├── languages ├── dashboard-feeds-default.mo ├── dashboard-feeds-default.po └── dashboard-feeds.pot ├── .gitmodules ├── css └── dashboard-feeds-admin.css ├── changelog.txt ├── README.md └── dashboard-feeds.php /languages/dashboard-feeds-default.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpmudev/dashboard-feeds/master/languages/dashboard-feeds-default.mo -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/dash-notices"] 2 | path = lib/dash-notices 3 | url = git@bitbucket.org:incsub/wpmudev-dashboard-notification.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /css/dashboard-feeds-admin.css: -------------------------------------------------------------------------------- 1 | table.df_dashboard_widgets { width: 60%; } 2 | table.df_dashboard_widgets td { width: 100%; } 3 | table.df_dashboard_widgets td ul.df_extra_widgets_list { list-style: none; width: 100%; } 4 | table.df_dashboard_widgets td ul.df_extra_widgets_list li { margin-bottom: 40px; width: 100%; } 5 | -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | === Dashboard Feeds === 2 | Authors: Paul Menard (Incsub) 3 | 4 | == Changelog == 5 | 6 | = 2.0.4.4 = 7 | 2014-04-17 8 | * Corrected PHP notice reported on Add New Feed form 9 | * Test for WordPress 3.9 10 | 11 | = 2.0.4.4 = 12 | 2014-01-09 13 | * Cleanup some PHP notices from uninitialized variables. 14 | 15 | = 2.0.4.3 = 16 | 2013-12-28 17 | * Updated class WPMUDEV_Dashboard_Feed_Widget code for PHP 5.4.x Strict Standards notices. 18 | 19 | = 2.0.4.2 = 20 | 2013-12-28 21 | * Corrected issue with conversion of feed configurations for WordPress 3.8. 22 | * Better compatibility for WordPress 3.7.1 and lower 23 | * Changed UI screen to show feed items in a standard list table instead of multiple sets of forms. 24 | 25 | = 2.0.4.1 = 26 | 2013-12-14 27 | * Converted Primary and Secondary Feed configurations to extra feed configurations for WP 3.8 28 | * Added new settings checkbox to hide new WP 3.8 combined Primary and Secondary feed widget. 29 | * Added new settings checkboxes on feed configurations to control showinging feed on Site and/or Network Dashboards 30 | * Updated code for PHP 5.4.x Strict Standards notices 31 | 32 | = 2.0.4 = 33 | 2013-03-21 34 | * Bug fix for settings checkboxes not able to unset. 35 | * Moved JS to hide configure link to run in admin footer instead of admin head 36 | * Remove transient on primary site when settings are saved. 37 | 38 | = 2.0.3 = 39 | * Updated logic to enforce override of default Primary and Secondary feed widgets for all sites. Prior logic only worked for new sites. 40 | 41 | = 2.0.2 = 42 | * On Multisite corrected issue where Network controlled feeds were not properly being loaded for existing and new blogs. 43 | * On Multisite removed menu Settings. All Feeds are now controlled via Network only. 44 | 45 | = 2.0.1 = 46 | * Fixed warning from uninitialized extra feeds array http://premium.wpmudev.org/forums/topic/update-error-for-dashboard-feeds-plugin 47 | 48 | = 2.0 = 49 | * Added new Settings interface for configuring feeds. No more need to edit PHP code. 50 | * Extended functionality to allow any number of feed widgets to be shown on the Dashboard. 51 | * Works now for single WordPress as well as Multisite 52 | 53 | = 1.5.2 = 54 | * added feature for update of widgets when changed values of options in the file 'dashboard-feeds.php' 55 | 56 | = 1.5.1 = 57 | * Update plugin to overwrite the default feeds on all blogs on the network. 58 | * Compatible with WordPress 3.1 59 | 60 | = 1.5.0 = 61 | * Update 62 | 63 | = 1.0.0 = 64 | * Initial Release 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dashboard Feeds 2 | 3 | **INACTIVE NOTICE: This plugin is unsupported by WPMUDEV, we've published it here for those technical types who might want to fork and maintain it for their needs.** 4 | 5 | ## Translations 6 | 7 | Translation files can be found at https://github.com/wpmudev/translations 8 | 9 | ## Dashboard Feeds allows you to replace the WordPress news feeds in the dashboard with your very own. 10 | 11 | This is one of the easiest ways to personalize the dashboard and make users feel right at home on your site. Usually, after logging onto WordPress users see a snapshot of their site, can make a post with QuickPress, and are given two WordPress specific RSS feeds. Replace the WordPress Development feed with your own: 12 | 13 | ![Replace and change this feed with ease](http://premium.wpmudev.org/wp-content/uploads/2010/03/dashfeed1.gif) 14 | 15 | Replace the classic WordPress development feed 16 | 17 | Select feeds that enhance your network user experience. 18 | 19 | ![Replace and change the WordPress news feed with ease](http://premium.wpmudev.org/wp-content/uploads/2010/03/dashfeed2.gif) 20 | 21 | Replace and change the WordPress news feed with ease 22 | 23 | ##### Replace feeds with: 24 | 25 | * Your own news feeds, for promotions or help and support 26 | * Feeds from different sites relevant to the topics your users might cover 27 | * A news feed from the NY Times, BBC or any other newspaper 28 | * A whole host of other options 29 | 30 | Share relevant news with your users. Dashboard Feeds is the quick way to add custom news feeds to your site or network dashboard. 31 | 32 | ## Usage 33 | 34 | ### To Install: 35 | 36 | 1. Download the plugin file. 37 | 2. Unzip the file into a folder on your hard drive. 38 | 3. Upload the **_/dashboard-feeds/_** folder and all its contents to the **/wp-content/plugins/ **folder on your site. 39 | 4. Login to your admin panel for WordPress or Multisite and activate the plugin. Under Multisite you can Network activate (recommended) or activate in individual blogs. 40 | 41 | ### Configuration: 42 | 43 | * On Regular WordPress go to Settings > Dashboard Feeds. 44 | * On Multisite WordPress when Network activated go to Network > Settings > Dashboard Feeds 45 | 46 | On the Settings page you will see the default Primary and Secondary forms for the RSS Widgets. These are provided by WordPress and cannot be deleted. However they can be changed. You can also add more than the default two widgets. You can have as many RSS widgets as you want. To test it's working properly create a new blog and check inside it's blog dashboard. **Here's what the dashboard of a blog created before the plugin installed will look like:** 47 | 48 | ![Example of a dashboard of a blog created before dashboard feed plugin installed](https://premium.wpmudev.org/wp-content/uploads/2010/03/dash63.jpg) 49 | 50 | **Here's what the dashboard of a blog created after the plugin installed might look like:** 51 | 52 | ![Example of a dashboard of a blog created after dashboard feed plugin installed](https://premium.wpmudev.org/wp-content/uploads/2010/03/dash64.jpg) 53 | -------------------------------------------------------------------------------- /languages/dashboard-feeds-default.po: -------------------------------------------------------------------------------- 1 | # Translation of the WordPress plugin Dashboard Feeds 2.0.4.2 by Paul Menard (Incsub). 2 | # Copyright (C) 2013 Paul Menard (Incsub) 3 | # This file is distributed under the same license as the Dashboard Feeds package. 4 | # FIRST AUTHOR , 2013. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: Dashboard Feeds 2.0.4.2\n" 9 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/dashboard-feeds\n" 10 | "POT-Creation-Date: 2013-12-28 09:37-0600\n" 11 | "PO-Revision-Date: 2013-12-28 10:38-0500\n" 12 | "Last-Translator: Paul Menard \n" 13 | "Language-Team: \n" 14 | "MIME-Version: 1.0\n" 15 | "Content-Type: text/plain; charset=UTF-8\n" 16 | "Content-Transfer-Encoding: 8bit\n" 17 | "X-Poedit-Language: English\n" 18 | 19 | #: dashboard-feeds.php:207 20 | #: dashboard-feeds.php:208 21 | #: dashboard-feeds.php:216 22 | msgctxt "page label" 23 | msgid "Dashboard Feeds" 24 | msgstr "" 25 | 26 | #: dashboard-feeds.php:217 27 | msgctxt "menu label" 28 | msgid "Dashboard Feeds" 29 | msgstr "" 30 | 31 | #: dashboard-feeds.php:467 32 | msgid "The Feed item has been added." 33 | msgstr "" 34 | 35 | #: dashboard-feeds.php:468 36 | msgid "The Feed item has been updated." 37 | msgstr "" 38 | 39 | #: dashboard-feeds.php:469 40 | msgid "The Feed item has been deleted." 41 | msgstr "" 42 | 43 | #: dashboard-feeds.php:470 44 | msgid "Settings have been update." 45 | msgstr "" 46 | 47 | #: dashboard-feeds.php:490 48 | msgid "per Page" 49 | msgstr "" 50 | 51 | #: dashboard-feeds.php:504 52 | msgctxt "New Page Title" 53 | msgid "Dashboard Feed General Settings" 54 | msgstr "" 55 | 56 | #: dashboard-feeds.php:515 57 | msgctxt "New Page Title" 58 | msgid "Add New Dashboard Feed" 59 | msgstr "" 60 | 61 | #: dashboard-feeds.php:530 62 | msgctxt "New Page Title" 63 | msgid "Edit Dashboard Feed" 64 | msgstr "" 65 | 66 | #: dashboard-feeds.php:548 67 | msgctxt "New Page Title" 68 | msgid "Dashboard Feeds" 69 | msgstr "" 70 | 71 | #: dashboard-feeds.php:563 72 | msgid "General Settings" 73 | msgstr "" 74 | 75 | #: dashboard-feeds.php:591 76 | #: dashboard-feeds.php:744 77 | msgid "Submit" 78 | msgstr "" 79 | 80 | #: dashboard-feeds.php:592 81 | #: dashboard-feeds.php:745 82 | msgid "Cancel" 83 | msgstr "" 84 | 85 | #: dashboard-feeds.php:664 86 | msgid "Checked - This will remove the \"configure\" link on the widget header.(Recommended)
Unchecked - allow individual users to control this widget on their own Dashboards. When the feed is saved here again it will replace the custom settings." 87 | msgstr "" 88 | 89 | #: dashboard-feeds.php:682 90 | msgid "Give the feed a title (optional):" 91 | msgstr "" 92 | 93 | #: dashboard-feeds.php:686 94 | msgid "Enter Site URL:" 95 | msgstr "" 96 | 97 | #: dashboard-feeds.php:691 98 | msgid "Enter the RSS feed URL:" 99 | msgstr "" 100 | 101 | #: dashboard-feeds.php:701 102 | msgid "How many feed items would you like to display?" 103 | msgstr "" 104 | 105 | #: dashboard-feeds.php:707 106 | msgid "Display item full content? Unchecked - Will show only excerpt." 107 | msgstr "" 108 | 109 | #: dashboard-feeds.php:712 110 | msgid "Display item author if available?" 111 | msgstr "" 112 | 113 | #: dashboard-feeds.php:717 114 | msgid "Display item date?" 115 | msgstr "" 116 | 117 | #: dashboard-feeds.php:719 118 | msgid " You can now control the visibility of the Feed widget on the Dashboard. Unchecked - Hide the feed widget." 119 | msgstr "" 120 | 121 | #: dashboard-feeds.php:721 122 | msgid "Checked - Show this feed on Site Dashboard." 123 | msgstr "" 124 | 125 | #: dashboard-feeds.php:724 126 | msgid "Checked - Show this feed on Network Dashboard." 127 | msgstr "" 128 | 129 | #: dashboard-feeds.php:733 130 | msgid "WordPress Primary & Secondary Feed Widgets" 131 | msgstr "" 132 | 133 | #: dashboard-feeds.php:735 134 | msgid "WordPress 3.8 introduced some changes in the handling of the Dashboard Primary and Secondary Feed Widgets. Prior to WordPress 3.8 these were two separate widgets. In WordPress 3.8 these are now combined into a single widget. You can set the checkbox below to hide this combined widget from view. If you had previously defined Primary and Secondary feeds in this plugin, they will be automatically converted to individual widget items on your Dashboard." 135 | msgstr "" 136 | 137 | #: dashboard-feeds.php:738 138 | msgid "Check - Hide Combined Primary and Secondary Dashboard Feed Widget on Site." 139 | msgstr "" 140 | 141 | #: dashboard-feeds.php:740 142 | msgid "Check - Hide Combined Primary and Secondary Dashboard Feed Widget on Network." 143 | msgstr "" 144 | 145 | #: dashboard-feeds.php:939 146 | msgid "Title" 147 | msgstr "" 148 | 149 | #: dashboard-feeds.php:941 150 | msgid "Feed URL" 151 | msgstr "" 152 | 153 | #: dashboard-feeds.php:942 154 | msgid "Site URL" 155 | msgstr "" 156 | 157 | #: dashboard-feeds.php:943 158 | msgid "Meta" 159 | msgstr "" 160 | 161 | #: dashboard-feeds.php:973 162 | msgid "Edit" 163 | msgstr "" 164 | 165 | #: dashboard-feeds.php:978 166 | msgid "Delete" 167 | msgstr "" 168 | 169 | #: dashboard-feeds.php:1001 170 | msgid "Count" 171 | msgstr "" 172 | 173 | #: dashboard-feeds.php:1006 174 | msgid "Summary" 175 | msgstr "" 176 | 177 | #: dashboard-feeds.php:1007 178 | #: dashboard-feeds.php:1013 179 | #: dashboard-feeds.php:1019 180 | msgid "Yes" 181 | msgstr "" 182 | 183 | #: dashboard-feeds.php:1007 184 | #: dashboard-feeds.php:1013 185 | #: dashboard-feeds.php:1019 186 | msgid "No" 187 | msgstr "" 188 | 189 | #: dashboard-feeds.php:1012 190 | msgid "Author" 191 | msgstr "" 192 | 193 | #: dashboard-feeds.php:1018 194 | msgid "Date" 195 | msgstr "" 196 | 197 | #: dashboard-feeds.php:1025 198 | msgid "Show on" 199 | msgstr "" 200 | 201 | #: dashboard-feeds.php:1030 202 | msgid "Site" 203 | msgstr "" 204 | 205 | #: dashboard-feeds.php:1036 206 | msgid "Network" 207 | msgstr "" 208 | 209 | #: dashboard-feeds.php:1039 210 | msgid "None" 211 | msgstr "" 212 | 213 | #: dashboard-feeds.php:1122 214 | #, php-format 215 | msgid "RSS Error: %s" 216 | msgstr "" 217 | 218 | #. Plugin Name of the plugin/theme 219 | msgid "Dashboard Feeds" 220 | msgstr "" 221 | 222 | #. Plugin URI of the plugin/theme 223 | msgid "http://premium.wpmudev.org/project/dashboard-feeds" 224 | msgstr "" 225 | 226 | #. Description of the plugin/theme 227 | msgid "Customize the dashboard for every user in a flash with this straightforward dashboard feed replacement widget... no more WP development news or Matt's latest photo set :)" 228 | msgstr "" 229 | 230 | #. Author of the plugin/theme 231 | msgid "Paul Menard (Incsub)" 232 | msgstr "" 233 | 234 | #. Author URI of the plugin/theme 235 | msgid "http://premium.wpmudev.org" 236 | msgstr "" 237 | 238 | -------------------------------------------------------------------------------- /languages/dashboard-feeds.pot: -------------------------------------------------------------------------------- 1 | # Translation of the WordPress plugin Dashboard Feeds 2.0.4.2 by Paul Menard (Incsub). 2 | # Copyright (C) 2013 Paul Menard (Incsub) 3 | # This file is distributed under the same license as the Dashboard Feeds package. 4 | # FIRST AUTHOR , 2013. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Dashboard Feeds 2.0.4.2\n" 10 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/dashboard-feeds\n" 11 | "POT-Creation-Date: 2013-12-28 09:37-0600\n" 12 | "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=utf-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | 19 | #: dashboard-feeds.php:207 dashboard-feeds.php:208 dashboard-feeds.php:216 20 | msgctxt "page label" 21 | msgid "Dashboard Feeds" 22 | msgstr "" 23 | 24 | #: dashboard-feeds.php:217 25 | msgctxt "menu label" 26 | msgid "Dashboard Feeds" 27 | msgstr "" 28 | 29 | #: dashboard-feeds.php:467 30 | msgid "The Feed item has been added." 31 | msgstr "" 32 | 33 | #: dashboard-feeds.php:468 34 | msgid "The Feed item has been updated." 35 | msgstr "" 36 | 37 | #: dashboard-feeds.php:469 38 | msgid "The Feed item has been deleted." 39 | msgstr "" 40 | 41 | #: dashboard-feeds.php:470 42 | msgid "Settings have been update." 43 | msgstr "" 44 | 45 | #: dashboard-feeds.php:490 46 | msgid "per Page" 47 | msgstr "" 48 | 49 | #: dashboard-feeds.php:504 50 | msgctxt "New Page Title" 51 | msgid "Dashboard Feed General Settings" 52 | msgstr "" 53 | 54 | #: dashboard-feeds.php:515 55 | msgctxt "New Page Title" 56 | msgid "Add New Dashboard Feed" 57 | msgstr "" 58 | 59 | #: dashboard-feeds.php:530 60 | msgctxt "New Page Title" 61 | msgid "Edit Dashboard Feed" 62 | msgstr "" 63 | 64 | #: dashboard-feeds.php:548 65 | msgctxt "New Page Title" 66 | msgid "Dashboard Feeds" 67 | msgstr "" 68 | 69 | #: dashboard-feeds.php:563 70 | msgid "General Settings" 71 | msgstr "" 72 | 73 | #: dashboard-feeds.php:591 dashboard-feeds.php:744 74 | msgid "Submit" 75 | msgstr "" 76 | 77 | #: dashboard-feeds.php:592 dashboard-feeds.php:745 78 | msgid "Cancel" 79 | msgstr "" 80 | 81 | #: dashboard-feeds.php:664 82 | msgid "" 83 | "Checked - This will remove the \"configure\" link on the widget header." 84 | "(Recommended)
Unchecked - allow individual users to control this widget " 85 | "on their own Dashboards. When the feed is saved here again it will replace " 86 | "the custom settings." 87 | msgstr "" 88 | 89 | #: dashboard-feeds.php:682 90 | msgid "Give the feed a title (optional):" 91 | msgstr "" 92 | 93 | #: dashboard-feeds.php:686 94 | msgid "Enter Site URL:" 95 | msgstr "" 96 | 97 | #: dashboard-feeds.php:691 98 | msgid "Enter the RSS feed URL:" 99 | msgstr "" 100 | 101 | #: dashboard-feeds.php:701 102 | msgid "How many feed items would you like to display?" 103 | msgstr "" 104 | 105 | #: dashboard-feeds.php:707 106 | msgid "Display item full content? Unchecked - Will show only excerpt." 107 | msgstr "" 108 | 109 | #: dashboard-feeds.php:712 110 | msgid "Display item author if available?" 111 | msgstr "" 112 | 113 | #: dashboard-feeds.php:717 114 | msgid "Display item date?" 115 | msgstr "" 116 | 117 | #: dashboard-feeds.php:719 118 | msgid "" 119 | " You can now control the visibility of the Feed widget on the Dashboard. " 120 | "Unchecked - Hide the feed widget." 121 | msgstr "" 122 | 123 | #: dashboard-feeds.php:721 124 | msgid "Checked - Show this feed on Site Dashboard." 125 | msgstr "" 126 | 127 | #: dashboard-feeds.php:724 128 | msgid "Checked - Show this feed on Network Dashboard." 129 | msgstr "" 130 | 131 | #: dashboard-feeds.php:733 132 | msgid "WordPress Primary & Secondary Feed Widgets" 133 | msgstr "" 134 | 135 | #: dashboard-feeds.php:735 136 | msgid "" 137 | "WordPress 3.8 introduced some changes in the handling of the Dashboard " 138 | "Primary and Secondary Feed Widgets. Prior to WordPress 3.8 these were two " 139 | "separate widgets. In WordPress 3.8 these are now combined into a single " 140 | "widget. You can set the checkbox below to hide this combined widget from " 141 | "view. If you had previously defined Primary and Secondary feeds in this " 142 | "plugin, they will be automatically converted to individual widget items on " 143 | "your Dashboard." 144 | msgstr "" 145 | 146 | #: dashboard-feeds.php:738 147 | msgid "" 148 | "Check - Hide Combined Primary and Secondary Dashboard Feed Widget on Site." 149 | msgstr "" 150 | 151 | #: dashboard-feeds.php:740 152 | msgid "" 153 | "Check - Hide Combined Primary and Secondary Dashboard Feed Widget on Network." 154 | msgstr "" 155 | 156 | #: dashboard-feeds.php:939 157 | msgid "Title" 158 | msgstr "" 159 | 160 | #: dashboard-feeds.php:941 161 | msgid "Feed URL" 162 | msgstr "" 163 | 164 | #: dashboard-feeds.php:942 165 | msgid "Site URL" 166 | msgstr "" 167 | 168 | #: dashboard-feeds.php:943 169 | msgid "Meta" 170 | msgstr "" 171 | 172 | #: dashboard-feeds.php:973 173 | msgid "Edit" 174 | msgstr "" 175 | 176 | #: dashboard-feeds.php:978 177 | msgid "Delete" 178 | msgstr "" 179 | 180 | #: dashboard-feeds.php:1001 181 | msgid "Count" 182 | msgstr "" 183 | 184 | #: dashboard-feeds.php:1006 185 | msgid "Summary" 186 | msgstr "" 187 | 188 | #: dashboard-feeds.php:1007 dashboard-feeds.php:1013 dashboard-feeds.php:1019 189 | msgid "Yes" 190 | msgstr "" 191 | 192 | #: dashboard-feeds.php:1007 dashboard-feeds.php:1013 dashboard-feeds.php:1019 193 | msgid "No" 194 | msgstr "" 195 | 196 | #: dashboard-feeds.php:1012 197 | msgid "Author" 198 | msgstr "" 199 | 200 | #: dashboard-feeds.php:1018 201 | msgid "Date" 202 | msgstr "" 203 | 204 | #: dashboard-feeds.php:1025 205 | msgid "Show on" 206 | msgstr "" 207 | 208 | #: dashboard-feeds.php:1030 209 | msgid "Site" 210 | msgstr "" 211 | 212 | #: dashboard-feeds.php:1036 213 | msgid "Network" 214 | msgstr "" 215 | 216 | #: dashboard-feeds.php:1039 217 | msgid "None" 218 | msgstr "" 219 | 220 | #: dashboard-feeds.php:1122 221 | #, php-format 222 | msgid "RSS Error: %s" 223 | msgstr "" 224 | 225 | #. Plugin Name of the plugin/theme 226 | msgid "Dashboard Feeds" 227 | msgstr "" 228 | 229 | #. Plugin URI of the plugin/theme 230 | msgid "http://premium.wpmudev.org/project/dashboard-feeds" 231 | msgstr "" 232 | 233 | #. Description of the plugin/theme 234 | msgid "" 235 | "Customize the dashboard for every user in a flash with this straightforward " 236 | "dashboard feed replacement widget... no more WP development news or Matt's " 237 | "latest photo set :)" 238 | msgstr "" 239 | 240 | #. Author of the plugin/theme 241 | msgid "Paul Menard (Incsub)" 242 | msgstr "" 243 | 244 | #. Author URI of the plugin/theme 245 | msgid "http://premium.wpmudev.org" 246 | msgstr "" 247 | -------------------------------------------------------------------------------- /dashboard-feeds.php: -------------------------------------------------------------------------------- 1 | _settings['VERSION'] = "2.0.4.5"; 44 | 45 | // Support for WPMU DEV Dashboard plugin 46 | global $wpmudev_notices; 47 | $wpmudev_notices[] = array( 'id'=> 15,'name'=> 'Dashboard Feeds', 'screens' => array('settings_page_dashboard-feeds-network') ); 48 | require_once( dirname(__FILE__) . '/lib/dash-notices/wpmudev-dash-notification.php'); 49 | 50 | //add_action( 'init', array(&$this, 'init_proc') ); 51 | //add_action( 'admin_init', array(&$this, 'admin_init_proc') ); 52 | 53 | // We on;y try the filtering on 3.7.1 of WordPress and lower. The rest we ignore. 54 | //global $wp_version; 55 | //$version_compare = version_compare($wp_version, '3.7.1'); 56 | //if (0 >= $version_compare) { 57 | // add_filter( 'option_dashboard_widget_options', array(&$this, 'option_dashboard_widget_options_filter') ); 58 | //} 59 | 60 | add_action( 'admin_footer', array(&$this, 'admin_footer_proc'), 1 ); 61 | add_action( 'admin_menu', array(&$this, 'admin_menu_proc'), 1 ); 62 | add_action( 'network_admin_menu', array(&$this, 'admin_menu_proc'), 1 ); 63 | 64 | add_action( 'wp_dashboard_setup', array(&$this, 'add_dashboard_widgets'), 99 ); 65 | add_action( 'wp_network_dashboard_setup', array(&$this, 'add_dashboard_widgets'), 99 ); 66 | add_action( 'wp_user_dashboard_setup', array(&$this, 'add_dashboard_widgets'), 99 ); 67 | 68 | load_plugin_textdomain( 'dashboard-feeds', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 69 | } 70 | 71 | function WPMUDEV_Dashboard_Feeds() { 72 | $this->__construct(); 73 | } 74 | 75 | function admin_footer_proc() { 76 | $js_commands = ''; 77 | 78 | // We only want to add this for the Dashboard and/or Network Dashboard screens 79 | $screen = get_current_screen(); 80 | if (($screen->id != "dashboard") && ($screen->id != "dashboard-network")) return; 81 | 82 | $df_settings = $this->get_df_widget_settings(); 83 | //echo "df_settings
"; print_r($df_settings); echo "
"; 84 | //die(); 85 | 86 | if (is_multisite()) { 87 | $df_widgets = $this->get_df_feed_widgets_items(); 88 | //echo "df_widgets
"; print_r($df_widgets); echo "
"; 89 | if (is_network_admin()) { 90 | if ((isset($df_settings['wordpress-feed-widget'])) && ($df_settings['wordpress-feed-widget']['network'] == "on")) { 91 | $js_commands .= "jQuery('div#dashboard_primary').hide(); "; 92 | $js_commands .= "var input_hide = jQuery('div.metabox-prefs input#dashboard_primary-hide'); jQuery(input_hide).hide(); "; 93 | $js_commands .= "var label_hide = jQuery(input_hide).parent('label'); jQuery(label_hide).hide();"; 94 | } 95 | 96 | if (isset($df_widgets['df-dashboard_primary'])) { 97 | if ((!isset($df_widgets['df-dashboard_primary']['show-on']['network'])) 98 | || ($df_widgets['df-dashboard_primary']['show-on']['network'] != 'on')) { 99 | 100 | $js_commands .= "jQuery('div#dashboard_primary').hide(); "; 101 | $js_commands .= "var input_hide_primary = jQuery('div.metabox-prefs input#dashboard_primary-hide'); jQuery(input_hide_primary).hide(); "; 102 | $js_commands .= "var label_hide_primary = jQuery(input_hide_primary).parent('label'); jQuery(label_hide_primary).hide();"; 103 | } 104 | } 105 | 106 | if (isset($df_widgets['df-dashboard_secondary'])) { 107 | if ((!isset($df_widgets['df-dashboard_secondary']['show-on']['network'])) 108 | || ($df_widgets['df-dashboard_secondary']['show-on']['network'] != 'on')) { 109 | 110 | $js_commands .= "jQuery('div#dashboard_secondary').hide(); "; 111 | $js_commands .= "var input_hide_secondary = jQuery('div.metabox-prefs input#dashboard_secondary-hide'); jQuery(input_hide_secondary).hide(); "; 112 | $js_commands .= "var label_hide_secondary = jQuery(input_hide_secondary).parent('label'); jQuery(label_hide_secondary).hide();"; 113 | } 114 | } 115 | } else { 116 | if ((isset($df_settings['wordpress-feed-widget'])) && ($df_settings['wordpress-feed-widget']['site'] == "on")) { 117 | $js_commands .= "jQuery('div#dashboard_primary').hide(); "; 118 | $js_commands .= "var input_hide = jQuery('div.metabox-prefs input#dashboard_primary-hide'); jQuery(input_hide).hide(); "; 119 | $js_commands .= "var label_hide = jQuery(input_hide).parent('label'); jQuery(label_hide).hide();"; 120 | } 121 | 122 | if (isset($df_widgets['df-dashboard_primary'])) { 123 | if ((!isset($df_widgets['df-dashboard_primary']['show-on']['site'])) 124 | || ($df_widgets['df-dashboard_primary']['show-on']['site'] != 'on')) { 125 | 126 | $js_commands .= "jQuery('div#dashboard_primary').hide(); "; 127 | $js_commands .= "var input_hide_primary = jQuery('div.metabox-prefs input#dashboard_primary-hide'); jQuery(input_hide_primary).hide(); "; 128 | $js_commands .= "var label_hide_primary = jQuery(input_hide_primary).parent('label'); jQuery(label_hide_primary).hide();"; 129 | 130 | } 131 | } 132 | 133 | if (isset($df_widgets['df-dashboard_secondary'])) { 134 | if ((!isset($df_widgets['df-dashboard_secondary']['show-on']['site'])) 135 | || ($df_widgets['df-dashboard_secondary']['show-on']['site'] != 'on')) { 136 | 137 | $js_commands .= "jQuery('div#dashboard_secondary').hide(); "; 138 | $js_commands .= "var input_hide_secondary = jQuery('div.metabox-prefs input#dashboard_secondary-hide'); jQuery(input_hide_secondary).hide(); "; 139 | $js_commands .= "var label_hide_secondary = jQuery(input_hide_secondary).parent('label'); jQuery(label_hide_secondary).hide();"; 140 | } 141 | } 142 | } 143 | } 144 | 145 | 146 | if (isset($df_settings['force-dashboard_primary'])) { 147 | $js_commands .= "jQuery('div#dashboard_primary span.postbox-title-action').hide(); "; 148 | } 149 | if (isset($df_settings['force-dashboard_secondary'])) { 150 | $js_commands .= "jQuery('div#dashboard_secondary span.postbox-title-action').hide(); "; 151 | } 152 | if (strlen($js_commands)) { 153 | ?> 154 | 161 | get_df_widget_settings(); 178 | $df_widgets = $this->get_df_feed_widgets_items(); 179 | 180 | // Enforce Primary Widget rules. 181 | if (isset($widget_options['dashboard_primary'])) { 182 | if ((isset($df_settings['force-dashboard_primary'])) && ($df_settings['force-dashboard_primary'] == "on")) { 183 | if (isset($df_widgets['df-dashboard_primary'])) { 184 | $widget_options['dashboard_primary'] = $df_widgets['df-dashboard_primary']; 185 | } 186 | } 187 | } else { 188 | if (isset($df_widget['df-dashboard_primary'])) { 189 | $widget_options['dashboard_primary'] = $df_widget['df-dashboard_primary']; 190 | } 191 | } 192 | 193 | // Enforce Seconday Widget rules. 194 | if (isset($widget_options['dashboard_secondary'])) { 195 | if ((isset($df_settings['force-dashboard_secondary'])) && ($df_settings['force-dashboard_secondary'] == "on")) { 196 | if (isset($df_widgets['df-dashboard_secondary'])) { 197 | $widget_options['dashboard_secondary'] = $df_widgets['df-dashboard_secondary']; 198 | } 199 | } 200 | } else { 201 | if (isset($df_widget['df-dashboard_secondary'])) { 202 | $widget_options['dashboard_secondary'] = $df_widget['df-dashboard_secondary']; 203 | } 204 | } 205 | return $widget_options; 206 | } 207 | */ 208 | function admin_menu_proc() { 209 | if (is_multisite()) { 210 | if (is_network_admin()) { 211 | $this->_pagehooks['dashboard-feeds'] = add_submenu_page('settings.php', 212 | _x("Dashboard Feeds", 'page label', 'dashboard-feeds'), 213 | _x("Dashboard Feeds", 'page label', 'dashboard-feeds'), 214 | 'manage_network', 215 | 'dashboard-feeds', 216 | array($this, 'settings_show_panel') 217 | ); 218 | add_action('load-'. $this->_pagehooks['dashboard-feeds'], array(&$this, 'settings_panel_on_load')); 219 | } 220 | } else if (!is_multisite()) { 221 | $this->_pagehooks['dashboard-feeds'] = add_options_page( 222 | _x("Dashboard Feeds", 'page label', 'dashboard-feeds'), 223 | _x("Dashboard Feeds", 'menu label', 'dashboard-feeds'), 224 | 'manage_options', 225 | 'dashboard-feeds', 226 | array($this, 'settings_show_panel') 227 | ); 228 | add_action('load-'. $this->_pagehooks['dashboard-feeds'], array(&$this, 'settings_panel_on_load')); 229 | } 230 | } 231 | 232 | function settings_panel_on_load() { 233 | 234 | if (isset($_POST['df-form-submit'])) { 235 | 236 | if ((isset($_GET['subpage'])) && ($_GET['subpage'] == "general-settings")) { 237 | //echo "_POST
"; print_r($_POST); echo "
"; 238 | //die(); 239 | 240 | if (isset($_POST['df_settings'])) { 241 | $df_settings = $this->get_df_widget_settings(); 242 | 243 | if (isset($_POST['df_settings']['wordpress-feed-widget']['site'])) { 244 | $df_settings['wordpress-feed-widget']['site'] = 'on'; 245 | } else { 246 | $df_settings['wordpress-feed-widget']['site'] = false; 247 | } 248 | if (isset($_POST['df_settings']['wordpress-feed-widget']['network'])) { 249 | $df_settings['wordpress-feed-widget']['network'] = 'on'; 250 | } else { 251 | $df_settings['wordpress-feed-widget']['network'] = false; 252 | } 253 | $this->set_df_widget_settings($df_settings); 254 | } 255 | 256 | $return_url = remove_query_arg(array('subpage', 'nonce', 'action', 'number')); 257 | $return_url = add_query_arg('message', 'success-settings', $return_url); 258 | wp_redirect($return_url); 259 | die(); 260 | 261 | } else if (isset($_POST['widget-rss'])) { 262 | $df_widgets = $this->get_df_feed_widgets_items(); 263 | if ((!$df_widgets) || (!is_array($df_widgets))) 264 | $df_widgets = array(); 265 | 266 | if (isset($_POST['widget-rss']['df-new'])) { 267 | $widget_count = 1; 268 | while(true) { 269 | $widget_id = sprintf("df-%d", $widget_count); 270 | if (!isset($df_widgets[$widget_id])) { 271 | break; 272 | } else { 273 | $widget_count += 1; 274 | } 275 | } 276 | 277 | $df_widgets[$widget_id] = array(); 278 | 279 | if (isset($_POST['widget-rss']['df-new']['link'])) 280 | $df_widgets[$widget_id]['link'] = esc_url($_POST['widget-rss']['df-new']['link']); 281 | else 282 | $df_widgets[$widget_id]['link'] = ''; 283 | 284 | if (isset($_POST['widget-rss']['df-new']['url'])) 285 | $df_widgets[$widget_id]['url'] = esc_url($_POST['widget-rss']['df-new']['url']); 286 | else 287 | $df_widgets[$widget_id]['url'] = ''; 288 | 289 | if (isset($_POST['widget-rss']['df-new']['title'])) 290 | $df_widgets[$widget_id]['title'] = esc_attr($_POST['widget-rss']['df-new']['title']); 291 | else 292 | $df_widgets[$widget_id]['title'] = ''; 293 | 294 | if (isset($_POST['widget-rss']['df-new']['items'])) 295 | $df_widgets[$widget_id]['items'] = intval($_POST['widget-rss']['df-new']['items']); 296 | else 297 | $df_widgets[$widget_id]['items'] = 10; 298 | 299 | if (isset($_POST['widget-rss']['df-new']['show_summary'])) 300 | $df_widgets[$widget_id]['show_summary'] = intval($_POST['widget-rss']['df-new']['show_summary']); 301 | else 302 | $df_widgets[$widget_id]['show_summary'] = false; 303 | 304 | if (isset($_POST['widget-rss']['df-new']['show_author'])) 305 | $df_widgets[$widget_id]['show_author'] = intval($_POST['widget-rss']['df-new']['show_author']); 306 | else 307 | $df_widgets[$widget_id]['show_author'] = false; 308 | 309 | if (isset($_POST['widget-rss']['df-new']['show_date'])) 310 | $df_widgets[$widget_id]['show_date'] = intval($_POST['widget-rss']['df-new']['show_date']); 311 | else 312 | $df_widgets[$widget_id]['show_date'] = false; 313 | 314 | if (isset($_POST['widget-rss']['df-new']['show-on'])) { 315 | if (isset($_POST['widget-rss']['df-new']['show-on']['network'])) 316 | $df_widgets[$widget_id]['show-on']['network'] = esc_attr($_POST['widget-rss']['df-new']['show-on']['network']); 317 | else 318 | $df_widgets[$widget_id]['show-on']['network'] = false; 319 | 320 | if (isset($_POST['widget-rss']['df-new']['show-on']['site'])) 321 | $df_widgets[$widget_id]['show-on']['site'] = esc_attr($_POST['widget-rss']['df-new']['show-on']['site']); 322 | else 323 | $df_widgets[$widget_id]['show-on']['site'] = false; 324 | 325 | } else { 326 | $df_widgets[$widget_id]['show-on'] = array(); 327 | $df_widgets[$widget_id]['show-on']['network'] = false; 328 | $df_widgets[$widget_id]['show-on']['site'] = false; 329 | } 330 | $this->set_df_feed_widgets_items($df_widgets); 331 | 332 | $return_url = remove_query_arg(array('nonce', 'action', 'number')); 333 | $return_url = add_query_arg('message', 'success-add', $return_url); 334 | wp_redirect($return_url); 335 | die(); 336 | 337 | } else { 338 | //$df_widgets = $this->get_df_feed_widgets_items(); 339 | //echo "df_widgets
"; print_r($df_widgets); echo "
"; 340 | //echo "_POST
"; print_r($_POST); echo "
"; 341 | //die(); 342 | 343 | foreach($_POST['widget-rss'] as $widget_id => $widget_options) { 344 | // We want to remove the existing widget item. Then readd. 345 | if (!isset($df_widgets[$widget_id])) continue; 346 | 347 | $df_widgets[$widget_id] = array(); 348 | 349 | if (isset($_POST['widget-rss'][$widget_id]['link'])) 350 | $df_widgets[$widget_id]['link'] = esc_url($_POST['widget-rss'][$widget_id]['link']); 351 | else 352 | $df_widgets[$widget_id]['link'] = ''; 353 | 354 | if (isset($_POST['widget-rss'][$widget_id]['url'])) 355 | $df_widgets[$widget_id]['url'] = esc_url($_POST['widget-rss'][$widget_id]['url']); 356 | else 357 | $df_widgets[$widget_id]['url'] = ''; 358 | 359 | if (isset($_POST['widget-rss'][$widget_id]['title'])) 360 | $df_widgets[$widget_id]['title'] = esc_attr($_POST['widget-rss'][$widget_id]['title']); 361 | else 362 | $df_widgets[$widget_id]['title'] = ''; 363 | 364 | if (isset($_POST['widget-rss'][$widget_id]['items'])) 365 | $df_widgets[$widget_id]['items'] = intval($_POST['widget-rss'][$widget_id]['items']); 366 | else 367 | $df_widgets[$widget_id]['items'] = 10; 368 | 369 | if (isset($_POST['widget-rss'][$widget_id]['show_summary'])) 370 | $df_widgets[$widget_id]['show_summary'] = intval($_POST['widget-rss'][$widget_id]['show_summary']); 371 | else 372 | $df_widgets[$widget_id]['show_summary'] = false; 373 | 374 | if (isset($_POST['widget-rss'][$widget_id]['show_author'])) 375 | $df_widgets[$widget_id]['show_author'] = intval($_POST['widget-rss'][$widget_id]['show_author']); 376 | else 377 | $df_widgets[$widget_id]['show_author'] = false; 378 | 379 | if (isset($_POST['widget-rss'][$widget_id]['show_date'])) 380 | $df_widgets[$widget_id]['show_date'] = intval($_POST['widget-rss'][$widget_id]['show_date']); 381 | else 382 | $df_widgets[$widget_id]['show_date'] = false; 383 | 384 | if (isset($_POST['widget-rss'][$widget_id]['show-on'])) { 385 | if (isset($_POST['widget-rss'][$widget_id]['show-on']['network'])) 386 | $df_widgets[$widget_id]['show-on']['network'] = esc_attr($_POST['widget-rss'][$widget_id]['show-on']['network']); 387 | else 388 | $df_widgets[$widget_id]['show-on']['network'] = false; 389 | 390 | if (isset($_POST['widget-rss'][$widget_id]['show-on']['site'])) 391 | $df_widgets[$widget_id]['show-on']['site'] = esc_attr($_POST['widget-rss'][$widget_id]['show-on']['site']); 392 | else 393 | $df_widgets[$widget_id]['show-on']['site'] = false; 394 | } else { 395 | $df_widgets[$widget_id]['show-on'] = array(); 396 | $df_widgets[$widget_id]['show-on']['network'] = false; 397 | $df_widgets[$widget_id]['show-on']['site'] = false; 398 | } 399 | 400 | $this->set_df_feed_widgets_items($df_widgets); 401 | 402 | if (($widget_id == 'df-dashboard_primary') || ($widget_id == 'df-dashboard_secondary')) { 403 | $wp_widgets = get_option('dashboard_widget_options'); 404 | if ($widget_id == 'df-dashboard_primary') { 405 | $wp_widgets['dashboard_primary'] = $df_widgets[$widget_id]; 406 | 407 | $cache_key = 'dash_' . md5( 'dashboard_primary' ); 408 | delete_transient( $cache_key ); 409 | $feed_name = 'feed_' . $cache_key; 410 | delete_transient( $feed_name ); 411 | $feed_mod_name = 'feed_mod_' . $cache_key; 412 | delete_transient( $feed_mod_name ); 413 | 414 | $df_settings = $this->get_df_widget_settings(); 415 | if (isset($_POST['df_settings']['force-dashboard_primary'])) { 416 | $df_settings['force-dashboard_primary'] = 'on'; 417 | } else { 418 | if (isset($df_settings['force-dashboard_primary'])) { 419 | unset($df_settings['force-dashboard_primary']); 420 | } 421 | } 422 | $this->set_df_widget_settings($df_settings); 423 | } 424 | if ($widget_id == 'df-dashboard_secondary') { 425 | $wp_widgets['dashboard_secondary'] = $df_widgets[$widget_id]; 426 | 427 | $cache_key = 'dash_' . md5( 'dashboard_secondary' ); 428 | delete_transient( $cache_key ); 429 | $feed_name = 'feed_' . $cache_key; 430 | delete_transient( $feed_name ); 431 | $feed_mod_name = 'feed_mod_' . $cache_key; 432 | delete_transient( $feed_mod_name ); 433 | 434 | $df_settings = $this->get_df_widget_settings(); 435 | if (isset($_POST['df_settings']['force-dashboard_secondary'])) { 436 | $df_settings['force-dashboard_secondary'] = 'on'; 437 | } else { 438 | if (isset($df_settings['force-dashboard_secondary'])) { 439 | unset($df_settings['force-dashboard_secondary']); 440 | } 441 | } 442 | $this->set_df_widget_settings($df_settings); 443 | } 444 | update_option('dashboard_widget_options', $wp_widgets); 445 | } 446 | 447 | $cache_key = 'dash_' . md5( $widget_id ); 448 | delete_transient( $cache_key ); 449 | $feed_name = 'feed_' . $cache_key; 450 | delete_transient( $feed_name ); 451 | $feed_mod_name = 'feed_mod_' . $cache_key; 452 | delete_transient( $feed_mod_name ); 453 | 454 | $return_url = remove_query_arg(array('nonce', 'action', 'number')); 455 | $return_url = add_query_arg('message', 'success-update', $return_url); 456 | wp_redirect($return_url); 457 | die(); 458 | } 459 | } 460 | } 461 | } else if ((isset($_GET['action'])) && ($_GET['action'] == "delete")) { 462 | $return_url = remove_query_arg(array('nonce', 'action', 'number')); 463 | 464 | if ( !empty($_GET) && (wp_verify_nonce($_GET['nonce'],'nonce')) ) { 465 | if ((isset($_GET['number'])) && (!empty($_GET['number']))) { 466 | $df_widgets = $this->get_df_feed_widgets_items(); 467 | $df_item_number = esc_attr($_GET['number']); 468 | 469 | if (isset($df_widgets[$df_item_number])) { 470 | unset($df_widgets[$df_item_number]); 471 | $this->set_df_feed_widgets_items($df_widgets); 472 | 473 | $return_url = add_query_arg('message', 'success-delete', $return_url); 474 | } 475 | } 476 | } 477 | wp_redirect($return_url); 478 | die(); 479 | } 480 | 481 | wp_enqueue_style( 'dashboard-feeds-admin-stylesheet', plugins_url( '/css/dashboard-feeds-admin.css', __FILE__ ), 482 | false, $this->_settings['VERSION']); 483 | 484 | $this->_messages['success-add'] = __( "The Feed item has been added.", 'dashboard-feeds' ); 485 | $this->_messages['success-update'] = __( "The Feed item has been updated.", 'dashboard-feeds' ); 486 | $this->_messages['success-delete'] = __( "The Feed item has been deleted.", 'dashboard-feeds' ); 487 | $this->_messages['success-settings'] = __( "Settings have been update.", 'dashboard-feeds' ); 488 | 489 | $this->wpmudev_dashboard_feeds_list_table = new WPMUDEV_Dashboard_Feeds_List_Table(); 490 | 491 | if ((isset($_POST['wp_screen_options']['option'])) 492 | && ($_POST['wp_screen_options']['option'] == "settings_page_dashboard_feeds_per_page")) { 493 | 494 | if (isset($_POST['wp_screen_options']['value'])) { 495 | $per_page = intval($_POST['wp_screen_options']['value']); 496 | if ((!$per_page) || ($per_page < 1)) { 497 | $per_page = 20; 498 | } 499 | update_user_meta(get_current_user_id(), 'wpmudev_dashboard_feeds_items_per_page', $per_page); 500 | } 501 | } else { 502 | $per_page = get_user_meta(get_current_user_id(), 'wpmudev_dashboard_feeds_items_per_page', true); 503 | if (!$per_page) 504 | $per_page = 15; 505 | } 506 | 507 | add_screen_option( 'per_page', array('label' => __('per Page', 'dashboard-feeds' ), 'default' => $per_page) ); 508 | } 509 | 510 | function settings_show_panel() { 511 | global $wp_version; 512 | $version_compare = version_compare($wp_version, '3.7.1'); 513 | 514 | $_SHOW_LISTING = true; 515 | $_ACTION_MESSAGE = ''; 516 | 517 | if ((isset($_GET['subpage'])) && ($_GET['subpage'] == "general-settings")) { 518 | ?> 519 |
520 | 521 |

522 | show_dashboard_feed_settings_form(); ?> 523 |
524 | 530 |
531 | 532 |

533 | show_dashboard_feed_form(); ?> 534 |
535 | get_df_feed_widgets_items(); 540 | $df_item_number = esc_attr($_GET['number']); 541 | if (isset($df_widgets[$df_item_number])) { 542 | $df_widgets[$df_item_number]['number'] = $df_item_number; 543 | 544 | ?> 545 |
546 | 547 |

548 | show_dashboard_feed_form($df_widgets[$df_item_number]); ?> 549 |
550 | 559 |
560 | 561 | 565 |

 Add New

566 | _messages[$message_idx])) { 570 | ?>

_messages[$_GET['message']] ?>

574 | = 1) { 577 | if (!(isset($_GET['action']))) { 578 | $action_url = remove_query_arg(array('nonce', 'message', 'number')); 579 | $action_url = add_query_arg('subpage', 'general-settings', $action_url); 580 | ?> 584 | get_df_feed_widgets_items(); //get_option('wpmudev_df_widget_options'); 586 | if ((!$df_widgets) || (!is_array($df_widgets))) 587 | $df_widgets = array(); 588 | 589 | $this->show_dashboard_feed_list_table($df_widgets); 590 | ?> 591 |
592 | 605 |
606 | 607 | 608 | 609 | 610 | 611 | 612 |
wp_widget_rss_form($widget_options); ?>
613 | 614 | 615 |
616 | get_df_widget_settings(); 626 | 627 | //echo "widget_options
"; print_r($widget_options); echo "
"; 628 | 629 | if ((isset($widget_options['number'])) && (!empty($widget_options['number']))) 630 | $widget_options['number'] = esc_attr( $widget_options['number'] ); 631 | else 632 | $widget_options['number'] = 'df-new'; 633 | 634 | if ((isset($widget_options['title'])) && (!empty($widget_options['title']))) 635 | $widget_options['title'] = esc_attr( $widget_options['title'] ); 636 | else 637 | $widget_options['title'] = ''; 638 | 639 | if ((isset($widget_options['url'])) && (!empty($widget_options['url']))) 640 | $widget_options['url'] = esc_url( $widget_options['url'] ); 641 | else 642 | $widget_options['url'] = ''; 643 | 644 | if ((isset($widget_options['link'])) && (!empty($widget_options['link']))) 645 | $widget_options['link'] = esc_url( $widget_options['link'] ); 646 | else 647 | $widget_options['link'] = ''; 648 | 649 | 650 | if (isset($widget_options['items'])) 651 | $widget_options['items'] = (int) $widget_options['items']; 652 | else 653 | $widget_options['items'] = 10; 654 | 655 | if ( $widget_options['items'] < 1 || 20 < $widget_options['items'] ) 656 | $widget_options['items'] = 10; 657 | 658 | if (isset($widget_options['show_summary'])) 659 | $widget_options['show_summary'] = (int) $widget_options['show_summary']; 660 | else 661 | $widget_options['show_summary'] = false; 662 | 663 | if (isset($widget_options['show_author'])) 664 | $widget_options['show_author'] = (int) $widget_options['show_author']; 665 | else 666 | $widget_options['show_author'] = false; 667 | 668 | if (isset($widget_options['show_date'])) 669 | $widget_options['show_date'] = (int) $widget_options['show_date']; 670 | else 671 | $widget_options['show_date'] = false; 672 | 673 | if (isset($widget_options['show-on'])) { 674 | if (isset($widget_options['show-on']['network'])) 675 | $widget_options['show-on']['network'] = esc_attr($widget_options['show-on']['network']); 676 | else 677 | $widget_options['show-on']['network'] = false; 678 | 679 | if (isset($widget_options['show-on']['site'])) 680 | $widget_options['show-on']['site'] = esc_attr($widget_options['show-on']['site']); 681 | else 682 | $widget_options['show-on']['site'] = false; 683 | } else { 684 | $widget_options['show-on'] = array(); 685 | $widget_options['show-on']['network'] = 'on'; 686 | $widget_options['show-on']['site'] = 'on'; 687 | } 688 | ?> 689 | 690 | = $version_compare) { 692 | $label_description = __('Checked - This will remove the "configure" link on the widget header.(Recommended)
Unchecked - allow individual users to control this widget on their own Dashboards. When the feed is saved here again it will replace the custom settings.', 'dashboard-feeds'); 693 | 694 | if ($widget_options['number'] == 'df-dashboard_primary') { 695 | ?> 696 |

/>

699 | 702 |

/>

705 | 709 | 710 |

711 |

713 | 714 |

715 |

718 | 719 |

720 |

723 | 724 |

730 |

731 | 732 |

/> 735 |

736 | 737 |

/> 740 |

741 | 742 |

/> 745 |

746 | 747 |


748 | 749 | /> 750 | 751 | 752 |
/> 753 |

get_df_widget_settings(); 758 | ?> 759 |
760 | 761 |

762 | 763 |

764 | 765 |

766 | /> 767 | 768 |
/> 769 | 770 |

771 | 772 | 773 | 774 |
775 | get_df_feed_widgets_items(); 785 | 786 | if ((!$df_widgets) || (!is_array($df_widgets))) 787 | $df_widgets = array(); 788 | 789 | //echo "df_widgets
"; print_r($df_widgets); echo "
"; 790 | //if (0 >= $version_compare) { 791 | //} else { 792 | // $df_widgets_current = $this->convert_legacy_wordpress_widgets($df_widgets_current); 793 | //} 794 | 795 | foreach($df_widgets as $widget_id => $widget_options) { 796 | // IF we still have them, ignore. 797 | if (0 >= $version_compare) { 798 | if (($widget_id == 'df-dashboard_primary') || ($widget_id == 'df-dashboard_secondary')) { 799 | continue; 800 | } 801 | } 802 | 803 | if ((is_multisite()) && (is_network_admin())) { 804 | if ((isset($widget_options['show-on']['network'])) && ($widget_options['show-on']['network'] == "on")) { 805 | $widget_items[$widget_id] = new WPMUDEV_Dashboard_Feed_Widget(); 806 | $widget_items[$widget_id]->init($widget_id, $widget_options); 807 | } 808 | } else { 809 | if ((isset($widget_options['show-on']['site'])) && ($widget_options['show-on']['site'] == "on")) { 810 | $widget_items[$widget_id] = new WPMUDEV_Dashboard_Feed_Widget(); 811 | $widget_items[$widget_id]->init($widget_id, $widget_options); 812 | } 813 | } 814 | } 815 | } 816 | 817 | function convert_legacy_wordpress_widgets($df_widgets = array()) { 818 | if (isset($df_widgets['df-dashboard_primary'])) { 819 | $count = 0; 820 | foreach($df_widgets as $widget_id => $widget_options) { 821 | if (($widget_id != 'df-dashboard_primary') && ($widget_id != 'df-dashboard_secondary')) { 822 | $count += 1; 823 | } 824 | } 825 | $new_widget_id = sprintf("df-%d", intval($count)+1); 826 | $df_widgets[$new_widget_id] = $df_widgets['df-dashboard_primary']; 827 | unset($df_widgets['df-dashboard_primary']); 828 | } 829 | 830 | if (isset($df_widgets['df-dashboard_secondary'])) { 831 | $count = 0; 832 | foreach($df_widgets as $widget_id => $widget_options) { 833 | if (($widget_id != 'df-dashboard_primary') && ($widget_id != 'df-dashboard_secondary')) { 834 | $count += 1; 835 | } 836 | } 837 | $new_widget_id = sprintf("df-%d", intval($count)+1); 838 | $df_widgets[$new_widget_id] = $df_widgets['df-dashboard_secondary']; 839 | unset($df_widgets['df-dashboard_secondary']); 840 | } 841 | return $df_widgets; 842 | } 843 | 844 | function get_df_feed_widgets_items() { 845 | if (is_multisite()) { 846 | global $current_blog; 847 | //echo "current_blog
"; print_r($current_blog); echo "
"; 848 | 849 | if ($current_blog->site_id == $current_blog->blog_id) { 850 | $df_widgets = get_blog_option($current_blog->site_id, 'wpmudev_df_widget_options'); 851 | if (!is_array($df_widgets)) { 852 | $df_widgets = get_option('wpmudev_df_widget_options'); 853 | } 854 | 855 | } else { 856 | $df_widgets = get_blog_option($current_blog->site_id, 'wpmudev_df_widget_options'); 857 | } 858 | } else { 859 | $df_widgets = get_option('wpmudev_df_widget_options'); 860 | } 861 | 862 | return $df_widgets; 863 | } 864 | 865 | function set_df_feed_widgets_items($df_widgets) { 866 | if (is_multisite()) { 867 | global $current_blog; 868 | 869 | if (is_array($df_widgets)) 870 | update_blog_option($current_blog->site_id, 'wpmudev_df_widget_options', $df_widgets); 871 | else 872 | delete_blog_option($current_blog->site_id, 'wpmudev_df_widget_options'); 873 | } else { 874 | if (is_array($df_widgets)) 875 | update_option('wpmudev_df_widget_options', $df_widgets); 876 | else 877 | delete_option('wpmudev_df_widget_options'); 878 | } 879 | } 880 | 881 | function get_df_widget_settings() { 882 | if (is_multisite()) { 883 | global $current_blog; 884 | 885 | if ($current_blog->site_id == $current_blog->blog_id) { 886 | $df_settings = get_blog_option($current_blog->site_id, 'dashboard_widget_settings'); 887 | if (!is_array($df_settings)) { 888 | $df_settings = get_option('dashboard_widget_settings'); 889 | } 890 | 891 | } else { 892 | $df_settings = get_blog_option($current_blog->site_id, 'dashboard_widget_settings'); 893 | } 894 | } else { 895 | //echo "in non-MS
"; 896 | $df_settings = get_option('dashboard_widget_settings', array()); 897 | } 898 | 899 | if (!isset($df_settings['wordpress-feed-widget'])) 900 | $df_settings['wordpress-feed-widget'] = array(); 901 | if (!isset($df_settings['wordpress-feed-widget']['site'])) 902 | $df_settings['wordpress-feed-widget']['site'] = 'on'; 903 | if (!isset($df_settings['wordpress-feed-widget']['network'])) 904 | $df_settings['wordpress-feed-widget']['network'] = 'on'; 905 | 906 | //echo "df_settings
"; print_r($df_settings); echo "
"; 907 | return $df_settings; 908 | } 909 | 910 | function set_df_widget_settings($df_settings) { 911 | if (is_multisite()) { 912 | global $current_blog; 913 | 914 | if (is_array($df_settings)) 915 | update_blog_option($current_blog->site_id, 'dashboard_widget_settings', $df_settings); 916 | else 917 | delete_blog_option($current_blog->site_id, 'dashboard_widget_settings'); 918 | } else { 919 | if (is_array($df_settings)) { 920 | update_option('dashboard_widget_settings', $df_settings); 921 | } else { 922 | delete_option('dashboard_widget_settings'); 923 | } 924 | } 925 | } 926 | 927 | function show_dashboard_feed_list_table($df_items = array()) { 928 | $this->wpmudev_dashboard_feeds_list_table->prepare_items($df_items); 929 | $this->wpmudev_dashboard_feeds_list_table->display(); 930 | } 931 | } 932 | } 933 | $wpmudev_dashboard_feeds = new WPMUDEV_Dashboard_Feeds(); 934 | 935 | if (!class_exists('WPMUDEV_Dashboard_Feeds_List_Table')) { 936 | 937 | if(!class_exists('WP_List_Table')) { 938 | require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); 939 | } 940 | class WPMUDEV_Dashboard_Feeds_List_Table extends WP_List_Table { 941 | 942 | function __construct( ) { 943 | global $status, $page; 944 | 945 | //Set parent defaults 946 | parent::__construct( 947 | array( 948 | 'singular' => 'Archive', //singular name of the listed records 949 | 'plural' => 'Archive', //plural name of the listed records 950 | 'ajax' => false //does this table support ajax? 951 | ) 952 | ); 953 | } 954 | 955 | function WPMUDEV_Dashboard_Feeds_List_Table() { 956 | $this->__construct(); 957 | } 958 | 959 | function get_table_classes() { 960 | return array( 'widefat', 'fixed', 'df-list-table' ); 961 | } 962 | 963 | function get_columns() { 964 | 965 | $columns = array(); 966 | 967 | $columns['title'] = __('Title', 'dashboard-feeds'); 968 | //$columns['number'] = __('ID', 'dashboard-feeds'); 969 | $columns['feedurl'] = __('Feed URL', 'dashboard-feeds'); 970 | $columns['siteurl'] = __('Site URL', 'dashboard-feeds'); 971 | $columns['meta'] = __('Meta', 'dashboard-feeds'); 972 | 973 | return $columns; 974 | } 975 | 976 | function get_hidden_columns() { 977 | $screen = get_current_screen(); 978 | $hidden = get_hidden_columns( $screen ); 979 | 980 | return $hidden; 981 | } 982 | 983 | function column_default($item, $column_name){ 984 | //echo "column_name=[". $column_name ."]
"; 985 | //echo "item
"; print_r($item); echo "
"; 986 | echo " "; 987 | } 988 | 989 | function column_cb($item) { 990 | ?> ' . __('Edit', 'dashboard-feeds') . ''; 1002 | 1003 | $action_delete_url = add_query_arg('action', 'delete', $edit_url); 1004 | $action_delete_url = add_query_arg('nonce', wp_create_nonce( 'nonce' ), $action_delete_url); 1005 | 1006 | $row_actions['delete'] = ''. __('Delete', 'dashboard-feeds') .''; 1007 | 1008 | if (count($row_actions)) { 1009 | ?>
"; print_r($item); echo ""; 1027 | 1028 | if (isset($item['items'])) { 1029 | echo __('Count', 'dashboard-feeds'). ': '. intval($item['items']); 1030 | echo '
'; 1031 | } 1032 | 1033 | if (isset($item['show_summary'])) { 1034 | echo __('Summary', 'dashboard-feeds'). ': '; 1035 | ($item['show_summary'] == 1) ? _e('Yes', 'dashboard-feeds') : _e('No', 'dashboard-feeds'); 1036 | echo '
'; 1037 | } 1038 | 1039 | if (isset($item['show_author'])) { 1040 | echo __('Author', 'dashboard-feeds'). ': '; 1041 | ($item['show_author'] == 1) ? _e('Yes', 'dashboard-feeds') : _e('No', 'dashboard-feeds'); 1042 | echo '
'; 1043 | } 1044 | 1045 | if (isset($item['show_date'])) { 1046 | echo __('Date', 'dashboard-feeds'). ': '; 1047 | ($item['show_date'] == 1) ? _e('Yes', 'dashboard-feeds') : _e('No', 'dashboard-feeds'); 1048 | echo '
'; 1049 | } 1050 | 1051 | if (is_multisite()) { 1052 | if ((isset($item['show-on'])) && is_array($item['show-on']) && (count($item['show-on']))) { 1053 | echo __('Show on', 'dashboard-feeds'). ': '; 1054 | $show_on_str = ''; 1055 | if (isset($item['show-on']['site'])) { 1056 | if ($item['show-on']['site'] == 'on') { 1057 | if (!empty($show_on_str)) $show_on_str .= ', '; 1058 | $show_on_str .= __('Site', 'dashboard-feeds'); 1059 | } 1060 | } 1061 | if (isset($item['show-on']['network'])) { 1062 | if ($item['show-on']['network'] == 'on') { 1063 | if (!empty($show_on_str)) $show_on_str .= ', '; 1064 | $show_on_str .= __('Network', 'dashboard-feeds'); 1065 | } 1066 | } 1067 | if (empty($show_on_str)) $show_on_str = __('None', 'dashboard-feeds'); 1068 | echo $show_on_str; 1069 | } 1070 | } 1071 | } 1072 | 1073 | function prepare_items($df_items = array()) { 1074 | $columns = $this->get_columns(); 1075 | $hidden = $this->get_hidden_columns(); 1076 | //$hidden = array(); 1077 | //$sortable = $this->get_sortable_columns(); 1078 | $sortable = array(); 1079 | $this->_column_headers = array($columns, $hidden, $sortable); 1080 | 1081 | foreach($df_items as $df_key => $df_item) { 1082 | if (!isset($df_items[$df_key]['number'])) { 1083 | $df_items[$df_key]['number'] = $df_key; 1084 | } 1085 | } 1086 | //echo "df_items
"; print_r($df_items); echo "
"; 1087 | 1088 | $per_page = get_user_meta(get_current_user_id(), 'wpmudev_dashboard_feeds_items_per_page', true); 1089 | if ((!$per_page) || ($per_page < 1)) { 1090 | $per_page = 15; 1091 | } 1092 | 1093 | $current_page = $this->get_pagenum(); 1094 | 1095 | if (count($df_items) > $per_page) { 1096 | $this->items = array_slice($df_items, (($current_page - 1) * intval($per_page)), intval($per_page), true); 1097 | } else { 1098 | $this->items = $df_items; 1099 | } 1100 | 1101 | $this->set_pagination_args( 1102 | array( 1103 | 'total_items' => count($df_items), // WE have to calculate the total number of items 1104 | 'per_page' => intval($per_page), // WE have to determine how many items to show on a page 1105 | 'total_pages' => ceil(intval(count($df_items)) / intval($per_page)) // WE have to calculate the total number of pages 1106 | ) 1107 | ); 1108 | } 1109 | } 1110 | } 1111 | 1112 | 1113 | if (!class_exists('WPMUDEV_Dashboard_Feed_Widget')) { 1114 | 1115 | class WPMUDEV_Dashboard_Feed_Widget { 1116 | var $widget_id; 1117 | var $widget_options; 1118 | 1119 | function __construct() { 1120 | } 1121 | 1122 | function WPMUDEV_Dashboard_Feed_Widget() { 1123 | $this->__construct(); 1124 | } 1125 | 1126 | function init($options_set='', $options=array()) { 1127 | if (empty($options_set)) return; 1128 | if (empty($options)) return; 1129 | 1130 | if (strlen($options_set)) { 1131 | $this->widget_id = "wpmudev_dashboard_item_". $options_set; 1132 | $options['number'] = $options_set; 1133 | } 1134 | 1135 | $this->widget_options = $options; 1136 | wp_add_dashboard_widget( $this->widget_id, 1137 | $this->widget_options['title'], 1138 | array(&$this, 'wp_dashboard_widget_display') 1139 | /* array(&$this, 'wp_dashboard_widget_controls') */ 1140 | ); 1141 | } 1142 | 1143 | function wp_dashboard_widget_display() { 1144 | 1145 | $rss = @fetch_feed( $this->widget_options['url'] ); 1146 | 1147 | if ( is_wp_error($rss) ) { 1148 | if ( is_admin() || current_user_can('manage_options') ) { 1149 | echo '

'; 1150 | printf(__('RSS Error: %s'), $rss->get_error_message()); 1151 | echo '

'; 1152 | } 1153 | 1154 | } elseif ( !$rss->get_item_quantity() ) { 1155 | $rss->__destruct(); 1156 | unset($rss); 1157 | return false; 1158 | 1159 | } else { 1160 | echo '
'; 1161 | wp_widget_rss_output( $rss, $this->widget_options ); 1162 | echo '
'; 1163 | $rss->__destruct(); 1164 | unset($rss); 1165 | } 1166 | } 1167 | 1168 | function wp_dashboard_widget_controls() { 1169 | wp_widget_rss_form( $this->widget_options ); 1170 | } 1171 | } 1172 | } 1173 | --------------------------------------------------------------------------------