| @@ -1,0 +1,201 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Extension Abstract | |
| 4 | + * | |
| 5 | + * @package NotificationX\Extensions | |
| 6 | + */ | |
| 7 | + | |
| 8 | +namespace NotificationX\Types; | |
| 9 | +use NotificationX\GetInstance; | |
| 10 | +use NotificationX\Modules; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * Extension Abstract for all Extension. | |
| 14 | + * @method static PageAnalytics get_instance($args = null) | |
| 15 | + */ | |
| 16 | +class PageAnalytics extends Types { | |
| 17 | + /** | |
| 18 | + * Instance of Admin | |
| 19 | + * | |
| 20 | + * @var Admin | |
| 21 | + */ | |
| 22 | + use GetInstance; | |
| 23 | + | |
| 24 | + public $priority = 70; | |
| 25 | + public $is_pro = true; | |
| 26 | + public $module = ['modules_google_analytics']; | |
| 27 | + public $default_source = 'google'; | |
| 28 | + | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * Initially Invoked when initialized. | |
| 32 | + */ | |
| 33 | + public function __construct(){ | |
| 34 | + parent::__construct(); | |
| 35 | + $this->id = 'page_analytics'; | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * Runs when modules is enabled. | |
| 40 | + * | |
| 41 | + * @return void | |
| 42 | + */ | |
| 43 | + public function init(){ | |
| 44 | + parent::init(); | |
| 45 | + $this->title = __('Page Analytics', 'notificationx'); | |
| 46 | + $this->popup = [ | |
| 47 | + "denyButtonText" => __("<a href='https://notificationx.com/docs/google-analytics/' target='_blank'>More Info</a>", "notificationx"), | |
| 48 | + "confirmButtonText" => __("<a href='https://notificationx.com/#pricing' target='_blank'>Upgrade to PRO</a>", "notificationx"), | |
| 49 | + // phpcs:disable PluginCheck.CodeAnalysis.Offloading.OffloadedContent -- False positive for this context: these are HTML email bodies and remote documentation/tutorial links in admin help text, not offloaded plugin assets. Audited 2026-07-16. | |
| 50 | + "html"=> __(' | |
| 51 | + <span>Connect Google Analytics to display the total number of real-time site visitors</span> | |
| 52 | + <video id="pro_alert_video_popup" type="text/html" allowfullscreen width="450" height="235" autoplay loop muted> | |
| 53 | + <source src="https://notificationx.com/wp-content/uploads/2024/01/Google-Analytics-Integration-With-NotificationX-How-To-Show-Active-Users-Traffic-in-WordPress.mp4" type="video/mp4"> | |
| 54 | + </video> | |
| 55 | + ', 'notificationx') | |
| 56 | + // phpcs:enable PluginCheck.CodeAnalysis.Offloading.OffloadedContent | |
| 57 | + ]; | |
| 58 | + $this->themes = [ | |
| 59 | + 'pa-theme-one' => [ | |
| 60 | + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/analytics/ga-theme-one.jpg', | |
| 61 | + 'template' => [ | |
| 62 | + 'first_param' => 'tag_siteview', | |
| 63 | + 'second_param' => __('marketers', 'notificationx'), | |
| 64 | + 'third_param' => 'ga_title', | |
| 65 | + 'custom_third_param' => __('Surfed this page', 'notificationx'), | |
| 66 | + 'ga_fourth_param' => __('in last ', 'notificationx'), | |
| 67 | + 'ga_fifth_param' => __('30', 'notificationx'), | |
| 68 | + 'sixth_param' => 'tag_day', | |
| 69 | + ], | |
| 70 | + 'defaults' => [ | |
| 71 | + 'link_button' => false, | |
| 72 | + 'link_type' => 'none', | |
| 73 | + 'show_default_image' => true, | |
| 74 | + ], | |
| 75 | + ], | |
| 76 | + 'pa-theme-two' => [ | |
| 77 | + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/analytics/pa-theme-one.png', | |
| 78 | + 'image_shape' => 'rounded', | |
| 79 | + 'template' => [ | |
| 80 | + 'first_param' => 'tag_siteview', | |
| 81 | + 'second_param' => __('people visited', 'notificationx'), | |
| 82 | + 'third_param' => 'ga_title', | |
| 83 | + 'custom_third_param' => __('this page', 'notificationx'), | |
| 84 | + 'ga_fourth_param' => __('in last ', 'notificationx'), | |
| 85 | + 'ga_fifth_param' => __('1', 'notificationx'), | |
| 86 | + 'sixth_param' => 'tag_day', | |
| 87 | + ], | |
| 88 | + 'defaults' => [ | |
| 89 | + 'link_button' => false, | |
| 90 | + 'link_type' => 'none', | |
| 91 | + 'show_default_image' => true, | |
| 92 | + ], | |
| 93 | + ], | |
| 94 | + 'pa-theme-three' => [ | |
| 95 | + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/analytics/pa-theme-two.png', | |
| 96 | + 'image_shape' => 'circle', | |
| 97 | + 'template' => [ | |
| 98 | + 'first_param' => 'tag_realtime_siteview', | |
| 99 | + 'second_param' => __('people looking', 'notificationx'), | |
| 100 | + 'third_param' => 'ga_title', | |
| 101 | + 'custom_third_param' => __('this deal', 'notificationx'), | |
| 102 | + 'ga_fourth_param' => __('right now', 'notificationx'), | |
| 103 | + // need to set this two param unless they won't show up when changing the first param. | |
| 104 | + 'ga_fifth_param' => __('30', 'notificationx'), | |
| 105 | + 'sixth_param' => 'tag_day', | |
| 106 | + ], | |
| 107 | + 'defaults' => [ | |
| 108 | + 'link_button' => false, | |
| 109 | + 'link_type' => 'none', | |
| 110 | + 'show_default_image' => true, | |
| 111 | + ], | |
| 112 | + ], | |
| 113 | + 'pa-theme-four' => [ | |
| 114 | + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/analytics/pa-theme-four.png', | |
| 115 | + 'image_shape' => 'circle', | |
| 116 | + 'template' => [ | |
| 117 | + 'first_param' => 'tag_current_page_view', | |
| 118 | + 'second_param' => __('People Is Now Visiting', 'notificationx'), | |
| 119 | + 'third_param' => 'tag_custom', | |
| 120 | + 'custom_third_param' => __('Holiday Deal Page', 'notificationx'), | |
| 121 | + 'ga_fourth_param' => __('Check out now & grab exceptional deals', 'notificationx'), | |
| 122 | + // need to set this two param unless they won't show up when changing the first param. | |
| 123 | + 'ga_fifth_param' => __('30', 'notificationx'), | |
| 124 | + 'sixth_param' => 'tag_day', | |
| 125 | + ], | |
| 126 | + 'defaults' => [ | |
| 127 | + 'link_button_text' => __('Grab Now','notificationx'), | |
| 128 | + 'link_button' => true, | |
| 129 | + 'link_type' => 'custom', | |
| 130 | + 'custom_url' => '#', | |
| 131 | + 'show_default_image' => true, | |
| 132 | + ], | |
| 133 | + ], | |
| 134 | + ]; | |
| 135 | + $this->res_themes = [ | |
| 136 | + 'res-pa-theme-one' => [ | |
| 137 | + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_analytics/ga-res-theme-1.png', | |
| 138 | + 'is_pro' => true, | |
| 139 | + ], | |
| 140 | + 'res-pa-theme-two' => [ | |
| 141 | + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_analytics/ga-res-theme-2.png', | |
| 142 | + 'is_pro' => true, | |
| 143 | + ], | |
| 144 | + 'res-pa-theme-three' => [ | |
| 145 | + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_analytics/ga-res-theme-3.png', | |
| 146 | + 'is_pro' => true, | |
| 147 | + ], | |
| 148 | + 'res-pa-theme-four' => [ | |
| 149 | + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_analytics/ga-res-theme-4.png', | |
| 150 | + 'is_pro' => true, | |
| 151 | + ], | |
| 152 | + ]; | |
| 153 | + $this->templates = [ | |
| 154 | + 'pa_template_new' => [ | |
| 155 | + 'first_param' => [ | |
| 156 | + 'tag_siteview' => __('Total Site View', 'notificationx'), | |
| 157 | + 'tag_realtime_siteview' => __('Realtime site view', 'notificationx') | |
| 158 | + ], | |
| 159 | + 'third_param' => [ | |
| 160 | + 'ga_title' => __('Site Title', 'notificationx'), | |
| 161 | + ], | |
| 162 | + 'sixth_param' => [ | |
| 163 | + 'tag_day' => __('Day', 'notificationx'), | |
| 164 | + 'tag_month' => __('Month', 'notificationx'), | |
| 165 | + 'tag_year' => __('Year', 'notificationx'), | |
| 166 | + ], | |
| 167 | + '_themes' => [ | |
| 168 | + 'page_analytics_pa-theme-one', | |
| 169 | + 'page_analytics_pa-theme-two', | |
| 170 | + 'page_analytics_pa-theme-three', | |
| 171 | + ], | |
| 172 | + ], | |
| 173 | + 'pa_template_current_page_view' => [ | |
| 174 | + 'first_param' => [ | |
| 175 | + 'tag_current_page_view' => __('Current Page View', 'notificationx') | |
| 176 | + ], | |
| 177 | + 'third_param' => [ | |
| 178 | + 'tag_ga_page_title' => __('Page Title', 'notificationx'), | |
| 179 | + ], | |
| 180 | + 'sixth_param' => [ | |
| 181 | + 'tag_day' => __('Day', 'notificationx'), | |
| 182 | + 'tag_month' => __('Month', 'notificationx'), | |
| 183 | + 'tag_year' => __('Year', 'notificationx'), | |
| 184 | + ], | |
| 185 | + '_themes' => [ | |
| 186 | + 'page_analytics_pa-theme-four', | |
| 187 | + ], | |
| 188 | + ], | |
| 189 | + ]; | |
| 190 | + } | |
| 191 | + | |
| 192 | + public function preview_entry($entry, $settings){ | |
| 193 | + $entry = array_merge($entry, [ | |
| 194 | + "title" => "WPDeveloper", | |
| 195 | + | |
| 196 | + ]); | |
| 197 | + return $entry; | |
| 198 | + } | |
| 199 | + | |
| 200 | + | |
| 201 | +} | |