Changeset 1166838
- Timestamp:
- 05/25/2015 02:14:37 AM (11 years ago)
- Location:
- basic-dev-tools/trunk
- Files:
-
- 4 edited
-
includes/index.php (modified) (2 diffs)
-
includes/settings-manager.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
screenshot-2.png (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
basic-dev-tools/trunk/includes/index.php
r1166383 r1166838 1 1 <?php 2 2 if(isset($_POST['basic_dev_tools_special_settings_save']) && $_POST['basic_dev_tools_special_settings_save']=='true') { 3 if($_POST['basic_dev_tools_show_admin_bar']=='yes') { 4 update_option('basic_dev_tools_show_admin_bar', true); 5 } else { 6 update_option('basic_dev_tools_show_admin_bar', false); 7 } 3 update_option('basic_dev_tools_hide_admin_bar', $_POST['basic_dev_tools_hide_admin_bar']=='yes'?true:false); 4 update_option('basic_dev_tools_disable_theme_updates', $_POST['basic_dev_tools_disable_theme_updates']=='yes'?true:false); 5 update_option('basic_dev_tools_disable_plugin_updates', $_POST['basic_dev_tools_disable_plugin_updates']=='yes'?true:false); 6 update_option('basic_dev_tools_disable_core_updates', $_POST['basic_dev_tools_disable_core_updates']=='yes'?true:false); 8 7 } 9 8 ?> … … 15 14 <tbody> 16 15 <tr> 17 <th scope="row"><label for="blogname"> ShowAdmin Bar</label></th>16 <th scope="row"><label for="blogname">Hide Admin Bar</label></th> 18 17 <td> 19 <label><input type="radio"<?php echo get_option('basic_dev_tools_show_admin_bar', false)?' checked="checked"':'';?> value="yes" name="basic_dev_tools_show_admin_bar"> Yes</label> 20 <label><input type="radio"<?php echo get_option('basic_dev_tools_show_admin_bar', false)?'':' checked="checked"';?> value="no" name="basic_dev_tools_show_admin_bar"> No</label> 18 <label><input type="radio"<?php echo get_option('basic_dev_tools_hide_admin_bar', false)?' checked="checked"':'';?> value="yes" name="basic_dev_tools_hide_admin_bar"> Yes</label> 19 <label><input type="radio"<?php echo get_option('basic_dev_tools_hide_admin_bar', false)?'':' checked="checked"';?> value="no" name="basic_dev_tools_hide_admin_bar"> No</label> 20 </td> 21 </tr> 22 <tr> 23 <th scope="row"><label for="blogname">Disable Theme Updates</label></th> 24 <td> 25 <label><input type="radio"<?php echo get_option('basic_dev_tools_disable_theme_updates', false)?' checked="checked"':'';?> value="yes" name="basic_dev_tools_disable_theme_updates"> Yes</label> 26 <label><input type="radio"<?php echo get_option('basic_dev_tools_disable_theme_updates', false)?'':' checked="checked"';?> value="no" name="basic_dev_tools_disable_theme_updates"> No</label> 27 </td> 28 </tr> 29 <tr> 30 <th scope="row"><label for="blogname">Disable Plugin Updates</label></th> 31 <td> 32 <label><input type="radio"<?php echo get_option('basic_dev_tools_disable_plugin_updates', false)?' checked="checked"':'';?> value="yes" name="basic_dev_tools_disable_plugin_updates"> Yes</label> 33 <label><input type="radio"<?php echo get_option('basic_dev_tools_disable_plugin_updates', false)?'':' checked="checked"';?> value="no" name="basic_dev_tools_disable_plugin_updates"> No</label> 34 </td> 35 </tr> 36 <tr> 37 <th scope="row"><label for="blogname">Disable Core Updates</label></th> 38 <td> 39 <label><input type="radio"<?php echo get_option('basic_dev_tools_disable_core_updates', false)?' checked="checked"':'';?> value="yes" name="basic_dev_tools_disable_core_updates"> Yes</label> 40 <label><input type="radio"<?php echo get_option('basic_dev_tools_disable_core_updates', false)?'':' checked="checked"';?> value="no" name="basic_dev_tools_disable_core_updates"> No</label> 21 41 </td> 22 42 </tr> -
basic-dev-tools/trunk/includes/settings-manager.php
r1166652 r1166838 2 2 class Basic_Dev_Tools_Settings_Manager { 3 3 function __construct() { 4 if(get_option('basic_dev_tools_show_admin_bar', false)) { 4 5 // 6 7 8 //add_filter( 'pre_site_transient_update_plugins', array($this, 'last_checked_plugins') ); 9 10 //disable core updates option 11 //add_filter( 'pre_site_transient_update_core', array($this, 'last_checked_core') ); 12 } 13 14 function apply_special_settings() { 15 //disable admin bar option 16 if(get_option('basic_dev_tools_hide_admin_bar', false)) 5 17 add_filter('show_admin_bar', '__return_false'); 18 19 //disable theme updates option 20 if(get_option('basic_dev_tools_disable_theme_updates', false)) { 21 add_filter('pre_site_transient_update_themes', array($this, 'cancel_theme_updates')); 22 23 remove_action('load-update-core.php', 'wp_update_themes'); 24 } 25 26 //disable plugins updates option 27 if(get_option('basic_dev_tools_disable_plugin_updates', false)) { 28 add_filter('pre_site_transient_update_plugins', array($this, 'cancel_plugin_updates')); 29 30 remove_action('load-update-core.php', 'wp_update_plugins'); 31 } 32 33 //disable core updates option 34 if(get_option('basic_dev_tools_disable_core_updates', false)) { 35 $this->cancel_core_updates(); 36 37 remove_action('wp_maybe_auto_update', 'wp_maybe_auto_update'); 38 remove_action('admin_init', 'wp_maybe_auto_update'); 39 remove_action('admin_init', 'wp_auto_update_core'); 6 40 } 7 41 } 8 42 9 function apply_special_settings() { 10 if(get_option('basic_dev_tools_show_admin_bar', false)) { 11 add_filter('show_admin_bar', '__return_false'); 12 } 43 function cancel_theme_updates() { 44 global $wp_version; 45 46 $theme_files = array(); 47 if(count(wp_get_themes())>0) 48 foreach(wp_get_themes() as $theme) 49 $theme_files[$theme->get_stylesheet()] = $theme->get('Version'); 50 51 return (object) array( 'last_checked' => time(), 52 'updates' => array(), 53 'version_checked' => $wp_version, 54 'checked' => $theme_files); 55 } 56 57 function cancel_plugin_updates() { 58 global $wp_version; 59 60 $plugin_files = array(); 61 if(!function_exists('get_plugins')) 62 require_once ABSPATH.'wp-admin/includes/plugin.php'; 63 64 if(count(get_plugins())>0) 65 foreach(get_plugins() as $file_name => $plugin) 66 $plugin_files[$file_name] = $plugin['Version']; 67 68 return (object) array( 'last_checked' => time(), 69 'updates' => array(), 70 'version_checked' => $wp_version, 71 'checked' => $plugin_files); 72 } 73 74 function cancel_core_updates() { 75 if(!defined('AUTOMATIC_UPDATER_DISABLED')) 76 define('AUTOMATIC_UPDATER_DISABLED', true); 77 78 if(!defined('WP_AUTO_UPDATE_CORE')) 79 define('WP_AUTO_UPDATE_CORE', false); 80 81 add_filter('pre_site_transient_update_core', array($this, 'cancel_core_update')); 82 83 add_filter('automatic_updates_send_debug_email', '__return_false', 1); 84 add_filter('pre_http_request', array($this, 'block_request'), 10, 3); 85 add_filter('auto_update_translation', '__return_false'); 86 add_filter('automatic_updater_disabled', '__return_true'); 87 add_filter('allow_minor_auto_core_updates', '__return_false'); 88 add_filter('allow_major_auto_core_updates', '__return_false'); 89 add_filter('allow_dev_auto_core_updates', '__return_false'); 90 add_filter('auto_update_core', '__return_false'); 91 add_filter('wp_auto_update_core', '__return_false'); 92 add_filter('auto_core_update_send_email', '__return_false'); 93 add_filter('send_core_update_notification_email', '__return_false'); 94 add_filter('auto_update_plugin', '__return_false'); 95 add_filter('auto_update_theme', '__return_false'); 96 add_filter('automatic_updates_send_debug_email', '__return_false'); 97 add_filter('automatic_updates_is_vcs_checkout', '__return_true'); 98 } 99 100 function cancel_core_update() { 101 global $wp_version; 102 103 return (object) array( 'last_checked' => time(), 104 'updates' => array(), 105 'version_checked' => $wp_version); 13 106 } 14 107 } -
basic-dev-tools/trunk/readme.txt
r1166655 r1166838 5 5 Requires at least: 3.0.1 6 6 Tested up to: 4.2 7 Stable tag: 1.4 7 Stable tag: 1.4.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 52 52 == Upgrade Notice == 53 53 54 = 1.4 =55 * Bug with files in svn fixed54 = 1.4.1 = 55 * New Special Settings added 56 56 57 57 == Changelog == 58 59 = 1.4.1 (2015-05-24) = 60 * Added "Hide Admin Bar" Special Setting 61 * Added "Disable Theme Updates" Special Setting 62 * Added "Disable Plugin Updates" Special Setting 63 * Added "Disable Core Updates" Special Setting 64 * Screenshot changed 58 65 59 66 = 1.4 (2015-05-24) =
Note: See TracChangeset
for help on using the changeset viewer.