Plugin Directory

Changeset 2943099


Ignore:
Timestamp:
07/25/2023 01:21:06 PM (3 years ago)
Author:
rezaplus
Message:

fix notice class

Location:
twchat/trunk
Files:
10 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • twchat/trunk/TWChat.php

    r2943088 r2943099  
    44 * Description: Allowing admins to send messages to customers and vice versa through popular chat platforms.
    55 * Author: Rellaco
    6  * Version: 4.0.0
     6 * Version: 4.0.1
    77 * Author URI: https://rellaco.com
    88 * Plugin URI: "https://rellaco.com/product/TwoWayChat"
     
    4848 * @since 1.0.0
    4949 */
    50 defined( 'TWCH_VERSION' ) or define( 'TWCH_VERSION', '4.0.0' );
     50defined( 'TWCH_VERSION' ) or define( 'TWCH_VERSION', '4.0.1' );
    5151
    5252// run plugin
  • twchat/trunk/helpers/notices.php

    r2942750 r2943099  
    11<?php
     2
    23/**
    34 * Manage the notice of the plugin in admin panel
     
    1011 */
    1112
    12  // Exit if accessed directly
    13 if ( ! defined( 'ABSPATH' ) ) { exit; }
     13// Exit if accessed directly
     14if (!defined('ABSPATH')) {
     15    exit;
     16}
    1417
    1518class TWChat_notice
     
    3740        $this->dismissible = $dismissible;
    3841        $this->button = $button;
    39         // show notice
    4042        echo $this->display_notice();
    4143    }
     44
     45
    4246    /**
    4347     * Display notice html code with message and type and button
     
    5862        }
    5963        // print notice html
    60         printf('<div class="%1$s"><p>%2$s</p>%3$s</div>', esc_attr($class), $message, $button);
     64        return sprintf('<div class="%1$s"><p>%2$s</p>%3$s</div>', esc_attr($class), $message, $button);
    6165    }
    6266}
     
    7680    function TWChat_notice($message, $type = 'info', $dismissible = true, $button = array())
    7781    {
    78         $notice = new TWChat_notice();
    79         $notice->add_notice($message, $type, $dismissible, $button);
     82        // if is admin panel
     83        if (is_admin()) {
     84            $notice = new TWChat_notice();
     85            $notice->add_notice($message, $type, $dismissible, $button);
     86        }
    8087    }
    8188}
Note: See TracChangeset for help on using the changeset viewer.