1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
|
<?php /** * @author ThemePunch <[email protected]> * @link https://www.themepunch.com/ * @copyright 2024 ThemePunch */
if(!defined('ABSPATH')) exit();
class RevSliderTracking extends RevSliderFunctions { public $tracking_enabled; public $tracking_status; private $tracking_url = 'tracking.php';
public function __construct(){ $gs = $this->get_global_settings();
$this->tracking_status = $this->get_val($gs, 'tracking', '1999-01-01'); $this->tracking_enabled = ($this->tracking_status === 'enabled') ? true : false;
if($this->is_enabled() === true){ add_filter('revslider_doing_html_export', array($this, 'count_html_export'), 10, 1); add_filter('revslider_exportSlider_export_data', array($this, 'count_regular_exports'), 10, 1); add_filter('revslider_retrieve_version_info_addition', array($this, 'add_additional_data'), 10, 1); add_filter('revslider_deactivate_plugin_info_addition', array($this, 'add_additional_data'), 10, 1); add_filter('revslider_activate_plugin_info_addition', array($this, 'add_additional_data'), 10, 1); add_action('revslider-retrieve_version_info', array($this, '_run'), 10); } }
public function is_enabled(){ return $this->tracking_enabled; }
public function get_status(){ return $this->tracking_status; }
public function get_tracking_data(){ $data = get_option('rs-tracking-data', array());
return (!is_array($data)) ? array() : $data; }
public function update_tracking_data($data){ return update_option('rs-tracking-data', $data); }
public function delete_tracking_data(){ return delete_option('rs-tracking-data'); }
public function count_regular_exports($_data){ $data = $this->get_tracking_data(); if(!isset($data['regular_exports'])) $data['regular_exports'] = 0; $data['regular_exports']++;
$this->update_tracking_data($data);
return $_data; }
public function count_html_export($slider){ $data = $this->get_tracking_data(); if(!isset($data['html_exports'])) $data['html_exports'] = 0; $data['html_exports']++;
$this->update_tracking_data($data);
return $slider; }
public function get_unique_identifier(){ $uid = get_option('revslider-uid'); if(strlen($uid) !== 12){ $uid = substr(md5(mt_rand()), 0, 12); update_option('revslider-uid', $uid); }
return $uid; }
/** * this will run the tracking functions and prepare it to be send to the themepunch servers **/ public function _run($deactivation = 'default'){ if(!$this->is_enabled()) return false; global $SR_GLOBALS;
$sl = new RevSliderSlide(); $data = $this->get_tracking_data(); $pages = $this->get_all_shortcode_pages(); $shortcodes = array();
if(!empty($pages)) $shortcodes = $this->get_shortcode_from_page($pages);
if(!isset($data['html_exports'])) $data['html_exports'] = 0; $data['environment'] = array( 'version' => RS_REVISION, 'engine' => $this->get_val($SR_GLOBALS, 'front_version', 6) ); $data['licensed'] = (!in_array($deactivation, array(true, false), true)) ? $this->_truefalse(get_option('revslider-valid', 'true')) : $deactivation; //if $deactivation === false, we are in deactivation process, so set already to false $data['slider'] = array( 'number' => 0, 'premium' => 0, 'import' => 0, 'sources' => array( 'custom' => 0, 'post' => 0, 'woocommerce' => 0, 'social' => 0, 'social_detail' => array(), ), 'navigations' => array( 'arrows' => 0, 'bullets' => 0, 'tabs' => 0, 'scrubber' => 0, 'thumbs' => 0, 'mouse' => 0, 'swipe' => 0, 'keyboard' => 0 ), 'parallax' => 0, 'scrolleffects' => 0, 'timeline_scroll'=> 0, 'color_skins' => 0, ); $data['slides'] = array( 'number' => 0, 'background' => array(), 'kenburns' => 0 ); $data['layer'] = array( 'number' => 0, 'types' => array(), 'actions' => array(), 'frames' => array(), 'presets' => array(), 'presets_modified' => 0, 'loop' => 0, 'library' => 0, 'in' => array( 'column' => 0, 'group' => 0 ), );
if(!empty($shortcodes)){ foreach($shortcodes as $alias){ wp_cache_flush(); $sldr = new RevSliderSlider(); $sldr->init_by_alias($alias); if($sldr->inited === false) continue; $premium = $sldr->get_param('pakps', false); if($data['licensed'] === false && $premium === true) continue; // do not fetch premium data on unlicensed slider
$data['slider']['number']++; $slides = $sldr->get_slides(); $static_slide = false; $static_id = $sl->get_static_slide_id($sldr->get_id()); if($static_id !== false){ $msl = new RevSliderSlide(); if(strpos($static_id, 'static_') === false){ $static_id = 'static_'. $static_id; } $msl->init_by_id($static_id); if($msl->get_id() !== ''){ $static_slide = $msl; } $msl = null; }
$wc = false; $post = $sldr->is_posts(); $specific_post = $sldr->is_specific_posts(); $stream = $sldr->is_stream(); $type = $sldr->get_param('sourcetype', 'gallery'); $import = $sldr->get_param('imported', false); if($post){ if(in_array($type, array('woocommerce', 'woo'))){ $wc = true; $post = false; } }
if($type === 'gallery') $data['slider']['sources']['custom']++; if($post === true || $specific_post === true) $data['slider']['sources']['post']++; if($stream !== false){ $data['slider']['sources']['social']++; if(!isset($data['slider']['sources']['social_detail'][$stream])) $data['slider']['sources']['social_detail'][$stream] = 0; $data['slider']['sources']['social_detail'][$stream]++; } if($wc === true) $data['slider']['sources']['woocommerce']++;
if($premium === true) $data['slider']['premium']++; if($import === true) $data['slider']['import']++;
if($sldr->get_param('type', 'standard') !== 'hero'){ foreach($data['slider']['navigations'] as $n => $count){ if($sldr->get_param(array('nav', $n, 'set'), false) === true) $data['slider']['navigations'][$n]++; }
if($sldr->get_param(array('nav', 'swipe', 'set'), false) === false){ if($sldr->get_param(array('nav', 'swipe', 'setOnDesktop'), false) === true) $data['slider']['navigations']['swipe']++; } }
if($sldr->get_param(array('parallax', 'set'), false) === true || $sldr->get_param(array('parallax', 'setDDD'), false) === true) $data['slider']['parallax']++; if($sldr->get_param(array('scrolleffects', 'set'), false) === true) $data['slider']['scrolleffects']++; if($sldr->get_param(array('scrolltimeline', 'set'), false) === true) $data['slider']['timeline_scroll']++; if($sldr->get_param(array('skins', 'colors'), array()) > 0) $data['slider']['color_skins']++;
if(!empty($slides)){ $data['slides']['number'] += count($slides); foreach($slides as $slide){ //'transparent', 'trans', 'solid' //'image' //'html5' //'streamtwitter', 'streamtwitterboth', 'streaminstagram', 'streaminstagramboth' //'streamyoutube', 'streamyoutubeboth', 'youtube', 'streamvimeo', 'streamvimeoboth', 'vimeo' $bg_type = $slide->get_param(array('bg', 'type'), 'transparent'); if(!isset($data['slides']['background'][$bg_type])) $data['slides']['background'][$bg_type] = 0;
$data['slides']['background'][$bg_type]++; if($slide->get_param(array('panzoom', 'set'), false) === true) $data['slides']['kenburns']++;
$layers = $slide->get_layers(); if(!empty($layers) && is_array($layers)){ $list = array('group' => array(), 'column' => array());
foreach($layers as $key => $layer){ $layer_type = $this->get_val($layer, 'type', 'text'); if($layer_type === 'column') $list['column'][] = (string)$this->get_val($layer, 'uid'); if($layer_type === 'group') $list['group'][] = (string)$this->get_val($layer, 'uid'); } foreach($layers as $key => $layer){ if(in_array($key, array('top', 'middle', 'bottom'))) continue; $layer_type = $this->get_val($layer, 'type', 'text'); if(in_array($layer_type, array('column', 'row'))) continue; $puid = (string)$this->get_val($layer, array('group', 'puid'), '-1'); if($puid !== '-1'){ if(in_array($puid, $list['column'])) $data['layer']['in']['column']++; if(in_array($puid, $list['group'])) $data['layer']['in']['group']++; }
$data['layer']['number']++; //top bottom middle layer
if(!isset($data['layer']['types'][$layer_type])) $data['layer']['types'][$layer_type] = 0; $data['layer']['types'][$layer_type]++;
$actions = $this->get_val($layer, array('actions', 'action'), array()); if(!empty($actions)){ foreach($actions as $num => $action){ $act = $this->get_val($action, 'action');
if(!isset($data['layer']['actions'][$act])) $data['layer']['actions'][$act] = 0;
$data['layer']['actions'][$act]++; } } $frames = $this->get_val($layer, array('timeline', 'frames'), false); if(!empty($frames)){ foreach($frames as $fk => $frame){ if(!isset($data['layer']['frames'][$fk])) $data['layer']['frames'][$fk] = 0; $data['layer']['frames'][$fk]++; $preset = $this->get_val($frame, array('timeline', 'preset')); $presetBased = $this->get_val($frame, array('timeline', 'presetBased'), 1); if(!empty($preset) && $presetBased < 1) $data['layer']['presets_modified']++;
if(in_array($fk, array('frame_0', 'frame_1', 'frame_999'))){ if(!empty($preset)){ if(!isset($data['layer']['presets'][$preset])) $data['layer']['presets'][$preset] = 0;
$data['layer']['presets'][$preset]++; } continue; } } }
if($this->get_val($layer, array('layerLibSrc'), false) !== false) $data['layer']['library']++; if($this->get_val($layer, array('timeline', 'loop', 'use'), false) === true) $data['layer']['loop']++; } $layers = null; unset($layers); } } $slides = null; unset($slides); } $sldr = null; unset($sldr); } }
$this->update_tracking_data($data); }
/** * will return all posts/pages that include the [rev_slider] shortcode **/ public function get_all_shortcode_pages(){ global $wpdb; $ids = array(); $pages = $wpdb->get_results("SELECT ID FROM ".$wpdb->posts." WHERE `post_content` LIKE '%[rev_slider %' AND post_status IN ('publish', 'private', 'draft')"); if(!empty($pages)){ foreach($pages as $page){ $ids[] = $this->get_val($page, 'ID'); } }
return $ids; }
public function add_additional_data($addition){ if(!$this->is_enabled()) return $addition;
$data = $this->get_tracking_data(); $addition['tracking'] = array( 'uid' => $this->get_unique_identifier(), 'data' => $data, );
return $addition; } }
?>
|