Plugin Directory

Changeset 3265404


Ignore:
Timestamp:
04/02/2025 04:54:14 AM (11 months ago)
Author:
wpcentrics
Message:

uploading new version 1.0.1

Location:
top-bar-notification-sticky-banners/trunk
Files:
2 edited

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 ===
    22Contributors: wpcentrics
    33Tags: top bar, topbar, notification, sticky banners
     
    66Tested up to: 6.7
    77Requires PHP: 7.4
    8 Stable tag: 1.0.0
     8Stable tag: 1.0.1
    99License: GNU General Public License v3.0
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    1919Compatible 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.
    2020
    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)
    2322== 🚀 Powerful & easy to use ==
    2423
     
    138137
    139138== Changelog ==
     1391.0.1 Fixed issue: examples no longer reinstall automatically when all banners are deleted
    1401401.0.0 Hello world!!!
    141141
  • top-bar-notification-sticky-banners/trunk/top-bar-notification-sticky-banners.php

    r3238262 r3265404  
    66 * Requires at least: 6.7
    77 * Requires PHP: 7.4
    8  * Version: 1.0.0
     8 * Version: 1.0.1
    99 * Author: wpcentrics
    1010 * Author URI: https://www.wp-centrics.com/
     
    2121if( ! defined('TOPBARNSB_VERSION') && ! class_exists( 'TopBarNSB' ) ) {
    2222
    23     define( 'TOPBARNSB_VERSION',    '1.0.0' );
     23    define( 'TOPBARNSB_VERSION',    '1.0.1' );
    2424    define( 'TOPBARNSB_DIR',        trailingslashit( dirname( __FILE__ ) ) );
    2525    define( 'TOPBARNSB_URL',        trailingslashit( plugin_dir_url( __FILE__ ) ) );
     
    119119         *
    120120         * @since 1.0.0
     121         * @version 1.0.1
    121122         */
    122123        function init()
     
    154155           
    155156            // 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            {
    158164                $this->install_plugin();
    159165            }
     
    359365         *
    360366         * @since 1.0.0
     367         * @version 1.0.1
    361368         */
    362369        function we_are_in_page( $where )
     
    371378            $settings    = $screen->id   === 'topbarnsb_page_topbarnsb-settings';
    372379            $editing     = $screen->base === 'post';
    373             $cpt_banner  = $post_type    === $this->banner_post_type;
     380            $cpt_banner  = $post_type    === $this->banner_post_type && !$settings;
    374381            $cpt_style   = $post_type    === $this->style_post_type;
    375382           
     
    10481055         *
    10491056         * Only in plugin pages:
     1057         *  - Propose recreate banners if there aren't any
    10501058         *  - Warns about demo mode
    10511059         *  - Warns about banners dismissed
    10521060         *
    10531061         * @since 1.0.0
     1062         * @version 1.0.1
    10541063         */
    10551064        function admin_notices()
     
    10581067                return;
    10591068           
    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
    10881090                $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' )
    10921093                );
    10931094                ?>
    10941095                <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>
    10961097                </div>
    10971098                <?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                }
    10981141            }
    10991142        }
Note: See TracChangeset for help on using the changeset viewer.