Changeset 3404157
- Timestamp:
- 11/27/2025 01:57:56 PM (2 weeks ago)
- Location:
- betterlinks
- Files:
-
- 10 edited
- 1 copied
-
tags/2.3.4 (copied) (copied from betterlinks/trunk)
-
tags/2.3.4/README.txt (modified) (2 diffs)
-
tags/2.3.4/betterlinks.php (modified) (2 diffs)
-
tags/2.3.4/includes/Admin.php (modified) (1 diff)
-
tags/2.3.4/includes/Admin/Ajax.php (modified) (2 diffs)
-
tags/2.3.4/includes/Admin/Notice.php (modified) (5 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/betterlinks.php (modified) (2 diffs)
-
trunk/includes/Admin.php (modified) (1 diff)
-
trunk/includes/Admin/Ajax.php (modified) (2 diffs)
-
trunk/includes/Admin/Notice.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
betterlinks/tags/2.3.4/README.txt
r3398003 r3404157 6 6 Tested up to: 6.7 7 7 Requires PHP: 7.4 8 Stable tag: 2.3. 38 Stable tag: 2.3.4 9 9 License: GPLv3 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 161 161 == Changelog == 162 162 163 = 2.3.4 - 27/11/2025 = 164 165 - Few minor bug fixes & improvements 166 167 163 168 = 2.3.3 - 18/11/2025 = 164 169 -
betterlinks/tags/2.3.4/betterlinks.php
r3398003 r3404157 4 4 * Plugin URI: https://betterlinks.io/ 5 5 * Description: Ultimate plugin to create, shorten, track and manage any URL. Gather analytics reports and run successfully marketing campaigns easily. 6 * Version: 2.3. 36 * Version: 2.3.4 7 7 * Author: WPDeveloper 8 8 * Author URI: https://wpdeveloper.com … … 84 84 * Defines CONSTANTS for Whole plugins. 85 85 */ 86 define('BETTERLINKS_VERSION', '2.3. 3');86 define('BETTERLINKS_VERSION', '2.3.4'); 87 87 define('BETTERLINKS_DB_VERSION', '1.6.7'); 88 88 define('BETTERLINKS_MENU_NOTICE', '9'); -
betterlinks/tags/2.3.4/includes/Admin.php
r3198127 r3404157 46 46 public function insert_plugin_links( $links ) { 47 47 if ( ! apply_filters( 'betterlinks/pro_enabled', false ) ) { 48 $links[] = '<a href="https:// wpdeveloper.com/in/upgrade-betterlinks" target="_blank" style="color: #39b54a; font-weight: bold;">' . __( 'Go Pro', 'betterlinks' ) . '</a>';48 $links[] = '<a href="https://betterlinks.io/bfcm-2025-plugins-wp" target="_blank" style="color: #000000; font-weight: bold;">' . __( 'Save 40% Today', 'betterlinks' ) . '</a>'; 49 49 } 50 50 -
betterlinks/tags/2.3.4/includes/Admin/Ajax.php
r3384708 r3404157 81 81 add_action( 'wp_ajax_betterlinks__admin_menu_notice', array( $this, 'admin_menu_notice' ) ); 82 82 add_action( 'wp_ajax_betterlinks__admin_dashboard_notice', array( $this, 'admin_dashboard_notice' ) ); 83 add_action( 'wp_ajax_betterlinks_dismiss_black_friday_notice', array( $this, 'dismiss_black_friday_notice' ) ); 83 84 84 85 add_action( 'wp_ajax_betterlinks__fetch_target_url', array( $this, 'fetch_target_url' ) ); … … 1594 1595 ) ); 1595 1596 } 1597 1598 /** 1599 * Dismiss Black Friday notice via AJAX 1600 * Sets a transient so the notice doesn't show again for 30 days 1601 * 1602 * @return void 1603 */ 1604 public function dismiss_black_friday_notice() { 1605 // Verify nonce for security 1606 check_ajax_referer( 'betterlinks_dismiss_black_friday_notice', 'nonce' ); 1607 1608 // Check user permissions 1609 if ( ! current_user_can( 'manage_options' ) ) { 1610 wp_send_json_error( 1611 array( 'message' => __( "You don't have permission to do this.", 'betterlinks' ) ), 1612 403 1613 ); 1614 } 1615 1616 // Set transient for 30 days (2592000 seconds) 1617 $transient_set = set_transient( 'betterlinks_black_friday_pointer_dismissed', true, 2592000 ); 1618 1619 if ( ! $transient_set ) { 1620 wp_send_json_error( 1621 array( 'message' => __( 'Failed to dismiss notice. Please try again.', 'betterlinks' ) ), 1622 500 1623 ); 1624 } 1625 1626 // Update plugin pointer priority to null when notice is dismissed 1627 update_option( '_wpdeveloper_plugin_pointer_priority', null ); 1628 1629 // Dismiss the notice in the Notices library system as well 1630 // This ensures the notice doesn't show again even after page refresh 1631 // The key format is: {app}_{notice_id}_notice_dismissed 1632 update_site_option( 'betterlinks_betterlinks_black_friday_2025_notice_dismissed', true ); 1633 1634 wp_send_json_success( array( 'message' => __( 'Notice dismissed successfully.', 'betterlinks' ) ) ); 1635 } 1596 1636 } -
betterlinks/tags/2.3.4/includes/Admin/Notice.php
r3398003 r3404157 20 20 private $opt_in_tracker; 21 21 22 /** 23 * @var bool Flag to prevent duplicate notice display 24 */ 25 private static $black_friday_notice_displayed = false; 26 22 27 const ASSET_URL = BETTERLINKS_ASSETS_URI; 23 28 … … 34 39 add_action( 'in_admin_header', [ $this, 'remove_admin_notice' ] ); 35 40 add_action( 'btl_compatibity_notices', [ $this, 'btlpro_compatibility_notices' ] ); 41 // Use multiple hooks for better compatibility across different WordPress setups 42 add_action( 'admin_footer', [ $this, 'black_friday_pointer_notice' ], 999 ); 36 43 } 37 44 … … 55 62 echo wp_kses_post( $notice ); 56 63 } 64 } 65 66 /** 67 * Display Black Friday pointer notice 68 * Shows only once per user with date range validation 69 * Only displays for free users (without BetterLinks Pro) 70 * Only shows on BetterLinks pages and WordPress dashboard 71 * 72 * @return void 73 */ 74 public function black_friday_pointer_notice() { 75 // Prevent duplicate display when hooked to multiple actions 76 if ( self::$black_friday_notice_displayed ) { 77 return; 78 } 79 80 // Check if notice is dismissed 81 if ( get_transient( 'betterlinks_black_friday_pointer_dismissed' ) ) { 82 return; 83 } 84 85 // Check date range: November 16, 2025 to December 4, 2025 86 $start_date = strtotime( '11:59:59pm 16th November, 2025' ); 87 $end_date = strtotime( '11:59:59pm 4th December, 2025' ); 88 $current_time = current_time( 'timestamp' ); 89 90 // Only show if within date range 91 if ( $current_time < $start_date || $current_time > $end_date ) { 92 return; 93 } 94 95 // Don't show if Pro is already active or installed 96 if ( defined( 'BETTERLINKS_PRO_VERSION' ) || is_plugin_active( 'betterlinks-pro/betterlinks-pro.php' ) ) { 97 return; 98 } 99 100 // Check plugin pointer priority system 101 // BetterLinks priority is 7 102 $betterlinks_priority = 7; 103 $current_priority = get_option( '_wpdeveloper_plugin_pointer_priority' ); 104 // If priority option doesn't exist, create it with BetterLinks priority 105 if ( false === $current_priority || null === $current_priority || '' === $current_priority ) { 106 update_option( '_wpdeveloper_plugin_pointer_priority', $betterlinks_priority ); 107 } elseif ( $current_priority > $betterlinks_priority ) { 108 // If current priority is higher than BetterLinks priority, update it 109 update_option( '_wpdeveloper_plugin_pointer_priority', $betterlinks_priority ); 110 $current_priority = $betterlinks_priority; 111 } 112 113 if ( $current_priority < $betterlinks_priority ) { 114 return; 115 } 116 117 // Only show on BetterLinks pages, WordPress dashboard, and plugins directory 118 $current_screen = get_current_screen(); 119 $is_betterlinks_page = ( 0 === strpos( $current_screen->id, 'toplevel_page_betterlinks' ) || 0 === strpos( $current_screen->id, 'betterlinks_page_' ) ); 120 $is_dashboard = ( 'dashboard' === $current_screen->id ); 121 $is_plugins_page = ( 'plugins' === $current_screen->id ); 122 123 if ( ! $is_betterlinks_page && ! $is_dashboard && ! $is_plugins_page ) { 124 return; 125 } 126 127 // Enqueue pointer styles and scripts 128 wp_enqueue_style( 'wp-pointer' ); 129 wp_enqueue_script( 'wp-pointer' ); 130 wp_enqueue_script( 'jquery' ); 131 132 // Create nonce for AJAX 133 $nonce = wp_create_nonce( 'betterlinks_dismiss_black_friday_notice' ); 134 135 // Mark notice as displayed to prevent duplicates 136 self::$black_friday_notice_displayed = true; 137 138 // Output the notice markup 139 ?> 140 141 <script type="text/javascript"> 142 (function($) { 143 $(document).ready(function() { 144 145 const target = jQuery("#toplevel_page_betterlinks" || 'body'); 146 147 if (target.length === 0) { 148 return; 149 } 150 151 // Prepare content with optional button 152 let content = '<h3><?php esc_html_e( 'BetterLinks Black Friday Sale', 'betterlinks' ); ?></h3><p><?php esc_html_e( 'Shorten and redirect links & analyze website performance efficiently.', 'betterlinks' ); ?> </p>' || ''; 153 content += '<p style="margin-top: 15px;"><a href="https://betterlinks.io/bfcm-wp-admin-pointer" class="button button-primary" target="_blank" rel="noopener"><?php esc_html_e( 'Save 40%', 'betterlinks' ); ?></a></p>'; 154 155 // Default pointer options 156 const options = { 157 content: content, 158 position: { 159 edge: "left", 160 align: 'center' 161 }, 162 close: function() { 163 // dismissPointer(pointerId); 164 var nonce = '<?php echo $nonce; ?>'; 165 // Send AJAX request to set transient 166 $.ajax({ 167 url: '<?php echo esc_url(admin_url( 'admin-ajax.php' )); ?>', 168 type: 'POST', 169 data: { 170 action: 'betterlinks_dismiss_black_friday_notice', 171 nonce: nonce 172 }, 173 }); 174 } 175 }; 176 177 // Show the pointer 178 target.pointer(options).pointer('open'); 179 }); 180 })(jQuery); 181 </script> 182 <?php 57 183 } 58 184 … … 129 255 'stylesheet_url' => self::ASSET_URL . 'css/betterlinks-admin-notice.css', 130 256 'styles' => self::ASSET_URL . 'css/betterlinks-admin-notice.css', 131 'priority' => 5257 'priority' => 7 132 258 ] ); 133 259 … … 248 374 'refresh' => BETTERLINKS_VERSION, 249 375 "expire" => strtotime('11:59:59pm 4th December, 2025'), 250 'display_if' => ! is_plugin_active( 'betterlinks-pro/betterlinks-pro.php' ) 376 'display_if' => ! is_plugin_active( 'betterlinks-pro/betterlinks-pro.php' ), 377 'priority' => 7 251 378 ] 252 379 ); -
betterlinks/trunk/README.txt
r3398003 r3404157 6 6 Tested up to: 6.7 7 7 Requires PHP: 7.4 8 Stable tag: 2.3. 38 Stable tag: 2.3.4 9 9 License: GPLv3 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 161 161 == Changelog == 162 162 163 = 2.3.4 - 27/11/2025 = 164 165 - Few minor bug fixes & improvements 166 167 163 168 = 2.3.3 - 18/11/2025 = 164 169 -
betterlinks/trunk/betterlinks.php
r3398003 r3404157 4 4 * Plugin URI: https://betterlinks.io/ 5 5 * Description: Ultimate plugin to create, shorten, track and manage any URL. Gather analytics reports and run successfully marketing campaigns easily. 6 * Version: 2.3. 36 * Version: 2.3.4 7 7 * Author: WPDeveloper 8 8 * Author URI: https://wpdeveloper.com … … 84 84 * Defines CONSTANTS for Whole plugins. 85 85 */ 86 define('BETTERLINKS_VERSION', '2.3. 3');86 define('BETTERLINKS_VERSION', '2.3.4'); 87 87 define('BETTERLINKS_DB_VERSION', '1.6.7'); 88 88 define('BETTERLINKS_MENU_NOTICE', '9'); -
betterlinks/trunk/includes/Admin.php
r3198127 r3404157 46 46 public function insert_plugin_links( $links ) { 47 47 if ( ! apply_filters( 'betterlinks/pro_enabled', false ) ) { 48 $links[] = '<a href="https:// wpdeveloper.com/in/upgrade-betterlinks" target="_blank" style="color: #39b54a; font-weight: bold;">' . __( 'Go Pro', 'betterlinks' ) . '</a>';48 $links[] = '<a href="https://betterlinks.io/bfcm-2025-plugins-wp" target="_blank" style="color: #000000; font-weight: bold;">' . __( 'Save 40% Today', 'betterlinks' ) . '</a>'; 49 49 } 50 50 -
betterlinks/trunk/includes/Admin/Ajax.php
r3384708 r3404157 81 81 add_action( 'wp_ajax_betterlinks__admin_menu_notice', array( $this, 'admin_menu_notice' ) ); 82 82 add_action( 'wp_ajax_betterlinks__admin_dashboard_notice', array( $this, 'admin_dashboard_notice' ) ); 83 add_action( 'wp_ajax_betterlinks_dismiss_black_friday_notice', array( $this, 'dismiss_black_friday_notice' ) ); 83 84 84 85 add_action( 'wp_ajax_betterlinks__fetch_target_url', array( $this, 'fetch_target_url' ) ); … … 1594 1595 ) ); 1595 1596 } 1597 1598 /** 1599 * Dismiss Black Friday notice via AJAX 1600 * Sets a transient so the notice doesn't show again for 30 days 1601 * 1602 * @return void 1603 */ 1604 public function dismiss_black_friday_notice() { 1605 // Verify nonce for security 1606 check_ajax_referer( 'betterlinks_dismiss_black_friday_notice', 'nonce' ); 1607 1608 // Check user permissions 1609 if ( ! current_user_can( 'manage_options' ) ) { 1610 wp_send_json_error( 1611 array( 'message' => __( "You don't have permission to do this.", 'betterlinks' ) ), 1612 403 1613 ); 1614 } 1615 1616 // Set transient for 30 days (2592000 seconds) 1617 $transient_set = set_transient( 'betterlinks_black_friday_pointer_dismissed', true, 2592000 ); 1618 1619 if ( ! $transient_set ) { 1620 wp_send_json_error( 1621 array( 'message' => __( 'Failed to dismiss notice. Please try again.', 'betterlinks' ) ), 1622 500 1623 ); 1624 } 1625 1626 // Update plugin pointer priority to null when notice is dismissed 1627 update_option( '_wpdeveloper_plugin_pointer_priority', null ); 1628 1629 // Dismiss the notice in the Notices library system as well 1630 // This ensures the notice doesn't show again even after page refresh 1631 // The key format is: {app}_{notice_id}_notice_dismissed 1632 update_site_option( 'betterlinks_betterlinks_black_friday_2025_notice_dismissed', true ); 1633 1634 wp_send_json_success( array( 'message' => __( 'Notice dismissed successfully.', 'betterlinks' ) ) ); 1635 } 1596 1636 } -
betterlinks/trunk/includes/Admin/Notice.php
r3398003 r3404157 20 20 private $opt_in_tracker; 21 21 22 /** 23 * @var bool Flag to prevent duplicate notice display 24 */ 25 private static $black_friday_notice_displayed = false; 26 22 27 const ASSET_URL = BETTERLINKS_ASSETS_URI; 23 28 … … 34 39 add_action( 'in_admin_header', [ $this, 'remove_admin_notice' ] ); 35 40 add_action( 'btl_compatibity_notices', [ $this, 'btlpro_compatibility_notices' ] ); 41 // Use multiple hooks for better compatibility across different WordPress setups 42 add_action( 'admin_footer', [ $this, 'black_friday_pointer_notice' ], 999 ); 36 43 } 37 44 … … 55 62 echo wp_kses_post( $notice ); 56 63 } 64 } 65 66 /** 67 * Display Black Friday pointer notice 68 * Shows only once per user with date range validation 69 * Only displays for free users (without BetterLinks Pro) 70 * Only shows on BetterLinks pages and WordPress dashboard 71 * 72 * @return void 73 */ 74 public function black_friday_pointer_notice() { 75 // Prevent duplicate display when hooked to multiple actions 76 if ( self::$black_friday_notice_displayed ) { 77 return; 78 } 79 80 // Check if notice is dismissed 81 if ( get_transient( 'betterlinks_black_friday_pointer_dismissed' ) ) { 82 return; 83 } 84 85 // Check date range: November 16, 2025 to December 4, 2025 86 $start_date = strtotime( '11:59:59pm 16th November, 2025' ); 87 $end_date = strtotime( '11:59:59pm 4th December, 2025' ); 88 $current_time = current_time( 'timestamp' ); 89 90 // Only show if within date range 91 if ( $current_time < $start_date || $current_time > $end_date ) { 92 return; 93 } 94 95 // Don't show if Pro is already active or installed 96 if ( defined( 'BETTERLINKS_PRO_VERSION' ) || is_plugin_active( 'betterlinks-pro/betterlinks-pro.php' ) ) { 97 return; 98 } 99 100 // Check plugin pointer priority system 101 // BetterLinks priority is 7 102 $betterlinks_priority = 7; 103 $current_priority = get_option( '_wpdeveloper_plugin_pointer_priority' ); 104 // If priority option doesn't exist, create it with BetterLinks priority 105 if ( false === $current_priority || null === $current_priority || '' === $current_priority ) { 106 update_option( '_wpdeveloper_plugin_pointer_priority', $betterlinks_priority ); 107 } elseif ( $current_priority > $betterlinks_priority ) { 108 // If current priority is higher than BetterLinks priority, update it 109 update_option( '_wpdeveloper_plugin_pointer_priority', $betterlinks_priority ); 110 $current_priority = $betterlinks_priority; 111 } 112 113 if ( $current_priority < $betterlinks_priority ) { 114 return; 115 } 116 117 // Only show on BetterLinks pages, WordPress dashboard, and plugins directory 118 $current_screen = get_current_screen(); 119 $is_betterlinks_page = ( 0 === strpos( $current_screen->id, 'toplevel_page_betterlinks' ) || 0 === strpos( $current_screen->id, 'betterlinks_page_' ) ); 120 $is_dashboard = ( 'dashboard' === $current_screen->id ); 121 $is_plugins_page = ( 'plugins' === $current_screen->id ); 122 123 if ( ! $is_betterlinks_page && ! $is_dashboard && ! $is_plugins_page ) { 124 return; 125 } 126 127 // Enqueue pointer styles and scripts 128 wp_enqueue_style( 'wp-pointer' ); 129 wp_enqueue_script( 'wp-pointer' ); 130 wp_enqueue_script( 'jquery' ); 131 132 // Create nonce for AJAX 133 $nonce = wp_create_nonce( 'betterlinks_dismiss_black_friday_notice' ); 134 135 // Mark notice as displayed to prevent duplicates 136 self::$black_friday_notice_displayed = true; 137 138 // Output the notice markup 139 ?> 140 141 <script type="text/javascript"> 142 (function($) { 143 $(document).ready(function() { 144 145 const target = jQuery("#toplevel_page_betterlinks" || 'body'); 146 147 if (target.length === 0) { 148 return; 149 } 150 151 // Prepare content with optional button 152 let content = '<h3><?php esc_html_e( 'BetterLinks Black Friday Sale', 'betterlinks' ); ?></h3><p><?php esc_html_e( 'Shorten and redirect links & analyze website performance efficiently.', 'betterlinks' ); ?> </p>' || ''; 153 content += '<p style="margin-top: 15px;"><a href="https://betterlinks.io/bfcm-wp-admin-pointer" class="button button-primary" target="_blank" rel="noopener"><?php esc_html_e( 'Save 40%', 'betterlinks' ); ?></a></p>'; 154 155 // Default pointer options 156 const options = { 157 content: content, 158 position: { 159 edge: "left", 160 align: 'center' 161 }, 162 close: function() { 163 // dismissPointer(pointerId); 164 var nonce = '<?php echo $nonce; ?>'; 165 // Send AJAX request to set transient 166 $.ajax({ 167 url: '<?php echo esc_url(admin_url( 'admin-ajax.php' )); ?>', 168 type: 'POST', 169 data: { 170 action: 'betterlinks_dismiss_black_friday_notice', 171 nonce: nonce 172 }, 173 }); 174 } 175 }; 176 177 // Show the pointer 178 target.pointer(options).pointer('open'); 179 }); 180 })(jQuery); 181 </script> 182 <?php 57 183 } 58 184 … … 129 255 'stylesheet_url' => self::ASSET_URL . 'css/betterlinks-admin-notice.css', 130 256 'styles' => self::ASSET_URL . 'css/betterlinks-admin-notice.css', 131 'priority' => 5257 'priority' => 7 132 258 ] ); 133 259 … … 248 374 'refresh' => BETTERLINKS_VERSION, 249 375 "expire" => strtotime('11:59:59pm 4th December, 2025'), 250 'display_if' => ! is_plugin_active( 'betterlinks-pro/betterlinks-pro.php' ) 376 'display_if' => ! is_plugin_active( 'betterlinks-pro/betterlinks-pro.php' ), 377 'priority' => 7 251 378 ] 252 379 );
Note: See TracChangeset
for help on using the changeset viewer.