Example #1
0
 function __construct()
 {
     // Add support for new WPMUDEV Dashboard Notices
     global $wpmudev_notices;
     $wpmudev_notices[] = array('id' => 106, 'name' => 'Affiliate', 'screens' => array('toplevel_page_affiliatesadmin', 'affiliates_page_affiliatesadminmanage', 'affiliates_page_affiliatesadminsettings', 'affiliates_page_affiliatesadminaddons', 'users_page_affiliateearnings', 'users_page_affiliatebanners', 'toplevel_page_affiliatesadmin-network', 'affiliates_page_affiliatesadminmanage-network', 'affiliates_page_affiliatesadminsettings-network', 'affiliates_page_affiliatesadminaddons-network', 'users_page_affiliateearnings-network', 'users_page_affiliatebanners-network'));
     include_once dirname(__FILE__) . '../../external/wpmudev-dash-notification.php';
     global $wpdb;
     // Grab our own local reference to the database class
     $this->db =& $wpdb;
     foreach ($this->tables as $table) {
         if (affiliate_is_plugin_active_for_network() && (defined('AFFILIATE_USE_GLOBAL_IF_NETWORK_ACTIVATED') && AFFILIATE_USE_GLOBAL_IF_NETWORK_ACTIVATED == 'yes')) {
             // we're activated site wide
             $this->{$table} = $this->db->base_prefix . $table;
         } else {
             if (defined('AFFILIATE_USE_BASE_PREFIX_IF_EXISTS') && AFFILIATE_USE_BASE_PREFIX_IF_EXISTS == 'yes' && !empty($this->db->base_prefix)) {
                 $this->{$table} = $this->db->base_prefix . $table;
             } else {
                 // we're only activated on a blog level so put the admin menu in the main area
                 $this->{$table} = $this->db->prefix . $table;
             }
         }
     }
     $this->installed_version = aff_get_option('Aff_Installed', false);
     if ($this->installed_version === false || $this->installed_version != $this->build_version) {
         $this->install();
         aff_update_option('Aff_Installed', $this->build_version);
     }
     register_activation_hook(__FILE__, array(&$this, 'install'));
     add_action('init', array(&$this, 'initialise_ajax'), 1);
     add_action('init', array(&$this, 'aff_report_header'), 999);
     add_action('init', array(&$this, 'handle_export_link'));
     add_action('plugins_loaded', array(&$this, 'load_textdomain'));
     // Menus and profile page
     add_action('admin_menu', array(&$this, 'add_menu_items'));
     add_action('network_admin_menu', array(&$this, 'add_menu_items'));
     add_action('show_user_profile', array(&$this, 'add_profile_box'));
     add_action('personal_options_update', array(&$this, 'update_profile_box'));
     // Affiliate blog and user reporting
     add_filter('wpmu_blogs_columns', array(&$this, 'add_affiliate_column'));
     add_action('manage_blogs_custom_column', array(&$this, 'show_affiliate_column'), 10, 2);
     add_action('manage_sites_custom_column', array(&$this, 'show_affiliate_column'), 10, 2);
     add_filter('manage_users_columns', array(&$this, 'add_user_affiliate_column'));
     add_filter('wpmu_users_columns', array(&$this, 'add_user_affiliate_column'));
     add_filter('manage_users_custom_column', array(&$this, 'show_user_affiliate_column'), 10, 3);
     add_action('pre_user_query', array(&$this, 'override_referrer_search'));
     add_filter('user_row_actions', array(&$this, 'add_referrer_search_link'), 10, 2);
     add_filter('ms_user_row_actions', array(&$this, 'add_referrer_search_link'), 10, 2);
     //add_action( 'show_user_profile', array(&$this, 'edit_user_profile') );
     //add_action( 'edit_user_profile', array(&$this, 'edit_user_profile') );
     // Include affiliate plugins
     load_affiliate_addons();
 }
Example #2
0
 function __construct()
 {
     global $wpdb;
     // Grab our own local reference to the database class
     $this->db =& $wpdb;
     foreach ($this->tables as $table) {
         if (function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('affiliate/affiliate.php') && (defined('AFFILIATE_USE_GLOBAL_IF_NETWORK_ACTIVATED') && AFFILIATE_USE_GLOBAL_IF_NETWORK_ACTIVATED == 'yes')) {
             // we're activated site wide
             $this->{$table} = $this->db->base_prefix . $table;
         } else {
             if (defined('AFFILIATE_USE_BASE_PREFIX_IF_EXISTS') && AFFILIATE_USE_BASE_PREFIX_IF_EXISTS == 'yes' && !empty($this->db->base_prefix)) {
                 $this->{$table} = $this->db->base_prefix . $table;
             } else {
                 // we're only activated on a blog level so put the admin menu in the main area
                 $this->{$table} = $this->db->prefix . $table;
             }
         }
     }
     $installed = aff_get_option('Aff_Installed', false);
     if ($installed === false || $installed != $this->build) {
         $this->install();
         aff_update_option('Aff_Installed', $this->build);
     }
     register_activation_hook(__FILE__, array(&$this, 'install'));
     add_action('init', array(&$this, 'initialise_ajax'), 1);
     add_action('init', array(&$this, 'aff_report_header'), 999);
     add_action('init', array(&$this, 'handle_export_link'));
     add_action('plugins_loaded', array(&$this, 'load_textdomain'));
     // Menus and profile page
     add_action('admin_menu', array(&$this, 'add_menu_items'));
     add_action('network_admin_menu', array(&$this, 'add_menu_items'));
     add_action('show_user_profile', array(&$this, 'add_profile_box'));
     add_action('personal_options_update', array(&$this, 'update_profile_box'));
     // Affiliate blog and user reporting
     add_filter('wpmu_blogs_columns', array(&$this, 'add_affiliate_column'));
     add_action('manage_blogs_custom_column', array(&$this, 'show_affiliate_column'), 10, 2);
     add_filter('manage_users_columns', array(&$this, 'add_user_affiliate_column'));
     add_filter('wpmu_users_columns', array(&$this, 'add_user_affiliate_column'));
     add_filter('manage_users_custom_column', array(&$this, 'show_user_affiliate_column'), 10, 3);
     add_action('pre_user_query', array(&$this, 'override_referrer_search'));
     add_filter('user_row_actions', array(&$this, 'add_referrer_search_link'), 10, 2);
     add_filter('ms_user_row_actions', array(&$this, 'add_referrer_search_link'), 10, 2);
     // Include affiliate plugins
     load_affiliate_addons();
 }
Example #3
0
 function __construct()
 {
     global $wpdb;
     // Grab our own local reference to the database class
     $this->db =& $wpdb;
     $this->detect_location(1);
     foreach ($this->tables as $table) {
         if (affiliate_is_plugin_active_for_network() && (defined('AFFILIATE_USE_GLOBAL_IF_NETWORK_ACTIVATED') && AFFILIATE_USE_GLOBAL_IF_NETWORK_ACTIVATED == 'yes')) {
             // we're activated site wide
             $this->{$table} = $this->db->base_prefix . $table;
         } else {
             if (defined('AFFILIATE_USE_BASE_PREFIX_IF_EXISTS') && AFFILIATE_USE_BASE_PREFIX_IF_EXISTS == 'yes' && !empty($this->db->base_prefix)) {
                 $this->{$table} = $this->db->base_prefix . $table;
             } else {
                 // we're only activated on a blog level so put the admin menu in the main area
                 $this->{$table} = $this->db->prefix . $table;
             }
         }
     }
     //$installed = aff_get_option('Aff_Installed', false);
     //if($installed === false || $installed != $this->build) {
     //	$this->install();
     //
     //	aff_update_option('Aff_Installed', $this->build);
     //}
     //register_activation_hook(__FILE__, array(&$this, 'install'));
     add_action('init', array(&$this, 'handle_affiliate_link'));
     // Global generic functions
     add_action('affiliate_click', array(&$this, 'record_click'), 10, 6);
     add_action('affiliate_signup', array(&$this, 'record_signup'), 10, 6);
     add_action('affiliate_purchase', array(&$this, 'record_purchase'), 10, 6);
     add_action('affiliate_credit', array(&$this, 'record_credit'), 10, 2);
     add_action('affiliate_debit', array(&$this, 'record_debit'), 10, 2);
     add_action('affiliate_referrer', array(&$this, 'record_referrer'), 10, 2);
     add_action('user_register', array(&$this, 'user_register'), 10);
     add_action('wpmu_activate_user', array(&$this, 'wpmu_activate_user'), 10, 3);
     add_filter('add_signup_meta', array(&$this, 'add_signup_meta'), 10);
     add_action('wpmu_activate_blog', array(&$this, 'wpmu_activate_blog'), 10, 5);
     // Include affiliate plugins
     if (!is_admin()) {
         // We only need to load if we are not in admin.
         load_affiliate_addons();
     }
 }