Plugin Directory

Changeset 939635


Ignore:
Timestamp:
06/27/2014 01:47:26 PM (12 years ago)
Author:
samface
Message:

Added fixes that prevent multiple instantiating and triggering of action hooks

Location:
angry-creative-logger/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • angry-creative-logger/trunk/classes/inspector.php

    r882977 r939635  
    22/*
    33Class name: AC Inspector
    4 Version: 0.4.1
     4Version: 0.4.2
    55Author: Sammy Nordström, Angry Creative AB
    66*/
     
    99
    1010    class AC_Inspector {
     11
     12        private static $_this;
    1113
    1214        public static $log_path = "";
     
    1921        public function __construct() {
    2022
    21             self::$_default_log_path = ACI_PLUGIN_DIR . '/inspection.log';
    22 
    23             $this->_get_log_path();
    24 
    25             $this->_check_log_path();
    26 
    27             // Define log levels
    28             self::$_log_levels = array(
    29                 'notice',
    30                 'warning',
    31                 'fatal',
    32                 'ignore'
    33             );
    34 
    35             $this->_on_update();
    36 
    37             add_action( 'ac_inspection', function() {
    38                 AC_Inspector::log("Inspection completed with " . AC_Inspector::$log_count . " remarks.");
    39             }, 999, 0 );
    40 
     23            if ( !isset( self::$_this ) ) {
     24
     25                self::$_this = $this;
     26
     27                self::$_default_log_path = ACI_PLUGIN_DIR . '/inspection.log';
     28
     29                $this->_get_log_path();
     30
     31                $this->_check_log_path();
     32
     33                // Define log levels
     34                self::$_log_levels = array(
     35                    'notice',
     36                    'warning',
     37                    'fatal',
     38                    'ignore'
     39                );
     40
     41                $this->_on_update();
     42
     43                add_action( 'ac_inspection', function() {
     44                    AC_Inspector::log("Inspection completed with " . AC_Inspector::$log_count . " remarks.");
     45                }, 999, 0 );
     46
     47            }
     48
     49        }
     50
     51        static function this() {
     52            return self::$_this;
    4153        }
    4254
     
    4456        public static function activate() {
    4557
    46             wp_schedule_event( time(), 'daily', 'ac_inspection');
     58            if ( !wp_next_scheduled( 'ac_inspection' ) ) {
     59
     60                wp_schedule_event( time(), 'daily', 'ac_inspection');
     61
     62            }
    4763
    4864        }
     
    208224        public function inspect() {
    209225
    210             do_action( 'ac_inspection' );
     226            if ( !did_action( 'ac_inspection' ) ) {
     227
     228                do_action( 'ac_inspection' );
     229
     230            }
    211231
    212232        }
  • angry-creative-logger/trunk/classes/routine_handler.php

    r882244 r939635  
    22/*
    33Class name: ACI Routine Handler
    4 Version: 0.2.1
     4Version: 0.2.2
    55Depends: AC Inspector 0.4.x
    66Author: Sammy Nordström, Angry Creative AB
     
    130130
    131131            self::$routine_events[$routine][] = $action;
     132
     133            if ( has_action( $action, $inspection_method ) === $priority ) {
     134                return false;
     135            }
    132136
    133137            if ( !empty( $options ) ) {
  • angry-creative-logger/trunk/plugin.php

    r882244 r939635  
    44Plugin URI: http://angrycreative.se
    55Description: Inspects and logs possible issues with your Wordpress installation.
    6 Version: 0.4.1
     6Version: 0.4.2
    77Author: Robin Björklund, Sammy Nordström, Angry Creative AB
    88*/
    99
    10 define( 'ACI_PLUGIN_VERSION', '0.4.1' );
     10define( 'ACI_PLUGIN_VERSION', '0.4.2' );
    1111
    1212define( 'ACI_PLUGIN_DIR', dirname( __FILE__ ) );
  • angry-creative-logger/trunk/readme.txt

    r882244 r939635  
    33Tags: inspect, inspection, monitor, monitoring, log, logging, check, checking, validate, validation, permissions, install, installation
    44Requires at least: 3.0.1
    5 Tested up to: 3.8.1
    6 Stable tag: 0.4.1
     5Tested up to: 3.9.1
     6Stable tag: 0.4.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.