Version Description
- Improvement - Compatibility with WordPress 5.5.
- Improvement - Updated the Hashchange jquery.
- Fix - Tabs UI breaks in the backend.
Download this release
Release Info
Developer | brainstormworg |
Plugin | All In One Schema Rich Snippets |
Version | 1.6.3 |
Comparing to | |
See all releases |
Code changes from version 1.6.2 to 1.6.3
- admin/bsf-analytics/assets/css/minified/style-rtl.min.css +1 -1
- admin/bsf-analytics/assets/css/minified/style.min.css +1 -1
- admin/bsf-analytics/assets/css/unminified/style-rtl.css +5 -5
- admin/bsf-analytics/assets/css/unminified/style.css +5 -5
- admin/bsf-analytics/class-bsf-analytics-loader.php +118 -0
- admin/bsf-analytics/class-bsf-analytics.php +197 -222
- admin/bsf-analytics/version.json +4 -0
- admin/css/admin.css +13 -0
- admin/js/jquery.hashchange.min.js +5 -9
- index.php +18 -2
- languages/all-in-one-schemaorg-rich-snippets.pot +13 -16
- readme.txt +7 -2
admin/bsf-analytics/assets/css/minified/style-rtl.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
[ID*="-optin-notice"]{padding:1px 12px;border-right-color:#007cba}[ID*="-optin-notice"] .notice-container{padding-top:10px;padding-bottom:12px}[ID*="-optin-notice"] .notice-content{margin:0}[ID*="-optin-notice"] .notice-heading{padding:0 0 12px 20px}[ID*="-optin-notice"] .button-primary{margin-left:5px}
|
admin/bsf-analytics/assets/css/minified/style.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
[ID*="-optin-notice"]{padding:1px 12px;border-left-color:#007cba}[ID*="-optin-notice"] .notice-container{padding-top:10px;padding-bottom:12px}[ID*="-optin-notice"] .notice-content{margin:0}[ID*="-optin-notice"] .notice-heading{padding:0 20px 12px 0}[ID*="-optin-notice"] .button-primary{margin-right:5px}
|
admin/bsf-analytics/assets/css/unminified/style-rtl.css
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
|
2 |
padding: 1px 12px;
|
3 |
border-right-color: #007cba;
|
4 |
}
|
5 |
|
6 |
-
|
7 |
padding-top: 10px;
|
8 |
padding-bottom: 12px;
|
9 |
}
|
10 |
|
11 |
-
|
12 |
margin: 0;
|
13 |
}
|
14 |
|
15 |
-
|
16 |
padding: 0 0 12px 20px;
|
17 |
}
|
18 |
|
19 |
-
|
20 |
margin-left: 5px;
|
21 |
}
|
1 |
+
[ID*="-optin-notice"] {
|
2 |
padding: 1px 12px;
|
3 |
border-right-color: #007cba;
|
4 |
}
|
5 |
|
6 |
+
[ID*="-optin-notice"] .notice-container {
|
7 |
padding-top: 10px;
|
8 |
padding-bottom: 12px;
|
9 |
}
|
10 |
|
11 |
+
[ID*="-optin-notice"] .notice-content {
|
12 |
margin: 0;
|
13 |
}
|
14 |
|
15 |
+
[ID*="-optin-notice"] .notice-heading {
|
16 |
padding: 0 0 12px 20px;
|
17 |
}
|
18 |
|
19 |
+
[ID*="-optin-notice"] .button-primary {
|
20 |
margin-left: 5px;
|
21 |
}
|
admin/bsf-analytics/assets/css/unminified/style.css
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
|
2 |
padding: 1px 12px;
|
3 |
border-left-color: #007cba;
|
4 |
}
|
5 |
|
6 |
-
|
7 |
padding-top: 10px;
|
8 |
padding-bottom: 12px;
|
9 |
}
|
10 |
|
11 |
-
|
12 |
margin: 0;
|
13 |
}
|
14 |
|
15 |
-
|
16 |
padding: 0 20px 12px 0;
|
17 |
}
|
18 |
|
19 |
-
|
20 |
margin-right: 5px;
|
21 |
}
|
1 |
+
[ID*="-optin-notice"] {
|
2 |
padding: 1px 12px;
|
3 |
border-left-color: #007cba;
|
4 |
}
|
5 |
|
6 |
+
[ID*="-optin-notice"] .notice-container {
|
7 |
padding-top: 10px;
|
8 |
padding-bottom: 12px;
|
9 |
}
|
10 |
|
11 |
+
[ID*="-optin-notice"] .notice-content {
|
12 |
margin: 0;
|
13 |
}
|
14 |
|
15 |
+
[ID*="-optin-notice"] .notice-heading {
|
16 |
padding: 0 20px 12px 0;
|
17 |
}
|
18 |
|
19 |
+
[ID*="-optin-notice"] .button-primary {
|
20 |
margin-right: 5px;
|
21 |
}
|
admin/bsf-analytics/class-bsf-analytics-loader.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BSF analytics loader file.
|
4 |
+
*
|
5 |
+
* @version 1.0.0
|
6 |
+
*
|
7 |
+
* @package bsf-analytics
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
exit();
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Class BSF_Analytics_Loader.
|
16 |
+
*/
|
17 |
+
class BSF_Analytics_Loader {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Analytics Entities.
|
21 |
+
*
|
22 |
+
* @access private
|
23 |
+
* @var array Entities array.
|
24 |
+
*/
|
25 |
+
private $entities = array();
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Analytics Version.
|
29 |
+
*
|
30 |
+
* @access private
|
31 |
+
* @var float analytics version.
|
32 |
+
*/
|
33 |
+
private $analytics_version = '';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Analytics path.
|
37 |
+
*
|
38 |
+
* @access private
|
39 |
+
* @var string path array.
|
40 |
+
*/
|
41 |
+
private $analytics_path = '';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Instance
|
45 |
+
*
|
46 |
+
* @access private
|
47 |
+
* @var object Class object.
|
48 |
+
*/
|
49 |
+
private static $instance = null;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Get instace of class.
|
53 |
+
*
|
54 |
+
* @return object
|
55 |
+
*/
|
56 |
+
public static function get_instance() {
|
57 |
+
if ( null === self::$instance ) {
|
58 |
+
self::$instance = new self();
|
59 |
+
}
|
60 |
+
|
61 |
+
return self::$instance;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Constructor
|
66 |
+
*/
|
67 |
+
public function __construct() {
|
68 |
+
add_action( 'init', array( $this, 'load_analytics' ) );
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Set entity for analytics.
|
73 |
+
*
|
74 |
+
* @param string $data Entity attributes data.
|
75 |
+
* @return void
|
76 |
+
*/
|
77 |
+
public function set_entity( $data ) {
|
78 |
+
array_push( $this->entities, $data );
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Load Analytics library.
|
83 |
+
*
|
84 |
+
* @return void
|
85 |
+
*/
|
86 |
+
public function load_analytics() {
|
87 |
+
$unique_entities = array();
|
88 |
+
|
89 |
+
if ( ! empty( $this->entities ) ) {
|
90 |
+
foreach ( $this->entities as $entity ) {
|
91 |
+
foreach ( $entity as $key => $data ) {
|
92 |
+
|
93 |
+
if ( isset( $data['path'] ) ) {
|
94 |
+
if ( file_exists( $data['path'] . '/version.json' ) ) {
|
95 |
+
$file_contents = file_get_contents( $data['path'] . '/version.json' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
96 |
+
$analytics_version = json_decode( $file_contents, 1 );
|
97 |
+
$analytics_version = $analytics_version['bsf-analytics-ver'];
|
98 |
+
|
99 |
+
if ( version_compare( $analytics_version, $this->analytics_version, '>' ) ) {
|
100 |
+
$this->analytics_version = $analytics_version;
|
101 |
+
$this->analytics_path = $data['path'];
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
if ( ! isset( $unique_entities[ $key ] ) ) {
|
107 |
+
$unique_entities[ $key ] = $data;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
if ( file_exists( $this->analytics_path ) && ! class_exists( 'BSF_Analytics' ) ) {
|
113 |
+
require_once $this->analytics_path . '/class-bsf-analytics.php';
|
114 |
+
new BSF_Analytics( $unique_entities, $this->analytics_path, $this->analytics_version );
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
admin/bsf-analytics/class-bsf-analytics.php
CHANGED
@@ -18,60 +18,74 @@ if ( ! class_exists( 'BSF_Analytics' ) ) {
|
|
18 |
*/
|
19 |
class BSF_Analytics {
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
/**
|
22 |
* Member Variable
|
23 |
*
|
24 |
* @var string Usage tracking document URL
|
25 |
*/
|
26 |
-
|
27 |
|
28 |
/**
|
29 |
* Setup actions, load files.
|
30 |
*
|
|
|
|
|
|
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
-
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
define( '
|
36 |
-
define( '
|
37 |
-
define( 'BSF_ANALYTICS_PATH', dirname( __FILE__ ) );
|
38 |
-
define( 'BSF_ANALYTICS_URI', $this->bsf_analytics_url() );
|
39 |
|
40 |
add_action( 'admin_init', array( $this, 'handle_optin_optout' ) );
|
41 |
-
add_action( 'cron_schedules', array( $this, 'every_two_days_schedule' ) );
|
42 |
add_action( 'admin_notices', array( $this, 'option_notice' ) );
|
43 |
-
add_action( '
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
if ( ! has_action( 'bsf_analytics_send', array( $this, 'send' ) ) ) {
|
48 |
-
add_action( 'bsf_analytics_send', array( $this, 'send' ) );
|
49 |
-
}
|
50 |
|
51 |
add_action( 'admin_init', array( $this, 'register_usage_tracking_setting' ) );
|
52 |
|
53 |
-
add_action( 'update_option_bsf_analytics_optin', array( $this, 'update_analytics_option_callback' ), 10, 3 );
|
54 |
-
add_action( 'add_option_bsf_analytics_optin', array( $this, 'add_analytics_option_callback' ), 10, 2 );
|
55 |
-
|
56 |
$this->includes();
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
/**
|
60 |
* BSF Analytics URL
|
61 |
*
|
|
|
62 |
* @return String URL of bsf-analytics directory.
|
63 |
* @since 1.0.0
|
64 |
*/
|
65 |
-
public function
|
66 |
-
|
67 |
-
$path = wp_normalize_path( BSF_ANALYTICS_PATH );
|
68 |
-
$theme_dir = wp_normalize_path( get_template_directory() );
|
69 |
-
|
70 |
-
if ( strpos( $path, $theme_dir ) !== false ) {
|
71 |
-
return rtrim( get_template_directory_uri() . '/admin/bsf-analytics/', '/' );
|
72 |
-
} else {
|
73 |
-
return rtrim( plugin_dir_url( BSF_ANALYTICS_FILE ), '/' );
|
74 |
-
}
|
75 |
}
|
76 |
|
77 |
/**
|
@@ -129,21 +143,30 @@ if ( ! class_exists( 'BSF_Analytics' ) ) {
|
|
129 |
* @since 1.0.0
|
130 |
*/
|
131 |
public function is_tracking_enabled() {
|
132 |
-
$is_enabled = get_site_option( 'bsf_analytics_optin' ) === 'yes' ? true : false;
|
133 |
-
$is_enabled = $this->is_white_label_enabled() ? false : $is_enabled;
|
134 |
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
}
|
137 |
|
138 |
/**
|
139 |
* Check if WHITE label is enabled for BSF products.
|
140 |
*
|
|
|
141 |
* @return bool
|
142 |
* @since 1.0.0
|
143 |
*/
|
144 |
-
public function is_white_label_enabled() {
|
145 |
|
146 |
-
$options = apply_filters( '
|
147 |
$is_enabled = false;
|
148 |
|
149 |
if ( is_array( $options ) ) {
|
@@ -169,67 +192,75 @@ if ( ! class_exists( 'BSF_Analytics' ) ) {
|
|
169 |
return;
|
170 |
}
|
171 |
|
172 |
-
|
173 |
-
if ( false !== get_site_option( 'bsf_analytics_optin', false ) || $this->is_white_label_enabled() ) {
|
174 |
-
return;
|
175 |
-
}
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
return;
|
180 |
-
}
|
181 |
|
182 |
-
|
183 |
-
|
|
|
|
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
|
|
|
188 |
|
189 |
-
|
|
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
'
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
),
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
)
|
232 |
-
);
|
233 |
}
|
234 |
|
235 |
/**
|
@@ -238,27 +269,35 @@ if ( ! class_exists( 'BSF_Analytics' ) ) {
|
|
238 |
* @since 1.0.0
|
239 |
*/
|
240 |
public function handle_optin_optout() {
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
return;
|
243 |
}
|
244 |
|
245 |
-
if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['
|
246 |
return;
|
247 |
}
|
248 |
|
249 |
-
$optin_status = isset( $_GET['
|
250 |
|
251 |
if ( 'yes' === $optin_status ) {
|
252 |
-
$this->optin();
|
253 |
} elseif ( 'no' === $optin_status ) {
|
254 |
-
$this->optout();
|
255 |
}
|
256 |
|
257 |
wp_safe_redirect(
|
258 |
remove_query_arg(
|
259 |
array(
|
260 |
-
'
|
261 |
-
'
|
|
|
262 |
)
|
263 |
)
|
264 |
);
|
@@ -267,54 +306,21 @@ if ( ! class_exists( 'BSF_Analytics' ) ) {
|
|
267 |
/**
|
268 |
* Opt in to usage tracking.
|
269 |
*
|
|
|
270 |
* @since 1.0.0
|
271 |
*/
|
272 |
-
private function optin() {
|
273 |
-
update_site_option( '
|
274 |
}
|
275 |
|
276 |
/**
|
277 |
* Opt out to usage tracking.
|
278 |
*
|
|
|
279 |
* @since 1.0.0
|
280 |
*/
|
281 |
-
private function optout() {
|
282 |
-
update_site_option( '
|
283 |
-
}
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Add two days event schedule variables.
|
287 |
-
*
|
288 |
-
* @param array $schedules scheduled array data.
|
289 |
-
* @since 1.0.0
|
290 |
-
*/
|
291 |
-
public function every_two_days_schedule( $schedules ) {
|
292 |
-
$schedules['every_two_days'] = array(
|
293 |
-
'interval' => 2 * DAY_IN_SECONDS,
|
294 |
-
'display' => __( 'Every two days', 'all-in-one-schemaorg-rich-snippets' ),
|
295 |
-
);
|
296 |
-
|
297 |
-
return $schedules;
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Schedule usage tracking event.
|
302 |
-
*
|
303 |
-
* @since 1.0.0
|
304 |
-
*/
|
305 |
-
private function schedule_event() {
|
306 |
-
if ( ! wp_next_scheduled( 'bsf_analytics_send' ) && $this->is_tracking_enabled() ) {
|
307 |
-
wp_schedule_event( time(), 'every_two_days', 'bsf_analytics_send' );
|
308 |
-
}
|
309 |
-
}
|
310 |
-
|
311 |
-
/**
|
312 |
-
* Unschedule usage tracking event.
|
313 |
-
*
|
314 |
-
* @since 1.0.0
|
315 |
-
*/
|
316 |
-
private function unschedule_event() {
|
317 |
-
wp_clear_scheduled_hook( 'bsf_analytics_send' );
|
318 |
}
|
319 |
|
320 |
/**
|
@@ -333,22 +339,37 @@ if ( ! class_exists( 'BSF_Analytics' ) ) {
|
|
333 |
*/
|
334 |
public function register_usage_tracking_setting() {
|
335 |
|
336 |
-
|
337 |
-
return;
|
338 |
-
}
|
339 |
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
array( 'sanitize_callback' => array( $this, 'sanitize_option' ) ) // sanitize callback function.
|
344 |
-
);
|
345 |
|
346 |
-
|
347 |
-
'
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
}
|
353 |
|
354 |
/**
|
@@ -369,15 +390,17 @@ if ( ! class_exists( 'BSF_Analytics' ) ) {
|
|
369 |
/**
|
370 |
* Print settings field HTML.
|
371 |
*
|
|
|
372 |
* @since 1.0.0
|
373 |
*/
|
374 |
-
public function render_settings_field_html() {
|
375 |
?>
|
376 |
<fieldset>
|
377 |
-
<label for="
|
378 |
-
<input id="
|
379 |
<?php
|
380 |
-
|
|
|
381 |
|
382 |
if ( is_multisite() ) {
|
383 |
esc_html_e( ' This will be applicable for all sites from the network.', 'all-in-one-schemaorg-rich-snippets' );
|
@@ -385,75 +408,26 @@ if ( ! class_exists( 'BSF_Analytics' ) ) {
|
|
385 |
?>
|
386 |
</label>
|
387 |
<?php
|
388 |
-
echo wp_kses_post( sprintf( '<a href="%1s" target="_blank" rel="noreferrer noopener">%2s</a>', esc_url( $
|
389 |
?>
|
390 |
</fieldset>
|
391 |
<?php
|
392 |
}
|
393 |
|
394 |
-
/**
|
395 |
-
* Get current product name.
|
396 |
-
*
|
397 |
-
* @return string $plugin_data['Name] Name of plugin.
|
398 |
-
* @since 1.0.0
|
399 |
-
*/
|
400 |
-
private function get_product_name() {
|
401 |
-
|
402 |
-
$base = wp_normalize_path( dirname( __FILE__ ) );
|
403 |
-
$theme_dir = wp_normalize_path( get_template_directory() );
|
404 |
-
|
405 |
-
if ( false !== strpos( $base, $theme_dir ) ) {
|
406 |
-
$theme = wp_get_theme( get_template() );
|
407 |
-
return $theme->get( 'Name' );
|
408 |
-
}
|
409 |
-
|
410 |
-
$base = plugin_basename( __FILE__ );
|
411 |
-
|
412 |
-
$exploded_path = explode( '/', $base, 2 );
|
413 |
-
$plugin_slug = $exploded_path[0];
|
414 |
-
|
415 |
-
return $this->get_plugin_name( $plugin_slug );
|
416 |
-
}
|
417 |
-
|
418 |
-
/**
|
419 |
-
* Get plugin name by plugin slug.
|
420 |
-
*
|
421 |
-
* @param string $plugin_slug Plugin slug.
|
422 |
-
* @return string $plugin_info['Name'] Plugin name.
|
423 |
-
*/
|
424 |
-
private function get_plugin_name( $plugin_slug ) {
|
425 |
-
|
426 |
-
$plugins = get_option( 'active_plugins' );
|
427 |
-
|
428 |
-
if ( ! function_exists( 'get_plugin_data' ) ) {
|
429 |
-
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
430 |
-
}
|
431 |
-
|
432 |
-
foreach ( $plugins as $plugin_file ) {
|
433 |
-
|
434 |
-
$plugin_folder = explode( '/', $plugin_file );
|
435 |
-
$plugin_folder = $plugin_folder[0];
|
436 |
-
if ( $plugin_folder === $plugin_slug ) {
|
437 |
-
$plugin_path = WP_PLUGIN_DIR . '/' . $plugin_file;
|
438 |
-
$plugin_data = get_plugin_data( $plugin_path );
|
439 |
-
return $plugin_data['Name'];
|
440 |
-
}
|
441 |
-
}
|
442 |
-
}
|
443 |
-
|
444 |
/**
|
445 |
* Set analytics installed time in option.
|
446 |
*
|
|
|
447 |
* @return string $time analytics installed time.
|
448 |
* @since 1.0.0
|
449 |
*/
|
450 |
-
private function get_analytics_install_time() {
|
451 |
|
452 |
-
$time = get_site_option( '
|
453 |
|
454 |
if ( ! $time ) {
|
455 |
$time = time();
|
456 |
-
update_site_option( '
|
457 |
}
|
458 |
|
459 |
return $time;
|
@@ -468,7 +442,9 @@ if ( ! class_exists( 'BSF_Analytics' ) ) {
|
|
468 |
* @since 1.0.0
|
469 |
*/
|
470 |
public function update_analytics_option_callback( $old_value, $value, $option ) {
|
471 |
-
|
|
|
|
|
472 |
}
|
473 |
|
474 |
/**
|
@@ -479,50 +455,49 @@ if ( ! class_exists( 'BSF_Analytics' ) ) {
|
|
479 |
* @since 1.0.0
|
480 |
*/
|
481 |
public function add_analytics_option_callback( $option, $value ) {
|
482 |
-
|
|
|
|
|
483 |
}
|
484 |
|
485 |
/**
|
486 |
-
*
|
487 |
*
|
488 |
* @since 1.0.0
|
489 |
*/
|
490 |
-
public function
|
491 |
|
492 |
-
if (
|
493 |
-
$this->unschedule_event();
|
494 |
return;
|
495 |
}
|
496 |
|
497 |
-
$
|
498 |
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
}
|
504 |
}
|
505 |
|
506 |
/**
|
507 |
* Save analytics option to network.
|
508 |
*
|
|
|
509 |
* @param string $value value of option.
|
510 |
* @since 1.0.0
|
511 |
*/
|
512 |
-
public function add_option_to_network( $value ) {
|
513 |
|
514 |
// If action coming from general settings page.
|
515 |
if ( isset( $_POST['option_page'] ) && 'general' === $_POST['option_page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
|
516 |
|
517 |
-
if ( get_site_option(
|
518 |
-
update_site_option(
|
519 |
} else {
|
520 |
-
add_site_option(
|
521 |
}
|
522 |
}
|
523 |
}
|
524 |
}
|
525 |
-
|
526 |
-
new BSF_Analytics();
|
527 |
-
|
528 |
}
|
18 |
*/
|
19 |
class BSF_Analytics {
|
20 |
|
21 |
+
/**
|
22 |
+
* Member Variable
|
23 |
+
*
|
24 |
+
* @var array Entities data.
|
25 |
+
*/
|
26 |
+
private $entities;
|
27 |
+
|
28 |
/**
|
29 |
* Member Variable
|
30 |
*
|
31 |
* @var string Usage tracking document URL
|
32 |
*/
|
33 |
+
public $usage_doc_link = 'https://store.brainstormforce.com/usage-tracking/?utm_source=wp_dashboard&utm_medium=general_settings&utm_campaign=usage_tracking';
|
34 |
|
35 |
/**
|
36 |
* Setup actions, load files.
|
37 |
*
|
38 |
+
* @param array $args entity data for analytics.
|
39 |
+
* @param string $analytics_path directory path to analytics library.
|
40 |
+
* @param float $analytics_version analytics library version.
|
41 |
* @since 1.0.0
|
42 |
*/
|
43 |
+
public function __construct( $args, $analytics_path, $analytics_version ) {
|
44 |
+
|
45 |
+
// Bail when no analytics entities are registered.
|
46 |
+
if ( empty( $args ) ) {
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
+
$this->entities = $args;
|
51 |
|
52 |
+
define( 'BSF_ANALYTICS_VERSION', $analytics_version );
|
53 |
+
define( 'BSF_ANALYTICS_URI', $this->get_analytics_url( $analytics_path ) );
|
|
|
|
|
54 |
|
55 |
add_action( 'admin_init', array( $this, 'handle_optin_optout' ) );
|
|
|
56 |
add_action( 'admin_notices', array( $this, 'option_notice' ) );
|
57 |
+
add_action( 'init', array( $this, 'maybe_track_analytics' ), 99 );
|
58 |
|
59 |
+
$this->set_actions();
|
|
|
|
|
|
|
|
|
60 |
|
61 |
add_action( 'admin_init', array( $this, 'register_usage_tracking_setting' ) );
|
62 |
|
|
|
|
|
|
|
63 |
$this->includes();
|
64 |
}
|
65 |
|
66 |
+
/**
|
67 |
+
* Setup actions for admin notice style and analytics cron event.
|
68 |
+
*
|
69 |
+
* @since 1.0.4
|
70 |
+
*/
|
71 |
+
public function set_actions() {
|
72 |
+
|
73 |
+
foreach ( $this->entities as $key => $data ) {
|
74 |
+
add_action( 'astra_notice_before_markup_' . $key . '-optin-notice', array( $this, 'enqueue_assets' ) );
|
75 |
+
add_action( 'update_option_' . $key . '_analytics_optin', array( $this, 'update_analytics_option_callback' ), 10, 3 );
|
76 |
+
add_action( 'add_option_' . $key . '_analytics_optin', array( $this, 'add_analytics_option_callback' ), 10, 2 );
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
/**
|
81 |
* BSF Analytics URL
|
82 |
*
|
83 |
+
* @param string $analytics_path directory path to analytics library.
|
84 |
* @return String URL of bsf-analytics directory.
|
85 |
* @since 1.0.0
|
86 |
*/
|
87 |
+
public function get_analytics_url( $analytics_path ) {
|
88 |
+
return str_replace( WP_CONTENT_DIR, content_url(), $analytics_path );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
/**
|
143 |
* @since 1.0.0
|
144 |
*/
|
145 |
public function is_tracking_enabled() {
|
|
|
|
|
146 |
|
147 |
+
foreach ( $this->entities as $key => $data ) {
|
148 |
+
|
149 |
+
$is_enabled = get_site_option( $key . '_analytics_optin' ) === 'yes' ? true : false;
|
150 |
+
$is_enabled = $this->is_white_label_enabled( $key ) ? false : $is_enabled;
|
151 |
+
|
152 |
+
if ( apply_filters( $key . '_tracking_enabled', $is_enabled ) ) {
|
153 |
+
return true;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
return false;
|
158 |
}
|
159 |
|
160 |
/**
|
161 |
* Check if WHITE label is enabled for BSF products.
|
162 |
*
|
163 |
+
* @param string $source source of analytics.
|
164 |
* @return bool
|
165 |
* @since 1.0.0
|
166 |
*/
|
167 |
+
public function is_white_label_enabled( $source ) {
|
168 |
|
169 |
+
$options = apply_filters( $source . '_white_label_options', array() );
|
170 |
$is_enabled = false;
|
171 |
|
172 |
if ( is_array( $options ) ) {
|
192 |
return;
|
193 |
}
|
194 |
|
195 |
+
foreach ( $this->entities as $key => $data ) {
|
|
|
|
|
|
|
196 |
|
197 |
+
$time_to_display = isset( $data['time_to_display'] ) ? $data['time_to_display'] : '+24 hours';
|
198 |
+
$usage_doc_link = isset( $data['usage_doc_link'] ) ? $data['usage_doc_link'] : $this->usage_doc_link;
|
|
|
|
|
199 |
|
200 |
+
// Don't display the notice if tracking is disabled or White Label is enabled for any of our plugins.
|
201 |
+
if ( false !== get_site_option( $key . '_analytics_optin', false ) || $this->is_white_label_enabled( $key ) ) {
|
202 |
+
continue;
|
203 |
+
}
|
204 |
|
205 |
+
// Show tracker consent notice after 24 hours from installed time.
|
206 |
+
if ( strtotime( $time_to_display, $this->get_analytics_install_time( $key ) ) > time() ) {
|
207 |
+
continue;
|
208 |
+
}
|
209 |
|
210 |
+
/* translators: %s product name */
|
211 |
+
$notice_string = __( 'Want to help make <strong>%1s</strong> even more awesome? Allow us to collect non-sensitive diagnostic data and usage information. ', 'all-in-one-schemaorg-rich-snippets' );
|
212 |
|
213 |
+
if ( is_multisite() ) {
|
214 |
+
$notice_string .= __( 'This will be applicable for all sites from the network.', 'all-in-one-schemaorg-rich-snippets' );
|
215 |
+
}
|
216 |
+
|
217 |
+
$language_dir = is_rtl() ? 'rtl' : 'ltr';
|
218 |
+
|
219 |
+
Astra_Notices::add_notice(
|
220 |
+
array(
|
221 |
+
'id' => $key . '-optin-notice',
|
222 |
+
'type' => '',
|
223 |
+
'message' => sprintf(
|
224 |
+
'<div class="notice-content">
|
225 |
+
<div class="notice-heading">
|
226 |
+
%1$s
|
227 |
+
</div>
|
228 |
+
<div class="astra-notices-container">
|
229 |
+
<a href="%2$s" class="astra-notices button-primary">
|
230 |
+
%3$s
|
231 |
+
</a>
|
232 |
+
<a href="%4$s" data-repeat-notice-after="%5$s" class="astra-notices button-secondary">
|
233 |
+
%6$s
|
234 |
+
</a>
|
235 |
+
</div>
|
236 |
+
</div>',
|
237 |
+
/* translators: %s usage doc link */
|
238 |
+
sprintf( $notice_string . '<span dir="%2s"><a href="%3s" target="_blank" rel="noreferrer noopener">%4s</a><span>', esc_html( $data['product_name'] ), $language_dir, esc_url( $usage_doc_link ), __( ' Know More.', 'all-in-one-schemaorg-rich-snippets' ) ),
|
239 |
+
add_query_arg(
|
240 |
+
array(
|
241 |
+
$key . '_analytics_optin' => 'yes',
|
242 |
+
$key . '_analytics_nonce' => wp_create_nonce( $key . '_analytics_optin' ),
|
243 |
+
'bsf_analytics_source' => $key,
|
244 |
+
)
|
245 |
+
),
|
246 |
+
__( 'Yes! Allow it', 'all-in-one-schemaorg-rich-snippets' ),
|
247 |
+
add_query_arg(
|
248 |
+
array(
|
249 |
+
$key . '_analytics_optin' => 'no',
|
250 |
+
$key . '_analytics_nonce' => wp_create_nonce( $key . '_analytics_optin' ),
|
251 |
+
'bsf_analytics_source' => $key,
|
252 |
+
)
|
253 |
+
),
|
254 |
+
MONTH_IN_SECONDS,
|
255 |
+
__( 'No Thanks', 'all-in-one-schemaorg-rich-snippets' )
|
256 |
),
|
257 |
+
'show_if' => true,
|
258 |
+
'repeat-notice-after' => false,
|
259 |
+
'priority' => 18,
|
260 |
+
'display-with-other-notices' => true,
|
261 |
+
)
|
262 |
+
);
|
263 |
+
}
|
|
|
|
|
264 |
}
|
265 |
|
266 |
/**
|
269 |
* @since 1.0.0
|
270 |
*/
|
271 |
public function handle_optin_optout() {
|
272 |
+
|
273 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
274 |
+
return;
|
275 |
+
}
|
276 |
+
|
277 |
+
$source = isset( $_GET['bsf_analytics_source'] ) ? sanitize_text_field( wp_unslash( $_GET['bsf_analytics_source'] ) ) : '';
|
278 |
+
|
279 |
+
if ( ! isset( $_GET[ $source . '_analytics_nonce' ] ) ) {
|
280 |
return;
|
281 |
}
|
282 |
|
283 |
+
if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET[ $source . '_analytics_nonce' ] ) ), $source . '_analytics_optin' ) ) {
|
284 |
return;
|
285 |
}
|
286 |
|
287 |
+
$optin_status = isset( $_GET[ $source . '_analytics_optin' ] ) ? sanitize_text_field( wp_unslash( $_GET[ $source . '_analytics_optin' ] ) ) : '';
|
288 |
|
289 |
if ( 'yes' === $optin_status ) {
|
290 |
+
$this->optin( $source );
|
291 |
} elseif ( 'no' === $optin_status ) {
|
292 |
+
$this->optout( $source );
|
293 |
}
|
294 |
|
295 |
wp_safe_redirect(
|
296 |
remove_query_arg(
|
297 |
array(
|
298 |
+
$source . '_analytics_optin',
|
299 |
+
$source . '_analytics_nonce',
|
300 |
+
'bsf_analytics_source',
|
301 |
)
|
302 |
)
|
303 |
);
|
306 |
/**
|
307 |
* Opt in to usage tracking.
|
308 |
*
|
309 |
+
* @param string $source source of analytics.
|
310 |
* @since 1.0.0
|
311 |
*/
|
312 |
+
private function optin( $source ) {
|
313 |
+
update_site_option( $source . '_analytics_optin', 'yes' );
|
314 |
}
|
315 |
|
316 |
/**
|
317 |
* Opt out to usage tracking.
|
318 |
*
|
319 |
+
* @param string $source source of analytics.
|
320 |
* @since 1.0.0
|
321 |
*/
|
322 |
+
private function optout( $source ) {
|
323 |
+
update_site_option( $source . '_analytics_optin', 'no' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
}
|
325 |
|
326 |
/**
|
339 |
*/
|
340 |
public function register_usage_tracking_setting() {
|
341 |
|
342 |
+
foreach ( $this->entities as $key => $data ) {
|
|
|
|
|
343 |
|
344 |
+
if ( ! apply_filters( $key . '_tracking_enabled', true ) || $this->is_white_label_enabled( $key ) ) {
|
345 |
+
return;
|
346 |
+
}
|
|
|
|
|
347 |
|
348 |
+
$usage_doc_link = isset( $data['usage_doc_link'] ) ? $data['usage_doc_link'] : $this->usage_doc_link;
|
349 |
+
$author = isset( $data['author'] ) ? $data['author'] : 'Brainstorm Force';
|
350 |
+
|
351 |
+
register_setting(
|
352 |
+
'general', // Options group.
|
353 |
+
$key . '_analytics_optin', // Option name/database.
|
354 |
+
array( 'sanitize_callback' => array( $this, 'sanitize_option' ) ) // sanitize callback function.
|
355 |
+
);
|
356 |
+
|
357 |
+
add_settings_field(
|
358 |
+
$key . '-analytics-optin', // Field ID.
|
359 |
+
__( 'Usage Tracking', 'all-in-one-schemaorg-rich-snippets' ), // Field title.
|
360 |
+
array( $this, 'render_settings_field_html' ), // Field callback function.
|
361 |
+
'general',
|
362 |
+
'default', // Settings page slug.
|
363 |
+
array(
|
364 |
+
'type' => 'checkbox',
|
365 |
+
'title' => $author,
|
366 |
+
'name' => $key . '_analytics_optin',
|
367 |
+
'label_for' => $key . '-analytics-optin',
|
368 |
+
'id' => $key . '-analytics-optin',
|
369 |
+
'usage_doc_link' => $usage_doc_link,
|
370 |
+
)
|
371 |
+
);
|
372 |
+
}
|
373 |
}
|
374 |
|
375 |
/**
|
390 |
/**
|
391 |
* Print settings field HTML.
|
392 |
*
|
393 |
+
* @param array $args arguments to field.
|
394 |
* @since 1.0.0
|
395 |
*/
|
396 |
+
public function render_settings_field_html( $args ) {
|
397 |
?>
|
398 |
<fieldset>
|
399 |
+
<label for="<?php echo esc_attr( $args['label_for'] ); ?>">
|
400 |
+
<input id="<?php echo esc_attr( $args['id'] ); ?>" type="checkbox" value="1" name="<?php echo esc_attr( $args['name'] ); ?>" <?php checked( get_site_option( $args['name'], 'no' ), 'yes' ); ?>>
|
401 |
<?php
|
402 |
+
/* translators: %s Product title */
|
403 |
+
echo esc_html( sprintf( __( 'Allow %s products to track non-sensitive usage tracking data.', 'all-in-one-schemaorg-rich-snippets' ), $args['title'] ) );// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
|
404 |
|
405 |
if ( is_multisite() ) {
|
406 |
esc_html_e( ' This will be applicable for all sites from the network.', 'all-in-one-schemaorg-rich-snippets' );
|
408 |
?>
|
409 |
</label>
|
410 |
<?php
|
411 |
+
echo wp_kses_post( sprintf( '<a href="%1s" target="_blank" rel="noreferrer noopener">%2s</a>', esc_url( $args['usage_doc_link'] ), __( 'Learn More.', 'all-in-one-schemaorg-rich-snippets' ) ) );
|
412 |
?>
|
413 |
</fieldset>
|
414 |
<?php
|
415 |
}
|
416 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
/**
|
418 |
* Set analytics installed time in option.
|
419 |
*
|
420 |
+
* @param string $source source of analytics.
|
421 |
* @return string $time analytics installed time.
|
422 |
* @since 1.0.0
|
423 |
*/
|
424 |
+
private function get_analytics_install_time( $source ) {
|
425 |
|
426 |
+
$time = get_site_option( $source . '_analytics_installed_time' );
|
427 |
|
428 |
if ( ! $time ) {
|
429 |
$time = time();
|
430 |
+
update_site_option( $source . '_analytics_installed_time', time() );
|
431 |
}
|
432 |
|
433 |
return $time;
|
442 |
* @since 1.0.0
|
443 |
*/
|
444 |
public function update_analytics_option_callback( $old_value, $value, $option ) {
|
445 |
+
if ( is_multisite() ) {
|
446 |
+
$this->add_option_to_network( $option, $value );
|
447 |
+
}
|
448 |
}
|
449 |
|
450 |
/**
|
455 |
* @since 1.0.0
|
456 |
*/
|
457 |
public function add_analytics_option_callback( $option, $value ) {
|
458 |
+
if ( is_multisite() ) {
|
459 |
+
$this->add_option_to_network( $option, $value );
|
460 |
+
}
|
461 |
}
|
462 |
|
463 |
/**
|
464 |
+
* Send analaytics track event if tracking is enabled.
|
465 |
*
|
466 |
* @since 1.0.0
|
467 |
*/
|
468 |
+
public function maybe_track_analytics() {
|
469 |
|
470 |
+
if ( ! $this->is_tracking_enabled() ) {
|
|
|
471 |
return;
|
472 |
}
|
473 |
|
474 |
+
$analytics_track = get_site_transient( 'bsf_analytics_track' );
|
475 |
|
476 |
+
// If the last data sent is 2 days old i.e. transient is expired.
|
477 |
+
if ( ! $analytics_track ) {
|
478 |
+
$this->send();
|
479 |
+
set_site_transient( 'bsf_analytics_track', true, 2 * DAY_IN_SECONDS );
|
480 |
}
|
481 |
}
|
482 |
|
483 |
/**
|
484 |
* Save analytics option to network.
|
485 |
*
|
486 |
+
* @param string $option name of option.
|
487 |
* @param string $value value of option.
|
488 |
* @since 1.0.0
|
489 |
*/
|
490 |
+
public function add_option_to_network( $option, $value ) {
|
491 |
|
492 |
// If action coming from general settings page.
|
493 |
if ( isset( $_POST['option_page'] ) && 'general' === $_POST['option_page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
|
494 |
|
495 |
+
if ( get_site_option( $option ) ) {
|
496 |
+
update_site_option( $option, $value );
|
497 |
} else {
|
498 |
+
add_site_option( $option, $value );
|
499 |
}
|
500 |
}
|
501 |
}
|
502 |
}
|
|
|
|
|
|
|
503 |
}
|
admin/bsf-analytics/version.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bsf-analytics-ver": "1.1.0"
|
3 |
+
}
|
4 |
+
|
admin/css/admin.css
CHANGED
@@ -299,6 +299,19 @@ span.bsf-tooltiptext:after {
|
|
299 |
outline: none;
|
300 |
box-shadow: none;
|
301 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
@media(max-width:768px){
|
303 |
#bsf-postbox-container-2 {
|
304 |
width: 100%;
|
299 |
outline: none;
|
300 |
box-shadow: none;
|
301 |
}
|
302 |
+
.bsf-panel .meta-box-sortables .postbox .handlediv{
|
303 |
+
float:right;
|
304 |
+
border-bottom: 1px solid #ccd0d4;
|
305 |
+
}
|
306 |
+
.bsf-panel .meta-box-sortables .postbox .hndle{
|
307 |
+
border-bottom: 1px solid #ccd0d4;
|
308 |
+
}
|
309 |
+
.bsf-woocommerce-setting .handlediv, .bsf-contact .handlediv{
|
310 |
+
float:right;
|
311 |
+
}
|
312 |
+
.postbox.bsf-woocommerce-setting.closed, .postbox.bsf-contact.closed{
|
313 |
+
border-bottom: 1px solid #ccd0d4;
|
314 |
+
}
|
315 |
@media(max-width:768px){
|
316 |
#bsf-postbox-container-2 {
|
317 |
width: 100%;
|
admin/js/jquery.hashchange.min.js
CHANGED
@@ -1,9 +1,5 @@
|
|
1 |
-
/*
|
2 |
-
* jQuery hashchange event
|
3 |
-
*
|
4 |
-
|
5 |
-
|
6 |
-
* Dual licensed under the MIT and GPL licenses.
|
7 |
-
* http://benalman.com/about/license/
|
8 |
-
*/
|
9 |
-
(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
|
1 |
+
/*
|
2 |
+
* jQuery hashchange event, v1.4, 2013-11-29
|
3 |
+
* https://github.com/georgekosmidis/jquery-hashchange
|
4 |
+
*/
|
5 |
+
(function(e,t,n){"$:nomunge";function f(e){e=e||location.href;return"#"+e.replace(/^[^#]*#?(.*)$/,"$1")}var r="hashchange",i=document,s,o=e.event.special,u=i.documentMode,a="on"+r in t&&(u===n||u>7);e.fn[r]=function(e){return e?this.bind(r,e):this.trigger(r)};e.fn[r].delay=50;o[r]=e.extend(o[r],{setup:function(){if(a){return false}e(s.start)},teardown:function(){if(a){return false}e(s.stop)}});s=function(){function p(){var n=f(),i=h(u);if(n!==u){c(u=n,i);e(t).trigger(r)}else if(i!==u){location.href=location.href.replace(/#.*/,"")+i}o=setTimeout(p,e.fn[r].delay)}var s={},o,u=f(),l=function(e){return e},c=l,h=l;s.start=function(){o||p()};s.stop=function(){o&&clearTimeout(o);o=n};var d=function(){var e,t=3,n=document.createElement("div"),r=n.getElementsByTagName("i");while(n.innerHTML="<!--[if gt IE "+ ++t+"]><i></i><![endif]-->",r[0]);return t>4?t:e}();d&&!a&&function(){var t,n;s.start=function(){if(!t){n=e.fn[r].src;n=n&&n+f();t=e('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){n||c(f());p()}).attr("src",n||"javascript:0").insertAfter("body")[0].contentWindow;i.onpropertychange=function(){try{if(event.propertyName==="title"){t.document.title=i.title}}catch(e){}}}};s.stop=l;h=function(){return f(t.location.href)};c=function(n,s){var o=t.document,u=e.fn[r].domain;if(n!==s){o.title=i.title;o.open();u&&o.write('<script>document.domain="'+u+'"</script>');o.close();t.location.hash=n}}}();return s}()})(jQuery,this)
|
|
|
|
|
|
|
|
index.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Author: Brainstorm Force
|
6 |
* Author URI: https://www.brainstormforce.com
|
7 |
* Description: Welcome to the Schema - All In One Schema Rich Snippets! You can now easily add schema markup on various * pages and posts of your website. Implement schema types such as Review, Events, Recipes, Article, Products, Services * *etc.
|
8 |
-
* Version: 1.6.
|
9 |
* Text Domain: rich-snippets
|
10 |
* License: GPL2
|
11 |
*
|
@@ -374,7 +374,23 @@ if ( is_admin() ) {
|
|
374 |
// Load Astra Notices library.
|
375 |
require_once plugin_dir_path( __FILE__ ) . '/lib/notices/class-astra-notices.php';
|
376 |
}
|
377 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
add_filter( 'bsf_meta_boxes', 'bsf_metaboxes' );
|
379 |
// Instantiating the Class.
|
380 |
if ( class_exists( 'RichSnippets' ) ) {
|
5 |
* Author: Brainstorm Force
|
6 |
* Author URI: https://www.brainstormforce.com
|
7 |
* Description: Welcome to the Schema - All In One Schema Rich Snippets! You can now easily add schema markup on various * pages and posts of your website. Implement schema types such as Review, Events, Recipes, Article, Products, Services * *etc.
|
8 |
+
* Version: 1.6.3
|
9 |
* Text Domain: rich-snippets
|
10 |
* License: GPL2
|
11 |
*
|
374 |
// Load Astra Notices library.
|
375 |
require_once plugin_dir_path( __FILE__ ) . '/lib/notices/class-astra-notices.php';
|
376 |
}
|
377 |
+
// BSF Analytics library.
|
378 |
+
if ( ! class_exists( 'BSF_Analytics_Loader' ) ) {
|
379 |
+
require_once plugin_dir_path( __FILE__ ) . 'admin/bsf-analytics/class-bsf-analytics-loader.php';
|
380 |
+
}
|
381 |
+
|
382 |
+
$bsf_analytics = BSF_Analytics_Loader::get_instance();
|
383 |
+
|
384 |
+
$bsf_analytics->set_entity(
|
385 |
+
array(
|
386 |
+
'bsf' => array(
|
387 |
+
'product_name' => 'All In One Schema Rich Snippets',
|
388 |
+
'path' => plugin_dir_path( __FILE__ ) . 'admin/bsf-analytics',
|
389 |
+
'author' => 'Brainstorm Force',
|
390 |
+
'time_to_display' => '+24 hours',
|
391 |
+
),
|
392 |
+
)
|
393 |
+
);
|
394 |
add_filter( 'bsf_meta_boxes', 'bsf_metaboxes' );
|
395 |
// Instantiating the Class.
|
396 |
if ( class_exists( 'RichSnippets' ) ) {
|
languages/all-in-one-schemaorg-rich-snippets.pot
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
# This file is distributed under the GPL2.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Schema - All In One Schema Rich Snippets 1.6.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/all-in-one-schemaorg-rich-snippets\n"
|
8 |
-
"POT-Creation-Date: 2020-
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -25,47 +25,44 @@ msgstr ""
|
|
25 |
"X-Textdomain-Support: yes\n"
|
26 |
"X-Generator: grunt-wp-i18n 1.0.3\n"
|
27 |
|
28 |
-
#: admin/bsf-analytics/class-bsf-analytics.php:
|
29 |
#. translators: %s product name
|
30 |
msgid ""
|
31 |
"Want to help make <strong>%1s</strong> even more awesome? Allow us to "
|
32 |
"collect non-sensitive diagnostic data and usage information. "
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: admin/bsf-analytics/class-bsf-analytics.php:
|
36 |
msgid "This will be applicable for all sites from the network."
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: admin/bsf-analytics/class-bsf-analytics.php:
|
40 |
#. translators: %s usage doc link
|
41 |
msgid " Know More."
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: admin/bsf-analytics/class-bsf-analytics.php:
|
45 |
msgid "Yes! Allow it"
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: admin/bsf-analytics/class-bsf-analytics.php:
|
49 |
msgid "No Thanks"
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: admin/bsf-analytics/class-bsf-analytics.php:
|
53 |
-
msgid "Every two days"
|
54 |
-
msgstr ""
|
55 |
-
|
56 |
-
#: admin/bsf-analytics/class-bsf-analytics.php:348
|
57 |
msgid "Usage Tracking"
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: admin/bsf-analytics/class-bsf-analytics.php:
|
61 |
-
|
|
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: admin/bsf-analytics/class-bsf-analytics.php:
|
65 |
msgid " This will be applicable for all sites from the network."
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: admin/bsf-analytics/class-bsf-analytics.php:
|
69 |
msgid "Learn More."
|
70 |
msgstr ""
|
71 |
|
2 |
# This file is distributed under the GPL2.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Schema - All In One Schema Rich Snippets 1.6.3\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/all-in-one-schemaorg-rich-snippets\n"
|
8 |
+
"POT-Creation-Date: 2020-08-18 11:37:36+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-Textdomain-Support: yes\n"
|
26 |
"X-Generator: grunt-wp-i18n 1.0.3\n"
|
27 |
|
28 |
+
#: admin/bsf-analytics/class-bsf-analytics.php:211
|
29 |
#. translators: %s product name
|
30 |
msgid ""
|
31 |
"Want to help make <strong>%1s</strong> even more awesome? Allow us to "
|
32 |
"collect non-sensitive diagnostic data and usage information. "
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: admin/bsf-analytics/class-bsf-analytics.php:214
|
36 |
msgid "This will be applicable for all sites from the network."
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: admin/bsf-analytics/class-bsf-analytics.php:238
|
40 |
#. translators: %s usage doc link
|
41 |
msgid " Know More."
|
42 |
msgstr ""
|
43 |
|
44 |
+
#: admin/bsf-analytics/class-bsf-analytics.php:246
|
45 |
msgid "Yes! Allow it"
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: admin/bsf-analytics/class-bsf-analytics.php:255
|
49 |
msgid "No Thanks"
|
50 |
msgstr ""
|
51 |
|
52 |
+
#: admin/bsf-analytics/class-bsf-analytics.php:359
|
|
|
|
|
|
|
|
|
53 |
msgid "Usage Tracking"
|
54 |
msgstr ""
|
55 |
|
56 |
+
#: admin/bsf-analytics/class-bsf-analytics.php:403
|
57 |
+
#. translators: %s Product title
|
58 |
+
msgid "Allow %s products to track non-sensitive usage tracking data."
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: admin/bsf-analytics/class-bsf-analytics.php:406
|
62 |
msgid " This will be applicable for all sites from the network."
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: admin/bsf-analytics/class-bsf-analytics.php:411
|
66 |
msgid "Learn More."
|
67 |
msgstr ""
|
68 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: brainstormforce
|
|
3 |
Donate link: https://www.paypal.me/BrainstormForce
|
4 |
Tags: schema markup, structured data, rich snippets, schema.org, Microdata, schema
|
5 |
Requires at least: 3.7
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 1.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Boost CTR. Improve SEO & Rankings. Supports most of the content type. Works perfectly with Google, Bing, Yahoo & Facebook.
|
@@ -80,6 +80,11 @@ Review, Event, People, Product, Recipe, Software Application, Video, Articles et
|
|
80 |
|
81 |
== Changelog ==
|
82 |
|
|
|
|
|
|
|
|
|
|
|
83 |
= 1.6.2 =
|
84 |
- New - Users can now share non-personal usage data to help us test and develop better products. (https://store.brainstormforce.com/usage-tracking/?utm_source=wp_dashboard&utm_medium=general_settings&utm_campaign=usage_tracking)
|
85 |
|
3 |
Donate link: https://www.paypal.me/BrainstormForce
|
4 |
Tags: schema markup, structured data, rich snippets, schema.org, Microdata, schema
|
5 |
Requires at least: 3.7
|
6 |
+
Tested up to: 5.5
|
7 |
+
Stable tag: 1.6.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Boost CTR. Improve SEO & Rankings. Supports most of the content type. Works perfectly with Google, Bing, Yahoo & Facebook.
|
80 |
|
81 |
== Changelog ==
|
82 |
|
83 |
+
= 1.6.3 =
|
84 |
+
- Improvement - Compatibility with WordPress 5.5.
|
85 |
+
- Improvement - Updated the Hashchange jquery.
|
86 |
+
- Fix - Tabs UI breaks in the backend.
|
87 |
+
|
88 |
= 1.6.2 =
|
89 |
- New - Users can now share non-personal usage data to help us test and develop better products. (https://store.brainstormforce.com/usage-tracking/?utm_source=wp_dashboard&utm_medium=general_settings&utm_campaign=usage_tracking)
|
90 |
|