/**
  * Dashboard setup action
  *
  * @return void
  */
 function wp_dashboard_setup()
 {
     $nerser = Dispatcher::component('Extension_NewRelic_Service');
     $view = '';
     $view_application = $nerser->get_effective_application_id();
     $new_relic_configured = $this->_config->get_string(array('newrelic', 'api_key')) && $view_application != 0;
     if ($new_relic_configured) {
         $view_vis = sprintf("https://rpm.newrelic.com/accounts/%d/applications/%d", $nerser->get_account_id(), $nerser->get_effective_application_id());
         $view = '<div class="w3tc-widget-text"><a href="' . $view_vis . '">' . __('view visualizations', 'w3-total-cache') . '</a></div>';
     }
     Util_Widget::add('w3tc_new_relic', '<div class="w3tc-widget-newrelic-logo"></div>' . $view, array($this, 'widget_new_relic'), Util_Ui::admin_url('admin.php?page=w3tc_general#monitoring'), 'normal');
 }
Example #2
0
 /**
  * Registers dashboard widgets.
  *
  * Handles POST data, sets up filters.
  *
  * @since 0.9.2.6
  */
 public static function setup()
 {
     global $w3tc_registered_widgets, $w3tc_registered_widget_controls, $w3tc_dashboard_control_callbacks;
     $w3tc_dashboard_control_callbacks = array();
     $screen = get_current_screen();
     $update = false;
     $widget_options = get_option('w3tc_dashboard_widget_options');
     if (!$widget_options || !is_array($widget_options)) {
         $widget_options = array();
     }
     // Hook to register new widgets
     // Filter widget order
     if (is_network_admin()) {
         do_action('w3tc_network_dashboard_setup');
         $dashboard_widgets = apply_filters('w3tc_network_dashboard_widgets', array());
     } else {
         do_action('w3tc_widget_setup');
         $dashboard_widgets = apply_filters('w3tc_dashboard_widgets', array());
     }
     foreach ($dashboard_widgets as $widget_id) {
         $name = empty($w3tc_registered_widgets[$widget_id]['all_link']) ? $w3tc_registered_widgets[$widget_id]['name'] : $w3tc_registered_widgets[$widget_id]['name'] . " <a href='{$w3tc_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __('View all') . '</a>';
         Util_Widget::add($widget_id, $name, $w3tc_registered_widgets[$widget_id]['callback'], $w3tc_registered_widget_controls[$widget_id]['callback']);
     }
     if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id'])) {
         check_admin_referer('edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce');
         ob_start();
         // hack - but the same hack wp-admin/widgets.php uses
         Util_Widget::trigger_widget_control($_POST['widget_id']);
         ob_end_clean();
     }
     if ($update) {
         update_option('w3tc_dashboard_widget_options', $widget_options);
     }
     do_action('do_meta_boxes', $screen->id, 'normal', '');
     do_action('do_meta_boxes', $screen->id, 'side', '');
 }
 function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_usage_statistics', __('Usage Statistics', 'w3-total-cache'), array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_general#miscellaneous'), 'normal');
 }
 function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_usage_statistics', '<div class="w3tc-widget-w3tc-logo"></div>' . '<div class="w3tc-widget-text">' . __('Caching Statistics', 'w3-total-cache') . '</div>', array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_general#miscellaneous'), 'normal');
 }
 /**
  * Dashboard setup action
  *
  * @return void
  */
 function wp_dashboard_setup()
 {
     Util_Widget::add('w3tc_latest', __('Discussions', 'w3-total-cache'), array($this, 'widget_latest'), array($this, 'widget_latest_control'), 'side');
 }
 /**
  * Dashboard setup action
  *
  * @return void
  */
 function wp_dashboard_setup()
 {
     Util_Widget::add('w3tc_spreadtheword', '<div class="w3tc-widget-w3tc-logo"></div>' . '<div class="w3tc-widget-text">' . __('Spread the Word', 'w3-total-cache') . '</div>', array($this, 'widget_form'), null, 'normal');
 }
 /**
  * Dashboard setup action
  *
  * @return void
  */
 function wp_dashboard_setup()
 {
     Util_Widget::add('w3tc_services', '<div class="w3tc-widget-services-logo"></div>' . '<div class="w3tc-widget-text">' . __('Premium Services', 'w3-total-cache') . '</div>', array($this, 'widget_form'), null, 'normal');
 }
 public function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_highwinds', '<div class="w3tc-widget-highwinds-logo"></div>', array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_cdn'), 'normal');
 }
 function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_cloudflare', '<div class="w3tc_cloudflare_widget_logo"></div>', array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_general#cloudflare'), 'normal');
 }
 /**
  * Dashboard setup action
  *
  * @return void
  */
 function wp_dashboard_setup()
 {
     Util_Widget::add('w3tc_netdna', '<div class="w3tc-widget-netdna-logo"></div>', array($this, 'widget_netdna'), Util_Ui::admin_url('admin.php?page=w3tc_cdn'), 'normal');
 }
 /**
  * Dashboard setup action
  *
  * @return void
  */
 public function wp_dashboard_setup()
 {
     Util_Widget::add('w3tc_pagespeed', '<div class="w3tc-widget-pagespeed-logo"></div>' . '<div class="w3tc-widget-text">' . __('Page Speed Report', 'w3-total-cache') . '</div>', array($this, 'widget_pagespeed'), Util_Ui::admin_url('admin.php?page=w3tc_general#miscellaneous'), 'normal');
 }
 function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_cloudflare', __('CloudFlare', 'w3-total-cache'), array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_general#cloudflare'), 'normal');
 }