/**
  * Construct Settings manager.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->add_ajax_action(self::AJAX_ACTION_UPDATE_PAGES, 'ajax_action_update_pages');
     $this->add_ajax_action(self::AJAX_ACTION_TOGGLE_MENU, 'ajax_action_toggle_menu');
     $this->add_ajax_action(self::AJAX_ACTION_CREATE_MENU, 'ajax_action_create_menu');
 }
 /**
  * Prepare the Billing manager.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->add_ajax_action(self::AJAX_ACTION_TRANSACTION_UPDATE, 'ajax_change_transaction');
     $this->add_ajax_action(self::AJAX_ACTION_TRANSACTION_LINK, 'ajax_link_transaction');
     $this->add_ajax_action(self::AJAX_ACTION_TRANSACTION_LINK_DATA, 'ajax_link_data_transaction');
 }
 /**
  * Prepare the Import manager.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->add_ajax_action(self::AJAX_ACTION_IMPORT, 'ajax_action_import');
     $this->add_ajax_action(self::AJAX_ACTION_MATCH, 'ajax_action_match');
     $this->add_ajax_action(self::AJAX_ACTION_RETRY, 'ajax_action_retry');
 }
 /**
  * Prepare the Rule manager.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->add_ajax_action(self::AJAX_ACTION_CHANGE_MEMBERSHIPS, 'ajax_action_change_memberships');
     $this->add_ajax_action(self::AJAX_ACTION_UPDATE_MATCHING, 'ajax_action_update_matching');
     $this->add_ajax_action(self::AJAX_ACTION_UPDATE_DRIPPED, 'ajax_action_update_dripped');
     $this->add_action('ms_controller_protection_admin_page', 'edit_rule_manager');
 }
 /**
  * Prepare the Member manager.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->add_action('ms_controller_membership_setup_completed', 'add_current_user');
     $this->add_ajax_action(self::AJAX_ACTION_CHANGE_MEMBERSHIPS, 'ajax_action_change_memberships');
     $this->add_ajax_action(self::AJAX_ACTION_VALIDATE_FIELD, 'ajax_action_validate_field');
     $this->add_ajax_action(self::AJAX_ACTION_SEARCH, 'ajax_action_search');
 }
Example #6
0
 /**
  * Initialize the Add-On.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     self::$model = MS_Factory::load('MS_Model_Addon');
     self::$settings = MS_Factory::load('MS_Model_Settings');
     $this->add_filter('ms_model_addon_register', 'register');
     $this->add_action('ms_model_addon_initialize', 'init_addon');
     $this->add_ajax_action($this->ajax_action(), 'ajax_update_settings');
 }
 /**
  * Prepare the Membership manager.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->add_ajax_action(self::AJAX_ACTION_TOGGLE_MEMBERSHIP, 'ajax_action_toggle_membership');
     $this->add_ajax_action(self::AJAX_ACTION_UPDATE_MEMBERSHIP, 'ajax_action_update_membership');
     $this->add_ajax_action(self::AJAX_ACTION_SET_CUSTOM_FIELD, 'ajax_action_set_custom_field');
     // Tries to auto-detect the currently displayed membership-ID.
     $this->add_filter('ms_detect_membership_id', 'autodetect_membership');
 }
 /**
  * Prepare Membership settings manager.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     do_action('ms_controller_communication_before', $this);
     $this->add_ajax_action(self::AJAX_ACTION_UPDATE_COMM, 'ajax_action_update_communication');
     $this->add_action('ms_controller_membership_setup_completed', 'auto_setup_communications');
     $this->add_action('ms_model_event', 'process_event', 10, 2);
     $this->add_action('ms_cron_process_communications', 'process_queue');
     do_action('ms_controller_communication_after', $this);
 }
 /**
  * Prepare the Dialog manager.
  *
  * @since  1.0.0
  * @internal
  */
 public function __construct()
 {
     parent::__construct();
     // Listen to Ajax requests that want to display a popup.
     $this->add_ajax_action('ms_dialog', 'ajax_dialog');
     // Listen to Ajax requests that submit form data.
     $this->add_ajax_action('ms_submit', 'ajax_submit');
     // Login. For IE this hook is listening to guests + logged in users.
     $this->add_ajax_action('ms_login', 'ajax_login', true, true);
     $this->add_ajax_action('ms_lostpass', 'ajax_lostpass', true, true);
 }
 /**
  * Prepare the Dialog manager.
  *
  * @since  1.0.0
  * @access public
  */
 public function __construct()
 {
     parent::__construct();
     // Listen to Ajax requests that want to display a popup.
     $this->add_ajax_action('ms_dialog', 'ajax_dialog');
     // Listen to Ajax requests that submit form data.
     $this->add_ajax_action('ms_submit', 'ajax_submit');
     // Login.
     $this->add_ajax_action('ms_login', 'ajax_login', false, true);
     $this->add_ajax_action('ms_lostpass', 'ajax_lostpass', false, true);
 }
 /**
  * Prepare the metabox.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->metabox_title = __('Membership Access', 'membership2');
     $post_types = array_merge(array('page', 'post', 'attachment'), array());
     $this->post_types = apply_filters('ms_controller_membership_metabox_add_meta_boxes_post_types', $post_types);
     if (!MS_Plugin::is_enabled()) {
         return $this;
     }
     $this->add_action('add_meta_boxes', 'add_meta_boxes', 10);
     $this->add_action('admin_enqueue_scripts', 'admin_enqueue_scripts');
     $this->add_ajax_action(self::AJAX_ACTION_TOGGLE_ACCESS, 'ajax_action_toggle_metabox_access');
     // Populates the WP editor with default contents of a page
     $this->add_action('the_editor_content', 'show_default_content');
 }
 /**
  * Prepare the gateway controller.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->add_action('template_redirect', 'process_actions', 1);
     $this->add_action('ms_controller_gateway_settings_render_view', 'gateway_settings_edit');
     $this->add_action('ms_view_shortcode_invoice_purchase_button', 'purchase_button', 10, 2);
     $this->add_action('ms_view_frontend_payment_purchase_button', 'purchase_button', 10, 2);
     $this->add_action('ms_controller_frontend_signup_gateway_form', 'gateway_form_mgr', 1);
     $this->add_action('ms_controller_frontend_signup_process_purchase', 'process_purchase', 1);
     $this->add_filter('ms_view_shortcode_membershipsignup_cancel_button', 'cancel_button', 10, 2);
     $this->add_action('ms_view_shortcode_account_card_info', 'card_info');
     $this->add_action('pre_get_posts', 'handle_payment_return', 1);
     $this->add_action('ms_gateway_transaction_log', 'log_transaction', 10, 7);
     $this->add_action('ms_controller_frontend_enqueue_scripts', 'enqueue_scripts');
     $this->add_ajax_action(self::AJAX_ACTION_TOGGLE_GATEWAY, 'toggle_ajax_action');
     $this->add_ajax_action(self::AJAX_ACTION_UPDATE_GATEWAY, 'ajax_action_update_gateway');
 }
 /**
  * Construct Settings manager.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     /*
      * Check if the user wants to manually run the Cron services.
      * This block calls the action 'ms_run_cron_services' which is defined
      * in MS_Model_Plugin. It will run all cron jobs and re-schedule them.
      *
      * @since  1.0.0
      */
     if (isset($_REQUEST['run_cron'])) {
         $url = esc_url_raw(remove_query_arg('run_cron'));
         do_action('ms_run_cron_services', $_REQUEST['run_cron']);
         wp_safe_redirect($url);
         exit;
     }
     $this->add_action('ms_controller_membership_setup_completed', 'auto_setup_settings');
     $this->add_ajax_action(self::AJAX_ACTION_TOGGLE_SETTINGS, 'ajax_action_toggle_settings');
     $this->add_ajax_action(self::AJAX_ACTION_UPDATE_SETTING, 'ajax_action_update_setting');
     $this->add_ajax_action(self::AJAX_ACTION_UPDATE_CUSTOM_SETTING, 'ajax_action_update_custom_setting');
     $this->add_ajax_action(self::AJAX_ACTION_UPDATE_PROTECTION_MSG, 'ajax_action_update_protection_msg');
 }
 /**
  * Prepare for Member registration.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     if (MS_Plugin::is_enabled()) {
         do_action('ms_controller_frontend_construct', $this);
         // Process actions like register new account.
         $this->add_action('template_redirect', 'process_actions', 1);
         // Check if the current page is a Membership Page.
         $this->add_action('template_redirect', 'check_for_membership_pages', 2);
         // Propagates SSL cookies when user logs in.
         $this->add_action('wp_login', 'propagate_ssl_cookie', 10, 2);
         // Enqueue scripts.
         $this->add_action('wp_enqueue_scripts', 'enqueue_scripts');
         // Add classes for all memberships the user is registered to.
         $this->add_filter('body_class', 'body_class');
         // Clears the shortcode memory at the beginning of the_content
         $this->add_filter('the_content', 'clear_content_memory', 1);
         // Compact code for output on the front end.
         add_filter('ms_compact_code', array('MS_Helper_Html', 'compact_code'));
         /**
          * This allows WordPress to provide the default register form.
          *
          * Set the filter response to FALSE to stop Membership2 from
          * handling the registration process. WordPress or other plugins can
          * register users in that case.
          *
          * @since  1.0.0
          */
         self::$handle_registration = apply_filters('ms_frontend_handle_registration', true);
         if (self::$handle_registration) {
             // Set the registration URL to the 'Register' Membership Page.
             $this->add_filter('wp_signup_location', 'signup_location', 999);
             $this->add_filter('register_url', 'signup_location', 999);
         }
         // Redirect users to their Account page after login.
         $this->add_filter('login_redirect', 'login_redirect', 10, 3);
         $this->add_action('wp_logout', 'logout_redirect', 10);
     }
 }
 /**
  * Prepare the Add-on manager.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->add_action('ms_controller_membership_setup_completed', 'auto_setup_addons');
     $this->add_ajax_action(self::AJAX_ACTION_TOGGLE_ADDON, 'ajax_action_toggle_addon');
 }
 /**
  * Prepare the Admin Bar simulator.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->run_action('init', 'init_adminbar', 1);
 }
 /**
  * Customize the URL used for the view-list
  *
  * @since  1.0.0
  * @param  string $url The URL
  * @return string The URL
  */
 public function view_url($url)
 {
     $menu_id = MS_Controller::get_request_field('menu_id', 0, 'REQUEST');
     $url = esc_url_raw(add_query_arg('menu_id', $menu_id, $url));
     return $url;
 }
 /**
  * Constructs the primary Plugin controller.
  *
  * Created by the MS_Plugin object during the setup_theme action.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     /**
      * Fix for IE: This is a privacy policy which states, that we do not
      * collect personal contact information without consent.
      *
      * Note that other plugins that output this header later will overwrite
      * it! So this is a default value if no other file sends the P3P header.
      *
      * @since  1.0.2.2
      */
     $p3p_done = false;
     foreach (headers_list() as $header) {
         if (false !== stripos($header, 'P3P:')) {
             $p3p_done = true;
             break;
         }
     }
     if (!$p3p_done) {
         header('P3P:CP="NOI"');
     }
     /*
      * Remove the "&msg" attribute from the URL if it was already present in
      * the previous request.
      */
     if (empty($_POST)) {
         /*
          * No form was submitted:
          * It's save to redirect the request without losing form-data.
          */
         if (isset($_GET['msg']) && isset($_SERVER['HTTP_REFERER']) && MS_Helper_Utility::is_current_url($_SERVER['HTTP_REFERER'])) {
             // A msg is set AND the referer URL has the same msg flag!
             $url = esc_url_raw(remove_query_arg(array('msg')));
             wp_safe_redirect($url);
             exit;
         }
     }
     /**
      * We allow two ways to modify the default Admin-Capability setting:
      *
      * Either by defining the constant in wp-config or by using the filter.
      * The constant takes priority over the filter.
      *
      * @since  1.0.0
      */
     if (defined('MS_ADMIN_CAPABILITY')) {
         $this->capability = MS_ADMIN_CAPABILITY;
     } else {
         $this->capability = apply_filters('ms_admin_user_capability', $this->capability);
     }
     // Create core controllers that are available on every page.
     $this->model = MS_Factory::load('MS_Model_Plugin');
     $this->dialogs = MS_Factory::load('MS_Controller_Dialog');
     $this->controllers['widget'] = MS_Factory::load('MS_Controller_Widget');
     $this->controllers['membership'] = MS_Factory::load('MS_Controller_Membership');
     $this->controllers['protection'] = MS_Factory::load('MS_Controller_Protection');
     $this->controllers['rule'] = MS_Factory::load('MS_Controller_Rule');
     $this->controllers['member'] = MS_Factory::load('MS_Controller_Member');
     $this->controllers['billing'] = MS_Factory::load('MS_Controller_Billing');
     $this->controllers['addon'] = MS_Factory::load('MS_Controller_Addon');
     $this->controllers['pages'] = MS_Factory::load('MS_Controller_Pages');
     $this->controllers['settings'] = MS_Factory::load('MS_Controller_Settings');
     $this->controllers['communication'] = MS_Factory::load('MS_Controller_Communication');
     $this->controllers['gateway'] = MS_Factory::load('MS_Controller_Gateway');
     $this->controllers['admin_bar'] = MS_Factory::load('MS_Controller_Adminbar');
     $this->controllers['membership_metabox'] = MS_Factory::load('MS_Controller_Metabox');
     $this->controllers['membership_shortcode'] = MS_Factory::load('MS_Controller_Shortcode');
     $this->controllers['frontend'] = MS_Factory::load('MS_Controller_Frontend');
     $this->controllers['import'] = MS_Factory::load('MS_Controller_Import');
     $this->controllers['help'] = MS_Factory::load('MS_Controller_Help');
     // API should be the last Controller to create.
     $this->controllers['api'] = MS_Controller_Api::instance();
     // Register all available styles and scripts. Nothing is enqueued.
     $this->add_action('wp_loaded', 'wp_loaded');
     // Setup plugin admin UI.
     $this->add_action('admin_menu', 'add_menu_pages');
     if (MS_Plugin::is_network_wide()) {
         $this->add_action('network_admin_menu', 'add_menu_pages');
     }
     // Select the right page to display.
     $this->add_action('admin_init', 'route_submenu_request');
     // This will do the ADMIN-SIDE initialization of the controllers
     $this->add_action('ms_plugin_admin_setup', 'run_admin_init');
     // Changes the current themes "single" template to the invoice form when an invoice is displayed.
     $this->add_filter('single_template', 'custom_single_template');
     $this->add_filter('page_template', 'custom_page_template');
     // Register styles and javascripts for use in front-end
     $this->add_action('ms_register_public_scripts', 'register_public_scripts');
     $this->add_action('ms_register_public_scripts', 'register_public_styles');
     $this->add_action('wp_enqueue_scripts', 'enqueue_plugin_styles');
     $this->add_action('wp_enqueue_scripts', 'enqueue_plugin_scripts');
 }
 /**
  * Prepare the shortcode hooks.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->run_action('init', 'init');
 }
 /**
  * Construct Settings manager.
  *
  * @since  1.0.0
  * @internal
  */
 public function __construct()
 {
     parent::__construct();
     $this->settings = MS_Plugin::instance()->settings;
     /**
      * Simple check to allow other plugins to quickly find out if
      * Membership2 is loaded and the API was initialized.
      *
      * Example:
      *   if ( apply_filters( 'ms_active', false ) ) { ... }
      */
     add_filter('ms_active', '__return_true');
     /**
      * Make the API controller accessible via MS_Plugin::$api
      */
     MS_Plugin::set_api($this);
     /**
      * Notify other plugins that Membership2 is ready.
      */
     do_action('ms_init', $this);
 }
 /**
  * Prepare the component.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
 }
Example #22
0
 /**
  * Construct Settings manager.
  *
  * @since  1.0.0
  * @internal
  */
 public function __construct()
 {
     parent::__construct();
     $this->settings = MS_Plugin::instance()->settings;
     /**
      * Simple check to allow other plugins to quickly find out if
      * Membership2 is loaded and the API was initialized.
      *
      * Example:
      *   if ( apply_filters( 'ms_active', false ) ) { ... }
      *
      * @since  1.0.0
      */
     add_filter('ms_active', '__return_true');
     /**
      * Returns the API object.
      *
      * Example:
      *   $api = apply_filters( 'ms_api', false );
      *
      * Alternative:
      *   $api = MS_Plugin::$api;
      *
      * @since  1.0.1.2
      */
     add_filter('ms_api', array($this, 'return_api'));
     /**
      * Make the API controller accessible via static property.
      *
      * Example:
      *   $api = MS_Plugin::$api;
      *
      * Alternative:
      *   $api = apply_filters( 'ms_api', false );
      *
      * @since  1.0.0
      */
     MS_Plugin::set_api($this);
     /**
      * Notify other plugins that Membership2 is ready.
      *
      * @since  1.0.0
      */
     do_action('ms_init', $this);
 }
 /**
  * Prepare the Import manager.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->add_ajax_action(self::AJAX_ACTION_IMPORT, 'ajax_action_import');
 }
 /**
  * Register available widgets.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     // Load the add-on manager model.
     $this->add_action('widgets_init', 'register_widgets');
 }