コード例 #1
0
 public function onInit()
 {
     add_action('wp_enqueue_scripts', array($this, 'load_shortcode_specific_scripts'));
     add_action('wp_head', array($this, 'handle_wp_head_hook'));
     //actions & filters
     add_action('template_redirect', array($this, 'onTemplateRedirect'));
     add_action('admin_menu', array($this, 'onAdminMenu'));
     add_action('current_screen', array($this, 'onCurrentScreen'));
     add_action('wp_ajax_wpam-ajax_request', array($this, 'onAjaxRequest'));
     add_filter('pre_user_email', array($this, 'filterUserEmail'));
     //set the locale for money format & paypal
     $this->locale = WPAM_LOCALE_OVERRIDE ? WPAM_LOCALE_OVERRIDE : get_locale();
     $this->setloc = $this->setMonetaryLocale($this->locale);
     //loading provided locale didn't work, choose default
     if (!$this->setloc && setlocale(LC_MONETARY, 0) == 'C') {
         setlocale(LC_MONETARY, '');
     }
     add_action('admin_notices', array($this, 'showAdminMessages'));
     if (!is_admin()) {
         add_filter('widget_text', 'do_shortcode');
     }
     add_shortcode('AffiliatesRegister', array($this->publicPages[self::PAGE_NAME_REGISTER], 'doShortcode'));
     add_shortcode('AffiliatesHome', array($this->publicPages[self::PAGE_NAME_HOME], 'doShortcode'));
     add_shortcode('AffiliatesLogin', array($this, 'doLoginShortcode'));
     add_action('save_post', array($this, 'onSavePage'), 10, 2);
     try {
         if (isset($_GET[WPAM_PluginConfig::$RefKey])) {
             $requestTracker = new WPAM_Tracking_RequestTracker();
             $query_args = $_GET;
             $requestTracker->handleIncomingReferral($query_args);
         }
     } catch (Exception $e) {
         wp_die("WPAM FAILED: " . $e->getMessage());
     }
     //new affiliate tracking code
     WPAM_Click_Tracking::record_click();
 }
コード例 #2
0
 public function onInit()
 {
     add_action('wp_enqueue_scripts', array($this, 'load_shortcode_specific_scripts'));
     add_action('wp_head', array($this, 'handle_wp_head_hook'));
     //actions & filters
     add_action('template_redirect', array($this, 'onTemplateRedirect'));
     add_action('admin_menu', array($this, 'onAdminMenu'));
     add_action('current_screen', array($this, 'onCurrentScreen'));
     //checkout handlers
     add_action('wpsc_transaction_result_cart_item', array($this, 'onWpscCheckout'));
     add_action('woocommerce_checkout_order_processed', array($this, 'onWooCheckout'), 10, 2);
     //Exchange integration
     add_filter('it_exchange_add_transaction', array($this, 'onExchangeCheckout'), 10, 7);
     //simple cart integration
     add_filter('wpspc_cart_custom_field_value', array($this, 'wpspcAddCustomValue'));
     add_action('wpspc_paypal_ipn_processed', array($this, 'wpspcProcessTransaction'));
     //Jigoshop integration
     add_action('jigoshop_new_order', array($this, 'jigoshopNewOrder'));
     add_action('wp_ajax_wpam-ajax_request', array($this, 'onAjaxRequest'));
     add_filter('login_redirect', array($this, 'redirectAffiliate'), 10, 3);
     add_filter('pre_user_email', array($this, 'filterUserEmail'));
     //set the locale for money format & paypal
     $this->locale = WPAM_LOCALE_OVERRIDE ? WPAM_LOCALE_OVERRIDE : get_locale();
     $this->setloc = $this->setMonetaryLocale($this->locale);
     //loading provided locale didn't work, choose default
     if (!$this->setloc && setlocale(LC_MONETARY, 0) == 'C') {
         setlocale(LC_MONETARY, '');
     }
     add_action('admin_notices', array($this, 'showAdminMessages'));
     if (!is_admin()) {
         add_filter('widget_text', 'do_shortcode');
     }
     add_shortcode('AffiliatesRegister', array($this->publicPages[self::PAGE_NAME_REGISTER], 'doShortcode'));
     add_shortcode('AffiliatesHome', array($this->publicPages[self::PAGE_NAME_HOME], 'doShortcode'));
     add_shortcode('AffiliatesLogin', array($this, 'doLoginShortcode'));
     add_action('save_post', array($this, 'onSavePage'), 10, 2);
     try {
         if (isset($_GET[WPAM_PluginConfig::$RefKey])) {
             $requestTracker = new WPAM_Tracking_RequestTracker();
             $query_args = $_GET;
             $requestTracker->handleIncomingReferral($query_args);
         }
     } catch (Exception $e) {
         wp_die("WPAM FAILED: " . $e->getMessage());
     }
 }