sync = new Parcelflare_Sync_Service(); $this->sync->hooks(); Parcelflare_Alerts::hooks(); Parcelflare_Health::hooks(); Parcelflare_Reviews::hooks(); add_action( self::DAILY_HOOK, array( 'Parcelflare_Logger', 'purge' ) ); add_action( 'init', array( $this, 'schedule_maintenance' ) ); if ( is_admin() ) { require_once PARCELFLARE_DIR . 'includes/admin/class-parcelflare-admin.php'; $this->admin = new Parcelflare_Admin( $this->sync ); $this->admin->hooks(); } /** * Fires when the plugin is ready. Extensions can hook in here. * * @param Parcelflare_Plugin $plugin Plugin. */ do_action( 'parcelflare_loaded', $this ); } /** * Translations. */ public function load_textdomain() { // WordPress.org language packs load automatically (WP 4.6+); only bundled files need loading here. if ( ! is_textdomain_loaded( 'parcelflare' ) && is_readable( PARCELFLARE_DIR . 'languages/parcelflare-' . determine_locale() . '.mo' ) ) { load_textdomain( 'parcelflare', PARCELFLARE_DIR . 'languages/parcelflare-' . determine_locale() . '.mo' ); } } /** * Ensure the daily maintenance action exists. */ public function schedule_maintenance() { if ( function_exists( 'as_has_scheduled_action' ) && ! as_has_scheduled_action( self::DAILY_HOOK ) ) { as_schedule_recurring_action( time() + HOUR_IN_SECONDS, DAY_IN_SECONDS, self::DAILY_HOOK, array(), Parcelflare_Sync_Service::GROUP ); } } /** * Notice if WooCommerce is missing. */ public function missing_wc_notice() { echo '

' . esc_html__( 'Parcelflare needs WooCommerce to be installed and active.', 'parcelflare' ) . '

'; } /** * Activation. */ public static function activate() { Parcelflare_Logger::install(); Parcelflare_Reviews::record_install(); if ( false === get_option( Parcelflare_Settings::OPTION ) ) { add_option( Parcelflare_Settings::OPTION, Parcelflare_Settings::defaults(), '', false ); } } /** * Deactivation: stop scheduled work (queued syncs are kept so nothing is lost). */ public static function deactivate() { if ( function_exists( 'as_unschedule_all_actions' ) ) { as_unschedule_all_actions( self::DAILY_HOOK ); as_unschedule_all_actions( Parcelflare_Health::HOOK ); } } }