Changeset 3396930
- Timestamp:
- 11/17/2025 06:33:31 AM (2 months ago)
- Location:
- wp-team-showcase-and-slider
- Files:
-
- 126 added
- 3 edited
-
tags/2.8.6 (added)
-
tags/2.8.6/assets (added)
-
tags/2.8.6/assets/css (added)
-
tags/2.8.6/assets/css/ajax-loader.gif (added)
-
tags/2.8.6/assets/css/arrow-left.png (added)
-
tags/2.8.6/assets/css/arrow-right.png (added)
-
tags/2.8.6/assets/css/blocks.editor.build.css (added)
-
tags/2.8.6/assets/css/magnific-popup.css (added)
-
tags/2.8.6/assets/css/slick.css (added)
-
tags/2.8.6/assets/css/wp-tsas-admin.css (added)
-
tags/2.8.6/assets/css/wp-tsas-public.css (added)
-
tags/2.8.6/assets/images (added)
-
tags/2.8.6/assets/images/SlidersPack-50.png (added)
-
tags/2.8.6/assets/images/beaver-icon.png (added)
-
tags/2.8.6/assets/images/black-friday-banner.png (added)
-
tags/2.8.6/assets/images/divi-icon.png (added)
-
tags/2.8.6/assets/images/elementor-icon.png (added)
-
tags/2.8.6/assets/images/essential-logo-small.png (added)
-
tags/2.8.6/assets/images/essential-plugin-logo.png (added)
-
tags/2.8.6/assets/images/fb-icon.png (added)
-
tags/2.8.6/assets/images/g-logo.png (added)
-
tags/2.8.6/assets/images/gutenberg-icon.png (added)
-
tags/2.8.6/assets/images/inboundwp-50.png (added)
-
tags/2.8.6/assets/images/logo-image (added)
-
tags/2.8.6/assets/images/logo-image/White-labeling.png (added)
-
tags/2.8.6/assets/images/logo-image/advertising.png (added)
-
tags/2.8.6/assets/images/logo-image/backup.png (added)
-
tags/2.8.6/assets/images/logo-image/forms.png (added)
-
tags/2.8.6/assets/images/logo-image/img-slider.png (added)
-
tags/2.8.6/assets/images/logo-image/layers.png (added)
-
tags/2.8.6/assets/images/logo-image/marketing.png (added)
-
tags/2.8.6/assets/images/logo-image/performance.png (added)
-
tags/2.8.6/assets/images/logo-image/photo-album.png (added)
-
tags/2.8.6/assets/images/logo-image/risk.png (added)
-
tags/2.8.6/assets/images/logo-image/security.png (added)
-
tags/2.8.6/assets/images/logo-image/seo.png (added)
-
tags/2.8.6/assets/images/logo-image/shopping-bag.png (added)
-
tags/2.8.6/assets/images/logo-image/showcase.png (added)
-
tags/2.8.6/assets/images/logo-image/support.png (added)
-
tags/2.8.6/assets/images/page-builder-support.jpg (added)
-
tags/2.8.6/assets/images/popup-anything-icon.png (added)
-
tags/2.8.6/assets/images/security-icon.png (added)
-
tags/2.8.6/assets/images/site-origin-icon.png (added)
-
tags/2.8.6/assets/images/utility-50.png (added)
-
tags/2.8.6/assets/images/vc-icon.png (added)
-
tags/2.8.6/assets/images/wordpress-icon-logo.png (added)
-
tags/2.8.6/assets/images/wpbakery-icon.png (added)
-
tags/2.8.6/assets/js (added)
-
tags/2.8.6/assets/js/blocks.build.js (added)
-
tags/2.8.6/assets/js/elementor (added)
-
tags/2.8.6/assets/js/elementor/tsas-elementor.js (added)
-
tags/2.8.6/assets/js/jquery.magnific-popup.min.js (added)
-
tags/2.8.6/assets/js/slick.min.js (added)
-
tags/2.8.6/assets/js/tsas-admin.js (added)
-
tags/2.8.6/assets/js/tsas-public.js (added)
-
tags/2.8.6/includes (added)
-
tags/2.8.6/includes/admin (added)
-
tags/2.8.6/includes/admin/class-tsas-admin.php (added)
-
tags/2.8.6/includes/admin/metabox (added)
-
tags/2.8.6/includes/admin/metabox/tsas-post-setting-metabox-pro.php (added)
-
tags/2.8.6/includes/admin/settings (added)
-
tags/2.8.6/includes/admin/settings/premium.php (added)
-
tags/2.8.6/includes/admin/supports (added)
-
tags/2.8.6/includes/admin/supports/gutenberg-block.php (added)
-
tags/2.8.6/includes/admin/wp-tsas-how-it-work.php (added)
-
tags/2.8.6/includes/class-tsas-script.php (added)
-
tags/2.8.6/includes/shortcodes (added)
-
tags/2.8.6/includes/shortcodes/tsas-shortcode.php (added)
-
tags/2.8.6/includes/shortcodes/tsas-slider-shortcode.php (added)
-
tags/2.8.6/includes/tsas-functions.php (added)
-
tags/2.8.6/includes/tsas-post-type.php (added)
-
tags/2.8.6/languages (added)
-
tags/2.8.6/languages/wp-team-showcase-and-slider-en_US-wp-tsas-block-js.json (added)
-
tags/2.8.6/languages/wp-team-showcase-and-slider-en_US.mo (added)
-
tags/2.8.6/languages/wp-team-showcase-and-slider-en_US.po (added)
-
tags/2.8.6/languages/wp-team-showcase-and-slider.pot (added)
-
tags/2.8.6/readme.txt (added)
-
tags/2.8.6/templates (added)
-
tags/2.8.6/templates/designs (added)
-
tags/2.8.6/templates/designs/design-1.php (added)
-
tags/2.8.6/templates/designs/design-2.php (added)
-
tags/2.8.6/templates/designs/design-3.php (added)
-
tags/2.8.6/templates/popup (added)
-
tags/2.8.6/templates/popup/popup-design-1.php (added)
-
tags/2.8.6/wp-team-showcase-and-slider.php (added)
-
tags/2.8.6/wpos-analytics (added)
-
tags/2.8.6/wpos-analytics/assets (added)
-
tags/2.8.6/wpos-analytics/assets/css (added)
-
tags/2.8.6/wpos-analytics/assets/css/wpos-anylc-admin.css (added)
-
tags/2.8.6/wpos-analytics/assets/images (added)
-
tags/2.8.6/wpos-analytics/assets/images/icon.png (added)
-
tags/2.8.6/wpos-analytics/assets/images/wpos-logo.png (added)
-
tags/2.8.6/wpos-analytics/assets/js (added)
-
tags/2.8.6/wpos-analytics/assets/js/wpos-anylc-admin.js (added)
-
tags/2.8.6/wpos-analytics/includes (added)
-
tags/2.8.6/wpos-analytics/includes/class-anylc-admin.php (added)
-
tags/2.8.6/wpos-analytics/includes/class-anylc-script.php (added)
-
tags/2.8.6/wpos-analytics/includes/wpos-anylc-function.php (added)
-
tags/2.8.6/wpos-analytics/templates (added)
-
tags/2.8.6/wpos-analytics/templates/analytic.php (added)
-
tags/2.8.6/wpos-analytics/templates/offers.php (added)
-
tags/2.8.6/wpos-analytics/templates/optout-popup.php (added)
-
tags/2.8.6/wpos-analytics/wpos-analytics.php (added)
-
tags/2.8.6/wpos-plugins (added)
-
tags/2.8.6/wpos-plugins/assets (added)
-
tags/2.8.6/wpos-plugins/assets/css (added)
-
tags/2.8.6/wpos-plugins/assets/css/admin-style.css (added)
-
tags/2.8.6/wpos-plugins/assets/images (added)
-
tags/2.8.6/wpos-plugins/assets/images/cart-2.png (added)
-
tags/2.8.6/wpos-plugins/assets/images/essential-plugin-16.png (added)
-
tags/2.8.6/wpos-plugins/assets/images/essential-plugin-50.png (added)
-
tags/2.8.6/wpos-plugins/assets/images/essentialplugin-logo.png (added)
-
tags/2.8.6/wpos-plugins/assets/images/inbound50-by-50.png (added)
-
tags/2.8.6/wpos-plugins/assets/images/sliderspack.png (added)
-
tags/2.8.6/wpos-plugins/assets/images/utility-icon.png (added)
-
tags/2.8.6/wpos-plugins/assets/js (added)
-
tags/2.8.6/wpos-plugins/assets/js/admin-script.js (added)
-
tags/2.8.6/wpos-plugins/includes (added)
-
tags/2.8.6/wpos-plugins/includes/admin (added)
-
tags/2.8.6/wpos-plugins/includes/admin/class-espbw-admin.php (added)
-
tags/2.8.6/wpos-plugins/includes/admin/views (added)
-
tags/2.8.6/wpos-plugins/includes/admin/views/dashboard.php (added)
-
tags/2.8.6/wpos-plugins/includes/class-espbw-script.php (added)
-
tags/2.8.6/wpos-plugins/includes/espbw-functions.php (added)
-
tags/2.8.6/wpos-plugins/plugins-data.json (added)
-
tags/2.8.6/wpos-plugins/wpos-recommendation.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp-team-showcase-and-slider.php (modified) (2 diffs)
-
trunk/wpos-analytics/includes/class-anylc-admin.php (modified) (41 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-team-showcase-and-slider/trunk/readme.txt
r3394370 r3396930 4 4 Requires at least: 4.0 5 5 Tested up to: 6.8.3 6 Stable tag: 2.8. 56 Stable tag: 2.8.6 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 168 168 == Changelog == 169 169 170 = 2.8.6 (17, Nov 2025) = 171 * [*] Fixed code conflict issue affecting widget saving. 172 170 173 = 2.8.5 (12, Nov 2025) = 171 174 * [*] Check compatibility with WordPress version 6.8.3 -
wp-team-showcase-and-slider/trunk/wp-team-showcase-and-slider.php
r3394370 r3396930 7 7 * Description: Easy to add and display your employees, team members in Grid view, Slider view and in widget. Also work with Gutenberg shortcode block. 8 8 * Author: Essential Plugin 9 * Version: 2.8. 59 * Version: 2.8.6 10 10 * Author URI: https://essentialplugin.com 11 11 * … … 19 19 20 20 if ( ! defined( 'WP_TSAS_VERSION' ) ) { 21 define( 'WP_TSAS_VERSION', '2.8. 5' ); // Version of plugin21 define( 'WP_TSAS_VERSION', '2.8.6' ); // Version of plugin 22 22 } 23 23 -
wp-team-showcase-and-slider/trunk/wpos-analytics/includes/class-anylc-admin.php
r3394370 r3396930 9 9 */ 10 10 11 if ( ! defined( 'ABSPATH' ) ) {11 if ( ! defined( 'ABSPATH' ) ) { 12 12 exit; // Exit if accessed directly 13 13 } … … 21 21 public $changelog = null; 22 22 public $release_date = null; 23 private $analytics_slugs = array(); 23 24 24 25 function __construct() { … … 27 28 28 29 // Plugin action links 29 if ( ! empty( $wpos_analytics_module ) ) {30 if ( ! empty( $wpos_analytics_module ) ) { 30 31 foreach ($wpos_analytics_module as $module_key => $module) { 31 32 32 // Filter to add Opt In / Out row 33 33 add_filter( 'plugin_action_links_' . $module_key, array($this, 'wpos_anylc_add_action_links'), 10, 4 ); 34 35 $product_slug = isset( $module['slug'] ) ? $module['slug'] : ''; 36 37 if ( !empty( $product_slug ) ) { 38 // Store slug for later CORS match 39 $this->analytics_slugs[] = $product_slug; 40 } 34 41 } 35 42 } … … 76 83 global $menu, $submenu, $wpos_analytics_module; 77 84 78 if ( !empty( $wpos_analytics_module ) ) {85 if ( !empty( $wpos_analytics_module ) ) { 79 86 foreach ($wpos_analytics_module as $module_key => $module) { 80 87 81 88 $opt_in_data = wpos_anylc_get_option( $module['anylc_optin'] ); 82 89 83 if ( !empty( $module['menu'] ) && !isset( $opt_in_data['status'] ) ) {90 if ( !empty( $module['menu'] ) && !isset( $opt_in_data['status'] ) ) { 84 91 remove_menu_page( $module['menu'] ); 85 92 } … … 98 105 global $menu, $submenu, $wpos_analytics_module; 99 106 100 if ( !empty( $wpos_analytics_module ) ) {107 if ( !empty( $wpos_analytics_module ) ) { 101 108 102 109 // WP Menu data … … 110 117 111 118 // Offers Page 112 if ( !empty( $module['offers'] ) && $anylc_page == $module['slug'].'-offers' ) {113 add_submenu_page( $module['menu'], 'WPOS Offers', '<span style="color:#2ECC71">Premium Offers</span>', 'manage_options', $module['slug'] .'-offers', array($this, 'wpos_anylc_offers_html') );119 if ( !empty( $module['offers'] ) && $anylc_page == $module['slug'] . '-offers' ) { 120 add_submenu_page( $module['menu'], 'WPOS Offers', '<span style="color:#2ECC71">Premium Offers</span>', 'manage_options', $module['slug'] . '-offers', array($this, 'wpos_anylc_offers_html') ); 114 121 } 115 122 116 123 // If data is set 117 if ( $optin_status == 1 ) {124 if ( $optin_status == 1 ) { 118 125 continue; 119 126 } … … 122 129 $menu_args = array(); 123 130 124 if ( $optin_status === 0 || $optin_status === 2 ) {131 if ( $optin_status === 0 || $optin_status === 2 ) { 125 132 126 133 // Register admin menu 127 if ( $anylc_page == $module['slug'] ) {128 add_submenu_page( $module['menu'], $module['name'] .' '.'Opt In', $module['name'].' '.'Opt In', 'manage_options', $module['slug'], array($this, 'wpos_anylc_page_html') );134 if ( $anylc_page == $module['slug'] ) { 135 add_submenu_page( $module['menu'], $module['name'] . ' ' . 'Opt In', $module['name'] . ' ' . 'Opt In', 'manage_options', $module['slug'], array($this, 'wpos_anylc_page_html') ); 129 136 } 130 137 131 138 } else { 132 139 133 if ( !empty( $wpos_menu_data ) ) {140 if ( !empty( $wpos_menu_data ) ) { 134 141 $orig_menu_pos = array_search( $module['menu'], $wpos_menu_data ); 135 142 136 if ( $orig_menu_pos !== false ) {143 if ( $orig_menu_pos !== false ) { 137 144 138 145 $menu_args = array( … … 145 152 146 153 // Taking default name and icon 147 if ( empty( $menu_args ) ) {154 if ( empty( $menu_args ) ) { 148 155 $menu_args = array( 149 156 'name' => $module['name'], … … 174 181 175 182 // if no data is set then return 176 if ( ! isset( $wpos_analytics_product[ $anylc_product_name ] ) ) {183 if ( ! isset( $wpos_analytics_product[ $anylc_product_name ] ) ) { 177 184 return; 178 185 } … … 191 198 $skip_url = wp_nonce_url( $skip_url, 'wpos_anylc_act' ); 192 199 193 require_once WPOS_ANYLC_DIR . '/templates/analytic.php';200 require_once WPOS_ANYLC_DIR . '/templates/analytic.php'; 194 201 } 195 202 … … 208 215 209 216 // if no data is set then return 210 if ( ! isset( $wpos_analytics_product[ $anylc_product_name ] ) ) {217 if ( ! isset( $wpos_analytics_product[ $anylc_product_name ] ) ) { 211 218 return; 212 219 } … … 217 224 $opt_in = isset( $opt_in_data['status'] ) ? $opt_in_data['status'] : null; 218 225 219 include_once( WPOS_ANYLC_DIR . '/templates/offers.php' );226 include_once( WPOS_ANYLC_DIR . '/templates/offers.php' ); 220 227 } 221 228 … … 234 241 235 242 // If analytics module data is there 236 if ( $module_data ) {243 if ( $module_data ) { 237 244 238 245 $opt_in_data = wpos_anylc_get_option( $module_data['anylc_optin'] ); … … 240 247 241 248 // If user has opt in 242 if ( $opt_in == 1 ) {243 244 $new_links['wpos_anylc'] = '<a href="#" class="wpos-anylc-opt-out-link" data-id="' .$module_data['id'].'">'.__('Opt Out', 'wpos_analytic').'</a>';249 if ( $opt_in == 1 ) { 250 251 $new_links['wpos_anylc'] = '<a href="#" class="wpos-anylc-opt-out-link" data-id="' . $module_data['id'] . '">' . __('Opt Out', 'wpos_analytic') . '</a>'; 245 252 246 253 } else { … … 248 255 $opt_in_link = wpos_anylc_optin_url( $module_data, $opt_in ); 249 256 250 $new_links['wpos_anylc'] = '<a href="' .esc_url( $opt_in_link ).'" class="wpos-anylc-opt-in-link">'.__('Opt In', 'wpos_analytic').'</a>';257 $new_links['wpos_anylc'] = '<a href="' . esc_url( $opt_in_link ) . '" class="wpos-anylc-opt-in-link">' . __('Opt In', 'wpos_analytic') . '</a>'; 251 258 } 252 259 … … 264 271 function wpos_anylc_admin_init_process() { 265 272 266 if ( isset( $_GET['message'] ) && 'wpos-anylc-dismiss-notice' == $_GET['message'] && ! empty( $_GET['anylc_id'] )273 if ( isset( $_GET['message'] ) && 'wpos-anylc-dismiss-notice' == $_GET['message'] && ! empty( $_GET['anylc_id'] ) 267 274 && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'wpos-anylc-dismiss-notice-nonce' ) 268 275 ) { … … 272 279 273 280 // Flush the redirect transient 274 if ( isset( $_GET['anylc_nonce'] ) && wp_verify_nonce( $_GET['anylc_nonce'], 'wpos-anylc-redirect-nonce' ) ) {281 if ( isset( $_GET['anylc_nonce'] ) && wp_verify_nonce( $_GET['anylc_nonce'], 'wpos-anylc-redirect-nonce' ) ) { 275 282 update_option( 'wpos_anylc_redirect', '' ); 276 283 } … … 286 293 parse_str( parse_url( $redirect, PHP_URL_QUERY ), $url_data ); 287 294 288 if ( ! isset( $url_data['anylc_nonce'] ) || ( isset( $url_data['anylc_nonce'] ) && ! wp_verify_nonce( $_GET['anylc_nonce'], 'wpos-anylc-redirect-nonce' ) ) ) {295 if ( ! isset( $url_data['anylc_nonce'] ) || ( isset( $url_data['anylc_nonce'] ) && ! wp_verify_nonce( $_GET['anylc_nonce'], 'wpos-anylc-redirect-nonce' ) ) ) { 289 296 $redirect = add_query_arg( array( 'anylc_nonce' => wp_create_nonce( 'wpos-anylc-redirect-nonce' ) ), $redirect ); 290 297 } … … 304 311 function wpos_anylc_optin_notice() { 305 312 313 // Prevent breaking JSON/AJAX/REST responses 314 if ( wp_doing_ajax() || wp_is_json_request() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { 315 return; 316 } 317 306 318 global $current_screen, $wpos_analytics_module, $wpos_analytics_product; 319 320 // Ensure screen object exists 321 if ( ! isset( $current_screen ) || ! is_object( $current_screen ) ) { 322 return; 323 } 307 324 308 325 // Taking some variables 309 326 $screen_id = isset( $current_screen->id ) ? $current_screen->id : ''; 310 327 311 // Plugin action links312 if ( $screen_id == 'dashboard' && current_user_can('manage_options') && !empty( $wpos_analytics_module ) ) {313 foreach ($wpos_analytics_module as $module _key => $module) {328 // Show notices only on dashboard for admins 329 if ( $screen_id == 'dashboard' && current_user_can('manage_options') && !empty( $wpos_analytics_module ) ) { 330 foreach ($wpos_analytics_module as $module) { 314 331 315 332 $anylc_pdt_id = $module['id']; 316 $notice_transient = get_transient( 'wpos_anylc_optin_notice_' .$anylc_pdt_id );317 318 if ( $notice_transient == false ) {333 $notice_transient = get_transient( 'wpos_anylc_optin_notice_' . $anylc_pdt_id ); 334 335 if ( $notice_transient == false ) { 319 336 320 337 $opt_in_data = wpos_anylc_get_option( $module['anylc_optin'] ); … … 323 340 324 341 // If user has opt in 325 if ( $opt_in == -1 ) {342 if ( $opt_in == -1 ) { 326 343 327 344 $anylc_pdt_name = $module['name']; … … 329 346 330 347 echo '<div class="updated notice wpos-anylc-notice wpos-anylc-optin-notice"> 331 <p><strong>' .wp_kses_post( $anylc_pdt_name ).'</strong> - We made a few tweaks to the plugin, <a href="'.esc_url( $anylc_optin_url ).'">Opt in to make it Better!</a></p>332 <a href="' .esc_url( $notice_link ).'" class="notice-dismiss"></a>348 <p><strong>' . wp_kses_post( $anylc_pdt_name ) . '</strong> - We made a few tweaks to the plugin, <a href="' . esc_url( $anylc_optin_url ) . '">Opt in to make it Better!</a></p> 349 <a href="' . esc_url( $notice_link ) . '" class="notice-dismiss"></a> 333 350 </div>'; 334 351 … … 339 356 } // End of if 340 357 341 if( isset($_GET['message']) && $_GET['message'] == 'optout_success' ) { 358 // Handle message parameter 359 $message = isset($_GET['message']) ? sanitize_text_field($_GET['message']) : ''; 360 361 if ( 'optout_success' == $message ) { 342 362 echo '<div class="updated notice wpos-anylc-optin-notice is-dismissible"> 343 363 <p><strong>Sorry to let you go. You are now opted out from the plugin.</strong></p> … … 345 365 } 346 366 347 // Process Promotion Data348 if ( !empty($_GET['message']) && $_GET['message'] == 'wpos_anylc_promotion'&& !empty($_GET['wpos_anylc_pdt']) && !empty($_GET['wpos_anylc_promo_pdt']) ) {367 // Handle promotion download 368 if ( 'wpos_anylc_promotion' == $message && !empty($_GET['wpos_anylc_pdt']) && !empty($_GET['wpos_anylc_promo_pdt']) ) { 349 369 350 370 $promotion = 1; 351 371 $wpos_anylc_promo_pdt = sanitize_text_field( $_GET['wpos_anylc_promo_pdt'] ); 352 372 $promotion_pdt = explode( ',', $wpos_anylc_promo_pdt ); 373 $promotion_pdt_data = array(); 353 374 354 375 $anylc_pdt = sanitize_text_field( $_GET['wpos_anylc_pdt'] ); 355 376 $anylc_pdt_data = isset( $wpos_analytics_product[ $anylc_pdt ] ) ? $wpos_analytics_product[ $anylc_pdt ] : false; 356 377 357 if ( !empty($promotion_pdt) ) {358 foreach ($promotion_pdt as $pdt _key => $pdt) {359 if ( isset( $anylc_pdt_data['promotion'][$pdt]['file'] ) ) {360 $promotion_pdt_data[] = '<a href="' .$anylc_pdt_data['promotion'][$pdt]['file'].'">'.$anylc_pdt_data['promotion'][$pdt]['name'].'</a>';361 } 362 } 363 } 364 365 if ( $promotion_pdt_data) {378 if ( !empty($promotion_pdt) ) { 379 foreach ($promotion_pdt as $pdt) { 380 if ( isset( $anylc_pdt_data['promotion'][$pdt]['file'] ) ) { 381 $promotion_pdt_data[] = '<a href="' . $anylc_pdt_data['promotion'][$pdt]['file'] . '">' . $anylc_pdt_data['promotion'][$pdt]['name'] . '</a>'; 382 } 383 } 384 } 385 386 if ( ! empty( $promotion_pdt_data ) ) { 366 387 echo '<div class="updated notice wpos-anylc-optin-notice is-dismissible" style="display:block !important;"> 367 <p><strong>Your Download has been started. In case if it is int rupted then download it from here. '.join(' | ', $promotion_pdt_data).'</strong></p>388 <p><strong>Your Download has been started. In case if it is interrupted then download it from here. ' . join(' | ', $promotion_pdt_data) . '</strong></p> 368 389 </div>'; 369 390 } … … 381 402 global $pagenow, $wpos_analytics_module; 382 403 383 if ( $pagenow == 'plugins.php' && !empty( $wpos_analytics_module ) ) {404 if ( $pagenow == 'plugins.php' && !empty( $wpos_analytics_module ) ) { 384 405 foreach ($wpos_analytics_module as $module_key => $module) { 385 406 … … 388 409 389 410 // If user has opt in 390 if ( $opt_in == 1 ) {411 if ( $opt_in == 1 ) { 391 412 392 413 // Creating redirect URL … … 396 417 397 418 $redirect_url = add_query_arg( array( 'plugin_status' => $plugin_status, 'paged' => $paged, 's' => $s, 'wpos_anylc_pdt' => $module['slug'] ), admin_url( 'plugins.php' ) ); 398 $redirect_url = wp_nonce_url( $redirect_url, 'wpos_anylc_act' .'|'.$module['slug'] );419 $redirect_url = wp_nonce_url( $redirect_url, 'wpos_anylc_act' . '|' . $module['slug'] ); 399 420 400 421 // Form Data 401 422 $optin_form_data = wpos_anylc_optin_data( $module['slug'], $redirect_url ); 402 423 403 include( WPOS_ANYLC_DIR . '/templates/optout-popup.php' );424 include( WPOS_ANYLC_DIR . '/templates/optout-popup.php' ); 404 425 } 405 426 } … … 420 441 } 421 442 422 if ( !empty($_GET['wpos_anylc_action']) && isset($_GET['_wpnonce']) ) {443 if ( !empty($_GET['wpos_anylc_action']) && isset($_GET['_wpnonce']) ) { 423 444 424 445 global $wpos_analytics_product; … … 429 450 430 451 // If valid product data found 431 if ( $anylc_pdt_data ) {452 if ( $anylc_pdt_data ) { 432 453 433 454 // Process Optin 434 if ( $_GET['wpos_anylc_action'] == 'optin' ) {455 if ( $_GET['wpos_anylc_action'] == 'optin' ) { 435 456 436 457 // Verify nonce 437 if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'wpos_anylc_act' ) ) {458 if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'wpos_anylc_act' ) ) { 438 459 wp_die( __('Sorry, Something happened wrong.', 'wpos_analytic'), 'wpos_anylc_err', array('back_link' => true) ); 439 460 } … … 443 464 // Redirect to original menu 444 465 $redirect_url = wpos_anylc_pdt_url( $anylc_pdt_data, 'offer-promotion' ); 445 if ( $redirect_url ) {466 if ( $redirect_url ) { 446 467 wp_redirect( $redirect_url ); 447 468 exit; … … 451 472 452 473 // Process Skip 453 if ( $_GET['wpos_anylc_action'] == 'skip' ) {474 if ( $_GET['wpos_anylc_action'] == 'skip' ) { 454 475 455 476 // Verify nonce 456 if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'wpos_anylc_act' ) ) {477 if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'wpos_anylc_act' ) ) { 457 478 wp_die( __('Sorry, Something happened wrong.', 'wpos_analytic'), 'wpos_anylc_err', array('back_link' => true) ); 458 479 } … … 462 483 // Redirect to original menu 463 484 $redirect_url = wpos_anylc_pdt_url( $anylc_pdt_data, 'offer' ); 464 if ( $redirect_url ) {485 if ( $redirect_url ) { 465 486 wp_redirect( $redirect_url ); 466 487 exit; … … 470 491 471 492 // Process Opt Out 472 if ( $_GET['wpos_anylc_action'] == 'optout' ) {493 if ( $_GET['wpos_anylc_action'] == 'optout' ) { 473 494 474 495 // Verify nonce 475 if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'wpos_anylc_act'.'|'.$_GET['wpos_anylc_pdt'] ) ) {496 if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'wpos_anylc_act' . '|' . $_GET['wpos_anylc_pdt'] ) ) { 476 497 wp_die( __('Sorry, Something happened wrong.', 'wpos_analytic'), 'wpos_anylc_err', array('back_link' => true) ); 477 498 } … … 481 502 // Redirect with success message 482 503 $redirect_url = add_query_arg( array( 'message' => 'optout_success', 'wpos_anylc_action' => false, 'wpos_anylc_pdt' => false, '_wpnonce' => false ) ); 483 if ( $redirect_url ) {504 if ( $redirect_url ) { 484 505 wp_redirect( $redirect_url ); 485 506 exit; … … 498 519 if (!wp_next_scheduled('wpos_monthly_cron_hook')) { 499 520 wp_schedule_event(time(), 'monthly', 'wpos_monthly_cron_hook'); 500 }501 502 if ( 'OPTIONS' === $_SERVER['REQUEST_METHOD'] ) {503 header("Access-Control-Allow-Origin: https://analytics.essentialplugin.com");504 header("Access-Control-Allow-Methods: POST, OPTIONS");505 header("Access-Control-Allow-Headers: Authorization, Content-Type");506 exit;507 521 } 508 522 } … … 529 543 */ 530 544 public function wpos_monthly_cron_hook_fn() { 531 532 global $wpos_analytics_module; 533 $slugs = []; 534 535 global $wpos_analytics_module; 536 537 if ( !empty( $wpos_analytics_module ) ) { 538 foreach ( $wpos_analytics_module as $module_key => $module ) { 539 540 $opt_in_data = wpos_anylc_get_option( $module['anylc_optin'] ); 541 $opt_in = isset( $opt_in_data['status'] ) ? $opt_in_data['status'] : -1; 542 543 // If user has opt in 544 if ( 1 == $opt_in ) { 545 array_push($slugs, $module['slug']); 546 } 547 548 } 549 } 550 551 // If user has opt-in then send data 552 if ( ! empty( $slugs ) ) { 553 $this->wpos_process_monthly_data($slugs); 554 } 545 $this->wpos_process_monthly_data( $this->analytics_slugs ); 555 546 } 556 547 … … 568 559 $data['wpos_anylc_optin'] = 'wpos_anylc_optin'; 569 560 570 $response = wp_remote_post( 'https://analytics.essentialplugin.com', [561 $response = wp_remote_post( 'https://analytics.essentialplugin.com', array( 571 562 'method' => 'POST', 572 563 'timeout' => 15, 573 564 'blocking' => true, 574 565 'body' => $data, 575 'headers' => [566 'headers' => array( 576 567 'Content-Type' => 'application/x-www-form-urlencoded' 577 ],578 ]);568 ), 569 )); 579 570 580 571 $this->version_info_clean(); … … 590 581 */ 591 582 public function wpos_rest_api_init() { 592 global $wpos_analytics_module;593 594 if ( !empty( $wpos_analytics_module ) ) {595 foreach ( $wpos_analytics_module as $module_key => $module ) { 596 597 $product_slug = isset( $module['slug'] ) ? $module['slug'] : '';598 599 if ( !empty( $product_slug ) ) {600 register_rest_route( $product_slug . '/v1', '/analytics/', [601 'methods' => 'POST',602 'callback' => array( $this, 'wpos_handle_analytics_request' ),583 if ( !empty( $this->analytics_slugs ) ) { 584 // Add CORS only for this namespace 585 add_filter( 'rest_pre_serve_request', array($this, 'wpos_cors_headers'), 10, 3 ); 586 587 foreach ( $this->analytics_slugs as $product_slug ) { 588 register_rest_route( 589 $product_slug . '/v1', 590 '/analytics/', 591 array( 592 'methods' => 'POST', 593 'callback' => array( $this, 'wpos_handle_analytics_request' ), 603 594 'permission_callback' => '__return_true', 604 ]); 605 } 606 } 607 } 608 595 ) 596 ); 597 } 598 } 599 } 600 601 /** 602 * Allow Cors for rest request 603 * 604 * @package Wpos Analytic 605 */ 606 public function wpos_cors_headers($served, $result, $request) { 607 608 $route = $request->get_route(); 609 610 foreach ( $this->analytics_slugs as $slug ) { 611 612 if ( strpos( $route, '/' . $slug . '/v1/analytics' ) === 0 ) { 613 614 header( "Access-Control-Allow-Origin: https://analytics.essentialplugin.com" ); 615 header( "Access-Control-Allow-Methods: POST, OPTIONS" ); 616 header( "Access-Control-Allow-Headers: Authorization, Content-Type" ); 617 618 break; // Stop checking further slugs 619 } 620 621 } 622 623 return $served; 609 624 } 610 625 … … 614 629 * @package Wpos Analytic 615 630 */ 616 public function wpos_handle_analytics_request( WP_REST_Request $request) {631 public function wpos_handle_analytics_request( $request ) { 617 632 618 633 global $wpos_analytics_module; … … 643 658 $update_result = $this->fetch_ver_info( $product_id, $version ); 644 659 unset($update_result); 645 $this->wpos_process_monthly_data( [$matching_product['slug']]);660 $this->wpos_process_monthly_data( array( $matching_product['slug'] ) ); 646 661 647 return new WP_REST_Response([662 return array( 648 663 'success' => true, 649 664 'message' => 'Data received successfully!', 650 'data' => compact( 'site_id', 'product_id', 'product_slug', 'site_url')651 ], 200);665 'data' => compact( 'site_id', 'product_id', 'product_slug', 'site_url' ) 666 ); 652 667 } 653 668 … … 656 671 } 657 672 673 /** 674 * Is the plugin outdated? 675 * 676 * @package Wpos Analytic 677 */ 658 678 public function isOutdated() { 659 return strtotime($this->release_date ?? 'now') < time(); 679 $date = isset($this->release_date) ? $this->release_date : 'now'; 680 return strtotime($date) < time(); 660 681 } 661 682 683 /** 684 * Plugin version info 685 * 686 * @package Wpos Analytic 687 */ 662 688 public function fetch_ver_info( $product_id, $curr_version ) { 663 689 $url = $this->analytics_endpoint . '/plugin_info/' . $product_id . '/' . '?version=' . urlencode($curr_version) . '&site_url=' . urlencode(get_site_url()) . '&live=1'; … … 686 712 } 687 713 714 /** 715 * Clean the info 716 * 717 * @package Wpos Analytic 718 */ 688 719 public function version_info_clean() { 689 720 if ($this->status === 'valid' && $this->changelog && !$this->isOutdated()) {
Note: See TracChangeset
for help on using the changeset viewer.