Advertisement
Guest User

Untitled

a guest
May 4th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.95 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. Plugin Name: Dashboard Feeds
  5. Plugin URI: http://premium.wpmudev.org/project/dashboard-feeds
  6. Description: 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 :)
  7. Author: Ivan Shaovchev, Andrew Billits, Andrey Shipilov (Incsub)
  8. Author URI: http://premium.wpmudev.org
  9. Version: 1.5.2
  10. Network: true
  11. WDP ID: 15
  12. License: GNU General Public License (Version 2 - GPLv2)
  13. */
  14.  
  15. /*
  16. Copyright 2007-2011 Incsub (http://incsub.com)
  17.  
  18. This program is free software; you can redistribute it and/or modify
  19. it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by
  20. the Free Software Foundation.
  21.  
  22. This program is distributed in the hope that it will be useful,
  23. but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  25. GNU General Public License for more details.
  26.  
  27. You should have received a copy of the GNU General Public License
  28. along with this program; if not, write to the Free Software
  29. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  30. */
  31.  
  32. /**
  33.  * Set the widget settings after "=".
  34.  * The settings will apply to all blogs on your network and will overwrite
  35.  * the default and custom ones.
  36.  *
  37.  * @return void
  38.  **/
  39. function df_set_widget_options() {
  40.  
  41. // Temporary clear cache for testing. This should be commented for final production to allow caching
  42. $cache_key = 'dash_' . md5( 'dashboard_primary' );
  43. delete_transient( $cache_key );
  44.  
  45.     $widget_options['dashboard_primary']['link']         = 'http://www.iphoneblogger.net/';
  46.     $widget_options['dashboard_primary']['url']          = 'http://www.iphoneblogger.net/feed/';
  47.     $widget_options['dashboard_primary']['title']        = 'WordPress Blog';
  48.     $widget_options['dashboard_primary']['items']        = 2;
  49.     $widget_options['dashboard_primary']['show_summary'] = true;
  50.     $widget_options['dashboard_primary']['show_author']  = false;
  51.     $widget_options['dashboard_primary']['show_date']    = true;
  52.  
  53.     $widget_options['dashboard_secondary']['link']         = 'http://planet.wordpress.org/';
  54.     $widget_options['dashboard_secondary']['url']          = 'http://planet.wordpress.org/feed/';
  55.     $widget_options['dashboard_secondary']['title']        = 'Other WordPress News';
  56.     $widget_options['dashboard_secondary']['items']        = 5;
  57.     $widget_options['dashboard_secondary']['show_summary'] = false;
  58.     $widget_options['dashboard_secondary']['show_author']  = false;
  59.     $widget_options['dashboard_secondary']['show_date']    = false;
  60.  
  61.     $current_widget_options = get_option('dashboard_widget_options');
  62.  
  63.     if ( $current_widget_options ) {
  64.         //delete cache for update the widget when we change options values
  65.         if ( $current_widget_options['dashboard_primary']['link']           != $widget_options['dashboard_primary']['link'] ||
  66.              $current_widget_options['dashboard_primary']['url']            != $widget_options['dashboard_primary']['url'] ||
  67.              $current_widget_options['dashboard_primary']['items']          != $widget_options['dashboard_primary']['items'] ||
  68.              $current_widget_options['dashboard_primary']['show_summary']   != $widget_options['dashboard_primary']['show_summary'] ||
  69.              $current_widget_options['dashboard_primary']['show_author']    != $widget_options['dashboard_primary']['show_author'] ||
  70.              $current_widget_options['dashboard_primary']['show_date']      != $widget_options['dashboard_primary']['show_date'] )
  71.         {
  72.             $cache_key = 'dash_' . md5( 'dashboard_primary' );
  73.             delete_transient( $cache_key );
  74.         }
  75.         //delete cache for update the widget when we change values of options
  76.         if ( $current_widget_options['dashboard_secondary']['link']         != $widget_options['dashboard_secondary']['link'] ||
  77.              $current_widget_options['dashboard_secondary']['url']          != $widget_options['dashboard_secondary']['url'] ||
  78.              $current_widget_options['dashboard_secondary']['items']        != $widget_options['dashboard_secondary']['items'] ||
  79.              $current_widget_options['dashboard_secondary']['show_summary'] != $widget_options['dashboard_secondary']['show_summary'] ||
  80.              $current_widget_options['dashboard_secondary']['show_author']  != $widget_options['dashboard_secondary']['show_author'] ||
  81.              $current_widget_options['dashboard_secondary']['show_date']    != $widget_options['dashboard_secondary']['show_date'] )
  82.         {
  83.             $cache_key = 'dash_' . md5( 'dashboard_secondary' );
  84.             delete_transient( $cache_key );
  85.         }
  86.  
  87.         $widget_options = array_merge( $current_widget_options, $widget_options );
  88.     }
  89.     update_option( 'dashboard_widget_options', $widget_options );
  90.  
  91. }
  92.  
  93. function df_filter_http_request_timeout($current_timeout) {
  94.     if (intval($current_timeout) < 60)
  95.         return intval(60);
  96.     else
  97.         return intval($current_timeout);
  98. }
  99. add_filter( 'http_request_timeout', 'df_filter_http_request_timeout');
  100.  
  101.  
  102. /* Call the function */
  103. df_set_widget_options();
  104.  
  105. /* Update Notifications Notice */
  106. if ( !function_exists( 'wdp_un_check' ) ) {
  107.     function wdp_un_check() {
  108.         if ( !class_exists('WPMUDEV_Update_Notifications') && current_user_can('edit_users') )
  109.             echo '<div class="error fade"><p>' . __('Please install the latest version of <a href="http://premium.wpmudev.org/project/update-notifications/" title="Download Now &raquo;">our free Update Notifications plugin</a> which helps you stay up-to-date with the most stable, secure versions of WPMU DEV themes and plugins. <a href="http://premium.wpmudev.org/wpmu-dev/update-notifications-plugin-information/">More information &raquo;</a>', 'wpmudev') . '</a></p></div>';
  110.     }
  111.     add_action( 'admin_notices', 'wdp_un_check', 5 );
  112.     add_action( 'network_admin_notices', 'wdp_un_check', 5 );
  113. }
  114.  
  115. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement