Google Analytics for WordPress by MonsterInsights - Version 5.4

Version Description

Release Date: April 20th, 2015

Enhancements: * Complete technical overhaul of the way settings are being stored. Switched to WP Settings API and added input validation and sanitation for several settings. * Made the settings more accessible by adding for attributes to the labels, connecting them with the corresponding form fields. Props to Steve Repsher for the awesome contribution! * Made Universal tracking the default for new installs. * Adds administrators to the default user roles to ignore for tracking.

Security: * Fixes several security issues that were discovered during an elaborate security review performed by our friends from Sucuri. * Fixes two other XSS issues. Thanks to Johannes Schmitt from Scrutinizer CI and Jouko Pynnnen for discovering and responsibly disclosing these issues.

Bugfixes: * Fixes an issue where some GA dashboard style sheets and scripts were also loaded outside of the Google Analytics by Yoast dashboard, thereby unnecessarily slowing down the WP admin. * Fixes a bug where a PHP warning could be raised on the dashboard when no data is available.

Download this release

Release Info

Developer omarreiss
Plugin Icon 128x128 Google Analytics for WordPress by MonsterInsights
Version 5.4
Comparing to
See all releases

Code changes from version 5.3.3 to 5.4

Files changed (113) hide show
  1. admin/class-admin-assets.php +1 -2
  2. admin/class-admin-form.php +1 -2
  3. admin/class-admin-menu.php +8 -9
  4. admin/class-admin-settings-fields.php +184 -0
  5. admin/class-admin-settings-registrar.php +629 -0
  6. admin/class-admin.php +68 -260
  7. admin/class-google-analytics.php +1 -2
  8. admin/dashboards/class-admin-dashboards-api-options.php +1 -2
  9. admin/dashboards/class-admin-dashboards-collector.php +1 -2
  10. admin/dashboards/class-admin-dashboards-data.php +1 -2
  11. admin/dashboards/class-admin-dashboards-display.php +1 -2
  12. admin/dashboards/class-admin-dashboards.php +2 -3
  13. admin/dashboards/drivers/class-admin-dashboards-driver-generate.php +27 -2
  14. admin/dashboards/drivers/class-admin-dashboards-driver.php +1 -2
  15. admin/dashboards/drivers/class-admin-dashboards-graph-generate.php +4 -4
  16. admin/dashboards/drivers/class-admin-dashboards-graph.php +1 -2
  17. admin/dashboards/drivers/class-admin-dashboards-table-generate.php +3 -4
  18. admin/dashboards/drivers/class-admin-dashboards-table.php +1 -2
  19. admin/dashboards/views/graph.php +3 -4
  20. admin/dashboards/views/table.php +4 -5
  21. admin/pages/dashboard.php +2 -3
  22. admin/pages/extensions.php +1 -2
  23. admin/pages/settings-api.php +123 -0
  24. admin/pages/settings.php +0 -166
  25. admin/views/content-footer.php +1 -2
  26. admin/views/custom-dimensions-upsell.php +21 -0
  27. assets/css/yoast_ga_styles.css +4 -0
  28. assets/css/yoast_ga_styles.min.css +1 -1
  29. assets/js/yoast_ga_admin.js +21 -0
  30. assets/js/yoast_ga_admin.min.js +1 -1
  31. frontend/abstract-class-tracking.php +9 -10
  32. frontend/class-frontend.php +1 -2
  33. frontend/class-ga-js.php +7 -8
  34. frontend/class-universal.php +7 -8
  35. frontend/views/tracking-debug.php +1 -2
  36. frontend/views/tracking-ga-js.php +1 -2
  37. frontend/views/tracking-universal.php +1 -2
  38. frontend/views/tracking-usergroup.php +1 -2
  39. googleanalytics.php +5 -4
  40. includes/{class-settings.php → class-options-utils.php} +17 -6
  41. includes/class-options.php +3 -30
  42. includes/class-utils.php +1 -2
  43. languages/google-analytics-for-wordpress-da_DK.mo +0 -0
  44. languages/google-analytics-for-wordpress-de_DE.mo +0 -0
  45. languages/google-analytics-for-wordpress-en_GB.mo +0 -0
  46. languages/google-analytics-for-wordpress-es_ES.mo +0 -0
  47. languages/google-analytics-for-wordpress-es_MX.mo +0 -0
  48. languages/google-analytics-for-wordpress-fr_FR.mo +0 -0
  49. languages/google-analytics-for-wordpress-he_IL.mo +0 -0
  50. languages/google-analytics-for-wordpress-it_IT.mo +0 -0
  51. languages/google-analytics-for-wordpress-nb_NO.mo +0 -0
  52. languages/google-analytics-for-wordpress-nl_NL.mo +0 -0
  53. languages/google-analytics-for-wordpress-pl_PL.mo +0 -0
  54. languages/google-analytics-for-wordpress-pt_BR.mo +0 -0
  55. languages/google-analytics-for-wordpress-ru_RU.mo +0 -0
  56. languages/google-analytics-for-wordpress-sv_SE.mo +0 -0
  57. languages/google-analytics-for-wordpress-tr_TR.mo +0 -0
  58. languages/google-analytics-for-wordpress.pot +471 -378
  59. readme.txt +20 -2
  60. vendor/autoload.php +1 -1
  61. vendor/autoload_52.php +1 -1
  62. vendor/composer/autoload_classmap.php +3 -1
  63. vendor/composer/autoload_real.php +4 -4
  64. vendor/composer/autoload_real_52.php +3 -3
  65. vendor/composer/installed.json +23 -22
  66. vendor/composer/installers/README.md +5 -1
  67. vendor/composer/installers/composer.json +1 -0
  68. vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php +9 -0
  69. vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php +9 -0
  70. vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php +5 -72
  71. vendor/composer/installers/src/Composer/Installers/Installer.php +4 -0
  72. vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php +10 -0
  73. vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php +10 -0
  74. vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php +5 -53
  75. vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php +12 -0
  76. vendor/xrstf/composer-php52/.hg/00changelog.i +0 -0
  77. vendor/xrstf/composer-php52/.hg/branch +1 -0
  78. vendor/xrstf/composer-php52/.hg/cache/branch2-served +4 -0
  79. vendor/xrstf/composer-php52/.hg/cache/rbc-names-v1 +0 -0
  80. vendor/xrstf/composer-php52/.hg/cache/rbc-revs-v1 +0 -0
  81. vendor/xrstf/composer-php52/.hg/dirstate +0 -0
  82. vendor/xrstf/composer-php52/.hg/hgrc +14 -0
  83. vendor/xrstf/composer-php52/.hg/requires +4 -0
  84. vendor/xrstf/composer-php52/.hg/store/00changelog.i +0 -0
  85. vendor/xrstf/composer-php52/.hg/store/00manifest.i +0 -0
  86. vendor/xrstf/composer-php52/.hg/store/data/_l_i_c_e_n_s_e.i +0 -0
  87. vendor/xrstf/composer-php52/.hg/store/data/_r_e_a_d_m_e.md.i +0 -0
  88. vendor/xrstf/composer-php52/.hg/store/data/composer.json.i +0 -0
  89. vendor/xrstf/composer-php52/.hg/store/data/lib/xrstf/_composer52/_autoload_generator.php.i +0 -0
  90. vendor/xrstf/composer-php52/.hg/store/data/lib/xrstf/_composer52/_class_loader.php.i +0 -0
  91. vendor/xrstf/composer-php52/.hg/store/data/lib/xrstf/_composer52/_generator.php.i +0 -0
  92. vendor/xrstf/composer-php52/.hg/store/data/~2ehgtags.i +0 -0
  93. vendor/xrstf/composer-php52/.hg/store/fncache +7 -0
  94. vendor/xrstf/composer-php52/.hg/store/phaseroots +0 -0
  95. vendor/xrstf/composer-php52/.hg/store/undo +0 -0
  96. vendor/xrstf/composer-php52/.hg/store/undo.backupfiles +0 -0
  97. vendor/xrstf/composer-php52/.hg/store/undo.phaseroots +0 -0
  98. vendor/xrstf/composer-php52/.hg/undo.bookmarks +0 -0
  99. vendor/xrstf/composer-php52/.hg/undo.branch +1 -0
  100. vendor/xrstf/composer-php52/.hg/undo.desc +3 -0
  101. vendor/xrstf/composer-php52/.hg/undo.dirstate +0 -0
  102. vendor/xrstf/composer-php52/.hg_archival.txt +0 -4
  103. vendor/xrstf/composer-php52/.hgtags +1 -0
  104. vendor/yoast/i18n-module/i18n-module.php +1 -1
  105. vendor/yoast/license-manager/.gitigore +2 -0
  106. vendor/yoast/license-manager/.travis.yml +54 -0
  107. vendor/yoast/license-manager/class-license-manager.php +210 -161
  108. vendor/yoast/license-manager/phpunit.xml +23 -0
  109. vendor/yoast/license-manager/tests/bootstrap.php +16 -0
  110. vendor/yoast/license-manager/tests/framework/class-yst-license-manager-unit-test-case.php +40 -0
  111. vendor/yoast/license-manager/tests/index.php +3 -0
  112. vendor/yoast/license-manager/tests/test-class-yoast-license-manager.php +81 -0
  113. vendor/yoast/license-manager/views/form.php +9 -1
admin/class-admin-assets.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
admin/class-admin-form.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
admin/class-admin-menu.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
@@ -45,7 +44,7 @@ class Yoast_GA_Admin_Menu {
45
  add_action( 'network_admin_menu', array( $this, 'create_admin_menu' ), 5 );
46
  }
47
 
48
- $this->dashboards_disabled = Yoast_GA_Settings::get_instance()->dashboards_disabled();
49
  $this->parent_slug = ( ( $this->dashboards_disabled ) ? 'yst_ga_settings' : 'yst_ga_dashboard' );
50
  }
51
 
@@ -163,24 +162,24 @@ class Yoast_GA_Admin_Menu {
163
  * @param array $submenu_page
164
  */
165
  private function add_submenu_page( $submenu_page ) {
166
- $page = add_submenu_page( $submenu_page['parent_slug'], $submenu_page['page_title'], $submenu_page['menu_title'], $submenu_page['capability'], $submenu_page['menu_slug'], $submenu_page['submenu_function'] );
167
- $is_not_dashboard = ( 'yst_ga_settings' === $submenu_page['menu_slug'] || 'yst_ga_extensions' === $submenu_page['menu_slug'] );
168
 
169
- $this->add_assets( $page, $is_not_dashboard );
170
  }
171
 
172
  /**
173
  * Adding stylesheets and based on $is_not_dashboard maybe some more styles and scripts.
174
  *
175
  * @param string $page
176
- * @param boolean $is_not_dashboard
177
  */
178
- private function add_assets( $page, $is_not_dashboard ) {
179
  add_action( 'admin_print_styles-' . $page, array( 'Yoast_GA_Admin_Assets', 'enqueue_styles' ) );
180
 
181
  add_action( 'admin_print_styles-' . $page, array( 'Yoast_GA_Admin_Assets', 'enqueue_settings_styles' ) );
182
  add_action( 'admin_print_scripts-' . $page, array( 'Yoast_GA_Admin_Assets', 'enqueue_scripts' ) );
183
- if ( ! $is_not_dashboard ) {
184
  Yoast_GA_Admin_Assets::enqueue_dashboard_assets();
185
  }
186
  }
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\AdminMenu
 
4
  */
5
 
6
  /**
44
  add_action( 'network_admin_menu', array( $this, 'create_admin_menu' ), 5 );
45
  }
46
 
47
+ $this->dashboards_disabled = Yoast_GA_Options_Utils::get_instance()->dashboards_disabled();
48
  $this->parent_slug = ( ( $this->dashboards_disabled ) ? 'yst_ga_settings' : 'yst_ga_dashboard' );
49
  }
50
 
162
  * @param array $submenu_page
163
  */
164
  private function add_submenu_page( $submenu_page ) {
165
+ $page = add_submenu_page( $submenu_page['parent_slug'], $submenu_page['page_title'], $submenu_page['menu_title'], $submenu_page['capability'], $submenu_page['menu_slug'], $submenu_page['submenu_function'] );
166
+ $is_dashboard = ( 'yst_ga_dashboard' === $submenu_page['menu_slug'] );
167
 
168
+ $this->add_assets( $page, $is_dashboard );
169
  }
170
 
171
  /**
172
  * Adding stylesheets and based on $is_not_dashboard maybe some more styles and scripts.
173
  *
174
  * @param string $page
175
+ * @param boolean $is_dashboard
176
  */
177
+ private function add_assets( $page, $is_dashboard ) {
178
  add_action( 'admin_print_styles-' . $page, array( 'Yoast_GA_Admin_Assets', 'enqueue_styles' ) );
179
 
180
  add_action( 'admin_print_styles-' . $page, array( 'Yoast_GA_Admin_Assets', 'enqueue_settings_styles' ) );
181
  add_action( 'admin_print_scripts-' . $page, array( 'Yoast_GA_Admin_Assets', 'enqueue_scripts' ) );
182
+ if ( ! $is_dashboard && filter_input( INPUT_GET, 'page' ) === 'yst_ga_dashboard' ) {
183
  Yoast_GA_Admin_Assets::enqueue_dashboard_assets();
184
  }
185
  }
admin/class-admin-settings-fields.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package GoogleAnalytics\AdminSettingsFields
4
+ */
5
+
6
+ /**
7
+ * Class Yoast_GA_Admin_Settings_Fields
8
+ */
9
+ class Yoast_GA_Admin_Settings_Fields {
10
+
11
+ /**
12
+ * @var array
13
+ */
14
+ private static $options = array();
15
+
16
+ /**
17
+ * Render a text field
18
+ *
19
+ * @param array $args Add arguments for the text field
20
+ */
21
+ public static function yst_ga_text_field( $args ) {
22
+ self::set_options();
23
+ self::before_input( $args );
24
+
25
+ echo '<input type="text" name="yst_ga[ga_general][' . $args['key'] . ']" id="' . $args['label_for'] . '" value="' . esc_attr( self::$options[ $args['key'] ] ) . '" class="ga-form-text">';
26
+ }
27
+
28
+ /**
29
+ * Render a text field
30
+ *
31
+ * @param array $args Add arguments for the text field
32
+ */
33
+ public static function yst_ga_textarea_field( $args ) {
34
+ self::set_options();
35
+ self::before_input( $args );
36
+
37
+ $value = self::$options[ $args['key'] ];
38
+ if ( $args['key'] !== 'custom_code' ) {
39
+ $value = esc_attr( $value );
40
+ }
41
+
42
+ echo '<textarea name="yst_ga[ga_general][' . $args['key'] . ']" id="' . $args['label_for'] . '" rows="5" cols="60">' . $value . '</textarea>';
43
+ }
44
+
45
+ /**
46
+ * Render a text field
47
+ *
48
+ * @param array $args Add arguments for the text field
49
+ */
50
+ public static function yst_ga_checkbox_field( $args ) {
51
+ self::set_options();
52
+ self::before_input( $args );
53
+
54
+ echo '<input type="checkbox" name="yst_ga[ga_general][' . $args['key'] . ']" id="' . $args['label_for'] . '" value="1" ' . checked( self::$options[ $args['key'] ], 1, false ) . '>';
55
+ }
56
+
57
+ /**
58
+ * Render a select field
59
+ *
60
+ * @param array $args Add arguments for the text field
61
+ */
62
+ public static function yst_ga_select_field( $args ) {
63
+ self::set_options();
64
+
65
+ $options = null;
66
+ $class = null;
67
+ $name_addition = null;
68
+
69
+ if ( isset( $args['class'] ) ) {
70
+ $class = ' class="' . $args['class'] . '"';
71
+ }
72
+
73
+ if ( ! isset( $args['attributes'] ) ) {
74
+ $args['attributes'] = null;
75
+ }
76
+
77
+ if ( $args['key'] === 'ignore_users' ) {
78
+ $name_addition = '[]';
79
+ }
80
+
81
+ foreach ( $args['options'] as $option ) {
82
+ if ( is_array( self::$options[ $args['key'] ] ) ) {
83
+ if ( in_array( $option['id'], self::$options[ $args['key'] ] ) ) {
84
+ $options .= '<option value="' . esc_attr( $option['id'] ) . '" selected="selected">' . esc_attr( $option['name'] ) . '</option>';
85
+ continue;
86
+ }
87
+
88
+ $options .= '<option value="' . esc_attr( $option['id'] ) . '">' . esc_attr( $option['name'] ) . '</option>';
89
+ continue;
90
+ }
91
+
92
+ $options .= '<option value="' . esc_attr( $option['id'] ) . '" ' . selected( $option['id'], self::$options[ $args['key'] ], false ) . '>' . esc_attr( $option['name'] ) . '</option>';
93
+ }
94
+
95
+ echo self::show_help( 'id-' . $args['key'], $args['help'] ) . '<select id="' . $args['label_for'] . '" name="yst_ga[ga_general][' . $args['key'] . ']' . $name_addition . '"' . $class . $args['attributes'] . '>' . $options . '</select>';
96
+ }
97
+
98
+ /**
99
+ * Render a select field
100
+ *
101
+ * @param array $args Add arguments for the text field
102
+ */
103
+ public static function yst_ga_select_profile_field( $args ) {
104
+ self::set_options();
105
+
106
+ $options = null;
107
+ $class = null;
108
+
109
+ if ( isset( $args['class'] ) ) {
110
+ $class = ' class="' . $args['class'] . '"';
111
+ }
112
+
113
+ if ( ! isset( $args['attributes'] ) ) {
114
+ $args['attributes'] = null;
115
+ }
116
+
117
+ foreach ( $args['options'] as $option ) {
118
+ foreach ( $option['items'] as $optgroup ) {
119
+ $options .= '<optgroup label="' . esc_attr( $optgroup['name'] ) . '">';
120
+
121
+ foreach ( $optgroup['items'] as $item ) {
122
+ $options .= '<option value="' . esc_attr( $item['id'] ) . '" ' . selected( $item['id'], self::$options[ $args['key'] ], false ) . '>' . esc_attr( $item['name'] ) . '</option>';
123
+ }
124
+
125
+ $options .= '</optgroup>';
126
+ }
127
+ }
128
+
129
+ echo self::show_help( 'id-' . $args['key'], $args['help'] ) . '<select id="' . $args['label_for'] . '" name="yst_ga[ga_general][' . $args['key'] . ']"' . $class . $args['attributes'] . ' data-placeholder="' . __( 'Select a profile', 'google-analytics-for-wordpress' ) . '" ><option></option>' . $options . '</select>';
130
+ }
131
+
132
+
133
+ /**
134
+ * Cache the options in this class, so check if they're set
135
+ */
136
+ private static function set_options() {
137
+ if ( self::$options === array() ) {
138
+ $options = get_option( 'yst_ga' );
139
+
140
+ if ( ! isset( $options['ga_general'] ) ) {
141
+ self::$options = Yoast_GA_Options::instance()->default_ga_values();
142
+ }
143
+ else {
144
+ self::$options = $options['ga_general'];
145
+ }
146
+
147
+ unset( self::$options['ga_general'] );
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Show a question mark with help
153
+ *
154
+ * @param string $id
155
+ * @param string $description
156
+ *
157
+ * @return string
158
+ */
159
+ private static function show_help( $id, $description ) {
160
+ if ( is_null( $description ) ) {
161
+ return '';
162
+ }
163
+
164
+ $help = '<img src="' . plugins_url( 'assets/img/question-mark.png', GAWP_FILE ) . '" class="alignleft yoast_help" id="' . esc_attr( $id . 'help' ) . '" alt="' . esc_attr( $description ) . '" />';
165
+
166
+ return $help;
167
+ }
168
+
169
+ /**
170
+ * Render the help button and set the option value
171
+ *
172
+ * @param array $args Arguments for the input
173
+ */
174
+ private static function before_input( $args ) {
175
+ if ( ! isset( self::$options[ $args['key'] ] ) ) {
176
+ self::$options[ $args['key'] ] = '';
177
+ }
178
+
179
+ if ( isset( $args['help'] ) ) {
180
+ echo self::show_help( $args['key'], $args['help'] );
181
+ }
182
+ }
183
+
184
+ }
admin/class-admin-settings-registrar.php ADDED
@@ -0,0 +1,629 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package GoogleAnalytics\AdminSettingsFieldsRegistrar
4
+ */
5
+
6
+ /**
7
+ * This class is for options/settings in the admin forms
8
+ */
9
+ class Yoast_GA_Admin_Settings_Registrar {
10
+
11
+ /**
12
+ * The slug of this settings page, used in the Settings API
13
+ *
14
+ * @var string
15
+ */
16
+ protected $settings_api_page = 'yst_ga_settings_api';
17
+
18
+ /**
19
+ * Current section of the form fields
20
+ *
21
+ * @var string
22
+ */
23
+ private $current_section;
24
+
25
+ /**
26
+ * @var array
27
+ */
28
+ private $default_options = array(
29
+ 'tracking_code' => array(),
30
+ 'user_roles' => array(),
31
+ 'track_download_types' => array(),
32
+ 'track_full_url' => array(),
33
+ 'analytics_profile' => array(),
34
+ );
35
+
36
+ /**
37
+ * Amount of errors on validation
38
+ *
39
+ * @var integer
40
+ */
41
+ private $errors = 0;
42
+
43
+ /**
44
+ * Construct the new admin settings api forms
45
+ */
46
+ public function __construct() {
47
+ add_action( 'admin_notices', array( $this, 'yst_ga_settings_errors' ) );
48
+ add_action( 'admin_init', array( $this, 'init_default_options' ) );
49
+ add_action( 'admin_init', array( $this, 'yst_ga_settings_init_ua_code' ) );
50
+ add_action( 'admin_init', array( $this, 'yst_ga_settings_init_general' ) );
51
+ add_action( 'admin_init', array( $this, 'yst_ga_settings_init_universal' ) );
52
+ add_action( 'admin_init', array( $this, 'yst_ga_settings_init_advanced' ) );
53
+ add_action( 'admin_init', array( $this, 'yst_ga_settings_init_debug' ) );
54
+
55
+ if ( filter_input( INPUT_GET, 'settings-updated' ) && filter_input( INPUT_GET, 'yst_ga_settings' ) ) {
56
+ add_action( 'admin_init', array( $this, 'update_ga_tracking_from_profile' ) );
57
+ add_action( 'in_admin_footer', array( $this, 'go_to_current_tab' ) );
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Show the settings errors
63
+ */
64
+ public function yst_ga_settings_errors() {
65
+ settings_errors( 'yst_ga_settings' );
66
+ }
67
+
68
+ /**
69
+ * Update the UA tracking code if we have a profile selected in the dropdown in the settings field
70
+ */
71
+ public function update_ga_tracking_from_profile() {
72
+ $tracking_code = get_option( 'yst_ga' );
73
+ if ( $tracking_code['ga_general']['analytics_profile'] !== '' && ( $tracking_code['ga_general']['manual_ua_code'] === '0' || $tracking_code['ga_general']['manual_ua_code'] === 0 ) ) {
74
+ $tracking_code['ga_general']['analytics_profile_code'] = $this->get_ua_code_from_profile( $tracking_code['ga_general']['analytics_profile'] );
75
+
76
+ unset( $tracking_code['ga_general']['ga_general'] ); // cleanup old keys
77
+ update_option( 'yst_ga', $tracking_code );
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Go to the current tab after a save, if we have one
83
+ */
84
+ public function go_to_current_tab() {
85
+ $tab_option = get_option( 'yst_ga' );
86
+
87
+ if ( isset ( $tab_option['ga_general']['return_tab'] ) ) {
88
+ echo '<script type="text/javascript">jQuery(document).ready(function(){jQuery("#' . esc_js( $tab_option['ga_general']['return_tab'] ) . '-tab").click();});</script>';
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Init the UA code block
94
+ */
95
+ public function yst_ga_settings_init_ua_code() {
96
+ $section_name = 'ua_code';
97
+
98
+ register_setting( $this->settings_api_page . '_' . $section_name, 'yst_ga' );
99
+
100
+ $this->create_section( $section_name );
101
+
102
+ if ( ! empty( $this->default_options['analytics_profile'] ) && count( $this->default_options['analytics_profile'] ) >= 1 ) {
103
+ $this->add_field(
104
+ 'analytics_profile',
105
+ __( 'Google Analytics profile', 'google-analytics-for-wordpress' ),
106
+ 'select_profile',
107
+ array(
108
+ 'help' => __( 'Select an analytics profile from your Google account to use for the tracking on this website.', 'google-analytics-for-wordpress' ),
109
+ 'attributes' => ' class="chosen"',
110
+ 'options' => $this->default_options['analytics_profile'],
111
+ )
112
+ );
113
+ }
114
+
115
+ $this->add_field(
116
+ 'manual_ua_code',
117
+ __( 'Use a manual UA code', 'google-analytics-for-wordpress' ),
118
+ 'checkbox',
119
+ array(
120
+ 'help' => __( 'You can use the manual UA code field to enter your UA code manually, instead of using the Google Authenticator.', 'google-analytics-for-wordpress' ),
121
+ )
122
+ );
123
+
124
+ $this->add_field(
125
+ 'manual_ua_code_field',
126
+ __( 'Enter your UA code here', 'google-analytics-for-wordpress' ),
127
+ 'text',
128
+ array(
129
+ 'help' => __( 'Enter the UA code (e.g.: UA-1234567-89) here, you can find the correct UA code in your Google Analytics dashboard.', 'google-analytics-for-wordpress' ),
130
+ )
131
+ );
132
+
133
+ $this->close_section( $section_name );
134
+ }
135
+
136
+ /**
137
+ * Init the general tab
138
+ */
139
+ public function yst_ga_settings_init_general() {
140
+ $section_name = 'general';
141
+
142
+ register_setting( $this->settings_api_page . '_' . $section_name, 'yst_ga' );
143
+
144
+ $this->create_section( $section_name );
145
+
146
+ $this->add_field(
147
+ 'track_outbound',
148
+ __( 'Track outbound click and downloads', 'google-analytics-for-wordpress' ),
149
+ 'checkbox',
150
+ array(
151
+ 'help' => __( 'Clicks and downloads will be tracked as events, you can find these under Content &#xBB; Event Tracking in your Google Analytics reports.', 'google-analytics-for-wordpress' ),
152
+ )
153
+ );
154
+
155
+ $this->add_field(
156
+ 'anonymous_data',
157
+ __( 'Allow tracking of anonymous data', 'google-analytics-for-wordpress' ),
158
+ 'checkbox',
159
+ array(
160
+ 'help' => __( 'By allowing us to track anonymous data we can better help you, because we know with which WordPress configurations, themes and plugins we should test. No personal data will be submitted.', 'google-analytics-for-wordpress' ),
161
+ )
162
+ );
163
+
164
+ $this->add_field(
165
+ 'anonymize_ips',
166
+ __( 'Anonymize IPs', 'google-analytics-for-wordpress' ),
167
+ 'checkbox',
168
+ array(
169
+ 'help' => sprintf( __( 'This adds %1$s, telling Google Analytics to anonymize the information sent by the tracker objects by removing the last octet of the IP address prior to its storage.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApi_gat?csw=1#_gat._anonymizeIp" target="_blank"><code>_anonymizeIp</code></a>' ),
170
+ )
171
+ );
172
+
173
+ $this->add_field(
174
+ 'ignore_users',
175
+ __( 'Ignore users', 'google-analytics-for-wordpress' ),
176
+ 'select',
177
+ array(
178
+ 'help' => __( 'Users of the role you select will be ignored, so if you select Editor, all Editors will be ignored.', 'google-analytics-for-wordpress' ),
179
+ 'attributes' => ' multiple="true" style="width: 365px;" class="chosen"',
180
+ 'options' => $this->default_options['user_roles'],
181
+ )
182
+ );
183
+
184
+ $this->add_field(
185
+ 'dashboards_disabled',
186
+ __( 'Disable analytics dashboard', 'google-analytics-for-wordpress' ),
187
+ 'checkbox',
188
+ array(
189
+ 'help' => __( 'This will completely disable the dashboard and stop the plugin from fetching the latest analytics data.', 'google-analytics-for-wordpress' ),
190
+ )
191
+ );
192
+
193
+ $this->close_section( $section_name );
194
+ }
195
+
196
+ /**
197
+ * Init the universal tab
198
+ */
199
+ public function yst_ga_settings_init_universal() {
200
+ $section_name = 'universal';
201
+
202
+ register_setting( $this->settings_api_page . '_' . $section_name, 'yst_ga' );
203
+
204
+ $this->create_section( $section_name );
205
+
206
+ $this->add_field(
207
+ 'enable_universal',
208
+ __( 'Enable universal', 'google-analytics-for-wordpress' ),
209
+ 'checkbox',
210
+ array(
211
+ 'help' => sprintf( __( 'First enable Universal tracking in your Google Analytics account. Please read %1$sthis guide%2$s to learn how to do that.', 'google-analytics-for-wordpress' ), '<a href="http://kb.yoast.com/article/125-universal-analytics#utm_medium=kb-link&utm_source=gawp-config&utm_campaign=wpgaplugin" target="_blank">', '</a>' ),
212
+ )
213
+ );
214
+
215
+ $this->add_field(
216
+ 'demographics',
217
+ __( 'Enable Demographics and Interest Reports', 'google-analytics-for-wordpress' ),
218
+ 'checkbox',
219
+ array(
220
+ 'help' => sprintf( __( 'You have to enable the Demographics in Google Analytics before you can see the tracking data. We have a knowledge base article in our %1$sknowledge base%2$s about this feature.', 'google-analytics-for-wordpress' ), '<a href="http://kb.yoast.com/article/154-enable-demographics-and-interests-report-in-google-analytics/#utm_medium=kb-link&amp;utm_source=gawp-config&amp;utm_campaign=wpgaplugin" target="_blank">', '</a>' ),
221
+ )
222
+ );
223
+
224
+ $this->add_field(
225
+ 'enhanced_link_attribution',
226
+ __( 'Enhanced Link Attribution', 'google-analytics-for-wordpress' ),
227
+ 'checkbox',
228
+ array(
229
+ 'help' => sprintf( __( 'Add %1$sEnhanced Link Attribution%2$s to your tracking code.', 'google-analytics-for-wordpress' ), '<a href="https://support.google.com/analytics/answer/2558867" target="_blank">', ' </a>' )
230
+ )
231
+ );
232
+
233
+ $this->close_section( $section_name );
234
+ }
235
+
236
+ /**
237
+ * Init the advanced tab
238
+ */
239
+ public function yst_ga_settings_init_advanced() {
240
+ $section_name = 'advanced';
241
+
242
+ register_setting( $this->settings_api_page . '_' . $section_name, 'yst_ga' );
243
+
244
+ $this->create_section( $section_name );
245
+
246
+ $this->add_field(
247
+ 'track_download_as',
248
+ __( 'Track downloads as', 'google-analytics-for-wordpress' ),
249
+ 'select',
250
+ array(
251
+ 'help' => __( 'Not recommended, as this would skew your statistics, but it does make it possible to track downloads as goals.', 'google-analytics-for-wordpress' ),
252
+ 'options' => $this->default_options['track_download_types'],
253
+ 'attributes' => ' class="chosen"',
254
+ )
255
+ );
256
+
257
+ $this->add_field(
258
+ 'extensions_of_files',
259
+ __( 'Extensions of files to track as downloads', 'google-analytics-for-wordpress' ),
260
+ 'text',
261
+ array(
262
+ 'help' => __( 'Please separate extensions using commas', 'google-analytics-for-wordpress' ),
263
+ )
264
+ );
265
+
266
+ $this->add_field(
267
+ 'track_full_url',
268
+ __( 'Track full URL of outbound clicks or just the domain', 'google-analytics-for-wordpress' ),
269
+ 'select',
270
+ array(
271
+ 'help' => __( 'How should we track your outbound clicks?', 'google-analytics-for-wordpress' ),
272
+ 'options' => $this->default_options['track_full_url'],
273
+ 'attributes' => ' class="chosen"',
274
+ )
275
+ );
276
+
277
+ $this->add_field(
278
+ 'subdomain_tracking',
279
+ __( 'Subdomain tracking', 'google-analytics-for-wordpress' ),
280
+ 'text',
281
+ array(
282
+ 'help' => sprintf( __( 'This allows you to set the domain that\'s set by %1$s for tracking subdomains.<br/>If empty, this will not be set.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._setDomainName" target="_blank"><code>_setDomainName</code></a>' ),
283
+ )
284
+ );
285
+
286
+ $this->add_field(
287
+ 'track_internal_as_outbound',
288
+ __( 'Set path for internal links to track as outbound links', 'google-analytics-for-wordpress' ),
289
+ 'text',
290
+ array(
291
+ 'help' => sprintf( __( 'If you want to track all internal links that begin with %1$s, enter %1$s in the box above. If you have multiple prefixes you can separate them with comma\'s: %2$s', 'google-analytics-for-wordpress' ), '<code>/out/</code>', '<code>/out/,/recommends/</code>' ),
292
+ )
293
+ );
294
+
295
+ $this->add_field(
296
+ 'track_internal_as_label',
297
+ __( 'Label for those links', 'google-analytics-for-wordpress' ),
298
+ 'text',
299
+ array(
300
+ 'help' => __( 'The label to use for these links, this will be added to where the click came from, so if the label is "aff", the label for a click from the content of an article becomes "outbound-article-aff".', 'google-analytics-for-wordpress' ),
301
+ )
302
+ );
303
+
304
+ $this->add_field(
305
+ 'tag_links_in_rss',
306
+ __( 'Tag links in RSS feed with campaign variables', 'google-analytics-for-wordpress' ),
307
+ 'checkbox',
308
+ array(
309
+ 'help' => __( 'Do not use this feature if you use FeedBurner, as FeedBurner can do this automatically and better than this plugin can. Check <a href="https://support.google.com/feedburner/answer/165769?hl=en&amp;ref_topic=13075" target="_blank">this help page</a> for info on how to enable this feature in FeedBurner.', 'google-analytics-for-wordpress' ),
310
+ )
311
+ );
312
+
313
+ $this->add_field(
314
+ 'allow_anchor',
315
+ __( 'Tag links in RSS feed with campaign variables', 'google-analytics-for-wordpress' ),
316
+ 'checkbox',
317
+ array(
318
+ 'help' => sprintf( __( 'This adds a %1$s call to your tracking code, and makes RSS link tagging use a %2$s as well.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiCampaignTracking?csw=1#_gat.GA_Tracker_._setAllowAnchor" target="_blank"><code>_setAllowAnchor</code></a>', '<code>#</code>' ),
319
+ )
320
+ );
321
+
322
+ $this->add_field(
323
+ 'add_allow_linker',
324
+ __( 'Add <code>_setAllowLinker</code>', 'google-analytics-for-wordpress' ),
325
+ 'checkbox',
326
+ array(
327
+ 'help' => sprintf( __( 'This adds a %1$s call to your tracking code, allowing you to use %2$s and related functions.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory?csw=1#_gat.GA_Tracker_._setAllowLinker" target="_blank"><code>_setAllowLinker</code></a>', ' <code>_link</code>' ),
328
+ )
329
+ );
330
+
331
+ $this->add_field(
332
+ 'custom_code',
333
+ __( 'Custom code', 'google-analytics-for-wordpress' ),
334
+ 'textarea',
335
+ array(
336
+ 'help' => sprintf( __( 'Not for the average user: this allows you to add a line of code, to be added before the %1$s call.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._trackPageview" target="_blank"><code>_trackPageview</code></a>' ),
337
+ )
338
+ );
339
+
340
+ $this->close_section( $section_name );
341
+ }
342
+
343
+ /**
344
+ * Init the debug tab
345
+ */
346
+ public function yst_ga_settings_init_debug() {
347
+ $section_name = 'debug';
348
+
349
+ register_setting( $this->settings_api_page . '_' . $section_name, 'yst_ga', array( $this, 'validate_options_ua_code' ) );
350
+
351
+ $this->create_section( $section_name );
352
+
353
+ $this->add_field(
354
+ 'debug_mode',
355
+ __( 'Enable debug mode', 'google-analytics-for-wordpress' ),
356
+ 'checkbox',
357
+ array(
358
+ 'help' => __( 'Not recommended, as this would skew your statistics, but it does make it possible to track downloads as goals.', 'google-analytics-for-wordpress' ),
359
+ )
360
+ );
361
+
362
+ $this->close_section( $section_name );
363
+ }
364
+
365
+ /**
366
+ * Validate the UA code options
367
+ *
368
+ * @param array $new_settings
369
+ *
370
+ * @return array
371
+ */
372
+ public function validate_options_ua_code( $new_settings ) {
373
+ foreach ( $new_settings['ga_general'] as $key => $value ) {
374
+ switch ( $key ) {
375
+ case 'manual_ua_code':
376
+ if ( $new_settings['ga_general']['manual_ua_code'] === '1' ) {
377
+ $new_settings['ga_general']['manual_ua_code_field'] = trim( $new_settings['ga_general']['manual_ua_code_field'] );
378
+ $new_settings['ga_general']['manual_ua_code_field'] = str_replace( '–', '-', $new_settings['ga_general']['manual_ua_code_field'] );
379
+
380
+ if ( ! $this->validate_manual_ua_code( $new_settings['ga_general']['manual_ua_code_field'] ) ) {
381
+ unset( $new_settings['ga_general']['manual_ua_code_field'] );
382
+
383
+ $this->errors ++;
384
+ }
385
+ }
386
+ break;
387
+ case 'analytics_profile':
388
+ if ( ! empty( $new_settings['ga_general']['analytics_profile'] ) ) {
389
+ $new_settings['ga_general']['analytics_profile'] = trim( $new_settings['ga_general']['analytics_profile'] );
390
+
391
+ if ( ! $this->validate_profile_id( $new_settings['ga_general']['analytics_profile'] ) ) {
392
+ unset( $new_settings['ga_general']['analytics_profile'] );
393
+
394
+ $this->errors ++;
395
+ }
396
+ }
397
+ break;
398
+ }
399
+ }
400
+
401
+ if ( ! isset( $new_settings['ga_general']['ignore_users'] ) ) {
402
+ $new_settings['ga_general']['ignore_users'] = array();
403
+ }
404
+
405
+ if ( ! isset( $new_settings['ga_general']['enable_universal'] ) ) {
406
+ $new_settings['ga_general']['enable_universal'] = 0;
407
+ }
408
+
409
+ if ( $this->errors === 0 && get_settings_errors( 'yst_ga_settings' ) === array() ) {
410
+ add_settings_error(
411
+ 'yst_ga_settings',
412
+ 'yst_ga_settings',
413
+ __( 'The Google Analytics settings are saved successfully.', 'google-analytics-for-wordpress' ),
414
+ 'updated'
415
+ );
416
+ }
417
+
418
+ return $new_settings;
419
+ }
420
+
421
+ /**
422
+ * Set the default options, for now, it is in the admin class (Needs to be hooked at admin_init)
423
+ */
424
+ public function init_default_options() {
425
+ $this->default_options = array(
426
+ 'tracking_code' => Yoast_GA_Options::instance()->get_tracking_code(),
427
+ 'user_roles' => $this->get_userroles(),
428
+ 'track_download_types' => $this->track_download_types(),
429
+ 'track_full_url' => $this->get_track_full_url(),
430
+ 'analytics_profile' => $this->get_profiles(),
431
+ );
432
+ }
433
+
434
+ /**
435
+ * Transform the Profile ID into an helpful UA code
436
+ *
437
+ * @param int $profile_id The profile ID from Google Analytics
438
+ *
439
+ * @return null|string
440
+ */
441
+ public function get_ua_code_from_profile( $profile_id ) {
442
+ $profiles = $this->get_profiles();
443
+ $ua_code = null;
444
+
445
+ foreach ( $profiles as $account ) {
446
+ foreach ( $account['items'] as $profile ) {
447
+ foreach ( $profile['items'] as $subprofile ) {
448
+ if ( isset( $subprofile['id'] ) && $subprofile['id'] === $profile_id ) {
449
+ return $subprofile['ua_code'];
450
+ }
451
+ }
452
+ }
453
+ }
454
+
455
+ return $ua_code;
456
+ }
457
+
458
+ /**
459
+ * Get the user roles of this WordPress blog
460
+ *
461
+ * @return array
462
+ */
463
+ protected function get_userroles() {
464
+ global $wp_roles;
465
+
466
+ $all_roles = $wp_roles->roles;
467
+ $roles = array();
468
+
469
+ /**
470
+ * Filter: 'editable_roles' - Allows filtering of the roles shown within the plugin (and elsewhere in WP as it's a WP filter)
471
+ *
472
+ * @api array $all_roles
473
+ */
474
+ $editable_roles = apply_filters( 'editable_roles', $all_roles );
475
+
476
+ foreach ( $editable_roles as $id => $name ) {
477
+ $roles[] = array(
478
+ 'id' => $id,
479
+ 'name' => translate_user_role( $name['name'] ),
480
+ );
481
+ }
482
+
483
+ return $roles;
484
+ }
485
+
486
+ /**
487
+ * Get types of how we can track downloads
488
+ *
489
+ * @return array
490
+ */
491
+ protected function track_download_types() {
492
+ return array(
493
+ 0 => array( 'id' => 'event', 'name' => __( 'Event', 'google-analytics-for-wordpress' ) ),
494
+ 1 => array( 'id' => 'pageview', 'name' => __( 'Pageview', 'google-analytics-for-wordpress' ) ),
495
+ );
496
+ }
497
+
498
+ /**
499
+ * Get options for the track full url or links setting
500
+ *
501
+ * @return array
502
+ */
503
+ protected function get_track_full_url() {
504
+ return array(
505
+ 0 => array( 'id' => 'domain', 'name' => __( 'Just the domain', 'google-analytics-for-wordpress' ) ),
506
+ 1 => array( 'id' => 'full_links', 'name' => __( 'Full links', 'google-analytics-for-wordpress' ) ),
507
+ );
508
+ }
509
+
510
+
511
+ /**
512
+ * Create a new settings section
513
+ *
514
+ * @param string $tab The tab name that should be added
515
+ */
516
+ protected function create_section( $tab ) {
517
+ $this->current_section = $tab;
518
+
519
+ add_settings_section(
520
+ 'yst_ga_settings_api_' . $tab,
521
+ '',
522
+ '',
523
+ $this->settings_api_page . '_' . $tab
524
+ );
525
+ }
526
+
527
+ /**
528
+ * Add a extra fields while closing the section
529
+ *
530
+ * @param string $tab
531
+ */
532
+ protected function close_section( $tab ) {
533
+ /**
534
+ * Filter: 'yst-ga-settings-fields-[TAB_NAME]' - Create an extra input field.
535
+ *
536
+ * @api array Array with extra fields for this tab
537
+ */
538
+ $extra_fields = apply_filters( 'yst-ga-settings-fields-' . $tab, array() );
539
+
540
+ if ( ! empty( $extra_fields ) && is_array( $extra_fields ) ) {
541
+ foreach ( $extra_fields as $field ) {
542
+ $this->add_field( $field['id'], $field['title'], $field['type'], $field['args'] );
543
+ }
544
+ }
545
+ }
546
+
547
+ /**
548
+ * Add a settings field
549
+ *
550
+ * @param string $id ID of the field and key name in the options
551
+ * @param string $title Title of this field
552
+ * @param string $type Type of the field e.g. text, select etc.
553
+ * @param array $args Extra arguments for the field that will be rendered
554
+ */
555
+ protected function add_field( $id, $title, $type, $args ) {
556
+ if ( ! isset( $args['key'] ) ) {
557
+ $args['key'] = $id;
558
+ }
559
+
560
+ if ( ! isset( $args['label_for'] ) ) {
561
+ $args['label_for'] = 'ga_form_' . $args['key'];
562
+ }
563
+
564
+ add_settings_field(
565
+ 'yst_ga_' . $id,
566
+ $title,
567
+ array( 'Yoast_GA_Admin_Settings_Fields', 'yst_ga_' . $type . '_field' ),
568
+ $this->settings_api_page . '_' . $this->current_section,
569
+ $this->settings_api_page . '_' . $this->current_section,
570
+ $args
571
+ );
572
+ }
573
+
574
+ /**
575
+ * Validate the manual UA code
576
+ *
577
+ * @param string $ua_code The UA code that we have to check
578
+ *
579
+ * @return bool
580
+ */
581
+ private function validate_manual_ua_code( $ua_code ) {
582
+ if ( ! preg_match( '|^UA-\d{4,}-\d+$|', $ua_code ) ) {
583
+ add_settings_error(
584
+ 'yst_ga_settings',
585
+ 'yst_ga_settings',
586
+ __( 'The UA code needs to follow UA-XXXXXXXX-X format.', 'google-analytics-for-wordpress' ),
587
+ 'error'
588
+ );
589
+
590
+ return false;
591
+ }
592
+
593
+ return true;
594
+ }
595
+
596
+ /**
597
+ * Validate the profile ID in the selectbox
598
+ *
599
+ * @param int $profile_id Check the profile id
600
+ *
601
+ * @return bool
602
+ */
603
+ private function validate_profile_id( $profile_id ) {
604
+ if ( ! is_numeric( $profile_id ) ) {
605
+ add_settings_error(
606
+ 'yst_ga_settings',
607
+ 'yst_ga_settings',
608
+ __( 'The profile ID needs to be numeric.', 'google-analytics-for-wordpress' ),
609
+ 'error'
610
+ );
611
+
612
+ return false;
613
+ }
614
+
615
+ return true;
616
+ }
617
+
618
+ /**
619
+ * Get the Google Analytics profiles which are in this google account
620
+ *
621
+ * @return array
622
+ */
623
+ private function get_profiles() {
624
+ $return = Yoast_Google_Analytics::get_instance()->get_profiles();
625
+
626
+ return $return;
627
+ }
628
+
629
+ }
admin/class-admin.php CHANGED
@@ -1,24 +1,43 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
8
- * This class is for the backend, extendable for all child classes
9
  */
10
- class Yoast_GA_Admin extends Yoast_GA_Options {
11
 
12
  /**
13
- * @var boolean $api Store the API instance
 
 
14
  */
15
  public $api;
16
 
17
  /**
18
- * Constructor
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  */
20
  public function __construct() {
21
- parent::__construct();
 
22
 
23
  add_action( 'plugins_loaded', array( $this, 'init_ga' ) );
24
  add_action( 'admin_init', array( $this, 'init_settings' ) );
@@ -28,39 +47,36 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
28
  * Init function when the plugin is loaded
29
  */
30
  public function init_ga() {
31
-
32
  new Yoast_GA_Admin_Menu( $this );
33
 
34
- add_filter( 'plugin_action_links_' . plugin_basename( GAWP_FILE ), array( $this, 'add_action_links' ) );
35
 
 
36
  }
37
 
38
  /**
39
  * Init function for the settings of GA
40
  */
41
  public function init_settings() {
42
- $this->options = $this->get_options();
 
 
43
  $this->api = Yoast_Api_Libs::load_api_libraries( array( 'google', 'googleanalytics' ) );
44
  $dashboards = Yoast_GA_Dashboards::get_instance();
45
 
46
  // Listener for reconnecting with google analytics
47
  $this->google_analytics_listener();
48
 
49
- if ( is_null( $this->get_tracking_code() ) && $this->show_admin_warning() ) {
50
  add_action( 'admin_notices', array( 'Yoast_Google_Analytics_Notice', 'config_warning' ) );
51
  }
52
 
53
  // Check if something has went wrong with GA-api calls
54
- $has_tracking_code = ( ! is_null( $this->get_tracking_code() ) && empty( $this->options['manual_ua_code_field'] ) );
55
  if ( $has_tracking_code && $this->show_admin_dashboard_warning() ) {
56
  Yoast_Google_Analytics::get_instance()->check_for_ga_issues();
57
  }
58
 
59
-
60
- if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
61
- $this->handle_ga_post_request( $dashboards );
62
- }
63
-
64
  /**
65
  * Show the notifications if we have one
66
  */
@@ -70,71 +86,6 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
70
  $dashboards->init_dashboards( $this->get_current_profile() );
71
  }
72
 
73
- /**
74
- * This function saves the settings in the option field and returns a wp success message on success
75
- *
76
- * @param array $data
77
- */
78
- public function save_settings( $data ) {
79
-
80
- unset( $data['google_auth_code'] );
81
-
82
- foreach ( $data as $key => $value ) {
83
- if ( $key != 'return_tab' ) {
84
- if ( $key != 'custom_code' && is_string( $value ) ) {
85
- $value = strip_tags( $value );
86
- }
87
- $this->options[ $key ] = $value;
88
- }
89
- }
90
-
91
- // Check checkboxes, on a uncheck they won't be posted to this function
92
- $defaults = $this->default_ga_values();
93
- foreach ( $defaults[ $this->option_prefix ] as $option_name => $value ) {
94
- $this->handle_default_setting( $data, $option_name, $value );
95
- }
96
-
97
- if ( ! empty( $this->options['analytics_profile'] ) ) {
98
- $this->options['analytics_profile_code'] = $this->get_ua_code_from_profile( $this->options['analytics_profile'] );
99
- }
100
-
101
- if ( ! empty( $this->options['manual_ua_code_field'] ) ) {
102
- $this->options['manual_ua_code_field'] = trim( $this->options['manual_ua_code_field'] );
103
- // en dash to minus, prevents issue with code copied from web with "fancy" dash
104
- $this->options['manual_ua_code_field'] = str_replace( '–', '-', $this->options['manual_ua_code_field'] );
105
-
106
- if ( ! preg_match( '|^UA-\d{4,}-\d+$|', $this->options['manual_ua_code_field'] ) ) {
107
-
108
- $this->add_notification( 'ga_notifications', array(
109
- 'type' => 'error',
110
- 'description' => __( 'The UA code needs to follow UA-XXXXXXXX-X format.', 'google-analytics-for-wordpress' ),
111
- ) );
112
-
113
- wp_redirect( admin_url( 'admin.php' ) . '?page=yst_ga_settings#top#' . $data['return_tab'], 301 );
114
- exit;
115
- }
116
- }
117
-
118
- if ( $this->update_option( $this->options ) ) {
119
- // Success, add a new notification
120
- $this->add_notification( 'ga_notifications', array(
121
- 'type' => 'success',
122
- 'description' => __( 'Settings saved.', 'google-analytics-for-wordpress' ),
123
- ) );
124
- }
125
- else {
126
- // Fail, add a new notification
127
- $this->add_notification( 'ga_notifications', array(
128
- 'type' => 'error',
129
- 'description' => __( 'There were no changes to save, please try again.', 'google-analytics-for-wordpress' ),
130
- ) );
131
- }
132
-
133
- // redirect
134
- wp_redirect( admin_url( 'admin.php' ) . '?page=yst_ga_settings#top#' . $data['return_tab'], 301 );
135
- exit;
136
- }
137
-
138
  /**
139
  * Run a this deactivation hook on deactivation of GA. When this happens we'll
140
  * remove the options for the profiles and the refresh token.
@@ -144,69 +95,6 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
144
  self::analytics_api_clean_up();
145
  }
146
 
147
- /**
148
- * Handle a default setting in GA
149
- *
150
- * @param array $data
151
- * @param string $option_name
152
- * @param mixed $value
153
- */
154
- private function handle_default_setting( $data, $option_name, $value ) {
155
- if ( ! isset( $data[ $option_name ] ) ) {
156
- // If no data was passed in, set it to the default.
157
- if ( $value === 1 ) {
158
- // Disable the checkbox for now, use value 0
159
- $this->options[ $option_name ] = 0;
160
- }
161
- else {
162
- $this->options[ $option_name ] = $value;
163
- }
164
- }
165
- }
166
-
167
- /**
168
- * Handle the post requests in the admin form of the GA plugin
169
- *
170
- * @param Yoast_GA_Dashboards $dashboards
171
- */
172
- private function handle_ga_post_request( $dashboards ) {
173
- if ( ! function_exists( 'wp_verify_nonce' ) ) {
174
- require_once( ABSPATH . 'wp-includes/pluggable.php' );
175
- }
176
-
177
- if ( isset( $_POST['ga-form-settings'] ) && wp_verify_nonce( $_POST['yoast_ga_nonce'], 'save_settings' ) ) {
178
- if ( ! isset ( $_POST['ignore_users'] ) ) {
179
- $_POST['ignore_users'] = array();
180
- }
181
-
182
- $dashboards_disabled = Yoast_GA_Settings::get_instance()->dashboards_disabled();
183
-
184
- if ( ( $dashboards_disabled == false && isset( $_POST['dashboards_disabled'] ) ) || $this->ga_profile_changed( $_POST ) ) {
185
- $dashboards->reset_dashboards_data();
186
- }
187
-
188
- // Post submitted and verified with our nonce
189
- $this->save_settings( $_POST );
190
- }
191
- }
192
-
193
- /**
194
- * Is there selected an other property in the settings post? Returns true or false.
195
- *
196
- * @param array $post
197
- *
198
- * @return bool
199
- */
200
- private function ga_profile_changed( $post ) {
201
- if ( isset( $post['analytics_profile'] ) && isset( $this->options['analytics_profile'] ) ) {
202
- if ( $post['analytics_profile'] != $this->options['analytics_profile'] ) {
203
- return true;
204
- }
205
- }
206
-
207
- return false;
208
- }
209
-
210
  /**
211
  * Are we allowed to show a warning message? returns true if it's allowed
212
  *
@@ -225,30 +113,6 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
225
  return ( current_user_can( 'manage_options' ) && isset( $_GET['page'] ) && $_GET['page'] === 'yst_ga_dashboard' );
226
  }
227
 
228
- /**
229
- * Transform the Profile ID into an helpful UA code
230
- *
231
- * @param integer $profile_id
232
- *
233
- * @return null
234
- */
235
- private function get_ua_code_from_profile( $profile_id ) {
236
- $profiles = $this->get_profiles();
237
- $ua_code = null;
238
-
239
- foreach ( $profiles as $account ) {
240
- foreach ( $account['items'] as $profile ) {
241
- foreach ( $profile['items'] as $subprofile ) {
242
- if ( isset( $subprofile['id'] ) && $subprofile['id'] === $profile_id ) {
243
- return $subprofile['ua_code'];
244
- }
245
- }
246
- }
247
- }
248
-
249
- return $ua_code;
250
- }
251
-
252
  /**
253
  * Add a link to the settings page to the plugins list
254
  *
@@ -268,17 +132,27 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
268
  return $links;
269
  }
270
 
 
 
 
 
 
 
 
271
  /**
272
  * Adds some promo text for the premium plugin on the custom dimensions tab.
273
  */
274
- public function premium_promo() {
275
- echo '<div class="ga-promote">';
276
- echo '<p>';
277
- printf( __( 'If you want to track custom dimensions like page views per author or post type, you should upgrade to the %1$spremium version of Google Analytics by Yoast%2$s.', 'google-analytics-for-wordpress' ), '<a href="https://yoast.com/wordpress/plugins/google-analytics/#utm_medium=text-link&utm_source=gawp-config&utm_campaign=wpgaplugin&utm_content=custom_dimensions_tab">', '</a>' );
278
- echo ' ';
279
- _e( 'This will also give you email access to the support team at Yoast, who will provide support on the plugin 24/7.', 'google-analytics-for-wordpress' );
280
- echo '</p>';
281
- echo '</div>';
 
 
 
282
  }
283
 
284
  /**
@@ -311,7 +185,8 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
311
  $this->translate_promo();
312
 
313
  if ( ! has_action( 'yst_ga_custom_dimensions_tab-content' ) ) {
314
- add_action( 'yst_ga_custom_dimensions_tab-content', array( $this, 'premium_promo' ) );
 
315
  }
316
 
317
  if ( ! has_action( 'yst_ga_custom_dimension_add-dashboards-tab' ) ) {
@@ -320,7 +195,7 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
320
 
321
  switch ( filter_input( INPUT_GET, 'page' ) ) {
322
  case 'yst_ga_settings':
323
- require_once( $this->plugin_path . 'admin/pages/settings.php' );
324
  break;
325
  case 'yst_ga_extensions':
326
  require_once( $this->plugin_path . 'admin/pages/extensions.php' );
@@ -332,25 +207,15 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
332
  }
333
  }
334
 
335
-
336
  /**
337
- * Get the Google Analytics profiles which are in this google account
338
- *
339
- * @return array
340
- */
341
- public function get_profiles() {
342
- $return = Yoast_Google_Analytics::get_instance()->get_profiles();
343
-
344
- return $return;
345
- }
346
-
347
- /**
348
- * Checks if there is a callback to get token from Google Analytics API
349
  */
350
  private function google_analytics_listener() {
 
 
 
351
  $google_auth_code = filter_input( INPUT_POST, 'google_auth_code' );
352
- if ( $google_auth_code && current_user_can( 'manage_options' ) ) {
353
- wp_verify_nonce( 'yoast_ga_nonce', 'save_settings' );
354
 
355
  self::analytics_api_clean_up();
356
 
@@ -369,69 +234,22 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
369
  }
370
 
371
  /**
372
- * Get the current GA profile
 
 
373
  *
374
  * @return null
375
  */
376
- private function get_current_profile() {
377
  if ( ! empty( $this->options['analytics_profile'] ) ) {
378
- return $this->options['analytics_profile'];
379
- }
380
- else {
381
- return null;
382
- }
383
- }
384
-
385
- /**
386
- * Get the user roles of this WordPress blog
387
- *
388
- * @return array
389
- */
390
- public function get_userroles() {
391
- global $wp_roles;
392
-
393
- $all_roles = $wp_roles->roles;
394
- $roles = array();
395
-
396
- /**
397
- * Filter: 'editable_roles' - Allows filtering of the roles shown within the plugin (and elsewhere in WP as it's a WP filter)
398
- *
399
- * @api array $all_roles
400
- */
401
- $editable_roles = apply_filters( 'editable_roles', $all_roles );
402
 
403
- foreach ( $editable_roles as $id => $name ) {
404
- $roles[] = array(
405
- 'id' => $id,
406
- 'name' => translate_user_role( $name['name'] ),
407
- );
408
  }
409
 
410
- return $roles;
411
- }
412
-
413
- /**
414
- * Get types of how we can track downloads
415
- *
416
- * @return array
417
- */
418
- public function track_download_types() {
419
- return array(
420
- 0 => array( 'id' => 'event', 'name' => __( 'Event', 'google-analytics-for-wordpress' ) ),
421
- 1 => array( 'id' => 'pageview', 'name' => __( 'Pageview', 'google-analytics-for-wordpress' ) ),
422
- );
423
- }
424
-
425
- /**
426
- * Get options for the track full url or links setting
427
- *
428
- * @return array
429
- */
430
- public function get_track_full_url() {
431
- return array(
432
- 0 => array( 'id' => 'domain', 'name' => __( 'Just the domain', 'google-analytics-for-wordpress' ) ),
433
- 1 => array( 'id' => 'full_links', 'name' => __( 'Full links', 'google-analytics-for-wordpress' ) ),
434
- );
435
  }
436
 
437
  /**
@@ -516,16 +334,6 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
516
  return $extensions;
517
  }
518
 
519
- /**
520
- * Add a notification to the notification transient
521
- *
522
- * @param string $transient_name
523
- * @param array $settings
524
- */
525
- private function add_notification( $transient_name, $settings ) {
526
- set_transient( $transient_name, $settings, MINUTE_IN_SECONDS );
527
- }
528
-
529
  /**
530
  * Show the notification that should be set, after showing the notification this function unset the transient
531
  *
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
7
+ * This class is for the backend
8
  */
9
+ class Yoast_GA_Admin {
10
 
11
  /**
12
+ * Store the API instance
13
+ *
14
+ * @var resource
15
  */
16
  public $api;
17
 
18
  /**
19
+ * Store the options
20
+ *
21
+ * @var array
22
+ */
23
+ private $options;
24
+
25
+ /**
26
+ * @var string
27
+ */
28
+ private $plugin_path;
29
+
30
+ /**
31
+ * @var string
32
+ */
33
+ private $plugin_url;
34
+
35
+ /**
36
+ * Construct the admin class
37
  */
38
  public function __construct() {
39
+ $this->plugin_path = GAWP_DIR . '/';
40
+ $this->plugin_url = GAWP_URL;
41
 
42
  add_action( 'plugins_loaded', array( $this, 'init_ga' ) );
43
  add_action( 'admin_init', array( $this, 'init_settings' ) );
47
  * Init function when the plugin is loaded
48
  */
49
  public function init_ga() {
 
50
  new Yoast_GA_Admin_Menu( $this );
51
 
52
+ new Yoast_GA_Admin_Settings_Registrar();
53
 
54
+ add_filter( 'plugin_action_links_' . plugin_basename( GAWP_FILE ), array( $this, 'add_action_links' ) );
55
  }
56
 
57
  /**
58
  * Init function for the settings of GA
59
  */
60
  public function init_settings() {
61
+ $options_instance = Yoast_GA_Options::instance();
62
+ $this->options = $options_instance->get_options();
63
+
64
  $this->api = Yoast_Api_Libs::load_api_libraries( array( 'google', 'googleanalytics' ) );
65
  $dashboards = Yoast_GA_Dashboards::get_instance();
66
 
67
  // Listener for reconnecting with google analytics
68
  $this->google_analytics_listener();
69
 
70
+ if ( is_null( $options_instance->get_tracking_code() ) && $this->show_admin_warning() ) {
71
  add_action( 'admin_notices', array( 'Yoast_Google_Analytics_Notice', 'config_warning' ) );
72
  }
73
 
74
  // Check if something has went wrong with GA-api calls
75
+ $has_tracking_code = ( ! is_null( $options_instance->get_tracking_code() ) && empty( $this->options['manual_ua_code_field'] ) );
76
  if ( $has_tracking_code && $this->show_admin_dashboard_warning() ) {
77
  Yoast_Google_Analytics::get_instance()->check_for_ga_issues();
78
  }
79
 
 
 
 
 
 
80
  /**
81
  * Show the notifications if we have one
82
  */
86
  $dashboards->init_dashboards( $this->get_current_profile() );
87
  }
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  /**
90
  * Run a this deactivation hook on deactivation of GA. When this happens we'll
91
  * remove the options for the profiles and the refresh token.
95
  self::analytics_api_clean_up();
96
  }
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  /**
99
  * Are we allowed to show a warning message? returns true if it's allowed
100
  *
113
  return ( current_user_can( 'manage_options' ) && isset( $_GET['page'] ) && $_GET['page'] === 'yst_ga_dashboard' );
114
  }
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  /**
117
  * Add a link to the settings page to the plugins list
118
  *
132
  return $links;
133
  }
134
 
135
+ /**
136
+ * Register the custom dimensions tab
137
+ */
138
+ public function register_custom_dimensions_tab() {
139
+ echo '<a class="nav-tab" id="yst_ga_custom_dimensions-tab" href="#top#yst_ga_custom_dimensions">' . __( 'Custom Dimensions', 'google-analytics-for-wordpress' ) . '</a>';
140
+ }
141
+
142
  /**
143
  * Adds some promo text for the premium plugin on the custom dimensions tab.
144
  */
145
+ public function premium_promo_tab() {
146
+ echo $this->premium_promo( true );
147
+ }
148
+
149
+ /**
150
+ * Adds some promo text for the premium plugin on the custom dimensions tab.
151
+ *
152
+ * @param bool $add_tab_div Add the div wrapper to make it a tab
153
+ */
154
+ public function premium_promo( $add_tab_div = false ) {
155
+ require_once( $this->plugin_path . 'admin/views/custom-dimensions-upsell.php' );
156
  }
157
 
158
  /**
185
  $this->translate_promo();
186
 
187
  if ( ! has_action( 'yst_ga_custom_dimensions_tab-content' ) ) {
188
+ add_action( 'yst_ga_custom_tabs-tab', array( $this, 'register_custom_dimensions_tab' ) );
189
+ add_action( 'yst_ga_custom_tabs-content', array( $this, 'premium_promo_tab' ) );
190
  }
191
 
192
  if ( ! has_action( 'yst_ga_custom_dimension_add-dashboards-tab' ) ) {
195
 
196
  switch ( filter_input( INPUT_GET, 'page' ) ) {
197
  case 'yst_ga_settings':
198
+ require_once( $this->plugin_path . 'admin/pages/settings-api.php' );
199
  break;
200
  case 'yst_ga_extensions':
201
  require_once( $this->plugin_path . 'admin/pages/extensions.php' );
207
  }
208
  }
209
 
 
210
  /**
211
+ * Checks if there is a callback or reauth to get token from Google Analytics api
 
 
 
 
 
 
 
 
 
 
 
212
  */
213
  private function google_analytics_listener() {
214
+ if ( ! empty( $this->options['google_auth_code'] ) ) {
215
+ Yoast_Google_Analytics::get_instance()->authenticate( trim( $this->options['google_auth_code'] ) );
216
+ }
217
  $google_auth_code = filter_input( INPUT_POST, 'google_auth_code' );
218
+ if ( $google_auth_code && current_user_can( 'manage_options' ) && wp_verify_nonce( 'yoast_ga_nonce', 'save_settings' ) ) {
 
219
 
220
  self::analytics_api_clean_up();
221
 
234
  }
235
 
236
  /**
237
+ * Get the UA code from a profile
238
+ *
239
+ * @param bool $ua_code
240
  *
241
  * @return null
242
  */
243
+ public function get_current_profile( $ua_code = false ) {
244
  if ( ! empty( $this->options['analytics_profile'] ) ) {
245
+ if ( $ua_code ) {
246
+ return $this->options['analytics_profile_code'];
247
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
 
249
+ return $this->options['analytics_profile'];
 
 
 
 
250
  }
251
 
252
+ return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  }
254
 
255
  /**
334
  return $extensions;
335
  }
336
 
 
 
 
 
 
 
 
 
 
 
337
  /**
338
  * Show the notification that should be set, after showing the notification this function unset the transient
339
  *
admin/class-google-analytics.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
admin/dashboards/class-admin-dashboards-api-options.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
admin/dashboards/class-admin-dashboards-collector.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
admin/dashboards/class-admin-dashboards-data.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
admin/dashboards/class-admin-dashboards-display.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
admin/dashboards/class-admin-dashboards.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
@@ -51,7 +50,7 @@ class Yoast_GA_Dashboards {
51
  protected function __construct() {
52
  add_filter( 'ga_extend_dashboards', array( $this, 'extend_dashboards' ), 10, 1 );
53
 
54
- $this->dashboards_disabled = Yoast_GA_Settings::get_instance()->dashboards_disabled();
55
  }
56
 
57
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
50
  protected function __construct() {
51
  add_filter( 'ga_extend_dashboards', array( $this, 'extend_dashboards' ), 10, 1 );
52
 
53
+ $this->dashboards_disabled = Yoast_GA_Options_Utils::get_instance()->dashboards_disabled();
54
  }
55
 
56
  /**
admin/dashboards/drivers/class-admin-dashboards-driver-generate.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
@@ -115,6 +114,32 @@ abstract class Yoast_GA_Dashboards_Driver_Generate {
115
  return ( $timestamp >= $this->start_date && $timestamp <= $this->end_date );
116
  }
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  /**
119
  * Should always be available
120
  *
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
114
  return ( $timestamp >= $this->start_date && $timestamp <= $this->end_date );
115
  }
116
 
117
+ /**
118
+ * Escape the data array before output
119
+ *
120
+ * @param array $data The data array that we need to check
121
+ *
122
+ * @return array|boolean The data array which is escaped
123
+ */
124
+ protected function escape_strings_array( $data ) {
125
+ if ( is_array( $data ) ) {
126
+ foreach ( $data as $key => $value ) {
127
+ if ( is_array( $value ) ) {
128
+ foreach ( $value as $subkey => $subvar ) {
129
+ $data[ $key ][ $subkey ] = esc_html( $subvar );
130
+ }
131
+ }
132
+ else {
133
+ $data[ $key ] = esc_html( (string) $value );
134
+ }
135
+ }
136
+
137
+ return $data;
138
+ }
139
+
140
+ return false;
141
+ }
142
+
143
  /**
144
  * Should always be available
145
  *
admin/dashboards/drivers/class-admin-dashboards-driver.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
admin/dashboards/drivers/class-admin-dashboards-graph-generate.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
@@ -95,10 +94,11 @@ class Yoast_GA_Dashboards_Graph_Generate extends Yoast_GA_Dashboards_Driver_Gene
95
  * Generate the data for the frontend based on the $google_data
96
  */
97
  private function generate() {
98
-
99
  $google_data = $this->get_google_data();
100
 
101
  foreach ( $google_data as $timestamp => $value ) {
 
 
102
  $this->add_data( $value );
103
  $this->add_x_mapping( $timestamp );
104
  $this->add_hover_mapping( $timestamp, $value );
@@ -147,7 +147,7 @@ class Yoast_GA_Dashboards_Graph_Generate extends Yoast_GA_Dashboards_Driver_Gene
147
  * @param integer $value
148
  */
149
  private function add_hover_mapping( $timestamp, $value ) {
150
- $this->mapping['hover'][] = date_i18n( 'l ' . $this->date_field . ' M', $timestamp ) . ': ' . number_format_i18n( $value, 0 );
151
  }
152
 
153
  }
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
94
  * Generate the data for the frontend based on the $google_data
95
  */
96
  private function generate() {
 
97
  $google_data = $this->get_google_data();
98
 
99
  foreach ( $google_data as $timestamp => $value ) {
100
+ $timestamp = esc_html( $timestamp );
101
+
102
  $this->add_data( $value );
103
  $this->add_x_mapping( $timestamp );
104
  $this->add_hover_mapping( $timestamp, $value );
147
  * @param integer $value
148
  */
149
  private function add_hover_mapping( $timestamp, $value ) {
150
+ $this->mapping['hover'][] = esc_html( date_i18n( 'l ' . $this->date_field . ' M', $timestamp ) . ': ' . number_format_i18n( $value, 0 ) );
151
  }
152
 
153
  }
admin/dashboards/drivers/class-admin-dashboards-graph.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
admin/dashboards/drivers/class-admin-dashboards-table-generate.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
@@ -32,7 +31,7 @@ class Yoast_GA_Dashboards_Table_Generate extends Yoast_GA_Dashboards_Driver_Gene
32
  */
33
  public function get_json() {
34
  $return = array(
35
- 'data' => $this->data,
36
  );
37
 
38
  return json_encode( $return );
@@ -69,7 +68,7 @@ class Yoast_GA_Dashboards_Table_Generate extends Yoast_GA_Dashboards_Driver_Gene
69
  */
70
  private function generate() {
71
  $google_data = $this->get_google_data();
72
- $this->data = array_values( $google_data );
73
  }
74
 
75
  }
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
31
  */
32
  public function get_json() {
33
  $return = array(
34
+ 'data' => $this->escape_strings_array( $this->data ),
35
  );
36
 
37
  return json_encode( $return );
68
  */
69
  private function generate() {
70
  $google_data = $this->get_google_data();
71
+ $this->data = is_array( $google_data ) ? array_values( $google_data ) : array();
72
  }
73
 
74
  }
admin/dashboards/drivers/class-admin-dashboards-table.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  /**
admin/dashboards/views/graph.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  ?>
@@ -18,12 +17,12 @@
18
 
19
  <?php
20
  if ( empty( $settings['hide_y_axis'] ) ) {
21
- echo "<div class='yoast-graph-yaxis'></div >";
22
  } ?>
23
  <div class="yoast-graph-holder"></div>
24
 
25
  <?php
26
  if ( empty( $settings['hide_x_axis'] ) ) {
27
- echo "<div class='yoast-graph-xaxis'></div >";
28
  } ?>
29
  </div>
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  ?>
17
 
18
  <?php
19
  if ( empty( $settings['hide_y_axis'] ) ) {
20
+ echo "<div class='yoast-graph-yaxis'></div>";
21
  } ?>
22
  <div class="yoast-graph-holder"></div>
23
 
24
  <?php
25
  if ( empty( $settings['hide_x_axis'] ) ) {
26
+ echo "<div class='yoast-graph-xaxis'></div>";
27
  } ?>
28
  </div>
admin/dashboards/views/table.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  ?>
@@ -13,15 +12,15 @@
13
  echo Yoast_GA_Admin_Form::show_help( 'graph-' . $dashboard, $settings['help'] );
14
  }
15
  ?>
16
- <span class='alignright period'><?php echo __( 'Last month', 'google-analytics-for-wordpress' ); ?></span>
17
  </h3>
18
 
19
  <div>
20
  <table class="widefat fixed stripe">
21
  <thead>
22
- <th><?php echo $settings['title']; ?></th>
23
  <?php foreach ( $settings['columns'] as $columns ) { ?>
24
- <th><?php echo $columns; ?></th>
25
  <?php } ?>
26
  </thead>
27
  </table>
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  ?>
12
  echo Yoast_GA_Admin_Form::show_help( 'graph-' . $dashboard, $settings['help'] );
13
  }
14
  ?>
15
+ <span class='alignright period'><?php _e( 'Last month', 'google-analytics-for-wordpress' ); ?></span>
16
  </h3>
17
 
18
  <div>
19
  <table class="widefat fixed stripe">
20
  <thead>
21
+ <th><?php echo esc_html( $settings['title'] ); ?></th>
22
  <?php foreach ( $settings['columns'] as $columns ) { ?>
23
+ <th><?php echo esc_html( $columns ); ?></th>
24
  <?php } ?>
25
  </thead>
26
  </table>
admin/pages/dashboard.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  global $yoast_ga_admin;
@@ -98,7 +97,7 @@ echo $yoast_ga_admin->content_head();
98
  else {
99
  ?>
100
  <div class="ga-form ga-form-input">
101
- <label class="ga-form ga-form-checkbox-label ga-form-label-left"><?php echo __( 'Select a dimension', 'google-analytics-for-wordpress' ); ?></label>
102
  </div>
103
  <select data-rel='toggle_dimensions' id="toggle_dimensions" style="width: 350px"></select>
104
 
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  global $yoast_ga_admin;
97
  else {
98
  ?>
99
  <div class="ga-form ga-form-input">
100
+ <label for="toggle_dimensions" class="ga-form ga-form-checkbox-label ga-form-label-left"><?php echo __( 'Select a dimension', 'google-analytics-for-wordpress' ); ?></label>
101
  </div>
102
  <select data-rel='toggle_dimensions' id="toggle_dimensions" style="width: 350px"></select>
103
 
admin/pages/extensions.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  global $yoast_ga_admin;
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  global $yoast_ga_admin;
admin/pages/settings-api.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package GoogleAnalytics\AdminSettingsFieldsView
4
+ */
5
+
6
+ global $yoast_ga_admin;
7
+
8
+ echo $yoast_ga_admin->content_head();
9
+ ?>
10
+ <h2 id="yoast_ga_title"><?php echo __( 'Google Analytics by Yoast: ', 'google-analytics-for-wordpress' ) . __( 'Settings', 'google-analytics-for-wordpress' ); ?></h2>
11
+
12
+ <?php
13
+ settings_errors( 'yoast_google_analytics' );
14
+ ?>
15
+
16
+ <h2 class="nav-tab-wrapper" id="ga-tabs">
17
+ <a class="nav-tab" id="yst_ga_general-tab" href="#top#yst_ga_general"><?php _e( 'General', 'google-analytics-for-wordpress' ); ?></a>
18
+ <a class="nav-tab" id="yst_ga_universal-tab" href="#top#yst_ga_universal"><?php _e( 'Universal', 'google-analytics-for-wordpress' ); ?></a>
19
+ <a class="nav-tab" id="yst_ga_advanced-tab" href="#top#yst_ga_advanced"><?php _e( 'Advanced', 'google-analytics-for-wordpress' ); ?></a>
20
+ <?php do_action( 'yst_ga_custom_tabs-tab' ); ?>
21
+ <a class="nav-tab" id="yst_ga_debugmode-tab" href="#top#yst_ga_debugmode"><?php _e( 'Debug mode', 'google-analytics-for-wordpress' ); ?></a>
22
+ </h2>
23
+
24
+ <form method="post" action="<?php echo admin_url( 'options.php' ); ?>" id="yoast-ga-form-settings">
25
+ <input type="hidden" name="yst_ga[ga_general][return_tab]" id="return_tab" value="general" />
26
+ <div class="tabwrapper">
27
+ <div id="yst_ga_general" class="gatab">
28
+ <div id="google_ua_code_field" class="ga-promote">
29
+ <?php
30
+ $ga_class = Yoast_Google_Analytics::get_instance();
31
+ $wp_block_google = $ga_class->check_google_access_from_wp();
32
+ $check_google_access = $ga_class->check_google_access();
33
+ $profiles = $ga_class->get_profiles();
34
+
35
+ if ( $wp_block_google === false || $check_google_access === false ) {
36
+ echo '<h3>' . __( 'Cannot connect to Google', 'google-analytics-for-wordpress' ) . '</h3>';
37
+ if ( $wp_block_google === false && $check_google_access === false ) {
38
+ echo '<p>' . __( 'Your server is blocking requests to Google, to fix this, add <code>*.googleapis.com</code> to the <code>WP_ACCESSIBLE_HOSTS</code> constant in your <em>wp-config.php</em> or ask your webhost to do this.', 'google-analytics-for-wordpress' ) . '</p>';
39
+ }
40
+ else {
41
+ echo '<p>' . __( 'Your firewall or webhost is blocking requests to Google, please ask your webhost company to fix this.', 'google-analytics-for-wordpress' ) . '</p>';
42
+ }
43
+ echo '<p>' . __( 'Until this is fixed, you can only use the manual authentication method and cannot use the dashboards feature.', 'google-analytics-for-wordpress' ) . '</p>';
44
+ }
45
+ else {
46
+ $auth_url = $ga_class->create_auth_url();
47
+ add_thickbox();
48
+
49
+ echo '<script>yst_thickbox_heading = "' . __( 'Paste your Google authentication code', 'google-analytics-for-wordpress' ) . '";</script>';
50
+ echo '<div id="oauth_code" class="ga-form ga-form-input">';
51
+ echo '<label class="ga-form ga-form-text-label ga-form-label-left" id="yoast-ga-form-label-text-ga-authwithgoogle">' . __( 'Paste your Google code here', 'google-analytics-for-wordpress' ) . ':';
52
+ echo '<input type="text" name="yst_ga[ga_general][google_auth_code]"></label>';
53
+ echo '<div class="ga-form ga-form-input"><input type="submit" name="ga-form-settings" value="' . __( 'Save authentication code', 'google-analytics-for-wordpress' ) . '" class="button button-primary ga-form-submit" id="yoast-ga-form-submit-settings" onclick="yst_closepopupwindow();"></div>';
54
+ echo '</div>';
55
+
56
+ echo '<table class="form-table"><tbody><tr><th scope="row">' . __( 'Authenticate with Google', 'google-analytics-for-wordpress' ) . '</th>';
57
+ if ( empty( $profiles ) ) {
58
+ echo '<td><a id="yst_ga_authenticate" class="button" onclick="yst_popupwindow(\'' . $auth_url . '\',500,500);">' . __( 'Click here to authenticate with your Google account', 'google-analytics-for-wordpress' ) . '</a></td>';
59
+ }
60
+ else {
61
+ echo '<td><a id="yst_ga_authenticate" class="button" onclick="yst_popupwindow(\'' . $auth_url . '\',500,500);">' . __( 'Re-authenticate with your Google account', 'google-analytics-for-wordpress' ) . '</a></td>';
62
+ }
63
+ echo'</tr>';
64
+ $current_profile = $yoast_ga_admin->get_current_profile( true );
65
+ if ( ! empty ( $current_profile ) ) {
66
+ echo '<tr><th scope="row">' . __( 'Current UA code', 'google-analytics-for-wordpress' ) . ':</th><td>' . $yoast_ga_admin->get_current_profile( true ) . '</td></tr>';
67
+ }
68
+ echo '</table>';
69
+ }
70
+
71
+
72
+ settings_fields( 'yst_ga_settings_api_ua_code' );
73
+ do_settings_sections( 'yst_ga_settings_api_ua_code' );
74
+ ?>
75
+ <p id="manual_ua_code_warning"><strong style="color: red;"><?php _e( 'Warning: If you use a manual UA code, you won\'t be able to use the dashboards.', 'google-analytics-for-wordpress' ); ?></strong></p>
76
+ </div>
77
+ <?php
78
+ settings_fields( 'yst_ga_settings_api_general' );
79
+ do_settings_sections( 'yst_ga_settings_api_general' );
80
+ ?>
81
+ </div>
82
+ <div id="yst_ga_universal" class="gatab">
83
+ <?php
84
+ settings_fields( 'yst_ga_settings_api_universal' );
85
+ do_settings_sections( 'yst_ga_settings_api_universal' );
86
+ ?>
87
+ </div>
88
+ <div id="yst_ga_advanced" class="gatab">
89
+ <?php
90
+ settings_fields( 'yst_ga_settings_api_advanced' );
91
+ do_settings_sections( 'yst_ga_settings_api_advanced' );
92
+ ?>
93
+ </div>
94
+ <?php do_action( 'yst_ga_custom_tabs-content' ); ?>
95
+ <div id="yst_ga_debugmode" class="gatab">
96
+ <?php
97
+ echo '<div id="ga-promote">';
98
+ echo '<p class="ga-topdescription">' . __( 'If you want to confirm that tracking on your blog is working as it should, enable this option and check the console of your browser. Be absolutely sure to disable debugging afterwards, as it is slower than normal tracking.', 'google-analytics-for-wordpress' ) . '</p>';
99
+ echo '<p class="ga-topdescription">' . __( '<strong>Note</strong> the debugging is only loaded for administrators.', 'google-analytics-for-wordpress' ) . '</p>';
100
+ echo '</div>';
101
+
102
+ settings_fields( 'yst_ga_settings_api_debug' );
103
+ do_settings_sections( 'yst_ga_settings_api_debug' );
104
+ ?>
105
+ </div>
106
+ <?php
107
+ submit_button();
108
+ ?>
109
+ </div>
110
+ </form>
111
+
112
+ <?php
113
+ echo $yoast_ga_admin->content_footer();
114
+ ?>
115
+ <script type="text/javascript">
116
+ jQuery(document).ready(
117
+ function () {
118
+ jQuery('.chosen').chosen({
119
+ placeholder_text_multiple: '<?php echo __( 'Select the users to ignore', 'google-analytics-for-wordpress' ); ?>'
120
+ });
121
+ }
122
+ );
123
+ </script>
admin/pages/settings.php DELETED
@@ -1,166 +0,0 @@
1
- <?php
2
- /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
- */
6
-
7
- global $yoast_ga_admin;
8
-
9
- echo $yoast_ga_admin->content_head();
10
- ?>
11
- <h2 id="yoast_ga_title"><?php echo __( 'Google Analytics by Yoast: ', 'google-analytics-for-wordpress' ) . __( 'Settings', 'google-analytics-for-wordpress' ); ?></h2>
12
-
13
- <?php
14
- settings_errors( 'yoast_google_analytics' );
15
- ?>
16
-
17
- <h2 class="nav-tab-wrapper" id="ga-tabs">
18
- <a class="nav-tab" id="general-tab" href="#top#general"><?php _e( 'General', 'google-analytics-for-wordpress' ); ?></a>
19
- <a class="nav-tab" id="universal-tab" href="#top#universal"><?php _e( 'Universal', 'google-analytics-for-wordpress' ); ?></a>
20
- <a class="nav-tab" id="advanced-tab" href="#top#advanced"><?php _e( 'Advanced', 'google-analytics-for-wordpress' ); ?></a>
21
- <a class="nav-tab" id="customdimensions-tab" href="#top#customdimensions"><?php _e( 'Custom Dimensions', 'google-analytics-for-wordpress' ); ?></a>
22
- <?php do_action( 'yst_ga_custom_tabs-tab' ); ?>
23
- <a class="nav-tab" id="debugmode-tab" href="#top#debugmode"><?php _e( 'Debug mode', 'google-analytics-for-wordpress' ); ?></a>
24
- </h2>
25
-
26
- <?php
27
- echo Yoast_GA_Admin_Form::create_form( 'settings' );
28
- ?>
29
- <input type="hidden" name="return_tab" id="return_tab" value="general" />
30
- <div class="tabwrapper">
31
- <div id="general" class="gatab">
32
- <?php
33
- echo '<h2>' . __( 'General settings', 'google-analytics-for-wordpress' ) . '</h2>';
34
-
35
- echo '<div id="ga-promote">';
36
-
37
- $ga_class = Yoast_Google_Analytics::get_instance();
38
- $wp_block_google = $ga_class->check_google_access_from_wp();
39
- $check_google_access = $ga_class->check_google_access();
40
-
41
- if ( $wp_block_google && $check_google_access ) {
42
-
43
- $profiles = Yoast_GA_Admin_Form::parse_optgroups( $yoast_ga_admin->get_profiles() );
44
-
45
- $auth_url = Yoast_Google_Analytics::get_instance()->create_auth_url();
46
- add_thickbox();
47
- echo '<script>yst_thickbox_heading = "' . __( 'Paste your Google authentication code', 'google-analytics-for-wordpress' ) . '";</script>';
48
-
49
- echo "<div id='google_ua_code_field'>";
50
- if ( count( $profiles ) == 0 ) {
51
- echo '<div class="ga-form ga-form-input">';
52
- echo '<label class="ga-form ga-form-text-label ga-form-label-left" id="yoast-ga-form-label-text-ga-authwithgoogle">' . __( 'Google profile', 'google-analytics-for-wordpress' ) . ':</label>';
53
- echo '<a id="yst_ga_authenticate" class="button" onclick="yst_popupwindow(\'' . $auth_url . '\',500,500);">' . __( 'Authenticate with your Google account', 'google-analytics-for-wordpress' ) . '</a>';
54
- echo '</div>';
55
- echo '<div class="ga-form ga-form-input">';
56
- echo '<label class="ga-form ga-form-text-label ga-form-label-left" id="yoast-ga-form-label-text-ga-authwithgoogle">' . __( 'Current UA-profile', 'google-analytics-for-wordpress' ) . '</label>';
57
- echo esc_html( $yoast_ga_admin->get_tracking_code() );
58
- echo '</div>';
59
- }
60
- else {
61
- echo Yoast_GA_Admin_Form::select( __( 'Analytics profile', 'google-analytics-for-wordpress' ), 'analytics_profile', $profiles, null, false, __( 'Select a profile', 'google-analytics-for-wordpress' ) );
62
-
63
- echo '<div class="ga-form ga-form-input">';
64
- echo '<label class="ga-form ga-form-text-label ga-form-label-left" id="yoast-ga-form-label-text-ga-authwithgoogle">&nbsp;</label>';
65
- echo '<a id="yst_ga_authenticate" class="button" onclick="yst_popupwindow(\'' . $auth_url . '\',500,500);">' . __( 'Re-authenticate with your Google account', 'google-analytics-for-wordpress' ) . '</a>';
66
- echo '</div>';
67
- }
68
- echo '</div>';
69
-
70
- echo '<div id="oauth_code" class="ga-form ga-form-input">';
71
- echo '<label class="ga-form ga-form-text-label ga-form-label-left" id="yoast-ga-form-label-text-ga-authwithgoogle">' . __( 'Paste your Google code here', 'google-analytics-for-wordpress' ) . ':</label>';
72
- echo Yoast_GA_Admin_Form::input( 'text', null, 'google_auth_code', null, null );
73
-
74
- echo '<label class="ga-form ga-form-text-label ga-form-label-left" id="yoast-ga-form-label-text-ga-authwithgoogle-submit">&nbsp;</label>';
75
- echo '<div class="ga-form ga-form-input"><input type="submit" name="ga-form-settings" value="' . __( 'Save authentication code', 'google-analytics-for-wordpress' ) . '" class="button button-primary ga-form-submit" id="yoast-ga-form-submit-settings" onclick="yst_closepopupwindow();"></div>';
76
- echo '</div>';
77
- }
78
- else {
79
- echo '<h3>' . __( 'Cannot connect to Google', 'google-analytics-for-wordpress' ) . '</h3>';
80
- if ( $wp_block_google == false && $check_google_access == false ) {
81
- echo '<p>' . __( 'Your server is blocking requests to Google, to fix this, add <code>*.googleapis.com</code> to the <code>WP_ACCESSIBLE_HOSTS</code> constant in your <em>wp-config.php</em> or ask your webhost to do this.', 'google-analytics-for-wordpress' ) . '</p>';
82
- }
83
- else {
84
- echo '<p>' . __( 'Your firewall or webhost is blocking requests to Google, please ask your webhost company to fix this.', 'google-analytics-for-wordpress' ) . '</p>';
85
- }
86
- echo '<p>' . __( 'Until this is fixed, you can only use the manual authentication method and cannot use the dashboards feature.', 'google-analytics-for-wordpress' ) . '</p>';
87
- }
88
-
89
- echo '<label class="ga-form ga-form-checkbox-label ga-form-label-left">';
90
- echo Yoast_GA_Admin_Form::input( 'checkbox', null, 'manual_ua_code', __( 'Manually enter your UA code', 'google-analytics-for-wordpress' ) );
91
- echo '</label>';
92
- echo '<div id="enter_ua">';
93
- echo Yoast_GA_Admin_Form::input( 'text', null, 'manual_ua_code_field' );
94
- echo '<p><strong>' . __( 'Warning: If you use a manual UA code, you won\'t be able to use the dashboards.', 'google-analytics-for-wordpress' ) . '</strong></p>';
95
- echo '</div>';
96
- echo '<div class="clear"></div></div>';
97
- ?>
98
- <div class="clear"><br /></div>
99
- <?php
100
- echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Track outbound click and downloads', 'google-analytics-for-wordpress' ), 'track_outbound', null, __( 'Clicks and downloads will be tracked as events, you can find these under Content &#xBB; Event Tracking in your Google Analytics reports.', 'google-analytics-for-wordpress' ) );
101
- echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Allow tracking of anonymous data', 'google-analytics-for-wordpress' ), 'anonymous_data', null, __( 'By allowing us to track anonymous data we can better help you, because we know with which WordPress configurations, themes and plugins we should test. No personal data will be submitted.', 'google-analytics-for-wordpress' ) );
102
- echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Anonymize IPs', 'google-analytics-for-wordpress' ), 'anonymize_ips', null, sprintf( __( 'This adds %1$s, telling Google Analytics to anonymize the information sent by the tracker objects by removing the last octet of the IP address prior to its storage.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApi_gat?csw=1#_gat._anonymizeIp" target="_blank"><code>_anonymizeIp</code></a>' ) );
103
- echo Yoast_GA_Admin_Form::select( __( 'Ignore users', 'google-analytics-for-wordpress' ), 'ignore_users', $yoast_ga_admin->get_userroles(), __( 'Users of the role you select will be ignored, so if you select Editor, all Editors will be ignored.', 'google-analytics-for-wordpress' ), true );
104
- echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Disable analytics dashboard', 'google-analytics-for-wordpress' ), 'dashboards_disabled', null, __( 'This will completely disable the dashboard and stop the plugin from fetching the latest analytics data.', 'google-analytics-for-wordpress' ) );
105
- ?>
106
- </div>
107
- <div id="universal" class="gatab">
108
- <?php
109
- echo '<h2>' . __( 'Universal settings', 'google-analytics-for-wordpress' ) . '</h2>';
110
- echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Enable Universal tracking', 'google-analytics-for-wordpress' ), 'enable_universal', null, sprintf( __( 'First enable Universal tracking in your Google Analytics account. Please read %1$sthis guide%2$s to learn how to do that.', 'google-analytics-for-wordpress' ), '<a href="http://kb.yoast.com/article/125-universal-analytics#utm_medium=kb-link&utm_source=gawp-config&utm_campaign=wpgaplugin" target="_blank">', '</a>' ) );
111
- echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Enable Demographics and Interest Reports', 'google-analytics-for-wordpress' ), 'demographics', null, sprintf( __( 'You have to enable the Demographics in Google Analytics before you can see the tracking data. We have a knowledge base article in our %1$sknowledge base%2$s about this feature.', 'google-analytics-for-wordpress' ), '<a href="http://kb.yoast.com/article/154-enable-demographics-and-interests-report-in-google-analytics/#utm_medium=kb-link&amp;utm_source=gawp-config&amp;utm_campaign=wpgaplugin" target="_blank">', '</a>' ) );
112
- echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Enhanced Link Attribution', 'google-analytics-for-wordpress' ), 'enhanced_link_attribution', null, sprintf( __( 'Add %1$sEnhanced Link Attribution%2$s to your tracking code.', 'google-analytics-for-wordpress' ), '<a href="https://support.google.com/analytics/answer/2558867" target="_blank">', ' </a>' ) );
113
- ?>
114
- </div>
115
- <div id="advanced" class="gatab">
116
- <?php
117
- echo '<h2>' . __( 'Advanced settings', 'google-analytics-for-wordpress' ) . '</h2>';
118
- echo Yoast_GA_Admin_Form::select( __( 'Track downloads as', 'google-analytics-for-wordpress' ), 'track_download_as', $yoast_ga_admin->track_download_types(), __( 'Not recommended, as this would skew your statistics, but it does make it possible to track downloads as goals.', 'google-analytics-for-wordpress' ) );
119
- echo Yoast_GA_Admin_Form::input( 'text', __( 'Extensions of files to track as downloads', 'google-analytics-for-wordpress' ), 'extensions_of_files', null, 'Please separate extensions using commas' );
120
- echo Yoast_GA_Admin_Form::select( __( 'Track full URL of outbound clicks or just the domain', 'google-analytics-for-wordpress' ), 'track_full_url', $yoast_ga_admin->get_track_full_url() );
121
- echo Yoast_GA_Admin_Form::input( 'text', __( 'Subdomain tracking', 'google-analytics-for-wordpress' ), 'subdomain_tracking', null, sprintf( __( 'This allows you to set the domain that\'s set by %1$s for tracking subdomains.<br/>If empty, this will not be set.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._setDomainName" target="_blank"><code>_setDomainName</code></a>' ) );
122
-
123
- echo Yoast_GA_Admin_Form::input( 'text', __( 'Set path for internal links to track as outbound links', 'google-analytics-for-wordpress' ), 'track_internal_as_outbound', null, sprintf( __( 'If you want to track all internal links that begin with %1$s, enter %1$s in the box above. If you have multiple prefixes you can separate them with comma\'s: %2$s', 'google-analytics-for-wordpress' ), '<code>/out/</code>', '<code>/out/,/recommends/</code>' ) );
124
- echo Yoast_GA_Admin_Form::input( 'text', __( 'Label for those links', 'google-analytics-for-wordpress' ), 'track_internal_as_label', null, 'The label to use for these links, this will be added to where the click came from, so if the label is "aff", the label for a click from the content of an article becomes "outbound-article-aff".' );
125
-
126
- echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Tag links in RSS feed with campaign variables', 'google-analytics-for-wordpress' ), 'tag_links_in_rss', null, __( 'Do not use this feature if you use FeedBurner, as FeedBurner can do this automatically and better than this plugin can. Check <a href="https://support.google.com/feedburner/answer/165769?hl=en&amp;ref_topic=13075" target="_blank">this help page</a> for info on how to enable this feature in FeedBurner.', 'google-analytics-for-wordpress' ) );
127
- echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Allow anchor', 'google-analytics-for-wordpress' ), 'allow_anchor', null, sprintf( __( 'This adds a %1$s call to your tracking code, and makes RSS link tagging use a %2$s as well.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiCampaignTracking?csw=1#_gat.GA_Tracker_._setAllowAnchor" target="_blank"><code>_setAllowAnchor</code></a>', '<code>#</code>' ) );
128
- echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Add <code>_setAllowLinker</code>', 'google-analytics-for-wordpress' ), 'add_allow_linker', null, sprintf( __( 'This adds a %1$s call to your tracking code, allowing you to use %2$s and related functions.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory?csw=1#_gat.GA_Tracker_._setAllowLinker" target="_blank"><code>_setAllowLinker</code></a>', ' <code>_link</code>' ) );
129
- echo Yoast_GA_Admin_Form::textarea( __( 'Custom code', 'google-analytics-for-wordpress' ), 'custom_code', sprintf( __( 'Not for the average user: this allows you to add a line of code, to be added before the %1$s call.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._trackPageview" target="_blank"><code>_trackPageview</code></a>' ) );
130
-
131
- do_action( 'yst_ga_advanced-tab' );
132
- ?>
133
- </div>
134
- <div id="customdimensions" class="gatab">
135
- <?php
136
- echo '<h2>' . __( 'Custom dimensions', 'google-analytics-for-wordpress' ) . '</h2>';
137
- do_action( 'yst_ga_custom_dimensions_tab-content' );
138
- ?>
139
- </div>
140
- <?php do_action( 'yst_ga_custom_tabs-content' ); ?>
141
- <div id="debugmode" class="gatab">
142
- <?php
143
- echo '<h2>' . __( 'Debug', 'google-analytics-for-wordpress' ) . '</h2>';
144
-
145
- echo '<div id="ga-promote">';
146
- echo '<p class="ga-topdescription">' . __( 'If you want to confirm that tracking on your blog is working as it should, enable this option and check the console of your browser. Be absolutely sure to disable debugging afterwards, as it is slower than normal tracking.', 'google-analytics-for-wordpress' ) . '</p>';
147
- echo '<p class="ga-topdescription">' . __( '<strong>Note</strong> the debugging is only loaded for administrators.', 'google-analytics-for-wordpress' ) . '</p>';
148
- echo '</div>';
149
- echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Enable debug mode', 'google-analytics-for-wordpress' ), 'debug_mode' );
150
- ?>
151
- </div>
152
- </div>
153
- <?php
154
- echo Yoast_GA_Admin_Form::end_form( __( 'Save changes', 'google-analytics-for-wordpress' ), 'settings', 'yst_closepopupwindow();' );
155
- echo $yoast_ga_admin->content_footer();
156
- ?>
157
- <script type="text/javascript">
158
- jQuery(document).ready(
159
- function () {
160
- jQuery('#yoast-ga-form-select-settings-analytics_profile').chosen({
161
- group_search: true
162
- });
163
- jQuery('#yoast-ga-form-select-settings-ignore_users').chosen({placeholder_text_multiple: '<?php echo __( 'Select the users to ignore', 'google-analytics-for-wordpress' ); ?>'});
164
- }
165
- );
166
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/content-footer.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Admin
5
  */
6
 
7
  ?>
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Admin
 
4
  */
5
 
6
  ?>
admin/views/custom-dimensions-upsell.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package GoogleAnalytics\AdminUpSellView
4
+ */
5
+
6
+ ?>
7
+ <?php if ( $add_tab_div === true ) : ?>
8
+ <div id="yst_ga_custom_dimensions" class="gatab">
9
+ <?php endif; ?>
10
+ <div class="ga-promote">
11
+ <p>
12
+ <?php
13
+ printf( __( 'If you want to track custom dimensions like page views per author or post type, you should upgrade to the %1$spremium version of Google Analytics by Yoast%2$s.', 'google-analytics-for-wordpress' ), '<a href="https://yoast.com/wordpress/plugins/google-analytics/#utm_medium=text-link&utm_source=gawp-config&utm_campaign=wpgaplugin&utm_content=custom_dimensions_tab">', '</a>' );
14
+ echo ' ';
15
+ _e( 'This will also give you email access to the support team at Yoast, who will provide support on the plugin 24/7.', 'google-analytics-for-wordpress' );
16
+ ?>
17
+ </p>
18
+ </div>
19
+ <?php if ( $add_tab_div === true ) : ?>
20
+ </div>
21
+ <?php endif; ?>
assets/css/yoast_ga_styles.css CHANGED
@@ -118,6 +118,10 @@ p.ga-topdescription {
118
  width: 325px;
119
  }
120
 
 
 
 
 
121
  #yoast-ga-form-settings #oauth_code {
122
  padding: 20px;
123
  }
118
  width: 325px;
119
  }
120
 
121
+ .chosen-search input[type="text"] {
122
+ width: 100% !important;
123
+ }
124
+
125
  #yoast-ga-form-settings #oauth_code {
126
  padding: 20px;
127
  }
assets/css/yoast_ga_styles.min.css CHANGED
@@ -1 +1 @@
1
- h2#yoast_ga_title{padding:9px 15px 4px 0;font-size:23px;font-weight:400;line-height:29px}.nav-tab-wrapper{margin-bottom:20px}.gatab{display:none}.gatab.active{display:block;padding:.5em .9em;border:1px solid #ddd;border-radius:0 3px 3px;background-color:#fff}.tabwrapper .gatab{padding:0;border:none;background:0 0}.tabwrapper .gatab h2{padding:9px 15px 4px 0;font-size:23px;font-weight:400}.ga-form-submit{margin-top:20px}.ga-form-label-left{float:left;width:250px;margin:0 0 0 5px;font-size:14px;font-weight:700;cursor:default}.ga-form-input{margin-top:10px}#yoast-ga-wrapper{display:table;width:auto;max-width:1150px}.yoast-ga-content{display:table-cell;min-width:850px;height:500px;margin:0;padding:0;vertical-align:top}.yoast-ga-banners{display:table-cell;width:261px;height:500px;margin:0;padding:20px;vertical-align:top}.ga-form-input{display:table;margin-bottom:20px}.ga-form-table{display:table-cell}.ga-form-description{display:block;float:right;max-width:325px;color:#999}p.ga-topdescription{max-width:600px}#ga-promote,.ga-promote{max-width:600px;padding-left:10px;border:1px solid #ccc;background-color:#fff}.ga-promote{margin-bottom:10px}#ga-promote p,.ga-promote p{margin:0;padding:1em 1em 1em 0}#yoast-ga-form-settings input[type=text]{width:325px}#yoast-ga-form-settings #oauth_code{padding:20px}#yoast-ga-form-settings #oauth_code div{margin:0 0 0 5px}#yoast-ga-form-settings #oauth_code input[type=text]{width:275px}.ga-form .chosen-search input[type=text]{width:100%!important}.yoast-ga-content .chosen-container{width:325px!important}#enter_ua{display:none;margin-top:10px;padding-top:10px}#yoast-ga-form-text-settings-ga_general-manual_ua_code_field{margin-top:-30px}select.ga-multiple{width:300px;height:150px!important}.wpseotab .extension{float:left;box-sizing:border-box;width:350px;height:230px;margin:10px 20px 10px 0;border:1px solid #ccc}.wpseotab .extension p{margin:0;padding:10px}.wpseotab .extension h3{box-sizing:border-box;height:110px;margin:0;padding:20px 10px 0 120px;border-bottom:1px solid #ccc;background:left 10px/130px 100px no-repeat #fff}.wpseotab .extension button.installed{border-color:#00a000;background-color:#00a000;cursor:default}.wpseotab .extension .button-primary.activate-link{border-color:#f06000;background-color:#f18500}.extension a{text-decoration:none}.ecommerce h3{background-image:url(../img/eComm_130x100.png)!important}.ga_premium h3{background-image:url(../img/ga-premium-banner.png)!important}#ga-debug-info h3{height:30px;margin-top:10px;padding-left:16px;font-size:14px}.yoast_help{margin:2px 5px 0}#enter_ua div{display:inline-block;margin:0}
1
+ h2#yoast_ga_title{padding:9px 15px 4px 0;font-size:23px;font-weight:400;line-height:29px}.nav-tab-wrapper{margin-bottom:20px}.gatab{display:none}.gatab.active{display:block;padding:.5em .9em;border:1px solid #ddd;border-radius:0 3px 3px;background-color:#fff}.tabwrapper .gatab{padding:0;border:none;background:0 0}.tabwrapper .gatab h2{padding:9px 15px 4px 0;font-size:23px;font-weight:400}.ga-form-submit{margin-top:20px}.ga-form-label-left{float:left;width:250px;margin:0 0 0 5px;font-size:14px;font-weight:700;cursor:default}.ga-form-input{margin-top:10px}#yoast-ga-wrapper{display:table;width:auto;max-width:1150px}.yoast-ga-content{display:table-cell;min-width:850px;height:500px;margin:0;padding:0;vertical-align:top}.yoast-ga-banners{display:table-cell;width:261px;height:500px;margin:0;padding:20px;vertical-align:top}.ga-form-input{display:table;margin-bottom:20px}.ga-form-table{display:table-cell}.ga-form-description{display:block;float:right;max-width:325px;color:#999}p.ga-topdescription{max-width:600px}#ga-promote,.ga-promote{max-width:600px;padding-left:10px;border:1px solid #ccc;background-color:#fff}.ga-promote{margin-bottom:10px}#ga-promote p,.ga-promote p{margin:0;padding:1em 1em 1em 0}#yoast-ga-form-settings input[type=text]{width:325px}.chosen-search input[type=text]{width:100%!important}#yoast-ga-form-settings #oauth_code{padding:20px}#yoast-ga-form-settings #oauth_code div{margin:0 0 0 5px}#yoast-ga-form-settings #oauth_code input[type=text]{width:275px}.ga-form .chosen-search input[type=text]{width:100%!important}.yoast-ga-content .chosen-container{width:325px!important}#enter_ua{display:none;margin-top:10px;padding-top:10px}#yoast-ga-form-text-settings-ga_general-manual_ua_code_field{margin-top:-30px}select.ga-multiple{width:300px;height:150px!important}.wpseotab .extension{float:left;box-sizing:border-box;width:350px;height:230px;margin:10px 20px 10px 0;border:1px solid #ccc}.wpseotab .extension p{margin:0;padding:10px}.wpseotab .extension h3{box-sizing:border-box;height:110px;margin:0;padding:20px 10px 0 120px;border-bottom:1px solid #ccc;background:left 10px/130px 100px no-repeat #fff}.wpseotab .extension button.installed{border-color:#00a000;background-color:#00a000;cursor:default}.wpseotab .extension .button-primary.activate-link{border-color:#f06000;background-color:#f18500}.extension a{text-decoration:none}.ecommerce h3{background-image:url(../img/eComm_130x100.png)!important}.ga_premium h3{background-image:url(../img/ga-premium-banner.png)!important}#ga-debug-info h3{height:30px;margin-top:10px;padding-left:16px;font-size:14px}.yoast_help{margin:2px 5px 0}#enter_ua div{display:inline-block;margin:0}
assets/js/yoast_ga_admin.js CHANGED
@@ -93,4 +93,25 @@ jQuery(document).ready(function() {
93
  name: 'blue'
94
  }
95
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  });
93
  name: 'blue'
94
  }
95
  });
96
+
97
+ jQuery('#ga_form_manual_ua_code').click(function() {
98
+ handle_settings_form();
99
+ });
100
+
101
+ handle_settings_form();
102
+
103
+ function handle_settings_form() {
104
+ if ( jQuery('#ga_form_manual_ua_code').attr("checked") ) {
105
+ jQuery('#ga_form_manual_ua_code_field').closest('tr').show(); // Show parent tr
106
+ jQuery('#yst_ga_authenticate').closest('tr').hide(); // Show parent tr
107
+ jQuery('#manual_ua_code_warning').show();
108
+ jQuery('#ga_form_analytics_profile').prop('disabled', true).trigger("chosen:updated");
109
+ }
110
+ else{
111
+ jQuery('#ga_form_manual_ua_code_field').closest('tr').hide(); // Hide parent tr
112
+ jQuery('#yst_ga_authenticate').closest('tr').show(); // Hide parent tr
113
+ jQuery('#manual_ua_code_warning').hide();
114
+ jQuery('#ga_form_analytics_profile').prop('disabled', false).trigger("chosen:updated");
115
+ }
116
+ }
117
  });
assets/js/yoast_ga_admin.min.js CHANGED
@@ -1 +1 @@
1
- function yst_popupwindow(e,t,n){"use strict";var r=screen.width/2-t/2;var i=screen.height/8;authwindow=window.open(e,"yst_ga_auth_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+t+", height="+n+", top="+i+", left="+r)}function yst_closepopupwindow(){authwindow.close()}function yst_ga_switch_manual(){if(jQuery("#yoast-ga-form-checkbox-settings-manual_ua_code").is(":checked")){var e=true;jQuery("#enter_ua").show();jQuery("#oauth_code").hide()}else{var e=false;jQuery("#enter_ua").hide();jQuery("#yoast-ga-form-text-settings-manual_ua_code_field").attr("value","");jQuery("#oauth_code").hide()}jQuery("#yoast-ga-form-select-settings-analytics_profile").prop("disabled",e).trigger("chosen:updated");jQuery("#yst_ga_authenticate").attr("disabled",e)}var authwindow;jQuery(document).ready(function(){"use strict";jQuery("#ga-tabs").find("a").click(function(){jQuery("#ga-tabs").find("a").removeClass("nav-tab-active");jQuery(".gatab").removeClass("active");var e=jQuery(this).attr("id").replace("-tab","");jQuery("#"+e).addClass("active");jQuery(this).addClass("nav-tab-active");jQuery("#return_tab").val(e)});jQuery("a.activate-link").click(function(){jQuery("#extensions.wpseotab").removeClass("active");jQuery("#extensions-tab").removeClass("nav-tab-active");jQuery("#licenses.wpseotab").addClass("active");jQuery("#licenses-tab").addClass("nav-tab-active")});var e=window.location.hash.replace("#top#","");if(e===""||e==="#_=_"){e=jQuery(".gatab").attr("id")}jQuery("#"+e).addClass("active");jQuery("#"+e+"-tab").addClass("nav-tab-active");jQuery("#yoast-ga-form-checkbox-settings-manual_ua_code").click(yst_ga_switch_manual);yst_ga_switch_manual();jQuery("#oauth_code").hide();jQuery("#yst_ga_authenticate").click(function(){jQuery("#oauth_code").show();Focusable.setFocus(jQuery("#oauth_code"),{hideOnESC:true});jQuery("#oauth_code input").focus()});jQuery(".nav-tab-active").click();jQuery(".yoast_help").qtip({position:{corner:{target:"topMiddle",tooltip:"bottomLeft"}},show:{when:{event:"mouseover"}},hide:{fixed:true,when:{event:"mouseout"}},style:{tip:"bottomLeft",name:"blue"}})})
1
+ function yst_popupwindow(a,b,c){"use strict";var d=screen.width/2-b/2,e=screen.height/8;authwindow=window.open(a,"yst_ga_auth_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+b+", height="+c+", top="+e+", left="+d)}function yst_closepopupwindow(){authwindow.close()}function yst_ga_switch_manual(){if(jQuery("#yoast-ga-form-checkbox-settings-manual_ua_code").is(":checked")){var a=!0;jQuery("#enter_ua").show(),jQuery("#oauth_code").hide()}else{var a=!1;jQuery("#enter_ua").hide(),jQuery("#yoast-ga-form-text-settings-manual_ua_code_field").attr("value",""),jQuery("#oauth_code").hide()}jQuery("#yoast-ga-form-select-settings-analytics_profile").prop("disabled",a).trigger("chosen:updated"),jQuery("#yst_ga_authenticate").attr("disabled",a)}var authwindow;jQuery(document).ready(function(){"use strict";function a(){jQuery("#ga_form_manual_ua_code").attr("checked")?(jQuery("#ga_form_manual_ua_code_field").closest("tr").show(),jQuery("#yst_ga_authenticate").closest("tr").hide(),jQuery("#manual_ua_code_warning").show(),jQuery("#ga_form_analytics_profile").prop("disabled",!0).trigger("chosen:updated")):(jQuery("#ga_form_manual_ua_code_field").closest("tr").hide(),jQuery("#yst_ga_authenticate").closest("tr").show(),jQuery("#manual_ua_code_warning").hide(),jQuery("#ga_form_analytics_profile").prop("disabled",!1).trigger("chosen:updated"))}jQuery("#ga-tabs").find("a").click(function(){jQuery("#ga-tabs").find("a").removeClass("nav-tab-active"),jQuery(".gatab").removeClass("active");var a=jQuery(this).attr("id").replace("-tab","");jQuery("#"+a).addClass("active"),jQuery(this).addClass("nav-tab-active"),jQuery("#return_tab").val(a)}),jQuery("a.activate-link").click(function(){jQuery("#extensions.wpseotab").removeClass("active"),jQuery("#extensions-tab").removeClass("nav-tab-active"),jQuery("#licenses.wpseotab").addClass("active"),jQuery("#licenses-tab").addClass("nav-tab-active")});var b=window.location.hash.replace("#top#","");(""===b||"#_=_"===b)&&(b=jQuery(".gatab").attr("id")),jQuery("#"+b).addClass("active"),jQuery("#"+b+"-tab").addClass("nav-tab-active"),jQuery("#yoast-ga-form-checkbox-settings-manual_ua_code").click(yst_ga_switch_manual),yst_ga_switch_manual(),jQuery("#oauth_code").hide(),jQuery("#yst_ga_authenticate").click(function(){jQuery("#oauth_code").show(),Focusable.setFocus(jQuery("#oauth_code"),{hideOnESC:!0}),jQuery("#oauth_code input").focus()}),jQuery(".nav-tab-active").click(),jQuery(".yoast_help").qtip({position:{corner:{target:"topMiddle",tooltip:"bottomLeft"}},show:{when:{event:"mouseover"}},hide:{fixed:!0,when:{event:"mouseout"}},style:{tip:"bottomLeft",name:"blue"}}),jQuery("#ga_form_manual_ua_code").click(function(){a()}),a()});
frontend/abstract-class-tracking.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Frontend
5
  */
6
 
7
  /**
@@ -13,7 +12,7 @@ abstract class Yoast_GA_Tracking {
13
  * Regular expression for Ga.js and universal tracking to detect links
14
  * @var string
15
  */
16
- protected $link_regex = '/<a\s+([^>]*?)href=[\'\"](.*?):(\/\/)?([^\'\"]+?)[\'\"]\s?(.*?)>(.*?)<\/a>/i';
17
 
18
  /**
19
  * Storage for the currently set options
@@ -337,9 +336,9 @@ abstract class Yoast_GA_Tracking {
337
  * @return array
338
  */
339
  protected function get_target( $category, $matches ) {
340
- $protocol = $matches[2];
341
- $original_url = $matches[4];
342
- $domain = $this->yoast_ga_get_domain( $matches[4] );
343
  $origin = $this->yoast_ga_get_domain( $_SERVER['HTTP_HOST'] );
344
  $extension = substr( strrchr( $original_url, '.' ), 1 );
345
  $type = $this->get_target_type( $extension, $domain, $origin, $matches );
@@ -353,8 +352,8 @@ abstract class Yoast_GA_Tracking {
353
  'origin_domain' => $origin['domain'],
354
  'origin_host' => $origin['host'],
355
  'extension' => $extension,
356
- 'link_attributes' => rtrim( $matches[1] . ' ' . $matches[5] ),
357
- 'link_text' => $matches[6],
358
  'original_url' => $original_url,
359
  );
360
  }
@@ -372,8 +371,8 @@ abstract class Yoast_GA_Tracking {
372
  protected function get_target_type( $extension, $domain, $origin, $matches ) {
373
  $download_extensions = explode( ',', str_replace( '.', '', $this->options['extensions_of_files'] ) );
374
  $download_extensions = array_map( 'trim', $download_extensions );
375
- $protocol = $matches[2];
376
- $original_url = $matches[4];
377
 
378
  // Break out immediately if the link is not an http or https link.
379
  $type = null;
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Frontend
 
4
  */
5
 
6
  /**
12
  * Regular expression for Ga.js and universal tracking to detect links
13
  * @var string
14
  */
15
+ protected $link_regex = '/<a([^>]*?)\shref=([\'\"])([a-zA-Z]+?):(\/\/)?([^\2]+?)\2\s?(.*?)>(.*?)<\/a>/i';
16
 
17
  /**
18
  * Storage for the currently set options
336
  * @return array
337
  */
338
  protected function get_target( $category, $matches ) {
339
+ $protocol = $matches[3];
340
+ $original_url = $matches[5];
341
+ $domain = $this->yoast_ga_get_domain( $matches[5] );
342
  $origin = $this->yoast_ga_get_domain( $_SERVER['HTTP_HOST'] );
343
  $extension = substr( strrchr( $original_url, '.' ), 1 );
344
  $type = $this->get_target_type( $extension, $domain, $origin, $matches );
352
  'origin_domain' => $origin['domain'],
353
  'origin_host' => $origin['host'],
354
  'extension' => $extension,
355
+ 'link_attributes' => rtrim( $matches[1] . ' ' . $matches[6] ),
356
+ 'link_text' => $matches[7],
357
  'original_url' => $original_url,
358
  );
359
  }
371
  protected function get_target_type( $extension, $domain, $origin, $matches ) {
372
  $download_extensions = explode( ',', str_replace( '.', '', $this->options['extensions_of_files'] ) );
373
  $download_extensions = array_map( 'trim', $download_extensions );
374
+ $protocol = $matches[3];
375
+ $original_url = $matches[5];
376
 
377
  // Break out immediately if the link is not an http or https link.
378
  $type = null;
frontend/class-frontend.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Frontend
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Frontend
 
4
  */
5
 
6
  /**
frontend/class-ga-js.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Frontend
5
  */
6
 
7
  /**
@@ -26,7 +25,7 @@ class Yoast_GA_JS extends Yoast_GA_Tracking {
26
  do_action( 'yst_tracking' );
27
 
28
  if ( isset( $this->options['subdomain_tracking'] ) && $this->options['subdomain_tracking'] != '' ) {
29
- $domain = $this->options['subdomain_tracking'];
30
  }
31
  else {
32
  $domain = null; // Default domain value
@@ -163,25 +162,25 @@ class Yoast_GA_JS extends Yoast_GA_Tracking {
163
  switch ( $link['type'] ) {
164
  case 'download':
165
  if ( $this->options['track_download_as'] == 'pageview' ) {
166
- $onclick = "_gaq.push(['_trackPageview','download/" . esc_attr( $full_url ) . "']);";
167
  }
168
  else {
169
- $onclick = "_gaq.push(['_trackEvent','download','" . esc_attr( $full_url ) . "']);";
170
  }
171
 
172
  break;
173
  case 'email':
174
- $onclick = "_gaq.push(['_trackEvent','mailto','" . esc_attr( $link['original_url'] ) . "']);";
175
 
176
  break;
177
  case 'internal-as-outbound':
178
  $label = $this->sanitize_internal_label();
179
 
180
- $onclick = "_gaq.push(['_trackEvent', '" . esc_attr( $link['category'] ) . '-' . esc_attr( $label ) . "', '" . esc_attr( $full_url ) . "', '" . esc_attr( strip_tags( $link['link_text'] ) ) . "']);";
181
 
182
  break;
183
  case 'outbound':
184
- $onclick = "_gaq.push(['_trackEvent', '" . esc_attr( $link['category'] ) . "', '" . esc_attr( $full_url ) . "', '" . esc_attr( strip_tags( $link['link_text'] ) ) . "']);";
185
 
186
  break;
187
  }
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Frontend
 
4
  */
5
 
6
  /**
25
  do_action( 'yst_tracking' );
26
 
27
  if ( isset( $this->options['subdomain_tracking'] ) && $this->options['subdomain_tracking'] != '' ) {
28
+ $domain = esc_attr( $this->options['subdomain_tracking'] );
29
  }
30
  else {
31
  $domain = null; // Default domain value
162
  switch ( $link['type'] ) {
163
  case 'download':
164
  if ( $this->options['track_download_as'] == 'pageview' ) {
165
+ $onclick = "_gaq.push(['_trackPageview','download/" . esc_js( $full_url ) . "']);";
166
  }
167
  else {
168
+ $onclick = "_gaq.push(['_trackEvent','download','" . esc_js( $full_url ) . "']);";
169
  }
170
 
171
  break;
172
  case 'email':
173
+ $onclick = "_gaq.push(['_trackEvent','mailto','" . esc_js( $link['original_url'] ) . "']);";
174
 
175
  break;
176
  case 'internal-as-outbound':
177
  $label = $this->sanitize_internal_label();
178
 
179
+ $onclick = "_gaq.push(['_trackEvent', '" . esc_js( $link['category'] ) . '-' . esc_js( $label ) . "', '" . esc_js( $full_url ) . "', '" . esc_js( strip_tags( $link['link_text'] ) ) . "']);";
180
 
181
  break;
182
  case 'outbound':
183
+ $onclick = "_gaq.push(['_trackEvent', '" . esc_js( $link['category'] ) . "', '" . esc_js( $full_url ) . "', '" . esc_js( strip_tags( $link['link_text'] ) ) . "']);";
184
 
185
  break;
186
  }
frontend/class-universal.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Frontend
5
  */
6
 
7
  /**
@@ -33,7 +32,7 @@ class Yoast_GA_Universal extends Yoast_GA_Tracking {
33
  do_action( 'yst_tracking' );
34
 
35
  if ( isset( $this->options['subdomain_tracking'] ) && $this->options['subdomain_tracking'] != '' ) {
36
- $domain = $this->options['subdomain_tracking'];
37
  }
38
  else {
39
  $domain = 'auto'; // Default domain value
@@ -169,26 +168,26 @@ class Yoast_GA_Universal extends Yoast_GA_Tracking {
169
  switch ( $link['type'] ) {
170
  case 'download':
171
  if ( $this->options['track_download_as'] == 'pageview' ) {
172
- $onclick = "__gaTracker('send', 'pageview', '" . esc_attr( $full_url ) . "');";
173
  }
174
  else {
175
- $onclick = "__gaTracker('send', 'event', 'download', '" . esc_attr( $full_url ) . "');";
176
  }
177
 
178
  break;
179
  case 'email':
180
- $onclick = "__gaTracker('send', 'event', 'mailto', '" . esc_attr( $link['original_url'] ) . "');";
181
 
182
  break;
183
  case 'internal-as-outbound':
184
  $label = $this->sanitize_internal_label();
185
 
186
- $onclick = "__gaTracker('send', '" . $this->options['track_download_as'] . "', '" . esc_attr( $link['category'] ) . '-' . esc_attr( $label ) . "', '" . esc_attr( $full_url ) . "', '" . esc_attr( strip_tags( $link['link_text'] ) ) . "');";
187
 
188
  break;
189
  case 'outbound':
190
  if ( $this->options['track_outbound'] == 1 ) {
191
- $onclick = "__gaTracker('send', 'event', '" . esc_attr( $link['category'] ) . "', '" . esc_attr( $full_url ) . "', '" . esc_attr( strip_tags( $link['link_text'] ) ) . "');";
192
  }
193
 
194
  break;
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Frontend
 
4
  */
5
 
6
  /**
32
  do_action( 'yst_tracking' );
33
 
34
  if ( isset( $this->options['subdomain_tracking'] ) && $this->options['subdomain_tracking'] != '' ) {
35
+ $domain = esc_attr( $this->options['subdomain_tracking'] );
36
  }
37
  else {
38
  $domain = 'auto'; // Default domain value
168
  switch ( $link['type'] ) {
169
  case 'download':
170
  if ( $this->options['track_download_as'] == 'pageview' ) {
171
+ $onclick = "__gaTracker('send', 'pageview', '" . esc_js( $full_url ) . "');";
172
  }
173
  else {
174
+ $onclick = "__gaTracker('send', 'event', 'download', '" . esc_js( $full_url ) . "');";
175
  }
176
 
177
  break;
178
  case 'email':
179
+ $onclick = "__gaTracker('send', 'event', 'mailto', '" . esc_js( $link['original_url'] ) . "');";
180
 
181
  break;
182
  case 'internal-as-outbound':
183
  $label = $this->sanitize_internal_label();
184
 
185
+ $onclick = "__gaTracker('send', '" . $this->options['track_download_as'] . "', '" . esc_js( $link['category'] ) . '-' . esc_js( $label ) . "', '" . esc_js( $full_url ) . "', '" . esc_js( strip_tags( $link['link_text'] ) ) . "');";
186
 
187
  break;
188
  case 'outbound':
189
  if ( $this->options['track_outbound'] == 1 ) {
190
+ $onclick = "__gaTracker('send', 'event', '" . esc_js( $link['category'] ) . "', '" . esc_js( $full_url ) . "', '" . esc_js( strip_tags( $link['link_text'] ) ) . "');";
191
  }
192
 
193
  break;
frontend/views/tracking-debug.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Frontend
5
  */
6
 
7
  ?>
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Frontend
 
4
  */
5
 
6
  ?>
frontend/views/tracking-ga-js.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Frontend
5
  */
6
 
7
  ?>
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Frontend
 
4
  */
5
 
6
  ?>
frontend/views/tracking-universal.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Frontend
5
  */
6
 
7
  ?>
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Frontend
 
4
  */
5
 
6
  ?>
frontend/views/tracking-usergroup.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Frontend
5
  */
6
 
7
  ?>
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Frontend
 
4
  */
5
 
6
  ?>
googleanalytics.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Main
5
  */
6
 
7
  /**
@@ -9,7 +8,7 @@
9
  * Plugin URI: https://yoast.com/wordpress/plugins/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wpgaplugin&utm_content=v504
10
  * Description: This plugin makes it simple to add Google Analytics to your WordPress site, adding lots of features, e.g. error page, search result and automatic outgoing links and download tracking.
11
  * Author: Team Yoast
12
- * Version: 5.3.3
13
  * Requires at least: 3.8
14
  * Author URI: https://yoast.com/
15
  * License: GPL v3
@@ -35,12 +34,14 @@
35
 
36
  // This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics, but has since been rewritten and refactored multiple times.
37
 
38
- define( 'GAWP_VERSION', '5.3.3' );
39
 
40
  define( 'GAWP_FILE', __FILE__ );
41
 
42
  define( 'GAWP_PATH', plugin_basename( __FILE__ ) );
43
 
 
 
44
  define( 'GAWP_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
45
 
46
  if ( file_exists( dirname( GAWP_FILE ) . '/vendor/autoload_52.php' ) ) {
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Main
 
4
  */
5
 
6
  /**
8
  * Plugin URI: https://yoast.com/wordpress/plugins/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wpgaplugin&utm_content=v504
9
  * Description: This plugin makes it simple to add Google Analytics to your WordPress site, adding lots of features, e.g. error page, search result and automatic outgoing links and download tracking.
10
  * Author: Team Yoast
11
+ * Version: 5.4
12
  * Requires at least: 3.8
13
  * Author URI: https://yoast.com/
14
  * License: GPL v3
34
 
35
  // This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics, but has since been rewritten and refactored multiple times.
36
 
37
+ define( 'GAWP_VERSION', '5.4' );
38
 
39
  define( 'GAWP_FILE', __FILE__ );
40
 
41
  define( 'GAWP_PATH', plugin_basename( __FILE__ ) );
42
 
43
+ define( 'GAWP_DIR', dirname( __FILE__ ) );
44
+
45
  define( 'GAWP_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
46
 
47
  if ( file_exists( dirname( GAWP_FILE ) . '/vendor/autoload_52.php' ) ) {
includes/{class-settings.php → class-options-utils.php} RENAMED
@@ -1,13 +1,15 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Includes
5
  */
6
 
7
  /**
8
- * Settings class.
 
 
9
  */
10
- class Yoast_GA_Settings {
 
11
 
12
  /**
13
  * Saving instance of it's own in this static var
@@ -39,11 +41,11 @@ class Yoast_GA_Settings {
39
  /**
40
  * Getting instance of this object. If instance doesn't exists it will be created.
41
  *
42
- * @return object|Yoast_GA_Settings
43
  */
44
  public static function get_instance() {
45
  if ( is_null( self::$instance ) ) {
46
- self::$instance = new Yoast_GA_Settings();
47
  }
48
 
49
  return self::$instance;
@@ -58,4 +60,13 @@ class Yoast_GA_Settings {
58
  return $this->options_class->option_value_to_bool( 'dashboards_disabled' );
59
  }
60
 
 
 
 
 
 
 
 
 
 
61
  }
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\OptionsUtils
 
4
  */
5
 
6
  /**
7
+ * Class Yoast_GA_Options_Utils
8
+ *
9
+ * Old name: Class Yoast_GA_Settings
10
  */
11
+
12
+ class Yoast_GA_Options_Utils {
13
 
14
  /**
15
  * Saving instance of it's own in this static var
41
  /**
42
  * Getting instance of this object. If instance doesn't exists it will be created.
43
  *
44
+ * @return object|Yoast_GA_Options_Utils
45
  */
46
  public static function get_instance() {
47
  if ( is_null( self::$instance ) ) {
48
+ self::$instance = new Yoast_GA_Options_Utils();
49
  }
50
 
51
  return self::$instance;
60
  return $this->options_class->option_value_to_bool( 'dashboards_disabled' );
61
  }
62
 
63
+ /**
64
+ * Add a notification to the notification transient
65
+ *
66
+ * @param string $transient_name The transient name
67
+ * @param array $settings Set the values for this new transient
68
+ */
69
+ public function add_notification( $transient_name, $settings ) {
70
+ set_transient( $transient_name, $settings, MINUTE_IN_SECONDS );
71
+ }
72
  }
includes/class-options.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Includes
5
  */
6
 
7
  /**
@@ -67,7 +66,6 @@ class Yoast_GA_Options {
67
  */
68
  public function __construct() {
69
  $this->options = $this->get_options();
70
- $this->options = $this->check_options( $this->options );
71
 
72
  $this->plugin_path = plugin_dir_path( GAWP_FILE );
73
  $this->plugin_url = trailingslashit( plugin_dir_url( GAWP_FILE ) );
@@ -114,31 +112,6 @@ class Yoast_GA_Options {
114
  return $options[ $this->option_prefix ];
115
  }
116
 
117
- /**
118
- * Check if all the options are set, to prevent a notice if debugging is enabled
119
- * When we have new changes, the settings are saved to the options class
120
- *
121
- * @param array $options
122
- *
123
- * @return mixed
124
- */
125
- public function check_options( $options ) {
126
-
127
- $changes = 0;
128
- foreach ( $this->default_ga_values() as $key => $value ) {
129
- if ( ! isset( $options[ $key ] ) ) {
130
- $options[ $key ] = $value;
131
- $changes ++;
132
- }
133
- }
134
-
135
- if ( $changes >= 1 ) {
136
- $this->update_option( $options );
137
- }
138
-
139
- return $options;
140
- }
141
-
142
  /**
143
  * Get the Google Analytics tracking code for this website
144
  *
@@ -218,7 +191,7 @@ class Yoast_GA_Options {
218
  }
219
  }
220
  // 5.2.8+ Add disabled dashboards option
221
- if ( ! isset ( $this->options['dashboards_disabled'] ) || version_compare( $this->options['version'], '5.2.8', '>' ) ) {
222
  $this->options['dashboards_disabled'] = 0;
223
  }
224
  // Check is API option already exists - if not add it
@@ -257,7 +230,7 @@ class Yoast_GA_Options {
257
  'anonymous_data' => 0,
258
  'enable_universal' => 1,
259
  'demographics' => 0,
260
- 'ignore_users' => array( 'editor' ),
261
  'dashboards_disabled' => 0,
262
  'anonymize_ips' => 0,
263
  'track_download_as' => 'event',
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Includes
 
4
  */
5
 
6
  /**
66
  */
67
  public function __construct() {
68
  $this->options = $this->get_options();
 
69
 
70
  $this->plugin_path = plugin_dir_path( GAWP_FILE );
71
  $this->plugin_url = trailingslashit( plugin_dir_url( GAWP_FILE ) );
112
  return $options[ $this->option_prefix ];
113
  }
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  /**
116
  * Get the Google Analytics tracking code for this website
117
  *
191
  }
192
  }
193
  // 5.2.8+ Add disabled dashboards option
194
+ if ( ( ! isset( $this->options['version'] ) || ! isset ( $this->options['dashboards_disabled'] ) || version_compare( $this->options['version'], '5.2.8', '>' ) ) && ! empty( $_POST ) ) {
195
  $this->options['dashboards_disabled'] = 0;
196
  }
197
  // Check is API option already exists - if not add it
230
  'anonymous_data' => 0,
231
  'enable_universal' => 1,
232
  'demographics' => 0,
233
+ 'ignore_users' => array( 'administrator', 'editor' ),
234
  'dashboards_disabled' => 0,
235
  'anonymize_ips' => 0,
236
  'track_download_as' => 'event',
includes/class-utils.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
- * @package GoogleAnalytics
4
- * @subpackage Includes
5
  */
6
 
7
  /**
1
  <?php
2
  /**
3
+ * @package GoogleAnalytics\Includes
 
4
  */
5
 
6
  /**
languages/google-analytics-for-wordpress-da_DK.mo CHANGED
Binary file
languages/google-analytics-for-wordpress-de_DE.mo ADDED
Binary file
languages/google-analytics-for-wordpress-en_GB.mo CHANGED
Binary file
languages/google-analytics-for-wordpress-es_ES.mo ADDED
Binary file
languages/google-analytics-for-wordpress-es_MX.mo CHANGED
Binary file
languages/google-analytics-for-wordpress-fr_FR.mo CHANGED
Binary file
languages/google-analytics-for-wordpress-he_IL.mo CHANGED
Binary file
languages/google-analytics-for-wordpress-it_IT.mo CHANGED
Binary file
languages/google-analytics-for-wordpress-nb_NO.mo CHANGED
Binary file
languages/google-analytics-for-wordpress-nl_NL.mo CHANGED
Binary file
languages/google-analytics-for-wordpress-pl_PL.mo CHANGED
Binary file
languages/google-analytics-for-wordpress-pt_BR.mo CHANGED
Binary file
languages/google-analytics-for-wordpress-ru_RU.mo CHANGED
Binary file
languages/google-analytics-for-wordpress-sv_SE.mo ADDED
Binary file
languages/google-analytics-for-wordpress-tr_TR.mo ADDED
Binary file
languages/google-analytics-for-wordpress.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GPL v3.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Google Analytics by Yoast 5.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/yoast/google-analytics-for-wordpress/issues\n"
8
- "POT-Creation-Date: 2015-02-09 10:47:19+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -25,414 +25,472 @@ msgstr ""
25
  "X-Poedit-Bookmarks: \n"
26
  "X-Textdomain-Support: yes\n"
27
 
28
- #: admin/class-admin-menu.php:65 admin/class-admin-menu.php:126
 
 
 
 
29
  msgid "Yoast Google Analytics:"
30
  msgstr ""
31
 
32
- #: admin/class-admin-menu.php:65 admin/pages/settings.php:28
33
  msgid "General settings"
34
  msgstr ""
35
 
36
- #: admin/class-admin-menu.php:65
37
  msgid "Analytics"
38
  msgstr ""
39
 
40
- #: admin/class-admin-menu.php:210 admin/pages/extensions.php:10
41
- #: admin/pages/extensions.php:13
42
- msgid "Extensions"
43
- msgstr ""
44
-
45
- #: admin/class-admin-menu.php:218 admin/pages/dashboard.php:10
46
  msgid "Dashboard"
47
  msgstr ""
48
 
49
- #: admin/class-admin-menu.php:221 admin/class-admin.php:204
50
- #: admin/pages/settings.php:6
51
  msgid "Settings"
52
  msgstr ""
53
 
54
- #: admin/class-admin.php:119
55
- msgid "Settings saved."
 
56
  msgstr ""
57
 
58
- #: admin/class-admin.php:126
59
- msgid "There were no changes to save, please try again."
60
  msgstr ""
61
 
62
- #: admin/class-admin.php:201
63
- msgid "FAQ"
64
  msgstr ""
65
 
66
- #: admin/class-admin.php:216
67
  msgid ""
68
- "If you want to track custom dimensions like page views per author or post "
69
- "type, you should upgrade to the %1$spremium version of Google Analytics by "
70
- "Yoast%2$s."
71
  msgstr ""
72
 
73
- #: admin/class-admin.php:218
74
- msgid ""
75
- "This will also give you email access to the support team at Yoast, who will "
76
- "provide support on the plugin 24/7."
77
  msgstr ""
78
 
79
- #: admin/class-admin.php:388
80
- msgid "Debug information"
 
 
81
  msgstr ""
82
 
83
- #: admin/class-admin.php:437
84
- msgid "Google Analytics by Yoast Premium"
85
  msgstr ""
86
 
87
- #: admin/class-admin.php:438
88
  msgid ""
89
- "The premium version of Google Analytics by Yoast with more features and "
90
- "support."
91
  msgstr ""
92
 
93
- #. Plugin Name of the plugin/theme
94
- msgid "Google Analytics by Yoast"
95
  msgstr ""
96
 
97
- #: admin/class-admin.php:443
98
- msgid "eCommerce tracking"
 
 
 
 
 
 
99
  msgstr ""
100
 
101
- #: admin/class-admin.php:444
102
  msgid ""
103
- "Track your eCommerce data and transactions with this eCommerce extension "
104
- "for Google Analytics."
 
105
  msgstr ""
106
 
107
- #: admin/class-google-analytics.php:311
108
- msgid "Please configure your %sGoogle Analytics settings%s!"
109
  msgstr ""
110
 
111
- #: admin/class-google-analytics.php:324
112
  msgid ""
113
- "It seems the authentication for the plugin has expired, please "
114
- "%sre-authenticate%s with Google Analytics to allow the plugin to fetch data."
 
115
  msgstr ""
116
 
117
- #: admin/class-google-analytics.php:337
 
 
 
 
118
  msgid ""
119
- "Data is not up-to-date, there was an error in retrieving the data from "
120
- "Google Analytics. This error could be caused by several issues. If the "
121
- "error persists, please see %sthis page%s."
122
  msgstr ""
123
 
124
- #: admin/dashboards/class-admin-dashboards.php:137
125
- msgid ": activate to sort column ascending"
126
  msgstr ""
127
 
128
- #: admin/dashboards/class-admin-dashboards.php:138
129
- msgid ": activate to sort column descending"
 
 
130
  msgstr ""
131
 
132
- #: admin/dashboards/class-admin-dashboards.php:139
133
- msgid "No data available"
134
  msgstr ""
135
 
136
- #: admin/dashboards/class-admin-dashboards.php:141
137
- msgid "No rows to show"
 
 
138
  msgstr ""
139
 
140
- #: admin/dashboards/class-admin-dashboards.php:144
141
- msgid "Loading..."
142
  msgstr ""
143
 
144
- #: admin/dashboards/class-admin-dashboards.php:145
145
- msgid "First"
 
 
 
146
  msgstr ""
147
 
148
- #: admin/dashboards/class-admin-dashboards.php:146
149
- msgid "Last"
150
  msgstr ""
151
 
152
- #: admin/dashboards/class-admin-dashboards.php:147
153
- msgid "Next"
154
  msgstr ""
155
 
156
- #: admin/dashboards/class-admin-dashboards.php:148
157
- msgid "Previous"
158
  msgstr ""
159
 
160
- #: admin/dashboards/class-admin-dashboards.php:149
161
- msgid "Processing..."
 
 
 
162
  msgstr ""
163
 
164
- #: admin/dashboards/class-admin-dashboards.php:150
165
- msgid "Search"
166
  msgstr ""
167
 
168
- #: admin/dashboards/class-admin-dashboards.php:151
169
- msgid "No matching records found"
170
  msgstr ""
171
 
172
- #: admin/dashboards/class-admin-dashboards.php:154 admin/pages/dashboard.php:14
173
- msgid "Reports"
174
  msgstr ""
175
 
176
- #: admin/dashboards/class-admin-dashboards.php:155 admin/pages/dashboard.php:15
177
- msgid "Custom dimension reports"
178
  msgstr ""
179
 
180
- #: admin/dashboards/class-admin-dashboards.php:193
181
- #: admin/dashboards/class-admin-dashboards.php:210
182
- #: admin/dashboards/class-admin-dashboards.php:219
183
- #: admin/dashboards/class-admin-dashboards.php:228
184
- msgid "Sessions"
185
  msgstr ""
186
 
187
- #: admin/dashboards/class-admin-dashboards.php:194
188
  msgid ""
189
- "A session is a group of interactions that take place on your website within "
190
- "a given time frame. For example a single session can contain multiple "
191
- "screen or page views, events, social interactions, and ecommerce "
192
- "transactions. <a href=\"http://yoa.st/gasessions\" target=\"_blank\">[Learn "
193
- "more]</a>"
194
  msgstr ""
195
 
196
- #: admin/dashboards/class-admin-dashboards.php:199
197
- msgid "Bounce rate"
198
  msgstr ""
199
 
200
- #: admin/dashboards/class-admin-dashboards.php:200
201
  msgid ""
202
- "Bounce Rate is the percentage of single-page sessions (i.e. sessions in "
203
- "which the person left your site from the entrance page without interacting "
204
- "with the page). <a href=\"http://yoa.st/gabounce\" target=\"_blank\">[Learn "
205
- "more]</a>"
206
  msgstr ""
207
 
208
- #: admin/dashboards/class-admin-dashboards.php:206
209
- msgid "Traffic sources"
210
  msgstr ""
211
 
212
- #: admin/dashboards/class-admin-dashboards.php:207
213
  msgid ""
214
- "Every referral to a web site has an origin, or (traffic) source. Possible "
215
- "sources include: “google” (the name of a search engine), “facebook.com” "
216
- "(the name of a referring site), “spring_newsletter” (the name of one of "
217
- "your newsletters), and “direct” (users that typed your URL directly into "
218
- "their browser, or who had bookmarked your site). <a "
219
- "href=\"http://yoa.st/gabnce\" target=\"_blank\">[Learn more]</a>"
220
  msgstr ""
221
 
222
- #: admin/dashboards/class-admin-dashboards.php:215
223
- msgid "Popular pages"
 
224
  msgstr ""
225
 
226
- #: admin/dashboards/class-admin-dashboards.php:216
227
- msgid "Pages by url."
 
 
 
 
 
228
  msgstr ""
229
 
230
- #: admin/dashboards/class-admin-dashboards.php:224
231
- msgid "Countries"
 
 
232
  msgstr ""
233
 
234
- #: admin/dashboards/class-admin-dashboards.php:225
 
 
 
 
235
  msgid ""
236
- "The country or territory from which visits originated. <a "
237
- "href=\"http://yoa.st/gacountry\" target=\"_blank\">[Learn more]</a>"
238
  msgstr ""
239
 
240
- #: admin/dashboards/views/graph.php:9 admin/dashboards/views/table.php:9
241
- msgid "Last month"
242
  msgstr ""
243
 
244
- #: admin/i18n-module/i18n-module.php:170
245
  msgid ""
246
- "As you can see, there is a translation of this plugin in %1$s. This "
247
- "translation is currently %3$d%% complete. We need your help to make it "
248
- "complete and to fix any errors. Please register at %4$s to help complete "
249
- "the translation to %1$s!"
250
  msgstr ""
251
 
252
- #: admin/i18n-module/i18n-module.php:172
253
- msgid ""
254
- "You're using WordPress in %1$s. While %2$s has been translated to %1$s for "
255
- "%3$d%%, it's not been shipped with the plugin yet. You can help! Register "
256
- "at %4$s to help complete the translation to %1$s!"
257
  msgstr ""
258
 
259
- #: admin/i18n-module/i18n-module.php:174
260
- msgid ""
261
- "You're using WordPress in a language we don't support yet. We'd love for "
262
- "%2$s to be translated in that language too, but unfortunately, it isn't "
263
- "right now. You can change that! Register at %4$s to help translate it!"
264
  msgstr ""
265
 
266
- #: admin/i18n-module/i18n-module.php:194
267
- msgid "Translation of %s"
268
  msgstr ""
269
 
270
- #: admin/i18n-module/i18n-module.php:199
271
- msgid "Register now &raquo;"
272
  msgstr ""
273
 
274
- #: admin/license-manager/class-license-manager.php:137
275
- msgid ""
276
- "<b>Warning!</b> You're blocking external requests which means you won't be "
277
- "able to get %s updates. Please add %s to %s."
278
  msgstr ""
279
 
280
- #: admin/license-manager/class-license-manager.php:180
281
- msgid "Your %s license has been activated. You have an unlimited license. "
282
  msgstr ""
283
 
284
- #: admin/license-manager/class-license-manager.php:182
285
- msgid "Your %s license has been activated. You have used %d/%d activations. "
286
  msgstr ""
287
 
288
- #: admin/license-manager/class-license-manager.php:187
289
- msgid "<a href=\"%s\">Did you know you can upgrade your license?</a>"
 
 
 
 
 
 
 
 
 
 
 
 
290
  msgstr ""
291
 
292
- #: admin/license-manager/class-license-manager.php:191
 
 
 
 
293
  msgid ""
294
- "<a href=\"%s\">Your license is expiring in %d days, would you like to "
295
- "extend it?</a>"
 
 
 
 
296
  msgstr ""
297
 
298
- #: admin/license-manager/class-license-manager.php:200
 
 
 
 
299
  msgid ""
300
- "You've reached your activation limit. You must <a href=\"%s\">upgrade your "
301
- "license</a> to use it on this site."
302
  msgstr ""
303
 
304
- #: admin/license-manager/class-license-manager.php:203
 
 
 
 
305
  msgid ""
306
- "Your license has expired. You must <a href=\"%s\">extend your license</a> "
307
- "in order to use it again."
308
  msgstr ""
309
 
310
- #: admin/license-manager/class-license-manager.php:206
311
- msgid "Failed to activate your license, your license key seems to be invalid."
 
 
 
312
  msgstr ""
313
 
314
- #: admin/license-manager/class-license-manager.php:230
315
- msgid "Your %s license has been deactivated."
316
  msgstr ""
317
 
318
- #: admin/license-manager/class-license-manager.php:232
319
- msgid "Failed to deactivate your %s license."
320
  msgstr ""
321
 
322
- #: admin/license-manager/class-license-manager.php:267
323
- msgid "Request error: \"%s\" (%scommon license notices%s)"
324
  msgstr ""
325
 
326
- #: admin/license-manager/class-license-manager.php:423
327
- msgid "%s: License Settings"
328
  msgstr ""
329
 
330
- #: admin/license-manager/class-plugin-license-manager.php:73
331
- msgid ""
332
- "%s is network activated, you can manage your license in the <a "
333
- "href=\"%s\">network admin license page</a>."
334
  msgstr ""
335
 
336
- #: admin/license-manager/class-plugin-license-manager.php:75
337
- msgid ""
338
- "%s is network activated, please contact your site administrator to manage "
339
- "the license."
340
  msgstr ""
341
 
342
- #: admin/license-manager/class-theme-license-manager.php:34
343
- #: admin/license-manager/samples/sample-plugin.php:53
344
- msgid "%s License"
345
  msgstr ""
346
 
347
- #: admin/license-manager/class-theme-license-manager.php:34
348
- msgid "Theme License"
349
  msgstr ""
350
 
351
- #: admin/license-manager/class-theme-update-manager.php:96
352
- msgid ""
353
- "Updating this theme will lose any customizations you have made. 'Cancel' to "
354
- "stop, 'OK' to update."
355
  msgstr ""
356
 
357
- #: admin/license-manager/class-theme-update-manager.php:101
358
- msgid ""
359
- "<strong>%s version %s</strong> is available. <a href=\"%s\" "
360
- "class=\"thickbox\" title=\"%s\">Check out what's new</a> or <a href=\"%s\" "
361
- "%s>update now</a>."
362
  msgstr ""
363
 
364
- #: admin/license-manager/class-update-manager.php:83
365
- msgid "%s failed to check for updates because of the following error: <em>%s</em>"
366
  msgstr ""
367
 
368
- #: admin/license-manager/class-update-manager.php:153
369
- msgid ""
370
- "This site has not been activated properly on yoast.com and thus cannot "
371
- "check for future updates. Please activate your site with a valid license "
372
- "key."
373
  msgstr ""
374
 
375
- #: admin/license-manager/views/form.php:23
376
- msgid "License status"
377
  msgstr ""
378
 
379
- #: admin/license-manager/views/form.php:33
380
- msgid "Toggle license status"
381
  msgstr ""
382
 
383
- #: admin/license-manager/views/form.php:37
384
- msgid "Deactivate License"
 
 
 
385
  msgstr ""
386
 
387
- #: admin/license-manager/views/form.php:38
388
- msgid "(deactivate your license so you can activate it on another WordPress site)"
 
 
 
 
 
389
  msgstr ""
390
 
391
- #: admin/license-manager/views/form.php:42
392
- msgid "Activate License"
393
  msgstr ""
394
 
395
- #: admin/license-manager/views/form.php:44
396
- msgid "Please enter a license key in the field below first."
 
 
 
 
397
  msgstr ""
398
 
399
- #: admin/license-manager/views/form.php:52
400
- msgid "License Key"
401
  msgstr ""
402
 
403
- #: admin/license-manager/views/form.php:54
404
- msgid "Paste your %s license key here.."
 
 
 
 
 
 
405
  msgstr ""
406
 
407
- #: admin/license-manager/views/form.php:56
408
- msgid "You defined your license key using the %s PHP constant."
409
  msgstr ""
410
 
411
- #: admin/license-manager/views/form.php:73
412
- msgid "Your %s license will expire on %s."
413
  msgstr ""
414
 
415
- #: admin/license-manager/views/form.php:76
416
- msgid "%sRenew your license now%s."
 
 
 
 
 
 
 
 
 
 
417
  msgstr ""
418
 
419
- #: admin/pages/dashboard.php:10 admin/pages/extensions.php:10
420
- #: admin/pages/settings.php:6
421
  msgid "Google Analytics by Yoast: "
422
  msgstr ""
423
 
424
- #: admin/pages/dashboard.php:13
425
  msgid "Overview"
426
  msgstr ""
427
 
428
- #: admin/pages/dashboard.php:39 admin/pages/dashboard.php:75
429
  msgid ""
430
  "We need you to authenticate with Google Analytics to use this "
431
  "functionality. If you set your UA-code manually, this won't work. You can "
432
  "%sauthenticate your Google Analytics profile here%s to enable dashboards."
433
  msgstr ""
434
 
435
- #: admin/pages/dashboard.php:47 admin/pages/dashboard.php:83
436
  msgid ""
437
  "Because we've switched to a newer version of the Google Analytics API, "
438
  "you'll need to re-authenticate with Google Analytics. We're sorry for the "
@@ -440,307 +498,342 @@ msgid ""
440
  "here%s."
441
  msgstr ""
442
 
443
- #: admin/pages/dashboard.php:58 admin/pages/dashboard.php:101
444
  msgid ""
445
  "You have not yet finished setting up Google Analytics for Wordpress by "
446
  "Yoast. Please %sadd your Analytics profile here%s to enable tracking."
447
  msgstr ""
448
 
449
- #: admin/pages/dashboard.php:91
450
  msgid "Select a dimension"
451
  msgstr ""
452
 
453
- #: admin/pages/extensions.php:14
454
  msgid "Licenses"
455
  msgstr ""
456
 
457
- #: admin/pages/extensions.php:58
 
 
 
 
 
 
 
 
 
 
 
 
458
  msgid ""
459
  "You have not installed any extensions for Google Analytics by Yoast, so "
460
  "there are no licenses to activate."
461
  msgstr ""
462
 
463
- #: admin/pages/settings.php:13
464
  msgid "General"
465
  msgstr ""
466
 
467
- #: admin/pages/settings.php:14
468
  msgid "Universal"
469
  msgstr ""
470
 
471
- #: admin/pages/settings.php:15
472
  msgid "Advanced"
473
  msgstr ""
474
 
475
- #: admin/pages/settings.php:16
476
- msgid "Custom Dimensions"
477
- msgstr ""
478
-
479
- #: admin/pages/settings.php:18
480
  msgid "Debug mode"
481
  msgstr ""
482
 
483
- #: admin/pages/settings.php:42
484
- msgid "Paste your Google authentication code"
485
  msgstr ""
486
 
487
- #: admin/pages/settings.php:47
488
- msgid "Google profile"
 
 
 
489
  msgstr ""
490
 
491
- #: admin/pages/settings.php:48
492
- msgid "Authenticate with your Google account"
 
 
493
  msgstr ""
494
 
495
- #: admin/pages/settings.php:51
496
- msgid "Current UA-profile"
 
 
497
  msgstr ""
498
 
499
- #: admin/pages/settings.php:55
500
- msgid "Analytics profile"
501
  msgstr ""
502
 
503
- #: admin/pages/settings.php:55
504
- msgid "Select a profile"
505
  msgstr ""
506
 
507
- #: admin/pages/settings.php:59
508
- msgid "Re-authenticate with your Google account"
509
  msgstr ""
510
 
511
- #: admin/pages/settings.php:65
512
- msgid "Paste your Google code here"
513
  msgstr ""
514
 
515
- #: admin/pages/settings.php:69
516
- msgid "Save authentication code"
517
  msgstr ""
518
 
519
- #: admin/pages/settings.php:72
520
- msgid "Cannot connect to Google"
521
  msgstr ""
522
 
523
- #: admin/pages/settings.php:74
524
  msgid ""
525
- "Your server is blocking requests to Google, to fix this, add "
526
- "<code>*.googleapis.com</code> to the <code>WP_ACCESSIBLE_HOSTS</code> "
527
- "constant in your <em>wp-config.php</em> or ask your webhost to do this."
528
  msgstr ""
529
 
530
- #: admin/pages/settings.php:76
531
  msgid ""
532
- "Your firewall or webhost is blocking requests to Google, please ask your "
533
- "webhost company to fix this."
 
534
  msgstr ""
535
 
536
- #: admin/pages/settings.php:78
537
- msgid ""
538
- "Until this is fixed, you can only use the manual authentication method and "
539
- "cannot use the dashboards feature."
540
  msgstr ""
541
 
542
- #: admin/pages/settings.php:82
543
- msgid "Manually enter your UA code"
544
  msgstr ""
545
 
546
- #: admin/pages/settings.php:86
547
- msgid ""
548
- "Warning: If you use a manual UA code, you won't be able to use the "
549
- "dashboards."
550
  msgstr ""
551
 
552
- #: admin/pages/settings.php:92
553
- msgid "Track outbound click and downloads"
554
  msgstr ""
555
 
556
- #: admin/pages/settings.php:92
557
  msgid ""
558
- "Clicks and downloads will be tracked as events, you can find these under "
559
- "Content &#xBB; Event Tracking in your Google Analytics reports."
 
560
  msgstr ""
561
 
562
- #: admin/pages/settings.php:93
563
- msgid "Allow tracking of anonymous data"
 
 
564
  msgstr ""
565
 
566
- #: admin/pages/settings.php:93
567
  msgid ""
568
- "By allowing us to track anonymous data we can better help you, because we "
569
- "know with which WordPress configurations, themes and plugins we should "
570
- "test. No personal data will be submitted."
571
  msgstr ""
572
 
573
- #: admin/pages/settings.php:94
574
- msgid "Anonymize IPs"
 
 
575
  msgstr ""
576
 
577
- #: admin/pages/settings.php:94
578
  msgid ""
579
- "This adds %1$s, telling Google Analytics to anonymize the information sent "
580
- "by the tracker objects by removing the last octet of the IP address prior "
581
- "to its storage."
 
582
  msgstr ""
583
 
584
- #: admin/pages/settings.php:95
585
  msgid ""
586
- "Users of the role you select will be ignored, so if you select Editor, all "
587
- "Editors will be ignored."
 
588
  msgstr ""
589
 
590
- #: admin/pages/settings.php:96
591
- msgid "Disable analytics dashboard"
 
 
 
 
 
 
 
 
 
 
 
592
  msgstr ""
593
 
594
- #: admin/pages/settings.php:96
595
  msgid ""
596
- "This will completely disable the dashboard and stop the plugin from "
597
- "fetching the latest analytics data."
598
  msgstr ""
599
 
600
- #: admin/pages/settings.php:101
601
- msgid "Universal settings"
602
  msgstr ""
603
 
604
- #: admin/pages/settings.php:102
605
- msgid "Enable Universal tracking"
606
  msgstr ""
607
 
608
- #: admin/pages/settings.php:102
609
- msgid ""
610
- "First enable Universal tracking in your Google Analytics account. Please "
611
- "read %1$sthis guide%2$s to learn how to do that."
612
  msgstr ""
613
 
614
- #: admin/pages/settings.php:103
615
- msgid "Enable Demographics and Interest Reports"
616
  msgstr ""
617
 
618
- #: admin/pages/settings.php:103
619
  msgid ""
620
- "You have to enable the Demographics in Google Analytics before you can see "
621
- "the tracking data. We have a knowledge base article in our %1$sknowledge "
622
- "base%2$s about this feature."
623
  msgstr ""
624
 
625
- #: admin/pages/settings.php:108
626
- msgid "Advanced settings"
 
 
627
  msgstr ""
628
 
629
- #: admin/pages/settings.php:109
630
- msgid "Track downloads as"
 
 
631
  msgstr ""
632
 
633
- #: admin/pages/settings.php:109
634
- msgid ""
635
- "Not recommended, as this would skew your statistics, but it does make it "
636
- "possible to track downloads as goals."
637
  msgstr ""
638
 
639
- #: admin/pages/settings.php:110
640
- msgid "Extensions of files to track as downloads"
641
  msgstr ""
642
 
643
- #: admin/pages/settings.php:111
644
- msgid "Track full URL of outbound clicks or just the domain"
645
  msgstr ""
646
 
647
- #: admin/pages/settings.php:112
648
- msgid "Subdomain tracking"
649
  msgstr ""
650
 
651
- #: admin/pages/settings.php:112
652
- msgid ""
653
- "This allows you to set the domain that's set by %1$s for tracking "
654
- "subdomains.<br/>If empty, this will not be set."
655
  msgstr ""
656
 
657
- #: admin/pages/settings.php:114
658
- msgid "Set path for internal links to track as outbound links"
 
 
659
  msgstr ""
660
 
661
- #: admin/pages/settings.php:114
662
  msgid ""
663
- "If you want to track all internal links that begin with %1$s, enter %1$s in "
664
- "the box above. If you have multiple prefixes you can separate them with "
665
- "comma's: %2$s"
666
  msgstr ""
667
 
668
- #: admin/pages/settings.php:115
669
- msgid "Label for those links"
 
670
  msgstr ""
671
 
672
- #: admin/pages/settings.php:117
673
- msgid "Tag links in RSS feed with campaign variables"
674
  msgstr ""
675
 
676
- #: admin/pages/settings.php:117
677
  msgid ""
678
- "Do not use this feature if you use FeedBurner, as FeedBurner can do this "
679
- "automatically and better than this plugin can. Check <a "
680
- "href=\"https://support.google.com/feedburner/answer/165769?hl=en&amp;ref_"
681
- "topic=13075\" target=\"_blank\">this help page</a> for info on how to "
682
- "enable this feature in FeedBurner."
683
  msgstr ""
684
 
685
- #: admin/pages/settings.php:118
686
- msgid "Allow anchor"
 
 
 
687
  msgstr ""
688
 
689
- #: admin/pages/settings.php:118
690
- msgid ""
691
- "This adds a %1$s call to your tracking code, and makes RSS link tagging use "
692
- "a %2$s as well."
693
  msgstr ""
694
 
695
- #: admin/pages/settings.php:119
696
- msgid "Add <code>_setAllowLinker</code>"
 
 
 
697
  msgstr ""
698
 
699
- #: admin/pages/settings.php:119
700
  msgid ""
701
- "This adds a %1$s call to your tracking code, allowing you to use %2$s and "
702
- "related functions."
 
703
  msgstr ""
704
 
705
- #: admin/pages/settings.php:120
706
  msgid ""
707
- "Not for the average user: this allows you to add a line of code, to be "
708
- "added before the %1$s call."
 
709
  msgstr ""
710
 
711
- #: admin/pages/settings.php:127
712
- msgid "Custom dimensions"
713
  msgstr ""
714
 
715
- #: admin/pages/settings.php:134
716
- msgid "Debug"
717
  msgstr ""
718
 
719
- #: admin/pages/settings.php:137
720
- msgid ""
721
- "If you want to confirm that tracking on your blog is working as it should, "
722
- "enable this option and check the console of your browser. Be absolutely "
723
- "sure to disable debugging afterwards, as it is slower than normal tracking."
724
  msgstr ""
725
 
726
- #: admin/pages/settings.php:138
727
- msgid "<strong>Note</strong> the debugging is only loaded for administrators."
728
  msgstr ""
729
 
730
- #: admin/pages/settings.php:140
731
- msgid "Enable debug mode"
732
  msgstr ""
733
 
734
- #: admin/pages/settings.php:154
735
- msgid "Select the users to ignore"
736
  msgstr ""
737
 
738
- #: admin/views/content-footer.php:8
739
- msgid "Remove these ads?"
740
  msgstr ""
741
 
742
- #: admin/views/content-footer.php:9
743
- msgid "Upgrade to Google Analytics By Yoast Premium »"
 
 
 
 
 
 
 
 
744
  msgstr ""
745
 
746
  #. Plugin URI of the plugin/theme
@@ -764,21 +857,21 @@ msgstr ""
764
  msgid "https://yoast.com/"
765
  msgstr ""
766
 
767
- #: admin/dashboards/class-admin-dashboards.php:140
768
  msgctxt ""
769
  "_START_, _END_ and _TOTAL_ will be replaced by JS (See: "
770
  "http://datatables.net/reference/option/language.info)"
771
  msgid "Showing _START_ to _END_ of _TOTAL_ rows"
772
  msgstr ""
773
 
774
- #: admin/dashboards/class-admin-dashboards.php:142
775
  msgctxt ""
776
  "_MAX_ will be replaced by JS (See: "
777
  "http://datatables.net/reference/option/language.infoFiltered)"
778
  msgid "(filtered from _MAX_ total rows)"
779
  msgstr ""
780
 
781
- #: admin/dashboards/class-admin-dashboards.php:143
782
  msgctxt "_MAX_ will be replaced by JS"
783
  msgid "Show _MENU_ rows"
784
  msgstr ""
2
  # This file is distributed under the GPL v3.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Google Analytics by Yoast 5.4\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/yoast/google-analytics-for-wordpress/issues\n"
8
+ "POT-Creation-Date: 2015-04-20 15:00:39+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
25
  "X-Poedit-Bookmarks: \n"
26
  "X-Textdomain-Support: yes\n"
27
 
28
+ #: admin/class-admin-form.php:46
29
+ msgid "Save changes"
30
+ msgstr ""
31
+
32
+ #: admin/class-admin-menu.php:72 admin/class-admin-menu.php:135
33
  msgid "Yoast Google Analytics:"
34
  msgstr ""
35
 
36
+ #: admin/class-admin-menu.php:72
37
  msgid "General settings"
38
  msgstr ""
39
 
40
+ #: admin/class-admin-menu.php:72
41
  msgid "Analytics"
42
  msgstr ""
43
 
44
+ #: admin/class-admin-menu.php:238 admin/pages/dashboard.php:14
 
 
 
 
 
45
  msgid "Dashboard"
46
  msgstr ""
47
 
48
+ #: admin/class-admin-menu.php:244 admin/class-admin.php:129
49
+ #: admin/pages/settings-api.php:10
50
  msgid "Settings"
51
  msgstr ""
52
 
53
+ #: admin/class-admin-menu.php:251 admin/pages/extensions.php:14
54
+ #: admin/pages/extensions.php:17
55
+ msgid "Extensions"
56
  msgstr ""
57
 
58
+ #: admin/class-admin-settings-fields.php:129
59
+ msgid "Select a profile"
60
  msgstr ""
61
 
62
+ #: admin/class-admin-settings-registrar.php:105
63
+ msgid "Google Analytics profile"
64
  msgstr ""
65
 
66
+ #: admin/class-admin-settings-registrar.php:108
67
  msgid ""
68
+ "Select an analytics profile from your Google account to use for the "
69
+ "tracking on this website."
 
70
  msgstr ""
71
 
72
+ #: admin/class-admin-settings-registrar.php:117
73
+ msgid "Use a manual UA code"
 
 
74
  msgstr ""
75
 
76
+ #: admin/class-admin-settings-registrar.php:120
77
+ msgid ""
78
+ "You can use the manual UA code field to enter your UA code manually, "
79
+ "instead of using the Google Authenticator."
80
  msgstr ""
81
 
82
+ #: admin/class-admin-settings-registrar.php:126
83
+ msgid "Enter your UA code here"
84
  msgstr ""
85
 
86
+ #: admin/class-admin-settings-registrar.php:129
87
  msgid ""
88
+ "Enter the UA code (e.g.: UA-1234567-89) here, you can find the correct UA "
89
+ "code in your Google Analytics dashboard."
90
  msgstr ""
91
 
92
+ #: admin/class-admin-settings-registrar.php:148
93
+ msgid "Track outbound click and downloads"
94
  msgstr ""
95
 
96
+ #: admin/class-admin-settings-registrar.php:151
97
+ msgid ""
98
+ "Clicks and downloads will be tracked as events, you can find these under "
99
+ "Content &#xBB; Event Tracking in your Google Analytics reports."
100
+ msgstr ""
101
+
102
+ #: admin/class-admin-settings-registrar.php:157
103
+ msgid "Allow tracking of anonymous data"
104
  msgstr ""
105
 
106
+ #: admin/class-admin-settings-registrar.php:160
107
  msgid ""
108
+ "By allowing us to track anonymous data we can better help you, because we "
109
+ "know with which WordPress configurations, themes and plugins we should "
110
+ "test. No personal data will be submitted."
111
  msgstr ""
112
 
113
+ #: admin/class-admin-settings-registrar.php:166
114
+ msgid "Anonymize IPs"
115
  msgstr ""
116
 
117
+ #: admin/class-admin-settings-registrar.php:169
118
  msgid ""
119
+ "This adds %1$s, telling Google Analytics to anonymize the information sent "
120
+ "by the tracker objects by removing the last octet of the IP address prior "
121
+ "to its storage."
122
  msgstr ""
123
 
124
+ #: admin/class-admin-settings-registrar.php:175
125
+ msgid "Ignore users"
126
+ msgstr ""
127
+
128
+ #: admin/class-admin-settings-registrar.php:178
129
  msgid ""
130
+ "Users of the role you select will be ignored, so if you select Editor, all "
131
+ "Editors will be ignored."
 
132
  msgstr ""
133
 
134
+ #: admin/class-admin-settings-registrar.php:186
135
+ msgid "Disable analytics dashboard"
136
  msgstr ""
137
 
138
+ #: admin/class-admin-settings-registrar.php:189
139
+ msgid ""
140
+ "This will completely disable the dashboard and stop the plugin from "
141
+ "fetching the latest analytics data."
142
  msgstr ""
143
 
144
+ #: admin/class-admin-settings-registrar.php:208
145
+ msgid "Enable universal"
146
  msgstr ""
147
 
148
+ #: admin/class-admin-settings-registrar.php:211
149
+ msgid ""
150
+ "First enable Universal tracking in your Google Analytics account. Please "
151
+ "read %1$sthis guide%2$s to learn how to do that."
152
  msgstr ""
153
 
154
+ #: admin/class-admin-settings-registrar.php:217
155
+ msgid "Enable Demographics and Interest Reports"
156
  msgstr ""
157
 
158
+ #: admin/class-admin-settings-registrar.php:220
159
+ msgid ""
160
+ "You have to enable the Demographics in Google Analytics before you can see "
161
+ "the tracking data. We have a knowledge base article in our %1$sknowledge "
162
+ "base%2$s about this feature."
163
  msgstr ""
164
 
165
+ #: admin/class-admin-settings-registrar.php:226
166
+ msgid "Enhanced Link Attribution"
167
  msgstr ""
168
 
169
+ #: admin/class-admin-settings-registrar.php:229
170
+ msgid "Add %1$sEnhanced Link Attribution%2$s to your tracking code."
171
  msgstr ""
172
 
173
+ #: admin/class-admin-settings-registrar.php:248
174
+ msgid "Track downloads as"
175
  msgstr ""
176
 
177
+ #: admin/class-admin-settings-registrar.php:251
178
+ #: admin/class-admin-settings-registrar.php:358
179
+ msgid ""
180
+ "Not recommended, as this would skew your statistics, but it does make it "
181
+ "possible to track downloads as goals."
182
  msgstr ""
183
 
184
+ #: admin/class-admin-settings-registrar.php:259
185
+ msgid "Extensions of files to track as downloads"
186
  msgstr ""
187
 
188
+ #: admin/class-admin-settings-registrar.php:262
189
+ msgid "Please separate extensions using commas"
190
  msgstr ""
191
 
192
+ #: admin/class-admin-settings-registrar.php:268
193
+ msgid "Track full URL of outbound clicks or just the domain"
194
  msgstr ""
195
 
196
+ #: admin/class-admin-settings-registrar.php:271
197
+ msgid "How should we track your outbound clicks?"
198
  msgstr ""
199
 
200
+ #: admin/class-admin-settings-registrar.php:279
201
+ msgid "Subdomain tracking"
 
 
 
202
  msgstr ""
203
 
204
+ #: admin/class-admin-settings-registrar.php:282
205
  msgid ""
206
+ "This allows you to set the domain that's set by %1$s for tracking "
207
+ "subdomains.<br/>If empty, this will not be set."
 
 
 
208
  msgstr ""
209
 
210
+ #: admin/class-admin-settings-registrar.php:288
211
+ msgid "Set path for internal links to track as outbound links"
212
  msgstr ""
213
 
214
+ #: admin/class-admin-settings-registrar.php:291
215
  msgid ""
216
+ "If you want to track all internal links that begin with %1$s, enter %1$s in "
217
+ "the box above. If you have multiple prefixes you can separate them with "
218
+ "comma's: %2$s"
 
219
  msgstr ""
220
 
221
+ #: admin/class-admin-settings-registrar.php:297
222
+ msgid "Label for those links"
223
  msgstr ""
224
 
225
+ #: admin/class-admin-settings-registrar.php:300
226
  msgid ""
227
+ "The label to use for these links, this will be added to where the click "
228
+ "came from, so if the label is \"aff\", the label for a click from the "
229
+ "content of an article becomes \"outbound-article-aff\"."
 
 
 
230
  msgstr ""
231
 
232
+ #: admin/class-admin-settings-registrar.php:306
233
+ #: admin/class-admin-settings-registrar.php:315
234
+ msgid "Tag links in RSS feed with campaign variables"
235
  msgstr ""
236
 
237
+ #: admin/class-admin-settings-registrar.php:309
238
+ msgid ""
239
+ "Do not use this feature if you use FeedBurner, as FeedBurner can do this "
240
+ "automatically and better than this plugin can. Check <a "
241
+ "href=\"https://support.google.com/feedburner/answer/165769?hl=en&amp;ref_"
242
+ "topic=13075\" target=\"_blank\">this help page</a> for info on how to "
243
+ "enable this feature in FeedBurner."
244
  msgstr ""
245
 
246
+ #: admin/class-admin-settings-registrar.php:318
247
+ msgid ""
248
+ "This adds a %1$s call to your tracking code, and makes RSS link tagging use "
249
+ "a %2$s as well."
250
  msgstr ""
251
 
252
+ #: admin/class-admin-settings-registrar.php:324
253
+ msgid "Add <code>_setAllowLinker</code>"
254
+ msgstr ""
255
+
256
+ #: admin/class-admin-settings-registrar.php:327
257
  msgid ""
258
+ "This adds a %1$s call to your tracking code, allowing you to use %2$s and "
259
+ "related functions."
260
  msgstr ""
261
 
262
+ #: admin/class-admin-settings-registrar.php:333
263
+ msgid "Custom code"
264
  msgstr ""
265
 
266
+ #: admin/class-admin-settings-registrar.php:336
267
  msgid ""
268
+ "Not for the average user: this allows you to add a line of code, to be "
269
+ "added before the %1$s call."
 
 
270
  msgstr ""
271
 
272
+ #: admin/class-admin-settings-registrar.php:355
273
+ msgid "Enable debug mode"
 
 
 
274
  msgstr ""
275
 
276
+ #: admin/class-admin-settings-registrar.php:413
277
+ msgid "The Google Analytics settings are saved successfully."
 
 
 
278
  msgstr ""
279
 
280
+ #: admin/class-admin-settings-registrar.php:493
281
+ msgid "Event"
282
  msgstr ""
283
 
284
+ #: admin/class-admin-settings-registrar.php:494
285
+ msgid "Pageview"
286
  msgstr ""
287
 
288
+ #: admin/class-admin-settings-registrar.php:505
289
+ msgid "Just the domain"
 
 
290
  msgstr ""
291
 
292
+ #: admin/class-admin-settings-registrar.php:506
293
+ msgid "Full links"
294
  msgstr ""
295
 
296
+ #: admin/class-admin-settings-registrar.php:582
297
+ msgid "The UA code needs to follow UA-XXXXXXXX-X format."
298
  msgstr ""
299
 
300
+ #: admin/class-admin-settings-registrar.php:604
301
+ msgid "The profile ID needs to be numeric."
302
+ msgstr ""
303
+
304
+ #: admin/class-admin.php:126
305
+ msgid "FAQ"
306
+ msgstr ""
307
+
308
+ #: admin/class-admin.php:139
309
+ msgid "Custom Dimensions"
310
+ msgstr ""
311
+
312
+ #: admin/class-admin.php:265
313
+ msgid "Debug information"
314
  msgstr ""
315
 
316
+ #: admin/class-admin.php:314
317
+ msgid "Google Analytics by Yoast Premium"
318
+ msgstr ""
319
+
320
+ #: admin/class-admin.php:315
321
  msgid ""
322
+ "The premium version of Google Analytics by Yoast with more features and "
323
+ "support."
324
+ msgstr ""
325
+
326
+ #. Plugin Name of the plugin/theme
327
+ msgid "Google Analytics by Yoast"
328
  msgstr ""
329
 
330
+ #: admin/class-admin.php:320
331
+ msgid "eCommerce tracking"
332
+ msgstr ""
333
+
334
+ #: admin/class-admin.php:321
335
  msgid ""
336
+ "Track your eCommerce data and transactions with this eCommerce extension "
337
+ "for Google Analytics."
338
  msgstr ""
339
 
340
+ #: admin/class-google-analytics.php:318
341
+ msgid "Please configure your %sGoogle Analytics settings%s!"
342
+ msgstr ""
343
+
344
+ #: admin/class-google-analytics.php:331
345
  msgid ""
346
+ "It seems the authentication for the plugin has expired, please "
347
+ "%sre-authenticate%s with Google Analytics to allow the plugin to fetch data."
348
  msgstr ""
349
 
350
+ #: admin/class-google-analytics.php:344
351
+ msgid ""
352
+ "Data is not up-to-date, there was an error in retrieving the data from "
353
+ "Google Analytics. This error could be caused by several issues. If the "
354
+ "error persists, please see %sthis page%s."
355
  msgstr ""
356
 
357
+ #: admin/dashboards/class-admin-dashboards.php:135
358
+ msgid ": activate to sort column ascending"
359
  msgstr ""
360
 
361
+ #: admin/dashboards/class-admin-dashboards.php:136
362
+ msgid ": activate to sort column descending"
363
  msgstr ""
364
 
365
+ #: admin/dashboards/class-admin-dashboards.php:137
366
+ msgid "No data available"
367
  msgstr ""
368
 
369
+ #: admin/dashboards/class-admin-dashboards.php:139
370
+ msgid "No rows to show"
371
  msgstr ""
372
 
373
+ #: admin/dashboards/class-admin-dashboards.php:142
374
+ msgid "Loading..."
 
 
375
  msgstr ""
376
 
377
+ #: admin/dashboards/class-admin-dashboards.php:143
378
+ msgid "First"
 
 
379
  msgstr ""
380
 
381
+ #: admin/dashboards/class-admin-dashboards.php:144
382
+ msgid "Last"
 
383
  msgstr ""
384
 
385
+ #: admin/dashboards/class-admin-dashboards.php:145
386
+ msgid "Next"
387
  msgstr ""
388
 
389
+ #: admin/dashboards/class-admin-dashboards.php:146
390
+ msgid "Previous"
 
 
391
  msgstr ""
392
 
393
+ #: admin/dashboards/class-admin-dashboards.php:147
394
+ msgid "Processing..."
 
 
 
395
  msgstr ""
396
 
397
+ #: admin/dashboards/class-admin-dashboards.php:148
398
+ msgid "Search"
399
  msgstr ""
400
 
401
+ #: admin/dashboards/class-admin-dashboards.php:149
402
+ msgid "No matching records found"
 
 
 
403
  msgstr ""
404
 
405
+ #: admin/dashboards/class-admin-dashboards.php:152 admin/pages/dashboard.php:18
406
+ msgid "Reports"
407
  msgstr ""
408
 
409
+ #: admin/dashboards/class-admin-dashboards.php:153 admin/pages/dashboard.php:19
410
+ msgid "Custom dimension reports"
411
  msgstr ""
412
 
413
+ #: admin/dashboards/class-admin-dashboards.php:191
414
+ #: admin/dashboards/class-admin-dashboards.php:208
415
+ #: admin/dashboards/class-admin-dashboards.php:217
416
+ #: admin/dashboards/class-admin-dashboards.php:226
417
+ msgid "Sessions"
418
  msgstr ""
419
 
420
+ #: admin/dashboards/class-admin-dashboards.php:192
421
+ msgid ""
422
+ "A session is a group of interactions that take place on your website within "
423
+ "a given time frame. For example a single session can contain multiple "
424
+ "screen or page views, events, social interactions, and ecommerce "
425
+ "transactions. <a href=\"http://yoa.st/gasessions\" target=\"_blank\">[Learn "
426
+ "more]</a>"
427
  msgstr ""
428
 
429
+ #: admin/dashboards/class-admin-dashboards.php:197
430
+ msgid "Bounce rate"
431
  msgstr ""
432
 
433
+ #: admin/dashboards/class-admin-dashboards.php:198
434
+ msgid ""
435
+ "Bounce Rate is the percentage of single-page sessions (i.e. sessions in "
436
+ "which the person left your site from the entrance page without interacting "
437
+ "with the page). <a href=\"http://yoa.st/gabounce\" target=\"_blank\">[Learn "
438
+ "more]</a>"
439
  msgstr ""
440
 
441
+ #: admin/dashboards/class-admin-dashboards.php:204
442
+ msgid "Traffic sources"
443
  msgstr ""
444
 
445
+ #: admin/dashboards/class-admin-dashboards.php:205
446
+ msgid ""
447
+ "Every referral to a web site has an origin, or (traffic) source. Possible "
448
+ "sources include: “google” (the name of a search engine), “facebook.com” "
449
+ "(the name of a referring site), “spring_newsletter” (the name of one of "
450
+ "your newsletters), and “direct” (users that typed your URL directly into "
451
+ "their browser, or who had bookmarked your site). <a "
452
+ "href=\"http://yoa.st/gabnce\" target=\"_blank\">[Learn more]</a>"
453
  msgstr ""
454
 
455
+ #: admin/dashboards/class-admin-dashboards.php:213
456
+ msgid "Popular pages"
457
  msgstr ""
458
 
459
+ #: admin/dashboards/class-admin-dashboards.php:214
460
+ msgid "Pages by url."
461
  msgstr ""
462
 
463
+ #: admin/dashboards/class-admin-dashboards.php:222
464
+ msgid "Countries"
465
+ msgstr ""
466
+
467
+ #: admin/dashboards/class-admin-dashboards.php:223
468
+ msgid ""
469
+ "The country or territory from which visits originated. <a "
470
+ "href=\"http://yoa.st/gacountry\" target=\"_blank\">[Learn more]</a>"
471
+ msgstr ""
472
+
473
+ #: admin/dashboards/views/graph.php:15 admin/dashboards/views/table.php:15
474
+ msgid "Last month"
475
  msgstr ""
476
 
477
+ #: admin/pages/dashboard.php:14 admin/pages/extensions.php:14
478
+ #: admin/pages/settings-api.php:10
479
  msgid "Google Analytics by Yoast: "
480
  msgstr ""
481
 
482
+ #: admin/pages/dashboard.php:17
483
  msgid "Overview"
484
  msgstr ""
485
 
486
+ #: admin/pages/dashboard.php:43 admin/pages/dashboard.php:82
487
  msgid ""
488
  "We need you to authenticate with Google Analytics to use this "
489
  "functionality. If you set your UA-code manually, this won't work. You can "
490
  "%sauthenticate your Google Analytics profile here%s to enable dashboards."
491
  msgstr ""
492
 
493
+ #: admin/pages/dashboard.php:52 admin/pages/dashboard.php:91
494
  msgid ""
495
  "Because we've switched to a newer version of the Google Analytics API, "
496
  "you'll need to re-authenticate with Google Analytics. We're sorry for the "
498
  "here%s."
499
  msgstr ""
500
 
501
+ #: admin/pages/dashboard.php:65 admin/pages/dashboard.php:111
502
  msgid ""
503
  "You have not yet finished setting up Google Analytics for Wordpress by "
504
  "Yoast. Please %sadd your Analytics profile here%s to enable tracking."
505
  msgstr ""
506
 
507
+ #: admin/pages/dashboard.php:100
508
  msgid "Select a dimension"
509
  msgstr ""
510
 
511
+ #: admin/pages/extensions.php:18
512
  msgid "Licenses"
513
  msgstr ""
514
 
515
+ #: admin/pages/extensions.php:36
516
+ msgid "Get this extension"
517
+ msgstr ""
518
+
519
+ #: admin/pages/extensions.php:39 vendor/yoast/license-manager/views/form.php:50
520
+ msgid "Activate License"
521
+ msgstr ""
522
+
523
+ #: admin/pages/extensions.php:41
524
+ msgid "Installed"
525
+ msgstr ""
526
+
527
+ #: admin/pages/extensions.php:51
528
  msgid ""
529
  "You have not installed any extensions for Google Analytics by Yoast, so "
530
  "there are no licenses to activate."
531
  msgstr ""
532
 
533
+ #: admin/pages/settings-api.php:17
534
  msgid "General"
535
  msgstr ""
536
 
537
+ #: admin/pages/settings-api.php:18
538
  msgid "Universal"
539
  msgstr ""
540
 
541
+ #: admin/pages/settings-api.php:19
542
  msgid "Advanced"
543
  msgstr ""
544
 
545
+ #: admin/pages/settings-api.php:21
 
 
 
 
546
  msgid "Debug mode"
547
  msgstr ""
548
 
549
+ #: admin/pages/settings-api.php:36
550
+ msgid "Cannot connect to Google"
551
  msgstr ""
552
 
553
+ #: admin/pages/settings-api.php:38
554
+ msgid ""
555
+ "Your server is blocking requests to Google, to fix this, add "
556
+ "<code>*.googleapis.com</code> to the <code>WP_ACCESSIBLE_HOSTS</code> "
557
+ "constant in your <em>wp-config.php</em> or ask your webhost to do this."
558
  msgstr ""
559
 
560
+ #: admin/pages/settings-api.php:41
561
+ msgid ""
562
+ "Your firewall or webhost is blocking requests to Google, please ask your "
563
+ "webhost company to fix this."
564
  msgstr ""
565
 
566
+ #: admin/pages/settings-api.php:43
567
+ msgid ""
568
+ "Until this is fixed, you can only use the manual authentication method and "
569
+ "cannot use the dashboards feature."
570
  msgstr ""
571
 
572
+ #: admin/pages/settings-api.php:49
573
+ msgid "Paste your Google authentication code"
574
  msgstr ""
575
 
576
+ #: admin/pages/settings-api.php:51
577
+ msgid "Paste your Google code here"
578
  msgstr ""
579
 
580
+ #: admin/pages/settings-api.php:55
581
+ msgid "Save authentication code"
582
  msgstr ""
583
 
584
+ #: admin/pages/settings-api.php:58
585
+ msgid "Authenticate with Google"
586
  msgstr ""
587
 
588
+ #: admin/pages/settings-api.php:60
589
+ msgid "Click here to authenticate with your Google account"
590
  msgstr ""
591
 
592
+ #: admin/pages/settings-api.php:63
593
+ msgid "Re-authenticate with your Google account"
594
  msgstr ""
595
 
596
+ #: admin/pages/settings-api.php:72
597
  msgid ""
598
+ "Warning: If you use a manual UA code, you won't be able to use the "
599
+ "dashboards."
 
600
  msgstr ""
601
 
602
+ #: admin/pages/settings-api.php:95
603
  msgid ""
604
+ "If you want to confirm that tracking on your blog is working as it should, "
605
+ "enable this option and check the console of your browser. Be absolutely "
606
+ "sure to disable debugging afterwards, as it is slower than normal tracking."
607
  msgstr ""
608
 
609
+ #: admin/pages/settings-api.php:96
610
+ msgid "<strong>Note</strong> the debugging is only loaded for administrators."
 
 
611
  msgstr ""
612
 
613
+ #: admin/pages/settings-api.php:116
614
+ msgid "Select the users to ignore"
615
  msgstr ""
616
 
617
+ #: admin/views/content-footer.php:14
618
+ msgid "Remove these ads?"
 
 
619
  msgstr ""
620
 
621
+ #: admin/views/content-footer.php:15
622
+ msgid "Upgrade to Google Analytics By Yoast Premium »"
623
  msgstr ""
624
 
625
+ #: admin/views/custom-dimensions-upsell.php:13
626
  msgid ""
627
+ "If you want to track custom dimensions like page views per author or post "
628
+ "type, you should upgrade to the %1$spremium version of Google Analytics by "
629
+ "Yoast%2$s."
630
  msgstr ""
631
 
632
+ #: admin/views/custom-dimensions-upsell.php:15
633
+ msgid ""
634
+ "This will also give you email access to the support team at Yoast, who will "
635
+ "provide support on the plugin 24/7."
636
  msgstr ""
637
 
638
+ #: googleanalytics.php:80
639
  msgid ""
640
+ "The Standard PHP Library (SPL) extension seem to be unavailable. Please ask "
641
+ "your web host to enable it."
 
642
  msgstr ""
643
 
644
+ #: googleanalytics.php:93
645
+ msgid ""
646
+ "The (standard) PHP filter extension seem to be unavailable. Please ask your "
647
+ "web host to enable it."
648
  msgstr ""
649
 
650
+ #: vendor/yoast/i18n-module/i18n-module.php:170
651
  msgid ""
652
+ "As you can see, there is a translation of this plugin in %1$s. This "
653
+ "translation is currently %3$d%% complete. We need your help to make it "
654
+ "complete and to fix any errors. Please register at %4$s to help complete "
655
+ "the translation to %1$s!"
656
  msgstr ""
657
 
658
+ #: vendor/yoast/i18n-module/i18n-module.php:172
659
  msgid ""
660
+ "You're using WordPress in %1$s. While %2$s has been translated to %1$s for "
661
+ "%3$d%%, it's not been shipped with the plugin yet. You can help! Register "
662
+ "at %4$s to help complete the translation to %1$s!"
663
  msgstr ""
664
 
665
+ #: vendor/yoast/i18n-module/i18n-module.php:174
666
+ msgid ""
667
+ "You're using WordPress in a language we don't support yet. We'd love for "
668
+ "%2$s to be translated in that language too, but unfortunately, it isn't "
669
+ "right now. You can change that! Register at %4$s to help translate it!"
670
+ msgstr ""
671
+
672
+ #: vendor/yoast/i18n-module/i18n-module.php:194
673
+ msgid "Translation of %s"
674
+ msgstr ""
675
+
676
+ #: vendor/yoast/i18n-module/i18n-module.php:199
677
+ msgid "Register now &raquo;"
678
  msgstr ""
679
 
680
+ #: vendor/yoast/license-manager/class-license-manager.php:138
681
  msgid ""
682
+ "<b>Warning!</b> You're blocking external requests which means you won't be "
683
+ "able to get %s updates. Please add %s to %s."
684
  msgstr ""
685
 
686
+ #: vendor/yoast/license-manager/class-license-manager.php:179
687
+ msgid "Your %s license has been activated. "
688
  msgstr ""
689
 
690
+ #: vendor/yoast/license-manager/class-license-manager.php:183
691
+ msgid "You have an unlimited license. "
692
  msgstr ""
693
 
694
+ #: vendor/yoast/license-manager/class-license-manager.php:185
695
+ msgid "You have used %d/%d activations. "
 
 
696
  msgstr ""
697
 
698
+ #: vendor/yoast/license-manager/class-license-manager.php:190
699
+ msgid "<a href=\"%s\">Did you know you can upgrade your license?</a>"
700
  msgstr ""
701
 
702
+ #: vendor/yoast/license-manager/class-license-manager.php:194
703
  msgid ""
704
+ "<a href=\"%s\">Your license is expiring in %d days, would you like to "
705
+ "extend it?</a>"
 
706
  msgstr ""
707
 
708
+ #: vendor/yoast/license-manager/class-license-manager.php:203
709
+ msgid ""
710
+ "You've reached your activation limit. You must <a href=\"%s\">upgrade your "
711
+ "license</a> to use it on this site."
712
  msgstr ""
713
 
714
+ #: vendor/yoast/license-manager/class-license-manager.php:206
715
+ msgid ""
716
+ "Your license has expired. You must <a href=\"%s\">extend your license</a> "
717
+ "in order to use it again."
718
  msgstr ""
719
 
720
+ #: vendor/yoast/license-manager/class-license-manager.php:209
721
+ msgid "Failed to activate your license, your license key seems to be invalid."
 
 
722
  msgstr ""
723
 
724
+ #: vendor/yoast/license-manager/class-license-manager.php:233
725
+ msgid "Your %s license has been deactivated."
726
  msgstr ""
727
 
728
+ #: vendor/yoast/license-manager/class-license-manager.php:235
729
+ msgid "Failed to deactivate your %s license."
730
  msgstr ""
731
 
732
+ #: vendor/yoast/license-manager/class-license-manager.php:271
733
+ msgid "Request error: \"%s\" (%scommon license notices%s)"
734
  msgstr ""
735
 
736
+ #: vendor/yoast/license-manager/class-license-manager.php:430
737
+ msgid "%s: License Settings"
 
 
738
  msgstr ""
739
 
740
+ #: vendor/yoast/license-manager/class-plugin-license-manager.php:73
741
+ msgid ""
742
+ "%s is network activated, you can manage your license in the <a "
743
+ "href=\"%s\">network admin license page</a>."
744
  msgstr ""
745
 
746
+ #: vendor/yoast/license-manager/class-plugin-license-manager.php:75
747
  msgid ""
748
+ "%s is network activated, please contact your site administrator to manage "
749
+ "the license."
 
750
  msgstr ""
751
 
752
+ #: vendor/yoast/license-manager/class-theme-license-manager.php:34
753
+ #: vendor/yoast/license-manager/samples/sample-plugin.php:53
754
+ msgid "%s License"
755
  msgstr ""
756
 
757
+ #: vendor/yoast/license-manager/class-theme-license-manager.php:34
758
+ msgid "Theme License"
759
  msgstr ""
760
 
761
+ #: vendor/yoast/license-manager/class-theme-update-manager.php:96
762
  msgid ""
763
+ "Updating this theme will lose any customizations you have made. 'Cancel' to "
764
+ "stop, 'OK' to update."
 
 
 
765
  msgstr ""
766
 
767
+ #: vendor/yoast/license-manager/class-theme-update-manager.php:101
768
+ msgid ""
769
+ "<strong>%s version %s</strong> is available. <a href=\"%s\" "
770
+ "class=\"thickbox\" title=\"%s\">Check out what's new</a> or <a href=\"%s\" "
771
+ "%s>update now</a>."
772
  msgstr ""
773
 
774
+ #: vendor/yoast/license-manager/class-update-manager.php:83
775
+ msgid "%s failed to check for updates because of the following error: <em>%s</em>"
 
 
776
  msgstr ""
777
 
778
+ #: vendor/yoast/license-manager/class-update-manager.php:153
779
+ msgid ""
780
+ "This site has not been activated properly on yoast.com and thus cannot "
781
+ "check for future updates. Please activate your site with a valid license "
782
+ "key."
783
  msgstr ""
784
 
785
+ #: vendor/yoast/license-manager/views/form.php:15
786
  msgid ""
787
+ "We couldn't create a connection to our API to verify your license key(s). "
788
+ "Please ask your hosting company to allow outgoing connections from your "
789
+ "server to %s."
790
  msgstr ""
791
 
792
+ #: vendor/yoast/license-manager/views/form.php:19
793
  msgid ""
794
+ "Your server has an outdated version of the PHP module cURL (Version: %s). "
795
+ "Please ask your hosting company to update this to a recent version of cURL. "
796
+ "You can read more about that in our %sKnowledge base%s."
797
  msgstr ""
798
 
799
+ #: vendor/yoast/license-manager/views/form.php:31
800
+ msgid "License status"
801
  msgstr ""
802
 
803
+ #: vendor/yoast/license-manager/views/form.php:41
804
+ msgid "Toggle license status"
805
  msgstr ""
806
 
807
+ #: vendor/yoast/license-manager/views/form.php:45
808
+ msgid "Deactivate License"
 
 
 
809
  msgstr ""
810
 
811
+ #: vendor/yoast/license-manager/views/form.php:46
812
+ msgid "(deactivate your license so you can activate it on another WordPress site)"
813
  msgstr ""
814
 
815
+ #: vendor/yoast/license-manager/views/form.php:52
816
+ msgid "Please enter a license key in the field below first."
817
  msgstr ""
818
 
819
+ #: vendor/yoast/license-manager/views/form.php:60
820
+ msgid "License Key"
821
  msgstr ""
822
 
823
+ #: vendor/yoast/license-manager/views/form.php:62
824
+ msgid "Paste your %s license key here.."
825
  msgstr ""
826
 
827
+ #: vendor/yoast/license-manager/views/form.php:64
828
+ msgid "You defined your license key using the %s PHP constant."
829
+ msgstr ""
830
+
831
+ #: vendor/yoast/license-manager/views/form.php:81
832
+ msgid "Your %s license will expire on %s."
833
+ msgstr ""
834
+
835
+ #: vendor/yoast/license-manager/views/form.php:84
836
+ msgid "%sRenew your license now%s."
837
  msgstr ""
838
 
839
  #. Plugin URI of the plugin/theme
857
  msgid "https://yoast.com/"
858
  msgstr ""
859
 
860
+ #: admin/dashboards/class-admin-dashboards.php:138
861
  msgctxt ""
862
  "_START_, _END_ and _TOTAL_ will be replaced by JS (See: "
863
  "http://datatables.net/reference/option/language.info)"
864
  msgid "Showing _START_ to _END_ of _TOTAL_ rows"
865
  msgstr ""
866
 
867
+ #: admin/dashboards/class-admin-dashboards.php:140
868
  msgctxt ""
869
  "_MAX_ will be replaced by JS (See: "
870
  "http://datatables.net/reference/option/language.infoFiltered)"
871
  msgid "(filtered from _MAX_ total rows)"
872
  msgstr ""
873
 
874
+ #: admin/dashboards/class-admin-dashboards.php:141
875
  msgctxt "_MAX_ will be replaced by JS"
876
  msgid "Show _MENU_ rows"
877
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://yoast.com/donate/
4
  Tags: analytics, google analytics, statistics, tracking, stats, google, yoast
5
  Requires at least: 3.8
6
  Tested up to: 4.2
7
- Stable tag: 5.3.3
8
  License: GPL v3
9
 
10
  Track your WordPress site easily with the latest tracking codes and lots added data for search result pages and error pages.
@@ -51,6 +51,24 @@ This section describes how to install the plugin and get it working.
51
 
52
  == Changelog ==
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  = 5.3.3 =
55
 
56
  Release Date: March 19th, 2015
@@ -349,7 +367,7 @@ Complete rewrite of the Google Analytics plugin.
349
 
350
  = 4.3.4 =
351
 
352
- * Bugfix:
353
  * Fixed error in a database query as reported by [mikeotgaar](http://wordpress.org/support/topic/wordpress-database-error-table-1) and applied some best practices for the database queries - props [Jrf](http://profiles.wordpress.org/jrf).
354
  * Fixed error in a database query.
355
  * Made check for customcode option more robust - props [Rarst](https://github.com/Rarst).
4
  Tags: analytics, google analytics, statistics, tracking, stats, google, yoast
5
  Requires at least: 3.8
6
  Tested up to: 4.2
7
+ Stable tag: 5.4
8
  License: GPL v3
9
 
10
  Track your WordPress site easily with the latest tracking codes and lots added data for search result pages and error pages.
51
 
52
  == Changelog ==
53
 
54
+ = 5.4 =
55
+
56
+ Release Date: April 20th, 2015
57
+
58
+ Enhancements:
59
+ * Complete technical overhaul of the way settings are being stored. Switched to WP Settings API and added input validation and sanitation for several settings.
60
+ * Made the settings more accessible by adding `for` attributes to the labels, connecting them with the corresponding form fields. Props to [Steve Repsher](https://github.com/steverep) for the awesome contribution!
61
+ * Made Universal tracking the default for new installs.
62
+ * Adds administrators to the default user roles to ignore for tracking.
63
+
64
+ Security:
65
+ * Fixes several security issues that were discovered during an elaborate security review performed by our friends from [Sucuri](https://sucuri.net/).
66
+ * Fixes two other XSS issues. Thanks to [Johannes Schmitt](https://github.com/schmittjoh) from [Scrutinizer CI](https://scrutinizer-ci.com/) and [Jouko Pynnönen](http://klikki.fi) for discovering and responsibly disclosing these issues.
67
+
68
+ Bugfixes:
69
+ * Fixes an issue where some GA dashboard style sheets and scripts were also loaded outside of the Google Analytics by Yoast dashboard, thereby unnecessarily slowing down the WP admin.
70
+ * Fixes a bug where a PHP warning could be raised on the dashboard when no data is available.
71
+
72
  = 5.3.3 =
73
 
74
  Release Date: March 19th, 2015
367
 
368
  = 4.3.4 =
369
 
370
+ * Bugfix:
371
  * Fixed error in a database query as reported by [mikeotgaar](http://wordpress.org/support/topic/wordpress-database-error-table-1) and applied some best practices for the database queries - props [Jrf](http://profiles.wordpress.org/jrf).
372
  * Fixed error in a database query.
373
  * Made check for customcode option more robust - props [Rarst](https://github.com/Rarst).
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit4bdc500f9ad408badfeb53112af5d59f::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitc25dd8530d96371aeae7c93f0fbd7210::getLoader();
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInitc7697842af642d0524332c8e2aa408d0::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInitf47bb2769d4e49c246453941d671b543::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -12,6 +12,8 @@ return array(
12
  'Yoast_GA_Admin_Assets' => $baseDir . '/admin/class-admin-assets.php',
13
  'Yoast_GA_Admin_Form' => $baseDir . '/admin/class-admin-form.php',
14
  'Yoast_GA_Admin_Menu' => $baseDir . '/admin/class-admin-menu.php',
 
 
15
  'Yoast_GA_Dashboards' => $baseDir . '/admin/dashboards/class-admin-dashboards.php',
16
  'Yoast_GA_Dashboards_Api_Options' => $baseDir . '/admin/dashboards/class-admin-dashboards-api-options.php',
17
  'Yoast_GA_Dashboards_Collector' => $baseDir . '/admin/dashboards/class-admin-dashboards-collector.php',
@@ -26,7 +28,7 @@ return array(
26
  'Yoast_GA_Frontend' => $baseDir . '/frontend/class-frontend.php',
27
  'Yoast_GA_JS' => $baseDir . '/frontend/class-ga-js.php',
28
  'Yoast_GA_Options' => $baseDir . '/includes/class-options.php',
29
- 'Yoast_GA_Settings' => $baseDir . '/includes/class-settings.php',
30
  'Yoast_GA_Tracking' => $baseDir . '/frontend/abstract-class-tracking.php',
31
  'Yoast_GA_Universal' => $baseDir . '/frontend/class-universal.php',
32
  'Yoast_GA_Utils' => $baseDir . '/includes/class-utils.php',
12
  'Yoast_GA_Admin_Assets' => $baseDir . '/admin/class-admin-assets.php',
13
  'Yoast_GA_Admin_Form' => $baseDir . '/admin/class-admin-form.php',
14
  'Yoast_GA_Admin_Menu' => $baseDir . '/admin/class-admin-menu.php',
15
+ 'Yoast_GA_Admin_Settings_Fields' => $baseDir . '/admin/class-admin-settings-fields.php',
16
+ 'Yoast_GA_Admin_Settings_Registrar' => $baseDir . '/admin/class-admin-settings-registrar.php',
17
  'Yoast_GA_Dashboards' => $baseDir . '/admin/dashboards/class-admin-dashboards.php',
18
  'Yoast_GA_Dashboards_Api_Options' => $baseDir . '/admin/dashboards/class-admin-dashboards-api-options.php',
19
  'Yoast_GA_Dashboards_Collector' => $baseDir . '/admin/dashboards/class-admin-dashboards-collector.php',
28
  'Yoast_GA_Frontend' => $baseDir . '/frontend/class-frontend.php',
29
  'Yoast_GA_JS' => $baseDir . '/frontend/class-ga-js.php',
30
  'Yoast_GA_Options' => $baseDir . '/includes/class-options.php',
31
+ 'Yoast_GA_Options_Utils' => $baseDir . '/includes/class-options-utils.php',
32
  'Yoast_GA_Tracking' => $baseDir . '/frontend/abstract-class-tracking.php',
33
  'Yoast_GA_Universal' => $baseDir . '/frontend/class-universal.php',
34
  'Yoast_GA_Utils' => $baseDir . '/includes/class-utils.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit4bdc500f9ad408badfeb53112af5d59f
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit4bdc500f9ad408badfeb53112af5d59f
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit4bdc500f9ad408badfeb53112af5d59f', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit4bdc500f9ad408badfeb53112af5d59f', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
@@ -44,7 +44,7 @@ class ComposerAutoloaderInit4bdc500f9ad408badfeb53112af5d59f
44
  }
45
  }
46
 
47
- function composerRequire4bdc500f9ad408badfeb53112af5d59f($file)
48
  {
49
  require $file;
50
  }
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitc25dd8530d96371aeae7c93f0fbd7210
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitc25dd8530d96371aeae7c93f0fbd7210', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitc25dd8530d96371aeae7c93f0fbd7210', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
44
  }
45
  }
46
 
47
+ function composerRequirec25dd8530d96371aeae7c93f0fbd7210($file)
48
  {
49
  require $file;
50
  }
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInitc7697842af642d0524332c8e2aa408d0 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitc7697842af642d0524332c8e2aa408d0 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitc7697842af642d0524332c8e2aa408d0', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitc7697842af642d0524332c8e2aa408d0', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInitf47bb2769d4e49c246453941d671b543 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitf47bb2769d4e49c246453941d671b543', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitf47bb2769d4e49c246453941d671b543', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
vendor/composer/installed.json CHANGED
@@ -1,17 +1,17 @@
1
  [
2
  {
3
  "name": "composer/installers",
4
- "version": "v1.0.20",
5
- "version_normalized": "1.0.20.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/composer/installers.git",
9
- "reference": "1bff8aa77a18f3616f468ed8000cf86a5725bac3"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/composer/installers/zipball/1bff8aa77a18f3616f468ed8000cf86a5725bac3",
14
- "reference": "1bff8aa77a18f3616f468ed8000cf86a5725bac3",
15
  "shasum": ""
16
  },
17
  "replace": {
@@ -22,7 +22,7 @@
22
  "composer/composer": "1.0.*@dev",
23
  "phpunit/phpunit": "4.1.*"
24
  },
25
- "time": "2015-01-11 03:51:11",
26
  "type": "composer-installer",
27
  "extra": {
28
  "class": "Composer\\Installers\\Installer",
@@ -30,7 +30,7 @@
30
  "dev-master": "1.0-dev"
31
  }
32
  },
33
- "installation-source": "dist",
34
  "autoload": {
35
  "psr-0": {
36
  "Composer\\Installers\\": "src/"
@@ -59,6 +59,7 @@
59
  "Thelia",
60
  "WolfCMS",
61
  "agl",
 
62
  "annotatecms",
63
  "bitrix",
64
  "cakephp",
@@ -97,27 +98,27 @@
97
  },
98
  {
99
  "name": "xrstf/composer-php52",
100
- "version": "v1.0.17",
101
- "version_normalized": "1.0.17.0",
102
  "source": {
103
  "type": "hg",
104
  "url": "https://bitbucket.org/xrstf/composer-php52",
105
- "reference": "70b853668d6c3f97b63dafcfaeebb622bf08fd30"
106
  },
107
  "dist": {
108
  "type": "zip",
109
- "url": "https://bitbucket.org/xrstf/composer-php52/get/70b853668d6c3f97b63dafcfaeebb622bf08fd30.zip",
110
- "reference": "70b853668d6c3f97b63dafcfaeebb622bf08fd30",
111
  "shasum": ""
112
  },
113
- "time": "2015-02-01 14:28:15",
114
  "type": "library",
115
  "extra": {
116
  "branch-alias": {
117
  "dev-default": "1.x-dev"
118
  }
119
  },
120
- "installation-source": "dist",
121
  "autoload": {
122
  "psr-0": {
123
  "xrstf\\Composer52": "lib/"
@@ -176,15 +177,15 @@
176
  "source": {
177
  "type": "git",
178
  "url": "https://github.com/Yoast/i18n-module.git",
179
- "reference": "b391683ca3e0a714c1c8bede8cf5e32c48274216"
180
  },
181
  "dist": {
182
  "type": "zip",
183
- "url": "https://api.github.com/repos/Yoast/i18n-module/zipball/b391683ca3e0a714c1c8bede8cf5e32c48274216",
184
- "reference": "b391683ca3e0a714c1c8bede8cf5e32c48274216",
185
  "shasum": ""
186
  },
187
- "time": "2015-01-29 09:52:51",
188
  "type": "library",
189
  "installation-source": "source",
190
  "autoload": {
@@ -216,15 +217,15 @@
216
  "source": {
217
  "type": "git",
218
  "url": "https://github.com/Yoast/License-Manager.git",
219
- "reference": "590ec054383c5e609c78cd4aee03bc8e9d9742cc"
220
  },
221
  "dist": {
222
  "type": "zip",
223
- "url": "https://api.github.com/repos/Yoast/License-Manager/zipball/590ec054383c5e609c78cd4aee03bc8e9d9742cc",
224
- "reference": "590ec054383c5e609c78cd4aee03bc8e9d9742cc",
225
  "shasum": ""
226
  },
227
- "time": "2015-01-19 09:14:58",
228
  "type": "library",
229
  "installation-source": "source",
230
  "autoload": {
1
  [
2
  {
3
  "name": "composer/installers",
4
+ "version": "dev-master",
5
+ "version_normalized": "9999999-dev",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/composer/installers.git",
9
+ "reference": "f8c20b427de1cfe7a28a015c1640ce4e4eef1e33"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/composer/installers/zipball/f8c20b427de1cfe7a28a015c1640ce4e4eef1e33",
14
+ "reference": "f8c20b427de1cfe7a28a015c1640ce4e4eef1e33",
15
  "shasum": ""
16
  },
17
  "replace": {
22
  "composer/composer": "1.0.*@dev",
23
  "phpunit/phpunit": "4.1.*"
24
  },
25
+ "time": "2015-03-26 16:11:30",
26
  "type": "composer-installer",
27
  "extra": {
28
  "class": "Composer\\Installers\\Installer",
30
  "dev-master": "1.0-dev"
31
  }
32
  },
33
+ "installation-source": "source",
34
  "autoload": {
35
  "psr-0": {
36
  "Composer\\Installers\\": "src/"
59
  "Thelia",
60
  "WolfCMS",
61
  "agl",
62
+ "aimeos",
63
  "annotatecms",
64
  "bitrix",
65
  "cakephp",
98
  },
99
  {
100
  "name": "xrstf/composer-php52",
101
+ "version": "dev-default",
102
+ "version_normalized": "9999999-dev",
103
  "source": {
104
  "type": "hg",
105
  "url": "https://bitbucket.org/xrstf/composer-php52",
106
+ "reference": "717c00a8bec1b40401384536d2ebaea57c7c35d4"
107
  },
108
  "dist": {
109
  "type": "zip",
110
+ "url": "https://bitbucket.org/xrstf/composer-php52/get/717c00a8bec1b40401384536d2ebaea57c7c35d4.zip",
111
+ "reference": "717c00a8bec1b40401384536d2ebaea57c7c35d4",
112
  "shasum": ""
113
  },
114
+ "time": "2015-02-01 13:29:12",
115
  "type": "library",
116
  "extra": {
117
  "branch-alias": {
118
  "dev-default": "1.x-dev"
119
  }
120
  },
121
+ "installation-source": "source",
122
  "autoload": {
123
  "psr-0": {
124
  "xrstf\\Composer52": "lib/"
177
  "source": {
178
  "type": "git",
179
  "url": "https://github.com/Yoast/i18n-module.git",
180
+ "reference": "6d366c5b19d2068e3bb1c9bb4b9d17c0dd9566a8"
181
  },
182
  "dist": {
183
  "type": "zip",
184
+ "url": "https://api.github.com/repos/Yoast/i18n-module/zipball/6d366c5b19d2068e3bb1c9bb4b9d17c0dd9566a8",
185
+ "reference": "6d366c5b19d2068e3bb1c9bb4b9d17c0dd9566a8",
186
  "shasum": ""
187
  },
188
+ "time": "2015-04-15 06:48:03",
189
  "type": "library",
190
  "installation-source": "source",
191
  "autoload": {
217
  "source": {
218
  "type": "git",
219
  "url": "https://github.com/Yoast/License-Manager.git",
220
+ "reference": "8caf52202bf51011686e31c9a43b18731047f1be"
221
  },
222
  "dist": {
223
  "type": "zip",
224
+ "url": "https://api.github.com/repos/Yoast/License-Manager/zipball/8caf52202bf51011686e31c9a43b18731047f1be",
225
+ "reference": "8caf52202bf51011686e31c9a43b18731047f1be",
226
  "shasum": ""
227
  },
228
+ "time": "2015-03-16 11:51:33",
229
  "type": "library",
230
  "installation-source": "source",
231
  "autoload": {
vendor/composer/installers/README.md CHANGED
@@ -33,8 +33,10 @@ is not needed to install packages with these frameworks:
33
 
34
  | Framework | Types
35
  | --------- | -----
36
- | Asgard | `asgard-module`<br>`asgard-theme`
 
37
  | AGL | `agl-module`
 
38
  | AnnotateCms | `annotatecms-module`<br>`annotatecms-component`<br>`annotatecms-service`
39
  | Bitrix | `bitrix-module`<br>`bitrix-component`<br>`bitrix-theme`
40
  | CakePHP 2+ | **`cakephp-plugin`**
@@ -54,6 +56,7 @@ is not needed to install packages with these frameworks:
54
  | Hurad | `hurad-plugin`<br>`hurad-theme`
55
  | Joomla | `joomla-component`<br>`joomla-module`<br>`joomla-template`<br>`joomla-plugin`<br>`joomla-library`
56
  | Kirby | **`kirby-plugin`**
 
57
  | Kohana | **`kohana-module`**
58
  | Laravel | `laravel-library`
59
  | Lithium | **`lithium-library`<br>`lithium-source`**
@@ -83,6 +86,7 @@ is not needed to install packages with these frameworks:
83
  | WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin`
84
  | Zend | `zend-library`<br>`zend-extra`<br>`zend-module`
85
  | Zikula | `zikula-module`<br>`zikula-theme`
 
86
 
87
  ## Example `composer.json` File
88
 
33
 
34
  | Framework | Types
35
  | --------- | -----
36
+ | Aimeos | `aimeos-extension`
37
+ | Asgard | `asgard-module`<br>`asgard-theme`
38
  | AGL | `agl-module`
39
+ | Bonefish | `bonefish-package`
40
  | AnnotateCms | `annotatecms-module`<br>`annotatecms-component`<br>`annotatecms-service`
41
  | Bitrix | `bitrix-module`<br>`bitrix-component`<br>`bitrix-theme`
42
  | CakePHP 2+ | **`cakephp-plugin`**
56
  | Hurad | `hurad-plugin`<br>`hurad-theme`
57
  | Joomla | `joomla-component`<br>`joomla-module`<br>`joomla-template`<br>`joomla-plugin`<br>`joomla-library`
58
  | Kirby | **`kirby-plugin`**
59
+ | KodiCMS | `kodicms-plugin`<br>`kodicms-media`
60
  | Kohana | **`kohana-module`**
61
  | Laravel | `laravel-library`
62
  | Lithium | **`lithium-library`<br>`lithium-source`**
86
  | WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin`
87
  | Zend | `zend-library`<br>`zend-extra`<br>`zend-module`
88
  | Zikula | `zikula-module`<br>`zikula-theme`
89
+ | Prestashop | `prestashop-module`<br>`prestashop-theme`
90
 
91
  ## Example `composer.json` File
92
 
vendor/composer/installers/composer.json CHANGED
@@ -5,6 +5,7 @@
5
  "description": "A multi-framework Composer library installer",
6
  "keywords": [
7
  "installer",
 
8
  "AGL",
9
  "AnnotateCms",
10
  "Bitrix",
5
  "description": "A multi-framework Composer library installer",
6
  "keywords": [
7
  "installer",
8
+ "Aimeos",
9
  "AGL",
10
  "AnnotateCms",
11
  "Bitrix",
vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class AimeosInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'ext/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class BonefishInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'package' => 'Packages/{$vendor}/{$name}/'
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php CHANGED
@@ -17,6 +17,10 @@ class CakePHPInstaller extends BaseInstaller
17
  */
18
  public function inflectPackageVars($vars)
19
  {
 
 
 
 
20
  $nameParts = explode('/', $vars['name']);
21
  foreach ($nameParts as &$value) {
22
  $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
@@ -34,27 +38,11 @@ class CakePHPInstaller extends BaseInstaller
34
  public function getLocations()
35
  {
36
  if ($this->matchesCakeVersion('>=', '3.0.0')) {
37
- $this->locations['plugin'] = 'plugins/{$name}/';
38
  }
39
  return $this->locations;
40
  }
41
 
42
- /**
43
- * Add installer-name for CakePHP >= 3.0.0
44
- *
45
- * @param PackageInterface $package
46
- * @param string $frameworkType
47
- * @return string
48
- */
49
- public function getInstallPath(PackageInterface $package, $frameworkType = '')
50
- {
51
- $extra = $package->getExtra();
52
- if (empty($extra['installer-name']) && $this->matchesCakeVersion('>=', '3.0.0')) {
53
- $this->setInstallerName($package);
54
- }
55
- return parent::getInstallPath($package, $frameworkType);
56
- }
57
-
58
  /**
59
  * Check if CakePHP version matches against a version
60
  *
@@ -87,59 +75,4 @@ class CakePHPInstaller extends BaseInstaller
87
  }
88
  return false;
89
  }
90
-
91
- /**
92
- * Set installer-name based on namespace for the source path checking in
93
- * following order:
94
- *
95
- * - With only one autoload path the namespace for that path will be used.
96
- * - With multiple paths if path 'src' exists it's namespace will be used.
97
- * - With two autoload paths provided, the namespace of path other than
98
- * 'tests' will be used.
99
- *
100
- * No installer-name is set if PSR-4 autoload block is not found or if none
101
- * of the above conditions are met.
102
- *
103
- * @param PackageInterface $package
104
- */
105
- protected function setInstallerName(PackageInterface $package)
106
- {
107
- $primaryNS = null;
108
- $autoLoad = $package->getAutoload();
109
- foreach ($autoLoad as $type => $typeConfig) {
110
- if ($type !== 'psr-4') {
111
- continue;
112
- }
113
- $count = count($typeConfig);
114
-
115
- if ($count === 1) {
116
- $primaryNS = key($typeConfig);
117
- break;
118
- }
119
-
120
- $matches = preg_grep('#^(\./)?src/?$#', $typeConfig);
121
- if ($matches) {
122
- $primaryNS = key($matches);
123
- break;
124
- }
125
-
126
- if ($count === 2) {
127
- reset($typeConfig);
128
- if (preg_match('#^(\./)?tests/?$#', current($typeConfig))) {
129
- next($typeConfig);
130
- }
131
- $primaryNS = key($typeConfig);
132
- break;
133
- }
134
-
135
- break;
136
- }
137
-
138
- if ($primaryNS) {
139
- $package->setExtra(array(
140
- 'installer-name' => trim(str_replace('\\', '/', $primaryNS), '/')
141
- ));
142
- }
143
- }
144
-
145
  }
17
  */
18
  public function inflectPackageVars($vars)
19
  {
20
+ if ($this->matchesCakeVersion('>=', '3.0.0')) {
21
+ return $vars;
22
+ }
23
+
24
  $nameParts = explode('/', $vars['name']);
25
  foreach ($nameParts as &$value) {
26
  $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
38
  public function getLocations()
39
  {
40
  if ($this->matchesCakeVersion('>=', '3.0.0')) {
41
+ $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
42
  }
43
  return $this->locations;
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * Check if CakePHP version matches against a version
48
  *
75
  }
76
  return false;
77
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  }
vendor/composer/installers/src/Composer/Installers/Installer.php CHANGED
@@ -13,10 +13,12 @@ class Installer extends LibraryInstaller
13
  * @var array
14
  */
15
  private $supportedTypes = array(
 
16
  'asgard' => 'AsgardInstaller',
17
  'agl' => 'AglInstaller',
18
  'annotatecms' => 'AnnotateCmsInstaller',
19
  'bitrix' => 'BitrixInstaller',
 
20
  'cakephp' => 'CakePHPInstaller',
21
  'chef' => 'ChefInstaller',
22
  'ccframework' => 'ClanCatsFrameworkInstaller',
@@ -34,6 +36,7 @@ class Installer extends LibraryInstaller
34
  'hurad' => 'HuradInstaller',
35
  'joomla' => 'JoomlaInstaller',
36
  'kirby' => 'KirbyInstaller',
 
37
  'kohana' => 'KohanaInstaller',
38
  'laravel' => 'LaravelInstaller',
39
  'lithium' => 'LithiumInstaller',
@@ -66,6 +69,7 @@ class Installer extends LibraryInstaller
66
  'wordpress' => 'WordPressInstaller',
67
  'zend' => 'ZendInstaller',
68
  'zikula' => 'ZikulaInstaller',
 
69
  );
70
 
71
  /**
13
  * @var array
14
  */
15
  private $supportedTypes = array(
16
+ 'aimeos' => 'AimeosInstaller',
17
  'asgard' => 'AsgardInstaller',
18
  'agl' => 'AglInstaller',
19
  'annotatecms' => 'AnnotateCmsInstaller',
20
  'bitrix' => 'BitrixInstaller',
21
+ 'bonefish' => 'BonefishInstaller',
22
  'cakephp' => 'CakePHPInstaller',
23
  'chef' => 'ChefInstaller',
24
  'ccframework' => 'ClanCatsFrameworkInstaller',
36
  'hurad' => 'HuradInstaller',
37
  'joomla' => 'JoomlaInstaller',
38
  'kirby' => 'KirbyInstaller',
39
+ 'kodicms' => 'KodiCMSInstaller',
40
  'kohana' => 'KohanaInstaller',
41
  'laravel' => 'LaravelInstaller',
42
  'lithium' => 'LithiumInstaller',
69
  'wordpress' => 'WordPressInstaller',
70
  'zend' => 'ZendInstaller',
71
  'zikula' => 'ZikulaInstaller',
72
+ 'prestashop' => 'PrestashopInstaller'
73
  );
74
 
75
  /**
vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class KodiCMSInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'cms/plugins/{$name}/',
8
+ 'media' => 'cms/media/vendor/{$name}/'
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PrestashopInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php CHANGED
@@ -9,6 +9,7 @@ use Composer\Package\RootPackage;
9
  use Composer\Package\Link;
10
  use Composer\Package\Version\VersionParser;
11
  use Composer\Composer;
 
12
 
13
  class CakePHPInstallerTest extends TestCase
14
  {
@@ -25,6 +26,7 @@ class CakePHPInstallerTest extends TestCase
25
  $this->package = new Package('CamelCased', '1.0', '1.0');
26
  $this->io = $this->getMock('Composer\IO\PackageInterface');
27
  $this->composer = new Composer();
 
28
  }
29
 
30
  /**
@@ -61,7 +63,7 @@ class CakePHPInstallerTest extends TestCase
61
  */
62
  public function testGetLocations() {
63
  $package = new RootPackage('CamelCased', '1.0', '1.0');
64
- $composer = new Composer();
65
  $rm = new RepositoryManager(
66
  $this->getMock('Composer\IO\IOInterface'),
67
  $this->getMock('Composer\Config')
@@ -94,61 +96,11 @@ class CakePHPInstallerTest extends TestCase
94
  // cakephp >= 3.0
95
  $this->setCakephpVersion($rm, '3.0.*-dev');
96
  $result = $installer->getLocations();
97
- $this->assertContains('plugins/', $result['plugin']);
98
 
99
  $this->setCakephpVersion($rm, '~8.8');
100
  $result = $installer->getLocations();
101
- $this->assertContains('plugins/', $result['plugin']);
102
- }
103
-
104
- /**
105
- * Test if installer-name was set
106
- *
107
- */
108
- public function testGetInstallPath() {
109
- $autoload = array(
110
- 'psr-4' => array(
111
- 'FOC\\Authenticate' => ''
112
- )
113
- );
114
- $this->package->setAutoload($autoload);
115
- $this->package->setType('cakephp-plugin');
116
- $rm = new RepositoryManager(
117
- $this->getMock('Composer\IO\IOInterface'),
118
- $this->getMock('Composer\Config')
119
- );
120
- $this->composer->setRepositoryManager($rm);
121
- $installer = new CakePHPInstaller($this->package, $this->composer);
122
-
123
- $this->setCakephpVersion($rm, '3.0.0');
124
- $installer->getInstallPath($this->package, 'cakephp');
125
- $extra = $this->package->getExtra();
126
- $this->assertEquals('FOC/Authenticate', $extra['installer-name']);
127
-
128
- $autoload = array(
129
- 'psr-4' => array(
130
- 'FOC\Acl\Test' => './tests',
131
- 'FOC\Acl' => ''
132
- )
133
- );
134
- $this->package->setAutoload($autoload);
135
- $this->package->setExtra(array());
136
- $installer->getInstallPath($this->package, 'cakephp');
137
- $extra = $this->package->getExtra();
138
- $this->assertEquals('FOC/Acl', $extra['installer-name']);
139
-
140
- $autoload = array(
141
- 'psr-4' => array(
142
- 'Foo\Bar' => 'foo',
143
- 'Acme\Plugin\Test' => 'tests',
144
- 'Acme\Plugin' => './src'
145
- )
146
- );
147
- $this->package->setAutoload($autoload);
148
- $this->package->setExtra(array());
149
- $installer->getInstallPath($this->package, 'cakephp');
150
- $extra = $this->package->getExtra();
151
- $this->assertEquals('Acme/Plugin', $extra['installer-name']);
152
  }
153
 
154
  protected function setCakephpVersion($rm, $version) {
9
  use Composer\Package\Link;
10
  use Composer\Package\Version\VersionParser;
11
  use Composer\Composer;
12
+ use Composer\Config;
13
 
14
  class CakePHPInstallerTest extends TestCase
15
  {
26
  $this->package = new Package('CamelCased', '1.0', '1.0');
27
  $this->io = $this->getMock('Composer\IO\PackageInterface');
28
  $this->composer = new Composer();
29
+ $this->composer->setConfig(new Config(false));
30
  }
31
 
32
  /**
63
  */
64
  public function testGetLocations() {
65
  $package = new RootPackage('CamelCased', '1.0', '1.0');
66
+ $composer = $this->composer;
67
  $rm = new RepositoryManager(
68
  $this->getMock('Composer\IO\IOInterface'),
69
  $this->getMock('Composer\Config')
96
  // cakephp >= 3.0
97
  $this->setCakephpVersion($rm, '3.0.*-dev');
98
  $result = $installer->getLocations();
99
+ $this->assertContains('vendor/{$vendor}/{$name}/', $result['plugin']);
100
 
101
  $this->setCakephpVersion($rm, '~8.8');
102
  $result = $installer->getLocations();
103
+ $this->assertContains('vendor/{$vendor}/{$name}/', $result['plugin']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  }
105
 
106
  protected function setCakephpVersion($rm, $version) {
vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php CHANGED
@@ -85,12 +85,14 @@ class InstallerTest extends TestCase
85
  {
86
  return array(
87
  array('agl-module', true),
 
88
  array('annotatecms-module', true),
89
  array('annotatecms-component', true),
90
  array('annotatecms-service', true),
91
  array('bitrix-module', true),
92
  array('bitrix-component', true),
93
  array('bitrix-theme', true),
 
94
  array('cakephp', false),
95
  array('cakephp-', false),
96
  array('cakephp-app', false),
@@ -142,6 +144,8 @@ class InstallerTest extends TestCase
142
  array('phpbb-extension', true),
143
  array('pimcore-plugin', true),
144
  array('ppi-module', true),
 
 
145
  array('puppet-module', true),
146
  array('redaxo-addon', true),
147
  array('redaxo-bestyle-plugin', true),
@@ -170,6 +174,8 @@ class InstallerTest extends TestCase
170
  array('zend-library', true),
171
  array('zikula-module', true),
172
  array('zikula-theme', true),
 
 
173
  );
174
  }
175
 
@@ -195,12 +201,14 @@ class InstallerTest extends TestCase
195
  {
196
  return array(
197
  array('agl-module', 'More/MyTestPackage/', 'agl/my_test-package'),
 
198
  array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'),
199
  array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'),
200
  array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'),
201
  array('bitrix-module', 'local/modules/my_module/', 'author/my_module'),
202
  array('bitrix-component', 'local/components/my_component/', 'author/my_component'),
203
  array('bitrix-theme', 'local/templates/my_theme/', 'author/my_theme'),
 
204
  array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'),
205
  array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'),
206
  array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'),
@@ -252,6 +260,8 @@ class InstallerTest extends TestCase
252
  array('october-plugin', 'plugins/shama/my_plugin/', 'shama/my_plugin'),
253
  array('october-theme', 'themes/my_theme/', 'shama/my_theme'),
254
  array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'),
 
 
255
  array('phpbb-extension', 'ext/test/foo/', 'test/foo'),
256
  array('phpbb-style', 'styles/foo/', 'test/foo'),
257
  array('phpbb-language', 'language/foo/', 'test/foo'),
@@ -291,6 +301,8 @@ class InstallerTest extends TestCase
291
  array('zend-extra', 'extras/library/zend_test/', 'shama/zend_test'),
292
  array('zikula-module', 'modules/my-test_module/', 'my/test_module'),
293
  array('zikula-theme', 'themes/my-test_theme/', 'my/test_theme'),
 
 
294
  );
295
  }
296
 
85
  {
86
  return array(
87
  array('agl-module', true),
88
+ array('aimeos-extension', true),
89
  array('annotatecms-module', true),
90
  array('annotatecms-component', true),
91
  array('annotatecms-service', true),
92
  array('bitrix-module', true),
93
  array('bitrix-component', true),
94
  array('bitrix-theme', true),
95
+ array('bonefish-package', true),
96
  array('cakephp', false),
97
  array('cakephp-', false),
98
  array('cakephp-app', false),
144
  array('phpbb-extension', true),
145
  array('pimcore-plugin', true),
146
  array('ppi-module', true),
147
+ array('prestashop-module', true),
148
+ array('prestashop-theme', true),
149
  array('puppet-module', true),
150
  array('redaxo-addon', true),
151
  array('redaxo-bestyle-plugin', true),
174
  array('zend-library', true),
175
  array('zikula-module', true),
176
  array('zikula-theme', true),
177
+ array('kodicms-plugin', true),
178
+ array('kodicms-media', true),
179
  );
180
  }
181
 
201
  {
202
  return array(
203
  array('agl-module', 'More/MyTestPackage/', 'agl/my_test-package'),
204
+ array('aimeos-extension', 'ext/ai-test/', 'author/ai-test'),
205
  array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'),
206
  array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'),
207
  array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'),
208
  array('bitrix-module', 'local/modules/my_module/', 'author/my_module'),
209
  array('bitrix-component', 'local/components/my_component/', 'author/my_component'),
210
  array('bitrix-theme', 'local/templates/my_theme/', 'author/my_theme'),
211
+ array('bonefish-package', 'Packages/bonefish/package/', 'bonefish/package'),
212
  array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'),
213
  array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'),
214
  array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'),
260
  array('october-plugin', 'plugins/shama/my_plugin/', 'shama/my_plugin'),
261
  array('october-theme', 'themes/my_theme/', 'shama/my_theme'),
262
  array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'),
263
+ array('prestashop-module', 'modules/a-module/', 'vendor/a-module'),
264
+ array('prestashop-theme', 'themes/a-theme/', 'vendor/a-theme'),
265
  array('phpbb-extension', 'ext/test/foo/', 'test/foo'),
266
  array('phpbb-style', 'styles/foo/', 'test/foo'),
267
  array('phpbb-language', 'language/foo/', 'test/foo'),
301
  array('zend-extra', 'extras/library/zend_test/', 'shama/zend_test'),
302
  array('zikula-module', 'modules/my-test_module/', 'my/test_module'),
303
  array('zikula-theme', 'themes/my-test_theme/', 'my/test_theme'),
304
+ array('kodicms-media', 'cms/media/vendor/my_media/', 'shama/my_media'),
305
+ array('kodicms-plugin', 'cms/plugins/my_plugin/', 'shama/my_plugin'),
306
  );
307
  }
308
 
vendor/xrstf/composer-php52/.hg/00changelog.i ADDED
Binary file
vendor/xrstf/composer-php52/.hg/branch ADDED
@@ -0,0 +1 @@
 
1
+ default
vendor/xrstf/composer-php52/.hg/cache/branch2-served ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ 717c00a8bec1b40401384536d2ebaea57c7c35d4 49
2
+ 717c00a8bec1b40401384536d2ebaea57c7c35d4 o default
3
+ d1e08e2d82fc290b637c6b416899da45ed743e64 o fix-4
4
+ 302eef74e7d25bc741f16316c6d332419111ea42 o fix_composer_compatibility
vendor/xrstf/composer-php52/.hg/cache/rbc-names-v1 ADDED
Binary file
vendor/xrstf/composer-php52/.hg/cache/rbc-revs-v1 ADDED
Binary file
vendor/xrstf/composer-php52/.hg/dirstate ADDED
Binary file
vendor/xrstf/composer-php52/.hg/hgrc ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # example repository config (see "hg help config" for more info)
2
+ [paths]
3
+ default = https://bitbucket.org/xrstf/composer-php52
4
+
5
+ # path aliases to other clones of this repo in URLs or filesystem paths
6
+ # (see "hg help config.paths" for more info)
7
+ #
8
+ # default-push = ssh://jdoe@example.net/hg/jdoes-fork
9
+ # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
10
+ # my-clone = /home/jdoe/jdoes-clone
11
+
12
+ [ui]
13
+ # name and email (local to this repository, optional), e.g.
14
+ # username = Jane Doe <jdoe@example.com>
vendor/xrstf/composer-php52/.hg/requires ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ dotencode
2
+ fncache
3
+ revlogv1
4
+ store
vendor/xrstf/composer-php52/.hg/store/00changelog.i ADDED
Binary file
vendor/xrstf/composer-php52/.hg/store/00manifest.i ADDED
Binary file
vendor/xrstf/composer-php52/.hg/store/data/_l_i_c_e_n_s_e.i ADDED
Binary file
vendor/xrstf/composer-php52/.hg/store/data/_r_e_a_d_m_e.md.i ADDED
Binary file
vendor/xrstf/composer-php52/.hg/store/data/composer.json.i ADDED
Binary file
vendor/xrstf/composer-php52/.hg/store/data/lib/xrstf/_composer52/_autoload_generator.php.i ADDED
Binary file
vendor/xrstf/composer-php52/.hg/store/data/lib/xrstf/_composer52/_class_loader.php.i ADDED
Binary file
vendor/xrstf/composer-php52/.hg/store/data/lib/xrstf/_composer52/_generator.php.i ADDED
Binary file
vendor/xrstf/composer-php52/.hg/store/data/~2ehgtags.i ADDED
Binary file
vendor/xrstf/composer-php52/.hg/store/fncache ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ data/lib/xrstf/Composer52/Generator.php.i
2
+ data/lib/xrstf/Composer52/ClassLoader.php.i
3
+ data/lib/xrstf/Composer52/AutoloadGenerator.php.i
4
+ data/.hgtags.i
5
+ data/LICENSE.i
6
+ data/composer.json.i
7
+ data/README.md.i
vendor/xrstf/composer-php52/.hg/store/phaseroots ADDED
File without changes
vendor/xrstf/composer-php52/.hg/store/undo ADDED
Binary file
vendor/xrstf/composer-php52/.hg/store/undo.backupfiles ADDED
Binary file
vendor/xrstf/composer-php52/.hg/store/undo.phaseroots ADDED
File without changes
vendor/xrstf/composer-php52/.hg/undo.bookmarks ADDED
File without changes
vendor/xrstf/composer-php52/.hg/undo.branch ADDED
@@ -0,0 +1 @@
 
1
+ default
vendor/xrstf/composer-php52/.hg/undo.desc ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ 0
2
+ pull
3
+ https://bitbucket.org/xrstf/composer-php52
vendor/xrstf/composer-php52/.hg/undo.dirstate ADDED
File without changes
vendor/xrstf/composer-php52/.hg_archival.txt DELETED
@@ -1,4 +0,0 @@
1
- repo: 0d0ceaca3a0500b3f45b41b79c6ac4f396dc4b13
2
- node: 70b853668d6c3f97b63dafcfaeebb622bf08fd30
3
- branch: default
4
- tag: v1.0.17
 
 
 
 
vendor/xrstf/composer-php52/.hgtags CHANGED
@@ -15,3 +15,4 @@ eabb654da4d9200180037805cf348c20caf775c2 v1.0.13
15
  8cc8f6ceddf527eafd0cd7b4cb274bef39d27a92 v1.0.14
16
  b69d211ed4885e3c16282b01b7548226c7b50657 v1.0.15
17
  b80de08b940ea59789646fa20d841fbdd72d72f0 v1.0.16
 
15
  8cc8f6ceddf527eafd0cd7b4cb274bef39d27a92 v1.0.14
16
  b69d211ed4885e3c16282b01b7548226c7b50657 v1.0.15
17
  b80de08b940ea59789646fa20d841fbdd72d72f0 v1.0.16
18
+ 70b853668d6c3f97b63dafcfaeebb622bf08fd30 v1.0.17
vendor/yoast/i18n-module/i18n-module.php CHANGED
@@ -190,7 +190,7 @@ class yoast_i18n {
190
 
191
  if ( $message ) {
192
  echo '<div id="i18n_promo_box" style="border:1px solid #ccc;background-color:#fff;padding:10px;max-width:650px;">';
193
- echo '<a href="' . add_query_arg( array( 'remove_i18n_promo' => '1' ) ) . '" style="color:#333;text-decoration:none;font-weight:bold;font-size:16px;border:1px solid #ccc;padding:1px 4px;" class="alignright">X</a>';
194
  echo '<h2>' . sprintf( __( 'Translation of %s', $this->textdomain ), $this->plugin_name ) . '</h2>';
195
  if ( isset( $this->glotpress_logo ) && '' != $this->glotpress_logo ) {
196
  echo '<a href="' . $this->register_url . '"><img class="alignright" style="margin:15px 5px 5px 5px;width:200px;" src="' . $this->glotpress_logo . '" alt="' . $this->glotpress_name . '"/></a>';
190
 
191
  if ( $message ) {
192
  echo '<div id="i18n_promo_box" style="border:1px solid #ccc;background-color:#fff;padding:10px;max-width:650px;">';
193
+ echo '<a href="' . esc_url( add_query_arg( array( 'remove_i18n_promo' => '1' ) ) ) . '" style="color:#333;text-decoration:none;font-weight:bold;font-size:16px;border:1px solid #ccc;padding:1px 4px;" class="alignright">X</a>';
194
  echo '<h2>' . sprintf( __( 'Translation of %s', $this->textdomain ), $this->plugin_name ) . '</h2>';
195
  if ( isset( $this->glotpress_logo ) && '' != $this->glotpress_logo ) {
196
  echo '<a href="' . $this->register_url . '"><img class="alignright" style="margin:15px 5px 5px 5px;width:200px;" src="' . $this->glotpress_logo . '" alt="' . $this->glotpress_name . '"/></a>';
vendor/yoast/license-manager/.gitigore ADDED
@@ -0,0 +1,2 @@
 
 
1
+ .idea/
2
+ .idea/*
vendor/yoast/license-manager/.travis.yml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+
3
+ php: '5.5'
4
+
5
+ sudo: false
6
+
7
+ env:
8
+ - WP_VERSION=master WP_MULTISITE=0 PHPLINT=1
9
+
10
+ matrix:
11
+ include:
12
+ - php: '5.5'
13
+ env: WP_VERSION=4.0 WP_MULTISITE=1
14
+ - php: '5.4'
15
+ env: WP_VERSION=4.0 WP_MULTISITE=0
16
+ - php: '5.4'
17
+ env: WP_VERSION=4.0 WP_MULTISITE=1
18
+ - php: '5.5'
19
+ env: WP_VERSION=4.0 WP_MULTISITE=0
20
+ - php: '5.5'
21
+ env: WP_VERSION=3.9 WP_MULTISITE=1
22
+ - php: '5.3'
23
+ env: WP_VERSION=3.9 WP_MULTISITE=0
24
+ - php: '5.2'
25
+ env: WP_VERSION=master WP_MULTISITE=1 PHPLINT=1
26
+
27
+ before_script:
28
+ - phpenv local 5.6
29
+ - composer selfupdate --no-interaction
30
+ - composer install --no-interaction
31
+ - phpenv local --unset
32
+ - PLUGIN_SLUG=$(basename $(pwd))
33
+ - export WP_DEVELOP_DIR=/tmp/wordpress/
34
+ - git clone --depth=50 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress
35
+ - cd ..
36
+ - cp -r "$PLUGIN_SLUG" "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG"
37
+ - cd /tmp/wordpress/
38
+ - cp wp-tests-config-sample.php wp-tests-config.php
39
+ - sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
40
+ - sed -i "s/yourusernamehere/travis/" wp-tests-config.php
41
+ - sed -i "s/yourpasswordhere//" wp-tests-config.php
42
+ - mysql -e "CREATE DATABASE wordpress_tests;" -uroot
43
+ - git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs
44
+ - git clone https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git
45
+ wpcs
46
+ - cd phpcs
47
+ - scripts/phpcs --config-set installed_paths ../wpcs
48
+ - cd "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG"
49
+ - phpenv rehash
50
+
51
+ script:
52
+ - if [[ "$PHPLINT" == "1" ]]; then find -L . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l; fi
53
+ - if [[ "$PHPLINT" == "1" ]]; then /tmp/wordpress/phpcs/scripts/phpcs -p -s -v -n . --standard=./codesniffer.xml --extensions=php; fi
54
+ - phpunit -c phpunit.xml
vendor/yoast/license-manager/class-license-manager.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
 
3
- if( ! interface_exists( 'iYoast_License_Manager', false ) ) {
4
 
5
  interface iYoast_License_Manager {
6
 
7
  public function specific_hooks();
 
8
  public function setup_auto_updater();
9
 
10
  }
@@ -12,7 +13,7 @@ if( ! interface_exists( 'iYoast_License_Manager', false ) ) {
12
  }
13
 
14
 
15
- if( ! class_exists( 'Yoast_License_Manager', false ) ) {
16
 
17
  /**
18
  * Class Yoast_License_Manager
@@ -23,8 +24,8 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
23
  abstract class Yoast_License_Manager implements iYoast_License_Manager {
24
 
25
  /**
26
- * @const VERSION The version number of the License_Manager class
27
- */
28
  const VERSION = 1;
29
 
30
  /**
@@ -33,28 +34,28 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
33
  protected $product;
34
 
35
  /**
36
- * @var string
37
- */
38
  private $license_constant_name = '';
39
 
40
  /**
41
- * @var boolean True if license is defined with a constant
42
- */
43
  private $license_constant_is_defined = false;
44
 
45
  /**
46
- * @var boolean True if remote license activation just failed
47
- */
48
  private $remote_license_activation_failed = false;
49
 
50
  /**
51
- * @var array Array of license related options
52
- */
53
  private $options = array();
54
 
55
  /**
56
- * @var string Used to prefix ID's, option names, etc..
57
- */
58
  protected $prefix;
59
 
60
  /**
@@ -89,7 +90,7 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
89
  add_action( 'admin_notices', array( $this, 'display_admin_notices' ) );
90
 
91
  // catch POST requests from license form
92
- add_action( 'admin_init', array( $this, 'catch_post_request') );
93
 
94
  // setup item type (plugin|theme) specific hooks
95
  $this->specific_hooks();
@@ -100,11 +101,11 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
100
  }
101
 
102
  /**
103
- * Display license specific admin notices, namely:
104
- *
105
- * - License for the product isn't activated
106
- * - External requests are blocked through WP_HTTP_BLOCK_EXTERNAL
107
- */
108
  public function display_admin_notices() {
109
 
110
  if ( ! current_user_can( 'manage_options' ) ) {
@@ -112,42 +113,42 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
112
  }
113
 
114
  // show notice if license is invalid
115
- if( ! $this->license_is_valid() ) {
116
- if( $this->get_license_key() == '' ) {
117
  $message = '<b>Warning!</b> You didn\'t set your %s license key yet, which means you\'re missing out on updates and support! <a href="%s">Enter your license key</a> or <a href="%s" target="_blank">get a license here</a>.';
118
  } else {
119
  $message = '<b>Warning!</b> Your %s license is inactive which means you\'re missing out on updates and support! <a href="%s">Activate your license</a> or <a href="%s" target="_blank">get a license here</a>.';
120
  }
121
- ?>
122
- <div class="error">
123
- <p><?php printf( __( $message, $this->product->get_text_domain() ), $this->product->get_item_name(), $this->product->get_license_page_url(), $this->product->get_tracking_url( 'activate-license-notice' ) ); ?></p>
124
- </div>
125
  <?php
126
  }
127
 
128
  // show notice if external requests are blocked through the WP_HTTP_BLOCK_EXTERNAL constant
129
- if( defined( "WP_HTTP_BLOCK_EXTERNAL" ) && WP_HTTP_BLOCK_EXTERNAL === true ) {
130
 
131
  // check if our API endpoint is in the allowed hosts
132
  $host = parse_url( $this->product->get_api_url(), PHP_URL_HOST );
133
-
134
- if( ! defined( "WP_ACCESSIBLE_HOSTS" ) || stristr( WP_ACCESSIBLE_HOSTS, $host ) === false ) {
135
  ?>
136
  <div class="error">
137
- <p><?php printf( __( '<b>Warning!</b> You\'re blocking external requests which means you won\'t be able to get %s updates. Please add %s to %s.', $this->product->get_text_domain() ), $this->product->get_item_name(), '<strong>' . $host . '</strong>', '<code>WP_ACCESSIBLE_HOSTS</code>'); ?></p>
138
  </div>
139
- <?php
140
  }
141
 
142
  }
143
  }
144
 
145
  /**
146
- * Set a notice to display in the admin area
147
- *
148
- * @param string $type error|updated
149
- * @param string $message The message to display
150
- */
151
  protected function set_notice( $message, $success = true ) {
152
  $css_class = ( $success ) ? 'updated' : 'error';
153
  add_settings_error( $this->prefix . 'license', 'license-notice', $message, $css_class );
@@ -162,33 +163,33 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
162
  $result = $this->call_license_api( 'activate' );
163
 
164
 
165
- if( $result ) {
166
 
167
  // story expiry date
168
- if( isset( $result->expires ) ) {
169
  $this->set_license_expiry_date( $result->expires );
170
  $expiry_date = strtotime( $result->expires );
171
  } else {
172
  $expiry_date = false;
173
  }
174
-
175
  // show success notice if license is valid
176
- if($result->license === 'valid') {
177
 
178
  $message = sprintf( __( "Your %s license has been activated. ", $this->product->get_text_domain() ), $this->product->get_item_name() );
179
 
180
  // show a custom notice if users have an unlimited license
181
- if( $result->license_limit == 0 ) {
182
  $message .= __( "You have an unlimited license. ", $this->product->get_text_domain() );
183
  } else {
184
  $message .= sprintf( __( "You have used %d/%d activations. ", $this->product->get_text_domain() ), $result->site_count, $result->license_limit );
185
  }
186
-
187
  // add upgrade notice if user has less than 3 activations left
188
- if( $result->license_limit > 0 && ( $result->license_limit - $result->site_count ) <= 3 ) {
189
  $message .= sprintf( __( '<a href="%s">Did you know you can upgrade your license?</a>', $this->product->get_text_domain() ), $this->product->get_tracking_url( 'license-nearing-limit-notice' ) );
190
- // add extend notice if license is expiring in less than 1 month
191
- } elseif( $expiry_date !== false && $expiry_date < strtotime( "+1 month" ) ) {
192
  $days_left = round( ( $expiry_date - strtotime( "now" ) ) / 86400 );
193
  $message .= sprintf( __( '<a href="%s">Your license is expiring in %d days, would you like to extend it?</a>', $this->product->get_text_domain() ), $this->product->get_tracking_url( 'license-expiring-notice' ), $days_left );
194
  }
@@ -196,13 +197,13 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
196
  $this->set_notice( $message, true );
197
 
198
  } else {
199
-
200
- if( isset($result->error) && $result->error === 'no_activations_left' ) {
201
  // show notice if user is at their activation limit
202
- $this->set_notice( sprintf( __('You\'ve reached your activation limit. You must <a href="%s">upgrade your license</a> to use it on this site.', $this->product->get_text_domain() ), $this->product->get_tracking_url( 'license-at-limit-notice' ) ), false );
203
- } elseif( isset($result->error) && $result->error == "expired" ) {
204
  // show notice if the license is expired
205
- $this->set_notice( sprintf( __('Your license has expired. You must <a href="%s">extend your license</a> in order to use it again.', $this->product->get_text_domain() ), $this->product->get_tracking_url( 'license-expired-notice' ) ), false );
206
  } else {
207
  // show a general notice if it's any other error
208
  $this->set_notice( __( "Failed to activate your license, your license key seems to be invalid.", $this->product->get_text_domain() ), false );
@@ -221,14 +222,14 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
221
  * Remotely deactivate License
222
  * @return boolean True if the license is now deactivated, false if not
223
  */
224
- public function deactivate_license () {
225
 
226
  $result = $this->call_license_api( 'deactivate' );
227
 
228
- if( $result ) {
229
-
230
  // show notice if license is deactivated
231
- if( $result->license === 'deactivated' ) {
232
  $this->set_notice( sprintf( __( "Your %s license has been deactivated.", $this->product->get_text_domain() ), $this->product->get_item_name() ) );
233
  } else {
234
  $this->set_notice( sprintf( __( "Failed to deactivate your %s license.", $this->product->get_text_domain() ), $this->product->get_item_name() ), false );
@@ -237,17 +238,18 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
237
  $this->set_license_status( $result->license );
238
  }
239
 
240
- return ( $this->get_license_status() === 'deactivated' );
241
  }
242
 
243
  /**
244
- * @param string $action activate|deactivate
245
- * @return mixed
246
- */
 
247
  protected function call_license_api( $action ) {
248
 
249
  // don't make a request if license key is empty
250
- if( $this->get_license_key() === '' ) {
251
  return false;
252
  }
253
 
@@ -264,8 +266,8 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
264
 
265
  require_once dirname( __FILE__ ) . '/class-api-request.php';
266
  $request = new Yoast_API_Request( $url );
267
-
268
- if( $request->is_valid() !== true ) {
269
  $this->set_notice( sprintf( __( "Request error: \"%s\" (%scommon license notices%s)", $this->product->get_text_domain() ), $request->get_error_message(), '<a href="http://kb.yoast.com/article/13-license-activation-notices">', '</a>' ), false );
270
  }
271
 
@@ -278,92 +280,93 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
278
  return $license_data;
279
  }
280
 
281
-
282
 
283
  /**
284
- * Set the license status
285
- *
286
- * @param string $license_status
287
- */
288
  public function set_license_status( $license_status ) {
289
  $this->set_option( 'status', $license_status );
290
  }
291
 
292
  /**
293
- * Get the license status
294
- *
295
- * @return string $license_status;
296
- */
297
  public function get_license_status() {
298
  $license_status = $this->get_option( 'status' );
 
299
  return trim( $license_status );
300
  }
301
 
302
  /**
303
- * Set the license key
304
- *
305
- * @param string $license_key
306
- */
307
  public function set_license_key( $license_key ) {
308
  $this->set_option( 'key', $license_key );
309
  }
310
 
311
  /**
312
- * Gets the license key from constant or option
313
- *
314
- * @return string $license_key
315
- */
316
  public function get_license_key() {
317
  $license_key = $this->get_option( 'key' );
 
318
  return trim( $license_key );
319
  }
320
 
321
  /**
322
- * Gets the license expiry date
323
- *
324
- * @return string
325
- */
326
  public function get_license_expiry_date() {
327
- return $this->get_option( 'expiry_date');
328
  }
329
 
330
  /**
331
- * Stores the license expiry date
332
- */
333
  public function set_license_expiry_date( $expiry_date ) {
334
  $this->set_option( 'expiry_date', $expiry_date );
335
  }
336
 
337
  /**
338
- * Checks whether the license status is active
339
- *
340
- * @return boolean True if license is active
341
- */
342
  public function license_is_valid() {
343
  return ( $this->get_license_status() === 'valid' );
344
  }
345
 
346
  /**
347
- * Get all license related options
348
- *
349
- * @return array Array of license options
350
- */
351
  protected function get_options() {
352
 
353
  // create option name
354
  $option_name = $this->prefix . 'license';
355
 
356
  // get array of options from db
357
- if( $this->is_network_activated ) {
358
- $options = get_site_option( $option_name, array( ) );
359
  } else {
360
- $options = get_option( $option_name, array( ) );
361
  }
362
 
363
  // setup array of defaults
364
  $defaults = array(
365
- 'key' => '',
366
- 'status' => '',
367
  'expiry_date' => ''
368
  );
369
 
@@ -374,16 +377,16 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
374
  }
375
 
376
  /**
377
- * Set license related options
378
- *
379
- * @param array $options Array of new license options
380
- */
381
  protected function set_options( array $options ) {
382
  // create option name
383
  $option_name = $this->prefix . 'license';
384
 
385
  // update db
386
- if( $this->is_network_activated ) {
387
  update_site_option( $option_name, $options );
388
  } else {
389
  update_option( $option_name, $options );
@@ -392,28 +395,30 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
392
  }
393
 
394
  /**
395
- * Gets a license related option
396
- *
397
- * @param string $name The option name
398
- * @return mixed The option value
399
- */
 
400
  protected function get_option( $name ) {
401
  $options = $this->get_options();
402
- return $options[ $name ];
 
403
  }
404
 
405
  /**
406
- * Set a license related option
407
- *
408
- * @param string $name The option name
409
- * @param mixed $value The option value
410
- */
411
  protected function set_option( $name, $value ) {
412
  // get options
413
  $options = $this->get_options();
414
 
415
  // update option
416
- $options[ $name ] = $value;
417
 
418
  // save options
419
  $this->set_options( $options );
@@ -424,48 +429,48 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
424
  <h3>
425
  <?php printf( __( "%s: License Settings", $this->product->get_text_domain() ), $this->product->get_item_name() ); ?>&nbsp; &nbsp;
426
  </h3>
427
- <?php
428
  }
429
 
430
  /**
431
- * Show a form where users can enter their license key
432
- *
433
- * @param boolean $embedded Boolean indicating whether this form is embedded in another form?
434
- */
435
  public function show_license_form( $embedded = true ) {
436
-
437
- $key_name = $this->prefix . 'license_key';
438
- $nonce_name = $this->prefix . 'license_nonce';
439
  $action_name = $this->prefix . 'license_action';
440
 
441
-
442
- $visible_license_key = $this->get_license_key();
 
443
 
444
  // obfuscate license key
445
  $obfuscate = ( strlen( $this->get_license_key() ) > 5 && ( $this->license_is_valid() || ! $this->remote_license_activation_failed ) );
446
 
447
- if($obfuscate) {
448
- $visible_license_key = str_repeat('*', strlen( $this->get_license_key() ) - 4) . substr( $this->get_license_key(), -4 );
449
  }
450
 
451
  // make license key readonly when license key is valid or license is defined with a constant
452
  $readonly = ( $this->license_is_valid() || $this->license_constant_is_defined );
453
-
454
- require dirname( __FILE__ ) . '/views/form.php';
455
 
456
  // enqueue script in the footer
457
- add_action( 'admin_footer', array( $this, 'output_script'), 99 );
458
  }
459
 
460
  /**
461
- * Check if the license form has been submitted
462
- */
463
  public function catch_post_request() {
464
 
465
  $name = $this->prefix . 'license_key';
466
 
467
  // check if license key was posted and not empty
468
- if( ! isset( $_POST[$name] ) ) {
469
  return;
470
  }
471
 
@@ -476,13 +481,13 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
476
  return;
477
  }
478
 
479
- // @TODO: check for user cap?
480
 
481
  // get key from posted value
482
  $license_key = $_POST[$name];
483
 
484
  // check if license key doesn't accidentally contain asterisks
485
- if( strstr($license_key, '*') === false ) {
486
 
487
  // sanitize key
488
  $license_key = trim( sanitize_key( $_POST[$name] ) );
@@ -492,21 +497,21 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
492
  }
493
 
494
  // does user have an activated valid license
495
- if( ! $this->license_is_valid() ) {
496
 
497
  // try to auto-activate license
498
- return $this->activate_license();
499
 
500
- }
501
 
502
  $action_name = $this->prefix . 'license_action';
503
 
504
  // was one of the action buttons clicked?
505
- if( isset( $_POST[ $action_name ] ) ) {
506
-
507
- $action = trim( $_POST[ $action_name ] );
508
 
509
- switch($action) {
 
 
510
 
511
  case 'activate':
512
  return $this->activate_license();
@@ -518,53 +523,97 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
518
  }
519
 
520
  }
521
-
522
  }
523
 
524
  /**
525
- * Output the script containing the YoastLicenseManager JS Object
526
- *
527
- * This takes care of disabling the 'activate' and 'deactivate' buttons
528
- */
529
  public function output_script() {
530
  require_once dirname( __FILE__ ) . '/views/script.php';
531
  }
532
 
533
  /**
534
- * Set the constant used to define the license
535
- *
536
- * @param string $license_constant_name The license constant name
537
- */
538
  public function set_license_constant_name( $license_constant_name ) {
539
  $this->license_constant_name = trim( $license_constant_name );
540
  $this->maybe_set_license_key_from_constant();
541
  }
542
 
543
  /**
544
- * Maybe set license key from a defined constant
545
- */
546
- private function maybe_set_license_key_from_constant( ) {
547
-
548
- if( empty( $this->license_constant_name ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  // generate license constant name
550
- $this->set_license_constant_name( strtoupper( str_replace( array(' ', '-' ), '', sanitize_key( $this->product->get_item_name() ) ) ) . '_LICENSE');
551
  }
552
 
553
  // set license key from constant
554
- if( defined( $this->license_constant_name ) ) {
555
 
556
  $license_constant_value = constant( $this->license_constant_name );
557
 
558
  // update license key value with value of constant
559
- if( $this->get_license_key() !== $license_constant_value ) {
560
  $this->set_license_key( $license_constant_value );
561
  }
562
-
563
  $this->license_constant_is_defined = true;
564
  }
565
  }
566
 
567
-
568
  }
569
 
570
  }
1
  <?php
2
 
3
+ if ( ! interface_exists( 'iYoast_License_Manager', false ) ) {
4
 
5
  interface iYoast_License_Manager {
6
 
7
  public function specific_hooks();
8
+
9
  public function setup_auto_updater();
10
 
11
  }
13
  }
14
 
15
 
16
+ if ( ! class_exists( 'Yoast_License_Manager', false ) ) {
17
 
18
  /**
19
  * Class Yoast_License_Manager
24
  abstract class Yoast_License_Manager implements iYoast_License_Manager {
25
 
26
  /**
27
+ * @const VERSION The version number of the License_Manager class
28
+ */
29
  const VERSION = 1;
30
 
31
  /**
34
  protected $product;
35
 
36
  /**
37
+ * @var string
38
+ */
39
  private $license_constant_name = '';
40
 
41
  /**
42
+ * @var boolean True if license is defined with a constant
43
+ */
44
  private $license_constant_is_defined = false;
45
 
46
  /**
47
+ * @var boolean True if remote license activation just failed
48
+ */
49
  private $remote_license_activation_failed = false;
50
 
51
  /**
52
+ * @var array Array of license related options
53
+ */
54
  private $options = array();
55
 
56
  /**
57
+ * @var string Used to prefix ID's, option names, etc..
58
+ */
59
  protected $prefix;
60
 
61
  /**
90
  add_action( 'admin_notices', array( $this, 'display_admin_notices' ) );
91
 
92
  // catch POST requests from license form
93
+ add_action( 'admin_init', array( $this, 'catch_post_request' ) );
94
 
95
  // setup item type (plugin|theme) specific hooks
96
  $this->specific_hooks();
101
  }
102
 
103
  /**
104
+ * Display license specific admin notices, namely:
105
+ *
106
+ * - License for the product isn't activated
107
+ * - External requests are blocked through WP_HTTP_BLOCK_EXTERNAL
108
+ */
109
  public function display_admin_notices() {
110
 
111
  if ( ! current_user_can( 'manage_options' ) ) {
113
  }
114
 
115
  // show notice if license is invalid
116
+ if ( ! $this->license_is_valid() ) {
117
+ if ( $this->get_license_key() == '' ) {
118
  $message = '<b>Warning!</b> You didn\'t set your %s license key yet, which means you\'re missing out on updates and support! <a href="%s">Enter your license key</a> or <a href="%s" target="_blank">get a license here</a>.';
119
  } else {
120
  $message = '<b>Warning!</b> Your %s license is inactive which means you\'re missing out on updates and support! <a href="%s">Activate your license</a> or <a href="%s" target="_blank">get a license here</a>.';
121
  }
122
+ ?>
123
+ <div class="error">
124
+ <p><?php printf( __( $message, $this->product->get_text_domain() ), $this->product->get_item_name(), $this->product->get_license_page_url(), $this->product->get_tracking_url( 'activate-license-notice' ) ); ?></p>
125
+ </div>
126
  <?php
127
  }
128
 
129
  // show notice if external requests are blocked through the WP_HTTP_BLOCK_EXTERNAL constant
130
+ if ( defined( "WP_HTTP_BLOCK_EXTERNAL" ) && WP_HTTP_BLOCK_EXTERNAL === true ) {
131
 
132
  // check if our API endpoint is in the allowed hosts
133
  $host = parse_url( $this->product->get_api_url(), PHP_URL_HOST );
134
+
135
+ if ( ! defined( "WP_ACCESSIBLE_HOSTS" ) || stristr( WP_ACCESSIBLE_HOSTS, $host ) === false ) {
136
  ?>
137
  <div class="error">
138
+ <p><?php printf( __( '<b>Warning!</b> You\'re blocking external requests which means you won\'t be able to get %s updates. Please add %s to %s.', $this->product->get_text_domain() ), $this->product->get_item_name(), '<strong>' . $host . '</strong>', '<code>WP_ACCESSIBLE_HOSTS</code>' ); ?></p>
139
  </div>
140
+ <?php
141
  }
142
 
143
  }
144
  }
145
 
146
  /**
147
+ * Set a notice to display in the admin area
148
+ *
149
+ * @param string $type error|updated
150
+ * @param string $message The message to display
151
+ */
152
  protected function set_notice( $message, $success = true ) {
153
  $css_class = ( $success ) ? 'updated' : 'error';
154
  add_settings_error( $this->prefix . 'license', 'license-notice', $message, $css_class );
163
  $result = $this->call_license_api( 'activate' );
164
 
165
 
166
+ if ( $result ) {
167
 
168
  // story expiry date
169
+ if ( isset( $result->expires ) ) {
170
  $this->set_license_expiry_date( $result->expires );
171
  $expiry_date = strtotime( $result->expires );
172
  } else {
173
  $expiry_date = false;
174
  }
175
+
176
  // show success notice if license is valid
177
+ if ( $result->license === 'valid' ) {
178
 
179
  $message = sprintf( __( "Your %s license has been activated. ", $this->product->get_text_domain() ), $this->product->get_item_name() );
180
 
181
  // show a custom notice if users have an unlimited license
182
+ if ( $result->license_limit == 0 ) {
183
  $message .= __( "You have an unlimited license. ", $this->product->get_text_domain() );
184
  } else {
185
  $message .= sprintf( __( "You have used %d/%d activations. ", $this->product->get_text_domain() ), $result->site_count, $result->license_limit );
186
  }
187
+
188
  // add upgrade notice if user has less than 3 activations left
189
+ if ( $result->license_limit > 0 && ( $result->license_limit - $result->site_count ) <= 3 ) {
190
  $message .= sprintf( __( '<a href="%s">Did you know you can upgrade your license?</a>', $this->product->get_text_domain() ), $this->product->get_tracking_url( 'license-nearing-limit-notice' ) );
191
+ // add extend notice if license is expiring in less than 1 month
192
+ } elseif ( $expiry_date !== false && $expiry_date < strtotime( "+1 month" ) ) {
193
  $days_left = round( ( $expiry_date - strtotime( "now" ) ) / 86400 );
194
  $message .= sprintf( __( '<a href="%s">Your license is expiring in %d days, would you like to extend it?</a>', $this->product->get_text_domain() ), $this->product->get_tracking_url( 'license-expiring-notice' ), $days_left );
195
  }
197
  $this->set_notice( $message, true );
198
 
199
  } else {
200
+
201
+ if ( isset( $result->error ) && $result->error === 'no_activations_left' ) {
202
  // show notice if user is at their activation limit
203
+ $this->set_notice( sprintf( __( 'You\'ve reached your activation limit. You must <a href="%s">upgrade your license</a> to use it on this site.', $this->product->get_text_domain() ), $this->product->get_tracking_url( 'license-at-limit-notice' ) ), false );
204
+ } elseif ( isset( $result->error ) && $result->error == "expired" ) {
205
  // show notice if the license is expired
206
+ $this->set_notice( sprintf( __( 'Your license has expired. You must <a href="%s">extend your license</a> in order to use it again.', $this->product->get_text_domain() ), $this->product->get_tracking_url( 'license-expired-notice' ) ), false );
207
  } else {
208
  // show a general notice if it's any other error
209
  $this->set_notice( __( "Failed to activate your license, your license key seems to be invalid.", $this->product->get_text_domain() ), false );
222
  * Remotely deactivate License
223
  * @return boolean True if the license is now deactivated, false if not
224
  */
225
+ public function deactivate_license() {
226
 
227
  $result = $this->call_license_api( 'deactivate' );
228
 
229
+ if ( $result ) {
230
+
231
  // show notice if license is deactivated
232
+ if ( $result->license === 'deactivated' ) {
233
  $this->set_notice( sprintf( __( "Your %s license has been deactivated.", $this->product->get_text_domain() ), $this->product->get_item_name() ) );
234
  } else {
235
  $this->set_notice( sprintf( __( "Failed to deactivate your %s license.", $this->product->get_text_domain() ), $this->product->get_item_name() ), false );
238
  $this->set_license_status( $result->license );
239
  }
240
 
241
+ return ( $this->get_license_status() === 'deactivated' );
242
  }
243
 
244
  /**
245
+ * @param string $action activate|deactivate
246
+ *
247
+ * @return mixed
248
+ */
249
  protected function call_license_api( $action ) {
250
 
251
  // don't make a request if license key is empty
252
+ if ( $this->get_license_key() === '' ) {
253
  return false;
254
  }
255
 
266
 
267
  require_once dirname( __FILE__ ) . '/class-api-request.php';
268
  $request = new Yoast_API_Request( $url );
269
+
270
+ if ( $request->is_valid() !== true ) {
271
  $this->set_notice( sprintf( __( "Request error: \"%s\" (%scommon license notices%s)", $this->product->get_text_domain() ), $request->get_error_message(), '<a href="http://kb.yoast.com/article/13-license-activation-notices">', '</a>' ), false );
272
  }
273
 
280
  return $license_data;
281
  }
282
 
 
283
 
284
  /**
285
+ * Set the license status
286
+ *
287
+ * @param string $license_status
288
+ */
289
  public function set_license_status( $license_status ) {
290
  $this->set_option( 'status', $license_status );
291
  }
292
 
293
  /**
294
+ * Get the license status
295
+ *
296
+ * @return string $license_status;
297
+ */
298
  public function get_license_status() {
299
  $license_status = $this->get_option( 'status' );
300
+
301
  return trim( $license_status );
302
  }
303
 
304
  /**
305
+ * Set the license key
306
+ *
307
+ * @param string $license_key
308
+ */
309
  public function set_license_key( $license_key ) {
310
  $this->set_option( 'key', $license_key );
311
  }
312
 
313
  /**
314
+ * Gets the license key from constant or option
315
+ *
316
+ * @return string $license_key
317
+ */
318
  public function get_license_key() {
319
  $license_key = $this->get_option( 'key' );
320
+
321
  return trim( $license_key );
322
  }
323
 
324
  /**
325
+ * Gets the license expiry date
326
+ *
327
+ * @return string
328
+ */
329
  public function get_license_expiry_date() {
330
+ return $this->get_option( 'expiry_date' );
331
  }
332
 
333
  /**
334
+ * Stores the license expiry date
335
+ */
336
  public function set_license_expiry_date( $expiry_date ) {
337
  $this->set_option( 'expiry_date', $expiry_date );
338
  }
339
 
340
  /**
341
+ * Checks whether the license status is active
342
+ *
343
+ * @return boolean True if license is active
344
+ */
345
  public function license_is_valid() {
346
  return ( $this->get_license_status() === 'valid' );
347
  }
348
 
349
  /**
350
+ * Get all license related options
351
+ *
352
+ * @return array Array of license options
353
+ */
354
  protected function get_options() {
355
 
356
  // create option name
357
  $option_name = $this->prefix . 'license';
358
 
359
  // get array of options from db
360
+ if ( $this->is_network_activated ) {
361
+ $options = get_site_option( $option_name, array() );
362
  } else {
363
+ $options = get_option( $option_name, array() );
364
  }
365
 
366
  // setup array of defaults
367
  $defaults = array(
368
+ 'key' => '',
369
+ 'status' => '',
370
  'expiry_date' => ''
371
  );
372
 
377
  }
378
 
379
  /**
380
+ * Set license related options
381
+ *
382
+ * @param array $options Array of new license options
383
+ */
384
  protected function set_options( array $options ) {
385
  // create option name
386
  $option_name = $this->prefix . 'license';
387
 
388
  // update db
389
+ if ( $this->is_network_activated ) {
390
  update_site_option( $option_name, $options );
391
  } else {
392
  update_option( $option_name, $options );
395
  }
396
 
397
  /**
398
+ * Gets a license related option
399
+ *
400
+ * @param string $name The option name
401
+ *
402
+ * @return mixed The option value
403
+ */
404
  protected function get_option( $name ) {
405
  $options = $this->get_options();
406
+
407
+ return $options[$name];
408
  }
409
 
410
  /**
411
+ * Set a license related option
412
+ *
413
+ * @param string $name The option name
414
+ * @param mixed $value The option value
415
+ */
416
  protected function set_option( $name, $value ) {
417
  // get options
418
  $options = $this->get_options();
419
 
420
  // update option
421
+ $options[$name] = $value;
422
 
423
  // save options
424
  $this->set_options( $options );
429
  <h3>
430
  <?php printf( __( "%s: License Settings", $this->product->get_text_domain() ), $this->product->get_item_name() ); ?>&nbsp; &nbsp;
431
  </h3>
432
+ <?php
433
  }
434
 
435
  /**
436
+ * Show a form where users can enter their license key
437
+ *
438
+ * @param boolean $embedded Boolean indicating whether this form is embedded in another form?
439
+ */
440
  public function show_license_form( $embedded = true ) {
441
+ $key_name = $this->prefix . 'license_key';
442
+ $nonce_name = $this->prefix . 'license_nonce';
 
443
  $action_name = $this->prefix . 'license_action';
444
 
445
+ $api_host_available = $this->get_api_availability();
446
+
447
+ $visible_license_key = $this->get_license_key();
448
 
449
  // obfuscate license key
450
  $obfuscate = ( strlen( $this->get_license_key() ) > 5 && ( $this->license_is_valid() || ! $this->remote_license_activation_failed ) );
451
 
452
+ if ( $obfuscate ) {
453
+ $visible_license_key = str_repeat( '*', strlen( $this->get_license_key() ) - 4 ) . substr( $this->get_license_key(), - 4 );
454
  }
455
 
456
  // make license key readonly when license key is valid or license is defined with a constant
457
  $readonly = ( $this->license_is_valid() || $this->license_constant_is_defined );
458
+
459
+ require dirname( __FILE__ ) . '/views/form.php';
460
 
461
  // enqueue script in the footer
462
+ add_action( 'admin_footer', array( $this, 'output_script' ), 99 );
463
  }
464
 
465
  /**
466
+ * Check if the license form has been submitted
467
+ */
468
  public function catch_post_request() {
469
 
470
  $name = $this->prefix . 'license_key';
471
 
472
  // check if license key was posted and not empty
473
+ if ( ! isset( $_POST[$name] ) ) {
474
  return;
475
  }
476
 
481
  return;
482
  }
483
 
484
+ // @TODO: check for user cap?
485
 
486
  // get key from posted value
487
  $license_key = $_POST[$name];
488
 
489
  // check if license key doesn't accidentally contain asterisks
490
+ if ( strstr( $license_key, '*' ) === false ) {
491
 
492
  // sanitize key
493
  $license_key = trim( sanitize_key( $_POST[$name] ) );
497
  }
498
 
499
  // does user have an activated valid license
500
+ if ( ! $this->license_is_valid() ) {
501
 
502
  // try to auto-activate license
503
+ return $this->activate_license();
504
 
505
+ }
506
 
507
  $action_name = $this->prefix . 'license_action';
508
 
509
  // was one of the action buttons clicked?
510
+ if ( isset( $_POST[$action_name] ) ) {
 
 
511
 
512
+ $action = trim( $_POST[$action_name] );
513
+
514
+ switch ( $action ) {
515
 
516
  case 'activate':
517
  return $this->activate_license();
523
  }
524
 
525
  }
526
+
527
  }
528
 
529
  /**
530
+ * Output the script containing the YoastLicenseManager JS Object
531
+ *
532
+ * This takes care of disabling the 'activate' and 'deactivate' buttons
533
+ */
534
  public function output_script() {
535
  require_once dirname( __FILE__ ) . '/views/script.php';
536
  }
537
 
538
  /**
539
+ * Set the constant used to define the license
540
+ *
541
+ * @param string $license_constant_name The license constant name
542
+ */
543
  public function set_license_constant_name( $license_constant_name ) {
544
  $this->license_constant_name = trim( $license_constant_name );
545
  $this->maybe_set_license_key_from_constant();
546
  }
547
 
548
  /**
549
+ * Get the API availability information
550
+ *
551
+ * @return array
552
+ */
553
+ protected function get_api_availability(){
554
+ return array(
555
+ 'url' => $this->product->get_api_url(),
556
+ 'availability' => $this->check_api_host_availability(),
557
+ 'curl_version' => $this->get_curl_version(),
558
+ );
559
+ }
560
+
561
+ /**
562
+ * Check if the API host address is available from this server
563
+ *
564
+ * @return bool
565
+ */
566
+ private function check_api_host_availability() {
567
+ $wp_http = new WP_Http();
568
+ if ( $wp_http->block_request( $this->product->get_api_url() ) === false ) {
569
+ return true;
570
+ }
571
+
572
+ return false;
573
+ }
574
+
575
+ /**
576
+ * Get the current curl version, or false
577
+ *
578
+ * @return mixed
579
+ */
580
+ protected function get_curl_version() {
581
+ if ( function_exists( 'curl_version' ) ) {
582
+ $curl_version = curl_version();
583
+
584
+ if ( isset( $curl_version['version'] ) ) {
585
+ return $curl_version['version'];
586
+ }
587
+ }
588
+
589
+ return false;
590
+ }
591
+
592
+ /**
593
+ * Maybe set license key from a defined constant
594
+ */
595
+ private function maybe_set_license_key_from_constant() {
596
+
597
+ if ( empty( $this->license_constant_name ) ) {
598
  // generate license constant name
599
+ $this->set_license_constant_name( strtoupper( str_replace( array( ' ', '-' ), '', sanitize_key( $this->product->get_item_name() ) ) ) . '_LICENSE' );
600
  }
601
 
602
  // set license key from constant
603
+ if ( defined( $this->license_constant_name ) ) {
604
 
605
  $license_constant_value = constant( $this->license_constant_name );
606
 
607
  // update license key value with value of constant
608
+ if ( $this->get_license_key() !== $license_constant_value ) {
609
  $this->set_license_key( $license_constant_value );
610
  }
611
+
612
  $this->license_constant_is_defined = true;
613
  }
614
  }
615
 
616
+
617
  }
618
 
619
  }
vendor/yoast/license-manager/phpunit.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <phpunit
2
+ backupGlobals="false"
3
+ backupStaticAttributes="false"
4
+ bootstrap="tests/bootstrap.php"
5
+ colors="true"
6
+ convertErrorsToExceptions="true"
7
+ convertNoticesToExceptions="true"
8
+ convertWarningsToExceptions="true"
9
+ processIsolation="false"
10
+ stopOnError="false"
11
+ stopOnFailure="false"
12
+ stopOnIncomplete="false"
13
+ stopOnSkipped="false"
14
+ strict="false"
15
+ syntaxCheck="false"
16
+ verbose="true"
17
+ >
18
+ <testsuites>
19
+ <testsuite>
20
+ <directory prefix="test-" suffix=".php">./tests/</directory>
21
+ </testsuite>
22
+ </testsuites>
23
+ </phpunit>
vendor/yoast/license-manager/tests/bootstrap.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // disable xdebug backtrace
3
+ if ( function_exists( 'xdebug_disable' ) ) {
4
+ xdebug_disable();
5
+ }
6
+
7
+ echo 'Welcome to the License Manager Test Suite' . PHP_EOL;
8
+ echo 'Version: 1.0' . PHP_EOL . PHP_EOL;
9
+
10
+ if( false !== getenv( 'WP_DEVELOP_DIR' ) ) {
11
+ require getenv( 'WP_DEVELOP_DIR' ) . 'tests/phpunit/includes/bootstrap.php';
12
+ } else {
13
+ require '../../../../tests/phpunit/includes/bootstrap.php';
14
+ }
15
+ // include unit test base class
16
+ require_once dirname( __FILE__ ) . '/framework/class-yst-license-manager-unit-test-case.php';
vendor/yoast/license-manager/tests/framework/class-yst-license-manager-unit-test-case.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * TestCase base class for convenience methods.
5
+ */
6
+ class Yst_License_Manager_UnitTestCase extends WP_UnitTestCase {
7
+
8
+ /**
9
+ * @param string $key
10
+ * @param mixed $value
11
+ */
12
+ protected function set_post( $key, $value ) {
13
+ $_POST[$key] = $_REQUEST[$key] = addslashes( $value );
14
+ }
15
+
16
+ /**
17
+ * @param string $key
18
+ */
19
+ protected function unset_post( $key ) {
20
+ unset( $_POST[$key], $_REQUEST[$key] );
21
+ }
22
+
23
+ /**
24
+ * Fake a request to the WP front page
25
+ */
26
+ protected function go_to_home() {
27
+ $this->go_to( home_url( '/' ) );
28
+ }
29
+
30
+ /**
31
+ * @param string $string
32
+ * @param mixed $function
33
+ */
34
+ protected function expectOutput( $string, $function = null ) {
35
+ $output = ob_get_contents();
36
+ ob_clean();
37
+ $this->assertEquals( $output, $string );
38
+ }
39
+
40
+ }
vendor/yoast/license-manager/tests/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ //Nothing to see here
3
+ header('HTTP/1.0 403 Forbidden');
vendor/yoast/license-manager/tests/test-class-yoast-license-manager.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include( dirname( __FILE__ ) . '../../class-product.php' );
4
+ include( dirname( __FILE__ ) . '../../class-license-manager.php' );
5
+
6
+ class Yoast_Product_Double extends Yoast_Product {
7
+
8
+ /**
9
+ * Construct the real Product class with our fake data
10
+ */
11
+ public function __construct() {
12
+ parent::__construct( get_site_url(), 'test-product', 'slug-test-product', '1.0.0' );
13
+ }
14
+
15
+ }
16
+
17
+ class Yoast_License_Manager_Double extends Yoast_License_Manager {
18
+
19
+ public $product;
20
+
21
+ public function __construct() {
22
+ $this->product = new Yoast_Product_Double();
23
+
24
+ parent::__construct( $this->product );
25
+ }
26
+
27
+ public function specific_hooks() {
28
+ return $this->specific_hooks();
29
+ }
30
+
31
+ public function setup_auto_updater() {
32
+ return $this->setup_auto_updater();
33
+ }
34
+
35
+ /**
36
+ * Wrapper for get_curl_version()
37
+ *
38
+ * @return mixed
39
+ */
40
+ public function double_get_curl_version(){
41
+ return $this->get_curl_version();
42
+ }
43
+
44
+ }
45
+
46
+ class Test_Yoast_License_Manager extends Yst_License_Manager_UnitTestCase {
47
+
48
+ private $class;
49
+
50
+ public function setUp() {
51
+ $this->class = new Yoast_License_Manager_Double();
52
+ }
53
+
54
+ /**
55
+ * Make sure the API url is correct in the product
56
+ *
57
+ * @covers Yoast_License_Manager::get_api_url()
58
+ */
59
+ public function test_get_api_url(){
60
+ $this->assertEquals( $this->class->product->get_api_url(), get_site_url() );
61
+ }
62
+
63
+ /**
64
+ * Make sure the API url is correct in the product
65
+ *
66
+ * @covers Yoast_License_Manager::get_curl_version()
67
+ */
68
+ public function test_get_curl_version_WITH_curl_installed_on_test_server(){
69
+ $curl_result = $this->class->double_get_curl_version();
70
+
71
+ if( function_exists('curl_version') ){
72
+ $curl_version = curl_version();
73
+
74
+ $this->assertEquals( $curl_result, $curl_version['version'] );
75
+ }
76
+ else{
77
+ $this->assertFalse( $curl_result );
78
+ }
79
+ }
80
+
81
+ }
vendor/yoast/license-manager/views/form.php CHANGED
@@ -11,6 +11,14 @@ $product = $this->product;
11
 
12
  $this->show_license_form_heading();
13
 
 
 
 
 
 
 
 
 
14
  // Output form tags if we're not embedded in another form
15
  if( ! $embedded ) {
16
  echo '<form method="post" action="">';
@@ -84,7 +92,7 @@ if( $this->license_is_valid() ) {
84
  if( ! $embedded ) {
85
 
86
  // only show "Save Changes" button if license is not activated and not defined with a constant
87
- if( $readonly === false ) {
88
  submit_button();
89
  }
90
 
11
 
12
  $this->show_license_form_heading();
13
 
14
+ if( $api_host_available['availability'] === false ){
15
+ echo '<p style="color: red; max-width: 600px;"><strong>' . sprintf( __( 'We couldn\'t create a connection to our API to verify your license key(s). Please ask your hosting company to allow outgoing connections from your server to %s.', $product->get_text_domain() ), $api_host_available['url'] ) . '</strong></p>';
16
+ }
17
+
18
+ if( $api_host_available['curl_version'] !== false && version_compare( $api_host_available['curl_version'], '7.20.0', '<')){
19
+ echo '<p style="color: red; max-width: 600px;"><strong>' . sprintf( __( 'Your server has an outdated version of the PHP module cURL (Version: %s). Please ask your hosting company to update this to a recent version of cURL. You can read more about that in our %sKnowledge base%s.', $product->get_text_domain() ), $api_host_available['curl_version'], '<a href="http://kb.yoast.com/article/90-is-my-curl-up-to-date" target="_blank">', '</a>' ) . '</strong></p>';
20
+ }
21
+
22
  // Output form tags if we're not embedded in another form
23
  if( ! $embedded ) {
24
  echo '<form method="post" action="">';
92
  if( ! $embedded ) {
93
 
94
  // only show "Save Changes" button if license is not activated and not defined with a constant
95
+ if( $readonly === false && $api_host_available['availability'] === true ) {
96
  submit_button();
97
  }
98