PluginProbe
Pixelavo – Server Side Tracking & Pixel + AI Ads Tools / trunk
Pixelavo – Server Side Tracking & Pixel + AI Ads Tools vtrunk
1.5.5 1.5.4 trunk 1.0.0 1.0.1 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 All 47 releases
pixelavo / includes / modifier.php

modifier.php in Pixelavo – Server Side Tracking & Pixel + AI Ads Tools trunk, at includes/modifier.php

98 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Pixelavo;
4
5 /* Exit if accessed directly */
6 if (!defined('ABSPATH')) {
7 exit;
8 }
9
10 class Modifier{
11
12 private static $_instance = null;
13
14 /**
15 * Instance.
16 * Initializes a singleton instance.
17 * @return self class
18 */
19 static function instance() {
20 if ( is_null( self::$_instance ) ) {
21 self::$_instance = new self();
22 }
23 return self::$_instance;
24 }
25
26 function __construct() {
27 add_action('init', [$this, 'init']);
28 }
29
30 function init() {
31 $plugin_data = get_file_data( PIXELAVO_PL_ROOT, [ 'Version' => 'Version' ], 'plugin' );
32 $version = $plugin_data['Version'];
33 if(version_compare($version,'1.2.2','>') && !get_option('pixelavo_other_events_setting_modify', false)){
34 $other_events_data = get_option('pixelavo_other_events', [] );
35 if(array_key_exists('page_scroll_value', $other_events_data)){
36 update_option('pixelavo_page_scroll', [
37 'page_scroll' => [
38 'page_scroll_value' => $other_events_data['page_scroll_value']
39 ]
40 ]);
41 }
42 if(array_key_exists('time_on_page_value', $other_events_data)){
43 update_option('pixelavo_time_on_page', [
44 'time_on_page' => [
45 'time_on_page_value' => $other_events_data['time_on_page_value']
46 ]
47 ]);
48 }
49 if(array_key_exists('download_files_extensions', $other_events_data)){
50 update_option('pixelavo_download_files', [
51 'download_files' => [
52 'download_files_extensions' => $other_events_data['download_files_extensions']
53 ]
54 ]);
55 }
56 update_option('pixelavo_other_events_setting_modify', true);
57 }
58 if(version_compare($version,'1.2.3','>') && !get_option('pixelavo_setting_modify_124', false)){
59 $settings = get_option('pixelavo_settings', [] );
60
61 /* Purchase Evetn Settings Modifier */
62 $purchase_event_data = [];
63 if(array_key_exists('purchase_event_trigger', $settings)){
64 $purchase_event_data['purchase_event_trigger'] = $settings['purchase_event_trigger'];
65 }
66 if(array_key_exists('purchase_additional_info', $settings)){
67 $purchase_event_data['purchase_additional_info'] = $settings['purchase_additional_info'];
68 }
69 update_option('pixelavo_wc_purchase', array_replace_recursive([
70 'purchase' => $purchase_event_data,
71 ], get_option('pixelavo_wc_purchase', [])));
72 update_option('pixelavo_edd_purchase', array_replace_recursive([
73 'purchase' => $purchase_event_data,
74 ], get_option('pixelavo_edd_purchase', [])));
75
76 /* View Content Evetn Settings Modifier */
77 $view_content_event_data = [];
78 if(array_key_exists('view_content_delay', $settings)){
79 $view_content_event_data['view_content_delay'] = $settings['view_content_delay'];
80 }
81 update_option('pixelavo_wc_view_content', array_replace_recursive([
82 'view_content' => $view_content_event_data,
83 ], get_option('pixelavo_wc_view_content', [])));
84 update_option('pixelavo_edd_view_content', array_replace_recursive([
85 'view_content' => $view_content_event_data,
86 ], get_option('pixelavo_edd_view_content', [])));
87
88 update_option('pixelavo_setting_modify_124', true);
89 }
90 }
91
92 }
93
94 /**
95 * Initialize Modifier Class
96 */
97 Modifier::instance();
98