affilinet Performance Ads - Version 1.8

Version Description

  • Release Date: August 17, 2015
  • Disable PerformanceAds Netherlands
  • add subid parameter to adcodes
  • enhances installation docs
Download this release

Release Info

Developer Affilinet
Plugin Icon 128x128 affilinet Performance Ads
Version 1.8
Comparing to
See all releases

Code changes from version 1.7 to 1.8

affilinet.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Affilinet Performance Ads
5
  Description: Integrate our data driven and automated performance display plugin into your WordPress platform and serve your users targeted ads in real time.
6
- Version: 1.7
7
  Author: Affilinet
8
  Author URI: https://www.affili.net/de/publisher/tools/performance-ads
9
  License: GPLv2 or later
@@ -13,20 +13,8 @@ License: GPLv2 or later
13
 
14
  define("AFFILINET_PLUGIN_DIR", dirname(__FILE__).DIRECTORY_SEPARATOR);
15
 
16
-
17
-
18
  foreach (glob(AFFILINET_PLUGIN_DIR . "classes/*.php") as $filename) {
19
  include $filename;
20
  }
21
 
22
  new Affilinet_Plugin();
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
3
  /*
4
  Plugin Name: Affilinet Performance Ads
5
  Description: Integrate our data driven and automated performance display plugin into your WordPress platform and serve your users targeted ads in real time.
6
+ Version: 1.8
7
  Author: Affilinet
8
  Author URI: https://www.affili.net/de/publisher/tools/performance-ads
9
  License: GPLv2 or later
13
 
14
  define("AFFILINET_PLUGIN_DIR", dirname(__FILE__).DIRECTORY_SEPARATOR);
15
 
 
 
16
  foreach (glob(AFFILINET_PLUGIN_DIR . "classes/*.php") as $filename) {
17
  include $filename;
18
  }
19
 
20
  new Affilinet_Plugin();
 
 
 
 
 
 
 
 
 
 
classes/Api.php CHANGED
@@ -21,10 +21,12 @@ class Affilinet_Api
21
  "WebServiceType" => "Publisher"
22
  );
23
  $token = $logon_client->__soapCall("Logon", array($params));
 
24
  return $token;
25
  } catch (\SoapFault $e) {
26
 
27
  Affilinet_Helper::displayAdminError(__('Could not connect to Affilinet API. Please recheck your Webservice Password and Publisher ID', 'affilinet'));
 
28
  return false;
29
  }
30
  }
@@ -36,8 +38,8 @@ class Affilinet_Api
36
  $params = array(
37
  'CredentialToken' => self::logon(),
38
  'GetDailyStatisticsRequestMessage' => array(
39
- 'StartDate' => (int)date_format($start_date, 'U'),
40
- 'EndDate' => (int)date_format($end_date, 'U'),
41
  'SubId' => '',
42
  'ProgramTypes' => 'All',
43
  'ValuationType' => 'DateOfRegistration',
@@ -50,12 +52,13 @@ class Affilinet_Api
50
  return $statistics->DailyStatisticsRecords->DailyStatisticRecords->DailyStatisticsRecord;
51
  }
52
 
53
-
54
  Affilinet_Helper::displayAdminError(__('No data in selected time frame', 'affilinet'));
 
55
  return null;
56
  } catch (\SoapFault $e) {
57
  Affilinet_Helper::displayAdminError(__('Could not connect to Affilinet API. Please recheck your Webservice Password and Publisher ID', 'affilinet'));
 
58
  return false;
59
  }
60
  }
61
- }
21
  "WebServiceType" => "Publisher"
22
  );
23
  $token = $logon_client->__soapCall("Logon", array($params));
24
+
25
  return $token;
26
  } catch (\SoapFault $e) {
27
 
28
  Affilinet_Helper::displayAdminError(__('Could not connect to Affilinet API. Please recheck your Webservice Password and Publisher ID', 'affilinet'));
29
+
30
  return false;
31
  }
32
  }
38
  $params = array(
39
  'CredentialToken' => self::logon(),
40
  'GetDailyStatisticsRequestMessage' => array(
41
+ 'StartDate' => (int) date_format($start_date, 'U'),
42
+ 'EndDate' => (int) date_format($end_date, 'U'),
43
  'SubId' => '',
44
  'ProgramTypes' => 'All',
45
  'ValuationType' => 'DateOfRegistration',
52
  return $statistics->DailyStatisticsRecords->DailyStatisticRecords->DailyStatisticsRecord;
53
  }
54
 
 
55
  Affilinet_Helper::displayAdminError(__('No data in selected time frame', 'affilinet'));
56
+
57
  return null;
58
  } catch (\SoapFault $e) {
59
  Affilinet_Helper::displayAdminError(__('Could not connect to Affilinet API. Please recheck your Webservice Password and Publisher ID', 'affilinet'));
60
+
61
  return false;
62
  }
63
  }
64
+ }
classes/Helper.php CHANGED
@@ -4,11 +4,10 @@
4
  class Affilinet_Helper
5
  {
6
 
7
-
8
  /**
9
  * Get the currency String for the given platform
10
- * @param Int $platformId
11
- * @return String $currencyCode
12
  */
13
  public static function getCurrencyForPlatformId($platformId)
14
  {
@@ -17,10 +16,13 @@ class Affilinet_Helper
17
  case 3: // FR
18
  case 4: // NL
19
  case 7: // AT
 
20
  return '€';
21
  case 2: // UK
 
22
  return '£';
23
  case 6: // CH
 
24
  return 'CHF';
25
  default :
26
  return '';
@@ -29,8 +31,8 @@ class Affilinet_Helper
29
 
30
  /**
31
  * Return the platforms' view hostname
32
- * @param Int $platformId
33
- * @return bool|string $hostName
34
  */
35
  public static function getViewHostnameForPlatform($platformId)
36
  {
@@ -38,10 +40,13 @@ class Affilinet_Helper
38
  case 1: // de
39
  case 7: // at
40
  case 6: // ch
 
41
  return 'banners.webmasterplan.com';
42
  case 2: //uk
 
43
  return 'become.successfultogether.co.uk';
44
  case 3: //fr
 
45
  return 'banniere.reussissonsensemble.fr';
46
  case 4:
47
  return 'worden.samenresultaat.nl';
@@ -52,8 +57,8 @@ class Affilinet_Helper
52
 
53
  /**
54
  * Return the platforms' click hostname
55
- * @param Int $platformId
56
- * @return bool|string $hostName
57
  */
58
  public static function getClickHostnameForPlatform($platformId)
59
  {
@@ -61,12 +66,16 @@ class Affilinet_Helper
61
  case 1: // DE
62
  case 7: // AT
63
  case 6: // CH
 
64
  return 'partners.webmasterplan.com';
65
  case 2: // UK
 
66
  return 'being.successfultogether.co.uk';
67
  case 3: // FR
 
68
  return 'clic.reussissonsensemble.fr';
69
  case 4: // NL
 
70
  return 'zijn.samenresultaat.nl';
71
  default :
72
  return false;
@@ -82,6 +91,7 @@ class Affilinet_Helper
82
  {
83
  $locale = get_locale();
84
  $shortLocale = mb_substr($locale, 0, 2);
 
85
  return $shortLocale;
86
  }
87
 
@@ -96,6 +106,20 @@ class Affilinet_Helper
96
  <?php echo $message;?>
97
  </p>
98
  </div>
99
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  }
101
- }
4
  class Affilinet_Helper
5
  {
6
 
 
7
  /**
8
  * Get the currency String for the given platform
9
+ * @param Int $platformId
10
+ * @return String $currencyCode
11
  */
12
  public static function getCurrencyForPlatformId($platformId)
13
  {
16
  case 3: // FR
17
  case 4: // NL
18
  case 7: // AT
19
+
20
  return '&euro;';
21
  case 2: // UK
22
+
23
  return '&pound;';
24
  case 6: // CH
25
+
26
  return 'CHF';
27
  default :
28
  return '';
31
 
32
  /**
33
  * Return the platforms' view hostname
34
+ * @param Int $platformId
35
+ * @return bool|string $hostName
36
  */
37
  public static function getViewHostnameForPlatform($platformId)
38
  {
40
  case 1: // de
41
  case 7: // at
42
  case 6: // ch
43
+
44
  return 'banners.webmasterplan.com';
45
  case 2: //uk
46
+
47
  return 'become.successfultogether.co.uk';
48
  case 3: //fr
49
+
50
  return 'banniere.reussissonsensemble.fr';
51
  case 4:
52
  return 'worden.samenresultaat.nl';
57
 
58
  /**
59
  * Return the platforms' click hostname
60
+ * @param Int $platformId
61
+ * @return bool|string $hostName
62
  */
63
  public static function getClickHostnameForPlatform($platformId)
64
  {
66
  case 1: // DE
67
  case 7: // AT
68
  case 6: // CH
69
+
70
  return 'partners.webmasterplan.com';
71
  case 2: // UK
72
+
73
  return 'being.successfultogether.co.uk';
74
  case 3: // FR
75
+
76
  return 'clic.reussissonsensemble.fr';
77
  case 4: // NL
78
+
79
  return 'zijn.samenresultaat.nl';
80
  default :
81
  return false;
91
  {
92
  $locale = get_locale();
93
  $shortLocale = mb_substr($locale, 0, 2);
94
+
95
  return $shortLocale;
96
  }
97
 
106
  <?php echo $message;?>
107
  </p>
108
  </div>
109
+ <?php
110
+ }
111
+
112
+ /**
113
+ * Returns current plugin version.
114
+ *
115
+ * @return string Plugin version
116
+ */
117
+ public static function get_plugin_version()
118
+ {
119
+ if ( ! function_exists( 'get_plugins' ) )
120
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
121
+ $plugin_folder = get_plugin_data(AFFILINET_PLUGIN_DIR.DIRECTORY_SEPARATOR.'affilinet.php') ;
122
+
123
+ return $plugin_folder['Version'];
124
  }
125
+ }
classes/PerformanceAds.php CHANGED
@@ -9,24 +9,30 @@ class Affilinet_PerformanceAds
9
  *
10
  * Returns false if the platform id is invalid
11
  *
12
- * @param int $platformId
13
  *
14
- * @return bool|int $programId
15
  */
16
  public static function getProgramIdByPlatform($platformId)
17
  {
18
  switch ($platformId) {
19
  case 1: // DE
 
20
  return 9192;
21
  case 2: // UK
 
22
  return 12752;
23
  case 3: // FR
 
24
  return 12751;
25
  case 4: // NL
 
26
  return 13397;
27
  case 6: // CH
 
28
  return 12252;
29
  case 7: // AT
 
30
  return 12376;
31
 
32
  default :
@@ -45,7 +51,6 @@ class Affilinet_PerformanceAds
45
  $publisherId = get_option('affilinet_publisher_id');
46
  $platformId = get_option('affilinet_platform');
47
 
48
-
49
  if ($publisherId === false || $publisherId === '') {
50
  return __('No publisher ID given', 'affilinet');
51
  }
@@ -53,27 +58,36 @@ class Affilinet_PerformanceAds
53
  return __('No platform chosen', 'affilinet');
54
  }
55
 
 
 
 
 
 
 
 
56
  $programId = Affilinet_PerformanceAds::getProgramIdByPlatform($platformId);
57
  $viewUrl = Affilinet_Helper::getViewHostnameForPlatform($platformId);
58
  $clickUrl = Affilinet_Helper::getClickHostnameForPlatform($platformId);
59
-
 
 
60
  $hnb = self::getHnbForPlatform($platformId, $size);
 
61
  if ($hnb === false) {
62
  return __('Invalid ad size given. Choose one of "728x90","300x250","250x250","468x60","160x600","120x600"', 'affilinet');
63
  }
64
 
65
  $html = '<script language="javascript" type="text/javascript" src="' .
66
- 'http://' . $viewUrl . '/view.asp?ref=' . $publisherId . '&site=' . $programId . '&type=html&hnb=' . $hnb . '&js=1'.
67
  '"></script><noscript><a href="' .
68
- 'http://' . $clickUrl . '/click.asp?ref=' . $publisherId . '&site=' . $programId . '&type=b1&bnb=1&'.
69
  '" target="_blank"><img src="' .
70
- 'http://' . $viewUrl . '/view.asp?ref=' . $publisherId . '&site=' . $programId . '&b=1'.
71
  '" border="0"/></a><br /></noscript>';
72
 
73
  return $html;
74
  }
75
 
76
-
77
  /**
78
  * Get the HNB paramter for performance Ads
79
  * @param $platformId
@@ -144,4 +158,4 @@ class Affilinet_PerformanceAds
144
  }
145
 
146
  }
147
- }
9
  *
10
  * Returns false if the platform id is invalid
11
  *
12
+ * @param int $platformId
13
  *
14
+ * @return bool|int $programId
15
  */
16
  public static function getProgramIdByPlatform($platformId)
17
  {
18
  switch ($platformId) {
19
  case 1: // DE
20
+
21
  return 9192;
22
  case 2: // UK
23
+
24
  return 12752;
25
  case 3: // FR
26
+
27
  return 12751;
28
  case 4: // NL
29
+
30
  return 13397;
31
  case 6: // CH
32
+
33
  return 12252;
34
  case 7: // AT
35
+
36
  return 12376;
37
 
38
  default :
51
  $publisherId = get_option('affilinet_publisher_id');
52
  $platformId = get_option('affilinet_platform');
53
 
 
54
  if ($publisherId === false || $publisherId === '') {
55
  return __('No publisher ID given', 'affilinet');
56
  }
58
  return __('No platform chosen', 'affilinet');
59
  }
60
 
61
+ /**
62
+ * Disable Netherlands
63
+ */
64
+ if ($platformId == 4) {
65
+ return '';
66
+ }
67
+
68
  $programId = Affilinet_PerformanceAds::getProgramIdByPlatform($platformId);
69
  $viewUrl = Affilinet_Helper::getViewHostnameForPlatform($platformId);
70
  $clickUrl = Affilinet_Helper::getClickHostnameForPlatform($platformId);
71
+ $pluginVersion = Affilinet_Helper::get_plugin_version();
72
+ $wpVersion = get_bloginfo('version');
73
+ $subId = 'Wordpress'.$wpVersion.'-Plugin'.$pluginVersion;
74
  $hnb = self::getHnbForPlatform($platformId, $size);
75
+
76
  if ($hnb === false) {
77
  return __('Invalid ad size given. Choose one of "728x90","300x250","250x250","468x60","160x600","120x600"', 'affilinet');
78
  }
79
 
80
  $html = '<script language="javascript" type="text/javascript" src="' .
81
+ 'http://' . $viewUrl . '/view.asp?ref=' . $publisherId . '&site=' . $programId . '&type=html&hnb=' . $hnb . '&js=1&subid='.$subId.
82
  '"></script><noscript><a href="' .
83
+ 'http://' . $clickUrl . '/click.asp?ref=' . $publisherId . '&site=' . $programId . '&type=b1&bnb=1&subid='.$subId.
84
  '" target="_blank"><img src="' .
85
+ 'http://' . $viewUrl . '/view.asp?ref=' . $publisherId . '&site=' . $programId . '&b=1&subid='.$subId.
86
  '" border="0"/></a><br /></noscript>';
87
 
88
  return $html;
89
  }
90
 
 
91
  /**
92
  * Get the HNB paramter for performance Ads
93
  * @param $platformId
158
  }
159
 
160
  }
161
+ }
classes/Plugin.php CHANGED
@@ -31,15 +31,12 @@ class Affilinet_Plugin
31
 
32
  * End Disable YieldKit in Version 1
33
  */
34
- foreach( array('post.php','post-new.php') as $hook ) {
35
  add_action( "admin_head-$hook",array($this, 'affilinet_adminScript') );
36
  }
37
 
38
-
39
  }
40
 
41
-
42
-
43
  /**
44
  * Register Settings for admin area
45
  */
@@ -60,10 +57,8 @@ class Affilinet_Plugin
60
  register_setting('affilinet-settings-group', 'affilinet_ywcap');
61
  register_setting('affilinet-settings-group', 'affilinet_ywcolor');
62
 
63
-
64
  }
65
 
66
-
67
  /**
68
  * Create the admin Menu
69
  */
@@ -72,9 +67,6 @@ class Affilinet_Plugin
72
  // create top level menu
73
  add_menu_page('Affilinet', 'Affilinet', 'manage_options', 'affilinet', 'Affilinet_View::start', plugin_dir_url(dirname(__FILE__)).'images/affilinet_icon.png');
74
 
75
-
76
-
77
-
78
  // submenu items
79
  add_submenu_page('affilinet', __('Start', 'affilinet'), __('Start', 'affilinet'), 'manage_options', 'affilinet', 'Affilinet_View::start');
80
  add_submenu_page('affilinet', __('Settings', 'affilinet'), __('Settings', 'affilinet'), 'manage_options', 'affilinet_settings', 'Affilinet_View::settings');
@@ -128,7 +120,6 @@ class Affilinet_Plugin
128
  load_plugin_textdomain( 'affilinet', false, dirname(dirname( plugin_basename( __FILE__ ) )) . '/languages' );
129
  }
130
 
131
-
132
  /**
133
  * TinyMCE Editor Button
134
  */
@@ -148,7 +139,7 @@ class Affilinet_Plugin
148
  /**
149
  * Load TinyMCE Variables
150
  */
151
- function affilinet_adminScript()
152
  {
153
  $img = plugin_dir_url( plugin_basename( dirname(__FILE__) ) ). 'images/';
154
  ?>
@@ -163,25 +154,23 @@ class Affilinet_Plugin
163
  <?php
164
  }
165
 
166
-
167
  public function add_buttons($plugin_array)
168
  {
169
  $plugin_array['affilinet_mce_button'] = plugin_dir_url( plugin_basename( dirname(__FILE__) ) ). 'js/affilinet_editor_buttons.js';
 
170
  return $plugin_array;
171
  }
172
 
173
  public function register_buttons($buttons)
174
  {
175
  array_push($buttons, 'affilinet_mce_button');
 
176
  return $buttons;
177
  }
178
 
179
-
180
  public function yielkit_code()
181
  {
182
  echo Affilinet_Yieldkit::getAdCode();
183
-
184
  }
185
 
186
-
187
  }
31
 
32
  * End Disable YieldKit in Version 1
33
  */
34
+ foreach ( array('post.php','post-new.php') as $hook ) {
35
  add_action( "admin_head-$hook",array($this, 'affilinet_adminScript') );
36
  }
37
 
 
38
  }
39
 
 
 
40
  /**
41
  * Register Settings for admin area
42
  */
57
  register_setting('affilinet-settings-group', 'affilinet_ywcap');
58
  register_setting('affilinet-settings-group', 'affilinet_ywcolor');
59
 
 
60
  }
61
 
 
62
  /**
63
  * Create the admin Menu
64
  */
67
  // create top level menu
68
  add_menu_page('Affilinet', 'Affilinet', 'manage_options', 'affilinet', 'Affilinet_View::start', plugin_dir_url(dirname(__FILE__)).'images/affilinet_icon.png');
69
 
 
 
 
70
  // submenu items
71
  add_submenu_page('affilinet', __('Start', 'affilinet'), __('Start', 'affilinet'), 'manage_options', 'affilinet', 'Affilinet_View::start');
72
  add_submenu_page('affilinet', __('Settings', 'affilinet'), __('Settings', 'affilinet'), 'manage_options', 'affilinet_settings', 'Affilinet_View::settings');
120
  load_plugin_textdomain( 'affilinet', false, dirname(dirname( plugin_basename( __FILE__ ) )) . '/languages' );
121
  }
122
 
 
123
  /**
124
  * TinyMCE Editor Button
125
  */
139
  /**
140
  * Load TinyMCE Variables
141
  */
142
+ public function affilinet_adminScript()
143
  {
144
  $img = plugin_dir_url( plugin_basename( dirname(__FILE__) ) ). 'images/';
145
  ?>
154
  <?php
155
  }
156
 
 
157
  public function add_buttons($plugin_array)
158
  {
159
  $plugin_array['affilinet_mce_button'] = plugin_dir_url( plugin_basename( dirname(__FILE__) ) ). 'js/affilinet_editor_buttons.js';
160
+
161
  return $plugin_array;
162
  }
163
 
164
  public function register_buttons($buttons)
165
  {
166
  array_push($buttons, 'affilinet_mce_button');
167
+
168
  return $buttons;
169
  }
170
 
 
171
  public function yielkit_code()
172
  {
173
  echo Affilinet_Yieldkit::getAdCode();
 
174
  }
175
 
 
176
  }
classes/View.php CHANGED
@@ -4,31 +4,32 @@ class Affilinet_View
4
  {
5
  public static function start()
6
  {
7
- require_once(AFFILINET_PLUGIN_DIR . 'views' . DIRECTORY_SEPARATOR . 'start.php');
8
  }
9
 
10
  public static function settings()
11
  {
12
- require_once(AFFILINET_PLUGIN_DIR . 'views' . DIRECTORY_SEPARATOR . 'settings.php');
13
  }
14
 
15
  public static function signup()
16
  {
17
- require_once(AFFILINET_PLUGIN_DIR . 'views' . DIRECTORY_SEPARATOR . 'signup.php');
18
  }
19
 
20
  public static function reporting()
21
  {
22
  add_filter('admin_print_footer_scripts', array(__CLASS__, 'reporting_footer_script'));
23
 
24
- require_once(AFFILINET_PLUGIN_DIR . 'views' . DIRECTORY_SEPARATOR . 'reporting.php');
25
  }
26
 
27
  public static function reporting_footer_script()
28
  {
29
  ?>
30
  <script type="text/javascript">
31
- function euroFormatter(v, axis) {
 
32
  return v.toFixed(axis.tickDecimals) + " €";
33
 
34
  }
@@ -74,17 +75,17 @@ class Affilinet_View
74
  <?php
75
  }
76
 
77
-
78
- public static function settings_script( $hook_suffix ) {
79
- include(ABSPATH . WPINC . '/version.php'); // include an unmodified $wp_version
80
  /** @var String $wp_version */
81
  if ($wp_version < 3.5) {
82
  wp_enqueue_script( 'affilinet_settings', plugins_url('/affilinet/js/affilinet_settings.js'), array('jquery'), false, true );
83
- }else {
84
  wp_enqueue_style( 'wp-color-picker' );
85
  wp_enqueue_script( 'affilinet_settings', plugins_url('/js/affilinet_settings.js', AFFILINET_PLUGIN_DIR.'affilinet' ), array( 'wp-color-picker' , 'jquery'), false, true );
86
  }
87
 
88
  }
89
 
90
- }
4
  {
5
  public static function start()
6
  {
7
+ require_once AFFILINET_PLUGIN_DIR . 'views' . DIRECTORY_SEPARATOR . 'start.php';
8
  }
9
 
10
  public static function settings()
11
  {
12
+ require_once AFFILINET_PLUGIN_DIR . 'views' . DIRECTORY_SEPARATOR . 'settings.php';
13
  }
14
 
15
  public static function signup()
16
  {
17
+ require_once AFFILINET_PLUGIN_DIR . 'views' . DIRECTORY_SEPARATOR . 'signup.php';
18
  }
19
 
20
  public static function reporting()
21
  {
22
  add_filter('admin_print_footer_scripts', array(__CLASS__, 'reporting_footer_script'));
23
 
24
+ require_once AFFILINET_PLUGIN_DIR . 'views' . DIRECTORY_SEPARATOR . 'reporting.php';
25
  }
26
 
27
  public static function reporting_footer_script()
28
  {
29
  ?>
30
  <script type="text/javascript">
31
+ function euroFormatter(v, axis)
32
+ {
33
  return v.toFixed(axis.tickDecimals) + " €";
34
 
35
  }
75
  <?php
76
  }
77
 
78
+ public static function settings_script($hook_suffix)
79
+ {
80
+ include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
81
  /** @var String $wp_version */
82
  if ($wp_version < 3.5) {
83
  wp_enqueue_script( 'affilinet_settings', plugins_url('/affilinet/js/affilinet_settings.js'), array('jquery'), false, true );
84
+ } else {
85
  wp_enqueue_style( 'wp-color-picker' );
86
  wp_enqueue_script( 'affilinet_settings', plugins_url('/js/affilinet_settings.js', AFFILINET_PLUGIN_DIR.'affilinet' ), array( 'wp-color-picker' , 'jquery'), false, true );
87
  }
88
 
89
  }
90
 
91
+ }
classes/Widget.php CHANGED
@@ -13,7 +13,6 @@ class Affilinet_Widget extends \WP_Widget
13
 
14
  }
15
 
16
-
17
  /**
18
  * Display the widget edit form
19
  *
@@ -26,7 +25,7 @@ class Affilinet_Widget extends \WP_Widget
26
  $defaults = array(
27
  'size' => '728x90'
28
  );
29
- $instance = wp_parse_args((array)$instance, $defaults);
30
  $size = $instance['size'];
31
  ?>
32
  <p>
@@ -48,7 +47,6 @@ class Affilinet_Widget extends \WP_Widget
48
  <?php
49
  }
50
 
51
-
52
  /**
53
  * Handle widget update process
54
  *
@@ -61,6 +59,7 @@ class Affilinet_Widget extends \WP_Widget
61
  {
62
  $instance = $old_instance;
63
  $instance['size'] = $new_instance['size'];
 
64
  return $instance;
65
 
66
  }
13
 
14
  }
15
 
 
16
  /**
17
  * Display the widget edit form
18
  *
25
  $defaults = array(
26
  'size' => '728x90'
27
  );
28
+ $instance = wp_parse_args((array) $instance, $defaults);
29
  $size = $instance['size'];
30
  ?>
31
  <p>
47
  <?php
48
  }
49
 
 
50
  /**
51
  * Handle widget update process
52
  *
59
  {
60
  $instance = $old_instance;
61
  $instance['size'] = $new_instance['size'];
62
+
63
  return $instance;
64
 
65
  }
classes/Yieldkit.php CHANGED
@@ -8,24 +8,30 @@ class Affilinet_Yieldkit
8
  *
9
  * Returns false if the platform id is invalid
10
  *
11
- * @param int $platformId
12
  *
13
- * @return bool|int $programId
14
  */
15
  public static function getProgramIdByPlatform($platformId)
16
  {
17
  switch ($platformId) {
18
  case 1: // DE
 
19
  return 12816;
20
  case 2: // UK
 
21
  return 12973;
22
  case 3: // FR
 
23
  return 13179;
24
  case 4: // NL
 
25
  return 13828;
26
  case 6: // CH
 
27
  return 1317;
28
  case 7: // AT
 
29
  return 13181;
30
 
31
  default :
@@ -33,7 +39,6 @@ class Affilinet_Yieldkit
33
  }
34
  }
35
 
36
-
37
  /**
38
  * Return the AdCode for the given size
39
  * @return string|void
@@ -77,7 +82,6 @@ class Affilinet_Yieldkit
77
  $ywcolor = str_replace('#','',$ywcolor);
78
  $hnb = 1;
79
 
80
-
81
  $scriptUrl = 'http://' . $viewUrl . '/view.asp?ref=' . $publisherId . '&site=' . $programId . '&type=html&hnb=' . $hnb . '&js=1' .
82
  '&yword='. $yword.
83
  '&ylink='.$ylink
@@ -98,7 +102,6 @@ class Affilinet_Yieldkit
98
  .'&ywcolor='.$ywcolor
99
  .'&ywcid=content&ywcclass=site-content';
100
 
101
-
102
  $html = '<script language="javascript" type="text/javascript" src="'
103
  .$scriptUrl
104
  .'"></script><noscript><a href="'
@@ -110,4 +113,4 @@ class Affilinet_Yieldkit
110
  return $html;
111
  }
112
 
113
- }
8
  *
9
  * Returns false if the platform id is invalid
10
  *
11
+ * @param int $platformId
12
  *
13
+ * @return bool|int $programId
14
  */
15
  public static function getProgramIdByPlatform($platformId)
16
  {
17
  switch ($platformId) {
18
  case 1: // DE
19
+
20
  return 12816;
21
  case 2: // UK
22
+
23
  return 12973;
24
  case 3: // FR
25
+
26
  return 13179;
27
  case 4: // NL
28
+
29
  return 13828;
30
  case 6: // CH
31
+
32
  return 1317;
33
  case 7: // AT
34
+
35
  return 13181;
36
 
37
  default :
39
  }
40
  }
41
 
 
42
  /**
43
  * Return the AdCode for the given size
44
  * @return string|void
82
  $ywcolor = str_replace('#','',$ywcolor);
83
  $hnb = 1;
84
 
 
85
  $scriptUrl = 'http://' . $viewUrl . '/view.asp?ref=' . $publisherId . '&site=' . $programId . '&type=html&hnb=' . $hnb . '&js=1' .
86
  '&yword='. $yword.
87
  '&ylink='.$ylink
102
  .'&ywcolor='.$ywcolor
103
  .'&ywcid=content&ywcclass=site-content';
104
 
 
105
  $html = '<script language="javascript" type="text/javascript" src="'
106
  .$scriptUrl
107
  .'"></script><noscript><a href="'
113
  return $html;
114
  }
115
 
116
+ }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: Affilinet, teraone
3
  Tags: advertising, affilinet, affiliate marketing, display, advertisement, vermarktung, geld verdienen, online marketing, marketing, performance
4
  Requires at least: 3.0.1
5
- Tested up to: 4.2
6
- Stable tag: 1.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -33,8 +33,6 @@ Nutzen Sie die neue Data-Driven Advertising Technologie mit automatisierter Werb
33
  = French =
34
  Profitez des avantages de notre nouvelle technologie publicitaire! Diffusez en temps réel des publicités ciblées selon le profil des internautes.
35
 
36
- = Netherlands =
37
- Gebruik de nieuwe Data-Driven advertising technologie met geautomatiseerde advertentievertoning en speel real time in op de wensen van je gebruikers.
38
 
39
  == Installation ==
40
 
@@ -45,20 +43,46 @@ You can download the Plugin from Wordpress Plugin repository or install manually
45
  2. Click on 'Install' and activate the plugin
46
  3. Don't forget to enter your Publisher ID
47
 
 
48
  = Or Install manually =
49
  1. Download the Plugin
50
  2. Extract and upload the folder `affilinet-performance-module` to the `/wp-content/plugins/` directory
51
  3. Activate the plugin through the 'Plugins' menu in WordPress
52
 
53
- = Enter your affilinet publisher account data =
54
- 1. Navigate to the `Affilinet` section in your WordPress Admin Backend
55
- 2. If you do not have an affilinet publisher account, please signup first.
56
- 3. In the settings choose your country platform and enter your affilinet Publisher ID
57
 
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
 
62
  = 1.7 =
63
  * Release Date: July 6, 2015
64
  * Report data shown by date of registration
2
  Contributors: Affilinet, teraone
3
  Tags: advertising, affilinet, affiliate marketing, display, advertisement, vermarktung, geld verdienen, online marketing, marketing, performance
4
  Requires at least: 3.0.1
5
+ Tested up to: 4.2.4
6
+ Stable tag: 1.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
33
  = French =
34
  Profitez des avantages de notre nouvelle technologie publicitaire! Diffusez en temps réel des publicités ciblées selon le profil des internautes.
35
 
 
 
36
 
37
  == Installation ==
38
 
43
  2. Click on 'Install' and activate the plugin
44
  3. Don't forget to enter your Publisher ID
45
 
46
+
47
  = Or Install manually =
48
  1. Download the Plugin
49
  2. Extract and upload the folder `affilinet-performance-module` to the `/wp-content/plugins/` directory
50
  3. Activate the plugin through the 'Plugins' menu in WordPress
51
 
 
 
 
 
52
 
53
 
54
+ After installing the affilinet Performance Ads Plugin, a new "Affilinet" sub-menu will appear in the main WordPress Admin menu.
55
+
56
+ = Required settings =
57
+ 1. Click the Settings link and select the affilinet office you will be working with, click save
58
+ 2. Signup to affilinet using the embedded form, available from the Signup menu link
59
+ 3. After submitting the form and validating your email address you will be sent another email containing your affilinet publisher ID store this somewhere safe, you will need to use it to access the affilinet publisher platform
60
+ 4. Login to the [affilinet publisher platform](https://publisher.affili.net/) using your publisher ID and the password entered into the sign-up form
61
+ 5. Use the main navigation in the following steps: Solutions > Web Services > Access data to reach the page where you aquire your Publisher Web Service password
62
+
63
+ [Screenshot Affilinet Publisher Portal](http://plugins.svn.wordpress.org/affilinet-performance-module/assets/affilinet_Publisher_Portal.png "Affilinet Publisher Portal")
64
+
65
+ Click the Acquire password button and wait for the token to be loaded as shown [here](http://plugins.svn.wordpress.org/affilinet-performance-module/assets/affilinet_Publisher_Portal_2.png "Affilinet Publisher Portal")
66
+
67
+ Now that you have both your publisher ID and your Publisher Web services password you can open up your WordPress admin again, and navigate to Settings page within the affilinet plugin. Enter your publisher ID and Web Services password as shown [here](http://plugins.svn.wordpress.org/affilinet-performance-module/assets/WordPress_Plugin_Settings.png "Plugin Settings") and click Save Changes:
68
+
69
+ If you do not already have an affilinet publisher account you will need to signup using the embedded form. After submitting the form and validating your email address you will have access to the affilinet publisher platform
70
+
71
+ Some ads will start showing straight away, but all publisher accounts must be assessed by our network quality before they can receive ads from our entire network of advertising brands. This process can take up to 48 hours during busy periods.
72
+
73
+ = If you have an affilinet Publisher Account: =
74
+
75
+ The process is the same as the above, please start from step 3 in the process.
76
+
77
 
78
  == Changelog ==
79
 
80
+ = 1.8 =
81
+ * Release Date: August 17, 2015
82
+ * Disable PerformanceAds Netherlands
83
+ * add subid parameter to adcodes
84
+ * enhances installation docs
85
+
86
  = 1.7 =
87
  * Release Date: July 6, 2015
88
  * Report data shown by date of registration
views/reporting.php CHANGED
@@ -25,7 +25,6 @@
25
  ?><p>Missing SoapExtension on your webserver</p><?php
26
  } else {
27
 
28
-
29
  if (isset($_GET['month'])) {
30
  $selected_month = $_GET['month'];
31
  } else {
@@ -39,7 +38,6 @@
39
  $selected_year = $this_year;
40
  }
41
 
42
-
43
  if (phpversion() < 5.3) {
44
  $selected_end_month = $selected_month;
45
  $selected_end_year = $selected_year;
@@ -58,7 +56,6 @@
58
  $end_date->add(DateInterval::createFromDateString('1 month'))->sub(DateInterval::createFromDateString('1 day'));
59
  }
60
 
61
-
62
  $dailyStatistics = Affilinet_Api::getDailyStatistics($start_date, $end_date);
63
 
64
  if ($dailyStatistics !== false) {
@@ -140,10 +137,8 @@
140
  $totalTotalOpenCommission =
141
  $totalTotalCommission = 0;
142
 
143
-
144
  if ($dailyStatistics !== null) {
145
 
146
-
147
  foreach ($dailyStatistics as $day) {
148
  ?>
149
  <tr class="alternate">
@@ -179,15 +174,13 @@
179
  </script><?php
180
 
181
 
182
- }else {
183
  ?>
184
  <tr class="alternate">
185
  <td colspan="8" class="col center"><?php _e('No data for this month', 'affilinet'); ?></td>
186
  <?php
187
  }
188
 
189
-
190
-
191
  ?>
192
  </tbody>
193
  <tfoot>
@@ -213,4 +206,4 @@
213
  ?>
214
 
215
 
216
- </div>
25
  ?><p>Missing SoapExtension on your webserver</p><?php
26
  } else {
27
 
 
28
  if (isset($_GET['month'])) {
29
  $selected_month = $_GET['month'];
30
  } else {
38
  $selected_year = $this_year;
39
  }
40
 
 
41
  if (phpversion() < 5.3) {
42
  $selected_end_month = $selected_month;
43
  $selected_end_year = $selected_year;
56
  $end_date->add(DateInterval::createFromDateString('1 month'))->sub(DateInterval::createFromDateString('1 day'));
57
  }
58
 
 
59
  $dailyStatistics = Affilinet_Api::getDailyStatistics($start_date, $end_date);
60
 
61
  if ($dailyStatistics !== false) {
137
  $totalTotalOpenCommission =
138
  $totalTotalCommission = 0;
139
 
 
140
  if ($dailyStatistics !== null) {
141
 
 
142
  foreach ($dailyStatistics as $day) {
143
  ?>
144
  <tr class="alternate">
174
  </script><?php
175
 
176
 
177
+ } else {
178
  ?>
179
  <tr class="alternate">
180
  <td colspan="8" class="col center"><?php _e('No data for this month', 'affilinet'); ?></td>
181
  <?php
182
  }
183
 
 
 
184
  ?>
185
  </tbody>
186
  <tfoot>
206
  ?>
207
 
208
 
209
+ </div>
views/settings.php CHANGED
@@ -1,12 +1,16 @@
1
  <div class="wrap">
2
  <h2><?php _e( 'Affilinet Performance Ads', 'affilinet' ) ?></h2>
3
 
4
- <?php if ( isset($_GET['settings-updated']) && ($_GET['settings-updated']== true ) && $_GET['page'] == 'affilinet_settings'){
5
 
 
6
  add_settings_error('affilinet-settings-group', 'settings_updated', __('Settings saved.'), 'updated');
7
- settings_errors('affilinet-settings-group');
8
  }
9
 
 
 
 
 
10
  ?>
11
 
12
  <form method="post" action="options.php">
@@ -22,7 +26,7 @@
22
  <option <?php selected('1',get_option('affilinet_platform')); ?> value="1" >affilinet <?php _e('Germany', 'affilinet'); ?></option>
23
  <option <?php selected('2',get_option('affilinet_platform')); ?> value="2" >affilinet <?php _e('United Kingdom', 'affilinet'); ?></option>
24
  <option <?php selected('3',get_option('affilinet_platform')); ?> value="3" >affilinet <?php _e('France', 'affilinet'); ?></option>
25
- <option <?php selected('4',get_option('affilinet_platform')); ?> value="4" >affilinet <?php _e('Netherlands', 'affilinet'); ?></option>
26
  <option <?php selected('6',get_option('affilinet_platform')); ?> value="6" >affilinet <?php _e('Switzerland', 'affilinet'); ?></option>
27
  <option <?php selected('7',get_option('affilinet_platform')); ?> value="7" >affilinet <?php _e('Austria', 'affilinet'); ?></option>
28
 
@@ -30,6 +34,8 @@
30
  </td>
31
  </tr>
32
 
 
 
33
  <tr valign="top">
34
  <th scope="row"><label for="affilinet_publisher_id"><?php _e('Publisher ID', 'affilinet'); ?></label></th>
35
  <td><input type="text" id="affilinet_publisher_id" style="min-width: 250px;" name="affilinet_publisher_id" value="<?php echo esc_attr( get_option('affilinet_publisher_id') ); ?>" /></td>
@@ -147,11 +153,11 @@
147
  <?php
148
  if ( function_exists('submit_button')) {
149
  submit_button();
150
- }else {
151
  ?><button type="submit"><?php _e('Save', 'affilinet');?></button><?php
152
  }
153
 
154
  ?>
155
 
156
  </form>
157
- </div>
1
  <div class="wrap">
2
  <h2><?php _e( 'Affilinet Performance Ads', 'affilinet' ) ?></h2>
3
 
4
+ <?php
5
 
6
+ if ( isset($_GET['settings-updated']) && ($_GET['settings-updated']== true ) && $_GET['page'] == 'affilinet_settings') {
7
  add_settings_error('affilinet-settings-group', 'settings_updated', __('Settings saved.'), 'updated');
 
8
  }
9
 
10
+ if (get_option('affilinet_platform') == 4 ) {
11
+ add_settings_error('affilinet-settings-group', 'invalid_platform', __('The Performance Ads Program will soon be available in Netherlands, too. Please choose another platform so far.'), 'error');
12
+ }
13
+ settings_errors('affilinet-settings-group');
14
  ?>
15
 
16
  <form method="post" action="options.php">
26
  <option <?php selected('1',get_option('affilinet_platform')); ?> value="1" >affilinet <?php _e('Germany', 'affilinet'); ?></option>
27
  <option <?php selected('2',get_option('affilinet_platform')); ?> value="2" >affilinet <?php _e('United Kingdom', 'affilinet'); ?></option>
28
  <option <?php selected('3',get_option('affilinet_platform')); ?> value="3" >affilinet <?php _e('France', 'affilinet'); ?></option>
29
+ <?php /*<option <?php selected('4',get_option('affilinet_platform')); ?> value="4" >affilinet <?php _e('Netherlands', 'affilinet'); ?></option> */ ?>
30
  <option <?php selected('6',get_option('affilinet_platform')); ?> value="6" >affilinet <?php _e('Switzerland', 'affilinet'); ?></option>
31
  <option <?php selected('7',get_option('affilinet_platform')); ?> value="7" >affilinet <?php _e('Austria', 'affilinet'); ?></option>
32
 
34
  </td>
35
  </tr>
36
 
37
+
38
+
39
  <tr valign="top">
40
  <th scope="row"><label for="affilinet_publisher_id"><?php _e('Publisher ID', 'affilinet'); ?></label></th>
41
  <td><input type="text" id="affilinet_publisher_id" style="min-width: 250px;" name="affilinet_publisher_id" value="<?php echo esc_attr( get_option('affilinet_publisher_id') ); ?>" /></td>
153
  <?php
154
  if ( function_exists('submit_button')) {
155
  submit_button();
156
+ } else {
157
  ?><button type="submit"><?php _e('Save', 'affilinet');?></button><?php
158
  }
159
 
160
  ?>
161
 
162
  </form>
163
+ </div>
views/signup.php CHANGED
@@ -21,8 +21,12 @@
21
  affilinet <?php _e('United Kingdom', 'affilinet'); ?></option>
22
  <option <?php selected('3', get_option('affilinet_platform')); ?> value="3">
23
  affilinet <?php _e('France', 'affilinet'); ?></option>
 
 
24
  <option <?php selected('4', get_option('affilinet_platform')); ?> value="4">
25
  affilinet <?php _e('Netherlands', 'affilinet'); ?></option>
 
 
26
  <option <?php selected('6', get_option('affilinet_platform')); ?> value="6">
27
  affilinet <?php _e('Switzerland', 'affilinet'); ?></option>
28
  <option <?php selected('7', get_option('affilinet_platform')); ?> value="7">
@@ -60,7 +64,7 @@
60
 
61
  $shortLocale = Affilinet_Helper::getShortLocale();
62
 
63
- include(ABSPATH . WPINC . '/version.php'); // include an unmodified $wp_version
64
  /** @var String $wp_version */
65
 
66
  $link = 'https://modules.affili.net/Signup/' .
@@ -93,4 +97,4 @@
93
  ?>
94
 
95
 
96
- </div>
21
  affilinet <?php _e('United Kingdom', 'affilinet'); ?></option>
22
  <option <?php selected('3', get_option('affilinet_platform')); ?> value="3">
23
  affilinet <?php _e('France', 'affilinet'); ?></option>
24
+
25
+ <?php /*
26
  <option <?php selected('4', get_option('affilinet_platform')); ?> value="4">
27
  affilinet <?php _e('Netherlands', 'affilinet'); ?></option>
28
+ */ ?>
29
+
30
  <option <?php selected('6', get_option('affilinet_platform')); ?> value="6">
31
  affilinet <?php _e('Switzerland', 'affilinet'); ?></option>
32
  <option <?php selected('7', get_option('affilinet_platform')); ?> value="7">
64
 
65
  $shortLocale = Affilinet_Helper::getShortLocale();
66
 
67
+ include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
68
  /** @var String $wp_version */
69
 
70
  $link = 'https://modules.affili.net/Signup/' .
97
  ?>
98
 
99
 
100
+ </div>
views/start.php CHANGED
@@ -19,4 +19,4 @@
19
  }
20
  }
21
  </style>
22
- <iframe id="startIframe" src="<?php echo __('https://www.affili.net/htmlcontent/en/Publishermodules/WordPress/Welcome.html', 'affilinet'); ?>" style=""></iframe>
19
  }
20
  }
21
  </style>
22
+ <iframe id="startIframe" src="<?php echo __('https://www.affili.net/htmlcontent/en/Publishermodules/WordPress/Welcome.html', 'affilinet'); ?>" style=""></iframe>