Changeset 881818
- Timestamp:
- 03/25/2014 04:15:49 PM (12 years ago)
- Location:
- angry-creative-logger/trunk
- Files:
-
- 16 added
- 5 edited
-
classes/inspector.php (modified) (4 diffs)
-
classes/routine_handler.php (modified) (4 diffs)
-
classes/settings.php (modified) (12 diffs)
-
git (added)
-
git/.git (added)
-
git/Git.php (added)
-
git/composer.json (added)
-
git/license.txt (added)
-
git/readme.md (added)
-
git/test (added)
-
git/test/test-suite.php (added)
-
plugin.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
routines (added)
-
routines/file_permissions.php (added)
-
routines/git_status.php (added)
-
routines/plugin_change.php (added)
-
routines/site_change.php (added)
-
routines/site_visibility.php (added)
-
routines/upload_permissions.php (added)
-
routines/wp_mail.php (added)
Legend:
- Unmodified
- Added
- Removed
-
angry-creative-logger/trunk/classes/inspector.php
r839003 r881818 2 2 /* 3 3 Class name: AC Inspector 4 Version: 0. 34 Version: 0.4 5 5 Author: Sammy Nordström, Angry Creative AB 6 6 */ … … 34 34 ); 35 35 36 $this->_on_update(); 37 38 add_action( 'ac_inspection', function() { 39 AC_Inspector::log("Inspection completed with " . AC_Inspector::$_log_count . " remarks."); 40 }, 999, 0 ); 41 36 42 } 37 43 … … 50 56 } 51 57 58 /* Plugin update actions */ 59 private function _on_update() { 60 61 if ( version_compare(get_option(__CLASS__.'_Version', true), ACI_PLUGIN_VERSION, '<') ) { 62 63 $this->deactivate(); 64 $this->activate(); 65 66 set_option(__CLASS__.'_Version', ACI_PLUGIN_VERSION); 67 68 } 69 70 } 71 52 72 public static function get_log_levels() { 53 73 … … 188 208 189 209 do_action( 'ac_inspection' ); 190 191 self::log("Inspection completed with " . self::$_log_count . " remarks.");192 210 193 211 } -
angry-creative-logger/trunk/classes/routine_handler.php
r839072 r881818 2 2 /* 3 3 Class name: ACI Routine Handler 4 Version: 0. 1.15 Depends: AC Inspector 0. 3.x4 Version: 0.2 5 Depends: AC Inspector 0.4.x 6 6 Author: Sammy Nordström, Angry Creative AB 7 7 */ … … 31 31 } 32 32 33 public static function get_inspection_method($routine, $options = array()) { 34 35 if (empty($routine)) { 36 return false; 37 } 38 39 if (!is_array($options) || empty($options)) { 40 41 $options = self::get_options($routine); 42 43 if (!is_array($options)) { 44 $options = array(); 45 } 46 47 } 48 49 if (class_exists($routine)) { 50 51 if ($options['inspection_method'] && method_exists($routine, $options['inspection_method'])) { 52 53 return array($routine, $options['inspection_method']); 54 55 } else if (method_exists($routine, 'inspect')) { 56 57 return array($routine, 'inspect'); 58 59 } 60 61 } 62 63 if (!empty($options['inspection_method']) && function_exists($options['inspection_method'])) { 64 65 return $options['inspection_method']; 66 67 } else if (function_exists($routine)) { 68 69 return $routine; 70 71 } 72 73 return false; 74 75 } 76 33 77 public static function set_options($routine, $args = array()) { 34 78 … … 67 111 public static function add($routine, $options = array(), $action = "ac_inspection", $priority = 10, $accepted_args = 1) { 68 112 69 if ( empty($routine) ) { 113 $inspection_method = self::get_inspection_method($routine); 114 115 if ( !$inspection_method ) { 70 116 return false; 71 117 } … … 95 141 } 96 142 97 add_action( $action, $ routine, $priority, $accepted_args );143 add_action( $action, $inspection_method, $priority, $accepted_args ); 98 144 99 145 return true; -
angry-creative-logger/trunk/classes/settings.php
r860106 r881818 2 2 /* 3 3 Class name: ACI Settings 4 Version: 0. 1.15 Depends: AC Inspector 0. 3.x4 Version: 0.2 5 Depends: AC Inspector 0.4.x 6 6 Author: Sammy Nordström, Angry Creative AB 7 7 */ … … 215 215 'aci_general_options', 216 216 'General', 217 array( $this, 'print_ log_path_info' ),217 array( $this, 'print_general_settings_info' ), 218 218 'ac-inspector' 219 219 ); … … 232 232 233 233 add_settings_section( 234 'aci_inspection_routine_ options',234 'aci_inspection_routine_settings', 235 235 'Routines on General Inspection', 236 array( $this, 'print_inspection_routine_ options_info' ),236 array( $this, 'print_inspection_routine_settings_info' ), 237 237 'ac-inspector' 238 ); 238 ); 239 240 $routine_fields = array(); 239 241 240 242 foreach( $inspection_routines as $routine ) { 241 243 242 $routine_label = ucwords(str_replace("_", " ", str_replace("wp_", "", str_replace("aci_", "", $routine)))); 243 $routine_options_key = ACI_Routine_Handler::routine_options_key($routine); 244 $routine_settings_fields[$routine] = array(); 245 246 $routine_settings_fields[$routine]['id'] = $routine.'_settings_field'; 247 $routine_settings_fields[$routine]['title'] = ucwords(str_replace("_", " ", str_replace("wp_", "", str_replace("aci_", "", str_replace("routine_", "", strtolower($routine)))))); 248 $routine_settings_fields[$routine]['callback'] = array( &$this, 'routine_settings_field' ); 249 $routine_settings_fields[$routine]['page'] = 'ac-inspector'; 250 $routine_settings_fields[$routine]['section'] = 'aci_inspection_routine_settings'; 251 $routine_settings_fields[$routine]['args'] = array('routine' => $routine); 252 253 $routine_settings_fields[$routine] = apply_filters( $routine.'_settings_field_args', $routine_settings_fields[$routine] ); 254 255 } 256 257 foreach( $routine_settings_fields as $routine_field ) { 244 258 245 259 add_settings_field( 246 $routine .'_log_level',247 $routine_ label,248 array( $this, 'log_level_field' ),249 'ac-inspector',250 'aci_inspection_routine_options',251 array('routine' => $routine)260 $routine_field['id'], 261 $routine_field['title'], 262 $routine_field['callback'], 263 $routine_field['page'], 264 $routine_field['section'], 265 $routine_field['args'] 252 266 ); 253 267 254 268 } 255 269 … … 261 275 262 276 add_settings_section( 263 'aci_wp_hook_routine_ options',277 'aci_wp_hook_routine_settings', 264 278 'Routines on WP Hooks', 265 array( $this, 'print_wp_hook_routine_ options_info' ),279 array( $this, 'print_wp_hook_routine_settings_info' ), 266 280 'ac-inspector' 267 281 ); … … 269 283 foreach( $wp_hook_routines as $routine ) { 270 284 271 $routine_label = ucwords(str_replace("_", " ", str_replace("wp_", "", str_replace("aci_", "", $routine)))); 272 $routine_options_key = ACI_Routine_Handler::routine_options_key($routine); 285 $routine_settings_fields[$routine] = array(); 286 287 $routine_settings_fields[$routine]['id'] = $routine.'_settings_field'; 288 $routine_settings_fields[$routine]['title'] = ucwords(str_replace("_", " ", str_replace("wp_", "", str_replace("aci_", "", str_replace("routine_", "", strtolower($routine)))))); 289 $routine_settings_fields[$routine]['callback'] = array( &$this, 'routine_settings_field' ); 290 $routine_settings_fields[$routine]['page'] = 'ac-inspector'; 291 $routine_settings_fields[$routine]['section'] = 'aci_wp_hook_routine_settings'; 292 $routine_settings_fields[$routine]['args'] = array('routine' => $routine); 293 294 $routine_settings_fields[$routine] = apply_filters( $routine.'_settings_field_args', $routine_settings_fields[$routine] ); 295 296 } 297 298 foreach( $routine_settings_fields as $routine_field ) { 273 299 274 300 add_settings_field( 275 $routine .'_log_level',276 $routine_ label,277 array( $this, 'log_level_field' ),278 'ac-inspector',279 'aci_wp_hook_routine_options',280 array('routine' => $routine)301 $routine_field['id'], 302 $routine_field['title'], 303 $routine_field['callback'], 304 $routine_field['page'], 305 $routine_field['section'], 306 $routine_field['args'] 281 307 ); 282 308 283 309 } 284 310 … … 311 337 foreach( array_keys($routines) as $routine ) { 312 338 313 $routine_ options = ACI_Routine_Handler::get_options($routine);314 $new_routine_ options = $input[$routine];315 316 foreach($routine_ options as $opt => $val) {317 318 if (isset($new_routine_ options[$opt])) {319 $routine_ options[$opt] = $new_routine_options[$opt];339 $routine_settings = ACI_Routine_Handler::get_options($routine); 340 $new_routine_settings = $input[$routine]; 341 342 foreach($routine_settings as $opt => $val) { 343 344 if (isset($new_routine_settings[$opt])) { 345 $routine_settings[$opt] = $new_routine_settings[$opt]; 320 346 } 321 347 322 348 } 323 349 324 ACI_Routine_Handler::set_options( $routine, $routine_options ); 350 $routine_settings = apply_filters( $routine.'_settings', $routine_settings ); 351 352 echo $routine . "<br />"; 353 354 var_dump($routine_settings); 355 356 ACI_Routine_Handler::set_options( $routine, $routine_settings ); 325 357 326 358 } … … 344 376 } 345 377 346 public function print_ log_path_info() {378 public function print_general_settings_info() { 347 379 348 380 print 'These are your general settings:'; … … 350 382 } 351 383 352 public function print_inspection_routine_ options_info() {384 public function print_inspection_routine_settings_info() { 353 385 354 386 print 'Below you can set options for your inspection routines on scheduled and user activated inspections:'; … … 356 388 } 357 389 358 public function print_wp_hook_routine_ options_info() {390 public function print_wp_hook_routine_settings_info() { 359 391 360 392 print 'Below you can set options for your inspection routines triggered by Wordpress hooks:'; … … 370 402 } 371 403 372 public function log_level_field($args) {404 public function routine_settings_field($args) { 373 405 374 406 $routine = $args['routine']; 375 407 $log_levels = AC_Inspector::get_log_levels(); 376 $routine_ options = ACI_Routine_Handler::get_options($routine);408 $routine_settings = ACI_Routine_Handler::get_options($routine); 377 409 378 410 ?> … … 384 416 <?php foreach( $log_levels as $level ) { ?> 385 417 386 <option value="<?php echo $level; ?>"<?php echo ($level == $routine_ options['log_level']) ? " selected" : ""; ?>><?php echo ucfirst($level); ?></option>418 <option value="<?php echo $level; ?>"<?php echo ($level == $routine_settings['log_level']) ? " selected" : ""; ?>><?php echo ucfirst($level); ?></option> 387 419 388 420 <?php } ?> … … 393 425 <?php 394 426 427 do_action($routine.'_settings_field', $routine_settings, $args); 428 395 429 } 396 430 -
angry-creative-logger/trunk/plugin.php
r860106 r881818 4 4 Plugin URI: http://angrycreative.se 5 5 Description: Inspects and logs possible issues with your Wordpress installation. 6 Version: 0. 3.36 Version: 0.4 7 7 Author: Robin Björklund, Sammy Nordström, Angry Creative AB 8 8 */ 9 9 10 define('ACI_PLUGIN_DIR', dirname( __FILE__ ) ); 11 define('ACI_PLUGIN_FILE', __FILE__ ); 12 define('ACI_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); 10 define( 'ACI_PLUGIN_VERSION', '0.4' ); 11 12 define( 'ACI_PLUGIN_DIR', dirname( __FILE__ ) ); 13 define( 'ACI_PLUGIN_FILE', __FILE__ ); 14 define( 'ACI_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); 13 15 14 16 // Needed for multisite support … … 25 27 26 28 // Load inspection routines 27 require( ACI_PLUGIN_DIR . "/routines.php" ); 29 foreach ( glob( ACI_PLUGIN_DIR."/routines/*.php" ) as $routine_file ) { 30 include $routine_file; 31 } 28 32 29 33 // If in admin, also load settings class -
angry-creative-logger/trunk/readme.txt
r860106 r881818 3 3 Tags: inspect, inspection, monitor, monitoring, log, logging, check, checking, validate, validation, permissions, install, installation 4 4 Requires at least: 3.0.1 5 Tested up to: 3.8 6 Stable tag: 0. 3.35 Tested up to: 3.8.1 6 Stable tag: 0.4 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 22 22 == Changelog == 23 23 24 = 0.4.x = 25 * New routine with git support for checking file system changes 26 * Improved pluggability and custom routines support 27 * Added version-awareness and re-activation on update 28 24 29 = 0.3.x = 25 30 * Completely rewritten sources abstracting settings and inspection routines
Note: See TracChangeset
for help on using the changeset viewer.