Changeset 958135
- Timestamp:
- 07/31/2014 03:00:15 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
angry-creative-logger/trunk/routines/write_permissions.php
r958063 r958135 8 8 const LOG_LEVEL = 'warning'; 9 9 10 const DESCRIPTION = 'Checks wether your web server has the appropriate write permissions.'; 11 10 12 private static $_default_allowed_dirs = array( 11 'wp-content/uploads/*' 13 'wp-content/uploads/*', 14 'wp-content/plugins/*', 15 'wp-content/themes/*', 16 'wp-content/languages/*', 12 17 ); 13 18 19 private static $_force_default_allowed_dirs = false; 20 14 21 private static $_options = array(); 15 22 16 public static function register() { 23 private static $_instantiated = false; 24 25 public static function preload() { 17 26 18 27 if ( defined('DISALLOW_FILE_MODS') && true == DISALLOW_FILE_MODS ) { 19 28 self::$_default_allowed_dirs = array( 'wp-content/uploads/*' ); 29 self::$_force_default_allowed_dirs = true; 20 30 } 21 31 22 32 if ( defined('FS_METHOD') && 'direct' == FS_METHOD ) { 23 33 self::$_default_allowed_dirs = array( '/*' ); 24 } 25 26 $default_options = array( 'log_level' => self::LOG_LEVEL, 27 'allowed_dirs' => self::$_default_allowed_dirs , 28 'description' => "Checks wether your web server has the appropriate write permissions."); 34 self::$_force_default_allowed_dirs = true; 35 } 36 37 } 38 39 public static function register() { 40 41 self::preload(); 42 43 $reg_options = array( 'log_level' => self::LOG_LEVEL, 44 'allowed_dirs' => self::$_default_allowed_dirs, 45 'description' => self::DESCRIPTION ); 29 46 30 aci_register_routine( __CLASS__, $default_options ); 47 aci_register_routine( __CLASS__, $reg_options ); 48 49 self::setup(); 50 51 if ( !self::$_force_default_allowed_dirs ) { 52 53 add_action( __CLASS__.'_settings_field', array( __CLASS__, 'settings_field' ), 10, 2 ); 54 add_filter( __CLASS__.'_settings', array( __CLASS__, 'settings' ), 10, 1 ); 55 56 } 57 58 } 59 60 public static function setup() { 31 61 32 62 self::$_options = ACI_Routine_Handler::get_options( __CLASS__ ); … … 36 66 } 37 67 38 if ( !is_array( self::$_options['allowed_dirs'] ) ) { 39 self::$_options['allowed_dirs'] = array(); 40 } 41 42 if ( ( !defined('DISALLOW_FILE_MODS') || false == DISALLOW_FILE_MODS ) && ( !defined('FS_METHOD') || 'direct' != FS_METHOD ) ) { 68 if ( self::$_force_default_allowed_dirs ) { 69 43 70 self::$_options['allowed_dirs'] = self::$_default_allowed_dirs; 44 add_action( __CLASS__.'_settings_field', array( __CLASS__, 'settings_field' ), 10, 2 ); 45 add_filter( __CLASS__.'_settings', array( __CLASS__, 'settings' ), 10, 1 ); 71 72 } else { 73 74 if ( !is_array( self::$_options['allowed_dirs'] ) || empty( self::$_options['allowed_dirs'] ) ) { 75 self::$_options['allowed_dirs'] = self::$_default_allowed_dirs; 76 } 77 46 78 } 47 79 … … 141 173 $routine = $args['routine']; 142 174 175 if ( empty( $options['allowed_dirs'] ) || self::$_force_default_allowed_dirs ) { 176 $options['allowed_dirs'] = self::$_default_allowed_dirs; 177 } 178 143 179 ?> 144 180 … … 157 193 public static function settings( $options ) { 158 194 159 if ( !empty( $options['allowed_dirs'] ) && false != strpos( $options['allowed_dirs'], "\n" ) ) { 195 if ( empty( $options['allowed_dirs'] ) || self::$_force_default_allowed_dirs ) { 196 $options['allowed_dirs'] = self::$_default_allowed_dirs; 197 } 198 199 if ( false != strpos( $options['allowed_dirs'], "\n" ) ) { 160 200 $options['allowed_dirs'] = array_map('trim', explode("\n", $options['allowed_dirs'])); 161 201 }
Note: See TracChangeset
for help on using the changeset viewer.