Server : Apache System : Linux pod-100823:apache2_74:v0.5.7 5.4.0-1138-gcp #147~18.04.1-Ubuntu SMP Mon Oct 7 21:46:26 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33.7 Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system Directory : /nas/content/live/attorneyexperi/wp-content/plugins/cookie-law-info/lite/includes/ |
<?php /** * WordPress file sytstem API. * * @link https://www.cookieyes.com/ * @since 3.0.0 * @package CookieYes\Lite\Includes */ namespace CookieYes\Lite\Includes; // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Handles admin notices for the plugin. */ class Notice { /** * Instance of the current class * * @var object */ private static $instance; /** * Return the current instance of the class * * @return object */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } /** * Holds all dismissed notices * * @access public * @since 3.0.0 * @var array $notices Array of dismissed notices. */ public $notices; /** * Primary class constructor. * * @access public * @since 3.0.0 */ public function __construct() { // Populate $notices. $this->notices = $this->get_dismissed(); foreach ( $this->notices as $notice => $timeout ) { if ( $timeout && $timeout < time() ) { $this->undismiss( $notice ); } } } /** * Checks if a given notice has been dismissed or not * * @since 6.0.0 * @param string $notice Programmatic Notice Name. * @return boolean Notice Dismissed */ public function is_dismissed( $notice ) { if ( ! isset( $this->notices[ $notice ] ) ) { return false; } return true; } /** * Marks the given notice as dismissed * * @since 3.0.0 * @param string $notice Programmatic Notice Name. * @param integer $expiry Notice expiry. * @return void */ public function dismiss( $notice, $expiry = 0 ) { $dismissed = $this->get_dismissed(); if ( 0 !== $expiry ) { $dismissed[ $notice ] = time() + $expiry; } else { $dismissed[ $notice ] = false; } update_option( 'cky_admin_notices', $dismissed ); } /** * Marks a notice as not dismissed * * @access public * @since 6.0.0 * * @param string $notice Programmatic Notice Name. * @return void */ public function undismiss( $notice ) { unset( $this->notices[ $notice ] ); update_option( 'cky_admin_notices', $this->notices ); } /** * Add notice * * @param string $notice Notice ID. * @param array $options Notice options. * @return void */ public function add( $notice, $options = array() ) { $options = wp_parse_args( $options, array( 'dismissible' => true, 'type' => 'default', 'expiration' => 0, // Default 0 (no expiration). 'message' => '', ) ); if ( isset( $this->notices[ $notice ] ) ) { unset( $this->notices[ $notice ] ); } else { $this->notices[ $notice ] = $options; } } /** * Get all the notices. * * @return array */ public function get() { return $this->notices; } /** * Get dismissed notices * * @return array */ public function get_dismissed() { return get_option( 'cky_admin_notices', array() ); } }