/** * Add the widget to the dashboard **/ function addDashboardWidget() { # Check if the user is an admin if (ga_current_user_is(get_option(key_ga_dashboard_role))) { nxt_add_dashboard_widget('google-analytics-summary', __('Google Analytics Summary', 'google-analyticator'), array($this, 'widget')); } }
function woo_register_tumblog_dashboard_widget() { nxt_add_dashboard_widget('woo_tumblog_dashboard_widget', 'Tumblog', 'woo_tumblog_dashboard_widget_output'); // Globalize the metaboxes array, this holds all the widgets for nxt-admin global $nxt_meta_boxes; // Get the regular dashboard widgets array $normal_dashboard = $nxt_meta_boxes['dashboard']['normal']['core']; // Backup and delete dashboard widget from the end of the array $woo_tumblog_widget_backup = array('woo_tumblog_dashboard_widget' => $normal_dashboard['woo_tumblog_dashboard_widget']); unset($normal_dashboard['woo_tumblog_dashboard_widget']); // Merge the two arrays together so tumblog widget is at the beginning $sorted_dashboard = array_merge($woo_tumblog_widget_backup, $normal_dashboard); // Save the sorted array back into the original metaboxes $nxt_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard; }
/** * Adds an admin dashboard widget to any student-blog admin pages that shows * the student's word count for the current and previous weeks. * * @access private * @since 0.1 */ public function _add_student_dashboard_widget() { if (is_admin() && ClassBlogs_Utils::on_student_blog_admin()) { nxt_add_dashboard_widget('dashboard_' . $this->get_uid(), __('Word Count', 'classblogs'), array($this, '_handle_student_dashboard_widget')); } }
/** * Dashboard setup action * * @return void */ function nxt_dashboard_setup() { nxt_enqueue_style('w3tc-widget'); nxt_enqueue_script('w3tc-metadata'); nxt_enqueue_script('w3tc-widget'); if ($this->_config->get_boolean('widget.latest.enabled')) { nxt_add_dashboard_widget('w3tc_latest', 'The Latest from W3 EDGE', array(&$this, 'widget_latest'), array(&$this, 'widget_latest_control')); } if ($this->_config->get_boolean('widget.pagespeed.enabled')) { nxt_add_dashboard_widget('w3tc_pagespeed', 'W3 Total Cache: Google Page Speed Report', array(&$this, 'widget_pagespeed'), array(&$this, 'widget_pagespeed_control')); } }
function dashboard_widget_hook() { nxt_add_dashboard_widget('nxtw_dashboard_widget', 'Recent contributions to Wiki', array($this, 'dashboard_widget_function')); }
function wlcms_add_dashboard_widget_custom() { if (get_option('wlcms_o_show_welcome')) { if (wlcmsUserCompare(strtolower(get_option('wlcms_o_welcome_visible_to')), strtolower(wlcms_get_current_user_role()))) { nxt_add_dashboard_widget('custom_help_widget', get_option('wlcms_o_welcome_title'), 'wlcms_custom_dashboard_help'); } if (wlcmsUserCompare(strtolower(get_option('wlcms_o_welcome_visible_to1')), strtolower(wlcms_get_current_user_role()))) { nxt_add_dashboard_widget('my_dashboard_widget', get_option('wlcms_o_welcome_title1'), 'wlcms_custom_dashboard_help_new'); } } }
/** * Registers dashboard widgets. * * Handles POST data, sets up filters. * * @since 2.5.0 */ function nxt_dashboard_setup() { global $nxt_registered_widgets, $nxt_registered_widget_controls, $nxt_dashboard_control_callbacks; $nxt_dashboard_control_callbacks = array(); $screen = get_current_screen(); $update = false; $widget_options = get_option('dashboard_widget_options'); if (!$widget_options || !is_array($widget_options)) { $widget_options = array(); } /* Register Widgets and Controls */ $response = nxt_check_browser_version(); if ($response && $response['upgrade']) { add_filter('postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class'); if ($response['insecure']) { nxt_add_dashboard_widget('dashboard_browser_nag', __('You are using an insecure browser!'), 'nxt_dashboard_browser_nag'); } else { nxt_add_dashboard_widget('dashboard_browser_nag', __('Your browser is out of date!'), 'nxt_dashboard_browser_nag'); } } // Right Now if (is_blog_admin() && current_user_can('edit_posts')) { nxt_add_dashboard_widget('dashboard_right_now', __('Right Now'), 'nxt_dashboard_right_now'); } if (is_network_admin()) { nxt_add_dashboard_widget('network_dashboard_right_now', __('Right Now'), 'nxt_network_dashboard_right_now'); } // Recent Comments Widget if (is_blog_admin() && current_user_can('moderate_comments')) { if (!isset($widget_options['dashboard_recent_comments']) || !isset($widget_options['dashboard_recent_comments']['items'])) { $update = true; $widget_options['dashboard_recent_comments'] = array('items' => 5); } $recent_comments_title = __('Recent Comments'); nxt_add_dashboard_widget('dashboard_recent_comments', $recent_comments_title, 'nxt_dashboard_recent_comments', 'nxt_dashboard_recent_comments_control'); } // Incoming Links Widget if (is_blog_admin() && current_user_can('publish_posts')) { if (!isset($widget_options['dashboard_incoming_links']) || !isset($widget_options['dashboard_incoming_links']['home']) || $widget_options['dashboard_incoming_links']['home'] != get_option('home')) { $update = true; $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10; $widget_options['dashboard_incoming_links'] = array('home' => get_option('home'), 'link' => apply_filters('dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=nxtclass&q=link:' . trailingslashit(get_option('home'))), 'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters('dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url']) : apply_filters('dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=nxtclass&q=link:' . trailingslashit(get_option('home'))), 'items' => $num_items, 'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false); } nxt_add_dashboard_widget('dashboard_incoming_links', __('Incoming Links'), 'nxt_dashboard_incoming_links', 'nxt_dashboard_incoming_links_control'); } // nxt Plugins Widget if (!is_multisite() && is_blog_admin() && current_user_can('install_plugins') || is_network_admin() && current_user_can('manage_network_plugins') && current_user_can('install_plugins')) { nxt_add_dashboard_widget('dashboard_plugins', __('Plugins'), 'nxt_dashboard_plugins'); } // QuickPress Widget if (is_blog_admin() && current_user_can('edit_posts')) { nxt_add_dashboard_widget('dashboard_quick_press', __('QuickPress'), 'nxt_dashboard_quick_press'); } // Recent Drafts if (is_blog_admin() && current_user_can('edit_posts')) { nxt_add_dashboard_widget('dashboard_recent_drafts', __('Recent Drafts'), 'nxt_dashboard_recent_drafts'); } // Primary feed (Dev Blog) Widget if (!isset($widget_options['dashboard_primary'])) { $update = true; $widget_options['dashboard_primary'] = array('link' => apply_filters('dashboard_primary_link', __('http://nxtclass.org/news/')), 'url' => apply_filters('dashboard_primary_feed', __('http://nxtclass.org/news/feed/')), 'title' => apply_filters('dashboard_primary_title', __('NXTClass Blog')), 'items' => 2, 'show_summary' => 1, 'show_author' => 0, 'show_date' => 1); } nxt_add_dashboard_widget('dashboard_primary', $widget_options['dashboard_primary']['title'], 'nxt_dashboard_primary', 'nxt_dashboard_primary_control'); // Secondary Feed (Planet) Widget if (!isset($widget_options['dashboard_secondary'])) { $update = true; $widget_options['dashboard_secondary'] = array('link' => apply_filters('dashboard_secondary_link', __('http://planet.nxtclass.org/')), 'url' => apply_filters('dashboard_secondary_feed', __('http://planet.nxtclass.org/feed/')), 'title' => apply_filters('dashboard_secondary_title', __('Other NXTClass News')), 'items' => 5, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0); } nxt_add_dashboard_widget('dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'nxt_dashboard_secondary', 'nxt_dashboard_secondary_control'); // Hook to register new widgets // Filter widget order if (is_network_admin()) { do_action('nxt_network_dashboard_setup'); $dashboard_widgets = apply_filters('nxt_network_dashboard_widgets', array()); } elseif (is_user_admin()) { do_action('nxt_user_dashboard_setup'); $dashboard_widgets = apply_filters('nxt_user_dashboard_widgets', array()); } else { do_action('nxt_dashboard_setup'); $dashboard_widgets = apply_filters('nxt_dashboard_widgets', array()); } foreach ($dashboard_widgets as $widget_id) { $name = empty($nxt_registered_widgets[$widget_id]['all_link']) ? $nxt_registered_widgets[$widget_id]['name'] : $nxt_registered_widgets[$widget_id]['name'] . " <a href='{$nxt_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __('View all') . '</a>'; nxt_add_dashboard_widget($widget_id, $name, $nxt_registered_widgets[$widget_id]['callback'], $nxt_registered_widget_controls[$widget_id]['callback']); } if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id'])) { ob_start(); // hack - but the same hack nxt-admin/widgets.php uses nxt_dashboard_trigger_widget_control($_POST['widget_id']); ob_end_clean(); nxt_redirect(remove_query_arg('edit')); exit; } if ($update) { update_option('dashboard_widget_options', $widget_options); } do_action('do_meta_boxes', $screen->id, 'normal', ''); do_action('do_meta_boxes', $screen->id, 'side', ''); }