AlkantarClanX12

Your IP : 216.73.217.24


Current Path : /www/capitalgmcbuickregina_830/public/wp-content/plugins/leadbox/lib/
Upload File :
Current File : /www/capitalgmcbuickregina_830/public/wp-content/plugins/leadbox/lib/dashboard.php

<?php

function remove_dashboard_widgets() {
  global $wp_meta_boxes;
  unset($wp_meta_boxes['dashboard']['normal']['core']['cerber_quick']);
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['meta_box_sortables']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_site_health']);
  //unset($wp_meta_boxes['dashboard']);
}

add_action('wp_dashboard_setup', 'remove_dashboard_widgets', 999999);
remove_action('welcome_panel', 'wp_welcome_panel');

function remove_core_updates(){
  global $wp_version;
  return (object) array('last_checked' => time(),'version_checked' => $wp_version,);
}

//THIS LINE DISABLE THE UPDATE OF CORE, PLUGINS AND THEMES
//add_filter('pre_site_transient_update_core','remove_core_updates');
//add_filter('pre_site_transient_update_plugins','remove_core_updates');
//add_filter('pre_site_transient_update_themes','remove_core_updates');

function remove_customize_page(){

  global $submenu;
  global $menu;

    //print_r($menu);
  $settings_index = -1;
  $stackable_index = -1;
  $kinsta_cache_index = -1;
  $cerber_index = -1;

  unset($submenu['themes.php'][5]);
  unset($submenu['themes.php'][6]);
  remove_menu_page('edit.php?post_type=landing-page');

  if(isset(wp_get_current_user()->caps['dealer-admin']) && wp_get_current_user()->caps['dealer-admin'])
  {
    unset($submenu['edit.php?post_type=popup'][18]);
    unset($submenu['edit.php?post_type=popup'][19]);
    unset($submenu['edit.php?post_type=popup'][20]);
    unset($submenu['edit.php?post_type=popup'][21]);
    unset($submenu['edit.php?post_type=popup'][22]);
    unset($submenu['ninja-forms'][4]);
    unset($submenu['ninja-forms'][5]);
    unset($submenu['ninja-forms'][6]);

    foreach($menu as $key => $value){
      if($value[0] == 'Settings')
      $settings_index = $key;
      if($value[2] == 'stackable')
        $stackable_index = $key;
      if($value[0] == 'Kinsta Cache')
        $kinsta_cache_index = $key;
      if($value[0] == 'WP Cerber')
        $cerber_index = $key;
        if($value[0] == 'Languages')
        $languajes_index = $key;
        if($value[2] == 'plugins.php')
        $plugins_index = $key;
    }

    unset($menu[25]);
    unset($menu[60]);
    unset($menu[75]);

    if($settings_index != -1)
      unset($menu[$settings_index]);
    if($stackable_index != -1)
      unset($menu[$stackable_index]);
    if($kinsta_cache_index != -1)
      unset($menu[$kinsta_cache_index]);
    if($cerber_index != -1)
      unset($menu[$cerber_index]);
      if($languajes_index != -1)
           unset($menu[$languajes_index]);
      if($plugins_index != -1)
      unset($menu[$plugins_index]);

  }

  if(isset(wp_get_current_user()->caps['editor']))
  {
    unset($submenu['edit.php?post_type=popup'][18]);
    unset($submenu['edit.php?post_type=popup'][19]);
    unset($submenu['edit.php?post_type=popup'][20]);
    unset($submenu['edit.php?post_type=popup'][21]);
    unset($submenu['edit.php?post_type=popup'][22]);
    unset($submenu['edit.php?post_type=popup'][27]); //posicion de las offers
    unset($submenu['ninja-forms'][4]);
    unset($submenu['ninja-forms'][5]);
    unset($submenu['ninja-forms'][6]);

    foreach($menu as $key => $value){
      if($value[0] == 'Settings')
        $settings_index = $key;
      if($value[2] == 'stackable')
        $stackable_index = $key;
      if($value[0] == 'Appearance')
        $appearance_index = $key;
      if($value[0] == 'Kinsta Cache')
        $kinsta_cache_index = $key;
      if($value[0] == 'WP Cerber')
        $cerber_index = $key;
        if($value[0] == 'Leadbox Settings')
        $leadbox_settings_index = $key;
        if($value[0] == 'Languages')
        $languajes_index = $key;
				if($value[2] == 'edit.php?post_type=offer') //*línea para Offers
				$offer_index = $key;
    }

     if($languajes_index != -1)
      unset($menu[$languajes_index]);
     if($leadbox_settings_index != -1)
      unset($menu[$leadbox_settings_index]);
    if($settings_index != -1)
      unset($menu[$settings_index]);
    if($stackable_index != -1)
      unset($menu[$stackable_index]);
    if($appearance_index != -1)
      unset($menu[$appearance_index]);
    if($kinsta_cache_index != -1)
      unset($menu[$kinsta_cache_index]);
    if($cerber_index != -1)
      unset($menu[$cerber_index]);
		if(isset($offer_index) && $offer_index != -1) //*condición para Offers
		unset($menu[$offer_index]);
  }
}

add_action('admin_menu', 'remove_customize_page', 9999);

function add_dashboard_widget()
{
    wp_add_dashboard_widget("leadbox-widget", "Leadbox", "leadbox_dashboard");
}

function leadbox_dashboard()
{
	echo '<iframe src="https://leadboxhq.com/internal/website-dashboard/" style="width: 100%; min-height: 1000px;"></iframe>';
}

add_action("wp_dashboard_setup", "add_dashboard_widget");