function awpcp_modules_manager() { static $instance = null; if (is_null($instance)) { $instance = new AWPCP_ModulesManager(awpcp(), awpcp_licenses_manager(), awpcp_modules_updater(), awpcp()->settings); } return $instance; }
/** * Single entry point for AWPCP plugin. * * This is functional but still a work in progress... */ public function setup() { global $wpdb; if (!$this->is_up_to_date()) { $this->installer->install_or_upgrade(); // we can't call flush_rewrite_rules() because // $wp_rewrite is not available yet. It is initialized // after plugins_load hook is executed. $this->flush_rewrite_rules = true; } if (!$this->is_up_to_date()) { return; } $this->setup_register_settings_handlers(); // Ad metadata integration. $wpdb->awpcp_admeta = AWPCP_TABLE_AD_META; $this->settings->setup(); $this->modules_manager = awpcp_modules_manager(); $this->modules_updater = awpcp_modules_updater(); $this->payments = awpcp_payments_api(); $this->listings = awpcp_listings_api(); $this->admin = new AWPCP_Admin(); $this->panel = new AWPCP_User_Panel(); $this->compatibility = new AWPCP_Compatibility(); $this->compatibility->load_plugin_integrations(); add_action('generate_rewrite_rules', array($this, 'clear_categories_list_cache')); add_action('init', array($this, 'init')); add_action('init', array($this, 'register_custom_style'), 1000000); add_action('admin_init', array($this, 'check_compatibility_with_premium_modules')); add_action('admin_notices', array($this, 'admin_notices')); add_action('admin_notices', array($this->modules_manager, 'show_admin_notices')); add_action('awpcp_register_settings', array($this, 'register_settings')); add_action('awpcp-register-payment-term-types', array($this, 'register_payment_term_types')); add_action('awpcp-register-payment-methods', array($this, 'register_payment_methods')); add_filter('pre_set_site_transient_update_plugins', array($this->modules_updater, 'filter_plugins_version_information')); add_filter('plugins_api', array($this->modules_updater, 'filter_detailed_plugin_information'), 10, 3); add_filter('http_request_args', array($this->modules_updater, 'filter_http_request_args'), 10, 2); add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 1000); add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1000); add_action('wp_footer', array($this, 'localize_scripts'), 15000); add_action('admin_footer', array($this, 'localize_scripts'), 15000); // some upgrade operations can't be done in background. // if one those is pending, we will disable all other features // until the user executes the upgrade operaton if (!get_option('awpcp-pending-manual-upgrade')) { $this->pages = new AWPCP_Pages(); add_action('awpcp-process-payment-transaction', array($this, 'process_transaction_update_payment_status')); add_action('awpcp-process-payment-transaction', array($this, 'process_transaction_notify_wp_affiliate_platform')); add_action('wp_ajax_awpcp-get-regions-options', array($this, 'get_regions_options')); add_action('wp_ajax_nopriv_awpcp-get-regions-options', array($this, 'get_regions_options')); // actions and filters from functions_awpcp.php add_action('phpmailer_init', 'awpcp_phpmailer_init_smtp'); add_action('widgets_init', array($this, 'register_widgets')); if (get_awpcp_option('awpcppagefilterswitch') == 1) { add_filter('wp_list_pages_excludes', 'exclude_awpcp_child_pages'); } awpcp_schedule_activation(); $this->modules_manager->load_modules(); } }