Changeset 2128696
- Timestamp:
- 07/25/2019 08:08:46 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
custom-wp-update-message/trunk/custom-wp-update-message.php
r1227659 r2128696 3 3 * Plugin Name: Custom WP Update Message 4 4 * Description: This plugin allows you to edit the WordPress update message shown when a new version of WordPress is available. This plugin is targeted toward web developers who want to provide support to their clients when updates are available. You can enter your contact information, and a personalized message. You can also determine which types of users see the message and which do not. 5 * Version: 1.0. 35 * Version: 1.0.4 6 6 * Author: Computer Courage 7 7 * Author URI: http://www.computercourage.com … … 50 50 ); 51 51 52 foreach($fields as $key => $label) { 53 add_settings_field( 54 'ccmwcu_' . $key, 55 $label, 56 array( __CLASS__, 'settings_field' ), 57 self::$pageslug, 58 self::$settingsname, 59 array( 'key' => $key ) 60 ); 52 if(is_countable($fields) && count($fields)){ 53 foreach($fields as $key => $label) { 54 add_settings_field( 55 'ccmwcu_' . $key, 56 $label, 57 array( __CLASS__, 'settings_field' ), 58 self::$pageslug, 59 self::$settingsname, 60 array( 'key' => $key ) 61 ); 62 } 61 63 } 62 64 … … 74 76 if( $key == 'users' ) { 75 77 $user_roles = self::get_user_roles(); 76 foreach($user_roles as $urkey => $ur) { 77 echo "<input type='checkbox' name='" . self::$settingsname . "[" . $key . "][]' value='" . $urkey . "' id='" . self::$settingsname . "_" . $urkey . "'"; 78 if( is_array($val) && in_array($urkey, $val) ) echo ' checked'; 79 if( isset($ur['capabilities']['update_core']) ) echo ' checked disabled'; 80 echo "> <label for='" . self::$settingsname . "_" . $urkey . "'>" . $ur['name'] . "</label><br />"; 78 if(is_countable($user_roles) && count($user_roles)){ 79 foreach($user_roles as $urkey => $ur) { 80 echo "<input type='checkbox' name='" . self::$settingsname . "[" . $key . "][]' value='" . $urkey . "' id='" . self::$settingsname . "_" . $urkey . "'"; 81 if( is_array($val) && in_array($urkey, $val) ) echo ' checked'; 82 if( isset($ur['capabilities']['update_core']) ) echo ' checked disabled'; 83 echo "> <label for='" . self::$settingsname . "_" . $urkey . "'>" . $ur['name'] . "</label><br />"; 84 } 81 85 } 82 86 … … 88 92 89 93 public static function validate_field($input) { 90 foreach($input as $key => $in) { 91 if( is_array($in) ) { 92 $in = array_map( array( __CLASS__, 'clean_input' ), $in ); 94 if(is_countable($input) && count($input)){ 95 foreach($input as $key => $in) { 96 if( is_array($in) ) { 97 $in = array_map( array( __CLASS__, 'clean_input' ), $in ); 98 99 } else { 100 $in = self::clean_input($in); 101 } 93 102 94 } else { 95 $in = self::clean_input($in); 96 } 97 98 $input[$key] = $in; 103 $input[$key] = $in; 104 } 99 105 } 100 106 … … 205 211 $users = $ccmwcu_options['users'] ? $ccmwcu_options['users'] : ''; 206 212 $users = maybe_unserialize($users); 207 foreach($users as $user_role) { 208 if( current_user_can($user_role) ) return true; 209 } 213 if(is_countable($users) && count($users)){ 214 foreach($users as $user_role) { 215 if( current_user_can($user_role) ) return true; 216 } 217 } 210 218 return false; 211 219 }
Note: See TracChangeset
for help on using the changeset viewer.