array( 'slug' => 'adcell', 'link_pattern' => 'adcell', 'label' => 'Adcell', 'fields' => array( array('slug' => 'username', 'label' => 'Username', 'info' => __('The Adcell Username is the number, you are using to login on the adcell page.', 'affiliate-power'), 'validation' => 'ctype_digit'), array('slug' => 'password', 'label' => 'API Password', 'info' => __('The Adcell API password is a special access to the Adcell API. Please do not enter your normal Adcell password here. The API password can be defined in the publisher area, menu item "My Data".', 'affiliate-power')), array('type' => 'checkbox', 'slug' => 'referer-filter', 'label' => 'Website Filter', 'info' => __('Only save sales, which came from this domain. This option makes only sense if you are using your Adcell account for several pages.', 'affiliate-power')), ), ), 'awin' => array( 'slug' => 'awin', 'link_pattern' => 'awin', 'label' => 'Awin', 'fields' => array( array('slug' => 'id', 'label' => 'Publisher ID', 'info' => __('You can find the Awin Publisher ID at the top of the publisher area, next to your company name.', 'affiliate-power'), 'validation' => 'ctype_digit', 'allowed_chars' => ','), array('slug' => 'token', 'label' => 'API Token', 'info' => __('You can find the Awin API Token at the top of the publisher area, where it says Hello... -> API Credentials.', 'affiliate-power'), 'validation' => 'ctype_alnum', 'allowed_chars' => array(',', '-')), array('slug' => 'referer', 'label' => 'Referer Domain', 'info' => __('If you are using your awin account for several pages, you can enter the domain of this page here (without https and www). The plugin will only import sales from this domain. If you are using your awin account only for this page anyway, just leave the field empty. In this case, the plugin will download all sales.', 'affiliate-power')), ), ), 'belboon' => array( 'slug' => 'belboon', 'link_pattern' => '(belboon)|(https://[a-z]+\.r\.[a-z]+\.com/ts/[a-z0-9]+/tsc)', 'label' => 'Belboon', 'fields' => array( array('slug' => 'userid', 'label' => 'Partner Id', 'info' => __('You can find the numeric belboon Partner Id at the top of the publisher area, next to your name.', 'affiliate-power'), 'validation' => 'ctype_digit'), array('slug' => 'key', 'label' => 'Magic Key', 'info' => __('You can create the magic key in the publisher area, top menu at your account name, menu item Credentials. Give it a name of your choice and allow access to all APIs.', 'affiliate-power'), 'validation' => 'ctype_alnum', 'allowed_chars' => '-'), array('slug' => 'platform', 'label' => 'Ad Space Name', 'info' => __('If you are using your belboon account for several pages, you can enter the ad space name for this page here. The plugin will only import sales from this ad space. Please do not enter the ad space id but the name. You can find the ad space name in the publisher area, top menu at your account name, menu item Ad space. If you are using several ad spaces for this page you can separate the ad space names with comma. If you are using your belboon account only for this site anyway, just leave the field empty. In this case, the plugin will download all sales.', 'affiliate-power')), ), ), 'cj' => array( 'slug' => 'cj', 'link_pattern' => 'click-[0-9]+-[0-9]+', 'label' => 'Commission Junction', 'fields' => array( array('slug' => 'id', 'label' => 'PID', 'info' => __('The PID identifies your website at Commission Junction. You can find it in the publisher area of Commission Junction at the menu item Account -> Website Settings.', 'affiliate-power'), 'validation' => 'ctype_digit'), array('slug' => 'key', 'label' => 'Developer Key', 'info' => __('The Commission Junction Developer Key is a special access to the Commission Junction API. Please do not enter your normal password here. In order to get the key, you have to go to the Webservice-Site of Commission Junction, and login with your normal account data.', 'affiliate-power')), ), ), 'digistore24' => array( 'slug' => 'digistore24', 'link_pattern' => '(digistore24)|(/#aff=)', 'label' => 'Digistore24', 'check_login_params' => 1, 'fields' => array( array('slug' => 'key', 'label' => 'API Key', 'info' => __('The Digistore24 API key is a special access to the Digistore24 API. Please do not enter your normal password here. Follow these steps to get the key:
Anything is not working or you have an idea for a cool feature? Send me an email
', 'affiliate-power'); } static function addSubIdsField() { $output = " [?] ".__("", "affiliate-power")."Are you missing a network? Make your voice heard
', 'affiliate-power'); } //Validation static function optionsValidate($input) { //Main Settings if (isset($input['send-mail-transactions']) && $input['send-mail-transactions'] == 1) $whitelist['send-mail-transactions'] = 1; else $whitelist['send-mail-transactions'] = 0; if (isset($input['licence-key']) && ctype_alnum($input['licence-key'])) { $check_result = Affiliate_Power::checkLicenceKey($input['licence-key']); if ($check_result == false || $check_result == 'database_error' || $check_result == 'database_charset_error') add_settings_error('affiliate-power-options', 'affiliate-power-error-licence-key', __('The licence key could not be checked. Please try again later and let me know if it is still not working.', 'affiliate-power') ); elseif ($check_result == 'outdated_key') add_settings_error('affiliate-power-options', 'affiliate-power-error-licence-key', __('The licence key is outdated. Please renew your licence key.', 'affiliate-power') ); elseif ($check_result == 'invalid_key_format' || $check_result == 'invalid_key') add_settings_error('affiliate-power-options', 'affiliate-power-error-licence-key', __('The licence key is invalid. Please check again. If you are sure you entered the right key, let me know, and I will check it out.', 'affiliate-power') ); elseif ($check_result == 'ok') $whitelist['licence-key'] = $input['licence-key']; } elseif (!empty($input['licence-key'])) add_settings_error('affiliate-power-options', 'affiliate-power-error-licence-key', __('Invalid license key. The key should only contain numbers and letters.', 'affiliate-power')); foreach (self::$network_data as $network_name => $network) { foreach ($network['fields'] as $field) { $network_field_slug = $network['slug'].'-'.$field['slug']; if (isset($field['validation'])) { if (isset($field['allowed_chars'])) $check_value = str_replace($field['allowed_chars'], '', $input[$network_field_slug]); else $check_value = $input[$network_field_slug]; if ($field['validation']($check_value)) $whitelist[$network_field_slug] = esc_html($input[$network_field_slug]); elseif (!empty($input[$network_field_slug])) add_settings_error('affiliate-power-options', 'affiliate-power-error-'.$network_field_slug, __('Invalid', 'affiliate-power').': '.$network['label'].' '.$field['label'], 'error'); } elseif (isset($field['type']) && $field['type'] == 'checkbox') { if (isset($input[$network_field_slug]) && $input[$network_field_slug] == 1) $whitelist[$network_field_slug] = 1; else $whitelist[$network_field_slug] = 0; } elseif (!empty($input[$network_field_slug])) { $whitelist[$network_field_slug] = esc_html($input[$network_field_slug]); } } if (!isset($network['check_login_params'])) $network['check_login_params'] = 2; if ($network['check_login_params'] > 0) { $testlogin_result = null; $checkparams_keys = array(); for ($i=0; $i<$network['check_login_params']; $i++) $checkparams_keys[] = $network['slug'].'-'.$network['fields'][$i]['slug']; if ($network['check_login_params'] == 1 && isset($whitelist[$checkparams_keys[0]])) $testlogin_result = Affiliate_Power_Apis::checkNetworkLogin($network_name, $whitelist[$checkparams_keys[0]]); elseif ($network['check_login_params'] == 2 && isset($whitelist[$checkparams_keys[0]]) && isset($whitelist[$checkparams_keys[1]])) $testlogin_result = Affiliate_Power_Apis::checkNetworkLogin($network_name, $whitelist[$checkparams_keys[0]], $whitelist[$checkparams_keys[1]]); elseif ($network['check_login_params'] == 3 && isset($whitelist[$checkparams_keys[0]]) && isset($whitelist[$checkparams_keys[1]]) && isset($whitelist[$checkparams_keys[2]])) $testlogin_result = Affiliate_Power_Apis::checkNetworkLogin($network_name, $whitelist[$checkparams_keys[0]], $whitelist[$checkparams_keys[1]], $whitelist[$checkparams_keys[2]]); if ($testlogin_result === false) add_settings_error('affiliate-power-options', 'affiliate-power-error-'.$network['slug'].'-login', $network['label'].' '.__('test login failed. Please check your data.', 'affiliate-power'), 'error'); } } $whitelist = apply_filters('affiliate_power_options_validate', $whitelist, $input); return $whitelist; } }