Plugin = new stdClass; $this->Cap = new stdClass; $this->Form = new stdClass; $this->Site = new stdClass; $this->Env = new stdClass; $this->User = new stdClass; $this->ThirdParty = new stdClass; $this->Link = new stdClass; $this->Api = new stdClass; $this->Helper = new stdClass; } public function init() { add_action( 'plugins_loaded' , array( $this , 'plugins_loaded' ) , 20 ); add_action( 'setup_theme' , array( $this , 'setup_theme' ) , 20 ); add_action( 'after_setup_theme' , array( $this , 'after_setup_theme' ) , 20 ); add_action( 'init' , array( $this , 'wp_init' ) , 20 ); add_action( 'wp_loaded' , array( $this , 'wp_loaded' ) , 20 ); } public function plugins_loaded() { $this->define_constants(); $this->includes(); do_action( $this->main_slug . '_plugins_loaded' ); add_action( $this->main_slug . '_screen' , array( $this , 'screen' ) ); } private function define_constants() { $this->name = 'Archive Post Sort Customize'; $this->ver = '1.6.1'; $this->main_slug = 'apsc'; $this->ltd = 'apsc'; $this->plugin_dir = plugin_dir_path( __FILE__ ); $this->plugin_url = plugin_dir_url( __FILE__ ); $this->plugin_slug = str_replace( '.php' , '' , basename( dirname( __FILE__ ) ) ); load_plugin_textdomain( $this->ltd , false , $this->plugin_slug . '/languages' ); include_once( $this->plugin_dir . 'core/api.php' ); include_once( $this->plugin_dir . 'core/helper.php' ); $this->Api = new APSC_Api(); $this->Helper = new APSC_Helper(); } private function includes() { $includes = array( 'core/init.php', 'core/init_add.php', 'third-party/third-party.php', 'admin/master.php', 'front/master.php', ); $this->Helper->includes( $includes ); } public function setup_theme() { do_action( $this->main_slug . '_setup_theme' ); } public function after_setup_theme() { do_action( $this->main_slug . '_after_setup_theme' ); } public function wp_init() { do_action( $this->main_slug . '_init' ); } public function wp_loaded() { if( $this->Env->is_cron ) { do_action( $this->main_slug . '_cron' ); } else { do_action( $this->main_slug . '_after_init' ); if( $this->Env->is_ajax ) { do_action( $this->main_slug . '_ajax' ); } else { do_action( $this->main_slug . '_screen' ); } } } public function screen() { if( !empty( $this->ThirdParty->debug_bar ) ) { add_filter( 'debug_bar_panels' , array( $this , 'debug_bar_panels' ) ); } } public function debug_bar_panels( $panels ) { if ( !class_exists( 'Debug_Bar_Panel' ) ) { return $panels; } $this->Helper->includes( 'controller/debug-bar.php' ); $panels[] = new APSC_Debug_Panel(); return $panels; } } $GLOBALS['APSC'] = new APSC(); $GLOBALS['APSC']->init(); endif;