Changeset 3265404
- Timestamp:
- 04/02/2025 04:54:14 AM (11 months ago)
- Location:
- top-bar-notification-sticky-banners/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (4 diffs)
-
top-bar-notification-sticky-banners.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
top-bar-notification-sticky-banners/trunk/readme.txt
r3254364 r3265404 1 === Top Bar Notification & Sticky Banners ===1 === Top Bar Notification & Sticky Banners === 2 2 Contributors: wpcentrics 3 3 Tags: top bar, topbar, notification, sticky banners … … 6 6 Tested up to: 6.7 7 7 Requires PHP: 7.4 8 Stable tag: 1.0. 08 Stable tag: 1.0.1 9 9 License: GNU General Public License v3.0 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 19 19 Compatible with most themes, it includes 7 different sticky methods. Add image banners, announcements, and messages. Easily create your own styles with its built-in style editor using your own fonts. 20 20 21 [Run live preview](https://wordpress.org/plugins/top-bar-notification-sticky-banners/?preview=1) 22 21 ⚡Demo here: [Run live preview](https://wordpress.org/plugins/top-bar-notification-sticky-banners/?preview=1) 23 22 == 🚀 Powerful & easy to use == 24 23 … … 138 137 139 138 == Changelog == 139 1.0.1 Fixed issue: examples no longer reinstall automatically when all banners are deleted 140 140 1.0.0 Hello world!!! 141 141 -
top-bar-notification-sticky-banners/trunk/top-bar-notification-sticky-banners.php
r3238262 r3265404 6 6 * Requires at least: 6.7 7 7 * Requires PHP: 7.4 8 * Version: 1.0. 08 * Version: 1.0.1 9 9 * Author: wpcentrics 10 10 * Author URI: https://www.wp-centrics.com/ … … 21 21 if( ! defined('TOPBARNSB_VERSION') && ! class_exists( 'TopBarNSB' ) ) { 22 22 23 define( 'TOPBARNSB_VERSION', '1.0. 0' );23 define( 'TOPBARNSB_VERSION', '1.0.1' ); 24 24 define( 'TOPBARNSB_DIR', trailingslashit( dirname( __FILE__ ) ) ); 25 25 define( 'TOPBARNSB_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) ); … … 119 119 * 120 120 * @since 1.0.0 121 * @version 1.0.1 121 122 */ 122 123 function init() … … 154 155 155 156 // First load after first activation? 156 // if ( is_admin() && ! $this->get_setting('installed', false) && get_option( 'topbarnsb_activation' ) === '1' ) { 157 if ( is_admin() ) { 157 if ( is_admin() && ! $this->get_setting('installed', false) ) { 158 $this->install_plugin(); 159 } 160 161 // Recreate sample banners? 162 if( isset($_GET['topbarnsb-recreate']) && check_ajax_referer( 'topbarnsb_recreate', 'nonce', true ) ) 163 { 158 164 $this->install_plugin(); 159 165 } … … 359 365 * 360 366 * @since 1.0.0 367 * @version 1.0.1 361 368 */ 362 369 function we_are_in_page( $where ) … … 371 378 $settings = $screen->id === 'topbarnsb_page_topbarnsb-settings'; 372 379 $editing = $screen->base === 'post'; 373 $cpt_banner = $post_type === $this->banner_post_type ;380 $cpt_banner = $post_type === $this->banner_post_type && !$settings; 374 381 $cpt_style = $post_type === $this->style_post_type; 375 382 … … 1048 1055 * 1049 1056 * Only in plugin pages: 1057 * - Propose recreate banners if there aren't any 1050 1058 * - Warns about demo mode 1051 1059 * - Warns about banners dismissed 1052 1060 * 1053 1061 * @since 1.0.0 1062 * @version 1.0.1 1054 1063 */ 1055 1064 function admin_notices() … … 1058 1067 return; 1059 1068 1060 if( $this->get_setting('demo_mode', 1) == '1' ) 1061 { 1062 echo '<div class="notice notice-info"><p>'; 1063 1064 echo wp_kses( 1065 __('Top Bar Notification & Sticky Banners are running in <strong>Demo mode</strong>, so only users logged in as administrators will see the banners.', 'top-bar-notification-sticky-banners') . ' ', 1066 array( 'strong' => array() ) 1067 ); 1068 1069 if( $this->we_are_in_page('settings') ) 1070 { 1071 esc_html_e('You can change this here, in Main options:','top-bar-notification-sticky-banners'); 1072 } 1073 else 1074 { 1075 // translators: the part: %1$ssettings page%2$s will be turned into link 1076 printf( esc_html__('You can change this in %1$ssettings page%2$s.', 'top-bar-notification-sticky-banners'), 1077 '<a href="' . esc_url(admin_url('edit.php?post_type=topbarnsb&page=topbarnsb-settings')) . '">', 1078 '</a>'); 1079 } 1080 echo '</p></div>'; 1081 } 1082 1083 // Read the cookie and decode: 1084 $cookie_data = $this->decode_cookie(); 1085 1086 if( ! empty( $cookie_data ['dismiss_top'] ) || ! empty( $cookie_data ['dismiss_bot'] ) ) 1087 { 1069 1070 // We will check if there is at least one banner 1071 $propose_recreate_sample_banners = false; 1072 1073 if( ! $this->we_are_in_page('any_edition') ) 1074 { 1075 $banners = get_posts( array( 1076 'post_type' => $this->banner_post_type, 1077 'orderby' => 'menu_order', 1078 'order' => 'ASC', 1079 'posts_per_page' => 1 1080 ) ); 1081 1082 if( is_array($banners) && count($banners) < 1 ) 1083 $propose_recreate_sample_banners = true; 1084 } 1085 1086 // If we must propose recreate banners, no want to tell nothing else about demo/hidden banners for now 1087 if( $propose_recreate_sample_banners ) 1088 { 1089 // Offer regenerate sample banners 1088 1090 $link_params = array( 1089 'topbarnsb-param' => 'dismiss', 1090 'topbarnsb-value' => 'reset', 1091 'nonce' => wp_create_nonce( 'topbarnsb_dismiss' ) 1091 'topbarnsb-recreate' => '1', 1092 'nonce' => wp_create_nonce( 'topbarnsb_recreate' ) 1092 1093 ); 1093 1094 ?> 1094 1095 <div class="notice notice-info"> 1095 <p><?php echo esc_html__('You have clicked to hide the banners. To show them again, click here:', 'top-bar-notification-sticky-banners') . ' <a style="margin: 0 10px;" class="button" href="' . esc_url( add_query_arg($link_params, get_bloginfo('url')) ) . '" target="_blank">' . esc_html__('Show again','top-bar-notification-sticky-banners') . '</a>'; ?></p>1096 <p><?php echo esc_html__('You don’t have any banners right now. Do you want to create the demo banners? ', 'top-bar-notification-sticky-banners') . ' <a style="margin: 0 10px;" class="button" href="' . esc_url( add_query_arg($link_params) ) . '">' . esc_html__('Create demos','top-bar-notification-sticky-banners') . '</a>'; ?></p> 1096 1097 </div> 1097 1098 <?php 1099 } 1100 else 1101 { 1102 if( $this->get_setting('demo_mode', 1) == '1' ) 1103 { 1104 echo '<div class="notice notice-info"><p>'; 1105 1106 echo wp_kses( 1107 __('Top Bar Notification & Sticky Banners are running in <strong>Demo mode</strong>, so only users logged in as administrators will see the banners.', 'top-bar-notification-sticky-banners') . ' ', 1108 array( 'strong' => array() ) 1109 ); 1110 1111 if( $this->we_are_in_page('settings') ) 1112 { 1113 esc_html_e('You can change this here, in Main options:','top-bar-notification-sticky-banners'); 1114 } 1115 else 1116 { 1117 // translators: the part: %1$ssettings page%2$s will be turned into link 1118 printf( esc_html__('You can change this in %1$ssettings page%2$s.', 'top-bar-notification-sticky-banners'), 1119 '<a href="' . esc_url(admin_url('edit.php?post_type=topbarnsb&page=topbarnsb-settings')) . '">', 1120 '</a>'); 1121 } 1122 echo '</p></div>'; 1123 } 1124 1125 // Read the cookie and decode: 1126 $cookie_data = $this->decode_cookie(); 1127 1128 if( ! empty( $cookie_data ['dismiss_top'] ) || ! empty( $cookie_data ['dismiss_bot'] ) ) 1129 { 1130 $link_params = array( 1131 'topbarnsb-param' => 'dismiss', 1132 'topbarnsb-value' => 'reset', 1133 'nonce' => wp_create_nonce( 'topbarnsb_dismiss' ) 1134 ); 1135 ?> 1136 <div class="notice notice-info"> 1137 <p><?php echo esc_html__('You have clicked to hide the banners. To show them again, click here:', 'top-bar-notification-sticky-banners') . ' <a style="margin: 0 10px;" class="button" href="' . esc_url( add_query_arg($link_params, get_bloginfo('url')) ) . '" target="_blank">' . esc_html__('Show again','top-bar-notification-sticky-banners') . '</a>'; ?></p> 1138 </div> 1139 <?php 1140 } 1098 1141 } 1099 1142 }
Note: See TracChangeset
for help on using the changeset viewer.