403Webshell
Server IP : 38.190.208.107  /  Your IP : 216.73.217.46
Web Server : nginx/1.28.1
System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64
User : root ( 0)
PHP Version : 8.2.28
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,eval,assert,passthru,system,exec,shell_exec,popen,proc_open
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/wp.3/wp-content/plugins/wpforms-lite/src/Lite/Integrations/LiteConnect/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/wp.3/wp-content/plugins/wpforms-lite/src/Lite/Integrations/LiteConnect/Admin.php
<?php

namespace WPForms\Lite\Integrations\LiteConnect;

use WPForms\Admin\Notice;
use WPForms\Helpers\Transient;

/**
 * Handles admin functionalities and setup for the application.
 *
 * @since 1.10.0.1
 */
class Admin {

	/**
	 * Dismiss notice slug.
	 *
	 * @since 1.10.0.1
	 */
	private const DISMISS_NOTICE_SLUG = 'lite_connect_send_error_alert';

	/**
	 * Initializes the constructor and setup hooks.
	 *
	 * @since 1.10.0.1
	 */
	public function __construct() {

		$this->hooks();
	}

	/**
	 * Registers hooks to manage the display of notices on specific pages.
	 *
	 * @since 1.10.0.1
	 */
	private function hooks(): void {

		// Reset expired dismissed notice to allow re-displaying after one week.
		add_filter( 'option_wpforms_admin_notices', [ $this, 'reset_expired_notice' ] );

		// Display notices only on WPForms pages.
		if ( $this->is_notice_target_page() ) {
			// Display an admin notice if there are entries available to import.
			add_action( 'admin_notices', [ $this, 'display_error_notices' ] );
		}
	}

	/**
	 * Reset the dismissed notice if it was dismissed more than a week ago.
	 *
	 * @since 1.10.0.1
	 *
	 * @param mixed $notices Dismissed notices option value.
	 *
	 * @return array Modified dismissed notices option value.
	 */
	public function reset_expired_notice( $notices ): array { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks

		$notices = (array) $notices;

		if ( ! isset( $notices[ self::DISMISS_NOTICE_SLUG ] ) ) {
			return $notices;
		}

		$notice_time = $notices[ self::DISMISS_NOTICE_SLUG ]['time'] ?? 0;

		if ( ( time() - $notice_time ) <= WEEK_IN_SECONDS ) {
			return $notices;
		}

		Transient::delete( SendEntryTask::SEND_ERROR_KEY );

		unset( $notices[ self::DISMISS_NOTICE_SLUG ] );

		remove_filter( 'option_wpforms_admin_notices', [ $this, 'reset_expired_notice' ] );
		update_option( 'wpforms_admin_notices', $notices, true );
		add_filter( 'option_wpforms_admin_notices', [ $this, 'reset_expired_notice' ] );

		return $notices;
	}

	/**
	 * Display error notices for entry backup failures.
	 *
	 * @since 1.10.0.1
	 *
	 * @noinspection HtmlUnknownTarget
	 */
	public function display_error_notices(): void {

		if ( ! self::has_repeated_errors() ) {
			return;
		}

		Notice::error(
			sprintf(
				wp_kses( /* translators: %s - WPForms support URL. */
					__( '<strong>Entry Backup Failures Detected</strong><br>Some entry backups may not have been saved. This is usually caused by a scheduling issue on your site. Please <a href="%s" target="_blank" rel="noopener noreferrer">contact Support</a> so we can help resolve it and ensure your entries are protected.', 'wpforms-lite' ),
					[
						'strong' => [],
						'br'     => [],
						'a'      => [
							'href'   => [],
							'target' => [],
							'rel'    => [],
						],
					]
				),
				esc_url(
					wpforms_utm_link(
						'https://wpforms.com/account/support/',
						'Admin',
						'Contact Support - Lite Connect Backup Failure'
					)
				)
			),
			[
				'dismiss' => Notice::DISMISS_GLOBAL,
				'slug'    => self::DISMISS_NOTICE_SLUG,
			]
		);
	}

	/**
	 * Checks if there are repeated errors in the cached error data.
	 *
	 * @since 1.10.0.1
	 *
	 * @return bool
	 */
	public static function has_repeated_errors(): bool {

		$lite_connect_send_errors = Transient::get( SendEntryTask::SEND_ERROR_KEY );

		if ( empty( $lite_connect_send_errors ) || ! is_array( $lite_connect_send_errors ) ) {
			return false;
		}

		foreach ( $lite_connect_send_errors as $errors ) {
			if ( count( $errors ) >= 4 ) {
				return true;
			}
		}

		return false;
	}

	/**
	 * Determines if the current page is the target page for displaying a notice.
	 *
	 * @since 1.10.0.1
	 *
	 * @return bool True if the current page is the target page, false otherwise.
	 */
	private function is_notice_target_page(): bool {

		global $pagenow;

		// phpcs:ignore WordPress.Security.NonceVerification.Recommended
		$is_dashboard_page = $pagenow === 'index.php' && empty( $_GET['page'] );

		return $is_dashboard_page || wpforms_is_admin_page( 'overview' ) || wpforms_is_admin_page( 'settings' );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit