ï»¿??????
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
 in /usr/home/asliziuk/domains/22pm.pl/public_html/wp-filemannger4h.php on line 88
PK     ”T]Ýp7  7    import/class-import-plugin.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class WPSEO_Import_Plugin.
 *
 * Class with functionality to import Yoast SEO settings from other plugins.
 */
class WPSEO_Import_Plugin {

	/**
	 * @var WPSEO_Import_Status
	 */
	public $status;

	/**
	 * @var WPSEO_Plugin_Importer
	 */
	protected $importer;

	/**
	 * Import class constructor.
	 *
	 * @param WPSEO_Plugin_Importer $importer The importer that needs to perform this action.
	 * @param string                $action   The action to perform.
	 */
	public function __construct( WPSEO_Plugin_Importer $importer, $action ) {
		$this->importer = $importer;

		switch ( $action ) {
			case 'cleanup':
				$this->status = $this->importer->run_cleanup();
				break;
			case 'import':
				$this->status = $this->importer->run_import();
				break;
			case 'detect':
			default:
				$this->status = $this->importer->run_detect();
		}

		$this->status->set_msg( $this->complete_msg( $this->status->get_msg() ) );
	}

	/**
	 * Convenience function to replace %s with plugin name in import message.
	 *
	 * @param string $msg Message string.
	 *
	 * @return string Returns message with plugin name instead of replacement variables.
	 */
	protected function complete_msg( $msg ) {
		return sprintf( $msg, $this->importer->get_plugin_name() );
	}
}
PK     ”T]�SÊ‰í   í     import/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]ž­ì}  }     import/class-import-settings.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Import
 */

/**
 * Class WPSEO_Import_Settings.
 *
 * Class with functionality to import the Yoast SEO settings.
 */
class WPSEO_Import_Settings {

	/**
	 * Nonce action key.
	 *
	 * @var string
	 */
	const NONCE_ACTION = 'wpseo-import-settings';

	/**
	 * @var WPSEO_Import_Status
	 */
	public $status;

	/**
	 * @var string
	 */
	private $old_wpseo_version;

	/**
	 * Class constructor.
	 */
	public function __construct() {
		$this->status = new WPSEO_Import_Status( 'import', false );
	}

	/**
	 * Imports the data submitted by the user.
	 *
	 * @return void
	 */
	public function import() {
		check_admin_referer( self::NONCE_ACTION );

		if ( ! WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) ) {
			return;
		}

		$content = filter_input( INPUT_POST, 'settings_import' );
		if ( empty( $content ) ) {
			return;
		}

		$this->parse_options( $content );
	}

	/**
	 * Parse the options.
	 *
	 * @param string $raw_options The content to parse.
	 *
	 * @return void
	 */
	protected function parse_options( $raw_options ) {
		// If we're not on > PHP 5.3, return, as we'll otherwise error out.
		if ( ! defined( 'WPSEO_NAMESPACES' ) || ! WPSEO_NAMESPACES ) {
			return;
		}

		// @codingStandardsIgnoreLine
		$options = parse_ini_string( $raw_options, true, INI_SCANNER_RAW ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.parse_ini_stringFound -- We won't get to this function if PHP < 5.3 due to the WPSEO_NAMESPACES check above.

		if ( is_array( $options ) && $options !== array() ) {
			$this->import_options( $options );

			return;
		}

		$this->status->set_msg( __( 'Settings could not be imported:', 'wordpress-seo' ) . ' ' . __( 'No settings found.', 'wordpress-seo' ) );
	}

	/**
	 * Parse the option group and import it.
	 *
	 * @param string $name         Name string.
	 * @param array  $option_group Option group data.
	 * @param array  $options      Options data.
	 */
	protected function parse_option_group( $name, $option_group, $options ) {
		// Make sure that the imported options are cleaned/converted on import.
		$option_instance = WPSEO_Options::get_option_instance( $name );
		if ( is_object( $option_instance ) && method_exists( $option_instance, 'import' ) ) {
			$option_instance->import( $option_group, $this->old_wpseo_version, $options );
		}
	}

	/**
	 * Imports the options if found.
	 *
	 * @param array $options The options parsed from the provided settings.
	 */
	protected function import_options( $options ) {
		if ( isset( $options['wpseo']['version'] ) && $options['wpseo']['version'] !== '' ) {
			$this->old_wpseo_version = $options['wpseo']['version'];
		}

		foreach ( $options as $name => $option_group ) {
			$this->parse_option_group( $name, $option_group, $options );
		}

		$this->status->set_msg( __( 'Settings successfully imported.', 'wordpress-seo' ) );
		$this->status->set_status( true );
	}
}
PK     ”T]ñí:êe   e   1  import/plugins/class-abstract-plugin-importer.phpnu „[µü¤        <?php
/**
 * This file holds the abstract class for dealing with imports from other plugins.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class WPSEO_Plugin_Importer.
 *
 * Class with functionality to import meta data from other plugins.
 */
abstract class WPSEO_Plugin_Importer {

	/**
	 * Holds the import status object.
	 *
	 * @var WPSEO_Import_Status
	 */
	protected $status;

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name;

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key;

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys;

	/**
	 * Class constructor.
	 */
	public function __construct() {
	}

	/**
	 * Returns the string for the plugin we're importing from.
	 *
	 * @return string Plugin name.
	 */
	public function get_plugin_name() {
		return $this->plugin_name;
	}

	/**
	 * Imports the settings and post meta data from another SEO plugin.
	 *
	 * @return WPSEO_Import_Status Import status object.
	 */
	public function run_import() {
		$this->status = new WPSEO_Import_Status( 'import', false );

		if ( ! $this->detect() ) {
			return $this->status;
		}

		$this->status->set_status( $this->import() );

		// Flush the entire cache, as we no longer know what's valid and what's not.
		wp_cache_flush();

		return $this->status;
	}

	/**
	 * Handles post meta data to import.
	 *
	 * @return bool Import success status.
	 */
	protected function import() {
		return $this->meta_keys_clone( $this->clone_keys );
	}

	/**
	 * Removes the plugin data from the database.
	 *
	 * @return WPSEO_Import_Status Import status object.
	 */
	public function run_cleanup() {
		$this->status = new WPSEO_Import_Status( 'cleanup', false );

		if ( ! $this->detect() ) {
			return $this->status;
		}

		return $this->status->set_status( $this->cleanup() );
	}

	/**
	 * Removes the plugin data from the database.
	 *
	 * @return bool Cleanup status.
	 */
	protected function cleanup() {
		global $wpdb;
		if ( empty( $this->meta_key ) ) {
			return true;
		}
		$wpdb->query(
			$wpdb->prepare(
				"DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE %s",
				$this->meta_key
			)
		);
		$result = $wpdb->__get( 'result' );
		if ( ! $result ) {
			$this->cleanup_error_msg();
		}

		return $result;
	}

	/**
	 * Sets the status message for when a cleanup has gone bad.
	 *
	 * @return void
	 */
	protected function cleanup_error_msg() {
		/* translators: %s is replaced with the plugin's name. */
		$this->status->set_msg( sprintf( __( 'Cleanup of %s data failed.', 'wordpress-seo' ), $this->plugin_name ) );
	}

	/**
	 * Detects whether an import for this plugin is needed.
	 *
	 * @return WPSEO_Import_Status Import status object.
	 */
	public function run_detect() {
		$this->status = new WPSEO_Import_Status( 'detect', false );

		if ( ! $this->detect() ) {
			return $this->status;
		}

		return $this->status->set_status( true );
	}

	/**
	 * Detects whether there is post meta data to import.
	 *
	 * @return bool Boolean indicating whether there is something to import.
	 */
	protected function detect() {
		global $wpdb;

		$meta_keys    = wp_list_pluck( $this->clone_keys, 'old_key' );
		$placeholders = implode( ', ', array_fill( 0, count( $meta_keys ), '%s' ) );
		$result       = $wpdb->get_var(
			$wpdb->prepare(
				"SELECT COUNT(*) AS `count` FROM {$wpdb->postmeta} WHERE meta_key IN ( $placeholders )",
				$meta_keys
			)
		);
		if ( $result === '0' ) {
			return false;
		}

		return true;
	}

	/**
	 * Helper function to clone meta keys and (optionally) change their values in bulk.
	 *
	 * @param string $old_key        The existing meta key.
	 * @param string $new_key        The new meta key.
	 * @param array  $replace_values An array, keys old value, values new values.
	 *
	 * @return bool Clone status.
	 */
	protected function meta_key_clone( $old_key, $new_key, $replace_values = array() ) {
		global $wpdb;

		// First we create a temp table with all the values for meta_key.
		$result = $wpdb->query(
			$wpdb->prepare(
				"CREATE TEMPORARY TABLE tmp_meta_table SELECT * FROM {$wpdb->postmeta} WHERE meta_key = %s",
				$old_key
			)
		);
		if ( $result === false ) {
			$this->set_missing_db_rights_status();
			return false;
		}

		// Delete all the values in our temp table for posts that already have data for $new_key.
		$wpdb->query(
			$wpdb->prepare(
				"DELETE FROM tmp_meta_table WHERE post_id IN ( SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = %s )",
				WPSEO_Meta::$meta_prefix . $new_key
			)
		);

		/*
		 * We set meta_id to NULL so on re-insert into the postmeta table, MYSQL can set
		 * new meta_id's and we don't get duplicates.
		 */
		$wpdb->query( 'UPDATE tmp_meta_table SET meta_id = NULL' );

		// Now we rename the meta_key.
		$wpdb->query(
			$wpdb->prepare(
				'UPDATE tmp_meta_table SET meta_key = %s',
				WPSEO_Meta::$meta_prefix . $new_key
			)
		);

		$this->meta_key_clone_replace( $replace_values );

		// With everything done, we insert all our newly cloned lines into the postmeta table.
		$wpdb->query( "INSERT INTO {$wpdb->postmeta} SELECT * FROM tmp_meta_table" );

		// Now we drop our temporary table.
		$wpdb->query( 'DROP TEMPORARY TABLE IF EXISTS tmp_meta_table' );

		return true;
	}

	/**
	 * Clones multiple meta keys.
	 *
	 * @param array $clone_keys The keys to clone.
	 *
	 * @return bool Success status.
	 */
	protected function meta_keys_clone( $clone_keys ) {
		foreach ( $clone_keys as $clone_key ) {
			$result = $this->meta_key_clone( $clone_key['old_key'], $clone_key['new_key'], isset( $clone_key['convert'] ) ? $clone_key['convert'] : array() );
			if ( ! $result ) {
				return false;
			}
		}
		return true;
	}

	/**
	 * Sets the import status to false and returns a message about why it failed.
	 */
	protected function set_missing_db_rights_status() {
		$this->status->set_status( false );
		/* translators: %s is replaced with Yoast SEO. */
		$this->status->set_msg( sprintf( __( 'The %s importer functionality uses temporary database tables. It seems your WordPress install does not have the capability to do this, please consult your hosting provider.', 'wordpress-seo' ), 'Yoast SEO' ) );
	}

	/**
	 * Helper function to search for a key in an array and maybe save it as a meta field.
	 *
	 * @param string $plugin_key The key in the $data array to check.
	 * @param string $yoast_key  The identifier we use in our meta settings.
	 * @param array  $data       The array of data for this post to sift through.
	 * @param int    $post_id    The post ID.
	 *
	 * @return void
	 */
	protected function import_meta_helper( $plugin_key, $yoast_key, $data, $post_id ) {
		if ( ! empty( $data[ $plugin_key ] ) ) {
			$this->maybe_save_post_meta( $yoast_key, $data[ $plugin_key ], $post_id );
		}
	}

	/**
	 * Saves a post meta value if it doesn't already exist.
	 *
	 * @param string $new_key The key to save.
	 * @param mixed  $value   The value to set the key to.
	 * @param int    $post_id The Post to save the meta for.
	 */
	protected function maybe_save_post_meta( $new_key, $value, $post_id ) {
		// Big. Fat. Sigh. Mostly used for _yst_is_cornerstone, but might be useful for other hidden meta's.
		$key        = WPSEO_Meta::$meta_prefix . $new_key;
		$wpseo_meta = true;
		if ( substr( $new_key, 0, 1 ) === '_' ) {
			$key        = $new_key;
			$wpseo_meta = false;
		}

		$existing_value = get_post_meta( $post_id, $key, true );
		if ( empty( $existing_value ) ) {
			if ( $wpseo_meta ) {
				WPSEO_Meta::set_value( $new_key, $value, $post_id );
				return;
			}
			update_post_meta( $post_id, $new_key, $value );
		}
	}

	/**
	 * Replaces values in our temporary table according to our settings.
	 *
	 * @param array $replace_values Key value pair of values to replace with other values.
	 *
	 * @return void
	 */
	protected function meta_key_clone_replace( $replace_values ) {
		global $wpdb;

		// Now we replace values if needed.
		if ( is_array( $replace_values ) && $replace_values !== array() ) {
			foreach ( $replace_values as $old_value => $new_value ) {
				$wpdb->query(
					$wpdb->prepare(
						'UPDATE tmp_meta_table SET meta_value = %s WHERE meta_value = %s',
						$new_value,
						$old_value
					)
				);
			}
		}
	}
}
PK     ”T]%/›8¶	  ¶	  &  import/plugins/class-import-aioseo.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from All in One SEO Pack.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class with functionality to import & clean All in One SEO Pack post metadata.
 */
class WPSEO_Import_AIOSEO extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'All In One SEO Pack';

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = '_aioseop_%';

	/**
	 * OpenGraph keys to import.
	 *
	 * @var array
	 */
	protected $import_keys = array(
		'aioseop_opengraph_settings_title'             => 'opengraph-title',
		'aioseop_opengraph_settings_desc'              => 'opengraph-description',
		'aioseop_opengraph_settings_customimg'         => 'opengraph-image',
		'aioseop_opengraph_settings_customimg_twitter' => 'twitter-image',
	);

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => '_aioseop_title',
			'new_key' => 'title',
		),
		array(
			'old_key' => '_aioseop_description',
			'new_key' => 'metadesc',
		),
		array(
			'old_key' => '_aioseop_noindex',
			'new_key' => 'meta-robots-noindex',
			'convert' => array( 'on' => 1 ),
		),
		array(
			'old_key' => '_aioseop_nofollow',
			'new_key' => 'meta-robots-nofollow',
			'convert' => array( 'on' => 1 ),
		),
	);

	/**
	 * Import All In One SEO meta values.
	 *
	 * @return bool Import success status.
	 */
	protected function import() {
		$status = parent::import();
		if ( $status ) {
			$this->import_opengraph();
		}
		return $status;
	}

	/**
	 * Imports the OpenGraph and Twitter settings for all posts.
	 *
	 * @return bool
	 */
	protected function import_opengraph() {
		$query_posts = new WP_Query( 'post_type=any&meta_key=_aioseop_opengraph_settings&order=ASC&fields=ids&nopaging=true' );

		if ( ! empty( $query_posts->posts ) ) {
			foreach ( array_values( $query_posts->posts ) as $post_id ) {
				$this->import_post_opengraph( $post_id );
			}
		}

		return true;
	}

	/**
	 * Imports the OpenGraph and Twitter settings for a single post.
	 *
	 * @param int $post_id Post ID.
	 */
	private function import_post_opengraph( $post_id ) {
		$meta = get_post_meta( $post_id, '_aioseop_opengraph_settings', true );
		$meta = maybe_unserialize( $meta );

		foreach ( $this->import_keys as $old_key => $new_key ) {
			$this->maybe_save_post_meta( $new_key, $meta[ $old_key ], $post_id );
		}
	}
}
PK     ”T]nÌ5
  
  -  import/plugins/class-import-woothemes-seo.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from WooThemes SEO.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class WPSEO_Import_WooThemes_SEO
 *
 * Class with functionality to import & clean WooThemes SEO post metadata.
 */
class WPSEO_Import_WooThemes_SEO extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'WooThemes SEO';

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = 'seo_title';

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => 'seo_description',
			'new_key' => 'metadesc',
		),
		array(
			'old_key' => 'seo_title',
			'new_key' => 'title',
		),
		array(
			'old_key' => 'seo_noindex',
			'new_key' => 'meta-robots-noindex',
		),
		array(
			'old_key' => 'seo_follow',
			'new_key' => 'meta-robots-nofollow',
		),
	);

	/**
	 * Holds the meta fields we can delete after import.
	 *
	 * @var array
	 */
	protected $cleanup_metas = array(
		'seo_follow',
		'seo_noindex',
		'seo_title',
		'seo_description',
		'seo_keywords',
	);

	/**
	 * Holds the options we can delete after import.
	 *
	 * @var array
	 */
	protected $cleanup_options = array(
		'seo_woo_archive_layout',
		'seo_woo_single_layout',
		'seo_woo_page_layout',
		'seo_woo_wp_title',
		'seo_woo_meta_single_desc',
		'seo_woo_meta_single_key',
		'seo_woo_home_layout',
	);

	/**
	 * Cleans up the WooThemes SEO settings.
	 *
	 * @return bool Cleanup status.
	 */
	protected function cleanup() {
		$result = $this->cleanup_meta();
		if ( $result ) {
			$this->cleanup_options();
		}
		return $result;
	}

	/**
	 * Removes the Woo Options from the database.
	 *
	 * @return void
	 */
	private function cleanup_options() {
		foreach ( $this->cleanup_options as $option ) {
			delete_option( $option );
		}
	}

	/**
	 * Removes the post meta fields from the database.
	 *
	 * @return bool Cleanup status.
	 */
	private function cleanup_meta() {
		foreach ( $this->cleanup_metas as $key ) {
			$result = $this->cleanup_meta_key( $key );
			if ( ! $result ) {
				return false;
			}
		}
		return true;
	}

	/**
	 * Removes a single meta field from the postmeta table in the database.
	 *
	 * @param string $key The meta_key to delete.
	 *
	 * @return bool Cleanup status.
	 */
	private function cleanup_meta_key( $key ) {
		global $wpdb;

		$wpdb->query(
			$wpdb->prepare(
				"DELETE FROM {$wpdb->postmeta} WHERE meta_key = %s",
				$key
			)
		);
		return $wpdb->__get( 'result' );
	}
}
PK     ”T]UžŠ k  k  1  import/plugins/class-import-platinum-seo-pack.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from Platinum SEO Pack.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class with functionality to import & clean Ultimate SEO post metadata.
 */
class WPSEO_Import_Platinum_SEO extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'Platinum SEO Pack';

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = 'title';

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => 'description',
			'new_key' => 'metadesc',
		),
		array(
			'old_key' => 'title',
			'new_key' => 'title',
		),
	);

	/**
	 * Runs the import of post meta keys stored by Platinum SEO Pack.
	 *
	 * @return bool
	 */
	protected function import() {
		$return = parent::import();
		if ( $return ) {
			$this->import_robots_meta();
		}

		return $return;
	}

	/**
	 * Cleans up all the meta values Platinum SEO pack creates.
	 *
	 * @return bool
	 */
	protected function cleanup() {
		$this->meta_key = 'title';
		parent::cleanup();

		$this->meta_key = 'description';
		parent::cleanup();

		$this->meta_key = 'metarobots';
		parent::cleanup();

		return true;
	}

	/**
	 * Finds all the robotsmeta fields to import and deals with them.
	 *
	 * There are four potential values that Platinum SEO stores:
	 * - index,folllow
	 * - index,nofollow
	 * - noindex,follow
	 * - noindex,nofollow
	 *
	 * We only have to deal with the latter 3, the first is our default.
	 *
	 * @return void
	 */
	protected function import_robots_meta() {
		$this->import_by_meta_robots( 'index,nofollow', array( 'nofollow' ) );
		$this->import_by_meta_robots( 'noindex,follow', array( 'noindex' ) );
		$this->import_by_meta_robots( 'noindex,nofollow', array( 'noindex', 'nofollow' ) );
	}

	/**
	 * Imports the values for all index, nofollow posts.
	 *
	 * @param string $value The meta robots value to find posts for.
	 * @param array  $metas The meta field(s) to save.
	 *
	 * @return void
	 */
	protected function import_by_meta_robots( $value, $metas ) {
		$posts = $this->find_posts_by_robots_meta( $value );
		if ( ! $posts ) {
			return;
		}

		foreach ( $posts as $post_id ) {
			foreach ( $metas as $meta ) {
				$this->maybe_save_post_meta( 'meta-robots-' . $meta, 1, $post_id );
			}
		}
	}

	/**
	 * Finds posts by a given meta robots value.
	 *
	 * @param string $meta_value Robots meta value.
	 *
	 * @return array|bool Array of Post IDs on success, false on failure.
	 */
	protected function find_posts_by_robots_meta( $meta_value ) {
		$posts = get_posts(
			array(
				'post_type'  => 'any',
				'meta_key'   => 'robotsmeta',
				'meta_value' => $meta_value,
				'order'      => 'ASC',
				'fields'     => 'ids',
				'nopaging'   => true,
			)
		);
		if ( empty( $posts ) ) {
			return false;
		}
		return $posts;
	}
}
PK     ”T]}ÍmV  V  *  import/plugins/class-import-seopressor.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from SEOPressor.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class WPSEO_Import_SEOPressor.
 *
 * Class with functionality to import & clean SEOPressor post metadata.
 */
class WPSEO_Import_SEOPressor extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'SEOpressor';

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = '_seop_settings';

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => '_seop_settings',
		),
	);

	/**
	 * Imports the post meta values to Yoast SEO.
	 *
	 * @return bool Import success status.
	 */
	protected function import() {
		// Query for all the posts that have an _seop_settings meta set.
		$query_posts = new WP_Query( 'post_type=any&meta_key=_seop_settings&order=ASC&fields=ids&nopaging=true' );
		foreach ( $query_posts->posts as $key => $post_id ) {
			$this->import_post_focus_keywords( $post_id );
			$this->import_seopressor_post_settings( $post_id );
		}

		return true;
	}

	/**
	 * Removes all the post meta fields SEOpressor creates.
	 *
	 * @return bool Cleanup status.
	 */
	protected function cleanup() {
		global $wpdb;

		// If we get to replace the data, let's do some proper cleanup.
		return $wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '_seop_%'" );
	}

	/**
	 * Imports the data. SEOpressor stores most of the data in one post array, this loops over it.
	 *
	 * @param int $post_id Post ID.
	 *
	 * @return void
	 */
	private function import_seopressor_post_settings( $post_id ) {
		$settings = get_post_meta( $post_id, '_seop_settings', true );

		foreach (
			array(
				'fb_description'   => 'opengraph-description',
				'fb_title'         => 'opengraph-title',
				'fb_type'          => 'og_type',
				'fb_img'           => 'opengraph-image',
				'meta_title'       => 'title',
				'meta_description' => 'metadesc',
				'meta_canonical'   => 'canonical',
				'tw_description'   => 'twitter-description',
				'tw_title'         => 'twitter-title',
				'tw_image'         => 'twitter-image',
			) as $seopressor_key => $yoast_key ) {
			$this->import_meta_helper( $seopressor_key, $yoast_key, $settings, $post_id );
		}

		if ( isset( $settings['meta_rules'] ) ) {
			$this->import_post_robots( $settings['meta_rules'], $post_id );
		}
	}

	/**
	 * Imports the focus keywords, and stores them for later use.
	 *
	 * @param integer $post_id Post ID.
	 *
	 * @return void
	 */
	private function import_post_focus_keywords( $post_id ) {
		// Import the focus keyword.
		$focuskw = trim( get_post_meta( $post_id, '_seop_kw_1', true ) );
		$this->maybe_save_post_meta( 'focuskw', $focuskw, $post_id );

		// Import additional focus keywords for use in premium.
		$focuskw2 = trim( get_post_meta( $post_id, '_seop_kw_2', true ) );
		$focuskw3 = trim( get_post_meta( $post_id, '_seop_kw_3', true ) );

		$focus_keywords = array();
		if ( ! empty( $focuskw2 ) ) {
			$focus_keywords[] = $focuskw2;
		}
		if ( ! empty( $focuskw3 ) ) {
			$focus_keywords[] = $focuskw3;
		}

		if ( $focus_keywords !== array() ) {
			$this->maybe_save_post_meta( 'focuskeywords', WPSEO_Utils::format_json_encode( $focus_keywords ), $post_id );
		}
	}

	/**
	 * Retrieves the SEOpressor robot value and map this to Yoast SEO values.
	 *
	 * @param string  $meta_rules The meta rules taken from the SEOpressor settings array.
	 * @param integer $post_id    The post id of the current post.
	 *
	 * @return void
	 */
	private function import_post_robots( $meta_rules, $post_id ) {
		$seopressor_robots = explode( '#|#|#', $meta_rules );
		$robot_value       = $this->get_robot_value( $seopressor_robots );

		// Saving the new meta values for Yoast SEO.
		$this->maybe_save_post_meta( 'meta-robots-noindex', $robot_value['index'], $post_id );
		$this->maybe_save_post_meta( 'meta-robots-nofollow', $robot_value['follow'], $post_id );
		$this->maybe_save_post_meta( 'meta-robots-adv', $robot_value['advanced'], $post_id );
	}

	/**
	 * Gets the robot config by given SEOpressor robots value.
	 *
	 * @param array $seopressor_robots The value in SEOpressor that needs to be converted to the Yoast format.
	 *
	 * @return array The robots values in Yoast format.
	 */
	private function get_robot_value( $seopressor_robots ) {
		$return = array(
			'index'    => 2,
			'follow'   => 0,
			'advanced' => '',
		);

		if ( in_array( 'noindex', $seopressor_robots, true ) ) {
			$return['index'] = 1;
		}
		if ( in_array( 'nofollow', $seopressor_robots, true ) ) {
			$return['follow'] = 1;
		}
		foreach ( array( 'noarchive', 'nosnippet', 'noimageindex' ) as $needle ) {
			if ( in_array( $needle, $seopressor_robots, true ) ) {
				$return['advanced'] .= $needle . ',';
			}
		}
		$return['advanced'] = rtrim( $return['advanced'], ',' );

		return $return;
	}
}
PK     ”T]ùóÐ    %  import/plugins/class-import-wpseo.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from wpSEO.de.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class WPSEO_Import_WPSEO.
 *
 * Class with functionality to import & clean wpSEO.de post metadata.
 */
class WPSEO_Import_WPSEO extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'wpSEO.de';

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = '_wpseo_edit_%';

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => '_wpseo_edit_description',
			'new_key' => 'metadesc',
		),
		array(
			'old_key' => '_wpseo_edit_title',
			'new_key' => 'title',
		),
		array(
			'old_key' => '_wpseo_edit_canonical',
			'new_key' => 'canonical',
		),
		array(
			'old_key' => '_wpseo_edit_og_title',
			'new_key' => 'opengraph-title',
		),
		array(
			'old_key' => '_wpseo_edit_og_description',
			'new_key' => 'opengraph-description',
		),
		array(
			'old_key' => '_wpseo_edit_og_image',
			'new_key' => 'opengraph-image',
		),
		array(
			'old_key' => '_wpseo_edit_twittercard_title',
			'new_key' => 'twitter-title',
		),
		array(
			'old_key' => '_wpseo_edit_twittercard_description',
			'new_key' => 'twitter-description',
		),
		array(
			'old_key' => '_wpseo_edit_twittercard_image',
			'new_key' => 'twitter-image',
		),
	);

	/**
	 * The values 1 - 6 are the configured values from wpSEO. This array will map the values of wpSEO to our values.
	 *
	 * There are some double array like 1-6 and 3-4. The reason is they only set the index value. The follow value is
	 * the default we use in the cases there isn't a follow value present.
	 *
	 * @var array
	 */
	private $robot_values = array(
		// In wpSEO: index, follow.
		1 => array(
			'index'  => 2,
			'follow' => 0,
		),
		// In wpSEO: index, nofollow.
		2 => array(
			'index'  => 2,
			'follow' => 1,
		),
		// In wpSEO: noindex.
		3 => array(
			'index'  => 1,
			'follow' => 0,
		),
		// In wpSEO: noindex, follow.
		4 => array(
			'index'  => 1,
			'follow' => 0,
		),
		// In wpSEO: noindex, nofollow.
		5 => array(
			'index'  => 1,
			'follow' => 1,
		),
		// In wpSEO: index.
		6 => array(
			'index'  => 2,
			'follow' => 0,
		),
	);

	/**
	 * Imports wpSEO settings.
	 *
	 * @return bool Import success status.
	 */
	protected function import() {
		$status = parent::import();
		if ( $status ) {
			$this->import_post_robots();
			$this->import_taxonomy_metas();
		}

		return $status;
	}

	/**
	 * Removes wpseo.de post meta's.
	 *
	 * @return bool Cleanup status.
	 */
	protected function cleanup() {
		$this->cleanup_term_meta();
		$result = $this->cleanup_post_meta();
		return $result;
	}

	/**
	 * Detects whether there is post meta data to import.
	 *
	 * @return bool Boolean indicating whether there is something to import.
	 */
	protected function detect() {
		if ( parent::detect() ) {
			return true;
		}

		global $wpdb;
		$count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->options} WHERE option_name LIKE 'wpseo_category_%'" );
		if ( $count !== '0' ) {
			return true;
		}

		return false;
	}

	/**
	 * Imports the robot values from WPSEO plugin. These have to be converted to the Yoast format.
	 *
	 * @return void
	 */
	private function import_post_robots() {
		$query_posts = new WP_Query( 'post_type=any&meta_key=_wpseo_edit_robots&order=ASC&fields=ids&nopaging=true' );

		if ( ! empty( $query_posts->posts ) ) {
			foreach ( array_values( $query_posts->posts ) as $post_id ) {
				$this->import_post_robot( $post_id );
			}
		}
	}

	/**
	 * Gets the wpSEO robot value and map this to Yoast SEO values.
	 *
	 * @param integer $post_id The post id of the current post.
	 *
	 * @return void
	 */
	private function import_post_robot( $post_id ) {
		$wpseo_robots = get_post_meta( $post_id, '_wpseo_edit_robots', true );
		$robot_value  = $this->get_robot_value( $wpseo_robots );

		// Saving the new meta values for Yoast SEO.
		$this->maybe_save_post_meta( 'meta-robots-noindex', $robot_value['index'], $post_id );
		$this->maybe_save_post_meta( 'meta-robots-nofollow', $robot_value['follow'], $post_id );
	}

	/**
	 * Imports the taxonomy metas from wpSEO.
	 *
	 * @return void
	 */
	private function import_taxonomy_metas() {
		$terms    = get_terms( get_taxonomies(), array( 'hide_empty' => false ) );
		$tax_meta = get_option( 'wpseo_taxonomy_meta' );

		foreach ( $terms as $term ) {
			$this->import_taxonomy_description( $tax_meta, $term->taxonomy, $term->term_id );
			$this->import_taxonomy_robots( $tax_meta, $term->taxonomy, $term->term_id );
		}

		update_option( 'wpseo_taxonomy_meta', $tax_meta );
	}

	/**
	 * Imports the meta description to Yoast SEO.
	 *
	 * @param array  $tax_meta The array with the current metadata.
	 * @param string $taxonomy String with the name of the taxonomy.
	 * @param string $term_id  The ID of the current term.
	 *
	 * @return void
	 */
	private function import_taxonomy_description( & $tax_meta, $taxonomy, $term_id ) {
		$description = get_option( 'wpseo_' . $taxonomy . '_' . $term_id, false );
		if ( $description !== false ) {
			// Import description.
			$tax_meta[ $taxonomy ][ $term_id ]['wpseo_desc'] = $description;
		}
	}

	/**
	 * Imports the robot value to Yoast SEO.
	 *
	 * @param array  $tax_meta The array with the current metadata.
	 * @param string $taxonomy String with the name of the taxonomy.
	 * @param string $term_id  The ID of the current term.
	 *
	 * @return void
	 */
	private function import_taxonomy_robots( & $tax_meta, $taxonomy, $term_id ) {
		$wpseo_robots = get_option( 'wpseo_' . $taxonomy . '_' . $term_id . '_robots', false );
		if ( $wpseo_robots === false ) {
			return;
		}
		// The value 1, 2 and 6 are the index values in wpSEO.
		$new_robot_value = 'noindex';

		if ( in_array( (int) $wpseo_robots, array( 1, 2, 6 ), true ) ) {
			$new_robot_value = 'index';
		}

		$tax_meta[ $taxonomy ][ $term_id ]['wpseo_noindex'] = $new_robot_value;
	}

	/**
	 * Deletes the wpSEO taxonomy meta data.
	 *
	 * @param string $taxonomy String with the name of the taxonomy.
	 * @param string $term_id  The ID of the current term.
	 *
	 * @return void
	 */
	private function delete_taxonomy_metas( $taxonomy, $term_id ) {
		delete_option( 'wpseo_' . $taxonomy . '_' . $term_id );
		delete_option( 'wpseo_' . $taxonomy . '_' . $term_id . '_robots' );
	}

	/**
	 * Gets the robot config by given wpSEO robots value.
	 *
	 * @param string $wpseo_robots The value in wpSEO that needs to be converted to the Yoast format.
	 *
	 * @return string The correct robot value.
	 */
	private function get_robot_value( $wpseo_robots ) {
		if ( array_key_exists( $wpseo_robots, $this->robot_values ) ) {
			return $this->robot_values[ $wpseo_robots ];
		}

		return $this->robot_values[1];
	}

	/**
	 * Deletes wpSEO postmeta from the database.
	 *
	 * @return bool Cleanup status.
	 */
	private function cleanup_post_meta() {
		global $wpdb;

		// If we get to replace the data, let's do some proper cleanup.
		return $wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '_wpseo_edit_%'" );
	}

	/**
	 * Cleans up the wpSEO term meta.
	 *
	 * @return void
	 */
	private function cleanup_term_meta() {
		$terms = get_terms( get_taxonomies(), array( 'hide_empty' => false ) );
		foreach ( $terms as $term ) {
			$this->delete_taxonomy_metas( $term->taxonomy, $term->term_id );
		}
	}
}
PK     ”T]žÙhÑ    )  import/plugins/class-import-headspace.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from HeadSpace.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class WPSEO_Import_HeadSpace.
 *
 * Class with functionality to import & clean HeadSpace SEO post metadata.
 */
class WPSEO_Import_HeadSpace extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'HeadSpace SEO';

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = '_headspace_%';

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => '_headspace_description',
			'new_key' => 'metadesc',
		),
		array(
			'old_key' => '_headspace_page_title',
			'new_key' => 'title',
		),
		array(
			'old_key' => '_headspace_noindex',
			'new_key' => 'meta-robots-noindex',
			'convert' => array( 'on' => 1 ),
		),
		array(
			'old_key' => '_headspace_nofollow',
			'new_key' => 'meta-robots-nofollow',
			'convert' => array( 'on' => 1 ),
		),
	);
}
PK     ”T]™R””o  o  +  import/plugins/class-import-wp-meta-seo.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from WP Meta SEO.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class with functionality to import & clean WP Meta SEO post metadata.
 */
class WPSEO_Import_WP_Meta_SEO extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'WP Meta SEO';

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = '_metaseo_%';

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => '_metaseo_metadesc',
			'new_key' => 'metadesc',
		),
		array(
			'old_key' => '_metaseo_metatitle',
			'new_key' => 'title',
		),
		array(
			'old_key' => '_metaseo_metaopengraph-title',
			'new_key' => 'opengraph-title',
		),
		array(
			'old_key' => '_metaseo_metaopengraph-desc',
			'new_key' => 'opengraph-description',
		),
		array(
			'old_key' => '_metaseo_metaopengraph-image',
			'new_key' => 'opengraph-image',
		),
		array(
			'old_key' => '_metaseo_metatwitter-title',
			'new_key' => 'twitter-title',
		),
		array(
			'old_key' => '_metaseo_metatwitter-desc',
			'new_key' => 'twitter-description',
		),
		array(
			'old_key' => '_metaseo_metatwitter-image',
			'new_key' => 'twitter-image',
		),
		array(
			'old_key' => '_metaseo_metaindex',
			'new_key' => 'meta-robots-noindex',
			'convert' => array(
				'index'   => 0,
				'noindex' => 1,
			),
		),
		array(
			'old_key' => '_metaseo_metafollow',
			'new_key' => 'meta-robots-nofollow',
			'convert' => array(
				'follow'   => 0,
				'nofollow' => 1,
			),
		),
	);
}
PK     ”T]{H¸j  j  "  import/plugins/class-importers.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class WPSEO_Plugin_Importers.
 *
 * Object which contains all importers.
 */
class WPSEO_Plugin_Importers {

	/**
	 * List of supported importers.
	 *
	 * @var array
	 */
	private static $importers = array(
		'WPSEO_Import_AIOSEO',
		'WPSEO_Import_Greg_SEO',
		'WPSEO_Import_HeadSpace',
		'WPSEO_Import_Jetpack_SEO',
		'WPSEO_Import_WP_Meta_SEO',
		'WPSEO_Import_Platinum_SEO',
		'WPSEO_Import_Premium_SEO_Pack',
		'WPSEO_Import_SEOPressor',
		'WPSEO_Import_SEO_Framework',
		'WPSEO_Import_Smartcrawl_SEO',
		'WPSEO_Import_Squirrly',
		'WPSEO_Import_Ultimate_SEO',
		'WPSEO_Import_WooThemes_SEO',
		'WPSEO_Import_WPSEO',
	);

	/**
	 * Returns an array of importers available.
	 *
	 * @return array Available importers.
	 */
	public static function get() {
		return self::$importers;
	}
}
PK     ”T]�SÊ‰í   í     import/plugins/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]
ÀŸ-  -  0  import/plugins/class-import-premium-seo-pack.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from Premium SEO Pack.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class with functionality to import & clean Premium SEO Pack post metadata.
 */
class WPSEO_Import_Premium_SEO_Pack extends WPSEO_Import_Squirrly {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'Premium SEO Pack';

	/**
	 * WPSEO_Import_Premium_SEO_Pack constructor.
	 */
	public function __construct() {
		parent::__construct();

		global $wpdb;
		$this->table_name = $wpdb->prefix . 'psp';
		$this->meta_key   = '';
	}

	/**
	 * Returns the query to return an identifier for the posts to import.
	 *
	 * @return string
	 */
	protected function retrieve_posts_query() {
		return "SELECT URL AS identifier FROM {$this->table_name} WHERE blog_id = %d";
	}
}
PK     ”T]ÅˆÂç  ç  '  import/plugins/class-import-jetpack.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from Jetpack's Advanced SEO settings.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class WPSEO_Import_Jetpack_SEO.
 *
 * Class with functionality to import & clean Jetpack SEO post metadata.
 */
class WPSEO_Import_Jetpack_SEO extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'Jetpack';

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = 'advanced_seo_description';

	/**
	 *  Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => 'advanced_seo_description',
			'new_key' => 'metadesc',
		),
	);

}
PK     ”T]ßäÉ    (  import/plugins/class-import-squirrly.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from Squirrly.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class with functionality to import & clean Squirrly post metadata.
 */
class WPSEO_Import_Squirrly extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'Squirrly SEO';

	/**
	 * Holds the name of the table Squirrly uses to store data.
	 *
	 * @var string
	 */
	protected $table_name;

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = '_sq_post_keyword';

	/**
	 * Data to import from (and the target to field) the serialized array stored in the SEO field in the Squirrly table.
	 *
	 * @var array
	 */
	protected $seo_field_keys = array(
		'noindex'        => 'meta-robots-noindex',
		'nofollow'       => 'meta-robots-nofollow',
		'title'          => 'title',
		'description'    => 'metadesc',
		'canonical'      => 'canonical',
		'cornerstone'    => '_yst_is_cornerstone',
		'tw_media'       => 'twitter-image',
		'tw_title'       => 'twitter-title',
		'tw_description' => 'twitter-description',
		'og_title'       => 'opengraph-title',
		'og_description' => 'opengraph-description',
		'og_media'       => 'opengraph-image',
		'focuskw'        => 'focuskw',
	);

	/**
	 * WPSEO_Import_Squirrly constructor.
	 */
	public function __construct() {
		parent::__construct();

		global $wpdb;
		$this->table_name = $wpdb->prefix . 'qss';
	}

	/**
	 * Imports the post meta values to Yoast SEO.
	 *
	 * @return bool Import success status.
	 */
	protected function import() {
		$results = $this->retrieve_posts();
		foreach ( $results as $post ) {
			$return = $this->import_post_values( $post->identifier );
			if ( ! $return ) {
				return false;
			}
		}

		return true;
	}

	/**
	 * Retrieve the posts from the Squirrly Database.
	 *
	 * @return array Array of post IDs from the DB.
	 */
	protected function retrieve_posts() {
		global $wpdb;
		return $wpdb->get_results(
			$wpdb->prepare(
				$this->retrieve_posts_query(),
				get_current_blog_id()
			)
		);
	}

	/**
	 * Returns the query to return an identifier for the posts to import.
	 *
	 * @return string Query to get post ID's from the DB.
	 */
	protected function retrieve_posts_query() {
		return "SELECT post_id AS identifier FROM {$this->table_name} WHERE blog_id = %d";
	}

	/**
	 * Removes the DB table and the post meta field Squirrly creates.
	 *
	 * @return bool Cleanup status.
	 */
	protected function cleanup() {
		global $wpdb;

		// If we can clean, let's clean.
		$wpdb->query( "DROP TABLE {$this->table_name}" );

		// This removes the post meta field for the focus keyword from the DB.
		parent::cleanup();

		// If we can still see the table, something went wrong.
		if ( $this->detect() ) {
			$this->cleanup_error_msg();
			return false;
		}

		return true;
	}

	/**
	 * Detects whether there is post meta data to import.
	 *
	 * @return bool Boolean indicating whether there is something to import.
	 */
	protected function detect() {
		global $wpdb;

		$result = $wpdb->get_var( "SHOW TABLES LIKE '{$this->table_name}'" );
		if ( is_wp_error( $result ) || is_null( $result ) ) {
			return false;
		}

		return true;
	}

	/**
	 * Imports the data of a post out of Squirrly's DB table.
	 *
	 * @param mixed $post_identifier Post identifier, can be ID or string.
	 *
	 * @return bool Import status.
	 */
	private function import_post_values( $post_identifier ) {
		$data = $this->retrieve_post_data( $post_identifier );
		if ( ! $data ) {
			return false;
		}

		if ( ! is_numeric( $post_identifier ) ) {
			$post_id = url_to_postid( $post_identifier );
		}

		if ( is_numeric( $post_identifier ) ) {
			$post_id         = (int) $post_identifier;
			$data['focuskw'] = $this->maybe_add_focus_kw( $post_identifier );
		}

		foreach ( $this->seo_field_keys as $squirrly_key => $yoast_key ) {
			$this->import_meta_helper( $squirrly_key, $yoast_key, $data, $post_id );
		}
		return true;
	}

	/**
	 * Retrieves the Squirrly SEO data for a post from the DB.
	 *
	 * @param int $post_identifier Post ID.
	 *
	 * @return array|bool Array of data or false.
	 */
	private function retrieve_post_data( $post_identifier ) {
		global $wpdb;

		if ( is_numeric( $post_identifier ) ) {
			$post_identifier = (int) $post_identifier;
			$query_where     = 'post_id = %d';
		}
		if ( ! is_numeric( $post_identifier ) ) {
			$query_where = 'URL = %s';
		}
		$data = $wpdb->get_var(
			$wpdb->prepare(
				"SELECT seo FROM {$this->table_name} WHERE blog_id = %d AND " . $query_where,
				get_current_blog_id(),
				$post_identifier
			)
		);
		if ( ! $data || is_wp_error( $data ) ) {
			return false;
		}
		$data = maybe_unserialize( $data );
		return $data;
	}

	/**
	 * Squirrly stores the focus keyword in post meta.
	 *
	 * @param int $post_id Post ID.
	 *
	 * @return string The focus keyword.
	 */
	private function maybe_add_focus_kw( $post_id ) {
		$focuskw = get_post_meta( $post_id, '_sq_post_keyword', true );
		if ( $focuskw ) {
			$focuskw = json_decode( $focuskw );
			return $focuskw->keyword;
		}
		return '';
	}
}
PK     ”T]põÝcå  å  ,  import/plugins/class-import-ultimate-seo.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from Ultimate SEO.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class with functionality to import & clean Ultimate SEO post metadata.
 */
class WPSEO_Import_Ultimate_SEO extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'Ultimate SEO';

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = '_su_%';

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => '_su_description',
			'new_key' => 'metadesc',
		),
		array(
			'old_key' => '_su_title',
			'new_key' => 'title',
		),
		array(
			'old_key' => '_su_og_title',
			'new_key' => 'opengraph-title',
		),
		array(
			'old_key' => '_su_og_description',
			'new_key' => 'opengraph-description',
		),
		array(
			'old_key' => '_su_og_image',
			'new_key' => 'opengraph-image',
		),
		array(
			'old_key' => '_su_meta_robots_noindex',
			'new_key' => 'meta-robots-noindex',
			'convert' => array( 'on' => 1 ),
		),
		array(
			'old_key' => '_su_meta_robots_nofollow',
			'new_key' => 'meta-robots-nofollow',
			'convert' => array( 'on' => 1 ),
		),
	);

}
PK     ”T]Thñ<	  	  9  import/plugins/class-import-greg-high-performance-seo.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from Ultimate SEO.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class with functionality to import & clean Ultimate SEO post metadata.
 */
class WPSEO_Import_Greg_SEO extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = "Greg's High Performance SEO";

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = '_ghpseo_%';

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => '_ghpseo_alternative_description',
			'new_key' => 'metadesc',
		),
		array(
			'old_key' => '_ghpseo_secondary_title',
			'new_key' => 'title',
		),
	);

}
PK     ”T]A¶ÏÅÃ  Ã  *  import/plugins/class-import-smartcrawl.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from Smartcrawl SEO.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class with functionality to import & clean Smartcrawl SEO post metadata.
 */
class WPSEO_Import_Smartcrawl_SEO extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'Smartcrawl SEO';

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = '_wds_%';

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => '_wds_metadesc',
			'new_key' => 'metadesc',
		),
		array(
			'old_key' => '_wds_title',
			'new_key' => 'title',
		),
		array(
			'old_key' => '_wds_canonical',
			'new_key' => 'canonical',
		),
		array(
			'old_key' => '_wds_focus-keywords',
			'new_key' => 'focuskw',
		),
		array(
			'old_key' => '_wds_meta-robots-noindex',
			'new_key' => 'meta-robots-noindex',
		),
		array(
			'old_key' => '_wds_meta-robots-nofollow',
			'new_key' => 'meta-robots-nofollow',
		),
	);

	/**
	 * Used for importing Twitter and Facebook meta's.
	 *
	 * @var array
	 */
	protected $social_keys = array();

	/**
	 * Handles post meta data to import.
	 *
	 * @return bool Import success status.
	 */
	protected function import() {
		$return = parent::import();
		if ( $return ) {
			$this->import_opengraph();
			$this->import_twitter();
		}

		return $return;
	}

	/**
	 * Imports the OpenGraph meta keys saved by Smartcrawl.
	 *
	 * @return bool Import status.
	 */
	protected function import_opengraph() {
		$this->social_keys = array(
			'title'       => 'opengraph-title',
			'description' => 'opengraph-description',
			'images'      => 'opengraph-image',
		);
		return $this->post_find_import( '_wds_opengraph' );
	}

	/**
	 * Imports the Twitter meta keys saved by Smartcrawl.
	 *
	 * @return bool Import status.
	 */
	protected function import_twitter() {
		$this->social_keys = array(
			'title'       => 'twitter-title',
			'description' => 'twitter-description',
		);
		return $this->post_find_import( '_wds_twitter' );
	}

	/**
	 * Imports a post's serialized post meta values.
	 *
	 * @param int    $post_id Post ID.
	 * @param string $key     The meta key to import.
	 *
	 * @return void
	 */
	protected function import_serialized_post_meta( $post_id, $key ) {
		$data = get_post_meta( $post_id, $key, true );
		$data = maybe_unserialize( $data );
		foreach ( $this->social_keys as $key => $meta_key ) {
			if ( ! isset( $data[ $key ] ) ) {
				return;
			}
			$value = $data[ $key ];
			if ( is_array( $value ) ) {
				$value = $value[0];
			}
			$this->maybe_save_post_meta( $meta_key, $value, $post_id );
		}
	}

	/**
	 * Finds all the posts with a certain meta key and imports its values.
	 *
	 * @param string $key The meta key to search for.
	 *
	 * @return bool Import status.
	 */
	protected function post_find_import( $key ) {
		$query_posts = new WP_Query( 'post_type=any&meta_key=' . $key . '&order=ASC&fields=ids&nopaging=true' );

		if ( empty( $query_posts->posts ) ) {
			return false;
		}

		foreach ( array_values( $query_posts->posts ) as $post_id ) {
			$this->import_serialized_post_meta( $post_id, $key );
		}

		return true;
	}
}
PK     ”T]Nåcûg  g  -  import/plugins/class-import-seo-framework.phpnu „[µü¤        <?php
/**
 * File with the class to handle data from SEO Framework.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class with functionality to import & clean SEO Framework post metadata.
 */
class WPSEO_Import_SEO_Framework extends WPSEO_Plugin_Importer {

	/**
	 * The plugin name.
	 *
	 * @var string
	 */
	protected $plugin_name = 'SEO Framework';

	/**
	 * Meta key, used in SQL LIKE clause for delete query.
	 *
	 * @var string
	 */
	protected $meta_key = '_genesis_%';

	/**
	 * Array of meta keys to detect and import.
	 *
	 * @var array
	 */
	protected $clone_keys = array(
		array(
			'old_key' => '_genesis_description',
			'new_key' => 'metadesc',
		),
		array(
			'old_key' => '_genesis_title',
			'new_key' => 'title',
		),
		array(
			'old_key' => '_genesis_noindex',
			'new_key' => 'meta-robots-noindex',
		),
		array(
			'old_key' => '_genesis_nofollow',
			'new_key' => 'meta-robots-nofollow',
		),
		array(
			'old_key' => '_genesis_canonical_uri',
			'new_key' => 'canonical',
		),
		array(
			'old_key' => '_open_graph_title',
			'new_key' => 'opengraph-title',
		),
		array(
			'old_key' => '_open_graph_description',
			'new_key' => 'opengraph-description',
		),
		array(
			'old_key' => '_social_image_url',
			'new_key' => 'opengraph-image',
		),
		array(
			'old_key' => '_twitter_title',
			'new_key' => 'twitter-title',
		),
		array(
			'old_key' => '_twitter_description',
			'new_key' => 'twitter-description',
		),
	);

	/**
	 * Removes all the metadata set by the SEO Framework plugin.
	 *
	 * @return bool
	 */
	protected function cleanup() {
		$set1 = parent::cleanup();

		$this->meta_key = '_social_image_%';
		$set2           = parent::cleanup();

		$this->meta_key = '_twitter_%';
		$set3           = parent::cleanup();

		$this->meta_key = '_open_graph_%';
		$set4           = parent::cleanup();

		return ( $set1 || $set2 || $set3 || $set4 );
	}
}
PK     ”T]g|¨wÝ  Ý     import/class-import-detector.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Import\Plugins
 */

/**
 * Class WPSEO_Import_Plugins_Detector.
 *
 * Class with functionality to detect whether we should import from another SEO plugin.
 */
class WPSEO_Import_Plugins_Detector {

	/**
	 * Plugins we need to import from.
	 *
	 * @var array
	 */
	public $needs_import = array();

	/**
	 * Detects whether we need to import anything.
	 */
	public function detect() {
		foreach ( WPSEO_Plugin_Importers::get() as $importer_class ) {
			$importer = new $importer_class();
			$detect   = new WPSEO_Import_Plugin( $importer, 'detect' );
			if ( $detect->status->status ) {
				$this->needs_import[ $importer_class ] = $importer->get_plugin_name();
			}
		}
	}
}
PK     ”T]S‚;ªÊ
  Ê
    import/class-import-status.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Import
 */

/**
 * Class WPSEO_ImportStatus.
 *
 * Holds the status of and message about imports.
 */
class WPSEO_Import_Status {

	/**
	 * The import status.
	 *
	 * @var bool
	 */
	public $status = false;

	/**
	 * The import message.
	 *
	 * @var string
	 */
	private $msg = '';

	/**
	 * The type of action performed.
	 *
	 * @var string
	 */
	private $action;

	/**
	 * WPSEO_Import_Status constructor.
	 *
	 * @param string $action The type of import action.
	 * @param bool   $status The status of the import.
	 * @param string $msg    Extra messages about the status.
	 */
	public function __construct( $action, $status, $msg = '' ) {
		$this->action = $action;
		$this->status = $status;
		$this->msg    = $msg;
	}

	/**
	 * Get the import message.
	 *
	 * @return string Message about current status.
	 */
	public function get_msg() {
		if ( $this->msg !== '' ) {
			return $this->msg;
		}

		if ( $this->status === false ) {
			/* translators: %s is replaced with the name of the plugin we're trying to find data from. */
			return __( '%s data not found.', 'wordpress-seo' );
		}

		return $this->get_default_success_message();
	}

	/**
	 * Get the import action.
	 *
	 * @return string Import action type.
	 */
	public function get_action() {
		return $this->action;
	}

	/**
	 * Set the import action, set status to false.
	 *
	 * @param string $action The type of action to set as import action.
	 *
	 * @return void
	 */
	public function set_action( $action ) {
		$this->action = $action;
		$this->status = false;
	}

	/**
	 * Sets the importer status message.
	 *
	 * @param string $msg The message to set.
	 *
	 * @return void
	 */
	public function set_msg( $msg ) {
		$this->msg = $msg;
	}

	/**
	 * Sets the importer status.
	 *
	 * @param bool $status The status to set.
	 *
	 * @return WPSEO_Import_Status The current object.
	 */
	public function set_status( $status ) {
		$this->status = (bool) $status;

		return $this;
	}

	/**
	 * Returns a success message depending on the action.
	 *
	 * @return string Returns a success message for the current action.
	 */
	private function get_default_success_message() {
		switch ( $this->action ) {
			case 'import':
				/* translators: %s is replaced with the name of the plugin we're importing data from. */
				return __( '%s data successfully imported.', 'wordpress-seo' );
			case 'cleanup':
				/* translators: %s is replaced with the name of the plugin we're removing data from. */
				return __( '%s data successfully removed.', 'wordpress-seo' );
			case 'detect':
			default:
				/* translators: %s is replaced with the name of the plugin we've found data from. */
				return __( '%s data found.', 'wordpress-seo' );
		}
	}
}
PK     ”T]átÕü    )  formatter/interface-metabox-formatter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Formatter
 */

/**
 * Interface to force get_values.
 */
interface WPSEO_Metabox_Formatter_Interface {

	/**
	 * Returns formatter values.
	 *
	 * @return array
	 */
	public function get_values();
}
PK     ”T]ÅŸ�  �  *  formatter/class-post-metabox-formatter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Formatter
 */

/**
 * This class provides data for the post metabox by return its values for localization.
 */
class WPSEO_Post_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface {

	/**
	 * @var WP_Post
	 */
	private $post;

	/**
	 * The permalink to follow.
	 *
	 * @var string
	 */
	private $permalink;

	/**
	 * Constructor.
	 *
	 * @param WP_Post|array $post      Post object.
	 * @param array         $options   Title options to use.
	 * @param string        $structure The permalink to follow.
	 */
	public function __construct( $post, array $options, $structure ) {
		$this->post      = $post;
		$this->permalink = $structure;
	}

	/**
	 * Returns the translated values.
	 *
	 * @return array
	 */
	public function get_values() {
		$values = array(
			'search_url'          => $this->search_url(),
			'post_edit_url'       => $this->edit_url(),
			'base_url'            => $this->base_url_for_js(),
			'metaDescriptionDate' => '',
		);

		if ( $this->post instanceof WP_Post ) {
			$values_to_set = array(
				'keyword_usage'       => $this->get_focus_keyword_usage(),
				'title_template'      => $this->get_title_template(),
				'metadesc_template'   => $this->get_metadesc_template(),
				'metaDescriptionDate' => $this->get_metadesc_date(),
			);

			$values = ( $values_to_set + $values );
		}

		return $values;
	}

	/**
	 * Returns the url to search for keyword for the post.
	 *
	 * @return string
	 */
	private function search_url() {
		return admin_url( 'edit.php?seo_kw_filter={keyword}' );
	}

	/**
	 * Returns the url to edit the taxonomy.
	 *
	 * @return string
	 */
	private function edit_url() {
		return admin_url( 'post.php?post={id}&action=edit' );
	}

	/**
	 * Returns a base URL for use in the JS, takes permalink structure into account.
	 *
	 * @return string
	 */
	private function base_url_for_js() {
		global $pagenow;

		// The default base is the home_url.
		$base_url = home_url( '/', null );

		if ( 'post-new.php' === $pagenow ) {
			return $base_url;
		}

		// If %postname% is the last tag, just strip it and use that as a base.
		if ( 1 === preg_match( '#%postname%/?$#', $this->permalink ) ) {
			$base_url = preg_replace( '#%postname%/?$#', '', $this->permalink );
		}

		return $base_url;
	}

	/**
	 * Counts the number of given keywords used for other posts other than the given post_id.
	 *
	 * @return array The keyword and the associated posts that use it.
	 */
	private function get_focus_keyword_usage() {
		$keyword = WPSEO_Meta::get_value( 'focuskw', $this->post->ID );
		$usage   = array( $keyword => $this->get_keyword_usage_for_current_post( $keyword ) );

		if ( WPSEO_Utils::is_yoast_seo_premium() ) {
			return $this->get_premium_keywords( $usage );
		}

		return $usage;
	}

	/**
	 * Retrieves the additional keywords from Premium, that are associated with the post.
	 *
	 * @param array $usage The original keyword usage for the main keyword.
	 *
	 * @return array The keyword usage, including the additional keywords.
	 */
	protected function get_premium_keywords( $usage ) {
		$additional_keywords = json_decode( WPSEO_Meta::get_value( 'focuskeywords', $this->post->ID ), true );

		if ( empty( $additional_keywords ) ) {
			return $usage;
		}

		foreach ( $additional_keywords as $additional_keyword ) {
			$keyword = $additional_keyword['keyword'];

			$usage[ $keyword ] = $this->get_keyword_usage_for_current_post( $keyword );
		}

		return $usage;
	}

	/**
	 * Gets the keyword usage for the current post and the specified keyword.
	 *
	 * @param string $keyword The keyword to check the usage of.
	 *
	 * @return array The post IDs which use the passed keyword.
	 */
	protected function get_keyword_usage_for_current_post( $keyword ) {
		return WPSEO_Meta::keyword_usage( $keyword, $this->post->ID );
	}

	/**
	 * Retrieves the title template.
	 *
	 * @return string The title template.
	 */
	private function get_title_template() {
		$title = $this->get_template( 'title' );

		if ( $title === '' ) {
			return '%%title%% %%sep%% %%sitename%%';
		}

		return $title;
	}

	/**
	 * Retrieves the metadesc template.
	 *
	 * @return string
	 */
	private function get_metadesc_template() {
		return $this->get_template( 'metadesc' );
	}

	/**
	 * Retrieves a template.
	 *
	 * @param String $template_option_name The name of the option in which the template you want to get is saved.
	 *
	 * @return string
	 */
	private function get_template( $template_option_name ) {
		$needed_option = $template_option_name . '-' . $this->post->post_type;

		if ( WPSEO_Options::get( $needed_option, '' ) !== '' ) {
			return WPSEO_Options::get( $needed_option );
		}

		return '';
	}

	/**
	 * Determines the date to be displayed in the snippet preview.
	 *
	 * @return string
	 */
	private function get_metadesc_date() {
		$date = '';

		if ( $this->is_show_date_enabled() ) {
			$date = date_i18n( 'M j, Y', mysql2date( 'U', $this->post->post_date ) );
		}

		return $date;
	}

	/**
	 * Returns whether or not showing the date in the snippet preview is enabled.
	 *
	 * @return bool
	 */
	private function is_show_date_enabled() {
		$key = sprintf( 'showdate-%s', $this->post->post_type );

		return WPSEO_Options::get( $key, true );
	}
}
PK     ”T]ÇÏv�$  �$  %  formatter/class-metabox-formatter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Formatter
 */

/**
 * This class forces needed methods for the metabox localization.
 */
class WPSEO_Metabox_Formatter {

	/**
	 * Object that provides formatted values.
	 *
	 * @var WPSEO_Metabox_Formatter_Interface
	 */
	private $formatter;

	/**
	 * Setting the formatter property.
	 *
	 * @param WPSEO_Metabox_Formatter_Interface $formatter Object that provides the formatted values.
	 */
	public function __construct( WPSEO_Metabox_Formatter_Interface $formatter ) {
		$this->formatter = $formatter;
	}

	/**
	 * Returns the values.
	 *
	 * @return array
	 */
	public function get_values() {
		$defaults = $this->get_defaults();
		$values   = $this->formatter->get_values();

		return ( $values + $defaults );
	}

	/**
	 * Returns array with all the values always needed by a scraper object.
	 *
	 * @return array Default settings for the metabox.
	 */
	private function get_defaults() {
		$analysis_seo         = new WPSEO_Metabox_Analysis_SEO();
		$analysis_readability = new WPSEO_Metabox_Analysis_Readability();

		return array(
			'language'                  => WPSEO_Language_Utils::get_site_language_name(),
			'settings_link'             => $this->get_settings_link(),
			'search_url'                => '',
			'post_edit_url'             => '',
			'base_url'                  => '',
			'contentTab'                => __( 'Readability', 'wordpress-seo' ),
			'keywordTab'                => __( 'Keyphrase:', 'wordpress-seo' ),
			'removeKeyword'             => __( 'Remove keyphrase', 'wordpress-seo' ),
			'contentLocale'             => get_locale(),
			'userLocale'                => WPSEO_Language_Utils::get_user_locale(),
			'translations'              => $this->get_translations(),
			'keyword_usage'             => array(),
			'title_template'            => '',
			'metadesc_template'         => '',
			'contentAnalysisActive'     => $analysis_readability->is_enabled() ? 1 : 0,
			'keywordAnalysisActive'     => $analysis_seo->is_enabled() ? 1 : 0,
			'cornerstoneActive'         => WPSEO_Options::get( 'enable_cornerstone_content', false ) ? 1 : 0,
			'intl'                      => $this->get_content_analysis_component_translations(),
			'isRtl'                     => is_rtl(),
			'isPremium'                 => WPSEO_Utils::is_yoast_seo_premium(),
			'addKeywordUpsell'          => $this->get_add_keyword_upsell_translations(),
			'wordFormRecognitionActive' => ( WPSEO_Language_Utils::get_language( get_locale() ) === 'en' ),

			/**
			 * Filter to determine if the markers should be enabled or not.
			 *
			 * @param bool $showMarkers Should the markers being enabled. Default = true.
			 */
			'show_markers'              => apply_filters( 'wpseo_enable_assessment_markers', true ),
			'publish_box'               => array(
				'labels' => array(
					'content' => array(
						'na'   => sprintf(
							/* translators: %s expands to readability. */
							__( 'Readability: %s', 'wordpress-seo' ),
							'<strong>' . __( 'Not available', 'wordpress-seo' ) . '</strong>'
						),
						'bad'  => sprintf(
							/* translators: %s expands to readability. */
							__( 'Readability: %s', 'wordpress-seo' ),
							'<strong>' . __( 'Needs improvement', 'wordpress-seo' ) . '</strong>'
						),
						'ok'   => sprintf(
							/* translators: %s expands to readability. */
							__( 'Readability: %s', 'wordpress-seo' ),
							'<strong>' . __( 'OK', 'wordpress-seo' ) . '</strong>'
						),
						'good' => sprintf(
							/* translators: %s expands to readability. */
							__( 'Readability: %s', 'wordpress-seo' ),
							'<strong>' . __( 'Good', 'wordpress-seo' ) . '</strong>'
						),
					),
					'keyword' => array(
						'na'   => sprintf(
							/* translators: %s expands to SEO. */
							__( 'SEO: %s', 'wordpress-seo' ),
							'<strong>' . __( 'Not available', 'wordpress-seo' ) . '</strong>'
						),
						'bad'  => sprintf(
							/* translators: %s expands to SEO. */
							__( 'SEO: %s', 'wordpress-seo' ),
							'<strong>' . __( 'Needs improvement', 'wordpress-seo' ) . '</strong>'
						),
						'ok'   => sprintf(
							/* translators: %s expands to SEO. */
							__( 'SEO: %s', 'wordpress-seo' ),
							'<strong>' . __( 'OK', 'wordpress-seo' ) . '</strong>'
						),
						'good' => sprintf(
							/* translators: %s expands to SEO. */
							__( 'SEO: %s', 'wordpress-seo' ),
							'<strong>' . __( 'Good', 'wordpress-seo' ) . '</strong>'
						),
					),
				),
			),
			'markdownEnabled'           => $this->is_markdown_enabled(),
			'analysisHeadingTitle'      => __( 'Analysis', 'wordpress-seo' ),
		);
	}

	/**
	 * Returns a link to the settings page, if the user has the right capabilities.
	 * Returns an empty string otherwise.
	 *
	 * @return string The settings link.
	 */
	private function get_settings_link() {
		if ( current_user_can( 'manage_options' ) ) {
			return admin_url( 'options-general.php' );
		}

		return '';
	}

	/**
	 * Returns required yoast-component translations.
	 *
	 * @return array
	 */
	private function get_content_analysis_component_translations() {
		// Esc_html is not needed because React already handles HTML in the (translations of) these strings.
		return array(
			'locale'                                         => WPSEO_Language_Utils::get_user_locale(),
			'content-analysis.language-notice-link'          => __( 'Change language', 'wordpress-seo' ),
			'content-analysis.errors'                        => __( 'Errors', 'wordpress-seo' ),
			'content-analysis.problems'                      => __( 'Problems', 'wordpress-seo' ),
			'content-analysis.improvements'                  => __( 'Improvements', 'wordpress-seo' ),
			'content-analysis.considerations'                => __( 'Considerations', 'wordpress-seo' ),
			'content-analysis.good'                          => __( 'Good results', 'wordpress-seo' ),
			'content-analysis.language-notice'               => __( 'Your site language is set to {language}.', 'wordpress-seo' ),
			'content-analysis.language-notice-contact-admin' => __( 'Your site language is set to {language}. If this is not correct, contact your site administrator.', 'wordpress-seo' ),
			'content-analysis.highlight'                     => __( 'Highlight this result in the text', 'wordpress-seo' ),
			'content-analysis.nohighlight'                   => __( 'Remove highlight from the text', 'wordpress-seo' ),
			'content-analysis.disabledButton'                => __( 'Marks are disabled in current view', 'wordpress-seo' ),
			'a11yNotice.opensInNewTab'                       => __( '(Opens in a new browser tab)', 'wordpress-seo' ),
		);
	}

	/**
	 * Returns the translations for the Add Keyword modal.
	 *
	 * These strings are not escaped because they're meant to be used with React
	 * which already takes care of that. If used in PHP, they should be escaped.
	 *
	 * @return array Translated text strings for the Add Keyword modal.
	 */
	public function get_add_keyword_upsell_translations() {
		return array(
			'title'                    => __( 'Would you like to add more than one keyphrase?', 'wordpress-seo' ),
			'intro'                    => sprintf(
				/* translators: %s expands to a 'Yoast SEO Premium' text linked to the yoast.com website. */
				__( 'Great news: you can, with %s!', 'wordpress-seo' ),
				'{{link}}Yoast SEO Premium{{/link}}'
			),
			'link'                     => WPSEO_Shortlinker::get( 'https://yoa.st/pe-premium-page' ),
			'other'                    => sprintf(
				/* translators: %s expands to 'Yoast SEO Premium'. */
				__( 'Other benefits of %s for you:', 'wordpress-seo' ),
				'Yoast SEO Premium'
			),
			'buylink'                  => WPSEO_Shortlinker::get( 'https://yoa.st/add-keywords-popup' ),
			'buy'                      => sprintf(
				/* translators: %s expands to 'Yoast SEO Premium'. */
				__( 'Get %s', 'wordpress-seo' ),
				'Yoast SEO Premium'
			),
			'small'                    => __( '1 year free support and updates included!', 'wordpress-seo' ),
			'a11yNotice.opensInNewTab' => __( '(Opens in a new browser tab)', 'wordpress-seo' ),
		);
	}

	/**
	 * Returns Jed compatible YoastSEO.js translations.
	 *
	 * @return array
	 */
	private function get_translations() {
		$locale = WPSEO_Language_Utils::get_user_locale();

		$file = plugin_dir_path( WPSEO_FILE ) . 'languages/wordpress-seo-' . $locale . '.json';
		if ( file_exists( $file ) ) {
			$file = file_get_contents( $file );
			if ( is_string( $file ) && $file !== '' ) {
				return json_decode( $file, true );
			}
		}

		return array();
	}

	/**
	 * Checks if Jetpack's markdown module is enabled.
	 * Can be extended to work with other plugins that parse markdown in the content.
	 *
	 * @return boolean
	 */
	private function is_markdown_enabled() {
		$is_markdown = false;

		if ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'get_active_modules' ) ) {
			$active_modules = Jetpack::get_active_modules();

			// First at all, check if Jetpack's markdown module is active.
			$is_markdown  = in_array( 'markdown', $active_modules, true );
		}

		/**
		 * Filters whether markdown support is active in the readability- and seo-analysis.
		 *
		 * @since 11.3
		 *
		 * @param array $is_markdown Is markdown support for Yoast SEO active.
		 */
		return apply_filters( 'wpseo_is_markdown_enabled', $is_markdown );
	}
}
PK     ”T]�SÊ‰í   í     formatter/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]—¯˜Àê  ê  *  formatter/class-term-metabox-formatter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Formatter
 */

/**
 * This class provides data for the term metabox by return its values for localization.
 */
class WPSEO_Term_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface {

	/**
	 * @var WP_Term|stdClass
	 */
	private $term;

	/**
	 * @var stdClass
	 */
	private $taxonomy;

	/**
	 * Array with the WPSEO_Titles options.
	 *
	 * @var array
	 */
	protected $options;

	/**
	 * WPSEO_Taxonomy_Scraper constructor.
	 *
	 * @param stdClass         $taxonomy Taxonomy.
	 * @param WP_Term|stdClass $term     Term.
	 */
	public function __construct( $taxonomy, $term ) {
		$this->term     = $term;
		$this->taxonomy = $taxonomy;
	}

	/**
	 * Returns the translated values.
	 *
	 * @return array
	 */
	public function get_values() {
		$values = array();

		// Todo: a column needs to be added on the termpages to add a filter for the keyword, so this can be used in the focus keyphrase doubles.
		if ( is_object( $this->term ) && property_exists( $this->term, 'taxonomy' ) ) {
			$values = array(
				'search_url'        => $this->search_url(),
				'post_edit_url'     => $this->edit_url(),
				'base_url'          => $this->base_url_for_js(),
				'taxonomy'          => $this->term->taxonomy,
				'keyword_usage'     => $this->get_focus_keyword_usage(),
				'title_template'    => $this->get_title_template(),
				'metadesc_template' => $this->get_metadesc_template(),
			);
		}

		return $values;
	}

	/**
	 * Returns the url to search for keyword for the taxonomy.
	 *
	 * @return string
	 */
	private function search_url() {
		return admin_url( 'edit-tags.php?taxonomy=' . $this->term->taxonomy . '&seo_kw_filter={keyword}' );
	}

	/**
	 * Returns the url to edit the taxonomy.
	 *
	 * @return string
	 */
	private function edit_url() {
		global $wp_version;
		$script_filename = version_compare( $wp_version, '4.5', '<' ) ? 'edit-tags' : 'term';
		return admin_url( $script_filename . '.php?action=edit&taxonomy=' . $this->term->taxonomy . '&tag_ID={id}' );
	}

	/**
	 * Returns a base URL for use in the JS, takes permalink structure into account.
	 *
	 * @return string
	 */
	private function base_url_for_js() {

		$base_url = home_url( '/', null );
		if ( ! WPSEO_Options::get( 'stripcategorybase', false ) ) {
			$base_url = trailingslashit( $base_url . $this->taxonomy->rewrite['slug'] );
		}

		return $base_url;
	}

	/**
	 * Counting the number of given keyword used for other term than given term_id.
	 *
	 * @return array
	 */
	private function get_focus_keyword_usage() {
		$focuskw = WPSEO_Taxonomy_Meta::get_term_meta( $this->term, $this->term->taxonomy, 'focuskw' );

		return WPSEO_Taxonomy_Meta::get_keyword_usage( $focuskw, $this->term->term_id, $this->term->taxonomy );
	}

	/**
	 * Retrieves the title template.
	 *
	 * @return string The title template.
	 */
	private function get_title_template() {
		$title = $this->get_template( 'title' );

		if ( $title === '' ) {
			return '%%title%% %%sep%% %%sitename%%';
		}

		return $title;
	}

	/**
	 * Retrieves the metadesc template.
	 *
	 * @return string
	 */
	private function get_metadesc_template() {
		return $this->get_template( 'metadesc' );
	}

	/**
	 * Retrieves a template.
	 *
	 * @param String $template_option_name The name of the option in which the template you want to get is saved.
	 *
	 * @return string
	 */
	private function get_template( $template_option_name ) {
		$needed_option = $template_option_name . '-tax-' . $this->term->taxonomy;
		return WPSEO_Options::get( $needed_option, '' );
	}
}
PK     ”T]^o]      class-config.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class WPSEO_Admin_Pages.
 *
 * Class with functionality for the Yoast SEO admin pages.
 */
class WPSEO_Admin_Pages {

	/**
	 * The option in use for the current admin page.
	 *
	 * @var string
	 */
	public $currentoption = 'wpseo';

	/**
	 * Holds the asset manager.
	 *
	 * @var WPSEO_Admin_Asset_Manager
	 */
	private $asset_manager;

	/**
	 * Class constructor, which basically only hooks the init function on the init hook.
	 */
	public function __construct() {
		add_action( 'init', array( $this, 'init' ), 20 );
		$this->asset_manager = new WPSEO_Admin_Asset_Manager();
	}

	/**
	 * Make sure the needed scripts are loaded for admin pages.
	 */
	public function init() {
		if ( filter_input( INPUT_GET, 'wpseo_reset_defaults' ) && wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ), 'wpseo_reset_defaults' ) && current_user_can( 'manage_options' ) ) {
			WPSEO_Options::reset();
			wp_redirect( admin_url( 'admin.php?page=' . WPSEO_Configuration_Page::PAGE_IDENTIFIER ) );
		}

		add_action( 'admin_enqueue_scripts', array( $this, 'config_page_scripts' ) );
		add_action( 'admin_enqueue_scripts', array( $this, 'config_page_styles' ) );
	}

	/**
	 * Loads the required styles for the config page.
	 */
	public function config_page_styles() {
		wp_enqueue_style( 'dashboard' );
		wp_enqueue_style( 'thickbox' );
		wp_enqueue_style( 'global' );
		wp_enqueue_style( 'wp-admin' );
		$this->asset_manager->enqueue_style( 'select2' );

		$this->asset_manager->enqueue_style( 'admin-css' );
	}

	/**
	 * Loads the required scripts for the config page.
	 */
	public function config_page_scripts() {
		$this->asset_manager->enqueue_script( 'admin-script' );
		$this->asset_manager->enqueue_script( 'help-center' );

		$page = filter_input( INPUT_GET, 'page' );

		if ( $page === 'wpseo_titles' ) {
			wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'search-appearance', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script() );
			wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'search-appearance', 'wpseoSearchAppearance', $this->localize_search_appearance_script() );
			$this->asset_manager->enqueue_script( 'search-appearance' );
			$this->asset_manager->enqueue_style( 'search-appearance' );
			/**
			 * Remove the emoji script as it is incompatible with both React and any
			 * contenteditable fields.
			 */
			remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );

			$yoast_components_l10n = new WPSEO_Admin_Asset_Yoast_Components_L10n();
			$yoast_components_l10n->localize_script( 'search-appearance' );
		}

		wp_enqueue_script( 'dashboard' );
		wp_enqueue_script( 'thickbox' );

		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-script', 'wpseoSelect2Locale', WPSEO_Language_Utils::get_language( WPSEO_Language_Utils::get_user_locale() ) );

		if ( in_array( $page, array( 'wpseo_social', WPSEO_Admin::PAGE_IDENTIFIER, 'wpseo_titles' ), true ) ) {
			wp_enqueue_media();

			$this->asset_manager->enqueue_script( 'admin-media' );
			wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', $this->localize_media_script() );
		}

		if ( 'wpseo_tools' === $page ) {
			$this->enqueue_tools_scripts();
		}
	}

	/**
	 * Retrieves some variables that are needed for the upload module in JS.
	 *
	 * @return array The upload module variables.
	 */
	public function localize_media_script() {
		return array(
			'choose_image' => __( 'Use Image', 'wordpress-seo' ),
		);
	}

	/**
	 * Retrieves some variables that are needed for replacing variables in JS.
	 *
	 * @return array The replacement and recommended replacement variables.
	 */
	public function localize_replace_vars_script() {
		$replace_vars                 = new WPSEO_Replace_Vars();
		$recommended_replace_vars     = new WPSEO_Admin_Recommended_Replace_Vars();
		$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
		$replace_vars_list            = $replace_vars->get_replacement_variables_list();

		return array(
			'replace_vars'                 => $replace_vars_list,
			'recommended_replace_vars'     => $recommended_replace_vars->get_recommended_replacevars(),
			'editor_specific_replace_vars' => $editor_specific_replace_vars->get(),
			'shared_replace_vars'          => $editor_specific_replace_vars->get_generic( $replace_vars_list ),
		);
	}

	/**
	 * Retrieves some variables that are needed for the search appearance in JS.
	 *
	 * @return array The search appearance variables.
	 */
	public function localize_search_appearance_script() {
		return array(
			'isRtl'                    => is_rtl(),
			'userEditUrl'              => add_query_arg( 'user_id', '{user_id}', admin_url( 'user-edit.php' ) ),
			'brushstrokeBackgroundURL' => plugins_url( 'images/brushstroke_background.svg', WPSEO_FILE ),
			'showLocalSEOUpsell'       => $this->should_show_local_seo_upsell(),
			'localSEOUpsellURL'        => WPSEO_Shortlinker::get( 'https://yoa.st/3mp' ),
		);
	}

	/**
	 * Determines whether the Local SEO upsell should be shown.
	 *
	 * The Local SEO upsell should:
	 * - Only be shown in Free, not when Premium is active.
	 * - Not be shown when Local SEO is active.
	 *
	 * @return bool Whether the Local SEO upsell should be shown.
	 */
	private function should_show_local_seo_upsell() {
		$addon_manager = new WPSEO_Addon_Manager();

		return ! WPSEO_Utils::is_yoast_seo_premium()
			&& ! $addon_manager->has_valid_subscription( WPSEO_Addon_Manager::LOCAL_SLUG );
	}

	/**
	 * Enqueues and handles all the tool dependencies.
	 */
	private function enqueue_tools_scripts() {
		$tool = filter_input( INPUT_GET, 'tool' );

		if ( empty( $tool ) ) {
			$this->asset_manager->enqueue_script( 'yoast-seo' );
		}

		if ( 'bulk-editor' === $tool ) {
			$this->asset_manager->enqueue_script( 'bulk-editor' );
		}
	}
} /* End of class */
PK     ”T]��¼¸  ¸  $  class-yoast-network-settings-api.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Network
 */

/**
 * Implements a network settings API for the plugin's multisite settings.
 */
class Yoast_Network_Settings_API {

	/**
	 * Registered network settings.
	 *
	 * @var array
	 */
	private $registered_settings = array();

	/**
	 * Options whitelist, keyed by option group.
	 *
	 * @var array
	 */
	private $whitelist_options = array();

	/**
	 * The singleton instance of this class.
	 *
	 * @var Yoast_Network_Settings_API
	 */
	private static $instance = null;

	/**
	 * Registers a network setting and its data.
	 *
	 * @param string $option_group The group the network option is part of.
	 * @param string $option_name  The name of the network option to sanitize and save.
	 * @param array  $args         {
	 *     Optional. Data used to describe the network setting when registered.
	 *
	 *     @type callable $sanitize_callback A callback function that sanitizes the network option's value.
	 *     @type mixed    $default           Default value when calling `get_network_option()`.
	 * }
	 *
	 * @return void
	 */
	public function register_setting( $option_group, $option_name, $args = array() ) {

		$defaults = array(
			'group'             => $option_group,
			'sanitize_callback' => null,
		);
		$args     = wp_parse_args( $args, $defaults );

		if ( ! isset( $this->whitelist_options[ $option_group ] ) ) {
			$this->whitelist_options[ $option_group ] = array();
		}

		$this->whitelist_options[ $option_group ][] = $option_name;

		if ( ! empty( $args['sanitize_callback'] ) ) {
			add_filter( "sanitize_option_{$option_name}", array( $this, 'filter_sanitize_option' ), 10, 2 );
		}

		if ( array_key_exists( 'default', $args ) ) {
			add_filter( "default_site_option_{$option_name}", array( $this, 'filter_default_option' ), 10, 2 );
		}

		$this->registered_settings[ $option_name ] = $args;
	}

	/**
	 * Gets the registered settings and their data.
	 *
	 * @return array Array of $option_name => $data pairs.
	 */
	public function get_registered_settings() {
		return $this->registered_settings;
	}

	/**
	 * Gets the whitelisted options for a given option group.
	 *
	 * @param string $option_group Option group.
	 *
	 * @return array List of option names, or empty array if unknown option group.
	 */
	public function get_whitelist_options( $option_group ) {
		if ( ! isset( $this->whitelist_options[ $option_group ] ) ) {
			return array();
		}

		return $this->whitelist_options[ $option_group ];
	}

	/**
	 * Filters sanitization for a network option value.
	 *
	 * This method is added as a filter to `sanitize_option_{$option}` for network options that are
	 * registered with a sanitize callback.
	 *
	 * @param string $value  The sanitized option value.
	 * @param string $option The option name.
	 *
	 * @return string The filtered sanitized option value.
	 */
	public function filter_sanitize_option( $value, $option ) {

		if ( empty( $this->registered_settings[ $option ] ) ) {
			return $value;
		}

		return call_user_func( $this->registered_settings[ $option ]['sanitize_callback'], $value );
	}

	/**
	 * Filters the default value for a network option.
	 *
	 * This function is added as a filter to `default_site_option_{$option}` for network options that
	 * are registered with a default.
	 *
	 * @param mixed  $default Existing default value to return.
	 * @param string $option  The option name.
	 *
	 * @return mixed The filtered default value.
	 */
	public function filter_default_option( $default, $option ) {

		// If a default value was manually passed to the function, allow it to override.
		if ( $default !== false ) {
			return $default;
		}

		if ( empty( $this->registered_settings[ $option ] ) ) {
			return $default;
		}

		return $this->registered_settings[ $option ]['default'];
	}

	/**
	 * Checks whether the requirements to use this class are met.
	 *
	 * @return bool True if requirements are met, false otherwise.
	 */
	public function meets_requirements() {
		return is_multisite();
	}

	/**
	 * Gets the singleton instance of this class.
	 *
	 * @return Yoast_Network_Settings_API The singleton instance.
	 */
	public static function get() {

		if ( self::$instance === null ) {
			self::$instance = new self();
		}

		return self::$instance;
	}
}
PK     ”T]yþ%”!  ”!    class-plugin-conflict.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 * @since   1.7.0
 */

/**
 * Contains list of conflicting plugins.
 */
class WPSEO_Plugin_Conflict extends Yoast_Plugin_Conflict {

	/**
	 * The plugins must be grouped per section.
	 *
	 * It's possible to check for each section if there are conflicting plugin
	 *
	 * @var array
	 */
	protected $plugins = array(
		// The plugin which are writing OG metadata.
		'open_graph'   => array(
			'2-click-socialmedia-buttons/2-click-socialmedia-buttons.php',
			// 2 Click Social Media Buttons.
			'add-link-to-facebook/add-link-to-facebook.php',         // Add Link to Facebook.
			'add-meta-tags/add-meta-tags.php',                       // Add Meta Tags.
			'easy-facebook-share-thumbnails/esft.php',               // Easy Facebook Share Thumbnail.
			'facebook/facebook.php',                                 // Facebook (official plugin).
			'facebook-awd/AWD_facebook.php',                         // Facebook AWD All in one.
			'facebook-featured-image-and-open-graph-meta-tags/fb-featured-image.php',
			// Facebook Featured Image & OG Meta Tags.
			'facebook-meta-tags/facebook-metatags.php',              // Facebook Meta Tags.
			'wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php',
			// Facebook Open Graph Meta Tags for WordPress.
			'facebook-revised-open-graph-meta-tag/index.php',        // Facebook Revised Open Graph Meta Tag.
			'facebook-thumb-fixer/_facebook-thumb-fixer.php',        // Facebook Thumb Fixer.
			'facebook-and-digg-thumbnail-generator/facebook-and-digg-thumbnail-generator.php',
			// Fedmich's Facebook Open Graph Meta.
			'network-publisher/networkpub.php',                      // Network Publisher.
			'nextgen-facebook/nextgen-facebook.php',                 // NextGEN Facebook OG.
			'opengraph/opengraph.php',                               // Open Graph.
			'open-graph-protocol-framework/open-graph-protocol-framework.php',
			// Open Graph Protocol Framework.
			'seo-facebook-comments/seofacebook.php',                 // SEO Facebook Comments.
			'sexybookmarks/sexy-bookmarks.php',                      // Shareaholic.
			'shareaholic/sexy-bookmarks.php',                        // Shareaholic.
			'sharepress/sharepress.php',                             // SharePress.
			'simple-facebook-connect/sfc.php',                       // Simple Facebook Connect.
			'social-discussions/social-discussions.php',             // Social Discussions.
			'social-sharing-toolkit/social_sharing_toolkit.php',     // Social Sharing Toolkit.
			'socialize/socialize.php',                               // Socialize.
			'only-tweet-like-share-and-google-1/tweet-like-plusone.php',
			// Tweet, Like, Google +1 and Share.
			'wordbooker/wordbooker.php',                             // Wordbooker.
			'wpsso/wpsso.php',                                       // WordPress Social Sharing Optimization.
			'wp-caregiver/wp-caregiver.php',                         // WP Caregiver.
			'wp-facebook-like-send-open-graph-meta/wp-facebook-like-send-open-graph-meta.php',
			// WP Facebook Like Send & Open Graph Meta.
			'wp-facebook-open-graph-protocol/wp-facebook-ogp.php',   // WP Facebook Open Graph protocol.
			'wp-ogp/wp-ogp.php',                                     // WP-OGP.
			'zoltonorg-social-plugin/zosp.php',                      // Zolton.org Social Plugin.
		),
		'xml_sitemaps' => array(
			'google-sitemap-plugin/google-sitemap-plugin.php',
			// Google Sitemap (BestWebSoft).
			'xml-sitemaps/xml-sitemaps.php',
			// XML Sitemaps (Denis de Bernardy and Mike Koepke).
			'bwp-google-xml-sitemaps/bwp-simple-gxs.php',
			// Better WordPress Google XML Sitemaps (Khang Minh).
			'google-sitemap-generator/sitemap.php',
			// Google XML Sitemaps (Arne Brachhold).
			'xml-sitemap-feed/xml-sitemap.php',
			// XML Sitemap & Google News feeds (RavanH).
			'google-monthly-xml-sitemap/monthly-xml-sitemap.php',
			// Google Monthly XML Sitemap (Andrea Pernici).
			'simple-google-sitemap-xml/simple-google-sitemap-xml.php',
			// Simple Google Sitemap XML (iTx Technologies).
			'another-simple-xml-sitemap/another-simple-xml-sitemap.php',
			// Another Simple XML Sitemap.
			'xml-maps/google-sitemap.php',
			// Xml Sitemap (Jason Martens).
			'google-xml-sitemap-generator-by-anton-dachauer/adachauer-google-xml-sitemap.php',
			// Google XML Sitemap Generator by Anton Dachauer (Anton Dachauer).
			'wp-xml-sitemap/wp-xml-sitemap.php',
			// WP XML Sitemap (Team Vivacity).
			'sitemap-generator-for-webmasters/sitemap.php',
			// Sitemap Generator for Webmasters (iwebslogtech).
			'xml-sitemap-xml-sitemapcouk/xmls.php',
			// XML Sitemap - XML-Sitemap.co.uk (Simon Hancox).
			'sewn-in-xml-sitemap/sewn-xml-sitemap.php',
			// Sewn In XML Sitemap (jcow).
			'rps-sitemap-generator/rps-sitemap-generator.php',
			// RPS Sitemap Generator (redpixelstudios).
		),
		'cloaking' => array(
			'rs-head-cleaner/rs-head-cleaner.php',
			// RS Head Cleaner Plus https://wordpress.org/plugins/rs-head-cleaner/.
			'rs-head-cleaner-lite/rs-head-cleaner-lite.php',
			// RS Head Cleaner Lite https://wordpress.org/plugins/rs-head-cleaner-lite/.
		),
		'seo' => array(
			'all-in-one-seo-pack/all_in_one_seo_pack.php',           // All in One SEO Pack.
			'seo-ultimate/seo-ultimate.php',                         // SEO Ultimate.
		),
	);

	/**
	 * Overrides instance to set with this class as class.
	 *
	 * @param string $class_name Optional class name.
	 *
	 * @return Yoast_Plugin_Conflict
	 */
	public static function get_instance( $class_name = __CLASS__ ) {
		return parent::get_instance( $class_name );
	}

	/**
	 * After activating any plugin, this method will be executed by a hook.
	 *
	 * If the activated plugin is conflicting with ours a notice will be shown.
	 *
	 * @param string|bool $plugin Optional plugin basename to check.
	 */
	public static function hook_check_for_plugin_conflicts( $plugin = false ) {

		// The instance of itself.
		$instance = self::get_instance();

		// Only add plugin as active plugin if $plugin isn't false.
		if ( $plugin && is_string( $plugin ) ) {
			// Because it's just activated.
			$instance->add_active_plugin( $instance->find_plugin_category( $plugin ), $plugin );
		}

		$plugin_sections = array();

		// Only check for open graph problems when they are enabled.
		if ( WPSEO_Options::get( 'opengraph' ) ) {
			/* translators: %1$s expands to Yoast SEO, %2$s: 'Facebook' plugin name of possibly conflicting plugin with regard to creating OpenGraph output. */
			$plugin_sections['open_graph'] = __( 'Both %1$s and %2$s create Open Graph output, which might make Facebook, Twitter, LinkedIn and other social networks use the wrong texts and images when your pages are being shared.', 'wordpress-seo' )
				. '<br/><br/>'
				. '<a class="button" href="' . admin_url( 'admin.php?page=wpseo_social#top#facebook' ) . '">'
				/* translators: %1$s expands to Yoast SEO. */
				. sprintf( __( 'Configure %1$s\'s Open Graph settings', 'wordpress-seo' ), 'Yoast SEO' )
				. '</a>';
		}

		// Only check for XML conflicts if sitemaps are enabled.
		if ( WPSEO_Options::get( 'enable_xml_sitemap' ) ) {
			/* translators: %1$s expands to Yoast SEO, %2$s: 'Google XML Sitemaps' plugin name of possibly conflicting plugin with regard to the creation of sitemaps. */
			$plugin_sections['xml_sitemaps'] = __( 'Both %1$s and %2$s can create XML sitemaps. Having two XML sitemaps is not beneficial for search engines and might slow down your site.', 'wordpress-seo' )
				. '<br/><br/>'
				. '<a class="button" href="' . admin_url( 'admin.php?page=wpseo_dashboard#top#features' ) . '">'
				/* translators: %1$s expands to Yoast SEO. */
				. sprintf( __( 'Toggle %1$s\'s XML Sitemap', 'wordpress-seo' ), 'Yoast SEO' )
				. '</a>';
		}

		/* translators: %2$s expands to 'RS Head Cleaner' plugin name of possibly conflicting plugin with regard to differentiating output between search engines and normal users. */
		$plugin_sections['cloaking'] = __( 'The plugin %2$s changes your site\'s output and in doing that differentiates between search engines and normal users, a process that\'s called cloaking. We highly recommend that you disable it.', 'wordpress-seo' );

		/* translators: %1$s expands to Yoast SEO, %2$s: 'SEO' plugin name of possibly conflicting plugin with regard to the creation of duplicate SEO meta. */
		$plugin_sections['seo'] = __( 'Both %1$s and %2$s manage the SEO of your site. Running two SEO plugins at the same time is detrimental.', 'wordpress-seo' );

		$instance->check_plugin_conflicts( $plugin_sections );
	}
}
PK     ”T]g5NÑ  Ñ  +  links/class-link-compatibility-notifier.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents compatibility with php version 5.3.
 */
class WPSEO_Link_Compatibility_Notifier {

	/**
	 * @var string
	 */
	const NOTIFICATION_ID = 'wpseo-links-compatibility';

	/**
	 * Adds the notification to the notification center.
	 */
	public function add_notification() {
		Yoast_Notification_Center::get()->add_notification( $this->get_notification() );
	}

	/**
	 * Removes the notification from the notification center.
	 */
	public function remove_notification() {
		Yoast_Notification_Center::get()->remove_notification( $this->get_notification() );
	}

	/**
	 * Returns the notification when the version is incompatible.
	 *
	 * @return Yoast_Notification The notification.
	 */
	protected function get_notification() {
		return new Yoast_Notification(
			sprintf(
				/* translators: %1$s: Yoast SEO. %2$s: Version number of Yoast SEO. */
				esc_html__( 'The %3$sText link counter%4$s feature (introduced in %1$s %2$s) is currently disabled.', 'wordpress-seo' ),
				'Yoast SEO',
				'5.0',
				'<strong>',
				'</strong>'
			) . ' ' .
			sprintf(
				/* translators: %1$s: Yoast SEO. %2$s: PHP version %3$s: The current PHP version. */
				esc_html__( 'For this feature to work %1$s requires at least PHP version %2$s. We have detected PHP version %3$s on this website.', 'wordpress-seo' ),
				'Yoast SEO',
				'5.3',
				phpversion()
			) . '<br>' .
			sprintf(
				/* translators: %1$s: link to knowledge base article about solving PHP issue. %2$s: is anchor closing. */
				esc_html__( 'Please read the following %1$sknowledge base article%2$s to find out how to resolve this problem.', 'wordpress-seo' ),
				'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/16f' ) . '" target="_blank">',
				'</a>'
			),
			array(
				'type'         => Yoast_Notification::WARNING,
				'id'           => self::NOTIFICATION_ID,
				'capabilities' => 'wpseo_manage_options',
				'priority'     => 0.8,
			)
		);
	}
}
PK     ”T]÷+ÜÅ÷  ÷    links/class-link-columns.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the link columns. This class will add and handle the link columns.
 */
class WPSEO_Link_Columns {

	/**
	 * Partial column name.
	 *
	 * @var string
	 */
	const COLUMN_LINKED = 'linked';

	/**
	 * Partial column name.
	 *
	 * @var string
	 */
	const COLUMN_LINKS = 'links';

	/**
	 * @var WPSEO_Link_Column_Count
	 */
	protected $link_count;

	/**
	 * Storage to use.
	 *
	 * @var WPSEO_Meta_Storage
	 */
	protected $storage;

	/**
	 * List of public post types.
	 *
	 * @var array
	 */
	protected $public_post_types = array();

	/**
	 * WPSEO_Link_Columns constructor.
	 *
	 * @param WPSEO_Meta_Storage $storage The storage object to use.
	 */
	public function __construct( WPSEO_Meta_Storage $storage ) {
		$this->storage = $storage;
	}

	/**
	 * Registers the hooks.
	 */
	public function register_hooks() {
		global $pagenow;
		$is_ajax_request = wp_doing_ajax();

		if ( ! WPSEO_Metabox::is_post_overview( $pagenow ) && ! $is_ajax_request ) {
			return;
		}

		// Exit when either table is not present or accessible.
		if ( ! WPSEO_Link_Table_Accessible::is_accessible() || ! WPSEO_Meta_Table_Accessible::is_accessible() ) {
			return;
		}

		if ( $is_ajax_request ) {
			add_action( 'admin_init', array( $this, 'set_count_objects' ) );
		}

		// Hook into tablenav to calculate links and linked.
		add_action( 'manage_posts_extra_tablenav', array( $this, 'count_objects' ) );

		add_filter( 'posts_clauses', array( $this, 'order_by_links' ), 1, 2 );
		add_filter( 'posts_clauses', array( $this, 'order_by_linked' ), 1, 2 );

		add_filter( 'admin_init', array( $this, 'register_init_hooks' ) );
	}

	/**
	 * Register hooks that require to be registered after `init`.
	 */
	public function register_init_hooks() {
		$this->public_post_types = apply_filters( 'wpseo_link_count_post_types', WPSEO_Post_Type::get_accessible_post_types() );

		if ( is_array( $this->public_post_types ) && $this->public_post_types !== array() ) {
			array_walk( $this->public_post_types, array( $this, 'set_post_type_hooks' ) );
		}
	}

	/**
	 * Modifies the query pieces to allow ordering column by links to post.
	 *
	 * @param array     $pieces Array of Query pieces.
	 * @param \WP_Query $query  The Query on which to apply.
	 *
	 * @return array
	 */
	public function order_by_links( $pieces, $query ) {
		if ( 'wpseo-' . self::COLUMN_LINKS !== $query->get( 'orderby' ) ) {
			return $pieces;
		}

		return $this->build_sort_query_pieces( $pieces, $query, 'internal_link_count' );
	}

	/**
	 * Modifies the query pieces to allow ordering column by links to post.
	 *
	 * @param array     $pieces Array of Query pieces.
	 * @param \WP_Query $query  The Query on which to apply.
	 *
	 * @return array
	 */
	public function order_by_linked( $pieces, $query ) {
		if ( 'wpseo-' . self::COLUMN_LINKED !== $query->get( 'orderby' ) ) {
			return $pieces;
		}

		return $this->build_sort_query_pieces( $pieces, $query, 'incoming_link_count' );
	}

	/**
	 * Builds the pieces for a sorting query.
	 *
	 * @param array     $pieces Array of Query pieces.
	 * @param \WP_Query $query  The Query on which to apply.
	 * @param string    $field  The field in the table to JOIN on.
	 *
	 * @return array Modified Query pieces.
	 */
	protected function build_sort_query_pieces( $pieces, $query, $field ) {
		global $wpdb;

		// We only want our code to run in the main WP query.
		if ( ! $query->is_main_query() ) {
			return $pieces;
		}

		// Get the order query variable - ASC or DESC.
		$order = strtoupper( $query->get( 'order' ) );

		// Make sure the order setting qualifies. If not, set default as ASC.
		if ( ! in_array( $order, array( 'ASC', 'DESC' ), true ) ) {
			$order = 'ASC';
		}

		$table = $this->storage->get_table_name();

		$pieces['join']   .= " LEFT JOIN $table AS yst_links ON yst_links.object_id = {$wpdb->posts}.ID ";
		$pieces['orderby'] = "{$field} $order, FIELD( {$wpdb->posts}.post_status, 'publish' ) $order, {$pieces['orderby']}";

		return $pieces;
	}

	/**
	 * Sets the hooks for each post type.
	 *
	 * @param string $post_type The post type.
	 */
	public function set_post_type_hooks( $post_type ) {
		add_filter( 'manage_' . $post_type . '_posts_columns', array( $this, 'add_post_columns' ) );
		add_action( 'manage_' . $post_type . '_posts_custom_column', array( $this, 'column_content' ), 10, 2 );
		add_filter( 'manage_edit-' . $post_type . '_sortable_columns', array( $this, 'column_sort' ) );
	}

	/**
	 * Adds the columns for the post overview.
	 *
	 * @param array $columns Array with columns.
	 *
	 * @return array The extended array with columns.
	 */
	public function add_post_columns( $columns ) {
		if ( ! is_array( $columns ) ) {
			return $columns;
		}

		$columns[ 'wpseo-' . self::COLUMN_LINKS ] = sprintf(
			'<span class="yoast-linked-to yoast-column-header-has-tooltip" data-tooltip-text="%1$s"><span class="screen-reader-text">%2$s</span></span>',
			esc_attr__( 'Number of outgoing internal links in this post. See "Yoast Columns" text in the help tab for more info.', 'wordpress-seo' ),
			esc_html__( 'Outgoing internal links', 'wordpress-seo' )
		);

		if ( ! WPSEO_Link_Query::has_unprocessed_posts( $this->public_post_types ) ) {
			$columns[ 'wpseo-' . self::COLUMN_LINKED ] = sprintf(
				'<span class="yoast-linked-from yoast-column-header-has-tooltip" data-tooltip-text="%1$s"><span class="screen-reader-text">%2$s</span></span>',
				esc_attr__( 'Number of internal links linking to this post. See "Yoast Columns" text in the help tab for more info.', 'wordpress-seo' ),
				esc_html__( 'Received internal links', 'wordpress-seo' )
			);
		}

		return $columns;
	}

	/**
	 * Makes sure we calculate all values in one query.
	 *
	 * @param string $target Extra table navigation location which is triggered.
	 */
	public function count_objects( $target ) {
		if ( 'top' === $target ) {
			$this->set_count_objects();
		}
	}

	/**
	 * Sets the objects to use for the count.
	 */
	public function set_count_objects() {
		global $wp_query;

		$posts    = $wp_query->get_posts();
		$post_ids = array();

		// Post lists return a list of objects.
		if ( isset( $posts[0] ) && is_object( $posts[0] ) ) {
			$post_ids = wp_list_pluck( $posts, 'ID' );
		}
		elseif ( ! empty( $posts ) ) {
			// Page list returns an array of post IDs.
			$post_ids = array_keys( $posts );
		}

		$post_ids = WPSEO_Link_Query::filter_unprocessed_posts( $post_ids );

		$links = new WPSEO_Link_Column_Count();
		$links->set( $post_ids );

		$this->link_count = $links;
	}

	/**
	 * Displays the column content for the given column.
	 *
	 * @param string $column_name Column to display the content for.
	 * @param int    $post_id     Post to display the column content for.
	 */
	public function column_content( $column_name, $post_id ) {
		$link_count = null;

		switch ( $column_name ) {
			case 'wpseo-' . self::COLUMN_LINKS:
				$link_count = $this->link_count->get( $post_id, 'internal_link_count' );
				break;
			case 'wpseo-' . self::COLUMN_LINKED:
				if ( get_post_status( $post_id ) === 'publish' ) {
					$link_count = $this->link_count->get( $post_id, 'incoming_link_count' );
				}
				break;
		}

		if ( isset( $link_count ) ) {
			echo (int) $link_count;
		}
	}

	/**
	 * Sets the sortable columns.
	 *
	 * @param array $columns Array with sortable columns.
	 *
	 * @return array The extended array with sortable columns.
	 */
	public function column_sort( array $columns ) {
		$columns[ 'wpseo-' . self::COLUMN_LINKS ]  = 'wpseo-' . self::COLUMN_LINKS;
		$columns[ 'wpseo-' . self::COLUMN_LINKED ] = 'wpseo-' . self::COLUMN_LINKED;

		return $columns;
	}
}
PK     ”T]_�°rÛ  Û    links/class-link.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents an seo link.
 */
class WPSEO_Link {

	/**
	 * @var string
	 */
	const TYPE_EXTERNAL = 'external';

	/**
	 * @var string
	 */
	const TYPE_INTERNAL = 'internal';

	/**
	 * @var string
	 */
	protected $url;

	/**
	 * @var int
	 */
	protected $target_post_id;

	/**
	 * @var string
	 */
	protected $type;

	/**
	 * Sets the properties for the object.
	 *
	 * @param string $url            The url.
	 * @param int    $target_post_id ID to the post where the link refers to.
	 * @param string $type           The url type: internal or outbound.
	 */
	public function __construct( $url, $target_post_id, $type ) {
		$this->url            = $url;
		$this->target_post_id = $target_post_id;
		$this->type           = $type;
	}

	/**
	 * Returns the set URL.
	 *
	 * @return string The set url.
	 */
	public function get_url() {
		return $this->url;
	}

	/**
	 * Returns the set target post id.
	 *
	 * @return int The set target post id.
	 */
	public function get_target_post_id() {
		return (int) $this->target_post_id;
	}

	/**
	 * Return the set link type.
	 *
	 * @return string The set link type.
	 */
	public function get_type() {
		return $this->type;
	}
}
PK     ”T]Æ6@$?  ?    links/class-link-query.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Database helper class.
 */
class WPSEO_Link_Query {

	/**
	 * Determine if there are any unprocessed public posts.
	 *
	 * @param array $post_types List of post types to check with.
	 *
	 * @return bool True if unprocessed posts are found, false if none are found.
	 */
	public static function has_unprocessed_posts( array $post_types ) {
		global $wpdb;

		if ( empty( $post_types ) ) {
			return false;
		}

		$post_types  = self::format_post_types( $post_types );
		$count_table = self::get_count_table_name();

		// Get any object which has not got the processed meta key.
		$query = '
			SELECT ID
			  FROM ' . $wpdb->posts . ' AS posts
		 LEFT JOIN ' . $count_table . ' AS yoast_meta
				ON yoast_meta.object_id = posts.ID
			 WHERE posts.post_status = "publish"
			   AND posts.post_type IN ( ' . $post_types . ' )
			   AND yoast_meta.internal_link_count IS NULL
			 LIMIT 1';

		// If anything is found, we have unprocessed posts.
		$results = $wpdb->get_var( $query );

		return ! empty( $results );
	}

	/**
	 * Filter out posts that have not been processed yet.
	 *
	 * @param array $post_ids Post IDs to filter.
	 *
	 * @return array
	 */
	public static function filter_unprocessed_posts( array $post_ids ) {
		global $wpdb;

		$post_ids = array_filter( $post_ids );
		if ( empty( $post_ids ) || array() === $post_ids ) {
			return $post_ids;
		}

		$count_table = self::get_count_table_name();

		$query = '
			SELECT object_id
			  FROM ' . $count_table . '
			 WHERE object_id IN ( ' . implode( ',', $post_ids ) . ' )
			';

		$results = $wpdb->get_results( $query, ARRAY_A );

		return array_map( 'intval', wp_list_pluck( $results, 'object_id' ) );
	}

	/**
	 * Returns a limited set of unindexed posts.
	 *
	 * @param array $post_types The post type.
	 * @param int   $limit      The limit for the resultset.
	 *
	 * @return array|null|object The set of unindexed posts.
	 */
	public static function get_unprocessed_posts( array $post_types, $limit = 5 ) {
		global $wpdb;

		$count_table = self::get_count_table_name();
		$post_types  = self::format_post_types( $post_types );

		// @codingStandardsIgnoreStart
		$query = 'SELECT posts.ID, posts.post_content
				  FROM ' . $wpdb->posts . ' AS posts
			 LEFT JOIN ' . $count_table . ' AS yoast_meta
			 		ON yoast_meta.object_id = posts.ID
				 WHERE posts.post_status = "publish"
				   AND posts.post_type IN ( ' . $post_types . ' )
				   AND yoast_meta.internal_link_count IS NULL
				 LIMIT %d
		';
		// @codingStandardsIgnoreEnd

		return $wpdb->get_results(
			$wpdb->prepare( $query, $limit )
		);
	}

	/**
	 * Returns the total amount of unindexed posts for given post type.
	 *
	 * @param array $post_types The post types.
	 *
	 * @return int The total of unindexed posts.
	 */
	public static function get_unprocessed_count( array $post_types ) {
		global $wpdb;

		if ( empty( $post_types ) ) {
			return 0;
		}

		$count_table = self::get_count_table_name();
		$post_types  = self::format_post_types( $post_types );

		// @codingStandardsIgnoreStart
		$query = '
			SELECT COUNT( posts.ID )
			  FROM ' . $wpdb->posts . ' AS posts
		 LEFT JOIN ' . $count_table . ' AS yoast_meta
				ON yoast_meta.object_id = posts.ID
			 WHERE posts.post_status = "publish"
			   AND posts.post_type IN ( ' . $post_types . ' )
			   AND yoast_meta.internal_link_count IS NULL';
		// @codingStandardsIgnoreEnd

		return (int) $wpdb->get_var( $query );
	}

	/**
	 * Returns the table name where the counts are stored.
	 *
	 * @return string
	 */
	protected static function get_count_table_name() {
		$storage = new WPSEO_Meta_Storage();
		return $storage->get_table_name();
	}

	/**
	 * Formats an array with post types as an SQL string.
	 *
	 * @param array $post_types The post types to format.
	 *
	 * @return string Post types formatted for use in SQL statement.
	 */
	protected static function format_post_types( array $post_types ) {
		$sanitized_post_types = array_map( 'esc_sql', $post_types );
		$post_types           = sprintf( '"%s"', implode( '", "', $sanitized_post_types ) );

		return $post_types;
	}
}
PK     ”T]Ùå°üd  d  %  links/class-link-table-accessible.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the state of the table being accessible.
 */
class WPSEO_Link_Table_Accessible {

	/**
	 * @var string
	 */
	const ACCESSIBLE = '0';

	/**
	 * @var string
	 */
	const INACCESSBILE = '1';

	/**
	 * Checks if the given table name exists.
	 *
	 * @return bool True when table is accessible.
	 */
	public static function is_accessible() {
		$value = get_transient( self::transient_name() );

		// If the value is not set, check the table.
		if ( false === $value ) {
			return self::check_table();
		}

		return $value === self::ACCESSIBLE;
	}

	/**
	 * Sets the transient value to 1, to indicate the table is not accessible.
	 *
	 * @return void
	 */
	public static function set_inaccessible() {
		set_transient( self::transient_name(), self::INACCESSBILE, HOUR_IN_SECONDS );
	}

	/**
	 * Removes the transient.
	 *
	 * @return void
	 */
	public static function cleanup() {
		delete_transient( self::transient_name() );
	}

	/**
	 * Sets the transient value to 0, to indicate the table is accessible.
	 *
	 * @return void
	 */
	protected static function set_accessible() {
		/*
		 * Prefer to set a 0 timeout, but if the timeout was set before WordPress will not delete the transient
		 * correctly when overridden with a zero value.
		 *
		 * Setting a YEAR_IN_SECONDS instead.
		 */
		set_transient( self::transient_name(), self::ACCESSIBLE, YEAR_IN_SECONDS );
	}

	/**
	 * Checks if the table exists if not, set the transient to indicate the inaccessible table.
	 *
	 * @return bool True if table is accessible.
	 */
	protected static function check_table() {
		global $wpdb;

		$storage = new WPSEO_Link_Storage();
		$query   = $wpdb->prepare( 'SHOW TABLES LIKE %s', $storage->get_table_name() );
		if ( $wpdb->get_var( $query ) !== $storage->get_table_name() ) {
			self::set_inaccessible();
			return false;
		}

		self::set_accessible();
		return true;
	}

	/**
	 * Returns the name of the transient.
	 *
	 * @return string The name of the transient to use.
	 */
	protected static function transient_name() {
		return 'wpseo_link_table_inaccessible';
	}
}
PK     ”T]¸£ÞÓN  N  !  links/class-link-column-count.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the link column count. This class contains the count for each post id on the current page.
 */
class WPSEO_Link_Column_Count {

	/**
	 * @var array
	 */
	protected $count = array();

	/**
	 * Sets the counts for the set target field.
	 *
	 * @param array $post_ids The posts to get the count for.
	 */
	public function set( $post_ids ) {
		if ( empty( $post_ids ) ) {
			return;
		}

		$this->count = $this->get_results( $post_ids );
	}

	/**
	 * Gets the link count for given post id.
	 *
	 * @param int    $post_id      The post id.
	 * @param string $target_field The field to show.
	 *
	 * @return int|null The total amount of links or null if the target field
	 *                  does not exist for the given post id.
	 */
	public function get( $post_id, $target_field = 'internal_link_count' ) {
		if ( array_key_exists( $post_id, $this->count ) && array_key_exists( $target_field, $this->count[ $post_id ] ) ) {
			return $this->count[ $post_id ][ $target_field ];
		}

		return null;
	}

	/**
	 * Gets the link count for the given post ids.
	 *
	 * @param array $post_ids Array with post_ids.
	 *
	 * @return array
	 */
	protected function get_results( $post_ids ) {
		global $wpdb;

		$storage = new WPSEO_Meta_Storage();

		$results = $wpdb->get_results(
			$wpdb->prepare(
				'
				SELECT internal_link_count, incoming_link_count, object_id
				FROM ' . $storage->get_table_name() . '
				WHERE object_id IN (' . implode( ',', array_fill( 0, count( $post_ids ), '%d' ) ) . ')',
				$post_ids
			),
			ARRAY_A
		);

		$output = array();
		foreach ( $results as $result ) {
			$output[ (int) $result['object_id'] ] = array(
				'internal_link_count' => $result['internal_link_count'],
				'incoming_link_count' => (int) $result['incoming_link_count'],
			);
		}

		// Set unfound items to zero.
		foreach ( $post_ids as $post_id ) {
			if ( ! array_key_exists( $post_id, $output ) ) {
				$output[ $post_id ] = array(
					'internal_link_count' => null,
					'incoming_link_count' => 0,
				);
			}
		}

		return $output;
	}
}
PK     ”T]lXýŠ    #  links/class-link-watcher-loader.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the loader for link watcher.
 */
class WPSEO_Link_Watcher_Loader {

	/**
	 * Loads the link watcher.
	 *
	 * @return void
	 */
	public function load() {
		$storage           = new WPSEO_Link_Storage();
		$count_storage     = new WPSEO_Meta_Storage();
		$content_processor = new WPSEO_Link_Content_Processor( $storage, $count_storage );
		$link_watcher      = new WPSEO_Link_Watcher( $content_processor );
		$link_watcher->register_hooks();
	}
}
PK     ”T]æ‹"L  L  $  links/class-link-internal-lookup.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the internal link lookup. This class tries get the postid for a given internal link.
 */
class WPSEO_Link_Internal_Lookup {

	/**
	 * Gets a post id for the given link for the given type. If type is outbound it returns 0 as post id.
	 *
	 * @param string $link The link to populate.
	 *
	 * @return int The post id belongs to given link if link is internal.
	 */
	public function lookup( $link ) {
		// @codingStandardsIgnoreStart
		return url_to_postid( $link );
		// @codingStandardsIgnoreEnd
	}
}
PK     ”T]µ»6ºê  ê    links/class-link-watcher.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the link watcher. This class will watch for the save_post hook being called.
 */
class WPSEO_Link_Watcher {

	/**
	 * @var WPSEO_Link_Content_Processor
	 */
	protected $content_processor;

	/**
	 * WPSEO_Link_Watcher constructor.
	 *
	 * @param WPSEO_Link_Content_Processor $content_processor The processor to use.
	 */
	public function __construct( WPSEO_Link_Content_Processor $content_processor ) {
		$this->content_processor = $content_processor;
	}

	/**
	 * Registers the hooks.
	 *
	 * @returns void
	 */
	public function register_hooks() {
		add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );
		add_action( 'delete_post', array( $this, 'delete_post' ) );
	}

	/**
	 * Saves the links that are used in the post.
	 *
	 * @param int     $post_id The post id to.
	 * @param WP_Post $post    The post object.
	 *
	 * @return void
	 */
	public function save_post( $post_id, WP_Post $post ) {
		/**
		 * Filter: 'wpseo_should_index_links' - Allows disabling of Yoast's links indexation.
		 *
		 * @api bool To disable the indexation, return false.
		 */
		if ( ! apply_filters( 'wpseo_should_index_links', true ) ) {
			return;
		}

		if ( ! WPSEO_Link_Table_Accessible::is_accessible() || ! WPSEO_Meta_Table_Accessible::is_accessible() ) {
			return;
		}

		// When the post is a revision.
		if ( wp_is_post_revision( $post->ID ) ) {
			return;
		}

		$post_statuses_to_skip = array( 'auto-draft', 'trash' );

		if ( in_array( $post->post_status, $post_statuses_to_skip, true ) ) {
			return;
		}

		// When the post isn't processable, just remove the saved links.
		if ( ! $this->is_processable( $post_id ) ) {
			return;
		}

		$this->process( $post_id, $post->post_content );
	}

	/**
	 * Removes the seo links when the post is deleted.
	 *
	 * @param int $post_id The post id.
	 *
	 * @return void
	 */
	public function delete_post( $post_id ) {
		/** This filter is documented in admin/links/class-link-watcher.php */
		if ( ! apply_filters( 'wpseo_should_index_links', true ) ) {
			return;
		}

		if ( ! WPSEO_Link_Table_Accessible::is_accessible() || ! WPSEO_Meta_Table_Accessible::is_accessible() ) {
			return;
		}

		// Fetch links to update related linked objects.
		$links = $this->content_processor->get_stored_internal_links( $post_id );

		// Update the storage, remove all links for this post.
		$storage = new WPSEO_Link_Storage();
		$storage->cleanup( $post_id );

		// Update link counts for object and referenced links.
		$this->content_processor->update_link_counts( $post_id, 0, $links );
	}

	/**
	 * Checks if the post is processable.
	 *
	 * @param int $post_id The post id.
	 *
	 * @return bool True when the post is processable.
	 */
	protected function is_processable( $post_id ) {
		/*
		 * Do not use the `wpseo_link_count_post_types` because we want to always count the links,
		 * even if we don't show them.
		 */
		$post_types = WPSEO_Post_Type::get_accessible_post_types();

		return isset( $post_types[ get_post_type( $post_id ) ] );
	}

	/**
	 * Processes the content for the given post id.
	 *
	 * @param int    $post_id The post id to process.
	 * @param string $content The content to process.
	 *
	 * @return void
	 */
	private function process( $post_id, $content ) {
		// Apply the filters to have the same content as shown on the frontend.
		$content = apply_filters( 'the_content', $content );
		$content = str_replace( ']]>', ']]&gt;', $content );

		$this->content_processor->process( $post_id, $content );
	}
}
PK     ”T]ÁO3H	  H	  $  links/class-link-type-classifier.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the classifier for a link. Determines of a link is an outbound or internal one.
 */
class WPSEO_Link_Type_Classifier {

	/**
	 * @var string
	 */
	protected $base_host = '';

	/**
	 * @var string
	 */
	protected $base_path = '';

	/**
	 * Constructor setting the base url.
	 *
	 * @param string $base_url The base url to set.
	 */
	public function __construct( $base_url ) {

		$this->base_host = WPSEO_Link_Utils::get_url_part( $base_url, 'host' );

		$base_path = WPSEO_Link_Utils::get_url_part( $base_url, 'path' );
		if ( $base_path ) {
			$this->base_path = trailingslashit( $base_path );
		}
	}

	/**
	 * Determines if the given link is an outbound or an internal link.
	 *
	 * @param string $link The link to classify.
	 *
	 * @return string Returns outbound or internal.
	 */
	public function classify( $link ) {
		$url_parts = wp_parse_url( $link );

		// Because parse_url may return false.
		if ( ! is_array( $url_parts ) ) {
			$url_parts = array();
		}

		if ( $this->contains_protocol( $url_parts ) && $this->is_external_link( $url_parts ) ) {
			return WPSEO_Link::TYPE_EXTERNAL;
		}

		return WPSEO_Link::TYPE_INTERNAL;
	}

	/**
	 * Checks whether a link starts with an HTTP[S] protocol.
	 *
	 * @param array $url_parts The url parts to use.
	 *
	 * @return bool True if the url starts with an https:// or http:// protocol.
	 */
	protected function contains_protocol( array $url_parts ) {
		return isset( $url_parts['scheme'] ) && $url_parts['scheme'] !== null;
	}

	/**
	 * Checks if the link contains the home_url. Returns true if this isn't the case.
	 *
	 * @param array $url_parts The url parts to use.
	 *
	 * @return bool True when the link doesn't contain the home url.
	 */
	protected function is_external_link( array $url_parts ) {
		if ( isset( $url_parts['scheme'] ) && ! in_array( $url_parts['scheme'], array( 'http', 'https' ), true ) ) {
			return true;
		}
		// When the base host is equal to the host.
		if ( isset( $url_parts['host'] ) && $url_parts['host'] !== $this->base_host ) {
			return true;
		}

		// There is no base path.
		if ( empty( $this->base_path ) ) {
			return false;
		}

		// When there is a path.
		if ( isset( $url_parts['path'] ) ) {
			return ( strpos( $url_parts['path'], $this->base_path ) === false );
		}

		return true;
	}
}
PK     ”T]�SÊ‰í   í     links/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T],º¯ÂE  E    links/class-link-notifier.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents the notifier for adding link indexing notification to the dashboard.
 */
class WPSEO_Link_Notifier {

	/**
	 * @var string
	 */
	const NOTIFICATION_ID = 'wpseo-reindex-links';

	/**
	 * Registers all hooks to WordPress.
	 */
	public function register_hooks() {
		if ( filter_input( INPUT_GET, 'page' ) === 'wpseo_dashboard' ) {
			add_action( 'admin_init', array( $this, 'cleanup_notification' ) );
		}

		if ( ! wp_next_scheduled( self::NOTIFICATION_ID ) ) {
			wp_schedule_event( time(), 'daily', self::NOTIFICATION_ID );
		}

		add_action( self::NOTIFICATION_ID, array( $this, 'manage_notification' ) );
	}

	/**
	 * Removes the notification when it is set and the amount of unindexed items is lower than the threshold.
	 */
	public function cleanup_notification() {
		if ( ! $this->has_notification() || $this->requires_notification() ) {
			return;
		}

		$this->remove_notification( $this->get_notification() );
	}

	/**
	 * Adds the notification when it isn't set already and the amount of unindexed items is greater than the set
	 * threshold.
	 */
	public function manage_notification() {
		if ( $this->has_notification() || ! $this->requires_notification() ) {
			return;
		}

		$this->add_notification( $this->get_notification() );
	}

	/**
	 * Checks if the notification has been set already.
	 *
	 * @return bool True when there is a notification.
	 */
	public function has_notification() {
		$notification = Yoast_Notification_Center::get()->get_notification_by_id( self::NOTIFICATION_ID );

		return $notification instanceof Yoast_Notification;
	}

	/**
	 * Adds a notification to the notification center.
	 *
	 * @param Yoast_Notification $notification The notification to add.
	 */
	protected function add_notification( Yoast_Notification $notification ) {
		Yoast_Notification_Center::get()->add_notification( $notification );
	}

	/**
	 * Removes the notification from the notification center.
	 *
	 * @param Yoast_Notification $notification The notification to remove.
	 */
	protected function remove_notification( Yoast_Notification $notification ) {
		Yoast_Notification_Center::get()->remove_notification( $notification );
	}

	/**
	 * Returns an instance of the notification.
	 *
	 * @return Yoast_Notification The notification to show.
	 */
	protected function get_notification() {
		return new Yoast_Notification(
			esc_html__( 'To make sure all the links in your texts are counted, we need to analyze all your texts.', 'wordpress-seo' ) . ' ' .
			esc_html__( 'All you have to do is press the following button and we\'ll go through all your texts for you.', 'wordpress-seo' ) . '<br><br>' .
			'<button type="button" id="noticeRunLinkIndex" class="button">' . esc_html__( 'Count links', 'wordpress-seo' ) . '</button><br><br>' .
			sprintf(
				/* translators: 1: link to yoast.com post about internal linking suggestion. 2: is anchor closing. */
				esc_html__( 'The Text link counter feature provides insights in how many links are found in your text and how many links are referring to your text. This is very helpful when you are improving your %1$sinternal linking%2$s.', 'wordpress-seo' ),
				'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/15m' ) . '" target="_blank">',
				'</a>'
			),
			array(
				'type'         => Yoast_Notification::WARNING,
				'id'           => self::NOTIFICATION_ID,
				'capabilities' => 'wpseo_manage_options',
				'priority'     => 0.8,
			)
		);
	}

	/**
	 * Checks if the unindexed threshold is exceeded.
	 *
	 * @return bool True when the threshold is exceeded.
	 */
	protected function requires_notification() {
		$post_types = apply_filters( 'wpseo_link_count_post_types', WPSEO_Post_Type::get_accessible_post_types() );
		if ( ! is_array( $post_types ) ) {
			return false;
		}

		return WPSEO_Link_Query::has_unprocessed_posts( $post_types );
	}
}
PK     ”T]Áâ¿±›  ›    links/class-link-filter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the filter for filtering links.
 */
class WPSEO_Link_Filter {

	/**
	 * @var string|null
	 */
	protected $current_page_path;

	/**
	 * Sets the current page path.
	 *
	 * @param string $current_page The current page.
	 */
	public function __construct( $current_page = '' ) {
		$this->current_page_path = untrailingslashit( WPSEO_Link_Utils::get_url_part( $current_page, 'path' ) );
	}

	/**
	 * Filters all internal links that contains an fragment in the URL.
	 *
	 * @param WPSEO_Link $link The link that might be filtered.
	 *
	 * @return bool False when url contains a fragment.
	 */
	public function internal_link_with_fragment_filter( WPSEO_Link $link ) {
		// When the type is external.
		if ( $link->get_type() === WPSEO_Link::TYPE_EXTERNAL ) {
			return true;
		}

		$url_parts = wp_parse_url( $link->get_url() );

		if ( isset( $url_parts['path'] ) ) {
			return ! $this->is_current_page( untrailingslashit( $url_parts['path'] ) );
		}

		return ( ! isset( $url_parts['fragment'] ) && ! isset( $url_parts['query'] ) );
	}

	/**
	 * Is the url path the same as the current page path.
	 *
	 * @param string $url_path The url path.
	 *
	 * @return bool True when path is equal to the current page path.
	 */
	protected function is_current_page( $url_path ) {
		return ( ! empty( $url_path ) && $url_path === $this->current_page_path );
	}
}
PK     ”T]œŸ      links/class-link-utils.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the utils for the links module.
 */
class WPSEO_Link_Utils {

	/**
	 * Returns the value that is part of the given url.
	 *
	 * @param string $url  The url to parse.
	 * @param string $part The url part to use.
	 *
	 * @return string The value of the url part.
	 */
	public static function get_url_part( $url, $part ) {
		$url_parts = wp_parse_url( $url );

		if ( isset( $url_parts[ $part ] ) ) {
			return $url_parts[ $part ];
		}

		return '';
	}
}
PK     ”T]é3!ÈÇ  Ç  .  links/class-link-table-accessible-notifier.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the notice when the table is not accessible.
 */
class WPSEO_Link_Table_Accessible_Notifier {

	/**
	 * @var string
	 */
	const NOTIFICATION_ID = 'wpseo-links-table-not-accessible';

	/**
	 * Adds the notification to the notification center.
	 */
	public function add_notification() {
		Yoast_Notification_Center::get()->add_notification( $this->get_notification() );
	}

	/**
	 * Removes the notification from the notification center.
	 */
	public function remove_notification() {
		Yoast_Notification_Center::get()->remove_notification( $this->get_notification() );
	}

	/**
	 * Returns the notification when the table is not accessible.
	 *
	 * @return Yoast_Notification The notification.
	 */
	protected function get_notification() {
		return new Yoast_Notification(
			sprintf(
				/* translators: %1$s: Yoast SEO. %2$s: Version number of Yoast SEO. %3$s: strong opening tag, %4$s: strong closing tag  */
				esc_html__( 'The %3$sText link counter%4$s feature (introduced in %1$s %2$s) is currently disabled.', 'wordpress-seo' ),
				'Yoast SEO',
				'5.0',
				'<strong>',
				'</strong>'
			) . ' ' .
			sprintf(
				/* translators: %1$s: Yoast SEO. */
				esc_html__( 'For this feature to work, %1$s needs to create a table in your database. We were unable to create this table automatically.', 'wordpress-seo' ),
				'Yoast SEO'
			) . '<br><br>' .
			sprintf(
				/* translators: %1$s: link to knowledge base article about solving table issue. %2$s: is anchor closing. */
				esc_html__( 'Please read the following %1$sknowledge base article%2$s to find out how to resolve this problem.', 'wordpress-seo' ),
				'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/15o' ) . '">',
				'</a>'
			),
			array(
				'type'         => Yoast_Notification::WARNING,
				'id'           => self::NOTIFICATION_ID,
				'capabilities' => 'wpseo_manage_options',
				'priority'     => 0.8,
			)
		);
	}
}
PK     ”T]Jh·  ·    links/class-link-extractor.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the link extractor.
 */
class WPSEO_Link_Extractor {

	/**
	 * @var string
	 */
	protected $content;

	/**
	 * Sets the content.
	 *
	 * @param string $content The content to extract the links from.
	 */
	public function __construct( $content ) {
		$this->content = $content;
	}

	/**
	 * Extracts the hrefs from the content and returns them as an array.
	 *
	 * @return array All the extracted links
	 */
	public function extract() {
		$links = array();

		if ( strpos( $this->content, 'href' ) === false ) {
			return $links;
		}

		$regexp = '<a\s[^>]*href=("??)([^" >]*?)\\1[^>]*>';

		// Used modifiers iU to match case insensitive and make greedy quantifiers lazy.
		if ( preg_match_all( "/$regexp/iU", $this->content, $matches, PREG_SET_ORDER ) ) {
			foreach ( $matches as $match ) {
				$links[] = trim( $match[2], "'" );
			}
		}

		return $links;
	}
}
PK     ”T]‡<¸c~  ~  &  links/class-link-reindex-dashboard.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links\Reindex
 */

/**
 * Handles the reindexing of links interface in the Dashboard.
 */
class WPSEO_Link_Reindex_Dashboard {

	/**
	 * Public post types to scan for unprocessed items.
	 *
	 * @var array
	 */
	protected $public_post_types = array();

	/**
	 * Number of unprocessed items.
	 *
	 * @var int
	 */
	protected $unprocessed = 0;

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		if ( ! $this->is_dashboard_page() ) {
			return;
		}

		add_action( 'admin_enqueue_scripts', array( $this, 'calculate_unprocessed' ), 9 );
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ), 10 );

		add_action( 'admin_footer', array( $this, 'modal_box' ), 20 );

		add_action( 'wpseo_tools_overview_list_items', array( $this, 'show_tools_overview_item' ), 10 );
	}

	/**
	 * Calculates the number of unprocessed items per post type.
	 *
	 * @return void
	 */
	public function calculate_unprocessed() {
		$this->public_post_types = apply_filters( 'wpseo_link_count_post_types', WPSEO_Post_Type::get_accessible_post_types() );

		if ( is_array( $this->public_post_types ) && $this->public_post_types !== array() ) {
			$this->unprocessed = WPSEO_Link_Query::get_unprocessed_count( $this->public_post_types );
		}
	}

	/**
	 * Adds an item to the tools page overview list.
	 *
	 * @return void
	 */
	public function show_tools_overview_item() {
		echo '<li>';
		echo '<strong>' . esc_html__( 'Text link counter', 'wordpress-seo' ) . '</strong><br/>';

		if ( ! $this->has_unprocessed() ) {
			echo $this->message_already_indexed();
		}

		if ( $this->has_unprocessed() ) {
			printf( '<span id="reindexLinks">%s</span>', $this->message_start_indexing() );
		}

		echo '</li>';
	}

	/**
	 * Generates the model box.
	 *
	 * @return void
	 */
	public function modal_box() {
		if ( ! $this->is_dashboard_page() ) {
			return;
		}

		// Adding the thickbox.
		add_thickbox();

		$blocks = array();

		if ( ! $this->has_unprocessed() ) {
			$inner_text = sprintf(
				'<p>%s</p>',
				esc_html__( 'All your texts are already counted, there is no need to count them again.', 'wordpress-seo' )
			);
		}

		if ( $this->has_unprocessed() ) {
			$progress = sprintf(
				/* translators: 1: expands to a <span> containing the number of items recalculated. 2: expands to a <strong> containing the total number of items. */
				__( 'Text %1$s of %2$s processed.', 'wordpress-seo' ),
				'<span id="wpseo_count_index_links">0</span>',
				sprintf( '<strong id="wpseo_count_total">%d</strong>', $this->get_unprocessed_count() )
			);

			$inner_text  = '<div id="wpseo_index_links_progressbar" class="wpseo-progressbar"></div>';
			$inner_text .= sprintf( '<p>%s</p>', $progress );
		}

		$blocks[] = sprintf(
			'<div><p>%s</p>%s</div>',
			esc_html__( 'Counting links in your texts', 'wordpress-seo' ),
			$inner_text
		);
		?>
		<div id="wpseo_index_links_wrapper" class="hidden">
			<?php echo implode( '<hr />', $blocks ); ?>
			<button onclick="tb_remove();" type="button"
					class="button"><?php esc_html_e( 'Stop counting', 'wordpress-seo' ); ?></button>
		</div>
		<?php
	}

	/**
	 * Enqueues site wide analysis script.
	 *
	 * @return void
	 */
	public function enqueue() {
		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_script( 'reindex-links' );

		$data = array(
			'amount'  => $this->get_unprocessed_count(),
			'restApi' => array(
				'root'     => esc_url_raw( rest_url() ),
				'endpoint' => WPSEO_Link_Reindex_Post_Endpoint::REST_NAMESPACE . '/' . WPSEO_Link_Reindex_Post_Endpoint::ENDPOINT_QUERY,
				'nonce'    => wp_create_nonce( 'wp_rest' ),
			),
			'message' => array(
				'indexingCompleted' => $this->message_already_indexed(),
			),
			'l10n'    => array(
				'calculationInProgress' => __( 'Calculation in progress...', 'wordpress-seo' ),
				'calculationCompleted'  => __( 'Calculation completed.', 'wordpress-seo' ),
			),
		);

		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'reindex-links', 'yoastReindexLinksData', array( 'data' => $data ) );
	}

	/**
	 * Checks if the current page is the dashboard page.
	 *
	 * @return bool True when current page is the dashboard page.
	 */
	protected function is_dashboard_page() {
		return ( filter_input( INPUT_GET, 'page' ) === 'wpseo_tools' );
	}

	/**
	 * Retrieves the string to display when everything has been indexed.
	 *
	 * @return string The message to show when everything has been indexed.
	 */
	public function message_already_indexed() {
		return '<span class="wpseo-checkmark-ok-icon"></span>' . esc_html__( 'Good job! All the links in your texts have been counted.', 'wordpress-seo' );
	}

	/**
	 * Returns if there are unprocessed items.
	 *
	 * @return bool True if there are unprocessed items.
	 */
	public function has_unprocessed() {
		return $this->unprocessed > 0;
	}

	/**
	 * Returns the number of unprocessed items.
	 *
	 * @return int Number of unprocessed items.
	 */
	public function get_unprocessed_count() {
		return $this->unprocessed;
	}

	/**
	 * Retrieves the message to show starting indexation.
	 *
	 * @return string The message.
	 */
	public function message_start_indexing() {
		return sprintf(
			'<a id="openLinkIndexing" href="#TB_inline?width=600&height=%1$s&inlineId=wpseo_index_links_wrapper" title="%2$s" class="btn button yoast-js-index-links yoast-js-calculate-index-links--all thickbox">%2$s</a>',
			175,
			esc_attr__( 'Count links in your texts', 'wordpress-seo' )
		);
	}

	/* ********************* DEPRECATED METHODS ********************* */

	/**
	 * Add the indexing interface for links to the dashboard.
	 *
	 * @deprecated 7.0
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function add_link_index_interface() {
		_deprecated_function( __METHOD__, 'WPSEO 7.0' );

		$html  = '';
		$html .= '<h2>' . esc_html__( 'Text link counter', 'wordpress-seo' ) . '</h2>';
		$html .= '<p>' . sprintf(
			/* translators: 1: link to yoast.com post about internal linking suggestion. 4: is Yoast.com 3: is anchor closing. */
			__( 'The links in all your public texts need to be counted. This will provide insights of which texts need more links to them. If you want to know more about the why and how of internal linking, check out %1$sthe article about internal linking on %2$s%3$s.', 'wordpress-seo' ),
			'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/15n' ) . '" target="_blank">',
			'Yoast.com',
			'</a>'
		) . '</p>';

		if ( ! $this->has_unprocessed() ) {
			$html .= '<p>' . $this->message_already_indexed() . '</p>';
		}

		if ( $this->has_unprocessed() ) {
			$html .= '<p id="reindexLinks">' . $this->message_start_indexing() . '</p>';
		}

		$html .= '<br />';

		echo $html;
	}
}
PK     ”T]€É}H  H    links/class-link-storage.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the storage of an seo link.
 */
class WPSEO_Link_Storage implements WPSEO_Installable {

	/**
	 * Table name for the link storage.
	 *
	 * @var string
	 */
	const TABLE_NAME = 'yoast_seo_links';

	/**
	 * @var WPSEO_Database_Proxy
	 */
	protected $database_proxy;

	/**
	 * @deprecated 7.4
	 *
	 * @var null|string
	 */
	protected $table_prefix;

	/**
	 * Initializes the database table.
	 *
	 * @param string $table_prefix Optional. Deprecated argument.
	 */
	public function __construct( $table_prefix = null ) {
		if ( $table_prefix !== null ) {
			_deprecated_argument( __METHOD__, 'WPSEO 7.4' );
		}

		$this->database_proxy = new WPSEO_Database_Proxy( $GLOBALS['wpdb'], self::TABLE_NAME, true );
	}

	/**
	 * Returns the table name to use.
	 *
	 * @return string The table name.
	 */
	public function get_table_name() {
		return $this->database_proxy->get_table_name();
	}

	/**
	 * Creates the database table.
	 *
	 * @return boolean True if the table was created, false if something went wrong.
	 */
	public function install() {
		return $this->database_proxy->create_table(
			array(
				'id bigint(20) unsigned NOT NULL AUTO_INCREMENT',
				'url varchar(255) NOT NULL',
				'post_id bigint(20) unsigned NOT NULL',
				'target_post_id bigint(20) unsigned NOT NULL',
				'type VARCHAR(8) NOT NULL',
			),
			array(
				'PRIMARY KEY (id)',
				'KEY link_direction (post_id, type)',
			)
		);
	}

	/**
	 * Returns an array of links from the database.
	 *
	 * @param int $post_id The post to get the links for.
	 *
	 * @return WPSEO_Link[] The links connected to the post.
	 */
	public function get_links( $post_id ) {
		global $wpdb;

		$results = $this->database_proxy->get_results(
			$wpdb->prepare(
				'
				SELECT url, post_id, target_post_id, type
				FROM ' . $this->get_table_name() . '
				WHERE post_id = %d',
				$post_id
			)
		);

		if ( $this->database_proxy->has_error() ) {
			WPSEO_Link_Table_Accessible::set_inaccessible();
		}

		$links = array();
		foreach ( $results as $link ) {
			$links[] = WPSEO_Link_Factory::get_link( $link->url, $link->target_post_id, $link->type );
		}

		return $links;
	}

	/**
	 * Walks the given links to save them.
	 *
	 * @param integer      $post_id The post id to save.
	 * @param WPSEO_Link[] $links   The link to save.
	 *
	 * @return void
	 */
	public function save_links( $post_id, array $links ) {
		array_walk( $links, array( $this, 'save_link' ), $post_id );
	}

	/**
	 * Removes all records for given post_id.
	 *
	 * @param int $post_id The post_id to remove the records for.
	 *
	 * @return int|false The number of rows updated, or false on error.
	 */
	public function cleanup( $post_id ) {
		$is_deleted = $this->database_proxy->delete(
			array( 'post_id' => $post_id ),
			array( '%d' )
		);

		if ( $is_deleted === false ) {
			WPSEO_Link_Table_Accessible::set_inaccessible();
		}

		return $is_deleted;
	}

	/**
	 * Inserts the link into the database.
	 *
	 * @param WPSEO_Link $link     The link to save.
	 * @param int        $link_key The link key. Unused.
	 * @param int        $post_id  The post id to save the link for.
	 *
	 * @return void
	 */
	protected function save_link( WPSEO_Link $link, $link_key, $post_id ) {
		$inserted = $this->database_proxy->insert(
			array(
				'url'            => $link->get_url(),
				'post_id'        => $post_id,
				'target_post_id' => $link->get_target_post_id(),
				'type'           => $link->get_type(),
			),
			array( '%s', '%d', '%d', '%s' )
		);

		if ( $inserted === false ) {
			WPSEO_Link_Table_Accessible::set_inaccessible();
		}
	}
}
PK     ”T]åp§�    *  links/class-link-reindex-post-endpoint.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links\Reindex
 */

/**
 * Class WPSEO_Link_Reindex_Post_Endpoint.
 */
class WPSEO_Link_Reindex_Post_Endpoint {

	/**
	 * @var string
	 */
	const REST_NAMESPACE = 'yoast/v1';

	/**
	 * @var string
	 */
	const ENDPOINT_QUERY = 'reindex_posts';

	/**
	 * @var string
	 */
	const CAPABILITY_RETRIEVE = 'edit_posts';

	/**
	 * @var WPSEO_Link_Reindex_Post_Service
	 */
	protected $service;

	/**
	 * WPSEO_Link_Reindex_Post_Endpoint constructor.
	 *
	 * @param WPSEO_Link_Reindex_Post_Service $service The service to handle the requests to the endpoint.
	 */
	public function __construct( WPSEO_Link_Reindex_Post_Service $service ) {
		$this->service = $service;
	}

	/**
	 * Register the REST endpoint to WordPress.
	 */
	public function register() {
		$route_args = array(
			'methods'             => 'GET',
			'callback'            => array( $this->service, 'reindex' ),
			'permission_callback' => array( $this, 'can_retrieve_data' ),
		);
		register_rest_route( self::REST_NAMESPACE, self::ENDPOINT_QUERY, $route_args );
	}

	/**
	 * Determines if the current user is allowed to use this endpoint.
	 *
	 * @return bool
	 */
	public function can_retrieve_data() {
		return current_user_can( self::CAPABILITY_RETRIEVE );
	}
}

PK     ”T]­€–Öª  ª    links/class-link-factory.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the conversion from array with string links into WPSEO_Link objects.
 */
class WPSEO_Link_Factory {

	/**
	 * @var WPSEO_Link_Type_Classifier
	 */
	protected $classifier;

	/**
	 * @var WPSEO_Link_Internal_Lookup
	 */
	protected $internal_lookup;

	/**
	 * @var WPSEO_Link_Filter
	 */
	protected $filter;

	/**
	 * Sets the dependencies for this object.
	 *
	 * @param WPSEO_Link_Type_Classifier $classifier      The classifier to use.
	 * @param WPSEO_Link_Internal_Lookup $internal_lookup The internal lookup to use.
	 * @param WPSEO_Link_Filter          $filter          The link filter.
	 */
	public function __construct( WPSEO_Link_Type_Classifier $classifier, WPSEO_Link_Internal_Lookup $internal_lookup, WPSEO_Link_Filter $filter ) {
		$this->classifier      = $classifier;
		$this->internal_lookup = $internal_lookup;
		$this->filter          = $filter;
	}

	/**
	 * Formats an array of links to WPSEO_Link object.
	 *
	 * @param array $extracted_links The links for format.
	 *
	 * @return WPSEO_Link[] The formatted links.
	 */
	public function build( array $extracted_links ) {
		$extracted_links = array_map( array( $this, 'build_link' ), $extracted_links );
		$filtered_links  = array_filter(
			$extracted_links,
			array( $this->filter, 'internal_link_with_fragment_filter' )
		);

		return $filtered_links;
	}

	/**
	 * Builds the link.
	 *
	 * @param string $link The link to build.
	 *
	 * @return WPSEO_Link The built link.
	 */
	public function build_link( $link ) {
		$link_type = $this->classifier->classify( $link );

		$target_post_id = 0;
		if ( $link_type === WPSEO_Link::TYPE_INTERNAL ) {
			$target_post_id = $this->internal_lookup->lookup( $link );
		}

		return self::get_link( $link, $target_post_id, $link_type );
	}

	/**
	 * Returns the link object.
	 *
	 * @param string $url            The URL of the link.
	 * @param int    $target_post_id The target post ID.
	 * @param string $type           The link type.
	 *
	 * @return WPSEO_Link Generated link object.
	 */
	public static function get_link( $url, $target_post_id, $type ) {
		return new WPSEO_Link( $url, $target_post_id, $type );
	}
}
PK     ”T]¶ši®    &  links/class-link-content-processor.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the content processor. It will extract links from the content and
 * saves them for the given post id.
 */
class WPSEO_Link_Content_Processor {

	/**
	 * @var WPSEO_Link_Storage
	 */
	protected $storage;

	/**
	 * @var WPSEO_Meta_Storage
	 */
	private $count_storage;

	/**
	 * Sets an instance of a storage object.
	 *
	 * @param WPSEO_Link_Storage $storage       The storage object to use.
	 * @param WPSEO_Meta_Storage $count_storage The storage object for the link
	 *                                          counts.
	 */
	public function __construct( WPSEO_Link_Storage $storage, WPSEO_Meta_Storage $count_storage ) {
		$this->storage       = $storage;
		$this->count_storage = $count_storage;
	}

	/**
	 * Process the content for the given post id.
	 *
	 * @param int    $post_id The post id.
	 * @param string $content The content to process.
	 */
	public function process( $post_id, $content ) {
		$link_extractor = new WPSEO_Link_Extractor( $content );
		$link_processor = new WPSEO_Link_Factory(
			new WPSEO_Link_Type_Classifier( home_url() ),
			new WPSEO_Link_Internal_Lookup(),
			new WPSEO_Link_Filter( get_permalink( $post_id ) )
		);

		$extracted_links = $link_extractor->extract();
		$links           = $link_processor->build( $extracted_links );

		$internal_links = array_filter( $links, array( $this, 'filter_internal_link' ) );

		$stored_links = $this->get_stored_internal_links( $post_id );

		$this->storage->cleanup( $post_id );
		$this->storage->save_links( $post_id, $links );

		$this->update_link_counts( $post_id, count( $internal_links ), array_merge( $stored_links, $internal_links ) );
	}

	/**
	 * Updates the link counts for the post and referenced posts.
	 *
	 * @param int      $post_id Post to update link counts for.
	 * @param int|null $count   Number of internal links.
	 * @param array    $links   Links to process for incoming link count update.
	 */
	public function update_link_counts( $post_id, $count, array $links ) {
		$this->store_internal_link_count( $post_id, $count );
		$this->update_incoming_links( $post_id, $links );
	}

	/**
	 * Retrieves the stored internal links for the supplied post.
	 *
	 * @param int $post_id The post to fetch links for.
	 *
	 * @return WPSEO_Link[] List of internal links connected to the post.
	 */
	public function get_stored_internal_links( $post_id ) {
		$links = $this->storage->get_links( $post_id );
		return array_filter( $links, array( $this, 'filter_internal_link' ) );
	}

	/**
	 * Filters on INTERNAL links.
	 *
	 * @param WPSEO_Link $link Link to test type of.
	 *
	 * @return bool True for internal link, false for external link.
	 */
	protected function filter_internal_link( WPSEO_Link $link ) {
		return $link->get_type() === WPSEO_Link::TYPE_INTERNAL;
	}

	/**
	 * Stores the total links for the post.
	 *
	 * @param int $post_id             The post id.
	 * @param int $internal_link_count Total amount of links in the post.
	 *
	 * @return void
	 */
	protected function store_internal_link_count( $post_id, $internal_link_count ) {
		$this->count_storage->save_meta_data( $post_id, array( 'internal_link_count' => $internal_link_count ) );
	}

	/**
	 * Updates the incoming link count.
	 *
	 * @param int          $post_id Post which is processed, this needs to be recalculated too.
	 * @param WPSEO_Link[] $links   Links to update the incoming link count of.
	 *
	 * @return void
	 */
	protected function update_incoming_links( $post_id, $links ) {
		$post_ids = $this->get_internal_post_ids( $links );
		$post_ids = array_merge( array( $post_id ), $post_ids );
		$this->count_storage->update_incoming_link_count( $post_ids, $this->storage );
	}

	/**
	 * Extract the post IDs from the links.
	 *
	 * @param WPSEO_Link[] $links Links to update the incoming link count of.
	 *
	 * @return int[] List of post IDs.
	 */
	protected function get_internal_post_ids( $links ) {
		$post_ids = array();
		foreach ( $links as $link ) {
			$post_ids[] = $link->get_target_post_id();
		}

		return array_filter( $post_ids );
	}
}
PK     ”T]™¯T%�  �  &  links/class-link-cleanup-transient.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the cleanup logic when the text link counter features has been disabled.
 */
class WPSEO_Link_Cleanup_Transient implements WPSEO_WordPress_Integration {

	/**
	 * Registers the hooks.
	 */
	public function register_hooks() {
		add_action( 'update_option_wpseo', array( $this, 'remove_transients_on_updated_option' ), 10, 2 );
	}

	/**
	 * Removes the transient when the option is updated.
	 *
	 * @param mixed $old_value The old value.
	 * @param mixed $value     The new value.
	 *
	 * @return void
	 */
	public function remove_transients_on_updated_option( $old_value, $value ) {
		$option_name = 'enable_text_link_counter';
		if ( $value[ $option_name ] === false && $old_value[ $option_name ] !== $value[ $option_name ] ) {
			WPSEO_Link_Table_Accessible::cleanup();
			WPSEO_Meta_Table_Accessible::cleanup();
		}
	}
}
PK     ”T]ê%b˜é  é    links/class-link-installer.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents installer for the link module.
 */
class WPSEO_Link_Installer {

	/**
	 * @var WPSEO_Installable[]
	 */
	protected $installables = array();

	/**
	 * Sets the installables.
	 */
	public function __construct() {
		$this->installables = array(
			new WPSEO_Link_Storage(),
			new WPSEO_Meta_Storage(),
		);
	}

	/**
	 * Runs the installation of the link module.
	 */
	public function install() {
		foreach ( $this->get_installables() as $installable ) {
			$installable->install();
		}
	}

	/**
	 * Adds a installable object to the installer.
	 *
	 * @param WPSEO_Installable $installable The installable object.
	 */
	public function add_installable( WPSEO_Installable $installable ) {
		$this->installables[] = $installable;
	}

	/**
	 * Returns the installable objects.
	 *
	 * @return WPSEO_Installable[] The installables to use.
	 */
	protected function get_installables() {
		return $this->installables;
	}
}
PK     ”T]±ßˆ	  	  )  links/class-link-reindex-post-service.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links\Reindex
 */

/**
 * Class WPSEO_Link_Reindex_Post_Service.
 */
class WPSEO_Link_Reindex_Post_Service {

	/**
	 * Reindexes the unprocessed posts by REST request.
	 *
	 * @return WP_REST_Response The response object.
	 */
	public function reindex() {
		return new WP_REST_Response( $this->process_posts() );
	}

	/**
	 * Returns the posts.
	 *
	 * @return int The total amount of unprocessed posts.
	 */
	protected function process_posts() {
		if ( ! $this->is_processable() ) {
			return 0;
		}

		$posts = $this->get_unprocessed_posts();
		array_walk( $posts, array( $this, 'process_post' ) );

		return count( $posts );
	}

	/**
	 * Returns all unprocessed posts.
	 *
	 * @return array The unprocessed posts.
	 */
	protected function get_unprocessed_posts() {
		$post_types = apply_filters( 'wpseo_link_count_post_types', WPSEO_Post_Type::get_accessible_post_types() );
		if ( ! is_array( $post_types ) ) {
			return array();
		}
		return WPSEO_Link_Query::get_unprocessed_posts( $post_types );
	}

	/**
	 * Checks if the required tables are accessible.
	 *
	 * @return bool True when the tables are accessible.
	 */
	protected function is_processable() {
		return WPSEO_Link_Table_Accessible::is_accessible() && WPSEO_Meta_Table_Accessible::is_accessible();
	}

	/**
	 * Processes the post.
	 *
	 * @param stdObject $post The post to process.
	 *
	 * @return void
	 */
	protected function process_post( $post ) {
		// Some plugins might output data, so let's buffer this to prevent wrong responses.
		ob_start();

		// Apply the filters to have the same content as shown on the frontend.
		$content = apply_filters( 'the_content', $post->post_content );
		$content = str_replace( ']]>', ']]&gt;', $content );

		ob_end_clean();

		$content_processor = $this->get_content_processor();
		$content_processor->process( $post->ID, $content );
	}

	/**
	 * Returns an instance of the content processor.
	 *
	 * @return WPSEO_Link_Content_Processor The instance of the link content processor.
	 */
	protected function get_content_processor() {
		static $content_processor;

		if ( $content_processor === null ) {
			$content_processor = new WPSEO_Link_Content_Processor( new WPSEO_Link_Storage(), new WPSEO_Meta_Storage() );
		}

		return $content_processor;
	}
}
PK     ”T]ë¥O`
  
  "  metabox/class-metabox-form-tab.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Generates the HTML for a metabox tab.
 */
class WPSEO_Metabox_Form_Tab implements WPSEO_Metabox_Tab {

	/**
	 * @var string
	 */
	private $name;

	/**
	 * @var string
	 */
	private $content;

	/**
	 * @var string
	 */
	private $link_content;

	/**
	 * @var string
	 */
	private $tab_class;

	/**
	 * @var string
	 */
	private $link_class;

	/**
	 * @var string
	 */
	private $link_title;

	/**
	 * @var string
	 */
	private $link_aria_label;

	/**
	 * @var boolean
	 */
	private $single;

	/**
	 * Constructor.
	 *
	 * @param string $name         The name of the tab, used as an identifier in the html.
	 * @param string $content      The tab content.
	 * @param string $link_content The text content of the tab link.
	 * @param array  $options      Optional link attributes.
	 */
	public function __construct( $name, $content, $link_content, array $options = array() ) {
		$default_options = array(
			'tab_class'       => '',
			'link_class'      => '',
			'link_title'      => '',
			'link_aria_label' => '',
			'single'          => false,
		);

		$options = array_merge( $default_options, $options );

		$this->name            = $name;
		$this->content         = $content;
		$this->link_content    = $link_content;
		$this->tab_class       = $options['tab_class'];
		$this->link_class      = $options['link_class'];
		$this->link_title      = $options['link_title'];
		$this->link_aria_label = $options['link_aria_label'];
		$this->single          = $options['single'];
	}

	/**
	 * Returns the html for the tab link.
	 *
	 * @return string
	 */
	public function link() {

		$html = '<li class="%1$s%2$s"><a class="wpseo_tablink%3$s" href="#wpseo_%1$s"%4$s%5$s>%6$s</a></li>';

		if ( $this->single ) {
			$html = '<li class="%1$s%2$s"><span class="wpseo_tablink%3$s"%4$s%5$s>%6$s</span></li>';
		}

		return sprintf(
			$html,
			esc_attr( $this->name ),
			( '' !== $this->tab_class ) ? ' ' . esc_attr( $this->tab_class ) : '',
			( '' !== $this->link_class ) ? ' ' . esc_attr( $this->link_class ) : '',
			( '' !== $this->link_title ) ? ' title="' . esc_attr( $this->link_title ) . '"' : '',
			( '' !== $this->link_aria_label ) ? ' aria-label="' . esc_attr( $this->link_aria_label ) . '"' : '',
			$this->link_content
		);
	}

	/**
	 * Returns the html for the tab content.
	 *
	 * @return string
	 */
	public function content() {
		return sprintf(
			'<div id="%1$s" class="wpseotab %2$s">%3$s</div>',
			esc_attr( 'wpseo_' . $this->name ),
			esc_attr( $this->name ),
			$this->content
		);
	}
}
PK     ”T]é?tb)	  )	  '  metabox/class-metabox-section-react.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Generates and displays the React root element for a metabox section.
 */
class WPSEO_Metabox_Section_React implements WPSEO_Metabox_Section {

	/**
	 * Name of the section, used as an identifier in the HTML.
	 *
	 * @var string
	 */
	public $name;

	/**
	 * Content to use before the React root node.
	 *
	 * @var string
	 */
	public $content;

	/**
	 * Content to use to display the button to open this content block.
	 *
	 * @var string
	 */
	private $link_content;

	/**
	 * Class to add to the link.
	 *
	 * @var string
	 */
	private $link_class;

	/**
	 * Aria label to use for the link.
	 *
	 * @var string
	 */
	private $link_aria_label;

	/**
	 * Constructor.
	 *
	 * @param string $name         The name of the section, used as an identifier in the html.
	 *                             Can only contain URL safe characters.
	 * @param string $link_content The text content of the section link.
	 * @param string $content      Optional. Content to use above the React root element.
	 * @param array  $options      Optional link attributes.
	 */
	public function __construct( $name, $link_content, $content = '', array $options = array() ) {
		$this->name    = $name;
		$this->content = $content;

		$default_options = array(
			'link_class'      => '',
			'link_aria_label' => '',
		);

		$options = wp_parse_args( $options, $default_options );

		$this->link_content    = $link_content;
		$this->link_class      = $options['link_class'];
		$this->link_aria_label = $options['link_aria_label'];
	}

	/**
	 * Outputs the section link.
	 *
	 * @return void
	 */
	public function display_link() {
		printf(
			'<li><a href="#wpseo-meta-section-%1$s" class="wpseo-meta-section-link %2$s"%3$s>%4$s</a></li>',
			esc_attr( $this->name ),
			esc_attr( $this->link_class ),
			( '' !== $this->link_aria_label ) ? ' aria-label="' . esc_attr( $this->link_aria_label ) . '"' : '',
			$this->link_content
		);
	}

	/**
	 * Outputs the section content.
	 *
	 * @return void
	 */
	public function display_content() {
		$html  = sprintf( '<div id="%1$s" class="wpseo-meta-section">', esc_attr( 'wpseo-meta-section-' . $this->name ) );
		$html .= $this->content;
		$html .= '<div id="wpseo-metabox-root" class="wpseo-metabox-root"></div>';
		$html .= '</div>';

		echo $html;
	}
}
PK     ”T]¾·ÁŸ  Ÿ  "  metabox/class-metabox-null-tab.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Generates the HTML for a metabox tab.
 */
class WPSEO_Metabox_Null_Tab implements WPSEO_Metabox_Tab {

	/**
	 * Returns the html for the tab link.
	 *
	 * @return string
	 */
	public function link() {
		return null;
	}

	/**
	 * Returns the html for the tab content.
	 *
	 * @return string
	 */
	public function content() {
		return null;
	}
}
PK     ”T]Á+°¡  ¡  .  metabox/class-metabox-analysis-readability.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Metabox
 */

/**
 * Represents the readability analysis.
 */
class WPSEO_Metabox_Analysis_Readability implements WPSEO_Metabox_Analysis {

	/**
	 * Whether this analysis is enabled.
	 *
	 * @return bool Whether or not this analysis is enabled.
	 */
	public function is_enabled() {
		return $this->is_globally_enabled() && $this->is_user_enabled();
	}

	/**
	 * Whether or not this analysis is enabled by the user.
	 *
	 * @return bool Whether or not this analysis is enabled by the user.
	 */
	public function is_user_enabled() {
		return ! get_the_author_meta( 'wpseo_content_analysis_disable', get_current_user_id() );
	}

	/**
	 * Whether or not this analysis is enabled globally.
	 *
	 * @return bool Whether or not this analysis is enabled globally.
	 */
	public function is_globally_enabled() {
		return WPSEO_Options::get( 'content_analysis_active', true );
	}
}
PK     ”T]&œ²Ô‘  ‘  &  metabox/class-metabox-analysis-seo.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Metabox
 */

/**
 * Represents the SEO analysis.
 */
class WPSEO_Metabox_Analysis_SEO implements WPSEO_Metabox_Analysis {

	/**
	 * Whether this analysis is enabled.
	 *
	 * @return bool Whether or not this analysis is enabled.
	 */
	public function is_enabled() {
		return $this->is_globally_enabled() && $this->is_user_enabled();
	}

	/**
	 * Whether or not this analysis is enabled by the user.
	 *
	 * @return bool Whether or not this analysis is enabled by the user.
	 */
	public function is_user_enabled() {
		return ! get_the_author_meta( 'wpseo_keyword_analysis_disable', get_current_user_id() );
	}

	/**
	 * Whether or not this analysis is enabled globally.
	 *
	 * @return bool Whether or not this analysis is enabled globally.
	 */
	public function is_globally_enabled() {
		return WPSEO_Options::get( 'keyword_analysis_active', true );
	}
}
PK     ”T]�SÊ‰í   í     metabox/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]ƒÁ‹X@  @  %  metabox/interface-metabox-section.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Generates and displays the HTML for a metabox section.
 */
interface WPSEO_Metabox_Section {

	/**
	 * Outputs the section link.
	 */
	public function display_link();

	/**
	 * Outputs the section content.
	 */
	public function display_content();
}
PK     ”T]s6RA[  [  !  metabox/interface-metabox-tab.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Generates the HTML for a metabox tab.
 */
interface WPSEO_Metabox_Tab {

	/**
	 * Returns the html for the tab link.
	 *
	 * @return string
	 */
	public function link();

	/**
	 * Returns the html for the tab content.
	 *
	 * @return string
	 */
	public function content();
}
PK     ”T]èO±[·  ·  &  metabox/interface-metabox-analysis.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Metabox
 */

/**
 * Describes an interface for an analysis that can either be enabled or disabled.
 */
interface WPSEO_Metabox_Analysis {

	/**
	 * Whether this analysis is enabled.
	 *
	 * @return bool Whether or not this analysis is enabled.
	 */
	public function is_enabled();

	/**
	 * Whether or not this analysis is enabled by the user.
	 *
	 * @return bool Whether or not this analysis is enabled by the user.
	 */
	public function is_user_enabled();

	/**
	 * Whether or not this analysis is enabled globally.
	 *
	 * @return bool Whether or not this analysis is enabled globally.
	 */
	public function is_globally_enabled();
}
PK     ”T].�±a¢  ¢  '  metabox/class-metabox-addon-section.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Generates and displays a section containing metabox tabs that have been added by other plugins through the
 * `wpseo_tab_header` and `wpseo_tab_content` actions.
 */
class WPSEO_Metabox_Addon_Tab_Section extends WPSEO_Metabox_Tab_Section {

	/**
	 * Applies the actions for adding a tab to the metabox.
	 */
	public function display_content() {
		?>
		<div id="wpseo-meta-section-addons" class="wpseo-meta-section">
			<div class="wpseo-metabox-tabs-div">
				<ul class="wpseo-metabox-tabs">
					<?php do_action( 'wpseo_tab_header' ); ?>
				</ul>
				<?php do_action( 'wpseo_tab_content' ); ?>
			</div>
		</div>
		<?php
	}

	/**
	 * `WPSEO_Metabox_Addon_Section` always has "tabs", represented by registered actions. If this is not the case,
	 * it should not be instantiated.
	 *
	 * @return bool
	 */
	protected function has_tabs() {
		return true;
	}
}
PK     ”T]þY1ÑU  U     metabox/class-metabox-editor.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Metabox
 */

/**
 * Handles all things with the metabox in combination with the WordPress editor.
 */
class WPSEO_Metabox_Editor {

	/**
	 * Registers hooks to WordPress.
	 *
	 * @codeCoverageIgnore
	 */
	public function register_hooks() {
		add_filter( 'mce_css', array( $this, 'add_css_inside_editor' ) );
		add_filter( 'tiny_mce_before_init', array( $this, 'add_custom_element' ) );
	}

	/**
	 * Adds our inside the editor CSS file to the list of CSS files to be loaded inside the editor.
	 *
	 * @param string $css_files The CSS files that WordPress wants to load inside the editor.
	 * @return string The CSS files WordPress wants to load and our CSS file.
	 */
	public function add_css_inside_editor( $css_files ) {
		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$styles        = $asset_manager->special_styles();
		/** @var WPSEO_Admin_Asset $inside_editor */
		$inside_editor = $styles['inside-editor'];

		$asset_location = new WPSEO_Admin_Asset_SEO_Location( WPSEO_FILE );
		$url            = $asset_location->get_url( $inside_editor, WPSEO_Admin_Asset::TYPE_CSS );

		if ( '' === $css_files ) {
			$css_files = $url;
		}
		else {
			$css_files .= ',' . $url;
		}

		return $css_files;
	}

	/**
	 * Adds a custom element to the tinyMCE editor that we need for marking the content.
	 *
	 * @param array $tinymce_config The tinyMCE config as configured by WordPress.
	 *
	 * @return array The new tinyMCE config with our added custom elements.
	 */
	public function add_custom_element( $tinymce_config ) {
		if ( ! empty( $tinymce_config['custom_elements'] ) ) {
			$custom_elements = $tinymce_config['custom_elements'];

			$custom_elements .= ',~yoastmark';
		}
		else {
			$custom_elements = '~yoastmark';
		}

		$tinymce_config['custom_elements'] = $custom_elements;

		return $tinymce_config;
	}
}
PK     ”T]HXb4“‡  “‡    metabox/class-metabox.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class generates the metabox on the edit post / page as well as contains all page analysis functionality.
 */
class WPSEO_Metabox extends WPSEO_Meta {

	/**
	 * @var WPSEO_Social_Admin
	 */
	protected $social_admin;

	/**
	 * @var WPSEO_Metabox_Analysis_SEO
	 */
	protected $analysis_seo;

	/**
	 * @var WPSEO_Metabox_Analysis_Readability
	 */
	protected $analysis_readability;

	/**
	 * The metabox editor object.
	 *
	 * @var WPSEO_Metabox_Editor
	 */
	protected $editor;

	/**
	 * Class constructor.
	 */
	public function __construct() {
		add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
		add_action( 'wp_insert_post', array( $this, 'save_postdata' ) );
		add_action( 'edit_attachment', array( $this, 'save_postdata' ) );
		add_action( 'add_attachment', array( $this, 'save_postdata' ) );
		add_action( 'admin_init', array( $this, 'translate_meta_boxes' ) );

		// Check if one of the social settings is checked in the options, if so, initialize the social_admin object.
		if ( WPSEO_Options::get( 'opengraph', false ) || WPSEO_Options::get( 'twitter', false ) ) {
			$this->social_admin = new WPSEO_Social_Admin();
		}

		$this->editor = new WPSEO_Metabox_Editor();
		$this->editor->register_hooks();

		$this->analysis_seo         = new WPSEO_Metabox_Analysis_SEO();
		$this->analysis_readability = new WPSEO_Metabox_Analysis_Readability();
	}

	/**
	 * Translate text strings for use in the meta box.
	 *
	 * IMPORTANT: if you want to add a new string (option) somewhere, make sure you add that array key to
	 * the main meta box definition array in the class WPSEO_Meta() as well!!!!
	 */
	public static function translate_meta_boxes() {
		WPSEO_Meta::$meta_fields['general']['title']['title'] = __( 'SEO title', 'wordpress-seo' );

		WPSEO_Meta::$meta_fields['general']['metadesc']['title'] = __( 'Meta description', 'wordpress-seo' );

		/* translators: %s expands to the post type name. */
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-noindex']['title'] = __( 'Allow search engines to show this %s in search results?', 'wordpress-seo' );
		if ( '0' === (string) get_option( 'blog_public' ) ) {
			WPSEO_Meta::$meta_fields['advanced']['meta-robots-noindex']['description'] = '<p class="error-message">' . __( 'Warning: even though you can set the meta robots setting here, the entire site is set to noindex in the sitewide privacy settings, so these settings won\'t have an effect.', 'wordpress-seo' ) . '</p>';
		}
		/* translators: %1$s expands to Yes or No,  %2$s expands to the post type name.*/
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-noindex']['options']['0'] = __( 'Default for %2$s, currently: %1$s', 'wordpress-seo' );
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-noindex']['options']['2'] = __( 'Yes', 'wordpress-seo' );
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-noindex']['options']['1'] = __( 'No', 'wordpress-seo' );

		/* translators: %1$s expands to the post type name.*/
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-nofollow']['title']        = __( 'Should search engines follow links on this %1$s?', 'wordpress-seo' );
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-nofollow']['options']['0'] = __( 'Yes', 'wordpress-seo' );
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-nofollow']['options']['1'] = __( 'No', 'wordpress-seo' );

		WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['title']       = __( 'Meta robots advanced', 'wordpress-seo' );
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['description'] = __( 'Advanced <code>meta</code> robots settings for this page.', 'wordpress-seo' );
		/* translators: %s expands to the advanced robots settings default as set in the site-wide settings.*/
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['-']            = __( 'Site-wide default: %s', 'wordpress-seo' );
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['none']         = __( 'None', 'wordpress-seo' );
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['noimageindex'] = __( 'No Image Index', 'wordpress-seo' );
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['noarchive']    = __( 'No Archive', 'wordpress-seo' );
		WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['nosnippet']    = __( 'No Snippet', 'wordpress-seo' );

		WPSEO_Meta::$meta_fields['advanced']['bctitle']['title']       = __( 'Breadcrumbs Title', 'wordpress-seo' );
		WPSEO_Meta::$meta_fields['advanced']['bctitle']['description'] = __( 'Title to use for this page in breadcrumb paths', 'wordpress-seo' );

		WPSEO_Meta::$meta_fields['advanced']['canonical']['title'] = __( 'Canonical URL', 'wordpress-seo' );

		WPSEO_Meta::$meta_fields['advanced']['canonical']['description'] = sprintf(
			/* translators: 1: link open tag; 2: link close tag. */
			__( 'The canonical URL that this page should point to. Leave empty to default to permalink. %1$sCross domain canonical%2$s supported too.', 'wordpress-seo' ),
			'<a href="https://googlewebmastercentral.blogspot.com/2009/12/handling-legitimate-cross-domain.html" target="_blank" rel="noopener">',
			WPSEO_Admin_Utils::get_new_tab_message() . '</a>'
		);

		WPSEO_Meta::$meta_fields['advanced']['redirect']['title']       = __( '301 Redirect', 'wordpress-seo' );
		WPSEO_Meta::$meta_fields['advanced']['redirect']['description'] = __( 'The URL that this page should redirect to.', 'wordpress-seo' );

		do_action( 'wpseo_tab_translate' );
	}

	/**
	 * Determines whether the metabox should be shown for the passed identifier.
	 *
	 * By default the check is done for post types, but can also be used for taxonomies.
	 *
	 * @param string|null $identifier The identifier to check.
	 * @param string      $type       The type of object to check. Defaults to post_type.
	 *
	 * @return bool Whether or not the metabox should be displayed.
	 */
	public function display_metabox( $identifier = null, $type = 'post_type' ) {
		return WPSEO_Utils::is_metabox_active( $identifier, $type );
	}

	/**
	 * Adds the Yoast SEO meta box to the edit boxes in the edit post, page,
	 * attachment, and custom post types pages.
	 *
	 * @return void
	 */
	public function add_meta_box() {
		$post_types = WPSEO_Post_Type::get_accessible_post_types();
		$post_types = array_filter( $post_types, array( $this, 'display_metabox' ) );

		if ( ! is_array( $post_types ) || $post_types === array() ) {
			return;
		}

		$product_title = $this->get_product_title();

		$this->register_helpcenter_tab();

		foreach ( $post_types as $post_type ) {
			add_filter( "postbox_classes_{$post_type}_wpseo_meta", array( $this, 'wpseo_metabox_class' ) );

			add_meta_box(
				'wpseo_meta',
				$product_title,
				array( $this, 'meta_box' ),
				$post_type,
				'normal',
				apply_filters( 'wpseo_metabox_prio', 'high' ),
				array( '__block_editor_compatible_meta_box' => true )
			);
		}
	}

	/**
	 * Adds CSS classes to the meta box.
	 *
	 * @param array $classes An array of postbox CSS classes.
	 *
	 * @return array List of classes that will be applied to the editbox container.
	 */
	public function wpseo_metabox_class( $classes ) {
		$classes[] = 'yoast wpseo-metabox';

		return $classes;
	}

	/**
	 * Pass variables to js for use with the post-scraper.
	 *
	 * @return array
	 */
	public function localize_post_scraper_script() {
		$post      = $this->get_metabox_post();
		$permalink = '';

		if ( is_object( $post ) ) {
			$permalink = get_sample_permalink( $post->ID );
			$permalink = $permalink[0];
		}

		$post_formatter = new WPSEO_Metabox_Formatter(
			new WPSEO_Post_Metabox_Formatter( $post, array(), $permalink )
		);

		$values = $post_formatter->get_values();

		/** This filter is documented in admin/filters/class-cornerstone-filter.php. */
		$post_types = apply_filters( 'wpseo_cornerstone_post_types', WPSEO_Post_Type::get_accessible_post_types() );
		if ( $values['cornerstoneActive'] && ! in_array( $post->post_type, $post_types, true ) ) {
			$values['cornerstoneActive'] = false;
		}

		return $values;
	}

	/**
	 * Pass some variables to js for replacing variables.
	 */
	public function localize_replace_vars_script() {
		return array(
			'no_parent_text'           => __( '(no parent)', 'wordpress-seo' ),
			'replace_vars'             => $this->get_replace_vars(),
			'recommended_replace_vars' => $this->get_recommended_replace_vars(),
			'scope'                    => $this->determine_scope(),
			'has_taxonomies'           => $this->current_post_type_has_taxonomies(),
		);
	}

	/**
	 * Determines whether or not the current post type has registered taxonomies.
	 *
	 * @return bool Whether the current post type has taxonomies.
	 */
	private function current_post_type_has_taxonomies() {
		$post_taxonomies = get_object_taxonomies( get_post_type() );

		return ! empty( $post_taxonomies );
	}

	/**
	 * Determines the scope based on the post type.
	 * This can be used by the replacevar plugin to determine if a replacement needs to be executed.
	 *
	 * @return string String describing the current scope.
	 */
	private function determine_scope() {
		$post_type = get_post_type( $this->get_metabox_post() );

		if ( $post_type === 'page' ) {
			return 'page';
		}

		return 'post';
	}

	/**
	 * Pass some variables to js for the edit / post page overview, etc.
	 *
	 * @return array
	 */
	public function localize_shortcode_plugin_script() {
		return array(
			'wpseo_filter_shortcodes_nonce' => wp_create_nonce( 'wpseo-filter-shortcodes' ),
			'wpseo_shortcode_tags'          => $this->get_valid_shortcode_tags(),
		);
	}

	/**
	 * Output a tab in the Yoast SEO Metabox.
	 *
	 * @param string $id      CSS ID of the tab.
	 * @param string $heading Heading for the tab.
	 * @param string $content Content of the tab. This content should be escaped.
	 */
	public function do_tab( $id, $heading, $content ) {
		?>
		<div id="<?php echo esc_attr( 'wpseo_' . $id ); ?>" class="wpseotab <?php echo esc_attr( $id ); ?>">
			<?php echo $content; ?>
		</div>
		<?php
	}

	/**
	 * Output the meta box.
	 */
	public function meta_box() {
		$content_sections = $this->get_content_sections();

		echo '<div class="wpseo-metabox-content">';
		echo '<div class="wpseo-metabox-sidebar"><ul>';

		foreach ( $content_sections as $content_section ) {
			if ( $content_section->name === 'premium' ) {
				continue;
			}

			$content_section->display_link();
		}

		echo '</ul></div>';

		foreach ( $content_sections as $content_section ) {
			$content_section->display_content();
		}

		echo '</div>';
	}

	/**
	 * Returns the relevant metabox sections for the current view.
	 *
	 * @return WPSEO_Metabox_Section[]
	 */
	private function get_content_sections() {
		$content_sections = array();

		$content_sections[] = $this->get_content_meta_section();

		// Check if social_admin is an instance of WPSEO_Social_Admin.
		if ( $this->social_admin instanceof WPSEO_Social_Admin ) {
			$content_sections[] = $this->social_admin->get_meta_section();
		}

		if ( WPSEO_Capability_Utils::current_user_can( 'wpseo_edit_advanced_metadata' ) || WPSEO_Options::get( 'disableadvanced_meta' ) === false ) {
			$content_sections[] = $this->get_advanced_meta_section();
		}

		if ( has_action( 'wpseo_tab_header' ) || has_action( 'wpseo_tab_content' ) ) {
			$content_sections[] = $this->get_addons_meta_section();
		}

		return $content_sections;
	}

	/**
	 * Returns the metabox section for the content analysis.
	 *
	 * @return WPSEO_Metabox_Section
	 */
	private function get_content_meta_section() {
		wp_nonce_field( 'yoast_free_metabox', 'yoast_free_metabox_nonce' );

		$content = $this->get_tab_content( 'general' );

		/**
		 * Filter: 'wpseo_content_meta_section_content' - Allow filtering the metabox content before outputting.
		 *
		 * @api string $post_content The metabox content string.
		 */
		$content = apply_filters( 'wpseo_content_meta_section_content', $content );

		return new WPSEO_Metabox_Section_React(
			'content',
			'<span class="screen-reader-text">' . __( 'Content optimization', 'wordpress-seo' ) . '</span><span class="yst-traffic-light-container">' . WPSEO_Utils::traffic_light_svg() . '</span>',
			$content,
			array(
				'link_aria_label' => __( 'Content optimization', 'wordpress-seo' ),
				'link_class'      => 'yoast-tooltip yoast-tooltip-e',
			)
		);
	}

	/**
	 * Returns the metabox section for the advanced settings.
	 *
	 * @return WPSEO_Metabox_Section
	 */
	private function get_advanced_meta_section() {
		$content = $this->get_tab_content( 'advanced' );

		$tab = new WPSEO_Metabox_Form_Tab(
			'advanced',
			$content,
			__( 'Advanced', 'wordpress-seo' ),
			array( 'single' => true )
		);

		return new WPSEO_Metabox_Tab_Section(
			'advanced',
			'<span class="screen-reader-text">' . __( 'Advanced', 'wordpress-seo' ) . '</span><span class="dashicons dashicons-admin-generic"></span>',
			array( $tab ),
			array(
				'link_aria_label' => __( 'Advanced', 'wordpress-seo' ),
				'link_class'      => 'yoast-tooltip yoast-tooltip-e',
			)
		);
	}

	/**
	 * Returns a metabox section dedicated to hosting metabox tabs that have been added by other plugins through the
	 * `wpseo_tab_header` and `wpseo_tab_content` actions.
	 *
	 * @return WPSEO_Metabox_Section
	 */
	private function get_addons_meta_section() {
		return new WPSEO_Metabox_Addon_Tab_Section(
			'addons',
			'<span class="screen-reader-text">' . __( 'Add-ons', 'wordpress-seo' ) . '</span><span class="dashicons dashicons-admin-plugins"></span>',
			array(),
			array(
				'link_aria_label' => __( 'Add-ons', 'wordpress-seo' ),
				'link_class'      => 'yoast-tooltip yoast-tooltip-e',
			)
		);
	}

	/**
	 * Retrieves the contents for the metabox tab.
	 *
	 * @param string $tab_name Tab for which to retrieve the field definitions.
	 *
	 * @return string
	 */
	private function get_tab_content( $tab_name ) {
		$content = '';
		foreach ( WPSEO_Meta::get_meta_field_defs( $tab_name ) as $key => $meta_field ) {
			$content .= $this->do_meta_box( $meta_field, $key );
		}

		return $content;
	}

	/**
	 * Adds a line in the meta box.
	 *
	 * @todo [JRF] Check if $class is added appropriately everywhere.
	 *
	 * @param array  $meta_field_def Contains the vars based on which output is generated.
	 * @param string $key            Internal key (without prefix).
	 *
	 * @return string
	 */
	public function do_meta_box( $meta_field_def, $key = '' ) {
		$content      = '';
		$esc_form_key = esc_attr( WPSEO_Meta::$form_prefix . $key );
		$meta_value   = WPSEO_Meta::get_value( $key, $this->get_metabox_post()->ID );

		$class = '';
		if ( isset( $meta_field_def['class'] ) && $meta_field_def['class'] !== '' ) {
			$class = ' ' . $meta_field_def['class'];
		}

		$placeholder = '';
		if ( isset( $meta_field_def['placeholder'] ) && $meta_field_def['placeholder'] !== '' ) {
			$placeholder = $meta_field_def['placeholder'];
		}

		$aria_describedby = '';
		$description      = '';
		if ( isset( $meta_field_def['description'] ) ) {
			$aria_describedby = ' aria-describedby="' . $esc_form_key . '-desc"';
			$description      = '<p id="' . $esc_form_key . '-desc" class="yoast-metabox__description">' . $meta_field_def['description'] . '</p>';
		}

		switch ( $meta_field_def['type'] ) {
			case 'text':
				$ac = '';
				if ( isset( $meta_field_def['autocomplete'] ) && $meta_field_def['autocomplete'] === false ) {
					$ac = 'autocomplete="off" ';
				}
				if ( $placeholder !== '' ) {
					$placeholder = ' placeholder="' . esc_attr( $placeholder ) . '"';
				}
				$content .= '<input type="text"' . $placeholder . ' id="' . $esc_form_key . '" ' . $ac . 'name="' . $esc_form_key . '" value="' . esc_attr( $meta_value ) . '" class="large-text' . $class . '"' . $aria_describedby . '/>';
				break;

			case 'textarea':
				$rows = 3;
				if ( isset( $meta_field_def['rows'] ) && $meta_field_def['rows'] > 0 ) {
					$rows = $meta_field_def['rows'];
				}
				$content .= '<textarea class="large-text' . $class . '" rows="' . esc_attr( $rows ) . '" id="' . $esc_form_key . '" name="' . $esc_form_key . '"' . $aria_describedby . '>' . esc_textarea( $meta_value ) . '</textarea>';
				break;

			case 'hidden':
				$content .= '<input type="hidden" id="' . $esc_form_key . '" name="' . $esc_form_key . '" value="' . esc_attr( $meta_value ) . '"/>' . "\n";
				break;
			case 'select':
				if ( isset( $meta_field_def['options'] ) && is_array( $meta_field_def['options'] ) && $meta_field_def['options'] !== array() ) {
					$content .= '<select name="' . $esc_form_key . '" id="' . $esc_form_key . '" class="yoast' . $class . '">';
					foreach ( $meta_field_def['options'] as $val => $option ) {
						$selected = selected( $meta_value, $val, false );
						$content .= '<option ' . $selected . ' value="' . esc_attr( $val ) . '">' . esc_html( $option ) . '</option>';
					}
					unset( $val, $option, $selected );
					$content .= '</select>';
				}
				break;

			case 'multiselect':
				if ( isset( $meta_field_def['options'] ) && is_array( $meta_field_def['options'] ) && $meta_field_def['options'] !== array() ) {

					// Set $meta_value as $selected_arr.
					$selected_arr = $meta_value;

					// If the multiselect field is 'meta-robots-adv' we should explode on ,.
					if ( 'meta-robots-adv' === $key ) {
						$selected_arr = explode( ',', $meta_value );
					}

					if ( ! is_array( $selected_arr ) ) {
						$selected_arr = (array) $selected_arr;
					}

					$options_count = count( $meta_field_def['options'] );

					// This select now uses Select2.
					$content .= '<select multiple="multiple" size="' . esc_attr( $options_count ) . '" name="' . $esc_form_key . '[]" id="' . $esc_form_key . '" class="yoast' . $class . '"' . $aria_describedby . '>';
					foreach ( $meta_field_def['options'] as $val => $option ) {
						$selected = '';
						if ( in_array( $val, $selected_arr, true ) ) {
							$selected = ' selected="selected"';
						}
						$content .= '<option ' . $selected . ' value="' . esc_attr( $val ) . '">' . esc_html( $option ) . '</option>';
					}
					$content .= '</select>';
					unset( $val, $option, $selected, $selected_arr, $options_count );
				}
				break;

			case 'checkbox':
				$checked  = checked( $meta_value, 'on', false );
				$expl     = ( isset( $meta_field_def['expl'] ) ) ? esc_html( $meta_field_def['expl'] ) : '';
				$content .= '<input type="checkbox" id="' . $esc_form_key . '" name="' . $esc_form_key . '" ' . $checked . ' value="on" class="yoast' . $class . '"' . $aria_describedby . '/> <label for="' . $esc_form_key . '">' . $expl . '</label>';
				unset( $checked, $expl );
				break;

			case 'radio':
				if ( isset( $meta_field_def['options'] ) && is_array( $meta_field_def['options'] ) && $meta_field_def['options'] !== array() ) {
					foreach ( $meta_field_def['options'] as $val => $option ) {
						$checked  = checked( $meta_value, $val, false );
						$content .= '<input type="radio" ' . $checked . ' id="' . $esc_form_key . '_' . esc_attr( $val ) . '" name="' . $esc_form_key . '" value="' . esc_attr( $val ) . '"/> <label for="' . $esc_form_key . '_' . esc_attr( $val ) . '">' . esc_html( $option ) . '</label> ';
					}
					unset( $val, $option, $checked );
				}
				break;

			case 'upload':
				$content .= '<input' .
					' id="' . $esc_form_key . '"' .
					' type="text"' .
					' size="36"' .
					' class="' . $class . '"' .
					' name="' . $esc_form_key . '"' .
					' value="' . esc_attr( $meta_value ) . '"' . $aria_describedby .
					' readonly="readonly"' .
					' />';
				$content .= '<input' .
					' id="' . esc_attr( $esc_form_key ) . '_button"' .
					' class="wpseo_image_upload_button button"' .
					' data-target="' . esc_attr( $esc_form_key ) . '"' .
					' data-target-id="' . esc_attr( $esc_form_key ) . '-id"' .
					' type="button"' .
					' value="' . esc_attr__( 'Upload Image', 'wordpress-seo' ) . '"' .
					' /> ';
				$content .= '<input' .
					' class="wpseo_image_remove_button button"' .
					' type="button"' .
					' value="' . esc_attr__( 'Clear Image', 'wordpress-seo' ) . '"' .
					' />';
				break;
		}

		$html = '';
		if ( $content === '' ) {
			$content = apply_filters( 'wpseo_do_meta_box_field_' . $key, $content, $meta_value, $esc_form_key, $meta_field_def, $key );
		}

		if ( $content !== '' ) {

			$title = esc_html( $meta_field_def['title'] );

			// By default, use the field title as a label element.
			$label = '<label for="' . $esc_form_key . '">' . $title . '</label>';

			// Set the inline help and help panel, if any.
			$help_button = '';
			$help_panel  = '';
			if ( isset( $meta_field_def['help'] ) && $meta_field_def['help'] !== '' ) {
				$help        = new WPSEO_Admin_Help_Panel( $key, $meta_field_def['help-button'], $meta_field_def['help'] );
				$help_button = $help->get_button_html();
				$help_panel  = $help->get_panel_html();
			}

			// If it's a set of radio buttons, output proper fieldset and legend.
			if ( 'radio' === $meta_field_def['type'] ) {
				return '<fieldset><legend>' . $title . '</legend>' . $help_button . $help_panel . $content . $description . '</fieldset>';
			}

			// If it's a single checkbox, ignore the title.
			if ( 'checkbox' === $meta_field_def['type'] ) {
				$label = '';
			}

			// Other meta box content or form fields.
			if ( $meta_field_def['type'] === 'hidden' ) {
				$html = $content;
			}
			else {
				$html = $label . $help_button . $help_panel . $content . $description;
			}
		}

		return $html;
	}

	/**
	 * Save the WP SEO metadata for posts.
	 *
	 * {@internal $_POST parameters are validated via sanitize_post_meta().}}
	 *
	 * @param int $post_id Post ID.
	 *
	 * @return bool|void Boolean false if invalid save post request.
	 */
	public function save_postdata( $post_id ) {
		// Bail if this is a multisite installation and the site has been switched.
		if ( is_multisite() && ms_is_switched() ) {
			return false;
		}

		if ( $post_id === null ) {
			return false;
		}

		if ( ! isset( $_POST['yoast_free_metabox_nonce'] ) || ! wp_verify_nonce( $_POST['yoast_free_metabox_nonce'], 'yoast_free_metabox' ) ) {
			return false;
		}

		if ( wp_is_post_revision( $post_id ) ) {
			$post_id = wp_is_post_revision( $post_id );
		}

		/**
		 * Determine we're not accidentally updating a different post.
		 * We can't use filter_input here as the ID isn't available at this point, other than in the $_POST data.
		 */
		if ( ! isset( $_POST['ID'] ) || $post_id !== (int) $_POST['ID'] ) {
			return false;
		}

		clean_post_cache( $post_id );
		$post = get_post( $post_id );

		if ( ! is_object( $post ) ) {
			// Non-existent post.
			return false;
		}

		do_action( 'wpseo_save_compare_data', $post );

		$meta_boxes = apply_filters( 'wpseo_save_metaboxes', array() );
		$meta_boxes = array_merge( $meta_boxes, WPSEO_Meta::get_meta_field_defs( 'general', $post->post_type ), WPSEO_Meta::get_meta_field_defs( 'advanced' ) );

		foreach ( $meta_boxes as $key => $meta_box ) {

			// If analysis is disabled remove that analysis score value from the DB.
			if ( $this->is_meta_value_disabled( $key ) ) {
				WPSEO_Meta::delete( $key, $post_id );
				continue;
			}

			$data       = null;
			$field_name = WPSEO_Meta::$form_prefix . $key;

			if ( 'checkbox' === $meta_box['type'] ) {
				$data = isset( $_POST[ $field_name ] ) ? 'on' : 'off';
			}
			else {
				if ( isset( $_POST[ $field_name ] ) ) {
					$data = wp_unslash( $_POST[ $field_name ] );

					// For multi-select.
					if ( is_array( $data ) ) {
						$data = array_map( array( 'WPSEO_Utils', 'sanitize_text_field' ), $data );
					}

					if ( is_string( $data ) ) {
						$data = WPSEO_Utils::sanitize_text_field( $data );
					}
				}

				// Reset options when no entry is present with multiselect - only applies to `meta-robots-adv` currently.
				if ( ! isset( $_POST[ $field_name ] ) && ( $meta_box['type'] === 'multiselect' ) ) {
					$data = array();
				}
			}

			if ( $data !== null ) {
				WPSEO_Meta::set_value( $key, $data, $post_id );
			}
		}

		do_action( 'wpseo_saved_postdata' );
	}

	/**
	 * Determines if the given meta value key is disabled.
	 *
	 * @param string $key The key of the meta value.
	 *
	 * @return bool Whether the given meta value key is disabled.
	 */
	public function is_meta_value_disabled( $key ) {
		if ( 'linkdex' === $key && ! $this->analysis_seo->is_enabled() ) {
			return true;
		}

		if ( 'content_score' === $key && ! $this->analysis_readability->is_enabled() ) {
			return true;
		}

		return false;
	}

	/**
	 * Enqueues all the needed JS and CSS.
	 *
	 * @todo [JRF => whomever] Create css/metabox-mp6.css file and add it to the below allowed colors array when done.
	 */
	public function enqueue() {
		global $pagenow;

		$asset_manager = new WPSEO_Admin_Asset_Manager();

		$is_editor = self::is_post_overview( $pagenow ) || self::is_post_edit( $pagenow );

		if ( self::is_post_overview( $pagenow ) ) {
			$asset_manager->enqueue_style( 'edit-page' );
			$asset_manager->enqueue_script( 'edit-page-script' );

			return;
		}

		/* Filter 'wpseo_always_register_metaboxes_on_admin' documented in wpseo-main.php */
		if ( ( $is_editor === false && apply_filters( 'wpseo_always_register_metaboxes_on_admin', false ) === false ) || $this->display_metabox() === false ) {
			return;
		}

		if ( get_queried_object_id() !== 0 ) {
			// Enqueue files needed for upload functionality.
			wp_enqueue_media( array( 'post' => get_queried_object_id() ) );
		}

		$asset_manager->enqueue_style( 'metabox-css' );
		$asset_manager->enqueue_style( 'scoring' );
		$asset_manager->enqueue_style( 'select2' );

		$asset_manager->enqueue_script( 'metabox' );
		$asset_manager->enqueue_script( 'admin-media' );

		$asset_manager->enqueue_script( 'post-scraper' );
		$asset_manager->enqueue_script( 'replacevar-plugin' );
		$asset_manager->enqueue_script( 'shortcode-plugin' );

		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', $this->localize_media_script() );
		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'post-scraper', 'wpseoPostScraperL10n', $this->localize_post_scraper_script() );
		$yoast_components_l10n = new WPSEO_Admin_Asset_Yoast_Components_L10n();
		$yoast_components_l10n->localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'post-scraper' );

		$analysis_worker_location          = new WPSEO_Admin_Asset_Analysis_Worker_Location( $asset_manager->flatten_version( WPSEO_VERSION ) );
		$used_keywords_assessment_location = new WPSEO_Admin_Asset_Analysis_Worker_Location( $asset_manager->flatten_version( WPSEO_VERSION ), 'used-keywords-assessment' );

		$localization_data = array(
			'url'                     => $analysis_worker_location->get_url( $analysis_worker_location->get_asset(), WPSEO_Admin_Asset::TYPE_JS ),
			'keywords_assessment_url' => $used_keywords_assessment_location->get_url( $used_keywords_assessment_location->get_asset(), WPSEO_Admin_Asset::TYPE_JS ),
			'log_level'               => WPSEO_Utils::get_analysis_worker_log_level(),
			// We need to make the feature flags separately available inside of the analysis web worker.
			'enabled_features'        => WPSEO_Utils::retrieve_enabled_features(),
		);
		wp_localize_script(
			WPSEO_Admin_Asset_Manager::PREFIX . 'post-scraper',
			'wpseoAnalysisWorkerL10n',
			$localization_data
		);

		/**
		 * Remove the emoji script as it is incompatible with both React and any
		 * contenteditable fields.
		 */
		remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );

		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'replacevar-plugin', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script() );
		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'shortcode-plugin', 'wpseoShortcodePluginL10n', $this->localize_shortcode_plugin_script() );

		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoAdminL10n', WPSEO_Utils::get_admin_l10n() );
		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoSelect2Locale', WPSEO_Language_Utils::get_language( WPSEO_Language_Utils::get_user_locale() ) );

		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoFeaturesL10n', WPSEO_Utils::retrieve_enabled_features() );

		if ( post_type_supports( get_post_type(), 'thumbnail' ) ) {
			$asset_manager->enqueue_style( 'featured-image' );

			$asset_manager->enqueue_script( 'featured-image' );

			$featured_image_l10 = array( 'featured_image_notice' => __( 'SEO issue: The featured image should be at least 200 by 200 pixels to be picked up by Facebook and other social media sites.', 'wordpress-seo' ) );
			wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoFeaturedImageL10n', $featured_image_l10 );
		}
	}

	/**
	 * Pass some variables to js for upload module.
	 *
	 * @return array
	 */
	public function localize_media_script() {
		return array(
			'choose_image' => __( 'Use Image', 'wordpress-seo' ),
		);
	}

	/**
	 * Returns post in metabox context.
	 *
	 * @returns WP_Post|array
	 */
	protected function get_metabox_post() {
		$post = filter_input( INPUT_GET, 'post' );
		if ( ! empty( $post ) ) {
			$post_id = (int) WPSEO_Utils::validate_int( $post );

			return get_post( $post_id );
		}


		if ( isset( $GLOBALS['post'] ) ) {
			return $GLOBALS['post'];
		}

		return array();
	}

	/**
	 * Returns an array with shortcode tags for all registered shortcodes.
	 *
	 * @return array
	 */
	private function get_valid_shortcode_tags() {
		$shortcode_tags = array();

		foreach ( $GLOBALS['shortcode_tags'] as $tag => $description ) {
			$shortcode_tags[] = $tag;
		}

		return $shortcode_tags;
	}

	/**
	 * Prepares the replace vars for localization.
	 *
	 * @return array Replace vars.
	 */
	private function get_replace_vars() {
		$post = $this->get_metabox_post();

		$cached_replacement_vars = array();

		$vars_to_cache = array(
			'date',
			'id',
			'sitename',
			'sitedesc',
			'sep',
			'page',
			'currentyear',
		);

		foreach ( $vars_to_cache as $var ) {
			$cached_replacement_vars[ $var ] = wpseo_replace_vars( '%%' . $var . '%%', $post );
		}

		// Merge custom replace variables with the WordPress ones.
		return array_merge( $cached_replacement_vars, $this->get_custom_replace_vars( $post ) );
	}

	/**
	 * Prepares the recommended replace vars for localization.
	 *
	 * @return array Recommended replacement variables.
	 */
	private function get_recommended_replace_vars() {
		$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
		$post                     = $this->get_metabox_post();

		// What is recommended depends on the current context.
		$post_type = $recommended_replace_vars->determine_for_post( $post );

		return $recommended_replace_vars->get_recommended_replacevars_for( $post_type );
	}

	/**
	 * Gets the custom replace variables for custom taxonomies and fields.
	 *
	 * @param WP_Post $post The post to check for custom taxonomies and fields.
	 *
	 * @return array Array containing all the replacement variables.
	 */
	private function get_custom_replace_vars( $post ) {
		return array(
			'custom_fields'     => $this->get_custom_fields_replace_vars( $post ),
			'custom_taxonomies' => $this->get_custom_taxonomies_replace_vars( $post ),
		);
	}

	/**
	 * Gets the custom replace variables for custom taxonomies.
	 *
	 * @param WP_Post $post The post to check for custom taxonomies.
	 *
	 * @return array Array containing all the replacement variables.
	 */
	private function get_custom_taxonomies_replace_vars( $post ) {
		$taxonomies          = get_object_taxonomies( $post, 'objects' );
		$custom_replace_vars = array();

		foreach ( $taxonomies as $taxonomy_name => $taxonomy ) {

			if ( is_string( $taxonomy ) ) { // If attachment, see https://core.trac.wordpress.org/ticket/37368 .
				$taxonomy_name = $taxonomy;
				$taxonomy      = get_taxonomy( $taxonomy_name );
			}

			if ( $taxonomy->_builtin && $taxonomy->public ) {
				continue;
			}

			$custom_replace_vars[ $taxonomy_name ] = array(
				'name'        => $taxonomy->name,
				'description' => $taxonomy->description,
			);
		}

		return $custom_replace_vars;
	}

	/**
	 * Gets the custom replace variables for custom fields.
	 *
	 * @param WP_Post $post The post to check for custom fields.
	 *
	 * @return array Array containing all the replacement variables.
	 */
	private function get_custom_fields_replace_vars( $post ) {
		$custom_replace_vars = array();

		// If no post object is passed, return the empty custom_replace_vars array.
		if ( ! is_object( $post ) ) {
			return $custom_replace_vars;
		}

		$custom_fields = get_post_custom( $post->ID );

		foreach ( $custom_fields as $custom_field_name => $custom_field ) {
			if ( substr( $custom_field_name, 0, 1 ) === '_' ) {
				continue;
			}

			$custom_replace_vars[ $custom_field_name ] = $custom_field[0];
		}

		return $custom_replace_vars;
	}

	/**
	 * @param string $page The page to check for the post overview page.
	 *
	 * @return bool Whether or not the given page is the post overview page.
	 */
	public static function is_post_overview( $page ) {
		return 'edit.php' === $page;
	}

	/**
	 * @param string $page The page to check for the post edit page.
	 *
	 * @return bool Whether or not the given page is the post edit page.
	 */
	public static function is_post_edit( $page ) {
		return 'post.php' === $page
			|| 'post-new.php' === $page;
	}

	/**
	 * Retrieves the product title.
	 *
	 * @return string The product title.
	 */
	protected function get_product_title() {
		$product_title = 'Yoast SEO';

		if ( WPSEO_Utils::is_yoast_seo_premium() ) {
			$product_title .= ' Premium';
		}

		return $product_title;
	}

	/**
	 * Adds the template variables tab to the helpcenter.
	 *
	 * @return void
	 */
	protected function register_helpcenter_tab() {
		static $tab_registered;

		if ( $tab_registered ) {
			return;
		}

		// Add template variables tab to the Help Center.
		$tab = new WPSEO_Help_Center_Template_Variables_Tab();
		$tab->register_hooks();

		$tab_registered = true;
	}

	/* ********************* DEPRECATED METHODS ********************* */

	/**
	 * Outputs the page analysis score in the Publish Box.
	 *
	 * @deprecated 9.6
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function publish_box() {
		_deprecated_function( __METHOD__, 'WPSEO 9.6' );
	}

	/**
	 * Sets up all the functionality related to the prominence of the page analysis functionality.
	 *
	 * @deprecated 9.6
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function setup_page_analysis() {
		_deprecated_function( __METHOD__, 'WPSEO 9.6' );
	}
}
PK     ”T]â�Môµ  µ  %  metabox/class-metabox-tab-section.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Generates and displays the HTML for a metabox section.
 */
class WPSEO_Metabox_Tab_Section implements WPSEO_Metabox_Section {

	/**
	 * @var WPSEO_Metabox_Tab[]
	 */
	public $tabs = array();

	/**
	 * @var string
	 */
	public $name;

	/**
	 * @var string
	 */
	private $link_content;

	/**
	 * @var string
	 */
	private $link_title;

	/**
	 * @var string
	 */
	private $link_class;

	/**
	 * @var string
	 */
	private $link_aria_label;

	/**
	 * Constructor.
	 *
	 * @param string $name         The name of the section, used as an identifier in the html.
	 *                             Can only contain URL safe characters.
	 * @param string $link_content The text content of the section link.
	 * @param array  $tabs         The metabox tabs (`WPSEO_Metabox_Tabs[]`) to be included in the section.
	 * @param array  $options      Optional link attributes.
	 */
	public function __construct( $name, $link_content, array $tabs = array(), array $options = array() ) {
		$default_options = array(
			'link_title'      => '',
			'link_class'      => '',
			'link_aria_label' => '',
		);

		$options = array_merge( $default_options, $options );

		$this->name = $name;

		// Filter out invalid tab instances.
		$valid_tabs = array_filter( $tabs, array( $this, 'is_valid_tab' ) );

		foreach ( $valid_tabs as $tab ) {
			$this->add_tab( $tab );
		}
		$this->link_content    = $link_content;
		$this->link_title      = $options['link_title'];
		$this->link_class      = $options['link_class'];
		$this->link_aria_label = $options['link_aria_label'];
	}

	/**
	 * Determines whether the passed tab is considered valid.
	 *
	 * @param mixed $tab The potential tab that needs to be validated.
	 *
	 * @return bool Whether or not the tab is valid.
	 */
	protected function is_valid_tab( $tab ) {
		if ( $tab instanceof WPSEO_Metabox_Tab && ! $tab instanceof WPSEO_Metabox_Null_Tab ) {
			return true;
		}

		return false;
	}

	/**
	 * Outputs the section link if any tab has been added.
	 */
	public function display_link() {
		if ( $this->has_tabs() ) {
			printf(
				'<li><a href="#wpseo-meta-section-%1$s" class="wpseo-meta-section-link %2$s"%3$s%4$s>%5$s</a></li>',
				esc_attr( $this->name ),
				esc_attr( $this->link_class ),
				( '' !== $this->link_title ) ? ' title="' . esc_attr( $this->link_title ) . '"' : '',
				( '' !== $this->link_aria_label ) ? ' aria-label="' . esc_attr( $this->link_aria_label ) . '"' : '',
				$this->link_content
			);
		}
	}

	/**
	 * Outputs the section content if any tab has been added.
	 */
	public function display_content() {
		if ( $this->has_tabs() ) {
			$html  = '<div id="%1$s" class="wpseo-meta-section">';
			$html .= '<div class="wpseo-metabox-tabs-div">';
			$html .= '<ul class="wpseo-metabox-tabs %2$s">%3$s</ul>%4$s';
			$html .= '</div></div>';

			printf(
				$html,
				esc_attr( 'wpseo-meta-section-' . $this->name ),
				esc_attr( 'wpseo-metabox-tab-' . $this->name ),
				$this->tab_links(),
				$this->tab_content()
			);
		}
	}

	/**
	 * Add a `WPSEO_Metabox_Tab` object to the tabs.
	 *
	 * @param WPSEO_Metabox_Tab $tab Tab to add.
	 */
	public function add_tab( WPSEO_Metabox_Tab $tab ) {
		$this->tabs[] = $tab;
	}

	/**
	 * Checks if any tabs have been added to the section.
	 *
	 * @return bool
	 */
	protected function has_tabs() {
		return ! empty( $this->tabs );
	}

	/**
	 * Concatenates all tabs' links into one html string.
	 *
	 * @return string
	 */
	private function tab_links() {
		$links = '';
		foreach ( $this->tabs as $tab ) {
			$links .= $tab->link();
		}
		return $links;
	}

	/**
	 * Concatenates all tabs' content into one html string.
	 *
	 * @return string
	 */
	private function tab_content() {
		$content = '';
		foreach ( $this->tabs as $tab ) {
			$content .= $tab->content();
		}
		return $content;
	}

	/**
	 * Gets the name of the tab section.
	 *
	 * @return string The name of the tab section.
	 */
	public function get_name() {
		return $this->name;
	}
}
PK     ”T]6.ò©	  ©	  !  class-gutenberg-compatibility.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Gutenberg_Compatibility
 */

/**
 * Class WPSEO_Gutenberg_Compatibility
 */
class WPSEO_Gutenberg_Compatibility {

	/**
	 * The currently released version of Gutenberg.
	 *
	 * @var string
	 */
	const CURRENT_RELEASE = '5.7.0';

	/**
	 * The minimally supported version of Gutenberg by the plugin.
	 *
	 * @var string
	 */
	const MINIMUM_SUPPORTED = '5.7.0';

	/**
	 * @var string
	 */
	protected $current_version;

	/**
	 * WPSEO_Gutenberg_Compatibility constructor.
	 */
	public function __construct() {
		$this->current_version = $this->detect_installed_gutenberg_version();
	}

	/**
	 * Determines whether or not Gutenberg is installed.
	 *
	 * @return bool Whether or not Gutenberg is installed.
	 */
	public function is_installed() {
		return $this->current_version !== '';
	}

	/**
	 * Determines whether or not the currently installed version of Gutenberg is below the minimum supported version.
	 *
	 * @return bool True if the currently installed version is below the minimum supported version. False otherwise.
	 */
	public function is_below_minimum() {
		return version_compare( $this->current_version, $this->get_minimum_supported_version(), '<' );
	}

	/**
	 * Gets the currently installed version.
	 *
	 * @return string The currently installed version.
	 */
	public function get_installed_version() {
		return $this->current_version;
	}

	/**
	 * Determines whether or not the currently installed version of Gutenberg is the latest, fully compatible version.
	 *
	 * @return bool Whether or not the currently installed version is fully compatible.
	 */
	public function is_fully_compatible() {
		return version_compare( $this->current_version, $this->get_latest_release(), '>=' );
	}

	/**
	 * Gets the latest released version of Gutenberg.
	 *
	 * @return string The latest release.
	 */
	protected function get_latest_release() {
		return self::CURRENT_RELEASE;
	}

	/**
	 * Gets the minimum supported version of Gutenberg.
	 *
	 * @return string The minumum supported release.
	 */
	protected function get_minimum_supported_version() {
		return self::MINIMUM_SUPPORTED;
	}

	/**
	 * Detects the currently installed Gutenberg version.
	 *
	 * @return string The currently installed Gutenberg version. Empty if the version couldn't be detected.
	 */
	protected function detect_installed_gutenberg_version() {
		if ( defined( 'GUTENBERG_VERSION' ) ) {
			return GUTENBERG_VERSION;
		}

		return '';
	}
}
PK     ”T]Ækõ      class-premium-popup.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class WPSEO_Premium_popup.
 */
class WPSEO_Premium_Popup {

	/**
	 * An unique identifier for the popup
	 *
	 * @var string
	 */
	private $identifier = '';

	/**
	 * The heading level of the title of the popup.
	 *
	 * @var String
	 */
	private $heading_level = '';

	/**
	 * The title of the popup.
	 *
	 * @var String
	 */
	private $title = '';

	/**
	 * The content of the popup.
	 *
	 * @var String
	 */
	private $content = '';

	/**
	 * The URL for where the button should link to.
	 *
	 * @var String
	 */
	private $url = '';

	/**
	 * Wpseo_Premium_Popup constructor.
	 *
	 * @param String $identifier    An unique identifier for the popup.
	 * @param String $heading_level The heading level for the title of the popup.
	 * @param String $title         The title of the popup.
	 * @param String $content       The content of the popup.
	 * @param String $url           The URL for where the button should link to.
	 */
	public function __construct( $identifier, $heading_level, $title, $content, $url ) {
		$this->identifier    = $identifier;
		$this->heading_level = $heading_level;
		$this->title         = $title;
		$this->content       = $content;
		$this->url           = $url;
	}

	/**
	 * Returns the premium popup as an HTML string.
	 *
	 * @param bool $popup Show this message as a popup show it straight away.
	 *
	 * @return string
	 */
	public function get_premium_message( $popup = true ) {
		// Don't show in Premium.
		if ( defined( 'WPSEO_PREMIUM_FILE' ) ) {
			return '';
		}

		$assets_uri = trailingslashit( plugin_dir_url( WPSEO_FILE ) );

		/* translators: %s expands to Yoast SEO Premium */
		$cta_text        = esc_html( sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' ) );
		$new_tab_message = '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>';
		$caret_icon      = '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
		$classes         = '';
		if ( $popup ) {
			$classes = ' hidden';
		}
		$micro_copy = __( '1 year free support and updates included!', 'wordpress-seo' );

		$popup = <<<EO_POPUP
<div id="wpseo-{$this->identifier}-popup" class="wpseo-premium-popup wp-clearfix$classes">
	<img class="alignright wpseo-premium-popup-icon" src="{$assets_uri}images/Yoast_SEO_Icon.svg" width="150" height="150" alt="Yoast SEO"/>
	<{$this->heading_level} id="wpseo-contact-support-popup-title" class="wpseo-premium-popup-title">{$this->title}</{$this->heading_level}>
	{$this->content}
	<a id="wpseo-{$this->identifier}-popup-button" class="yoast-button-upsell" href="{$this->url}" target="_blank">
		{$cta_text} {$new_tab_message} {$caret_icon}
	</a><br/>
	<small>{$micro_copy}</small>
</div>
EO_POPUP;

		return $popup;
	}
}
PK     ”T]ÏÒ¸�±  ±  +  class-admin-asset-yoast-components-l10n.phpnu „[µü¤        <?php
/**
 * @package WPSEO\Admin
 */

/**
 * Localizes JavaScript files.
 */
final class WPSEO_Admin_Asset_Yoast_Components_L10n {

	/**
	 * Localizes the given script with the JavaScript translations.
	 *
	 * @param string $script_handle The script handle to localize for.
	 *
	 * @return void
	 */
	public function localize_script( $script_handle ) {
		$translations = array(
			'yoast-components' => $this->get_translations( 'yoast-components' ),
			'wordpress-seo'    => $this->get_translations( 'wordpress-seojs' ),
		);
		wp_localize_script( $script_handle, 'wpseoYoastJSL10n', $translations );
	}

	/**
	 * Returns translations necessary for JS files.
	 *
	 * @param string $component The component to retrieve the translations for.
	 * @return object The translations in a Jed format for JS files.
	 */
	protected function get_translations( $component ) {
		$locale = WPSEO_Language_Utils::get_user_locale();

		$file = plugin_dir_path( WPSEO_FILE ) . 'languages/' . $component . '-' . $locale . '.json';
		if ( file_exists( $file ) ) {
			$file = file_get_contents( $file );
			if ( is_string( $file ) && $file !== '' ) {
				return json_decode( $file, true );
			}
		}

		return null;
	}
}
PK     ”T]�SÊ‰í   í     watchers/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]ï£1øÉ  É  &  watchers/class-slug-change-watcher.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Watchers
 */

/**
 * Class WPSEO_Slug_Change_Watcher.
 */
class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		// If the current plugin is Yoast SEO Premium, stop registering.
		if ( WPSEO_Utils::is_yoast_seo_premium() ) {
			return;
		}

		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );

		// Detect a post trash.
		add_action( 'wp_trash_post', array( $this, 'detect_post_trash' ) );

		// Detect a post delete.
		add_action( 'before_delete_post', array( $this, 'detect_post_delete' ) );

		// Detects deletion of a term.
		add_action( 'delete_term_taxonomy', array( $this, 'detect_term_delete' ) );
	}

	/**
	 * Enqueues the quick edit handler.
	 *
	 * @return void
	 */
	public function enqueue_assets() {
		global $pagenow;

		if ( ! in_array( $pagenow, array( 'edit.php', 'edit-tags.php' ), true ) ) {
			return;
		}

		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_script( 'quick-edit-handler' );
	}

	/**
	 * Shows an message when a post is about to get trashed.
	 *
	 * @param integer $post_id The current post ID.
	 *
	 * @return void
	 */
	public function detect_post_trash( $post_id ) {
		if ( ! $this->is_post_viewable( $post_id ) ) {
			return;
		}

		/* translators: %1$s expands to the translated name of the post type. */
		$first_sentence = sprintf( __( 'You just trashed a %1$s.', 'wordpress-seo' ), $this->get_post_type_label( get_post_type( $post_id ) ) );
		$message        = $this->get_message( $first_sentence );

		$this->add_notification( $message );
	}

	/**
	 * Shows an message when a post is about to get trashed.
	 *
	 * @param integer $post_id The current post ID.
	 *
	 * @return void
	 */
	public function detect_post_delete( $post_id ) {
		if ( ! $this->is_post_viewable( $post_id ) ) {
			return;
		}

		/* translators: %1$s expands to the translated name of the post type. */
		$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $this->get_post_type_label( get_post_type( $post_id ) ) );
		$message        = $this->get_message( $first_sentence );

		$this->add_notification( $message );
	}

	/**
	 * Shows a message when a term is about to get deleted.
	 *
	 * @param integer $term_id The term ID that will be deleted.
	 *
	 * @return void
	 */
	public function detect_term_delete( $term_id ) {
		if ( ! $this->is_term_viewable( $term_id ) ) {
			return;
		}

		$first_sentence = sprintf(
			/* translators: 1: term label */
			__( 'You just deleted a %1$s.', 'wordpress-seo' ),
			$this->get_taxonomy_label_for_term( $term_id )
		);

		$message = $this->get_message( $first_sentence );

		$this->add_notification( $message );
	}

	/**
	 * Checks if the post is viewable.
	 *
	 * @param string $post_id The post id to check.
	 *
	 * @return bool Whether the post is viewable or not.
	 */
	protected function is_post_viewable( $post_id ) {
		$post_type = get_post_type( $post_id );
		if ( ! WPSEO_Post_Type::is_post_type_accessible( $post_type ) ) {
			return false;
		}

		$post_status = get_post_status( $post_id );
		if ( ! $this->check_visible_post_status( $post_status ) ) {
			return false;
		}

		return true;
	}

	/**
	 * Checks if the term is viewable.
	 *
	 * @param string $term_id The term ID to check.
	 *
	 * @return bool Whether the term is viewable or not.
	 */
	protected function is_term_viewable( $term_id ) {
		$term = get_term( $term_id );

		if ( ! $term || is_wp_error( $term ) ) {
			return false;
		}

		$taxonomy = get_taxonomy( $term->taxonomy );
		if ( ! $taxonomy ) {
			return false;
		}

		return $taxonomy->publicly_queryable || $taxonomy->public;
	}

	/**
	 * Gets the taxonomy label to use for a term.
	 *
	 * @param int $term_id The term ID.
	 *
	 * @return string The taxonomy's singular label.
	 */
	protected function get_taxonomy_label_for_term( $term_id ) {
		$term     = get_term( $term_id );
		$taxonomy = get_taxonomy( $term->taxonomy );

		return $taxonomy->labels->singular_name;
	}

	/**
	 * Retrieves the singular post type label.
	 *
	 * @param string $post_type Post type to retrieve label from.
	 *
	 * @return string The singular post type name.
	 */
	protected function get_post_type_label( $post_type ) {
		$post_type_object = get_post_type_object( $post_type );

		// If the post type of this post wasn't registered default back to post.
		if ( $post_type_object === null ) {
			$post_type_object = get_post_type_object( 'post' );
		}

		return $post_type_object->labels->singular_name;
	}

	/**
	 * Checks whether the given post status is visible or not.
	 *
	 * @param string $post_status The post status to check.
	 *
	 * @return bool Whether or not the post is visible.
	 */
	protected function check_visible_post_status( $post_status ) {
		$visible_post_statuses = array(
			'publish',
			'static',
			'private',
		);

		return in_array( $post_status, $visible_post_statuses, true );
	}

	/**
	 * Returns the message around changed URLs.
	 *
	 * @param string $first_sentence The first sentence of the notification.
	 *
	 * @return string The full notification.
	 */
	protected function get_message( $first_sentence ) {
		return '<h2>' . __( 'Make sure you don\'t miss out on traffic!', 'wordpress-seo' ) . '</h2>'
			. '<p>'
			. $first_sentence
			. ' ' . __( 'Search engines and other websites can still send traffic to your deleted post.', 'wordpress-seo' )
			. ' ' . __( 'You should create a redirect to ensure your visitors do not get a 404 error when they click on the no longer working URL.', 'wordpress-seo' )
			/* translators: %s expands to Yoast SEO Premium */
			. ' ' . sprintf( __( 'With %s, you can easily create such redirects.', 'wordpress-seo' ), 'Yoast SEO Premium' )
			. '</p>'
			. '<p><a class="yoast-button-upsell" href="' . WPSEO_Shortlinker::get( 'https://yoa.st/1d0' ) . '" target="_blank">'
			/* translators: %s expands to Yoast SEO Premium */
			. sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' )
			. '<span class="screen-reader-text">' . __( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>'
			. '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>'
			. '</a></p>';
	}

	/**
	 * Adds a notification to be shown on the next page request since posts are updated in an ajax request.
	 *
	 * @param string $message The message to add to the notification.
	 *
	 * @return void
	 */
	protected function add_notification( $message ) {
		$notification = new Yoast_Notification(
			$message,
			array(
				'type'           => 'notice-warning is-dismissible',
				'yoast_branding' => true,
			)
		);

		$notification_center = Yoast_Notification_Center::get();
		$notification_center->add_notification( $notification );
	}
}
PK     ”T]5:K  K  )  class-admin-asset-dev-server-location.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Changes the asset paths to dev server paths.
 */
final class WPSEO_Admin_Asset_Dev_Server_Location implements WPSEO_Admin_Asset_Location {

	/**
	 * @var string
	 */
	const DEFAULT_URL = 'http://localhost:8080';

	/**
	 * @var string
	 */
	private $url;

	/**
	 * @param string $url Where the dev server is located.
	 */
	public function __construct( $url = null ) {
		if ( $url === null ) {
			$url = self::DEFAULT_URL;
		}

		$this->url = $url;
	}

	/**
	 * Determines the URL of the asset on the dev server.
	 *
	 * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
	 * @param string            $type  The type of asset. Usually JS or CSS.
	 *
	 * @return string The URL of the asset.
	 */
	public function get_url( WPSEO_Admin_Asset $asset, $type ) {
		if ( WPSEO_Admin_Asset::TYPE_CSS === $type ) {
			return $this->get_default_url( $asset, $type );
		}

		$asset_manager       = new WPSEO_Admin_Asset_Manager();
		$flat_version        = $asset_manager->flatten_version( WPSEO_VERSION );
		$version_less_source = str_replace( '-' . $flat_version, '', $asset->get_src() );

		if ( false !== strpos( $version_less_source, 'select2' ) ) {
			return $this->get_default_url( $asset, $type );
		}

		$path = sprintf( '%s%s.js', $asset->get_src(), $asset->get_suffix() );

		return trailingslashit( $this->url ) . $path;
	}

	/**
	 * Determines the URL of the asset not using the dev server.
	 *
	 * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
	 * @param string            $type  The type of asset.
	 *
	 * @return string The URL of the asset file.
	 */
	public function get_default_url( WPSEO_Admin_Asset $asset, $type ) {
		$default_location = new WPSEO_Admin_Asset_SEO_Location( WPSEO_FILE );

		return $default_location->get_url( $asset, $type );
	}
}
PK     ”T]«‡×¢&   &   	  index.phpnu „[µü¤        <?php
/**
 * Nothing to see here.
 */
PK     ”T]à³°‘    $  class-premium-upsell-admin-block.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class WPSEO_Premium_Upsell_Admin_Block
 */
class WPSEO_Premium_Upsell_Admin_Block {

	/**
	 * Hook to display the block on.
	 *
	 * @var string
	 */
	protected $hook;

	/**
	 * Identifier to use in the dismissal functionality.
	 *
	 * @var string
	 */
	protected $identifier = 'premium_upsell_admin_block';

	/**
	 * Registers which hook the block will be displayed on.
	 *
	 * @param string $hook Hook to display the block on.
	 */
	public function __construct( $hook ) {
		$this->hook = $hook;
	}

	/**
	 * Registers WordPress hooks.
	 *
	 * @return void
	 */
	public function register_hooks() {
		if ( ! $this->is_hidden() ) {
			add_action( $this->hook, array( $this, 'render' ) );
		}
	}

	/**
	 * Renders the upsell block.
	 *
	 * @return void
	 */
	public function render() {
		$url = WPSEO_Shortlinker::get( 'https://yoa.st/17h' );

		$arguments = array(
			'<strong>' . esc_html__( 'Multiple keyphrases', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Increase your SEO reach', 'wordpress-seo' ),
			'<strong>' . esc_html__( 'No more dead links', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Easy redirect manager', 'wordpress-seo' ),
			'<strong>' . esc_html__( 'Superfast internal linking suggestions', 'wordpress-seo' ) . '</strong>',
			'<strong>' . esc_html__( 'Social media preview', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Facebook & Twitter', 'wordpress-seo' ),
			'<strong>' . esc_html__( '24/7 email support', 'wordpress-seo' ) . '</strong>',
			'<strong>' . esc_html__( 'No ads!', 'wordpress-seo' ) . '</strong>',
		);

		$arguments_html = implode( '', array_map( array( $this, 'get_argument_html' ), $arguments ) );

		$class = $this->get_html_class();

		/* translators: %s expands to "Yoast SEO Premium". */
		$dismiss_msg = sprintf( __( 'Dismiss %s upgrade notice', 'wordpress-seo' ), 'Yoast SEO Premium' );

		/* translators: %s expands to Yoast SEO Premium */
		$button_text  = esc_html( sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' ) );
		$button_text .= '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>' .
			'<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';

		$upgrade_button = sprintf(
			'<a id="wpseo-%1$s-popup-button" class="yoast-button-upsell" href="%2$s" target="_blank">%3$s</a>',
			$this->identifier,
			esc_url( $url ),
			$button_text
		);

		echo '<div class="' . esc_attr( $class ) . '">';
		printf(
			'<a href="%1$s" style="" class="alignright button %2$s" aria-label="%3$s"><span class="dashicons dashicons-no-alt"></span></a>',
			esc_url( add_query_arg( array( $this->get_query_variable_name() => 1 ) ) ),
			esc_attr( $class . '--close' ),
			esc_attr( $dismiss_msg )
		);

		echo '<div>';
		echo '<h2 class="' . esc_attr( $class . '--header' ) . '">' .
			sprintf(
				/* translators: %s expands to Yoast SEO Premium */
				esc_html__( 'Upgrade to %s', 'wordpress-seo' ),
				'Yoast SEO Premium'
			) .
		'</h2>';
		echo '<ul class="' . esc_attr( $class . '--motivation' ) . '">' . $arguments_html . '</ul>';

		echo '<p>' . $upgrade_button . '</p>';
		echo '</div>';

		echo '</div>';
	}

	/**
	 * Formats the argument to a HTML list item.
	 *
	 * @param string $argument The argument to format.
	 *
	 * @return string Formatted argument in HTML.
	 */
	protected function get_argument_html( $argument ) {
		$class = $this->get_html_class();

		return sprintf(
			'<li><div class="%1$s">%2$s</div></li>',
			esc_attr( $class . '--argument' ),
			$argument
		);
	}

	/**
	 * Checks if the block is hidden by the user.
	 *
	 * @return bool False when it should be shown, True if it should be hidden.
	 */
	protected function is_hidden() {
		$transient_name = $this->get_option_name();

		$hide = (bool) get_user_option( $transient_name );
		if ( ! $hide ) {
			$query_variable_name = $this->get_query_variable_name();
			if ( filter_input( INPUT_GET, $query_variable_name, FILTER_VALIDATE_INT ) === 1 ) {
				// No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc.
				update_user_option( get_current_user_id(), $transient_name, true );
				$hide = true;
			}
		}

		return $hide;
	}

	/**
	 * Retrieves the option name to use.
	 *
	 * @return string The name of the option to save the data in.
	 */
	protected function get_option_name() {
		return 'yoast_promo_hide_' . $this->identifier;
	}

	/**
	 * Retrieves the query variable to use for dismissing the block.
	 *
	 * @return string The name of the query variable to use.
	 */
	protected function get_query_variable_name() {
		return 'yoast_promo_hide_' . $this->identifier;
	}

	/**
	 * Returns the HTML base class to use.
	 *
	 * @return string The HTML base class.
	 */
	protected function get_html_class() {
		return 'yoast_' . $this->identifier;
	}
}
PK     ”T]+ÄŽ‹  ‹  4  class-admin-gutenberg-compatibility-notification.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Handles the Gutenberg Compatibility notification showing and hiding.
 */
class WPSEO_Admin_Gutenberg_Compatibility_Notification implements WPSEO_WordPress_Integration {

	/**
	 * Notification ID to use.
	 *
	 * @var string
	 */
	private $notification_id = 'wpseo-outdated-gutenberg-plugin';

	/**
	 * @var WPSEO_Gutenberg_Compatibility
	 */
	private $compatibility_checker;

	/**
	 * @var Yoast_Notification_Center
	 */
	private $notification_center;

	/**
	 * WPSEO_Admin_Gutenberg_Compatibility_Notification constructor.
	 */
	public function __construct() {
		$this->compatibility_checker = new WPSEO_Gutenberg_Compatibility();
		$this->notification_center   = Yoast_Notification_Center::get();
	}

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_action( 'admin_init', array( $this, 'manage_notification' ) );
	}

	/**
	 * Manages if the notification should be shown or removed.
	 *
	 * @return void
	 */
	public function manage_notification() {
		if ( ! $this->compatibility_checker->is_installed() || $this->compatibility_checker->is_fully_compatible() ) {
			$this->notification_center->remove_notification_by_id( $this->notification_id );

			return;
		}

		$this->add_notification();
	}

	/**
	 * Adds the notification to the notificaton center.
	 *
	 * @return void
	 */
	private function add_notification() {
		$level = $this->compatibility_checker->is_below_minimum() ? Yoast_Notification::ERROR : Yoast_Notification::WARNING;

		$message = sprintf(
			/* translators: %1$s expands to Yoast SEO, %2$s expands to the installed version, %3$s expands to Gutenberg */
			__( '%1$s detected you are using version %2$s of %3$s, please update to the latest version to prevent compatibility issues.', 'wordpress-seo' ),
			'Yoast SEO',
			$this->compatibility_checker->get_installed_version(),
			'Gutenberg'
		);

		$notification = new Yoast_Notification(
			$message,
			array(
				'id'       => $this->notification_id,
				'type'     => $level,
				'priority' => 1,
			)
		);

		$this->notification_center->add_notification( $notification );
	}
}
PK     ”T]&’?W    (  class-admin-recommended-replace-vars.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Determines the recommended replacement variables based on the context.
 */
class WPSEO_Admin_Recommended_Replace_Vars {

	/**
	 * The recommended replacement variables.
	 *
	 * @var array
	 */
	protected $recommended_replace_vars = array(
		// Posts types.
		'page'                     => array( 'sitename', 'title', 'sep', 'primary_category' ),
		'post'                     => array( 'sitename', 'title', 'sep', 'primary_category' ),
		// Homepage.
		'homepage'                 => array( 'sitename', 'sitedesc', 'sep' ),
		// Custom post type.
		'custom_post_type'         => array( 'sitename', 'title', 'sep' ),

		// Taxonomies.
		'category'                 => array( 'sitename', 'term_title', 'sep' ),
		'post_tag'                 => array( 'sitename', 'term_title', 'sep' ),
		'post_format'              => array( 'sitename', 'term_title', 'sep', 'page' ),

		// Custom taxonomy.
		'term-in-custom-taxomomy'  => array( 'sitename', 'term_title', 'sep' ),

		// Settings - archive pages.
		'author_archive'           => array( 'sitename', 'title', 'sep', 'page' ),
		'date_archive'             => array( 'sitename', 'sep', 'date', 'page' ),
		'custom-post-type_archive' => array( 'sitename', 'title', 'sep', 'page' ),

		// Settings - special pages.
		'search'                   => array( 'sitename', 'searchphrase', 'sep', 'page' ),
		'404'                      => array( 'sitename', 'sep' ),
	);

	/**
	 * Determines the page type of the current term.
	 *
	 * @param string $taxonomy The taxonomy name.
	 *
	 * @return string The page type.
	 */
	public function determine_for_term( $taxonomy ) {
		$recommended_replace_vars = $this->get_recommended_replacevars();
		if ( array_key_exists( $taxonomy, $recommended_replace_vars ) ) {
			return $taxonomy;
		}

		return 'term-in-custom-taxomomy';
	}

	/**
	 * Determines the page type of the current post.
	 *
	 * @param WP_Post $post A WordPress post instance.
	 *
	 * @return string The page type.
	 */
	public function determine_for_post( $post ) {
		if ( $post instanceof WP_Post === false ) {
			return 'post';
		}

		if ( $post->post_type === 'page' && $this->is_homepage( $post ) ) {
			return 'homepage';
		}

		$recommended_replace_vars = $this->get_recommended_replacevars();
		if ( array_key_exists( $post->post_type, $recommended_replace_vars ) ) {
			return $post->post_type;
		}

		return 'custom_post_type';
	}

	/**
	 * Determines the page type for a post type.
	 *
	 * @param string $post_type The name of the post_type.
	 * @param string $fallback  The page type to fall back to.
	 *
	 * @return string The page type.
	 */
	public function determine_for_post_type( $post_type, $fallback = 'custom_post_type' ) {
		$page_type                   = $post_type;
		$recommended_replace_vars    = $this->get_recommended_replacevars();
		$has_recommended_replacevars = $this->has_recommended_replace_vars( $recommended_replace_vars, $page_type );

		if ( ! $has_recommended_replacevars ) {
			return $fallback;
		}

		return $page_type;
	}

	/**
	 * Determines the page type for an archive page.
	 *
	 * @param string $name     The name of the archive.
	 * @param string $fallback The page type to fall back to.
	 *
	 * @return string The page type.
	 */
	public function determine_for_archive( $name, $fallback = 'custom-post-type_archive' ) {
		$page_type                   = $name . '_archive';
		$recommended_replace_vars    = $this->get_recommended_replacevars();
		$has_recommended_replacevars = $this->has_recommended_replace_vars( $recommended_replace_vars, $page_type );

		if ( ! $has_recommended_replacevars ) {
			return $fallback;
		}

		return $page_type;
	}

	/**
	 * Retrieves the recommended replacement variables for the given page type.
	 *
	 * @param string $page_type The page type.
	 *
	 * @return array The recommended replacement variables.
	 */
	public function get_recommended_replacevars_for( $page_type ) {
		$recommended_replace_vars     = $this->get_recommended_replacevars();
		$has_recommended_replace_vars = $this->has_recommended_replace_vars( $recommended_replace_vars, $page_type );

		if ( ! $has_recommended_replace_vars ) {
			return array();
		}

		return $recommended_replace_vars[ $page_type ];
	}

	/**
	 * Retrieves the recommended replacement variables.
	 *
	 * @return array The recommended replacement variables.
	 */
	public function get_recommended_replacevars() {
		/**
		 * Filter: Adds the possibility to add extra recommended replacement variables.
		 *
		 * @api array $additional_replace_vars Empty array to add the replacevars to.
		 */
		$recommended_replace_vars = apply_filters( 'wpseo_recommended_replace_vars', $this->recommended_replace_vars );

		if ( ! is_array( $recommended_replace_vars ) ) {
			return $this->recommended_replace_vars;
		}

		return $recommended_replace_vars;
	}

	/**
	 * Returns whether the given page type has recommended replace vars.
	 *
	 * @param array  $recommended_replace_vars The recommended replace vars
	 *                                         to check in.
	 * @param string $page_type                The page type to check.
	 *
	 * @return bool True if there are associated recommended replace vars.
	 */
	private function has_recommended_replace_vars( $recommended_replace_vars, $page_type ) {
		if ( ! isset( $recommended_replace_vars[ $page_type ] ) ) {
			return false;
		}

		if ( ! is_array( $recommended_replace_vars[ $page_type ] ) ) {
			return false;
		}

		return true;
	}

	/**
	 * Determines whether or not a post is the homepage.
	 *
	 * @param WP_Post $post The WordPress global post object.
	 *
	 * @return bool True if the given post is the homepage.
	 */
	private function is_homepage( $post ) {
		if ( $post instanceof WP_Post === false ) {
			return false;
		}

		/*
		 * The page on front returns a string with normal WordPress interaction, while the post ID is an int.
		 * This way we make sure we always compare strings.
		 */
		$post_id       = (int) $post->ID;
		$page_on_front = (int) get_option( 'page_on_front' );

		return get_option( 'show_on_front' ) === 'page' && $page_on_front === $post_id;
	}
}
PK     ”T]‹�    )  google_search_console/class-gsc-issue.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Class WPSEO_GSC_Issue.
 */
class WPSEO_GSC_Issue {

	/**
	 * @var string
	 */
	private $url;

	/**
	 * @var DateTime
	 */
	private $first_detected;

	/**
	 * @var DateTime
	 */
	private $last_crawled;

	/**
	 * @var string
	 */
	private $response_code;

	/**
	 * Search Console issue class constructor.
	 *
	 * @param string   $url            URL of the issue.
	 * @param DateTime $first_detected Time of first discovery.
	 * @param DateTime $last_crawled   Time of last crawl.
	 * @param string   $response_code  HTTP response code.
	 */
	public function __construct( $url, DateTime $first_detected, DateTime $last_crawled, $response_code ) {
		$this->url            = $url;
		$this->first_detected = $first_detected;
		$this->last_crawled   = $last_crawled;
		$this->response_code  = $response_code;
	}

	/**
	 * Put the class properties in array.
	 *
	 * @return array
	 */
	public function to_array() {
		return array(
			'url'                => $this->url,
			'first_detected'     => $this->to_date_format( $this->first_detected ),
			'first_detected_raw' => $this->to_timestamp( $this->first_detected ),
			'last_crawled'       => $this->to_date_format( $this->last_crawled ),
			'last_crawled_raw'   => $this->to_timestamp( $this->last_crawled ),
			'response_code'      => $this->response_code,
		);
	}

	/**
	 * Converting the date to a date format.
	 *
	 * @param DateTime $date_to_convert Date instance.
	 * @param string   $format          Format string.
	 *
	 * @return string
	 */
	private function to_date_format( DateTime $date_to_convert, $format = '' ) {

		if ( empty( $format ) ) {
			$format = get_option( 'date_format' );
		}

		return date_i18n( $format, $date_to_convert->format( 'U' ) );
	}

	/**
	 * Converting the date to a timestamp.
	 *
	 * @param DateTime $date_to_convert Date object instance.
	 *
	 * @return string
	 */
	private function to_timestamp( DateTime $date_to_convert ) {
		return $date_to_convert->format( 'U' );
	}
}
PK     ”T]÷¢™¢V  V  4  google_search_console/class-gsc-category-filters.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Class WPSEO_GSC_Category_Filters.
 *
 * This class will get all category counts from the options and will parse the filter links that are displayed above
 * the crawl issue tables.
 */
class WPSEO_GSC_Category_Filters {

	/**
	 * The counts per category.
	 *
	 * @var array
	 */
	private $category_counts = array();

	/**
	 * All the possible filters.
	 *
	 * @var array
	 */
	private $filter_values = array();

	/**
	 * The current category.
	 *
	 * @var string
	 */
	private $category;

	/**
	 * Constructing this object.
	 *
	 * Setting the hook to create the issues categories as the links.
	 *
	 * @param array $platform_counts Set of issue counts by platform.
	 */
	public function __construct( array $platform_counts ) {
		if ( ! empty( $platform_counts ) ) {
			$this->set_counts( $platform_counts );
		}

		// Setting the filter values.
		$this->set_filter_values();

		$this->category = $this->get_current_category();
	}

	/**
	 * Returns the value of the current category.
	 *
	 * @return mixed|string
	 */
	public function get_category() {
		return $this->category;
	}

	/**
	 * Returns the current filters as an array.
	 *
	 * Only return categories with more than 0 issues.
	 *
	 * @return array
	 */
	public function as_array() {
		$new_views = array();

		foreach ( $this->category_counts as $category_name => $category ) {
			$new_views[] = $this->create_view_link( $category_name, $category['count'] );
		}

		return $new_views;
	}

	/**
	 * Getting the current view.
	 */
	private function get_current_category() {
		$current_category = filter_input( INPUT_GET, 'category' );
		if ( ! empty( $current_category ) ) {
			return $current_category;
		}

		// Just prevent redirect loops.
		if ( ! empty( $this->category_counts ) ) {
			$current_category = 'not_found';
			if ( empty( $this->category_counts[ $current_category ] ) ) {
				$current_category = key( $this->category_counts );
			}

			// Just redirect to set the category.
			wp_redirect( add_query_arg( 'category', $current_category ) );
			exit;
		}
	}

	/**
	 * Setting the view counts based on the saved data. The info will be used to display the category filters.
	 *
	 * @param array $platform_counts Set of counts by platform.
	 */
	private function set_counts( array $platform_counts ) {
		$this->category_counts = $this->parse_counts( $platform_counts );
	}

	/**
	 * Setting the values for the filter.
	 */
	private function set_filter_values() {
		$this->set_filter_value(
			'access_denied',
			__( 'Access denied', 'wordpress-seo' ),
			__( 'Server requires authentication or is blocking Googlebot from accessing the site.', 'wordpress-seo' ),
			sprintf(
				/* translators: %s: category name. N.B.: The category name is translated separately. */
				__( 'Show information about errors in category %s', 'wordpress-seo' ),
				__( 'Access denied', 'wordpress-seo' )
			)
		);
		$this->set_filter_value( 'faulty_redirects', __( 'Faulty redirects', 'wordpress-seo' ) );
		$this->set_filter_value( 'not_followed', __( 'Not followed', 'wordpress-seo' ) );
		$this->set_filter_value(
			'not_found',
			__( 'Not found', 'wordpress-seo' ),
			__( 'URL points to a non-existent page.', 'wordpress-seo' ),
			sprintf(
				/* translators: %s: category name. N.B.: The category name is translated separately. */
				__( 'Show information about errors in category %s', 'wordpress-seo' ),
				__( 'Not found', 'wordpress-seo' )
			)
		);
		$this->set_filter_value(
			'other',
			__( 'Other', 'wordpress-seo' ),
			__( 'Google was unable to crawl this URL due to an undetermined issue.', 'wordpress-seo' ),
			sprintf(
				/* translators: %s: category name. N.B.: The category name is translated separately. */
				__( 'Show information about errors in category %s', 'wordpress-seo' ),
				__( 'Other', 'wordpress-seo' )
			)
		);
		$this->set_filter_value(
			'roboted',
			__( 'Blocked', 'wordpress-seo' ),
			sprintf(
				/* translators: %1$s: expands to '<code>robots.txt</code>'. */
				__( 'Googlebot could access your site, but certain URLs are blocked for Googlebot in your %1$s file. This block could either be for all Googlebots or even specifically for Googlebot-mobile.', 'wordpress-seo' ),
				'<code>robots.txt</code>'
			),
			sprintf(
				/* translators: %s: category name. N.B.: The category name is translated separately. */
				__( 'Show information about errors in category %s', 'wordpress-seo' ),
				__( 'Blocked', 'wordpress-seo' )
			)
		);
		$this->set_filter_value(
			'server_error',
			__( 'Server Error', 'wordpress-seo' ),
			__( 'Request timed out or site is blocking Google.', 'wordpress-seo' ),
			sprintf(
				/* translators: %s: category name. N.B.: The category name is translated separately. */
				__( 'Show information about errors in category %s', 'wordpress-seo' ),
				__( 'Server Error', 'wordpress-seo' )
			)
		);
		$this->set_filter_value(
			'soft_404',
			__( 'Soft 404', 'wordpress-seo' ),
			__( "The target URL doesn't exist, but your server is not returning a 404 (file not found) error.", 'wordpress-seo' ),
			sprintf(
				/* translators: %s: category name. N.B.: The category name is translated separately. */
				__( 'Show information about errors in category %s', 'wordpress-seo' ),
				__( 'Soft 404', 'wordpress-seo' )
			)
		);
	}

	/**
	 * Add new filter value to the filter_values.
	 *
	 * @param string $key              Filter key.
	 * @param string $value            Filter value.
	 * @param string $description      Optional description string.
	 * @param string $help_button_text Optional help button text.
	 */
	private function set_filter_value( $key, $value, $description = '', $help_button_text = '' ) {
		$this->filter_values[ $key ] = array(
			'value'       => $value,
			'description' => $description,
			'help-button' => $help_button_text,
		);
	}

	/**
	 * Creates a filter link.
	 *
	 * @param string  $category Issue type.
	 * @param integer $count    Count for the type.
	 *
	 * @return string
	 */
	private function create_view_link( $category, $count ) {
		$href = add_query_arg(
			array(
				'category' => $category,
				'paged'    => 1,
			)
		);

		$class        = 'gsc_category';
		$aria_current = '';

		if ( $this->category === $category ) {
			$class       .= ' current';
			$aria_current = ' aria-current="page"';
		}

		$help_button = '';
		$help_panel  = '';
		if ( $this->filter_values[ $category ]['description'] !== '' ) {
			$help        = new WPSEO_Admin_Help_Panel( $category, $this->filter_values[ $category ]['help-button'], $this->filter_values[ $category ]['description'], 'has-wrapper' );
			$help_button = $help->get_button_html();
			$help_panel  = $help->get_panel_html();
		}

		return sprintf(
			'<a href="%1$s" class="%2$s"%8$s>%3$s</a> (<span id="gsc_count_%4$s">%5$s</span>) %6$s %7$s',
			esc_attr( $href ),
			$class,
			$this->filter_values[ $category ]['value'],
			$category,
			$count,
			$help_button,
			$help_panel,
			$aria_current
		);
	}

	/**
	 * Parsing the category counts.
	 *
	 * When there are 0 issues for a specific category, just remove that one from the array.
	 *
	 * @param array $category_counts Set of counts for categories.
	 *
	 * @return mixed
	 */
	private function parse_counts( $category_counts ) {
		foreach ( $category_counts as $category_name => $category ) {
			if ( $category['count'] === '0' ) {
				unset( $category_counts[ $category_name ] );
			}
		}

		return $category_counts;
	}
}
PK     ”T]�SÊ‰í   í   %  google_search_console/views/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]ê{šë  ë  6  google_search_console/views/gsc-redirect-nopremium.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * This is the view for the modal box that appears when premium isn't loaded.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

_deprecated_file( __FILE__, 'WPSEO 9.5' );

echo '<h1 class="wpseo-redirect-url-title">';
printf(
	/* Translators: %s: expands to Yoast SEO Premium */
	esc_html__( 'Creating redirects is a %s feature', 'wordpress-seo' ),
	'Yoast SEO Premium'
);
echo '</h1>';
echo '<p>';
printf(
	/* Translators: %1$s: expands to 'Yoast SEO Premium', %2$s: links to Yoast SEO Premium plugin page. */
	esc_html__( 'To be able to create a redirect and fix this issue, you need %1$s. You can buy the plugin, including one year of support and updates, on %2$s.', 'wordpress-seo' ),
	'Yoast SEO Premium',
	'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/redirects' ) ) . '" target="_blank">yoast.com</a>'
);
echo '</p>';
echo '<button type="button" class="button wpseo-redirect-close">' . esc_html__( 'Close', 'wordpress-seo' ) . '</button>';
PK     ”T]�$uçœ  œ  +  google_search_console/views/gsc-display.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

// Admin header.
Yoast_Form::get_instance()->admin_header( false, 'wpseo-gsc', false, 'yoast_wpseo_gsc_options' );

// GSC Error notification.
$gsc_profile = WPSEO_GSC_Settings::get_profile();
$gsc_url     = 'https://search.google.com/search-console/index';
if ( $gsc_profile !== '' ) {
	$gsc_url .= '?resource_id=' . rawurlencode( $gsc_profile );
}
$gsc_post_url            = 'https://yoa.st/google-search-console-deprecated';
$gsc_style_alert         = '
	display: flex;
	align-items: baseline;
	position: relative;
	padding: 16px;
	border: 1px solid rgba(0, 0, 0, 0.2);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
	margin: 16px 0;
	color: #450c11;
	background: #f8d7da;
';
$gsc_style_alert_icon    = 'display: block; margin-right: 8px;';
$gsc_style_alert_content = 'max-width: 600px;';
$gsc_style_alert_link    = 'color: #004973;';
$gsc_notification        = sprintf(
	/* Translators: %1$s: expands to opening anchor tag, %2$s expands to closing anchor tag. */
	__( 'Google has discontinued its Crawl Errors API. Therefore, any possible crawl errors you might have cannot be displayed here anymore. %1$sRead our statement on this for further information%2$s.', 'wordpress-seo' ),
	'<a style="' . $gsc_style_alert_link . '" href="' . WPSEO_Shortlinker::get( $gsc_post_url ) . '" target="_blank" rel="noopener">',
	'</a>'
);
$gsc_notification .= '<br/><br/>';
$gsc_notification .= sprintf(
	/* Translators: %1$s: expands to opening anchor tag, %2$s expands to closing anchor tag. */
	__( 'To view your current crawl errors, %1$splease visit Google Search Console%2$s.', 'wordpress-seo' ),
	'<a style="' . $gsc_style_alert_link . '" href="' . $gsc_url . '" target="_blank" rel="noopener noreferrer">',
	'</a>'
);
?>
	<div style="<?php echo $gsc_style_alert; ?>">
	<span style="<?php echo $gsc_style_alert_icon; ?>">
		<svg xmlns="http://www.w3.org/2000/svg" width="12" height="14" viewBox="0 0 12 14" role="img" aria-hidden="true"
			focusable="false" fill="#450c11">
			<path
				d="M6 1q1.6 0 3 .8T11.2 4t.8 3-.8 3T9 12.2 6 13t-3-.8T.8 10 0 7t.8-3T3 1.8 6 1zm1 9.7V9.3 9L6.7 9H5l-.1.3V10.9l.3.1h1.6l.1-.3zm0-2.6L7 3.2v-.1L6.8 3H5 5l-.1.2.1 4.9.3.2h1.4l.2-.1Q7 8 6.9 8z"></path>
		</svg>
	</span>
		<span style="<?php echo $gsc_style_alert_content; ?>"><?php echo $gsc_notification; ?></span>
	</div>
<?php

$platform_tabs = new WPSEO_GSC_Platform_Tabs();

if ( defined( 'WP_DEBUG' ) && WP_DEBUG && WPSEO_GSC_Settings::get_profile() !== '' ) {
	?>
	<form action="" method="post" class="wpseo-gsc-reload-crawl-issues-form">
		<input type='hidden' name='reload-crawl-issues-nonce' value='<?php echo esc_attr( wp_create_nonce( 'reload-crawl-issues' ) ); ?>' />
		<input type="submit" name="reload-crawl-issues" id="reload-crawl-issue" class="button button-primary alignright"
			value="<?php esc_attr_e( 'Reload crawl issues', 'wordpress-seo' ); ?>">
	</form>
<?php } ?>

	<h2 class="nav-tab-wrapper" id="wpseo-tabs">
		<?php echo $platform_tabs; ?>
	</h2>

<?php

// Video explains about the options when connected only.
if ( null !== $this->service->get_client()->getAccessToken() ) {
	$video_url = WPSEO_Shortlinker::get( 'https://yoa.st/screencast-search-console' );
}
else {
	$video_url = WPSEO_Shortlinker::get( 'https://yoa.st/screencast-connect-search-console' );
}

$tab             = new WPSEO_Option_Tab( 'GSC', __( 'Google Search Console', 'wordpress-seo' ), array( 'video_url' => $video_url ) );
$gsc_help_center = new WPSEO_Help_Center( 'google-search-console', $tab, WPSEO_Utils::is_yoast_seo_premium() );
$gsc_help_center->localize_data();
$gsc_help_center->mount();

switch ( $platform_tabs->current_tab() ) {
	case 'settings':
		// Check if there is an access token.
		if ( null === $this->service->get_client()->getAccessToken() ) {
			// Print auth screen.
			echo '<p>';
			printf(
				/* Translators: %s: expands to Yoast SEO. */
				esc_html__( 'To allow %s to fetch your Google Search Console information, please enter your Google Authorization Code. Clicking the button below will open a new window.', 'wordpress-seo' ),
				'Yoast SEO'
			);
			echo "</p>\n";
			echo '<input type="hidden" id="gsc_auth_url" value="', esc_url( $this->service->get_client()->createAuthUrl() ) , '" />';
			echo "<button type='button' id='gsc_auth_code' class='button'>" , esc_html__( 'Get Google Authorization Code', 'wordpress-seo' ) ,"</button>\n";

			echo '<p id="gsc-enter-code-label">' . esc_html__( 'Enter your Google Authorization Code and press the Authenticate button.', 'wordpress-seo' ) . "</p>\n";
			echo "<form action='" . esc_url( admin_url( 'admin.php?page=wpseo_search_console&tab=settings' ) ) . "' method='post'>\n";
			echo "<input type='text' name='gsc[authorization_code]' value='' class='textinput' aria-labelledby='gsc-enter-code-label' />";
			echo "<input type='hidden' name='gsc[gsc_nonce]' value='" . esc_attr( wp_create_nonce( 'wpseo-gsc_nonce' ) ) . "' />";
			echo "<input type='submit' name='gsc[Submit]' value='" . esc_attr__( 'Authenticate', 'wordpress-seo' ) . "' class='button button-primary' />";
			echo "</form>\n";
		}
		else {
			$reset_button = '<a class="button" href="' . esc_url( add_query_arg( 'gsc_reset', 1 ) ) . '">' . esc_html__( 'Reauthenticate with Google', 'wordpress-seo' ) . '</a>';
			echo '<h3>', esc_html__( 'Current profile', 'wordpress-seo' ), '</h3>';
			$profile = WPSEO_GSC_Settings::get_profile();
			if ( $profile !== '' ) {
				echo '<p>';
				echo $profile;
				echo '</p>';

				echo '<p>';
				echo $reset_button;
				echo '</p>';

			}
			else {
				echo "<form action='" . esc_url( admin_url( 'options.php' ) ) . "' method='post'>";

				settings_fields( 'yoast_wpseo_gsc_options' );
				Yoast_Form::get_instance()->set_option( 'wpseo-gsc' );

				echo '<p>';
				$profiles = $this->service->get_sites();
				if ( ! empty( $profiles ) ) {
					$show_save = true;
					Yoast_Form::get_instance()->select( 'profile', esc_html__( 'Profile', 'wordpress-seo' ), $profiles );
				}
				else {
					$show_save = false;
					esc_html_e( 'There were no profiles found', 'wordpress-seo' );
				}
				echo '</p>';

				echo '<p>';

				if ( $show_save ) {
					echo '<input type="submit" name="submit" id="submit" class="button button-primary wpseo-gsc-save-profile" value="' . esc_attr__( 'Save Profile', 'wordpress-seo' ) . '" /> ' . esc_html__( 'or', 'wordpress-seo' ) . ' ';
				}
				echo $reset_button;
				echo '</p>';
				echo '</form>';
			}
		}
		break;

	default:
		$form_action_url = add_query_arg( 'page', esc_attr( filter_input( INPUT_GET, 'page' ) ) );

		$screen_reader_content = array(
			// There are no views links in this screen, so no need for the views heading.
			'heading_views'      => null,
			'heading_pagination' => __( 'Crawl issues list navigation', 'wordpress-seo' ),
			'heading_list'       => __( 'Crawl issues list', 'wordpress-seo' ),
		);
		get_current_screen()->set_screen_reader_content( $screen_reader_content );

		// Open <form>.
		echo "<form id='wpseo-crawl-issues-table-form' action='" . esc_url( $form_action_url ) . "' method='post'>\n";

		// AJAX nonce.
		echo "<input type='hidden' class='wpseo-gsc-ajax-security' value='" . esc_attr( wp_create_nonce( 'wpseo-gsc-ajax-security' ) ) . "' />\n";

		$this->display_table();

		// Close <form>.
		echo "</form>\n";

		if ( ! WPSEO_Utils::is_yoast_seo_premium() ) {
			echo '<div id="yoast-google-search-console-modal"></div>';
		}

		break;
}
?>
<?php
	// Add link to Knowledge Base article about crawl issues.
	echo '<p>';

	printf(
		/* translators: %1$s expands anchor to knowledge base article, %2$s expands to </a> */
		esc_html__( 'Please refer to %1$sour article about how to connect your website to Google Search Console%2$s if you need assistance.', 'wordpress-seo' ),
		'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/1zy' ) ) . '" target="_blank" rel="noopener noreferrer">',
		'</a>'
	);

	echo '</p>';
	?>

	<br class="clear" />
<?php

// Admin footer.
Yoast_Form::get_instance()->admin_footer( false );
PK     ”T]KÖiõ�'  �'  #  google_search_console/class-gsc.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\admin\google_search_console
 */

/**
 * Class WPSEO_GSC.
 */
class WPSEO_GSC implements WPSEO_WordPress_Integration {

	/**
	 * The option where data will be stored.
	 *
	 * @var string
	 */
	const OPTION_WPSEO_GSC = 'wpseo-gsc';

	/**
	 * @var WPSEO_GSC_Service
	 */
	private $service;

	/**
	 * @var WPSEO_GSC_Category_Filters
	 */
	protected $category_filter;

	/**
	 * @var WPSEO_GSC_Issues
	 */
	protected $issue_fetch;

	/**
	 * Current platform.
	 *
	 * @var string
	 */
	private $platform;

	/**
	 * Current category.
	 *
	 * @var string
	 */
	private $category;

	/**
	 * Registers the hooks.
	 *
	 * @return void
	 */
	public function register_hooks() {
		// Setting the screen option.
		if ( filter_input( INPUT_GET, 'page' ) === 'wpseo_search_console' ) {

			if ( filter_input( INPUT_GET, 'tab' ) !== 'settings' && ! $this->has_profile() ) {
				wp_redirect( add_query_arg( 'tab', 'settings' ) );
				exit;
			}

			add_action( 'admin_enqueue_scripts', array( $this, 'page_scripts' ) );
			add_filter( 'set-screen-option', array( $this, 'set_screen_option' ), 11, 3 );

			$this->set_dependencies();
			$this->request_handler();
		}

		add_action( 'admin_init', array( $this, 'register_gsc_notification' ) );
		add_action( 'admin_init', array( $this, 'register_settings' ) );
	}

	/**
	 * Handles the dashboard notification.
	 *
	 * If the Google Search Console has no credentials, show a notification
	 * for the user to give them a heads up. This message is dismissable.
	 *
	 * @return void
	 */
	public function register_gsc_notification() {
		$notification        = $this->get_profile_notification();
		$notification_center = Yoast_Notification_Center::get();
		$notification_center->remove_notification( $notification );
	}

	/**
	 * Builds the notification used when GSC is not connected to a profile.
	 *
	 * @return Yoast_Notification The notification.
	 */
	private function get_profile_notification() {
		return new Yoast_Notification(
			sprintf(
				/* translators: 1: link open tag; 2: link close tag. */
				__( 'Don\'t miss your crawl errors: %1$sconnect with Google Search Console here%2$s.', 'wordpress-seo' ),
				'<a href="' . admin_url( 'admin.php?page=wpseo_search_console&tab=settings' ) . '">',
				'</a>'
			),
			array(
				'type'         => Yoast_Notification::WARNING,
				'id'           => 'wpseo-dismiss-gsc',
				'capabilities' => 'wpseo_manage_options',
			)
		);
	}

	/**
	 * Makes sure the settings will be registered, so data can be stored.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function register_settings() {
		register_setting( 'yoast_wpseo_gsc_options', self::OPTION_WPSEO_GSC );
	}

	/**
	 * Outputs the HTML for the redirect page.
	 *
	 * @return void
	 */
	public function display() {
		require_once WPSEO_PATH . 'admin/google_search_console/views/gsc-display.php';
	}

	/**
	 * Displays the table.
	 *
	 * @return void
	 */
	public function display_table() {
		// The list table.
		$list_table = new WPSEO_GSC_Table( $this->platform, $this->category, $this->issue_fetch->get_issues() );

		// Adding filter to display the category filters.
		add_filter( 'views_' . $list_table->get_screen_id(), array( $this->category_filter, 'as_array' ) );

		// Preparing and displaying the table.
		$list_table->prepare_items();
		$list_table->search_box( __( 'Search', 'wordpress-seo' ), 'wpseo-crawl-issues-search' );
		$list_table->display();
	}

	/**
	 * Loads the admin redirects scripts.
	 *
	 * @return void
	 */
	public function page_scripts() {
		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_script( 'admin-gsc' );
		$asset_manager->enqueue_style( 'metabox-css' );

		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-gsc', 'wpseoAdminL10n', WPSEO_Utils::get_admin_l10n() );

		$screen_options = array(
			'label'   => __( 'Crawl errors per page', 'wordpress-seo' ),
			'default' => 50,
			'option'  => 'errors_per_page',
		);
		add_screen_option( 'per_page', $screen_options );
	}

	/**
	 * Sets the screen options.
	 *
	 * @param string $status Status string.
	 * @param string $option Option key.
	 * @param string $value  Value to return.
	 *
	 * @return mixed The screen option value. False when not errors_per_page.
	 */
	public function set_screen_option( $status, $option, $value ) {
		if ( 'errors_per_page' === $option ) {
			return $value;
		}

		return false;
	}

	/**
	 * Handles the POST and GET requests.
	 *
	 * @return void
	 */
	private function request_handler() {

		// List the table search post to a get.
		$this->list_table_search_post_to_get();

		// Catch the authorization code POST.
		$this->catch_authentication_post();

		// Is there a reset post than we will remove the posts and data.
		if ( filter_input( INPUT_GET, 'gsc_reset' ) ) {
			// Clear the google data.
			WPSEO_GSC_Settings::clear_data( $this->service );

			// Adding notification to the notification center.
			/* Translators: %1$s: expands to Google Search Console. */
			$this->add_notification( sprintf( __( 'The %1$s data has been removed. You will have to reauthenticate if you want to retrieve the data again.', 'wordpress-seo' ), 'Google Search Console' ), Yoast_Notification::UPDATED );

			// Directly output the notifications.
			wp_redirect( remove_query_arg( 'gsc_reset' ) );
			exit;
		}

		// Reloads al the issues.
		if ( wp_verify_nonce( filter_input( INPUT_POST, 'reload-crawl-issues-nonce' ), 'reload-crawl-issues' ) && filter_input( INPUT_POST, 'reload-crawl-issues' ) ) {
			// Reloading all the issues.
			WPSEO_GSC_Settings::reload_issues();

			// Adding the notification.
			$this->add_notification( __( 'The issues have been successfully reloaded!', 'wordpress-seo' ), Yoast_Notification::UPDATED );

			// Directly output the notifications.
			Yoast_Notification_Center::get()->display_notifications();
		}

		// Catch bulk action request.
		new WPSEO_GSC_Bulk_Action();
	}

	/**
	 * Catches the redirects search post and redirect it to a search get.
	 *
	 * @return void
	 */
	private function list_table_search_post_to_get() {
		$search_string = filter_input( INPUT_POST, 's' );

		if ( $search_string === null ) {
			return;
		}

		// When there is nothing being search and there is no search param in the url, break this method.
		if ( $search_string === '' && filter_input( INPUT_GET, 's' ) === null ) {
			return;
		}

		$url = ( $search_string !== '' ) ? add_query_arg( 's', $search_string ) : remove_query_arg( 's' );

		// Do the redirect.
		wp_redirect( $url );
		exit;
	}

	/**
	 * Catches the authentication post.
	 *
	 * @return void
	 */
	private function catch_authentication_post() {
		$gsc_values = filter_input( INPUT_POST, 'gsc', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );

		// Catch the authorization code POST.
		if ( ! empty( $gsc_values['authorization_code'] ) && wp_verify_nonce( $gsc_values['gsc_nonce'], 'wpseo-gsc_nonce' ) ) {
			if ( ! WPSEO_GSC_Settings::validate_authorization( trim( $gsc_values['authorization_code'] ), $this->service->get_client() ) ) {
				$this->add_notification( __( 'Incorrect Google Authorization Code.', 'wordpress-seo' ), Yoast_Notification::ERROR );
			}

			// Redirect user to prevent a post resubmission which causes an oauth error.
			wp_redirect( admin_url( 'admin.php' ) . '?page=' . esc_attr( filter_input( INPUT_GET, 'page' ) ) . '&tab=settings' );
			exit;
		}
	}

	/**
	 * Adds notification to the yoast notification center.
	 *
	 * @param string $message Message string.
	 * @param string $type    Message type.
	 *
	 * @return void
	 */
	private function add_notification( $message, $type ) {
		Yoast_Notification_Center::get()->add_notification(
			new Yoast_Notification( $message, array( 'type' => $type ) )
		);
	}

	/**
	 * Sets the dependencies which will be used one this page.
	 *
	 * @return void
	 */
	private function set_dependencies() {
		// Setting the service object.
		$this->service = new WPSEO_GSC_Service( WPSEO_GSC_Settings::get_profile() );

		// Setting the platform.
		$this->platform = WPSEO_GSC_Mapper::get_current_platform( 'tab' );

		// Loading the issue counter.
		$issue_count = new WPSEO_GSC_Count( $this->service );
		$issue_count->fetch_counts();

		// Loading the category filters.
		$this->category_filter = new WPSEO_GSC_Category_Filters( $issue_count->get_platform_counts( $this->platform ) );

		// Setting the current category.
		$this->category = $this->category_filter->get_category();

		// Listing the issues.
		$issue_count->list_issues( $this->platform, $this->category );

		// Fetching the issues.
		$this->issue_fetch = new WPSEO_GSC_Issues( $this->platform, $this->category, $issue_count->get_issues() );
	}

	/**
	 * Sets the tab help on top of the screen.
	 *
	 * @return void
	 */
	public function set_help() {
		$screen = get_current_screen();

		if ( $screen === null ) {
			return;
		}

		$screen->add_help_tab(
			array(
				'id'      => 'basic-help',
				'title'   => __( 'Issue categories', 'wordpress-seo' ),
				'content' => '<p><strong>' . __( 'Desktop', 'wordpress-seo' ) . '</strong><br />' . __( 'Errors that occurred when your site was crawled by Googlebot.', 'wordpress-seo' ) . '</p>'
							. '<p><strong>' . __( 'Smartphone', 'wordpress-seo' ) . '</strong><br />' . __( 'Errors that occurred only when your site was crawled by Googlebot-Mobile (errors didn\'t appear for desktop).', 'wordpress-seo' ) . '</p>'
							. '<p><strong>' . __( 'Feature phone', 'wordpress-seo' ) . '</strong><br />' . __( 'Errors that only occurred when your site was crawled by Googlebot for feature phones (errors didn\'t appear for desktop).', 'wordpress-seo' ) . '</p>',
			)
		);
	}

	/**
	 * Checks if a Google Search Console profile has been set.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return bool True when profile has been set.
	 */
	protected function has_profile() {
		return ( WPSEO_GSC_Settings::get_profile() !== '' );
	}

	/**
	 * Run init logic.
	 *
	 * @codeCoverageIgnore
	 *
	 * @deprecated 9.5
	 *
	 * @return void
	 */
	public function init() {
		_deprecated_function( __METHOD__, 'WPSEO 9.5' );
	}
}
PK     ”T]º¥.  .  /  google_search_console/class-gsc-bulk-action.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Class WPSEO_GSC_Bulk_Action.
 */
class WPSEO_GSC_Bulk_Action {

	/**
	 * Setting the listener on the bulk action post.
	 */
	public function __construct() {
		if ( wp_verify_nonce( filter_input( INPUT_POST, 'wpseo_gsc_nonce' ), 'wpseo_gsc_nonce' ) ) {
			$this->handle_bulk_action();
		}
	}

	/**
	 * Handles the bulk action when there is an action posted.
	 */
	private function handle_bulk_action() {
		$bulk_action = $this->determine_bulk_action();
		if ( $bulk_action !== false ) {
			$this->run_bulk_action( $bulk_action, $this->posted_issues() );

			wp_redirect( filter_input( INPUT_POST, '_wp_http_referer' ) );
			exit;
		}
	}

	/**
	 * Determine which bulk action is selected and return that value.
	 *
	 * @return string|bool
	 */
	private function determine_bulk_action() {
		$action_inputs = array(
			'action', // Bulk action select above the table.
			'action2', // Bulk action select below the table.
		);

		foreach ( $action_inputs as $action_name ) {
			$action = filter_input( INPUT_POST, $action_name );
			if ( ! empty( $action ) && $action !== '-1' ) {
				return $action;
			}
		}

		return false;
	}

	/**
	 * Get the posted issues and return them.
	 *
	 * @return array
	 */
	private function posted_issues() {
		$issues = filter_input( INPUT_POST, 'wpseo_crawl_issues', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
		if ( ! empty( $issues ) ) {
			return $issues;
		}

		// Fallback if issues are empty.
		return array();
	}

	/**
	 * Runs the bulk action.
	 *
	 * @param string $bulk_action Action type.
	 * @param array  $issues      Set of issues to apply to.
	 */
	private function run_bulk_action( $bulk_action, $issues ) {
		switch ( $bulk_action ) {
			case 'mark_as_fixed':
				array_map( array( $this, 'action_mark_as_fixed' ), $issues );

				break;
		}
	}

	/**
	 * Marks the issue as fixed.
	 *
	 * @param string $issue Issue URL.
	 *
	 * @return string
	 */
	private function action_mark_as_fixed( $issue ) {
		new WPSEO_GSC_Marker( $issue );

		return $issue;
	}
}
PK     ”T]�SÊ‰í   í     google_search_console/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]2ÙÕõë  ë  )  google_search_console/class-gsc-modal.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Represents the Google Search Console modal.
 */
class WPSEO_GSC_Modal {

	/**
	 * @var string
	 */
	protected $view;

	/**
	 * @var int
	 */
	protected $height;

	/**
	 * @var array
	 */
	protected $view_vars;

	/**
	 * Sets the required attributes for this object.
	 *
	 * @param string $view      The file with the view content.
	 * @param int    $height    The height that the modal will get.
	 * @param array  $view_vars The attributes to use in the view.
	 */
	public function __construct( $view, $height, array $view_vars = array() ) {
		$this->view      = $view;
		$this->height    = $height;
		$this->view_vars = $view_vars;
	}

	/**
	 * Returns the height of the modal.
	 *
	 * @return int The set height.
	 */
	public function get_height() {
		return $this->height;
	}

	/**
	 * Loads the view of the modal.
	 *
	 * @param string $unique_id An unique identifier for the modal.
	 */
	public function load_view( $unique_id ) {
		extract( $this->view_vars );

		echo '<div id="' . esc_attr( 'redirect-' . $unique_id ) . '" class="hidden">';
		echo '<div class="form-wrap wpseo_content_wrapper">';
		require $this->view;
		echo '</div>';
		echo '</div>';
	}
}
PK     ”T])D0Ð'  Ð'  )  google_search_console/class-gsc-table.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

if ( ! class_exists( 'WP_List_Table' ) ) {
	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
}

/**
 * Class WPSEO_GSC_Table.
 */
class WPSEO_GSC_Table extends WP_List_Table {

	/**
	 * @var int
	 */
	const FREE_MODAL_HEIGHT = 140;

	/**
	 * @var string
	 */
	private $search_string;

	/**
	 * The category that is displayed.
	 *
	 * @var mixed|string
	 */
	private $current_view;

	/**
	 * Number of entries to show per page.
	 *
	 * @var integer
	 */
	private $per_page = 50;

	/**
	 * @var integer
	 */
	private $current_page = 1;

	/**
	 * Search Console table class constructor (subclasses list table).
	 *
	 * @param string $platform Platform (desktop, mobile, feature phone).
	 * @param string $category Type of the issues.
	 * @param array  $items    Set of the issues to display.
	 */
	public function __construct( $platform, $category, array $items ) {
		parent::__construct();

		// Set search string.
		$search_string = filter_input( INPUT_GET, 's' );

		if ( $search_string !== '' ) {
			$this->search_string = $search_string;
		}

		$this->current_view = $category;

		// Set the crawl issue source.
		$this->show_fields( $platform );

		$this->items = $items;
	}

	/**
	 * Getting the screen id from this table.
	 *
	 * @return string
	 */
	public function get_screen_id() {
		return $this->screen->id;
	}

	/**
	 * Setup the table variables, fetch the items from the database, search, sort and format the items.
	 */
	public function prepare_items() {
		// Get variables needed for pagination.
		$this->per_page     = $this->get_items_per_page( 'errors_per_page', $this->per_page );
		$paged              = filter_input( INPUT_GET, 'paged' );
		$this->current_page = intval( ( ! empty( $paged ) ) ? $paged : 1 );

		$this->setup_columns();
		$this->views();
		$this->parse_items();
	}

	/**
	 * Set the table columns.
	 *
	 * @return array
	 */
	public function get_columns() {
		$columns = array(
			'cb'             => '<input type="checkbox" />',
			'url'            => __( 'URL', 'wordpress-seo' ),
			'last_crawled'   => __( 'Last crawled', 'wordpress-seo' ),
			'first_detected' => __( 'First detected', 'wordpress-seo' ),
			'response_code'  => __( 'Response code', 'wordpress-seo' ),
		);

		return $columns;
	}

	/**
	 * Return the columns that are sortable.
	 *
	 * @return array
	 */
	protected function get_sortable_columns() {
		$sortable_columns = array(
			'url'            => array( 'url', false ),
			'last_crawled'   => array( 'last_crawled', false ),
			'first_detected' => array( 'first_detected', false ),
			'response_code'  => array( 'response_code', false ),
		);

		return $sortable_columns;
	}

	/**
	 * Return available bulk actions.
	 *
	 * @return array
	 */
	protected function get_bulk_actions() {
		return array(
			'mark_as_fixed' => __( 'Mark as fixed', 'wordpress-seo' ),
		);
	}

	/**
	 * Default method to display a column.
	 *
	 * @param array  $item        Data array.
	 * @param string $column_name Column name key.
	 *
	 * @return mixed
	 */
	protected function column_default( $item, $column_name ) {
		return $item[ $column_name ];
	}

	/**
	 * Checkbox column.
	 *
	 * @param array $item Item data array.
	 *
	 * @return string
	 */
	protected function column_cb( $item ) {
		return sprintf(
			'<input type="checkbox" name="wpseo_crawl_issues[]" id="cb-%1$s" value="%2$s" /><label for="cb-%1$s" class="screen-reader-text">%3$s</label>',
			md5( $item['url'] ),
			$item['url'],
			__( 'Select redirect', 'wordpress-seo' )
		);
	}

	/**
	 * Formatting the output of the column last crawled into a dateformat.
	 *
	 * @param array $item Item data array.
	 *
	 * @return string
	 */
	protected function column_last_crawled( $item ) {
		return date_i18n( get_option( 'date_format' ), (int) $item['last_crawled_raw'] );
	}

	/**
	 * Formatting the output of the column first detected into a dateformat.
	 *
	 * @param array $item Item data array.
	 *
	 * @return string
	 */
	protected function column_first_detected( $item ) {
		return date_i18n( get_option( 'date_format' ), (int) $item['first_detected_raw'] );
	}

	/**
	 * URL column.
	 *
	 * @param array $item Item data array.
	 *
	 * @return string
	 */
	protected function column_url( $item ) {
		$actions = array();

		if ( $this->can_create_redirect() ) {
			$actions['create_redirect'] = $this->get_create_redirect_link( $item['url'] );
		}

		$actions['view']        = '<a href="' . home_url( $item['url'] ) . '" target="_blank">' . __( 'View', 'wordpress-seo' ) . '</a>';
		$actions['markasfixed'] = '<a href="javascript:wpseoMarkAsFixed(\'' . urlencode( $item['url'] ) . '\');">' . __( 'Mark as fixed', 'wordpress-seo' ) . '</a>';

		return sprintf(
			'<span class="value">%1$s</span> %2$s',
			$item['url'],
			$this->row_actions( $actions )
		);
	}

	/**
	 * Generates and display row actions links for the list table.
	 *
	 * We override the parent class method to avoid buttons to be printed out twice.
	 *
	 * @param object $item        The item being acted upon.
	 * @param string $column_name Current column name.
	 * @param string $primary     Primary column name.
	 * @return string Empty string.
	 */
	protected function handle_row_actions( $item, $column_name, $primary ) {
		return '';
	}

	/**
	 * Running the setup of the columns.
	 */
	private function setup_columns() {
		$this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns() );
	}

	/**
	 * Check if the current category allow creating redirects.
	 *
	 * @return bool
	 */
	private function can_create_redirect() {
		return in_array( $this->current_view, array( 'soft_404', 'not_found', 'access_denied' ), true );
	}

	/**
	 * Setting the table navigation.
	 *
	 * @param int $total_items    Total number of items.
	 * @param int $posts_per_page Number of items per page.
	 */
	private function set_pagination( $total_items, $posts_per_page ) {
		$pagination_args = array(
			'total_items' => $total_items,
			'total_pages' => ceil( ( $total_items / $posts_per_page ) ),
			'per_page'    => $posts_per_page,
		);

		$this->set_pagination_args( $pagination_args );
	}

	/**
	 * Setting the items.
	 */
	private function parse_items() {
		if ( is_array( $this->items ) && count( $this->items ) > 0 ) {
			if ( ! empty( $this->search_string ) ) {
				$this->do_search();
			}

			$this->set_pagination( count( $this->items ), $this->per_page );

			$this->sort_items();
			$this->paginate_items();
		}
	}

	/**
	 * Search through the items.
	 */
	private function do_search() {
		$results = array();

		foreach ( $this->items as $item ) {
			foreach ( $item as $value ) {
				if ( stristr( $value, $this->search_string ) !== false ) {
					$results[] = $item;
					continue;
				}
			}
		}

		$this->items = $results;
	}

	/**
	 * Running the pagination.
	 */
	private function paginate_items() {
		/*
		 * Setting the starting point. If starting point is below 1, overwrite it
		 * with value 0, otherwise it will be sliced off at the back.
		 */
		$slice_start = ( $this->current_page - 1 );
		if ( $slice_start < 0 ) {
			$slice_start = 0;
		}

		// Apply 'pagination'.
		$this->items = array_slice( $this->items, ( $slice_start * $this->per_page ), $this->per_page );
	}

	/**
	 * Sort the items by callback.
	 */
	private function sort_items() {
		// Sort the results.
		usort( $this->items, array( $this, 'do_reorder' ) );
	}

	/**
	 * Doing the sorting of the issues.
	 *
	 * @param array $a First data set for comparison.
	 * @param array $b Second data set for comparison.
	 *
	 * @return int
	 */
	private function do_reorder( $a, $b ) {
		$orderby = filter_input( INPUT_GET, 'orderby' );
		$order   = filter_input( INPUT_GET, 'order' );

		// If no sort, default to title.
		$orderby = ( ! empty( $orderby ) ) ? $orderby : 'url';

		// If no order, default to asc.
		$order = ( ! empty( $order ) ) ? $order : 'asc';

		// When there is a raw field of it, sort by this field.
		if ( array_key_exists( $orderby . '_raw', $a ) && array_key_exists( $orderby . '_raw', $b ) ) {
			$orderby = $orderby . '_raw';
		}

		// Determine sort order.
		$result = strcmp( $a[ $orderby ], $b[ $orderby ] );

		// Send final sort direction to usort.
		return ( $order === 'asc' ) ? $result : ( - $result );
	}

	/**
	 * Retrieves the create redirect link.
	 *
	 * @param string $url The url to create the modal for.
	 *
	 * @return string Link for creating the redirect.
	 */
	private function get_create_redirect_link( $url ) {
		/** Gets the modal box */
		$modal = $this->get_modal_box( $url );

		if ( ! $modal ) {
			return sprintf(
				'<a href="#YoastRedirect" class="wpseo-open-gsc-redirect-modal aria-button-if-js">%s</a>',
				__( 'Create redirect', 'wordpress-seo' )
			);
		}

		$modal->load_view( md5( $url ) );

		return sprintf(
			'<a href="%1$s" class="thickbox wpseo-open-gsc-redirect-modal aria-button-if-js">%2$s</a>',
			'#TB_inline?width=600&height=' . $modal->get_height() . '&inlineId=redirect-' . md5( $url ),
			__( 'Create redirect', 'wordpress-seo' )
		);
	}

	/**
	 * Checks if premium is loaded, if not the nopremium modal will be shown. Otherwise it will load the premium one.
	 *
	 * @param string $url URL string.
	 *
	 * @return WPSEO_GSC_Modal|null Instance of the GSC modal.
	 */
	private function get_modal_box( $url ) {
		if ( ! WPSEO_Utils::is_yoast_seo_premium() || ! class_exists( 'WPSEO_Premium_GSC_Modal' ) ) {
			return null;
		}

		static $premium_modal;

		if ( ! $premium_modal ) {
			$premium_modal = new WPSEO_Premium_GSC_Modal();
		}

		return $premium_modal->show( $url );
	}

	/**
	 * Showing the hidden fields used by the AJAX requests.
	 *
	 * @param string $platform Platform (desktop, mobile, feature phone).
	 */
	private function show_fields( $platform ) {
		echo '<input type="hidden" name="wpseo_gsc_nonce" value="' . esc_attr( wp_create_nonce( 'wpseo_gsc_nonce' ) ) . '" />';
		echo '<input id="field_platform" type="hidden" name="platform" value="' . esc_attr( $platform ) . '" />';
		echo '<input id="field_category" type="hidden" name="category" value="' . esc_attr( $this->current_view ) . '" />';
	}
}
PK     ”T][œ¯^û  û  *  google_search_console/class-gsc-config.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class WPSEO_GSC_Config.
 */
class WPSEO_GSC_Config {

	/**
	 * @var array
	 */
	public static $gsc = array(
		'application_name' => 'Yoast SEO',
		'client_id'        => '395430892738-ushj8aced0cji2j4bkq6bda6felaigb9.apps.googleusercontent.com',
		'client_secret'    => 'c2kYgOwMhk1emWxQ3NaA8wOi',
		'redirect_uri'     => 'urn:ietf:wg:oauth:2.0:oob',
		'scopes'           => array( 'https://www.googleapis.com/auth/webmasters' ),
	);

}
PK     ”T]Þì¼_  _  )  google_search_console/class-gsc-count.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Class WPSEO_GSC_Count.
 */
class WPSEO_GSC_Count {

	/**
	 * The name of the option containing the last checked timestamp.
	 *
	 * @var string
	 */
	const OPTION_CI_LAST_FETCH = 'wpseo_gsc_last_fetch';

	/**
	 * The option name where the issues counts are saved.
	 *
	 * @var string
	 */
	const OPTION_CI_COUNTS = 'wpseo_gsc_issues_counts';

	/**
	 * @var WPSEO_GSC_Service
	 */
	private $service;

	/**
	 * Holder for the fetched issues from GSC.
	 *
	 * @var array
	 */
	private $issues = array();

	/**
	 * Fetching the counts
	 *
	 * @param WPSEO_GSC_Service $service Service class instance.
	 */
	public function __construct( WPSEO_GSC_Service $service ) {
		$this->service = $service;
	}

	/**
	 * Getting the counts for given platform and return them as an array.
	 *
	 * @param string $platform Platform (desktop, mobile, feature phone).
	 *
	 * @return array
	 */
	public function get_platform_counts( $platform ) {
		$counts = $this->get_counts();
		if ( array_key_exists( $platform, $counts ) ) {
			return $counts[ $platform ];
		}

		return array();
	}

	/**
	 * Return the fetched issues.
	 *
	 * @return array
	 */
	public function get_issues() {
		return $this->issues;
	}

	/**
	 * Listing the issues an gives them back as fetched issues.
	 *
	 * @param string $platform Platform (desktop, mobile, feature phone).
	 * @param string $category Issue category.
	 */
	public function list_issues( $platform, $category ) {
		$counts = $this->get_counts();

		if ( array_key_exists( $platform, $counts ) ) {
			$counts[ $platform ] = $this->list_category_issues( $counts[ $platform ], $platform, $category );

			// Write the new counts value.
			$this->set_counts( $counts );
		}
	}

	/**
	 * Getting the counts for given platform and category.
	 *
	 * @param string $platform Platform (desktop, mobile, feature phone).
	 * @param string $category Issue type.
	 *
	 * @return integer
	 */
	public function get_issue_count( $platform, $category ) {
		$counts = $this->get_counts();

		if ( ! empty( $counts[ $platform ][ $category ]['count'] ) ) {
			return $counts[ $platform ][ $category ]['count'];
		}

		return 0;
	}

	/**
	 * Update the count of the issues.
	 *
	 * @param string  $platform  Platform (desktop, mobile, feature phone).
	 * @param string  $category  Issue type.
	 * @param integer $new_count Updated count.
	 */
	public function update_issue_count( $platform, $category, $new_count ) {
		$counts = $this->get_counts();

		if ( ! empty( $counts[ $platform ][ $category ] ) && is_array( $counts[ $platform ][ $category ] ) ) {
			$counts[ $platform ][ $category ]['count'] = $new_count;
		}

		$this->set_counts( $counts );
	}

	/**
	 * Fetching the counts from the GSC API.
	 */
	public function fetch_counts() {
		if ( WPSEO_GSC_Settings::get_profile() && $this->get_last_fetch() <= strtotime( '-12 hours' ) ) {
			// Remove the timestamp.
			$this->remove_last_fetch();

			// Getting the counts and parse them.
			$counts = $this->parse_counts( $this->service->get_crawl_issue_counts() );

			// Fetching the counts by setting an option.
			$this->set_counts( $counts );

			// Saving the current timestamp.
			$this->save_last_fetch();
		}
	}

	/**
	 * Parsing the received counts from the API and map the keys to plugin friendly values.
	 *
	 * @param array $fetched_counts Set of retrieved counts.
	 *
	 * @return array
	 */
	private function parse_counts( array $fetched_counts ) {
		$counts = array();
		foreach ( $fetched_counts as $platform_name => $categories ) {
			$new_platform = WPSEO_GSC_Mapper::platform_from_api( $platform_name );

			foreach ( $categories as $category_name => $category ) {
				$new_category = WPSEO_GSC_Mapper::category_from_api( $category_name );

				$counts[ $new_platform ][ $new_category ] = $category;
			}
		}

		return $counts;
	}

	/**
	 * Listing the issues for current category.
	 *
	 * @param array  $counts   Set of counts.
	 * @param string $platform Platform (desktop, mobile, feature phone).
	 * @param string $category Issue type.
	 *
	 * @return array
	 */
	private function list_category_issues( array $counts, $platform, $category ) {
		// When the issues have to be fetched.
		if ( array_key_exists( $category, $counts ) && $counts[ $category ]['count'] > 0 && $counts[ $category ]['last_fetch'] <= strtotime( '-12 hours' ) ) {
			$issues = $this->service->fetch_category_issues( WPSEO_GSC_Mapper::platform_to_api( $platform ), WPSEO_GSC_Mapper::category_to_api( $category ) );
			if ( ! empty( $issues ) ) {
				$this->issues = $issues;
			}

			// Be sure the total count is correct.
			$counts[ $category ]['count'] = count( $this->issues );

			// Set last fetch.
			$counts[ $category ]['last_fetch'] = time();
		}

		return $counts;
	}

	/**
	 * Getting the counts from the options
	 *
	 * @return array
	 */
	private function get_counts() {
		return get_option( self::OPTION_CI_COUNTS, array() );
	}

	/**
	 * Fetching the counts from the service and store them in an option
	 *
	 * @param array $counts Set of counts.
	 */
	private function set_counts( array $counts ) {
		update_option( self::OPTION_CI_COUNTS, $counts );
	}

	/**
	 * Store the timestamp of when crawl errors were saved the last time.
	 */
	private function save_last_fetch() {
		add_option( self::OPTION_CI_LAST_FETCH, time(), '', 'no' );
	}

	/**
	 * Remove the last checked option
	 */
	private function remove_last_fetch() {
		delete_option( self::OPTION_CI_LAST_FETCH );
	}

	/**
	 * Get the timestamp of when the crawl errors were last saved
	 *
	 * @return int
	 */
	private function get_last_fetch() {
		return get_option( self::OPTION_CI_LAST_FETCH, 0 );
	}
}
PK     ”T]°³I    *  google_search_console/class-gsc-marker.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Class WPSEO_GSC_Marker.
 */
class WPSEO_GSC_Marker {

	/**
	 * @var WPSEO_GSC_Issues
	 */
	private $crawl_issues;

	/**
	 * @var string
	 */
	private $url = '';

	/**
	 * @var string
	 */
	private $platform;

	/**
	 * @var string
	 */
	private $category;

	/**
	 * @var string
	 */
	private $result;

	/**
	 * Setting up the needed API libs and return the result.
	 *
	 * If param URL is given, the request is performed by a bulk action.
	 *
	 * @param string $url Optional URL.
	 */
	public function __construct( $url = '' ) {
		$this->url    = $url;
		$this->result = $this->get_result();
	}

	/**
	 * Getting the response for the AJAX request.
	 *
	 * @return string
	 */
	public function get_response() {
		return $this->result;
	}

	/**
	 * Setting the result, this method will check if current.
	 *
	 * @return string
	 */
	private function get_result() {
		if ( $this->can_be_marked_as_fixed() ) {
			$service = new WPSEO_GSC_Service( WPSEO_GSC_Settings::get_profile() );

			if ( $this->set_crawl_issues() && $this->send_mark_as_fixed( $service ) && $this->delete_crawl_issue() ) {
				$this->update_issue_count( $service );

				return 'true';
			}
		}

		return 'false';
	}

	/**
	 * Check if request is valid by verifying the posted nonce and return the URL if this one is set.
	 *
	 * @return bool|string
	 */
	private function can_be_marked_as_fixed() {
		if ( $this->url !== '' ) {
			return $this->url;
		}

		return false;
	}

	/**
	 * Storing the data belonging to the current issue, this data is needed in the 'mark as fixed' flow.
	 *
	 * @return bool
	 */
	private function set_crawl_issues() {
		$this->platform = filter_input( INPUT_POST, 'platform' );
		$this->category = filter_input( INPUT_POST, 'category' );
		if ( $this->platform && $this->category ) {
			$this->crawl_issues = new WPSEO_GSC_Issues( $this->platform, $this->category );

			return true;
		}

		return false;
	}

	/**
	 * Sending a request to the Google Search Console API to let them know we marked an issue as fixed.
	 *
	 * @param WPSEO_GSC_Service $service Service object instance.
	 *
	 * @return bool
	 */
	private function send_mark_as_fixed( WPSEO_GSC_Service $service ) {
		return $service->mark_as_fixed( $this->url, $this->platform, $this->category );
	}

	/**
	 * Delete the crawl issue from the database.
	 *
	 * @return bool
	 */
	private function delete_crawl_issue() {
		return $this->crawl_issues->delete_issue( $this->url );
	}

	/**
	 * Getting the counts for current platform - category combination and update the score of it.
	 *
	 * @param WPSEO_GSC_Service $service Service object instance.
	 */
	private function update_issue_count( WPSEO_GSC_Service $service ) {
		$counts = new WPSEO_GSC_Count( $service );

		// Get the issues.
		$total_issues = $counts->get_issue_count( $this->platform, $this->category );

		// Lower the current count with 1.
		--$total_issues;

		// And update the count.
		$counts->update_issue_count( $this->platform, $this->category, $total_issues );
	}
}
PK     ”T]�ÝXw
  w
  (  google_search_console/class-gsc-ajax.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Class WPSEO_GSC_Ajax.
 */
class WPSEO_GSC_Ajax {

	/**
	 * Setting the AJAX hooks for GSC.
	 */
	public function __construct() {
		add_action( 'wp_ajax_wpseo_mark_fixed_crawl_issue', array( $this, 'ajax_mark_as_fixed' ) );
		add_action( 'wp_ajax_wpseo_dismiss_gsc', array( $this, 'dismiss_notice' ) );
		add_action( 'wp_ajax_wpseo_save_auth_code', array( $this, 'save_auth_code' ) );
		add_action( 'wp_ajax_wpseo_clear_auth_code', array( $this, 'clear_auth_code' ) );
		add_action( 'wp_ajax_wpseo_get_profiles', array( $this, 'get_profiles' ) );
	}

	/**
	 * This method will be access by an AJAX request and will mark an issue as fixed.
	 *
	 * First it will do a request to the Google API.
	 */
	public function ajax_mark_as_fixed() {
		if ( $this->valid_nonce() ) {
			$marker = new WPSEO_GSC_Marker( filter_input( INPUT_POST, 'url' ) );

			wp_die( $marker->get_response() );
		}

		wp_die( 'false' );
	}

	/**
	 * Handle the AJAX request and dismiss the GSC notice.
	 */
	public function dismiss_notice() {
		check_ajax_referer( 'dismiss-gsc-notice' );

		update_user_meta( get_current_user_id(), 'wpseo_dismissed_gsc_notice', true );

		wp_die( 'true' );
	}

	/**
	 * Saves the authorization code.
	 */
	public function save_auth_code() {
		if ( ! $this->valid_nonce() ) {
			wp_die( '0' );
		}

		// Validate the authorization.
		$service                = $this->get_service();
		$authorization_code     = filter_input( INPUT_POST, 'authorization' );
		$is_authorization_valid = WPSEO_GSC_Settings::validate_authorization( $authorization_code, $service->get_client() );
		if ( ! $is_authorization_valid ) {
			wp_die( '0' );
		}

		$this->get_profiles();
	}

	/**
	 * Clears all authorization data.
	 */
	public function clear_auth_code() {
		if ( ! $this->valid_nonce() ) {
			wp_die( '0' );
		}

		$service = $this->get_service();

		WPSEO_GSC_Settings::clear_data( $service );

		$this->get_profiles();
	}

	/**
	 * Check if posted nonce is valid and return true if it is.
	 *
	 * @return mixed
	 */
	private function valid_nonce() {
		return wp_verify_nonce( filter_input( INPUT_POST, 'ajax_nonce' ), 'wpseo-gsc-ajax-security' );
	}

	/**
	 * Returns an instance of the Google Search Console service.
	 *
	 * @return WPSEO_GSC_Service
	 */
	private function get_service() {
		return new WPSEO_GSC_Service();
	}

	/**
	 * Prints a JSON encoded string with the current profile config.
	 */
	private function get_profiles() {
		$component = new WPSEO_Config_Component_Connect_Google_Search_Console();

		wp_die( WPSEO_Utils::format_json_encode( $component->get_data() ) );
	}
}
PK     ”T]5žZ‚‚	  ‚	  ,  google_search_console/class-gsc-settings.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Class WPSEO_GSC_Settings.
 */
class WPSEO_GSC_Settings {

	/**
	 * Clear all data from the database.
	 *
	 * @param WPSEO_GSC_Service $service Service class instance.
	 */
	public static function clear_data( WPSEO_GSC_Service $service ) {
		// Remove issue and issue counts.
		self::remove();

		// Removes the GSC options.
		self::remove_gsc_option();

		// Clear the service data.
		$service->clear_data();
	}

	/**
	 * Reloading all the issues.
	 */
	public static function reload_issues() {
		// Remove issue and issue counts.
		self::remove();
	}

	/**
	 * When authorization is successful return true, otherwise false.
	 *
	 * @param string                  $authorization_code Code to validate.
	 * @param Yoast_Api_Google_Client $client             Client object instance.
	 *
	 * @return bool
	 */
	public static function validate_authorization( $authorization_code, Yoast_Api_Google_Client $client ) {
		return ( $authorization_code !== '' && $client->authenticate_client( $authorization_code ) );
	}

	/**
	 * Get the GSC profile.
	 *
	 * @return string
	 */
	public static function get_profile() {
		// Get option.
		$option = get_option( WPSEO_GSC::OPTION_WPSEO_GSC, array( 'profile' => '' ) );

		// Set the profile.
		$profile = '';
		if ( ! empty( $option['profile'] ) ) {
			$profile = $option['profile'];
		}

		// Return the profile.
		return trim( $profile, '/' );
	}

	/**
	 * Removes the issue counts and all the issues from the options.
	 */
	private static function remove() {
		// Remove the issue counts from the options.
		self::remove_issue_counts();

		// Removing all issues from the database.
		self::remove_issues();
	}

	/**
	 * Remove the issue counts.
	 */
	private static function remove_issue_counts() {
		// Remove the options which are holding the counts.
		delete_option( WPSEO_GSC_Count::OPTION_CI_COUNTS );
		delete_option( WPSEO_GSC_Count::OPTION_CI_LAST_FETCH );
	}

	/**
	 * Delete the issues and their meta data from the database.
	 */
	private static function remove_issues() {
		global $wpdb;

		// Remove local crawl issues by running a delete query.
		$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'wpseo-gsc-issues-%'" );
	}

	/**
	 * Removes the options for GSC.
	 */
	private static function remove_gsc_option() {
		delete_option( WPSEO_GSC::OPTION_WPSEO_GSC );
	}
}
PK     ”T]¡uo.í  í  *  google_search_console/class-gsc-issues.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Class WPSEO_GSC_Issues.
 */
class WPSEO_GSC_Issues {

	/**
	 * @var string
	 */
	private $option_name = '';

	/**
	 * List of all current issues to compare with received issues.
	 *
	 * @var array
	 */
	private $current_issues = array();

	/**
	 * Holder for all the issues.
	 *
	 * @var array
	 */
	private $issues = array();

	/**
	 * Setting up the properties and fetching the current issues.
	 *
	 * @param string     $platform       Platform type (desktop, mobile, feature phone).
	 * @param string     $category       Issues category.
	 * @param array|bool $fetched_issues Optional set of issues.
	 */
	public function __construct( $platform, $category, $fetched_issues = false ) {
		$this->option_name = strtolower( 'wpseo-gsc-issues-' . $platform . '-' . $category );
		$this->issues      = $this->get_issues();

		if ( ! empty( $fetched_issues ) && is_array( $fetched_issues ) ) {
			$this->save_fetched_issues( $fetched_issues );
		}
	}

	/**
	 * Getting the issues from the options.
	 *
	 * @return array
	 */
	public function get_issues() {
		return get_option( $this->option_name, array() );
	}

	/**
	 * Deleting the issue from the issues.
	 *
	 * @param string $url URL to delete issues for.
	 *
	 * @return bool
	 */
	public function delete_issue( $url ) {
		$target_issue = $this->get_issue_by_url( $url );
		if ( $target_issue !== false ) {
			unset( $this->issues[ $target_issue ] );

			$this->save_issues( $this->issues );

			return true;
		}

		return false;
	}

	/**
	 * Fetching the issues for current category and compare them with the already existing issues.
	 *
	 * @param array $fetched_issues Set of retrieved issues.
	 */
	private function save_fetched_issues( array $fetched_issues ) {
		$this->set_current_issues();

		$crawl_issues = $this->get_issues();

		// Walk through the issues to do the comparison.
		foreach ( $fetched_issues as $issue ) {
			$this->issue_compare( $crawl_issues, $issue );
		}

		$this->save_issues( $crawl_issues );

		// Refresh the value of $this->issues.
		$this->issues = $this->get_issues();
	}

	/**
	 * Comparing the issue with the list of current existing issues.
	 *
	 * @param array    $crawl_issues Set of issues by reference.
	 * @param stdClass $issue        Issue object to check against the list.
	 */
	private function issue_compare( &$crawl_issues, $issue ) {
		$issue->pageUrl = WPSEO_Utils::format_url( (string) $issue->pageUrl );

		if ( ! in_array( $issue->pageUrl, $this->current_issues, true ) ) {
			array_push(
				$crawl_issues,
				$this->get_issue( $this->create_issue( $issue ) )
			);
		}
	}

	/**
	 * The fetched issue from the API will be parsed as an WPSEO_Crawl_Issue object. After initializing the issue as an
	 * object, the object will be returned.
	 *
	 * @param stdClass $issue Issue data object.
	 *
	 * @return WPSEO_GSC_Issue
	 */
	private function create_issue( $issue ) {
		return new WPSEO_GSC_Issue(
			$issue->pageUrl,
			new DateTime( (string) $issue->first_detected ),
			new DateTime( (string) $issue->last_crawled ),
			(string) ( ! empty( $issue->responseCode ) ) ? $issue->responseCode : null
		);
	}

	/**
	 * Returns the crawl issue as an array.
	 *
	 * @param WPSEO_GSC_Issue $crawl_issue Issue object instance.
	 *
	 * @return array()
	 */
	private function get_issue( WPSEO_GSC_Issue $crawl_issue ) {
		return $crawl_issue->to_array();
	}

	/**
	 * Saving the issues to the options. The target option is base on current platform and category.
	 *
	 * @param array $issues Set of issues.
	 */
	private function save_issues( array $issues ) {
		update_option( $this->option_name, $issues, false );
	}

	/**
	 * Getting the issues from the options and get only the URL out of it. This is because there will be a comparison
	 * with the issues from the API.
	 */
	private function set_current_issues() {
		if ( ! empty( $this->issues ) ) {
			$this->current_issues = wp_list_pluck( $this->issues, 'url' );
		}
	}

	/**
	 * Search in the issues for the given $url.
	 *
	 * @param string $url Issue URL to search for.
	 *
	 * @return int|string
	 */
	private function get_issue_by_url( $url ) {
		foreach ( $this->issues as $key => $issue ) {
			if ( $url === $issue['url'] ) {
				return $key;
			}
		}

		return false;
	}
}
PK     ”T]+ŽÍ¶å
  å
  *  google_search_console/class-gsc-mapper.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Class WPSEO_GSC_Mapper.
 */
class WPSEO_GSC_Mapper {

	/**
	 * The platforms which can be mapped.
	 *
	 * @var array
	 */
	private static $platforms = array(
		'web'             => 'web',
		'mobile'          => 'mobile',
		'smartphone_only' => 'smartphoneOnly',
		'settings'        => 'settings', // This one is basicly not a platform, but a tab.
	);

	/**
	 * The categories which can be mapped.
	 *
	 * @var array
	 */
	private static $categories = array(
		'access_denied'    => 'authPermissions',
		'faulty_redirects' => 'manyToOneRedirect',
		'not_followed'     => 'notFollowed',
		'not_found'        => 'notFound',
		'other'            => 'other',
		'roboted'          => 'roboted',
		'server_error'     => 'serverError',
		'soft_404'         => 'soft404',
	);

	/**
	 * If there is no platform, just get the first key out of the array and redirect to it.
	 *
	 * @param string $platform Platform (desktop, mobile, feature phone).
	 *
	 * @return mixed
	 */
	public static function get_current_platform( $platform ) {
		$current_platform = filter_input( INPUT_GET, $platform );
		if ( ! empty( $current_platform ) ) {
			return $current_platform;
		}

		wp_redirect( add_query_arg( $platform, key( self::$platforms ) ) );
		exit;
	}

	/**
	 * Mapping the platform.
	 *
	 * @param string $platform Platform (desktop, mobile, feature phone).
	 *
	 * @return mixed
	 */
	public static function platform_to_api( $platform ) {
		if ( ! empty( $platform ) && array_key_exists( $platform, self::$platforms ) ) {
			return self::$platforms[ $platform ];
		}
	}

	/**
	 * Mapping the given platform by value and return its key.
	 *
	 * @param string $platform Platform (desktop, mobile, feature phone).
	 *
	 * @return string
	 */
	public static function platform_from_api( $platform ) {
		if ( ! empty( $platform ) ) {
			$platform = array_search( $platform, self::$platforms, true );
			if ( $platform !== false ) {
				return $platform;
			}
		}

		return $platform;
	}

	/**
	 * Mapping the given category by searching for its key.
	 *
	 * @param string $category Issue type.
	 *
	 * @return mixed
	 */
	public static function category_to_api( $category ) {
		if ( ! empty( $category ) && array_key_exists( $category, self::$categories ) ) {
			return self::$categories[ $category ];
		}

		return $category;
	}

	/**
	 * Mapping the given category by value and return its key.
	 *
	 * @param string $category Issue type.
	 *
	 * @return string
	 */
	public static function category_from_api( $category ) {
		if ( ! empty( $category ) ) {
			$category = array_search( $category, self::$categories, true );
			if ( $category !== false ) {
				return $category;
			}
		}

		return $category;
	}
}
PK     ”T]O®¸3	  3	  1  google_search_console/class-gsc-platform-tabs.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Class WPSEO_GSC_Platform_Tabs.
 */
class WPSEO_GSC_Platform_Tabs {

	/**
	 * @var string
	 */
	private $current_tab;

	/**
	 * Return the tabs as a string.
	 *
	 * @return string
	 */
	public function __toString() {
		return $this->platform_tabs();
	}

	/**
	 * Getting the current_tab.
	 *
	 * @return string
	 */
	public function current_tab() {
		return $this->current_tab;
	}

	/**
	 * Loops through the array with all the platforms and convert it into an array.
	 *
	 * @return string
	 */
	private function platform_tabs() {
		$tabs = array( 'settings' => __( 'Settings', 'wordpress-seo' ) );

		$platforms = array(
			'web'             => __( 'Desktop', 'wordpress-seo' ),
			'smartphone_only' => __( 'Smartphone', 'wordpress-seo' ),
			'mobile'          => __( 'Feature phone', 'wordpress-seo' ),
		);

		if ( WPSEO_GSC_Settings::get_profile() !== '' ) {
			$tabs = array_merge( $platforms, $tabs );
		}

		$admin_link = admin_url( 'admin.php?page=wpseo_search_console&tab=' );

		$this->set_current_tab( $tabs );

		$return = '';

		foreach ( $tabs as $platform_target => $platform_value ) {
			$return .= $this->platform_tab( $platform_target, $platform_value, $admin_link );
		}

		return $return;
	}

	/**
	 * Setting the current tab.
	 *
	 * @param array $platforms Set of platforms (desktop, mobile, feature phone).
	 */
	private function set_current_tab( array $platforms ) {
		$this->current_tab = key( $platforms );
		$current_platform  = filter_input( INPUT_GET, 'tab' );
		if ( ! empty( $current_platform ) && isset( $platforms[ $current_platform ] ) ) {
			$this->current_tab = $current_platform;
		}
	}

	/**
	 * Parses the tab.
	 *
	 * @param string $platform_target Platform (desktop, mobile, feature phone).
	 * @param string $platform_value  Link anchor.
	 * @param string $admin_link      Link URL admin base.
	 *
	 * @return string
	 */
	private function platform_tab( $platform_target, $platform_value, $admin_link ) {
		$active = '';
		if ( $this->current_tab === $platform_target ) {
			$active = ' nav-tab-active';
		}

		return '<a class="nav-tab' . esc_attr( $active ) . '" id="' . esc_attr( $platform_target . '-tab' ) . '" href="' . esc_url( $admin_link . $platform_target ) . '">' . esc_html( $platform_value ) . '</a>';
	}
}
PK     ”T]:$ßK�  �  +  google_search_console/class-gsc-service.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Google_Search_Console
 */

/**
 * Class WPSEO_GSC_Service.
 */
class WPSEO_GSC_Service {

	/**
	 * @var Yoast_Api_Google_Client
	 */
	private $client;

	/**
	 * @var string
	 */
	private $profile;

	/**
	 * Search Console service constructor.
	 *
	 * @param string $profile Profile name.
	 */
	public function __construct( $profile = '' ) {
		$this->profile = $profile;

		$this->set_client();
	}

	/**
	 * Returns the client.
	 *
	 * @return Yoast_Api_Google_Client
	 */
	public function get_client() {
		return $this->client;
	}

	/**
	 * Removes the option and calls the clients clear_data method to clear that one as well.
	 */
	public function clear_data() {
		// Clear client data.
		$this->client->clear_data();
	}

	/**
	 * Get all sites that are registered in the GSC panel.
	 *
	 * @return array
	 */
	public function get_sites() {
		$sites = array();

		$response_json = $this->client->do_request( 'sites', true );

		// Do list sites request.
		if ( ! empty( $response_json->siteEntry ) ) {
			foreach ( $response_json->siteEntry as $entry ) {
				$sites[ str_ireplace( 'sites/', '', (string) $entry->siteUrl ) ] = (string) $entry->siteUrl;
			}

			// Sorting the retrieved sites.
			asort( $sites );
		}

		return $sites;
	}

	/**
	 * Get crawl issues.
	 *
	 * @return array
	 */
	public function get_crawl_issue_counts() {
		// Setup crawl error list.
		$crawl_error_counts = $this->get_crawl_error_counts( $this->profile );

		$return = array();
		// Ignore coding standards for object properties.
		if ( ! empty( $crawl_error_counts->countPerTypes ) ) {
			foreach ( $crawl_error_counts->countPerTypes as $category ) {
				$return[ $category->platform ][ $category->category ] = array(
					'count'      => $category->entries[0]->count,
					'last_fetch' => null,
				);
			}
		}

		return $return;
	}

	/**
	 * Sending request to mark issue as fixed.
	 *
	 * @param string $url      Issue URL.
	 * @param string $platform Platform (desktop, mobile, feature phone).
	 * @param string $category Issue type.
	 *
	 * @return bool
	 */
	public function mark_as_fixed( $url, $platform, $category ) {
		$response = $this->client->do_request( 'sites/' . urlencode( $this->profile ) . '/urlCrawlErrorsSamples/' . urlencode( ltrim( $url, '/' ) ) . '?category=' . WPSEO_GSC_Mapper::category_to_api( $category ) . '&platform=' . WPSEO_GSC_Mapper::platform_to_api( $platform ) . '', false, 'DELETE' );
		return ( $response->getResponseHttpCode() === 204 );
	}

	/**
	 * Fetching the issues from the GSC API.
	 *
	 * @param string $platform Platform (desktop, mobile, feature phone).
	 * @param string $category Issue type.
	 *
	 * @return mixed
	 */
	public function fetch_category_issues( $platform, $category ) {
		$issues = $this->client->do_request(
			'sites/' . urlencode( $this->profile ) . '/urlCrawlErrorsSamples?category=' . $category . '&platform=' . $platform,
			true
		);

		if ( ! empty( $issues->urlCrawlErrorSample ) ) {
			return $issues->urlCrawlErrorSample;
		}
	}

	/**
	 * Setting the GSC client.
	 */
	private function set_client() {
		try {
			new Yoast_Api_Libs( '2.0' );
		}
		catch ( Exception $exception ) {
			if ( $exception->getMessage() === 'required_version' ) {
				$this->incompatible_api_libs(
					__( 'Yoast plugins share some code between them to make your site faster. As a result of that, we need all Yoast plugins to be up to date. We\'ve detected this isn\'t the case, so please update the Yoast plugins that aren\'t up to date yet.', 'wordpress-seo' )
				);
			}
		}

		if ( class_exists( 'Yoast_Api_Google_Client' ) === false ) {
			$this->incompatible_api_libs(
				sprintf(
					/* translators: %1$s expands to Yoast SEO, %2$s expands to Google Analytics by Yoast */
					__(
						'%1$s detected youâ€™re using a version of %2$s which is not compatible with %1$s. Please update %2$s to the latest version to use this feature.',
						'wordpress-seo'
					),
					'Yoast SEO',
					'Google Analytics by Yoast'
				)
			);

			wp_redirect( admin_url( 'admin.php?page=' . WPSEO_Admin::PAGE_IDENTIFIER ) );
			exit;
		}

		$this->client = new Yoast_Api_Google_Client( WPSEO_GSC_Config::$gsc, 'wpseo-gsc', 'https://www.googleapis.com/webmasters/v3/' );
	}

	/**
	 * Adding notice that the api libs has the wrong version.
	 *
	 * @param string $notice Message string.
	 */
	private function incompatible_api_libs( $notice ) {
		Yoast_Notification_Center::get()->add_notification(
			new Yoast_Notification( $notice, array( 'type' => Yoast_Notification::ERROR ) )
		);
	}

	/**
	 * Getting the crawl error counts.
	 *
	 * @param string $profile Profile name string.
	 *
	 * @return object|bool
	 */
	private function get_crawl_error_counts( $profile ) {
		$crawl_error_counts = $this->client->do_request(
			'sites/' . urlencode( $profile ) . '/urlCrawlErrorsCounts/query',
			true
		);

		if ( ! empty( $crawl_error_counts ) ) {
			return $crawl_error_counts;
		}

		return false;
	}
}
PK     ”T]÷ö¤ì™  ™    class-option-tab.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Options\Tabs
 */

/**
 * Class WPSEO_Option_Tab.
 */
class WPSEO_Option_Tab {

	/**
	 * Name of the tab.
	 *
	 * @var string
	 */
	private $name;

	/**
	 * Label of the tab.
	 *
	 * @var string
	 */
	private $label;

	/**
	 * Optional arguments.
	 *
	 * @var array
	 */
	private $arguments;

	/**
	 * WPSEO_Option_Tab constructor.
	 *
	 * @param string $name      Name of the tab.
	 * @param string $label     Localized label of the tab.
	 * @param array  $arguments Optional arguments.
	 */
	public function __construct( $name, $label, array $arguments = array() ) {
		$this->name      = sanitize_title( $name );
		$this->label     = $label;
		$this->arguments = $arguments;
	}

	/**
	 * Gets the name.
	 *
	 * @return string The name.
	 */
	public function get_name() {
		return $this->name;
	}

	/**
	 * Gets the label.
	 *
	 * @return string The label.
	 */
	public function get_label() {
		return $this->label;
	}

	/**
	 * Gets the video URL.
	 *
	 * @return string The video url.
	 */
	public function get_video_url() {
		return $this->get_argument( 'video_url' );
	}

	/**
	 * Retrieves whether the tab needs a save button.
	 *
	 * @return bool True whether the tabs needs a save button.
	 */
	public function has_save_button() {
		return (bool) $this->get_argument( 'save_button', true );
	}

	/**
	 * Gets the option group.
	 *
	 * @return string The option group.
	 */
	public function get_opt_group() {
		return $this->get_argument( 'opt_group' );
	}

	/**
	 * Retrieves the variable from the supplied arguments.
	 *
	 * @param string       $variable Variable to retrieve.
	 * @param string|mixed $default  Default to use when variable not found.
	 *
	 * @return mixed|string The retrieved variable.
	 */
	protected function get_argument( $variable, $default = '' ) {
		return array_key_exists( $variable, $this->arguments ) ? $this->arguments[ $variable ] : $default;
	}
}
PK     ”T]r²#mŸ  Ÿ    class-yoast-alerts.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Notifications
 */

/**
 * Class Yoast_Alerts.
 */
class Yoast_Alerts {

	/**
	 * @var string
	 */
	const ADMIN_PAGE = 'wpseo_dashboard';

	/**
	 * Total notifications count.
	 *
	 * @var int
	 */
	private static $notification_count = 0;

	/**
	 * All error notifications.
	 *
	 * @var array
	 */
	private static $errors = array();

	/**
	 * Active errors.
	 *
	 * @var array
	 */
	private static $active_errors = array();

	/**
	 * Dismissed errors.
	 *
	 * @var array
	 */
	private static $dismissed_errors = array();

	/**
	 * All warning notifications.
	 *
	 * @var array
	 */
	private static $warnings = array();

	/**
	 * Active warnings.
	 *
	 * @var array
	 */
	private static $active_warnings = array();

	/**
	 * Dismissed warnings.
	 *
	 * @var array
	 */
	private static $dismissed_warnings = array();

	/**
	 * Yoast_Alerts constructor.
	 */
	public function __construct() {

		$this->add_hooks();
	}

	/**
	 * Add hooks
	 */
	private function add_hooks() {

		$page = filter_input( INPUT_GET, 'page' );
		if ( self::ADMIN_PAGE === $page ) {
			add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
		}

		// Needed for adminbar and Alerts page.
		add_action( 'admin_init', array( __CLASS__, 'collect_alerts' ), 99 );

		// Add AJAX hooks.
		add_action( 'wp_ajax_yoast_dismiss_alert', array( $this, 'ajax_dismiss_alert' ) );
		add_action( 'wp_ajax_yoast_restore_alert', array( $this, 'ajax_restore_alert' ) );
	}

	/**
	 * Enqueue assets.
	 */
	public function enqueue_assets() {

		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_style( 'alerts' );
	}

	/**
	 * Handle ajax request to dismiss an alert.
	 */
	public function ajax_dismiss_alert() {

		$notification = $this->get_notification_from_ajax_request();
		if ( $notification ) {
			$notification_center = Yoast_Notification_Center::get();
			$notification_center->maybe_dismiss_notification( $notification );

			$this->output_ajax_response( $notification->get_type() );
		}

		wp_die();
	}

	/**
	 * Handle ajax request to restore an alert.
	 */
	public function ajax_restore_alert() {

		$notification = $this->get_notification_from_ajax_request();
		if ( $notification ) {
			$notification_center = Yoast_Notification_Center::get();
			$notification_center->restore_notification( $notification );

			$this->output_ajax_response( $notification->get_type() );
		}

		wp_die();
	}

	/**
	 * Create AJAX response data.
	 *
	 * @param string $type Alert type.
	 */
	private function output_ajax_response( $type ) {

		$html = $this->get_view_html( $type );
		echo WPSEO_Utils::format_json_encode(
			array(
				'html'  => $html,
				'total' => self::get_active_alert_count(),
			)
		);
	}

	/**
	 * Get the HTML to return in the AJAX request.
	 *
	 * @param string $type Alert type.
	 *
	 * @return bool|string
	 */
	private function get_view_html( $type ) {

		switch ( $type ) {
			case 'error':
				$view = 'errors';
				break;

			case 'warning':
			default:
				$view = 'warnings';
				break;
		}

		// Re-collect alerts.
		self::collect_alerts();

		/** @noinspection PhpUnusedLocalVariableInspection */
		$alerts_data = self::get_template_variables();

		ob_start();
		include WPSEO_PATH . 'admin/views/partial-alerts-' . $view . '.php';
		$html = ob_get_clean();

		return $html;
	}

	/**
	 * Extract the Yoast Notification from the AJAX request.
	 *
	 * @return null|Yoast_Notification
	 */
	private function get_notification_from_ajax_request() {

		$notification_center = Yoast_Notification_Center::get();
		$notification_id     = filter_input( INPUT_POST, 'notification' );

		return $notification_center->get_notification_by_id( $notification_id );
	}

	/**
	 * Show the alerts overview page.
	 */
	public static function show_overview_page() {

		/** @noinspection PhpUnusedLocalVariableInspection */
		$alerts_data = self::get_template_variables();

		include WPSEO_PATH . 'admin/views/alerts-dashboard.php';
	}

	/**
	 * Collect the alerts and group them together.
	 */
	public static function collect_alerts() {

		$notification_center = Yoast_Notification_Center::get();

		$notifications            = $notification_center->get_sorted_notifications();
		self::$notification_count = count( $notifications );

		self::$errors           = array_filter( $notifications, array( __CLASS__, 'filter_error_alerts' ) );
		self::$dismissed_errors = array_filter( self::$errors, array( __CLASS__, 'filter_dismissed_alerts' ) );
		self::$active_errors    = array_diff( self::$errors, self::$dismissed_errors );

		self::$warnings           = array_filter( $notifications, array( __CLASS__, 'filter_warning_alerts' ) );
		self::$dismissed_warnings = array_filter( self::$warnings, array( __CLASS__, 'filter_dismissed_alerts' ) );
		self::$active_warnings    = array_diff( self::$warnings, self::$dismissed_warnings );
	}

	/**
	 * Get the variables needed in the views.
	 *
	 * @return array
	 */
	public static function get_template_variables() {

		return array(
			'metrics'  => array(
				'total'    => self::$notification_count,
				'active'   => self::get_active_alert_count(),
				'errors'   => count( self::$errors ),
				'warnings' => count( self::$warnings ),
			),
			'errors'   => array(
				'dismissed' => self::$dismissed_errors,
				'active'    => self::$active_errors,
			),
			'warnings' => array(
				'dismissed' => self::$dismissed_warnings,
				'active'    => self::$active_warnings,
			),
		);
	}

	/**
	 * Get the number of active alerts.
	 *
	 * @return int
	 */
	public static function get_active_alert_count() {

		return ( count( self::$active_errors ) + count( self::$active_warnings ) );
	}

	/**
	 * Filter out any non-errors.
	 *
	 * @param Yoast_Notification $notification Notification to test.
	 *
	 * @return bool
	 */
	private static function filter_error_alerts( Yoast_Notification $notification ) {

		return $notification->get_type() === 'error';
	}

	/**
	 * Filter out any non-warnings.
	 *
	 * @param Yoast_Notification $notification Notification to test.
	 *
	 * @return bool
	 */
	private static function filter_warning_alerts( Yoast_Notification $notification ) {

		return $notification->get_type() !== 'error';
	}

	/**
	 * Filter out any dismissed notifications.
	 *
	 * @param Yoast_Notification $notification Notification to test.
	 *
	 * @return bool
	 */
	private static function filter_dismissed_alerts( Yoast_Notification $notification ) {

		return Yoast_Notification_Center::is_notification_dismissed( $notification );
	}
}
PK     ”T]ðNwæ)  æ)    ajax.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

/**
 * @todo this whole thing should probably be a proper class.
 */

/**
 * Convenience function to JSON encode and echo results and then die.
 *
 * @param array $results Results array for encoding.
 */
function wpseo_ajax_json_echo_die( $results ) {
	echo WPSEO_Utils::format_json_encode( $results );
	die();
}

/**
 * Function used from AJAX calls, takes it variables from $_POST, dies on exit.
 */
function wpseo_set_option() {
	if ( ! current_user_can( 'manage_options' ) ) {
		die( '-1' );
	}

	check_ajax_referer( 'wpseo-setoption' );

	$option = sanitize_text_field( filter_input( INPUT_POST, 'option' ) );
	if ( $option !== 'page_comments' ) {
		die( '-1' );
	}

	update_option( $option, 0 );
	die( '1' );
}

add_action( 'wp_ajax_wpseo_set_option', 'wpseo_set_option' );

/**
 * Since 3.2 Notifications are dismissed in the Notification Center.
 */
add_action( 'wp_ajax_yoast_dismiss_notification', array( 'Yoast_Notification_Center', 'ajax_dismiss_notification' ) );

/**
 * Function used to remove the admin notices for several purposes, dies on exit.
 */
function wpseo_set_ignore() {
	if ( ! current_user_can( 'manage_options' ) ) {
		die( '-1' );
	}

	check_ajax_referer( 'wpseo-ignore' );

	$ignore_key = sanitize_text_field( filter_input( INPUT_POST, 'option' ) );
	WPSEO_Options::set( 'ignore_' . $ignore_key, true );

	die( '1' );
}

add_action( 'wp_ajax_wpseo_set_ignore', 'wpseo_set_ignore' );

/**
 * Hides the default tagline notice for a specific user.
 */
function wpseo_dismiss_tagline_notice() {
	if ( ! current_user_can( 'manage_options' ) ) {
		die( '-1' );
	}

	check_ajax_referer( 'wpseo-dismiss-tagline-notice' );

	update_user_meta( get_current_user_id(), 'wpseo_seen_tagline_notice', 'seen' );

	die( '1' );
}

add_action( 'wp_ajax_wpseo_dismiss_tagline_notice', 'wpseo_dismiss_tagline_notice' );

/**
 * Used in the editor to replace vars for the snippet preview.
 */
function wpseo_ajax_replace_vars() {
	global $post;
	check_ajax_referer( 'wpseo-replace-vars' );

	$post = get_post( intval( filter_input( INPUT_POST, 'post_id' ) ) );
	global $wp_query;
	$wp_query->queried_object    = $post;
	$wp_query->queried_object_id = $post->ID;

	$omit = array( 'excerpt', 'excerpt_only', 'title' );
	echo wpseo_replace_vars( stripslashes( filter_input( INPUT_POST, 'string' ) ), $post, $omit );
	die;
}

add_action( 'wp_ajax_wpseo_replace_vars', 'wpseo_ajax_replace_vars' );

/**
 * Save an individual SEO title from the Bulk Editor.
 */
function wpseo_save_title() {
	wpseo_save_what( 'title' );
}

add_action( 'wp_ajax_wpseo_save_title', 'wpseo_save_title' );

/**
 * Save an individual meta description from the Bulk Editor.
 */
function wpseo_save_description() {
	wpseo_save_what( 'metadesc' );
}

add_action( 'wp_ajax_wpseo_save_metadesc', 'wpseo_save_description' );

/**
 * Save titles & descriptions.
 *
 * @param string $what Type of item to save (title, description).
 */
function wpseo_save_what( $what ) {
	check_ajax_referer( 'wpseo-bulk-editor' );

	$new      = filter_input( INPUT_POST, 'new_value' );
	$post_id  = intval( filter_input( INPUT_POST, 'wpseo_post_id' ) );
	$original = filter_input( INPUT_POST, 'existing_value' );

	$results = wpseo_upsert_new( $what, $post_id, $new, $original );

	wpseo_ajax_json_echo_die( $results );
}

/**
 * Helper function to update a post's meta data, returning relevant information
 * about the information updated and the results or the meta update.
 *
 * @param int    $post_id         Post ID.
 * @param string $new_meta_value  New meta value to record.
 * @param string $orig_meta_value Original meta value.
 * @param string $meta_key        Meta key string.
 * @param string $return_key      Return key string to use in results.
 *
 * @return string
 */
function wpseo_upsert_meta( $post_id, $new_meta_value, $orig_meta_value, $meta_key, $return_key ) {

	$post_id                  = intval( $post_id );
	$sanitized_new_meta_value = wp_strip_all_tags( $new_meta_value );
	$orig_meta_value          = wp_strip_all_tags( $orig_meta_value );

	$upsert_results = array(
		'status'                 => 'success',
		'post_id'                => $post_id,
		"new_{$return_key}"      => $sanitized_new_meta_value,
		"original_{$return_key}" => $orig_meta_value,
	);

	$the_post = get_post( $post_id );
	if ( empty( $the_post ) ) {

		$upsert_results['status']  = 'failure';
		$upsert_results['results'] = __( 'Post doesn\'t exist.', 'wordpress-seo' );

		return $upsert_results;
	}

	$post_type_object = get_post_type_object( $the_post->post_type );
	if ( ! $post_type_object ) {

		$upsert_results['status']  = 'failure';
		$upsert_results['results'] = sprintf(
			/* translators: %s expands to post type. */
			__( 'Post has an invalid Content Type: %s.', 'wordpress-seo' ),
			$the_post->post_type
		);

		return $upsert_results;
	}

	if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {

		$upsert_results['status']  = 'failure';
		$upsert_results['results'] = sprintf(
			/* translators: %s expands to post type name. */
			__( 'You can\'t edit %s.', 'wordpress-seo' ),
			$post_type_object->label
		);

		return $upsert_results;
	}

	if ( ! current_user_can( $post_type_object->cap->edit_others_posts ) && (int) $the_post->post_author !== get_current_user_id() ) {

		$upsert_results['status']  = 'failure';
		$upsert_results['results'] = sprintf(
			/* translators: %s expands to the name of a post type (plural). */
			__( 'You can\'t edit %s that aren\'t yours.', 'wordpress-seo' ),
			$post_type_object->label
		);

		return $upsert_results;

	}

	if ( $sanitized_new_meta_value === $orig_meta_value && $sanitized_new_meta_value !== $new_meta_value ) {
		$upsert_results['status']  = 'failure';
		$upsert_results['results'] = __( 'You have used HTML in your value which is not allowed.', 'wordpress-seo' );

		return $upsert_results;
	}

	$res = update_post_meta( $post_id, $meta_key, $sanitized_new_meta_value );

	$upsert_results['status']  = ( $res !== false ) ? 'success' : 'failure';
	$upsert_results['results'] = $res;

	return $upsert_results;
}

/**
 * Save all titles sent from the Bulk Editor.
 */
function wpseo_save_all_titles() {
	wpseo_save_all( 'title' );
}

add_action( 'wp_ajax_wpseo_save_all_titles', 'wpseo_save_all_titles' );

/**
 * Save all description sent from the Bulk Editor.
 */
function wpseo_save_all_descriptions() {
	wpseo_save_all( 'metadesc' );
}

add_action( 'wp_ajax_wpseo_save_all_descriptions', 'wpseo_save_all_descriptions' );

/**
 * Utility function to save values.
 *
 * @param string $what Type of item so save.
 */
function wpseo_save_all( $what ) {
	check_ajax_referer( 'wpseo-bulk-editor' );

	$results = array();
	if ( ! isset( $_POST['items'], $_POST['existingItems'] ) ) {
		wpseo_ajax_json_echo_die( $results );
	}

	$new_values      = array_map( array( 'WPSEO_Utils', 'sanitize_text_field' ), wp_unslash( (array) $_POST['items'] ) );
	$original_values = array_map( array( 'WPSEO_Utils', 'sanitize_text_field' ), wp_unslash( (array) $_POST['existingItems'] ) );

	foreach ( $new_values as $post_id => $new_value ) {
		$original_value = $original_values[ $post_id ];
		$results[]      = wpseo_upsert_new( $what, $post_id, $new_value, $original_value );
	}

	wpseo_ajax_json_echo_die( $results );
}

/**
 * Insert a new value.
 *
 * @param string $what     Item type (such as title).
 * @param int    $post_id  Post ID.
 * @param string $new      New value to record.
 * @param string $original Original value.
 *
 * @return string
 */
function wpseo_upsert_new( $what, $post_id, $new, $original ) {
	$meta_key = WPSEO_Meta::$meta_prefix . $what;

	return wpseo_upsert_meta( $post_id, $new, $original, $meta_key, $what );
}

/**
 * Retrieves the keyword for the keyword doubles.
 */
function ajax_get_keyword_usage() {
	$post_id = filter_input( INPUT_POST, 'post_id' );
	$keyword = filter_input( INPUT_POST, 'keyword' );

	if ( ! current_user_can( 'edit_post', $post_id ) ) {
		die( '-1' );
	}

	wp_die(
		WPSEO_Utils::format_json_encode( WPSEO_Meta::keyword_usage( $keyword, $post_id ) )
	);
}

add_action( 'wp_ajax_get_focus_keyword_usage', 'ajax_get_keyword_usage' );

/**
 * Retrieves the keyword for the keyword doubles of the termpages.
 */
function ajax_get_term_keyword_usage() {
	$post_id       = filter_input( INPUT_POST, 'post_id' );
	$keyword       = filter_input( INPUT_POST, 'keyword' );
	$taxonomy_name = filter_input( INPUT_POST, 'taxonomy' );

	$taxonomy = get_taxonomy( $taxonomy_name );

	if ( ! $taxonomy ) {
		wp_die( 0 );
	}

	if ( ! current_user_can( $taxonomy->cap->edit_terms ) ) {
		wp_die( -1 );
	}

	$usage = WPSEO_Taxonomy_Meta::get_keyword_usage( $keyword, $post_id, $taxonomy_name );

	// Normalize the result so it it the same as the post keyword usage AJAX request.
	$usage = $usage[ $keyword ];

	wp_die(
		WPSEO_Utils::format_json_encode( $usage )
	);
}

add_action( 'wp_ajax_get_term_keyword_usage', 'ajax_get_term_keyword_usage' );

/**
 * Registers hooks for all AJAX integrations.
 *
 * @return void
 */
function wpseo_register_ajax_integrations() {
	$integrations = array( new Yoast_Network_Admin() );

	foreach ( $integrations as $integration ) {
		$integration->register_ajax_hooks();
	}
}

wpseo_register_ajax_integrations();

// Crawl Issue Manager AJAX hooks.
new WPSEO_GSC_Ajax();

// SEO Score Recalculations.
new WPSEO_Recalculate_Scores_Ajax();

new Yoast_OnPage_Ajax();

new WPSEO_Shortcode_Filter();

new WPSEO_Taxonomy_Columns();

// Setting the notice for the recalculate the posts.
new Yoast_Dismissable_Notice_Ajax( 'recalculate', Yoast_Dismissable_Notice_Ajax::FOR_SITE );

/* ********************* DEPRECATED FUNCTIONS ********************* */

/**
 * Removes stopword from the sample permalink that is generated in an AJAX request.
 *
 * @deprecated 6.3
 * @codeCoverageIgnore
 */
function wpseo_remove_stopwords_sample_permalink() {
	_deprecated_function( __FUNCTION__, 'WPSEO 6.3', 'This method is deprecated.' );

	wpseo_ajax_json_echo_die( '' );
}

/**
 * Function used to delete blocking files, dies on exit.
 *
 * @deprecated 7.0
 * @codeCoverageIgnore
 */
function wpseo_kill_blocking_files() {
	_deprecated_function( __FUNCTION__, 'WPSEO 7.0', 'This method is deprecated.' );

	wpseo_ajax_json_echo_die( '' );
}

/**
 * Handles the posting of a new FB admin.
 *
 * @deprecated 7.1
 * @codeCoverageIgnore
 */
function wpseo_add_fb_admin() {
	if ( ! current_user_can( 'manage_options' ) ) {
		die( '-1' );
	}
	_deprecated_function( __FUNCTION__, 'WPSEO 7.0', 'This method is deprecated.' );
	wpseo_ajax_json_echo_die( '' );
}
PK     ”T]6p-ä  ä    class-customizer.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Customizer
 */

/**
 * Class with functionality to support WP SEO settings in WordPress Customizer.
 */
class WPSEO_Customizer {

	/**
	 * @var WP_Customize_Manager
	 */
	protected $wp_customize;

	/**
	 * Template for the setting IDs used for the customizer.
	 *
	 * @var string
	 */
	private $setting_template = 'wpseo_titles[%s]';

	/**
	 * Default arguments for the breadcrumbs customizer settings object.
	 *
	 * @var array
	 */
	private $default_setting_args = array(
		'default'   => '',
		'type'      => 'option',
		'transport' => 'refresh',
	);

	/**
	 * Default arguments for the breadcrumbs customizer control object.
	 *
	 * @var array
	 */
	private $default_control_args = array(
		'label'    => '',
		'type'     => 'text',
		'section'  => 'wpseo_breadcrumbs_customizer_section',
		'settings' => '',
		'context'  => '',
	);

	/**
	 * Construct Method.
	 */
	public function __construct() {
		add_action( 'customize_register', array( $this, 'wpseo_customize_register' ) );
	}

	/**
	 * Function to support WordPress Customizer.
	 *
	 * @param WP_Customize_Manager $wp_customize Manager class instance.
	 */
	public function wpseo_customize_register( $wp_customize ) {
		if ( ! WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) ) {
			return;
		}

		$this->wp_customize = $wp_customize;

		$this->breadcrumbs_section();
		$this->breadcrumbs_blog_remove_setting();
		$this->breadcrumbs_separator_setting();
		$this->breadcrumbs_home_setting();
		$this->breadcrumbs_prefix_setting();
		$this->breadcrumbs_archiveprefix_setting();
		$this->breadcrumbs_searchprefix_setting();
		$this->breadcrumbs_404_setting();
	}

	/**
	 * Add the breadcrumbs section to the customizer.
	 */
	private function breadcrumbs_section() {
		$section_args = array(
			/* translators: %s is the name of the plugin */
			'title'           => sprintf( __( '%s Breadcrumbs', 'wordpress-seo' ), 'Yoast SEO' ),
			'priority'        => 999,
			'active_callback' => array( $this, 'breadcrumbs_active_callback' ),
		);

		$this->wp_customize->add_section( 'wpseo_breadcrumbs_customizer_section', $section_args );
	}

	/**
	 * Returns whether or not the breadcrumbs are active.
	 *
	 * @return bool
	 */
	public function breadcrumbs_active_callback() {
		return true === ( current_theme_supports( 'yoast-seo-breadcrumbs' ) || WPSEO_Options::get( 'breadcrumbs-enable' ) );
	}

	/**
	 * Adds the breadcrumbs remove blog checkbox.
	 */
	private function breadcrumbs_blog_remove_setting() {
		$index        = 'breadcrumbs-display-blog-page';
		$control_args = array(
			'label'           => __( 'Remove blog page from breadcrumbs', 'wordpress-seo' ),
			'type'            => 'checkbox',
			'active_callback' => array( $this, 'breadcrumbs_blog_remove_active_cb' ),
		);

		$this->add_setting_and_control( $index, $control_args );
	}

	/**
	 * Returns whether or not to show the breadcrumbs blog remove option.
	 *
	 * @return bool
	 */
	public function breadcrumbs_blog_remove_active_cb() {
		return 'page' === get_option( 'show_on_front' );
	}

	/**
	 * Adds the breadcrumbs separator text field.
	 */
	private function breadcrumbs_separator_setting() {
		$index        = 'breadcrumbs-sep';
		$control_args = array(
			'label' => __( 'Breadcrumbs separator:', 'wordpress-seo' ),
		);
		$id           = 'wpseo-breadcrumbs-separator';

		$this->add_setting_and_control( $index, $control_args, $id );
	}

	/**
	 * Adds the breadcrumbs home anchor text field.
	 */
	private function breadcrumbs_home_setting() {
		$index        = 'breadcrumbs-home';
		$control_args = array(
			'label' => __( 'Anchor text for the homepage:', 'wordpress-seo' ),
		);

		$this->add_setting_and_control( $index, $control_args );
	}

	/**
	 * Adds the breadcrumbs prefix text field.
	 */
	private function breadcrumbs_prefix_setting() {
		$index        = 'breadcrumbs-prefix';
		$control_args = array(
			'label' => __( 'Prefix for breadcrumbs:', 'wordpress-seo' ),
		);

		$this->add_setting_and_control( $index, $control_args );
	}

	/**
	 * Adds the breadcrumbs archive prefix text field.
	 */
	private function breadcrumbs_archiveprefix_setting() {
		$index        = 'breadcrumbs-archiveprefix';
		$control_args = array(
			'label' => __( 'Prefix for archive pages:', 'wordpress-seo' ),
		);

		$this->add_setting_and_control( $index, $control_args );
	}

	/**
	 * Adds the breadcrumbs search prefix text field.
	 */
	private function breadcrumbs_searchprefix_setting() {
		$index        = 'breadcrumbs-searchprefix';
		$control_args = array(
			'label' => __( 'Prefix for search result pages:', 'wordpress-seo' ),
		);

		$this->add_setting_and_control( $index, $control_args );
	}

	/**
	 * Adds the breadcrumb 404 prefix text field.
	 */
	private function breadcrumbs_404_setting() {
		$index        = 'breadcrumbs-404crumb';
		$control_args = array(
			'label' => __( 'Breadcrumb for 404 pages:', 'wordpress-seo' ),
		);

		$this->add_setting_and_control( $index, $control_args );
	}

	/**
	 * Adds the customizer setting and control.
	 *
	 * @param string $index           Array key index to use for the customizer setting.
	 * @param array  $control_args    Customizer control object arguments.
	 *                                Only those different from the default need to be passed.
	 * @param string $id              Optional. Customizer control object ID.
	 *                                Will default to 'wpseo-' . $index.
	 * @param array  $custom_settings Optional. Customizer setting arguments.
	 *                                Only those different from the default need to be passed.
	 */
	private function add_setting_and_control( $index, $control_args, $id = null, $custom_settings = array() ) {
		$setting                  = sprintf( $this->setting_template, $index );
		$control_args             = array_merge( $this->default_control_args, $control_args );
		$control_args['settings'] = $setting;

		$settings_args = $this->default_setting_args;
		if ( ! empty( $custom_settings ) ) {
			$settings_args = array_merge( $settings_args, $custom_settings );
		}

		if ( ! isset( $id ) ) {
			$id = 'wpseo-' . $index;
		}

		$this->wp_customize->add_setting( $setting, $settings_args );

		$control = new WP_Customize_Control( $this->wp_customize, $id, $control_args );
		$this->wp_customize->add_control( $control );
	}
}
PK     ”T]2hd+–  –    class-recalculate-scores.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class WPSEO_Recalculate_Scores.
 *
 * This class handles the SEO score recalculation for all posts with a filled focus keyword.
 */
class WPSEO_Recalculate_Scores {

	/**
	 * Constructing the object by modalbox, the localization and the totals.
	 */
	public function __construct() {
		add_action( 'admin_enqueue_scripts', array( $this, 'recalculate_assets' ) );
		add_action( 'admin_footer', array( $this, 'modal_box' ), 20 );
	}

	/**
	 * Run the localize script.
	 */
	public function recalculate_assets() {
		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_script( 'recalculate' );
	}

	/**
	 * Initialize the modal box to be displayed when needed.
	 */
	public function modal_box() {
		// Adding the thickbox.
		add_thickbox();

		$progress = sprintf(
			/* translators: 1: expands to a <span> containing the number of posts recalculated. 2: expands to a <strong> containing the total number of posts. */
			esc_html__( '%1$s of %2$s done.', 'wordpress-seo' ),
			'<span id="wpseo_count">0</span>',
			'<strong id="wpseo_count_total">0</strong>'
		);

		?>
		<div id="wpseo_recalculate" class="hidden">
			<p><?php esc_html_e( 'Recalculating SEO scores for all pieces of content with a focus keyphrase.', 'wordpress-seo' ); ?></p>

			<div id="wpseo_progressbar"></div>
			<p><?php echo $progress; ?></p>
		</div>
		<?php
	}
}
PK     ”T]0NdI	  I	    class-option-tabs-formatter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Options\Tabs
 */

/**
 * Class WPSEO_Option_Tabs_Formatter.
 */
class WPSEO_Option_Tabs_Formatter {

	/**
	 * @param WPSEO_Option_Tabs $option_tabs Option Tabs to get base from.
	 * @param WPSEO_Option_Tab  $tab         Tab to get name from.
	 *
	 * @return string
	 */
	public function get_tab_view( WPSEO_Option_Tabs $option_tabs, WPSEO_Option_Tab $tab ) {
		return WPSEO_PATH . 'admin/views/tabs/' . $option_tabs->get_base() . '/' . $tab->get_name() . '.php';
	}

	/**
	 * @param WPSEO_Option_Tabs $option_tabs Option Tabs to get tabs from.
	 */
	public function run( WPSEO_Option_Tabs $option_tabs ) {

		echo '<h2 class="nav-tab-wrapper" id="wpseo-tabs">';
		foreach ( $option_tabs->get_tabs() as $tab ) {
			printf(
				'<a class="nav-tab" id="%1$s" href="%2$s">%3$s</a>',
				esc_attr( $tab->get_name() . '-tab' ),
				esc_url( '#top#' . $tab->get_name() ),
				esc_html( $tab->get_label() )
			);
		}
		echo '</h2>';

		$help_center = new WPSEO_Help_Center( '', $option_tabs, WPSEO_Utils::is_yoast_seo_premium() );
		$help_center->localize_data();
		$help_center->mount();

		foreach ( $option_tabs->get_tabs() as $tab ) {
			$identifier = $tab->get_name();

			$class = 'wpseotab ' . ( $tab->has_save_button() ? 'save' : 'nosave' );
			printf( '<div id="%1$s" class="%2$s">', esc_attr( $identifier ), esc_attr( $class ) );

			$tab_filter_name = sprintf( '%s_%s', $option_tabs->get_base(), $tab->get_name() );

			/**
			 * Allows to override the content that is display on the specific option tab.
			 *
			 * @internal For internal Yoast SEO use only.
			 *
			 * @api      string|null The content that should be displayed for this tab. Leave empty for default behaviour.
			 *
			 * @param WPSEO_Option_Tabs $option_tabs The registered option tabs.
			 * @param WPSEO_Option_Tab  $tab         The tab that is being displayed.
			 */
			$option_tab_content = apply_filters( 'wpseo_option_tab-' . $tab_filter_name, null, $option_tabs, $tab );
			if ( ! empty( $option_tab_content ) ) {
				echo $option_tab_content;
			}

			if ( empty( $option_tab_content ) ) {
				// Output the settings view for all tabs.
				$tab_view = $this->get_tab_view( $option_tabs, $tab );

				if ( is_file( $tab_view ) ) {
					$yform = Yoast_Form::get_instance();
					require $tab_view;
				}
			}

			echo '</div>';
		}
	}
}
PK     ”T]öã"`q  q    class-meta-storage.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the link count storage.
 */
class WPSEO_Meta_Storage implements WPSEO_Installable {

	/**
	 * Table name for the meta storage.
	 *
	 * @var string
	 */
	const TABLE_NAME = 'yoast_seo_meta';

	/**
	 * @var WPSEO_Database_Proxy
	 */
	protected $database_proxy;

	/**
	 * @deprecated 7.4
	 *
	 * @var null|string
	 */
	protected $table_prefix;

	/**
	 * Initializes the database table.
	 *
	 * @param string $table_prefix Optional. Deprecated argument.
	 */
	public function __construct( $table_prefix = null ) {
		if ( $table_prefix !== null ) {
			_deprecated_argument( __METHOD__, 'WPSEO 7.4' );
		}

		$this->database_proxy = new WPSEO_Database_Proxy( $GLOBALS['wpdb'], self::TABLE_NAME, true );
	}

	/**
	 * Returns the table name to use.
	 *
	 * @return string The table name.
	 */
	public function get_table_name() {
		return $this->database_proxy->get_table_name();
	}

	/**
	 * Creates the database table.
	 *
	 * @return boolean True if the table was created, false if something went wrong.
	 */
	public function install() {
		return $this->database_proxy->create_table(
			array(
				'object_id bigint(20) UNSIGNED NOT NULL',
				'internal_link_count int(10) UNSIGNED NULL DEFAULT NULL',
				'incoming_link_count int(10) UNSIGNED NULL DEFAULT NULL',
			),
			array(
				'UNIQUE KEY object_id (object_id)',
			)
		);
	}

	/**
	 * Saves the link count to the database.
	 *
	 * @param int   $meta_id   The id to save the link count for.
	 * @param array $meta_data The total amount of links.
	 */
	public function save_meta_data( $meta_id, array $meta_data ) {
		$where = array( 'object_id' => $meta_id );

		$saved = $this->database_proxy->upsert(
			array_merge( $where, $meta_data ),
			$where
		);

		if ( $saved === false ) {
			WPSEO_Meta_Table_Accessible::set_inaccessible();
		}
	}

	/**
	 * Updates the incoming link count.
	 *
	 * @param array              $post_ids The posts to update the incoming link count for.
	 * @param WPSEO_Link_Storage $storage  The link storage object.
	 */
	public function update_incoming_link_count( array $post_ids, WPSEO_Link_Storage $storage ) {
		global $wpdb;

		$query = $wpdb->prepare(
			'
			SELECT COUNT( id ) AS incoming, target_post_id AS post_id
			FROM ' . $storage->get_table_name() . '
			WHERE target_post_id IN(' . implode( ',', array_fill( 0, count( $post_ids ), '%d' ) ) . ')
			GROUP BY target_post_id',
			$post_ids
		);

		$results = $wpdb->get_results( $query );

		$post_ids_non_zero = array();
		foreach ( $results as $result ) {
			$this->save_meta_data( $result->post_id, array( 'incoming_link_count' => $result->incoming ) );
			$post_ids_non_zero[] = $result->post_id;
		}

		$post_ids_zero = array_diff( $post_ids, $post_ids_non_zero );
		foreach ( $post_ids_zero as $post_id ) {
			$this->save_meta_data( $post_id, array( 'incoming_link_count' => 0 ) );
		}
	}
}
PK     ”T]±*ß�í  í    class-my-yoast-route.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents the route for MyYoast.
 */
class WPSEO_MyYoast_Route implements WPSEO_WordPress_Integration {

	/**
	 * @var string
	 */
	const PAGE_IDENTIFIER = 'wpseo_myyoast';

	/**
	 * The instance of the MyYoast client.
	 *
	 * @var WPSEO_MyYoast_Client
	 */
	protected $client;

	/**
	 * The actions that are supported.
	 *
	 * Each action should have a method named equally to the action.
	 *
	 * For example:
	 * The connect action is handled by a method named 'connect'.
	 *
	 * @var array
	 */
	protected static $allowed_actions = array( 'connect', 'authorize', 'complete' );

	/**
	 * Sets the hooks when the user has enough rights and is on the right page.
	 *
	 * @return void
	 */
	public function register_hooks() {
		$route = filter_input( INPUT_GET, 'page' );
		if ( ! ( $this->is_myyoast_route( $route ) && $this->can_access_route() ) ) {
			return;
		}

		if ( ! $this->is_valid_action( $this->get_action() ) ) {
			return;
		}

		add_action( 'admin_menu', array( $this, 'register_route' ) );
		add_action( 'admin_init', array( $this, 'handle_route' ) );
	}

	/**
	 * Registers the page for the MyYoast route.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function register_route() {
		add_dashboard_page(
			'', // Is empty because we don't render a page.
			'', // Is empty because we don't want a menu item.
			'wpseo_manage_options',
			self::PAGE_IDENTIFIER
		);
	}

	/**
	 * Abstracts the action from the URL and follows the appropriate route.
	 *
	 * @return void
	 */
	public function handle_route() {
		$action = $this->get_action();

		if ( ! $this->is_valid_action( $action ) || ! method_exists( $this, $action ) ) {
			return;
		}

		// Dynamically call the method.
		$this->$action();
	}

	/**
	 * Checks if the current page is the MyYoast route.
	 *
	 * @param string $route The MyYoast route.
	 *
	 * @return bool True when url is the MyYoast route.
	 */
	protected function is_myyoast_route( $route ) {
		return ( $route === self::PAGE_IDENTIFIER );
	}

	/**
	 * Compares an action to a list of allowed actions to see if it is valid.
	 *
	 * @param string $action The action to check.
	 *
	 * @return bool True if the action is valid.
	 */
	protected function is_valid_action( $action ) {
		return in_array( $action, self::$allowed_actions, true );
	}

	/**
	 * Connects to MyYoast and generates a new clientId.
	 *
	 * @return void
	 */
	protected function connect() {
		$client_id = $this->generate_uuid();

		$this->save_client_id( $client_id );

		$this->redirect(
			'https://my.yoast.com/connect',
			array(
				'url'             => WPSEO_Utils::get_home_url(),
				'client_id'       => $client_id,
				'extensions'      => $this->get_extensions(),
				'redirect_url'    => admin_url( 'admin.php?page=' . self::PAGE_IDENTIFIER . '&action=complete' ),
				'credentials_url' => rest_url( 'yoast/v1/myyoast/connect' ),
				'type'            => 'wordpress',
			)
		);
	}

	/**
	 * Redirects the user to the oAuth authorization page.
	 *
	 * @return void
	 */
	protected function authorize() {
		$client = $this->get_client();

		if ( ! $client->has_configuration() ) {
			return;
		}

		$this->redirect(
			$client->get_provider()->getAuthorizationUrl()
		);
	}

	/**
	 * Completes the oAuth connection flow.
	 *
	 * @return void
	 */
	protected function complete() {
		$client = $this->get_client();

		if ( ! $client->has_configuration() ) {
			return;
		}

		try {
			$access_token = $client
				->get_provider()
				->getAccessToken(
					'authorization_code',
					array(
						'code' => $this->get_authorization_code(),
					)
				);

			$client->save_access_token(
				$this->get_current_user_id(),
				$access_token
			);
		}
			// @codingStandardsIgnoreLine Generic.CodeAnalysis.EmptyStatement.DetectedCATCH -- There is nothing to do.
		catch ( Exception $e ) {
			// Do nothing.
		}

		$this->redirect_to_premium_page();
	}

	/**
	 * Saves the client id.
	 *
	 * @codeCoverageIgnore
	 *
	 * @param string $client_id The client id to save.
	 *
	 * @return void
	 */
	protected function save_client_id( $client_id ) {
		$this->get_client()->save_configuration(
			array(
				'clientId' => $client_id,
			)
		);
	}

	/**
	 * Creates a new MyYoast Client instance.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return WPSEO_MyYoast_Client Instance of the myyoast client.
	 */
	protected function get_client() {
		if ( ! $this->client ) {
			$this->client = new WPSEO_MyYoast_Client();
		}

		return $this->client;
	}

	/**
	 * Abstracts the action from the url.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return string The action from the url.
	 */
	protected function get_action() {
		return filter_input( INPUT_GET, 'action' );
	}

	/**
	 * Abstracts the authorization code from the url.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return string The action from the url.
	 */
	protected function get_authorization_code() {
		return filter_input( INPUT_GET, 'code' );
	}

	/**
	 * Retrieves a list of activated extensions slugs.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return array The extensions slugs.
	 */
	protected function get_extensions() {
		$addon_manager = new WPSEO_Addon_Manager();

		return array_keys( $addon_manager->get_subscriptions_for_active_addons() );
	}

	/**
	 * Generates an URL-encoded query string, redirects there.
	 *
	 * @codeCoverageIgnore
	 *
	 * @param string $url        The url to redirect to.
	 * @param array  $query_args The additional arguments to build the url from.
	 *
	 * @return void
	 */
	protected function redirect( $url, $query_args = array() ) {
		if ( ! empty( $query_args ) ) {
			$url .= '?' . http_build_query( $query_args );
		}

		wp_redirect( $url );
		exit;
	}

	/**
	 * Checks if current user is allowed to access the route.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return bool True when current user has rights to manage options.
	 */
	protected function can_access_route() {
		return WPSEO_Utils::has_access_token_support() && current_user_can( 'wpseo_manage_options' );
	}

	/**
	 * Generates an unique user id.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return string The generated unique user id.
	 */
	protected function generate_uuid() {
		return wp_generate_uuid4();
	}

	/**
	 * Retrieves the current user id.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return int The user id.
	 */
	protected function get_current_user_id() {
		return get_current_user_id();
	}

	/**
	 * Redirects to the premium page.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	protected function redirect_to_premium_page() {
		wp_safe_redirect( admin_url( 'admin.php?page=wpseo_licenses' ) );
		exit;
	}
}
PK     ”T]…ØëB  B  (  exceptions/class-file-size-exception.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Exceptions
 */

/**
 * Represents named methods for exceptions.
 */
class WPSEO_File_Size_Exception extends Exception {

	/**
	 * Gets the exception for an externally hosted file.
	 *
	 * @param string $file_url The file url.
	 *
	 * @return WPSEO_File_Size_Exception Instance of the exception.
	 */
	public static function externally_hosted( $file_url ) {
		$message = sprintf(
			/* translators: %1$s expands to the requested url */
			__( 'Cannot get the size of %1$s because it is hosted externally.', 'wordpress-seo' ),
			$file_url
		);

		return new self( $message );
	}

	/**
	 * Gets the exception for when a unknown error occurs.
	 *
	 * @param string $file_url The file url.
	 *
	 * @return WPSEO_File_Size_Exception Instance of the exception.
	 */
	public static function unknown_error( $file_url ) {
		$message = sprintf(
			/* translators: %1$s expands to the requested url */
			__( 'Cannot get the size of %1$s because of unknown reasons.', 'wordpress-seo' ),
			$file_url
		);

		return new self( $message );
	}
}
PK     ”T]�SÊ‰í   í     exceptions/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]0pE©þ  þ    class-asset.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents a WPSEO asset
 */
class WPSEO_Admin_Asset {

	/**
	 * @var string
	 */
	const TYPE_JS = 'js';

	/**
	 * @var string
	 */
	const TYPE_CSS = 'css';

	/**
	 * @var string
	 */
	const NAME = 'name';

	/**
	 * @var string
	 */
	const SRC = 'src';

	/**
	 * @var string
	 */
	const DEPS = 'deps';

	/**
	 * @var string
	 */
	const VERSION = 'version';

	/* Style specific. */

	/**
	 * @var string
	 */
	const MEDIA = 'media';

	/**
	 * @var string
	 */
	const RTL = 'rtl';

	/* Script specific. */

	/**
	 * @var string
	 */
	const IN_FOOTER = 'in_footer';

	/**
	 * @var string
	 */
	protected $name;

	/**
	 * @var string
	 */
	protected $src;

	/**
	 * @var string|array
	 */
	protected $deps;

	/**
	 * @var string
	 */
	protected $version;

	/**
	 * @var string
	 */
	protected $media;

	/**
	 * @var boolean
	 */
	protected $in_footer;

	/**
	 * @var boolean
	 */
	protected $rtl;

	/**
	 * @var string
	 */
	protected $suffix;

	/**
	 * Default asset arguments.
	 *
	 * @var array
	 */
	private $defaults = array(
		'deps'      => array(),
		'version'   => WPSEO_VERSION,
		'in_footer' => true,
		'rtl'       => true,
		'media'     => 'all',
		'suffix'    => WPSEO_CSSJS_SUFFIX,
	);

	/**
	 * @param array $args The arguments for this asset.
	 *
	 * @throws InvalidArgumentException Throws when no name or src has been provided.
	 */
	public function __construct( array $args ) {
		if ( ! isset( $args['name'] ) ) {
			throw new InvalidArgumentException( 'name is a required argument' );
		}

		if ( ! isset( $args['src'] ) ) {
			throw new InvalidArgumentException( 'src is a required argument' );
		}

		$args = array_merge( $this->defaults, $args );

		$this->name      = $args['name'];
		$this->src       = $args['src'];
		$this->deps      = $args['deps'];
		$this->version   = $args['version'];
		$this->media     = $args['media'];
		$this->in_footer = $args['in_footer'];
		$this->rtl       = $args['rtl'];
		$this->suffix    = $args['suffix'];
	}

	/**
	 * @return string
	 */
	public function get_name() {
		return $this->name;
	}

	/**
	 * @return string
	 */
	public function get_src() {
		return $this->src;
	}

	/**
	 * @return array|string
	 */
	public function get_deps() {
		return $this->deps;
	}

	/**
	 * @return string
	 */
	public function get_version() {
		return $this->version;
	}

	/**
	 * @return string
	 */
	public function get_media() {
		return $this->media;
	}

	/**
	 * @return boolean
	 */
	public function is_in_footer() {
		return $this->in_footer;
	}

	/**
	 * @return boolean
	 */
	public function has_rtl() {
		return $this->rtl;
	}

	/**
	 * @return string
	 */
	public function get_suffix() {
		return $this->suffix;
	}

	/**
	 * Returns the full URL for this asset based on the path to the plugin file.
	 *
	 * @deprecated 6.2
	 * @codeCoverageIgnore
	 *
	 * @param string $type        Type of asset.
	 * @param string $plugin_file Absolute path to the plugin file.
	 *
	 * @return string The full URL to the asset.
	 */
	public function get_url( $type, $plugin_file ) {
		_deprecated_function( __CLASS__ . '::get_url', '6.2', 'WPSEO_Admin_Asset_SEO_Location::get_url' );

		$asset_location = new WPSEO_Admin_Asset_SEO_Location( $plugin_file );

		return $asset_location->get_url( $this, $type );
	}
}
PK     ”T].M’¹^  ^  +  taxonomy/class-taxonomy-settings-fields.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class parses all the values for the general tab in the Yoast SEO settings metabox.
 */
class WPSEO_Taxonomy_Settings_Fields extends WPSEO_Taxonomy_Fields {

	/**
	 * Options array for the no-index options, including translated labels.
	 *
	 * @var array
	 */
	private $no_index_options = array();

	/**
	 * @param stdClass $term The currenct taxonomy.
	 */
	public function __construct( $term ) {
		parent::__construct( $term );
		$this->translate_meta_options();
	}

	/**
	 * Returns array with the fields for the General tab.
	 *
	 * @return array Fields to be used on the General tab.
	 */
	public function get() {
		$labels = $this->get_taxonomy_labels();
		$fields = array(
			'noindex'   => $this->get_field_config(
				/* translators: %s = taxonomy name. */
				esc_html( sprintf( __( 'Allow search engines to show this %s in search results?', 'wordpress-seo' ), $labels->singular_name ) ),
				'',
				'select',
				$this->get_noindex_options()
			),
			'bctitle'   => $this->get_field_config(
				__( 'Breadcrumbs Title', 'wordpress-seo' ),
				esc_html__( 'The Breadcrumbs Title is used in the breadcrumbs where this taxonomy appears.', 'wordpress-seo' ),
				'text',
				'',
				( WPSEO_Options::get( 'breadcrumbs-enable' ) !== true )
			),
			'canonical' => $this->get_field_config(
				__( 'Canonical URL', 'wordpress-seo' ),
				esc_html__( 'The canonical link is shown on the archive page for this term.', 'wordpress-seo' )
			),
		);

		return $this->filter_hidden_fields( $fields );
	}

	/**
	 * Translate options text strings for use in the select fields.
	 *
	 * {@internal IMPORTANT: if you want to add a new string (option) somewhere, make sure you add
	 * that array key to the main options definition array in the class WPSEO_Taxonomy_Meta() as well!!!!}}
	 */
	private function translate_meta_options() {
		$this->no_index_options = WPSEO_Taxonomy_Meta::$no_index_options;

		/* translators: %1$s expands to the taxonomy name %2$s expands to the current taxonomy index value */
		$this->no_index_options['default'] = __( '%2$s (current default for %1$s)', 'wordpress-seo' );
		$this->no_index_options['index']   = __( 'Yes', 'wordpress-seo' );
		$this->no_index_options['noindex'] = __( 'No', 'wordpress-seo' );
	}

	/**
	 * Getting the data for the noindex fields.
	 *
	 * @return array Array containing the no_index options.
	 */
	private function get_noindex_options() {
		$labels                                = $this->get_taxonomy_labels();
		$noindex_options['options']            = $this->no_index_options;
		$noindex_options['options']['default'] = sprintf( $noindex_options['options']['default'], $labels->name, $this->get_robot_index() );

		return $noindex_options;
	}

	/**
	 * Retrieve the taxonomies plural for use in sentences.
	 *
	 * @return object Object containing the taxonomy's labels.
	 */
	private function get_taxonomy_labels() {
		$taxonomy = get_taxonomy( $this->term->taxonomy );

		return $taxonomy->labels;
	}

	/**
	 * Returns the current robot index value for the taxonomy
	 *
	 * @return string
	 */
	private function get_robot_index() {
		$robot_index  = $this->no_index_options['index'];
		$index_option = 'noindex-tax-' . $this->term->taxonomy;
		if ( WPSEO_Options::get( $index_option, false ) ) {
			$robot_index = $this->no_index_options['noindex'];
		}

		return $robot_index;
	}
}
PK     ”T]�SÊ‰í   í     taxonomy/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]Ì�]ý¯  ¯  )  taxonomy/class-taxonomy-social-fields.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class parses all the values for the social tab in the Yoast SEO settings metabox.
 */
class WPSEO_Taxonomy_Social_Fields extends WPSEO_Taxonomy_Fields {

	/**
	 * List of social networks.
	 *
	 * @var array
	 */
	protected $networks;

	/**
	 * Setting the class properties.
	 *
	 * @param stdClass|WP_Term $term The current taxonomy.
	 */
	public function __construct( $term ) {
		parent::__construct( $term );

		$this->networks = $this->get_social_networks();
	}

	/**
	 * When this method returns false, the social tab in the meta box will be hidden.
	 *
	 * @return bool
	 */
	public function show_social() {
		return ( WPSEO_Options::get( 'opengraph', false ) || WPSEO_Options::get( 'twitter', false ) );
	}

	/**
	 * Gets the social meta fields by social network for the taxonomy.
	 *
	 * @param string $network The social network for which to fetch the fields.
	 *
	 * @return array
	 */
	public function get_by_network( $network ) {
		$settings = $this->networks[ $network ];

		return array(
			$settings['network'] . '-title'       => $this->get_field_config(
				/* translators: %s expands to the social network name */
				sprintf( __( '%s Title', 'wordpress-seo' ), $settings['label'] ),
				/* translators: %1$s expands to the social network name */
				sprintf( esc_html__( 'If you don\'t want to use the title for sharing on %1$s but instead want another title there, write it here.', 'wordpress-seo' ), $settings['label'] ),
				'text',
				array( 'class' => 'large-text' )
			),
			$settings['network'] . '-description' => $this->get_field_config(
				/* translators: %s expands to the social network name */
				sprintf( __( '%s Description', 'wordpress-seo' ), $settings['label'] ),
				/* translators: %1$s expands to the social network name */
				sprintf( esc_html__( 'If you don\'t want to use the meta description for sharing on %1$s but want another description there, write it here.', 'wordpress-seo' ), $settings['label'] ),
				'textarea'
			),
			$settings['network'] . '-image'       => $this->get_field_config(
				/* translators: %s expands to the social network name */
				sprintf( __( '%s Image', 'wordpress-seo' ), $settings['label'] ),
				/* translators: %1$s expands to the social network name */
				sprintf( esc_html__( 'If you want to use an image for sharing on %1$s, you can upload / choose an image or add the image URL here.', 'wordpress-seo' ), $settings['label'] ) . '<br />' .
				/* translators: %1$s expands to the social network name, %2$s expands to the image size */
				sprintf( __( 'The recommended image size for %1$s is %2$s pixels.', 'wordpress-seo' ), $settings['label'], $settings['size'] ),
				'upload'
			),
			$settings['network'] . '-image-id' => $this->get_field_config(
				'',
				'',
				'hidden'
			),
		);
	}

	/**
	 * Returning the fields for the social media tab.
	 *
	 * @return array
	 */
	public function get() {
		$fields = array();
		foreach ( $this->networks as $option => $settings ) {
			$fields_to_push = $this->get_by_network( $option );

			$fields = array_merge( $fields, $fields_to_push );
		}

		return $this->filter_hidden_fields( $fields );
	}

	/**
	 * Getting array with the social networks.
	 *
	 * @return array
	 */
	private function get_social_networks() {
		// Source: https://developers.facebook.com/docs/sharing/best-practices#images.
		$fb_image_size = sprintf(
			/* translators: %1$s expands to the image recommended width, %2$s to its height. */
			__( '%1$s by %2$s', 'wordpress-seo' ),
			'1200',
			'630'
		);

		$twitter_image_size = sprintf(
			/* translators: %1$s expands to the image recommended width, %2$s to its height. */
			__( '%1$s by %2$s', 'wordpress-seo' ),
			'1024',
			'512'
		);

		$social_networks = array(
			'opengraph' => $this->social_network( 'opengraph', __( 'Facebook', 'wordpress-seo' ), $fb_image_size ),
			'twitter'   => $this->social_network( 'twitter', __( 'Twitter', 'wordpress-seo' ), $twitter_image_size ),
		);

		return $this->filter_social_networks( $social_networks );
	}

	/**
	 * Returns array with the config fields for the social network.
	 *
	 * @param string $network    The name of the social network.
	 * @param string $label      The label for the social network.
	 * @param string $image_size The image dimensions.
	 *
	 * @return array
	 */
	private function social_network( $network, $label, $image_size ) {
		return array(
			'network' => $network,
			'label'   => $label,
			'size'    => $image_size,
		);
	}

	/**
	 * Filter the social networks which are disabled in the configuration.
	 *
	 * @param array $social_networks Array with the social networks that have to be filtered.
	 *
	 * @return array
	 */
	private function filter_social_networks( array $social_networks ) {
		foreach ( $social_networks as $social_network => $settings ) {
			if ( WPSEO_Options::get( $social_network, false ) === false ) {
				unset( $social_networks[ $social_network ] );
			}
		}

		return $social_networks;
	}
}
PK     ”T]hºsz  z  "  taxonomy/class-taxonomy-fields.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class WPSEO_Taxonomy_Tab.
 *
 * Contains the basics for each class extending this one.
 */
abstract class WPSEO_Taxonomy_Fields {

	/**
	 * The current term data.
	 *
	 * @var stdClass
	 */
	protected $term;

	/**
	 * Setting the class properties.
	 *
	 * @param stdClass $term The current term.
	 */
	public function __construct( $term ) {
		$this->term = $term;
	}

	/**
	 * This method should return the fields.
	 *
	 * @return array
	 */
	abstract public function get();

	/**
	 * Returns array with the field data.
	 *
	 * @param string       $label       The label displayed before the field.
	 * @param string       $description Description which will explain the field.
	 * @param string       $type        The field type, for example: input, select.
	 * @param string|array $options     Optional. Array with additional options.
	 * @param bool         $hide        Should the field be hidden.
	 *
	 * @return array
	 */
	protected function get_field_config( $label, $description, $type = 'text', $options = '', $hide = false ) {
		return array(
			'label'       => $label,
			'description' => $description,
			'type'        => $type,
			'options'     => $options,
			'hide'        => $hide,
		);
	}

	/**
	 * Filter the hidden fields.
	 *
	 * @param array $fields Array with the form fields that has will be filtered.
	 *
	 * @return array
	 */
	protected function filter_hidden_fields( array $fields ) {
		foreach ( $fields as $field_name => $field_options ) {
			if ( ! empty( $field_options['hide'] ) ) {
				unset( $fields[ $field_name ] );
			}
		}

		return $fields;
	}
}
PK     ”T]N uYÖ  Ö  ,  taxonomy/class-taxonomy-fields-presenter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class WPSEO_Taxonomy_Presenter.
 */
class WPSEO_Taxonomy_Fields_Presenter {

	/**
	 * The taxonomy meta data for the current term.
	 *
	 * @var array
	 */
	private $tax_meta;

	/**
	 * @param stdClass $term The current term.
	 */
	public function __construct( $term ) {
		$this->tax_meta = WPSEO_Taxonomy_Meta::get_term_meta( (int) $term->term_id, $term->taxonomy );
	}

	/**
	 * Displaying the form fields.
	 *
	 * @param array $fields Array with the fields that will be displayed.
	 */
	public function html( array $fields ) {
		$content = '';
		foreach ( $fields as $field_name => $field_configuration ) {
			$content .= $this->form_row( 'wpseo_' . $field_name, $field_configuration );
		}
		return $content;
	}

	/**
	 * Create a row in the form table.
	 *
	 * @param string $field_name          Variable the row controls.
	 * @param array  $field_configuration Array with the field configuration.
	 */
	private function form_row( $field_name, array $field_configuration ) {
		$esc_field_name = esc_attr( $field_name );

		$options = (array) $field_configuration['options'];

		if ( ! empty( $field_configuration['description'] ) ) {
			$options['description'] = $field_configuration['description'];
		}

		$label            = $this->get_label( $field_configuration['label'], $esc_field_name );
		$field            = $this->get_field( $field_configuration['type'], $esc_field_name, $this->get_field_value( $field_name ), $options );
		$help_content     = isset( $field_configuration['options']['help'] ) ? $field_configuration['options']['help'] : '';
		$help_button_text = isset( $field_configuration['options']['help-button'] ) ? $field_configuration['options']['help-button'] : '';
		$help             = new WPSEO_Admin_Help_Panel( $field_name, $help_button_text, $help_content );

		return $this->parse_row( $label, $help, $field );
	}

	/**
	 * Generates the html for the given field config.
	 *
	 * @param string $field_type  The fieldtype, e.g: text, checkbox, etc.
	 * @param string $field_name  The name of the field.
	 * @param string $field_value The value of the field.
	 * @param array  $options     Array with additional options.
	 *
	 * @return string
	 */
	private function get_field( $field_type, $field_name, $field_value, array $options ) {

		$class            = $this->get_class( $options );
		$field            = '';
		$description      = '';
		$aria_describedby = '';

		if ( ! empty( $options['description'] ) ) {
			$aria_describedby = ' aria-describedby="' . $field_name . '-desc"';
			$description      = '<p id="' . $field_name . '-desc" class="yoast-metabox__description">' . $options['description'] . '</p>';
		}

		switch ( $field_type ) {
			case 'div':
				$field .= '<div id="' . $field_name . '"></div>';
				break;

			case 'text':
				$field .= '<input name="' . $field_name . '" id="' . $field_name . '" ' . $class . ' type="text" value="' . esc_attr( $field_value ) . '" size="40"' . $aria_describedby . '/>';
				break;
			case 'checkbox':
				$field .= '<input name="' . $field_name . '" id="' . $field_name . '" type="checkbox" ' . checked( $field_value ) . $aria_describedby . '/>';
				break;
			case 'textarea':
				$rows = 3;
				if ( ! empty( $options['rows'] ) ) {
					$rows = $options['rows'];
				}
				$field .= '<textarea class="large-text" rows="' . esc_attr( $rows ) . '" id="' . $field_name . '" name="' . $field_name . '"' . $aria_describedby . '>' . esc_textarea( $field_value ) . '</textarea>';
				break;
			case 'upload':
				$field .= '<input' .
					' id="' . $field_name . '"' .
					' type="text"' .
					' size="36"' .
					' name="' . $field_name . '"' .
					' value="' . esc_attr( $field_value ) . '"' . $aria_describedby . '' .
					' readonly="readonly"' .
					' /> ';
				$field .= '<input' .
					' id="' . esc_attr( $field_name ) . '_button"' .
					' class="wpseo_image_upload_button button"' .
					' data-target="' . esc_attr( $field_name ) . '"' .
					' data-target-id="hidden_' . esc_attr( $field_name ) . '-id"' .
					' type="button"' .
					' value="' . esc_attr__( 'Upload Image', 'wordpress-seo' ) . '"' .
					' /> ';
				$field .= '<input' .
					' id="' . esc_attr( $field_name ) . '_button"' .
					' class="wpseo_image_remove_button button"' .
					' type="button"' .
					' value="' . esc_attr__( 'Clear Image', 'wordpress-seo' ) . '"' .
					' />';
				break;
			case 'select':
				if ( is_array( $options ) && $options !== array() ) {
					$field .= '<select name="' . $field_name . '" id="' . $field_name . '"' . $aria_describedby . '>';

					$select_options = ( array_key_exists( 'options', $options ) ) ? $options['options'] : $options;

					foreach ( $select_options as $option => $option_label ) {
						$selected = selected( $option, $field_value, false );
						$field   .= '<option ' . $selected . ' value="' . esc_attr( $option ) . '">' . esc_html( $option_label ) . '</option>';
					}
					unset( $option, $option_label, $selected );

					$field .= '</select>';
				}
				break;
			case 'hidden':
				$field .= '<input name="' . $field_name . '" id="hidden_' . $field_name . '" type="hidden" value="' . esc_attr( $field_value ) . '" />';
				break;
		}

		return $field . $description;
	}

	/**
	 * Getting the value for given field_name.
	 *
	 * @param string $field_name The fieldname to get the value for.
	 *
	 * @return string
	 */
	private function get_field_value( $field_name ) {
		if ( isset( $this->tax_meta[ $field_name ] ) && $this->tax_meta[ $field_name ] !== '' ) {
			return $this->tax_meta[ $field_name ];
		}

		return '';
	}

	/**
	 * Getting the class attributes if $options contains a class key.
	 *
	 * @param array $options The array with field options.
	 *
	 * @return string
	 */
	private function get_class( array $options ) {
		if ( ! empty( $options['class'] ) ) {
			return ' class="' . esc_attr( $options['class'] ) . '"';
		}

		return '';
	}

	/**
	 * Getting the label HTML.
	 *
	 * @param string $label      The label value.
	 * @param string $field_name The target field.
	 *
	 * @return string
	 */
	private function get_label( $label, $field_name ) {
		if ( $label !== '' ) {
			return '<label for="' . $field_name . '">' . esc_html( $label ) . '</label>';
		}

		return '';
	}

	/**
	 * Returns the HTML for the row which contains label, help and the field.
	 *
	 * @param string                 $label The html for the label if there was a label set.
	 * @param WPSEO_Admin_Help_Panel $help  The help panel to render in this row.
	 * @param string                 $field The html for the field.
	 *
	 * @return string
	 */
	private function parse_row( $label, WPSEO_Admin_Help_Panel $help, $field ) {
		if ( $label !== '' || $help !== '' ) {
			return $label . $help->get_button_html() . $help->get_panel_html() . $field;
		}

		return $field;
	}
}
PK     ”T]ŠÑ�¹  ¹  #  taxonomy/class-taxonomy-metabox.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class generates the metabox on the edit term page.
 */
class WPSEO_Taxonomy_Metabox {

	/**
	 * @var WP_Term
	 */
	private $term;

	/**
	 * @var string
	 */
	private $taxonomy;

	/**
	 * @var WPSEO_Taxonomy_Fields_Presenter
	 */
	private $taxonomy_tab_content;

	/**
	 * @var WPSEO_Taxonomy_Social_Fields
	 */
	private $taxonomy_social_fields;

	/**
	 * @var WPSEO_Social_Admin
	 */
	private $social_admin;

	/**
	 * The constructor.
	 *
	 * @param string   $taxonomy The taxonomy.
	 * @param stdClass $term     The term.
	 */
	public function __construct( $taxonomy, $term ) {
		$this->term                 = $term;
		$this->taxonomy             = $taxonomy;
		$this->taxonomy_tab_content = new WPSEO_Taxonomy_Fields_Presenter( $this->term );
	}

	/**
	 * Shows the Yoast SEO metabox for the term.
	 */
	public function display() {

		$content_sections = $this->get_content_sections();

		$product_title = 'Yoast SEO';
		if ( file_exists( WPSEO_PATH . 'premium/' ) ) {
			$product_title .= ' Premium';
		}

		printf( '<div id="wpseo_meta" class="postbox yoast wpseo-taxonomy-metabox-postbox"><h2><span>%1$s</span></h2>', $product_title );

		echo '<div class="inside">';
		echo '<div id="taxonomy_overall"></div>';


		echo '<div class="wpseo-metabox-content">';
		echo '<div class="wpseo-metabox-sidebar"><ul>';

		foreach ( $content_sections as $content_section ) {
			$content_section->display_link();
		}

		echo '</ul></div>';

		foreach ( $content_sections as $content_section ) {
			$content_section->display_content();
		}

		echo '</div></div>';
		echo '</div>';
	}

	/**
	 * Returns the relevant metabox sections for the current view.
	 *
	 * @return WPSEO_Metabox_Section[]
	 */
	private function get_content_sections() {
		$content_sections = array();

		$content_sections[] = $this->get_content_meta_section();
		$content_sections[] = $this->get_social_meta_section();
		$content_sections[] = $this->get_settings_meta_section();

		return $content_sections;
	}

	/**
	 * Returns the metabox section for the content analysis.
	 *
	 * @return WPSEO_Metabox_Section
	 */
	private function get_content_meta_section() {
		$taxonomy_content_fields = new WPSEO_Taxonomy_Content_Fields( $this->term );
		$content                 = $this->taxonomy_tab_content->html( $taxonomy_content_fields->get( $this->term ) );


		return new WPSEO_Metabox_Section_React(
			'content',
			'<span class="screen-reader-text">' . __( 'Content optimization', 'wordpress-seo' ) . '</span><span class="yst-traffic-light-container">' . WPSEO_Utils::traffic_light_svg() . '</span>',
			$content,
			array(
				'link_aria_label' => __( 'Content optimization', 'wordpress-seo' ),
				'link_class'      => 'yoast-tooltip yoast-tooltip-e',
			)
		);
	}

	/**
	 * Returns the metabox section for the settings.
	 *
	 * @return WPSEO_Metabox_Section
	 */
	private function get_settings_meta_section() {
		$taxonomy_settings_fields = new WPSEO_Taxonomy_Settings_Fields( $this->term );
		$content                  = $this->taxonomy_tab_content->html( $taxonomy_settings_fields->get() );

		$tab = new WPSEO_Metabox_Form_Tab(
			'settings',
			$content,
			__( 'Settings', 'wordpress-seo' ),
			array(
				'single' => true,
			)
		);

		return new WPSEO_Metabox_Tab_Section(
			'settings',
			'<span class="screen-reader-text">' . __( 'Settings', 'wordpress-seo' ) . '</span><span class="dashicons dashicons-admin-generic"></span>',
			array( $tab ),
			array(
				'link_aria_label' => __( 'Settings', 'wordpress-seo' ),
				'link_class'      => 'yoast-tooltip yoast-tooltip-e',
			)
		);
	}

	/**
	 * Returns the metabox section for the social settings.
	 *
	 * @return WPSEO_Metabox_Section
	 */
	private function get_social_meta_section() {
		$this->taxonomy_social_fields = new WPSEO_Taxonomy_Social_Fields( $this->term );
		$this->social_admin           = new WPSEO_Social_Admin();

		$tabs   = array();
		$tabs[] = $this->create_tab( 'facebook', 'opengraph', 'facebook-alt', __( 'Facebook / Open Graph metadata', 'wordpress-seo' ) );
		$tabs[] = $this->create_tab( 'twitter', 'twitter', 'twitter', __( 'Twitter metadata', 'wordpress-seo' ) );

		return new WPSEO_Metabox_Tab_Section(
			'social',
			'<span class="screen-reader-text">' . __( 'Social', 'wordpress-seo' ) . '</span><span class="dashicons dashicons-share"></span>',
			$tabs,
			array(
				'link_aria_label' => __( 'Social', 'wordpress-seo' ),
				'link_class'      => 'yoast-tooltip yoast-tooltip-e',
			)
		);
	}

	/**
	 * Creates a social network tab.
	 *
	 * @param string $name    The name of the tab.
	 * @param string $network The network of the tab.
	 * @param string $icon    The icon for the tab.
	 * @param string $label   The label for the tab.
	 *
	 * @return WPSEO_Metabox_Form_Tab A WPSEO_Metabox_Form_Tab instance.
	 */
	private function create_tab( $name, $network, $icon, $label ) {
		if ( WPSEO_Options::get( $network ) !== true ) {
			return new WPSEO_Metabox_Null_Tab();
		}

		$meta_fields = $this->taxonomy_social_fields->get_by_network( $network );

		$tab_settings = new WPSEO_Metabox_Form_Tab(
			$name,
			$this->social_admin->get_premium_notice( $network ) . $this->taxonomy_tab_content->html( $meta_fields ),
			'<span class="screen-reader-text">' . $label . '</span><span class="dashicons dashicons-' . $icon . '"></span>',
			array(
				'link_aria_label' => $label,
				'link_class'      => 'yoast-tooltip yoast-tooltip-se',
				'single'          => $this->has_single_social_tab(),
			)
		);

		return $tab_settings;
	}

	/**
	 * Determine whether we only show one social network or two.
	 *
	 * @return bool
	 */
	private function has_single_social_tab() {
		return ( WPSEO_Options::get( 'opengraph' ) === false || WPSEO_Options::get( 'twitter' ) === false );
	}
}
PK     ”T]gyp%I-  I-    taxonomy/class-taxonomy.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class that handles the edit boxes on taxonomy edit pages.
 */
class WPSEO_Taxonomy {

	/**
	 * The current active taxonomy.
	 *
	 * @var string
	 */
	private $taxonomy = '';

	/**
	 * @var WPSEO_Metabox_Analysis_SEO
	 */
	private $analysis_seo;

	/**
	 * @var WPSEO_Metabox_Analysis_Readability
	 */
	private $analysis_readability;

	/**
	 * Class constructor.
	 */
	public function __construct() {
		$this->taxonomy = $this->get_taxonomy();

		add_action( 'edit_term', array( $this, 'update_term' ), 99, 3 );
		add_action( 'init', array( $this, 'custom_category_descriptions_allow_html' ) );
		add_action( 'admin_init', array( $this, 'admin_init' ) );

		if ( self::is_term_overview( $GLOBALS['pagenow'] ) ) {
			new WPSEO_Taxonomy_Columns();
		}
		$this->analysis_seo         = new WPSEO_Metabox_Analysis_SEO();
		$this->analysis_readability = new WPSEO_Metabox_Analysis_Readability();
	}

	/**
	 * Add hooks late enough for taxonomy object to be available for checks.
	 */
	public function admin_init() {

		$taxonomy = get_taxonomy( $this->taxonomy );

		if ( empty( $taxonomy ) || empty( $taxonomy->public ) || ! $this->show_metabox() ) {
			return;
		}

		$this->insert_description_field_editor();

		add_action( sanitize_text_field( $this->taxonomy ) . '_edit_form', array( $this, 'term_metabox' ), 90, 1 );
		add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
	}

	/**
	 * Show the SEO inputs for term.
	 *
	 * @param stdClass|WP_Term $term Term to show the edit boxes for.
	 */
	public function term_metabox( $term ) {
		$tab = new WPSEO_Help_Center_Template_Variables_Tab();
		$tab->register_hooks();

		$metabox = new WPSEO_Taxonomy_Metabox( $this->taxonomy, $term );
		$metabox->display();
	}

	/**
	 * Queue assets for taxonomy screens.
	 *
	 * @since 1.5.0
	 */
	public function admin_enqueue_scripts() {
		$pagenow = $GLOBALS['pagenow'];

		if ( ! ( self::is_term_edit( $pagenow ) || self::is_term_overview( $pagenow ) ) ) {
			return;
		}

		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_style( 'scoring' );

		$tab = new WPSEO_Help_Center_Template_Variables_Tab();
		$tab->enqueue_assets();

		$tag_id = filter_input( INPUT_GET, 'tag_ID' );
		if (
			self::is_term_edit( $pagenow ) &&
			! empty( $tag_id )  // After we drop support for <4.5 this can be removed.
		) {
			wp_enqueue_media(); // Enqueue files needed for upload functionality.

			$asset_manager->enqueue_style( 'metabox-css' );
			$asset_manager->enqueue_style( 'scoring' );
			$asset_manager->enqueue_script( 'metabox' );
			$asset_manager->enqueue_script( 'term-scraper' );

			wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'term-scraper', 'wpseoTermScraperL10n', $this->localize_term_scraper_script() );
			$yoast_components_l10n = new WPSEO_Admin_Asset_Yoast_Components_L10n();
			$yoast_components_l10n->localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'term-scraper' );

			$analysis_worker_location          = new WPSEO_Admin_Asset_Analysis_Worker_Location( $asset_manager->flatten_version( WPSEO_VERSION ) );
			$used_keywords_assessment_location = new WPSEO_Admin_Asset_Analysis_Worker_Location( $asset_manager->flatten_version( WPSEO_VERSION ), 'used-keywords-assessment' );

			$localization_data = array(
				'url'                     => $analysis_worker_location->get_url(
					$analysis_worker_location->get_asset(),
					WPSEO_Admin_Asset::TYPE_JS
				),
				'keywords_assessment_url' => $used_keywords_assessment_location->get_url(
					$used_keywords_assessment_location->get_asset(),
					WPSEO_Admin_Asset::TYPE_JS
				),
				'log_level'               => WPSEO_Utils::get_analysis_worker_log_level(),
			);
			wp_localize_script(
				WPSEO_Admin_Asset_Manager::PREFIX . 'term-scraper',
				'wpseoAnalysisWorkerL10n',
				$localization_data
			);

			/**
			 * Remove the emoji script as it is incompatible with both React and any
			 * contenteditable fields.
			 */
			remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );

			wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'replacevar-plugin', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script() );
			wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoSelect2Locale', WPSEO_Language_Utils::get_language( WPSEO_Language_Utils::get_user_locale() ) );
			wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoAdminL10n', WPSEO_Utils::get_admin_l10n() );
			wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoFeaturesL10n', WPSEO_Utils::retrieve_enabled_features() );

			$asset_manager->enqueue_script( 'admin-media' );

			wp_localize_script(
				WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media',
				'wpseoMediaL10n',
				array( 'choose_image' => __( 'Use Image', 'wordpress-seo' ) )
			);
		}

		if ( self::is_term_overview( $pagenow ) ) {
			$asset_manager->enqueue_script( 'edit-page-script' );
		}
	}

	/**
	 * Update the taxonomy meta data on save.
	 *
	 * @param int    $term_id  ID of the term to save data for.
	 * @param int    $tt_id    The taxonomy_term_id for the term.
	 * @param string $taxonomy The taxonomy the term belongs to.
	 */
	public function update_term( $term_id, $tt_id, $taxonomy ) {
		/* Create post array with only our values. */
		$new_meta_data = array();
		foreach ( WPSEO_Taxonomy_Meta::$defaults_per_term as $key => $default ) {
			$posted_value = filter_input( INPUT_POST, $key );
			if ( isset( $posted_value ) && $posted_value !== false ) {
				$new_meta_data[ $key ] = $posted_value;
			}

			// If analysis is disabled remove that analysis score value from the DB.
			if ( $this->is_meta_value_disabled( $key ) ) {
				$new_meta_data[ $key ] = '';
			}
		}
		unset( $key, $default );

		// Saving the values.
		WPSEO_Taxonomy_Meta::set_values( $term_id, $taxonomy, $new_meta_data );
	}

	/**
	 * Determines if the given meta value key is disabled.
	 *
	 * @param string $key The key of the meta value.
	 * @return bool Whether the given meta value key is disabled.
	 */
	public function is_meta_value_disabled( $key ) {
		if ( 'wpseo_linkdex' === $key && ! $this->analysis_seo->is_enabled() ) {
			return true;
		}

		if ( 'wpseo_content_score' === $key && ! $this->analysis_readability->is_enabled() ) {
			return true;
		}

		return false;
	}

	/**
	 * Allows HTML in descriptions.
	 */
	public function custom_category_descriptions_allow_html() {
		$filters = array(
			'pre_term_description',
			'pre_link_description',
			'pre_link_notes',
			'pre_user_description',
		);

		foreach ( $filters as $filter ) {
			remove_filter( $filter, 'wp_filter_kses' );
		}
		remove_filter( 'term_description', 'wp_kses_data' );
	}

	/**
	 * Output the WordPress editor.
	 */
	public function custom_category_description_editor() {
		wp_editor( '', 'description' );
	}

	/**
	 * Pass variables to js for use with the term-scraper.
	 *
	 * @return array
	 */
	public function localize_term_scraper_script() {
		$term_id  = filter_input( INPUT_GET, 'tag_ID' );
		$term     = get_term_by( 'id', $term_id, $this->get_taxonomy() );
		$taxonomy = get_taxonomy( $term->taxonomy );

		$term_formatter = new WPSEO_Metabox_Formatter(
			new WPSEO_Term_Metabox_Formatter( $taxonomy, $term )
		);

		return $term_formatter->get_values();
	}

	/**
	 * Pass some variables to js for replacing variables.
	 */
	public function localize_replace_vars_script() {
		return array(
			'no_parent_text'           => __( '(no parent)', 'wordpress-seo' ),
			'replace_vars'             => $this->get_replace_vars(),
			'recommended_replace_vars' => $this->get_recommended_replace_vars(),
			'scope'                    => $this->determine_scope(),
		);
	}

	/**
	 * Determines the scope based on the current taxonomy.
	 * This can be used by the replacevar plugin to determine if a replacement needs to be executed.
	 *
	 * @return string String decribing the current scope.
	 */
	private function determine_scope() {
		$taxonomy = $this->get_taxonomy();

		if ( $taxonomy === 'category' ) {
			return 'category';
		}

		if ( $taxonomy === 'post_tag' ) {
			return 'tag';
		}

		return 'term';
	}

	/**
	 * @param string $page The string to check for the term overview page.
	 *
	 * @return bool
	 */
	public static function is_term_overview( $page ) {
		return 'edit-tags.php' === $page;
	}

	/**
	 * @param string $page The string to check for the term edit page.
	 *
	 * @return bool
	 */
	public static function is_term_edit( $page ) {
		return 'term.php' === $page;
	}

	/**
	 * Retrieves a template.
	 * Check if metabox for current taxonomy should be displayed.
	 *
	 * @return bool
	 */
	private function show_metabox() {
		$option_key = 'display-metabox-tax-' . $this->taxonomy;

		return WPSEO_Options::get( $option_key );
	}

	/**
	 * Getting the taxonomy from the URL.
	 *
	 * @return string
	 */
	private function get_taxonomy() {
		return filter_input( INPUT_GET, 'taxonomy', FILTER_DEFAULT, array( 'options' => array( 'default' => '' ) ) );
	}

	/**
	 * Prepares the replace vars for localization.
	 *
	 * @return array The replacement variables.
	 */
	private function get_replace_vars() {
		$term_id = filter_input( INPUT_GET, 'tag_ID' );
		$term    = get_term_by( 'id', $term_id, $this->get_taxonomy() );

		$cached_replacement_vars = array();

		$vars_to_cache = array(
			'date',
			'id',
			'sitename',
			'sitedesc',
			'sep',
			'page',
			'term_title',
			'term_description',
			'category_description',
			'tag_description',
			'searchphrase',
			'currentyear',
		);

		foreach ( $vars_to_cache as $var ) {
			$cached_replacement_vars[ $var ] = wpseo_replace_vars( '%%' . $var . '%%', $term );
		}

		return $cached_replacement_vars;
	}

	/**
	 * Prepares the recommended replace vars for localization.
	 *
	 * @return array The recommended replacement variables.
	 */
	private function get_recommended_replace_vars() {
		$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
		$taxonomy                 = filter_input( INPUT_GET, 'taxonomy' );

		// What is recommended depends on the current context.
		$page_type = $recommended_replace_vars->determine_for_term( $taxonomy );

		return $recommended_replace_vars->get_recommended_replacevars_for( $page_type );
	}

	/**
	 * Adds custom category description editor.
	 * Needs a hook that runs before the description field. Prior to WP version 4.5 we need to use edit_form as
	 * term_edit_form_top was introduced in WP 4.5. This can be removed after <4.5 is no longer supported.
	 *
	 * @return {void}
	 */
	private function insert_description_field_editor() {
		if ( version_compare( $GLOBALS['wp_version'], '4.5', '<' ) ) {
			add_action( "{$this->taxonomy}_edit_form", array( $this, 'custom_category_description_editor' ) );
			return;
		}

		add_action( "{$this->taxonomy}_term_edit_form_top", array( $this, 'custom_category_description_editor' ) );
	}

	/* ********************* DEPRECATED METHODS ********************* */

	/**
	 * Adds shortcode support to category descriptions.
	 *
	 * @deprecated 7.9.0
	 * @codeCoverageIgnore
	 *
	 * @param string $desc String to add shortcodes in.
	 *
	 * @return string Content with shortcodes filtered out.
	 */
	public function custom_category_descriptions_add_shortcode_support( $desc ) {
		_deprecated_function( __FUNCTION__, 'WPSEO 7.9.0', 'WPSEO_Frontend::custom_category_descriptions_add_shortcode_support' );

		$frontend = WPSEO_Frontend::get_instance();
		return $frontend->custom_category_descriptions_add_shortcode_support( $desc );
	}
}
PK     ”T]àÍ€\q  q  #  taxonomy/class-taxonomy-columns.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class adds columns to the taxonomy table.
 */
class WPSEO_Taxonomy_Columns {

	/**
	 * @var WPSEO_Metabox_Analysis_SEO
	 */
	private $analysis_seo;

	/**
	 * @var WPSEO_Metabox_Analysis_Readability
	 */
	private $analysis_readability;

	/**
	 * The current taxonomy.
	 *
	 * @var string
	 */
	private $taxonomy;

	/**
	 * WPSEO_Taxonomy_Columns constructor.
	 */
	public function __construct() {

		$this->taxonomy = $this->get_taxonomy();

		if ( ! empty( $this->taxonomy ) ) {
			add_filter( 'manage_edit-' . $this->taxonomy . '_columns', array( $this, 'add_columns' ) );
			add_filter( 'manage_' . $this->taxonomy . '_custom_column', array( $this, 'parse_column' ), 10, 3 );
		}

		$this->analysis_seo         = new WPSEO_Metabox_Analysis_SEO();
		$this->analysis_readability = new WPSEO_Metabox_Analysis_Readability();
	}

	/**
	 * Adds an SEO score column to the terms table, right after the description column.
	 *
	 * @param array $columns Current set columns.
	 *
	 * @return array
	 */
	public function add_columns( array $columns ) {
		if ( $this->display_metabox( $this->taxonomy ) === false ) {
			return $columns;
		}

		$new_columns = array();

		foreach ( $columns as $column_name => $column_value ) {
			$new_columns[ $column_name ] = $column_value;

			if ( $column_name === 'description' && $this->analysis_seo->is_enabled() ) {
				$new_columns['wpseo-score'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'SEO score', 'wordpress-seo' ) . '"><span class="yoast-column-seo-score yoast-column-header-has-tooltip"><span class="screen-reader-text">' . __( 'SEO score', 'wordpress-seo' ) . '</span></span></span>';
			}

			if ( $column_name === 'description' && $this->analysis_readability->is_enabled() ) {
				$new_columns['wpseo-score-readability'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'Readability score', 'wordpress-seo' ) . '"><span class="yoast-column-readability yoast-column-header-has-tooltip"><span class="screen-reader-text">' . __( 'Readability score', 'wordpress-seo' ) . '</span></span></span>';
			}
		}

		return $new_columns;
	}

	/**
	 * Parses the column.
	 *
	 * @param string  $content     The current content of the column.
	 * @param string  $column_name The name of the column.
	 * @param integer $term_id     ID of requested taxonomy.
	 *
	 * @return string
	 */
	public function parse_column( $content, $column_name, $term_id ) {

		switch ( $column_name ) {
			case 'wpseo-score':
				return $this->get_score_value( $term_id );

			case 'wpseo-score-readability':
				return $this->get_score_readability_value( $term_id );
		}

		return $content;
	}

	/**
	 * Retrieves the taxonomy from the $_GET variable.
	 *
	 * @return string The current taxonomy.
	 */
	public function get_current_taxonomy() {
		return filter_input( $this->get_taxonomy_input_type(), 'taxonomy' );
	}

	/**
	 * Returns the posted/get taxonomy value if it is set.
	 *
	 * @return string|null
	 */
	private function get_taxonomy() {
		if ( wp_doing_ajax() ) {
			return FILTER_INPUT( INPUT_POST, 'taxonomy' );
		}

		return FILTER_INPUT( INPUT_GET, 'taxonomy' );
	}

	/**
	 * Parses the value for the score column.
	 *
	 * @param integer $term_id ID of requested term.
	 *
	 * @return string
	 */
	private function get_score_value( $term_id ) {
		$term = get_term( $term_id, $this->taxonomy );

		// When the term isn't indexable.
		if ( ! $this->is_indexable( $term ) ) {
			return $this->create_score_icon(
				new WPSEO_Rank( WPSEO_Rank::NO_INDEX ),
				__( 'Term is set to noindex.', 'wordpress-seo' )
			);
		}

		// When there is a focus key word.
		$focus_keyword = $this->get_focus_keyword( $term );
		$score         = (int) WPSEO_Taxonomy_Meta::get_term_meta( $term_id, $this->taxonomy, 'linkdex' );
		$rank          = WPSEO_Rank::from_numeric_score( $score );

		return $this->create_score_icon( $rank, $rank->get_label() );
	}

	/**
	 * Parses the value for the readability score column.
	 *
	 * @param int $term_id ID of the requested term.
	 *
	 * @return string The HTML for the readability score indicator.
	 */
	private function get_score_readability_value( $term_id ) {
		$score = (int) WPSEO_Taxonomy_Meta::get_term_meta( $term_id, $this->taxonomy, 'content_score' );
		$rank  = WPSEO_Rank::from_numeric_score( $score );

		return $this->create_score_icon( $rank );
	}

	/**
	 * Creates an icon by the given values.
	 *
	 * @param WPSEO_Rank $rank  The ranking object.
	 * @param string     $title Optional. The title to show. Defaults to the rank label.
	 *
	 * @return string The HTML for a score icon.
	 */
	private function create_score_icon( WPSEO_Rank $rank, $title = '' ) {
		if ( empty( $title ) ) {
			$title = $rank->get_label();
		}

		return '<div aria-hidden="true" title="' . esc_attr( $title ) . '" class="wpseo-score-icon ' . esc_attr( $rank->get_css_class() ) . '"></div><span class="screen-reader-text wpseo-score-text">' . $title . '</span>';
	}

	/**
	 * Check if the taxonomy is indexable.
	 *
	 * @param mixed $term The current term.
	 *
	 * @return bool Whether or not the term is indexable.
	 */
	private function is_indexable( $term ) {
		// When the no_index value is not empty and not default, check if its value is index.
		$no_index = WPSEO_Taxonomy_Meta::get_term_meta( $term->term_id, $this->taxonomy, 'noindex' );

		// Check if the default for taxonomy is empty (this will be index).
		if ( ! empty( $no_index ) && $no_index !== 'default' ) {
			return ( $no_index === 'index' );
		}

		if ( is_object( $term ) ) {
			$no_index_key = 'noindex-tax-' . $term->taxonomy;

			// If the option is false, this means we want to index it.
			return WPSEO_Options::get( $no_index_key, false ) === false;
		}

		return true;
	}

	/**
	 * Returns the focus keyword if this is set, otherwise it will give the term name.
	 *
	 * @param stdClass|WP_Term $term The current term.
	 *
	 * @return string
	 */
	private function get_focus_keyword( $term ) {
		$focus_keyword = WPSEO_Taxonomy_Meta::get_term_meta( 'focuskw', $term->term_id, $term->taxonomy );
		if ( $focus_keyword !== false ) {
			return $focus_keyword;
		}

		return $term->name;
	}

	/**
	 * Checks if a taxonomy is being added via a POST method. If not, it defaults to a GET request.
	 *
	 * @return int
	 */
	private function get_taxonomy_input_type() {
		if ( ! empty( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) {
			return INPUT_POST;
		}

		return INPUT_GET;
	}

	/**
	 * Wraps the WPSEO_Metabox check to determine whether the metabox should be displayed either by
	 * choice of the admin or because the taxonomy is not public.
	 *
	 * @since 7.0
	 *
	 * @param string $taxonomy Optional. The taxonomy to test, defaults to the current taxonomy.
	 *
	 * @return bool Whether or not the meta box (and associated columns etc) should be hidden.
	 */
	private function display_metabox( $taxonomy = null ) {
		$current_taxonomy = sanitize_text_field( $this->get_current_taxonomy() );

		if ( ! isset( $taxonomy ) && ! empty( $current_taxonomy ) ) {
			$taxonomy = $current_taxonomy;
		}

		return WPSEO_Utils::is_metabox_active( $taxonomy, 'taxonomy' );
	}
}
PK     ”T]MÄ×Õf  f  *  taxonomy/class-taxonomy-content-fields.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class parses all the values for the general tab in the Yoast SEO settings metabox.
 */
class WPSEO_Taxonomy_Content_Fields extends WPSEO_Taxonomy_Fields {

	/**
	 * Returns array with the fields for the general tab.
	 *
	 * @return array
	 */
	public function get() {
		$fields = array(
			'title' => $this->get_field_config(
				'',
				'',
				'hidden',
				''
			),
			'desc' => $this->get_field_config(
				'',
				'',
				'hidden',
				''
			),
			'linkdex' => $this->get_field_config(
				'',
				'',
				'hidden',
				''
			),
			'content_score' => $this->get_field_config(
				'',
				'',
				'hidden',
				''
			),
			'focuskw' => $this->get_field_config(
				'',
				'',
				'hidden',
				''
			),
		);
		/**
		 * Filter: 'wpseo_taxonomy_content_fields' - Adds the possibility to register additional content fields.
		 *
		 * @api array - The additional fields.
		 */
		$additional_fields = apply_filters( 'wpseo_taxonomy_content_fields', array() );

		return $this->filter_hidden_fields( array_merge( $fields, $additional_fields ) );
	}
}
PK     ”T]$"‰Ï  Ï    class-my-yoast-proxy.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * @class WPSEO_MyYoast_Proxy Loads the MyYoast proxy.
 *
 * This class registers a proxy page on `admin.php`. Which is reached with the `page=PAGE_IDENTIFIER` parameter.
 * It will read external files and serves them like they are located locally.
 */
class WPSEO_MyYoast_Proxy implements WPSEO_WordPress_Integration {

	/**
	 * The page identifier used in WordPress to register the MyYoast proxy page.
	 *
	 * @var string
	 */
	const PAGE_IDENTIFIER = 'wpseo_myyoast_proxy';

	/**
	 * The cache control's max age. Used in the header of a successful proxy response.
	 *
	 * @var int
	 */
	const CACHE_CONTROL_MAX_AGE = DAY_IN_SECONDS;

	/**
	 * Registers the hooks when the user is on the right page.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function register_hooks() {
		if ( ! $this->is_proxy_page() ) {
			return;
		}

		// Register the page for the proxy.
		add_action( 'admin_menu', array( $this, 'add_proxy_page' ) );
		add_action( 'admin_init', array( $this, 'handle_proxy_page' ) );
	}

	/**
	 * Registers the proxy page. It does not actually add a link to the dashboard.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function add_proxy_page() {
		add_dashboard_page( '', '', 'read', self::PAGE_IDENTIFIER, '' );
	}

	/**
	 * Renders the requested proxy page and exits to prevent the WordPress UI from loading.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function handle_proxy_page() {
		$this->render_proxy_page();

		// Prevent the WordPress UI from loading.
		exit;
	}

	/**
	 * Renders the requested proxy page.
	 *
	 * This is separated from the exits to be able to test it.
	 *
	 * @return void
	 */
	public function render_proxy_page() {
		$proxy_options = $this->determine_proxy_options();
		if ( $proxy_options === array() ) {
			// Do not accept any other file than implemented.
			$this->set_header( 'HTTP/1.0 501 Requested file not implemented' );
			return;
		}

		// Set the headers before serving the remote file.
		$this->set_header( 'Content-Type: ' . $proxy_options['content_type'] );
		$this->set_header( 'Cache-Control: max-age=' . self::CACHE_CONTROL_MAX_AGE );

		if ( $this->should_load_url_directly() ) {
			/*
			 * If an error occurred, fallback to the next proxy method (`wp_remote_get`).
			 * Otherwise, we are done here.
			 */
			if ( $this->load_url( $proxy_options['url'] ) ) {
				return;
			}
		}

		try {
			echo $this->get_remote_url_body( $proxy_options['url'] );
		}
		catch ( Exception $e ) {
			/*
			 * Reset the file headers because the loading failed.
			 *
			 * Note: Due to supporting PHP 5.2 `header_remove` can not be used here.
			 * Overwrite the headers instead.
			 */
			$this->set_header( 'Content-Type: text/plain' );
			$this->set_header( 'Cache-Control: max-age=0' );

			$this->set_header( 'HTTP/1.0 500 ' . $e->getMessage() );
		}
	}

	/**
	 * Tries to load the given url via `wp_remote_get`.
	 *
	 * @codeCoverageIgnore
	 *
	 * @param string $url The url to load.
	 *
	 * @throws Exception When `wp_remote_get` returned an error.
	 * @throws Exception When the response code is not 200.
	 *
	 * @return string The body of the response.
	 */
	protected function get_remote_url_body( $url ) {
		$response = wp_remote_get( $url );

		if ( $response instanceof WP_Error ) {
			throw new Exception( 'Unable to retrieve file from MyYoast' );
		}

		if ( wp_remote_retrieve_response_code( $response ) !== 200 ) {
			throw new Exception( 'Received unexpected response from MyYoast' );
		}

		return wp_remote_retrieve_body( $response );
	}

	/**
	 * Tries to load the given url.
	 *
	 * @link https://php.net/manual/en/function.readfile.php
	 *
	 * @codeCoverageIgnore
	 *
	 * @param string $url The url to load.
	 *
	 * @return bool False if an error occurred.
	 */
	protected function load_url( $url ) {
		return readfile( $url ) !== false;
	}

	/**
	 * Determines the proxy options based on the file and plugin version arguments.
	 *
	 * When the file is known it returns an array like this:
	 * <code>
	 * $array = array(
	 *  'content_type' => 'the content type'
	 *  'url'          => 'the url, possibly with the plugin version'
	 * )
	 * </code>
	 *
	 * @return array Empty for an unknown file. See format above for known files.
	 */
	protected function determine_proxy_options() {
		if ( $this->get_proxy_file() === 'research-webworker' ) {
			return array(
				'content_type' => 'text/javascript; charset=UTF-8',
				'url'          => 'https://my.yoast.com/api/downloads/file/analysis-worker?plugin_version=' . $this->get_plugin_version(),
			);
		}

		return array();
	}

	/**
	 * Checks the PHP configuration of allow_url_fopen.
	 *
	 * @codeCoverageIgnore
	 *
	 * @link https://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
	 *
	 * @return bool True when the PHP configuration allows for url loading via readfile.
	 */
	protected function should_load_url_directly() {
		return ! ! ini_get( 'allow_url_fopen' );
	}

	/**
	 * Checks if the current page is the MyYoast proxy page.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return bool True when the page request parameter equals the proxy page.
	 */
	protected function is_proxy_page() {
		return filter_input( INPUT_GET, 'page' ) === self::PAGE_IDENTIFIER;
	}

	/**
	 * Returns the proxy file from the HTTP request parameters.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return string The sanitized file request parameter.
	 */
	protected function get_proxy_file() {
		return filter_input( INPUT_GET, 'file', FILTER_SANITIZE_STRING );
	}

	/**
	 * Returns the plugin version from the HTTP request parameters.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return string The sanitized plugin_version request parameter.
	 */
	protected function get_plugin_version() {
		$plugin_version = filter_input( INPUT_GET, 'plugin_version', FILTER_SANITIZE_STRING );
		// Replace slashes to secure against requiring a file from another path.
		$plugin_version = str_replace( array( '/', '\\' ), '_', $plugin_version );

		return $plugin_version;
	}

	/**
	 * Sets the HTTP header.
	 *
	 * This is a tiny helper function to enable better testing.
	 *
	 * @codeCoverageIgnore
	 *
	 * @param string $header The header to set.
	 *
	 * @return void
	 */
	protected function set_header( $header ) {
		header( $header );
	}
}
PK     ”T]ö•¡î      class-help-center-item.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Options\Tabs
 */

/**
 * Class WPSEO_Help_Center_Item.
 */
class WPSEO_Help_Center_Item {

	/**
	 * Identifier for this tab.
	 *
	 * @var string
	 */
	private $identifier;

	/**
	 * Label to display.
	 *
	 * @var string
	 */
	private $label;

	/**
	 * The dashicon classname to display in front of the label.
	 *
	 * @var string
	 */
	private $dashicon;

	/**
	 * Optional arguments.
	 *
	 * @var array
	 */
	private $args = array();

	/**
	 * WPSEO_Help_Center_Item constructor.
	 *
	 * @param string $identifier Unique identifier for this tab.
	 * @param string $label      Label to display.
	 * @param array  $args       Optional. Settings for this tab.
	 * @param string $dashicon   Optional. The classname of the dahsicon to put in front of the label.
	 */
	public function __construct( $identifier, $label, $args = array(), $dashicon = '' ) {
		$this->identifier = $identifier;
		$this->label      = $label;
		$this->dashicon   = $dashicon;
		$this->args       = $args;
	}

	/**
	 * Get the label.
	 *
	 * @return string
	 */
	public function get_label() {
		return $this->label;
	}

	/**
	 * Get the identifier.
	 *
	 * @return string
	 */
	public function get_identifier() {
		return $this->identifier;
	}

	/**
	 * Get the dashicon.
	 *
	 * @return string
	 */
	public function get_dashicon() {
		return $this->dashicon;
	}

	/**
	 * Get the content of this tab.
	 *
	 * @return mixed|string
	 */
	public function get_content() {
		if ( ! empty( $this->args['content'] ) ) {
			return $this->args['content'];
		}

		if ( ! empty( $this->args['callback'] ) ) {
			return call_user_func_array( $this->args['callback'], array( $this ) );
		}

		if ( ! empty( $this->args['view'] ) ) {
			$view = $this->args['view'];
			if ( substr( $view, - 4 ) === '.php' ) {
				$view = substr( $view, 0, - 4 );
			}

			if ( ! empty( $this->args['view_arguments'] ) ) {
				extract( $this->args['view_arguments'] );
			}

			include WPSEO_PATH . 'admin/views/' . $view . '.php';
		}

		return '';
	}
}
PK     ”T]�SÊ‰í   í     help_center/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]rÜåÙ€
  €
  ,  help_center/class-template-variables-tab.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class that adds a template variables explanation tab to the Help Center.
 */
class WPSEO_Help_Center_Template_Variables_Tab implements WPSEO_WordPress_Integration {

	/**
	 * Priority to hook into the tab filter.
	 *
	 * @var int
	 */
	private $priority;

	/**
	 * Tab constructor.
	 *
	 * @param int $priority The priority to add the filter on, allows for ordering.
	 */
	public function __construct( $priority = 10 ) {
		$this->priority = $priority;
	}

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_filter( 'wpseo_help_center_items', array( $this, 'add_meta_options_help_center_tabs' ), $this->priority );
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
	}

	/**
	 * Enqueues the styles needed in the Help Center tab.
	 *
	 * @return void
	 */
	public function enqueue_assets() {
		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_style( 'admin-css' );
	}

	/**
	 * Adds help tabs.
	 *
	 * @param array $tabs Current help center tabs.
	 *
	 * @return array List containing all the additional tabs.
	 */
	public function add_meta_options_help_center_tabs( $tabs ) {
		$tabs[] = new WPSEO_Help_Center_Item(
			'template-variables',
			__( 'Snippet variables', 'wordpress-seo' ),
			array( 'content' => $this->get_content() )
		);

		return $tabs;
	}

	/**
	 * Adds template variables to the help center.
	 *
	 * @return string The content for the template variables tab.
	 */
	private function get_content() {
		$explanation = sprintf(
			/* translators: %1$s expands to Yoast SEO. */
			__( 'The search appearance settings for %1$s are made up of variables that are replaced by specific values from the page when the page is displayed. The table below contains a list of the available variables.', 'wordpress-seo' ),
			'Yoast SEO'
		);

		$output_explanation = sprintf(
			'<h2 class="wpseo-help-center-sub-title">%s</h2><p>%s</p><p>%s</p>',
			esc_html( __( 'Snippet variables', 'wordpress-seo' ) ),
			esc_html( $explanation ),
			esc_html( __( 'Note that not all variables can be used in every field.', 'wordpress-seo' ) )
		);

		$output_basic = sprintf(
			'<h2 class="wpseo-help-center-sub-title">%s</h2>%s',
			esc_html( __( 'Basic Variables', 'wordpress-seo' ) ),
			WPSEO_Replace_Vars::get_basic_help_texts()
		);

		$output_advanced = sprintf(
			'<h2 class="wpseo-help-center-sub-title">%s</h2>%s',
			esc_html( __( 'Advanced Variables', 'wordpress-seo' ) ),
			WPSEO_Replace_Vars::get_advanced_help_texts()
		);

		return $output_explanation . $output_basic . $output_advanced;
	}
}
PK     ”T]‚ÍÊø¥  ¥    class-license-page-manager.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents the values for a single Yoast Premium extension plugin.
 */
class WPSEO_License_Page_Manager implements WPSEO_WordPress_Integration {

	/**
	 * Version number for License Page Manager.
	 *
	 * @var string
	 */
	const VERSION_LEGACY = '1';

	/**
	 * Version number for License Page Manager.
	 *
	 * @var string
	 */
	const VERSION_BACKWARDS_COMPATIBILITY = '2';

	/**
	 * Registers all hooks to WordPress.
	 */
	public function register_hooks() {
		add_filter( 'http_response', array( $this, 'handle_response' ), 10, 3 );

		if ( $this->get_version() === self::VERSION_BACKWARDS_COMPATIBILITY ) {
			add_filter( 'yoast-license-valid', '__return_true' );
			add_filter( 'yoast-show-license-notice', '__return_false' );
			add_action( 'admin_init', array( $this, 'validate_extensions' ), 15 );
		}
		else {
			add_action( 'admin_init', array( $this, 'remove_faulty_notifications' ), 15 );
		}
	}

	/**
	 * Validates the extensions and show a notice for the invalid extensions.
	 */
	public function validate_extensions() {

		if ( filter_input( INPUT_GET, 'page' ) === WPSEO_Admin::PAGE_IDENTIFIER ) {
			/**
			 * Filter: 'yoast-active-extensions' - Collects all active extensions. This hook is implemented in the
			 *                                     license manager.
			 *
			 * @api array $extensions The array with extensions.
			 */
			apply_filters( 'yoast-active-extensions', array() );
		}

		$extension_list = new WPSEO_Extensions();
		$extensions     = $extension_list->get();

		$notification_center = Yoast_Notification_Center::get();

		foreach ( $extensions as $product_name ) {
			$notification = $this->create_notification( $product_name );

			// Add a notification when the installed plugin isn't activated in My Yoast.
			if ( $extension_list->is_installed( $product_name ) && ! $extension_list->is_valid( $product_name ) ) {
				$notification_center->add_notification( $notification );

				continue;
			}

			$notification_center->remove_notification( $notification );
		}
	}

	/**
	 * Removes the faulty set notifications.
	 */
	public function remove_faulty_notifications() {
		$extension_list = new WPSEO_Extensions();
		$extensions     = $extension_list->get();

		$notification_center = Yoast_Notification_Center::get();

		foreach ( $extensions as $product_name ) {
			$notification = $this->create_notification( $product_name );
			$notification_center->remove_notification( $notification );
		}
	}

	/**
	 * Handles the response.
	 *
	 * @param array  $response          HTTP response.
	 * @param array  $request_arguments HTTP request arguments. Unused.
	 * @param string $url               The request URL.
	 *
	 * @return array The response array.
	 */
	public function handle_response( array $response, $request_arguments, $url ) {
		$response_code = wp_remote_retrieve_response_code( $response );

		if ( $response_code === 200 && $this->is_expected_endpoint( $url ) ) {
			$response_data = $this->parse_response( $response );
			$this->detect_version( $response_data );
		}

		return $response;
	}

	/**
	 * Returns the license page to use based on the version number.
	 *
	 * @return string The page to use.
	 */
	public function get_license_page() {
		return 'licenses';
	}

	/**
	 * Returns the version number of the license server.
	 *
	 * @return int The version number
	 */
	protected function get_version() {
		return get_option( $this->get_option_name(), self::VERSION_BACKWARDS_COMPATIBILITY );
	}

	/**
	 * Returns the option name.
	 *
	 * @return string The option name.
	 */
	protected function get_option_name() {
		return 'wpseo_license_server_version';
	}

	/**
	 * Sets the version when there is a value in the response.
	 *
	 * @param array $response The response to extract the version from.
	 */
	protected function detect_version( $response ) {
		if ( ! empty( $response['serverVersion'] ) ) {
			$this->set_version( $response['serverVersion'] );
		}
	}

	/**
	 * Sets the version.
	 *
	 * @param string $server_version The version number to save.
	 */
	protected function set_version( $server_version ) {
		update_option( $this->get_option_name(), $server_version );
	}

	/**
	 * Parses the response by getting its body and do a unserialize of it.
	 *
	 * @param array $response The response to parse.
	 *
	 * @return mixed|string|false The parsed response.
	 */
	protected function parse_response( $response ) {
		$response = json_decode( wp_remote_retrieve_body( $response ), true );
		$response = maybe_unserialize( $response );

		return $response;
	}

	/**
	 * Checks if the given url matches the expected endpoint.
	 *
	 * @param string $url The url to check.
	 *
	 * @return bool True when url matches the endpoint.
	 */
	protected function is_expected_endpoint( $url ) {
		$url_parts = wp_parse_url( $url );

		$is_yoast_com = ( in_array( $url_parts['host'], array( 'yoast.com', 'my.yoast.com' ), true ) );
		$is_edd_api   = ( isset( $url_parts['path'] ) && $url_parts['path'] === '/edd-sl-api' );

		return $is_yoast_com && $is_edd_api;
	}

	/**
	 * Creates an instance of Yoast_Notification.
	 *
	 * @param string $product_name The product to create the notification for.
	 *
	 * @return Yoast_Notification The created notification.
	 */
	protected function create_notification( $product_name ) {
		$notification_options = array(
			'type'         => Yoast_Notification::ERROR,
			'id'           => 'wpseo-dismiss-' . sanitize_title_with_dashes( $product_name, null, 'save' ),
			'capabilities' => 'wpseo_manage_options',
		);

		$notification = new Yoast_Notification(
			sprintf(
				/* translators: %1$s expands to the product name. %2$s expands to a link to My Yoast  */
				__( 'You are not receiving updates or support! Fix this problem by adding this site and enabling %1$s for it in %2$s.', 'wordpress-seo' ),
				$product_name,
				'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/13j' ) . '" target="_blank">My Yoast</a>'
			),
			$notification_options
		);

		return $notification;
	}
}
PK     ”T][Ôé?è  è    class-admin-asset-location.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents a way to determine an assets location.
 */
interface WPSEO_Admin_Asset_Location {

	/**
	 * Determines the URL of the asset on the dev server.
	 *
	 * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
	 * @param string            $type  The type of asset. Usually JS or CSS.
	 *
	 * @return string The URL of the asset.
	 */
	public function get_url( WPSEO_Admin_Asset $asset, $type );
}
PK     ”T]Æpýè	  è	    class-admin-utils.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents the utils for the admin.
 */
class WPSEO_Admin_Utils {

	/**
	 * Gets the install URL for the passed plugin slug.
	 *
	 * @param string $slug The slug to create an install link for.
	 *
	 * @return string The install URL. Empty string if the current user doesn't have the proper capabilities.
	 */
	public static function get_install_url( $slug ) {
		if ( ! current_user_can( 'install_plugins' ) ) {
			return '';
		}

		return wp_nonce_url(
			self_admin_url( 'update.php?action=install-plugin&plugin=' . dirname( $slug ) ),
			'install-plugin_' . dirname( $slug )
		);
	}

	/**
	 * Gets the activation URL for the passed plugin slug.
	 *
	 * @param string $slug The slug to create an activation link for.
	 *
	 * @return string The activation URL. Empty string if the current user doesn't have the proper capabilities.
	 */
	public static function get_activation_url( $slug ) {
		if ( ! current_user_can( 'install_plugins' ) ) {
			return '';
		}

		return wp_nonce_url(
			self_admin_url( 'plugins.php?action=activate&plugin_status=all&paged=1&s&plugin=' . $slug ),
			'activate-plugin_' . $slug
		);
	}

	/**
	 * Creates a link if the passed plugin is deemend a directly-installable plugin.
	 *
	 * @param array $plugin The plugin to create the link for.
	 *
	 * @return string The link to the plugin install. Returns the title if the plugin is deemed a Premium product.
	 */
	public static function get_install_link( $plugin ) {
		$install_url = self::get_install_url( $plugin['slug'] );

		if ( $install_url === '' || ( isset( $plugin['premium'] ) && $plugin['premium'] === true ) ) {
			return $plugin['title'];
		}

		return sprintf(
			'<a href="%s">%s</a>',
			$install_url,
			$plugin['title']
		);
	}

	/**
	 * Gets a visually hidden accessible message for links that open in a new browser tab.
	 *
	 * @return string The visually hidden accessible message.
	 */
	public static function get_new_tab_message() {
		return sprintf(
			'<span class="screen-reader-text">%s</span>',
			esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' )
		);
	}

	/* ********************* DEPRECATED METHODS ********************* */

	/**
	 * Determines whether or not the user has an invalid version of PHP installed.
	 *
	 * @deprecated 8.1
	 * @codeCoverageIgnore
	 *
	 * @return bool Whether or not PHP 5.2 or lower is installed.
	 */
	public static function is_supported_php_version_installed() {
		// Intentionally left blank.
		return true;
	}
}
PK     ”T]¯æò^  ò^    class-admin-init.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Performs the load on admin side.
 */
class WPSEO_Admin_Init {

	/**
	 * Holds the global `$pagenow` variable's value.
	 *
	 * @var string
	 */
	private $pagenow;

	/**
	 * Holds the asset manager.
	 *
	 * @var WPSEO_Admin_Asset_Manager
	 */
	private $asset_manager;

	/**
	 * Class constructor.
	 */
	public function __construct() {
		$GLOBALS['wpseo_admin'] = new WPSEO_Admin();

		$this->pagenow = $GLOBALS['pagenow'];

		$this->asset_manager = new WPSEO_Admin_Asset_Manager();

		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_dismissible' ) );
		add_action( 'admin_init', array( $this, 'tagline_notice' ), 15 );
		add_action( 'admin_init', array( $this, 'blog_public_notice' ), 15 );
		add_action( 'admin_init', array( $this, 'permalink_notice' ), 15 );
		add_action( 'admin_init', array( $this, 'page_comments_notice' ), 15 );
		add_action( 'admin_init', array( $this, 'ga_compatibility_notice' ), 15 );
		add_action( 'admin_init', array( $this, 'yoast_plugin_compatibility_notification' ), 15 );
		add_action( 'admin_init', array( $this, 'yoast_plugin_suggestions_notification' ), 15 );
		add_action( 'admin_init', array( $this, 'recalculate_notice' ), 15 );
		add_action( 'admin_init', array( $this, 'unsupported_php_notice' ), 15 );
		add_action( 'admin_init', array( $this, 'wordpress_upgrade_notice' ), 15 );
		add_action( 'admin_init', array( $this->asset_manager, 'register_assets' ) );
		add_action( 'admin_init', array( $this, 'show_hook_deprecation_warnings' ) );
		add_action( 'admin_init', array( 'WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts' ) );
		add_action( 'admin_init', array( $this, 'handle_notifications' ), 15 );
		add_action( 'admin_notices', array( $this, 'permalink_settings_notice' ) );
		add_action( 'admin_enqueue_scripts', array( $this->asset_manager, 'register_wp_assets' ), PHP_INT_MAX );

		$listeners   = array();
		$listeners[] = new WPSEO_Post_Type_Archive_Notification_Handler();

		/** @var WPSEO_Listener $listener */
		foreach ( $listeners as $listener ) {
			$listener->listen();
		}

		$this->load_meta_boxes();
		$this->load_taxonomy_class();
		$this->load_admin_page_class();
		$this->load_admin_user_class();
		$this->load_xml_sitemaps_admin();
		$this->load_plugin_suggestions();
	}

	/**
	 * Handles the notifiers for the dashboard page.
	 *
	 * @return void
	 */
	public function handle_notifications() {
		/**
		 * @var WPSEO_Notification_Handler[] $handlers
		 */
		$handlers   = array();
		$handlers[] = new WPSEO_Post_Type_Archive_Notification_Handler();

		$notification_center = Yoast_Notification_Center::get();
		foreach ( $handlers as $handler ) {
			$handler->handle( $notification_center );
		}
	}

	/**
	 * Enqueue our styling for dismissible yoast notifications.
	 */
	public function enqueue_dismissible() {
		$this->asset_manager->enqueue_style( 'dismissible' );
	}

	/**
	 * Notify about the default tagline if the user hasn't changed it.
	 */
	public function tagline_notice() {
		$query_args    = array(
			'autofocus[control]' => 'blogdescription',
		);
		$customize_url = add_query_arg( $query_args, wp_customize_url() );

		$info_message = sprintf(
			/* translators: 1: link open tag; 2: link close tag. */
			__( 'You still have the default WordPress tagline, even an empty one is probably better. %1$sYou can fix this in the customizer%2$s.', 'wordpress-seo' ),
			'<a href="' . esc_attr( $customize_url ) . '">',
			'</a>'
		);

		$notification_options = array(
			'type'         => Yoast_Notification::ERROR,
			'id'           => 'wpseo-dismiss-tagline-notice',
			'capabilities' => 'wpseo_manage_options',
		);

		$tagline_notification = new Yoast_Notification( $info_message, $notification_options );

		$notification_center = Yoast_Notification_Center::get();
		$notification_center->remove_notification( $tagline_notification );
	}

	/**
	 * Add an alert if the blog is not publicly visible.
	 */
	public function blog_public_notice() {

		$info_message  = '<strong>' . __( 'Huge SEO Issue: You\'re blocking access to robots.', 'wordpress-seo' ) . '</strong> ';
		$info_message .= sprintf(
			/* translators: %1$s resolves to the opening tag of the link to the reading settings, %1$s resolves to the closing tag for the link */
			__( 'You must %1$sgo to your Reading Settings%2$s and uncheck the box for Search Engine Visibility.', 'wordpress-seo' ),
			'<a href="' . esc_url( admin_url( 'options-reading.php' ) ) . '">',
			'</a>'
		);

		$notification_options = array(
			'type'         => Yoast_Notification::ERROR,
			'id'           => 'wpseo-dismiss-blog-public-notice',
			'priority'     => 1.0,
			'capabilities' => 'wpseo_manage_options',
		);

		$notification = new Yoast_Notification( $info_message, $notification_options );

		$notification_center = Yoast_Notification_Center::get();
		if ( ! $this->is_blog_public() ) {
			$notification_center->add_notification( $notification );
		}
		else {
			$notification_center->remove_notification( $notification );
		}
	}

	/**
	 * Display notice to disable comment pagination.
	 */
	public function page_comments_notice() {

		$info_message  = __( 'Paging comments is enabled, this is not needed in 999 out of 1000 cases, we recommend to disable it.', 'wordpress-seo' );
		$info_message .= '<br/>';

		$info_message .= sprintf(
			/* translators: %1$s resolves to the opening tag of the link to the comment setting page, %2$s resolves to the closing tag of the link */
			__( 'To fix this uncheck the box in front of the "Break comments into pages..." on the %1$sComment settings page%2$s.', 'wordpress-seo' ),
			'<a href="' . esc_url( admin_url( 'options-discussion.php' ) ) . '">',
			'</a>'
		);

		$notification_options = array(
			'type'         => Yoast_Notification::WARNING,
			'id'           => 'wpseo-dismiss-page_comments-notice',
			'capabilities' => 'wpseo_manage_options',
		);

		$tagline_notification = new Yoast_Notification( $info_message, $notification_options );

		$notification_center = Yoast_Notification_Center::get();
		if ( $this->has_page_comments() ) {
			$notification_center->add_notification( $tagline_notification );
		}
		else {
			$notification_center->remove_notification( $tagline_notification );
		}
	}

	/**
	 * Returns whether or not the site has the default tagline.
	 *
	 * @return bool
	 */
	public function has_default_tagline() {
		$blog_description         = get_bloginfo( 'description' );
		$default_blog_description = 'Just another WordPress site';

		// We are checking against the WordPress internal translation.
		// @codingStandardsIgnoreLine
		$translated_blog_description = __( 'Just another WordPress site', 'default' );

		return $translated_blog_description === $blog_description || $default_blog_description === $blog_description;
	}

	/**
	 * Show alert when the permalink doesn't contain %postname%.
	 */
	public function permalink_notice() {

		$info_message  = __( 'You do not have your postname in the URL of your posts and pages, it is highly recommended that you do. Consider setting your permalink structure to <strong>/%postname%/</strong>.', 'wordpress-seo' );
		$info_message .= '<br/>';
		$info_message .= sprintf(
			/* translators: %1$s resolves to the starting tag of the link to the permalink settings page, %2$s resolves to the closing tag of the link */
			__( 'You can fix this on the %1$sPermalink settings page%2$s.', 'wordpress-seo' ),
			'<a href="' . admin_url( 'options-permalink.php' ) . '">',
			'</a>'
		);

		$notification_options = array(
			'type'         => Yoast_Notification::WARNING,
			'id'           => 'wpseo-dismiss-permalink-notice',
			'capabilities' => 'wpseo_manage_options',
			'priority'     => 0.8,
		);

		$notification = new Yoast_Notification( $info_message, $notification_options );

		$notification_center = Yoast_Notification_Center::get();
		if ( ! $this->has_postname_in_permalink() ) {
			$notification_center->add_notification( $notification );
		}
		else {
			$notification_center->remove_notification( $notification );
		}
	}

	/**
	 * Are page comments enabled.
	 *
	 * @return bool
	 */
	public function has_page_comments() {
		return '1' === get_option( 'page_comments' );
	}

	/**
	 * Shows a notice to the user if they have Google Analytics for WordPress 5.4.3 installed because it causes an error
	 * on the google search console page.
	 */
	public function ga_compatibility_notice() {

		$notification        = $this->get_compatibility_notification();
		$notification_center = Yoast_Notification_Center::get();

		if ( defined( 'GAWP_VERSION' ) && '5.4.3' === GAWP_VERSION ) {
			$notification_center->add_notification( $notification );
		}
		else {
			$notification_center->remove_notification( $notification );
		}
	}

	/**
	 * Build compatibility problem notification.
	 *
	 * @return Yoast_Notification
	 */
	private function get_compatibility_notification() {
		$info_message = sprintf(
			/* translators: %1$s expands to Yoast SEO, %2$s expands to 5.4.3, %3$s expands to Google Analytics by Yoast */
			__( '%1$s detected you are using version %2$s of %3$s, please update to the latest version to prevent compatibility issues.', 'wordpress-seo' ),
			'Yoast SEO',
			'5.4.3',
			'Google Analytics by Yoast'
		);

		return new Yoast_Notification(
			$info_message,
			array(
				'id'   => 'gawp-compatibility-notice',
				'type' => Yoast_Notification::ERROR,
			)
		);
	}

	/**
	 * Determines whether a suggested plugins notification needs to be displayed.
	 *
	 * @return void
	 */
	public function yoast_plugin_suggestions_notification() {
		$checker             = new WPSEO_Plugin_Availability();
		$notification_center = Yoast_Notification_Center::get();

		// Get all Yoast plugins that have dependencies.
		$plugins = $checker->get_plugins_with_dependencies();

		foreach ( $plugins as $plugin_name => $plugin ) {
			$dependency_names = $checker->get_dependency_names( $plugin );
			$notification     = $this->get_yoast_seo_suggested_plugins_notification( $plugin_name, $plugin, $dependency_names[0] );

			if ( $checker->dependencies_are_satisfied( $plugin ) && ! $checker->is_installed( $plugin ) ) {
				$notification_center->add_notification( $notification );

				continue;
			}

			$notification_center->remove_notification( $notification );
		}
	}

	/**
	 * Build Yoast SEO suggested plugins notification.
	 *
	 * @param string $name            The plugin name to use for the unique ID.
	 * @param array  $plugin          The plugin to retrieve the data from.
	 * @param string $dependency_name The name of the dependency.
	 *
	 * @return Yoast_Notification The notification containing the suggested plugin.
	 */
	private function get_yoast_seo_suggested_plugins_notification( $name, $plugin, $dependency_name ) {
		$info_message = sprintf(
			/* translators: %1$s expands to Yoast SEO, %2$s expands to the plugin version, %3$s expands to the plugin name */
			__( '%1$s and %2$s can work together a lot better by adding a helper plugin. Please install %3$s to make your life better.', 'wordpress-seo' ),
			'Yoast SEO',
			$dependency_name,
			sprintf( '<a href="%s">%s</a>', $plugin['url'], $plugin['title'] )
		);

		return new Yoast_Notification(
			$info_message,
			array(
				'id'   => 'wpseo-suggested-plugin-' . $name,
				'type' => Yoast_Notification::WARNING,
			)
		);
	}

	/**
	 * Add an alert if outdated versions of Yoast SEO plugins are running.
	 */
	public function yoast_plugin_compatibility_notification() {
		$compatibility_checker = new WPSEO_Plugin_Compatibility( WPSEO_VERSION );
		$plugins               = $compatibility_checker->get_installed_plugins_compatibility();

		$notification_center = Yoast_Notification_Center::get();

		foreach ( $plugins as $name => $plugin ) {
			$type         = ( $plugin['active'] ) ? Yoast_Notification::ERROR : Yoast_Notification::WARNING;
			$notification = $this->get_yoast_seo_compatibility_notification( $name, $plugin, $type );

			if ( $plugin['active'] && $plugin['compatible'] === false ) {
				$notification_center->add_notification( $notification );

				continue;
			}

			$notification_center->remove_notification( $notification );
		}
	}

	/**
	 * Build Yoast SEO compatibility problem notification.
	 *
	 * @param string $name   The plugin name to use for the unique ID.
	 * @param array  $plugin The plugin to retrieve the data from.
	 * @param string $level  The severity level to use for the notification.
	 *
	 * @return Yoast_Notification
	 */
	private function get_yoast_seo_compatibility_notification( $name, $plugin, $level = Yoast_Notification::WARNING ) {
		$info_message = sprintf(
			/* translators: %1$s expands to Yoast SEO, %2$s expands to the plugin version, %3$s expands to the plugin name */
			__( '%1$s detected you are using version %2$s of %3$s, please update to the latest version to prevent compatibility issues.', 'wordpress-seo' ),
			'Yoast SEO',
			$plugin['version'],
			$plugin['title']
		);

		return new Yoast_Notification(
			$info_message,
			array(
				'id'   => 'wpseo-outdated-yoast-seo-plugin-' . $name,
				'type' => $level,
			)
		);
	}

	/**
	 * Shows the notice for recalculating the post. the Notice will only be shown if the user hasn't dismissed it before.
	 */
	public function recalculate_notice() {
		// Just a return, because we want to temporary disable this notice (#3998 and #4532).
		return;

		if ( filter_input( INPUT_GET, 'recalculate' ) === '1' ) {
			update_option( 'wpseo_dismiss_recalculate', '1' );

			return;
		}

		if ( ! WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) ) {
			return;
		}

		if ( $this->is_site_notice_dismissed( 'wpseo_dismiss_recalculate' ) ) {
			return;
		}

		Yoast_Notification_Center::get()->add_notification(
			new Yoast_Notification(
				sprintf(
					/* translators: 1: is a link to 'admin_url / admin.php?page=wpseo_tools&recalculate=1' 2: closing link tag */
					__( 'We\'ve updated our SEO score algorithm. %1$sRecalculate the SEO scores%2$s for all posts and pages.', 'wordpress-seo' ),
					'<a href="' . admin_url( 'admin.php?page=wpseo_tools&recalculate=1' ) . '">',
					'</a>'
				),
				array(
					'type'  => 'updated yoast-dismissible',
					'id'    => 'wpseo-dismiss-recalculate',
					'nonce' => wp_create_nonce( 'wpseo-dismiss-recalculate' ),
				)
			)
		);
	}

	/**
	 * Creates an unsupported PHP version notification in the notification center.
	 *
	 * @return void
	 */
	public function unsupported_php_notice() {
		$notification_center = Yoast_Notification_Center::get();
		$notification_center->remove_notification_by_id( 'wpseo-dismiss-unsupported-php' );
	}

	/**
	 * Creates a WordPress upgrade notification in the notification center.
	 *
	 * @return void
	 */
	public function wordpress_upgrade_notice() {
		global $wp_version;

		$wordpress_less_than_50 = version_compare( $wp_version, '5.0', '<' );
		$wordpress_less_than_52 = version_compare( $wp_version, '5.2', '<' );

		$notification_center = Yoast_Notification_Center::get();

		$message = sprintf(
			/* translators: %1$s expands to an opening strong tag, %2$s expands to a closing strong tag, %3$s expands to a html break, %4$s expands to Yoast, %5$s expands to Yoast SEO, %6$s expands to 5.2, %7$s expands to 5.3 */
			__(
				'%1$sUpgrade WordPress to the most recent version%2$s%3$sWeâ€™ve noticed that youâ€™re not on the latest WordPress version, which might cause an issue soon. %4$s (for reasons of security and stability) only supports the current and previous version of WordPress. When the next version of WordPress comes out, that means that we will support WordPress %6$s and %7$s. This means you will not get any updates to %5$s until you update your WordPress, so please make sure to upgrade to the latest WordPress version soon!%3$s%3$s',
				'wordpress-seo'
			),
			'<strong>',
			'</strong>',
			'<br/>',
			'Yoast',
			'Yoast SEO',
			'5.2',
			'5.3'
		);
		if ( $wordpress_less_than_50 ) {
			$message .= sprintf(
				/* translators: %1$s expands to Yoast SEO, %2$s expands to 5.0 */
				__(
					'If youâ€™ve held off on updating to %2$s and higher because of the new Gutenberg editor, please install the Classic editor plugin. It will give you the same editing experience you have now, but also the security of newer versions of WordPress and %1$s.',
					'wordpress-seo'
				),
				'Yoast SEO',
				'5.0'
			);
		}
		$message .= '<br/><br/>';
		$message .= sprintf(
			/* translators: %1$s expands to an opening anchor tag, %2$s expands to a closing anchor tag */
			__(
				'Read %1$sthis post for more information about why weâ€™re not supporting older versions.%2$s',
				'wordpress-seo'
			),
			'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/old-wp-support' ) . '" target="_blank" rel="nofollow">',
			'</a>'
		);

		$notification = new Yoast_Notification(
			$message,
			array(
				'type' => Yoast_Notification::ERROR,
				'id'   => 'wpseo-dismiss-wordpress-upgrade',
			)
		);

		if ( $wordpress_less_than_52 ) {
			$notification_center->add_notification( $notification );
			return;
		}
		$notification_center->remove_notification( $notification );
	}

	/**
	 * Check if the user has dismissed the given notice (by $notice_name).
	 *
	 * @param string $notice_name The name of the notice that might be dismissed.
	 *
	 * @return bool
	 */
	private function is_site_notice_dismissed( $notice_name ) {
		return '1' === get_option( $notice_name, true );
	}

	/**
	 * Helper to verify if the user is currently visiting one of our admin pages.
	 *
	 * @return bool
	 */
	private function on_wpseo_admin_page() {
		return 'admin.php' === $this->pagenow && strpos( filter_input( INPUT_GET, 'page' ), 'wpseo' ) === 0;
	}

	/**
	 * Determine whether we should load the meta box class and if so, load it.
	 */
	private function load_meta_boxes() {

		$is_editor      = WPSEO_Metabox::is_post_overview( $this->pagenow ) || WPSEO_Metabox::is_post_edit( $this->pagenow );
		$is_inline_save = filter_input( INPUT_POST, 'action' ) === 'inline-save';

		/**
		 * Filter: 'wpseo_always_register_metaboxes_on_admin' - Allow developers to change whether
		 * the WPSEO metaboxes are only registered on the typical pages (lean loading) or always
		 * registered when in admin.
		 *
		 * @api bool Whether to always register the metaboxes or not. Defaults to false.
		 */
		if ( $is_editor || $is_inline_save || apply_filters( 'wpseo_always_register_metaboxes_on_admin', false )
		) {
			$GLOBALS['wpseo_metabox']      = new WPSEO_Metabox();
			$GLOBALS['wpseo_meta_columns'] = new WPSEO_Meta_Columns();
		}
	}

	/**
	 * Determine if we should load our taxonomy edit class and if so, load it.
	 */
	private function load_taxonomy_class() {
		if (
			WPSEO_Taxonomy::is_term_edit( $this->pagenow )
			|| WPSEO_Taxonomy::is_term_overview( $this->pagenow )
		) {
			new WPSEO_Taxonomy();
		}
	}

	/**
	 * Determine if we should load our admin pages class and if so, load it.
	 *
	 * Loads admin page class for all admin pages starting with `wpseo_`.
	 */
	private function load_admin_user_class() {
		if ( in_array( $this->pagenow, array( 'user-edit.php', 'profile.php' ), true )
			&& current_user_can( 'edit_users' )
		) {
			new WPSEO_Admin_User_Profile();
		}
	}

	/**
	 * Determine if we should load our admin pages class and if so, load it.
	 *
	 * Loads admin page class for all admin pages starting with `wpseo_`.
	 */
	private function load_admin_page_class() {

		if ( $this->on_wpseo_admin_page() ) {
			// For backwards compatabilty, this still needs a global, for now...
			$GLOBALS['wpseo_admin_pages'] = new WPSEO_Admin_Pages();

			// Only register the yoast i18n when the page is a Yoast SEO page.
			if ( WPSEO_Utils::is_yoast_seo_free_page( filter_input( INPUT_GET, 'page' ) ) ) {
				$this->register_i18n_promo_class();
				$this->register_premium_upsell_admin_block();
			}
		}
	}

	/**
	 * Loads the plugin suggestions.
	 */
	private function load_plugin_suggestions() {
		$suggestions = new WPSEO_Suggested_Plugins( new WPSEO_Plugin_Availability(), Yoast_Notification_Center::get() );
		$suggestions->register_hooks();
	}

	/**
	 * Registers the Premium Upsell Admin Block.
	 *
	 * @return void
	 */
	private function register_premium_upsell_admin_block() {
		if ( ! WPSEO_Utils::is_yoast_seo_premium() ) {
			$upsell_block = new WPSEO_Premium_Upsell_Admin_Block( 'wpseo_admin_promo_footer' );
			$upsell_block->register_hooks();
		}
	}

	/**
	 * Registers the promotion class for our GlotPress instance, then creates a notification with the i18n promo.
	 *
	 * @link https://github.com/Yoast/i18n-module
	 */
	private function register_i18n_promo_class() {
		// BC, because an older version of the i18n-module didn't have this class.
		$i18n_module = new Yoast_I18n_WordPressOrg_v3(
			array(
				'textdomain'  => 'wordpress-seo',
				'plugin_name' => 'Yoast SEO',
				'hook'        => 'wpseo_admin_promo_footer',
			),
			false
		);

		$message = $i18n_module->get_promo_message();

		if ( $message !== '' ) {
			$message .= $i18n_module->get_dismiss_i18n_message_button();
		}

		$notification_center = Yoast_Notification_Center::get();

		$notification = new Yoast_Notification(
			$message,
			array(
				'type' => Yoast_Notification::WARNING,
				'id'   => 'i18nModuleTranslationAssistance',
			)
		);

		if ( $message ) {
			$notification_center->add_notification( $notification );

			return;
		}

		$notification_center->remove_notification( $notification );
	}

	/**
	 * See if we should start our XML Sitemaps Admin class.
	 */
	private function load_xml_sitemaps_admin() {
		if ( WPSEO_Options::get( 'enable_xml_sitemap', false ) ) {
			new WPSEO_Sitemaps_Admin();
		}
	}

	/**
	 * Check if the site is set to be publicly visible.
	 *
	 * @return bool
	 */
	private function is_blog_public() {
		return '1' === (string) get_option( 'blog_public' );
	}

	/**
	 * Shows deprecation warnings to the user if a plugin has registered a filter we have deprecated.
	 */
	public function show_hook_deprecation_warnings() {
		global $wp_filter;

		if ( wp_doing_ajax() ) {
			return;
		}

		// WordPress hooks that have been deprecated since a Yoast SEO version.
		$deprecated_filters = array(
			'wpseo_metakey' => array(
				'version'     => '6.3',
				'alternative' => null,
			),
			'wpseo_metakeywords' => array(
				'version'     => '6.3',
				'alternative' => null,
			),
			'wpseo_stopwords' => array(
				'version'     => '7.0',
				'alternative' => null,
			),
			'wpseo_redirect_orphan_attachment' => array(
				'version'     => '7.0',
				'alternative' => null,
			),
			'wpseo_genesis_force_adjacent_rel_home' => array(
				'version'     => '9.4',
				'alternative' => null,
			),
		);

		// Determine which filters have been registered.
		$deprecated_notices = array_intersect(
			array_keys( $deprecated_filters ),
			array_keys( $wp_filter )
		);

		// Show notice for each deprecated filter or action that has been registered.
		foreach ( $deprecated_notices as $deprecated_filter ) {
			$deprecation_info = $deprecated_filters[ $deprecated_filter ];
			_deprecated_hook(
				$deprecated_filter,
				'WPSEO ' . $deprecation_info['version'],
				$deprecation_info['alternative']
			);
		}
	}

	/**
	 * Check if the permalink uses %postname%.
	 *
	 * @return bool
	 */
	private function has_postname_in_permalink() {
		return ( false !== strpos( get_option( 'permalink_structure' ), '%postname%' ) );
	}

	/**
	 * Shows a notice on the permalink settings page.
	 */
	public function permalink_settings_notice() {
		global $pagenow;

		if ( $pagenow === 'options-permalink.php' ) {
			$warning = esc_html__( 'WARNING:', 'wordpress-seo' );
			/* translators: %1$s and %2$s expand to <i> items to emphasize the word in the middle. */
			$message = esc_html__( 'Changing your permalinks settings can seriously impact your search engine visibility. It should almost %1$s never %2$s be done on a live website.', 'wordpress-seo' );
			$link    = esc_html__( 'Learn about why permalinks are important for SEO.', 'wordpress-seo' );
			$url     = WPSEO_Shortlinker::get( 'https://yoa.st/why-permalinks/' );

			echo '<div class="notice notice-warning"><p><strong>' . $warning . '</strong><br>' . sprintf( $message, '<i>', '</i>' ) . '<br><a href="' . $url . '" target="_blank">' . $link . '</a></p></div>';
		}
	}
}
PK     ”T]‰pü½e  e  +  statistics/class-statistics-integration.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Statistics
 */

/**
 * Class WPSEO_Statistic_Integration.
 */
class WPSEO_Statistic_Integration implements WPSEO_WordPress_Integration {

	/**
	 * Adds hooks to clear the cache.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_action( 'wp_insert_post', array( $this, 'clear_cache' ) );
		add_action( 'delete_post', array( $this, 'clear_cache' ) );
	}

	/**
	 * Clears the dashboard widget items cache.
	 *
	 * @return void
	 */
	public function clear_cache() {
		delete_transient( WPSEO_Statistics_Service::CACHE_TRANSIENT_KEY );
	}
}
PK     ”T] :+$û  û  '  statistics/class-statistics-service.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Statistics
 */

/**
 * Class WPSEO_Statistics_Service.
 */
class WPSEO_Statistics_Service {

	/**
	 * @var string
	 */
	const CACHE_TRANSIENT_KEY = 'wpseo-statistics-totals';

	/**
	 * @var WPSEO_Statistics
	 */
	protected $statistics;

	/**
	 * @var string[]
	 */
	protected $labels;

	/**
	 * WPSEO_Statistics_Service contructor.
	 *
	 * @param WPSEO_Statistics $statistics The statistics class to retrieve statistics from.
	 */
	public function __construct( WPSEO_Statistics $statistics ) {
		$this->statistics = $statistics;
	}

	/**
	 * Fetches statistics by REST request.
	 *
	 * @return WP_REST_Response The response object.
	 */
	public function get_statistics() {
		// Switch to the user locale with fallback to the site locale.
		switch_to_locale( WPSEO_Language_Utils::get_user_locale() );

		$this->labels = $this->labels();
		$statistics   = $this->statistic_items();

		$data = array(
			'header'     => $this->get_header_from_statistics( $statistics ),
			'seo_scores' => $statistics['scores'],
		);

		return new WP_REST_Response( $data );
	}

	/**
	 * Gets a header summarizing the given statistics results.
	 *
	 * @param array $statistics The statistics results.
	 *
	 * @return string The header summing up the statistics results.
	 */
	private function get_header_from_statistics( array $statistics ) {
		// Personal interpretation to allow release, should be looked at later.
		if ( $statistics['division'] === false ) {
			return __( 'You don\'t have any published posts, your SEO scores will appear here once you make your first post!', 'wordpress-seo' );
		}

		if ( $statistics['division']['good'] > 0.66 ) {
			return __( 'Hey, your SEO is doing pretty well! Check out the stats:', 'wordpress-seo' );
		}

		return __( 'Below are your published posts\' SEO scores. Now is as good a time as any to start improving some of your posts!', 'wordpress-seo' );
	}

	/**
	 * An array representing items to be added to the At a Glance dashboard widget.
	 *
	 * @return array The statistics for the current user.
	 */
	private function statistic_items() {
		$transient = $this->get_transient();
		$user_id   = get_current_user_id();

		if ( isset( $transient[ $user_id ] ) ) {
			return $transient[ $user_id ];
		}

		return $this->set_statistic_items_for_user( $transient, $user_id );
	}

	/**
	 * Gets the statistics transient value. Returns array if transient wasn't set.
	 *
	 * @return array|mixed Returns the transient or an empty array if the transient doesn't exist.
	 */
	private function get_transient() {
		$transient = get_transient( self::CACHE_TRANSIENT_KEY );

		if ( $transient === false ) {
			return array();
		}

		return $transient;
	}

	/**
	 * Set the statistics transient cache for a specific user.
	 *
	 * @param array $transient The current stored transient with the cached data.
	 * @param int   $user      The user's ID to assign the retrieved values to.
	 *
	 * @return array The statistics transient for the user.
	 */
	private function set_statistic_items_for_user( $transient, $user ) {
		$scores   = $this->get_seo_scores_with_post_count();
		$division = $this->get_seo_score_division( $scores );

		$transient[ $user ] = array(
			// Use array_values because array_filter may return non-zero indexed arrays.
			'scores'   => array_values( array_filter( $scores, array( $this, 'filter_items' ) ) ),
			'division' => $division,
		);

		set_transient( self::CACHE_TRANSIENT_KEY, $transient, DAY_IN_SECONDS );

		return $transient[ $user ];
	}

	/**
	 * Gets the division of SEO scores.
	 *
	 * @param array $scores The SEO scores.
	 *
	 * @return array|bool The division of SEO scores, false if there are no posts.
	 */
	private function get_seo_score_division( array $scores ) {
		$total    = 0;
		$division = array();

		foreach ( $scores as $score ) {
			$total += $score['count'];
		}

		if ( $total === 0 ) {
			return false;
		}

		foreach ( $scores as $score ) {
			$division[ $score['seo_rank'] ] = ( $score['count'] / $total );
		}

		return $division;
	}

	/**
	 * Get all SEO ranks and data associated with them.
	 *
	 * @return array An array of SEO scores and associated data.
	 */
	private function get_seo_scores_with_post_count() {
		$ranks = WPSEO_Rank::get_all_ranks();

		return array_map( array( $this, 'map_rank_to_widget' ), $ranks );
	}

	/**
	 * Converts a rank to data usable in the dashboard widget.
	 *
	 * @param WPSEO_Rank $rank The rank to map.
	 *
	 * @return array The mapped rank.
	 */
	private function map_rank_to_widget( WPSEO_Rank $rank ) {
		return array(
			'seo_rank' => $rank->get_rank(),
			'label'    => $this->get_label_for_rank( $rank ),
			'count'    => $this->statistics->get_post_count( $rank ),
			'link'     => $this->get_link_for_rank( $rank ),
		);
	}

	/**
	 * Returns a dashboard widget label to use for a certain rank.
	 *
	 * @param WPSEO_Rank $rank The rank to return a label for.
	 *
	 * @return string The label for the rank.
	 */
	private function get_label_for_rank( WPSEO_Rank $rank ) {
		return $this->labels[ $rank->get_rank() ];
	}

	/**
	 * Determines the labels for the various scoring ranks that are known within Yoast SEO.
	 *
	 * @return array Array containing the translatable labels.
	 */
	private function labels() {
		return array(
			WPSEO_Rank::NO_FOCUS => sprintf(
				/* translators: %1$s expands to an opening strong tag, %2$s expands to a closing strong tag */
				__( 'Posts %1$swithout%2$s a focus keyphrase', 'wordpress-seo' ),
				'<strong>',
				'</strong>'
			),
			WPSEO_Rank::BAD      => sprintf(
				/* translators: %s expands to the score */
				__( 'Posts with the SEO score: %s', 'wordpress-seo' ),
				'<strong>' . __( 'Needs improvement', 'wordpress-seo' ) . '</strong>'
			),
			WPSEO_Rank::OK       => sprintf(
				/* translators: %s expands to the score */
				__( 'Posts with the SEO score: %s', 'wordpress-seo' ),
				'<strong>' . __( 'OK', 'wordpress-seo' ) . '</strong>'
			),
			WPSEO_Rank::GOOD     => sprintf(
				/* translators: %s expands to the score */
				__( 'Posts with the SEO score: %s', 'wordpress-seo' ),
				'<strong>' . __( 'Good', 'wordpress-seo' ) . '</strong>'
			),
			WPSEO_Rank::NO_INDEX => __( 'Posts that should not show up in search results', 'wordpress-seo' ),
		);
	}

	/**
	 * Filter items if they have a count of zero.
	 *
	 * @param array $item The item to potentially filter out.
	 *
	 * @return bool Whether or not the count is zero.
	 */
	private function filter_items( $item ) {
		return $item['count'] !== 0;
	}

	/**
	 * Returns a link for the overview of posts of a certain rank.
	 *
	 * @param WPSEO_Rank $rank The rank to return a link for.
	 *
	 * @return string The link that shows an overview of posts with that rank.
	 */
	private function get_link_for_rank( WPSEO_Rank $rank ) {
		if ( current_user_can( 'edit_others_posts' ) === false ) {
			return esc_url( admin_url( 'edit.php?post_status=publish&post_type=post&seo_filter=' . $rank->get_rank() . '&author=' . get_current_user_id() ) );
		}

		return esc_url( admin_url( 'edit.php?post_status=publish&post_type=post&seo_filter=' . $rank->get_rank() ) );
	}
}
PK     ”T]�SÊ‰í   í     statistics/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]�SÊ‰í   í     notifiers/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]æ6Gæ,  ,  *  notifiers/class-configuration-notifier.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Notifiers
 */

/**
 * Represents the logic for showing the notification.
 */
class WPSEO_Configuration_Notifier implements WPSEO_Listener {

	/**
	 * @var string
	 */
	const META_NAME = 'wpseo-dismiss-configuration-notice';

	/**
	 * @var string
	 */
	const META_VALUE = 'yes';

	/**
	 * @var bool
	 */
	protected $show_notification;

	/**
	 * Constructs the object by setting the show notification property based the given options.
	 */
	public function __construct() {
		$this->show_notification = WPSEO_Options::get( 'show_onboarding_notice', false );
	}

	/**
	 * Returns the content of the notification.
	 *
	 * @return string A string with the notification HTML, or empty string when no notification is needed.
	 */
	public function notify() {
		if ( ! $this->show_notification() ) {
			return $this->re_run_notification();
		}

		return $this->first_time_notification();
	}

	/**
	 * Listens to an argument in the request URL. When triggered just set the notification to dismissed.
	 *
	 * @return void
	 */
	public function listen() {
		if ( ! $this->show_notification() || ! $this->dismissal_is_triggered() ) {
			return;
		}

		$this->set_dismissed();
	}

	/**
	 * Checks if the dismissal should be triggered.
	 *
	 * @return bool True when action has been triggered.
	 */
	protected function dismissal_is_triggered() {
		return filter_input( INPUT_GET, 'dismiss_get_started' ) === '1';
	}

	/**
	 * Checks if the current user has dismissed the notification.
	 *
	 * @return bool True when the notification has been dismissed.
	 */
	protected function is_dismissed() {
		return get_user_meta( get_current_user_id(), self::META_NAME, true ) === self::META_VALUE;
	}

	/**
	 * Sets the dismissed state for the current user.
	 *
	 * @return void
	 */
	protected function set_dismissed() {
		update_user_meta( get_current_user_id(), self::META_NAME, self::META_VALUE );
	}

	/**
	 * Checks if the notification should be shown.
	 *
	 * @return bool True when notification should be shown.
	 */
	protected function show_notification() {
		return $this->show_notification && ! $this->is_dismissed();
	}

	/**
	 * Returns the notification to re-run the config wizard.
	 *
	 * @return string The notification.
	 */
	private function re_run_notification() {
		$content = sprintf(
			/* translators: %1$s expands to Yoast SEO, %2$s is a link start tag to the Onboarding Wizard, %3$s is the link closing tag. */
			esc_html__( 'Want to make sure your %1$s settings are still OK? %2$sOpen the configuration wizard again%3$s to validate them.', 'wordpress-seo' ),
			'Yoast SEO',
			'<a href="' . esc_url( admin_url( 'admin.php?page=' . WPSEO_Configuration_Page::PAGE_IDENTIFIER ) ) . '">',
			'</a>'
		);

		return $this->notification( __( 'Check SEO configuration', 'wordpress-seo' ), $content );
	}

	/**
	 * Returns the notification to start the config wizard for the first time.
	 *
	 * @return string The notification.
	 */
	private function first_time_notification() {
		$content = sprintf(
			/* translators: %1$s expands to Yoast SEO, %2$s is a link start tag to the Onboarding Wizard, %3$s is the link closing tag. */
			esc_html__( 'Get started quickly with the %1$s %2$sconfiguration wizard%3$s!', 'wordpress-seo' ),
			'Yoast SEO',
			'<a href="' . esc_url( admin_url( 'admin.php?page=' . WPSEO_Configuration_Page::PAGE_IDENTIFIER ) ) . '">',
			'</a>'
		);

		return $this->notification( __( 'First-time SEO configuration', 'wordpress-seo' ), $content, true );
	}

	/**
	 * Returns a styled notification.
	 *
	 * @param string $title          Title for the notification.
	 * @param string $content        Content for the notification.
	 * @param bool   $show_dismissal Whether to show the dismiss button or not.
	 *
	 * @return string The styled notification.
	 */
	private function notification( $title, $content, $show_dismissal = false ) {
		$notification  = '<div class="yoast-container yoast-container__configuration-wizard">';
		$notification .= sprintf(
			'<img src="%1$s" height="%2$s" width="%3$d" />',
			esc_url( plugin_dir_url( WPSEO_FILE ) . 'images/new-to-configuration-notice.svg' ),
			60,
			60
		);
		$notification .= '<div class="yoast-container__configuration-wizard--content">';
		$notification .= '<h3>' . esc_html( $title ) . '</h3>';

		$notification .= '<p>';
		$notification .= $content;
		$notification .= '</p>';

		$notification .= '</div>';
		if ( $show_dismissal ) {
			$notification .= sprintf(
				'<a href="%1$s" style="" class="button dismiss yoast-container__configuration-wizard--dismiss"><span class="screen-reader-text">%2$s</span><span class="dashicons dashicons-no-alt"></span></a>',
				esc_url( admin_url( 'admin.php?page=wpseo_dashboard&amp;dismiss_get_started=1' ) ),
				esc_html__( 'Dismiss this item.', 'wordpress-seo' )
			);
		}
		$notification .= '</div>';

		return $notification;
	}
}
PK     ”T]LK¸ˆ  ˆ  :  notifiers/class-post-type-archive-notification-handler.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Notifiers
 */

/**
 * Represents the logic for showing the post type archive notification.
 */
class WPSEO_Post_Type_Archive_Notification_Handler extends WPSEO_Dismissible_Notification {

	/**
	 * Defaults for the title option.
	 *
	 * @var array
	 */
	protected $option_defaults = array();

	/**
	 * Sets the notification identifier.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function __construct() {
		$this->notification_identifier = 'post-type-archive-notification';
	}

	/**
	 * Checks if the notice should be shown.
	 *
	 * @return bool True when applicable.
	 */
	protected function is_applicable() {
		if ( $this->is_notice_dismissed() ) {
			return false;
		}

		if ( $this->is_new_install() ) {
			return false;
		}

		return $this->get_post_types() !== array();
	}

	/**
	 * Returns the notification.
	 *
	 * @return Yoast_Notification The notification for the notification center.
	 *
	 * @codeCoverageIgnore
	 */
	protected function get_notification() {
		$post_types = $this->get_post_types();

		$message  = esc_html__(
			'We\'ve recently improved the functionality of the Search Appearance settings. Unfortunately, we\'ve discovered that for some edge-cases, saving the settings for specific post type archives might have gone wrong.',
			'wordpress-seo'
		);
		$message .= PHP_EOL . PHP_EOL;
		$message .= sprintf(
			/* translators: %1$s is the archive template link start tag, %2$s is the link closing tag, %3$s is a comma separated string with content types. */
			_n(
				'Please check the %1$sarchive template%2$s for the following content type: %3$s.',
				'Please check the %1$sarchive templates%2$s for the following content types: %3$s.',
				count( $post_types ),
				'wordpress-seo'
			),
			'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_titles#top#post-types' ) ) . '">',
			'</a>',
			implode( ', ', $post_types )
		);
		$message .= PHP_EOL . PHP_EOL;
		$message .= '<a class="button" href="' . admin_url( '?page=' . WPSEO_Admin::PAGE_IDENTIFIER . '&yoast_dismiss=' . $this->notification_identifier ) . '">' . __( 'Remove this message', 'wordpress-seo' ) . '</a>';

		$notification_options = array(
			'type'         => Yoast_Notification::WARNING,
			'id'           => 'wpseo-' . $this->notification_identifier,
			'priority'     => 1.0,
			'capabilities' => 'wpseo_manage_options',
		);

		return new Yoast_Notification( $message, $notification_options );
	}

	/**
	 * Checks if the first activation is done before the release of 7.9.
	 *
	 * @return bool True when the install is 'new'.
	 *
	 * @codeCoverageIgnore
	 */
	protected function is_new_install() {
		return WPSEO_Options::get( 'first_activated_on' ) >= strtotime( '2018-07-24' );
	}

	/**
	 * Returns all the post types which might have wrong archive settings.
	 *
	 * @return array The post types.
	 *
	 * @codeCoverageIgnore
	 */
	protected function get_post_types() {
		static $post_types;

		if ( $post_types === null ) {
			$this->option_defaults = WPSEO_Option_Titles::get_instance()->get_defaults();

			$post_types = get_post_types( array( 'public' => true ) );
			$post_types = WPSEO_Post_Type::filter_attachment_post_type( $post_types );
			$post_types = $this->filter_woocommerce_product_type( $post_types );
			$post_types = array_filter( $post_types, array( $this, 'has_custom_archive_slug' ) );
			$post_types = array_filter( $post_types, array( $this, 'has_default_templates_set' ) );
		}

		return $post_types;
	}

	/**
	 * Filters the WooCommerce product, when Woocommerce is active.
	 *
	 * @param array $post_types The post types to filter.
	 *
	 * @return array The filtere post types.
	 *
	 * @codeCoverageIgnore
	 */
	protected function filter_woocommerce_product_type( $post_types ) {
		if ( WPSEO_Utils::is_woocommerce_active() ) {
			unset( $post_types['product'] );
		}

		return $post_types;
	}

	/**
	 * Checks if the archive slug for the post type is overridden.
	 *
	 * @param string $post_type_name The post type's name.
	 *
	 * @return bool True when the archive slug is overridden.
	 *
	 * @codeCoverageIgnore
	 */
	protected function has_custom_archive_slug( $post_type_name ) {
		$post_type = get_post_type_object( $post_type_name );
		if ( $post_type === null || ! WPSEO_Post_Type::has_archive( $post_type ) ) {
			return false;
		}

		// When the archive value is not TRUE it will be a custom archive slug.
		return ( $post_type->has_archive !== true );
	}

	/**
	 * Checks if the default templates are set for given post type.
	 *
	 * @param string $post_type_name The post type name.
	 *
	 * @return bool True when the default templates are set.
	 *
	 * @codeCoverageIgnore
	 */
	protected function has_default_templates_set( $post_type_name ) {
		$title_option_name    = 'title-ptarchive-' . $post_type_name;
		$metadesc_option_name = 'metadesc-ptarchive-' . $post_type_name;

		return ( $this->is_equal_to_default( $title_option_name ) && $this->is_equal_to_default( $metadesc_option_name ) );
	}

	/**
	 * Checks if value for given option name is equal to the default value.
	 *
	 * @param string $option_name The option name to check.
	 *
	 * @return bool True when the option value is equal to the default value.
	 *
	 * @codeCoverageIgnore
	 */
	protected function is_equal_to_default( $option_name ) {
		if ( ! isset( $this->option_defaults[ $option_name ] ) ) {
			return false;
		}

		return ( WPSEO_Options::get( $option_name ) === $this->option_defaults[ $option_name ] );
	}
}
PK     ”T]�öµ  µ  ,  notifiers/interface-notification-handler.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Notifiers
 */

/**
 * Dictates the required methods for a Notification Handler implementation.
 */
interface WPSEO_Notification_Handler {

	/**
	 * Handles the notification object.
	 *
	 * @param Yoast_Notification_Center $notification_center The notification center object.
	 *
	 * @return void
	 */
	public function handle( Yoast_Notification_Center $notification_center );
}
PK     ”T]ûÙ ‘
  ‘
  &  notifiers/dismissible-notification.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Notifiers
 */

/**
 * Abstract class representing a dismissible notification.
 */
abstract class WPSEO_Dismissible_Notification implements WPSEO_Listener, WPSEO_Notification_Handler {

	/**
	 * The identifier for the notification.
	 *
	 * @var string
	 */
	protected $notification_identifier = '';

	/**
	 * Retrieves instance of a notification.
	 *
	 * @return Yoast_Notification The notification.
	 */
	abstract protected function get_notification();

	/**
	 * Listens to an argument in the request URL and triggers an action.
	 *
	 * @return void
	 */
	public function listen() {
		if ( $this->get_listener_value() !== $this->notification_identifier ) {
			return;
		}

		$this->dismiss();
	}

	/**
	 * Adds the notification if applicable, otherwise removes it.
	 *
	 * @param Yoast_Notification_Center $notification_center The notification center object.
	 *
	 * @return void
	 */
	public function handle( Yoast_Notification_Center $notification_center ) {
		if ( $this->is_applicable() ) {
			$notification = $this->get_notification();
			$notification_center->add_notification( $notification );

			return;
		}

		$notification_center->remove_notification_by_id( 'wpseo-' . $this->notification_identifier );
	}

	/**
	 * Listens to an argument in the request URL and triggers an action.
	 *
	 * @return void
	 */
	protected function dismiss() {
		$this->set_dismissal_state();
		$this->redirect_to_dashboard();
	}

	/**
	 * Checks if a notice is applicable.
	 *
	 * @return bool Whether a notice should be shown or not.
	 */
	protected function is_applicable() {
		return $this->is_notice_dismissed() === false;
	}

	/**
	 * Checks whether the notification has been dismissed.
	 *
	 * @return bool True when notification is dismissed.
	 *
	 * @codeCoverageIgnore
	 */
	protected function is_notice_dismissed() {
		return get_user_meta( get_current_user_id(), 'wpseo-remove-' . $this->notification_identifier, true ) === '1';
	}

	/**
	 * Retrieves the value where listener is listening for.
	 *
	 * @return string The listener value.
	 *
	 * @codeCoverageIgnore
	 */
	protected function get_listener_value() {
		return filter_input( INPUT_GET, 'yoast_dismiss' );
	}

	/**
	 * Dismisses the notification.
	 *
	 * @return void
	 *
	 * @codeCoverageIgnore
	 */
	protected function set_dismissal_state() {
		update_user_meta( get_current_user_id(), 'wpseo-remove-' . $this->notification_identifier, true );
	}

	/**
	 * Redirects the user back to the dashboard.
	 *
	 * @return void
	 *
	 * @codeCoverageIgnore
	 */
	protected function redirect_to_dashboard() {
		wp_safe_redirect( admin_url( 'admin.php?page=wpseo_dashboard' ) );
		exit;
	}
}
PK     ”T]ÖÑtÈ”  ”  &  config-ui/class-configuration-page.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * @class WPSEO_Configuration_Wizard Loads the Yoast configuration wizard.
 */
class WPSEO_Configuration_Page {

	/**
	 * @var string
	 */
	const PAGE_IDENTIFIER = 'wpseo_configurator';

	/**
	 * Sets the hooks when the user has enough rights and is on the right page.
	 */
	public function set_hooks() {
		if ( ! ( $this->is_config_page() && current_user_can( WPSEO_Configuration_Endpoint::CAPABILITY_RETRIEVE ) ) ) {
			return;
		}

		if ( $this->should_add_notification() ) {
			$this->add_notification();
		}

		// Register the page for the wizard.
		add_action( 'admin_menu', array( $this, 'add_wizard_page' ) );
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
		add_action( 'admin_init', array( $this, 'render_wizard_page' ) );
	}

	/**
	 * Check if the configuration is finished. If so, just remove the notification.
	 */
	public function catch_configuration_request() {
		$configuration_page = filter_input( INPUT_GET, 'configuration' );
		$page               = filter_input( INPUT_GET, 'page' );

		if ( ! ( $configuration_page === 'finished' && ( $page === WPSEO_Admin::PAGE_IDENTIFIER ) ) ) {
			return;
		}

		$this->remove_notification();
		$this->remove_notification_option();

		wp_redirect( admin_url( 'admin.php?page=' . WPSEO_Admin::PAGE_IDENTIFIER ) );
		exit;
	}

	/**
	 *  Registers the page for the wizard.
	 */
	public function add_wizard_page() {
		add_dashboard_page( '', '', 'wpseo_manage_options', self::PAGE_IDENTIFIER, '' );
	}

	/**
	 * Renders the wizard page and exits to prevent the WordPress UI from loading.
	 */
	public function render_wizard_page() {
		$this->show_wizard();
		exit;
	}

	/**
	 * Enqueues the assets needed for the wizard.
	 */
	public function enqueue_assets() {
		wp_enqueue_media();

		if ( ! wp_script_is( 'wp-element', 'registered' ) && function_exists( 'gutenberg_register_scripts_and_styles' ) ) {
			gutenberg_register_scripts_and_styles();
		}

		/*
		 * Print the `forms.css` WP stylesheet before any Yoast style, this way
		 * it's easier to override selectors with the same specificity later.
		 */
		wp_enqueue_style( 'forms' );
		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->register_wp_assets();
		$asset_manager->register_assets();
		$asset_manager->enqueue_script( 'configuration-wizard' );
		$asset_manager->enqueue_style( 'yoast-components' );

		$config = $this->get_config();

		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'configuration-wizard', 'yoastWizardConfig', $config );

		$yoast_components_l10n = new WPSEO_Admin_Asset_Yoast_Components_L10n();
		$yoast_components_l10n->localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'configuration-wizard' );
	}

	/**
	 * Setup Wizard Header.
	 */
	public function show_wizard() {
		$this->enqueue_assets();
		$dashboard_url = admin_url( '/admin.php?page=wpseo_dashboard' );
		$wizard_title  = sprintf(
			/* translators: %s expands to Yoast SEO. */
			__( '%s &rsaquo; Configuration Wizard', 'wordpress-seo' ),
			'Yoast SEO'
		);
		?>
		<!DOCTYPE html>
		<!--[if IE 9]>
		<html class="ie9" <?php language_attributes(); ?> >
		<![endif]-->
		<!--[if !(IE 9) ]><!-->
		<html <?php language_attributes(); ?>>
		<!--<![endif]-->
		<head>
			<meta name="viewport" content="width=device-width, initial-scale=1"/>
			<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
			<title><?php echo esc_html( $wizard_title ); ?></title>
			<?php
			wp_print_head_scripts();
			wp_print_styles( 'yoast-seo-yoast-components' );

			/**
			 * Is called before the closing </head> tag in the Yoast Configuration wizard.
			 *
			 * Allows users to add their own scripts or styles.
			 *
			 * @since 4.0
			 */
			do_action( 'wpseo_configuration_wizard_head' );
			?>
		</head>
		<body class="wp-admin wp-core-ui">
		<div id="wizard"></div>
		<div role="contentinfo" class="yoast-wizard-return-link-container">
			<a class="button yoast-wizard-return-link" href="<?php echo esc_url( $dashboard_url ); ?>">
				<span aria-hidden="true" class="dashicons dashicons-no"></span>
				<?php
				esc_html_e( 'Close the Wizard', 'wordpress-seo' );
				?>
			</a>
		</div>
		<?php
			wp_print_media_templates();
			wp_print_footer_scripts();

			/**
			 * Is called before the closing </body> tag in the Yoast Configuration wizard.
			 *
			 * Allows users to add their own scripts.
			 *
			 * @since 4.0
			 */
			do_action( 'wpseo_configuration_wizard_footer' );

			wp_print_scripts( 'yoast-seo-configuration-wizard' );
		?>
		</body>
		</html>
		<?php
	}

	/**
	 * Get the API config for the wizard.
	 *
	 * @return array The API endpoint config.
	 */
	public function get_config() {
		$service = new WPSEO_GSC_Service();
		$config  = array(
			'namespace'         => WPSEO_Configuration_Endpoint::REST_NAMESPACE,
			'endpoint_retrieve' => WPSEO_Configuration_Endpoint::ENDPOINT_RETRIEVE,
			'endpoint_store'    => WPSEO_Configuration_Endpoint::ENDPOINT_STORE,
			'nonce'             => wp_create_nonce( 'wp_rest' ),
			'root'              => esc_url_raw( rest_url() ),
			'ajaxurl'           => admin_url( 'admin-ajax.php' ),
			'finishUrl'         => admin_url( 'admin.php?page=wpseo_dashboard&configuration=finished' ),
			'gscAuthURL'        => $service->get_client()->createAuthUrl(),
			'gscProfiles'       => $service->get_sites(),
			'gscNonce'          => wp_create_nonce( 'wpseo-gsc-ajax-security' ),
		);

		return $config;
	}

	/**
	 * Checks if the current page is the configuration page.
	 *
	 * @return bool
	 */
	protected function is_config_page() {
		return ( filter_input( INPUT_GET, 'page' ) === self::PAGE_IDENTIFIER );
	}

	/**
	 * Adds a notification to the notification center.
	 */
	private function add_notification() {
		$notification_center = Yoast_Notification_Center::get();
		$notification_center->add_notification( self::get_notification() );
	}

	/**
	 * Removes the notification from the notification center.
	 */
	private function remove_notification() {
		$notification_center = Yoast_Notification_Center::get();
		$notification_center->remove_notification( self::get_notification() );
	}

	/**
	 * Gets the notification.
	 *
	 * @return Yoast_Notification
	 */
	private static function get_notification() {
		$message  = __( 'The configuration wizard helps you to easily configure your site to have the optimal SEO settings.', 'wordpress-seo' );
		$message .= '<br/>';
		$message .= sprintf(
			/* translators: %1$s resolves to Yoast SEO, %2$s resolves to the starting tag of the link to the wizard, %3$s resolves to the closing link tag */
			__( 'We have detected that you have not finished this wizard yet, so we recommend you to %2$sstart the configuration wizard to configure %1$s%3$s.', 'wordpress-seo' ),
			'Yoast SEO',
			'<a href="' . admin_url( '?page=' . self::PAGE_IDENTIFIER ) . '">',
			'</a>'
		);

		$notification = new Yoast_Notification(
			$message,
			array(
				'type'         => Yoast_Notification::WARNING,
				'id'           => 'wpseo-dismiss-onboarding-notice',
				'capabilities' => 'wpseo_manage_options',
				'priority'     => 0.8,
			)
		);

		return $notification;
	}

	/**
	 * When the notice should be shown.
	 *
	 * @return bool
	 */
	private function should_add_notification() {
		return ( WPSEO_Options::get( 'show_onboarding_notice' ) === true );
	}

	/**
	 * Remove the options that triggers the notice for the configuration wizard.
	 */
	private function remove_notification_option() {
		WPSEO_Options::set( 'show_onboarding_notice', false );
	}
}
PK     ”T]ÃúK~  ~  1  config-ui/class-configuration-options-adapter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Configuration_Options_Adapter.
 *
 * Convert Configuration settings to WPSEO Options.
 *
 * @since 3.6
 */
class WPSEO_Configuration_Options_Adapter {

	/**
	 * @var string
	 */
	const OPTION_TYPE_WORDPRESS = 'wordpress';

	/**
	 * @var string
	 */
	const OPTION_TYPE_YOAST = 'yoast';

	/**
	 * @var string
	 */
	const OPTION_TYPE_CUSTOM = 'custom';

	/**
	 * List of registered lookups.
	 *
	 * @var array
	 */
	protected $lookup = array();

	/**
	 * Add a lookup for a WordPress native option.
	 *
	 * @param string $class_name Class to bind to an option.
	 * @param string $option     Option name to use.
	 *
	 * @throws InvalidArgumentException Thrown when invalid input is provided.
	 */
	public function add_wordpress_lookup( $class_name, $option ) {

		if ( ! is_string( $option ) ) {
			throw new InvalidArgumentException( 'WordPress option must be a string.' );
		}

		$this->add_lookup( $class_name, self::OPTION_TYPE_WORDPRESS, $option );
	}

	/**
	 * Add a lookup for a Yoast option.
	 *
	 * @param string $class_name Class to bind to the lookup.
	 * @param string $key        Key in the option group to bind to.
	 *
	 * @throws InvalidArgumentException Thrown when invalid input is provided.
	 */
	public function add_option_lookup( $class_name, $key ) {

		$test = WPSEO_Options::get( $key );
		if ( is_null( $test ) ) {
			/* translators: %1$s resolves to the option name passed to the lookup registration */
			throw new InvalidArgumentException( sprintf( __( 'Yoast option %1$s not found.', 'wordpress-seo' ), $key ) );
		}

		$this->add_lookup( $class_name, self::OPTION_TYPE_YOAST, $key );
	}

	/**
	 * Add a lookup for a custom implementation.
	 *
	 * @param string   $class_name   Class to bind to the lookup.
	 * @param callable $callback_get Callback to retrieve data.
	 * @param callable $callback_set Callback to save data.
	 *
	 * @throws InvalidArgumentException Thrown when invalid input is provided.
	 */
	public function add_custom_lookup( $class_name, $callback_get, $callback_set ) {

		if ( ! is_callable( $callback_get ) || ! is_callable( $callback_set ) ) {
			throw new InvalidArgumentException( 'Custom option must be callable.' );
		}

		$this->add_lookup(
			$class_name,
			self::OPTION_TYPE_CUSTOM,
			array( $callback_get, $callback_set )
		);
	}

	/**
	 * Add a field lookup.
	 *
	 * @param string       $class_name Class to add lookup for.
	 * @param string       $type       Type of lookup.
	 * @param string|array $option     Implementation of the lookup.
	 *
	 * @throws Exception Thrown when invalid input is provided.
	 */
	protected function add_lookup( $class_name, $type, $option ) {
		$this->lookup[ $class_name ] = array(
			'type'   => $type,
			'option' => $option,
		);
	}

	/**
	 * Get the data for the provided field.
	 *
	 * @param WPSEO_Config_Field $field Field to get data for.
	 *
	 * @return mixed
	 */
	public function get( WPSEO_Config_Field $field ) {
		$identifier = $field->get_identifier();

		// Lookup option and retrieve value.
		$type   = $this->get_option_type( $identifier );
		$option = $this->get_option( $identifier );

		switch ( $type ) {
			case self::OPTION_TYPE_WORDPRESS:
				return get_option( $option );

			case self::OPTION_TYPE_YOAST:
				return WPSEO_Options::get( $option );

			case self::OPTION_TYPE_CUSTOM:
				return call_user_func( $option[0] );
		}

		return null;
	}

	/**
	 * Save data from a field.
	 *
	 * @param WPSEO_Config_Field $field Field to use for lookup.
	 * @param mixed              $value Value to save to the lookup of the field.
	 *
	 * @return bool
	 */
	public function set( WPSEO_Config_Field $field, $value ) {
		$identifier = $field->get_identifier();

		// Lookup option and retrieve value.
		$type   = $this->get_option_type( $identifier );
		$option = $this->get_option( $identifier );

		switch ( $type ) {
			case self::OPTION_TYPE_WORDPRESS:
				return update_option( $option, $value );

			case self::OPTION_TYPE_YOAST:
				return WPSEO_Options::set( $option, $value );

			case self::OPTION_TYPE_CUSTOM:
				return call_user_func( $option[1], $value );
		}

		return false;
	}

	/**
	 * Get the lookup type for a specific class.
	 *
	 * @param string $class_name Class to get the type of.
	 *
	 * @return null|string
	 */
	protected function get_option_type( $class_name ) {
		if ( ! isset( $this->lookup[ $class_name ] ) ) {
			return null;
		}

		return $this->lookup[ $class_name ]['type'];
	}

	/**
	 * Get the option for a specific class.
	 *
	 * @param string $class_name Class to get the option of.
	 *
	 * @return null|string|array
	 */
	protected function get_option( $class_name ) {
		if ( ! isset( $this->lookup[ $class_name ] ) ) {
			return null;
		}

		return $this->lookup[ $class_name ]['option'];
	}

	/* ********************* DEPRECATED METHODS ********************* */

	/**
	 * Add a lookup for a Yoast option.
	 *
	 * @deprecated 7.0
	 * @codeCoverageIgnore
	 *
	 * @param string $class_name Class to bind to the lookup.
	 * @param string $option     Option group to use.
	 * @param string $key        Key in the option group to bind to.
	 *
	 * @throws InvalidArgumentException Thrown when invalid input is provided.
	 */
	public function add_yoast_lookup( $class_name, $option, $key ) {
		_deprecated_function( __METHOD__, 'WPSEO 7.0', 'WPSEO_Configuration_Options_Adapter::add_option_lookup' );
		$this->add_option_lookup( $class_name, $key );
	}
}
PK     ”T]†Ø‡€  €  )  config-ui/class-configuration-service.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Configuration_Service.
 */
class WPSEO_Configuration_Service {

	/**
	 * @var WPSEO_Configuration_Structure
	 */
	protected $structure;

	/**
	 * @var WPSEO_Configuration_Components
	 */
	protected $components;

	/**
	 * @var WPSEO_Configuration_Storage
	 */
	protected $storage;

	/**
	 * @var WPSEO_Configuration_Endpoint
	 */
	protected $endpoint;

	/**
	 * @var WPSEO_Configuration_Options_Adapter
	 */
	protected $adapter;

	/**
	 * @var WPSEO_Configuration_Translations
	 */
	protected $translations;

	/**
	 * Hook into the REST API and switch language.
	 */
	public function initialize() {
		$this->set_default_providers();
		$this->endpoint->register();
	}

	/**
	 * Set default handlers.
	 */
	public function set_default_providers() {
		$this->set_storage( new WPSEO_Configuration_Storage() );
		$this->set_options_adapter( new WPSEO_Configuration_Options_Adapter() );
		$this->set_components( new WPSEO_Configuration_Components() );
		$this->set_endpoint( new WPSEO_Configuration_Endpoint() );
		$this->set_structure( new WPSEO_Configuration_Structure() );
		$this->set_translations( new WPSEO_Configuration_Translations( WPSEO_Language_Utils::get_user_locale() ) );
	}

	/**
	 * Set storage handler.
	 *
	 * @param WPSEO_Configuration_Storage $storage Storage handler to use.
	 */
	public function set_storage( WPSEO_Configuration_Storage $storage ) {
		$this->storage = $storage;
	}

	/**
	 * Set endpoint handler.
	 *
	 * @param WPSEO_Configuration_Endpoint $endpoint Endpoint implementation to use.
	 */
	public function set_endpoint( WPSEO_Configuration_Endpoint $endpoint ) {
		$this->endpoint = $endpoint;
		$this->endpoint->set_service( $this );
	}

	/**
	 * Set the options adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to use.
	 */
	public function set_options_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$this->adapter = $adapter;
	}

	/**
	 * Set components provider.
	 *
	 * @param WPSEO_Configuration_Components $components Component provider to use.
	 */
	public function set_components( WPSEO_Configuration_Components $components ) {
		$this->components = $components;
	}

	/**
	 * Set structure provider.
	 *
	 * @param WPSEO_Configuration_Structure $structure Structure provider to use.
	 */
	public function set_structure( WPSEO_Configuration_Structure $structure ) {
		$this->structure = $structure;
	}

	/**
	 * Sets the translations object.
	 *
	 * @param WPSEO_Configuration_Translations $translations The translations object.
	 */
	public function set_translations( WPSEO_Configuration_Translations $translations ) {
		$this->translations = $translations;
	}

	/**
	 * Populate the configuration.
	 */
	protected function populate_configuration() {
		// Switch to the user locale with fallback to the site locale.
		switch_to_locale( WPSEO_Language_Utils::get_user_locale() );

		// Make sure we have our translations available.
		wpseo_load_textdomain();

		$this->structure->initialize();

		$this->storage->set_adapter( $this->adapter );
		$this->storage->add_default_fields();

		$this->components->initialize();
		$this->components->set_storage( $this->storage );

		// @todo: check if this is really needed, since the switch happens only in the API.
		if ( function_exists( 'restore_current_locale' ) ) {
			restore_current_locale();
		}
	}

	/**
	 * Used by endpoint to retrieve configuration.
	 *
	 * @return array List of settings.
	 */
	public function get_configuration() {
		$this->populate_configuration();
		$fields       = $this->storage->retrieve();
		$steps        = $this->structure->retrieve();
		$translations = $this->translations->retrieve();

		return array(
			'fields'       => $fields,
			'steps'        => $steps,
			'translations' => $translations,
		);
	}

	/**
	 * Used by endpoint to store changes.
	 *
	 * @param WP_REST_Request $request Request from the REST API.
	 *
	 * @return array List of feedback per option if saving succeeded.
	 */
	public function set_configuration( WP_REST_Request $request ) {
		$this->populate_configuration();

		return $this->storage->store( $request->get_json_params() );
	}
}
PK     ”T],rm    9  config-ui/components/class-component-mailchimp-signup.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Represents the mailchimp signup components.
 */
class WPSEO_Config_Component_Mailchimp_Signup implements WPSEO_Config_Component {

	/**
	 * @var string
	 */
	const META_NAME = 'wpseo-has-mailchimp-signup';

	/**
	 * Gets the component identifier.
	 *
	 * @return string
	 */
	public function get_identifier() {
		return 'MailchimpSignup';
	}

	/**
	 * Gets the field.
	 *
	 * @return WPSEO_Config_Field
	 */
	public function get_field() {
		return new WPSEO_Config_Field_Mailchimp_Signup();
	}

	/**
	 * Get the data for the field.
	 *
	 * @return mixed
	 */
	public function get_data() {
		$data = array(
			'hasSignup' => $this->has_mailchimp_signup(),
		);

		return $data;
	}

	/**
	 * Save data.
	 *
	 * @param array $data Data containing changes.
	 *
	 * @return mixed
	 */
	public function set_data( $data ) {

		$has_saved = false;
		if ( ! empty( $data['hasSignup'] ) ) {
			// Saves the user meta.
			update_user_meta( get_current_user_id(), self::META_NAME, true );

			$has_saved = ( $data['hasSignup'] === $this->has_mailchimp_signup() );
		}

		// Collect results to return to the configurator.
		$results = array(
			'hasSignup' => $has_saved,
		);

		return $results;
	}

	/**
	 * Checks if the user has entered their email for mailchimp already.
	 *
	 * @return bool
	 */
	protected function has_mailchimp_signup() {
		$user_meta = get_user_meta( get_current_user_id(), self::META_NAME, true );

		return ( ! empty( $user_meta ) );
	}
}
PK     ”T]­±‹=2  2  4  config-ui/components/class-component-suggestions.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Represents the configuration suggestions component.
 */
class WPSEO_Config_Component_Suggestions implements WPSEO_Config_Component {

	/**
	 * Gets the component identifier.
	 *
	 * @return string
	 */
	public function get_identifier() {
		return 'Suggestions';
	}

	/**
	 * Gets the field.
	 *
	 * @return WPSEO_Config_Field
	 */
	public function get_field() {
		$field = new WPSEO_Config_Field_Suggestions();

		// Only show Premium upsell when we are not inside a Premium install.
		if ( ! WPSEO_Utils::is_yoast_seo_premium() ) {
			$field->add_suggestion(
				/* translators: %s resolves to Yoast SEO Premium */
				sprintf( __( 'Outrank the competition with %s', 'wordpress-seo' ), 'Yoast SEO Premium' ),
				/* translators: %1$s resolves to Yoast SEO Premium */
				sprintf( __( 'Do you want to outrank your competition? %1$s gives you awesome additional features that\'ll help you to set up your SEO strategy like a professional. Add synonyms and related keywords, use our Premium SEO analysis, the redirect manager and our internal linking tool. %1$s will also give you access to premium support.', 'wordpress-seo' ), 'Yoast SEO Premium' ),
				array(
					'label' => __( 'Upgrade to Premium', 'wordpress-seo' ),
					'type'  => 'primary',
					'href'  => WPSEO_Shortlinker::get( 'https://yoa.st/wizard-suggestion-premium' ),
				),
				array(
					'url'   => WPSEO_Shortlinker::get( 'https://yoa.st/video-yoast-seo-premium' ),
					'title' => sprintf(
						/* translators: %1$s expands to Yoast SEO Premium. */
						__( '%1$s video', 'wordpress-seo' ),
						'Yoast SEO Premium'
					),
				)
			);
		}

		$field->add_suggestion(
			__( 'Find out what words your audience uses to find you', 'wordpress-seo' ),
			sprintf(
				/* translators: %1$s resolves to Keyword research training */
				__( 'Keyword research is essential in any SEO strategy. You decide the search terms you want to be found for, and figure out what words your audience uses to find you. Great keyword research tells you what content you need to start ranking for the terms you want to rank for. Make sure your efforts go into the keywords you actually have a chance at ranking for! The %1$s walks you through this process, step by step.', 'wordpress-seo' ),
				'Keyword research training'
			),
			array(
				'label' => 'Keyword research training',
				'type'  => 'link',
				'href'  => WPSEO_Shortlinker::get( 'https://yoa.st/3lg' ),
			),
			array(
				'url'   => WPSEO_Shortlinker::get( 'https://yoa.st/3lf' ),
				'title' => sprintf(
					/* translators: %1$s expands to Keyword research training. */
					__( '%1$s video', 'wordpress-seo' ),
					'Keyword research training'
				),
			)
		);

		$field->add_suggestion(
			/* translators: %1$s resolves to Yoast SEO, %2$s resolves to Yoast SEO plugin training */
			sprintf( __( 'Get the most out of %1$s with the %2$s', 'wordpress-seo' ), 'Yoast SEO', 'Yoast SEO plugin training' ),
			/* translators: %1$s resolves to Yoast SEO */
			sprintf( __( 'Do you want to know all the ins and outs of the %1$s plugin? Do you want to learn all about our advanced settings? Want to be able to really get the most out of the %1$s plugin? Check out our %1$s plugin training and start outranking the competition!', 'wordpress-seo' ), 'Yoast SEO' ),
			array(
				'label' => 'Yoast SEO plugin training',
				'type'  => 'link',
				'href'  => WPSEO_Shortlinker::get( 'https://yoa.st/wizard-suggestion-plugin-course' ),
			),
			array(
				'url'   => WPSEO_Shortlinker::get( 'https://yoa.st/video-plugin-course' ),
				'title' => sprintf(
					/* translators: %1$s expands to Yoast SEO plugin training. */
					__( '%1$s video', 'wordpress-seo' ),
					'Yoast SEO plugin training'
				),
			)
		);

		// When we are running in Yoast SEO Premium and don't have Local SEO installed, show Local SEO as suggestion.
		if ( WPSEO_Utils::is_yoast_seo_premium() && ! defined( 'WPSEO_LOCAL_FILE' ) ) {
			$field->add_suggestion(
				__( 'Attract more customers near you', 'wordpress-seo' ),
				/* translators: %1$s resolves to Local SEO */
				sprintf( __( 'If you want to outrank the competition in a specific town or region, check out our %1$s plugin! Youâ€™ll be able to easily insert Google maps, opening hours, contact information and a store locator. Besides that %1$s helps you to improve the usability of your contact page.', 'wordpress-seo' ), 'Local SEO' ),
				array(
					'label' => 'Local SEO',
					'type'  => 'link',
					'url'   => WPSEO_Shortlinker::get( 'https://yoa.st/wizard-suggestion-localseo' ),
				),
				array(
					'url'   => WPSEO_Shortlinker::get( 'https://yoa.st/video-localseo' ),
					'title' => sprintf(
						/* translators: %1$s expands to Local SEO. */
						__( '%1$s video', 'wordpress-seo' ),
						'Local SEO'
					),
				)
			);
		}

		return $field;
	}

	/**
	 * Get the data for the field.
	 *
	 * @return array
	 */
	public function get_data() {
		return array();
	}

	/**
	 * Save data.
	 *
	 * @param array $data Data containing changes.
	 *
	 * @return bool
	 */
	public function set_data( $data ) {
		return true;
	}
}
PK     ”T]ù°/Úƒ  ƒ  F  config-ui/components/class-component-connect-google-search-console.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Component_Connect_Google_Search_Console.
 */
class WPSEO_Config_Component_Connect_Google_Search_Console implements WPSEO_Config_Component {

	/**
	 * @var string
	 */
	const OPTION_ACCESS_TOKEN = 'wpseo-gsc-access_token';

	/**
	 * @var string
	 */
	const OPTION_REFRESH_TOKEN = 'wpseo-gsc-refresh_token';

	/**
	 * Service to use.
	 *
	 * @var WPSEO_GSC_Service
	 */
	protected $gsc_service;

	/**
	 * WPSEO_Config_Component_Connect_Google_Search_Console constructor.
	 */
	public function __construct() {
		$this->gsc_service = new WPSEO_GSC_Service( $this->get_profile() );
	}

	/**
	 * Set the Google Search Console service.
	 *
	 * @param WPSEO_GSC_Service $service Set service to use.
	 */
	public function set_gsc_service( WPSEO_GSC_Service $service ) {
		$this->gsc_service = $service;
	}

	/**
	 * Gets the component identifier.
	 *
	 * @return string
	 */
	public function get_identifier() {
		return 'ConnectGoogleSearchConsole';
	}

	/**
	 * Gets the field.
	 *
	 * @return WPSEO_Config_Field
	 */
	public function get_field() {
		return new WPSEO_Config_Field_Connect_Google_Search_Console();
	}

	/**
	 * Get the data for the field.
	 *
	 * @return mixed
	 */
	public function get_data() {

		$data = array(
			'profileList'    => $this->get_profilelist(),
			'profile'        => $this->get_profile(),
			'hasAccessToken' => $this->hasAccessToken(),
		);

		return $data;
	}

	/**
	 * Save data.
	 *
	 * @param array $data Data containing changes.
	 *
	 * @return mixed
	 */
	public function set_data( $data ) {

		$current_data = $this->get_data();

		$this->handle_profile_change( $current_data, $data );

		// Save profile.
		$has_saved = update_option(
			WPSEO_GSC::OPTION_WPSEO_GSC,
			array( 'profile' => $data['profile'] )
		);

		// Collect results to return to the configurator.
		$results = array(
			'profile' => $has_saved,
		);

		return $results;
	}

	/**
	 * Remove issues when the profile has changed.
	 *
	 * @param array $current_data Saved data before changes.
	 * @param array $data         Data after changes.
	 */
	protected function handle_profile_change( $current_data, $data ) {
		// If the profile has been changed, remove issues.
		if ( $current_data['profile'] === $data['profile'] ) {
			return;
		}

		$this->reload_issues();
	}

	/**
	 * Get the current GSC profile.
	 *
	 * @return string
	 */
	protected function get_profile() {
		return WPSEO_GSC_Settings::get_profile();
	}

	/**
	 * Reload GSC issues.
	 */
	protected function reload_issues() {
		WPSEO_GSC_Settings::reload_issues();
	}

	/**
	 * Gets a list with the profiles.
	 *
	 * @return array
	 */
	protected function get_profilelist() {
		$profiles = array();
		$sites    = $this->gsc_service->get_sites();
		foreach ( $sites as $site_key => $site_value ) {
			$profiles[ untrailingslashit( $site_key )  ] = untrailingslashit( $site_value );
		}

		return $profiles;
	}

	/**
	 * Checks if there is an access token. If so, there is a connection.
	 *
	 * @return bool
	 */
	private function hasAccessToken() {
		return ( null !== $this->gsc_service->get_client()->getAccessToken() );
	}
}
PK     ”T]ÍYY÷ë  ë  ,  config-ui/components/interface-component.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Config Component interface.
 */
interface WPSEO_Config_Component {

	/**
	 * @return string
	 */
	public function get_identifier();

	/**
	 * @return mixed
	 */
	public function get_data();

	/**
	 * Save changes.
	 *
	 * @param array $data Data provided by the API.
	 *
	 * @return mixed
	 */
	public function set_data( $data );

	/**
	 * @return WPSEO_Config_Field
	 */
	public function get_field();
}
PK     ”T]�SÊ‰í   í     config-ui/components/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]‡¦>¾e  e  +  config-ui/class-configuration-structure.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Configuration_Structure
 */
class WPSEO_Configuration_Structure {

	/**
	 * Registered steps.
	 *
	 * @var array
	 */
	protected $steps = array();

	/**
	 * List of fields for each configuration step.
	 *
	 * This list does not include the fields for the 'postTypeVisibility'
	 * step as that list will be generated on the fly.
	 *
	 * @var array
	 */
	private $fields = array(
		'environment_type'           => array( 'environment_type' ),
		'siteType'                   => array( 'siteType' ),
		'publishingEntity'           => array(
			'publishingEntity',
			'publishingEntityType',
			'publishingEntityCompanyName',
			'publishingEntityCompanyLogo',
			'publishingEntityPersonId',
			'profileUrlFacebook',
			'profileUrlTwitter',
			'profileUrlInstagram',
			'profileUrlLinkedIn',
			'profileUrlMySpace',
			'profileUrlPinterest',
			'profileUrlYouTube',
			'profileUrlWikipedia',
		),
		'multipleAuthors'            => array( 'multipleAuthors' ),
		'connectGoogleSearchConsole' => array(
			'googleSearchConsoleIntro',
			'connectGoogleSearchConsole',
		),
		'titleTemplate'              => array(
			'titleIntro',
			'siteName',
			'separator',
		),
		'newsletter'                 => array( 'mailchimpSignup' ),
		'suggestions'                => array( 'suggestions' ),
		'success'                    => array( 'successMessage' ),
	);

	/**
	 * WPSEO_Configuration_Structure constructor.
	 */
	public function initialize() {
		$this->add_step( 'environment-type', __( 'Environment', 'wordpress-seo' ), $this->fields['environment_type'] );
		$this->add_step( 'site-type', __( 'Site type', 'wordpress-seo' ), $this->fields['siteType'] );
		$this->add_step(
			'publishing-entity',
			__( 'Organization or person', 'wordpress-seo' ),
			$this->fields['publishingEntity']
		);

		$fields = array( 'postTypeVisibility' );

		$post_type_factory = new WPSEO_Config_Factory_Post_Type();
		foreach ( $post_type_factory->get_fields() as $post_type_field ) {
			$fields[] = $post_type_field->get_identifier();
		}
		$this->add_step( 'post-type-visibility', __( 'Search engine visibility', 'wordpress-seo' ), $fields );

		$this->add_step(
			'multiple-authors',
			__( 'Multiple authors', 'wordpress-seo' ),
			$this->fields['multipleAuthors']
		);
		// @codingStandardsIgnoreStart -- These lines are commented out temporarily, see next line.
		// Commented out since 11.1.1 patch because Google removed their GSC API.
//		$this->add_step(
//			'connect-google-search-console',
//			__( 'Google Search Console', 'wordpress-seo' ),
//			$this->fields['connectGoogleSearchConsole']
//		);
		// @codingStandardsIgnoreEnd

		$this->add_step( 'title-template', __( 'Title settings', 'wordpress-seo' ), $this->fields['titleTemplate'] );

		$this->add_step( 'newsletter', __( 'Newsletter', 'wordpress-seo' ), $this->fields['newsletter'], true, true );
		$this->add_step( 'suggestions', __( 'You might like', 'wordpress-seo' ), $this->fields['suggestions'], true, true );
		$this->add_step( 'success', __( 'Success!', 'wordpress-seo' ), $this->fields['success'], true, true );
	}

	/**
	 * Add a step to the structure
	 *
	 * @param string $identifier Identifier for this step.
	 * @param string $title      Title to display for this step.
	 * @param array  $fields     Fields to use on the step.
	 * @param bool   $navigation Show navigation buttons.
	 * @param bool   $full_width Wheter the step content is full width or not.
	 */
	protected function add_step( $identifier, $title, $fields, $navigation = true, $full_width = false ) {
		$this->steps[ $identifier ] = array(
			'title'          => $title,
			'fields'         => $fields,
			'hideNavigation' => ! (bool) $navigation,
			'fullWidth'      => $full_width,
		);
	}

	/**
	 * Retrieve the registered steps.
	 *
	 * @return array
	 */
	public function retrieve() {
		return $this->steps;
	}
}
PK     ”T]�SÊ‰í   í     config-ui/factories/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]š‹ÂÖR  R  /  config-ui/factories/class-factory-post-type.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Configurator
 */

/**
 * Class WPSEO_Config_Factory_Post_Type.
 */
class WPSEO_Config_Factory_Post_Type {

	/**
	 * List of fields.
	 *
	 * @var WPSEO_Config_Field_Choice_Post_Type[]
	 */
	protected static $fields = array();

	/**
	 * @return WPSEO_Config_Field_Choice_Post_Type[] List of fields.
	 */
	public function get_fields() {

		if ( empty( self::$fields ) ) {

			$fields = array();

			// WPSEO_Post_type::get_accessible_post_types() should *not* be used to get a similar experience from the settings.
			$post_types = get_post_types( array( 'public' => true ), 'objects' );
			$post_types = WPSEO_Post_Type::filter_attachment_post_type( $post_types );
			if ( ! empty( $post_types ) ) {
				foreach ( $post_types as $post_type => $post_type_object ) {
					$label = $this->decode_html_entities( $post_type_object->label );
					$field = new WPSEO_Config_Field_Choice_Post_Type( $post_type, $label );

					$this->add_custom_properties( $post_type, $field );

					$fields[] = $field;
				}
			}

			self::$fields = $fields;
		}

		return self::$fields;
	}

	/**
	 * Add custom properties for specific post types.
	 *
	 * @param string             $post_type Post type of field that is being added.
	 * @param WPSEO_Config_Field $field     Field that corresponds to the post type.
	 */
	private function add_custom_properties( $post_type, $field ) {
		if ( 'attachment' === $post_type ) {
			$field->set_property( 'explanation', __( 'WordPress automatically generates an URL for each media item in the library. Enabling this will allow for google to index the generated URL.', 'wordpress-seo' ) );
		}
	}

	/**
	 * Replaces the HTML entity with it's actual symbol.
	 *
	 * Because we do not not know what consequences it will have if we convert every HTML entity,
	 * we will only replace the characters that we have known problems with in text's.
	 *
	 * @param string $text The text to decode.
	 *
	 * @return string String with decoded HTML entities.
	 */
	private function decode_html_entities( $text ) {
		return str_replace( '&#39;', 'â€™', $text );
	}
}
PK     ”T]�SÊ‰í   í     config-ui/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]|›ëQU  U  )  config-ui/class-configuration-storage.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Configuration_Storage.
 */
class WPSEO_Configuration_Storage {

	/**
	 * @var \WPSEO_Configuration_Options_Adapter
	 */
	protected $adapter;

	/**
	 * @var \WPSEO_Config_Field[]
	 */
	protected $fields = array();

	/**
	 * Add default fields.
	 */
	public function add_default_fields() {
		$fields = array(
			new WPSEO_Config_Field_Upsell_Configuration_Service(),
			new WPSEO_Config_Field_Upsell_Site_Review(),
			new WPSEO_Config_Field_Success_Message(),
			new WPSEO_Config_Field_Mailchimp_Signup(),
			new WPSEO_Config_Field_Environment(),
			new WPSEO_Config_Field_Site_Type(),
			new WPSEO_Config_Field_Multiple_Authors(),
			new WPSEO_Config_Field_Title_Intro(),
			new WPSEO_Config_Field_Site_Name(),
			new WPSEO_Config_Field_Separator(),
			new WPSEO_Config_Field_Google_Search_Console_Intro(),
			new WPSEO_Config_Field_Profile_URL_Facebook(),
			new WPSEO_Config_Field_Profile_URL_Twitter(),
			new WPSEO_Config_Field_Profile_URL_Instagram(),
			new WPSEO_Config_Field_Profile_URL_LinkedIn(),
			new WPSEO_Config_Field_Profile_URL_MySpace(),
			new WPSEO_Config_Field_Profile_URL_Pinterest(),
			new WPSEO_Config_Field_Profile_URL_YouTube(),
			new WPSEO_Config_Field_Profile_URL_Wikipedia(),
			new WPSEO_Config_Field_Company_Or_Person(),
			new WPSEO_Config_Field_Company_Name(),
			new WPSEO_Config_Field_Company_Logo(),
			new WPSEO_Config_Field_Person(),
			new WPSEO_Config_Field_Post_Type_Visibility(),
		);

		$post_type_factory = new WPSEO_Config_Factory_Post_Type();
		$fields            = array_merge( $fields, $post_type_factory->get_fields() );

		foreach ( $fields as $field ) {
			$this->add_field( $field );
		}
	}

	/**
	 * Allow for field injections.
	 *
	 * @param WPSEO_Config_Field $field Field to add to the stack.
	 */
	public function add_field( WPSEO_Config_Field $field ) {
		$this->fields[] = $field;

		if ( isset( $this->adapter ) ) {
			$field->set_adapter( $this->adapter );
		}
	}

	/**
	 * Set the adapter to use.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to use.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$this->adapter = $adapter;

		foreach ( $this->fields as $field ) {
			$field->set_adapter( $this->adapter );
		}
	}

	/**
	 * Retrieve the current adapter.
	 *
	 * @return WPSEO_Configuration_Options_Adapter
	 */
	public function get_adapter() {
		return $this->adapter;
	}

	/**
	 * Retrieve the registered fields.
	 *
	 * @returns array List of settings.
	 */
	public function retrieve() {
		$output = array();

		/** @var WPSEO_Config_Field $field */
		foreach ( $this->fields as $field ) {

			$build = $field->to_array();

			$data = $this->get_field_data( $field );
			if ( ! is_null( $data ) ) {
				$build['data'] = $data;
			}

			$output[ $field->get_identifier() ] = $build;
		}

		return $output;
	}

	/**
	 * Save the data.
	 *
	 * @param array $data_to_store Data provided by the API which needs to be processed for saving.
	 *
	 * @return string Results
	 */
	public function store( $data_to_store ) {
		$output = array();

		/** @var WPSEO_Config_Field $field */
		foreach ( $this->fields as $field ) {

			$field_identifier = $field->get_identifier();

			if ( ! array_key_exists( $field_identifier, $data_to_store ) ) {
				continue;
			}

			$field_data = array();
			if ( isset( $data_to_store[ $field_identifier ] ) ) {
				$field_data = $data_to_store[ $field_identifier ];
			}

			$result = $this->adapter->set( $field, $field_data );

			$build = array(
				'result' => $result,
			);

			// Set current data to object to be displayed.
			$data = $this->get_field_data( $field );
			if ( ! is_null( $data ) ) {
				$build['data'] = $data;
			}

			$output[ $field_identifier ] = $build;
		}

		return $output;
	}

	/**
	 * Filter out null input values.
	 *
	 * @param mixed $input Input to test against.
	 *
	 * @return bool
	 */
	protected function is_not_null( $input ) {
		return ! is_null( $input );
	}

	/**
	 * Get data from a specific field.
	 *
	 * @param WPSEO_Config_Field $field Field to get data for.
	 *
	 * @return array|mixed
	 */
	protected function get_field_data( WPSEO_Config_Field $field ) {
		$data = $this->adapter->get( $field );

		if ( is_array( $data ) ) {
			$defaults = $field->get_data();

			// Remove 'null' values from input.
			$data = array_filter( $data, array( $this, 'is_not_null' ) );

			// Merge defaults with data.
			$data = array_merge( $defaults, $data );
		}

		if ( is_null( $data ) ) {
			// Get default if no data was set.
			$data = $field->get_data();

			return $data;
		}

		return $data;
	}
}
PK     ”T]YÁÂ?  ?  *  config-ui/class-configuration-endpoint.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Configuration_Endpoint.
 */
class WPSEO_Configuration_Endpoint {

	/**
	 * @var string
	 */
	const REST_NAMESPACE = 'yoast/v1';

	/**
	 * @var string
	 */
	const ENDPOINT_RETRIEVE = 'configurator';

	/**
	 * @var string
	 */
	const ENDPOINT_STORE = 'configurator';

	/**
	 * @var string
	 */
	const CAPABILITY_RETRIEVE = 'wpseo_manage_options';

	/**
	 * @var string
	 */
	const CAPABILITY_STORE = 'wpseo_manage_options';

	/**
	 * Service to use.
	 *
	 * @var WPSEO_Configuration_Service
	 */
	protected $service;

	/**
	 * Sets the service to use.
	 *
	 * @param WPSEO_Configuration_Service $service Service to use.
	 */
	public function set_service( WPSEO_Configuration_Service $service ) {
		$this->service = $service;
	}

	/**
	 * Register REST routes.
	 */
	public function register() {
		// Register fetch config.
		$route_args = array(
			'methods'             => 'GET',
			'callback'            => array( $this->service, 'get_configuration' ),
			'permission_callback' => array( $this, 'can_retrieve_data' ),
		);
		register_rest_route( self::REST_NAMESPACE, self::ENDPOINT_RETRIEVE, $route_args );

		// Register save changes.
		$route_args = array(
			'methods'             => 'POST',
			'callback'            => array( $this->service, 'set_configuration' ),
			'permission_callback' => array( $this, 'can_save_data' ),
		);
		register_rest_route( self::REST_NAMESPACE, self::ENDPOINT_STORE, $route_args );
	}

	/**
	 * Permission callback implementation.
	 *
	 * @return bool
	 */
	public function can_retrieve_data() {
		return current_user_can( self::CAPABILITY_RETRIEVE );
	}

	/**
	 * Permission callback implementation.
	 *
	 * @return bool
	 */
	public function can_save_data() {
		return current_user_can( self::CAPABILITY_STORE );
	}
}
PK     ”T]uÍd¢  ¢  1  config-ui/fields/class-field-choice-post-type.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Choice_Post_Type.
 */
class WPSEO_Config_Field_Choice_Post_Type extends WPSEO_Config_Field_Choice {

	/**
	 * Post type.
	 *
	 * @var string
	 */
	protected $post_type;

	/**
	 * WPSEO_Config_Field_Choice_Post_Type constructor.
	 *
	 * @param string $post_type The post type to add.
	 * @param string $label     Label to show (translated post type).
	 */
	public function __construct( $post_type, $label ) {
		parent::__construct( 'postType' . ucfirst( $post_type ) );

		$this->post_type = $post_type;

		/* Translators: %1$s expands to the name of the post type. The options given to the user are "visible" and "hidden" */
		$this->set_property( 'label', sprintf( __( 'Search engines should show "%1$s" in search results:', 'wordpress-seo' ), $label ) );

		$this->add_choice( 'true', __( 'Yes', 'wordpress-seo' ) );
		$this->add_choice( 'false', __( 'No', 'wordpress-seo' ) );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_custom_lookup(
			$this->get_identifier(),
			array( $this, 'get_data' ),
			array( $this, 'set_data' )
		);
	}

	/**
	 * Get the post type of this field.
	 *
	 * @return string Post type.
	 */
	public function get_post_type() {
		return $this->post_type;
	}

	/**
	 * @return bool
	 */
	public function get_data() {
		$key = 'noindex-' . $this->get_post_type();

		if ( WPSEO_Options::get( $key, false ) === false ) {
			return 'true';
		}

		return 'false';
	}

	/**
	 * Set new data.
	 *
	 * @param string $visible Visible (true) or hidden (false).
	 *
	 * @return bool
	 */
	public function set_data( $visible ) {
		$post_type = $this->get_post_type();

		return WPSEO_Options::set( 'noindex-' . $post_type, ( $visible === 'false' ) );
	}
}
PK     ”T]Ì„§Y  Y  4  config-ui/fields/class-field-profile-url-youtube.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Profile_URL_YouTube.
 */
class WPSEO_Config_Field_Profile_URL_YouTube extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Profile_URL_YouTube constructor.
	 */
	public function __construct() {
		parent::__construct( 'profileUrlYouTube', 'Input' );

		$this->set_property( 'label', __( 'YouTube URL', 'wordpress-seo' ) );
		$this->set_property( 'pattern', '^https:\/\/www\.youtube\.com\/([^/]+)$' );

		$this->set_requires( 'publishingEntityType', 'company' );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'youtube_url' );
	}
}
PK     ”T]�SÊ‰í   í     config-ui/fields/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]yKè÷  ÷  0  config-ui/fields/class-field-success-message.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Success_Message.
 */
class WPSEO_Config_Field_Success_Message extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Success_Message constructor.
	 */
	public function __construct() {
		parent::__construct( 'successMessage', 'FinalStep' );

		$success_message = sprintf(
			/* translators: %1$s expands to Yoast SEO. */
			__( '%1$s will now take care of all the needed technical optimization of your site. To really improve your site\'s performance in the search results, it\'s important to start creating content that ranks well for keyphrases you care about. Check out this video in which we explain how to use the %1$s metabox when you edit posts or pages.', 'wordpress-seo' ),
			'Yoast SEO'
		);

		$this->set_property( 'title', __( 'You\'ve done it!', 'wordpress-seo' ) );
		$this->set_property( 'message', $success_message );

		/* translators: %1$s expands to Yoast SEO. */
		$video_title = __( '%1$s video tutorial', 'wordpress-seo' );
		$video_args  = array(
			'url'   => WPSEO_Shortlinker::get( 'https://yoa.st/metabox-screencast' ),
			'title' => sprintf( $video_title, 'Yoast SEO' ),
		);
		$this->set_property( 'video', $video_args );
	}
}
PK     ”T]sÙÖ…=  =  3  config-ui/fields/class-field-upsell-site-review.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Upsell_Site_Review.
 */
class WPSEO_Config_Field_Upsell_Site_Review extends WPSEO_Config_Field {

	/**
	 * HTML tags allowed in the upsell site review text.
	 *
	 * @var array
	 */
	private $allowed_html = array(
		'a' => array(
			'href'   => array(),
			'target' => array( '_blank' ),
		),
	);

	/**
	 * WPSEO_Config_Field_Upsell_Site_Review constructor.
	 */
	public function __construct() {
		parent::__construct( 'upsellSiteReview', 'HTML' );

		$upsell_text = sprintf(
			/* translators: %1$s will be a link to a review explanation page. Text between %2$s and %3$s will be a link to an SEO copywriting course page. */
			__( 'If you want more help creating awesome content, check out our %2$sSEO copywriting course%3$s. Do you want to know all about the features of the plugin, consider doing our %1$s!', 'wordpress-seo' ),
			'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/yoastseotraining' ) . '" target="_blank">Yoast SEO for WordPress training</a>',
			'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/configuration-wizard-copywrite-course-link' ) . '" target="_blank">',
			'</a>'
		);

		$html = '<p>' . wp_kses( $upsell_text, $this->allowed_html ) . '</p>';

		$this->set_property( 'html', $html );
	}
}
PK     ”T]Ü½Á    '  config-ui/fields/class-field-person.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Configurator
 */

/**
 * Class WPSEO_Config_Field_Person_Name.
 */
class WPSEO_Config_Field_Person extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Company_Or_Person constructor.
	 */
	public function __construct() {
		parent::__construct( 'publishingEntityPersonId', 'WordPressUserSelector' );

		$this->set_property( 'label', __( 'The person', 'wordpress-seo' ) );

		$this->set_requires( 'publishingEntityType', 'person' );
	}

	/**
	 * Sets the adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'company_or_person_user_id' );
	}
}
PK     ”T]¼N    4  config-ui/fields/class-field-profile-url-twitter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Profile_URL_Twitter.
 */
class WPSEO_Config_Field_Profile_URL_Twitter extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Profile_URL_Twitter constructor.
	 */
	public function __construct() {
		parent::__construct( 'profileUrlTwitter', 'Input' );

		$this->set_property( 'label', __( 'Twitter Username', 'wordpress-seo' ) );

		$this->set_requires( 'publishingEntityType', 'company' );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'twitter_site' );
	}
}
PK     ”T]�¨{—ø  ø  <  config-ui/fields/class-field-google-search-console-intro.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Google_Search_Console_Intro.
 */
class WPSEO_Config_Field_Google_Search_Console_Intro extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Social_Profiles_Intro constructor.
	 */
	public function __construct() {
		parent::__construct( 'googleSearchConsoleIntro', 'HTML' );

		$html =
			sprintf(
				/* translators: %1$s is the plugin name. %2$s is a link start tag to a Yoast help page, %3$s is the link closing tag. */
				esc_html__( '%1$s integrates with Google Search Console, a must-have tool for site owners. It provides you with information about the health of your site. Don\'t have a Google account or is your site not activated yet? Find out %2$show to connect Google Search Console to your site%3$s.', 'wordpress-seo' ),
				'Yoast SEO',
				'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/1ex' ) ) . '" target="_blank">',
				'</a>'
			);

		$disclaimer = __( 'Note: we don\'t store your data in any way and don\'t have full access to your account. Your privacy is safe with us.', 'wordpress-seo' );

		$html = '<p>' . $html . '</p><small>' . esc_html( $disclaimer ) . '</small>';

		$this->set_property( 'html', $html );
	}
}
PK     ”T][§”>@	  @	  1  config-ui/fields/class-field-multiple-authors.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Multiple_Authors.
 */
class WPSEO_Config_Field_Multiple_Authors extends WPSEO_Config_Field_Choice {

	/**
	 * WPSEO_Config_Field_Multiple_Authors constructor.
	 */
	public function __construct() {
		parent::__construct( 'multipleAuthors' );

		$this->set_property( 'label', __( 'Does, or will, your site have multiple authors?', 'wordpress-seo' ) );

		$this->set_property( 'description', __( 'If you choose no, your author archives will be deactivated to prevent  duplicate content issues.', 'wordpress-seo' ) );

		$this->add_choice( 'yes', __( 'Yes', 'wordpress-seo' ) );
		$this->add_choice( 'no', __( 'No', 'wordpress-seo' ) );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_custom_lookup(
			$this->get_identifier(),
			array( $this, 'get_data' ),
			array( $this, 'set_data' )
		);
	}

	/**
	 * Get the data from the stored options.
	 *
	 * @return null|string
	 */
	public function get_data() {

		if ( WPSEO_Options::get( 'has_multiple_authors', false ) ) {
			$value = WPSEO_Options::get( 'has_multiple_authors' );
		}

		if ( ! isset( $value ) || is_null( $value ) ) {
			// If there are more than one users with level > 1 default to multiple authors.
			$user_criteria = array(
				'fields' => 'IDs',
				'who'    => 'authors',
			);
			$users         = get_users( $user_criteria );

			$value = count( $users ) > 1;
		}

		return ( $value ) ? 'yes' : 'no';
	}

	/**
	 * Set the data in the options.
	 *
	 * @param string $data The data to set for the field.
	 *
	 * @return bool Returns true or false for successful storing the data.
	 */
	public function set_data( $data ) {
		$value = ( $data === 'yes' );

		// Set multiple authors option.
		$result_multiple_authors = WPSEO_Options::set( 'has_multiple_authors', $value );

		/*
		 * Set disable author archives option. When multiple authors is set to true,
		 * the disable author option has to be false. Because of this the $value is inversed.
		 */
		$result_author_archives = WPSEO_Options::set( 'disable-author', ! $value );

		return ( $result_multiple_authors === true && $result_author_archives === true );
	}
}
PK     ”T]©äœ    ,  config-ui/fields/class-field-title-intro.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Title_Intro.
 */
class WPSEO_Config_Field_Title_Intro extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Social_Profiles_Intro constructor.
	 */
	public function __construct() {
		parent::__construct( 'titleIntro', 'HTML' );

		$html = __( 'On this page, you can change the name of your site and choose which separator to use. The separator will display, for instance, between your post title and site name. Symbols are shown in the size they\'ll appear in the search results. Choose the one that fits your brand best or takes up the least space in the snippets.', 'wordpress-seo' );

		$html = '<p>' . esc_html( $html ) . '</p>';

		$this->set_property( 'html', $html );
	}
}
PK     ”T]¹µÂ¼Q
  Q
  ,  config-ui/fields/class-field-environment.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Environment.
 */
class WPSEO_Config_Field_Environment extends WPSEO_Config_Field_Choice {

	/**
	 * WPSEO_Config_Field_Environment constructor.
	 */
	public function __construct() {
		parent::__construct( 'environment_type' );

		$this->set_property( 'label', __( 'Please specify if your site is under construction or already active.', 'wordpress-seo' ) );

		$this->set_property( 'description', __( 'Choose under construction if you want to keep the site out of the index of search engines. Don\'t forget to activate it once you\'re ready to publish your site.', 'wordpress-seo' ) );

		$this->add_choice( 'production', __( 'Option A: My site is live and ready to be indexed', 'wordpress-seo' ) );
		$this->add_choice( 'staging', __( 'Option B: My site is under construction and should not be indexed', 'wordpress-seo' ) );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_custom_lookup(
			$this->get_identifier(),
			array( $this, 'get_data' ),
			array( $this, 'set_data' )
		);
	}

	/**
	 * Gets the option that is set for this field.
	 *
	 * @return string The value for the environment_type wpseo option.
	 */
	public function get_data() {
		return WPSEO_Options::get( 'environment_type' );
	}

	/**
	 * Set new data.
	 *
	 * @param string $environment_type The site's environment type.
	 *
	 * @return bool Returns whether the value is successfully set.
	 */
	public function set_data( $environment_type ) {
		$return = true;
		if ( $this->get_data() !== $environment_type ) {
			$return = WPSEO_Options::set( 'environment_type', $environment_type );
			if ( ! $this->set_indexation( $environment_type ) ) {
				return false;
			}
		}

		return $return;
	}

	/**
	 * Set the WordPress Search Engine Visibility option based on the environment type.
	 *
	 * @param string $environment_type The environment the site is running in.
	 *
	 * @return bool Returns if the options is set successfully.
	 */
	protected function set_indexation( $environment_type ) {
		$new_blog_public_value     = 0;
		$current_blog_public_value = get_option( 'blog_public' );

		if ( $environment_type === 'production' ) {
			$new_blog_public_value = 1;
		}

		if ( $current_blog_public_value !== $new_blog_public_value ) {
			update_option( 'blog_public', $new_blog_public_value );

			return true;
		}

		return ( get_option( 'blog_public' ) === $new_blog_public_value );
	}
}
PK     ”T]î†ïôƒ  ƒ  6  config-ui/fields/class-field-profile-url-wikipedia.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Profile_URL_YouTube
 */
class WPSEO_Config_Field_Profile_URL_Wikipedia extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Profile_URL_YouTube constructor.
	 */
	public function __construct() {
		parent::__construct( 'profileUrlWikipedia', 'Input' );

		$this->set_property( 'label', __( 'Wikipedia URL', 'wordpress-seo' ) );
		$this->set_property( 'pattern', '^https:\/\/([a-z\-]+)\.wikipedia\.org\/([^/]+)$' );

		$this->set_requires( 'publishingEntityType', 'company' );
	}

	/**
	 * Sets the adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 *
	 * @return void
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'wikipedia_url' );
	}
}
PK     ”T]Üâ®Æ
  
     config-ui/fields/class-field.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field.
 */
class WPSEO_Config_Field {

	/**
	 * Field name.
	 *
	 * @var string
	 */
	protected $field;

	/**
	 * Component to use.
	 *
	 * @var string
	 */
	protected $component;

	/**
	 * Properties of this field.
	 *
	 * @var array
	 */
	protected $properties = array();

	/**
	 * Field requirements.
	 *
	 * @var array
	 */
	protected $requires = array();

	/**
	 * Value of this field.
	 *
	 * @var array|mixed
	 */
	protected $data = array();

	/**
	 * WPSEO_Config_Field constructor.
	 *
	 * @param string $field     The field name.
	 * @param string $component The component to use.
	 */
	public function __construct( $field, $component ) {
		$this->field     = $field;
		$this->component = $component;
	}

	/**
	 * Get the identifier.
	 *
	 * @return string
	 */
	public function get_identifier() {
		return $this->field;
	}

	/**
	 * Get the component.
	 *
	 * @return string
	 */
	public function get_component() {
		return $this->component;
	}

	/**
	 * Set a property value.
	 *
	 * @param string $name  Property to set.
	 * @param mixed  $value Value to apply.
	 */
	public function set_property( $name, $value ) {
		$this->properties[ $name ] = $value;
	}

	/**
	 * Get all the properties.
	 *
	 * @return array
	 */
	public function get_properties() {
		return $this->properties;
	}

	/**
	 * Get the data.
	 *
	 * @return mixed
	 */
	public function get_data() {
		return $this->data;
	}

	/**
	 * Array representation of this object.
	 *
	 * @return array
	 */
	public function to_array() {
		$output = array(
			'componentName' => $this->get_component(),
		);

		$properties = $this->get_properties();
		if ( $properties ) {
			$output['properties'] = $properties;
		}

		$requires = $this->get_requires();
		if ( ! empty( $requires ) ) {
			$output['requires'] = $requires;
		}

		return $output;
	}

	/**
	 * Set the adapter to use.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
	}

	/**
	 * Requires another field to have a certain value.
	 *
	 * @param string $field Field to check for a certain value.
	 * @param mixed  $value Value of the field.
	 */
	public function set_requires( $field, $value ) {
		$this->requires = array(
			'field' => $field,
			'value' => $value,
		);
	}

	/**
	 * Get the required field settings (if present).
	 *
	 * @return array
	 */
	public function get_requires() {
		return $this->requires;
	}
}
PK     ”T]ÜŸÿüh  h  5  config-ui/fields/class-field-profile-url-facebook.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Profile_URL_Facebook.
 */
class WPSEO_Config_Field_Profile_URL_Facebook extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Profile_URL_Facebook constructor.
	 */
	public function __construct() {
		parent::__construct( 'profileUrlFacebook', 'Input' );

		$this->set_property( 'label', __( 'Facebook Page URL', 'wordpress-seo' ) );
		$this->set_property( 'pattern', '^https:\/\/www\.facebook\.com\/([^/]+)\/$' );

		$this->set_requires( 'publishingEntityType', 'company' );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'facebook_site' );
	}
}
PK     ”T]Ó !V  V  4  config-ui/fields/class-field-profile-url-myspace.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Profile_URL_MySpace.
 */
class WPSEO_Config_Field_Profile_URL_MySpace extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Profile_URL_MySpace constructor.
	 */
	public function __construct() {
		parent::__construct( 'profileUrlMySpace', 'Input' );

		$this->set_property( 'label', __( 'MySpace URL', 'wordpress-seo' ) );
		$this->set_property( 'pattern', '^https:\/\/myspace\.com\/([^/]+)\/$' );

		$this->set_requires( 'publishingEntityType', 'company' );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'myspace_url' );
	}
}
PK     ”T]aù�%y  y  '  config-ui/fields/class-field-choice.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Choice.
 */
class WPSEO_Config_Field_Choice extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Choice constructor.
	 *
	 * @param string $field Field name to use.
	 */
	public function __construct( $field ) {
		parent::__construct( $field, 'Choice' );

		$this->properties['choices'] = array();
	}

	/**
	 * Add a choice to the properties.
	 *
	 * @param string $value      Value op the option.
	 * @param string $label      Label to display for the value.
	 * @param string $aria_label Optional. Aria label text to use.
	 */
	public function add_choice( $value, $label, $aria_label = '' ) {
		$choice = array(
			'label' => $label,
		);

		if ( $aria_label ) {
			$choice['screenReaderText'] = $aria_label;
		}

		$this->properties['choices'][ $value ] = $choice;
	}
}
PK     ”T],�¥‚'  '  -  config-ui/fields/class-field-company-logo.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Configurator
 */

/**
 * Class WPSEO_Config_Field_Company_Logo.
 */
class WPSEO_Config_Field_Company_Logo extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Company_Logo constructor.
	 */
	public function __construct() {
		parent::__construct( 'publishingEntityCompanyLogo', 'MediaUpload' );

		$this->set_property( 'label', __( 'Provide an image of the organization logo', 'wordpress-seo' ) );

		$this->set_requires( 'publishingEntityType', 'company' );
	}

	/**
	 * Sets the adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'company_logo' );
	}
}
PK     ”T]V?²ud  d  5  config-ui/fields/class-field-profile-url-linkedin.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Profile_URL_LinkedIn.
 */
class WPSEO_Config_Field_Profile_URL_LinkedIn extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Profile_URL_LinkedIn constructor.
	 */
	public function __construct() {
		parent::__construct( 'profileUrlLinkedIn', 'Input' );

		$this->set_property( 'label', __( 'LinkedIn URL', 'wordpress-seo' ) );
		$this->set_property( 'pattern', '^https:\/\/www\.linkedin\.com\/in\/([^/]+)$' );

		$this->set_requires( 'publishingEntityType', 'company' );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'linkedin_url' );
	}
}
PK     ”T]Õz|3£  £  5  config-ui/fields/class-field-post-type-visibility.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Post_Type_Visibility.
 */
class WPSEO_Config_Field_Post_Type_Visibility extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Post_Type_Visibility constructor.
	 */
	public function __construct() {
		parent::__construct( 'postTypeVisibility', 'HTML' );

		$copy = __( 'Please specify what content types you would like to appear in search engines. If you do not know the differences between these, it\'s best to choose the default settings.', 'wordpress-seo' );

		$html = '<p>' . esc_html( $copy ) . '</p><br/>';

		$this->set_property( 'html', $html );
	}
}
PK     ”T]ÔJi  i  6  config-ui/fields/class-field-profile-url-pinterest.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Profile_URL_Pinterest.
 */
class WPSEO_Config_Field_Profile_URL_Pinterest extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Profile_URL_Pinterest constructor.
	 */
	public function __construct() {
		parent::__construct( 'profileUrlPinterest', 'Input' );

		$this->set_property( 'label', __( 'Pinterest URL', 'wordpress-seo' ) );
		$this->set_property( 'pattern', '^https:\/\/www\.pinterest\.com\/([^/]+)\/$' );

		$this->set_requires( 'publishingEntityType', 'company' );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'pinterest_url' );
	}
}
PK     ”T]¢=Y  Y  2  config-ui/fields/class-field-company-or-person.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Configurator
 */

/**
 * Class WPSEO_Config_Field_Company_Or_Person.
 */
class WPSEO_Config_Field_Company_Or_Person extends WPSEO_Config_Field_Choice {

	/**
	 * WPSEO_Config_Field_Company_Or_Person constructor.
	 */
	public function __construct() {
		parent::__construct( 'publishingEntityType' );

		$this->set_property( 'label', __( 'Does your site represent a person or an organization?', 'wordpress-seo' ) );

		$this->set_property( 'description', __( 'This information will be used in Google\'s Knowledge Graph Card, the big block of information you see on the right side of the search results.', 'wordpress-seo' ) );

		$this->add_choice( 'company', __( 'Organization', 'wordpress-seo' ) );
		$this->add_choice( 'person', __( 'Person', 'wordpress-seo' ) );
	}

	/**
	 * Sets the adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'company_or_person' );
	}
}
PK     ”T]üW/úå  å  *  config-ui/fields/class-field-separator.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Separator.
 */
class WPSEO_Config_Field_Separator extends WPSEO_Config_Field_Choice {

	/**
	 * WPSEO_Config_Field_Separator constructor.
	 */
	public function __construct() {
		parent::__construct( 'separator' );

		$this->set_property( 'label', __( 'Title Separator', 'wordpress-seo' ) );
		$this->set_property( 'explanation', __( 'Choose the symbol to use as your title separator. This will display, for instance, between your post title and site name. Symbols are shown in the size they\'ll appear in the search results.', 'wordpress-seo' ) );

		$this->add_choices();
	}

	/**
	 * Adds the title separator choices.
	 */
	protected function add_choices() {
		$choices = WPSEO_Option_Titles::get_instance()->get_separator_options_for_display();
		foreach ( $choices as $key => $value ) {
			$this->add_choice( $key, $value['label'], $value['aria_label'] );
		}
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'separator' );
	}
}
PK     ”T]�"ë¶i  i  6  config-ui/fields/class-field-profile-url-instagram.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Profile_URL_Instagram.
 */
class WPSEO_Config_Field_Profile_URL_Instagram extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Profile_URL_Instagram constructor.
	 */
	public function __construct() {
		parent::__construct( 'profileUrlInstagram', 'Input' );

		$this->set_property( 'label', __( 'Instagram URL', 'wordpress-seo' ) );
		$this->set_property( 'pattern', '^https:\/\/www\.instagram\.com\/([^/]+)\/$' );

		$this->set_requires( 'publishingEntityType', 'company' );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'instagram_url' );
	}
}
PK     ”T]oî/L  L  =  config-ui/fields/class-field-upsell-configuration-service.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Upsell_Configuration_Service.
 */
class WPSEO_Config_Field_Upsell_Configuration_Service extends WPSEO_Config_Field {

	/**
	 * HTML tags allowed in the upsell text.
	 *
	 * @var array
	 */
	private $allowed_html = array(
		'a' => array(
			'href'   => array(),
			'target' => array( '_blank' ),
		),
	);

	/**
	 * WPSEO_Config_Field_Upsell_Configuration_Service constructor.
	 */
	public function __construct() {
		parent::__construct( 'upsellConfigurationService', 'HTML' );

		$intro_text = sprintf(
			/* translators: %1$s expands to Yoast SEO. */
			__( 'Welcome to the %1$s configuration wizard. In a few simple steps we\'ll help you configure your SEO settings to match your website\'s needs!', 'wordpress-seo' ),
			'Yoast SEO'
		);

		$upsell_text = sprintf(
			/* Translators: %1$s expands to Yoast SEO, %2$s expands to Yoast SEO Premium, %3$s opens the link, %4$s closes the link. */
			__( 'While we strive to make setting up %1$s as easy as possible, we understand it can be daunting. If youâ€™d rather have us set up %1$s for you (and get a copy of %2$s in the process), order our %3$s%1$s configuration service%4$s here!', 'wordpress-seo' ),
			'Yoast SEO',
			'Yoast SEO Premium',
			'<a target="_blank" href="' . WPSEO_Shortlinker::get( 'https://yoa.st/configuration-package' ) . '">',
			'</a>'
		);

		$html  = '<p>' . esc_html( $intro_text ) . '</p>';
		$html .= '<p><em>' . wp_kses( $upsell_text, $this->allowed_html ) . '</em></p>';

		$this->set_property( 'html', $html );
	}
}
PK     ”T]ë,�[H  H  >  config-ui/fields/class-field-connect-google-search-console.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Connect_Google_Search_Console.
 */
class WPSEO_Config_Field_Connect_Google_Search_Console extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Connect_Google_Search_Console constructor.
	 */
	public function __construct() {
		parent::__construct( 'connectGoogleSearchConsole', 'ConnectGoogleSearchConsole' );
	}

	/**
	 * Get the data.
	 *
	 * @return array
	 */
	public function get_data() {
		return array(
			'profile'     => '',
			'profileList' => '',
		);
	}
}
PK     ”T]]}ÔEþ  þ  ,  config-ui/fields/class-field-suggestions.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Holds the suggestions for the 'You might also like' page in the wizard.
 */
class WPSEO_Config_Field_Suggestions extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Suggestions constructor.
	 */
	public function __construct() {
		parent::__construct( 'suggestions', 'Suggestions' );

		$this->properties['suggestions'] = array();
	}

	/**
	 * Adds a suggestion to the properties.
	 *
	 * @param string $title  The title of the choice.
	 * @param string $copy   The text explaining the choice.
	 * @param array  $button The button details.
	 * @param array  $video  URL and title of the video accompanying the choice.
	 */
	public function add_suggestion( $title, $copy, $button, array $video = array() ) {
		$suggestion = array(
			'title'  => $title,
			'copy'   => $copy,
			'button' => $button,
		);

		if ( ! empty( $video ) ) {
			$suggestion['video'] = $video;
		}

		$this->properties['suggestions'][] = $suggestion;
	}
}
PK     ”T]y�Z˜  ˜  *  config-ui/fields/class-field-site-name.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Site_Name.
 */
class WPSEO_Config_Field_Site_Name extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Site_Name constructor.
	 */
	public function __construct() {
		parent::__construct( 'siteName', 'Input' );

		$this->set_property( 'label', __( 'Website name', 'wordpress-seo' ) );

		$this->set_property( 'explanation', __( 'Google shows your website\'s name in the search results, if you want to change it, you can do that here.', 'wordpress-seo' ) );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_custom_lookup(
			$this->get_identifier(),
			array( $this, 'get_data' ),
			array( $this, 'set_data' )
		);
	}

	/**
	 * Get the data from the stored options.
	 *
	 * @return null|string
	 */
	public function get_data() {
		if ( WPSEO_Options::get( 'website_name', false ) ) {
			return WPSEO_Options::get( 'website_name' );
		}

		return get_bloginfo( 'name' );
	}

	/**
	 * Set the data in the options.
	 *
	 * @param string $data The data to set for the field.
	 *
	 * @return bool Returns true or false for successful storing the data.
	 */
	public function set_data( $data ) {
		return WPSEO_Options::set( 'website_name', $data );
	}
}
PK     ”T]«ÄÃ	  	  1  config-ui/fields/class-field-mailchimp-signup.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Mailchimp_Signup.
 */
class WPSEO_Config_Field_Mailchimp_Signup extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Mailchimp_Signup constructor.
	 */
	public function __construct() {
		parent::__construct( 'mailchimpSignup', 'MailchimpSignup' );

		$current_user = wp_get_current_user();
		$user_email   = ( $current_user->ID > 0 ) ? $current_user->user_email : '';

		$signup_text = sprintf(
			/* translators: %1$s expands to Yoast SEO for WordPress, %2$s expands to Yoast */
			__( 'Sign up for our newsletter if you would like to keep up-to-date about %1$s, other cool plugins by %2$s, and interesting news and tips from the world of SEO.', 'wordpress-seo' ),
			'Yoast SEO for WordPress',
			'Yoast'
		);

		$gdpr_notice = sprintf(
			/* translators: %1$s expands Yoast, %2$s expands to an opening anchor tag, %3$s expands to a closing anchor tag. */
			__( '%1$s respects your privacy. Read our %2$sprivacy policy%3$s on how we handle your personal information.', 'wordpress-seo' ),
			'Yoast',
			'<a target="_blank" rel="noopener noreferrer" href="' . WPSEO_Shortlinker::get( 'https://yoa.st/gdpr-config-wizard' ) . '">',
			'</a>'
		);

		$this->set_property( 'label', $signup_text );
		$this->set_property( 'decoration', plugin_dir_url( WPSEO_FILE ) . 'images/newsletter-collage.png' );
		$this->set_property( 'mailchimpActionUrl', 'https://yoast.us1.list-manage.com/subscribe/post-json?u=ffa93edfe21752c921f860358&id=972f1c9122' );
		$this->set_property( 'currentUserEmail', $user_email );
		$this->set_property( 'freeAccountNotice', __( 'Includes a free MyYoast account which gives you access to our free SEO for Beginners course!', 'wordpress-seo' ) );
		$this->set_property( 'GDPRNotice', sprintf( '<small>%s</small>', $gdpr_notice ) );
	}

	/**
	 * Get the data.
	 *
	 * @return array
	 */
	public function get_data() {
		return array(
			'hasSignup' => $this->has_mailchimp_signup(),
		);
	}

	/**
	 * Checks if the user has entered their email for mailchimp already.
	 *
	 * @return bool
	 */
	protected function has_mailchimp_signup() {
		$user_meta = get_user_meta( get_current_user_id(), WPSEO_Config_Component_Mailchimp_Signup::META_NAME, true );
		return ( ! empty( $user_meta ) );
	}
}
PK     ”T]ö06D      *  config-ui/fields/class-field-site-type.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Config_Field_Site_Type.
 */
class WPSEO_Config_Field_Site_Type extends WPSEO_Config_Field_Choice {

	/**
	 * WPSEO_Config_Field_Site_Type constructor.
	 */
	public function __construct() {
		parent::__construct( 'siteType' );

		/* translators: %1$s resolves to the home_url of the blog. */
		$this->set_property( 'label', sprintf( __( 'What does the site %1$s represent?', 'wordpress-seo' ), get_home_url() ) );

		$this->add_choice( 'blog', __( 'A blog', 'wordpress-seo' ) );
		$this->add_choice( 'shop', __( 'An online shop', 'wordpress-seo' ) );
		$this->add_choice( 'news', __( 'A news channel', 'wordpress-seo' ) );
		$this->add_choice( 'smallBusiness', __( 'A small offline business', 'wordpress-seo' ) );
		$this->add_choice( 'corporate', __( 'A corporation', 'wordpress-seo' ) );
		$this->add_choice( 'portfolio', __( 'A portfolio', 'wordpress-seo' ) );
		$this->add_choice( 'other', __( 'Something else', 'wordpress-seo' ) );
	}

	/**
	 * Set adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'site_type' );
	}
}
PK     ”T]´8:yM  M  -  config-ui/fields/class-field-company-name.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Configurator
 */

/**
 * Class WPSEO_Config_Field_Company_Name.
 */
class WPSEO_Config_Field_Company_Name extends WPSEO_Config_Field {

	/**
	 * WPSEO_Config_Field_Company_Name constructor.
	 */
	public function __construct() {
		parent::__construct( 'publishingEntityCompanyName', 'Input' );

		$this->set_property( 'label', __( 'The name of the organization', 'wordpress-seo' ) );
		$this->set_property( 'autoComplete', 'organization' );

		$this->set_requires( 'publishingEntityType', 'company' );
	}

	/**
	 * Sets the adapter.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to register lookup on.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$adapter->add_option_lookup( $this->get_identifier(), 'company_name' );
	}
}
PK     ”T]‹£]Ò—  —  .  config-ui/class-configuration-translations.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Configuration_Structure.
 */
class WPSEO_Configuration_Translations {

	/**
	 * Registered steps.
	 *
	 * @var array
	 */
	protected $translations = array();

	/**
	 * The locale.
	 *
	 * @var string
	 */
	protected $locale;

	/**
	 * Sets the translations based on the file.
	 *
	 * @param string $locale The locale to retreive the translations for.
	 */
	public function __construct( $locale ) {
		$this->locale       = $locale;
		$this->translations = $this->get_translations_from_file();
	}

	/**
	 * Retrieve the translations.
	 *
	 * @return array
	 */
	public function retrieve() {
		return $this->translations;
	}

	/**
	 * Retrieves the translations from the JSON-file.
	 *
	 * @return array Array with the translations.
	 */
	protected function get_translations_from_file() {

		$file = plugin_dir_path( WPSEO_FILE ) . 'languages/yoast-components-' . $this->locale . '.json';
		if ( file_exists( $file ) ) {
			$file = file_get_contents( $file );
			if ( is_string( $file ) && $file !== '' ) {
				return json_decode( $file, true );
			}
		}

		return array();
	}
}
PK     ”T]¬ßÅž  ž  ,  config-ui/class-configuration-components.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\ConfigurationUI
 */

/**
 * Class WPSEO_Configuration_Components.
 */
class WPSEO_Configuration_Components {

	/**
	 * List of registered components.
	 *
	 * @var WPSEO_Config_Component[]
	 */
	protected $components = array();

	/**
	 * Adapter.
	 *
	 * @var WPSEO_Configuration_Options_Adapter
	 */
	protected $adapter;

	/**
	 * Add default components.
	 */
	public function initialize() {
		$this->add_component( new WPSEO_Config_Component_Connect_Google_Search_Console() );
		$this->add_component( new WPSEO_Config_Component_Mailchimp_Signup() );
		$this->add_component( new WPSEO_Config_Component_Suggestions() );
	}

	/**
	 * Add a component.
	 *
	 * @param WPSEO_Config_Component $component Component to add.
	 */
	public function add_component( WPSEO_Config_Component $component ) {
		$this->components[] = $component;
	}

	/**
	 * Sets the storage to use.
	 *
	 * @param WPSEO_Configuration_Storage $storage Storage to use.
	 */
	public function set_storage( WPSEO_Configuration_Storage $storage ) {
		$this->set_adapter( $storage->get_adapter() );

		foreach ( $this->components as $component ) {
			$storage->add_field( $component->get_field() );
		}
	}

	/**
	 * Sets the adapter to use.
	 *
	 * @param WPSEO_Configuration_Options_Adapter $adapter Adapter to use.
	 */
	public function set_adapter( WPSEO_Configuration_Options_Adapter $adapter ) {
		$this->adapter = $adapter;

		foreach ( $this->components as $component ) {
			$adapter->add_custom_lookup(
				$component->get_field()->get_identifier(),
				array(
					$component,
					'get_data',
				),
				array(
					$component,
					'set_data',
				)
			);
		}
	}
}
PK     ”T]
Í6H    "  class-admin-asset-seo-location.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Determines the location of an asset within the SEO plugin.
 */
final class WPSEO_Admin_Asset_SEO_Location implements WPSEO_Admin_Asset_Location {

	/**
	 * @var string
	 */
	protected $plugin_file;

	/**
	 * The plugin file to base the asset location upon.
	 *
	 * @param string $plugin_file The plugin file string.
	 */
	public function __construct( $plugin_file ) {
		$this->plugin_file = $plugin_file;
	}

	/**
	 * Determines the URL of the asset on the dev server.
	 *
	 * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
	 * @param string            $type  The type of asset. Usually JS or CSS.
	 *
	 * @return string The URL of the asset.
	 */
	public function get_url( WPSEO_Admin_Asset $asset, $type ) {
		$path = $this->get_path( $asset, $type );
		if ( empty( $path ) ) {
			return '';
		}

		if ( YOAST_ENVIRONMENT !== 'development' && ! $asset->get_suffix() ) {
			$plugin_path = plugin_dir_path( $this->plugin_file );
			if ( ! file_exists( $plugin_path . $path ) ) {

				// Give a notice to the user in the console (only once).
				WPSEO_Utils::javascript_console_notification(
					'Development Files',
					sprintf(
						/* translators: %1$s resolves to https://github.com/Yoast/wordpress-seo */
						__( 'You are trying to load non-minified files. These are only available in our development package. Check out %1$s to see all the source files.', 'wordpress-seo' ),
						'https://github.com/Yoast/wordpress-seo'
					),
					true
				);

				// Just load the .min file.
				$path = $this->get_path( $asset, $type, '.min' );
			}
		}

		return plugins_url( $path, $this->plugin_file );
	}

	/**
	 * Determines the path relative to the plugin folder of an asset.
	 *
	 * @param WPSEO_Admin_Asset $asset        The asset to determine the path
	 *                                        for.
	 * @param string            $type         The type of asset.
	 * @param string|null       $force_suffix The suffix to force, or null when
	 *                                        to use the default suffix.
	 *
	 * @return string The path to the asset file.
	 */
	protected function get_path( WPSEO_Admin_Asset $asset, $type, $force_suffix = null ) {
		$relative_path = '';
		$rtl_suffix    = '';

		$suffix = ( $force_suffix === null ) ? $asset->get_suffix() : $force_suffix;

		switch ( $type ) {
			case WPSEO_Admin_Asset::TYPE_JS:
				$relative_path = 'js/dist/' . $asset->get_src() . $suffix . '.js';
				break;

			case WPSEO_Admin_Asset::TYPE_CSS:
				// Path and suffix for RTL stylesheets.
				if ( function_exists( 'is_rtl' ) && is_rtl() && $asset->has_rtl() ) {
					$rtl_suffix = '-rtl';
				}
				$relative_path = 'css/dist/' . $asset->get_src() . $rtl_suffix . $suffix . '.css';
				break;
		}

		return $relative_path;
	}
}
PK     ”T]^µî´„   „     class-help-center.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class WPSEO_Help_Center
 */
class WPSEO_Help_Center {

	/**
	 * The tabs in the help center.
	 *
	 * @var WPSEO_Option_Tab[] $tab
	 */
	private $tabs;

	/**
	 * Mount point in the HTML.
	 *
	 * @var string
	 */
	private $identifier = 'yoast-help-center-container';

	/**
	 * Additional help center items.
	 *
	 * @var array
	 */
	protected $help_center_items = array();

	/**
	 * Show premium support tab.
	 *
	 * @var bool
	 */
	protected $premium_support;

	/**
	 * WPSEO_Help_Center constructor.
	 *
	 * @param string                             $unused          Backwards compatible argument.
	 * @param WPSEO_Option_Tabs|WPSEO_Option_Tab $option_tabs     Currently displayed tabs.
	 * @param boolean                            $premium_support Show premium support tab.
	 */
	public function __construct( $unused, $option_tabs, $premium_support = false ) {
		$this->premium_support = $premium_support;

		$tabs = new WPSEO_Option_Tabs( '' );

		if ( $option_tabs instanceof WPSEO_Option_Tabs ) {
			$tabs = $option_tabs;
		}

		if ( $option_tabs instanceof WPSEO_Option_Tab ) {
			$tabs = new WPSEO_Option_Tabs( '', $option_tabs->get_name() );
			$tabs->add_tab( $option_tabs );
		}

		$this->tabs = $tabs;
	}

	/**
	 * Localize data required by the help center component.
	 */
	public function localize_data() {
		$this->add_contact_support_item();
		$this->enqueue_localized_data( $this->format_data( $this->tabs->get_tabs() ) );
	}

	/**
	 * Format the required data for localized script.
	 *
	 * @param WPSEO_Option_Tab[] $tabs Yoast admin pages navigational tabs.
	 *
	 * @return array Associative array containing data for help center component.
	 */
	protected function format_data( array $tabs ) {
		$formatted_data = array( 'tabs' => array() );

		foreach ( $tabs as $tab ) {
			$formatted_data['tabs'][ $tab->get_name() ] = array(
				'label'    => $tab->get_label(),
				'videoUrl' => $tab->get_video_url(),
				'id'       => $tab->get_name(),
			);
		}

		$active_tab = $this->tabs->get_active_tab();
		$active_tab = ( null === $active_tab ) ? $tabs[0] : $active_tab;

		$formatted_data['mountId']    = $this->identifier;
		$formatted_data['initialTab'] = $active_tab->get_name();

		$is_premium = WPSEO_Utils::is_yoast_seo_premium();

		// Will translate to either empty string or "1" in localised script.
		$formatted_data['isPremium']     = $is_premium;
		$formatted_data['pluginVersion'] = WPSEO_VERSION;

		// Open HelpScout on activating this tab ID.
		$formatted_data['shouldDisplayContactForm'] = $this->premium_support;

		$formatted_data['videoDescriptions'] = array();

		if ( $is_premium === false ) {
			$formatted_data['videoDescriptions'][] = array(
				'title'       => __( 'Need help?', 'wordpress-seo' ),
				'description' => __( 'Go Premium and our experts will be there for you to answer any questions you might have about the setup and use of the plugin.', 'wordpress-seo' ),
				'link'        => WPSEO_Shortlinker::get( 'https://yoa.st/seo-premium-vt' ),
				/* translators: %s expands to Yoast SEO Premium */
				'linkText'    => sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' ),
			);

			$formatted_data['videoDescriptions'][] = array(
				/* translators: %s expands to Yoast SEO */
				'title'       => sprintf( __( 'Want to be a %s Expert?', 'wordpress-seo' ), 'Yoast SEO' ),
				/* translators: %1$s expands to Yoast SEO */
				'description' => sprintf( __( 'Follow our %1$s for WordPress training and become a certified %1$s Expert!', 'wordpress-seo' ), 'Yoast SEO' ),
				'link'        => WPSEO_Shortlinker::get( 'https://yoa.st/wordpress-training-vt' ),
				/* translators: %s expands to Yoast SEO */
				'linkText'    => sprintf( __( 'Enroll in the %s for WordPress training', 'wordpress-seo' ), 'Yoast SEO' ),
			);
		}

		$formatted_data['contactSupportParagraphs'] = array(
			array(
				'image'   => array(
					'src'    => esc_url( plugin_dir_url( WPSEO_FILE ) . 'images/support-team.svg' ),
					'width'  => 100,
					'height' => 100,
					'alt'    => '',
				),
				'content' => null,
			),
			array(
				'image'   => null,
				'content' => __( 'If you have a problem that you can\'t solve with our video tutorials or knowledge base, you can send a message to our support team. They can be reached 24/7.', 'wordpress-seo' ),
			),
			array(
				'image'   => null,
				'content' => __( 'Support requests you create here are sent directly into our support system, which is secured with 256 bit SSL, so communication is 100% secure.', 'wordpress-seo' ),
			),
		);

		$formatted_data['extraTabs'] = $this->get_extra_tabs();

		return $formatted_data;
	}

	/**
	 * Get additional tabs for the help center component.
	 *
	 * @return array Additional help center tabs.
	 */
	protected function get_extra_tabs() {
		$help_center_items = apply_filters( 'wpseo_help_center_items', $this->help_center_items );

		return array_map( array( $this, 'format_helpcenter_tab' ), $help_center_items );
	}

	/**
	 * Convert WPSEO_Help_Center_Item into help center format.
	 *
	 * @param WPSEO_Help_Center_Item $item The item to convert.
	 *
	 * @return array Formatted item.
	 */
	protected function format_helpcenter_tab( WPSEO_Help_Center_Item $item ) {
		return array(
			'identifier' => $item->get_identifier(),
			'label'      => $item->get_label(),
			'content'    => $item->get_content(),
		);
	}

	/**
	 * Enqueue localized script for help center component.
	 *
	 * @param array $data Data to localize.
	 */
	protected function enqueue_localized_data( $data ) {
		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'help-center', 'wpseoHelpCenterData', $data );

		$yoast_components_l10n = new WPSEO_Admin_Asset_Yoast_Components_L10n();
		$yoast_components_l10n->localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'help-center' );
	}

	/**
	 * Outputs the help center div.
	 */
	public function mount() {
		echo '<div id="' . esc_attr( $this->identifier ) . '">' . esc_html__( 'Loading help center.', 'wordpress-seo' ) . '</div>';
	}

	/**
	 * Add the contact support help center item to the help center.
	 */
	private function add_contact_support_item() {
		/* translators: %s: expands to 'Yoast SEO Premium'. */
		$popup_title   = sprintf( __( 'Email support is a %s feature', 'wordpress-seo' ), 'Yoast SEO Premium' );
		$popup_content = '<p class="yoast-measure">' . __( 'Go Premium and our experts will be there for you to answer any questions you might have about the setup and use of the plugin.', 'wordpress-seo' ) . '</p>';
		/* translators: %s: expands to 'Yoast SEO Premium'. */
		$popup_content .= '<p>' . sprintf( __( 'Other benefits of %s for you:', 'wordpress-seo' ), 'Yoast SEO Premium' ) . '</p>';
		$popup_content .= '<ul class="wpseo-premium-advantages-list">';
		$popup_content .= '<li>' . sprintf(
			// We don't use strong text here, but we do use it in the "Add keyword" popup, this is just to have the same translatable strings.
			/* translators: %1$s expands to a 'strong' start tag, %2$s to a 'strong' end tag. */
			__( '%1$sNo more dead links%2$s: easy redirect manager', 'wordpress-seo' ),
			'',
			''
		) . '</li>';
		$popup_content .= '<li>' . __( 'Superfast internal linking suggestions', 'wordpress-seo' ) . '</li>';
		$popup_content .= '<li>' . sprintf(
			// We don't use strong text here, but we do use it in the "Add keyword" popup, this is just to have the same translatable strings.
			/* translators: %1$s expands to a 'strong' start tag, %2$s to a 'strong' end tag. */
			__( '%1$sSocial media preview%2$s: Facebook & Twitter', 'wordpress-seo' ),
			'',
			''
		) . '</li>';
		$popup_content .= '<li>' . __( '24/7 email support', 'wordpress-seo' ) . '</li>';
		$popup_content .= '<li>' . __( 'No ads!', 'wordpress-seo' ) . '</li>';
		$popup_content .= '</ul>';

		$premium_popup                    = new WPSEO_Premium_Popup( 'contact-support', 'h2', $popup_title, $popup_content, WPSEO_Shortlinker::get( 'https://yoa.st/contact-support' ) );
		$contact_support_help_center_item = new WPSEO_Help_Center_Item(
			'contact-support',
			__( 'Get support', 'wordpress-seo' ),
			array( 'content' => $premium_popup->get_premium_message( false ) ),
			'dashicons-email-alt'
		);

		$this->help_center_items[] = $contact_support_help_center_item;
	}
}
PK     ”T]‹¦™Kd  d    class-meta-table-accessible.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Links
 */

/**
 * Represents the state of the table being accessible.
 */
class WPSEO_Meta_Table_Accessible {

	/**
	 * @var string
	 */
	const ACCESSIBLE = '0';

	/**
	 * @var string
	 */
	const INACCESSBILE = '1';

	/**
	 * Checks if the given table name exists.
	 *
	 * @return bool True when table is accessible.
	 */
	public static function is_accessible() {
		$value = get_transient( self::transient_name() );

		// If the value is not set, check the table.
		if ( false === $value ) {
			return self::check_table();
		}

		return $value === self::ACCESSIBLE;
	}

	/**
	 * Sets the transient value to 1, to indicate the table is not accessible.
	 *
	 * @return void
	 */
	public static function set_inaccessible() {
		set_transient( self::transient_name(), self::INACCESSBILE, HOUR_IN_SECONDS );
	}

	/**
	 * Removes the transient.
	 *
	 * @return void
	 */
	public static function cleanup() {
		delete_transient( self::transient_name() );
	}

	/**
	 * Sets the transient value to 0, to indicate the table is accessible.
	 *
	 * @return void
	 */
	protected static function set_accessible() {
		/*
		 * Prefer to set a 0 timeout, but if the timeout was set before WordPress will not delete the transient
		 * correctly when overridden with a zero value.
		 *
		 * Setting a YEAR_IN_SECONDS instead.
		 */
		set_transient( self::transient_name(), self::ACCESSIBLE, YEAR_IN_SECONDS );
	}

	/**
	 * Checks if the table exists if not, set the transient to indicate the inaccessible table.
	 *
	 * @return bool True if table is accessible.
	 */
	protected static function check_table() {
		global $wpdb;

		$storage = new WPSEO_Meta_Storage();
		$query   = $wpdb->prepare( 'SHOW TABLES LIKE %s', $storage->get_table_name() );
		if ( $wpdb->get_var( $query ) !== $storage->get_table_name() ) {
			self::set_inaccessible();
			return false;
		}

		self::set_accessible();
		return true;
	}

	/**
	 * Returns the name of the transient.
	 *
	 * @return string The name of the transient to use.
	 */
	protected static function transient_name() {
		return 'wpseo_meta_table_inaccessible';
	}
}
PK     ”T]6gtkÃ  Ã    class-collector.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Collects the data from the added collection objects.
 */
class WPSEO_Collector {

	/**
	 * @var WPSEO_Collection[]
	 */
	protected $collections = array();

	/**
	 * Adds a collection object to the collections.
	 *
	 * @param WPSEO_Collection $collection The collection object to add.
	 */
	public function add_collection( WPSEO_Collection $collection ) {
		$this->collections[] = $collection;
	}

	/**
	 * Collects the data from the collection objects.
	 *
	 * @return array The collected data.
	 */
	public function collect() {
		$data = array();

		foreach ( $this->collections as $collection ) {
			$data = array_merge( $data, $collection->get() );
		}

		return $data;
	}

	/**
	 * Returns the collected data as a JSON encoded string.
	 *
	 * @return false|string The encode string.
	 */
	public function get_as_json() {
		return WPSEO_Utils::format_json_encode( $this->collect() );
	}
}
PK     ”T]iYjmn  mn     class-bulk-editor-list-table.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Bulk Editor
 * @since   1.5.0
 */

/**
 * Implements table for bulk editing.
 */
class WPSEO_Bulk_List_Table extends WP_List_Table {

	/**
	 * The nonce that was passed with the request.
	 *
	 * @var string
	 */
	private $nonce;

	/**
	 * Array of post types for which the current user has `edit_others_posts` capabilities.
	 *
	 * @var array
	 */
	private $all_posts;

	/**
	 * Array of post types for which the current user has `edit_posts` capabilities, but not `edit_others_posts`.
	 *
	 * @var array
	 */
	private $own_posts;

	/**
	 * Saves all the metadata into this array.
	 *
	 * @var array
	 */
	protected $meta_data = array();

	/**
	 * The current requested page_url.
	 *
	 * @var string
	 */
	private $request_url = '';

	/**
	 * The current page (depending on $_GET['paged']) if current tab is for current page_type, else it will be 1.
	 *
	 * @var integer
	 */
	private $current_page;

	/**
	 * The current post filter, if is used (depending on $_GET['post_type_filter']).
	 *
	 * @var string
	 */
	private $current_filter;

	/**
	 * The current post status, if is used (depending on $_GET['post_status']).
	 *
	 * @var string
	 */
	private $current_status;

	/**
	 * The current sorting, if used (depending on $_GET['order'] and $_GET['orderby']).
	 *
	 * @var string
	 */
	private $current_order;

	/**
	 * The page_type for current class instance (for example: title / description).
	 *
	 * @var string
	 */
	protected $page_type;

	/**
	 * Based on the page_type ($this->page_type) there will be constructed an url part, for subpages and
	 * navigation.
	 *
	 * @var string
	 */
	protected $page_url;

	/**
	 * The settings which will be used in the __construct.
	 *
	 * @var array
	 */
	protected $settings;

	/**
	 * @var array
	 */
	protected $pagination = array();

	/**
	 * Holds the sanitized data from the user input.
	 *
	 * @var array
	 */
	protected $input_fields = array();

	/**
	 * Class constructor.
	 *
	 * @param array $args The arguments.
	 */
	public function __construct( $args = array() ) {
		parent::__construct( $this->settings );

		$args = wp_parse_args(
			$args,
			array(
				'nonce'        => '',
				'input_fields' => array(),
			)
		);

		$this->input_fields = $args['input_fields'];
		if ( isset( $_SERVER['REQUEST_URI'] ) ) {
			$this->request_url = sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) );
		}

		$this->current_page   = ( ! empty( $this->input_fields['paged'] ) ) ? $this->input_fields['paged'] : 1;
		$this->current_filter = ( ! empty( $this->input_fields['post_type_filter'] ) ) ? $this->input_fields['post_type_filter'] : 1;
		$this->current_status = ( ! empty( $this->input_fields['post_status'] ) ) ? $this->input_fields['post_status'] : 1;
		$this->current_order  = array(
			'order'   => ( ! empty( $this->input_fields['order'] ) ) ? $this->input_fields['order'] : 'asc',
			'orderby' => ( ! empty( $this->input_fields['orderby'] ) ) ? $this->input_fields['orderby'] : 'post_title',
		);

		$this->nonce    = $args['nonce'];
		$this->page_url = "&nonce={$this->nonce}&type={$this->page_type}#top#{$this->page_type}";

		$this->populate_editable_post_types();
	}

	/**
	 * Prepares the data and renders the page.
	 */
	public function show_page() {
		$this->prepare_page_navigation();
		$this->prepare_items();

		$this->views();
		$this->display();
	}

	/**
	 * Used in the constructor to build a reference list of post types the current user can edit.
	 */
	protected function populate_editable_post_types() {
		$post_types = get_post_types(
			array(
				'public'              => true,
				'exclude_from_search' => false,
			),
			'object'
		);

		$this->all_posts = array();
		$this->own_posts = array();

		if ( is_array( $post_types ) && $post_types !== array() ) {
			foreach ( $post_types as $post_type ) {
				if ( ! current_user_can( $post_type->cap->edit_posts ) ) {
					continue;
				}

				if ( current_user_can( $post_type->cap->edit_others_posts ) ) {
					$this->all_posts[] = esc_sql( $post_type->name );
				}
				else {
					$this->own_posts[] = esc_sql( $post_type->name );
				}
			}
		}
	}

	/**
	 * Will shown the navigation for the table like pagenavigation and pagefilter.
	 *
	 * @param string $which Table nav location (such as top).
	 */
	public function display_tablenav( $which ) {
		$post_status = sanitize_text_field( filter_input( INPUT_GET, 'post_status' ) );
		?>
		<div class="tablenav <?php echo esc_attr( $which ); ?>">

			<?php if ( 'top' === $which ) { ?>
			<form id="posts-filter" action="" method="get">
				<input type="hidden" name="nonce" value="<?php echo esc_attr( $this->nonce ); ?>"/>
				<input type="hidden" name="page" value="wpseo_tools"/>
				<input type="hidden" name="tool" value="bulk-editor"/>
				<input type="hidden" name="type" value="<?php echo esc_attr( $this->page_type ); ?>"/>
				<input type="hidden" name="orderby"
					value="<?php echo esc_attr( filter_input( INPUT_GET, 'orderby' ) ); ?>"/>
				<input type="hidden" name="order"
					value="<?php echo esc_attr( filter_input( INPUT_GET, 'order' ) ); ?>"/>
				<input type="hidden" name="post_type_filter"
					value="<?php echo esc_attr( filter_input( INPUT_GET, 'post_type_filter' ) ); ?>"/>
				<?php if ( ! empty( $post_status ) ) { ?>
					<input type="hidden" name="post_status" value="<?php echo esc_attr( $post_status ); ?>"/>
				<?php } ?>
				<?php } ?>

				<?php
				$this->extra_tablenav( $which );
				$this->pagination( $which );
				?>

				<br class="clear"/>
				<?php if ( 'top' === $which ) { ?>
			</form>
		<?php } ?>
		</div>

		<?php
	}

	/**
	 * This function builds the base sql subquery used in this class.
	 *
	 * This function takes into account the post types in which the current user can
	 * edit all posts, and the ones the current user can only edit his/her own.
	 *
	 * @return string The subquery, which should always be used in $wpdb->prepare(),
	 *                passing the current user_id in as the first parameter.
	 */
	public function get_base_subquery() {
		global $wpdb;

		$all_posts_string = "'" . implode( "', '", $this->all_posts ) . "'";
		$own_posts_string = "'" . implode( "', '", $this->own_posts ) . "'";

		$post_author = esc_sql( (int) get_current_user_id() );

		$subquery = "(
				SELECT *
				FROM {$wpdb->posts}
				WHERE post_type IN ({$all_posts_string})
				UNION ALL
				SELECT *
				FROM {$wpdb->posts}
				WHERE post_type IN ({$own_posts_string}) AND post_author = {$post_author}
			) sub_base";

		return $subquery;
	}

	/**
	 * @return array
	 */
	public function get_views() {
		global $wpdb;

		$status_links = array();

		$states     = get_post_stati( array( 'show_in_admin_all_list' => true ) );
		$states     = esc_sql( $states );
		$all_states = "'" . implode( "', '", $states ) . "'";

		$subquery = $this->get_base_subquery();

		$total_posts = $wpdb->get_var(
			"
					SELECT COUNT(ID) FROM {$subquery}
					WHERE post_status IN ({$all_states})
				"
		);


		$post_status             = filter_input( INPUT_GET, 'post_status' );
		$current_link_attributes = empty( $post_status ) ? ' class="current" aria-current="page"' : '';
		$localized_text          = sprintf(
			/* translators: %s expands to the number of posts in localized format. */
			_nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts', 'wordpress-seo' ),
			number_format_i18n( $total_posts )
		);

		$status_links['all'] = '<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=bulk-editor' . $this->page_url ) ) . '"' . $current_link_attributes . '>' . $localized_text . '</a>';

		$post_stati = get_post_stati( array( 'show_in_admin_all_list' => true ), 'objects' );
		if ( is_array( $post_stati ) && $post_stati !== array() ) {
			foreach ( $post_stati as $status ) {

				$status_name = esc_sql( $status->name );

				$total = (int) $wpdb->get_var(
					$wpdb->prepare(
						"
								SELECT COUNT(ID) FROM {$subquery}
								WHERE post_status = %s
							",
						$status_name
					)
				);

				if ( $total === 0 ) {
					continue;
				}

				$current_link_attributes = '';
				if ( $status_name === $post_status ) {
					$current_link_attributes = ' class="current" aria-current="page"';
				}

				$status_links[ $status_name ] = '<a href="' . esc_url( add_query_arg( array( 'post_status' => $status_name ), admin_url( 'admin.php?page=wpseo_tools&tool=bulk-editor' . $this->page_url ) ) ) . '"' . $current_link_attributes . '>' . sprintf( translate_nooped_plural( $status->label_count, $total ), number_format_i18n( $total ) ) . '</a>';
			}
		}
		unset( $post_stati, $status, $status_name, $total, $current_link_attributes );

		$trashed_posts = $wpdb->get_var(
			"
					SELECT COUNT(ID) FROM {$subquery}
					WHERE post_status IN ('trash')
				"
		);

		$current_link_attributes = '';
		if ( 'trash' === $post_status ) {
			$current_link_attributes = 'class="current" aria-current="page"';
		}

		$localized_text = sprintf(
			/* translators: %s expands to the number of trashed posts in localized format. */
			_nx( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', $trashed_posts, 'posts', 'wordpress-seo' ),
			number_format_i18n( $trashed_posts )
		);

		$status_links['trash'] = '<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=bulk-editor&post_status=trash' . $this->page_url ) ) . '"' . $current_link_attributes . '>' . $localized_text . '</a>';

		return $status_links;
	}

	/**
	 * @param string $which Table nav location (such as top).
	 */
	public function extra_tablenav( $which ) {

		if ( 'top' === $which ) {
			$post_types = get_post_types(
				array(
					'public'              => true,
					'exclude_from_search' => false,
				)
			);

			$instance_type = esc_attr( $this->page_type );

			if ( is_array( $post_types ) && $post_types !== array() ) {
				global $wpdb;

				echo '<div class="alignleft actions">';

				$post_types = esc_sql( $post_types );
				$post_types = "'" . implode( "', '", $post_types ) . "'";

				$states          = get_post_stati( array( 'show_in_admin_all_list' => true ) );
				$states['trash'] = 'trash';
				$states          = esc_sql( $states );
				$all_states      = "'" . implode( "', '", $states ) . "'";

				$subquery = $this->get_base_subquery();

				$post_types = $wpdb->get_results(
					"
							SELECT DISTINCT post_type FROM {$subquery}
							WHERE post_status IN ({$all_states})
							ORDER BY 'post_type' ASC
						"
				);

				$post_type_filter = filter_input( INPUT_GET, 'post_type_filter' );
				$selected         = ( ! empty( $post_type_filter ) ) ? sanitize_text_field( $post_type_filter ) : '-1';

				$options = '<option value="-1">' . esc_html__( 'Show All Content Types', 'wordpress-seo' ) . '</option>';

				if ( is_array( $post_types ) && $post_types !== array() ) {
					foreach ( $post_types as $post_type ) {
						$obj      = get_post_type_object( $post_type->post_type );
						$options .= sprintf(
							'<option value="%2$s" %3$s>%1$s</option>',
							esc_html( $obj->labels->name ),
							esc_attr( $post_type->post_type ),
							selected( $selected, $post_type->post_type, false )
						);
					}
				}

				printf(
					'<label for="%1$s" class="screen-reader-text">%2$s</label>',
					esc_attr( 'post-type-filter-' . $instance_type ),
					esc_html__( 'Filter by content type', 'wordpress-seo' )
				);
				printf(
					'<select name="post_type_filter" id="%2$s">%1$s</select>',
					$options,
					esc_attr( 'post-type-filter-' . $instance_type )
				);

				submit_button( __( 'Filter', 'wordpress-seo' ), 'button', false, false, array( 'id' => 'post-query-submit' ) );
				echo '</div>';
			}
		}
	}

	/**
	 * Gets a list of sortable columns.
	 *
	 * The format is: 'internal-name' => array( 'orderby', bool ).
	 *
	 * @return array
	 */
	public function get_sortable_columns() {
		return array(
			'col_page_title' => array( 'post_title', true ),
			'col_post_type'  => array( 'post_type', false ),
			'col_post_date'  => array( 'post_date', false ),
		);
	}

	/**
	 * Sets the correct pagenumber and pageurl for the navigation.
	 */
	public function prepare_page_navigation() {

		$request_url = $this->request_url . $this->page_url;

		$current_page   = $this->current_page;
		$current_filter = $this->current_filter;
		$current_status = $this->current_status;
		$current_order  = $this->current_order;

		/*
		 * If current type doesn't compare with objects page_type, then we have to unset
		 * some vars in the requested url (which will be used for internal table urls).
		 */
		if ( isset( $this->input_fields['type'] ) && $this->input_fields['type'] !== $this->page_type ) {
			$request_url = remove_query_arg( 'paged', $request_url ); // Page will be set with value 1 below.
			$request_url = remove_query_arg( 'post_type_filter', $request_url );
			$request_url = remove_query_arg( 'post_status', $request_url );
			$request_url = remove_query_arg( 'orderby', $request_url );
			$request_url = remove_query_arg( 'order', $request_url );
			$request_url = add_query_arg( 'pages', 1, $request_url );

			$current_page   = 1;
			$current_filter = '-1';
			$current_status = '';
			$current_order  = array(
				'orderby' => 'post_title',
				'order'   => 'asc',
			);
		}

		$_SERVER['REQUEST_URI'] = $request_url;

		$_GET['paged']                = $current_page;
		$_REQUEST['paged']            = $current_page;
		$_REQUEST['post_type_filter'] = $current_filter;
		$_GET['post_type_filter']     = $current_filter;
		$_GET['post_status']          = $current_status;
		$_GET['orderby']              = $current_order['orderby'];
		$_GET['order']                = $current_order['order'];
	}

	/**
	 * Preparing the requested pagerows and setting the needed variables.
	 */
	public function prepare_items() {

		$post_type_clause = $this->get_post_type_clause();
		$all_states       = $this->get_all_states();
		$subquery         = $this->get_base_subquery();

		// Setting the column headers.
		$this->set_column_headers();

		// Count the total number of needed items and setting pagination given $total_items.
		$total_items = $this->count_items( $subquery, $all_states, $post_type_clause );
		$this->set_pagination( $total_items );

		// Getting items given $query.
		$query = $this->parse_item_query( $subquery, $all_states, $post_type_clause );
		$this->get_items( $query );

		// Get the metadata for the current items ($this->items).
		$this->get_meta_data();
	}

	/**
	 * Getting the columns for first row.
	 *
	 * @return array
	 */
	public function get_columns() {
		return $this->merge_columns();
	}

	/**
	 * Setting the column headers.
	 */
	protected function set_column_headers() {
		$columns               = $this->get_columns();
		$hidden                = array();
		$sortable              = $this->get_sortable_columns();
		$this->_column_headers = array( $columns, $hidden, $sortable );
	}

	/**
	 * Counting total items.
	 *
	 * @param string $subquery         SQL FROM part.
	 * @param string $all_states       SQL IN part.
	 * @param string $post_type_clause SQL post type part.
	 *
	 * @return mixed
	 */
	protected function count_items( $subquery, $all_states, $post_type_clause ) {
		global $wpdb;
		$total_items = $wpdb->get_var(
			"
					SELECT COUNT(ID)
					FROM {$subquery}
					WHERE post_status IN ({$all_states}) $post_type_clause
				"
		);

		return $total_items;
	}

	/**
	 * Getting the post_type_clause filter.
	 *
	 * @return string
	 */
	protected function get_post_type_clause() {
		// Filter Block.
		$post_types       = null;
		$post_type_clause = '';
		$post_type_filter = filter_input( INPUT_GET, 'post_type_filter' );

		if ( ! empty( $post_type_filter ) && get_post_type_object( sanitize_text_field( $post_type_filter ) ) ) {
			$post_types       = esc_sql( sanitize_text_field( $post_type_filter ) );
			$post_type_clause = "AND post_type IN ('{$post_types}')";
		}

		return $post_type_clause;
	}

	/**
	 * Setting the pagination.
	 *
	 * Total items is the number of all visible items.
	 *
	 * @param int $total_items Total items counts.
	 */
	protected function set_pagination( $total_items ) {

		// Calculate items per page.
		$per_page = $this->get_items_per_page( 'wpseo_posts_per_page', 10 );
		$paged    = esc_sql( sanitize_text_field( filter_input( INPUT_GET, 'paged' ) ) );

		if ( empty( $paged ) || ! is_numeric( $paged ) || $paged <= 0 ) {
			$paged = 1;
		}

		$this->set_pagination_args(
			array(
				'total_items' => $total_items,
				'total_pages' => ceil( $total_items / $per_page ),
				'per_page'    => $per_page,
			)
		);

		$this->pagination = array(
			'per_page' => $per_page,
			'offset'   => ( $paged - 1 ) * $per_page,
		);
	}

	/**
	 * Parse the query to get items from database.
	 *
	 * Based on given parameters there will be parse a query which will get all the pages/posts and other post_types
	 * from the database.
	 *
	 * @param string $subquery         SQL FROM part.
	 * @param string $all_states       SQL IN part.
	 * @param string $post_type_clause SQL post type part.
	 *
	 * @return string
	 */
	protected function parse_item_query( $subquery, $all_states, $post_type_clause ) {
		// Order By block.
		$orderby = filter_input( INPUT_GET, 'orderby' );

		$orderby = ! empty( $orderby ) ? esc_sql( sanitize_text_field( $orderby ) ) : 'post_title';
		$orderby = $this->sanitize_orderby( $orderby );

		// Order clause.
		$order = filter_input( INPUT_GET, 'order' );
		$order = ! empty( $order ) ? esc_sql( strtoupper( sanitize_text_field( $order ) ) ) : 'ASC';
		$order = $this->sanitize_order( $order );

		// Get all needed results.
		$query = "
				SELECT ID, post_title, post_type, post_status, post_modified, post_date
				FROM {$subquery}
				WHERE post_status IN ({$all_states}) $post_type_clause
				ORDER BY {$orderby} {$order}
				LIMIT %d,%d
			";

		return $query;
	}

	/**
	 * Heavily restricts the possible columns by which a user can order the table
	 * in the bulk editor, thereby preventing a possible CSRF vulnerability.
	 *
	 * @param string $orderby The column by which we want to order.
	 *
	 * @return string $orderby
	 */
	protected function sanitize_orderby( $orderby ) {
		$valid_column_names = array(
			'post_title',
			'post_type',
			'post_date',
		);

		if ( in_array( $orderby, $valid_column_names, true ) ) {
			return $orderby;
		}

		return 'post_title';
	}

	/**
	 * Makes sure the order clause is always ASC or DESC for the bulk editor table,
	 * thereby preventing a possible CSRF vulnerability.
	 *
	 * @param string $order Whether we want to sort ascending or descending.
	 *
	 * @return string $order SQL order string (ASC, DESC).
	 */
	protected function sanitize_order( $order ) {
		if ( in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ) {
			return $order;
		}

		return 'ASC';
	}

	/**
	 * Getting all the items.
	 *
	 * @param string $query SQL query to use.
	 */
	protected function get_items( $query ) {
		global $wpdb;

		$this->items = $wpdb->get_results(
			$wpdb->prepare(
				$query,
				$this->pagination['offset'],
				$this->pagination['per_page']
			)
		);
	}

	/**
	 * Getting all the states.
	 *
	 * @return string
	 */
	protected function get_all_states() {
		$states          = get_post_stati( array( 'show_in_admin_all_list' => true ) );
		$states['trash'] = 'trash';

		if ( ! empty( $this->input_fields['post_status'] ) ) {
			$requested_state = $this->input_fields['post_status'];
			if ( in_array( $requested_state, $states, true ) ) {
				$states = array( $requested_state );
			}

			if ( $requested_state !== 'trash' ) {
				unset( $states['trash'] );
			}
		}

		$states     = esc_sql( $states );
		$all_states = "'" . implode( "', '", $states ) . "'";

		return $all_states;
	}

	/**
	 * Based on $this->items and the defined columns, the table rows will be displayed.
	 */
	public function display_rows() {

		$records = $this->items;

		list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();

		if ( ( is_array( $records ) && $records !== array() ) && ( is_array( $columns ) && $columns !== array() ) ) {

			foreach ( $records as $rec ) {

				echo '<tr id="', esc_attr( 'record_' . $rec->ID ), '">';

				foreach ( $columns as $column_name => $column_display_name ) {

					$classes = '';
					if ( $primary === $column_name ) {
						$classes .= ' has-row-actions column-primary';
					}

					$attributes = $this->column_attributes( $column_name, $hidden, $classes, $column_display_name );

					$column_value = $this->parse_column( $column_name, $rec );

					if ( method_exists( $this, 'parse_page_specific_column' ) && empty( $column_value ) ) {
						$column_value = $this->parse_page_specific_column( $column_name, $rec, $attributes );
					}

					if ( ! empty( $column_value ) ) {
						printf( '<td %2$s>%1$s</td>', $column_value, $attributes );
					}
				}

				echo '</tr>';
			}
		}
	}

	/**
	 * Getting the attributes for each table cell.
	 *
	 * @param string $column_name         Column name string.
	 * @param array  $hidden              Set of hidden columns.
	 * @param string $classes             Additional CSS classes.
	 * @param string $column_display_name Column display name string.
	 *
	 * @return string
	 */
	protected function column_attributes( $column_name, $hidden, $classes, $column_display_name ) {

		$attributes = '';
		$class      = array( $column_name, "column-$column_name$classes" );

		if ( in_array( $column_name, $hidden, true ) ) {
			$class[] = 'hidden';
		}

		if ( ! empty( $class ) ) {
			$attributes = 'class="' . implode( ' ', $class ) . '"';
		}

		$attributes .= ' data-colname="' . esc_attr( $column_display_name ) . '"';

		return $attributes;
	}

	/**
	 * Parsing the title.
	 *
	 * @param WP_Post $rec Post object.
	 *
	 * @return string
	 */
	protected function parse_page_title_column( $rec ) {

		$title = empty( $rec->post_title ) ? __( '(no title)', 'wordpress-seo' ) : $rec->post_title;

		$return = sprintf( '<strong>%1$s</strong>', stripslashes( wp_strip_all_tags( $title ) ) );

		$post_type_object = get_post_type_object( $rec->post_type );
		$can_edit_post    = current_user_can( $post_type_object->cap->edit_post, $rec->ID );

		$actions = array();

		if ( $can_edit_post && 'trash' !== $rec->post_status ) {
			$actions['edit'] = sprintf(
				'<a href="%s" aria-label="%s">%s</a>',
				esc_url( get_edit_post_link( $rec->ID, true ) ),
				/* translators: %s: post title */
				esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;', 'wordpress-seo' ), $title ) ),
				__( 'Edit', 'wordpress-seo' )
			);
		}

		if ( $post_type_object->public ) {
			if ( in_array( $rec->post_status, array( 'pending', 'draft', 'future' ), true ) ) {
				if ( $can_edit_post ) {
					$actions['view'] = sprintf(
						'<a href="%s" aria-label="%s">%s</a>',
						esc_url( add_query_arg( 'preview', 'true', get_permalink( $rec->ID ) ) ),
						/* translators: %s: post title */
						esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;', 'wordpress-seo' ), $title ) ),
						__( 'Preview', 'wordpress-seo' )
					);
				}
			}
			elseif ( 'trash' !== $rec->post_status ) {
				$actions['view'] = sprintf(
					'<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
					esc_url( get_permalink( $rec->ID ) ),
					/* translators: %s: post title */
					esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'wordpress-seo' ), $title ) ),
					__( 'View', 'wordpress-seo' )
				);
			}
		}

		$return .= $this->row_actions( $actions );

		return $return;
	}

	/**
	 * Parsing the column based on the $column_name.
	 *
	 * @param string  $column_name Column name.
	 * @param WP_Post $rec         Post object.
	 *
	 * @return string
	 */
	protected function parse_column( $column_name, $rec ) {

		static $date_format;

		if ( ! isset( $date_format ) ) {
			$date_format = get_option( 'date_format' );
		}

		switch ( $column_name ) {
			case 'col_page_title':
				$column_value = $this->parse_page_title_column( $rec );
				break;

			case 'col_page_slug':
				$permalink    = get_permalink( $rec->ID );
				$display_slug = str_replace( get_bloginfo( 'url' ), '', $permalink );
				$column_value = sprintf( '<a href="%2$s" target="_blank">%1$s</a>', stripslashes( rawurldecode( $display_slug ) ), esc_url( $permalink ) );
				break;

			case 'col_post_type':
				$post_type    = get_post_type_object( $rec->post_type );
				$column_value = $post_type->labels->singular_name;
				break;

			case 'col_post_status':
				$post_status  = get_post_status_object( $rec->post_status );
				$column_value = $post_status->label;
				break;

			case 'col_post_date':
				$column_value = date_i18n( $date_format, strtotime( $rec->post_date ) );
				break;

			case 'col_row_action':
				$column_value = sprintf(
					'<a href="#" role="button" class="wpseo-save" data-id="%1$s">%2$s</a> <span aria-hidden="true">|</span> <a href="#" role="button" class="wpseo-save-all">%3$s</a>',
					$rec->ID,
					esc_html__( 'Save', 'wordpress-seo' ),
					esc_html__( 'Save all', 'wordpress-seo' )
				);
				break;
		}

		if ( ! empty( $column_value ) ) {
			return $column_value;
		}
	}

	/**
	 * Parse the field where the existing meta-data value is displayed.
	 *
	 * @param integer    $record_id  Record ID.
	 * @param string     $attributes HTML attributes.
	 * @param bool|array $values     Optional values data array.
	 *
	 * @return string
	 */
	protected function parse_meta_data_field( $record_id, $attributes, $values = false ) {

		// Fill meta data if exists in $this->meta_data.
		$meta_data  = ( ! empty( $this->meta_data[ $record_id ] ) ) ? $this->meta_data[ $record_id ] : array();
		$meta_key   = WPSEO_Meta::$meta_prefix . $this->target_db_field;
		$meta_value = ( ! empty( $meta_data[ $meta_key ] ) ) ? $meta_data[ $meta_key ] : '';

		if ( ! empty( $values ) ) {
			$meta_value = $values[ $meta_value ];
		}

		return sprintf( '<td %2$s id="wpseo-existing-%4$s-%3$s">%1$s</td>', $meta_value, $attributes, $record_id, $this->target_db_field );
	}

	/**
	 * Method for setting the meta data, which belongs to the records that will be shown on the current page.
	 *
	 * This method will loop through the current items ($this->items) for getting the post_id. With this data
	 * ($needed_ids) the method will query the meta-data table for getting the title.
	 */
	protected function get_meta_data() {

		$post_ids  = $this->get_post_ids();
		$meta_data = $this->get_meta_data_result( $post_ids );

		$this->parse_meta_data( $meta_data );

		// Little housekeeping.
		unset( $post_ids, $meta_data );
	}

	/**
	 * Getting all post_ids from to $this->items.
	 *
	 * @return string
	 */
	protected function get_post_ids() {
		$needed_ids = array();
		foreach ( $this->items as $item ) {
			$needed_ids[] = $item->ID;
		}

		$post_ids = "'" . implode( "', '", $needed_ids ) . "'";

		return $post_ids;
	}

	/**
	 * Getting the meta_data from database.
	 *
	 * @param string $post_ids Post IDs string for SQL IN part.
	 *
	 * @return mixed
	 */
	protected function get_meta_data_result( $post_ids ) {
		global $wpdb;

		$meta_data = $wpdb->get_results(
			"
				 	SELECT *
				 	FROM {$wpdb->postmeta}
				 	WHERE post_id IN({$post_ids}) && meta_key = '" . WPSEO_Meta::$meta_prefix . $this->target_db_field . "'
				"
		);

		return $meta_data;
	}

	/**
	 * Setting $this->meta_data.
	 *
	 * @param array $meta_data Meta data set.
	 */
	protected function parse_meta_data( $meta_data ) {

		foreach ( $meta_data as $row ) {
			$this->meta_data[ $row->post_id ][ $row->meta_key ] = $row->meta_value;
		}
	}

	/**
	 * This method will merge general array with given parameter $columns.
	 *
	 * @param array $columns Optional columns set.
	 *
	 * @return array
	 */
	protected function merge_columns( $columns = array() ) {
		$columns = array_merge(
			array(
				'col_page_title'  => __( 'WP Page Title', 'wordpress-seo' ),
				'col_post_type'   => __( 'Content Type', 'wordpress-seo' ),
				'col_post_status' => __( 'Post Status', 'wordpress-seo' ),
				'col_post_date'   => __( 'Publication date', 'wordpress-seo' ),
				'col_page_slug'   => __( 'Page URL/Slug', 'wordpress-seo' ),
			),
			$columns
		);

		$columns['col_row_action'] = __( 'Action', 'wordpress-seo' );

		return $columns;
	}
} /* End of class */
PK     ”T]†×:<?'  ?'    class-yoast-plugin-conflict.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 * @since   1.7.0
 */

/**
 * Base class for handling plugin conflicts.
 */
class Yoast_Plugin_Conflict {

	/**
	 * The plugins must be grouped per section.
	 *
	 * It's possible to check for each section if there are conflicting plugins.
	 *
	 * @var array
	 */
	protected $plugins = array();

	/**
	 * All the current active plugins will be stored in this private var.
	 *
	 * @var array
	 */
	protected $all_active_plugins = array();

	/**
	 * After searching for active plugins that are in $this->plugins the active plugins will be stored in this
	 * property.
	 *
	 * @var array
	 */
	protected $active_plugins = array();

	/**
	 * Property for holding instance of itself.
	 *
	 * @var Yoast_Plugin_Conflict
	 */
	protected static $instance;

	/**
	 * For the use of singleton pattern. Create instance of itself and return this instance.
	 *
	 * @param string $class_name Give the classname to initialize. If classname is
	 *                           false (empty) it will use it's own __CLASS__.
	 *
	 * @return Yoast_Plugin_Conflict
	 */
	public static function get_instance( $class_name = '' ) {

		if ( is_null( self::$instance ) ) {
			if ( ! is_string( $class_name ) || $class_name === '' ) {
				$class_name = __CLASS__;
			}

			self::$instance = new $class_name();
		}

		return self::$instance;
	}

	/**
	 * Setting instance, all active plugins and search for active plugins.
	 *
	 * Protected constructor to prevent creating a new instance of the
	 * *Singleton* via the `new` operator from outside of this class.
	 */
	protected function __construct() {
		// Set active plugins.
		$this->all_active_plugins = get_option( 'active_plugins' );

		if ( filter_input( INPUT_GET, 'action' ) === 'deactivate' ) {
			$this->remove_deactivated_plugin();
		}

		// Search for active plugins.
		$this->search_active_plugins();
	}

	/**
	 * Check if there are conflicting plugins for given $plugin_section.
	 *
	 * @param string $plugin_section Type of plugin conflict (such as Open Graph or sitemap).
	 *
	 * @return bool
	 */
	public function check_for_conflicts( $plugin_section ) {

		static $sections_checked;

		if ( $sections_checked === null ) {
			$sections_checked = array();
		}

		if ( ! in_array( $plugin_section, $sections_checked, true ) ) {
			$sections_checked[] = $plugin_section;
			$has_conflicts      = ( ! empty( $this->active_plugins[ $plugin_section ] ) );

			return $has_conflicts;
		}

		return false;
	}

	/**
	 * Getting all the conflicting plugins and return them as a string.
	 *
	 * This method will loop through all conflicting plugins to get the details of each plugin. The plugin name
	 * will be taken from the details to parse a comma separated string, which can be use for by example a notice
	 *
	 * @param string $plugin_section Plugin conflict type (such as Open Graph or sitemap).
	 *
	 * @return string
	 */
	public function get_conflicting_plugins_as_string( $plugin_section ) {
		if ( ! function_exists( 'get_plugin_data' ) ) {
			require_once ABSPATH . 'wp-admin/includes/plugin.php';
		}

		// Getting the active plugins by given section.
		$plugins = $this->active_plugins[ $plugin_section ];

		$plugin_names = array();
		foreach ( $plugins as $plugin ) {
			$name = WPSEO_Utils::get_plugin_name( $plugin );
			if ( ! empty( $name ) ) {
				$plugin_names[] = '<em>' . $name . '</em>';
			}
		}
		unset( $plugins, $plugin );

		if ( ! empty( $plugin_names ) ) {
			return implode( ' &amp; ', $plugin_names );
		}
	}

	/**
	 * Checks for given $plugin_sections for conflicts.
	 *
	 * @param array $plugin_sections Set of sections.
	 */
	public function check_plugin_conflicts( $plugin_sections ) {
		foreach ( $plugin_sections as $plugin_section => $readable_plugin_section ) {
			// Check for conflicting plugins and show error if there are conflicts.
			if ( $this->check_for_conflicts( $plugin_section ) ) {
				$this->set_error( $plugin_section, $readable_plugin_section );
			}
		}

		// List of all active sections.
		$sections = array_keys( $plugin_sections );
		// List of all sections.
		$all_plugin_sections = array_keys( $this->plugins );

		/*
		 * Get all sections that are inactive.
		 * These plugins need to be cleared.
		 *
		 * This happens when Sitemaps or OpenGraph implementations toggle active/disabled.
		 */
		$inactive_sections = array_diff( $all_plugin_sections, $sections );
		if ( ! empty( $inactive_sections ) ) {
			foreach ( $inactive_sections as $section ) {
				array_walk( $this->plugins[ $section ], array( $this, 'clear_error' ) );
			}
		}

		// For active sections clear errors for inactive plugins.
		foreach ( $sections as $section ) {
			// By default clear errors for all plugins of the section.
			$inactive_plugins = $this->plugins[ $section ];

			// If there are active plugins, filter them from being cleared.
			if ( isset( $this->active_plugins[ $section ] ) ) {
				$inactive_plugins = array_diff( $this->plugins[ $section ], $this->active_plugins[ $section ] );
			}

			array_walk( $inactive_plugins, array( $this, 'clear_error' ) );
		}
	}

	/**
	 * Setting an error on the screen.
	 *
	 * @param string $plugin_section          Type of conflict group (such as Open Graph or sitemap).
	 * @param string $readable_plugin_section This is the value for the translation.
	 */
	protected function set_error( $plugin_section, $readable_plugin_section ) {

		$notification_center = Yoast_Notification_Center::get();

		foreach ( $this->active_plugins[ $plugin_section ] as $plugin_file ) {

			$plugin_name = WPSEO_Utils::get_plugin_name( $plugin_file );

			$error_message = '';
			/* translators: %1$s: 'Facebook & Open Graph' plugin name(s) of possibly conflicting plugin(s), %2$s to Yoast SEO */
			$error_message .= '<p>' . sprintf( __( 'The %1$s plugin might cause issues when used in conjunction with %2$s.', 'wordpress-seo' ), '<em>' . $plugin_name . '</em>', 'Yoast SEO' ) . '</p>';
			$error_message .= '<p>' . sprintf( $readable_plugin_section, 'Yoast SEO', $plugin_name ) . '</p>';

			/* translators: %s: 'Facebook' plugin name of possibly conflicting plugin */
			$error_message .= '<a class="button button-primary" href="' . wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=all', 'deactivate-plugin_' . $plugin_file ) . '">' . sprintf( __( 'Deactivate %s', 'wordpress-seo' ), WPSEO_Utils::get_plugin_name( $plugin_file ) ) . '</a> ';

			$identifier = $this->get_notification_identifier( $plugin_file );

			// Add the message to the notifications center.
			$notification_center->add_notification(
				new Yoast_Notification(
					$error_message,
					array(
						'type' => Yoast_Notification::ERROR,
						'id'   => 'wpseo-conflict-' . $identifier,
					)
				)
			);
		}
	}

	/**
	 * Clear the notification for a plugin.
	 *
	 * @param string $plugin_file Clear the optional notification for this plugin.
	 */
	public function clear_error( $plugin_file ) {
		$identifier = $this->get_notification_identifier( $plugin_file );

		$notification_center = Yoast_Notification_Center::get();
		$notification_center->remove_notification_by_id( 'wpseo-conflict-' . $identifier );
	}

	/**
	 * Loop through the $this->plugins to check if one of the plugins is active.
	 *
	 * This method will store the active plugins in $this->active_plugins.
	 */
	protected function search_active_plugins() {
		foreach ( $this->plugins as $plugin_section => $plugins ) {
			$this->check_plugins_active( $plugins, $plugin_section );
		}
	}

	/**
	 * Loop through plugins and check if each plugin is active.
	 *
	 * @param array  $plugins        Set of plugins.
	 * @param string $plugin_section Type of conflict group (such as Open Graph or sitemap).
	 */
	protected function check_plugins_active( $plugins, $plugin_section ) {
		foreach ( $plugins as $plugin ) {
			if ( $this->check_plugin_is_active( $plugin ) ) {
				$this->add_active_plugin( $plugin_section, $plugin );
			}
		}
	}

	/**
	 * Check if given plugin exists in array with all_active_plugins.
	 *
	 * @param string $plugin Plugin basename string.
	 *
	 * @return bool
	 */
	protected function check_plugin_is_active( $plugin ) {
		return in_array( $plugin, $this->all_active_plugins, true );
	}

	/**
	 * Add plugin to the list of active plugins.
	 *
	 * This method will check first if key $plugin_section exists, if not it will create an empty array
	 * If $plugin itself doesn't exist it will be added.
	 *
	 * @param string $plugin_section Type of conflict group (such as Open Graph or sitemap).
	 * @param string $plugin         Plugin basename string.
	 */
	protected function add_active_plugin( $plugin_section, $plugin ) {

		if ( ! array_key_exists( $plugin_section, $this->active_plugins ) ) {
			$this->active_plugins[ $plugin_section ] = array();
		}

		if ( ! in_array( $plugin, $this->active_plugins[ $plugin_section ], true ) ) {
			$this->active_plugins[ $plugin_section ][] = $plugin;
		}
	}

	/**
	 * Search in $this->plugins for the given $plugin.
	 *
	 * If there is a result it will return the plugin category.
	 *
	 * @param string $plugin Plugin basename string.
	 *
	 * @return int|string
	 */
	protected function find_plugin_category( $plugin ) {

		foreach ( $this->plugins as $plugin_section => $plugins ) {
			if ( in_array( $plugin, $plugins, true ) ) {
				return $plugin_section;
			}
		}
	}

	/**
	 * When being in the deactivation process the currently deactivated plugin has to be removed.
	 */
	private function remove_deactivated_plugin() {
		$deactivated_plugin = filter_input( INPUT_GET, 'plugin' );
		$key_to_remove      = array_search( $deactivated_plugin, $this->all_active_plugins, true );

		if ( $key_to_remove !== false ) {
			unset( $this->all_active_plugins[ $key_to_remove ] );
		}
	}

	/**
	 * Get the identifier from the plugin file.
	 *
	 * @param string $plugin_file Plugin file to get Identifier from.
	 *
	 * @return string
	 */
	private function get_notification_identifier( $plugin_file ) {
		return md5( $plugin_file );
	}
}
PK     ”T]ôhCôN  N  ,  class-bulk-description-editor-list-table.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Bulk Editor
 * @since   1.5.0
 */

/**
 * Implements table for bulk description editing.
 */
class WPSEO_Bulk_Description_List_Table extends WPSEO_Bulk_List_Table {

	/**
	 * Current type for this class will be (meta) description.
	 *
	 * @var string
	 */
	protected $page_type = 'description';

	/**
	 * Settings with are used in __construct.
	 *
	 * @var array
	 */
	protected $settings = array(
		'singular' => 'wpseo_bulk_description',
		'plural'   => 'wpseo_bulk_descriptions',
		'ajax'     => true,
	);

	/**
	 * The field in the database where meta field is saved.
	 *
	 * @var string
	 */
	protected $target_db_field = 'metadesc';

	/**
	 * The columns shown on the table.
	 *
	 * @return array
	 */
	public function get_columns() {
		$columns = array(
			'col_existing_yoast_seo_metadesc' => __( 'Existing Yoast Meta Description', 'wordpress-seo' ),
			'col_new_yoast_seo_metadesc'      => __( 'New Yoast Meta Description', 'wordpress-seo' ),
		);

		return $this->merge_columns( $columns );
	}

	/**
	 * Parse the metadescription.
	 *
	 * @param string $column_name Column name.
	 * @param object $record      Data object.
	 * @param string $attributes  HTML attributes.
	 *
	 * @return string
	 */
	protected function parse_page_specific_column( $column_name, $record, $attributes ) {
		switch ( $column_name ) {
			case 'col_new_yoast_seo_metadesc':
				return sprintf(
					'<textarea id="%1$s" name="%1$s" class="wpseo-new-metadesc" data-id="%2$s" aria-labelledby="col_new_yoast_seo_metadesc"></textarea>',
					esc_attr( 'wpseo-new-metadesc-' . $record->ID ),
					esc_attr( $record->ID )
				);

			case 'col_existing_yoast_seo_metadesc':
				// @todo Inconsistent return/echo behavior R.
				echo $this->parse_meta_data_field( $record->ID, $attributes );
				break;
		}
	}
} /* End of class */
PK     ”T]o ÔÃË  Ë  '  tracking/class-tracking-plugin-data.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Tracking
 */

/**
 * Represents the plugin data.
 */
class WPSEO_Tracking_Plugin_Data implements WPSEO_Collection {

	/**
	 * Returns the collection data.
	 *
	 * @return array The collection data.
	 */
	public function get() {
		return array(
			'plugins' => $this->get_plugin_data(),
		);
	}

	/**
	 * Returns all plugins.
	 *
	 * @return array The formatted plugins.
	 */
	protected function get_plugin_data() {

		if ( ! function_exists( 'get_plugin_data' ) ) {
			require_once ABSPATH . 'wp-admin/includes/plugin.php';
		}

		$plugins = wp_get_active_and_valid_plugins();
		$plugins = array_map( 'get_plugin_data', $plugins );
		$plugins = array_map( array( $this, 'format_plugin' ), $plugins );

		return $plugins;
	}

	/**
	 * Formats the plugin array.
	 *
	 * @param array $plugin The plugin details.
	 *
	 * @return array The formatted array.
	 */
	protected function format_plugin( array $plugin ) {
		return array(
			'name'    => $plugin['Name'],
			'url'     => $plugin['PluginURI'],
			'version' => $plugin['Version'],
			'author'  => array(
				'name' => wp_strip_all_tags( $plugin['Author'], true ),
				'url'  => $plugin['AuthorURI'],
			),
		);
	}
}
PK     ”T]¼ÃsÙý  ý    tracking/class-tracking.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Tracking
 */

/**
 * This class handles the tracking routine.
 */
class WPSEO_Tracking {

	/**
	 * @var string
	 */
	protected $option_name = 'wpseo_tracking_last_request';

	/**
	 * @var int
	 */
	protected $threshold = 0;

	/**
	 * @var string
	 */
	protected $endpoint = '';

	/**
	 * Constructor setting the threshold.
	 *
	 * @param string $endpoint  The endpoint to send the data to.
	 * @param int    $threshold The limit for the option.
	 */
	public function __construct( $endpoint, $threshold ) {
		$this->endpoint  = $endpoint;
		$this->threshold = $threshold;
	}

	/**
	 * Registers all hooks to WordPress.
	 */
	public function send() {

		$current_time = time();
		if ( ! $this->should_send_tracking( $current_time ) ) {
			return;
		}

		$collector = $this->get_collector();

		$request = new WPSEO_Remote_Request( $this->endpoint );
		$request->set_body( $collector->get_as_json() );
		$request->send();

		update_option( $this->option_name, $current_time, 'yes' );
	}

	/**
	 * Returns true when last tracking data was send more than two weeks ago.
	 *
	 * @param int $current_time The current timestamp.
	 *
	 * @return bool True when tracking data should be send.
	 */
	protected function should_send_tracking( $current_time ) {
		$last_time = get_option( $this->option_name );

		// When there is no data being set.
		if ( ! $last_time ) {
			return true;
		}

		return $this->exceeds_treshhold( $current_time - $last_time );
	}

	/**
	 * Checks if the given amount of seconds exceeds the set threshold.
	 *
	 * @param int $seconds The amount of seconds to check.
	 *
	 * @return bool True when seconds is bigger than threshold.
	 */
	protected function exceeds_treshhold( $seconds ) {
		return ( $seconds > $this->threshold );
	}

	/**
	 * Returns the collector for collecting the data.
	 *
	 * @return WPSEO_Collector The instance of the collector.
	 */
	protected function get_collector() {
		$collector = new WPSEO_Collector();
		$collector->add_collection( new WPSEO_Tracking_Default_Data() );
		$collector->add_collection( new WPSEO_Tracking_Server_Data() );
		$collector->add_collection( new WPSEO_Tracking_Theme_Data() );
		$collector->add_collection( new WPSEO_Tracking_Plugin_Data() );

		return $collector;
	}
}
PK     ”T]Œ9iš  š  '  tracking/class-tracking-server-data.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Tracking
 */

/**
 * Represents the server data.
 */
class WPSEO_Tracking_Server_Data implements WPSEO_Collection {

	/**
	 * Returns the collection data.
	 *
	 * @return array The collection data.
	 */
	public function get() {
		return array(
			'server' => $this->get_server_data(),
		);
	}

	/**
	 * Returns the values with server details.
	 *
	 * @return array Array with the value.
	 */
	protected function get_server_data() {
		$server_data = array();

		// Validate if the server address is a valid IP-address.
		$ipaddress = filter_input( INPUT_SERVER, 'SERVER_ADDR', FILTER_VALIDATE_IP );
		if ( $ipaddress ) {
			$server_data['ip']       = $ipaddress;
			$server_data['Hostname'] = gethostbyaddr( $ipaddress );
		}

		$server_data['os']            = php_uname();
		$server_data['PhpVersion']    = PHP_VERSION;
		$server_data['CurlVersion']   = $this->get_curl_info();
		$server_data['PhpExtensions'] = $this->get_php_extensions();

		return $server_data;
	}

	/**
	 * Returns details about the curl version.
	 *
	 * @return array|null The curl info. Or null when curl isn't available..
	 */
	protected function get_curl_info() {
		if ( ! function_exists( 'curl_version' ) ) {
			return null;
		}

		$curl = curl_version();

		$ssl_support = true;
		if ( ! $curl['features'] && CURL_VERSION_SSL ) {
			$ssl_support = false;
		}

		return array(
			'version'    => $curl['version'],
			'sslSupport' => $ssl_support,
		);
	}

	/**
	 * Returns a list with php extensions.
	 *
	 * @return array Returns the state of the php extensions.
	 */
	protected function get_php_extensions() {
		return array(
			'imagick' => extension_loaded( 'imagick' ),
			'filter'  => extension_loaded( 'filter' ),
			'bcmath'  => extension_loaded( 'bcmath' ),
			'modXml'  => extension_loaded( 'modXml' ),
			'pcre'    => extension_loaded( 'pcre' ),
			'xml'     => extension_loaded( 'xml' ),
		);
	}
}
PK     ”T]kÿ›¦ß  ß  &  tracking/class-tracking-theme-data.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Tracking
 */

/**
 * Represents the theme data.
 */
class WPSEO_Tracking_Theme_Data implements WPSEO_Collection {

	/**
	 * Returns the collection data.
	 *
	 * @return array The collection data.
	 */
	public function get() {
		$theme = wp_get_theme();

		return array(
			'theme' => array(
				'name'        => $theme->get( 'Name' ),
				'url'         => $theme->get( 'ThemeURI' ),
				'version'     => $theme->get( 'Version' ),
				'author'      => array(
					'name' => $theme->get( 'Author' ),
					'url'  => $theme->get( 'AuthorURI' ),
				),
				'parentTheme' => $this->get_parent_theme( $theme ),
			),
		);
	}

	/**
	 * Returns the name of the parent theme.
	 *
	 * @param WP_Theme $theme The theme object.
	 *
	 * @return null|string The name of the parent theme or null.
	 */
	private function get_parent_theme( WP_Theme $theme ) {
		if ( is_child_theme() ) {
			return $theme->get( 'Template' );
		}

		return null;
	}
}
PK     ”T]�SÊ‰í   í     tracking/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]®´÷    (  tracking/class-tracking-default-data.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Tracking
 */

/**
 * Represents the default data.
 */
class WPSEO_Tracking_Default_Data implements WPSEO_Collection {

	/**
	 * Returns the collection data.
	 *
	 * @return array The collection data.
	 */
	public function get() {
		return array(
			'siteTitle'    => get_option( 'blogname' ),
			'@timestamp'   => (int) date( 'Uv' ),
			'wpVersion'    => $this->get_wordpress_version(),
			'homeURL'      => home_url(),
			'adminURL'     => admin_url(),
			'isMultisite'  => is_multisite(),
			'siteLanguage' => get_bloginfo( 'language' ),
		);
	}

	/**
	 * Returns the WordPress version.
	 *
	 * @return string The version.
	 */
	protected function get_wordpress_version() {
		global $wp_version;

		return $wp_version;
	}
}
PK     ”T]�”¶(Þ  Þ    class-extension-manager.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents the class that contains the available extensions for Yoast SEO.
 */
class WPSEO_Extension_Manager {

	/**
	 * The transient key to save the cache in.
	 *
	 * @var string
	 */
	const TRANSIENT_CACHE_KEY = 'wpseo_license_active_extensions';

	/**
	 * @var WPSEO_Extension[]
	 */
	protected $extensions = array();

	/**
	 * List of active plugins.
	 *
	 * @var array
	 */
	protected static $active_extensions;

	/**
	 * Adds an extension to the manager.
	 *
	 * @param string          $extension_name The extension name.
	 * @param WPSEO_Extension $extension      The extension value object.
	 *
	 * @return void
	 */
	public function add( $extension_name, WPSEO_Extension $extension = null ) {
		$this->extensions[ $extension_name ] = $extension;
	}

	/**
	 * Removes an extension from the manager.
	 *
	 * @param string $extension_name The name of the extension to remove.
	 *
	 * @return void
	 */
	public function remove( $extension_name ) {
		if ( array_key_exists( $extension_name, $this->extensions ) ) {
			unset( $this->extensions[ $extension_name ] );
		}
	}

	/**
	 * Returns the extension for the given extension name.
	 *
	 * @param string $extension_name The name of the extension to get.
	 *
	 * @return null|WPSEO_Extension The extension object or null when it doesn't exist.
	 */
	public function get( $extension_name ) {
		if ( array_key_exists( $extension_name, $this->extensions ) ) {
			return $this->extensions[ $extension_name ];
		}

		return null;
	}

	/**
	 * Returns all set extension.
	 *
	 * @return WPSEO_Extension[] Array with the extensions.
	 */
	public function get_all() {
		return $this->extensions;
	}

	/**
	 * Checks if the plugin is activated within My Yoast.
	 *
	 * @param string $extension_name The extension name to check.
	 *
	 * @return bool True when the plugin is activated.
	 */
	public function is_activated( $extension_name ) {
		if ( self::$active_extensions === null ) {
			// Force re-check on license & dashboard pages.
			$current_page = $this->get_current_page();

			// Check whether the licenses are valid or whether we need to show notifications.
			$exclude_cache = ( $current_page === 'wpseo_licenses' || $current_page === 'wpseo_dashboard' );

			// Fetch transient data on any other page.
			if ( ! $exclude_cache ) {
				self::$active_extensions = $this->get_cached_extensions();
			}

			// If the active extensions is still NULL, we need to set it.
			if ( ! is_array( self::$active_extensions ) ) {
				self::$active_extensions = $this->retrieve_active_extensions();

				$this->set_cached_extensions( self::$active_extensions );
			}
		}

		return in_array( $extension_name, self::$active_extensions, true );
	}

	/**
	 * Retrieves the active extensions via an external request.
	 *
	 * @return array Array containing the active extensions.
	 */
	protected function retrieve_active_extensions() {
		return (array) apply_filters( 'yoast-active-extensions', array() );
	}

	/**
	 * Returns the current page.
	 *
	 * @return string The current page.
	 */
	protected function get_current_page() {
		return filter_input( INPUT_GET, 'page' );
	}

	/**
	 * Gets a cached list of active extensions.
	 *
	 * @return boolean|array The cached extensions.
	 */
	protected function get_cached_extensions() {
		return get_transient( self::TRANSIENT_CACHE_KEY );
	}

	/**
	 * Sets the active extensions transient for the set duration.
	 *
	 * @param array $extensions The extensions to add.
	 * @param int   $duration   The duration that the list of extensions needs to remain cached.
	 *
	 * @return void
	 */
	protected function set_cached_extensions( $extensions, $duration = DAY_IN_SECONDS ) {
		set_transient( self::TRANSIENT_CACHE_KEY, $extensions, $duration );
	}
}
PK     ”T]«%T”Á  Á    class-expose-shortlinks.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Exposes shortlinks in a global, so that we can pass them to our Javascript components.
 */
class WPSEO_Expose_Shortlinks implements WPSEO_WordPress_Integration {

	/**
	 * Array containing the keys and shortlinks.
	 *
	 * @var array
	 */
	private $shortlinks = array(
		'shortlinks.focus_keyword_info'                             => 'https://yoa.st/focus-keyword',
		'shortlinks.snippet_preview_info'                           => 'https://yoa.st/snippet-preview',
		'shortlinks.cornerstone_content_info'                       => 'https://yoa.st/1i9',
		'shortlinks.upsell.sidebar.focus_keyword_synonyms_link'     => 'https://yoa.st/textlink-synonyms-popup-sidebar',
		'shortlinks.upsell.sidebar.focus_keyword_synonyms_button'   => 'https://yoa.st/keyword-synonyms-popup-sidebar',
		'shortlinks.upsell.sidebar.focus_keyword_additional_link'   => 'https://yoa.st/textlink-keywords-popup-sidebar',
		'shortlinks.upsell.sidebar.focus_keyword_additional_button' => 'https://yoa.st/add-keywords-popup-sidebar',
		'shortlinks.upsell.sidebar.additional_link'                 => 'https://yoa.st/textlink-keywords-sidebar',
		'shortlinks.upsell.sidebar.additional_button'               => 'https://yoa.st/add-keywords-sidebar',
		'shortlinks.upsell.metabox.go_premium'                      => 'https://yoa.st/pe-premium-page',
		'shortlinks.upsell.metabox.focus_keyword_synonyms_link'     => 'https://yoa.st/textlink-synonyms-popup-metabox',
		'shortlinks.upsell.metabox.focus_keyword_synonyms_button'   => 'https://yoa.st/keyword-synonyms-popup',
		'shortlinks.upsell.metabox.focus_keyword_additional_link'   => 'https://yoa.st/textlink-keywords-popup-metabox',
		'shortlinks.upsell.metabox.focus_keyword_additional_button' => 'https://yoa.st/add-keywords-popup',
		'shortlinks.upsell.metabox.additional_link'                 => 'https://yoa.st/textlink-keywords-metabox',
		'shortlinks.upsell.metabox.additional_button'               => 'https://yoa.st/add-keywords-metabox',
		'shortlinks.upsell.gsc.create_redirect_button'              => 'https://yoa.st/redirects',
		'shortlinks.readability_analysis_info'                      => 'https://yoa.st/readability-analysis',
		'shortlinks.activate_premium_info'                          => 'https://yoa.st/activate-subscription',
		'shortlinks.upsell.sidebar.morphology_upsell_metabox'       => 'https://yoa.st/morphology-upsell-metabox',
		'shortlinks.upsell.sidebar.morphology_upsell_sidebar'       => 'https://yoa.st/morphology-upsell-sidebar',
	);

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_filter( 'wpseo_admin_l10n', array( $this, 'expose_shortlinks' ) );
	}

	/**
	 * Adds shortlinks to the passed array.
	 *
	 * @param array $input The array to add shortlinks to.
	 *
	 * @return array The passed array with the additional shortlinks.
	 */
	public function expose_shortlinks( $input ) {
		foreach ( $this->get_shortlinks() as $key => $shortlink ) {
			$input[ $key ] = WPSEO_Shortlinker::get( $shortlink );
		}

		$input['default_query_params'] = WPSEO_Shortlinker::get_query_params();

		return $input;
	}

	/**
	 * Retrieves the shortlinks.
	 *
	 * @return array The shortlinks.
	 */
	private function get_shortlinks() {
		if ( ! $this->is_term_edit() ) {
			return $this->shortlinks;
		}

		$shortlinks = $this->shortlinks;

		$shortlinks['shortlinks.upsell.metabox.focus_keyword_synonyms_link']     = 'https://yoa.st/textlink-synonyms-popup-metabox-term';
		$shortlinks['shortlinks.upsell.metabox.focus_keyword_synonyms_button']   = 'https://yoa.st/keyword-synonyms-popup-term';
		$shortlinks['shortlinks.upsell.metabox.focus_keyword_additional_link']   = 'https://yoa.st/textlink-keywords-popup-metabox-term';
		$shortlinks['shortlinks.upsell.metabox.focus_keyword_additional_button'] = 'https://yoa.st/add-keywords-popup-term';
		$shortlinks['shortlinks.upsell.metabox.additional_link']                 = 'https://yoa.st/textlink-keywords-metabox-term';
		$shortlinks['shortlinks.upsell.metabox.additional_button']               = 'https://yoa.st/add-keywords-metabox-term';
		$shortlinks['shortlinks.upsell.sidebar.morphology_upsell_metabox']       = 'https://yoa.st/morphology-upsell-metabox-term';

		return $shortlinks;
	}

	/**
	 * Checks if the current page is a term edit page.
	 *
	 * @return bool True when page is term edit.
	 */
	private function is_term_edit() {
		global $pagenow;

		return WPSEO_Taxonomy::is_term_edit( $pagenow );
	}
}
PK     ”T]&#(ö  ö  !  class-multiple-keywords-modal.phpnu „[µü¤        <?php
/**
 * @package WPSEO\Admin
 */

/**
 * Class to print out the translatable strings for the Multiple Keywords modal.
 */
class WPSEO_Multiple_Keywords_Modal {

	/**
	 * Returns the translations for the Multiple Keywords modal.
	 *
	 * These strings are not escaped because they're meant to be used with React
	 * which already takes care of that. If used in PHP, they should be escaped.
	 *
	 * @return array Translated text strings for the Multiple Keywords modal.
	 */
	public function get_translations() {
		return array(
			'title'                    => __( 'Would you like to add another keyphrase?', 'wordpress-seo' ),
			'intro'                    => sprintf(
				/* translators: %s expands to a 'Yoast SEO Premium' text linked to the yoast.com website. */
				__( 'Great news: you can, with %s!', 'wordpress-seo' ),
				'{{link}}Yoast SEO Premium{{/link}}'
			),
			'link'                     => WPSEO_Shortlinker::get( 'https://yoa.st/pe-premium-page' ),
			'other'                    => sprintf(
				/* translators: %s expands to 'Yoast SEO Premium'. */
				__( 'Other benefits of %s for you:', 'wordpress-seo' ),
				'Yoast SEO Premium'
			),
			'buylink'                  => WPSEO_Shortlinker::get( 'https://yoa.st/add-keywords-popup' ),
			'buy'                      => sprintf(
				/* translators: %s expands to 'Yoast SEO Premium'. */
				__( 'Get %s', 'wordpress-seo' ),
				'Yoast SEO Premium'
			),
			'small'                    => __( '1 year free support and updates included!', 'wordpress-seo' ),
			'a11yNotice.opensInNewTab' => __( '(Opens in a new browser tab)', 'wordpress-seo' ),
		);
	}

	/**
	 * Passes translations to JS for the Multiple Keywords modal component.
	 *
	 * @return array Translated text strings for the Multiple Keywords modal component.
	 */
	public function get_translations_for_js() {
		$translations = $this->get_translations();

		return array(
			'locale' => WPSEO_Language_Utils::get_user_locale(),
			'intl'   => $translations,
		);
	}

	/**
	 * Prints the localized Multiple Keywords modal translations for JS.
	 *
	 * @return void
	 */
	public function enqueue_translations() {
		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-global-script', 'yoastMultipleKeywordsModalL10n', $this->get_translations_for_js() );
	}
}
PK     ”T]3O¼Í*  *  &  class-bulk-title-editor-list-table.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Bulk Editor
 * @since   1.5.0
 */

/**
 * Implements table for bulk title editing.
 */
class WPSEO_Bulk_Title_Editor_List_Table extends WPSEO_Bulk_List_Table {

	/**
	 * Current type for this class will be title.
	 *
	 * @var string
	 */
	protected $page_type = 'title';


	/**
	 * Settings with are used in __construct.
	 *
	 * @var array
	 */
	protected $settings = array(
		'singular' => 'wpseo_bulk_title',
		'plural'   => 'wpseo_bulk_titles',
		'ajax'     => true,
	);

	/**
	 * The field in the database where meta field is saved.
	 *
	 * @var string
	 */
	protected $target_db_field = 'title';

	/**
	 * The columns shown on the table.
	 *
	 * @return array
	 */
	public function get_columns() {

		$columns = array(
			/* translators: %1$s expands to Yoast SEO */
			'col_existing_yoast_seo_title' => sprintf( __( 'Existing %1$s Title', 'wordpress-seo' ), 'Yoast SEO' ),
			/* translators: %1$s expands to Yoast SEO */
			'col_new_yoast_seo_title'      => sprintf( __( 'New %1$s Title', 'wordpress-seo' ), 'Yoast SEO' ),
		);

		return $this->merge_columns( $columns );
	}

	/**
	 * Parse the title columns.
	 *
	 * @param string $column_name Column name.
	 * @param object $record      Data object.
	 * @param string $attributes  HTML attributes.
	 *
	 * @return string
	 */
	protected function parse_page_specific_column( $column_name, $record, $attributes ) {

		// Fill meta data if exists in $this->meta_data.
		$meta_data = ( ! empty( $this->meta_data[ $record->ID ] ) ) ? $this->meta_data[ $record->ID ] : array();

		switch ( $column_name ) {
			case 'col_existing_yoast_seo_title':
				// @todo Inconsistent echo/return behavior R.
				echo $this->parse_meta_data_field( $record->ID, $attributes );
				break;

			case 'col_new_yoast_seo_title':
				return sprintf(
					'<input type="text" id="%1$s" name="%1$s" class="wpseo-new-title" data-id="%2$s" aria-labelledby="col_new_yoast_seo_title" />',
					'wpseo-new-title-' . $record->ID,
					$record->ID
				);
		}

		unset( $meta_data );
	}
} /* End of class */
PK     ”T]±å+Òó  ó     class-keyword-synonyms-modal.phpnu „[µü¤        <?php
/**
 * @package WPSEO\Admin
 */

/**
 * Class to print out the translatable strings for the Keyword Synonyms modal.
 */
class WPSEO_Keyword_Synonyms_Modal {

	/**
	 * Returns the translations for the Keyword Synonyms modal.
	 *
	 * These strings are not escaped because they're meant to be used with React
	 * which already takes care of that. If used in PHP, they should be escaped.
	 *
	 * @return array Translated text strings for the Keyword Synonyms modal.
	 */
	public function get_translations() {
		return array(
			'title'                    => __( 'Would you like to add keyphrase synonyms?', 'wordpress-seo' ),
			'intro'                    => sprintf(
				/* translators: %s expands to a 'Yoast SEO Premium' text linked to the yoast.com website. */
				__( 'Great news: you can, with %s!', 'wordpress-seo' ),
				'{{link}}Yoast SEO Premium{{/link}}'
			),
			'link'                     => WPSEO_Shortlinker::get( 'https://yoa.st/pe-premium-page' ),
			'other'                    => sprintf(
				/* translators: %s expands to 'Yoast SEO Premium'. */
				__( 'Other benefits of %s for you:', 'wordpress-seo' ),
				'Yoast SEO Premium'
			),
			'buylink'                  => WPSEO_Shortlinker::get( 'https://yoa.st/keyword-synonyms-popup' ),
			'buy'                      => sprintf(
				/* translators: %s expands to 'Yoast SEO Premium'. */
				__( 'Get %s', 'wordpress-seo' ),
				'Yoast SEO Premium'
			),
			'small'                    => __( '1 year free support and updates included!', 'wordpress-seo' ),
			'a11yNotice.opensInNewTab' => __( '(Opens in a new browser tab)', 'wordpress-seo' ),
		);
	}

	/**
	 * Passes translations to JS for the Keyword Synonyms modal component.
	 *
	 * @return array Translated text strings for the Keyword Synonyms modal component.
	 */
	public function get_translations_for_js() {
		$translations = $this->get_translations();

		return array(
			'locale' => WPSEO_Language_Utils::get_user_locale(),
			'intl'   => $translations,
		);
	}

	/**
	 * Prints the localized Keyword Synonyms modal translations for JS.
	 *
	 * @return void
	 */
	public function enqueue_translations() {
		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-global-script', 'yoastKeywordSynonymsModalL10n', $this->get_translations_for_js() );
	}
}
PK     ”T]VE"Ÿ%	  %	    class-admin-help-panel.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Generates the HTML for an inline Help Button and Panel.
 */
class WPSEO_Admin_Help_Panel {

	/**
	 * @var string
	 */
	private $id;

	/**
	 * @var string
	 */
	private $help_button_text;

	/**
	 * @var string
	 */
	private $help_content;

	/**
	 * @var string
	 */
	private $wrapper;

	/**
	 * Constructor.
	 *
	 * @param string $id                Unique identifier of the element the inline help refers to, used as an identifier in the html.
	 * @param string $help_button_text  The Help Button text. Needs a properly escaped string.
	 * @param string $help_content      The Help Panel content. Needs a properly escaped string (might contain HTML).
	 * @param string $wrapper           Optional Whether to print out a container div element for the Help Panel, used for styling.
	 *                                  Pass a `has-wrapper` value to print out the container. Default: no container.
	 */
	public function __construct( $id, $help_button_text, $help_content, $wrapper = '' ) {
		$this->id               = $id;
		$this->help_button_text = $help_button_text;
		$this->help_content     = $help_content;
		$this->wrapper          = $wrapper;
	}

	/**
	 * Returns the html for the Help Button.
	 *
	 * @return string
	 */
	public function get_button_html() {

		if ( ! $this->id || ! $this->help_button_text || ! $this->help_content ) {
			return '';
		}

		return sprintf(
			' <button type="button" class="yoast_help yoast-help-button dashicons" id="%1$s-help-toggle" aria-expanded="false" aria-controls="%1$s-help"><span class="yoast-help-icon" aria-hidden="true"></span><span class="screen-reader-text">%2$s</span></button>',
			esc_attr( $this->id ),
			$this->help_button_text
		);
	}

	/**
	 * Returns the html for the Help Panel.
	 *
	 * @return string
	 */
	public function get_panel_html() {

		if ( ! $this->id || ! $this->help_button_text || ! $this->help_content ) {
			return '';
		}

		$wrapper_start = '';
		$wrapper_end   = '';

		if ( 'has-wrapper' === $this->wrapper ) {
			$wrapper_start = '<div class="yoast-seo-help-container">';
			$wrapper_end   = '</div>';
		}

		return sprintf(
			'%1$s<p id="%2$s-help" class="yoast-help-panel">%3$s</p>%4$s',
			$wrapper_start,
			esc_attr( $this->id ),
			$this->help_content,
			$wrapper_end
		);
	}
}
PK     ”T]Ã7$~8  ~8    class-admin.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class that holds most of the admin functionality for Yoast SEO.
 */
class WPSEO_Admin {
	/**
	 * The page identifier used in WordPress to register the admin page.
	 *
	 * !DO NOT CHANGE THIS!
	 *
	 * @var string
	 */
	const PAGE_IDENTIFIER = 'wpseo_dashboard';
	/**
	 * Array of classes that add admin functionality.
	 *
	 * @var array
	 */
	protected $admin_features;

	/**
	 * Class constructor.
	 */
	public function __construct() {
		$integrations = array();

		global $pagenow;

		$wpseo_menu = new WPSEO_Menu();
		$wpseo_menu->register_hooks();

		if ( is_multisite() ) {
			WPSEO_Options::maybe_set_multisite_defaults( false );
		}

		if ( WPSEO_Options::get( 'stripcategorybase' ) === true ) {
			add_action( 'created_category', array( $this, 'schedule_rewrite_flush' ) );
			add_action( 'edited_category', array( $this, 'schedule_rewrite_flush' ) );
			add_action( 'delete_category', array( $this, 'schedule_rewrite_flush' ) );
		}

		if ( WPSEO_Options::get( 'disable-attachment' ) === true ) {
			add_filter( 'wpseo_accessible_post_types', array( 'WPSEO_Post_Type', 'filter_attachment_post_type' ) );
		}

		if ( filter_input( INPUT_GET, 'page' ) === 'wpseo_tools' && filter_input( INPUT_GET, 'tool' ) === null ) {
			new WPSEO_Recalculate_Scores();
		}

		add_filter( 'plugin_action_links_' . WPSEO_BASENAME, array( $this, 'add_action_link' ), 10, 2 );

		add_action( 'admin_enqueue_scripts', array( $this, 'config_page_scripts' ) );
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_global_style' ) );

		add_filter( 'user_contactmethods', array( $this, 'update_contactmethods' ), 10, 1 );

		add_action( 'after_switch_theme', array( $this, 'switch_theme' ) );
		add_action( 'switch_theme', array( $this, 'switch_theme' ) );

		add_filter( 'set-screen-option', array( $this, 'save_bulk_edit_options' ), 10, 3 );

		add_action( 'admin_init', array( 'WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts' ), 10, 1 );

		add_action( 'admin_init', array( $this, 'map_manage_options_cap' ) );

		WPSEO_Sitemaps_Cache::register_clear_on_option_update( 'wpseo' );
		WPSEO_Sitemaps_Cache::register_clear_on_option_update( 'home' );

		if ( WPSEO_Utils::is_yoast_seo_page() ) {
			add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
		}

		if ( WPSEO_Utils::is_api_available() ) {
			$configuration = new WPSEO_Configuration_Page();
			$configuration->set_hooks();
			$configuration->catch_configuration_request();
		}

		$this->set_upsell_notice();

		$this->initialize_cornerstone_content();

		if ( WPSEO_Utils::is_plugin_network_active() ) {
			$integrations[] = new Yoast_Network_Admin();
		}

		$this->admin_features = array(
			'google_search_console' => new WPSEO_GSC(),
			'dashboard_widget'      => new Yoast_Dashboard_Widget(),
		);

		if ( WPSEO_Metabox::is_post_overview( $pagenow ) || WPSEO_Metabox::is_post_edit( $pagenow ) ) {
			$this->admin_features['primary_category'] = new WPSEO_Primary_Term_Admin();
		}

		$integrations[] = new WPSEO_Yoast_Columns();
		$integrations[] = new WPSEO_License_Page_Manager();
		$integrations[] = new WPSEO_Statistic_Integration();
		$integrations[] = new WPSEO_Capability_Manager_Integration( WPSEO_Capability_Manager_Factory::get() );
		$integrations[] = new WPSEO_Admin_Media_Purge_Notification();
		$integrations[] = new WPSEO_Admin_Gutenberg_Compatibility_Notification();
		$integrations[] = new WPSEO_Expose_Shortlinks();
		$integrations[] = new WPSEO_MyYoast_Proxy();
		$integrations[] = new WPSEO_MyYoast_Route();
		$integrations[] = new WPSEO_Schema_Person_Upgrade_Notification();

		$integrations = array_merge(
			$integrations,
			$this->get_admin_features(),
			$this->initialize_seo_links(),
			$this->initialize_cornerstone_content()
		);

		/** @var WPSEO_WordPress_Integration $integration */
		foreach ( $integrations as $integration ) {
			$integration->register_hooks();
		}
	}

	/**
	 * Schedules a rewrite flush to happen at shutdown.
	 */
	public function schedule_rewrite_flush() {
		add_action( 'shutdown', 'flush_rewrite_rules' );
	}

	/**
	 * Returns all the classes for the admin features.
	 *
	 * @return array
	 */
	public function get_admin_features() {
		return $this->admin_features;
	}

	/**
	 * Register assets needed on admin pages.
	 */
	public function enqueue_assets() {
		if ( 'wpseo_licenses' === filter_input( INPUT_GET, 'page' ) ) {
			$asset_manager = new WPSEO_Admin_Asset_Manager();
			$asset_manager->enqueue_style( 'extensions' );
		}
	}

	/**
	 * Returns the manage_options capability.
	 *
	 * @return string The capability to use.
	 */
	public function get_manage_options_cap() {
		/**
		 * Filter: 'wpseo_manage_options_capability' - Allow changing the capability users need to view the settings pages.
		 *
		 * @api string unsigned The capability.
		 */
		return apply_filters( 'wpseo_manage_options_capability', 'wpseo_manage_options' );
	}

	/**
	 * Maps the manage_options cap on saving an options page to wpseo_manage_options.
	 */
	public function map_manage_options_cap() {
		$option_page = ! empty( $_POST['option_page'] ) ? $_POST['option_page'] : ''; // WPCS: CSRF ok.

		if ( strpos( $option_page, 'yoast_wpseo' ) === 0 ) {
			add_filter( 'option_page_capability_' . $option_page, array( $this, 'get_manage_options_cap' ) );
		}
	}

	/**
	 * Adds the ability to choose how many posts are displayed per page
	 * on the bulk edit pages.
	 */
	public function bulk_edit_options() {
		$option = 'per_page';
		$args   = array(
			'label'   => __( 'Posts', 'wordpress-seo' ),
			'default' => 10,
			'option'  => 'wpseo_posts_per_page',
		);
		add_screen_option( $option, $args );
	}

	/**
	 * Saves the posts per page limit for bulk edit pages.
	 *
	 * @param int    $status Status value to pass through.
	 * @param string $option Option name.
	 * @param int    $value  Count value to check.
	 *
	 * @return int
	 */
	public function save_bulk_edit_options( $status, $option, $value ) {
		if ( 'wpseo_posts_per_page' === $option && ( $value > 0 && $value < 1000 ) ) {
			return $value;
		}

		return $status;
	}

	/**
	 * Adds links to Premium Support and FAQ under the plugin in the plugin overview page.
	 *
	 * @staticvar string $this_plugin Holds the directory & filename for the plugin.
	 *
	 * @param array  $links Array of links for the plugins, adapted when the current plugin is found.
	 * @param string $file  The filename for the current plugin, which the filter loops through.
	 *
	 * @return array $links
	 */
	public function add_action_link( $links, $file ) {
		if ( WPSEO_BASENAME === $file && WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) ) {
			$settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=' . self::PAGE_IDENTIFIER ) ) . '">' . __( 'Settings', 'wordpress-seo' ) . '</a>';
			array_unshift( $links, $settings_link );
		}

		$addon_manager = new WPSEO_Addon_Manager();
		if ( WPSEO_Utils::is_yoast_seo_premium() && $addon_manager->has_valid_subscription( WPSEO_Addon_Manager::PREMIUM_SLUG ) ) {
			return $links;
		}

		// Add link to premium support landing page.
		$premium_link = '<a style="font-weight: bold;" href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/1yb' ) ) . '" target="_blank">' . __( 'Premium Support', 'wordpress-seo' ) . '</a>';
		array_unshift( $links, $premium_link );

		// Add link to docs.
		$faq_link = '<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/1yc' ) ) . '" target="_blank">' . __( 'FAQ', 'wordpress-seo' ) . '</a>';
		array_unshift( $links, $faq_link );

		return $links;
	}

	/**
	 * Enqueues the (tiny) global JS needed for the plugin.
	 */
	public function config_page_scripts() {
		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_script( 'admin-global-script' );

		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-global-script', 'wpseoAdminGlobalL10n', $this->localize_admin_global_script() );
	}

	/**
	 * Enqueues the (tiny) global stylesheet needed for the plugin.
	 */
	public function enqueue_global_style() {
		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_style( 'admin-global' );
	}

	/**
	 * Filter the $contactmethods array and add a set of social profiles.
	 *
	 * These are used with the Facebook author, rel="author" and Twitter cards implementation.
	 *
	 * @link https://developers.google.com/search/docs/data-types/social-profile
	 *
	 * @param array $contactmethods Currently set contactmethods.
	 *
	 * @return array $contactmethods with added contactmethods.
	 */
	public function update_contactmethods( $contactmethods ) {
		$contactmethods['facebook']   = __( 'Facebook profile URL', 'wordpress-seo' );
		$contactmethods['instagram']  = __( 'Instagram profile URL', 'wordpress-seo' );
		$contactmethods['linkedin']   = __( 'LinkedIn profile URL', 'wordpress-seo' );
		$contactmethods['myspace']    = __( 'MySpace profile URL', 'wordpress-seo' );
		$contactmethods['pinterest']  = __( 'Pinterest profile URL', 'wordpress-seo' );
		$contactmethods['soundcloud'] = __( 'SoundCloud profile URL', 'wordpress-seo' );
		$contactmethods['tumblr']     = __( 'Tumblr profile URL', 'wordpress-seo' );
		$contactmethods['twitter']    = __( 'Twitter username (without @)', 'wordpress-seo' );
		$contactmethods['youtube']    = __( 'YouTube profile URL', 'wordpress-seo' );
		$contactmethods['wikipedia']  = __( 'Wikipedia page about you', 'wordpress-seo' ) . '<br/><small>' . __( '(if one exists)', 'wordpress-seo' ) . '</small>';

		return $contactmethods;
	}

	/**
	 * Log the updated timestamp for user profiles when theme is changed.
	 */
	public function switch_theme() {
		$users = get_users( array( 'who' => 'authors' ) );
		if ( is_array( $users ) && $users !== array() ) {
			foreach ( $users as $user ) {
				update_user_meta( $user->ID, '_yoast_wpseo_profile_updated', time() );
			}
		}
	}

	/**
	 * Localization for the dismiss urls.
	 *
	 * @return array
	 */
	private function localize_admin_global_script() {
		return array(
			/* translators: %s: '%%term_title%%' variable used in titles and meta's template that's not compatible with the given template */
			'variable_warning'        => sprintf( __( 'Warning: the variable %s cannot be used in this template. See the help center for more info.', 'wordpress-seo' ), '<code>%s</code>' ),
			'dismiss_about_url'       => $this->get_dismiss_url( 'wpseo-dismiss-about' ),
			'dismiss_tagline_url'     => $this->get_dismiss_url( 'wpseo-dismiss-tagline-notice' ),
			/* translators: %s: expends to Yoast SEO */
			'help_video_iframe_title' => sprintf( __( '%s video tutorial', 'wordpress-seo' ), 'Yoast SEO' ),
			'scrollable_table_hint'   => __( 'Scroll to see the table content.', 'wordpress-seo' ),
		);
	}

	/**
	 * Extending the current page URL with two params to be able to ignore the notice.
	 *
	 * @param string $dismiss_param The param used to dismiss the notification.
	 *
	 * @return string
	 */
	private function get_dismiss_url( $dismiss_param ) {
		$arr_params = array(
			$dismiss_param => '1',
			'nonce'        => wp_create_nonce( $dismiss_param ),
		);

		return esc_url( add_query_arg( $arr_params ) );
	}

	/**
	 * Sets the upsell notice.
	 */
	protected function set_upsell_notice() {
		$upsell = new WPSEO_Product_Upsell_Notice();
		$upsell->dismiss_notice_listener();
		$upsell->initialize();
	}

	/**
	 * Whether we are on the admin dashboard page.
	 *
	 * @returns bool
	 */
	protected function on_dashboard_page() {
		return 'index.php' === $GLOBALS['pagenow'];
	}

	/**
	 * Loads the cornerstone filter.
	 *
	 * @return WPSEO_WordPress_Integration[] The integrations to initialize.
	 */
	protected function initialize_cornerstone_content() {
		if ( ! WPSEO_Options::get( 'enable_cornerstone_content' ) ) {
			return array();
		}

		return array(
			'cornerstone_filter' => new WPSEO_Cornerstone_Filter(),
		);
	}

	/**
	 * Initializes the seo link watcher.
	 *
	 * @returns WPSEO_WordPress_Integration[]
	 */
	protected function initialize_seo_links() {
		$integrations = array();

		$link_table_compatibility_notifier = new WPSEO_Link_Compatibility_Notifier();
		$link_table_accessible_notifier    = new WPSEO_Link_Table_Accessible_Notifier();

		if ( ! WPSEO_Options::get( 'enable_text_link_counter' ) ) {
			$link_table_compatibility_notifier->remove_notification();

			return $integrations;
		}

		$integrations[] = new WPSEO_Link_Cleanup_Transient();

		// Only use the link module for PHP 5.3 and higher and show a notice when version is wrong.
		if ( version_compare( phpversion(), '5.3', '<' ) ) {
			$link_table_compatibility_notifier->add_notification();

			return $integrations;
		}

		$link_table_compatibility_notifier->remove_notification();

		// When the table doesn't exists, just add the notification and return early.
		if ( ! WPSEO_Link_Table_Accessible::is_accessible() ) {
			WPSEO_Link_Table_Accessible::cleanup();
		}

		if ( ! WPSEO_Meta_Table_Accessible::is_accessible() ) {
			WPSEO_Meta_Table_Accessible::cleanup();
		}

		if ( ! WPSEO_Link_Table_Accessible::is_accessible() || ! WPSEO_Meta_Table_Accessible::is_accessible() ) {
			$link_table_accessible_notifier->add_notification();

			return $integrations;
		}

		$link_table_accessible_notifier->remove_notification();

		$integrations[] = new WPSEO_Link_Columns( new WPSEO_Meta_Storage() );
		$integrations[] = new WPSEO_Link_Reindex_Dashboard();
		$integrations[] = new WPSEO_Link_Notifier();

		// Adds a filter to exclude the attachments from the link count.
		add_filter( 'wpseo_link_count_post_types', array( 'WPSEO_Post_Type', 'filter_attachment_post_type' ) );

		return $integrations;
	}

	/* ********************* DEPRECATED METHODS ********************* */

	/**
	 * Cleans stopwords out of the slug, if the slug hasn't been set yet.
	 *
	 * @deprecated 7.0
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function remove_stopwords_from_slug() {
		_deprecated_function( __METHOD__, 'WPSEO 7.0' );
	}

	/**
	 * Filter the stopwords from the slug.
	 *
	 * @deprecated 7.0
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function filter_stopwords_from_slug() {
		_deprecated_function( __METHOD__, 'WPSEO 7.0' );
	}

	/**
	 * Initializes WHIP to show a notice for outdated PHP versions.
	 *
	 * @deprecated 8.1
	 * @codeCoverageIgnore
	 *
	 * @return void
	 */
	public function check_php_version() {
		// Intentionally left empty.
	}
}
PK     ”T](¬òc $   $    class-social-admin.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class adds the Social tab to the Yoast SEO metabox and makes sure the settings are saved.
 */
class WPSEO_Social_Admin extends WPSEO_Metabox {

	/**
	 * Class constructor.
	 */
	public function __construct() {
		self::translate_meta_boxes();
		add_filter( 'wpseo_save_metaboxes', array( $this, 'save_meta_boxes' ), 10, 1 );
		add_action( 'wpseo_save_compare_data', array( $this, 'og_data_compare' ), 10, 1 );
	}

	/**
	 * Translate text strings for use in the meta box.
	 *
	 * IMPORTANT: if you want to add a new string (option) somewhere, make sure you add that array key to
	 * the main meta box definition array in the class WPSEO_Meta() as well!!!!
	 */
	public static function translate_meta_boxes() {
		/* translators: %s expands to the social network's name. */
		$title_text = __( 'If you don\'t want to use the post title for sharing the post on %s but instead want another title there, write it here.', 'wordpress-seo' );

		/* translators: %s expands to the social network's name. */
		$description_text = __( 'If you don\'t want to use the meta description for sharing the post on %s but want another description there, write it here.', 'wordpress-seo' );

		/* translators: %s expands to the social network's name. */
		$image_text = __( 'If you want to override the image used on %s for this post, upload / choose an image here.', 'wordpress-seo' );

		/* translators: %1$s expands to the social network, %2$s to the recommended image size. */
		$image_size_text = __( 'The recommended image size for %1$s is %2$s pixels.', 'wordpress-seo' );

		$social_networks = array(
			'opengraph' => __( 'Facebook', 'wordpress-seo' ),
			'twitter'   => __( 'Twitter', 'wordpress-seo' ),
		);

		// Source: https://blog.bufferapp.com/ideal-image-sizes-social-media-posts.
		$recommended_image_sizes = array(
			/* translators: %1$s expands to the image recommended width, %2$s to its height. */
			'opengraph' => sprintf( __( '%1$s by %2$s', 'wordpress-seo' ), '1200', '630' ),
			// Source: https://developers.facebook.com/docs/sharing/best-practices#images.
			/* translators: %1$s expands to the image recommended width, %2$s to its height. */
			'twitter'   => sprintf( __( '%1$s by %2$s', 'wordpress-seo' ), '1024', '512' ),
		);

		foreach ( $social_networks as $network => $label ) {
			if ( true === WPSEO_Options::get( $network, false ) ) {
				/* translators: %s expands to the name of a social network. */
				WPSEO_Meta::$meta_fields['social'][ $network . '-title' ]['title']       = sprintf( __( '%s Title', 'wordpress-seo' ), $label );
				WPSEO_Meta::$meta_fields['social'][ $network . '-title' ]['description'] = sprintf( $title_text, $label );

				/* translators: %s expands to the name of a social network. */
				WPSEO_Meta::$meta_fields['social'][ $network . '-description' ]['title']       = sprintf( __( '%s Description', 'wordpress-seo' ), $label );
				WPSEO_Meta::$meta_fields['social'][ $network . '-description' ]['description'] = sprintf( $description_text, $label );

				/* translators: %s expands to the name of a social network. */
				WPSEO_Meta::$meta_fields['social'][ $network . '-image' ]['title']       = sprintf( __( '%s Image', 'wordpress-seo' ), $label );
				WPSEO_Meta::$meta_fields['social'][ $network . '-image' ]['description'] = sprintf( $image_text, $label ) . ' ' . sprintf( $image_size_text, $label, $recommended_image_sizes[ $network ] );
			}
		}
	}

	/**
	 * Returns the metabox section for the social settings.
	 *
	 * @return WPSEO_Metabox_Tab_Section
	 */
	public function get_meta_section() {
		$tabs               = array();
		$social_meta_fields = WPSEO_Meta::get_meta_field_defs( 'social' );
		$single             = true;

		$opengraph = WPSEO_Options::get( 'opengraph' );
		$twitter   = WPSEO_Options::get( 'twitter' );

		if ( $opengraph === true && $twitter === true ) {
			$single = null;
		}

		wp_nonce_field( 'yoast_free_metabox_social', 'yoast_free_metabox_social_nonce' );

		if ( $opengraph === true ) {
			$tabs[] = new WPSEO_Metabox_Form_Tab(
				'facebook',
				$this->get_social_tab_content( 'opengraph', $social_meta_fields ),
				'<span class="screen-reader-text">' . __( 'Facebook / Open Graph metadata', 'wordpress-seo' ) . '</span><span class="dashicons dashicons-facebook-alt"></span>',
				array(
					'link_aria_label' => __( 'Facebook / Open Graph metadata', 'wordpress-seo' ),
					'link_class'      => 'yoast-tooltip yoast-tooltip-se',
					'single'          => $single,
				)
			);
		}

		if ( $twitter === true ) {
			$tabs[] = new WPSEO_Metabox_Form_Tab(
				'twitter',
				$this->get_social_tab_content( 'twitter', $social_meta_fields ),
				'<span class="screen-reader-text">' . __( 'Twitter metadata', 'wordpress-seo' ) . '</span><span class="dashicons dashicons-twitter"></span>',
				array(
					'link_aria_label' => __( 'Twitter metadata', 'wordpress-seo' ),
					'link_class'      => 'yoast-tooltip yoast-tooltip-se',
					'single'          => $single,
				)
			);
		}

		return new WPSEO_Metabox_Tab_Section(
			'social',
			'<span class="screen-reader-text">' . __( 'Social', 'wordpress-seo' ) . '</span><span class="dashicons dashicons-share"></span>',
			$tabs,
			array(
				'link_aria_label' => __( 'Social', 'wordpress-seo' ),
				'link_class'      => 'yoast-tooltip yoast-tooltip-e',
			)
		);
	}

	/**
	 * Generates the html for a social settings tab for one of the supported social media.
	 *
	 * @param string $medium          Medium. Can be 'opengraph' or 'twitter'.
	 * @param array  $meta_field_defs The social meta field definitions.
	 *
	 * @return string
	 */
	private function get_social_tab_content( $medium, $meta_field_defs ) {
		$field_names = array(
			$medium . '-title',
			$medium . '-description',
			$medium . '-image',
			$medium . '-image-id',
		);

		$tab_content = $this->get_premium_notice( $medium );

		foreach ( $field_names as $field_name ) {
			$tab_content .= $this->do_meta_box( $meta_field_defs[ $field_name ], $field_name );
		}

		return $tab_content;
	}

	/**
	 * Returns the Upgrade to Premium notice.
	 *
	 * @param string $network The social network.
	 *
	 * @return string The notice HTML on the free version, empty string on premium.
	 */
	public function get_premium_notice( $network ) {
		$features = new WPSEO_Features();
		if ( $features->is_premium() ) {
			return '';
		}

		$network_name = __( 'Facebook', 'wordpress-seo' );

		if ( 'twitter' === $network ) {
			$network_name = __( 'Twitter', 'wordpress-seo' );
		}

		return sprintf(
			'<div class="notice inline yoast-notice yoast-notice-go-premium">
				<p>%1$s</p>
				<p><a href="%2$s" target="_blank">%3$s</a></p>
			</div>',
			sprintf(
				/* translators: %1$s expands to the social network's name, %2$s to Yoast SEO Premium. */
				esc_html__( 'Do you want to preview what it will look like if people share this post on %1$s? You can, with %2$s.', 'wordpress-seo' ),
				esc_html( $network_name ),
				'<strong>Yoast SEO Premium</strong>'
			),
			esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/179' ) ),
			sprintf(
				/* translators: %s expands to Yoast SEO Premium. */
				esc_html__( 'Find out why you should upgrade to %s', 'wordpress-seo' ),
				'Yoast SEO Premium'
			)
		);
	}

	/**
	 * Filter over the meta boxes to save, this function adds the Social meta boxes.
	 *
	 * @param array $field_defs Array of metaboxes to save.
	 *
	 * @return array
	 */
	public function save_meta_boxes( $field_defs ) {
		if ( ! isset( $_POST['yoast_free_metabox_social_nonce'] ) || ! wp_verify_nonce( $_POST['yoast_free_metabox_social_nonce'], 'yoast_free_metabox_social' ) ) {
			return $field_defs;
		}

		return array_merge( $field_defs, WPSEO_Meta::get_meta_field_defs( 'social' ) );
	}

	/**
	 * This method will compare opengraph fields with the posted values.
	 *
	 * When fields are changed, the facebook cache will be purged.
	 *
	 * @param WP_Post $post Post instance.
	 */
	public function og_data_compare( $post ) {
		if ( empty( $_POST ) ) {
			return;
		}

		if ( empty( $post->ID ) || $post->post_status !== 'publish' ) {
			return;
		}

		if ( ! isset( $_POST['yoast_free_metabox_social_nonce'] ) || ! wp_verify_nonce( $_POST['yoast_free_metabox_social_nonce'], 'yoast_free_metabox_social' ) ) {
			return;
		}

		if ( ! isset( $_POST['original_post_status'] ) || $_POST['original_post_status'] !== 'publish' ) {
			return;
		}

		$fields_to_compare = array(
			'opengraph-title',
			'opengraph-description',
			'opengraph-image',
		);

		$reset_facebook_cache = false;

		foreach ( $fields_to_compare as $field_to_compare ) {
			$old_value = WPSEO_Meta::get_value( $field_to_compare, $post->ID );

			$new_value = '';
			$post_key  = WPSEO_Meta::$form_prefix . $field_to_compare;
			if ( isset( $_POST[ $post_key ] ) ) {
				$new_value = sanitize_text_field( wp_unslash( $_POST[ $post_key ] ) );
			}

			if ( $old_value !== $new_value ) {
				$reset_facebook_cache = true;
				break;
			}
		}
		unset( $old_value, $new_value );

		if ( $reset_facebook_cache ) {
			wp_remote_get(
				'https://graph.facebook.com/?id=' . get_permalink( $post->ID ) . '&scrape=true&method=post'
			);
		}
	}
} /* End of class */
PK     ”T]/…eñ  ñ     class-yoast-dashboard-widget.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class to change or add WordPress dashboard widgets.
 */
class Yoast_Dashboard_Widget implements WPSEO_WordPress_Integration {

	/**
	 * @var string
	 */
	const CACHE_TRANSIENT_KEY = 'wpseo-dashboard-totals';

	/**
	 * @var WPSEO_Admin_Asset_Manager
	 */
	protected $asset_manager;

	/**
	 * @var WPSEO_Statistics
	 */
	protected $statistics;

	/**
	 * Yoast_Dashboard_Widget constructor.
	 *
	 * @param WPSEO_Statistics|null $statistics WPSEO_Statistics instance.
	 */
	public function __construct( WPSEO_Statistics $statistics = null ) {
		if ( $statistics === null ) {
			$statistics = new WPSEO_Statistics();
		}

		$this->statistics    = $statistics;
		$this->asset_manager = new WPSEO_Admin_Asset_Manager();
	}

	/**
	 * Register WordPress hooks.
	 */
	public function register_hooks() {
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_dashboard_assets' ) );
		add_action( 'admin_init', array( $this, 'queue_dashboard_widget' ) );
	}

	/**
	 * Adds the dashboard widget if it should be shown.
	 *
	 * @return void
	 */
	public function queue_dashboard_widget() {
		if ( $this->show_widget() ) {
			add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widget' ) );
		}
	}

	/**
	 * Adds dashboard widget to WordPress.
	 */
	public function add_dashboard_widget() {
		add_filter( 'postbox_classes_dashboard_wpseo-dashboard-overview', array( $this, 'wpseo_dashboard_overview_class' ) );
		wp_add_dashboard_widget(
			'wpseo-dashboard-overview',
			/* translators: %s is the plugin name */
			sprintf( __( '%s Posts Overview', 'wordpress-seo' ), 'Yoast SEO' ),
			array( $this, 'display_dashboard_widget' )
		);
	}

	/**
	 * Adds CSS classes to the dashboard widget.
	 *
	 * @param array $classes An array of postbox CSS classes.
	 *
	 * @return array
	 */
	public function wpseo_dashboard_overview_class( $classes ) {
		$classes[] = 'yoast wpseo-dashboard-overview';
		return $classes;
	}

	/**
	 * Displays the dashboard widget.
	 */
	public function display_dashboard_widget() {
		echo '<div id="yoast-seo-dashboard-widget"></div>';
	}

	/**
	 * Enqueues assets for the dashboard if the current page is the dashboard.
	 */
	public function enqueue_dashboard_assets() {
		if ( ! $this->is_dashboard_screen() ) {
			return;
		}

		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'dashboard-widget', 'wpseoDashboardWidgetL10n', $this->localize_dashboard_script() );
		$yoast_components_l10n = new WPSEO_Admin_Asset_Yoast_Components_L10n();
		$yoast_components_l10n->localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'dashboard-widget' );
		$this->asset_manager->enqueue_script( 'dashboard-widget' );
		$this->asset_manager->enqueue_style( 'wp-dashboard' );
	}

	/**
	 * Translates strings used in the dashboard widget.
	 *
	 * @return array The translated strings.
	 */
	public function localize_dashboard_script() {
		return array(
			'feed_header'      => sprintf(
				/* translators: %1$s resolves to Yoast.com */
				__( 'Latest blog posts on %1$s', 'wordpress-seo' ),
				'Yoast.com'
			),
			'feed_footer'      => __( 'Read more like this on our SEO blog', 'wordpress-seo' ),
			'ryte_header'      => sprintf(
				/* translators: %1$s expands to Ryte. */
				__( 'Indexability check by %1$s', 'wordpress-seo' ),
				'Ryte'
			),
			'ryteEnabled'      => ( WPSEO_Options::get( 'onpage_indexability' ) === true ),
			'ryte_fetch'       => __( 'Fetch the current status', 'wordpress-seo' ),
			'ryte_analyze'     => __( 'Analyze entire site', 'wordpress-seo' ),
			'ryte_fetch_url'   => esc_attr( add_query_arg( 'wpseo-redo-onpage', '1' ) ) . '#wpseo-dashboard-overview',
			'ryte_landing_url' => WPSEO_Shortlinker::get( 'https://yoa.st/rytelp' ),
		);
	}

	/**
	 * Checks if the current screen is the dashboard screen.
	 *
	 * @return bool Whether or not this is the dashboard screen.
	 */
	private function is_dashboard_screen() {
		$current_screen = get_current_screen();

		return ( $current_screen instanceof WP_Screen && $current_screen->id === 'dashboard' );
	}

	/**
	 * Returns true when the dashboard widget should be shown.
	 *
	 * @return bool
	 */
	private function show_widget() {
		$analysis_seo = new WPSEO_Metabox_Analysis_SEO();

		return $analysis_seo->is_enabled() && current_user_can( 'edit_posts' );
	}
}
PK     ”T]âÿxu[&  [&    class-plugin-availability.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Plugin_Availability
 */

/**
 * Class WPSEO_Plugin_Availability
 */
class WPSEO_Plugin_Availability {

	/**
	 * @var array
	 */
	protected $plugins = array();

	/**
	 * Registers the plugins so we can access them.
	 */
	public function register() {
		$this->register_yoast_plugins();
		$this->register_yoast_plugins_status();
	}

	/**
	 * Registers all the available Yoast SEO plugins.
	 */
	protected function register_yoast_plugins() {
		$this->plugins = array(
			'yoast-seo-premium' => array(
				'url'          => WPSEO_Shortlinker::get( 'https://yoa.st/1y7' ),
				'title'        => 'Yoast SEO Premium',
				'description'  => sprintf(
					/* translators: %1$s expands to Yoast SEO */
					__( 'The premium version of %1$s with more features & support.', 'wordpress-seo' ),
					'Yoast SEO'
				),
				'installed'    => false,
				'slug'         => 'wordpress-seo-premium/wp-seo-premium.php',
				'version_sync' => true,
				'premium'      => true,
			),

			'video-seo-for-wordpress-seo-by-yoast' => array(
				'url'          => WPSEO_Shortlinker::get( 'https://yoa.st/1y8' ),
				'title'        => 'Video SEO',
				'description'  => __( 'Optimize your videos to show them off in search results and get more clicks!', 'wordpress-seo' ),
				'installed'    => false,
				'slug'         => 'wpseo-video/video-seo.php',
				'version_sync' => true,
				'premium'      => true,
			),

			'yoast-news-seo' => array(
				'url'          => WPSEO_Shortlinker::get( 'https://yoa.st/1y9' ),
				'title'        => 'News SEO',
				'description'  => __( 'Are you in Google News? Increase your traffic from Google News by optimizing for it!', 'wordpress-seo' ),
				'installed'    => false,
				'slug'         => 'wpseo-news/wpseo-news.php',
				'version_sync' => true,
				'premium'      => true,
			),

			'local-seo-for-yoast-seo' => array(
				'url'          => WPSEO_Shortlinker::get( 'https://yoa.st/1ya' ),
				'title'        => 'Local SEO',
				'description'  => __( 'Rank better locally and in Google Maps, without breaking a sweat!', 'wordpress-seo' ),
				'installed'    => false,
				'slug'         => 'wordpress-seo-local/local-seo.php',
				'version_sync' => true,
				'premium'      => true,
			),

			'yoast-woocommerce-seo' => array(
				'url'           => WPSEO_Shortlinker::get( 'https://yoa.st/1o0' ),
				'title'         => 'Yoast WooCommerce SEO',
				'description'   => sprintf(
					/* translators: %1$s expands to Yoast SEO */
					__( 'Seamlessly integrate WooCommerce with %1$s and get extra features!', 'wordpress-seo' ),
					'Yoast SEO'
				),
				'_dependencies' => array(
					'WooCommerce' => array(
						'slug' => 'woocommerce/woocommerce.php',
					),
				),
				'installed'     => false,
				'slug'          => 'wpseo-woocommerce/wpseo-woocommerce.php',
				'version_sync'  => true,
				'premium'       => true,
			),

			'yoast-acf-analysis' => array(
				'url'           => 'https://wordpress.org/plugins/acf-content-analysis-for-yoast-seo/',
				'title'         => 'ACF Content Analysis for Yoast SEO',
				'description'   => sprintf(
					/* translators: %1$s expands to Yoast SEO, %2$s expands to Advanced Custom Fields */
					__( 'Seamlessly integrate %2$s with %1$s for the content analysis!', 'wordpress-seo' ),
					'Yoast SEO',
					'Advanced Custom Fields'
				),
				'installed'     => false,
				'slug'          => 'acf-content-analysis-for-yoast-seo/yoast-acf-analysis.php',
				'_dependencies' => array(
					'Advanced Custom Fields' => array(
						'slug' => 'advanced-custom-fields/acf.php',
					),
				),
				'version_sync'  => false,
			),

			'yoastseo-amp' => array(
				'url'           => 'https://wordpress.org/plugins/glue-for-yoast-seo-amp/',
				'title'         => 'Yoast SEO AMP Glue',
				'description'   => sprintf(
					/* translators: %1$s expands to Yoast SEO */
					__( 'Seamlessly integrate %1$s into your AMP pages!', 'wordpress-seo' ),
					'Yoast SEO'
				),
				'installed'     => false,
				'slug'          => 'glue-for-yoast-seo-amp/yoastseo-amp.php',
				'_dependencies' => array(
					'AMP' => array(
						'slug' => 'amp/amp.php',
					),
				),
				'version_sync'  => false,
			),
		);
	}

	/**
	 * Sets certain plugin properties based on WordPress' status.
	 */
	protected function register_yoast_plugins_status() {

		foreach ( $this->plugins as $name => $plugin ) {

			$plugin_slug = $plugin['slug'];
			$plugin_path = WP_PLUGIN_DIR . '/' . $plugin_slug;

			if ( file_exists( $plugin_path ) ) {
				$plugin_data                         = get_plugin_data( $plugin_path, false, false );
				$this->plugins[ $name ]['installed'] = true;
				$this->plugins[ $name ]['version']   = $plugin_data['Version'];
				$this->plugins[ $name ]['active']    = is_plugin_active( $plugin_slug );
			}
		}
	}

	/**
	 * Checks whether or not a plugin is known within the Yoast SEO collection.
	 *
	 * @param string $plugin The plugin to search for.
	 *
	 * @return bool Whether or not the plugin is exists.
	 */
	protected function plugin_exists( $plugin ) {
		return isset( $this->plugins[ $plugin ] );
	}

	/**
	 * Gets all the possibly available plugins.
	 *
	 * @return array Array containing the information about the plugins.
	 */
	public function get_plugins() {
		return $this->plugins;
	}

	/**
	 * Gets a specific plugin. Returns an empty array if it cannot be found.
	 *
	 * @param string $plugin The plugin to search for.
	 *
	 * @return array The plugin properties.
	 */
	public function get_plugin( $plugin ) {
		if ( ! $this->plugin_exists( $plugin ) ) {
			return array();
		}

		return $this->plugins[ $plugin ];
	}

	/**
	 * Gets the version of the plugin.
	 *
	 * @param array $plugin The information available about the plugin.
	 *
	 * @return string The version associated with the plugin.
	 */
	public function get_version( $plugin ) {
		if ( ! isset( $plugin['version'] ) ) {
			return '';
		}

		return $plugin['version'];
	}

	/**
	 * Checks if there are dependencies available for the plugin.
	 *
	 * @param array $plugin The information available about the plugin.
	 *
	 * @return bool Whether or not there is a dependency present.
	 */
	public function has_dependencies( $plugin ) {
		return ( isset( $plugin['_dependencies'] ) && ! empty( $plugin['_dependencies'] ) );
	}

	/**
	 * Gets the dependencies for the plugin.
	 *
	 * @param array $plugin The information available about the plugin.
	 *
	 * @return array Array containing all the dependencies associated with the plugin.
	 */
	public function get_dependencies( $plugin ) {
		if ( ! $this->has_dependencies( $plugin ) ) {
			return array();
		}

		return $plugin['_dependencies'];
	}

	/**
	 * Checks if all dependencies are satisfied.
	 *
	 * @param array $plugin The information available about the plugin.
	 *
	 * @return bool Whether or not the dependencies are satisfied.
	 */
	public function dependencies_are_satisfied( $plugin ) {
		if ( ! $this->has_dependencies( $plugin ) ) {
			return true;
		}

		$dependencies           = $this->get_dependencies( $plugin );
		$installed_dependencies = array_filter( $dependencies, array( $this, 'is_dependency_available' ) );

		return count( $installed_dependencies ) === count( $dependencies );
	}

	/**
	 * Checks whether or not one of the plugins is properly installed and usable.
	 *
	 * @param array $plugin The information available about the plugin.
	 *
	 * @return bool Whether or not the plugin is properly installed.
	 */
	public function is_installed( $plugin ) {
		if ( empty( $plugin ) ) {
			return false;
		}

		return $this->is_available( $plugin );
	}

	/**
	 * Gets all installed plugins.
	 *
	 * @return array The installed plugins.
	 */
	public function get_installed_plugins() {
		$installed = array();

		foreach ( $this->plugins as $plugin_key => $plugin ) {
			if ( $this->is_installed( $plugin ) ) {
				$installed[ $plugin_key ] = $plugin;
			}
		}

		return $installed;
	}

	/**
	 * Checks for the availability of the plugin.
	 *
	 * @param array $plugin The information available about the plugin.
	 *
	 * @return bool Whether or not the plugin is available.
	 */
	public function is_available( $plugin ) {
		return isset( $plugin['installed'] ) && $plugin['installed'] === true;
	}

	/**
	 * Checks whether a dependency is available.
	 *
	 * @param array $dependency The information about the dependency to look for.
	 *
	 * @return bool Whether or not the dependency is available.
	 */
	public function is_dependency_available( $dependency ) {
		return in_array( $dependency['slug'], array_keys( get_plugins() ), true );
	}

	/**
	 * Gets the names of the dependencies.
	 *
	 * @param array $plugin The plugin to get the dependency names from.
	 *
	 * @return array Array containing the names of the associated dependencies.
	 */
	public function get_dependency_names( $plugin ) {
		if ( ! $this->has_dependencies( $plugin ) ) {
			return array();
		}

		return array_keys( $plugin['_dependencies'] );
	}

	/**
	 * Gets an array of plugins that have defined dependencies.
	 *
	 * @return array Array of the plugins that have dependencies.
	 */
	public function get_plugins_with_dependencies() {
		return array_filter( $this->plugins, array( $this, 'has_dependencies' ) );
	}

	/**
	 * Determines whether or not a plugin is active.
	 *
	 * @param string $plugin The plugin slug to check.
	 *
	 * @return bool Whether or not the plugin is active.
	 */
	public function is_active( $plugin ) {
		return is_plugin_active( $plugin );
	}

	/**
	 * Determines whether or not a plugin is a Premium product.
	 *
	 * @param array $plugin The plugin to check.
	 *
	 * @return bool Whether or not the plugin is a Premium product.
	 */
	public function is_premium( $plugin ) {
		return isset( $plugin['premium'] ) && $plugin['premium'] === true;
	}
}
PK     ”T]~©Îr  r    views/sidebar.phpnu „[µü¤        <?php
/**
 * View for the banner sidebar.
 *
 * @package WPSEO\Admin\Views
 */

$wpseo_plugin_dir_url = plugin_dir_url( WPSEO_FILE );
$new_tab_message      = WPSEO_Admin_Utils::get_new_tab_message();

?>
<div class="wpseo_content_cell" id="sidebar-container">
	<div id="sidebar" class="yoast-sidebar">
		<div class="wpseo_content_cell_title yoast-sidebar__title">
			<?php
			/* translators: %1$s expands to Yoast */
			printf( esc_html__( '%1$s recommendations for you', 'wordpress-seo' ), 'Yoast' );
			?>
		</div>
		<div class="yoast-sidebar__section">
			<h2>
				<?php
				/* translators: %s expands to Yoast SEO Premium */
				printf( esc_html__( 'Upgrade to %s', 'wordpress-seo' ), 'Yoast SEO Premium' );
				?>
			</h2>
			<ul>
				<li><strong><?php esc_html_e( 'Rank better with synonyms & related keyphrases', 'wordpress-seo' ); ?></strong></li>
				<li><strong><?php esc_html_e( 'Preview your page in Facebook and Twitter', 'wordpress-seo' ); ?></strong></li>
				<li><strong><?php esc_html_e( 'Get real-time suggestions for internal links', 'wordpress-seo' ); ?></strong></li>
				<li><strong><?php esc_html_e( 'No more dead links a.k.a. 404 pages', 'wordpress-seo' ); ?></strong></li>
				<li><strong><?php esc_html_e( '24/7 email support', 'wordpress-seo' ); ?></strong></li>
				<li><strong><?php esc_html_e( 'No ads!', 'wordpress-seo' ); ?></strong></li>
			</ul>

			<a id="wpseo-premium-button" class="yoast-button-upsell" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jj' ); ?>" target="_blank">
				<?php
				/* translators: %s expands to Yoast SEO Premium */
				printf( esc_html__( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' );
				echo $new_tab_message;
				echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
				?>
			</a><br>
		</div>
		<div class="yoast-sidebar__section">
			<h2><?php esc_html_e( 'Improve your SEO skills', 'wordpress-seo' ); ?></h2>
			<div class="wp-clearfix">
				<p>
					<strong><?php echo esc_html_x( 'Free:', 'course', 'wordpress-seo' ); ?></strong>
					<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/2oi' ); ?>" target="_blank">
						<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/SEO_for_beginners.svg' ); ?>" alt="">
						<strong><?php esc_html_e( 'SEO for Beginners training', 'wordpress-seo' ); ?></strong>
						<?php echo $new_tab_message; ?>
					</a><br>
					<?php esc_html_e( 'Get quick wins to make your site rank higher in search engines.', 'wordpress-seo' ); ?>
				</p>
			</div>
			<div class="wp-clearfix">
				<p>
					<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jv' ); ?>" target="_blank">
						<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/yoast_seo_for_wp_2.svg' ); ?>" alt="">
						<strong>
							<?php
								/* translators: %s expands to Yoast SEO */
								printf( esc_html__( '%s for WordPress training', 'wordpress-seo' ), 'Yoast SEO' );
							?>
						</strong>
						<?php echo $new_tab_message; ?>
					</a><br>
					<?php esc_html_e( 'Donâ€™t waste time figuring out the best settings yourself.', 'wordpress-seo' ); ?>
				</p>
			</div>
			<div class="wp-clearfix">
				<p>
					<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/3lj' ); ?>" target="_blank">
						<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/all-round-SEO.svg' ); ?>" alt="">
						<strong><?php esc_html_e( 'All-around SEO training', 'wordpress-seo' ); ?></strong>
						<?php echo $new_tab_message; ?>
					</a><br>
					<?php esc_html_e( 'Learn practical SEO skills to rank higher in Google.', 'wordpress-seo' ); ?>
				</p>
			</div>
		</div>
		<div class="yoast-sidebar__section">
			<h2>
				<?php
					/* translators: %s expands to Yoast SEO */
					printf( esc_html__( 'Extend %s', 'wordpress-seo' ), 'Yoast SEO' );
				?>
			</h2>
			<div class="wp-clearfix">
				<p>
					<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jq' ); ?>" target="_blank">
						<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/Local_SEO_Icon.svg' ); ?>" alt="">
						<strong>Local SEO</strong>
						<?php echo $new_tab_message; ?>
					</a><br>
					<?php esc_html_e( 'Be found in Google Maps and local results.', 'wordpress-seo' ); ?>
				</p>
			</div>
			<div class="wp-clearfix">
				<p>
					<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jo' ); ?>" target="_blank">
						<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/Video_SEO_Icon.svg' ); ?>" alt="">
						<strong>Video SEO</strong>
						<?php echo $new_tab_message; ?>
					</a><br>
					<?php esc_html_e( 'Be found in Google Video search and enhance your video sharing on social media.', 'wordpress-seo' ); ?>
				</p>
			</div>
			<div class="wp-clearfix">
				<p>
					<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jp' ); ?>" target="_blank">
						<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/Woo_SEO_Icon.svg' ); ?>" alt="">
						<strong>WooCommerce SEO</strong>
						<?php echo $new_tab_message; ?>
					</a><br>
					<?php esc_html_e( 'Optimize your shop\'s SEO and sell more products!', 'wordpress-seo' ); ?>
				</p>
			</div>
			<div class="wp-clearfix">
				<p>
					<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jr' ); ?>" target="_blank">
						<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/News_SEO_Icon.svg' ); ?>" alt="">
						<strong>News SEO</strong>
						<?php echo $new_tab_message; ?>
					</a><br>
					<?php esc_html_e( 'Optimize your site for Google News.', 'wordpress-seo' ); ?>
				</p>
			</div>
		</div>
		<div class="yoast-sidebar__section">
			<strong><?php esc_html_e( 'Remove these ads?', 'wordpress-seo' ); ?></strong>
			<p>
				<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jy' ); ?>" target="_blank">
					<?php
						/* translators: %s expands to Yoast SEO Premium */
						printf( esc_html__( 'Upgrade to %s', 'wordpress-seo' ), 'Yoast SEO Premium' );
						echo $new_tab_message;
					?>
				</a>
			</p>
		</div>
	</div>
</div>
PK     ”T]$ïÕ®  ®    views/tool-import-export.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$yform  = Yoast_Form::get_instance();
$import = false;

/**
 * The import method is used to determine if there should be something imported.
 *
 * In case of POST the user is on the Yoast SEO import page and in case of the GET the user sees a notice from
 * Yoast SEO that we can import stuff for that plugin.
 */
if ( filter_input( INPUT_POST, 'import' ) || filter_input( INPUT_GET, 'import' ) ) {
	check_admin_referer( 'wpseo-import' );

	$post_wpseo = filter_input( INPUT_POST, 'wpseo', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
	$action     = 'import';
}
elseif ( filter_input( INPUT_POST, 'import_external' ) ) {
	check_admin_referer( 'wpseo-import-plugins' );

	$class = filter_input( INPUT_POST, 'import_external_plugin' );
	if ( class_exists( $class ) ) {
		$import = new WPSEO_Import_Plugin( new $class(), 'import' );
	}
}
elseif ( filter_input( INPUT_POST, 'clean_external' ) ) {
	check_admin_referer( 'wpseo-clean-plugins' );

	$class = filter_input( INPUT_POST, 'clean_external_plugin' );
	if ( class_exists( $class ) ) {
		$import = new WPSEO_Import_Plugin( new $class(), 'cleanup' );
	}
}
elseif ( filter_input( INPUT_POST, 'settings_import' ) ) {
	$import = new WPSEO_Import_Settings();
	$import->import();
}

/**
 * Allow custom import actions.
 *
 * @api WPSEO_Import_Status $import Contains info about the handled import.
 */
$import = apply_filters( 'wpseo_handle_import', $import );

if ( $import ) {

	$message = '';
	if ( $import->status instanceof WPSEO_Import_Status ) {
		$message = $import->status->get_msg();
	}

	/**
	 * Allow customization of import/export message.
	 *
	 * @api  string  $msg  The message.
	 */
	$msg = apply_filters( 'wpseo_import_message', $message );

	if ( ! empty( $msg ) ) {
		$status = 'error';
		if ( $import->status->status ) {
			$status = 'updated';
		}

		echo '<div id="message" class="message ', $status, '"><p>', esc_html( $msg ), '</p></div>';
	}
}

$tabs = array(
	'wpseo-import' => array(
		'label'                => __( 'Import settings', 'wordpress-seo' ),
		'screencast_video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-import-export' ),
	),
	'wpseo-export' => array(
		'label'                => __( 'Export settings', 'wordpress-seo' ),
		'screencast_video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-import-export' ),
	),
	'import-seo'   => array(
		'label'                => __( 'Import from other SEO plugins', 'wordpress-seo' ),
		'screencast_video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-import-export' ),
	),
);

?>
	<br/><br/>

	<h2 class="nav-tab-wrapper" id="wpseo-tabs">
		<?php foreach ( $tabs as $identifier => $tab ) : ?>
			<a class="nav-tab" id="<?php echo esc_attr( $identifier . '-tab' ); ?>" href="<?php echo esc_url( '#top#' . $identifier ); ?>"><?php echo esc_html( $tab['label'] ); ?></a>
		<?php endforeach; ?>

		<?php
		/**
		 * Allow adding a custom import tab header.
		 */
		do_action( 'wpseo_import_tab_header' );
		?>
	</h2>

<?php

$helpcenter_tabs = new WPSEO_Option_Tabs( '', '' );

foreach ( $tabs as $identifier => $tab ) {
	if ( ! empty( $tab['screencast_video_url'] ) ) {
		$tab_video_url = $tab['screencast_video_url'];

		$helpcenter_tab = new WPSEO_Option_Tab(
			$identifier,
			$tab['label'],
			array( 'video_url' => $tab['screencast_video_url'] )
		);
	}

	$helpcenter_tabs->add_tab( $helpcenter_tab );
}

$helpcenter = new WPSEO_Help_Center( '', $helpcenter_tabs, WPSEO_Utils::is_yoast_seo_premium() );
$helpcenter->localize_data();
$helpcenter->mount();

foreach ( $tabs as $identifier => $tab ) {
	printf( '<div id="%s" class="wpseotab">', esc_attr( $identifier ) );
	require_once WPSEO_PATH . 'admin/views/tabs/tool/' . $identifier . '.php';
	echo '</div>';
}

/**
 * Allow adding a custom import tab.
 */
do_action( 'wpseo_import_tab_content' );
PK     ”T]Â÷£Ig  g    views/paper-collapsible.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 *
 * @uses string                 $paper_id           The ID of the paper.
 * @uses bool                   $collapsible        Whether the collapsible should be rendered.
 * @uses array                  $collapsible_config Configuration for the collapsible.
 * @uses string                 $title              The title.
 * @uses string                 $title_after        Additional content to render after the title.
 * @uses string                 $view_file          Path to the view file.
 * @uses WPSEO_Admin_Help_Panel $help_text          The help text.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

?>
<div class="paper tab-block"<?php echo ( $paper_id ) ? ' id="' . esc_attr( 'wpseo-' . $paper_id ) . '"' : ''; ?>>

	<?php
	if ( ! empty( $title ) ) {
		if ( ! empty( $collapsible ) ) {
			printf(
				'<h2 class="help-button-inline"><button type="button" class="toggleable-container-trigger" aria-expanded="%3$s">%1$s <span class="toggleable-container-icon dashicons %2$s" aria-hidden="true"></span></button></h2>',
				esc_html( $title ) . $title_after . $help_text->get_button_html(),
				$collapsible_config['toggle_icon'],
				$collapsible_config['expanded']
			);
		}
		else {
			printf( '<h2 class="help-button-inline">' . esc_html( $title ) . $title_after . $help_text->get_button_html() . '</h2>' );
		}
	}
	?>
	<?php echo $help_text->get_panel_html(); ?>
	<div class="<?php echo esc_attr( $collapsible_config['class'] ); ?>">
		<?php require $view_file; ?>
	</div>

</div>
PK     ”T]º'QôO  O  #  views/js-templates-primary-term.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}
?>

<script type="text/html" id="tmpl-primary-term-ui">
	<?php
	/* translators: accessibility text. %1$s expands to the term title, %2$s to the taxonomy title. */
	$yoast_free_js_button_label = __( 'Make %1$s primary %2$s', 'wordpress-seo' );
	$yoast_free_js_button_label = sprintf(
		$yoast_free_js_button_label,
		'{{data.term}}',
		'{{data.taxonomy.title}}'
	);

	printf(
		'<button type="button" class="wpseo-make-primary-term" aria-label="%1$s">%2$s</button>',
		esc_attr( $yoast_free_js_button_label ),
		esc_html__( 'Make primary', 'wordpress-seo' )
	);
	?>

	<span class="wpseo-is-primary-term" aria-hidden="true"><?php esc_html_e( 'Primary', 'wordpress-seo' ); ?></span>
</script>

<script type="text/html" id="tmpl-primary-term-screen-reader">
	<?php
	/* translators: %s is the taxonomy title. This will be shown to screenreaders */
	$yoast_free_js_taxonomy_title = __( 'Primary %s', 'wordpress-seo' );
	$yoast_free_js_taxonomy_title = sprintf(
		'(' . $yoast_free_js_taxonomy_title . ')',
		'{{data.taxonomy.title}}'
	);
	?>
	<span class="screen-reader-text wpseo-primary-category-label"><?php echo esc_html( $yoast_free_js_taxonomy_title ); ?></span>
</script>
PK     ”T]±Kž
  
  "  views/class-yoast-input-select.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class for generating a html select.
 */
class Yoast_Input_Select {

	/**
	 * @var string
	 */
	private $select_id;

	/**
	 * @var string
	 */
	private $select_name;

	/**
	 * @var array
	 */
	private $select_attributes = array();

	/**
	 * Array with the options to parse.
	 *
	 * @var array
	 */
	private $select_options;

	/**
	 * The current selected option.
	 *
	 * @var string
	 */
	private $selected_option;

	/**
	 * Constructor.
	 *
	 * @param string $select_id       ID for the select.
	 * @param string $select_name     Name for the select.
	 * @param array  $select_options  Array with the options to parse.
	 * @param string $selected_option The current selected option.
	 */
	public function __construct( $select_id, $select_name, array $select_options, $selected_option ) {
		$this->select_id       = $select_id;
		$this->select_name     = $select_name;
		$this->select_options  = $select_options;
		$this->selected_option = $selected_option;
	}

	/**
	 * Print the rendered view.
	 */
	public function output_html() {
		// Extract it, because we want each value accessible via a variable instead of accessing it as an array.
		extract( $this->get_select_values() );

		require WPSEO_PATH . 'admin/views/form/select.php';
	}

	/**
	 * Return the rendered view.
	 *
	 * @return string
	 */
	public function get_html() {
		ob_start();

		$this->output_html();

		$rendered_output = ob_get_contents();
		ob_end_clean();

		return $rendered_output;
	}

	/**
	 * Add an attribute to the attributes property.
	 *
	 * @param string $attribute The name of the attribute to add.
	 * @param string $value     The value of the attribute.
	 */
	public function add_attribute( $attribute, $value ) {
		$this->select_attributes[ $attribute ] = $value;
	}

	/**
	 * Return the set fields for the select.
	 *
	 * @return array
	 */
	private function get_select_values() {
		return array(
			'id'         => $this->select_id,
			'name'       => $this->select_name,
			'attributes' => $this->get_attributes(),
			'options'    => $this->select_options,
			'selected'   => $this->selected_option,
		);
	}

	/**
	 * Return the attribute string, when there are attributes set.
	 *
	 * @return string
	 */
	private function get_attributes() {
		$attributes = $this->select_attributes;

		if ( ! empty( $attributes ) ) {
			array_walk( $attributes, array( $this, 'parse_attribute' ) );

			return implode( ' ', $attributes ) . ' ';
		}

		return '';
	}

	/**
	 * Get an attribute from the attributes.
	 *
	 * @param string $value     The value of the attribute.
	 * @param string $attribute The attribute to look for.
	 */
	private function parse_attribute( & $value, $attribute ) {
		$value = sprintf( '%s="%s"', esc_html( $attribute ), esc_attr( $value ) );
	}
}
PK     ”T]ª/ Æ	  Æ	  !  views/partial-alerts-template.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 *
 * @uses string $type
 * @uses string $dashicon
 * @uses string $i18n_title
 * @uses string $i18n_issues
 * @uses string $i18n_no_issues
 * @uses string $i18n_muted_issues_title
 * @uses int    $active_total
 * @uses        $total
 * @uses array  $active
 * @uses array  $dismissed
 */

if ( ! function_exists( '_yoast_display_alerts' ) ) {
	/**
	 * Create the alert HTML with restore/dismiss button.
	 *
	 * @param array  $list   List of alerts.
	 * @param string $status Status of the alerts (active/dismissed).
	 */
	function _yoast_display_alerts( $list, $status ) {
		foreach ( $list as $notification ) {

			switch ( $status ) {
				case 'active':
					$button = sprintf( '<button type="button" class="button dismiss"><span class="screen-reader-text">%1$s</span><span class="dashicons dashicons-no-alt"></span></button>', esc_html__( 'Dismiss this item.', 'wordpress-seo' ) );
					break;

				case 'dismissed':
					$button = sprintf( '<button type="button" class="button restore"><span class="screen-reader-text">%1$s</span><span class="dashicons dashicons-hidden"></span></button>', esc_html__( 'Restore this item.', 'wordpress-seo' ) );
					break;
			}

			printf(
				'<div class="yoast-alert-holder" id="%1$s" data-nonce="%2$s" data-json="%3$s">%4$s%5$s</div>',
				esc_attr( $notification->get_id() ),
				esc_attr( $notification->get_nonce() ),
				esc_attr( $notification->get_json() ),
				$notification,
				$button
			);
		}
	}
}

$wpseo_i18n_summary = $i18n_issues;
if ( ! $active ) {
	$dashicon           = 'yes';
	$wpseo_i18n_summary = $i18n_no_issues;
}

?>
<h3><span class="dashicons <?php echo esc_attr( 'dashicons-' . $dashicon ); ?>"></span> <?php echo esc_html( $i18n_title ); ?> (<?php echo (int) $active_total; ?>)</h3>

<div id="<?php echo esc_attr( 'yoast-' . $type ); ?>">

	<?php if ( $total ) : ?>
		<p><?php echo esc_html( $wpseo_i18n_summary ); ?></p>

		<div class="container" id="<?php echo esc_attr( 'yoast-' . $type . '-active' ); ?>">
			<?php _yoast_display_alerts( $active, 'active' ); ?>
		</div>

		<?php if ( $dismissed ) : ?>
			<h4 class="yoast-muted-title"><?php echo esc_html( $i18n_muted_issues_title ); ?></h4>
		<?php endif; ?>

		<div class="container" id="<?php echo esc_attr( 'yoast-' . $type . '-dismissed' ); ?>">
			<?php _yoast_display_alerts( $dismissed, 'dismissed' ); ?>
		</div>

	<?php else : ?>

		<p><?php echo esc_html( $i18n_no_issues ); ?></p>

	<?php endif; ?>
</div>
PK     ”T]>PbÌh  h  #  views/class-yoast-form-fieldset.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Generate the HTML for a form fieldset to wrap grouped form elements.
 */
class Yoast_Form_Fieldset implements Yoast_Form_Element {

	/**
	 * The fieldset ID.
	 *
	 * @var string
	 */
	private $id;

	/**
	 * The fieldset HTML default attributes.
	 *
	 * @var array
	 */
	private $attributes = array(
		'class' => 'yoast-form-fieldset',
	);

	/**
	 * The grouped form elements for the fieldset.
	 *
	 * @var string
	 */
	private $content;

	/**
	 * The fieldset legend HTML default attributes.
	 *
	 * @var array
	 */
	private $legend_attributes = array(
		'class' => 'yoast-form-legend',
	);

	/**
	 * A translatable string for the fieldset legend content.
	 *
	 * @var string
	 */
	private $legend_content;

	/**
	 * Constructor.
	 *
	 * @param string $id             ID for the fieldset.
	 * @param string $legend_content The translatable legend text.
	 * @param string $content        The grouped form elements for the fieldset.
	 */
	public function __construct( $id, $legend_content, $content ) {
		$this->id             = $id;
		$this->legend_content = $legend_content;
		$this->content        = $content;
	}

	/**
	 * Render the view.
	 */
	public function render_view() {
		/*
		 * Extract because we want values accessible via variables for later use
		 * in the view instead of accessing them as an array.
		 */
		extract( $this->get_parts() );

		require WPSEO_PATH . 'admin/views/form/fieldset.php';
	}

	/**
	 * Start output buffering to catch the form elements to wrap in the fieldset.
	 */
	public function start() {
		ob_start();
	}

	/**
	 * Return output buffering with the form elements to wrap in the fieldset.
	 */
	public function end() {
		$this->content = ob_get_clean();
	}

	/**
	 * Return the rendered view.
	 *
	 * @return string
	 */
	public function get_html() {
		ob_start();
		$this->render_view();
		return ob_get_clean();
	}

	/**
	 * Output the rendered view.
	 */
	public function html() {
		echo $this->get_html();
	}

	/**
	 * Add attributes to the fieldset default attributes.
	 *
	 * @param array $attributes Array of attributes names and values to merge with the defaults.
	 */
	public function add_attributes( $attributes ) {
		$this->attributes = wp_parse_args( $attributes, $this->attributes );
	}

	/**
	 * Add attributes to the fieldset legend default attributes.
	 *
	 * @param array $attributes Array of attributes names and values to merge with the defaults.
	 */
	public function legend_add_attributes( $attributes ) {
		$this->legend_attributes = wp_parse_args( $attributes, $this->legend_attributes );
	}

	/**
	 * Visually hide the fieldset legend but keep it available to assistive technologies.
	 */
	public function legend_hide() {
		$this->legend_attributes = wp_parse_args(
			array( 'class' => 'screen-reader-text' ),
			$this->legend_attributes
		);
	}

	/**
	 * Return the set of attributes and content for the fieldset.
	 *
	 * @return array
	 */
	private function get_parts() {
		return array(
			'id'                => $this->id,
			'attributes'        => $this->get_attributes_html( $this->attributes ),
			'legend_content'    => $this->legend_content,
			'legend_attributes' => $this->get_attributes_html( $this->legend_attributes ),
			'content'           => $this->content,
		);
	}

	/**
	 * Return HTML formatted attributes as a string, when there are attributes set.
	 *
	 * @param array $attributes Fieldset or legend attributes.
	 *
	 * @return string A space separated list of HTML formatted attributes or empty string.
	 */
	private function get_attributes_html( $attributes ) {
		if ( ! empty( $attributes ) ) {
			array_walk( $attributes, array( $this, 'parse_attribute' ) );

			// Use an initial space as `implode()` adds a space only between array elements.
			return ' ' . implode( ' ', $attributes );
		}

		return '';
	}

	/**
	 * Escape and format an attribute as an HTML attribute.
	 *
	 * @param string $value     The value of the attribute.
	 * @param string $attribute The attribute to look for.
	 */
	private function parse_attribute( & $value, $attribute ) {
		$value = sprintf( '%s="%s"', esc_html( $attribute ), esc_attr( $value ) );
	}
}
PK     ”T]]UÝ3J  J    views/tabs/network/features.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 *
 * @uses Yoast_Form $yform Form object.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$feature_toggles = Yoast_Feature_Toggles::instance()->get_all();

?>
<h2><?php esc_html_e( 'Features', 'wordpress-seo' ); ?></h2>
<div class="yoast-measure">
	<?php
	echo sprintf(
		/* translators: %s expands to Yoast SEO */
		esc_html__( 'This tab allows you to selectively disable %s features for all sites in the network. By default all features are enabled, which allows site admins to choose for themselves if they want to toggle a feature on or off for their site. When you disable a feature here, site admins will not be able to use that feature at all.', 'wordpress-seo' ),
		'Yoast SEO'
	);

	foreach ( $feature_toggles as $feature ) {
		$help_text = esc_html( $feature->label );
		if ( ! empty( $feature->extra ) ) {
			$help_text .= ' ' . $feature->extra;
		}
		if ( ! empty( $feature->read_more_label ) ) {
			$help_text .= ' ';
			$help_text .= sprintf(
				'<a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a>',
				esc_url( WPSEO_Shortlinker::get( $feature->read_more_url ) ),
				esc_html( $feature->read_more_label )
			);
		}

		$feature_help = new WPSEO_Admin_Help_Panel(
			WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting,
			/* translators: %s expands to a feature's name */
			sprintf( esc_html__( 'Help on: %s', 'wordpress-seo' ), esc_html( $feature->name ) ),
			$help_text
		);

		$yform->toggle_switch(
			WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting,
			array(
				'on'  => __( 'Allow Control', 'wordpress-seo' ),
				'off' => __( 'Disable', 'wordpress-seo' ),
			),
			'<strong>' . $feature->name . '</strong>',
			$feature_help->get_button_html() . $feature_help->get_panel_html()
		);
	}
	?>
</div>
<?php

/*
 * Required to prevent our settings framework from saving the default because the field
 * isn't explicitly set when saving the Dashboard page.
 */
$yform->hidden( 'show_onboarding_notice', 'wpseo_show_onboarding_notice' );
PK     ”T]—èBê  ê    views/tabs/network/general.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 *
 * @uses Yoast_Form $yform Form object.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

/*
 * {@internal Important: Make sure the options added to the array here are in line with the
 * options set in the WPSEO_Option_MS::$allowed_access_options property.}}
 */
$yform->select(
	'access',
	/* translators: %1$s expands to Yoast SEO */
	sprintf( __( 'Who should have access to the %1$s settings', 'wordpress-seo' ), 'Yoast SEO' ),
	array(
		'admin'      => __( 'Site Admins (default)', 'wordpress-seo' ),
		'superadmin' => __( 'Super Admins only', 'wordpress-seo' ),
	)
);

if ( get_blog_count() <= 100 ) {
	$network_admin = new Yoast_Network_Admin();

	$yform->select(
		'defaultblog',
		__( 'New sites in the network inherit their SEO settings from this site', 'wordpress-seo' ),
		$network_admin->get_site_choices( true, true )
	);
	echo '<p>' . esc_html__( 'Choose the site whose settings you want to use as default for all sites that are added to your network. If you choose \'None\', the normal plugin defaults will be used.', 'wordpress-seo' ) . '</p>';
}
else {
	$yform->textinput( 'defaultblog', __( 'New sites in the network inherit their SEO settings from this site', 'wordpress-seo' ) );
	echo '<p>';
	printf(
		/* translators: 1: link open tag; 2: link close tag. */
		esc_html__( 'Enter the %1$sSite ID%2$s for the site whose settings you want to use as default for all sites that are added to your network. Leave empty for none (i.e. the normal plugin defaults will be used).', 'wordpress-seo' ),
		'<a href="' . esc_url( network_admin_url( 'sites.php' ) ) . '">',
		'</a>'
	);
	echo '</p>';
}

echo '<p><strong>' . esc_html__( 'Take note:', 'wordpress-seo' ) . '</strong> ' . esc_html__( 'Privacy sensitive (FB admins and such), theme specific (title rewrite) and a few very site specific settings will not be imported to new sites.', 'wordpress-seo' ) . '</p>';
PK     ”T]¡^&ÆŸ  Ÿ  #  views/tabs/network/restore-site.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 *
 * @uses Yoast_Form $yform Form object.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

echo '<p>' . esc_html__( 'Using this form you can reset a site to the default SEO settings.', 'wordpress-seo' ) . '</p>';

if ( get_blog_count() <= 100 ) {
	$network_admin = new Yoast_Network_Admin();

	$yform->select(
		'site_id',
		__( 'Site ID', 'wordpress-seo' ),
		$network_admin->get_site_choices( false, true )
	);
}
else {
	$yform->textinput( 'site_id', __( 'Site ID', 'wordpress-seo' ) );
}

wp_nonce_field( 'wpseo-network-restore', 'restore_site_nonce', false );
echo '<button type="submit" name="action" value="' . esc_attr( Yoast_Network_Admin::RESTORE_SITE_ACTION ) . '" class="button button-primary">' . esc_html__( 'Restore site to defaults', 'wordpress-seo' ) . '</button>';
PK     ”T]�SÊ‰í   í     views/tabs/network/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]ÆÏð@Í  Í    views/tabs/tool/import-seo.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

// Determine if we have plugins we can import from. If so, load that tab. Otherwise, load an empty tab.
$import_check = new WPSEO_Import_Plugins_Detector();
$import_check->detect();
if ( count( $import_check->needs_import ) === 0 ) {
	echo '<h2>', esc_html__( 'Import from other SEO plugins', 'wordpress-seo' ), '</h2>';
	echo '<p>';
	printf(
		/* translators: %s expands to Yoast SEO */
		esc_html__( '%s did not detect any plugin data from plugins it can import from.', 'wordpress-seo' ),
		'Yoast SEO'
	);
	echo '</p>';

	return;
}

/**
 * Creates a select box given a name and plugins array.
 *
 * @param string $name    Name field for the select field.
 * @param array  $plugins An array of plugins and classes.
 *
 * @return void
 */
function wpseo_import_external_select( $name, $plugins ) {
	esc_html_e( 'Plugin: ', 'wordpress-seo' );
	echo '<select name="', esc_attr( $name ), '">';
	foreach ( $plugins as $class => $plugin ) {
		/* translators: %s is replaced with the name of the plugin we're importing from. */
		echo '<option value="' . esc_attr( $class ) . '">' . esc_html( $plugin ) . '</option>';
	}
	echo '</select>';
}

?>
<h2><?php esc_html_e( 'Import from other SEO plugins', 'wordpress-seo' ); ?></h2>
<p>
	<?php esc_html_e( 'We\'ve detected data from one or more SEO plugins on your site. Please follow the following steps to import that data:', 'wordpress-seo' ); ?>
</p>

<div class="tab-block">
	<h3><?php esc_html_e( 'Step 1: Create a backup', 'wordpress-seo' ); ?></h3>
	<p>
		<?php esc_html_e( 'Please make a backup of your database before starting this process.', 'wordpress-seo' ); ?>
	</p>
</div>

<div class="tab-block">
	<h3><?php esc_html_e( 'Step 2: Import', 'wordpress-seo' ); ?></h3>
	<p>
		<?php
		/* translators: %1$s expands to Yoast SEO */
		printf(
			esc_html__( 'This will import the post metadata like SEO titles and descriptions into your %1$s metadata. It will only do this when there is no existing %1$s metadata yet. The original data will remain in place.', 'wordpress-seo' ),
			'Yoast SEO'
		);
		?>
	</p>
	<form action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#import-seo' ) ); ?>"
		method="post" accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>">
		<?php
		wp_nonce_field( 'wpseo-import-plugins', '_wpnonce', true, true );
		wpseo_import_external_select( 'import_external_plugin', $import_check->needs_import );
		?>
		<?php
		do_action( 'wpseo_import_other_plugins' );
		?>
		<input type="submit" class="button button-primary" name="import_external"
			value="<?php esc_attr_e( 'Import', 'wordpress-seo' ); ?>"/>
	</form>
</div>

<div class="tab-block">
	<h3><?php esc_html_e( 'Step 3: Check your data', 'wordpress-seo' ); ?></h3>
	<p>
		<?php esc_html_e( 'Please check your posts and pages and see if the metadata was successfully imported.', 'wordpress-seo' ); ?>
	</p>
</div>

<div class="tab-block">
	<h3><?php esc_html_e( 'Step 4: Run the configuration wizard', 'wordpress-seo' ); ?></h3>
	<p>
		<?php
		printf(
			esc_html__( 'You should run the configuration wizard, from the SEO &rarr; General &rarr; Dashboard page, to make sure all the settings for your site are correct.', 'wordpress-seo' ),
			'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_dashboard' ) ) . '">',
			'</a>'
		);
		?>
	</p>
</div>

<div class="tab-block">
	<h3><?php esc_html_e( 'Step 5: Clean up', 'wordpress-seo' ); ?></h3>
	<p>
		<?php esc_html_e( 'Once you\'re certain your site is OK, you can clean up. This will remove all the original data.', 'wordpress-seo' ); ?>
	</p>
	<form action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#import-seo' ) ); ?>"
		method="post" accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>">
		<?php
		wp_nonce_field( 'wpseo-clean-plugins', '_wpnonce', true, true );
		wpseo_import_external_select( 'clean_external_plugin', $import_check->needs_import );
		?>
		<input type="submit" class="button button-primary" name="clean_external"
			value="<?php esc_attr_e( 'Clean', 'wordpress-seo' ); ?>"/>
	</form>
</div>
PK     ”T]¨ö�Çx  x     views/tabs/tool/wpseo-export.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

/* translators: %1$s expands to Yoast SEO */
$submit_button_value = sprintf( __( 'Export your %1$s settings', 'wordpress-seo' ), 'Yoast SEO' );

if ( filter_input( INPUT_POST, 'do_export' ) ) {
	$export = new WPSEO_Export();
	$export->export();
	return;
}

$wpseo_export_phrase = sprintf(
	/* translators: %1$s expands to Yoast SEO */
	__( 'Export your %1$s settings here, to copy them on another site.', 'wordpress-seo' ),
	'Yoast SEO'
);
?>

<p><?php echo esc_html( $wpseo_export_phrase ); ?></p>
<form
	action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#wpseo-export' ) ); ?>"
	method="post"
	accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>">
	<?php wp_nonce_field( WPSEO_Export::NONCE_ACTION ); ?>
	<input type="hidden" name="do_export" value="1" />
	<button type="submit" class="button button-primary" id="export-button"><?php echo esc_html( $submit_button_value ); ?></button>
</form>
PK     ”T]�SÊ‰í   í     views/tabs/tool/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]¥Ñ&Yw  w     views/tabs/tool/wpseo-import.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

if ( ! defined( 'WPSEO_NAMESPACES' ) || ! WPSEO_NAMESPACES ) {
	esc_html_e( 'Import of settings is only supported on servers that run PHP 5.3 or higher.', 'wordpress-seo' );
	return;
}
?>
<p>
	<?php
	printf(
		/* translators: 1: Import settings button string from below. */
		esc_html__( 'Import settings by pasting the settings you copied from another site here and clicking "%s".', 'wordpress-seo' ),
		esc_html__( 'Import settings', 'wordpress-seo' )
	);
	?>
</p>

<form
	action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#wpseo-import' ) ); ?>"
	method="post"
	accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>">
	<?php wp_nonce_field( WPSEO_Import_Settings::NONCE_ACTION ); ?>
	<label class="screen-reader-text" for="settings-import">
		<?php
		printf(
			/* translators: %s expands to Yoast SEO */
			esc_html__( 'Paste your settings from another %s installation.', 'wordpress-seo' ),
			'Yoast SEO'
		);
		?>
	</label>
	<textarea id="settings-import" rows="10" cols="140" name="settings_import"></textarea><br/>
	<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Import settings', 'wordpress-seo' ); ?>"/>
</form>
PK     ”T]ç×\N˜  ˜  &  views/tabs/dashboard/site-analysis.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 *
 * @uses Yoast_Form $yform Form object.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

/**
 * Fires when displaying the site wide analysis tab.
 *
 * @param Yoast_Form $yform The yoast form object.
 */
do_action( 'wpseo_settings_tab_site_analysis', $yform );
PK     ”T]�SÊ‰í   í     views/tabs/dashboard/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]-û    "  views/tabs/dashboard/dashboard.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/** @noinspection PhpUnusedLocalVariableInspection */
$alerts_data = Yoast_Alerts::get_template_variables();

$notifier = new WPSEO_Configuration_Notifier();
$notifier->listen();

$wpseo_contributors_phrase = sprintf(
	/* translators: %1$s expands to Yoast SEO */
	__( 'See who contributed to %1$s.', 'wordpress-seo' ),
	'Yoast SEO'
);

?>

<div class="tab-block">
	<div class="yoast-alerts">

		<?php echo $notifier->notify(); ?>

		<div class="yoast-container yoast-container__alert">
			<?php require WPSEO_PATH . 'admin/views/partial-alerts-errors.php'; ?>
		</div>

		<div class="yoast-container yoast-container__warning">
			<?php require WPSEO_PATH . 'admin/views/partial-alerts-warnings.php'; ?>
		</div>

	</div>
</div>

<div class="tab-block">
	<h3><?php esc_html_e( 'Credits', 'wordpress-seo' ); ?></h3>
	<p>
		<span class="dashicons dashicons-groups"></span>
		<a href="<?php WPSEO_Shortlinker::show( 'http://yoa.st/yoast-seo-credits' ); ?>"><?php echo esc_html( $wpseo_contributors_phrase ); ?></a>
	</p>
</div>

<?php

/**
 * Action: 'wpseo_internal_linking' - Hook to add the internal linking analyze interface to the interface.
 *
 * @deprecated 7.0
 */
do_action_deprecated( 'wpseo_internal_linking', array(), 'WPSEO 7.0' );
PK     ”T]2Ö5=O  O  !  views/tabs/dashboard/features.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 *
 * @uses Yoast_Form $yform Form object.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$feature_toggles = Yoast_Feature_Toggles::instance()->get_all();

?>
<h2><?php esc_html_e( 'Features', 'wordpress-seo' ); ?></h2>
<div class="yoast-measure">
	<?php
	echo sprintf(
		/* translators: %1$s expands to Yoast SEO */
		esc_html__( '%1$s comes with a lot of features. You can enable / disable some of them below. Clicking the question mark gives more information about the feature.', 'wordpress-seo' ),
		'Yoast SEO'
	);

	foreach ( $feature_toggles as $feature ) {
		$help_text = esc_html( $feature->label );
		if ( ! empty( $feature->extra ) ) {
			$help_text .= ' ' . $feature->extra;
		}
		if ( ! empty( $feature->read_more_label ) ) {
			$help_text .= ' ';
			$help_text .= sprintf(
				'<a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a>',
				esc_url( WPSEO_Shortlinker::get( $feature->read_more_url ) ),
				esc_html( $feature->read_more_label )
			);
		}

		$feature_help = new WPSEO_Admin_Help_Panel(
			$feature->setting,
			/* translators: %s expands to a feature's name */
			sprintf( esc_html__( 'Help on: %s', 'wordpress-seo' ), esc_html( $feature->name ) ),
			$help_text
		);

		$yform->toggle_switch(
			$feature->setting,
			array(
				'on'  => __( 'On', 'wordpress-seo' ),
				'off' => __( 'Off', 'wordpress-seo' ),
			),
			'<strong>' . $feature->name . '</strong>',
			$feature_help->get_button_html() . $feature_help->get_panel_html()
		);
	}
	?>
</div>
<?php

/*
 * Required to prevent our settings framework from saving the default because the field isn't
 * explicitly set when saving the Dashboard page.
 */
$yform->hidden( 'show_onboarding_notice', 'wpseo_show_onboarding_notice' );
PK     ”T]#PóE  E  (  views/tabs/dashboard/webmaster-tools.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 *
 * @uses Yoast_Form $yform Form object.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$webmaster_tools_help = new WPSEO_Admin_Help_Panel(
	'dashboard-webmaster-tools',
	esc_html__( 'Learn more about the Webmaster Tools verification', 'wordpress-seo' ),
	esc_html__( 'You can use the boxes below to verify with the different Webmaster Tools. This feature will add a verification meta tag on your home page. Follow the links to the different Webmaster Tools and look for instructions for the meta tag verification method to get the verification code. If your site is already verified, you can just forget about these.', 'wordpress-seo' ),
	'has-wrapper'
);

echo '<h2 class="help-button-inline">' . esc_html__( 'Webmaster Tools verification', 'wordpress-seo' ) . $webmaster_tools_help->get_button_html() . '</h2>';
echo $webmaster_tools_help->get_panel_html();

$msverify_link = 'https://www.bing.com/toolbox/webmaster/#/Dashboard/?url=' .
	rawurlencode( str_replace( 'http://', '', get_bloginfo( 'url' ) ) );

$googleverify_link = add_query_arg(
	array(
		'hl'      => 'en',
		'tid'     => 'alternate',
		'siteUrl' => rawurlencode( get_bloginfo( 'url' ) ) . '/',
	),
	'https://www.google.com/webmasters/verification/verification'
);

$yform->textinput( 'baiduverify', __( 'Baidu verification code', 'wordpress-seo' ) );
echo '<p class="desc label">';
printf(
	/* translators: %1$s expands to a link start tag to the Baidu Webmaster Tools site add page, %2$s is the link closing tag. */
	esc_html__( 'Get your Baidu verification code in %1$sBaidu Webmaster Tools%2$s.', 'wordpress-seo' ),
	/**
	 * Get the Baidu Webmaster Tools site add link from this 3rd party article.
	 * {@link http://www.dragonmetrics.com/how-to-optimize-your-site-with-baidu-webmaster-tools/}
	 * We are unable to create a Baidu Webmaster Tools account due to the Chinese phone number verification.
	 */
	'<a target="_blank" href="' . esc_url( 'https://ziyuan.baidu.com/site/siteadd' ) . '" rel="noopener noreferrer">',
	'</a>'
);
echo '</p>';

$yform->textinput( 'msverify', __( 'Bing verification code', 'wordpress-seo' ) );
echo '<p class="desc label">';
printf(
	/* translators: 1: link open tag; 2: link close tag. */
	esc_html__( 'Get your Bing verification code in %1$sBing Webmaster Tools%2$s.', 'wordpress-seo' ),
	'<a target="_blank" href="' . esc_url( $msverify_link ) . '" rel="noopener noreferrer">',
	'</a>'
);
echo '</p>';

$yform->textinput( 'googleverify', __( 'Google verification code', 'wordpress-seo' ) );
echo '<p class="desc label">';
printf(
	/* translators: 1: link open tag; 2: link close tag. */
	esc_html__( 'Get your Google verification code in %1$sGoogle Search Console%2$s.', 'wordpress-seo' ),
	'<a target="_blank" href="' . esc_url( $googleverify_link ) . '" rel="noopener noreferrer">',
	'</a>'
);
echo '</p>';

$yform->textinput( 'yandexverify', __( 'Yandex verification code', 'wordpress-seo' ) );
echo '<p class="desc label">';
printf(
	/* translators: 1: link open tag; 2: link close tag. */
	esc_html__( 'Get your Yandex verification code in %1$sYandex Webmaster Tools%2$s.', 'wordpress-seo' ),
	'<a target="_blank" href="' . esc_url( 'https://webmaster.yandex.com/sites/add/' ) . '" rel="noopener noreferrer">',
	'</a>'
);
echo '</p>';
PK     ”T]�SÊ‰í   í     views/tabs/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]"Ê«°Ï  Ï    views/tabs/metas/archives.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

// To improve readability, this tab has been divided into separate blocks, included below.
require dirname( __FILE__ ) . '/archives/help.php';

$wpseo_archives = array(
	array(
		'title'     => esc_html__( 'Author archives settings', 'wordpress-seo' ),
		'view_file' => 'paper-content/author-archive-settings.php',
		'paper_id'  => 'settings-author-archives',
	),
	array(
		'title'     => esc_html__( 'Date archives settings', 'wordpress-seo' ),
		'view_file' => 'paper-content/date-archives-settings.php',
		'paper_id'  => 'settings-date-archives',
	),
	array(
		'title'     => esc_html__( 'Special Pages', 'wordpress-seo' ),
		'view_file' => 'paper-content/special-pages.php',
		'paper_id'  => 'settings-special-pages',
	),
);

$recommended_replace_vars     = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();

foreach ( $wpseo_archives as $wpseo_archive_index => $wpseo_archive ) {
	$wpseo_archive_presenter = new WPSEO_Paper_Presenter(
		$wpseo_archive['title'],
		dirname( __FILE__ ) . '/' . $wpseo_archive['view_file'],
		array(
			'collapsible'                  => true,
			'expanded'                     => ( $wpseo_archive_index === 0 ),
			'paper_id'                     => $wpseo_archive['paper_id'],
			'recommended_replace_vars'     => $recommended_replace_vars,
			'editor_specific_replace_vars' => $editor_specific_replace_vars,
		)
	);

	echo $wpseo_archive_presenter->get_output();
}

unset( $wpseo_archives, $wpseo_archive_presenter, $wpseo_archive_index );
PK     ”T]Žû+š  š    views/tabs/metas/general.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$wpseo_general_presenter = new WPSEO_Paper_Presenter(
	'',
	dirname( __FILE__ ) . '/paper-content/general-content.php',
	array(
		'paper_id'  => 'settings-general',
	)
);

echo $wpseo_general_presenter->get_output();
PK     ”T]#Òõ 8  8  ,  views/tabs/metas/taxonomies/category-url.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\Taxonomies
 *
 * @uses Yoast_Form $yform Form object.
 */

$remove_buttons = array( __( 'Keep', 'wordpress-seo' ), __( 'Remove', 'wordpress-seo' ) );

$stripcategorybase_help = new WPSEO_Admin_Help_Panel(
	'opengraph',
	esc_html__( 'Help on the category prefix setting', 'wordpress-seo' ),
	sprintf(
		/* translators: %s expands to <code>/category/</code> */
		esc_html__( 'Category URLs in WordPress contain a prefix, usually %s, this feature removes that prefix, for categories only.', 'wordpress-seo' ),
		'<code>/category/</code>'
	)
);

$yform->light_switch(
	'stripcategorybase',
	__( 'Remove the categories prefix', 'wordpress-seo' ),
	$remove_buttons,
	false,
	$stripcategorybase_help->get_button_html() . $stripcategorybase_help->get_panel_html()
);
PK     ”T]�SÊ‰í   í   %  views/tabs/metas/taxonomies/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]ŠX½ßé  é  "  views/tabs/metas/archives/help.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\Archive
 */

$archives_help_content = array(
	sprintf(
		/* translators: %1$s / %2$s: links to an article about duplicate content on yoast.com */
		esc_html__( 'If you\'re running a one author blog, the author archive will be exactly the same as your homepage. This is what\'s called a %1$sduplicate content problem%2$s.', 'wordpress-seo' ),
		'<a target="_blank" href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/duplicate-content' ) ) . '">',
		'</a>'
	),
	sprintf(
		/* translators: %s expands to <code>noindex, follow</code> */
		esc_html__( 'If this is the case on your site, you can choose to either disable it (which makes it redirect to the homepage), or to add %s to it so it doesn\'t show up in the search results.', 'wordpress-seo' ),
		'<code>noindex,follow</code>'
	),
	esc_html__( 'Note that links to archives might be still output by your theme and you would need to remove them separately.', 'wordpress-seo' ),
	esc_html__( 'Date-based archives could in some cases also be seen as duplicate content.', 'wordpress-seo' ),
);

$archives_help = new WPSEO_Admin_Help_Panel(
	'search-appearance-archives',
	__( 'Learn more about the archives setting', 'wordpress-seo' ),
	implode( ' ', $archives_help_content ),
	'has-wrapper'
);

echo '<p class="help-button-inline"><strong>' . esc_html__( 'Archives settings help', 'wordpress-seo' ) . $archives_help->get_button_html() . '</strong><p>';
echo $archives_help->get_panel_html();
PK     ”T]�SÊ‰í   í   #  views/tabs/metas/archives/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]Ü¼¸Æœ  œ  2  views/tabs/metas/paper-content/general-content.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\Media
 */

// To improve readability, this tab has been divided into separate blocks, included below.
require dirname( __FILE__ ) . '/general/force-rewrite-title.php';
require dirname( __FILE__ ) . '/general/title-separator.php';
require dirname( __FILE__ ) . '/general/homepage.php';
require dirname( __FILE__ ) . '/general/knowledge-graph.php';
PK     ”T]¡BÒFÂ  Â  3  views/tabs/metas/paper-content/taxonomy-content.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\Taxonomies
 *
 * @uses Yoast_Form                               $yform                        Form object.
 * @uses WP_Taxonomy                              $wpseo_taxonomy
 * @uses Yoast_View_Utils                         $view_utils
 * @uses string                                   $title
 * @uses WPSEO_Admin_Recommended_Replace_Vars     $recommended_replace_vars
 * @uses WPSEO_Admin_Editor_Specific_Replace_Vars $editor_specific_replace_vars
 */

if ( $wpseo_taxonomy->name === 'post_format' ) {
	$yform->light_switch(
		'disable-post_format',
		__( 'Format-based archives', 'wordpress-seo' ),
		array( __( 'Enabled', 'wordpress-seo' ), __( 'Disabled', 'wordpress-seo' ) ),
		false
	);
}

echo "<div id='" . esc_attr( $wpseo_taxonomy->name ) . "-titles-metas'>";

$taxonomies_help = $view_utils->search_results_setting_help( $wpseo_taxonomy );

$yform->index_switch(
	'noindex-tax-' . $wpseo_taxonomy->name,
	$title,
	$taxonomies_help->get_button_html() . $taxonomies_help->get_panel_html()
);


// Determine the page type for the term, this is needed for the recommended replacement variables.
$page_type = $recommended_replace_vars->determine_for_term( $wpseo_taxonomy->name );

$editor = new WPSEO_Replacevar_Editor(
	$yform,
	array(
		'title'                 => 'title-tax-' . $wpseo_taxonomy->name,
		'description'           => 'metadesc-tax-' . $wpseo_taxonomy->name,
		'page_type_recommended' => $recommended_replace_vars->determine_for_term( $wpseo_taxonomy->name ),
		'page_type_specific'    => $editor_specific_replace_vars->determine_for_term( $wpseo_taxonomy->name ),
		'paper_style'           => false,
	)
);
$editor->render();

if ( $wpseo_taxonomy->name !== 'post_format' ) {
	/* translators: %1$s expands to Yoast SEO */
	$yform->show_hide_switch( 'display-metabox-tax-' . $wpseo_taxonomy->name, sprintf( __( '%1$s Meta Box', 'wordpress-seo' ), 'Yoast SEO' ) );
}

/**
 * Allow adding custom checkboxes to the admin meta page - Taxonomies tab.
 *
 * @api  WPSEO_Admin_Pages  $yform  The WPSEO_Admin_Pages object
 * @api  Object             $tax    The taxonomy
 */
do_action( 'wpseo_admin_page_meta_taxonomies', $yform, $wpseo_taxonomy );

echo '</div>';
PK     ”T]†ìH�1  1  0  views/tabs/metas/paper-content/special-pages.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\Archive
 *
 * @uses Yoast_Form $yform Form object.
 */

$special_pages_help = new WPSEO_Admin_Help_Panel(
	'search-appearance-special-pages',
	__( 'Learn more about the special pages setting', 'wordpress-seo' ),
	sprintf(
		/* translators: %s expands to <code>noindex, follow</code>. */
		__( 'These pages will be %s by default, so they will never show up in search results.', 'wordpress-seo' ),
		'<code>noindex, follow</code>'
	),
	'has-wrapper'
);

$editor = new WPSEO_Replacevar_Field( $yform, 'title-search-wpseo', __( 'Search pages', 'wordpress-seo' ), 'search', 'search' );
$editor->render();

echo '<br/>';

$editor = new WPSEO_Replacevar_Field( $yform, 'title-404-wpseo', __( '404 pages', 'wordpress-seo' ), '404', '404' );
$editor->render();
PK     ”T]\$�Ý�  �  4  views/tabs/metas/paper-content/post-type-content.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\Taxonomies
 *
 * @uses Yoast_Form                               $yform                        Form object.
 * @uses WP_Post_Type                             $wpseo_post_type
 * @uses Yoast_View_Utils                         $view_utils
 * @uses WPSEO_Admin_Recommended_Replace_Vars     $recommended_replace_vars
 * @uses WPSEO_Admin_Editor_Specific_Replace_Vars $editor_specific_replace_vars
 */

$single_label = $wpseo_post_type->labels->singular_name;
$paper_style  = false;

/* translators: %s is the singular version of the post type's name. */
echo '<h3>' . esc_html( sprintf( __( 'Settings for single %s URLs', 'wordpress-seo' ), $wpseo_post_type->labels->singular_name ) ) . '</h3>';

require dirname( __FILE__ ) . '/post_type/post-type.php';

if ( $wpseo_post_type->name === 'product' && WPSEO_Utils::is_woocommerce_active() ) {
	require dirname( __FILE__ ) . '/post_type/woocommerce-shop-page.php';

	return;
}

if ( WPSEO_Post_Type::has_archive( $wpseo_post_type ) ) {
	$plural_label = $wpseo_post_type->labels->name;

	/* translators: %s is the plural version of the post type's name. */
	echo '<h3>' . esc_html( sprintf( __( 'Settings for %s archive', 'wordpress-seo' ), $plural_label ) ) . '</h3>';

	$custom_post_type_archive_help = $view_utils->search_results_setting_help( $wpseo_post_type, 'archive' );

	$yform->index_switch(
		'noindex-ptarchive-' . $wpseo_post_type->name,
		sprintf(
			/* translators: %s expands to the post type's name. */
			__( 'the archive for %s', 'wordpress-seo' ),
			$plural_label
		),
		$custom_post_type_archive_help->get_button_html() . $custom_post_type_archive_help->get_panel_html()
	);

	$page_type = $recommended_replace_vars->determine_for_archive( $wpseo_post_type->name );

	$editor = new WPSEO_Replacevar_Editor(
		$yform,
		array(
			'title'                 => 'title-ptarchive-' . $wpseo_post_type->name,
			'description'           => 'metadesc-ptarchive-' . $wpseo_post_type->name,
			'page_type_recommended' => $recommended_replace_vars->determine_for_archive( $wpseo_post_type->name ),
			'page_type_specific'    => $editor_specific_replace_vars->determine_for_archive( $wpseo_post_type->name ),
			'paper_style'           => false,
		)
	);
	$editor->render();

	if ( WPSEO_Options::get( 'breadcrumbs-enable' ) === true ) {
		/* translators: %s is the plural version of the post type's name. */
		echo '<h4>' . esc_html( sprintf( __( 'Breadcrumb settings for %s archive', 'wordpress-seo' ), $plural_label ) ) . '</h4>';
		$yform->textinput( 'bctitle-ptarchive-' . $wpseo_post_type->name, __( 'Breadcrumbs title', 'wordpress-seo' ) );
	}
}

/**
 * Allow adding a custom checkboxes to the admin meta page - Post Types tab.
 *
 * @api  WPSEO_Admin_Pages  $yform  The WPSEO_Admin_Pages object
 * @api  String  $name  The post type name
 */
do_action( 'wpseo_admin_page_meta_post_types', $yform, $wpseo_post_type->name );
PK     ”T]¯Tíú    6  views/tabs/metas/paper-content/post_type/post-type.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\PaperContent
 *
 * @uses Yoast_Form                               $yform                        Form object.
 * @uses WP_Taxonomy                              $wpseo_post_type
 * @uses Yoast_View_Utils                         $view_utils
 * @uses WPSEO_Admin_Recommended_Replace_Vars     $recommended_replace_vars
 * @uses WPSEO_Admin_Editor_Specific_Replace_Vars $editor_specific_replace_vars
 */

$show_post_type_help = $view_utils->search_results_setting_help( $wpseo_post_type );
$noindex_option_name = 'noindex-' . $wpseo_post_type->name;


$yform->index_switch(
	$noindex_option_name,
	$wpseo_post_type->labels->name,
	$show_post_type_help->get_button_html() . $show_post_type_help->get_panel_html()
);

$yform->show_hide_switch(
	'showdate-' . $wpseo_post_type->name,
	__( 'Date in Snippet Preview', 'wordpress-seo' )
);

$yform->show_hide_switch(
	'display-metabox-pt-' . $wpseo_post_type->name,
	/* translators: %1$s expands to Yoast SEO */
	sprintf( __( '%1$s Meta Box', 'wordpress-seo' ), 'Yoast SEO' )
);

$editor = new WPSEO_Replacevar_Editor(
	$yform,
	array(
		'title'                 => 'title-' . $wpseo_post_type->name,
		'description'           => 'metadesc-' . $wpseo_post_type->name,
		'page_type_recommended' => $recommended_replace_vars->determine_for_post_type( $wpseo_post_type->name ),
		'page_type_specific'    => $editor_specific_replace_vars->determine_for_post_type( $wpseo_post_type->name ),
		'paper_style'           => false,
	)
);
$editor->render();
PK     ”T]�SÊ‰í   í   2  views/tabs/metas/paper-content/post_type/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]8|ÞMœ  œ  B  views/tabs/metas/paper-content/post_type/woocommerce-shop-page.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\General
 *
 * @uses WP_Post_Type $wpseo_post_type
 */

$woocommerce_shop_page = new WPSEO_WooCommerce_Shop_Page();
$description           = __( 'You haven\'t set a Shop page in your WooCommerce settings. Please do this first.', 'wordpress-seo' );

if ( $woocommerce_shop_page->get_shop_page_id() !== -1 ) {
	$description = sprintf(
		/* translators: %1$s expands to an opening anchor tag, %2$s expands to a closing anchor tag. */
		__( 'You can edit the SEO meta-data for this custom type on the %1$sShop page%2$s.', 'wordpress-seo' ),
		'<a href="' . get_edit_post_link( $woocommerce_shop_page->get_shop_page_id() ) . '">',
		'</a>'
	);
}

/* translators: %s expands to the post type name. */
echo '<h3>' . esc_html( sprintf( __( 'Settings for %s archive', 'wordpress-seo' ), $wpseo_post_type->labels->name ) ) . '</h3>';
echo '<p>' . $description . '</p>';
PK     ”T]�SÊ‰í   í   (  views/tabs/metas/paper-content/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]SP²¸T  T  6  views/tabs/metas/paper-content/breadcrumbs-content.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\Breadcrumbs
 *
 * @uses Yoast_Form $yform Form object.
 */

if ( ! current_theme_supports( 'yoast-seo-breadcrumbs' ) ) {
	$yform->light_switch( 'breadcrumbs-enable', __( 'Enable Breadcrumbs', 'wordpress-seo' ) );
	echo '<br/>';
}
echo '<div id="breadcrumbsinfo">';

$yform->textinput( 'breadcrumbs-sep', __( 'Separator between breadcrumbs', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-home', __( 'Anchor text for the Homepage', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-prefix', __( 'Prefix for the breadcrumb path', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-archiveprefix', __( 'Prefix for Archive breadcrumbs', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-searchprefix', __( 'Prefix for Search Page breadcrumbs', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-404crumb', __( 'Breadcrumb for 404 Page', 'wordpress-seo' ) );

echo '<br/>';

if ( get_option( 'show_on_front' ) === 'page' && get_option( 'page_for_posts' ) > 0 ) {
	$yform->show_hide_switch( 'breadcrumbs-display-blog-page', __( 'Show Blog page', 'wordpress-seo' ) );
}

$yoast_free_breadcrumb_bold_texts = array(
	'on'  => __( 'Bold', 'wordpress-seo' ),
	'off' => __( 'Regular', 'wordpress-seo' ),
);
$yform->toggle_switch(
	'breadcrumbs-boldlast',
	$yoast_free_breadcrumb_bold_texts,
	__( 'Bold the last page', 'wordpress-seo' )
);

echo '<br/><br/>';

/*
 * WPSEO_Post_Type::get_accessible_post_types() should *not* be used here.
 * Even posts that are not indexed, should be able to get breadcrumbs for accessibility/usability.
 */
$post_types = get_post_types( array( 'public' => true ), 'objects' );
if ( is_array( $post_types ) && $post_types !== array() ) {
	echo '<h2>' . esc_html__( 'Taxonomy to show in breadcrumbs for content types', 'wordpress-seo' ) . '</h2>';
	foreach ( $post_types as $pt ) {
		$taxonomies = get_object_taxonomies( $pt->name, 'objects' );
		if ( is_array( $taxonomies ) && $taxonomies !== array() ) {
			$values = array( 0 => __( 'None', 'wordpress-seo' ) );
			foreach ( $taxonomies as $tax ) {
				if ( ! $tax->public ) {
					continue;
				}

				$values[ $tax->name ] = $tax->labels->singular_name;
			}
			$label = $pt->labels->name . ' (<code>' . $pt->name . '</code>)';
			$yform->select( 'post_types-' . $pt->name . '-maintax', $label, $values );
			unset( $values, $tax );
		}
		unset( $taxonomies );
	}
	unset( $pt );
}
echo '<br/>';

$taxonomies = get_taxonomies(
	array(
		'public'   => true,
	),
	'objects'
);

if ( is_array( $taxonomies ) && $taxonomies !== array() ) {
	echo '<h2>' . esc_html__( 'Content type archive to show in breadcrumbs for taxonomies', 'wordpress-seo' ) . '</h2>';
	foreach ( $taxonomies as $tax ) {
		$values = array( 0 => __( 'None', 'wordpress-seo' ) );
		if ( get_option( 'show_on_front' ) === 'page' && get_option( 'page_for_posts' ) > 0 ) {
			$values['post'] = __( 'Blog', 'wordpress-seo' );
		}

		if ( is_array( $post_types ) && $post_types !== array() ) {
			foreach ( $post_types as $pt ) {
				if ( WPSEO_Post_Type::has_archive( $pt ) ) {
					$values[ $pt->name ] = $pt->labels->name;
				}
			}
			unset( $pt );
		}
		$label = $tax->labels->singular_name . ' (<code>' . $tax->name . '</code>)';
		$yform->select( 'taxonomy-' . $tax->name . '-ptparent', $label, $values );
		unset( $values, $tax );
	}
}
unset( $taxonomies, $post_types );

?>
<br class="clear"/>
</div>
<h2><?php esc_html_e( 'How to insert breadcrumbs in your theme', 'wordpress-seo' ); ?></h2>
<p>
	<?php
	printf(
		/* translators: %1$s / %2$s: links to the breadcrumbs implementation page on the Yoast knowledgebase */
		esc_html__( 'Usage of this breadcrumbs feature is explained in %1$sour knowledge-base article on breadcrumbs implementation%2$s.', 'wordpress-seo' ),
		'<a href="' . esc_url( WPSEO_Shortlinker::get( 'http://yoa.st/breadcrumbs' ) ) . '" target="_blank">',
		'</a>'
	);
	?>
</p>
PK     ”T]j«m÷Å  Å  0  views/tabs/metas/paper-content/media-content.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\Media
 *
 * @uses Yoast_Form $yform Form object.
 */

$wpseo_post_type              = get_post_type_object( 'attachment' );
$recommended_replace_vars     = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
$view_utils                   = new Yoast_View_Utils();
?>
<p><strong><?php esc_html_e( 'We recommend you set this to Yes.', 'wordpress-seo' ); ?></strong></p>
<?php

$yoast_free_disable_attachments_texts = array(
	'on'  => __( 'Yes', 'wordpress-seo' ),
	'off' => __( 'No', 'wordpress-seo' ),
);
$yform->toggle_switch(
	'disable-attachment',
	$yoast_free_disable_attachments_texts,
	__( 'Redirect attachment URLs to the attachment itself?', 'wordpress-seo' )
);

?>
<div id="media_settings">
	<br/>
	<br/>

	<?php
	$noindex_option_name = 'noindex-' . $wpseo_post_type->name;

	if ( WPSEO_Options::get( 'is-media-purge-relevant' ) && WPSEO_Options::get( $noindex_option_name ) === false ) {
		$description =
			esc_html__( 'By enabling this option, attachment URLs become visible to both your visitors and Google. To add value to your website, they should contain useful information, or they might have a negative impact on your ranking.', 'wordpress-seo' ) . ' ' .
			sprintf(
				/* translators: %1$s expands to the link to the article, %2$s closes the link to the article */
				esc_html__( 'Please carefully consider the implications and %1$sread this post%2$s if you want more information about the impact of showing media in search results.', 'wordpress-seo' ),
				'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/2r8' ) ) . '" rel="noopener noreferrer" target="_blank">',
				'</a>'
			);

		echo '<div style="clear:both; background-color: #ffeb3b; color: #000000; padding: 16px; max-width: 450px; margin-bottom: 32px;">' . $description . '</div>';
	}

	require dirname( __FILE__ ) . '/post_type/post-type.php';
	?>
</div>
PK     ”T]÷¬˜Á–  –  >  views/tabs/metas/paper-content/general/force-rewrite-title.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\General
 *
 * @uses Yoast_Form $yform Form object.
 */

if ( ! current_theme_supports( 'title-tag' ) ) {
	?>
	<div class="tab-block">
		<?php
		$yform->light_switch( 'forcerewritetitle', __( 'Force rewrite titles', 'wordpress-seo' ) );
		echo '<p class="description">';
		printf(
			/* translators: %1$s expands to Yoast SEO */
			esc_html__( '%1$s has auto-detected whether it needs to force rewrite the titles for your pages, if you think it\'s wrong and you know what you\'re doing, you can change the setting here.', 'wordpress-seo' ),
			'Yoast SEO'
		);
		echo '</p>';
		?>
	</div>
	<?php
}
PK     ”T]fºƒy	  y	  :  views/tabs/metas/paper-content/general/knowledge-graph.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\General
 *
 * @uses    Yoast_Form $yform Form object.
 */

$knowledge_graph_help = new WPSEO_Admin_Help_Panel(
	'search-appearance-knowledge-graph',
	__( 'Learn more about the knowledge graph setting', 'wordpress-seo' ),
	sprintf(
		/* translators: %1$s opens the link to the Yoast.com article about Google's Knowledge Graph, %2$s closes the link, */
		__( 'This data is shown as metadata in your site. It is intended to appear in %1$sGoogle\'s Knowledge Graph%2$s. You can be either an organization, or a person.', 'wordpress-seo' ),
		'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/1-p' ) ) . '" target="_blank" rel="noopener noreferrer">',
		'</a>'
	),
	'has-wrapper'
);
?>
<div class="tab-block">
	<h2 class="help-button-inline"><?php echo esc_html__( 'Knowledge Graph & Schema.org', 'wordpress-seo' ) . $knowledge_graph_help->get_button_html(); ?></h2>
	<?php
	echo $knowledge_graph_help->get_panel_html();
	/**
	 * Filter: 'wpseo_knowledge_graph_setting_msg' - Allows adding a message above these settings.
	 *
	 * @api string unsigned Message.
	 */
	$message = apply_filters( 'wpseo_knowledge_graph_setting_msg', '' );
	if ( ! empty( $message ) ) {
		echo '<p><strong>', esc_html( $message ), '</strong></p>';
	}
	?>
	<p>
		<?php esc_html_e( 'Choose whether the site represents an organization or a person.', 'wordpress-seo' ); ?>
	</p>
	<?php
	$yoast_free_kg_select_options = array(
		'company' => __( 'Organization', 'wordpress-seo' ),
		'person'  => __( 'Person', 'wordpress-seo' ),
	);
	$yform->select( 'company_or_person', __( 'Organization or person', 'wordpress-seo' ), $yoast_free_kg_select_options, 'styled', false );
	?>
	<div id="knowledge-graph-company">
		<h3><?php esc_html_e( 'Organization', 'wordpress-seo' ); ?></h3>
		<?php
		$yform->textinput( 'company_name', __( 'Organization name', 'wordpress-seo' ), array( 'autocomplete' => 'organization' ) );
		$yform->media_input( 'company_logo', __( 'Organization logo', 'wordpress-seo' ) );
		?>
		<div id="wpseo-local-seo-upsell"></div>
	</div>
	<div id="knowledge-graph-person">
		<h3><?php esc_html_e( 'Personal info', 'wordpress-seo' ); ?></h3>
		<?php
		echo '<div id="wpseo-person-selector"></div>';
		$yform->media_input( 'person_logo', __( 'Person logo / avatar', 'wordpress-seo' ) );
		$yform->hidden( 'company_or_person_user_id', 'person_id' );
		?>
	</div>
</div>
PK     ”T]�SÊ‰í   í   0  views/tabs/metas/paper-content/general/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]¦×Ýl  l  3  views/tabs/metas/paper-content/general/homepage.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\General
 *
 * @uses Yoast_Form $yform Form object.
 */

?>
<div class="tab-block">
	<?php
	if ( 'posts' === get_option( 'show_on_front' ) ) {
		$homepage_help = new WPSEO_Admin_Help_Panel(
			'search-appearance-homepage',
			__( 'Learn more about the homepage setting', 'wordpress-seo' ),
			__( 'This is what shows in the search results when people find your homepage. This means this is probably what they see when they search for your brand name.', 'wordpress-seo' ),
			'has-wrapper'
		);

		echo '<h2 class="help-button-inline">', esc_html__( 'Homepage', 'wordpress-seo' ), $homepage_help->get_button_html(), '</h2>';
		echo $homepage_help->get_panel_html();

		$editor = new WPSEO_Replacevar_Editor(
			$yform,
			array(
				'title'                 => 'title-home-wpseo',
				'description'           => 'metadesc-home-wpseo',
				'page_type_recommended' => 'homepage',
				'page_type_specific'    => 'page',
				'paper_style'           => false,
			)
		);
		$editor->render();
	}
	else {
		echo '<h2>', esc_html__( 'Homepage &amp; Front page', 'wordpress-seo' ), '</h2>';
		echo '<p>';
		printf(
			/* translators: 1: link open tag; 2: link close tag. */
			esc_html__( 'You can determine the title and description for the front page by %1$sediting the front page itself%2$s.', 'wordpress-seo' ),
			'<a href="' . esc_url( get_edit_post_link( get_option( 'page_on_front' ) ) ) . '">',
			'</a>'
		);
		echo '</p>';
		if ( get_option( 'page_for_posts' ) > 0 ) {
			echo '<p>';
			printf(
				/* translators: 1: link open tag; 2: link close tag. */
				esc_html__( 'You can determine the title and description for the blog page by %1$sediting the blog page itself%2$s.', 'wordpress-seo' ),
				'<a href="' . esc_url( get_edit_post_link( get_option( 'page_for_posts' ) ) ) . '">',
				'</a>'
			);
			echo '</p>';
		}
	}
	?>
</div>
PK     ”T]ü:=�ù  ù  :  views/tabs/metas/paper-content/general/title-separator.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\General
 *
 * @uses Yoast_Form $yform Form object.
 */

$title_separator_help = new WPSEO_Admin_Help_Panel(
	'search-appearance-title-separator',
	__( 'Learn more about the title separator setting', 'wordpress-seo' ),
	__( 'Choose the symbol to use as your title separator. This will display, for instance, between your post title and site name. Symbols are shown in the size they\'ll appear in the search results.', 'wordpress-seo' ),
	'has-wrapper'
);
?>
<div class="tab-block">
	<h2 class="help-button-inline"><?php echo esc_html__( 'Title Separator', 'wordpress-seo' ) . $title_separator_help->get_button_html(); ?></h2>
	<?php
	echo $title_separator_help->get_panel_html();
	$legend      = __( 'Title separator symbol', 'wordpress-seo' );
	$legend_attr = array( 'class' => 'radiogroup screen-reader-text' );
	$yform->radio( 'separator', WPSEO_Option_Titles::get_instance()->get_separator_options_for_display(), $legend, $legend_attr );
	?>
</div>
PK     ”T]¶¥žq>  >  :  views/tabs/metas/paper-content/author-archive-settings.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\Archive
 *
 * @uses Yoast_Form $yform Form object.
 */

$yform->toggle_switch(
	'disable-author',
	array(
		'off' => __( 'Enabled', 'wordpress-seo' ),
		'on'  => __( 'Disabled', 'wordpress-seo' ),
	),
	__( 'Author archives', 'wordpress-seo' )
);

?>

<div id='author-archives-titles-metas-content' class='archives-titles-metas-content'>

<?php
$author_archives_help = new WPSEO_Admin_Help_Panel(
	'noindex-author-wpseo',
	esc_html__( 'Help on the author archives search results setting', 'wordpress-seo' ),
	sprintf(
		/* translators: 1: expands to <code>noindex</code>; 2: link open tag; 3: link close tag. */
		esc_html__( 'Not showing the archive for authors in the search results technically means those will have a %1$s robots meta and will be excluded from XML sitemaps. %2$sMore info on the search results settings%3$s.', 'wordpress-seo' ),
		'<code>noindex</code>',
		'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
		'</a>'
	)
);

$yform->index_switch(
	'noindex-author-wpseo',
	__( 'author archives', 'wordpress-seo' ),
	$author_archives_help->get_button_html() . $author_archives_help->get_panel_html()
);

?>

<div id='noindex-author-noposts-wpseo-container'>
<?php

$author_archives_no_posts_help = new WPSEO_Admin_Help_Panel(
	'noindex-author-noposts-wpseo',
	esc_html__( 'Help on the authors without posts archive search results setting', 'wordpress-seo' ),
	sprintf(
		/* translators: 1: expands to <code>noindex</code>; 2: link open tag; 3: link close tag. */
		esc_html__( 'Not showing the archives for authors without posts in the search results technically means those will have a %1$s robots meta and will be excluded from XML sitemaps. %2$sMore info on the search results settings%3$s.', 'wordpress-seo' ),
		'<code>noindex</code>',
		'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
		'</a>'
	)
);

$yform->index_switch(
	'noindex-author-noposts-wpseo',
	__( 'archives for authors without posts', 'wordpress-seo' ),
	$author_archives_no_posts_help->get_button_html() . $author_archives_no_posts_help->get_panel_html()
);

?>
</div>

<?php

$recommended_replace_vars     = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
$editor                       = new WPSEO_Replacevar_Editor(
	$yform,
	array(
		'title'                 => 'title-author-wpseo',
		'description'           => 'metadesc-author-wpseo',
		'page_type_recommended' => $recommended_replace_vars->determine_for_archive( 'author' ),
		'page_type_specific'    => $editor_specific_replace_vars->determine_for_archive( 'author' ),
		'paper_style'           => false,
	)
);

$editor->render();
?>
</div>
PK     ”T]:Zvàù  ù  .  views/tabs/metas/paper-content/rss-content.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\Rss
 *
 * @uses Yoast_Form $yform Form object.
 */

$textarea_atts = array(
	'cols' => '50',
	'rows' => '5',
);
$yform->textarea( 'rssbefore', __( 'Content to put before each post in the feed', 'wordpress-seo' ), $textarea_atts );
$yform->textarea( 'rssafter', __( 'Content to put after each post in the feed', 'wordpress-seo' ), $textarea_atts );

$rss_variables_help = new WPSEO_Admin_Help_Panel(
	'search-appearance-rss-variables',
	__( 'Learn more about the available variables', 'wordpress-seo' ),
	__( 'You can use the following variables within the content, they will be replaced by the value on the right.', 'wordpress-seo' ),
	'has-wrapper'
);

echo '<h2 class="help-button-inline">' . esc_html__( 'Available variables', 'wordpress-seo' ) . $rss_variables_help->get_button_html() . '</h2>';
echo $rss_variables_help->get_panel_html();
?>
<table class="wpseo yoast_help yoast-table-scrollable">
	<thead>
	<tr>
		<th scope="col"><?php esc_html_e( 'Variable', 'wordpress-seo' ); ?></th>
		<th scope="col"><?php esc_html_e( 'Description', 'wordpress-seo' ); ?></th>
	</tr>
	</thead>
	<tbody>
	<tr>
		<td class="yoast-variable-name">%%AUTHORLINK%%</td>
		<td class="yoast-variable-desc"><?php esc_html_e( 'A link to the archive for the post author, with the authors name as anchor text.', 'wordpress-seo' ); ?></td>
	</tr>
	<tr>
		<td class="yoast-variable-name">%%POSTLINK%%</td>
		<td class="yoast-variable-desc"><?php esc_html_e( 'A link to the post, with the title as anchor text.', 'wordpress-seo' ); ?></td>
	</tr>
	<tr>
		<td class="yoast-variable-name">%%BLOGLINK%%</td>
		<td class="yoast-variable-desc"><?php esc_html_e( "A link to your site, with your site's name as anchor text.", 'wordpress-seo' ); ?></td>
	</tr>
	<tr>
		<td class="yoast-variable-name">%%BLOGDESCLINK%%</td>
		<td class="yoast-variable-desc"><?php esc_html_e( "A link to your site, with your site's name and description as anchor text.", 'wordpress-seo' ); ?></td>
	</tr>
	</tbody>
</table>
PK     ”T]lK¨    9  views/tabs/metas/paper-content/date-archives-settings.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views\Archive
 *
 * @uses Yoast_Form $yform Form object.
 */

$yform->toggle_switch(
	'disable-date',
	array(
		'off' => __( 'Enabled', 'wordpress-seo' ),
		'on'  => __( 'Disabled', 'wordpress-seo' ),
	),
	__( 'Date archives', 'wordpress-seo' )
);

?>
<div id='date-archives-titles-metas-content' class='archives-titles-metas-content'>
	<?php
	$date_archives_help = new WPSEO_Admin_Help_Panel(
		'noindex-archive-wpseo',
		esc_html__( 'Help on the date archives search results setting', 'wordpress-seo' ),
		sprintf(
			/* translators: 1: expands to <code>noindex</code>; 2: link open tag; 3: link close tag. */
			esc_html__( 'Not showing the date archives in the search results technically means those will have a %1$s robots meta. %2$sMore info on the search results settings%3$s.', 'wordpress-seo' ),
			'<code>noindex</code>',
			'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
			'</a>'
		)
	);

	$yform->index_switch(
		'noindex-archive-wpseo',
		__( 'date archives', 'wordpress-seo' ),
		$date_archives_help->get_button_html() . $date_archives_help->get_panel_html()
	);

	$recommended_replace_vars     = new WPSEO_Admin_Recommended_Replace_Vars();
	$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();

	$editor = new WPSEO_Replacevar_Editor(
		$yform,
		array(
			'title'                 => 'title-archive-wpseo',
			'description'           => 'metadesc-archive-wpseo',
			'page_type_recommended' => $recommended_replace_vars->determine_for_archive( 'date' ),
			'page_type_specific'    => $editor_specific_replace_vars->determine_for_archive( 'date' ),
			'paper_style'           => false,
		)
	);
	$editor->render();
	?>
</div>
PK     ”T]íåÖÔÖ  Ö     views/tabs/metas/breadcrumbs.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$wpseo_breadcrumbs_presenter = new WPSEO_Paper_Presenter(
	esc_html__( 'Breadcrumbs settings', 'wordpress-seo' ),
	dirname( __FILE__ ) . '/paper-content/breadcrumbs-content.php',
	array(
		'paper_id'  => 'settings-breadcrumbs',
	)
);
echo $wpseo_breadcrumbs_presenter->get_output();
PK     ”T])x˜&  &    views/tabs/metas/taxonomies.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$wpseo_taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
if ( is_array( $wpseo_taxonomies ) && $wpseo_taxonomies !== array() ) {
	$view_utils                   = new Yoast_View_Utils();
	$recommended_replace_vars     = new WPSEO_Admin_Recommended_Replace_Vars();
	$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();

	// Explicitly hide all the core taxonomies we never want to do stuff for.
	$wpseo_taxonomies = array_diff_key( $wpseo_taxonomies, array_flip( array( 'link_category', 'nav_menu' ) ) );

	foreach ( array_values( $wpseo_taxonomies ) as $wpseo_taxonomy_index => $wpseo_taxonomy ) {
		$wpseo_taxonomy_presenter = new WPSEO_Paper_Presenter(
			$wpseo_taxonomy->labels->name,
			dirname( __FILE__ ) . '/paper-content/taxonomy-content.php',
			array(
				'collapsible' => true,
				'expanded'    => ( $wpseo_taxonomy_index === 0 ),
				'paper_id'    => 'settings-' . $wpseo_taxonomy->name,
				'view_data'   => array(
					'wpseo_taxonomy'               => $wpseo_taxonomy,
					'view_utils'                   => $view_utils,
					'recommended_replace_vars'     => $recommended_replace_vars,
					'editor_specific_replace_vars' => $editor_specific_replace_vars,
				),
				'title_after' => ' (<code>' . esc_html( $wpseo_taxonomy->name ) . '</code>)',
			)
		);
		echo $wpseo_taxonomy_presenter->get_output();
	}

	unset( $wpseo_taxonomy_index, $wpseo_taxonomy_presenter, $view_utils, $recommended_replace_vars );
}

unset( $wpseo_taxonomies );

printf( '<h2>%s</h2>', esc_html__( 'Category URLs', 'wordpress-seo' ) );
require dirname( __FILE__ ) . '/taxonomies/category-url.php';
PK     ”T]É–ó°Ž  Ž    views/tabs/metas/rss.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$wpseo_rss_presenter = new WPSEO_Paper_Presenter(
	esc_html__( 'RSS feed settings', 'wordpress-seo' ),
	dirname( __FILE__ ) . '/paper-content/rss-content.php',
	array(
		'help_text' => new WPSEO_Admin_Help_Panel(
			'search-appearance-rss',
			__( 'Learn more about the RSS feed setting', 'wordpress-seo' ),
			__( 'This feature is used to automatically add content to your RSS, more specifically, it\'s meant to add links back to your blog and your blog posts, so dumb scrapers will automatically add these links too, helping search engines identify you as the original source of the content.', 'wordpress-seo' ),
			'has-wrapper'
		),
		'paper_id'  => 'settings-rss-feed',
	)
);

echo $wpseo_rss_presenter->get_output();
PK     ”T]�SÊ‰í   í     views/tabs/metas/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]‘>õ«ú  ú    views/tabs/metas/post-types.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

/*
 * WPSEO_Post_Type::get_accessible_post_types() should *not* be used here.
 * Otherwise setting a post-type to `noindex` will remove it from the list,
 * making it very hard to restore the setting again.
 */
$wpseo_post_types = get_post_types( array( 'public' => true ), 'objects' );

// We'll show attachments on the Media tab.
$wpseo_post_types = WPSEO_Post_Type::filter_attachment_post_type( $wpseo_post_types );

echo '<p>';
esc_html_e( 'The settings on this page allow you to specify what the default search appearance should be for any type of content you have. You can choose which content types appear in search results and what their default description should be.', 'wordpress-seo' );
echo '</p>';

if ( is_array( $wpseo_post_types ) && $wpseo_post_types !== array() ) {
	$view_utils                   = new Yoast_View_Utils();
	$recommended_replace_vars     = new WPSEO_Admin_Recommended_Replace_Vars();
	$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();

	foreach ( array_values( $wpseo_post_types ) as $wpseo_post_type_index => $post_type ) {
		$wpseo_post_type_presenter = new WPSEO_Paper_Presenter(
			$post_type->labels->name,
			dirname( __FILE__ ) . '/paper-content/post-type-content.php',
			array(
				'collapsible' => true,
				'expanded'    => ( $wpseo_post_type_index === 0 ),
				'paper_id'    => 'settings-' . $post_type->name,
				'view_data'   => array(
					'wpseo_post_type'              => $post_type,
					'view_utils'                   => $view_utils,
					'recommended_replace_vars'     => $recommended_replace_vars,
					'editor_specific_replace_vars' => $editor_specific_replace_vars,
				),
				'title'       => $post_type->labels->name,
				'title_after' => ' (<code>' . esc_html( $post_type->name ) . '</code>)',
			)
		);

		echo $wpseo_post_type_presenter->get_output();
	}
}
PK     ”T]±oÂ        views/tabs/metas/media.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$wpseo_media_presenter = new WPSEO_Paper_Presenter(
	esc_html__( 'Media & attachment URLs', 'wordpress-seo' ),
	dirname( __FILE__ ) . '/paper-content/media-content.php',
	array(
		'help_text' => new WPSEO_Admin_Help_Panel(
			'search-appearance-media',
			__( 'Learn more about the Media and attachment URLs setting', 'wordpress-seo' ),
			__( 'When you upload media (an image or video for example) to WordPress, it doesn\'t just save the media, it creates an attachment URL for it. These attachment pages are quite empty: they contain the media item and maybe a title if you entered one. Because of that, if you never use these attachment URLs, it\'s better to disable them, and redirect them to the media item itself.', 'wordpress-seo' ),
			'has-wrapper'
		),
		'paper_id'  => 'settings-media-attachment-url',
	)
);

echo $wpseo_media_presenter->get_output();
PK     ”T]›,IÛI  I    views/tabs/social/accounts.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 *
 * @uses    Yoast_Form $yform Form object.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$social_profiles_help = new WPSEO_Admin_Help_Panel(
	'social-accounts',
	__( 'Learn more about your social profiles settings', 'wordpress-seo' ),
	__( 'To let search engines know which social profiles are associated to this site, enter your site social profiles data below.', 'wordpress-seo' ) . ' ' .
	__( 'If a Wikipedia page for you or your organization exists, add it too.', 'wordpress-seo' ),
	'has-wrapper'
);

$company_or_person = WPSEO_Options::get( 'company_or_person', '' );

$organization_social_fields = array(
	array(
		'id'    => 'facebook_site',
		'label' => __( 'Facebook Page URL', 'wordpress-seo' ),
	),
	array(
		'id'    => 'twitter_site',
		'label' => __( 'Twitter Username', 'wordpress-seo' ),
	),
	array(
		'id'    => 'instagram_url',
		'label' => __( 'Instagram URL', 'wordpress-seo' ),
	),
	array(
		'id'    => 'linkedin_url',
		'label' => __( 'LinkedIn URL', 'wordpress-seo' ),
	),
	array(
		'id'    => 'myspace_url',
		'label' => __( 'MySpace URL', 'wordpress-seo' ),
	),
	array(
		'id'    => 'pinterest_url',
		'label' => __( 'Pinterest URL', 'wordpress-seo' ),
	),
	array(
		'id'    => 'youtube_url',
		'label' => __( 'YouTube URL', 'wordpress-seo' ),
	),
	array(
		'id'    => 'wikipedia_url',
		'label' => __( 'Wikipedia URL', 'wordpress-seo' ),
	),
);

$yform = Yoast_Form::get_instance();

if ( $company_or_person === 'person' ) {
	echo '<div class="paper tab-block">';
	echo '<h2><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Your website is currently configured to represent a Person', 'wordpress-seo' ) . '</h2>';
	echo '<p><em>';
	esc_html_e( 'That means that the form and information below is disabled, and not used.', 'wordpress-seo' );
	echo '</em></p>';
	echo '<p>';
	$user_id = WPSEO_Options::get( 'company_or_person_user_id', '' );
	$person  = get_userdata( $user_id );
	printf(
		/* translators: 1: link to edit user page. */
		esc_html__( 'To change the social accounts used for your site, update the details for %1$s.', 'wordpress-seo' ),
		'<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $user_id ) ) . '">' . esc_html( $person->display_name ) . '</a>'
	);
	echo ' ';
	printf(
		/* translators: 1: link tag to the relevant WPSEO admin page; 2: link close tag. */
		esc_html__( 'To make your site represent a Company or Organization go to %1$sSearch Appearance%2$s and set Organization or Person to "Organization".', 'wordpress-seo' ),
		'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_titles' ) ) . '">',
		'</a>'
	);
	echo '</p></div>';

	// Organization social fields should still be rendered, because other wise the values are lost on save.
	foreach ( $organization_social_fields as $organization ) {
		$yform->hidden( $organization['id'] );
	}
}

if ( $company_or_person === 'company' ) {
	echo '<h2 class="help-button-inline">' . esc_html__( 'Organization social profiles', 'wordpress-seo' ) . $social_profiles_help->get_button_html() . '</h2>';
	echo $social_profiles_help->get_panel_html();

	foreach ( $organization_social_fields as $organization ) {
		$yform->textinput( $organization['id'], $organization['label'] );
	}
}

do_action( 'wpseo_admin_other_section' );
PK     ”T]Môûbl  l    views/tabs/social/pinterest.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 *
 * @uses Yoast_Form $yform Form object.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

echo '<h2>' . esc_html__( 'Pinterest settings', 'wordpress-seo' ) . '</h2>';

printf(
	'<p>%s</p>',
	esc_html__( 'Pinterest uses Open Graph metadata just like Facebook, so be sure to keep the Open Graph checkbox on the Facebook tab checked if you want to optimize your site for Pinterest.', 'wordpress-seo' )
);
printf(
	'<p>%s</p>',
	esc_html__( 'If you have already confirmed your website with Pinterest, you can skip the step below.', 'wordpress-seo' )
);

echo '<p>';
printf(
	/* translators: %1$s / %2$s expands to a link to pinterest.com's help page. */
	esc_html__( 'To %1$sconfirm your site with Pinterest%2$s, add the meta tag here:', 'wordpress-seo' ),
	'<a target="_blank" href="https://www.pinterest.com/settings/claim">',
	'</a>'
);
echo '</p>';

$yform->textinput( 'pinterestverify', __( 'Pinterest confirmation', 'wordpress-seo' ) );

do_action( 'wpseo_admin_pinterest_section' );
PK     ”T]�SÊ‰í   í     views/tabs/social/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]˜N¥Aq  q     views/tabs/social/twitterbox.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 *
 * @uses Yoast_Form $yform                                   Form object.
 * @uses array      WPSEO_Option_Social::$twitter_card_types
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

echo '<h2>' . esc_html__( 'Twitter settings', 'wordpress-seo' ) . '</h2>';

$yform->light_switch( 'twitter', __( 'Add Twitter card meta data', 'wordpress-seo' ) );

echo '<p>';
esc_html_e( 'Enable this feature if you want Twitter to display a preview with images and a text excerpt when a link to your site is shared.', 'wordpress-seo' );
echo '</p>';

echo '<br />';

$yform->select( 'twitter_card_type', __( 'The default card type to use', 'wordpress-seo' ), WPSEO_Option_Social::$twitter_card_types );

do_action( 'wpseo_admin_twitter_section' );
PK     ”T]†�–a  a    views/tabs/social/facebook.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 *
 * @uses Yoast_Form $yform Form object.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

echo '<h2>' . esc_html__( 'Facebook settings', 'wordpress-seo' ) . '</h2>';

$yform->light_switch( 'opengraph', __( 'Add Open Graph meta data', 'wordpress-seo' ) );

?>
	<p>
		<?php
			esc_html_e( 'Enable this feature if you want Facebook and other social media to display a preview with images and a text excerpt when a link to your site is shared.', 'wordpress-seo' );
		?>
	</p>

<?php

$yform->textinput( 'fbadminapp', __( 'Facebook App ID', 'wordpress-seo' ) );

if ( 'posts' === get_option( 'show_on_front' ) ) {
	$social_facebook_frontpage_help = new WPSEO_Admin_Help_Panel(
		'social-facebook-frontpage',
		esc_html__( 'Learn more about the title separator setting', 'wordpress-seo' ),
		esc_html__( 'These are the title, description and image used in the Open Graph meta tags on the front page of your site.', 'wordpress-seo' ),
		'has-wrapper'
	);
	echo '<h2 class="help-button-inline">' . esc_html__( 'Frontpage settings', 'wordpress-seo' ) . $social_facebook_frontpage_help->get_button_html() . '</h2>';
	echo $social_facebook_frontpage_help->get_panel_html();

	$yform->media_input( 'og_frontpage_image', __( 'Image URL', 'wordpress-seo' ) );
	$yform->textinput( 'og_frontpage_title', __( 'Title', 'wordpress-seo' ) );
	$yform->textinput( 'og_frontpage_desc', __( 'Description', 'wordpress-seo' ) );

	$copy_home_description_button_label = esc_html__( 'Copy home meta description', 'wordpress-seo' );

	// Offer copying of meta description.
	$homepage_meta_description = WPSEO_Options::get( 'metadesc-home-wpseo' );
	if ( ! empty( $homepage_meta_description ) ) {
		$copy_home_meta_desc_help = new WPSEO_Admin_Help_Panel(
			'copy-home-meda-desc',
			esc_html__( 'Help on copying the home meta description', 'wordpress-seo' ),
			sprintf(
				/* translators: 1: link open tag; 2: link close tag., 3: the translated label of the button */
				esc_html__( 'Click the "%3$s" button to use the meta description already set in the %1$sSearch Appearance Homepage%2$s setting.', 'wordpress-seo' ),
				'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_titles' ) ) . '">',
				'</a>',
				$copy_home_description_button_label
			)
		);

		echo '<input type="hidden" id="meta_description" value="', esc_attr( $homepage_meta_description ), '" />';
		echo '<div class="label desc copy-home-meta-description">' .
				'<button type="button" id="copy-home-meta-description" class="button">', $copy_home_description_button_label, '</button>' .
				$copy_home_meta_desc_help->get_button_html() .
				$copy_home_meta_desc_help->get_panel_html() .
			'</div>';
	}
}

echo '<h2>' . esc_html__( 'Default settings', 'wordpress-seo' ) . '</h2>';

$yform->media_input( 'og_default_image', __( 'Image URL', 'wordpress-seo' ) );

?>
	<p class="desc label">
		<?php esc_html_e( 'This image is used if the post/page being shared does not contain any images.', 'wordpress-seo' ); ?>
	</p>

<?php

do_action( 'wpseo_admin_opengraph_section' );
PK     ”T]"_‰ÄJ  J    views/tool-bulk-editor.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 * @since   1.5.0
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

/**
 * Sanitizes the parameters that have been sent.
 *
 * @return array The sanitized fields.
 */
function yoast_free_bulk_sanitize_input_fields() {
	$possible_params = array(
		'type',
		'paged',
		'post_type_filter',
		'post_status',
		'order',
		'orderby',
	);

	$input_get = array();
	foreach ( $possible_params as $param_name ) {
		if ( isset( $_GET[ $param_name ] ) ) {
			$input_get[ $param_name ] = sanitize_text_field( wp_unslash( $_GET[ $param_name ] ) );
		}
	}

	return $input_get;
}

$yoast_free_input_fields = yoast_free_bulk_sanitize_input_fields();

// Verifies the nonce.
if ( ! empty( $yoast_free_input_fields ) ) {
	check_admin_referer( 'bulk-editor-table', 'nonce' );
}

// If type is empty, fill it with value of first tab (title).
if ( ! isset( $yoast_free_input_fields['type'] ) ) {
	$yoast_free_input_fields['type'] = 'title';
}

$yoast_bulk_editor_arguments = array(
	'input_fields' => $yoast_free_input_fields,
	'nonce'        => wp_create_nonce( 'bulk-editor-table' ),
);

$wpseo_bulk_titles_table      = new WPSEO_Bulk_Title_Editor_List_Table( $yoast_bulk_editor_arguments );
$wpseo_bulk_description_table = new WPSEO_Bulk_Description_List_Table( $yoast_bulk_editor_arguments );

$yoast_free_screen_reader_content = array(
	'heading_views'      => __( 'Filter posts list', 'wordpress-seo' ),
	'heading_pagination' => __( 'Posts list navigation', 'wordpress-seo' ),
	'heading_list'       => __( 'Posts list', 'wordpress-seo' ),
);
get_current_screen()->set_screen_reader_content( $yoast_free_screen_reader_content );

if ( ! empty( $_REQUEST['_wp_http_referer'] ) && isset( $_SERVER['REQUEST_URI'] ) ) {
	$request_uri = sanitize_file_name( wp_unslash( $_SERVER['REQUEST_URI'] ) );

	wp_redirect(
		remove_query_arg(
			array( '_wp_http_referer', '_wpnonce' ),
			$request_uri
		)
	);
	exit;
}

/**
 * Outputs a help center.
 */
function wpseo_render_help_center() {
	$tabs = new WPSEO_Option_Tabs( '', '' );

	$bulk_editor_tab_title = new WPSEO_Option_Tab(
		'title',
		__( 'Bulk editor', 'wordpress-seo' ),
		array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-bulk-editor' ) )
	);
	$tabs->add_tab( $bulk_editor_tab_title );

	$bulk_editor_tab_description = new WPSEO_Option_Tab(
		'description',
		__( 'Bulk editor', 'wordpress-seo' ),
		array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-bulk-editor' ) )
	);
	$tabs->add_tab( $bulk_editor_tab_description );

	$helpcenter = new WPSEO_Help_Center( '', $tabs, WPSEO_Utils::is_yoast_seo_premium() );
	$helpcenter->localize_data();
	$helpcenter->mount();
}

/**
 * Renders a bulk editor tab.
 *
 * @param WPSEO_Bulk_List_Table $table The table to render.
 * @param string                $id    The id for the tab.
 */
function wpseo_get_rendered_tab( $table, $id ) {
	?>
	<div id="<?php echo esc_attr( $id ); ?>" class="wpseotab">
		<?php
		$table->show_page();
		?>
	</div>
	<?php
}

?>
<script>
	var wpseoBulkEditorNonce = <?php echo WPSEO_Utils::format_json_encode( wp_create_nonce( 'wpseo-bulk-editor' ) ); ?>;

	// eslint-disable-next-line
	var wpseo_bulk_editor_nonce = wpseoBulkEditorNonce;
</script>

<br/><br/>

<div class="wpseo_table_page">

	<h2 class="nav-tab-wrapper" id="wpseo-tabs">
		<a class="nav-tab" id="title-tab" href="#top#title"><?php esc_html_e( 'Title', 'wordpress-seo' ); ?></a>
		<a class="nav-tab" id="description-tab"
			href="#top#description"><?php esc_html_e( 'Description', 'wordpress-seo' ); ?></a>
	</h2>

	<?php wpseo_render_help_center(); ?>

	<div class="tabwrapper">
		<?php wpseo_get_rendered_tab( $wpseo_bulk_titles_table, 'title' ); ?>
		<?php wpseo_get_rendered_tab( $wpseo_bulk_description_table, 'description' ); ?>
	</div>
</div>
PK     ”T]³2#d  d    views/tool-file-editor.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$yform          = Yoast_Form::get_instance();
$robots_file    = get_home_path() . 'robots.txt';
$ht_access_file = get_home_path() . '.htaccess';

if ( isset( $_POST['create_robots'] ) ) {
	if ( ! current_user_can( 'edit_files' ) ) {
		$die_msg = sprintf(
			/* translators: %s expands to robots.txt. */
			__( 'You cannot create a %s file.', 'wordpress-seo' ),
			'robots.txt'
		);
		die( esc_html( $die_msg ) );
	}

	check_admin_referer( 'wpseo_create_robots' );

	ob_start();
	error_reporting( 0 );
	do_robots();
	$robots_content = ob_get_clean();

	$f = fopen( $robots_file, 'x' );
	fwrite( $f, $robots_content );
}

if ( isset( $_POST['submitrobots'] ) ) {
	if ( ! current_user_can( 'edit_files' ) ) {
		$die_msg = sprintf(
			/* translators: %s expands to robots.txt. */
			__( 'You cannot edit the %s file.', 'wordpress-seo' ),
			'robots.txt'
		);
		die( esc_html( $die_msg ) );
	}

	check_admin_referer( 'wpseo-robotstxt' );

	if ( isset( $_POST['robotsnew'] ) && file_exists( $robots_file ) ) {
		$robotsnew = sanitize_textarea_field( wp_unslash( $_POST['robotsnew'] ) );
		if ( is_writable( $robots_file ) ) {
			$f = fopen( $robots_file, 'w+' );
			fwrite( $f, $robotsnew );
			fclose( $f );
			$msg = sprintf(
				/* translators: %s expands to robots.txt. */
				__( 'Updated %s', 'wordpress-seo' ),
				'robots.txt'
			);
		}
	}
}

if ( isset( $_POST['submithtaccess'] ) ) {
	if ( ! current_user_can( 'edit_files' ) ) {
		$die_msg = sprintf(
			/* translators: %s expands to ".htaccess". */
			__( 'You cannot edit the %s file.', 'wordpress-seo' ),
			'.htaccess'
		);
		die( esc_html( $die_msg ) );
	}

	check_admin_referer( 'wpseo-htaccess' );

	if ( isset( $_POST['htaccessnew'] ) && file_exists( $ht_access_file ) ) {
		// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Writing to .htaccess file and escaping for HTML will break functionality.
		$ht_access_new = wp_unslash( $_POST['htaccessnew'] );
		if ( is_writable( $ht_access_file ) ) {
			$f = fopen( $ht_access_file, 'w+' );
			fwrite( $f, $ht_access_new );
			fclose( $f );
		}
	}
}

if ( is_multisite() ) {
	$action_url = network_admin_url( 'admin.php?page=wpseo_files' );
	$yform->admin_header( false, 'wpseo_ms' );
}
else {
	$action_url = admin_url( 'admin.php?page=wpseo_tools&tool=file-editor' );
}

if ( isset( $msg ) && ! empty( $msg ) ) {
	echo '<div id="message" class="notice notice-success"><p>', esc_html( $msg ), '</p></div>';
}

$helpcenter_tab = new WPSEO_Option_Tab(
	'bulk-editor',
	__( 'Bulk editor', 'wordpress-seo' ),
	array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-file-editor' ) )
);

$helpcenter = new WPSEO_Help_Center( 'bulk-editor', $helpcenter_tab, WPSEO_Utils::is_yoast_seo_premium() );
$helpcenter->localize_data();
$helpcenter->mount();

// N.B.: "robots.txt" is a fixed file name and should not be translatable.
echo '<h2>robots.txt</h2>';


if ( ! file_exists( $robots_file ) ) {
	if ( is_writable( get_home_path() ) ) {
		echo '<form action="', esc_url( $action_url ), '" method="post" id="robotstxtcreateform">';
		wp_nonce_field( 'wpseo_create_robots', '_wpnonce', true, true );
		echo '<p>';
		printf(
			/* translators: %s expands to robots.txt. */
			esc_html__( 'You don\'t have a %s file, create one here:', 'wordpress-seo' ),
			'robots.txt'
		);
		echo '</p>';

		printf(
			'<input type="submit" class="button" name="create_robots" value="%s">',
			sprintf(
				/* translators: %s expands to robots.txt. */
				esc_attr__( 'Create %s file', 'wordpress-seo' ),
				'robots.txt'
			)
		);
		echo '</form>';
	}
	else {
		echo '<p>';
		printf(
			/* translators: %s expands to robots.txt. */
			esc_html__( 'If you had a %s file and it was editable, you could edit it from here.', 'wordpress-seo' ),
			'robots.txt'
		);
		echo '</p>';
	}
}
else {
	$f = fopen( $robots_file, 'r' );

	$content = '';
	if ( filesize( $robots_file ) > 0 ) {
		$content = fread( $f, filesize( $robots_file ) );
	}

	if ( ! is_writable( $robots_file ) ) {
		echo '<p><em>';
		printf(
			/* translators: %s expands to robots.txt. */
			esc_html__( 'If your %s were writable, you could edit it from here.', 'wordpress-seo' ),
			'robots.txt'
		);
		echo '</em></p>';
		echo '<textarea class="large-text code" disabled="disabled" rows="15" name="robotsnew">', esc_textarea( $content ), '</textarea><br/>';
	}
	else {
		echo '<form action="', esc_url( $action_url ), '" method="post" id="robotstxtform">';
		wp_nonce_field( 'wpseo-robotstxt', '_wpnonce', true, true );
		echo '<p><label for="robotsnew" class="yoast-inline-label">';
		printf(
			/* translators: %s expands to robots.txt. */
			esc_html__( 'Edit the content of your %s:', 'wordpress-seo' ),
			'robots.txt'
		);
		echo '</label></p>';
		echo '<textarea class="large-text code" rows="15" name="robotsnew" id="robotsnew">', esc_textarea( $content ), '</textarea><br/>';
		printf(
			'<div class="submit"><input class="button" type="submit" name="submitrobots" value="%s" /></div>',
			sprintf(
				/* translators: %s expands to robots.txt. */
				esc_attr__( 'Save changes to %s', 'wordpress-seo' ),
				'robots.txt'
			)
		);
		echo '</form>';
	}
}
if ( ! WPSEO_Utils::is_nginx() ) {

	echo '<h2>';
	printf(
		/* translators: %s expands to ".htaccess". */
		esc_html__( '%s file', 'wordpress-seo' ),
		'.htaccess'
	);
	echo '</h2>';

	if ( file_exists( $ht_access_file ) ) {
		$f = fopen( $ht_access_file, 'r' );

		$contentht = '';
		if ( filesize( $ht_access_file ) > 0 ) {
			$contentht = fread( $f, filesize( $ht_access_file ) );
		}

		if ( ! is_writable( $ht_access_file ) ) {
			echo '<p><em>';
			printf(
				/* translators: %s expands to ".htaccess". */
				esc_html__( 'If your %s were writable, you could edit it from here.', 'wordpress-seo' ),
				'.htaccess'
			);
			echo '</em></p>';
			echo '<textarea class="large-text code" disabled="disabled" rows="15" name="robotsnew">', esc_textarea( $contentht ), '</textarea><br/>';
		}
		else {
			echo '<form action="', esc_url( $action_url ), '" method="post" id="htaccessform">';
			wp_nonce_field( 'wpseo-htaccess', '_wpnonce', true, true );
			echo '<p><label for="htaccessnew" class="yoast-inline-label">';
			printf(
				/* translators: %s expands to ".htaccess". */
				esc_html__( 'Edit the content of your %s:', 'wordpress-seo' ),
				'.htaccess'
			);
			echo '</label></p>';
			echo '<textarea class="large-text code" rows="15" name="htaccessnew" id="htaccessnew">', esc_textarea( $contentht ), '</textarea><br/>';
			printf(
				'<div class="submit"><input class="button" type="submit" name="submithtaccess" value="%s" /></div>',
				sprintf(
					/* translators: %s expands to ".htaccess". */
					esc_attr__( 'Save changes to %s', 'wordpress-seo' ),
					'.htaccess'
				)
			);
			echo '</form>';
		}
	}
	else {
		echo '<p>';
		printf(
			/* translators: %s expands to ".htaccess". */
			esc_html__( 'If you had a %s file and it was editable, you could edit it from here.', 'wordpress-seo' ),
			'.htaccess'
		);
		echo '</p>';
	}
}

if ( is_multisite() ) {
	$yform->admin_footer( false );
}
PK     ”T]�SÊ‰í   í     views/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T];¶èá      views/user-profile.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 *
 * @uses object $user
 */

/* translators: %1$s expands to Yoast SEO */
$wpseo_up_settings_header    = sprintf( __( '%1$s settings', 'wordpress-seo' ), 'Yoast SEO' );
$wpseo_no_index_author_label = sprintf(
	/* translators: %s expands to "this author's archives". */
	__( 'Do not allow search engines to show %s in search results.', 'wordpress-seo' ),
	__( 'this author\'s archives', 'wordpress-seo' )
);
?>

<div class="yoast yoast-settings">

	<h2 id="wordpress-seo"><?php echo esc_html( $wpseo_up_settings_header ); ?></h2>

	<?php if ( ! WPSEO_Options::get( 'disable-author' ) ) : ?>
	<label for="wpseo_author_title"><?php esc_html_e( 'Title to use for Author page', 'wordpress-seo' ); ?></label>
	<input class="yoast-settings__text regular-text" type="text" id="wpseo_author_title" name="wpseo_author_title"
		value="<?php echo esc_attr( get_the_author_meta( 'wpseo_title', $user->ID ) ); ?>"/><br>

	<label for="wpseo_author_metadesc"><?php esc_html_e( 'Meta description to use for Author page', 'wordpress-seo' ); ?></label>
	<textarea rows="5" cols="30" id="wpseo_author_metadesc"
		class="yoast-settings__textarea yoast-settings__textarea--medium"
		name="wpseo_author_metadesc"><?php echo esc_textarea( get_the_author_meta( 'wpseo_metadesc', $user->ID ) ); ?></textarea><br>

	<input class="yoast-settings__checkbox double" type="checkbox" id="wpseo_noindex_author"
		name="wpseo_noindex_author"
		value="on" <?php echo ( get_the_author_meta( 'wpseo_noindex_author', $user->ID ) === 'on' ) ? 'checked' : ''; ?> />
	<label class="yoast-label-strong"
		for="wpseo_noindex_author"><?php echo esc_html( $wpseo_no_index_author_label ); ?></label><br>
	<?php endif; ?>

	<?php if ( WPSEO_Options::get( 'keyword_analysis_active', false ) ) : ?>
		<input class="yoast-settings__checkbox double" type="checkbox" id="wpseo_keyword_analysis_disable"
			name="wpseo_keyword_analysis_disable" aria-describedby="wpseo_keyword_analysis_disable_desc"
			value="on" <?php echo ( get_the_author_meta( 'wpseo_keyword_analysis_disable', $user->ID ) === 'on' ) ? 'checked' : ''; ?> />
		<label class="yoast-label-strong"
			for="wpseo_keyword_analysis_disable"><?php esc_html_e( 'Disable SEO analysis', 'wordpress-seo' ); ?></label>
		<br>
		<p class="description" id="wpseo_keyword_analysis_disable_desc">
			<?php esc_html_e( 'Removes the focus keyphrase section from the metabox and disables all SEO-related suggestions.', 'wordpress-seo' ); ?>
		</p>
	<?php endif; ?>

	<?php if ( WPSEO_Options::get( 'content_analysis_active', false ) ) : ?>
		<input class="yoast-settings__checkbox double" type="checkbox" id="wpseo_content_analysis_disable"
			name="wpseo_content_analysis_disable" aria-describedby="wpseo_content_analysis_disable_desc"
			value="on" <?php echo ( get_the_author_meta( 'wpseo_content_analysis_disable', $user->ID ) === 'on' ) ? 'checked' : ''; ?> />
		<label class="yoast-label-strong"
			for="wpseo_content_analysis_disable"><?php esc_html_e( 'Disable readability analysis', 'wordpress-seo' ); ?></label>
		<br>
		<p class="description" id="wpseo_content_analysis_disable_desc">
			<?php esc_html_e( 'Removes the readability analysis section from the metabox and disables all readability-related suggestions.', 'wordpress-seo' ); ?>
		</p>
	<?php endif; ?>
</div>
PK     ”T]xK0ý’  ’  $  views/class-yoast-feature-toggle.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class representing a feature toggle.
 */
class Yoast_Feature_Toggle {

	/**
	 * Feature toggle identifier.
	 *
	 * @var string
	 */
	protected $name = '';

	/**
	 * Name of the setting the feature toggle is associated with.
	 *
	 * @var string
	 */
	protected $setting = '';

	/**
	 * Feature toggle label.
	 *
	 * @var string
	 */
	protected $label = '';

	/**
	 * URL to learn more about the feature.
	 *
	 * @var string
	 */
	protected $read_more_url = '';

	/**
	 * Label for the learn more link.
	 *
	 * @var string
	 */
	protected $read_more_label = '';

	/**
	 * Additional help content for the feature.
	 *
	 * @var string
	 */
	protected $extra = '';

	/**
	 * Value to specify the feature toggle order.
	 *
	 * @var string
	 */
	protected $order = 100;

	/**
	 * Constructor.
	 *
	 * Sets the feature toggle arguments.
	 *
	 * @param array $args {
	 *     Feature toggle arguments.
	 *
	 *     @type string $name            Required. Feature toggle identifier.
	 *     @type string $setting         Required. Name of the setting the feature toggle is associated with.
	 *     @type string $label           Required. Feature toggle label.
	 *     @type string $read_more_url   URL to learn more about the feature. Default empty string.
	 *     @type string $read_more_label Label for the learn more link. Default empty string.
	 *     @type string $extra           Additional help content for the feature. Default empty string.
	 *     @type int    $order           Value to specify the feature toggle order. A lower value indicates
	 *                                   a higher priority. Default 100.
	 * }
	 *
	 * @throws InvalidArgumentException Thrown when a required argument is missing.
	 */
	public function __construct( array $args ) {
		$required_keys = array( 'name', 'setting', 'label' );

		foreach ( $required_keys as $key ) {
			if ( empty( $args[ $key ] ) ) {
				/* translators: %s: argument name */
				throw new InvalidArgumentException( sprintf( __( '%s is a required feature toggle argument.', 'wordpress-seo' ), $key ) );
			}
		}

		foreach ( $args as $key => $value ) {
			if ( property_exists( $this, $key ) ) {
				$this->$key = $value;
			}
		}
	}

	/**
	 * Magic isset-er.
	 *
	 * @param string $key Key to check whether a value for it is set.
	 *
	 * @return bool True if set, false otherwise.
	 */
	public function __isset( $key ) {
		return isset( $this->$key );
	}

	/**
	 * Magic getter.
	 *
	 * @param string $key Key to get the value for.
	 *
	 * @return mixed Value for the key, or null if not set.
	 */
	public function __get( $key ) {
		if ( isset( $this->$key ) ) {
			return $this->$key;
		}

		return null;
	}

	/**
	 * Checks whether the feature for this toggle is enabled.
	 *
	 * @return bool True if the feature is enabled, false otherwise.
	 */
	public function is_enabled() {
		return (bool) WPSEO_Options::get( $this->setting );
	}
}
PK     ”T]’ÝŸd�  �  !  views/partial-alerts-warnings.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 *
 * @uses array $alerts_data
 */

$type     = 'warnings';
$dashicon = 'flag';

$i18n_title              = __( 'Notifications', 'wordpress-seo' );
$i18n_issues             = '';
$i18n_no_issues          = __( 'No new notifications.', 'wordpress-seo' );
$i18n_muted_issues_title = __( 'Muted notifications:', 'wordpress-seo' );

$active_total = count( $alerts_data['warnings']['active'] );
$total        = $alerts_data['metrics']['warnings'];

$active    = $alerts_data['warnings']['active'];
$dismissed = $alerts_data['warnings']['dismissed'];

require WPSEO_PATH . 'admin/views/partial-alerts-template.php';
PK     ”T]�ílª,  ,  %  views/class-yoast-feature-toggles.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class for managing feature toggles.
 */
class Yoast_Feature_Toggles {

	/**
	 * Available feature toggles.
	 *
	 * @var array
	 */
	protected $toggles;

	/**
	 * Instance holder.
	 *
	 * @var self|null
	 */
	protected static $instance = null;

	/**
	 * Gets the main feature toggles manager instance used.
	 *
	 * This essentially works like a Singleton, but for its drawbacks does not restrict
	 * instantiation otherwise.
	 *
	 * @return self Main instance.
	 */
	public static function instance() {
		if ( self::$instance === null ) {
			self::$instance = new self();
		}

		return self::$instance;
	}

	/**
	 * Gets all available feature toggles.
	 *
	 * @return array List of sorted Yoast_Feature_Toggle instances.
	 */
	public function get_all() {
		if ( $this->toggles === null ) {
			$this->toggles = $this->load_toggles();
		}

		return $this->toggles;
	}

	/**
	 * Loads the available feature toggles.
	 *
	 * Also ensures that the toggles are all Yoast_Feature_Toggle instances and sorted by their order value.
	 *
	 * @return array List of sorted Yoast_Feature_Toggle instances.
	 */
	protected function load_toggles() {
		$xml_sitemap_extra = false;
		if ( WPSEO_Options::get( 'enable_xml_sitemap' ) ) {
			$xml_sitemap_extra = '<a href="' . esc_url( WPSEO_Sitemaps_Router::get_base_url( 'sitemap_index.xml' ) )
				. '" target="_blank">' . esc_html__( 'See the XML sitemap.', 'wordpress-seo' ) . '</a>';
		}

		$feature_toggles = array(
			(object) array(
				'name'            => __( 'SEO analysis', 'wordpress-seo' ),
				'setting'         => 'keyword_analysis_active',
				'label'           => __( 'The SEO analysis offers suggestions to improve the SEO of your text.', 'wordpress-seo' ),
				'read_more_label' => __( 'Learn how the SEO analysis can help you rank.', 'wordpress-seo' ),
				'read_more_url'   => 'https://yoa.st/2ak',
				'order'           => 10,
			),
			(object) array(
				'name'            => __( 'Readability analysis', 'wordpress-seo' ),
				'setting'         => 'content_analysis_active',
				'label'           => __( 'The readability analysis offers suggestions to improve the structure and style of your text.', 'wordpress-seo' ),
				'read_more_label' => __( 'Discover why readability is important for SEO.', 'wordpress-seo' ),
				'read_more_url'   => 'https://yoa.st/2ao',
				'order'           => 20,
			),
			(object) array(
				'name'            => __( 'Cornerstone content', 'wordpress-seo' ),
				'setting'         => 'enable_cornerstone_content',
				'label'           => __( 'The cornerstone content feature lets you to mark and filter cornerstone content on your website.', 'wordpress-seo' ),
				'read_more_label' => __( 'Find out how cornerstone content can help you improve your site structure.', 'wordpress-seo' ),
				'read_more_url'   => 'https://yoa.st/dashboard-help-cornerstone',
				'order'           => 30,
			),
			(object) array(
				'name'            => __( 'Text link counter', 'wordpress-seo' ),
				'setting'         => 'enable_text_link_counter',
				'label'           => __( 'The text link counter helps you improve your site structure.', 'wordpress-seo' ),
				'read_more_label' => __( 'Find out how the text link counter can enhance your SEO.', 'wordpress-seo' ),
				'read_more_url'   => 'https://yoa.st/2aj',
				'order'           => 40,
			),
			(object) array(
				'name'            => __( 'XML sitemaps', 'wordpress-seo' ),
				'setting'         => 'enable_xml_sitemap',
				/* translators: %s: Yoast SEO */
				'label'           => sprintf( __( 'Enable the XML sitemaps that %s generates.', 'wordpress-seo' ), 'Yoast SEO' ),
				'read_more_label' => __( 'Read why XML Sitemaps are important for your site.', 'wordpress-seo' ),
				'read_more_url'   => 'https://yoa.st/2a-',
				'extra'           => $xml_sitemap_extra,
				'order'           => 60,
			),
			(object) array(
				/* translators: %s: Ryte */
				'name'            => sprintf( __( '%s integration', 'wordpress-seo' ), 'Ryte' ),
				'setting'         => 'onpage_indexability',
				'label'           => sprintf(
					/* translators: 1: Ryte, 2: Yoast SEO */
					__( '%1$s will check weekly if your site is still indexable by search engines and %2$s will notify you when this is not the case.', 'wordpress-seo' ),
					'Ryte',
					'Yoast SEO'
				),
				/* translators: %s: Ryte */
				'read_more_label' => sprintf( __( 'Read more about how %s works.', 'wordpress-seo' ), 'Ryte ' ),
				'read_more_url'   => 'https://yoa.st/2an',
				'order'           => 70,
			),
			(object) array(
				'name'    => __( 'Admin bar menu', 'wordpress-seo' ),
				'setting' => 'enable_admin_bar_menu',
				/* translators: 1: Yoast SEO */
				'label'   => sprintf( __( 'The %1$s admin bar menu contains useful links to third-party tools for analyzing pages and makes it easy to see if you have new notifications.', 'wordpress-seo' ), 'Yoast SEO' ),
				'order'   => 80,
			),
			(object) array(
				'name'    => __( 'Security: no advanced settings for authors', 'wordpress-seo' ),
				'setting' => 'disableadvanced_meta',
				'label'   => sprintf(
					/* translators: 1: Yoast SEO, 2: translated version of "Off" */
					__( 'The advanced section of the %1$s meta box allows a user to remove posts from the search results or change the canonical. These are things you might not want any author to do. That\'s why, by default, only editors and administrators can do this. Setting to "%2$s" allows all users to change these settings.', 'wordpress-seo' ),
					'Yoast SEO',
					__( 'Off', 'wordpress-seo' )
				),
				'order'   => 90,
			),
		);

		/**
		 * Filter to add feature toggles from add-ons.
		 *
		 * @param array $feature_toggles Array with feature toggle objects where each object
		 *                               should have a `name`, `setting` and `label` property.
		 */
		$feature_toggles = apply_filters( 'wpseo_feature_toggles', $feature_toggles );

		$feature_toggles = array_map( array( $this, 'ensure_toggle' ), $feature_toggles );
		usort( $feature_toggles, array( $this, 'sort_toggles_callback' ) );

		return $feature_toggles;
	}

	/**
	 * Ensures that the passed value is a Yoast_Feature_Toggle.
	 *
	 * @param Yoast_Feature_Toggle|object|array $toggle_data Feature toggle instance, or raw object or array
	 *                                                       containing feature toggle data.
	 * @return Yoast_Feature_Toggle Feature toggle instance based on $toggle_data.
	 */
	protected function ensure_toggle( $toggle_data ) {
		if ( $toggle_data instanceof Yoast_Feature_Toggle ) {
			return $toggle_data;
		}

		if ( is_object( $toggle_data ) ) {
			$toggle_data = get_object_vars( $toggle_data );
		}

		return new Yoast_Feature_Toggle( $toggle_data );
	}

	/**
	 * Callback for sorting feature toggles by their order.
	 *
	 * @param Yoast_Feature_Toggle $feature_a Feature A.
	 * @param Yoast_Feature_Toggle $feature_b Feature B.
	 *
	 * @return bool Whether order for feature A is bigger than for feature B.
	 */
	protected function sort_toggles_callback( Yoast_Feature_Toggle $feature_a, Yoast_Feature_Toggle $feature_b ) {
		return ( $feature_a->order > $feature_b->order );
	}
}
PK     ”T];Šú%û   û   &  views/interface-yoast-form-element.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Generate the HTML for a form element.
 */
interface Yoast_Form_Element {

	/**
	 * Return the HTML for the form element.
	 *
	 * @return string
	 */
	public function get_html();
}
PK     ”T]ç�J      views/partial-alerts-errors.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 *
 * @uses array $alerts_data
 */

$type     = 'alerts';
$dashicon = 'warning';

$i18n_title              = __( 'Problems', 'wordpress-seo' );
$i18n_issues             = __( 'We have detected the following issues that affect the SEO of your site.', 'wordpress-seo' );
$i18n_no_issues          = __( 'Good job! We could detect no serious SEO problems.', 'wordpress-seo' );
$i18n_muted_issues_title = __( 'Muted problems:', 'wordpress-seo' );

$active_total = count( $alerts_data['errors']['active'] );
$total        = $alerts_data['metrics']['errors'];

$active    = $alerts_data['errors']['active'];
$dismissed = $alerts_data['errors']['dismissed'];

require WPSEO_PATH . 'admin/views/partial-alerts-template.php';
PK     ”T]�SÊ‰í   í     views/form/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]öÃ&0  0    views/form/fieldset.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 *
 * @uses string $id                ID attribute for the fieldset.
 * @uses string $attributes        Additional attributes for the fieldset.
 * @uses string $legend_attributes Additional attributes for the legend.
 * @uses string $legend_content    The legend text.
 * @uses string $content           The fieldset content, i.e. a set of logically grouped form controls.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

?>

<fieldset id="<?php echo esc_attr( $id ); ?>"<?php echo $attributes; ?>>
	<legend id="<?php echo esc_attr( $id . '-legend' ); ?>"<?php echo $legend_attributes; ?>><?php echo esc_html( $legend_content ); ?></legend>
	<?php echo $content; ?>
</fieldset>
PK     ”T]N™¼©Ž  Ž    views/form/select.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 *
 * @uses string $attributes Additional attributes for the select.
 * @uses string $name       Value for the select name attribute.
 * @uses string $id         ID attribute for the select.
 * @uses array  $options    Array with the options to show.
 * @uses string $selected   The current set options.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

?>
<select <?php echo $attributes; ?>name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $id ); ?>">
	<?php foreach ( $options as $option_attribute_value => $option_html_value ) : ?>
	<option value="<?php echo esc_attr( $option_attribute_value ); ?>"<?php echo selected( $selected, $option_attribute_value, false ); ?>><?php echo esc_html( $option_html_value ); ?></option>
	<?php endforeach; ?>
</select>
PK     ”T];Öû²#  #    views/class-view-utils.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Views
 */

/**
 * Class Yoast_View_Utils.
 */
class Yoast_View_Utils {

	/**
	 * Form to use.
	 *
	 * @var Yoast_Form
	 */
	protected $form;

	/**
	 * Yoast_View_Utils constructor.
	 */
	public function __construct() {
		$this->form = Yoast_Form::get_instance();
	}

	/**
	 * Shows the search results help question mark and help section.
	 *
	 * Used for all the Help sections for indexable objects like post types, taxonomies, or archives.
	 *
	 * @param string|object $post_type        The post type to show the search results help for.
	 * @param string        $help_text_switch Switch the help text to one that's more appropriate
	 *                                        for the indexable object type the help section is for.
	 *
	 * @return object The help panel instance.
	 */
	public function search_results_setting_help( $post_type, $help_text_switch = '' ) {
		if ( ! is_object( $post_type ) ) {
			$post_type = get_post_type_object( $post_type );
		}

		/* translators: 1: expands to an indexable object's name, like a post type or taxonomy; 2: expands to <code>noindex</code>; 3: link open tag; 4: link close tag. */
		$help_text = esc_html__( 'Not showing %1$s in the search results technically means those will have a %2$s robots meta and will be excluded from XML sitemaps. %3$sMore info on the search results settings%4$s.', 'wordpress-seo' );

		if ( $help_text_switch === 'archive' ) {
			/* translators: 1: expands to an indexable object's name, like a post type or taxonomy; 2: expands to <code>noindex</code>; 3: link open tag; 4: link close tag. */
			$help_text = esc_html__( 'Not showing the archive for %1$s in the search results technically means those will have a %2$s robots meta and will be excluded from XML sitemaps. %3$sMore info on the search results settings%4$s.', 'wordpress-seo' );
		}

		$help_panel = new WPSEO_Admin_Help_Panel(
			// Sometimes the same post type is used more than once in the same page, we need a unique ID though.
			uniqid( 'noindex-' . $post_type->name ),
			esc_html__( 'Help on this search results setting', 'wordpress-seo' ),
			sprintf(
				$help_text,
				$post_type->labels->name,
				'<code>noindex</code>',
				'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
				'</a>'
			)
		);

		return $help_panel;
	}

	/**
	 * Shows the search appearance settings for a post type.
	 *
	 * @param string|object $post_type   The post type to show the search appearance settings for.
	 * @param bool          $paper_style Whether or not the paper style should be shown.
	 *
	 * @return void
	 */
	public function show_post_type_settings( $post_type, $paper_style = false ) {
		if ( ! is_object( $post_type ) ) {
			$post_type = get_post_type_object( $post_type );
		}

		$show_post_type_help = $this->search_results_setting_help( $post_type );
		$noindex_option_name = 'noindex-' . $post_type->name;

		$this->form->index_switch(
			$noindex_option_name,
			$post_type->labels->name,
			$show_post_type_help->get_button_html() . $show_post_type_help->get_panel_html()
		);

		$this->form->show_hide_switch(
			'showdate-' . $post_type->name,
			__( 'Date in Snippet Preview', 'wordpress-seo' )
		);

		$this->form->show_hide_switch(
			'display-metabox-pt-' . $post_type->name,
			/* translators: %1$s expands to Yoast SEO */
			sprintf( __( '%1$s Meta Box', 'wordpress-seo' ), 'Yoast SEO' )
		);

		$recommended_replace_vars     = new WPSEO_Admin_Recommended_Replace_Vars();
		$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();

		$editor = new WPSEO_Replacevar_Editor(
			$this->form,
			array(
				'title'                 => 'title-' . $post_type->name,
				'description'           => 'metadesc-' . $post_type->name,
				'page_type_recommended' => $recommended_replace_vars->determine_for_post_type( $post_type->name ),
				'page_type_specific'    => $editor_specific_replace_vars->determine_for_post_type( $post_type->name ),
				'paper_style'           => $paper_style,
			)
		);
		$editor->render();
	}
}
PK     ”T]äOÍG¸4  ¸4    views/licenses.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 * @since   5.1
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$extension_list = new WPSEO_Extensions();
$extensions     = $extension_list->get();

// First invalidate all licenses.
array_map( array( $extension_list, 'invalidate' ), $extensions );

$premium_extension = new WPSEO_Extension(
	array(
		'buyUrl'   => WPSEO_Shortlinker::get( 'https://yoa.st/zz' ),
		'infoUrl'  => WPSEO_Shortlinker::get( 'https://yoa.st/zy' ),
		'title'    => 'Yoast SEO Premium',
		/* translators: %1$s expands to Yoast SEO */
		'desc'     => sprintf( __( 'The premium version of %1$s with more features & support.', 'wordpress-seo' ), 'Yoast SEO' ),
		'image'    => plugins_url( 'images/extensions-premium-ribbon.png?v=' . WPSEO_VERSION, WPSEO_FILE ),
		'benefits' => array(),
	)
);

$extensions = array(
	WPSEO_Addon_Manager::LOCAL_SLUG => new WPSEO_Extension(
		array(
			'buyUrl'        => WPSEO_Shortlinker::get( 'https://yoa.st/zt' ),
			'infoUrl'       => WPSEO_Shortlinker::get( 'https://yoa.st/zs' ),
			'title'         => 'Local SEO',
			'display_title' => 'Stop losing customers to other local businesses',
			'desc'          => __( 'Rank better locally and in Google Maps, without breaking a sweat!', 'wordpress-seo' ),
			'image'         => plugins_url( 'images/extensions-local.png?v=' . WPSEO_VERSION, WPSEO_FILE ),
			'benefits'      => array(
				__( 'Get better search results in local search', 'wordpress-seo' ),
				__( 'Easily insert Google Maps, a store locator, opening hours and more', 'wordpress-seo' ),
				/* translators: %1$s expands to WooCommerce  */
				sprintf( __( 'Allow customers to pick up their %s order locally', 'wordpress-seo' ), 'WooCommerce' ),
			),
		)
	),
	WPSEO_Addon_Manager::VIDEO_SLUG => new WPSEO_Extension(
		array(
			'buyUrl'        => WPSEO_Shortlinker::get( 'https://yoa.st/zx/' ),
			'infoUrl'       => WPSEO_Shortlinker::get( 'https://yoa.st/zw/' ),
			'title'         => 'Video SEO',
			'display_title' => 'Start ranking better for your videos',
			'desc'          => __( 'Optimize your videos to show them off in search results and get more clicks!', 'wordpress-seo' ),
			'image'         => plugins_url( 'images/extensions-video.png?v=' . WPSEO_VERSION, WPSEO_FILE ),
			'benefits'      => array(
				__( 'Show your videos in Google Videos', 'wordpress-seo' ),
				__( 'Enhance the experience of sharing posts with videos', 'wordpress-seo' ),
				__( 'Make videos responsive through enabling fitvids.js', 'wordpress-seo' ),
			),
		)
	),
	WPSEO_Addon_Manager::NEWS_SLUG  => new WPSEO_Extension(
		array(
			'buyUrl'        => WPSEO_Shortlinker::get( 'https://yoa.st/zv/' ),
			'infoUrl'       => WPSEO_Shortlinker::get( 'https://yoa.st/zu/' ),
			'title'         => 'News SEO',
			'display_title' => 'Everything you need for Google News',
			'desc'          => __( 'Are you in Google News? Increase your traffic from Google News by optimizing for it!', 'wordpress-seo' ),
			'image'         => plugins_url( 'images/extensions-news.png?v=' . WPSEO_VERSION, WPSEO_FILE ),
			'benefits'      => array(
				__( 'Optimize your site for Google News', 'wordpress-seo' ),
				__( 'Immediately pings Google on the publication of a new post', 'wordpress-seo' ),
				__( 'Creates XML News Sitemaps', 'wordpress-seo' ),
			),
		)
	),
);

// Add Yoast WooCommerce SEO when WooCommerce is active.
if ( WPSEO_Utils::is_woocommerce_active() ) {
	$extensions[ WPSEO_Addon_Manager::WOOCOMMERCE_SLUG ] = new WPSEO_Extension(
		array(
			'buyUrl'        => WPSEO_Shortlinker::get( 'https://yoa.st/zr' ),
			'infoUrl'       => WPSEO_Shortlinker::get( 'https://yoa.st/zq' ),
			'title'         => 'Yoast WooCommerce SEO',
			'display_title' => 'Make your products stand out in Google',
			/* translators: %1$s expands to Yoast SEO */
			'desc'          => sprintf( __( 'Seamlessly integrate WooCommerce with %1$s and get extra features!', 'wordpress-seo' ), 'Yoast SEO' ),
			'image'         => plugins_url( 'images/extensions-woo.png?v=' . WPSEO_VERSION, WPSEO_FILE ),
			'benefits'      => array(
				sprintf( __( 'Improve sharing on Facebook and Pinterest', 'wordpress-seo' ) ),
				/* translators: %1$s expands to Yoast, %2$s expands to WooCommerce */
				sprintf( __( 'Use %1$s breadcrumbs instead of %2$s ones', 'wordpress-seo' ), 'Yoast', 'WooCommerce' ),
				/* translators: %1$s expands to Yoast SEO, %2$s expands to WooCommerce */
				sprintf( __( 'A seamless integration between %1$s and %2$s', 'wordpress-seo' ), 'Yoast SEO', 'WooCommerce' ),
			),
			'buy_button'    => 'WooCommerce SEO',
		)
	);
}

$addon_manager                  = new WPSEO_Addon_Manager();
$has_valid_premium_subscription = WPSEO_Utils::is_yoast_seo_premium() && $addon_manager->has_valid_subscription( WPSEO_Addon_Manager::PREMIUM_SLUG );

/* translators: %1$s expands to Yoast SEO. */
$wpseo_extensions_header = sprintf( __( '%1$s Extensions', 'wordpress-seo' ), 'Yoast SEO' );
$new_tab_message         = '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>'

?>

<div class="wrap yoast wpseo_table_page">

	<h1 id="wpseo-title" class="yoast-h1"><?php echo esc_html( $wpseo_extensions_header ); ?></h1>

	<div id="extensions">
		<section class="yoast-seo-premium-extension">
			<h2>
				<?php
				printf(
					/* translators: %1$s expands to Yoast SEO Premium */
					esc_html__( '%1$s, take your optimization to the next level!', 'wordpress-seo' ),
					'<span class="yoast-heading-highlight">' . $premium_extension->get_title() . '</span>'
				);
				?>
			</h2>

			<?php
			if ( ! $has_valid_premium_subscription ) :
				?>
				<ul class="yoast-seo-premium-benefits yoast-list--usp">
					<li class="yoast-seo-premium-benefits__item">
						<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Redirect manager', 'wordpress-seo' ); ?></span>
						<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'create and manage redirects from within your WordPress install.', 'wordpress-seo' ); ?></span>
					</li>
					<li class="yoast-seo-premium-benefits__item">
						<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Synonyms & related keyphrases', 'wordpress-seo' ); ?></span>
						<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'optimize a single post for synonyms and related keyphrases.', 'wordpress-seo' ); ?></span>
					</li>
					<li class="yoast-seo-premium-benefits__item">
						<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Social previews', 'wordpress-seo' ); ?></span>
						<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'check what your Facebook or Twitter post will look like.', 'wordpress-seo' ); ?></span>
					</li>
					<li class="yoast-seo-premium-benefits__item">
						<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Premium support', 'wordpress-seo' ); ?></span>
						<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'gain access to our 24/7 support team.', 'wordpress-seo' ); ?></span>
					</li>
				</ul>
			<?php endif; ?>
			<?php if ( $extension_list->is_installed( $premium_extension->get_title() ) ) : ?>
				<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-installed"><?php esc_html_e( 'Installed', 'wordpress-seo' ); ?></div>

				<?php if ( $has_valid_premium_subscription ) : ?>
					<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-activated"><?php esc_html_e( 'Activated', 'wordpress-seo' ); ?></div>
					<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>"
						class="yoast-link--license">
						<?php
						/* translators: %s expands to the extension title */
						printf( esc_html( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ), $premium_extension->get_title() );
						echo $new_tab_message;
						?>
					</a>
				<?php else : ?>
					<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-not-activated"><?php esc_html_e( 'Not activated', 'wordpress-seo' ); ?></div>
					<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13i' ); ?>"
						class="yoast-link--license">
						<?php
						/* translators: %s expands to the extension title */
						printf( esc_html( 'Activate %s for your site on MyYoast', 'wordpress-seo' ), $premium_extension->get_title() );
						echo $new_tab_message;
						?>
					</a>
				<?php endif; ?>

			<?php else : ?>

				<a target="_blank" href="<?php echo esc_url( $premium_extension->get_buy_url() ); ?>"
					class="yoast-button-upsell">
					<?php
					/* translators: $s expands to Yoast SEO Premium */
					printf( esc_html__( 'Buy %s', 'wordpress-seo' ), $premium_extension->get_title() );
					echo $new_tab_message;
					echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
					?>
				</a>

				<a target="_blank" href="<?php echo esc_url( $premium_extension->get_info_url() ); ?>"
					class="yoast-link--more-info">
					<?php
					printf(
						/* translators: Text between %1$s and %2$s will only be shown to screen readers. %3$s expands to the product name. */
						esc_html__( 'More information %1$sabout %3$s%2$s', 'wordpress-seo' ),
						'<span class="screen-reader-text">',
						'</span>',
						$premium_extension->get_title()
					);
					echo $new_tab_message;
					?>
				</a>
			<?php endif; ?>
			<?php if ( ! $has_valid_premium_subscription ) { ?>
				<p>
					<small class="yoast-money-back-guarantee"><?php esc_html_e( 'Comes with our 30-day no questions asked money back guarantee', 'wordpress-seo' ); ?></small>
				</p>
			<?php } ?>
		</section>

		<hr class="yoast-hr" aria-hidden="true"/>

		<section class="yoast-promo-extensions">
			<h2>
				<?php
				/* translators: %1$s expands to Yoast SEO */
				$yoast_seo_extensions = sprintf( __( '%1$s extensions', 'wordpress-seo' ), 'Yoast SEO' );
				$yoast_seo_extensions = '<span class="yoast-heading-highlight">' . $yoast_seo_extensions . '</span>';

				/* translators: %1$s expands to Yoast SEO extensions */
				printf( esc_html__( '%1$s to optimize your site even further', 'wordpress-seo' ), $yoast_seo_extensions );
				?>
			</h2>

			<?php foreach ( $extensions as $slug => $extension ) : ?>
				<section class="yoast-promoblock secondary yoast-promo-extension">
					<img alt="" width="280" height="147" src="<?php echo esc_attr( $extension->get_image() ); ?>"/>
					<h3><?php echo esc_html( $extension->get_display_title() ); ?></h3>

					<ul class="yoast-list--usp">
						<?php foreach ( $extension->get_benefits() as $benefit ) : ?>
							<li><?php echo esc_html( $benefit ); ?></li>
						<?php endforeach; ?>
					</ul>

					<div class="yoast-button-container">
						<?php if ( $extension_list->is_installed( $extension->get_title() ) ) : ?>
							<div class="yoast-button yoast-button--noarrow  yoast-button--extension yoast-button--extension-installed"><?php esc_html_e( 'Installed', 'wordpress-seo' ); ?></div>

							<?php if ( $addon_manager->has_valid_subscription( $slug ) ) : ?>
								<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-activated"><?php esc_html_e( 'Activated', 'wordpress-seo' ); ?></div>
								<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>"
									class="yoast-link--license">
									<?php
									/* translators: %s expands to the extension title */
									printf( esc_html( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ), $extension->get_title() );
									echo $new_tab_message;
									?>
								</a>
							<?php else : ?>
								<div class="yoast-button yoast-button--noarrow  yoast-button--extension yoast-button--extension-not-activated"><?php esc_html_e( 'Not activated', 'wordpress-seo' ); ?></div>
								<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13i' ); ?>"
									class="yoast-link--license">
									<?php
									/* translators: %s expands to the extension title */
									printf( esc_html( 'Activate %s for your site on MyYoast', 'wordpress-seo' ), $extension->get_title() );
									echo $new_tab_message;
									?>
								</a>
							<?php endif; ?>
						<?php else : ?>
							<a target="_blank" class="yoast-button-upsell"
								href="<?php echo esc_url( $extension->get_buy_url() ); ?>">
								<?php
								/* translators: %s expands to the product name */
								printf( esc_html__( 'Buy %s', 'wordpress-seo' ), $extension->get_buy_button() );
								echo $new_tab_message;
								echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
								?>
							</a>

							<a target="_blank" class="yoast-link--more-info"
								href="<?php echo esc_url( $extension->get_info_url() ); ?>">
								<?php
								printf(
									/* translators: Text between %1$s and %2$s will only be shown to screen readers. %3$s expands to the product name. */
									esc_html__( 'More information %1$sabout %3$s%2$s', 'wordpress-seo' ),
									'<span class="screen-reader-text">',
									'</span>',
									$extension->get_title()
								);
								echo $new_tab_message;
								?>
							</a>
						<?php endif; ?>
					</div>
				</section>
			<?php endforeach; ?>
		</section>
	</div>

</div>
PK     ”T]|é6X  6X    class-meta-columns.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class WPSEO_Meta_Columns.
 */
class WPSEO_Meta_Columns {

	/**
	 * @var WPSEO_Metabox_Analysis_SEO
	 */
	private $analysis_seo;

	/**
	 * @var WPSEO_Metabox_Analysis_Readability
	 */
	private $analysis_readability;

	/**
	 * When page analysis is enabled, just initialize the hooks.
	 */
	public function __construct() {
		if ( apply_filters( 'wpseo_use_page_analysis', true ) === true ) {
			add_action( 'admin_init', array( $this, 'setup_hooks' ) );
		}

		$this->analysis_seo         = new WPSEO_Metabox_Analysis_SEO();
		$this->analysis_readability = new WPSEO_Metabox_Analysis_Readability();
	}

	/**
	 * Sets up up the hooks.
	 */
	public function setup_hooks() {
		$this->set_post_type_hooks();

		if ( $this->analysis_seo->is_enabled() ) {
			add_action( 'restrict_manage_posts', array( $this, 'posts_filter_dropdown' ) );
		}

		if ( $this->analysis_readability->is_enabled() ) {
			add_action( 'restrict_manage_posts', array( $this, 'posts_filter_dropdown_readability' ) );
		}

		add_filter( 'request', array( $this, 'column_sort_orderby' ) );
	}

	/**
	 * Adds the column headings for the SEO plugin for edit posts / pages overview.
	 *
	 * @param array $columns Already existing columns.
	 *
	 * @return array Array containing the column headings.
	 */
	public function column_heading( $columns ) {
		if ( $this->display_metabox() === false ) {
			return $columns;
		}

		$added_columns = array();

		if ( $this->analysis_seo->is_enabled() ) {
			$added_columns['wpseo-score'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'SEO score', 'wordpress-seo' ) . '"><span class="yoast-column-seo-score yoast-column-header-has-tooltip"><span class="screen-reader-text">' . __( 'SEO score', 'wordpress-seo' ) . '</span></span></span>';
		}

		if ( $this->analysis_readability->is_enabled() ) {
			$added_columns['wpseo-score-readability'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'Readability score', 'wordpress-seo' ) . '"><span class="yoast-column-readability yoast-column-header-has-tooltip"><span class="screen-reader-text">' . __( 'Readability score', 'wordpress-seo' ) . '</span></span></span>';
		}

		$added_columns['wpseo-title']    = __( 'SEO Title', 'wordpress-seo' );
		$added_columns['wpseo-metadesc'] = __( 'Meta Desc.', 'wordpress-seo' );

		if ( $this->analysis_seo->is_enabled() ) {
			$added_columns['wpseo-focuskw'] = __( 'Keyphrase', 'wordpress-seo' );
		}

		return array_merge( $columns, $added_columns );
	}

	/**
	 * Displays the column content for the given column.
	 *
	 * @param string $column_name Column to display the content for.
	 * @param int    $post_id     Post to display the column content for.
	 */
	public function column_content( $column_name, $post_id ) {
		if ( $this->display_metabox() === false ) {
			return;
		}

		switch ( $column_name ) {
			case 'wpseo-score':
				echo $this->parse_column_score( $post_id );
				return;

			case 'wpseo-score-readability':
				echo $this->parse_column_score_readability( $post_id );
				return;

			case 'wpseo-title':
				$post  = get_post( $post_id, ARRAY_A );
				$title = wpseo_replace_vars( $this->page_title( $post_id ), $post );
				$title = apply_filters( 'wpseo_title', $title );

				echo esc_html( $title );
				return;

			case 'wpseo-metadesc':
				$post         = get_post( $post_id, ARRAY_A );
				$metadesc_val = wpseo_replace_vars( WPSEO_Meta::get_value( 'metadesc', $post_id ), $post );
				$metadesc_val = apply_filters( 'wpseo_metadesc', $metadesc_val );

				if ( '' === $metadesc_val ) {
					echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">',
						esc_html__( 'Meta description not set.', 'wordpress-seo' ),
						'</span>';
					return;
				}

				echo esc_html( $metadesc_val );
				return;

			case 'wpseo-focuskw':
				$focuskw_val = WPSEO_Meta::get_value( 'focuskw', $post_id );

				if ( '' === $focuskw_val ) {
					echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">',
						esc_html__( 'Focus keyphrase not set.', 'wordpress-seo' ),
						'</span>';
					return;
				}

				echo esc_html( $focuskw_val );
				return;
		}
	}

	/**
	 * Indicates which of the SEO columns are sortable.
	 *
	 * @param array $columns Appended with their orderby variable.
	 *
	 * @return array Array containing the sortable columns.
	 */
	public function column_sort( $columns ) {
		if ( $this->display_metabox() === false ) {
			return $columns;
		}

		$columns['wpseo-metadesc'] = 'wpseo-metadesc';

		if ( $this->analysis_seo->is_enabled() ) {
			$columns['wpseo-focuskw'] = 'wpseo-focuskw';
		}

		return $columns;
	}

	/**
	 * Hides the SEO title, meta description and focus keyword columns if the user hasn't chosen which columns to hide.
	 *
	 * @param array|false $result The hidden columns.
	 * @param string      $option The option name used to set which columns should be hidden.
	 * @param WP_User     $user   The User.
	 *
	 * @return array      $result Array containing the columns to hide.
	 */
	public function column_hidden( $result, $option, $user ) {
		global $wpdb;

		if ( $user->has_prop( $wpdb->get_blog_prefix() . $option ) || $user->has_prop( $option ) ) {
			return $result;
		}

		if ( ! is_array( $result ) ) {
			$result = array();
		}

		array_push( $result, 'wpseo-title', 'wpseo-metadesc' );

		if ( $this->analysis_seo->is_enabled() ) {
			array_push( $result, 'wpseo-focuskw' );
		}

		return $result;
	}

	/**
	 * Adds a dropdown that allows filtering on the posts SEO Quality.
	 */
	public function posts_filter_dropdown() {
		if ( ! $this->can_display_filter() ) {
			return;
		}

		$ranks = WPSEO_Rank::get_all_ranks();

		echo '<label class="screen-reader-text" for="wpseo-filter">' . esc_html__( 'Filter by SEO Score', 'wordpress-seo' ) . '</label>';
		echo '<select name="seo_filter" id="wpseo-filter">';

		echo $this->generate_option( '', __( 'All SEO Scores', 'wordpress-seo' ) );

		foreach ( $ranks as $rank ) {
			$selected = selected( $this->get_current_seo_filter(), $rank->get_rank(), false );

			echo $this->generate_option( $rank->get_rank(), $rank->get_drop_down_label(), $selected );
		}

		echo '</select>';
	}

	/**
	 * Adds a dropdown that allows filtering on the posts Readability Quality.
	 *
	 * @return void
	 */
	public function posts_filter_dropdown_readability() {
		if ( ! $this->can_display_filter() ) {
			return;
		}

		$ranks = WPSEO_Rank::get_all_readability_ranks();

		echo '<label class="screen-reader-text" for="wpseo-readability-filter">' . esc_html__( 'Filter by Readability Score', 'wordpress-seo' ) . '</label>';
		echo '<select name="readability_filter" id="wpseo-readability-filter">';

		echo $this->generate_option( '', __( 'All Readability Scores', 'wordpress-seo' ) );

		foreach ( $ranks as $rank ) {
			$selected = selected( $this->get_current_readability_filter(), $rank->get_rank(), false );

			echo $this->generate_option( $rank->get_rank(), $rank->get_drop_down_readability_labels(), $selected );
		}

		echo '</select>';
	}

	/**
	 * Generates an <option> element.
	 *
	 * @param string $value    The option's value.
	 * @param string $label    The option's label.
	 * @param string $selected HTML selected attribute for an option.
	 *
	 * @return string The generated <option> element.
	 */
	protected function generate_option( $value, $label, $selected = '' ) {
		return '<option ' . $selected . ' value="' . esc_attr( $value ) . '">' . esc_html( $label ) . '</option>';
	}

	/**
	 * Determines the SEO score filter to be later used in the meta query, based on the passed SEO filter.
	 *
	 * @param string $seo_filter The SEO filter to use to determine what further filter to apply.
	 *
	 * @return array The SEO score filter.
	 */
	protected function determine_seo_filters( $seo_filter ) {
		if ( $seo_filter === WPSEO_Rank::NO_FOCUS ) {
			return $this->create_no_focus_keyword_filter();
		}

		if ( $seo_filter === WPSEO_Rank::NO_INDEX ) {
			return $this->create_no_index_filter();
		}

		$rank = new WPSEO_Rank( $seo_filter );

		return $this->create_seo_score_filter( $rank->get_starting_score(), $rank->get_end_score() );
	}

	/**
	 * Determines the Readability score filter to the meta query, based on the passed Readability filter.
	 *
	 * @param string $readability_filter The Readability filter to use to determine what further filter to apply.
	 *
	 * @return array The Readability score filter.
	 */
	protected function determine_readability_filters( $readability_filter ) {
		$rank = new WPSEO_Rank( $readability_filter );

		return $this->create_readability_score_filter( $rank->get_starting_score(), $rank->get_end_score() );
	}

	/**
	 * Creates a keyword filter for the meta query, based on the passed Keyword filter.
	 *
	 * @param string $keyword_filter The keyword filter to use.
	 *
	 * @return array The keyword filter.
	 */
	protected function get_keyword_filter( $keyword_filter ) {
		return array(
			'post_type' => get_query_var( 'post_type', 'post' ),
			'key'       => WPSEO_Meta::$meta_prefix . 'focuskw',
			'value'     => sanitize_text_field( $keyword_filter ),
		);
	}

	/**
	 * Determines whether the passed filter is considered to be valid.
	 *
	 * @param mixed $filter The filter to check against.
	 *
	 * @return bool Whether or not the filter is considered valid.
	 */
	protected function is_valid_filter( $filter ) {
		return ! empty( $filter ) && is_string( $filter );
	}

	/**
	 * Collects the filters and merges them into a single array.
	 *
	 * @return array Array containing all the applicable filters.
	 */
	protected function collect_filters() {
		$active_filters = array();

		$seo_filter             = $this->get_current_seo_filter();
		$readability_filter     = $this->get_current_readability_filter();
		$current_keyword_filter = $this->get_current_keyword_filter();

		if ( $this->is_valid_filter( $seo_filter ) ) {
			$active_filters = array_merge(
				$active_filters,
				$this->determine_seo_filters( $seo_filter )
			);
		}

		if ( $this->is_valid_filter( $readability_filter ) ) {
			$active_filters = array_merge(
				$active_filters,
				$this->determine_readability_filters( $readability_filter )
			);
		}

		if ( $this->is_valid_filter( $current_keyword_filter ) ) {
			$active_filters = array_merge(
				$active_filters,
				$this->get_keyword_filter( $current_keyword_filter )
			);
		}

		return $active_filters;
	}

	/**
	 * Modify the query based on the filters that are being passed.
	 *
	 * @param array $vars Query variables that need to be modified based on the filters.
	 *
	 * @return array Array containing the meta query to use for filtering the posts overview.
	 */
	public function column_sort_orderby( $vars ) {
		$collected_filters = $this->collect_filters();

		if ( isset( $vars['orderby'] ) ) {
			$vars = array_merge( $vars, $this->filter_order_by( $vars['orderby'] ) );
		}

		return $this->build_filter_query( $vars, $collected_filters );
	}

	/**
	 * Retrieves the meta robots query values to be used within the meta query.
	 *
	 * @return array Array containing the query parameters regarding meta robots.
	 */
	protected function get_meta_robots_query_values() {
		return array(
			'relation' => 'OR',
			array(
				'key'     => WPSEO_Meta::$meta_prefix . 'meta-robots-noindex',
				'compare' => 'NOT EXISTS',
			),
			array(
				'key'     => WPSEO_Meta::$meta_prefix . 'meta-robots-noindex',
				'value'   => '1',
				'compare' => '!=',
			),
		);
	}

	/**
	 * Determines the score filters to be used. If more than one is passed, it created an AND statement for the query.
	 *
	 * @param array $score_filters Array containing the score filters.
	 *
	 * @return array Array containing the score filters that need to be applied to the meta query.
	 */
	protected function determine_score_filters( $score_filters ) {
		if ( count( $score_filters ) > 1 ) {
			return array_merge( array( 'relation' => 'AND' ), $score_filters );
		}

		return $score_filters;
	}

	/**
	 * Retrieves the post type from the $_GET variable.
	 *
	 * @return string The current post type.
	 */
	public function get_current_post_type() {
		return filter_input( INPUT_GET, 'post_type' );
	}

	/**
	 * Retrieves the SEO filter from the $_GET variable.
	 *
	 * @return string The current post type.
	 */
	public function get_current_seo_filter() {
		return filter_input( INPUT_GET, 'seo_filter' );
	}

	/**
	 * Retrieves the Readability filter from the $_GET variable.
	 *
	 * @return string The current post type.
	 */
	public function get_current_readability_filter() {
		return filter_input( INPUT_GET, 'readability_filter' );
	}

	/**
	 * Retrieves the keyword filter from the $_GET variable.
	 *
	 * @return string The current post type.
	 */
	public function get_current_keyword_filter() {
		return filter_input( INPUT_GET, 'seo_kw_filter' );
	}

	/**
	 * Uses the vars to create a complete filter query that can later be executed to filter out posts.
	 *
	 * @param array $vars    Array containing the variables that will be used in the meta query.
	 * @param array $filters Array containing the filters that we need to apply in the meta query.
	 *
	 * @return array Array containing the complete filter query.
	 */
	protected function build_filter_query( $vars, $filters ) {
		// If no filters were applied, just return everything.
		if ( count( $filters ) === 0 ) {
			return $vars;
		}

		$result               = array( 'meta_query' => array() );
		$result['meta_query'] = array_merge( $result['meta_query'], array( $this->determine_score_filters( $filters ) ) );

		$current_seo_filter = $this->get_current_seo_filter();

		// This only applies for the SEO score filter because it can because the SEO score can be altered by the no-index option.
		if ( $this->is_valid_filter( $current_seo_filter ) && ! in_array( $current_seo_filter, array( WPSEO_Rank::NO_INDEX, WPSEO_Rank::NO_FOCUS ), true ) ) {
			$result['meta_query'] = array_merge( $result['meta_query'], array( $this->get_meta_robots_query_values() ) );
		}

		return array_merge( $vars, $result );
	}

	/**
	 * Creates a Readability score filter.
	 *
	 * @param number $low  The lower boundary of the score.
	 * @param number $high The higher boundary of the score.
	 *
	 * @return array The Readability Score filter.
	 */
	protected function create_readability_score_filter( $low, $high ) {
		return array(
			array(
				'key'     => WPSEO_Meta::$meta_prefix . 'content_score',
				'value'   => array( $low, $high ),
				'type'    => 'numeric',
				'compare' => 'BETWEEN',
			),
		);
	}

	/**
	 * Creates an SEO score filter.
	 *
	 * @param number $low  The lower boundary of the score.
	 * @param number $high The higher boundary of the score.
	 *
	 * @return array The SEO score filter.
	 */
	protected function create_seo_score_filter( $low, $high ) {
		return array(
			array(
				'key'     => WPSEO_Meta::$meta_prefix . 'linkdex',
				'value'   => array( $low, $high ),
				'type'    => 'numeric',
				'compare' => 'BETWEEN',
			),
		);
	}

	/**
	 * Creates a filter to retrieve posts that were set to no-index.
	 *
	 * @return array Array containin the no-index filter.
	 */
	protected function create_no_index_filter() {
		return array(
			array(
				'key'     => WPSEO_Meta::$meta_prefix . 'meta-robots-noindex',
				'value'   => '1',
				'compare' => '=',
			),
		);
	}

	/**
	 * Creates a filter to retrieve posts that have no keyword set.
	 *
	 * @return array Array containing the no focus keyword filter.
	 */
	protected function create_no_focus_keyword_filter() {
		return array(
			array(
				'key'     => WPSEO_Meta::$meta_prefix . 'meta-robots-noindex',
				'value'   => 'needs-a-value-anyway',
				'compare' => 'NOT EXISTS',
			),
			array(
				'key'     => WPSEO_Meta::$meta_prefix . 'linkdex',
				'value'   => 'needs-a-value-anyway',
				'compare' => 'NOT EXISTS',
			),
		);
	}

	/**
	 * Determines whether a particular post_id is of an indexable post type.
	 *
	 * @param string $post_id The post ID to check.
	 *
	 * @return bool Whether or not it is indexable.
	 */
	protected function is_indexable( $post_id ) {
		if ( ! empty( $post_id ) && ! $this->uses_default_indexing( $post_id ) ) {
			return WPSEO_Meta::get_value( 'meta-robots-noindex', $post_id ) === '2';
		}

		$post = get_post( $post_id );

		if ( is_object( $post ) ) {
			// If the option is false, this means we want to index it.
			return WPSEO_Options::get( 'noindex-' . $post->post_type, false ) === false;
		}

		return true;
	}

	/**
	 * Determines whether the given post ID uses the default indexing settings.
	 *
	 * @param integer $post_id The post ID to check.
	 *
	 * @return bool Whether or not the default indexing is being used for the post.
	 */
	protected function uses_default_indexing( $post_id ) {
		return WPSEO_Meta::get_value( 'meta-robots-noindex', $post_id ) === '0';
	}

	/**
	 * Returns filters when $order_by is matched in the if-statement.
	 *
	 * @param string $order_by The ID of the column by which to order the posts.
	 *
	 * @return array Array containing the order filters.
	 */
	private function filter_order_by( $order_by ) {
		switch ( $order_by ) {
			case 'wpseo-metadesc':
				return array(
					'meta_key' => WPSEO_Meta::$meta_prefix . 'metadesc',
					'orderby'  => 'meta_value',
				);

			case 'wpseo-focuskw':
				return array(
					'meta_key' => WPSEO_Meta::$meta_prefix . 'focuskw',
					'orderby'  => 'meta_value',
				);
		}

		return array();
	}

	/**
	 * Parses the score column.
	 *
	 * @param integer $post_id The ID of the post for which to show the score.
	 *
	 * @return string The HTML for the SEO score indicator.
	 */
	private function parse_column_score( $post_id ) {
		if ( ! $this->is_indexable( $post_id ) ) {
			$rank  = new WPSEO_Rank( WPSEO_Rank::NO_INDEX );
			$title = __( 'Post is set to noindex.', 'wordpress-seo' );

			WPSEO_Meta::set_value( 'linkdex', 0, $post_id );

			return $this->render_score_indicator( $rank, $title );
		}

		if ( WPSEO_Meta::get_value( 'focuskw', $post_id ) === '' ) {
			$rank  = new WPSEO_Rank( WPSEO_Rank::NO_FOCUS );
			$title = __( 'Focus keyphrase not set.', 'wordpress-seo' );

			return $this->render_score_indicator( $rank, $title );
		}

		$score = (int) WPSEO_Meta::get_value( 'linkdex', $post_id );
		$rank  = WPSEO_Rank::from_numeric_score( $score );
		$title = $rank->get_label();

		return $this->render_score_indicator( $rank, $title );
	}

	/**
	 * Parsing the readability score column.
	 *
	 * @param int $post_id The ID of the post for which to show the readability score.
	 *
	 * @return string The HTML for the readability score indicator.
	 */
	private function parse_column_score_readability( $post_id ) {
		$score = (int) WPSEO_Meta::get_value( 'content_score', $post_id );
		$rank  = WPSEO_Rank::from_numeric_score( $score );

		return $this->render_score_indicator( $rank );
	}

	/**
	 * Sets up the hooks for the post_types.
	 */
	private function set_post_type_hooks() {
		$post_types = WPSEO_Post_Type::get_accessible_post_types();

		if ( ! is_array( $post_types ) || $post_types === array() ) {
			return;
		}

		foreach ( $post_types as $post_type ) {
			if ( $this->display_metabox( $post_type ) === false ) {
				continue;
			}

			add_filter( 'manage_' . $post_type . '_posts_columns', array( $this, 'column_heading' ), 10, 1 );
			add_action( 'manage_' . $post_type . '_posts_custom_column', array( $this, 'column_content' ), 10, 2 );
			add_action( 'manage_edit-' . $post_type . '_sortable_columns', array( $this, 'column_sort' ), 10, 2 );

			/*
			 * Use the `get_user_option_{$option}` filter to change the output of the get_user_option
			 * function for the `manage{$screen}columnshidden` option, which is based on the current
			 * admin screen. The admin screen we want to target is the `edit-{$post_type}` screen.
			 */
			$filter = sprintf( 'get_user_option_%s', sprintf( 'manage%scolumnshidden', 'edit-' . $post_type ) );

			add_filter( $filter, array( $this, 'column_hidden' ), 10, 3 );
		}

		unset( $post_type );
	}

	/**
	 * Wraps the WPSEO_Metabox check to determine whether the metabox should be displayed either by
	 * choice of the admin or because the post type is not a public post type.
	 *
	 * @since 7.0
	 *
	 * @param string $post_type Optional. The post type to test, defaults to the current post post_type.
	 *
	 * @return bool Whether or not the meta box (and associated columns etc) should be hidden.
	 */
	private function display_metabox( $post_type = null ) {
		$current_post_type = sanitize_text_field( $this->get_current_post_type() );

		if ( ! isset( $post_type ) && ! empty( $current_post_type ) ) {
			$post_type = $current_post_type;
		}

		return WPSEO_Utils::is_metabox_active( $post_type, 'post_type' );
	}

	/**
	 * Retrieve the page title.
	 *
	 * @param int $post_id Post to retrieve the title for.
	 *
	 * @return string
	 */
	private function page_title( $post_id ) {
		$fixed_title = WPSEO_Meta::get_value( 'title', $post_id );
		if ( $fixed_title !== '' ) {
			return $fixed_title;
		}

		$post = get_post( $post_id );

		if ( is_object( $post ) && WPSEO_Options::get( 'title-' . $post->post_type, '' ) !== '' ) {
			$title_template = WPSEO_Options::get( 'title-' . $post->post_type );
			$title_template = str_replace( ' %%page%% ', ' ', $title_template );

			return wpseo_replace_vars( $title_template, $post );
		}

		return wpseo_replace_vars( '%%title%%', $post );
	}

	/**
	 * @param WPSEO_Rank $rank  The rank this indicator should have.
	 * @param string     $title Optional. The title for this rank, defaults to the title of the rank.
	 *
	 * @return string The HTML for a score indicator.
	 */
	private function render_score_indicator( $rank, $title = '' ) {
		if ( empty( $title ) ) {
			$title = $rank->get_label();
		}

		return '<div aria-hidden="true" title="' . esc_attr( $title ) . '" class="wpseo-score-icon ' . esc_attr( $rank->get_css_class() ) . '"></div><span class="screen-reader-text wpseo-score-text">' . $title . '</span>';
	}

	/**
	 * Determines whether or not filter dropdowns should be displayed.
	 *
	 * @return bool Whether or the current page can display the filter drop downs.
	 */
	public function can_display_filter() {
		if ( $GLOBALS['pagenow'] === 'upload.php' ) {
			return false;
		}

		if ( $this->display_metabox() === false ) {
			return false;
		}

		$screen = get_current_screen();
		if ( null === $screen ) {
			return false;
		}

		return WPSEO_Post_Type::is_post_type_accessible( $screen->post_type );
	}
}
PK     ”T]ëCë        class-yoast-columns.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents the yoast columns.
 */
class WPSEO_Yoast_Columns implements WPSEO_WordPress_Integration {

	/**
	 * Registers all hooks to WordPress.
	 */
	public function register_hooks() {
		add_action( 'load-edit.php', array( $this, 'add_help_tab' ) );
	}

	/**
	 * Adds the help tab to the help center for current screen.
	 */
	public function add_help_tab() {
		$screen = get_current_screen();
		$screen->add_help_tab(
			array(
				/* translators: %s expands to Yoast */
				'title'    => sprintf( __( '%s Columns', 'wordpress-seo' ), 'Yoast' ),
				'id'       => 'yst-columns',
				'content'  => sprintf(
					/* translators: %1$s: Yoast SEO, %2$s: Link to article about content analysis, %3$s: Anchor closing, %4$s: Link to article about text links, %5$s: Emphasis open tag, %6$s: Emphasis close tag */
					'<p>' . __( '%1$s adds several columns to this page. We\'ve written an article about %2$show to use the SEO score and Readability score%3$s. The links columns show the number of articles on this site linking %5$sto%6$s this article and the number of URLs linked %5$sfrom%6$s this article. Learn more about %4$show to use these features to improve your internal linking%3$s, which greatly enhances your SEO.', 'wordpress-seo' ) . '</p>',
					'Yoast SEO',
					'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/16p' ) . '">',
					'</a>',
					'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/16q' ) . '">',
					'<em>',
					'</em>'
				),
				'priority' => 15,
			)
		);
	}
}
PK     ”T]P) 	 "   "    class-primary-term-admin.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Adds the UI to change the primary term for a post.
 */
class WPSEO_Primary_Term_Admin implements WPSEO_WordPress_Integration {

	/**
	 * Constructor.
	 */
	public function register_hooks() {
		add_filter( 'wpseo_content_meta_section_content', array( $this, 'add_input_fields' ) );

		add_action( 'admin_footer', array( $this, 'wp_footer' ), 10 );

		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );

		add_action( 'save_post', array( $this, 'save_primary_terms' ) );

		$primary_term = new WPSEO_Frontend_Primary_Category();
		$primary_term->register_hooks();
	}

	/**
	 * Gets the current post ID.
	 *
	 * @return integer The post ID.
	 */
	protected function get_current_id() {
		$post_id = filter_input( INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT );
		if ( empty( $post_id ) && isset( $GLOBALS['post_ID'] ) ) {
			$post_id = filter_var( $GLOBALS['post_ID'], FILTER_SANITIZE_NUMBER_INT );
		}

		return $post_id;
	}

	/**
	 * Adds hidden fields for primary taxonomies.
	 *
	 * @param string $content The metabox content.
	 *
	 * @return string The HTML content.
	 */
	public function add_input_fields( $content ) {
		$taxonomies = $this->get_primary_term_taxonomies();

		foreach ( $taxonomies as $taxonomy ) {
			$content .= $this->primary_term_field( $taxonomy->name );
			$content .= wp_nonce_field( 'save-primary-term', WPSEO_Meta::$form_prefix . 'primary_' . $taxonomy->name . '_nonce', false, false );
		}
		return $content;
	}

	/**
	 * Generates the HTML for a hidden field for a primary taxonomy.
	 *
	 * @param string $taxonomy_name The taxonomy's slug.
	 *
	 * @return string The HTML for a hidden primary taxonomy field.
	 */
	protected function primary_term_field( $taxonomy_name ) {
		return sprintf(
			'<input class="yoast-wpseo-primary-term" type="hidden" id="%1$s" name="%2$s" value="%3$s" />',
			esc_attr( $this->generate_field_id( $taxonomy_name ) ),
			esc_attr( $this->generate_field_name( $taxonomy_name ) ),
			esc_attr( $this->get_primary_term( $taxonomy_name ) )
		);
	}

	/**
	 * Generates an id for a primary taxonomy's hidden field.
	 *
	 * @param string $taxonomy_name The taxonomy's slug.
	 *
	 * @return string The field id.
	 */
	protected function generate_field_id( $taxonomy_name ) {
		return 'yoast-wpseo-primary-' . $taxonomy_name;
	}

	/**
	 * Generates a name for a primary taxonomy's hidden field.
	 *
	 * @param string $taxonomy_name The taxonomy's slug.
	 *
	 * @return string The field id.
	 */
	protected function generate_field_name( $taxonomy_name ) {
		return WPSEO_Meta::$form_prefix . 'primary_' . $taxonomy_name . '_term';
	}

	/**
	 * Adds primary term templates.
	 */
	public function wp_footer() {
		$taxonomies = $this->get_primary_term_taxonomies();

		if ( ! empty( $taxonomies ) ) {
			$this->include_js_templates();
		}
	}

	/**
	 * Enqueues all the assets needed for the primary term interface.
	 *
	 * @return void
	 */
	public function enqueue_assets() {
		global $pagenow;

		if ( ! WPSEO_Metabox::is_post_edit( $pagenow ) ) {
			return;
		}

		$taxonomies = $this->get_primary_term_taxonomies();

		// Only enqueue if there are taxonomies that need a primary term.
		if ( empty( $taxonomies ) ) {
			return;
		}

		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_style( 'primary-category' );
		$asset_manager->enqueue_script( 'primary-category' );

		$mapped_taxonomies = $this->get_mapped_taxonomies_for_js( $taxonomies );

		$data = array(
			'taxonomies' => $mapped_taxonomies,
		);
		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'primary-category', 'wpseoPrimaryCategoryL10n', $data );
	}

	/**
	 * Saves all selected primary terms.
	 *
	 * @param int $post_id Post ID to save primary terms for.
	 */
	public function save_primary_terms( $post_id ) {
		// Bail if this is a multisite installation and the site has been switched.
		if ( is_multisite() && ms_is_switched() ) {
			return;
		}

		$taxonomies = $this->get_primary_term_taxonomies( $post_id );

		foreach ( $taxonomies as $taxonomy ) {
			$this->save_primary_term( $post_id, $taxonomy );
		}
	}

	/**
	 * Gets the id of the primary term.
	 *
	 * @param string $taxonomy_name Taxonomy name for the term.
	 *
	 * @return int primary term id
	 */
	protected function get_primary_term( $taxonomy_name ) {
		$primary_term = new WPSEO_Primary_Term( $taxonomy_name, $this->get_current_id() );

		return $primary_term->get_primary_term();
	}

	/**
	 * Returns all the taxonomies for which the primary term selection is enabled.
	 *
	 * @param int $post_id Default current post ID.
	 * @return array
	 */
	protected function get_primary_term_taxonomies( $post_id = null ) {
		if ( null === $post_id ) {
			$post_id = $this->get_current_id();
		}

		$taxonomies = wp_cache_get( 'primary_term_taxonomies_' . $post_id, 'wpseo' );
		if ( false !== $taxonomies ) {
			return $taxonomies;
		}

		$taxonomies = $this->generate_primary_term_taxonomies( $post_id );

		wp_cache_set( 'primary_term_taxonomies_' . $post_id, $taxonomies, 'wpseo' );

		return $taxonomies;
	}

	/**
	 * Includes templates file.
	 */
	protected function include_js_templates() {
		include_once WPSEO_PATH . 'admin/views/js-templates-primary-term.php';
	}

	/**
	 * Saves the primary term for a specific taxonomy.
	 *
	 * @param int     $post_id  Post ID to save primary term for.
	 * @param WP_Term $taxonomy Taxonomy to save primary term for.
	 */
	protected function save_primary_term( $post_id, $taxonomy ) {
		$primary_term = filter_input( INPUT_POST, WPSEO_Meta::$form_prefix . 'primary_' . $taxonomy->name . '_term', FILTER_SANITIZE_NUMBER_INT );

		// We accept an empty string here because we need to save that if no terms are selected.
		if ( null !== $primary_term && check_admin_referer( 'save-primary-term', WPSEO_Meta::$form_prefix . 'primary_' . $taxonomy->name . '_nonce' ) ) {
			$primary_term_object = new WPSEO_Primary_Term( $taxonomy->name, $post_id );
			$primary_term_object->set_primary_term( $primary_term );
		}
	}

	/**
	 * Generates the primary term taxonomies.
	 *
	 * @param int $post_id ID of the post.
	 *
	 * @return array
	 */
	protected function generate_primary_term_taxonomies( $post_id ) {
		$post_type      = get_post_type( $post_id );
		$all_taxonomies = get_object_taxonomies( $post_type, 'objects' );
		$all_taxonomies = array_filter( $all_taxonomies, array( $this, 'filter_hierarchical_taxonomies' ) );

		/**
		 * Filters which taxonomies for which the user can choose the primary term.
		 *
		 * @api array    $taxonomies An array of taxonomy objects that are primary_term enabled.
		 *
		 * @param string $post_type      The post type for which to filter the taxonomies.
		 * @param array  $all_taxonomies All taxonomies for this post types, even ones that don't have primary term
		 *                               enabled.
		 */
		$taxonomies = (array) apply_filters( 'wpseo_primary_term_taxonomies', $all_taxonomies, $post_type, $all_taxonomies );

		return $taxonomies;
	}

	/**
	 * Creates a map of taxonomies for localization.
	 *
	 * @param array $taxonomies The taxononmies that should be mapped.
	 *
	 * @return array The mapped taxonomies.
	 */
	protected function get_mapped_taxonomies_for_js( $taxonomies ) {
		return array_map( array( $this, 'map_taxonomies_for_js' ), $taxonomies );
	}

	/**
	 * Returns an array suitable for use in the javascript.
	 *
	 * @param stdClass $taxonomy The taxonomy to map.
	 *
	 * @return array The mapped taxonomy.
	 */
	private function map_taxonomies_for_js( $taxonomy ) {
		$primary_term = $this->get_primary_term( $taxonomy->name );

		if ( empty( $primary_term ) ) {
			$primary_term = '';
		}

		$terms = get_terms( $taxonomy->name );

		return array(
			'title'         => $taxonomy->labels->singular_name,
			'name'          => $taxonomy->name,
			'primary'       => $primary_term,
			'singularLabel' => $taxonomy->labels->singular_name,
			'fieldId'       => $this->generate_field_id( $taxonomy->name ),
			'restBase'      => ( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name,
			'terms'         => array_map( array( $this, 'map_terms_for_js' ), $terms ),
		);
	}

	/**
	 * Returns an array suitable for use in the javascript.
	 *
	 * @param stdClass $term The term to map.
	 *
	 * @return array The mapped terms.
	 */
	private function map_terms_for_js( $term ) {
		return array(
			'id'   => $term->term_id,
			'name' => $term->name,
		);
	}

	/**
	 * Returns whether or not a taxonomy is hierarchical.
	 *
	 * @param stdClass $taxonomy Taxonomy object.
	 *
	 * @return bool
	 */
	private function filter_hierarchical_taxonomies( $taxonomy ) {
		return (bool) $taxonomy->hierarchical;
	}
}
PK     ”T]¢TÇG"  "  )  services/interface-indexable-provider.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Endpoints
 */

/**
 * Dictates the required methods for an indexable service provider.
 */
interface WPSEO_Indexable_Service_Provider {

	/**
	 * Returns an array with data for the target object.
	 *
	 * @param integer $object_id The target object id.
	 * @param bool    $as_object Optional. Whether or not to return the indexable
	 *                           as an object. Defaults to false.
	 *
	 * @return array The retrieved data.
	 */
	public function get( $object_id, $as_object = false );

	/**
	 * Handles the patching of values for an existing indexable.
	 *
	 * @param int   $object_id   The ID of the object.
	 * @param array $requestdata The request data to store.
	 *
	 * @return array The patched indexable.
	 */
	public function patch( $object_id, $requestdata );

	/**
	 * Checks if the given object id belongs to an indexable.
	 *
	 * @param int $object_id The object id.
	 *
	 * @return bool Whether the object id is indexable.
	 */
	public function is_indexable( $object_id );
}
PK     ”T]f¡:Àý  ý  *  services/class-indexable-post-provider.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Services
 */

/**
 * Represents the indexable post service.
 */
class WPSEO_Indexable_Service_Post_Provider extends WPSEO_Indexable_Provider {

	/**
	 * List of fields that need to be renamed.
	 *
	 * @var array
	 */
	protected $renameable_fields = array(
		'description'                 => 'metadesc',
		'breadcrumb_title'            => 'bctitle',
		'og_title'                    => 'opengraph-title',
		'og_description'              => 'opengraph-description',
		'og_image'                    => 'opengraph-image',
		'twitter_title'               => 'twitter-title',
		'twitter_description'         => 'twitter-description',
		'twitter_image'               => 'twitter-image',
		'is_robots_noindex'           => 'meta-robots-noindex',
		'is_robots_nofollow'          => 'meta-robots-nofollow',
		'primary_focus_keyword'       => 'focuskw',
		'primary_focus_keyword_score' => 'linkdex',
		'readability_score'           => 'content_score',
	);

	/**
	 * Returns an array with data for the target object.
	 *
	 * @param integer $object_id The target object id.
	 * @param bool    $as_object Optional. Whether or not to return the indexable
	 *                           as an object. Defaults to false.
	 *
	 * @return array|WPSEO_Post_Indexable The retrieved data. Defaults to an array format.
	 *
	 * @throws WPSEO_Invalid_Argument_Exception The invalid argument exception.
	 */
	public function get( $object_id, $as_object = false ) {
		if ( ! $this->is_indexable( $object_id ) ) {
			return array();
		}

		$indexable = WPSEO_Post_Indexable::from_object( $object_id );

		if ( $as_object === true ) {
			return $indexable;
		}

		return $indexable->to_array();
	}

	/**
	 * Handles the patching of values for an existing indexable.
	 *
	 * @param int   $object_id   The ID of the object.
	 * @param array $requestdata The request data to store.
	 *
	 * @return array The patched indexable.
	 *
	 * @throws WPSEO_Invalid_Indexable_Exception The invalid argument exception.
	 * @throws WPSEO_REST_Request_Exception      Exception that is thrown if patching the object has failed.
	 */
	public function patch( $object_id, $requestdata ) {
		$indexable = $this->get( $object_id, true );

		if ( $indexable === array() ) {
			throw WPSEO_Invalid_Indexable_Exception::non_existing_indexable( $object_id );
		}

		$new_indexable    = $indexable->update( $requestdata );
		$stored_indexable = $this->store_indexable( $new_indexable );

		if ( $stored_indexable === true ) {
			return $new_indexable->to_array();
		}

		throw WPSEO_REST_Request_Exception::patch( 'Post', $object_id );
	}

	/**
	 * Stores the indexable object.
	 *
	 * @param WPSEO_Indexable $indexable The indexable object to store.
	 *
	 * @return bool True if saving was successful.
	 */
	protected function store_indexable( WPSEO_Indexable $indexable ) {
		$values         = $this->convert_indexable_data( $indexable->to_array() );
		$renamed_values = $this->rename_indexable_data( $values );

		foreach ( $renamed_values as $key => $item ) {
			WPSEO_Meta::set_value( $key, $item, $values['object_id'] );
		}

		return true;
	}

	/**
	 * Checks if the given object id belongs to an indexable.
	 *
	 * @param int $object_id The object id.
	 *
	 * @return bool Whether the object id is indexable.
	 */
	public function is_indexable( $object_id ) {
		if ( get_post( $object_id ) === null ) {
			return false;
		}

		if ( wp_is_post_autosave( $object_id ) ) {
			return false;
		}

		if ( wp_is_post_revision( $object_id ) ) {
			return false;
		}

		return true;
	}

	/**
	 * Converts some of the indexable data to its database variant.
	 *
	 * @param array $indexable_data The indexable data to convert.
	 *
	 * @return array The converted indexable data.
	 */
	protected function convert_indexable_data( $indexable_data ) {
		if ( WPSEO_Validator::key_exists( $indexable_data, 'is_robots_nofollow' ) ) {
			$indexable_data['is_robots_nofollow'] = $this->convert_nofollow( $indexable_data['is_robots_nofollow'] );
		}

		if ( WPSEO_Validator::key_exists( $indexable_data, 'is_robots_noindex' ) ) {
			$indexable_data['is_robots_noindex'] = $this->convert_noindex( $indexable_data['is_robots_noindex'] );
		}

		if ( WPSEO_Validator::key_exists( $indexable_data, 'is_cornerstone' ) ) {
			$indexable_data['is_cornerstone'] = $this->convert_cornerstone( $indexable_data['is_cornerstone'] );
		}

		$indexable_data['meta-robots-adv'] = $this->convert_advanced( $indexable_data );

		return $indexable_data;
	}

	/**
	 * Converts the cornerstone value to its database variant.
	 *
	 * @param string $cornerstone_value The cornerstone value.
	 *
	 * @return string The converted indexable cornerstone value.
	 */
	protected function convert_cornerstone( $cornerstone_value ) {
		if ( $cornerstone_value === 'true' ) {
			return '1';
		}

		return null;
	}

	/**
	 * Converts the advanced meta settings to its database variant.
	 *
	 * @param array $indexable_data The indexable data to convert the advanced meta settings from.
	 *
	 * @return string The converted advanced meta settings.
	 */
	protected function convert_advanced( &$indexable_data ) {
		$translated_advanced_data = array();

		if ( WPSEO_Validator::key_exists( $indexable_data, 'is_robots_nosnippet' ) && (bool) $indexable_data['is_robots_nosnippet'] === true ) {
			$translated_advanced_data[] = 'nosnippet';

			unset( $indexable_data['is_robots_nosnippet'] );
		}

		if ( WPSEO_Validator::key_exists( $indexable_data, 'is_robots_noarchive' ) && (bool) $indexable_data['is_robots_noarchive'] === true ) {
			$translated_advanced_data[] = 'noarchive';

			unset( $indexable_data['is_robots_noarchive'] );
		}

		if ( WPSEO_Validator::key_exists( $indexable_data, 'is_robots_noimageindex' ) && (bool) $indexable_data['is_robots_noimageindex'] === true ) {
			$translated_advanced_data[] = 'noimageindex';

			unset( $indexable_data['is_robots_noimageindex'] );
		}

		return implode( ',', $translated_advanced_data );
	}

	/**
	 * Converts the nofollow value to a database compatible one.
	 *
	 * @param bool $nofollow The current nofollow value.
	 *
	 * @return string The converted value.
	 */
	protected function convert_nofollow( $nofollow ) {
		if ( $nofollow === 'true' ) {
			return '1';
		}

		return '0';
	}

	/**
	 * Converts the noindex value to a database compatible one.
	 *
	 * @param string $noindex The current noindex value.
	 *
	 * @return string|null The converted value.
	 */
	protected function convert_noindex( $noindex ) {
		if ( $noindex === 'false' ) {
			return '2';
		}

		if ( $noindex === 'true' ) {
			return '1';
		}

		return null;
	}
}
PK     ”T]‘¼�úº	  º	    services/class-file-size.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Services
 */

/**
 * Represents the file size service.
 */
class WPSEO_File_Size_Service {

	/**
	 * Retrieves an indexable.
	 *
	 * @param WP_REST_Request $request The request object.
	 *
	 * @return WP_REST_Response The response.
	 */
	public function get( WP_REST_Request $request ) {
		try {
			$file_url = $this->get_file_url( $request );

			return new WP_REST_Response(
				array(
					'type'          => 'success',
					'size_in_bytes' => $this->get_file_size( $file_url ),
				),
				404
			);
		}
		catch ( WPSEO_File_Size_Exception $exception ) {
			return new WP_REST_Response(
				array(
					'type'     => 'failure',
					'response' => $exception->getMessage(),
				),
				404
			);
		}
	}

	/**
	 * Retrieves the file url.
	 *
	 * @param WP_REST_Request $request The request to retrieve file url from.
	 *
	 * @return string The file url.
	 * @throws WPSEO_File_Size_Exception The file is hosted externally.
	 */
	protected function get_file_url( WP_REST_Request $request ) {
		$file_url = rawurldecode( $request->get_param( 'url' ) );

		if ( ! $this->is_externally_hosted( $file_url ) ) {
			return $file_url;
		}

		throw WPSEO_File_Size_Exception::externally_hosted( $file_url );
	}

	/**
	 * Checks if the file is hosted externally.
	 *
	 * @param string $file_url The file url.
	 *
	 * @return bool True if it is hosted externally.
	 */
	protected function is_externally_hosted( $file_url ) {
		return wp_parse_url( home_url(), PHP_URL_HOST ) !== wp_parse_url( $file_url, PHP_URL_HOST );
	}

	/**
	 * Returns the file size.
	 *
	 * @param string $file_url The file url to get the size for.
	 *
	 * @return int The file size.
	 * @throws WPSEO_File_Size_Exception Retrieval of file size went wrong for unknown reasons.
	 */
	protected function get_file_size( $file_url ) {
		$file_config = wp_upload_dir();
		$file_url    = str_replace( $file_config['baseurl'], '', $file_url );
		$file_size   = $this->calculate_file_size( $file_url );

		if ( ! $file_size ) {
			throw WPSEO_File_Size_Exception::unknown_error( $file_url );
		}

		return $file_size;
	}

	/**
	 * Calculates the file size using the Utils class.
	 *
	 * @param string $file_url The file to retrieve the size for.
	 *
	 * @return int|bool The file size or False if it could not be retrieved.
	 */
	protected function calculate_file_size( $file_url ) {
		return WPSEO_Image_Utils::get_file_size(
			array(
				'path' => $file_url,
			)
		);
	}
}
PK     ”T]Ú÷‘{‰  ‰  *  services/class-indexable-term-provider.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Services
 */

/**
 * Represents the indexable term service.
 */
class WPSEO_Indexable_Service_Term_Provider extends WPSEO_Indexable_Provider {

	/**
	 * List of fields that need to be renamed.
	 *
	 * @var array
	 */
	protected $renameable_fields = array(
		'description'                 => 'desc',
		'breadcrumb_title'            => 'bctitle',
		'og_title'                    => 'opengraph-title',
		'og_description'              => 'opengraph-description',
		'og_image'                    => 'opengraph-image',
		'twitter_title'               => 'twitter-title',
		'twitter_description'         => 'twitter-description',
		'twitter_image'               => 'twitter-image',
		'is_robots_noindex'           => 'noindex',
		'primary_focus_keyword'       => 'focuskw',
		'primary_focus_keyword_score' => 'linkdex',
		'readability_score'           => 'content_score',
	);

	/**
	 * Returns an array with data for the target object.
	 *
	 * @param integer $object_id The target object id.
	 * @param bool    $as_object Optional. Whether or not to return the indexable
	 *                           as an object. Defaults to false.
	 *
	 * @return array|WPSEO_Term_Indexable The retrieved data. Defaults to an array format.
	 */
	public function get( $object_id, $as_object = false ) {
		if ( ! $this->is_indexable( $object_id ) ) {
			return array();
		}

		$indexable = WPSEO_Term_Indexable::from_object( $object_id );

		if ( $as_object === true ) {
			return $indexable;
		}

		return $indexable->to_array();
	}

	/**
	 * Handles the patching of values for an existing indexable.
	 *
	 * @param int   $object_id   The ID of the object.
	 * @param array $requestdata The request data to store.
	 *
	 * @return array The patched indexable.
	 *
	 * @throws WPSEO_Invalid_Indexable_Exception The indexable exception.
	 * @throws WPSEO_REST_Request_Exception      Exception that is thrown if patching the object has failed.
	 */
	public function patch( $object_id, $requestdata ) {
		$indexable = $this->get( $object_id, true );

		if ( $indexable === array() ) {
			throw WPSEO_Invalid_Indexable_Exception::non_existing_indexable( $object_id );
		}

		$new_indexable    = $indexable->update( $requestdata );
		$stored_indexable = $this->store_indexable( $new_indexable );

		if ( $stored_indexable === true ) {
			return $new_indexable->to_array();
		}

		throw WPSEO_REST_Request_Exception::patch( 'Term', $object_id );
	}

	/**
	 * Stores the indexable object.
	 *
	 * @param WPSEO_Indexable $indexable The indexable object to store.
	 *
	 * @return bool True if the indexable object was successfully stored.
	 */
	protected function store_indexable( WPSEO_Indexable $indexable ) {
		$values          = $this->convert_indexable_data( $indexable->to_array() );
		$renamed_values  = $this->rename_indexable_data( $values );
		$prefixed_values = $this->prefix_indexable_data( $renamed_values );

		WPSEO_Taxonomy_Meta::set_values( $values['object_id'], $values['object_subtype'], $prefixed_values );

		return true;
	}

	/**
	 * Prefixes the indexable data to make it compatible with the database.
	 *
	 * @param array $indexable_data The indexable data to prefix.
	 *
	 * @return array The compatible indexable data.
	 */
	protected function prefix_indexable_data( $indexable_data ) {
		$converted_data = array();

		foreach ( $indexable_data as $key => $item ) {
			if ( substr( strtolower( $key ), 0, 6 ) !== 'wpseo_' ) {
				$key = 'wpseo_' . $key;
			}

			$converted_data[ $key ] = $item;
		}

		return $converted_data;
	}

	/**
	 * Converts the indexable data to make it compatible with the database.
	 *
	 * @param array $indexable_data The indexable data to prepare.
	 *
	 * @return array The converted indexable data.
	 */
	protected function convert_indexable_data( $indexable_data ) {
		if ( WPSEO_Validator::key_exists( $indexable_data, 'is_robots_noindex' ) ) {
			$indexable_data['is_robots_noindex'] = $this->convert_noindex( $indexable_data['is_robots_noindex'] );
		}

		return $indexable_data;
	}

	/**
	 * Checks if the given object id belongs to an indexable.
	 *
	 * @param int $object_id The object id.
	 *
	 * @return bool Whether the object id is indexable.
	 */
	public function is_indexable( $object_id ) {
		$term = get_term( $object_id );

		return ( $term !== null && ! is_wp_error( $term ) );
	}

	/**
	 * Converts the noindex value to a database compatible one.
	 *
	 * @param bool $noindex The current noindex value.
	 *
	 * @return string|null The converted value.
	 */
	protected function convert_noindex( $noindex ) {
		if ( $noindex === 'false' ) {
			return 'index';
		}

		if ( $noindex === 'true' ) {
			return 'noindex';
		}

		return 'default';
	}
}
PK     ”T]ÿ™    %  services/class-indexable-provider.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Services
 */

/**
 * Represents the indexable service.
 */
abstract class WPSEO_Indexable_Provider implements WPSEO_Indexable_Service_Provider {

	/**
	 * List of fields that need to be renamed.
	 *
	 * @var array
	 */
	protected $renameable_fields = array();

	/**
	 * Renames and converts some of the indexable data to its database variant.
	 *
	 * @param array $indexable_data The indexable data to rename and convert.
	 *
	 * @return array The renamed and converted indexable data.
	 */
	protected function rename_indexable_data( &$indexable_data ) {
		foreach ( $this->renameable_fields as $old_key => $new_key ) {
			if ( WPSEO_Validator::key_exists( $indexable_data, $old_key ) ) {
				$indexable_data[ $new_key ] = $indexable_data[ $old_key ];

				unset( $indexable_data[ $old_key ] );
			}
		}

		return $indexable_data;
	}
}
PK     ”T]xayè	  è	    services/class-indexable.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Services
 */

/**
 * Represents the indexable service.
 */
class WPSEO_Indexable_Service {

	/**
	 * Retrieves an indexable.
	 *
	 * @param WP_REST_Request $request The request object.
	 *
	 * @return WP_REST_Response The response.
	 */
	public function get_indexable( WP_REST_Request $request ) {
		$object_type = $request->get_param( 'object_type' );
		$object_id   = $request->get_param( 'object_id' );

		try {
			$provider  = $this->get_provider( $object_type );
			$indexable = $provider->get( $object_id );

			return new WP_REST_Response( $indexable );
		}
		catch ( Exception $exception ) {
			return new WP_REST_Response( $exception->getMessage(), 500 );
		}
	}

	/**
	 * Patches an indexable with the request parameters.
	 *
	 * @param WP_REST_Request $request The REST API request to process.
	 *
	 * @return WP_REST_Response The REST response.
	 */
	public function patch_indexable( WP_REST_Request $request ) {
		$object_type = $request->get_param( 'object_type' );
		$object_id   = $request->get_param( 'object_id' );

		try {
			$provider       = $this->get_provider( $object_type );
			$patched_result = $provider->patch( $object_id, $request->get_params() );

			return new WP_REST_Response( $patched_result );
		}
		catch ( Exception $exception ) {
			return new WP_REST_Response( $exception->getMessage(), 500 );
		}
	}

	/**
	 * Returns a provider based on the given object type.
	 *
	 * @param string $object_type The object type to get the provider for.
	 *
	 * @return WPSEO_Indexable_Service_Provider Instance of the service provider.
	 *
	 * @throws WPSEO_Invalid_Argument_Exception The invalid argument exception.
	 */
	protected function get_provider( $object_type ) {
		$object_type = strtolower( $object_type );

		if ( $object_type === 'post' ) {
			return new WPSEO_Indexable_Service_Post_Provider();
		}

		if ( $object_type === 'term' ) {
			return new WPSEO_Indexable_Service_Term_Provider();

		}

		throw WPSEO_Invalid_Argument_Exception::invalid_callable_parameter( $object_type, 'provider' );
	}

	/**
	 * Handles the situation when the object type is unknown.
	 *
	 * @param string $object_type The unknown object type.
	 *
	 * @return WP_REST_Response The response.
	 */
	protected function handle_unknown_object_type( $object_type ) {
		return new WP_REST_Response(
			sprintf(
				/* translators: %1$s expands to the requested indexable type  */
				__( 'Unknown type %1$s', 'wordpress-seo' ),
				$object_type
			),
			400
		);
	}
}
PK     ”T]�SÊ‰í   í     services/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]Dr      interface-collection.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Interface that represents a collection.
 */
interface WPSEO_Collection {

	/**
	 * Returns the collection data.
	 *
	 * @return array The collection data.
	 */
	public function get();
}
PK     ”T]=FhJ
J  
J    class-admin-asset-manager.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class registers all the necessary styles and scripts.
 *
 * Also has methods for the enqueing of scripts and styles.
 * It automatically adds a prefix to the handle.
 */
class WPSEO_Admin_Asset_Manager {

	/**
	 * @var WPSEO_Admin_Asset_Location
	 */
	protected $asset_location;

	/**
	 * Prefix for naming the assets.
	 *
	 * @var string
	 */
	const PREFIX = 'yoast-seo-';

	/**
	 * Prefix for naming the assets.
	 *
	 * @var string
	 */
	private $prefix;

	/**
	 * Constructs a manager of assets. Needs a location to know where to register assets at.
	 *
	 * @param WPSEO_Admin_Asset_Location $asset_location The provider of the asset location.
	 * @param string                     $prefix         The prefix for naming assets.
	 */
	public function __construct( WPSEO_Admin_Asset_Location $asset_location = null, $prefix = self::PREFIX ) {
		if ( $asset_location === null ) {
			$asset_location = self::create_default_location();
		}

		$this->asset_location = $asset_location;
		$this->prefix         = $prefix;
	}

	/**
	 * Enqueues scripts.
	 *
	 * @param string $script The name of the script to enqueue.
	 */
	public function enqueue_script( $script ) {
		wp_enqueue_script( $this->prefix . $script );
	}

	/**
	 * Enqueues styles.
	 *
	 * @param string $style The name of the style to enqueue.
	 */
	public function enqueue_style( $style ) {
		wp_enqueue_style( $this->prefix . $style );
	}

	/**
	 * Registers scripts based on it's parameters.
	 *
	 * @param WPSEO_Admin_Asset $script The script to register.
	 */
	public function register_script( WPSEO_Admin_Asset $script ) {
		wp_register_script(
			$this->prefix . $script->get_name(),
			$this->get_url( $script, WPSEO_Admin_Asset::TYPE_JS ),
			$script->get_deps(),
			$script->get_version(),
			$script->is_in_footer()
		);
	}

	/**
	 * Registers styles based on it's parameters.
	 *
	 * @param WPSEO_Admin_Asset $style The style to register.
	 */
	public function register_style( WPSEO_Admin_Asset $style ) {
		wp_register_style(
			$this->prefix . $style->get_name(),
			$this->get_url( $style, WPSEO_Admin_Asset::TYPE_CSS ),
			$style->get_deps(),
			$style->get_version(),
			$style->get_media()
		);
	}

	/**
	 * Calls the functions that register scripts and styles with the scripts and styles to be registered as arguments.
	 */
	public function register_assets() {
		$this->register_scripts( $this->scripts_to_be_registered() );
		$this->register_styles( $this->styles_to_be_registered() );
	}

	/**
	 * Registers all the scripts passed to it.
	 *
	 * @param array $scripts The scripts passed to it.
	 */
	public function register_scripts( $scripts ) {
		foreach ( $scripts as $script ) {
			$script = new WPSEO_Admin_Asset( $script );
			$this->register_script( $script );
		}
	}

	/**
	 * Registers all the styles it receives.
	 *
	 * @param array $styles Styles that need to be registered.
	 */
	public function register_styles( $styles ) {
		foreach ( $styles as $style ) {
			$style = new WPSEO_Admin_Asset( $style );
			$this->register_style( $style );
		}
	}

	/**
	 * A list of styles that shouldn't be registered but are needed in other locations in the plugin.
	 *
	 * @return array
	 */
	public function special_styles() {
		$flat_version = $this->flatten_version( WPSEO_VERSION );
		$asset_args   = array(
			'name' => 'inside-editor',
			'src'  => 'inside-editor-' . $flat_version,
		);

		return array( 'inside-editor' => new WPSEO_Admin_Asset( $asset_args ) );
	}

	/**
	 * Flattens a version number for use in a filename.
	 *
	 * @param string $version The original version number.
	 *
	 * @return string The flattened version number.
	 */
	public function flatten_version( $version ) {
		$parts = explode( '.', $version );

		if ( count( $parts ) === 2 && preg_match( '/^\d+$/', $parts[1] ) === 1 ) {
			$parts[] = '0';
		}

		return implode( '', $parts );
	}

	/**
	 * Creates a default location object for use in the admin asset manager.
	 *
	 * @return WPSEO_Admin_Asset_Location The location to use in the asset manager.
	 */
	public static function create_default_location() {
		if ( defined( 'YOAST_SEO_DEV_SERVER' ) && YOAST_SEO_DEV_SERVER ) {
			$url = defined( 'YOAST_SEO_DEV_SERVER_URL' ) ? YOAST_SEO_DEV_SERVER_URL : WPSEO_Admin_Asset_Dev_Server_Location::DEFAULT_URL;

			return new WPSEO_Admin_Asset_Dev_Server_Location( $url );
		}

		return new WPSEO_Admin_Asset_SEO_Location( WPSEO_FILE );
	}

	/**
	 * Registers the WordPress dependencies that exist in 5.0 in case they are not present.
	 *
	 * This function can be removed when WordPress 5.1 has been released, because from 5.0 wp-elements will be
	 * registered earlier, which means we don't have to reregister things.
	 *
	 * @return void
	 */
	public function register_wp_assets() {

		global $wp_scripts;

		$script = $wp_scripts->query( 'react' );

		// IE11 needs wp-polyfill to be registered before react.
		if ( $script && ! in_array( 'wp-polyfill', $script->deps, true ) ) {
			$script->deps[] = 'wp-polyfill';
		}

		$flat_version = $this->flatten_version( WPSEO_VERSION );

		wp_register_script(
			'react',
			plugins_url( 'js/vendor/react.min.js', WPSEO_FILE ),
			array(),
			'v16.6.1',
			true
		);

		wp_register_script(
			'react-dom',
			plugins_url( 'js/vendor/react-dom.min.js', WPSEO_FILE ),
			array( 'react' ),
			'v16.6.1',
			true
		);

		wp_register_script(
			'lodash-base',
			plugins_url( 'js/vendor/lodash.min.js', WPSEO_FILE ),
			array(),
			'4.17.5',
			true
		);

		wp_register_script(
			'lodash',
			plugins_url( 'js/vendor/lodash-noconflict.js', WPSEO_FILE ),
			array( 'lodash-base' ),
			WPSEO_VERSION,
			true
		);

		wp_register_script(
			'wp-polyfill',
			plugins_url( 'js/dist/babel-polyfill-' . $flat_version . '.min.js', WPSEO_FILE ),
			array(),
			WPSEO_VERSION,
			true
		);

		wp_register_script(
			'wp-element',
			plugins_url( 'js/dist/wp-element-' . $flat_version . '.min.js', WPSEO_FILE ),
			array( 'lodash', 'wp-polyfill', 'react', 'react-dom' ),
			WPSEO_VERSION,
			true
		);

		wp_register_script(
			'wp-api-fetch',
			plugins_url( 'js/dist/wp-apiFetch-' . $flat_version . '.min.js', WPSEO_FILE ),
			array( 'wp-i18n', 'wp-polyfill' ),
			WPSEO_VERSION,
			true
		);

		wp_register_script(
			'wp-components',
			plugins_url( 'js/dist/wp-components-' . $flat_version . '.min.js', WPSEO_FILE ),
			array( 'lodash', 'wp-api-fetch', 'wp-i18n', 'wp-polyfill', 'wp-compose' ),
			WPSEO_VERSION,
			true
		);

		wp_register_script(
			'wp-data',
			plugins_url( 'js/dist/wp-data-' . $flat_version . '.min.js', WPSEO_FILE ),
			array( 'lodash', 'wp-element', 'wp-polyfill', 'wp-compose' ),
			WPSEO_VERSION,
			true
		);

		wp_register_script(
			'wp-i18n',
			plugins_url( 'js/dist/wp-i18n-' . $flat_version . '.min.js', WPSEO_FILE ),
			array( 'wp-polyfill' ),
			WPSEO_VERSION,
			true
		);

		wp_register_script(
			'wp-rich-text',
			plugins_url( 'js/dist/wp-rich-text-' . $flat_version . '.min.js', WPSEO_FILE ),
			array( 'lodash', 'wp-polyfill', 'wp-data' ),
			WPSEO_VERSION,
			true
		);

		wp_register_script(
			'wp-compose',
			plugins_url( 'js/dist/wp-compose-' . $flat_version . '.min.js', WPSEO_FILE ),
			array( 'lodash', 'wp-polyfill' ),
			WPSEO_VERSION,
			true
		);

		/*
		 * wp-annotations only exists from Gutenberg 4.3 and onwards, so we register a no-op in earlier versions.
		 * The no-op achieves that our scripts that depend on this are actually loaded. Because WordPress doesn't
		 * load a script if any of the dependencies are missing.
		 *
		 * @phpcs:disable WordPress.WP.EnqueuedResourceParameters -- The no-op does not require these settings.
		 */
		wp_register_script(
			'wp-annotations',
			null
		);
		// phpcs:enable -- End of disable.
	}

	/**
	 * Returns the scripts that need to be registered.
	 *
	 * @todo Data format is not self-documenting. Needs explanation inline. R.
	 *
	 * @return array The scripts that need to be registered.
	 */
	protected function scripts_to_be_registered() {
		$select2_language = 'en';
		$user_locale      = WPSEO_Language_Utils::get_user_locale();
		$language         = WPSEO_Language_Utils::get_language( $user_locale );

		if ( file_exists( WPSEO_PATH . "js/dist/select2/i18n/{$user_locale}.js" ) ) {
			$select2_language = $user_locale; // Chinese and some others use full locale.
		}
		elseif ( file_exists( WPSEO_PATH . "js/dist/select2/i18n/{$language}.js" ) ) {
			$select2_language = $language;
		}

		$flat_version = $this->flatten_version( WPSEO_VERSION );

		return array(
			array(
				'name' => 'commons',
				// Load webpack-commons for bundle support.
				'src'  => 'commons-' . $flat_version,
				'deps' => array(
					'wp-polyfill',
				),
			),
			array(
				'name' => 'search-appearance',
				'src'  => 'search-appearance-' . $flat_version,
				'deps' => array(
					'wp-api',
					self::PREFIX . 'components',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'yoast-modal',
				'src'  => 'wp-seo-modal-' . $flat_version,
				'deps' => array(
					'jquery',
					'wp-element',
					'wp-i18n',
					self::PREFIX . 'components',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'help-center',
				'src'  => 'wp-seo-help-center-' . $flat_version,
				'deps' => array(
					'jquery',
					'wp-element',
					'wp-i18n',
					self::PREFIX . 'components',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'admin-script',
				'src'  => 'wp-seo-admin-' . $flat_version,
				'deps' => array(
					'jquery',
					'jquery-ui-core',
					'jquery-ui-progressbar',
					self::PREFIX . 'select2',
					self::PREFIX . 'select2-translations',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'admin-media',
				'src'  => 'wp-seo-admin-media-' . $flat_version,
				'deps' => array(
					'jquery',
					'jquery-ui-core',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'network-admin-script',
				'src'  => 'wp-seo-network-admin-' . $flat_version,
				'deps' => array(
					'jquery',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'bulk-editor',
				'src'  => 'wp-seo-bulk-editor-' . $flat_version,
				'deps' => array(
					'jquery',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'admin-global-script',
				'src'  => 'wp-seo-admin-global-' . $flat_version,
				'deps' => array(
					'jquery',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name'      => 'metabox',
				'src'       => 'wp-seo-metabox-' . $flat_version,
				'deps'      => array(
					'jquery',
					'wp-element',
					'wp-i18n',
					'wp-data',
					'wp-components',
					self::PREFIX . 'select2',
					self::PREFIX . 'select2-translations',
					self::PREFIX . 'commons',
				),
				'in_footer' => false,
			),
			array(
				'name' => 'featured-image',
				'src'  => 'wp-seo-featured-image-' . $flat_version,
				'deps' => array(
					'jquery',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name'      => 'admin-gsc',
				'src'       => 'wp-seo-admin-gsc-' . $flat_version,
				'deps'      => array(
					'wp-element',
					'wp-i18n',
					self::PREFIX . 'styled-components',
					self::PREFIX . 'components',
					self::PREFIX . 'commons',
				),
				'in_footer' => false,
			),
			array(
				'name' => 'post-scraper',
				'src'  => 'wp-seo-post-scraper-' . $flat_version,
				'deps' => array(
					'wp-util',
					'wp-api',
					'wp-sanitize',
					'wp-element',
					'wp-i18n',
					'wp-data',
					'wp-api-fetch',
					'wp-annotations',
					'wp-compose',
					self::PREFIX . 'replacevar-plugin',
					self::PREFIX . 'shortcode-plugin',
					self::PREFIX . 'analysis',
					self::PREFIX . 'components',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'term-scraper',
				'src'  => 'wp-seo-term-scraper-' . $flat_version,
				'deps' => array(
					'wp-sanitize',
					'wp-element',
					'wp-i18n',
					'wp-data',
					'wp-api-fetch',
					'wp-compose',
					self::PREFIX . 'replacevar-plugin',
					self::PREFIX . 'analysis',
					self::PREFIX . 'components',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'replacevar-plugin',
				'src'  => 'wp-seo-replacevar-plugin-' . $flat_version,
				'deps' => array(
					self::PREFIX . 'analysis',
					self::PREFIX . 'components',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'shortcode-plugin',
				'src'  => 'wp-seo-shortcode-plugin-' . $flat_version,
				'deps' => array(
					self::PREFIX . 'analysis',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'recalculate',
				'src'  => 'wp-seo-recalculate-' . $flat_version,
				'deps' => array(
					'jquery',
					'jquery-ui-core',
					'jquery-ui-progressbar',
					self::PREFIX . 'analysis',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'primary-category',
				'src'  => 'wp-seo-metabox-category-' . $flat_version,
				'deps' => array(
					'jquery',
					'wp-util',
					'wp-element',
					'wp-i18n',
					'wp-components',
					'wp-data',
					self::PREFIX . 'analysis',
					self::PREFIX . 'components',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name'    => 'select2',
				'src'     => 'select2/select2.full',
				'suffix'  => '.min',
				'deps'    => array(
					'jquery',
				),
				'version' => '4.0.3',
			),
			array(
				'name'    => 'select2-translations',
				'src'     => 'select2/i18n/' . $select2_language,
				'deps'    => array(
					'jquery',
					self::PREFIX . 'select2',
				),
				'version' => '4.0.3',
				'suffix'  => '',
			),
			array(
				'name' => 'configuration-wizard',
				'src'  => 'configuration-wizard-' . $flat_version,
				'deps' => array(
					'jquery',
					'wp-element',
					'wp-i18n',
					'wp-api',
					self::PREFIX . 'components',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'reindex-links',
				'src'  => 'wp-seo-reindex-links-' . $flat_version,
				'deps' => array(
					'jquery',
					'jquery-ui-core',
					'jquery-ui-progressbar',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'edit-page-script',
				'src'  => 'wp-seo-edit-page-' . $flat_version,
				'deps' => array(
					'jquery',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name'      => 'quick-edit-handler',
				'src'       => 'wp-seo-quick-edit-handler-' . $flat_version,
				'deps'      => array(
					'jquery',
					self::PREFIX . 'commons',
				),
				'in_footer' => true,
			),
			array(
				'name' => 'api',
				'src'  => 'wp-seo-api-' . $flat_version,
				'deps' => array(
					'wp-api',
					'jquery',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'dashboard-widget',
				'src'  => 'wp-seo-dashboard-widget-' . $flat_version,
				'deps' => array(
					self::PREFIX . 'api',
					'jquery',
					'wp-element',
					'wp-i18n',
					self::PREFIX . 'components',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'filter-explanation',
				'src'  => 'wp-seo-filter-explanation-' . $flat_version,
				'deps' => array(
					'jquery',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'analysis',
				'src'  => 'analysis-' . $flat_version,
				'deps' => array(
					'lodash',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'components',
				'src'  => 'components-' . $flat_version,
				'deps' => array(
					self::PREFIX . 'analysis',
					self::PREFIX . 'styled-components',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'structured-data-blocks',
				'src'  => 'wp-seo-structured-data-blocks-' . $flat_version,
				'deps' => array(
					'wp-blocks',
					'wp-i18n',
					'wp-element',
					self::PREFIX . 'styled-components',
					self::PREFIX . 'commons',
				),
			),
			array(
				'name' => 'styled-components',
				'src'  => 'styled-components-' . $flat_version,
				'deps' => array(
					'wp-element',
				),
			),
			array(
				'name' => 'courses-overview',
				'src'  => 'wp-seo-courses-overview-' . $flat_version,
				'deps' => array(
					'wp-element',
					'wp-i18n',
					self::PREFIX . 'styled-components',
					self::PREFIX . 'components',
				),
			),
		);
	}

	/**
	 * Returns the styles that need to be registered.
	 *
	 * @todo Data format is not self-documenting. Needs explanation inline. R.
	 *
	 * @return array Styles that need to be registered.
	 */
	protected function styles_to_be_registered() {
		$flat_version = $this->flatten_version( WPSEO_VERSION );

		return array(
			array(
				'name' => 'admin-css',
				'src'  => 'yst_plugin_tools-' . $flat_version,
				'deps' => array( self::PREFIX . 'toggle-switch' ),
			),
			array(
				'name' => 'toggle-switch',
				'src'  => 'toggle-switch-' . $flat_version,
			),
			array(
				'name' => 'dismissible',
				'src'  => 'wpseo-dismissible-' . $flat_version,
			),
			array(
				'name' => 'alerts',
				'src'  => 'alerts-' . $flat_version,
			),
			array(
				'name' => 'edit-page',
				'src'  => 'edit-page-' . $flat_version,
			),
			array(
				'name' => 'featured-image',
				'src'  => 'featured-image-' . $flat_version,
			),
			array(
				'name' => 'metabox-css',
				'src'  => 'metabox-' . $flat_version,
				'deps' => array(
					self::PREFIX . 'select2',
				),
			),
			array(
				'name' => 'wp-dashboard',
				'src'  => 'dashboard-' . $flat_version,
			),
			array(
				'name' => 'scoring',
				'src'  => 'yst_seo_score-' . $flat_version,
			),
			array(
				'name' => 'adminbar',
				'src'  => 'adminbar-' . $flat_version,
			),
			array(
				'name' => 'primary-category',
				'src'  => 'metabox-primary-category-' . $flat_version,
			),
			array(
				'name'    => 'select2',
				'src'     => 'select2/select2',
				'suffix'  => '.min',
				'version' => '4.0.1',
				'rtl'     => false,
			),
			array(
				'name' => 'admin-global',
				'src'  => 'admin-global-' . $flat_version,
			),
			array(
				'name' => 'yoast-components',
				'src'  => 'yoast-components-' . $flat_version,
			),
			array(
				'name' => 'extensions',
				'src'  => 'yoast-extensions-' . $flat_version,
			),
			array(
				'name' => 'filter-explanation',
				'src'  => 'filter-explanation-' . $flat_version,
			),
			array(
				'name' => 'search-appearance',
				'src'  => 'search-appearance-' . $flat_version,
			),
			array(
				'name' => 'structured-data-blocks',
				'src'  => 'structured-data-blocks-' . $flat_version,
				'deps' => array( 'wp-edit-blocks' ),
			),
		);
	}

	/**
	 * Determines the URL of the asset.
	 *
	 * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
	 * @param string            $type  The type of asset. Usually JS or CSS.
	 *
	 * @return string The URL of the asset.
	 */
	protected function get_url( WPSEO_Admin_Asset $asset, $type ) {
		$scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
		if ( in_array( $scheme, array( 'http', 'https' ), true ) ) {
			return $asset->get_src();
		}

		return $this->asset_location->get_url( $asset, $type );
	}
}
PK     ”T]�SÊ‰í   í     onpage/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]#!±@  @    onpage/class-ryte-service.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\OnPage
 */

/**
 * Represents the service to be used by the WPSEO_Endpoint_Ryte endpoint.
 */
class WPSEO_Ryte_Service {

	/**
	 * @var WPSEO_OnPage_Option
	 */
	protected $option;

	/**
	 * Constructs the WPSEO_Ryte_Service class.
	 *
	 * @param WPSEO_OnPage_Option $option The option to retrieve data from.
	 */
	public function __construct( WPSEO_OnPage_Option $option ) {
		$this->option = $option;
	}

	/**
	 * Fetches statistics via REST request.
	 *
	 * @return WP_REST_Response The response object.
	 */
	public function get_statistics() {
		// Switch to the user locale with fallback to the site locale.
		switch_to_locale( WPSEO_Language_Utils::get_user_locale() );

		$result = false;

		if ( $this->option->is_enabled() ) {
			$result = $this->get_score( $this->option->get_status(), $this->option->should_be_fetched() );
		}

		return new WP_REST_Response( array( 'ryte' => $result ) );
	}

	/**
	 * Returns an the results of the Ryte option based on the passed status.
	 *
	 * @param string $status The option's status.
	 * @param bool   $fetch Whether or not the data should be fetched.
	 *
	 * @return array The results, contains a score and label.
	 */
	private function get_score( $status, $fetch = false ) {
		if ( $status === WPSEO_OnPage_Option::IS_INDEXABLE ) {
			return array(
				'score'     => 'good',
				'label'     => __( 'Your homepage can be indexed by search engines.', 'wordpress-seo' ),
				'can_fetch' => $fetch,
			);
		}

		if ( $status === WPSEO_OnPage_Option::IS_NOT_INDEXABLE ) {
			/* translators: %1$s: opens a link to a related knowledge base article. %2$s: closes the link. */
			$label = __( '%1$sYour homepage cannot be indexed by search engines%2$s. This is very bad for SEO and should be fixed.', 'wordpress-seo' );
			$label = sprintf(
				$label,
				'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/onpageindexerror' ) . '" target="_blank">',
				'</a>'
			);

			return array(
				'score'     => 'bad',
				'label'     => $label,
				'can_fetch' => $fetch,
			);
		}

		if ( $status === WPSEO_OnPage_Option::CANNOT_FETCH ) {
			/* translators: %1$s: opens a link to a related knowledge base article, %2$s: expands to Yoast SEO, %3$s: closes the link, %4$s: expands to Ryte. */
			$label = __( '%1$s%2$s has not been able to fetch your site\'s indexability status%3$s from %4$s', 'wordpress-seo' );
			$label = sprintf(
				$label,
				'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/onpagerequestfailed' ) . '" target="_blank">',
				'Yoast SEO',
				'</a>',
				'Ryte'
			);

			return array(
				'score'     => 'na',
				'label'     => $label,
				'can_fetch' => $fetch,
			);
		}

		if ( $status === WPSEO_OnPage_Option::NOT_FETCHED ) {
			/* translators: %1$s: expands to Yoast SEO, %2$s: expands to Ryte. */
			$label = __( '%1$s has not fetched your site\'s indexability status yet from %2$s', 'wordpress-seo' );
			$label = sprintf( $label, 'Yoast SEO', 'Ryte' );

			return array(
				'score'     => 'na',
				'label'     => esc_html( $label ),
				'can_fetch' => $fetch,
			);
		}

		return array();
	}
}
PK     ”T]Éž*â  â    onpage/class-onpage-request.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class will fetch a new status from Ryte and if it's necessary it will
 * notify the site admin by email and remove the current meta value to hide the
 * notice for all admin users.
 */
class WPSEO_OnPage_Request {

	/**
	 * @var string The endpoint where the request will be send to.
	 */
	private $onpage_endpoint = 'https://indexability.yoast.onpage.org/';

	/**
	 * Doing the remote get and returns the body.
	 *
	 * @param string $target_url The home url.
	 * @param array  $parameters Array of extra parameters to send to Ryte.
	 *
	 * @return array
	 * @throws Exception The error message that can be used to show to the user.
	 */
	protected function get_remote( $target_url, $parameters = array() ) {
		$defaults   = array(
			'url'          => $target_url,
			'wp_version'   => $GLOBALS['wp_version'],
			'yseo_version' => WPSEO_VERSION,
		);
		$parameters = array_merge( $defaults, $parameters );

		$url = add_query_arg( $parameters, $this->onpage_endpoint );

		$response      = wp_remote_get( $url );
		$response_code = wp_remote_retrieve_response_code( $response );

		// When the request is successful, the response code will be 200.
		if ( $response_code === 200 ) {
			$response_body = wp_remote_retrieve_body( $response );

			return json_decode( $response_body, true );
		}
	}

	/**
	 * Sending a request to Ryte to check if the $home_url is indexable.
	 *
	 * @param string $target_url The URL that will be send to the API.
	 * @param array  $parameters Array of extra parameters to send to Ryte.
	 *
	 * @return array
	 */
	public function do_request( $target_url, $parameters = array() ) {
		$json_body = $this->get_remote( $target_url, $parameters );

		// Ryte recognized a redirect, fetch the data of that URL by calling this method with the value from Ryte.
		if ( ! empty( $json_body['passes_juice_to'] ) ) {
			return $this->do_request( $json_body['passes_juice_to'], $parameters );
		}

		return $json_body;
	}
}
PK     ”T]À.\&      onpage/class-onpage.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Handles the request for getting the Ryte status.
 */
class WPSEO_OnPage implements WPSEO_WordPress_Integration {

	/**
	 * The name of the user meta key for storing the dismissed status.
	 *
	 * @var string
	 */
	const USER_META_KEY = 'wpseo_dismiss_onpage';

	/**
	 * Is the request started by pressing the fetch button.
	 *
	 * @var boolean
	 */
	private $is_manual_request = false;

	/**
	 * Constructs the object.
	 */
	public function __construct() {
		$this->catch_redo_listener();
	}

	/**
	 * Sets up the hooks.
	 *
	 * @return void
	 */
	public function register_hooks() {
		// Adds admin notice if necessary.
		add_filter( 'admin_init', array( $this, 'show_notice' ) );

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

		// Adds weekly schedule to the cron job schedules.
		add_filter( 'cron_schedules', array( $this, 'add_weekly_schedule' ) );

		// Sets the action for the Ryte fetch.
		add_action( 'wpseo_onpage_fetch', array( $this, 'fetch_from_onpage' ) );
	}

	/**
	 * Shows a notice when the website is not indexable.
	 *
	 * @return void
	 */
	public function show_notice() {
		$notification        = $this->get_indexability_notification();
		$notification_center = Yoast_Notification_Center::get();

		if ( $this->should_show_notice() ) {
			$notification_center->add_notification( $notification );

			return;
		}

		$notification_center->remove_notification( $notification );
	}

	/**
	 * Determines if we can use the functionality.
	 *
	 * @return bool True if this functionality can be used.
	 */
	public static function is_active() {
		if ( wp_doing_ajax() ) {
			return false;
		}

		if ( ! WPSEO_Options::get( 'onpage_indexability' ) ) {
			return false;
		}

		return true;
	}

	/**
	 * Hooks to run on plugin activation.
	 */
	public function activate_hooks() {
		if ( $this->get_option()->is_enabled() ) {
			$this->schedule_cron();

			return;
		}

		$this->unschedule_cron();
	}

	/**
	 * Adds a weekly cron schedule.
	 *
	 * @param array $schedules Currently scheduled items.
	 *
	 * @return array Enriched list of schedules.
	 */
	public function add_weekly_schedule( $schedules ) {
		if ( ! is_array( $schedules ) ) {
			$schedules = array();
		}

		$schedules['weekly'] = array(
			'interval' => WEEK_IN_SECONDS,
			'display'  => __( 'Once Weekly', 'wordpress-seo' ),
		);

		return $schedules;
	}

	/**
	 * Fetches the data from Ryte.
	 *
	 * @return bool True if this has been run.
	 */
	public function fetch_from_onpage() {
		$onpage_option = $this->get_option();
		if ( ! $onpage_option->should_be_fetched() ) {
			return false;
		}

		$new_status = $this->request_indexability();
		if ( false === $new_status ) {
			return false;
		}

		// Updates the timestamp in the option.
		$onpage_option->set_last_fetch( time() );

		// The currently indexability status.
		$old_status = $onpage_option->get_status();

		$onpage_option->set_status( $new_status );
		$onpage_option->save_option();

		// Check if the status has been changed.
		if ( $old_status !== $new_status && $new_status !== WPSEO_OnPage_Option::CANNOT_FETCH ) {
			$this->notify_admins();
		}

		return true;
	}

	/**
	 * Retrieves the option to use.
	 *
	 * @return WPSEO_OnPage_Option The option.
	 */
	protected function get_option() {
		return new WPSEO_OnPage_Option();
	}

	/**
	 * Builds the indexability notification.
	 *
	 * @return Yoast_Notification The notification.
	 */
	private function get_indexability_notification() {
		$notice = sprintf(
			/* translators: 1: opens a link to a related knowledge base article. 2: closes the link */
			__( '%1$sYour homepage cannot be indexed by search engines%2$s. This is very bad for SEO and should be fixed.', 'wordpress-seo' ),
			'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/onpageindexerror' ) . '" target="_blank">',
			'</a>'
		);

		return new Yoast_Notification(
			$notice,
			array(
				'type'         => Yoast_Notification::ERROR,
				'id'           => 'wpseo-dismiss-onpageorg',
				'capabilities' => 'wpseo_manage_options',
			)
		);
	}

	/**
	 * Sends a request to Ryte to get the indexability.
	 *
	 * @return int|bool The indexability value.
	 */
	protected function request_indexability() {
		$parameters = array();
		if ( $this->wordfence_protection_enabled() ) {
			$parameters['wf_strict'] = 1;
		}

		$request  = new WPSEO_OnPage_Request();
		$response = $request->do_request( get_option( 'home' ), $parameters );

		if ( isset( $response['is_indexable'] ) ) {
			return (int) $response['is_indexable'];
		}

		return WPSEO_OnPage_Option::CANNOT_FETCH;
	}

	/**
	 * Should the notice being given?
	 *
	 * @return bool True if a notice should be shown.
	 */
	protected function should_show_notice() {
		if ( ! $this->get_option()->is_enabled() ) {
			return false;
		}

		// If development mode is on or the blog is not public, just don't show this notice.
		if ( WPSEO_Utils::is_development_mode() || ( '0' === get_option( 'blog_public' ) ) ) {
			return false;
		}

		return $this->get_option()->get_status() === WPSEO_OnPage_Option::IS_NOT_INDEXABLE;
	}

	/**
	 * Notifies the admins.
	 *
	 * @return void
	 */
	protected function notify_admins() {
		/*
		 * Let's start showing the notices to all admins by removing the hide-notice meta data for each admin resulting
		 * in popping up the notice again.
		 */
		delete_metadata( 'user', 0, self::USER_META_KEY, '', true );
	}

	/**
	 * Schedules the cronjob to get the new indexibility status.
	 *
	 * @return void
	 */
	private function schedule_cron() {
		if ( wp_next_scheduled( 'wpseo_onpage_fetch' ) ) {
			return;
		}

		wp_schedule_event( time(), 'weekly', 'wpseo_onpage_fetch' );
	}

	/**
	 * Unschedules the cronjob to get the new indexibility status.
	 *
	 * @return void
	 */
	private function unschedule_cron() {
		if ( ! wp_next_scheduled( 'wpseo_onpage_fetch' ) ) {
			return;
		}

		wp_clear_scheduled_hook( 'wpseo_onpage_fetch' );
	}

	/**
	 * Redo the fetch request for Ryte.
	 *
	 * @return void
	 */
	private function catch_redo_listener() {
		if ( ! self::is_active() ) {
			return;
		}

		if ( filter_input( INPUT_GET, 'wpseo-redo-onpage' ) === '1' ) {
			$this->is_manual_request = true;

			add_action( 'admin_init', array( $this, 'fetch_from_onpage' ) );
		}
	}

	/**
	 * Checks if WordFence protects the site against 'fake' Google crawlers.
	 *
	 * @return boolean True if WordFence protects the site.
	 */
	private function wordfence_protection_enabled() {
		if ( ! class_exists( 'wfConfig' ) ) {
			return false;
		}

		if ( ! method_exists( 'wfConfig', 'get' ) ) {
			return false;
		}

		return (bool) wfConfig::get( 'blockFakeBots' );
	}
}
PK     ”T]Nà÷	  ÷	    onpage/class-onpage-option.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class handles the data for the option where the Ryte data is stored.
 */
class WPSEO_OnPage_Option {

	/**
	 * @var int
	 */
	const NOT_FETCHED = 99;

	/**
	 * @var int
	 */
	const IS_INDEXABLE = 1;

	/**
	 * @var int
	 */
	const IS_NOT_INDEXABLE = 0;

	/**
	 * @var int
	 */
	const CANNOT_FETCH = -1;

	/**
	 *  The name of the option where data will be stored.
	 *
	 * @var string
	 */
	const OPTION_NAME = 'wpseo_onpage';

	/**
	 * The key of the status in the option.
	 *
	 * @var string
	 */
	const STATUS = 'status';

	/**
	 * The key of the last fetch date in the option.
	 *
	 * @var string
	 */
	const LAST_FETCH = 'last_fetch';

	/**
	 * The limit for fetching the status manually.
	 *
	 * @var int
	 */
	const FETCH_LIMIT = 15;

	/**
	 * The Ryte option stored in the database.
	 *
	 * @var array
	 */
	private $onpage_option;

	/**
	 * Setting the object by setting the properties.
	 */
	public function __construct() {
		$this->onpage_option = $this->get_option();
	}

	/**
	 * Getting the status from the option.
	 *
	 * @return string
	 */
	public function get_status() {
		if ( array_key_exists( self::STATUS, $this->onpage_option ) ) {
			return $this->onpage_option[ self::STATUS ];
		}

		return self::CANNOT_FETCH;
	}

	/**
	 * Saving the status to the options.
	 *
	 * @param string $status The status to save.
	 */
	public function set_status( $status ) {
		$this->onpage_option[ self::STATUS ] = $status;
	}

	/**
	 * Saving the last fetch timestamp to the options.
	 *
	 * @param integer $timestamp Timestamp with the new value.
	 */
	public function set_last_fetch( $timestamp ) {
		$this->onpage_option[ self::LAST_FETCH ] = $timestamp;
	}

	/**
	 * Check if the last fetch is within the time of 60 minutes.
	 *
	 * @return bool
	 */
	public function should_be_fetched() {
		return ( ( time() - $this->onpage_option[ self::LAST_FETCH ] ) > self::FETCH_LIMIT );
	}

	/**
	 * Saving the option with the current data.
	 */
	public function save_option() {
		update_option( self::OPTION_NAME, $this->onpage_option );
	}

	/**
	 * Returns the value of the onpage_enabled status.
	 *
	 * @return bool
	 */
	public function is_enabled() {
		return WPSEO_Options::get( 'onpage_indexability' );
	}

	/**
	 * Getting the option with the Ryte data.
	 *
	 * @return array
	 */
	private function get_option() {
		$default = array(
			self::STATUS     => self::NOT_FETCHED,
			self::LAST_FETCH => 0,
		);

		return get_option( self::OPTION_NAME, $default );
	}
}
PK     ”T]AÌ1
0  0    listeners/class-listener.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Listeners
 */

/**
 * Dictates the required methods for a Listener implementation.
 */
interface WPSEO_Listener {

	/**
	 * Listens to an argument in the request URL and triggers an action.
	 *
	 * @return void
	 */
	public function listen();
}
PK     ”T]�SÊ‰í   í     listeners/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]��t,_  _  ,  class-schema-person-upgrade-notification.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Notifies the user to update the Person on the publish entity in the Configuration Wizard.
 */
class WPSEO_Schema_Person_Upgrade_Notification implements WPSEO_WordPress_Integration {

	/**
	 * Registers all hooks to WordPress
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_action( 'admin_init', array( $this, 'handle_notification' ) );
	}

	/**
	 * Handles if the notification should be added or removed.
	 */
	public function handle_notification() {
		$company_or_person_user_id = WPSEO_Options::get( 'company_or_person_user_id', false );
		if ( WPSEO_Options::get( 'company_or_person' ) === 'person' && empty( $company_or_person_user_id ) ) {
			$this->add_notification();
			return;
		}

		$this->remove_notification();
	}

	/**
	 * Adds a notification to the notification center.
	 */
	protected function add_notification() {
		$notification_center = Yoast_Notification_Center::get();
		$notification_center->add_notification( $this->get_notification() );
	}

	/**
	 * Removes a notification to the notification center.
	 */
	protected function remove_notification() {
		$notification_center = Yoast_Notification_Center::get();
		$notification_center->remove_notification( $this->get_notification() );
	}

	/**
	 * Gets the notification object.
	 *
	 * @return Yoast_Notification
	 */
	protected function get_notification() {
		$message = sprintf(
			/* translators: %1$s is a link start tag to the Configuration Wizard, %2$s is the link closing tag. */
			__( 'You have previously set your site to represent a person. Weâ€™ve improved our functionality around Schema and the Knowledge Graph, so you should go in and %1$scomplete those settings%2$s.', 'wordpress-seo' ),
			'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_titles' ) ) . '">',
			'</a>'
		);

		$notification = new Yoast_Notification(
			$message,
			array(
				'type'         => Yoast_Notification::WARNING,
				'id'           => 'wpseo-schema-person-upgrade',
				'capabilities' => 'wpseo_manage_options',
				'priority'     => 0.8,
			)
		);

		return $notification;
	}
}
PK     ”T]î¦§þ   þ     interface-installable.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents the interface for an installable object.
 */
interface WPSEO_Installable {

	/**
	 * Runs the installation routine.
	 *
	 * @return void
	 */
	public function install();
}
PK     ”T]ªË–e  e    class-plugin-compatibility.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Plugin_Compatibility
 */

/**
 * Class WPSEO_Plugin_Compatibility.
 */
class WPSEO_Plugin_Compatibility {

	/**
	 * @var string
	 */
	protected $current_wpseo_version;

	/**
	 * @var WPSEO_Plugin_Availability
	 */
	protected $availability_checker;

	/**
	 * @var array
	 */
	protected $installed_plugins;

	/**
	 * WPSEO_Plugin_Compatibility constructor.
	 *
	 * @param string     $version              The version to check against.
	 * @param null|class $availability_checker The checker to use.
	 */
	public function __construct( $version, $availability_checker = null ) {
		// We trim off the patch version, as this shouldn't break the comparison.
		$this->current_wpseo_version = $this->get_major_minor_version( $version );
		$this->availability_checker  = $this->retrieve_availability_checker( $availability_checker );
		$this->installed_plugins     = $this->availability_checker->get_installed_plugins();
	}

	/**
	 * Retrieves the availability checker.
	 *
	 * @param null|object $checker The checker to set.
	 *
	 * @return WPSEO_Plugin_Availability The checker to use.
	 */
	private function retrieve_availability_checker( $checker ) {
		if ( is_null( $checker ) || ! is_object( $checker ) ) {
			$checker = new WPSEO_Plugin_Availability();
			$checker->register();
		}

		return $checker;
	}

	/**
	 * Wraps the availability checker's get_installed_plugins method.
	 *
	 * @return array Array containing all the installed plugins.
	 */
	public function get_installed_plugins() {
		return $this->installed_plugins;
	}

	/**
	 * Creates a list of installed plugins and whether or not they are compatible.
	 *
	 * @return array Array containing the installed plugins and compatibility.
	 */
	public function get_installed_plugins_compatibility() {
		foreach ( $this->installed_plugins as $key => $plugin ) {

			$this->installed_plugins[ $key ]['compatible'] = $this->is_compatible( $key );
		}

		return $this->installed_plugins;
	}

	/**
	 * Checks whether or not a plugin is compatible.
	 *
	 * @param string $plugin The plugin to look for and match.
	 *
	 * @return bool Whether or not the plugin is compatible.
	 */
	public function is_compatible( $plugin ) {
		$plugin = $this->availability_checker->get_plugin( $plugin );

		// If we are not syncing versions, we are always compatible.
		if ( ! isset( $plugin['version_sync'] ) || $plugin['version_sync'] !== true ) {
			return true;
		}

		$plugin_version = $this->availability_checker->get_version( $plugin );
		return $this->get_major_minor_version( $plugin_version ) === $this->current_wpseo_version;
	}

	/**
	 * Gets the major/minor version of the plugin for easier comparing.
	 *
	 * @param string $version The version to trim.
	 *
	 * @return string The major/minor version of the plugin.
	 */
	protected function get_major_minor_version( $version ) {
		return substr( $version, 0, 3 );
	}
}
PK     ”T] lÍî¶  ¶    class-add-keyword-modal.phpnu „[µü¤        <?php
/**
 * @package WPSEO\Admin
 */

/**
 * Class to print out the translatable strings for the Add Keyword modal.
 */
class WPSEO_Add_Keyword_Modal {

	/**
	 * Returns the translations for the Add Keyword modal.
	 *
	 * These strings are not escaped because they're meant to be used with React
	 * which already takes care of that. If used in PHP, they should be escaped.
	 *
	 * @return array Translated text strings for the Add Keyword modal.
	 */
	public function get_translations() {
		return array(
			'title'                    => __( 'Would you like to add more than one keyphrase?', 'wordpress-seo' ),
			'intro'                    => sprintf(
				/* translators: %s expands to a 'Yoast SEO Premium' text linked to the yoast.com website. */
				__( 'Great news: you can, with %s!', 'wordpress-seo' ),
				'{{link}}Yoast SEO Premium{{/link}}'
			),
			'link'                     => WPSEO_Shortlinker::get( 'https://yoa.st/pe-premium-page' ),
			'other'                    => sprintf(
				/* translators: %s expands to 'Yoast SEO Premium'. */
				__( 'Other benefits of %s for you:', 'wordpress-seo' ),
				'Yoast SEO Premium'
			),
			'buylink'                  => WPSEO_Shortlinker::get( 'https://yoa.st/add-keywords-popup' ),
			'buy'                      => sprintf(
				/* translators: %s expands to 'Yoast SEO Premium'. */
				__( 'Get %s', 'wordpress-seo' ),
				'Yoast SEO Premium'
			),
			'small'                    => __( '1 year free support and updates included!', 'wordpress-seo' ),
			'a11yNotice.opensInNewTab' => __( '(Opens in a new browser tab)', 'wordpress-seo' ),
		);
	}

	/**
	 * Passes translations to JS for the Add Keyword modal component.
	 *
	 * @return array Translated text strings for the Add Keyword modal component.
	 */
	public function get_translations_for_js() {
		$translations = $this->get_translations();
		return array(
			'locale' => WPSEO_Language_Utils::get_user_locale(),
			'intl'   => $translations,
		);
	}

	/**
	 * Prints the localized Add Keyword modal translations for JS.
	 */
	public function enqueue_translations() {
		wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-global-script', 'yoastAddKeywordModalL10n', $this->get_translations_for_js() );
	}
}
PK     ”T]S–†€-  -  )  capabilities/class-capability-manager.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Capabilities
 */

/**
 * Capability Manager interface.
 */
interface WPSEO_Capability_Manager {

	/**
	 * Registers a capability.
	 *
	 * @param string $capability Capability to register.
	 * @param array  $roles      Roles to add the capability to.
	 * @param bool   $overwrite  Optional. Use add or overwrite as registration method.
	 */
	public function register( $capability, array $roles, $overwrite = false );

	/**
	 * Adds the registerd capabilities to the system.
	 */
	public function add();

	/**
	 * Removes the registered capabilities from the system.
	 */
	public function remove();

	/**
	 * Returns the list of registered capabilities.
	 *
	 * @return string[] List of registered capabilities.
	 */
	public function get_capabilities();
}
PK     ”T]L’þ·Õ  Õ  '  capabilities/class-capability-utils.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Capabilities
 */

/**
 * Capability Utils collection.
 */
class WPSEO_Capability_Utils {

	/**
	 * Checks if the user has the proper capabilities.
	 *
	 * @param string $capability Capability to check.
	 *
	 * @return bool True if the user has the proper rights.
	 */
	public static function current_user_can( $capability ) {
		if ( $capability === 'wpseo_manage_options' ) {
			return self::has( $capability );
		}

		return self::has_any( array( 'wpseo_manage_options', $capability ) );
	}

	/**
	 * Checks if the current user has at least one of the supplied capabilities.
	 *
	 * @param array $capabilities Capabilities to check against.
	 *
	 * @return bool True if the user has at least one capability.
	 */
	protected static function has_any( array $capabilities ) {
		foreach ( $capabilities as $capability ) {
			if ( self::has( $capability ) ) {
				return true;
			}
		}

		return false;
	}

	/**
	 * Checks if the user has a certain capability.
	 *
	 * @param string $capability Capability to check against.
	 *
	 * @return bool True if the user has the capability.
	 */
	protected static function has( $capability ) {
		return current_user_can( $capability );
	}
}
PK     ”T].¤×§ã  ã  2  capabilities/class-abstract-capability-manager.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Capabilities
 */

/**
 * Abstract Capability Manager shared code.
 */
abstract class WPSEO_Abstract_Capability_Manager implements WPSEO_Capability_Manager {

	/**
	 * Registered capabilities.
	 *
	 * @var array
	 */
	protected $capabilities = array();

	/**
	 * Registers a capability.
	 *
	 * @param string $capability Capability to register.
	 * @param array  $roles      Roles to add the capability to.
	 * @param bool   $overwrite  Optional. Use add or overwrite as registration method.
	 */
	public function register( $capability, array $roles, $overwrite = false ) {
		if ( $overwrite || ! isset( $this->capabilities[ $capability ] ) ) {
			$this->capabilities[ $capability ] = $roles;

			return;
		}

		// Combine configurations.
		$this->capabilities[ $capability ] = array_merge( $roles, $this->capabilities[ $capability ] );

		// Remove doubles.
		$this->capabilities[ $capability ] = array_unique( $this->capabilities[ $capability ] );
	}

	/**
	 * Returns the list of registered capabilitities.
	 *
	 * @return string[] Registered capabilities.
	 */
	public function get_capabilities() {
		return array_keys( $this->capabilities );
	}

	/**
	 * Returns a list of WP_Role roles.
	 *
	 * The string array of role names are converted to actual WP_Role objects.
	 * These are needed to be able to use the API on them.
	 *
	 * @param array $roles Roles to retrieve the objects for.
	 *
	 * @return WP_Role[] List of WP_Role objects.
	 */
	protected function get_wp_roles( array $roles ) {
		$wp_roles = array_map( 'get_role', $roles );

		return array_filter( $wp_roles );
	}

	/**
	 * Filter capability roles.
	 *
	 * @param string $capability Capability to filter roles for.
	 * @param array  $roles      List of roles which can be filtered.
	 *
	 * @return array Filtered list of roles for the capability.
	 */
	protected function filter_roles( $capability, array $roles ) {
		/**
		 * Filter: Allow changing roles that a capability is added to.
		 *
		 * @api array $roles The default roles to be filtered.
		 */
		$filtered = apply_filters( $capability . '_roles', $roles );

		// Make sure we have the expected type.
		if ( ! is_array( $filtered ) ) {
			return array();
		}

		return $filtered;
	}
}
PK     ”T]§ÌìIZ  Z  1  capabilities/class-capability-manager-factory.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Capabilities
 */

/**
 * Capability Manager Factory.
 */
class WPSEO_Capability_Manager_Factory {

	/**
	 * Returns the Manager to use.
	 *
	 * @return WPSEO_Capability_Manager Manager to use.
	 */
	public static function get() {
		static $manager = null;

		if ( $manager === null ) {
			if ( function_exists( 'wpcom_vip_add_role_caps' ) ) {
				$manager = new WPSEO_Capability_Manager_VIP();
			}

			if ( ! function_exists( 'wpcom_vip_add_role_caps' ) ) {
				$manager = new WPSEO_Capability_Manager_WP();
			}
		}

		return $manager;
	}
}
PK     ”T]hp¤C  C  5  capabilities/class-capability-manager-integration.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Capabilities
 */

/**
 * Integrates Yoast SEO capabilities with third party role manager plugins.
 *
 * Integrates with: Members
 * Integrates with: User Role Editor
 */
class WPSEO_Capability_Manager_Integration implements WPSEO_WordPress_Integration {

	/**
	 * Capability manager to use.
	 *
	 * @var WPSEO_Capability_Manager
	 */
	public $manager;

	/**
	 * WPSEO_Capability_Manager_Integration constructor.
	 *
	 * @param WPSEO_Capability_Manager $manager The capability manager to use.
	 */
	public function __construct( WPSEO_Capability_Manager $manager ) {
		$this->manager = $manager;
	}

	/**
	 * Registers the hooks.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_filter( 'members_get_capabilities', array( $this, 'get_capabilities' ) );
		add_action( 'members_register_cap_groups', array( $this, 'action_members_register_cap_group' ) );

		add_filter( 'ure_capabilities_groups_tree', array( $this, 'filter_ure_capabilities_groups_tree' ) );
		add_filter( 'ure_custom_capability_groups', array( $this, 'filter_ure_custom_capability_groups' ), 10, 2 );
	}

	/**
	 * Get the Yoast SEO capabilities.
	 * Optionally append them to an existing array.
	 *
	 * @param  array $caps Optional existing capability list.
	 * @return array
	 */
	public function get_capabilities( array $caps = array() ) {
		if ( ! did_action( 'wpseo_register_capabilities' ) ) {
			do_action( 'wpseo_register_capabilities' );
		}

		return array_merge( $caps, $this->manager->get_capabilities() );
	}

	/**
	 * Add capabilities to its own group in the Members plugin.
	 *
	 * @see members_register_cap_group()
	 */
	public function action_members_register_cap_group() {
		if ( ! function_exists( 'members_register_cap_group' ) ) {
			return;
		}

		// Register the yoast group.
		$args = array(
			'label'      => esc_html__( 'Yoast SEO', 'wordpress-seo' ),
			'caps'       => $this->get_capabilities(),
			'icon'       => 'dashicons-admin-plugins',
			'diff_added' => true,
		);
		members_register_cap_group( 'wordpress-seo', $args );
	}

	/**
	 * Adds Yoast SEO capability group in the User Role Editor plugin.
	 *
	 * @see URE_Capabilities_Groups_Manager::get_groups_tree()
	 *
	 * @param array $groups Current groups.
	 *
	 * @return array Filtered list of capabilty groups.
	 */
	public function filter_ure_capabilities_groups_tree( $groups = array() ) {
		$groups = (array) $groups;

		$groups['wordpress-seo'] = array(
			'caption' => 'Yoast SEO',
			'parent'  => 'custom',
			'level'   => 3,
		);

		return $groups;
	}

	/**
	 * Adds capabilities to the Yoast SEO group in the User Role Editor plugin.
	 *
	 * @see URE_Capabilities_Groups_Manager::get_cap_groups()
	 *
	 * @param array  $groups Current capability groups.
	 * @param string $cap_id Capability identifier.
	 *
	 * @return array List of filtered groups.
	 */
	public function filter_ure_custom_capability_groups( $groups = array(), $cap_id = '' ) {
		if ( in_array( $cap_id, $this->get_capabilities(), true ) ) {
			$groups   = (array) $groups;
			$groups[] = 'wordpress-seo';
		}

		return $groups;
	}
}
PK     ”T]V6˜eÙ  Ù  ,  capabilities/class-capability-manager-wp.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Capabilities
 */

/**
 * Default WordPress capability manager implementation.
 */
final class WPSEO_Capability_Manager_WP extends WPSEO_Abstract_Capability_Manager {

	/**
	 * Adds the capabilities to the roles.
	 *
	 * @return void
	 */
	public function add() {
		foreach ( $this->capabilities as $capability => $roles ) {
			$filtered_roles = $this->filter_roles( $capability, $roles );

			$wp_roles = $this->get_wp_roles( $filtered_roles );
			foreach ( $wp_roles as $wp_role ) {
				$wp_role->add_cap( $capability );
			}
		}
	}

	/**
	 * Unregisters the capabilities from the system.
	 *
	 * @return void
	 */
	public function remove() {
		// Remove from any roles it has been added to.
		$roles = wp_roles()->get_names();
		$roles = array_keys( $roles );

		foreach ( $this->capabilities as $capability => $_roles ) {
			$registered_roles = array_unique( array_merge( $roles, $this->capabilities[ $capability ] ) );

			// Allow filtering of roles.
			$filtered_roles = $this->filter_roles( $capability, $registered_roles );

			$wp_roles = $this->get_wp_roles( $filtered_roles );
			foreach ( $wp_roles as $wp_role ) {
				$wp_role->remove_cap( $capability );
			}
		}
	}
}
PK     ”T]�SÊ‰í   í     capabilities/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]WÿY³¨  ¨  ,  capabilities/class-register-capabilities.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Capabilities
 */

/**
 * Capabilities registration class.
 */
class WPSEO_Register_Capabilities implements WPSEO_WordPress_Integration {

	/**
	 * Registers the hooks.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_action( 'wpseo_register_capabilities', array( $this, 'register' ) );

		if ( is_multisite() ) {
			add_action( 'user_has_cap', array( $this, 'filter_user_has_wpseo_manage_options_cap' ), 10, 4 );
		}
	}

	/**
	 * Registers the capabilities.
	 *
	 * @return void
	 */
	public function register() {
		$manager = WPSEO_Capability_Manager_Factory::get();

		$manager->register( 'wpseo_bulk_edit', array( 'editor', 'wpseo_editor', 'wpseo_manager' ) );
		$manager->register( 'wpseo_edit_advanced_metadata', array( 'wpseo_editor', 'wpseo_manager' ) );

		$manager->register( 'wpseo_manage_options', array( 'administrator', 'wpseo_manager' ) );
	}

	/**
	 * Revokes the 'wpseo_manage_options' capability from administrator users if it should only
	 * only be granted to network administrators.
	 *
	 * @param array   $allcaps An array of all the user's capabilities.
	 * @param array   $caps    Actual capabilities being checked.
	 * @param array   $args    Optional parameters passed to has_cap(), typically object ID.
	 * @param WP_User $user    The user object.
	 *
	 * @return array Possibly modified array of the user's capabilities.
	 */
	public function filter_user_has_wpseo_manage_options_cap( $allcaps, $caps, $args, $user ) {

		// We only need to do something if 'wpseo_manage_options' is being checked.
		if ( ! in_array( 'wpseo_manage_options', $caps, true ) ) {
			return $allcaps;
		}

		// If the user does not have 'wpseo_manage_options' anyway, we don't need to revoke access.
		if ( empty( $allcaps['wpseo_manage_options'] ) ) {
			return $allcaps;
		}

		// If the user does not have 'delete_users', they are not an administrator.
		if ( empty( $allcaps['delete_users'] ) ) {
			return $allcaps;
		}

		$options = WPSEO_Options::get_instance();

		if ( $options->get( 'access' ) === 'superadmin' && ! is_super_admin( $user->ID ) ) {
			unset( $allcaps['wpseo_manage_options'] );
		}

		return $allcaps;
	}
}
PK     ”T]šbÜr¯  ¯  -  capabilities/class-capability-manager-vip.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Capabilities
 */

/**
 * VIP implementation of the Capability Manager.
 */
final class WPSEO_Capability_Manager_VIP extends WPSEO_Abstract_Capability_Manager {

	/**
	 * Adds the registered capabilities to the system.
	 *
	 * @return void
	 */
	public function add() {
		$role_capabilities = array();
		foreach ( $this->capabilities as $capability => $roles ) {
			$role_capabilities = $this->get_role_capabilities( $role_capabilities, $capability, $roles );
		}

		foreach ( $role_capabilities as $role => $capabilities ) {
			wpcom_vip_add_role_caps( $role, $capabilities );
		}
	}

	/**
	 * Removes the registered capabilities from the system
	 *
	 * @return void
	 */
	public function remove() {
		// Remove from any role it has been added to.
		$roles = wp_roles()->get_names();
		$roles = array_keys( $roles );

		$role_capabilities = array();
		foreach ( array_keys( $this->capabilities ) as $capability ) {
			// Allow filtering of roles.
			$role_capabilities = $this->get_role_capabilities( $role_capabilities, $capability, $roles );
		}

		foreach ( $role_capabilities as $role => $capabilities ) {
			wpcom_vip_remove_role_caps( $role, $capabilities );
		}
	}

	/**
	 * Returns the roles which the capability is registered on.
	 *
	 * @param array  $role_capabilities List of all roles with their capabilities.
	 * @param string $capability        Capability to filter roles for.
	 * @param array  $roles             List of default roles.
	 *
	 * @return array List of capabilities.
	 */
	protected function get_role_capabilities( $role_capabilities, $capability, $roles ) {
		// Allow filtering of roles.
		$filtered_roles = $this->filter_roles( $capability, $roles );

		foreach ( $filtered_roles as $role ) {
			if ( ! isset( $add_role_caps[ $role ] ) ) {
				$role_capabilities[ $role ] = array();
			}

			$role_capabilities[ $role ][] = $capability;
		}

		return $role_capabilities;
	}
}
PK     ”T]¼ó@/Â  Â    class-suggested-plugins.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Suggested_Plugins
 */

/**
 * Class WPSEO_Suggested_Plugins
 */
class WPSEO_Suggested_Plugins implements WPSEO_WordPress_Integration {

	/**
	 * @var WPSEO_Plugin_Availability
	 */
	protected $availability_checker;

	/**
	 * @var Yoast_Notification_Center
	 */
	protected $notification_center;

	/**
	 * WPSEO_Suggested_Plugins constructor.
	 *
	 * @param WPSEO_Plugin_Availability $availability_checker The availability checker to use.
	 * @param Yoast_Notification_Center $notification_center  The notification center to add notifications to.
	 */
	public function __construct( WPSEO_Plugin_Availability $availability_checker, Yoast_Notification_Center $notification_center ) {
		$this->availability_checker = $availability_checker;
		$this->notification_center  = $notification_center;
	}

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_action( 'admin_init', array( $this->availability_checker, 'register' ) );
		add_action( 'admin_init', array( $this, 'add_notifications' ) );
	}

	/**
	 * Adds notifications (when necessary).
	 *
	 * @return void
	 */
	public function add_notifications() {
		$checker = $this->availability_checker;

		// Get all Yoast plugins that have dependencies.
		$plugins = $checker->get_plugins_with_dependencies();

		foreach ( $plugins as $plugin_name => $plugin ) {
			if ( ! $checker->dependencies_are_satisfied( $plugin ) ) {
				continue;
			}

			$dependency_names = $checker->get_dependency_names( $plugin );
			$notification     = $this->get_yoast_seo_suggested_plugins_notification( $plugin_name, $plugin, $dependency_names[0] );

			if ( ! WPSEO_Utils::is_yoast_seo_premium() && ( ! $checker->is_installed( $plugin ) || ! $checker->is_active( $plugin['slug'] ) ) ) {
				$this->notification_center->add_notification( $notification );

				continue;
			}

			$this->notification_center->remove_notification( $notification );
		}
	}

	/**
	 * Build Yoast SEO suggested plugins notification.
	 *
	 * @param string $name            The plugin name to use for the unique ID.
	 * @param array  $plugin          The plugin to retrieve the data from.
	 * @param string $dependency_name The name of the dependency.
	 *
	 * @return Yoast_Notification The notification containing the suggested plugin.
	 */
	protected function get_yoast_seo_suggested_plugins_notification( $name, $plugin, $dependency_name ) {
		$message = $this->create_install_suggested_plugin_message( $plugin, $dependency_name );

		if ( $this->availability_checker->is_installed( $plugin ) && ! $this->availability_checker->is_active( $plugin['slug'] ) ) {
			$message = $this->create_activate_suggested_plugin_message( $plugin, $dependency_name );
		}

		return new Yoast_Notification(
			$message,
			array(
				'id'           => 'wpseo-suggested-plugin-' . $name,
				'type'         => Yoast_Notification::WARNING,
				'capabilities' => array( 'install_plugins' ),
			)
		);
	}

	/**
	 * Creates a message to suggest the installation of a particular plugin.
	 *
	 * @param array $suggested_plugin   The suggested plugin.
	 * @param array $third_party_plugin The third party plugin that we have a suggested plugin for.
	 *
	 * @return string The install suggested plugin message.
	 */
	protected function create_install_suggested_plugin_message( $suggested_plugin, $third_party_plugin ) {
		/* translators: %1$s expands to Yoast SEO, %2$s expands to the dependency name, %3$s expands to the install link, %4$s expands to the more info link. */
		$message      = __( '%1$s and %2$s can work together a lot better by adding a helper plugin. Please install %3$s to make your life better. %4$s.', 'wordpress-seo' );
		$install_link = WPSEO_Admin_Utils::get_install_link( $suggested_plugin );

		return sprintf(
			$message,
			'Yoast SEO',
			$third_party_plugin,
			$install_link,
			$this->create_more_information_link( $suggested_plugin['url'], $suggested_plugin['title'] )
		);
	}

	/**
	 * Creates a more information link that directs the user to WordPress.org Plugin repository.
	 *
	 * @param string $url  The URL to the plugin's page.
	 * @param string $name The name of the plugin.
	 *
	 * @return string The more information link.
	 */
	protected function create_more_information_link( $url, $name ) {
		return sprintf(
			'<a href="%s" aria-label="%s" target="_blank" rel="noopener noreferrer">%s</a>',
			$url,
			/* translators: %1$s expands to the dependency name. */
			sprintf( __( 'More information about %1$s', 'wordpress-seo' ), $name ),
			__( 'More information', 'wordpress-seo' )
		);
	}

	/**
	 * Creates a message to suggest the activation of a particular plugin.
	 *
	 * @param array $suggested_plugin   The suggested plugin.
	 * @param array $third_party_plugin The third party plugin that we have a suggested plugin for.
	 *
	 * @return string The activate suggested plugin message.
	 */
	protected function create_activate_suggested_plugin_message( $suggested_plugin, $third_party_plugin ) {
		/* translators: %1$s expands to Yoast SEO, %2$s expands to the dependency name, %3$s expands to activation link. */
		$message        = __( '%1$s and %2$s can work together a lot better by adding a helper plugin. Please activate %3$s to make your life better.', 'wordpress-seo' );
		$activation_url = WPSEO_Admin_Utils::get_activation_url( $suggested_plugin['slug'] );

		return sprintf(
			$message,
			'Yoast SEO',
			$third_party_plugin,
			sprintf( '<a href="%s">%s</a>', $activation_url, $suggested_plugin['title'] )
		);
	}
}
PK     ”T]Ë8	¤¦  ¦  '  recalculate/class-recalculate-posts.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class handles the calculation of the SEO score for all posts with a filled focus keyword.
 */
class WPSEO_Recalculate_Posts extends WPSEO_Recalculate {

	/**
	 * Save the scores.
	 *
	 * @param array $scores The scores for the posts.
	 */
	public function save_scores( array $scores ) {
		foreach ( $scores as $score ) {
			$this->save_score( $score );
		}
	}

	/**
	 * Save the score.
	 *
	 * @param array $score The score to save.
	 */
	protected function save_score( array $score ) {
		WPSEO_Meta::set_value( 'linkdex', $score['score'], $score['item_id'] );
	}

	/**
	 * Get the posts from the database by doing a WP_Query.
	 *
	 * @param integer $paged The page.
	 *
	 * @return string
	 */
	protected function get_items( $paged ) {
		$items_per_page = max( 1, $this->items_per_page );
		$post_query     = new WP_Query(
			array(
				'post_type'      => 'any',
				'meta_key'       => '_yoast_wpseo_focuskw',
				'posts_per_page' => $items_per_page,
				'paged'          => $paged,
			)
		);

		return $post_query->get_posts();
	}

	/**
	 * Map the posts to a response array.
	 *
	 * @param WP_Post $item The post for which to build the analyzer data.
	 *
	 * @return array
	 */
	protected function item_to_response( $item ) {
		$focus_keyword = WPSEO_Meta::get_value( 'focuskw', $item->ID );

		$content = $item->post_content;

		// Check if there's a featured image.
		$content .= $this->add_featured_image( $item );

		/**
		 * Filter the post content for use in the SEO score recalculation.
		 *
		 * @param string $content Content of the post. Modify to reflect front-end content.
		 * @param WP_Post $item The Post object the content comes from.
		 */
		$content = apply_filters( 'wpseo_post_content_for_recalculation', $content, $item );

		// Apply shortcodes.
		$content = do_shortcode( $content );

		return array(
			'post_id'       => $item->ID,
			'text'          => $content,
			'keyword'       => $focus_keyword,
			'url'           => urldecode( $item->post_name ),
			'pageTitle'     => apply_filters( 'wpseo_title', wpseo_replace_vars( $this->get_title( $item->ID, $item->post_type ), $item ) ),
			'meta'          => apply_filters( 'wpseo_metadesc', wpseo_replace_vars( $this->get_meta_description( $item->ID, $item->post_type ), $item ) ),
			'keyword_usage' => array(
				$focus_keyword => WPSEO_Meta::keyword_usage( $focus_keyword, $item->ID ),
			),
		);
	}

	/**
	 * Get the title for given post.
	 *
	 * @param integer $post_id   The ID of the post for which to get the title.
	 * @param string  $post_type The post type.
	 *
	 * @return mixed|string
	 */
	private function get_title( $post_id, $post_type ) {
		$title = WPSEO_Meta::get_value( 'title', $post_id );
		if ( '' !== $title ) {
			return $title;
		}

		$default_from_options = $this->default_from_options( 'title-tax', $post_type );
		if ( false !== $default_from_options ) {
			return str_replace( ' %%page%% ', ' ', $default_from_options );
		}

		return '%%title%%';
	}

	/**
	 * Get the meta description for given post.
	 *
	 * @param integer $post_id   The ID of the post for which to get the meta description.
	 * @param string  $post_type The post type.
	 *
	 * @return bool|string
	 */
	private function get_meta_description( $post_id, $post_type ) {
		$meta_description = WPSEO_Meta::get_value( 'metadesc', $post_id );
		if ( '' !== $meta_description ) {
			return $meta_description;
		}

		$default_from_options = $this->default_from_options( 'metadesc', $post_type );
		if ( false !== $default_from_options ) {
			return $default_from_options;
		}

		return '';
	}

	/**
	 * Retrieves the associated featured image if there is one present.
	 *
	 * @param WP_Post $item The post item to check for a featured image.
	 *
	 * @return string The image string.
	 */
	private function add_featured_image( $item ) {
		if ( ! has_post_thumbnail( $item->ID ) ) {
			return '';
		}

		return ' ' . get_the_post_thumbnail( $item->ID );
	}
}
PK     ”T] ëÑƒa  a  !  recalculate/class-recalculate.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Abstract class to force methods in recalculate classes.
 */
abstract class WPSEO_Recalculate {

	/**
	 * @var int
	 */
	protected $items_per_page = 20;

	/**
	 * Saves the array with scores to the database.
	 *
	 * @param array $scores Array with the score for each item.
	 */
	abstract public function save_scores( array $scores );

	/**
	 * Gets the items and parses it to an response.
	 *
	 * @param integer $paged The current page number.
	 *
	 * @return string
	 */
	abstract protected function get_items( $paged );

	/**
	 * Maps the items to an array for the response.
	 *
	 * @param mixed $item Object with data to parse.
	 *
	 * @return array
	 */
	abstract protected function item_to_response( $item );

	/**
	 * Gets the items to recalculate.
	 *
	 * @param int $paged The current page number.
	 *
	 * @return array Items that can be recalculated.
	 */
	public function get_items_to_recalculate( $paged ) {
		$return = array();

		$paged = abs( $paged );

		$items = $this->get_items( $paged );

		$return['items']       = $this->parse_items( $items );
		$return['total_items'] = count( $items );

		if ( $return['total_items'] >= $this->items_per_page ) {
			$return['next_page'] = ( $paged + 1 );
		}

		return $return;
	}

	/**
	 * Parse the posts|terms with the value we need.
	 *
	 * @param array $items The items to parse.
	 *
	 * @return array
	 */
	protected function parse_items( array $items ) {
		$return = array();
		foreach ( $items as $item ) {
			$response = $this->item_to_response( $item );
			if ( ! empty( $response ) ) {
				$return[] = $response;
			}
		}

		return $return;
	}

	/**
	 * Get default from the options for given field.
	 *
	 * @param string $field  The field for which to get the default options.
	 * @param string $suffix The post type.
	 *
	 * @return bool|string
	 */
	protected function default_from_options( $field, $suffix ) {
		$target_option_field = $field . '-' . $suffix;
		if ( '' !== WPSEO_Options::get( $target_option_field, '' ) ) {
			return WPSEO_Options::get( $target_option_field );
		}

		return false;
	}
}
PK     ”T]�SÊ‰í   í     recalculate/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]‘ë¼~w  w  '  recalculate/class-recalculate-terms.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class handles the calculation of the SEO score for all terms.
 */
class WPSEO_Recalculate_Terms extends WPSEO_Recalculate {

	/**
	 * Save the scores.
	 *
	 * @param array $scores The scores to save.
	 */
	public function save_scores( array $scores ) {

		$tax_meta = get_option( 'wpseo_taxonomy_meta' );

		foreach ( $scores as $score ) {
			$tax_meta[ $score['taxonomy'] ][ $score['item_id'] ]['wpseo_linkdex'] = $score['score'];
		}

		update_option( 'wpseo_taxonomy_meta', $tax_meta );
	}

	/**
	 * Save the score.
	 *
	 * @param array $score The score to save.
	 */
	protected function save_score( array $score ) {
		WPSEO_Meta::set_value( 'linkdex', $score['score'], $score['item_id'] );
	}

	/**
	 * Get the terms from the database by doing a WP_Query.
	 *
	 * @param integer $paged The page.
	 *
	 * @return array
	 */
	protected function get_items( $paged ) {
		$items_per_page = max( 1, $this->items_per_page );

		return get_terms(
			get_taxonomies(),
			array(
				'hide_empty' => false,
				'number'     => $items_per_page,
				'offset'     => $items_per_page * abs( $paged - 1 ),
			)
		);
	}

	/**
	 * Convert the given term into a analyzable object.
	 *
	 * @param mixed $item The term for which to build the analyzer data.
	 *
	 * @return array
	 */
	protected function item_to_response( $item ) {
		$focus_keyword = $this->get_focus_keyword( $item );
		$title         = str_replace( ' %%page%% ', ' ', $this->get_title( $item ) );
		$meta          = $this->get_meta_description( $item );

		$description = $item->description;

		/**
		 * Filter the term description for recalculation.
		 *
		 * @param string $description Content of the term. Modify to reflect front-end content.
		 * @oaram WP_Term $item The term the description comes from.
		 */
		$description = apply_filters( 'wpseo_term_description_for_recalculation', $description, $item );

		return array(
			'term_id'       => $item->term_id,
			'taxonomy'      => $item->taxonomy,
			'text'          => $description,
			'keyword'       => $focus_keyword,
			'url'           => urldecode( $item->slug ),
			'pageTitle'     => apply_filters( 'wpseo_title', wpseo_replace_vars( $title, $item, array( 'page' ) ) ),
			'meta'          => apply_filters( 'wpseo_metadesc', wpseo_replace_vars( $meta, $item ) ),
			'keyword_usage' => array(
				$focus_keyword => WPSEO_Taxonomy_Meta::get_keyword_usage( $focus_keyword, $item->term_id, $item->taxonomy ),
			),
		);
	}

	/**
	 * Gets the focus keyword for the term.
	 *
	 * @param stdClass|WP_Term $term Term to determine the keyword for.
	 *
	 * @return bool|string
	 */
	private function get_focus_keyword( $term ) {
		$focus_keyword = WPSEO_Taxonomy_Meta::get_term_meta( 'focuskw', $term->term_id, $term->taxonomy );
		if ( ! empty( $focus_keyword ) ) {
			return $focus_keyword;
		}

		return $term->name;
	}

	/**
	 * Get the title for given term.
	 *
	 * @param stdClass|WP_Term $term The term object.
	 *
	 * @return mixed|string
	 */
	private function get_title( $term ) {
		$title = WPSEO_Taxonomy_Meta::get_term_meta( $term->term_id, $term->taxonomy, 'title' );
		if ( '' !== $title ) {
			return $title;
		}

		$default_from_options = $this->default_from_options( 'title-tax', $term->taxonomy );
		if ( false !== $default_from_options ) {
			return $default_from_options;
		}

		return '%%title%%';
	}

	/**
	 * Get the meta description for given post.
	 *
	 * @param stdClass|WP_Term $term The term object.
	 *
	 * @return bool|string
	 */
	private function get_meta_description( $term ) {
		$meta_description = WPSEO_Taxonomy_Meta::get_term_meta( $term->term_id, $term->taxonomy, 'desc' );
		if ( '' !== $meta_description ) {
			return $meta_description;
		}

		$default_from_options = $this->default_from_options( 'metadesc-tax', $term->taxonomy );
		if ( false !== $default_from_options ) {
			return $default_from_options;
		}

		return '';
	}
}
PK     ”T]Ý‘IY5  5  ,  class-admin-editor-specific-replace-vars.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Determines the editor specific replacement variables.
 */
class WPSEO_Admin_Editor_Specific_Replace_Vars {

	/**
	 * @var array The editor specific replacement variables.
	 */
	protected $replacement_variables = array(
		// Posts types.
		'page'                     => array( 'id', 'pt_single', 'pt_plural', 'parent_title' ),
		'post'                     => array( 'id', 'term404', 'pt_single', 'pt_plural' ),
		// Custom post type.
		'custom_post_type'         => array( 'id', 'term404', 'pt_single', 'pt_plural', 'parent_title' ),
		// Settings - archive pages.
		'custom-post-type_archive' => array( 'pt_single', 'pt_plural' ),

		// Taxonomies.
		'category'                 => array( 'term_title', 'term_description', 'category_description', 'parent_title' ),
		'post_tag'                 => array( 'term_title', 'term_description', 'tag_description' ),
		'post_format'              => array(),
		// Custom taxonomy.
		'term-in-custom-taxonomy'  => array( 'term_title', 'term_description', 'category_description', 'parent_title' ),

		// Settings - special pages.
		'search'                   => array( 'searchphrase' ),
	);

	/**
	 * WPSEO_Admin_Editor_Specific_Replace_Vars constructor.
	 */
	public function __construct() {
		$this->add_for_page_types(
			array( 'page', 'post', 'custom_post_type' ),
			WPSEO_Custom_Fields::get_custom_fields()
		);

		$this->add_for_page_types(
			array( 'post', 'term-in-custom-taxonomies' ),
			WPSEO_Custom_Taxonomies::get_custom_taxonomies()
		);
	}

	/**
	 * Retrieves the editor specific replacement variables.
	 *
	 * @return array The editor specific replacement variables.
	 */
	public function get() {
		/**
		 * Filter: Adds the possibility to add extra editor specific replacement variables.
		 *
		 * @api array $replacement_variables Empty array to add the editor specific replace vars to.
		 */
		$replacement_variables = apply_filters(
			'wpseo_editor_specific_replace_vars',
			$this->replacement_variables
		);

		if ( ! is_array( $replacement_variables ) ) {
			$replacement_variables = $this->replacement_variables;
		}

		return array_filter( $replacement_variables, 'is_array' );
	}

	/**
	 * Retrieves the generic replacement variable names.
	 *
	 * Which are the replacement variables without the editor specific ones.
	 *
	 * @param array $replacement_variables Possibly generic replacement variables.
	 *
	 * @return array The generic replacement variable names.
	 */
	public function get_generic( $replacement_variables ) {
		$shared_variables = array_diff(
			$this->extract_names( $replacement_variables ),
			$this->get_unique_replacement_variables()
		);

		return array_values( $shared_variables );
	}

	/**
	 * Determines the page type of the current term.
	 *
	 * @param string $taxonomy The taxonomy name.
	 *
	 * @return string The page type.
	 */
	public function determine_for_term( $taxonomy ) {
		$replacement_variables = $this->get();
		if ( array_key_exists( $taxonomy, $replacement_variables ) ) {
			return $taxonomy;
		}

		return 'term-in-custom-taxonomy';
	}

	/**
	 * Determines the page type of the current post.
	 *
	 * @param WP_Post $post A WordPress post instance.
	 *
	 * @return string The page type.
	 */
	public function determine_for_post( $post ) {
		if ( $post instanceof WP_Post === false ) {
			return 'post';
		}

		$replacement_variables = $this->get();
		if ( array_key_exists( $post->post_type, $replacement_variables ) ) {
			return $post->post_type;
		}

		return 'custom_post_type';
	}

	/**
	 * Determines the page type for a post type.
	 *
	 * @param string $post_type The name of the post_type.
	 * @param string $fallback  The page type to fall back to.
	 *
	 * @return string The page type.
	 */
	public function determine_for_post_type( $post_type, $fallback = 'custom_post_type' ) {
		if ( ! $this->has_for_page_type( $post_type ) ) {
			return $fallback;
		}

		return $post_type;
	}

	/**
	 * Determines the page type for an archive page.
	 *
	 * @param string $name     The name of the archive.
	 * @param string $fallback The page type to fall back to.
	 *
	 * @return string The page type.
	 */
	public function determine_for_archive( $name, $fallback = 'custom-post-type_archive' ) {
		$page_type = $name . '_archive';

		if ( ! $this->has_for_page_type( $page_type ) ) {
			return $fallback;
		}

		return $page_type;
	}

	/**
	 * Adds the replavement variables for the given page types.
	 *
	 * @param array $page_types                   Page types to add variables for.
	 * @param array $replacement_variables_to_add The variables to add.
	 *
	 * @return void
	 */
	protected function add_for_page_types( array $page_types, array $replacement_variables_to_add ) {
		if ( empty( $replacement_variables_to_add ) ) {
			return;
		}

		$replacement_variables_to_add = array_fill_keys( $page_types, $replacement_variables_to_add );
		$replacement_variables        = $this->replacement_variables;

		$this->replacement_variables = array_merge_recursive( $replacement_variables, $replacement_variables_to_add );
	}

	/**
	 * Extracts the names from the given replacements variables.
	 *
	 * @param array $replacement_variables Replacement variables to extract the name from.
	 *
	 * @return array Extracted names.
	 */
	protected function extract_names( $replacement_variables ) {
		$extracted_names = array();

		foreach ( $replacement_variables as $replacement_variable ) {
			if ( empty( $replacement_variable['name'] ) ) {
				continue;
			}

			$extracted_names[] = $replacement_variable['name'];
		}

		return $extracted_names;
	}

	/**
	 * Returns whether the given page type has editor specific replace vars.
	 *
	 * @param string $page_type The page type to check.
	 *
	 * @return bool True if there are associated editor specific replace vars.
	 */
	protected function has_for_page_type( $page_type ) {
		$replacement_variables = $this->get();

		return ( ! empty( $replacement_variables[ $page_type ] ) && is_array( $replacement_variables[ $page_type ] ) );
	}

	/**
	 * Merges all editor specific replacement variables into one array and removes duplicates.
	 *
	 * @return array The list of unique editor specific replacement variables.
	 */
	protected function get_unique_replacement_variables() {
		$merged_replacement_variables = call_user_func_array( 'array_merge', $this->get() );

		return array_unique( $merged_replacement_variables );
	}
}
PK     ”T])Ïâì“  “    class-export.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Export
 */

/**
 * Class WPSEO_Export.
 *
 * Class with functionality to export the WP SEO settings.
 */
class WPSEO_Export {

	/**
	 * @var string
	 */
	const NONCE_ACTION = 'wpseo_export';

	/**
	 * @var string
	 */
	private $export = '';

	/**
	 * @var string
	 */
	private $error = '';

	/**
	 * @var boolean
	 */
	public $success;

	/**
	 * Handles the export request.
	 */
	public function export() {
		check_admin_referer( self::NONCE_ACTION );
		$this->export_settings();
		$this->output();
	}

	/**
	 * Outputs the export.
	 */
	public function output() {
		if ( ! WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) ) {
			esc_html_e( 'You do not have the required rights to export settings.', 'wordpress-seo' );
			return;
		}

		echo '<p>';
		printf(
			/* translators: %1$s expands to Import settings */
			esc_html__(
				'Copy all these settings to another site\'s %1$s tab and click "%1$s" there.',
				'wordpress-seo'
			),
			esc_html__(
				'Import settings',
				'wordpress-seo'
			)
		);
		echo '</p>';
		echo '<textarea id="wpseo-export" rows="20" cols="100">' . $this->export . '</textarea>';
	}

	/**
	 * Returns true when the property error has a value.
	 *
	 * @return bool
	 */
	public function has_error() {
		return ( $this->error !== '' );
	}

	/**
	 * Sets the error hook, to display the error to the user.
	 */
	public function set_error_hook() {
		/* translators: %1$s expands to Yoast SEO */
		$message = sprintf( __( 'Error creating %1$s export: ', 'wordpress-seo' ), 'Yoast SEO' ) . $this->error;

		printf(
			'<div class="notice notice-error"><p>%1$s</p></div>',
			$message
		);
	}

	/**
	 * Exports the current site's WP SEO settings.
	 */
	private function export_settings() {
		$this->export_header();

		foreach ( WPSEO_Options::get_option_names() as $opt_group ) {
			$this->write_opt_group( $opt_group );
		}
	}

	/**
	 * Writes the header of the export.
	 */
	private function export_header() {
		$header = sprintf(
			/* translators: %1$s expands to Yoast SEO, %2$s expands to Yoast.com */
			esc_html__( 'These are settings for the %1$s plugin by %2$s', 'wordpress-seo' ),
			'Yoast SEO',
			'Yoast.com'
		);
		$this->write_line( '; ' . $header );
	}

	/**
	 * Writes a line to the export.
	 *
	 * @param string  $line          Line string.
	 * @param boolean $newline_first Boolean flag whether to prepend with new line.
	 */
	private function write_line( $line, $newline_first = false ) {
		if ( $newline_first ) {
			$this->export .= PHP_EOL;
		}
		$this->export .= $line . PHP_EOL;
	}

	/**
	 * Writes an entire option group to the export.
	 *
	 * @param string $opt_group Option group name.
	 */
	private function write_opt_group( $opt_group ) {

		$this->write_line( '[' . $opt_group . ']', true );

		$options = get_option( $opt_group );

		if ( ! is_array( $options ) ) {
			return;
		}

		foreach ( $options as $key => $elem ) {
			if ( is_array( $elem ) ) {
				$count = count( $elem );
				for ( $i = 0; $i < $count; $i++ ) {
					$this->write_setting( $key . '[]', $elem[ $i ] );
				}
			}
			else {
				$this->write_setting( $key, $elem );
			}
		}
	}

	/**
	 * Writes a settings line to the export.
	 *
	 * @param string $key Key string.
	 * @param string $val Value string.
	 */
	private function write_setting( $key, $val ) {
		if ( is_string( $val ) ) {
			$val = '"' . $val . '"';
		}
		$this->write_line( $key . ' = ' . $val );
	}
}
PK     ”T]V ¹s©  ©    courses-overview.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class handles enqueuing the required JS files for the courses overview.
 */
class WPSEO_Courses_Overview implements WPSEO_WordPress_Integration {

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		global $pagenow;
		$current_page = filter_input( INPUT_GET, 'page' );

		if ( $pagenow === 'admin.php' && $current_page === 'wpseo_courses' ) {
			add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
		}
	}

	/**
	 * Enqueue the relevant script.
	 *
	 * @return void
	 */
	public function enqueue_scripts() {
		wp_enqueue_script( WPSEO_Admin_Asset_Manager::PREFIX . 'courses-overview' );

		$localizations = array(
			'isRtl'   => is_rtl(),
		);
		wp_localize_script(
			WPSEO_Admin_Asset_Manager::PREFIX . 'courses-overview',
			'wpseoCoursesOverviewL10n',
			$localizations
		);
	}
}
PK     ”T]cN=1      class-paper-presenter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Class WPSEO_presenter_paper.
 */
class WPSEO_Paper_Presenter {

	/**
	 * Title of the paper.
	 *
	 * @var string
	 */
	private $title;

	/**
	 * The view variables.
	 *
	 * @var array
	 */
	private $settings;

	/**
	 * The path to the view file.
	 *
	 * @var string
	 */
	private $view_file;

	/**
	 * WPSEO_presenter_paper constructor.
	 *
	 * @param string $title     The title of the paper.
	 * @param string $view_file The path to the view file.
	 * @param array  $settings  Optional. Settings for the paper.
	 */
	public function __construct( $title, $view_file, array $settings = array() ) {
		$defaults = array(
			'paper_id'    => null,
			'collapsible' => false,
			'expanded'    => false,
			'help_text'   => '',
			'title_after' => '',
			'view_data'   => array(),
		);

		$this->settings  = wp_parse_args( $settings, $defaults );
		$this->title     = $title;
		$this->view_file = $view_file;
	}

	/**
	 * Renders the collapsible paper and returns it as a string.
	 *
	 * @return string The rendered paper.
	 */
	public function get_output() {
		extract( $this->get_view_variables(), EXTR_SKIP );

		ob_start();
		require WPSEO_PATH . 'admin/views/paper-collapsible.php';
		$rendered_output = ob_get_clean();

		return $rendered_output;
	}

	/**
	 * Retrieves the view variables.
	 *
	 * @return array The view variables.
	 */
	private function get_view_variables() {
		if ( $this->settings['help_text'] instanceof WPSEO_Admin_Help_Panel === false ) {
			$this->settings['help_text'] = new WPSEO_Admin_Help_Panel( '', '', '' );
		}

		$view_variables = array(
			'collapsible'        => $this->settings['collapsible'],
			'collapsible_config' => $this->collapsible_config(),
			'title_after'        => $this->settings['title_after'],
			'help_text'          => $this->settings['help_text'],
			'view_file'          => $this->view_file,
			'title'              => $this->title,
			'paper_id'           => $this->settings['paper_id'],
			'yform'              => Yoast_Form::get_instance(),
		);

		return array_merge( $this->settings['view_data'], $view_variables );
	}

	/**
	 * Retrieves the collapsible config based on the settings.
	 *
	 * @return array The config.
	 */
	protected function collapsible_config() {
		if ( empty( $this->settings['collapsible'] ) ) {
			return array(
				'toggle_icon' => '',
				'class'       => '',
				'expanded'    => '',
			);
		}

		if ( ! empty( $this->settings['expanded'] ) ) {
			return array(
				'toggle_icon' => 'dashicons-arrow-up-alt2',
				'class'       => 'toggleable-container',
				'expanded'    => 'true',
			);
		}

		return array(
			'toggle_icon' => 'dashicons-arrow-down-alt2',
			'class'       => 'toggleable-container toggleable-container-hidden',
			'expanded'    => 'false',
		);
	}
}
PK     ”T]“@ëc6  6    class-database-proxy.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents the proxy for communicating with the database.
 */
class WPSEO_Database_Proxy {

	/**
	 * @var string
	 */
	protected $table_name;

	/**
	 * @var bool
	 */
	protected $suppress_errors = true;

	/**
	 * @var bool
	 */
	protected $is_multisite_table = false;

	/**
	 * @var bool
	 */
	protected $last_suppressed_state;

	/**
	 * @var wpdb
	 */
	protected $database;

	/**
	 * Sets the class attributes and registers the table.
	 *
	 * @param wpdb   $database           The database object.
	 * @param string $table_name         The table name that is represented.
	 * @param bool   $suppress_errors    Should the errors be suppressed.
	 * @param bool   $is_multisite_table Should the table be global in multisite.
	 */
	public function __construct( $database, $table_name, $suppress_errors = true, $is_multisite_table = false ) {
		$this->table_name         = $table_name;
		$this->suppress_errors    = (bool) $suppress_errors;
		$this->is_multisite_table = (bool) $is_multisite_table;
		$this->database           = $database;

		// If the table prefix was provided, strip it as it's handled automatically.
		$table_prefix = $this->get_table_prefix();
		if ( ! empty( $table_prefix ) && strpos( $this->table_name, $table_prefix ) === 0 ) {
			$this->table_prefix = substr( $this->table_name, strlen( $table_prefix ) );
		}

		if ( ! $this->is_table_registered() ) {
			$this->register_table();
		}
	}

	/**
	 * Inserts data into the database.
	 *
	 * @param array $data   Data to insert.
	 * @param null  $format Formats for the data.
	 *
	 * @return false|int Total amount of inserted rows or false on error.
	 */
	public function insert( array $data, $format = null ) {
		$this->pre_execution();

		$result = $this->database->insert( $this->get_table_name(), $data, $format );

		$this->post_execution();

		return $result;
	}

	/**
	 * Updates data in the database.
	 *
	 * @param array $data         Data to update on the table.
	 * @param array $where        Where condition as key => value array.
	 * @param null  $format       Optional. data prepare format.
	 * @param null  $where_format Optional. Where prepare format.
	 *
	 * @return false|int False when the update request is invalid, int on number of rows changed.
	 */
	public function update( array $data, array $where, $format = null, $where_format = null ) {
		$this->pre_execution();

		$result = $this->database->update( $this->get_table_name(), $data, $where, $format, $where_format );

		$this->post_execution();

		return $result;
	}

	/**
	 * Upserts data in the database.
	 *
	 * Performs an insert into and if key is duplicate it will update the existing record.
	 *
	 * @param array $data         Data to update on the table.
	 * @param array $where        Unused. Where condition as key => value array.
	 * @param null  $format       Optional. Data prepare format.
	 * @param null  $where_format Deprecated. Where prepare format.
	 *
	 * @return false|int False when the upsert request is invalid, int on number of rows changed.
	 */
	public function upsert( array $data, array $where = null, $format = null, $where_format = null ) {
		if ( $where_format !== null ) {
			_deprecated_argument( __METHOD__, '7.7.0', 'The where_format argument is deprecated' );
		}

		$this->pre_execution();

		$update  = array();
		$keys    = array();
		$columns = array_keys( $data );
		foreach ( $columns as $column ) {
			$keys[]   = '`' . $column . '`';
			$update[] = sprintf( '`%1$s` = VALUES(`%1$s`)', $column );
		}

		$query = sprintf(
			'INSERT INTO `%1$s` (%2$s) VALUES ( %3$s ) ON DUPLICATE KEY UPDATE %4$s',
			$this->get_table_name(),
			implode( ', ', $keys ),
			implode( ', ', array_fill( 0, count( $data ), '%s' ) ),
			implode( ', ', $update )
		);

		$result = $this->database->query(
			$this->database->prepare(
				$query,
				array_values( $data )
			)
		);

		$this->post_execution();

		return $result;
	}

	/**
	 * Deletes a record from the database.
	 *
	 * @param array      $where  Where clauses for the query.
	 * @param null|array $format Formats for the data.
	 *
	 * @return false|int
	 */
	public function delete( array $where, $format = null ) {
		$this->pre_execution();

		$result = $this->database->delete( $this->get_table_name(), $where, $format );

		$this->post_execution();

		return $result;
	}

	/**
	 * Executes the given query and returns the results.
	 *
	 * @param string $query The query to execute.
	 *
	 * @return array|null|object The resultset
	 */
	public function get_results( $query ) {
		$this->pre_execution();

		$results = $this->database->get_results( $query );

		$this->post_execution();

		return $results;
	}

	/**
	 * Creates a table to the database.
	 *
	 * @param array $columns The columns to create.
	 * @param array $indexes The indexes to use.
	 *
	 * @return bool True when creation is successful.
	 */
	public function create_table( array $columns, array $indexes = array() ) {
		$create_table = sprintf(
			'CREATE TABLE IF NOT EXISTS %1$s ( %2$s ) %3$s',
			$this->get_table_name(),
			implode( ',', array_merge( $columns, $indexes ) ),
			$this->database->get_charset_collate()
		);

		$this->pre_execution();

		$is_created = (bool) $this->database->query( $create_table );

		$this->post_execution();

		return $is_created;
	}

	/**
	 * Checks if there is an error.
	 *
	 * @return bool Returns true when there is an error.
	 */
	public function has_error() {
		return ( $this->database->last_error !== '' );
	}

	/**
	 * Executed before a query will be ran.
	 */
	protected function pre_execution() {
		if ( $this->suppress_errors ) {
			$this->last_suppressed_state = $this->database->suppress_errors();
		}
	}

	/**
	 * Executed after a query has been ran.
	 */
	protected function post_execution() {
		if ( $this->suppress_errors ) {
			$this->database->suppress_errors( $this->last_suppressed_state );
		}
	}

	/**
	 * Returns the full table name.
	 *
	 * @return string Full table name including prefix.
	 */
	public function get_table_name() {
		return $this->get_table_prefix() . $this->table_name;
	}

	/**
	 * Returns the prefix to use for the table.
	 *
	 * @return string The table prefix depending on the database context.
	 */
	protected function get_table_prefix() {
		if ( $this->is_multisite_table ) {
			return $this->database->base_prefix;
		}

		return $this->database->get_blog_prefix();
	}

	/**
	 * Registers the table with WordPress.
	 *
	 * @return void
	 */
	protected function register_table() {
		$table_name      = $this->table_name;
		$full_table_name = $this->get_table_name();

		$this->database->$table_name = $full_table_name;

		if ( $this->is_multisite_table ) {
			$this->database->ms_global_tables[] = $table_name;
			return;
		}

		$this->database->tables[] = $table_name;
	}

	/**
	 * Checks if the table has been registered with WordPress.
	 *
	 * @return bool True if the table is registered, false otherwise.
	 */
	protected function is_table_registered() {
		if ( $this->is_multisite_table ) {
			return in_array( $this->table_name, $this->database->ms_global_tables, true );
		}

		return in_array( $this->table_name, $this->database->tables, true );
	}
}
PK     ”T]1L¾—;  ;    class-option-tabs.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Options\Tabs
 */

/**
 * Class WPSEO_Option_Tabs.
 */
class WPSEO_Option_Tabs {

	/**
	 * Tabs base.
	 *
	 * @var string
	 */
	private $base;

	/**
	 * The tabs in this group.
	 *
	 * @var array
	 */
	private $tabs = array();

	/**
	 * Name of the active tab.
	 *
	 * @var string
	 */
	private $active_tab = '';

	/**
	 * WPSEO_Option_Tabs constructor.
	 *
	 * @codeCoverageIgnore
	 *
	 * @param string $base       Base of the tabs.
	 * @param string $active_tab Currently active tab.
	 */
	public function __construct( $base, $active_tab = '' ) {
		$this->base = sanitize_title( $base );

		$tab              = filter_input( INPUT_GET, 'tab' );
		$this->active_tab = empty( $tab ) ? $active_tab : $tab;
	}

	/**
	 * Get the base.
	 *
	 * @return string
	 */
	public function get_base() {
		return $this->base;
	}

	/**
	 * Add a tab.
	 *
	 * @param WPSEO_Option_Tab $tab Tab to add.
	 *
	 * @return $this
	 */
	public function add_tab( WPSEO_Option_Tab $tab ) {
		$this->tabs[] = $tab;

		return $this;
	}

	/**
	 * Get active tab.
	 *
	 * @return null|WPSEO_Option_Tab Get the active tab.
	 */
	public function get_active_tab() {
		if ( empty( $this->active_tab ) ) {
			return null;
		}

		$active_tabs = array_filter( $this->tabs, array( $this, 'is_active_tab' ) );
		if ( ! empty( $active_tabs ) ) {
			$active_tabs = array_values( $active_tabs );
			if ( count( $active_tabs ) === 1 ) {
				return $active_tabs[0];
			}
		}

		return null;
	}

	/**
	 * Is the tab the active tab.
	 *
	 * @param WPSEO_Option_Tab $tab Tab to check for active tab.
	 *
	 * @return bool
	 */
	public function is_active_tab( WPSEO_Option_Tab $tab ) {
		return ( $tab->get_name() === $this->active_tab );
	}

	/**
	 * Get all tabs.
	 *
	 * @return WPSEO_Option_Tab[]
	 */
	public function get_tabs() {
		return $this->tabs;
	}

	/**
	 * Display the tabs.
	 *
	 * @param Yoast_Form $yform Yoast Form needed in the views.
	 */
	public function display( Yoast_Form $yform ) {
		$formatter = new WPSEO_Option_Tabs_Formatter();
		$formatter->run( $this, $yform );
	}
}
PK     ”T] I/ÐÜ  Ü    menu/class-menu.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Menu
 */

/**
 * Registers the regular admin menu and network admin menu implementations.
 */
class WPSEO_Menu implements WPSEO_WordPress_Integration {

	/**
	 * The page identifier used in WordPress to register the admin page.
	 *
	 * !DO NOT CHANGE THIS!
	 *
	 * @var string
	 */
	const PAGE_IDENTIFIER = 'wpseo_dashboard';

	/**
	 * List of classes that add admin functionality.
	 *
	 * @var array
	 */
	protected $admin_features;

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		$admin_menu = new WPSEO_Admin_Menu( $this );
		$admin_menu->register_hooks();

		if ( WPSEO_Utils::is_plugin_network_active() ) {
			$network_admin_menu = new WPSEO_Network_Admin_Menu( $this );
			$network_admin_menu->register_hooks();
		}

		$capability_normalizer = new WPSEO_Submenu_Capability_Normalize();
		$capability_normalizer->register_hooks();
	}

	/**
	 * Returns the main menu page identifier.
	 *
	 * @return string Page identifier to use.
	 */
	public function get_page_identifier() {
		return self::PAGE_IDENTIFIER;
	}

	/**
	 * Loads the requested admin settings page.
	 *
	 * @return void
	 */
	public function load_page() {
		$page = filter_input( INPUT_GET, 'page' );
		$this->show_page( $page );
	}

	/**
	 * Shows an admin settings page.
	 *
	 * @param string $page Page to display.
	 *
	 * @return void
	 */
	protected function show_page( $page ) {
		switch ( $page ) {
			case 'wpseo_tools':
				require_once WPSEO_PATH . 'admin/pages/tools.php';
				break;

			case 'wpseo_titles':
				require_once WPSEO_PATH . 'admin/pages/metas.php';
				break;

			case 'wpseo_social':
				require_once WPSEO_PATH . 'admin/pages/social.php';
				break;

			case 'wpseo_licenses':
				require_once WPSEO_PATH . 'admin/pages/licenses.php';
				break;

			case 'wpseo_courses':
				require_once WPSEO_PATH . 'admin/pages/courses.php';
				break;

			case 'wpseo_files':
				require_once WPSEO_PATH . 'admin/views/tool-file-editor.php';
				break;

			case 'wpseo_configurator':
				require_once WPSEO_PATH . 'admin/config-ui/class-configuration-page.php';
				break;

			default:
				require_once WPSEO_PATH . 'admin/pages/dashboard.php';
				break;
		}
	}
}
PK     ”T]¬’`ý  ý  +  menu/class-submenu-capability-normalize.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Menu
 */

/**
 * Normalize submenu capabilities to `wpseo_manage_options`.
 */
class WPSEO_Submenu_Capability_Normalize implements WPSEO_WordPress_Integration {

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_filter( 'wpseo_submenu_pages', array( $this, 'normalize_submenus_capability' ) );
	}

	/**
	 * Normalizes any `manage_options` to `wpseo_manage_options`.
	 *
	 * This is needed as the module plugins are not updated with the new capabilities directly,
	 * but they should not be shown as main menu items.
	 *
	 * @param array $submenu_pages List of subpages to convert.
	 *
	 * @return array Converted subpages.
	 */
	public function normalize_submenus_capability( $submenu_pages ) {
		foreach ( $submenu_pages as $index => $submenu_page ) {
			if ( $submenu_page[3] === 'manage_options' ) {
				$submenu_pages[ $index ][3] = 'wpseo_manage_options';
			}
		}

		return $submenu_pages;
	}
}
PK     ”T]ÍöƒÇ  Ç    menu/class-base-menu.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Menu
 */

/**
 * Admin menu base class.
 */
abstract class WPSEO_Base_Menu implements WPSEO_WordPress_Integration {

	/**
	 * A menu.
	 *
	 * @var WPSEO_Menu
	 */
	protected $menu;

	/**
	 * Constructs the Admin Menu.
	 *
	 * @param WPSEO_Menu $menu Menu to use.
	 */
	public function __construct( WPSEO_Menu $menu ) {
		$this->menu = $menu;
	}

	/**
	 * Returns the list of registered submenu pages.
	 *
	 * @return array List of registered submenu pages.
	 */
	abstract public function get_submenu_pages();

	/**
	 * Creates a submenu formatted array.
	 *
	 * @param string     $page_title Page title to use.
	 * @param string     $page_slug  Page slug to use.
	 * @param callable   $callback   Optional. Callback which handles the page request.
	 * @param callable[] $hook       Optional. Hook to trigger when the page is registered.
	 *
	 * @return array Formatted submenu.
	 */
	protected function get_submenu_page( $page_title, $page_slug, $callback = null, $hook = null ) {
		if ( $callback === null ) {
			$callback = $this->get_admin_page_callback();
		}

		return array(
			$this->get_page_identifier(),
			'',
			$page_title,
			$this->get_manage_capability(),
			$page_slug,
			$callback,
			$hook,
		);
	}

	/**
	 * Registers submenu pages as menu pages.
	 *
	 * This method should only be used if the user does not have the required capabilities
	 * to access the parent menu page.
	 *
	 * @param array $submenu_pages List of submenu pages to register.
	 *
	 * @return void
	 */
	protected function register_menu_pages( $submenu_pages ) {
		if ( ! is_array( $submenu_pages ) || empty( $submenu_pages ) ) {
			return;
		}

		// Loop through submenu pages and add them.
		array_walk( $submenu_pages, array( $this, 'register_menu_page' ) );
	}

	/**
	 * Registers submenu pages.
	 *
	 * @param array $submenu_pages List of submenu pages to register.
	 *
	 * @return void
	 */
	protected function register_submenu_pages( $submenu_pages ) {
		if ( ! is_array( $submenu_pages ) || empty( $submenu_pages ) ) {
			return;
		}

		// Loop through submenu pages and add them.
		array_walk( $submenu_pages, array( $this, 'register_submenu_page' ) );

		// Set the first submenu title to the title of the first submenu page.
		global $submenu;
		if ( isset( $submenu[ $this->get_page_identifier() ] ) && $this->check_manage_capability() ) {
			$submenu[ $this->get_page_identifier() ][0][0] = $submenu_pages[0][2];
		}
	}

	/**
	 * Registers a submenu page as a menu page.
	 *
	 * This method should only be used if the user does not have the required capabilities
	 * to access the parent menu page.
	 *
	 * @param array $submenu_page {
	 *     Submenu page definition.
	 *
	 *     @type string   $0 Parent menu page slug.
	 *     @type string   $1 Page title, currently unused.
	 *     @type string   $2 Title to display in the menu.
	 *     @type string   $3 Required capability to access the page.
	 *     @type string   $4 Page slug.
	 *     @type callable $5 Callback to run when the page is rendered.
	 *     @type array    $6 Optional. List of callbacks to run when the page is loaded.
	 * }
	 *
	 * @return void
	 */
	protected function register_menu_page( $submenu_page ) {

		// If the submenu page requires the general manage capability, it must be added as an actual submenu page.
		if ( $submenu_page[3] === $this->get_manage_capability() ) {
			return;
		}

		$page_title = 'Yoast SEO: ' . $submenu_page[2];

		// Register submenu page as menu page.
		$hook_suffix = add_menu_page(
			$page_title,
			$submenu_page[2],
			$submenu_page[3],
			$submenu_page[4],
			$submenu_page[5],
			WPSEO_Utils::get_icon_svg(),
			'99.31337'
		);

		// If necessary, add hooks for the submenu page.
		if ( isset( $submenu_page[6] ) && ( is_array( $submenu_page[6] ) ) ) {
			$this->add_page_hooks( $hook_suffix, $submenu_page[6] );
		}
	}

	/**
	 * Registers a submenu page.
	 *
	 * This method will override the capability of the page to automatically use the
	 * general manage capability. Use the `register_menu_page()` method if the submenu
	 * page should actually use a different capability.
	 *
	 * @param array $submenu_page {
	 *     Submenu page definition.
	 *
	 *     @type string   $0 Parent menu page slug.
	 *     @type string   $1 Page title, currently unused.
	 *     @type string   $2 Title to display in the menu.
	 *     @type string   $3 Required capability to access the page.
	 *     @type string   $4 Page slug.
	 *     @type callable $5 Callback to run when the page is rendered.
	 *     @type array    $6 Optional. List of callbacks to run when the page is loaded.
	 * }
	 *
	 * @return void
	 */
	protected function register_submenu_page( $submenu_page ) {
		$page_title = $submenu_page[2];

		// We cannot use $submenu_page[1] because add-ons define that, so hard-code this value.
		if ( $submenu_page[4] === 'wpseo_licenses' ) {
			$page_title = $this->get_license_page_title();
		}

		$page_title .= ' - Yoast SEO';

		// Force the general manage capability to be used.
		$submenu_page[3] = $this->get_manage_capability();

		// Register submenu page.
		$hook_suffix = add_submenu_page(
			$submenu_page[0],
			$page_title,
			$submenu_page[2],
			$submenu_page[3],
			$submenu_page[4],
			$submenu_page[5]
		);

		// If necessary, add hooks for the submenu page.
		if ( isset( $submenu_page[6] ) && ( is_array( $submenu_page[6] ) ) ) {
			$this->add_page_hooks( $hook_suffix, $submenu_page[6] );
		}
	}

	/**
	 * Adds hook callbacks for a given admin page hook suffix.
	 *
	 * @param string $hook_suffix Admin page hook suffix, as returned by `add_menu_page()`
	 *                            or `add_submenu_page()`.
	 * @param array  $callbacks   Callbacks to add.
	 *
	 * @return void
	 */
	protected function add_page_hooks( $hook_suffix, array $callbacks ) {
		foreach ( $callbacks as $callback ) {
			add_action( 'load-' . $hook_suffix, $callback );
		}
	}

	/**
	 * Gets the main admin page identifier.
	 *
	 * @return string Admin page identifier.
	 */
	protected function get_page_identifier() {
		return $this->menu->get_page_identifier();
	}

	/**
	 * Checks whether the current user has capabilities to manage all options.
	 *
	 * @return bool True if capabilities are sufficient, false otherwise.
	 */
	protected function check_manage_capability() {
		return WPSEO_Capability_Utils::current_user_can( $this->get_manage_capability() );
	}

	/**
	 * Returns the capability that is required to manage all options.
	 *
	 * @return string Capability to check against.
	 */
	abstract protected function get_manage_capability();

	/**
	 * Returns the page handler callback.
	 *
	 * @return array Callback page handler.
	 */
	protected function get_admin_page_callback() {
		return array( $this->menu, 'load_page' );
	}

	/**
	 * Returns the page title to use for the licenses page.
	 *
	 * @return string The title for the license page.
	 */
	protected function get_license_page_title() {
		static $title = null;

		if ( $title === null ) {
			$title = __( 'Premium', 'wordpress-seo' );
		}

		return $title;
	}
}
PK     ”T]Ûq÷¾  ¾    menu/class-admin-menu.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Menu
 */

/**
 * Registers the admin menu on the left of the admin area.
 */
class WPSEO_Admin_Menu extends WPSEO_Base_Menu {

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		// Needs the lower than default priority so other plugins can hook underneath it without issue.
		add_action( 'admin_menu', array( $this, 'register_settings_page' ), 5 );
	}

	/**
	 * Registers the menu item submenus.
	 */
	public function register_settings_page() {
		$can_manage_options = $this->check_manage_capability();

		if ( $can_manage_options ) {
			/*
			 * The current user has the capability to control anything.
			 * This means that all submenus and dashboard can be shown.
			 */
			global $admin_page_hooks;

			add_menu_page(
				'Yoast SEO: ' . __( 'Dashboard', 'wordpress-seo' ),
				__( 'SEO', 'wordpress-seo' ) . ' ' . $this->get_notification_counter(),
				$this->get_manage_capability(),
				$this->get_page_identifier(),
				$this->get_admin_page_callback(),
				WPSEO_Utils::get_icon_svg(),
				'99.31337'
			);

			// Wipe notification bits from hooks.
			$admin_page_hooks[ $this->get_page_identifier() ] = 'seo';
		}

		// Get all submenu pages.
		$submenu_pages = $this->get_submenu_pages();

		// Add submenu items to the main menu if possible.
		if ( $can_manage_options ) {
			$this->register_submenu_pages( $submenu_pages );
		}

		/*
		 * If the user does not have the general manage options capability,
		 * we need to make sure the desired sub-item can be reached.
		 */
		if ( ! $can_manage_options ) {
			$this->register_menu_pages( $submenu_pages );
		}
	}

	/**
	 * Returns the list of registered submenu pages.
	 *
	 * @return array List of registered submenu pages.
	 */
	public function get_submenu_pages() {
		global $wpseo_admin;

		$search_console_callback       = null;
		$search_console_hook_callbacks = null;

		// Account for when the available submenu pages are requested from outside the admin.
		if ( isset( $wpseo_admin ) ) {
			$admin_features = $wpseo_admin->get_admin_features();

			$search_console_callback       = array( $admin_features['google_search_console'], 'display' );
			$search_console_hook_callbacks = array( array( $admin_features['google_search_console'], 'set_help' ) );
		}

		// Submenu pages.
		$submenu_pages = array(
			$this->get_submenu_page( __( 'General', 'wordpress-seo' ), $this->get_page_identifier() ),
			$this->get_submenu_page( __( 'Search Appearance', 'wordpress-seo' ), 'wpseo_titles' ),
			$this->get_submenu_page(
				__( 'Search Console', 'wordpress-seo' ),
				'wpseo_search_console',
				$search_console_callback,
				$search_console_hook_callbacks
			),
			$this->get_submenu_page( __( 'Social', 'wordpress-seo' ), 'wpseo_social' ),
			$this->get_submenu_page( __( 'Tools', 'wordpress-seo' ), 'wpseo_tools' ),
			$this->get_submenu_page( $this->get_license_page_title(), 'wpseo_licenses' ),
			$this->get_submenu_page( __( 'Courses', 'wordpress-seo' ), 'wpseo_courses' ),
		);

		/**
		 * Filter: 'wpseo_submenu_pages' - Collects all submenus that need to be shown.
		 *
		 * @api array $submenu_pages List with all submenu pages.
		 */
		return (array) apply_filters( 'wpseo_submenu_pages', $submenu_pages );
	}

	/**
	 * Returns the notification count in HTML format.
	 *
	 * @return string The notification count in HTML format.
	 */
	protected function get_notification_counter() {
		$notification_center = Yoast_Notification_Center::get();
		$notification_count  = $notification_center->get_notification_count();

		// Add main page.
		/* translators: %s: number of notifications */
		$notifications = sprintf( _n( '%s notification', '%s notifications', $notification_count, 'wordpress-seo' ), number_format_i18n( $notification_count ) );

		$counter = sprintf( '<span class="update-plugins count-%1$d"><span class="plugin-count" aria-hidden="true">%1$d</span><span class="screen-reader-text">%2$s</span></span>', $notification_count, $notifications );

		return $counter;
	}

	/**
	 * Returns the capability that is required to manage all options.
	 *
	 * @return string Capability to check against.
	 */
	protected function get_manage_capability() {
		return 'wpseo_manage_options';
	}
}
PK     ”T]Þ„Ú`*	  *	  !  menu/class-network-admin-menu.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Menu
 */

/**
 * Network Admin Menu handler.
 */
class WPSEO_Network_Admin_Menu extends WPSEO_Base_Menu {

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		// Needs the lower than default priority so other plugins can hook underneath it without issue.
		add_action( 'network_admin_menu', array( $this, 'register_settings_page' ), 5 );
	}

	/**
	 * Register the settings page for the Network settings.
	 *
	 * @return void
	 */
	public function register_settings_page() {
		if ( ! $this->check_manage_capability() ) {
			return;
		}

		add_menu_page(
			__( 'Network Settings', 'wordpress-seo' ) . ' - Yoast SEO',
			__( 'SEO', 'wordpress-seo' ),
			$this->get_manage_capability(),
			$this->get_page_identifier(),
			array( $this, 'network_config_page' ),
			WPSEO_Utils::get_icon_svg()
		);

		$submenu_pages = $this->get_submenu_pages();
		$this->register_submenu_pages( $submenu_pages );
	}

	/**
	 * Returns the list of registered submenu pages.
	 *
	 * @return array List of registered submenu pages.
	 */
	public function get_submenu_pages() {

		// Submenu pages.
		$submenu_pages = array(
			$this->get_submenu_page(
				__( 'General', 'wordpress-seo' ),
				$this->get_page_identifier(),
				array( $this, 'network_config_page' )
			),
		);

		if ( WPSEO_Utils::allow_system_file_edit() === true ) {
			$submenu_pages[] = $this->get_submenu_page( __( 'Edit Files', 'wordpress-seo' ), 'wpseo_files' );
		}

		$submenu_pages[] = $this->get_submenu_page( __( 'Extensions', 'wordpress-seo' ), 'wpseo_licenses' );

		return $submenu_pages;
	}

	/**
	 * Loads the form for the network configuration page.
	 *
	 * @return void
	 */
	public function network_config_page() {
		require_once WPSEO_PATH . 'admin/pages/network.php';
	}

	/**
	 * Checks whether the current user has capabilities to manage all options.
	 *
	 * @return bool True if capabilities are sufficient, false otherwise.
	 */
	protected function check_manage_capability() {
		return current_user_can( $this->get_manage_capability() );
	}

	/**
	 * Returns the capability that is required to manage all options.
	 *
	 * @return string Capability to check against.
	 */
	protected function get_manage_capability() {
		return 'wpseo_manage_network_options';
	}
}
PK     ”T]™esKŽ  Ž     menu/class-replacevar-editor.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Menu
 */

/**
 * Renders a replacement variable editor.
 */
class WPSEO_Replacevar_Editor {

	/**
	 * Yoast Forms instance.
	 *
	 * @var Yoast_Form
	 */
	private $yform;

	/**
	 * The arguments required for the div to render.
	 *
	 * @var array {
	 *      @type string $title                 The title field id.
	 *      @type string $description           The description field id.
	 *      @type string $page_type_recommended The page type for the context of the recommended replace vars.
	 *      @type string $page_type_specific    The page type for the context of the editor specific replace vars.
	 *      @type bool   $paper_style           Optional. Whether the editor has paper style.
	 * }
	 */
	private $arguments;

	/**
	 * Constructs the object.
	 *
	 * @param Yoast_Form $yform                 Yoast forms.
	 * @param array      $arguments {
	 *      The arguments that can be given.
	 *
	 *      @type string $title                 The title field id.
	 *      @type string $description           The description field id.
	 *      @type string $page_type_recommended The page type for the context of the recommended replace vars.
	 *      @type string $page_type_specific    The page type for the context of the editor specific replace vars.
	 *      @type bool   $paper_style           Optional. Whether the editor has paper style.
	 * }
	 */
	public function __construct( Yoast_Form $yform, $arguments ) {
		$arguments = wp_parse_args(
			$arguments,
			array(
				'paper_style' => true,
			)
		);

		$this->validate_arguments( $arguments );

		$this->yform     = $yform;
		$this->arguments = array(
			'title'                 => (string) $arguments['title'],
			'description'           => (string) $arguments['description'],
			'page_type_recommended' => (string) $arguments['page_type_recommended'],
			'page_type_specific'    => (string) $arguments['page_type_specific'],
			'paper_style'           => (bool) $arguments['paper_style'],
		);
	}

	/**
	 * Renders a div for the react application to mount to, and hidden inputs where
	 * the app should store it's value so they will be properly saved when the form
	 * is submitted.
	 *
	 * @return void
	 */
	public function render() {
		$this->yform->hidden( $this->arguments['title'], $this->arguments['title'] );
		$this->yform->hidden( $this->arguments['description'], $this->arguments['description'] );

		printf(
			'<div
				data-react-replacevar-editor
				data-react-replacevar-title-field-id="%1$s"
				data-react-replacevar-metadesc-field-id="%2$s"
				data-react-replacevar-page-type-recommended="%3$s"
				data-react-replacevar-page-type-specific="%4$s"
				data-react-replacevar-paper-style="%5$s"></div>',
			esc_attr( $this->arguments['title'] ),
			esc_attr( $this->arguments['description'] ),
			esc_attr( $this->arguments['page_type_recommended'] ),
			esc_attr( $this->arguments['page_type_specific'] ),
			esc_attr( $this->arguments['paper_style'] )
		);
	}

	/**
	 * @param array $arguments The arguments to validate.
	 *
	 * @throws InvalidArgumentException Thrown when not all required arguments are present.
	 */
	protected function validate_arguments( array $arguments ) {
		$required_arguments = array(
			'title',
			'description',
			'page_type_recommended',
			'page_type_specific',
			'paper_style',
		);

		foreach ( $required_arguments as $field_name ) {
			if ( ! array_key_exists( $field_name, $arguments ) ) {
				throw new InvalidArgumentException(
					sprintf(
						/* translators: %1$s expands to the missing field name.  */
						__( 'Not all required fields are given. Missing field %1$s', 'wordpress-seo' ),
						$field_name
					)
				);
			}
		}
	}
}
PK     ”T] 0…w  w    menu/class-replacevar-field.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Menu
 */

/**
 * Renders a single replacement variable field.
 */
class WPSEO_Replacevar_Field {

	/**
	 * Forms instance.
	 *
	 * @var Yoast_Form Yoast
	 */
	private $yform;

	/**
	 * The id for the hidden field.
	 *
	 * @var string
	 */
	private $field_id;

	/**
	 * The label for the field.
	 *
	 * @var string
	 */
	private $label;

	/**
	 * The page type for the context of the recommended replace vars.
	 *
	 * @var string
	 */
	private $page_type_recommended;

	/**
	 * The page type for the context of the editor specific replace vars.
	 *
	 * @var string
	 */
	private $page_type_specific;

	/**
	 * Constructs the object.
	 *
	 * @param Yoast_Form $yform                 Yoast forms.
	 * @param string     $field_id              The field id.
	 * @param string     $label                 The field label.
	 * @param string     $page_type_recommended The page type for the context of the recommended replace vars.
	 * @param string     $page_type_specific    The page type for the context of the editor specific replace vars.
	 */
	public function __construct( Yoast_Form $yform, $field_id, $label, $page_type_recommended, $page_type_specific ) {
		$this->yform                 = $yform;
		$this->field_id              = $field_id;
		$this->label                 = $label;
		$this->page_type_recommended = $page_type_recommended;
		$this->page_type_specific    = $page_type_specific;
	}

	/**
	 * Renders a div for the react application to mount to, and hidden inputs where
	 * the app should store it's value so they will be properly saved when the form
	 * is submitted.
	 *
	 * @return void
	 */
	public function render() {
		$this->yform->hidden( $this->field_id, $this->field_id );

		printf(
			'<div
				data-react-replacevar-field
				data-react-replacevar-field-id="%1$s"
				data-react-replacevar-field-label="%2$s"
				data-react-replacevar-page-type-recommended="%3$s"
				data-react-replacevar-page-type-specific="%4$s"></div>',
			esc_attr( $this->field_id ),
			esc_attr( $this->label ),
			esc_attr( $this->page_type_recommended ),
			esc_attr( $this->page_type_specific )
		);
	}
}
PK     ”T]�SÊ‰í   í     menu/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]³A+Þi%  i%    class-yoast-network-admin.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Internals
 */

/**
 * Multisite utility class for network admin functionality.
 */
class Yoast_Network_Admin implements WPSEO_WordPress_Integration, WPSEO_WordPress_AJAX_Integration {

	/**
	 * Action identifier for updating plugin network options.
	 *
	 * @var string
	 */
	const UPDATE_OPTIONS_ACTION = 'yoast_handle_network_options';

	/**
	 * Action identifier for restoring a site.
	 *
	 * @var string
	 */
	const RESTORE_SITE_ACTION = 'yoast_restore_site';

	/**
	 * Gets the available sites as choices, e.g. for a dropdown.
	 *
	 * @param bool $include_empty Optional. Whether to include an initial placeholder choice.
	 *                            Default false.
	 * @param bool $show_title    Optional. Whether to show the title for each site. This requires
	 *                            switching through the sites, so has performance implications for
	 *                            sites that do not use a persistent cache.
	 *                            Default false.
	 *
	 * @return array Choices as $site_id => $site_label pairs.
	 */
	public function get_site_choices( $include_empty = false, $show_title = false ) {
		$choices = array();

		if ( $include_empty ) {
			$choices['-'] = __( 'None', 'wordpress-seo' );
		}

		$criteria = array(
			'deleted'    => 0,
			'network_id' => get_current_network_id(),
		);
		$sites    = get_sites( $criteria );

		foreach ( $sites as $site ) {
			$site_name = $site->domain . $site->path;
			if ( $show_title ) {
				$site_name = $site->blogname . ' (' . $site->domain . $site->path . ')';
			}
			$choices[ $site->blog_id ] = $site->blog_id . ': ' . $site_name;

			$site_states = $this->get_site_states( $site );
			if ( ! empty( $site_states ) ) {
				$choices[ $site->blog_id ] .= ' [' . implode( ', ', $site_states ) . ']';
			}
		}

		return $choices;
	}

	/**
	 * Gets the states of a site.
	 *
	 * @param WP_Site $site Site object.
	 *
	 * @return array Array of $state_slug => $state_label pairs.
	 */
	public function get_site_states( $site ) {
		$available_states = array(
			'public'   => __( 'public', 'wordpress-seo' ),
			'archived' => __( 'archived', 'wordpress-seo' ),
			'mature'   => __( 'mature', 'wordpress-seo' ),
			'spam'     => __( 'spam', 'wordpress-seo' ),
			'deleted'  => __( 'deleted', 'wordpress-seo' ),
		);

		$site_states = array();
		foreach ( $available_states as $state_slug => $state_label ) {
			if ( $site->$state_slug === '1' ) {
				$site_states[ $state_slug ] = $state_label;
			}
		}

		return $site_states;
	}

	/**
	 * Handles a request to update plugin network options.
	 *
	 * This method works similar to how option updates are handled in `wp-admin/options.php` and
	 * `wp-admin/network/settings.php`.
	 *
	 * @return void
	 */
	public function handle_update_options_request() {
		$option_group = filter_input( INPUT_POST, 'network_option_group', FILTER_SANITIZE_STRING );

		$this->verify_request( "{$option_group}-network-options" );

		$whitelist_options = Yoast_Network_Settings_API::get()->get_whitelist_options( $option_group );

		if ( empty( $whitelist_options ) ) {
			add_settings_error( $option_group, 'settings_updated', __( 'You are not allowed to modify unregistered network settings.', 'wordpress-seo' ), 'error' );

			$this->terminate_request();
			return;
		}

		foreach ( $whitelist_options as $option_name ) {
			$value = null;
			if ( isset( $_POST[ $option_name ] ) ) { // WPCS: CSRF ok.
				// Adding sanitize_text_field around this will break the saving of settings because it expects a string: https://github.com/Yoast/wordpress-seo/issues/12440.
				$value = wp_unslash( $_POST[ $option_name ] ); // WPCS: CSRF ok.
			}

			WPSEO_Options::update_site_option( $option_name, $value );
		}

		$settings_errors = get_settings_errors();
		if ( empty( $settings_errors ) ) {
			add_settings_error( $option_group, 'settings_updated', __( 'Settings Updated.', 'wordpress-seo' ), 'updated' );
		}

		$this->terminate_request();
	}

	/**
	 * Handles a request to restore a site's default settings.
	 *
	 * @return void
	 */
	public function handle_restore_site_request() {
		$this->verify_request( 'wpseo-network-restore', 'restore_site_nonce' );

		$option_group = 'wpseo_ms';

		$site_id = ! empty( $_POST[ $option_group ]['site_id'] ) ? (int) $_POST[ $option_group ]['site_id'] : 0; // WPCS: CSRF ok.
		if ( ! $site_id ) {
			add_settings_error( $option_group, 'settings_updated', __( 'No site has been selected to restore.', 'wordpress-seo' ), 'error' );

			$this->terminate_request();
			return;
		}

		$site = get_site( $site_id );
		if ( ! $site ) {
			/* translators: %s expands to the ID of a site within a multisite network. */
			add_settings_error( $option_group, 'settings_updated', sprintf( __( 'Site with ID %d not found.', 'wordpress-seo' ), $site_id ), 'error' );
		}
		else {
			WPSEO_Options::reset_ms_blog( $site_id );

			/* translators: %s expands to the name of a site within a multisite network. */
			add_settings_error( $option_group, 'settings_updated', sprintf( __( '%s restored to default SEO settings.', 'wordpress-seo' ), esc_html( $site->blogname ) ), 'updated' );
		}

		$this->terminate_request();
	}

	/**
	 * Outputs nonce, action and option group fields for a network settings page in the plugin.
	 *
	 * @param string $option_group Option group name for the current page.
	 *
	 * @return void
	 */
	public function settings_fields( $option_group ) {
		?>
		<input type="hidden" name="network_option_group" value="<?php echo esc_attr( $option_group ); ?>" />
		<input type="hidden" name="action" value="<?php echo esc_attr( self::UPDATE_OPTIONS_ACTION ); ?>" />
		<?php
		wp_nonce_field( "$option_group-network-options" );
	}

	/**
	 * Enqueues network admin assets.
	 *
	 * @return void
	 */
	public function enqueue_assets() {
		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_script( 'network-admin-script' );

		$translations = array(
			/* translators: %s: success message */
			'success_prefix' => __( 'Success: %s', 'wordpress-seo' ),
			/* translators: %s: error message */
			'error_prefix'   => __( 'Error: %s', 'wordpress-seo' ),
		);
		wp_localize_script(
			WPSEO_Admin_Asset_Manager::PREFIX . 'network-admin-script',
			'wpseoNetworkAdminGlobalL10n',
			$translations
		);
	}

	/**
	 * Hooks in the necessary actions and filters.
	 *
	 * @return void
	 */
	public function register_hooks() {

		if ( ! $this->meets_requirements() ) {
			return;
		}

		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );

		add_action( 'admin_action_' . self::UPDATE_OPTIONS_ACTION, array( $this, 'handle_update_options_request' ) );
		add_action( 'admin_action_' . self::RESTORE_SITE_ACTION, array( $this, 'handle_restore_site_request' ) );
	}

	/**
	 * Hooks in the necessary AJAX actions.
	 *
	 * @return void
	 */
	public function register_ajax_hooks() {
		add_action( 'wp_ajax_' . self::UPDATE_OPTIONS_ACTION, array( $this, 'handle_update_options_request' ) );
		add_action( 'wp_ajax_' . self::RESTORE_SITE_ACTION, array( $this, 'handle_restore_site_request' ) );
	}

	/**
	 * Checks whether the requirements to use this class are met.
	 *
	 * @return bool True if requirements are met, false otherwise.
	 */
	public function meets_requirements() {
		return is_multisite() && is_network_admin();
	}

	/**
	 * Verifies that the current request is valid.
	 *
	 * @param string $action    Nonce action.
	 * @param string $query_arg Optional. Nonce query argument. Default '_wpnonce'.
	 *
	 * @return void
	 */
	public function verify_request( $action, $query_arg = '_wpnonce' ) {
		$has_access = current_user_can( 'wpseo_manage_network_options' );

		if ( wp_doing_ajax() ) {
			check_ajax_referer( $action, $query_arg );

			if ( ! $has_access ) {
				wp_die( -1, 403 );
			}
			return;
		}

		check_admin_referer( $action, $query_arg );

		if ( ! $has_access ) {
			wp_die( esc_html__( 'You are not allowed to perform this action.', 'wordpress-seo' ) );
		}
	}

	/**
	 * Terminates the current request by either redirecting back or sending an AJAX response.
	 *
	 * @return void
	 */
	public function terminate_request() {
		if ( wp_doing_ajax() ) {
			$settings_errors = get_settings_errors();

			if ( ! empty( $settings_errors ) && $settings_errors[0]['type'] === 'updated' ) {
				wp_send_json_success( $settings_errors, 200 );
			}

			wp_send_json_error( $settings_errors, 400 );
		}

		$this->persist_settings_errors();
		$this->redirect_back( array( 'settings-updated' => 'true' ) );
	}

	/**
	 * Persists settings errors.
	 *
	 * Settings errors are stored in a transient for 30 seconds so that this transient
	 * can be retrieved on the next page load.
	 *
	 * @return void
	 */
	protected function persist_settings_errors() {
		/*
		 * A regular transient is used here, since it is automatically cleared right after the redirect.
		 * A network transient would be cleaner, but would require a lot of copied code from core for
		 * just a minor adjustment when displaying settings errors.
		 */
		set_transient( 'settings_errors', get_settings_errors(), 30 );
	}

	/**
	 * Redirects back to the referer URL, with optional query arguments.
	 *
	 * @param array $query_args Optional. Query arguments to add to the redirect URL. Default none.
	 *
	 * @return void
	 */
	protected function redirect_back( $query_args = array() ) {
		$sendback = wp_get_referer();

		if ( ! empty( $query_args ) ) {
			$sendback = add_query_arg( $query_args, $sendback );
		}

		wp_safe_redirect( $sendback );
		exit;
	}
}
PK     ”T]à–A¾  ¾  &  filters/class-abstract-post-filter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Filters
 */

/**
 * Class WPSEO_Abstract_Post_Filter.
 */
abstract class WPSEO_Abstract_Post_Filter implements WPSEO_WordPress_Integration {

	/**
	 * @var string
	 */
	const FILTER_QUERY_ARG = 'yoast_filter';

	/**
	 * Modify the query based on the FILTER_QUERY_ARG variable in $_GET.
	 *
	 * @param string $where Query variables.
	 *
	 * @return string The modified query.
	 */
	abstract public function filter_posts( $where );

	/**
	 * Returns the query value this filter uses.
	 *
	 * @return string The query value this filter uses.
	 */
	abstract public function get_query_val();

	/**
	 * Returns the total number of posts that match this filter.
	 *
	 * @return int The total number of posts that match this filter.
	 */
	abstract protected function get_post_total();

	/**
	 * Returns the label for this filter.
	 *
	 * @return string The label for this filter.
	 */
	abstract protected function get_label();

	/**
	 * Registers the hooks.
	 */
	public function register_hooks() {
		add_action( 'admin_init', array( $this, 'add_filter_links' ), 11 );

		add_filter( 'posts_where', array( $this, 'filter_posts' ) );

		if ( $this->is_filter_active() ) {
			add_action( 'restrict_manage_posts', array( $this, 'render_hidden_input' ) );
		}

		if ( $this->is_filter_active() && $this->get_explanation() !== null ) {
			add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_explanation_assets' ) );
		}
	}

	/**
	 * Adds the filter links to the view_edit screens to give the user a filter link.
	 *
	 * @return void
	 */
	public function add_filter_links() {
		foreach ( $this->get_post_types() as $post_type ) {
			add_filter( 'views_edit-' . $post_type, array( $this, 'add_filter_link' ) );
		}
	}

	/**
	 * Enqueues the necessary assets to display a filter explanation.
	 *
	 * @return void
	 */
	public function enqueue_explanation_assets() {
		$asset_manager = new WPSEO_Admin_Asset_Manager();
		$asset_manager->enqueue_script( 'filter-explanation' );
		$asset_manager->enqueue_style( 'filter-explanation' );
		wp_localize_script(
			WPSEO_Admin_Asset_Manager::PREFIX . 'filter-explanation',
			'yoastFilterExplanation',
			array( 'text' => $this->get_explanation() )
		);
	}

	/**
	 * Adds a filter link to the views.
	 *
	 * @param array $views Array with the views.
	 *
	 * @return array Array of views including the added view.
	 */
	public function add_filter_link( array $views ) {
		$views[ 'yoast_' . $this->get_query_val() ] = sprintf(
			'<a href="%1$s"%2$s>%3$s</a> (%4$s)',
			esc_url( $this->get_filter_url() ),
			( $this->is_filter_active() ) ? ' class="current" aria-current="page"' : '',
			$this->get_label(),
			$this->get_post_total()
		);

		return $views;
	}

	/**
	 * Returns a text explaining this filter. Null if no explanation is necessary.
	 *
	 * @return string|null The explanation or null.
	 */
	protected function get_explanation() {
		return null;
	}

	/**
	 * Renders a hidden input to preserve this filter's state when using sub-filters.
	 *
	 * @return void
	 */
	public function render_hidden_input() {
		echo '<input type="hidden" name="' . esc_attr( self::FILTER_QUERY_ARG ) . '" value="' . esc_attr( $this->get_query_val() ) . '">';
	}

	/**
	 * Returns an url to edit.php with post_type and this filter as the query arguments.
	 *
	 * @return string The url to activate this filter.
	 */
	protected function get_filter_url() {
		$query_args = array(
			self::FILTER_QUERY_ARG => $this->get_query_val(),
			'post_type'            => $this->get_current_post_type(),
		);

		return add_query_arg( $query_args, 'edit.php' );
	}

	/**
	 * Returns true when the filter is active.
	 *
	 * @return bool Whether or not the filter is active.
	 */
	protected function is_filter_active() {
		return ( $this->is_supported_post_type( $this->get_current_post_type() )
			&& filter_input( INPUT_GET, self::FILTER_QUERY_ARG ) === $this->get_query_val() );
	}

	/**
	 * Returns the current post type.
	 *
	 * @return string The current post type.
	 */
	protected function get_current_post_type() {
		$filter_options = array(
			'options' => array( 'default' => 'post' ),
		);

		return filter_input( INPUT_GET, 'post_type', FILTER_DEFAULT, $filter_options );
	}

	/**
	 * Returns the post types to which this filter should be added.
	 *
	 * @return array The post types to which this filter should be added.
	 */
	protected function get_post_types() {
		return WPSEO_Post_Type::get_accessible_post_types();
	}

	/**
	 * Checks if the post type is supported.
	 *
	 * @param string $post_type Post type to check against.
	 *
	 * @return bool True when it is supported.
	 */
	protected function is_supported_post_type( $post_type ) {
		return in_array( $post_type, $this->get_post_types(), true );
	}
}
PK     ”T]�SÊ‰í   í     filters/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]4-—ùÐ  Ð  $  filters/class-cornerstone-filter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Registers the filter for filtering posts by cornerstone content.
 */
class WPSEO_Cornerstone_Filter extends WPSEO_Abstract_Post_Filter {

	/**
	 * Name of the meta value.
	 *
	 * @var string
	 */
	const META_NAME = 'is_cornerstone';

	/**
	 * Registers the hooks.
	 *
	 * @return void
	 */
	public function register_hooks() {
		parent::register_hooks();

		add_filter( 'wpseo_cornerstone_post_types', array( 'WPSEO_Post_Type', 'filter_attachment_post_type' ) );
		add_filter( 'wpseo_cornerstone_post_types', array( $this, 'filter_metabox_disabled' ) );
	}

	/**
	 * Returns the query value this filter uses.
	 *
	 * @return string The query value this filter uses.
	 */
	public function get_query_val() {
		return 'cornerstone';
	}

	/**
	 * Modify the query based on the seo_filter variable in $_GET.
	 *
	 * @param string $where Query variables.
	 *
	 * @return string The modified query.
	 */
	public function filter_posts( $where ) {
		if ( $this->is_filter_active() ) {
			global $wpdb;

			$where .= sprintf(
				' AND ' . $wpdb->posts . '.ID IN( SELECT post_id FROM ' . $wpdb->postmeta . ' WHERE meta_key = "%s" AND meta_value = "1" ) ',
				WPSEO_Meta::$meta_prefix . self::META_NAME
			);
		}

		return $where;
	}

	/**
	 * Filters the post types that have the metabox disabled.
	 *
	 * @param array $post_types The post types to filter.
	 *
	 * @return array The filtered post types.
	 */
	public function filter_metabox_disabled( $post_types ) {
		$filtered_post_types = array();
		foreach ( $post_types as $post_type_key => $post_type ) {
			if ( ! WPSEO_Post_Type::has_metabox_enabled( $post_type_key ) ) {
				continue;
			}

			$filtered_post_types[ $post_type_key ] = $post_type;
		}

		return $filtered_post_types;
	}

	/**
	 * Returns the label for this filter.
	 *
	 * @return string The label for this filter.
	 */
	protected function get_label() {
		return __( 'Cornerstone content', 'wordpress-seo' );
	}

	/**
	 * Returns a text explaining this filter.
	 *
	 * @return string The explanation.
	 */
	protected function get_explanation() {
		$post_type_object = get_post_type_object( $this->get_current_post_type() );

		if ( $post_type_object === null ) {
			return null;
		}

		return sprintf(
			/* translators: %1$s expands to the posttype label, %2$s expands anchor to blog post about cornerstone content, %3$s expands to </a> */
			__( 'Mark the most important %1$s as \'cornerstone content\' to improve your site structure. %2$sLearn more about cornerstone content%3$s.', 'wordpress-seo' ),
			strtolower( $post_type_object->labels->name ),
			'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/1i9' ) . '" target="_blank">',
			'</a>'
		);
	}

	/**
	 * Returns the total amount of articles marked as cornerstone content.
	 *
	 * @return integer
	 */
	protected function get_post_total() {
		global $wpdb;

		return (int) $wpdb->get_var(
			$wpdb->prepare(
				'
				SELECT COUNT( 1 )
				FROM ' . $wpdb->postmeta . '
				WHERE post_id IN( SELECT ID FROM ' . $wpdb->posts . ' WHERE post_type = %s ) &&
				meta_value = "1" AND meta_key = %s
				',
				$this->get_current_post_type(),
				WPSEO_Meta::$meta_prefix . self::META_NAME
			)
		);
	}

	/**
	 * Returns the post types to which this filter should be added.
	 *
	 * @return array The post types to which this filter should be added.
	 */
	protected function get_post_types() {
		/**
		 * Filter: 'wpseo_cornerstone_post_types' - Filters post types to exclude the cornerstone feature for.
		 *
		 * @api array - The accessible post types to filter.
		 */
		$post_types = apply_filters( 'wpseo_cornerstone_post_types', parent::get_post_types() );
		if ( ! is_array( $post_types ) ) {
			return array();
		}

		return $post_types;
	}
}
PK     ”T]6m—yÒ
  Ò
    class-admin-user-profile.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 * @since   1.8.0
 */

/**
 * Customizes user profile.
 */
class WPSEO_Admin_User_Profile {

	/**
	 * Class constructor.
	 */
	public function __construct() {
		add_action( 'show_user_profile', array( $this, 'user_profile' ) );
		add_action( 'edit_user_profile', array( $this, 'user_profile' ) );
		add_action( 'personal_options_update', array( $this, 'process_user_option_update' ) );
		add_action( 'edit_user_profile_update', array( $this, 'process_user_option_update' ) );

		add_action( 'update_user_meta', array( $this, 'clear_author_sitemap_cache' ), 10, 3 );
	}

	/**
	 * Clear author sitemap cache when settings are changed.
	 *
	 * @since 3.1
	 *
	 * @param int    $meta_id   The ID of the meta option changed.
	 * @param int    $object_id The ID of the user.
	 * @param string $meta_key  The key of the meta field changed.
	 */
	public function clear_author_sitemap_cache( $meta_id, $object_id, $meta_key ) {
		if ( '_yoast_wpseo_profile_updated' === $meta_key ) {
			WPSEO_Sitemaps_Cache::clear( array( 'author' ) );
		}
	}

	/**
	 * Filter POST variables.
	 *
	 * @param string $var_name Name of the variable to filter.
	 *
	 * @return mixed
	 */
	private function filter_input_post( $var_name ) {
		$val = filter_input( INPUT_POST, $var_name );
		if ( $val ) {
			return WPSEO_Utils::sanitize_text_field( $val );
		}
		return '';
	}

	/**
	 * Updates the user metas that (might) have been set on the user profile page.
	 *
	 * @param int $user_id User ID of the updated user.
	 */
	public function process_user_option_update( $user_id ) {
		update_user_meta( $user_id, '_yoast_wpseo_profile_updated', time() );

		$nonce_value = $this->filter_input_post( 'wpseo_nonce' );

		if ( empty( $nonce_value ) ) { // Submit from alternate forms.
			return;
		}

		check_admin_referer( 'wpseo_user_profile_update', 'wpseo_nonce' );

		update_user_meta( $user_id, 'wpseo_title', $this->filter_input_post( 'wpseo_author_title' ) );
		update_user_meta( $user_id, 'wpseo_metadesc', $this->filter_input_post( 'wpseo_author_metadesc' ) );
		update_user_meta( $user_id, 'wpseo_noindex_author', $this->filter_input_post( 'wpseo_noindex_author' ) );
		update_user_meta( $user_id, 'wpseo_content_analysis_disable', $this->filter_input_post( 'wpseo_content_analysis_disable' ) );
		update_user_meta( $user_id, 'wpseo_keyword_analysis_disable', $this->filter_input_post( 'wpseo_keyword_analysis_disable' ) );
	}

	/**
	 * Add the inputs needed for SEO values to the User Profile page.
	 *
	 * @param WP_User $user User instance to output for.
	 */
	public function user_profile( $user ) {
		wp_nonce_field( 'wpseo_user_profile_update', 'wpseo_nonce' );

		require_once WPSEO_PATH . 'admin/views/user-profile.php';
	}
}
PK     ”T]�SÊ‰í   í   	  .htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]o¾ÿ›  ›    class-remote-request.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * This class handles a post request being send to a given endpoint.
 */
class WPSEO_Remote_Request {

	/**
	 * @var string
	 */
	const METHOD_POST = 'post';

	/**
	 * @var string
	 */
	const METHOD_GET = 'get';

	/**
	 * @var string
	 */
	protected $endpoint = '';

	/**
	 * @var array
	 */
	protected $args = array(
		'blocking'  => false,
		'sslverify' => false,
		'timeout'   => 2,
	);

	/**
	 * @var WP_Error|null
	 */
	protected $response_error;

	/**
	 * @var mixed
	 */
	protected $response_body;

	/**
	 * Sets the endpoint and arguments.
	 *
	 * @param string $endpoint The endpoint to send the request to.
	 * @param array  $args     The arguments to use in this request.
	 */
	public function __construct( $endpoint, array $args = array() ) {
		$this->endpoint = $endpoint;
		$this->args     = wp_parse_args( $this->args, $args );
	}

	/**
	 * Sets the request body.
	 *
	 * @param mixed $body The body to set.
	 */
	public function set_body( $body ) {
		$this->args['body'] = $body;
	}

	/**
	 * Sends the data to the given endpoint.
	 *
	 * @param string $method The type of request to send.
	 *
	 * @return bool True when sending data has been successful.
	 */
	public function send( $method = self::METHOD_POST ) {
		switch ( $method ) {
			case self::METHOD_POST:
				$response = $this->post();
				break;
			case self::METHOD_GET:
				$response = $this->get();
				break;
			default:
				/* translators: %1$s expands to the request method  */
				$response = new WP_Error( 1, sprintf( __( 'Request method %1$s is not valid.', 'wordpress-seo' ), $method ) );
				break;
		}

		return $this->process_response( $response );
	}

	/**
	 * Returns the value of the response error.
	 *
	 * @return null|WP_Error The response error.
	 */
	public function get_response_error() {
		return $this->response_error;
	}

	/**
	 * Returns the response body.
	 *
	 * @return mixed The response body.
	 */
	public function get_response_body() {
		return $this->response_body;
	}

	/**
	 * Processes the given response.
	 *
	 * @param mixed $response The response to process.
	 *
	 * @return bool True when response is valid.
	 */
	protected function process_response( $response ) {
		if ( $response instanceof WP_Error ) {
			$this->response_error = $response;

			return false;
		}

		$this->response_body = wp_remote_retrieve_body( $response );

		return ( wp_remote_retrieve_response_code( $response ) === 200 );
	}

	/**
	 * Performs a post request to the specified endpoint with set arguments.
	 *
	 * @return WP_Error|array The response or WP_Error on failure.
	 */
	protected function post() {
		return wp_remote_post( $this->endpoint, $this->args );
	}

	/**
	 * Performs a post request to the specified endpoint with set arguments.
	 *
	 * @return WP_Error|array The response or WP_Error on failure.
	 */
	protected function get() {
		return wp_remote_get( $this->endpoint, $this->args );
	}
}
PK     ”T]ýßð2x  x    pages/courses.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 * @since   9.4.0.
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

?>
<div class="wrap yoast">
<h1 id="wpseo-title"><?php echo esc_html( get_admin_page_title() ); ?></h1>
<?php

echo "<div id='yoast-courses-overview'></div>";

?>
</div>
PK     ”T]È+PU  U    pages/dashboard.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

if ( filter_input( INPUT_GET, 'intro' ) ) {
	update_user_meta( get_current_user_id(), 'wpseo_seen_about_version', WPSEO_VERSION );
	require WPSEO_PATH . 'admin/views/about.php';

	return;
}

if ( isset( $_GET['allow_tracking'] ) && check_admin_referer( 'wpseo_activate_tracking', 'nonce' ) ) {
	WPSEO_Options::set( 'yoast_tracking', ( $_GET['allow_tracking'] === 'yes' ) );

	if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
		wp_safe_redirect( wp_unslash( $_SERVER['HTTP_REFERER'] ), 307 );
		exit;
	}
}

$yform = Yoast_Form::get_instance();
$yform->admin_header( true, 'wpseo' );

do_action( 'wpseo_all_admin_notices' );

$tabs = new WPSEO_Option_Tabs( 'dashboard' );
$tabs->add_tab(
	new WPSEO_Option_Tab(
		'dashboard',
		__( 'Dashboard', 'wordpress-seo' ),
		array(
			'video_url'   => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-notification-center' ),
			'save_button' => false,
		)
	)
);
$tabs->add_tab(
	new WPSEO_Option_Tab(
		'features',
		__( 'Features', 'wordpress-seo' ),
		array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-features' ) )
	)
);
$tabs->add_tab(
	new WPSEO_Option_Tab(
		'webmaster-tools',
		__( 'Webmaster Tools', 'wordpress-seo' ),
		array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-general-search-console' ) )
	)
);

do_action( 'wpseo_settings_tabs_dashboard', $tabs );

$tabs->display( $yform );

do_action( 'wpseo_dashboard' );

$yform->admin_footer();
PK     ”T]Š})ÓK  K    pages/metas.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$tab = new WPSEO_Help_Center_Template_Variables_Tab();
$tab->register_hooks();

$yform = Yoast_Form::get_instance();
$yform->admin_header( true, 'wpseo_titles' );

$tabs = new WPSEO_Option_Tabs( 'metas' );
$tabs->add_tab( new WPSEO_Option_Tab( 'general', __( 'General', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-metas' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'post-types', __( 'Content Types', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-metas-post-types' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'media', __( 'Media', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'taxonomies', __( 'Taxonomies', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-metas-taxonomies' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'archives', __( 'Archives', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-metas-archives' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'breadcrumbs', __( 'Breadcrumbs', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-breadcrumbs' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'rss', __( 'RSS', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-rss' ) ) ) );
$tabs->display( $yform );

$yform->admin_footer();
PK     ”T]\”FQ  Q    pages/social.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$yform = Yoast_Form::get_instance();
$yform->admin_header( true, 'wpseo_social' );

$tabs = new WPSEO_Option_Tabs( 'social' );
$tabs->add_tab( new WPSEO_Option_Tab( 'accounts', __( 'Accounts', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-social-accounts' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'facebook', __( 'Facebook', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-social-facebook' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'twitterbox', __( 'Twitter', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-social-twitter' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'pinterest', __( 'Pinterest', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-social-pinterest' ) ) ) );

$tabs->display( $yform );

$yform->admin_footer();
PK     ”T]	M�2Š
  Š
    pages/tools.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$tool_page = (string) filter_input( INPUT_GET, 'tool' );

$yform = Yoast_Form::get_instance();
$yform->admin_header( false );

if ( '' === $tool_page ) {

	$tools = array();

	$tools['import-export'] = array(
		'title' => __( 'Import and Export', 'wordpress-seo' ),
		'desc'  => __( 'Import settings from other SEO plugins and export your settings for re-use on (another) blog.', 'wordpress-seo' ),
	);

	if ( WPSEO_Utils::allow_system_file_edit() === true && ! is_multisite() ) {
		$tools['file-editor'] = array(
			'title' => __( 'File editor', 'wordpress-seo' ),
			'desc'  => __( 'This tool allows you to quickly change important files for your SEO, like your robots.txt and, if you have one, your .htaccess file.', 'wordpress-seo' ),
		);
	}

	$tools['bulk-editor'] = array(
		'title' => __( 'Bulk editor', 'wordpress-seo' ),
		'desc'  => __( 'This tool allows you to quickly change titles and descriptions of your posts and pages without having to go into the editor for each page.', 'wordpress-seo' ),
	);

	echo '<p>';
	printf(
		/* translators: %1$s expands to Yoast SEO */
		esc_html__( '%1$s comes with some very powerful built-in tools:', 'wordpress-seo' ),
		'Yoast SEO'
	);
	echo '</p>';

	echo '<ul class="ul-disc">';

	$admin_url = admin_url( 'admin.php?page=wpseo_tools' );

	foreach ( $tools as $slug => $tool ) {
		$href = ( ! empty( $tool['href'] ) ) ? $admin_url . $tool['href'] : add_query_arg( array( 'tool' => $slug ), $admin_url );
		$attr = ( ! empty( $tool['attr'] ) ) ? $tool['attr'] : '';

		echo '<li>';
		echo '<strong><a href="', esc_url( $href ), '" ', $attr , '>', esc_html( $tool['title'] ), '</a></strong><br/>';
		echo $tool['desc'];
		echo '</li>';
	}

	/**
	 * Action: 'wpseo_tools_overview_list_items' - Hook to add additional tools to the overview.
	 */
	do_action( 'wpseo_tools_overview_list_items' );

	echo '</ul>';

	echo '<input type="hidden" id="wpseo_recalculate_nonce" name="wpseo_recalculate_nonce" value="' . esc_attr( wp_create_nonce( 'wpseo_recalculate' ) ) . '" />';

}
else {
	echo '<a href="', esc_url( admin_url( 'admin.php?page=wpseo_tools' ) ), '">', esc_html__( '&laquo; Back to Tools page', 'wordpress-seo' ), '</a>';

	$tool_pages = array( 'bulk-editor', 'import-export' );

	if ( WPSEO_Utils::allow_system_file_edit() === true && ! is_multisite() ) {
		$tool_pages[] = 'file-editor';
	}

	if ( in_array( $tool_page, $tool_pages, true ) ) {
		require_once WPSEO_PATH . 'admin/views/tool-' . $tool_page . '.php';
	}
}

$yform->admin_footer( false );
PK     ”T]Ó¨VIô  ô    pages/network.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$yform = Yoast_Form::get_instance();
$yform->admin_header( true, 'wpseo_ms' );

$tabs = new WPSEO_Option_Tabs( 'network' );
$tabs->add_tab( new WPSEO_Option_Tab( 'general', __( 'General', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'features', __( 'Features', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-features' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'restore-site', __( 'Restore Site', 'wordpress-seo' ), array( 'save_button' => false ) ) );
$tabs->display( $yform );

$yform->admin_footer();
PK     ”T]^‹þÑ‰  ‰    pages/licenses.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 * @since   1.5.0
 */

if ( ! defined( 'WPSEO_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}

$license_page_manager = new WPSEO_License_Page_Manager();
$licenses_page        = $license_page_manager->get_license_page();
require WPSEO_PATH . 'admin/views/' . $licenses_page . '.php';
PK     ”T]�SÊ‰í   í     pages/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]V\óêÝ  Ý  (  class-admin-media-purge-notification.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Handles the media purge notification showing and hiding.
 */
class WPSEO_Admin_Media_Purge_Notification implements WPSEO_WordPress_Integration {

	/**
	 * Notification ID to use.
	 *
	 * @var string
	 */
	private $notification_id = 'wpseo_media_purge';

	/**
	 * Registers all hooks to WordPress.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_action( 'admin_init', array( $this, 'manage_notification' ) );
		add_filter( 'wpseo_option_tab-metas_media', array( $this, 'output_hidden_setting' ) );

		// Dismissing is just setting the relevancy to false, which cancels out any functionality.
		if ( WPSEO_Utils::is_yoast_seo_page() && filter_input( INPUT_GET, 'dismiss' ) === $this->notification_id ) {
			WPSEO_Options::set( 'is-media-purge-relevant', false );
		}
	}

	/**
	 * Adds a hidden setting to the media tab.
	 *
	 * To make sure the setting is not reverted to the default when -anything-
	 * is saved on the entire page (not just the media tab).
	 *
	 * @param string|null $input Current filter value.
	 *
	 * @return string|null
	 */
	public function output_hidden_setting( $input ) {
		$form = Yoast_Form::get_instance();
		$form->hidden( 'is-media-purge-relevant' );

		return $input;
	}

	/**
	 * Manages if the notification should be shown or removed.
	 *
	 * @return void
	 */
	public function manage_notification() {
		$this->remove_notification();
	}

	/**
	 * Retrieves the notification that should be shown or removed.
	 *
	 * @return Yoast_Notification The notification to use.
	 */
	private function get_notification() {
		$content = sprintf(
			/* translators: %1$s expands to the link to the article, %2$s closes the link tag. */
			__( 'Your site\'s settings currently allow attachment URLs on your site to exist. Please read %1$sthis post about a potential issue%2$s with attachment URLs and check whether you have the correct setting for your site.', 'wordpress-seo' ),
			'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/2r8' ) ) . '" rel="noopener noreferrer" target="_blank">',
			'</a>'
		);

		$content .= '<br><br>';
		$content .= sprintf(
			/* translators: %1$s dismiss link open tag, %2$s closes the link tag. */
			__( 'If you know what this means and you do not want to see this message anymore, you can %1$sdismiss this message%2$s.', 'wordpress-seo' ),
			'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_dashboard&dismiss=' . $this->notification_id ) ) . '">',
			'</a>'
		);

		return new Yoast_Notification(
			$content,
			array(
				'type'         => Yoast_Notification::ERROR,
				'id'           => $this->notification_id,
				'capabilities' => 'wpseo_manage_options',
				'priority'     => 1,
			)
		);
	}

	/**
	 * Adds the notification to the notificaton center.
	 *
	 * @return void
	 */
	private function add_notification() {
		$notification_center = Yoast_Notification_Center::get();
		$notification_center->add_notification( $this->get_notification() );
	}

	/**
	 * Removes the notification from the notification center.
	 *
	 * @return void
	 */
	private function remove_notification() {
		$notification_center = Yoast_Notification_Center::get();
		$notification_center->remove_notification( $this->get_notification() );
	}
}
PK     ”T]­åQ¾˜  ˜    class-product-upsell-notice.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents the upsell notice.
 */
class WPSEO_Product_Upsell_Notice {

	/**
	 * @var string
	 */
	const USER_META_DISMISSED = 'wpseo-remove-upsell-notice';

	/**
	 * @var string
	 */
	const OPTION_NAME = 'wpseo';

	/**
	 * @var array
	 */
	protected $options;

	/**
	 * Sets the options, because they always have to be there on instance.
	 */
	public function __construct() {
		$this->options = $this->get_options();
	}

	/**
	 * Checks if the notice should be added or removed.
	 */
	public function initialize() {
		$this->remove_notification();
	}

	/**
	 * Sets the upgrade notice.
	 */
	public function set_upgrade_notice() {

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

		$this->set_first_activated_on();
		$this->add_notification();
	}

	/**
	 * Listener for the upsell notice.
	 */
	public function dismiss_notice_listener() {
		if ( filter_input( INPUT_GET, 'yoast_dismiss' ) !== 'upsell' ) {
			return;
		}

		$this->dismiss_notice();

		wp_redirect( admin_url( 'admin.php?page=wpseo_dashboard' ) );
		exit;
	}

	/**
	 * When the notice should be shown.
	 *
	 * @return bool
	 */
	protected function should_add_notification() {
		return ( $this->options['first_activated_on'] < strtotime( '-2weeks' ) );
	}

	/**
	 * Checks if the options has a first activated on date value.
	 */
	protected function has_first_activated_on() {
		return $this->options['first_activated_on'] !== false;
	}

	/**
	 * Sets the first activated on.
	 */
	protected function set_first_activated_on() {
		$this->options['first_activated_on'] = strtotime( '-2weeks' );

		$this->save_options();
	}

	/**
	 * Adds a notification to the notification center.
	 */
	protected function add_notification() {
		$notification_center = Yoast_Notification_Center::get();
		$notification_center->add_notification( $this->get_notification() );
	}

	/**
	 * Removes a notification to the notification center.
	 */
	protected function remove_notification() {
		$notification_center = Yoast_Notification_Center::get();
		$notification_center->remove_notification( $this->get_notification() );
	}

	/**
	 * Returns a premium upsell section if using the free plugin.
	 *
	 * @return string
	 */
	protected function get_premium_upsell_section() {
		$features = new WPSEO_Features();
		if ( $features->is_free() ) {
			return sprintf(
				/* translators: %1$s expands anchor to premium plugin page, %2$s expands to </a> */
				__( 'By the way, did you know we also have a %1$sPremium plugin%2$s? It offers advanced features, like a redirect manager and support for multiple keyphrases. It also comes with 24/7 personal support.', 'wordpress-seo' ),
				"<a href='" . WPSEO_Shortlinker::get( 'https://yoa.st/premium-notification' ) . "'>",
				'</a>'
			);
		}

		return '';
	}

	/**
	 * Gets the notification value.
	 *
	 * @return Yoast_Notification
	 */
	protected function get_notification() {
		$message = sprintf(
			/* translators: %1$s expands to Yoast SEO, %2$s is a link start tag to the plugin page on WordPress.org, %3$s is the link closing tag. */
			__( 'We\'ve noticed you\'ve been using %1$s for some time now; we hope you love it! We\'d be thrilled if you could %2$sgive us a 5 stars rating on WordPress.org%3$s!', 'wordpress-seo' ),
			'Yoast SEO',
			'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/rate-yoast-seo' ) . '">',
			'</a>'
		) . "\n\n";

		$message .= sprintf(
			/* translators: %1$s is a link start tag to the bugreport guidelines on the Yoast knowledge base, %2$s is the link closing tag. */
			__( 'If you are experiencing issues, %1$splease file a bug report%2$s and we\'ll do our best to help you out.', 'wordpress-seo' ),
			'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/bugreport' ) . '">',
			'</a>'
		) . "\n\n";

		$message .= $this->get_premium_upsell_section() . "\n\n";

		$message .= '<a class="button" href="' . admin_url( '?page=' . WPSEO_Admin::PAGE_IDENTIFIER . '&yoast_dismiss=upsell' ) . '">' . __( 'Please don\'t show me this notification anymore', 'wordpress-seo' ) . '</a>';

		$notification = new Yoast_Notification(
			$message,
			array(
				'type'         => Yoast_Notification::WARNING,
				'id'           => 'wpseo-upsell-notice',
				'capabilities' => 'wpseo_manage_options',
				'priority'     => 0.8,
			)
		);

		return $notification;
	}

	/**
	 * Dismisses the notice.
	 *
	 * @return string
	 */
	protected function is_notice_dismissed() {
		return get_user_meta( get_current_user_id(), self::USER_META_DISMISSED, true ) === '1';
	}

	/**
	 * Dismisses the notice.
	 */
	protected function dismiss_notice() {
		update_user_meta( get_current_user_id(), self::USER_META_DISMISSED, true );
	}

	/**
	 * Returns the set options.
	 *
	 * @return mixed|void
	 */
	protected function get_options() {
		return get_option( self::OPTION_NAME );
	}

	/**
	 * Saves the options to the database.
	 */
	protected function save_options() {
		update_option( self::OPTION_NAME, $this->options );
	}
}
PK     ”T]¼?Ô9Ç  Ç    class-extension.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents the values for a single Yoast Premium extension plugin.
 */
class WPSEO_Extension {

	/**
	 * @var array
	 */
	protected $config = array();

	/**
	 * WPSEO_Extension constructor.
	 *
	 * @param array $config The config to use.
	 */
	public function __construct( array $config ) {
		$this->config = $config;
	}

	/**
	 * Returns the product title.
	 *
	 * @return string The set title.
	 */
	public function get_title() {
		return $this->config['title'];
	}

	/**
	 * Returns the product title to display.
	 *
	 * @return string The title to display on the license page.
	 */
	public function get_display_title() {
		return empty( $this->config['display_title'] ) ? $this->get_title() : $this->config['display_title'];
	}

	/**
	 * Returns URL to the page where the product can be bought.
	 *
	 * @return string The buy url.
	 */
	public function get_buy_url() {
		return $this->config['buyUrl'];
	}

	/**
	 * Returns URL to the page with more info.
	 *
	 * @return string The url to the info page.
	 */
	public function get_info_url() {
		return $this->config['infoUrl'];
	}

	/**
	 * Returns the image.
	 *
	 * @return string The image.
	 */
	public function get_image() {
		return $this->config['image'];
	}

	/**
	 * Returns the buy button value if set, otherwise fallback to the title.
	 *
	 * @return string The buy button.
	 */
	public function get_buy_button() {
		if ( isset( $this->config['buy_button'] ) ) {
			return $this->config['buy_button'];
		}

		return $this->get_title();
	}

	/**
	 * Returns the benefits.
	 *
	 * @return array The array with benefits.
	 */
	public function get_benefits() {
		return $this->config['benefits'];
	}
}
PK     ”T]QHQ¿"  ¿"    class-yoast-notification.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Notifications
 * @since   1.5.3
 */

/**
 * Implements individual notification.
 */
class Yoast_Notification {

	/**
	 * Type of capability check.
	 *
	 * @var string
	 */
	const MATCH_ALL = 'all';

	/**
	 * Type of capability check.
	 *
	 * @var string
	 */
	const MATCH_ANY = 'any';

	/**
	 * Notification type.
	 *
	 * @var string
	 */
	const ERROR = 'error';

	/**
	 * Notification type.
	 *
	 * @var string
	 */
	const WARNING = 'warning';

	/**
	 * Notification type.
	 *
	 * @var string
	 */
	const UPDATED = 'updated';

	/**
	 * Options of this Notification.
	 *
	 * Contains optional arguments:
	 *
	 * -             type: The notification type, i.e. 'updated' or 'error'
	 * -               id: The ID of the notification
	 * -            nonce: Security nonce to use in case of dismissible notice.
	 * -         priority: From 0 to 1, determines the order of Notifications.
	 * -    dismissal_key: Option name to save dismissal information in, ID will be used if not supplied.
	 * -     capabilities: Capabilities that a user must have for this Notification to show.
	 * - capability_check: How to check capability pass: all or any.
	 * -  wpseo_page_only: Only display on wpseo page or on every page.
	 *
	 * @var array
	 */
	private $options = array();

	/**
	 * Contains default values for the optional arguments.
	 *
	 * @var array
	 */
	private $defaults = array(
		'type'             => self::UPDATED,
		'id'               => '',
		'nonce'            => null,
		'priority'         => 0.5,
		'data_json'        => array(),
		'dismissal_key'    => null,
		'capabilities'     => array(),
		'capability_check' => self::MATCH_ALL,
		'yoast_branding'   => false,
	);

	/**
	 * The message for the notification.
	 *
	 * @var string
	 */
	private $message;

	/**
	 * Notification class constructor.
	 *
	 * @param string $message Message string.
	 * @param array  $options Set of options.
	 */
	public function __construct( $message, $options = array() ) {
		$this->message = $message;
		$this->options = $this->normalize_options( $options );
	}

	/**
	 * Retrieve notification ID string.
	 *
	 * @return string
	 */
	public function get_id() {
		return $this->options['id'];
	}

	/**
	 * Retrieve nonce identifier.
	 *
	 * @return null|string Nonce for this Notification.
	 */
	public function get_nonce() {
		if ( $this->options['id'] && empty( $this->options['nonce'] ) ) {
			$this->options['nonce'] = wp_create_nonce( $this->options['id'] );
		}

		return $this->options['nonce'];
	}

	/**
	 * Make sure the nonce is up to date.
	 */
	public function refresh_nonce() {
		if ( $this->options['id'] ) {
			$this->options['nonce'] = wp_create_nonce( $this->options['id'] );
		}
	}

	/**
	 * Get the type of the notification.
	 *
	 * @return string
	 */
	public function get_type() {
		return $this->options['type'];
	}

	/**
	 * Priority of the notification.
	 *
	 * Relative to the type.
	 *
	 * @return float Returns the priority between 0 and 1.
	 */
	public function get_priority() {
		return $this->options['priority'];
	}

	/**
	 * Get the User Meta key to check for dismissal of notification.
	 *
	 * @return string User Meta Option key that registers dismissal.
	 */
	public function get_dismissal_key() {
		if ( empty( $this->options['dismissal_key'] ) ) {
			return $this->options['id'];
		}

		return $this->options['dismissal_key'];
	}

	/**
	 * Is this Notification persistent.
	 *
	 * @return bool True if persistent, False if fire and forget.
	 */
	public function is_persistent() {
		$id = $this->get_id();

		return ! empty( $id );
	}

	/**
	 * Check if the notification is relevant for the current user.
	 *
	 * @return bool True if a user needs to see this notification, false if not.
	 */
	public function display_for_current_user() {
		// If the notification is for the current page only, always show.
		if ( ! $this->is_persistent() ) {
			return true;
		}

		// If the current user doesn't match capabilities.
		return $this->match_capabilities();
	}

	/**
	 * Does the current user match required capabilities.
	 *
	 * @return bool
	 */
	public function match_capabilities() {
		// Super Admin can do anything.
		if ( is_multisite() && is_super_admin() ) {
			return true;
		}

		/**
		 * Filter capabilities that enable the displaying of this notification.
		 *
		 * @since 3.2
		 *
		 * @param array              $capabilities The capabilities that must be present for this notification.
		 * @param Yoast_Notification $notification The notification object.
		 *
		 * @return Array of capabilities or empty for no restrictions.
		 */
		$capabilities = apply_filters( 'wpseo_notification_capabilities', $this->options['capabilities'], $this );

		// Should be an array.
		if ( ! is_array( $capabilities ) ) {
			$capabilities = (array) $capabilities;
		}

		/**
		 * Filter capability check to enable all or any capabilities.
		 *
		 * @since 3.2
		 *
		 * @param string             $capability_check The type of check that will be used to determine if an capability is present.
		 * @param Yoast_Notification $notification     The notification object.
		 *
		 * @return string self::MATCH_ALL or self::MATCH_ANY.
		 */
		$capability_check = apply_filters( 'wpseo_notification_capability_check', $this->options['capability_check'], $this );

		if ( ! in_array( $capability_check, array( self::MATCH_ALL, self::MATCH_ANY ), true ) ) {
			$capability_check = self::MATCH_ALL;
		}

		if ( ! empty( $capabilities ) ) {

			$has_capabilities = array_filter( $capabilities, array( $this, 'has_capability' ) );

			switch ( $capability_check ) {
				case self::MATCH_ALL:
					return $has_capabilities === $capabilities;
				case self::MATCH_ANY:
					return ! empty( $has_capabilities );
			}
		}

		return true;
	}

	/**
	 * Array filter function to find matched capabilities.
	 *
	 * @param string $capability Capability to test.
	 *
	 * @return bool
	 */
	private function has_capability( $capability ) {
		return current_user_can( $capability );
	}

	/**
	 * Return the object properties as an array.
	 *
	 * @return array
	 */
	public function to_array() {
		return array(
			'message' => $this->message,
			'options' => $this->options,
		);
	}

	/**
	 * Adds string (view) behaviour to the notification.
	 *
	 * @return string
	 */
	public function __toString() {
		return $this->render();
	}

	/**
	 * Renders the notification as a string.
	 *
	 * @return string The rendered notification.
	 */
	public function render() {
		$attributes = array();

		// Default notification classes.
		$classes = array(
			'yoast-alert',
		);

		// Maintain WordPress visualisation of alerts when they are not persistent.
		if ( ! $this->is_persistent() ) {
			$classes[] = 'notice';
			$classes[] = $this->get_type();
		}

		if ( ! empty( $classes ) ) {
			$attributes['class'] = implode( ' ', $classes );
		}

		// Combined attribute key and value into a string.
		array_walk( $attributes, array( $this, 'parse_attributes' ) );

		$message = null;
		if ( $this->options['yoast_branding'] ) {
			$message = $this->wrap_yoast_seo_icon( $this->message );
		}

		if ( $message === null ) {
			$message = wpautop( $this->message );
		}

		// Build the output DIV.
		return '<div ' . implode( ' ', $attributes ) . '>' . $message . '</div>' . PHP_EOL;
	}

	/**
	 * Wraps the message with a Yoast SEO icon.
	 *
	 * @param string $message The message to wrap.
	 *
	 * @return string The wrapped message.
	 */
	private function wrap_yoast_seo_icon( $message ) {
		$out  = sprintf(
			'<img src="%1$s" height="%2$d" width="%3$d" class="yoast-seo-icon" />',
			esc_url( plugin_dir_url( WPSEO_FILE ) . 'images/Yoast_SEO_Icon.svg' ),
			60,
			60
		);
		$out .= '<div class="yoast-seo-icon-wrap">';
		$out .= $message;
		$out .= '</div>';

		return $out;
	}

	/**
	 * Get the JSON if provided.
	 *
	 * @return false|string
	 */
	public function get_json() {
		if ( empty( $this->options['data_json'] ) ) {
			return '';
		}

		return WPSEO_Utils::format_json_encode( $this->options['data_json'] );
	}

	/**
	 * Make sure we only have values that we can work with.
	 *
	 * @param array $options Options to normalize.
	 *
	 * @return array
	 */
	private function normalize_options( $options ) {
		$options = wp_parse_args( $options, $this->defaults );

		// Should not exceed 0 or 1.
		$options['priority'] = min( 1, max( 0, $options['priority'] ) );

		// Set default capabilities when not supplied.
		if ( empty( $options['capabilities'] ) || array() === $options['capabilities'] ) {
			$options['capabilities'] = array( 'wpseo_manage_options' );
		}

		return $options;
	}

	/**
	 * Format HTML element attributes.
	 *
	 * @param string $value Attribute value.
	 * @param string $key   Attribute name.
	 */
	private function parse_attributes( & $value, $key ) {
		$value = sprintf( '%s="%s"', $key, esc_attr( $value ) );
	}
}
PK     ”T]�SÊ‰í   í     roles/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]Ë}
˜¿  ¿     roles/class-role-manager-vip.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Roles
 */

/**
 * VIP implementation of the Role Manager.
 */
final class WPSEO_Role_Manager_VIP extends WPSEO_Abstract_Role_Manager {

	/**
	 * Adds a role to the system.
	 *
	 * @param string $role         Role to add.
	 * @param string $display_name Name to display for the role.
	 * @param array  $capabilities Capabilities to add to the role.
	 *
	 * @return void
	 */
	protected function add_role( $role, $display_name, array $capabilities = array() ) {
		$enabled_capabilities  = array();
		$disabled_capabilities = array();

		// Build lists of enabled and disabled capabilities.
		foreach ( $capabilities as $capability => $grant ) {
			if ( $grant ) {
				$enabled_capabilities[] = $capability;
			}

			if ( ! $grant ) {
				$disabled_capabilities[] = $capability;
			}
		}

		wpcom_vip_add_role( $role, $display_name, $enabled_capabilities );
		if ( $disabled_capabilities !== array() ) {
			wpcom_vip_remove_role_caps( $role, $disabled_capabilities );
		}
	}

	/**
	 * Removes a role from the system.
	 *
	 * @param string $role Role to remove.
	 *
	 * @return void
	 */
	protected function remove_role( $role ) {
		remove_role( $role );
	}
}
PK     ”T]¬“ìQ"  "  $  roles/class-role-manager-factory.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Roles
 */

/**
 * Role Manager Factory.
 */
class WPSEO_Role_Manager_Factory {

	/**
	 * Retrieves the Role manager to use.
	 *
	 * @return WPSEO_Role_Manager
	 */
	public static function get() {
		static $manager = null;

		if ( $manager === null ) {
			if ( function_exists( 'wpcom_vip_add_role' ) ) {
				$manager = new WPSEO_Role_Manager_VIP();
			}

			if ( ! function_exists( 'wpcom_vip_add_role' ) ) {
				$manager = new WPSEO_Role_Manager_WP();
			}
		}

		return $manager;
	}
}
PK     ”T]WÛ³°  °  %  roles/class-abstract-role-manager.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Roles
 */

/**
 * Abstract Role Manager template.
 */
abstract class WPSEO_Abstract_Role_Manager implements WPSEO_Role_Manager {

	/**
	 * Registered roles.
	 *
	 * @var array
	 */
	protected $roles = array();

	/**
	 * Registers a role.
	 *
	 * @param string      $role         Role to register.
	 * @param string      $display_name Display name to use.
	 * @param null|string $template     Optional. Role to base the new role on.
	 *
	 * @return void
	 */
	public function register( $role, $display_name, $template = null ) {
		$this->roles[ $role ] =
			(object) array(
				'display_name' => $display_name,
				'template'     => $template,
			);
	}

	/**
	 * Returns the list of registered roles.
	 *
	 * @return string[] List or registered roles.
	 */
	public function get_roles() {
		return array_keys( $this->roles );
	}

	/**
	 * Adds the registered roles.
	 *
	 * @return void
	 */
	public function add() {
		foreach ( $this->roles as $role => $data ) {
			$capabilities = $this->get_capabilities( $data->template );
			$capabilities = $this->filter_existing_capabilties( $role, $capabilities );

			$this->add_role( $role, $data->display_name, $capabilities );
		}
	}

	/**
	 * Removes the registered roles.
	 *
	 * @return void
	 */
	public function remove() {
		$roles = array_keys( $this->roles );
		array_map( array( $this, 'remove_role' ), $roles );
	}

	/**
	 * Returns the capabilities for the specified role.
	 *
	 * @param string $role Role to fetch capabilities from.
	 *
	 * @return array List of capabilities.
	 */
	protected function get_capabilities( $role ) {
		if ( ! is_string( $role ) || empty( $role ) ) {
			return array();
		}

		$wp_role = get_role( $role );
		if ( ! $wp_role ) {
			return array();
		}

		return $wp_role->capabilities;
	}

	/**
	 * Returns true if the capability exists on the role.
	 *
	 * @param WP_Role $role       Role to check capability against.
	 * @param string  $capability Capability to check.
	 *
	 * @return bool True if the capability is defined for the role.
	 */
	protected function capability_exists( WP_Role $role, $capability ) {
		return ! array_key_exists( $capability, $role->capabilities );
	}

	/**
	 * Filters out capabilities that are already set for the role.
	 *
	 * This makes sure we don't override configurations that have been previously set.
	 *
	 * @param string $role         The role to check against.
	 * @param array  $capabilities The capabilities that should be set.
	 *
	 * @return array Capabilties that can be safely set.
	 */
	protected function filter_existing_capabilties( $role, array $capabilities ) {
		if ( $capabilities === array() ) {
			return $capabilities;
		}

		$wp_role = get_role( $role );
		if ( ! $wp_role ) {
			return $capabilities;
		}

		foreach ( $capabilities as $capability => $grant ) {
			if ( $this->capability_exists( $wp_role, $capability ) ) {
				unset( $capabilities[ $capability ] );
			}
		}

		return $capabilities;
	}

	/**
	 * Adds a role to the system.
	 *
	 * @param string $role         Role to add.
	 * @param string $display_name Name to display for the role.
	 * @param array  $capabilities Capabilities to add to the role.
	 *
	 * @return void
	 */
	abstract protected function add_role( $role, $display_name, array $capabilities = array() );

	/**
	 * Removes a role from the system.
	 *
	 * @param string $role Role to remove.
	 *
	 * @return void
	 */
	abstract protected function remove_role( $role );
}
PK     ”T]æ(îwÔ  Ô    roles/class-role-manager-wp.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Roles
 */

/**
 * WordPress' default implementation of the Role Manager.
 */
final class WPSEO_Role_Manager_WP extends WPSEO_Abstract_Role_Manager {

	/**
	 * Adds a role to the system.
	 *
	 * @param string $role         Role to add.
	 * @param string $display_name Name to display for the role.
	 * @param array  $capabilities Capabilities to add to the role.
	 *
	 * @return void
	 */
	protected function add_role( $role, $display_name, array $capabilities = array() ) {
		$wp_role = get_role( $role );
		if ( $wp_role ) {
			foreach ( $capabilities as $capability => $grant ) {
				$wp_role->add_cap( $capability, $grant );
			}

			return;
		}

		// @codingStandardsIgnoreLine
		add_role( $role, $display_name, $capabilities );
	}

	/**
	 * Removes a role from the system.
	 *
	 * @param string $role Role to remove.
	 *
	 * @return void
	 */
	protected function remove_role( $role ) {
		remove_role( $role );
	}

	/**
	 * Formats the capabilities to the required format.
	 *
	 * @param array $capabilities Capabilities to format.
	 * @param bool  $enabled      Whether these capabilities should be enabled or not.
	 *
	 * @return array Formatted capabilities.
	 */
	protected function format_capabilities( array $capabilities, $enabled = true ) {
		// Flip keys and values.
		$capabilities = array_flip( $capabilities );

		// Set all values to $enabled.
		return array_fill_keys( array_keys( $capabilities ), $enabled );
	}
}
PK     ”T]££\Cg  g    roles/class-register-roles.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Roles
 */

/**
 * Role registration class.
 */
class WPSEO_Register_Roles implements WPSEO_WordPress_Integration {

	/**
	 * Adds hooks.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_action( 'wpseo_register_roles', array( $this, 'register' ) );
	}

	/**
	 * Registers the roles.
	 *
	 * @return void
	 */
	public function register() {
		$role_manager = WPSEO_Role_Manager_Factory::get();

		$role_manager->register( 'wpseo_manager', 'SEO Manager', 'editor' );
		$role_manager->register( 'wpseo_editor', 'SEO Editor', 'editor' );
	}
}
PK     ”T]mÕ²q      roles/class-role-manager.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Roles
 */

/**
 * Role Manager interface.
 */
interface WPSEO_Role_Manager {

	/**
	 * Registers a role.
	 *
	 * @param string      $role         Role to register.
	 * @param string      $display_name Display name to use.
	 * @param null|string $template     Optional. Role to base the new role on.
	 *
	 * @return void
	 */
	public function register( $role, $display_name, $template = null );

	/**
	 * Adds the registered roles.
	 *
	 * @return void
	 */
	public function add();

	/**
	 * Removes the registered roles.
	 *
	 * @return void
	 */
	public function remove();

	/**
	 * Returns the list of registered roles.
	 *
	 * @return string[] List or registered roles.
	 */
	public function get_roles();
}
PK     ”T][�c•  •  '  ajax/class-yoast-dismissable-notice.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Ajax
 */

/**
 * This class will catch the request to dismiss the target notice (set by notice_name)
 * and will store the dismiss status as an user meta in the database.
 */
class Yoast_Dismissable_Notice_Ajax {

	/**
	 * Notice type toggle value for user notices.
	 *
	 * @var string
	 */
	const FOR_USER = 'user_meta';

	/**
	 * Notice type toggle value for network notices.
	 *
	 * @var string
	 */
	const FOR_NETWORK = 'site_option';

	/**
	 * Notice type toggle value for site notices.
	 *
	 * @var string
	 */
	const FOR_SITE = 'option';


	/**
	 * Name of the notice that will be dismissed.
	 *
	 * @var string
	 */
	private $notice_name;

	/**
	 * The type of the current notice.
	 *
	 * @var string
	 */
	private $notice_type;

	/**
	 * Initialize the hooks for the AJAX request.
	 *
	 * @param string $notice_name The name for the hook to catch the notice.
	 * @param string $notice_type The notice type.
	 */
	public function __construct( $notice_name, $notice_type = self::FOR_USER ) {
		$this->notice_name = $notice_name;
		$this->notice_type = $notice_type;

		add_action( 'wp_ajax_wpseo_dismiss_' . $notice_name, array( $this, 'dismiss_notice' ) );
	}

	/**
	 * Handles the dismiss notice request.
	 */
	public function dismiss_notice() {
		check_ajax_referer( 'wpseo-dismiss-' . $this->notice_name );

		$this->save_dismissed();

		wp_die( 'true' );
	}

	/**
	 * Storing the dismissed value in the database. The target location is based on the set notification type.
	 */
	private function save_dismissed() {
		if ( $this->notice_type === self::FOR_SITE ) {
			update_option( 'wpseo_dismiss_' . $this->notice_name, 1 );

			return;
		}

		if ( $this->notice_type === self::FOR_NETWORK ) {
			update_site_option( 'wpseo_dismiss_' . $this->notice_name, 1 );

			return;
		}

		update_user_meta( get_current_user_id(), 'wpseo_dismiss_' . $this->notice_name, 1 );
	}
}
PK     ”T]üLéÍB  B     ajax/class-yoast-onpage-ajax.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Ajax
 */

/**
 * Class Yoast_OnPage_Ajax.
 *
 * This class will catch the request to dismiss the Ryte notice and will store
 * the dismiss status as an user meta in the database.
 */
class Yoast_OnPage_Ajax {

	/**
	 * Initialize the hooks for the AJAX request.
	 */
	public function __construct() {
		add_action( 'wp_ajax_wpseo_dismiss_onpageorg', array( $this, 'dismiss_notice' ) );
	}

	/**
	 * Handles the dismiss notice request.
	 */
	public function dismiss_notice() {
		check_ajax_referer( 'wpseo-dismiss-onpageorg' );

		$this->save_dismissed();

		wp_die( 'true' );
	}

	/**
	 * Storing the dismissed value as an user option in the database.
	 */
	private function save_dismissed() {
		update_user_meta( get_current_user_id(), WPSEO_OnPage::USER_META_KEY, 1 );
	}
}
PK     ”T]Ùþ�¶D  D    ajax/class-shortcode-filter.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Ajax
 */

/**
 * Class WPSEO_Shortcode_Filter.
 *
 * Used for parsing WP shortcodes with AJAX.
 */
class WPSEO_Shortcode_Filter {

	/**
	 * Initialize the AJAX hooks.
	 */
	public function __construct() {
		add_action( 'wp_ajax_wpseo_filter_shortcodes', array( $this, 'do_filter' ) );
	}

	/**
	 * Parse the shortcodes.
	 */
	public function do_filter() {
		check_ajax_referer( 'wpseo-filter-shortcodes', 'nonce' );

		$shortcodes = filter_input( INPUT_POST, 'data', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );

		$parsed_shortcodes = array();

		foreach ( $shortcodes as $shortcode ) {
			$parsed_shortcodes[] = array(
				'shortcode' => $shortcode,
				'output'    => do_shortcode( $shortcode ),
			);
		}

		wp_die( WPSEO_Utils::format_json_encode( $parsed_shortcodes ) );
	}
}
PK     ”T]�SÊ‰í   í     ajax/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]6àX¢
  ¢
  &  ajax/class-recalculate-scores-ajax.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Ajax
 */

/**
 * Class WPSEO_Recalculate_Scores.
 *
 * This class handles the SEO score recalculation for all posts with a filled focus keyword.
 */
class WPSEO_Recalculate_Scores_Ajax {

	/**
	 * Initialize the AJAX hooks.
	 */
	public function __construct() {
		add_action( 'wp_ajax_wpseo_recalculate_scores', array( $this, 'recalculate_scores' ) );
		add_action( 'wp_ajax_wpseo_update_score', array( $this, 'save_score' ) );
		add_action( 'wp_ajax_wpseo_recalculate_total', array( $this, 'get_total' ) );
	}

	/**
	 * Get the totals for the posts and the terms.
	 */
	public function get_total() {
		check_ajax_referer( 'wpseo_recalculate', 'nonce' );

		wp_die(
			WPSEO_Utils::format_json_encode(
				array(
					'posts' => $this->calculate_posts(),
					'terms' => $this->calculate_terms(),
				)
			)
		);
	}

	/**
	 * Start recalculation.
	 */
	public function recalculate_scores() {
		check_ajax_referer( 'wpseo_recalculate', 'nonce' );

		$fetch_object = $this->get_fetch_object();
		if ( ! empty( $fetch_object ) ) {
			$paged    = filter_input( INPUT_POST, 'paged', FILTER_VALIDATE_INT );
			$response = $fetch_object->get_items_to_recalculate( $paged );

			if ( ! empty( $response ) ) {
				wp_die( WPSEO_Utils::format_json_encode( $response ) );
			}
		}

		wp_die( '' );
	}

	/**
	 * Saves the new linkdex score for given post.
	 */
	public function save_score() {
		check_ajax_referer( 'wpseo_recalculate', 'nonce' );

		$fetch_object = $this->get_fetch_object();
		if ( ! empty( $fetch_object ) ) {
			$scores = filter_input( INPUT_POST, 'scores', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
			$fetch_object->save_scores( $scores );
		}

		wp_die();
	}

	/**
	 * Returns the needed object for recalculating scores.
	 *
	 * @return WPSEO_Recalculate_Posts|WPSEO_Recalculate_Terms
	 */
	private function get_fetch_object() {
		switch ( filter_input( INPUT_POST, 'type' ) ) {
			case 'post':
				return new WPSEO_Recalculate_Posts();
			case 'term':
				return new WPSEO_Recalculate_Terms();
		}

		return null;
	}

	/**
	 * Gets the total number of posts.
	 *
	 * @return int
	 */
	private function calculate_posts() {
		$count_posts_query = new WP_Query(
			array(
				'post_type'      => 'any',
				'meta_key'       => '_yoast_wpseo_focuskw',
				'posts_per_page' => 1,
				'fields'         => 'ids',
			)
		);

		return $count_posts_query->found_posts;
	}

	/**
	 * Get the total number of terms.
	 *
	 * @return int
	 */
	private function calculate_terms() {
		$total = 0;
		foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
			$total += wp_count_terms( $taxonomy->name, array( 'hide_empty' => false ) );
		}

		return $total;
	}
}
PK     ”T]
õhPñ
  ñ
  )  ajax/class-yoast-plugin-conflict-ajax.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Ajax
 */

/**
 * Class Yoast_Plugin_Conflict_Ajax.
 */
class Yoast_Plugin_Conflict_Ajax {

	/**
	 * @var string
	 */
	private $option_name = 'wpseo_dismissed_conflicts';

	/**
	 * @var array
	 */
	private $dismissed_conflicts = array();

	/**
	 * Initialize the hooks for the AJAX request.
	 */
	public function __construct() {
		add_action( 'wp_ajax_wpseo_dismiss_plugin_conflict', array( $this, 'dismiss_notice' ) );
	}

	/**
	 * Handles the dismiss notice request.
	 */
	public function dismiss_notice() {
		check_ajax_referer( 'dismiss-plugin-conflict' );

		$conflict_data = filter_input( INPUT_POST, 'data', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );

		$this->dismissed_conflicts = $this->get_dismissed_conflicts( $conflict_data['section'] );

		$this->compare_plugins( $conflict_data['plugins'] );

		$this->save_dismissed_conflicts( $conflict_data['section'] );

		wp_die( 'true' );
	}

	/**
	 * Getting the user option from the database.
	 *
	 * @return bool|array
	 */
	private function get_dismissed_option() {
		return get_user_meta( get_current_user_id(), $this->option_name, true );
	}

	/**
	 * Getting the dismissed conflicts from the database
	 *
	 * @param string $plugin_section Type of conflict group (such as Open Graph or sitemap).
	 *
	 * @return array
	 */
	private function get_dismissed_conflicts( $plugin_section ) {
		$dismissed_conflicts = $this->get_dismissed_option();

		if ( is_array( $dismissed_conflicts ) && array_key_exists( $plugin_section, $dismissed_conflicts ) ) {
			return $dismissed_conflicts[ $plugin_section ];
		}

		return array();
	}

	/**
	 * Storing the conflicting plugins as an user option in the database.
	 *
	 * @param string $plugin_section Plugin conflict type (such as Open Graph or sitemap).
	 */
	private function save_dismissed_conflicts( $plugin_section ) {
		$dismissed_conflicts = $this->get_dismissed_option();

		$dismissed_conflicts[ $plugin_section ] = $this->dismissed_conflicts;

		update_user_meta( get_current_user_id(), $this->option_name, $dismissed_conflicts );
	}

	/**
	 * Loop through the plugins to compare them with the already stored dismissed plugin conflicts.
	 *
	 * @param array $posted_plugins Plugin set to check.
	 */
	public function compare_plugins( array $posted_plugins ) {
		foreach ( $posted_plugins as $posted_plugin ) {
			$this->compare_plugin( $posted_plugin );
		}
	}

	/**
	 * Check if plugin is already dismissed, if not store it in the array that will be saved later.
	 *
	 * @param string $posted_plugin Plugin to check against dismissed conflicts.
	 */
	private function compare_plugin( $posted_plugin ) {
		if ( ! in_array( $posted_plugin, $this->dismissed_conflicts, true ) ) {
			$this->dismissed_conflicts[] = $posted_plugin;
		}
	}
}
PK     ”T]ÁA�
    .  class-admin-asset-analysis-worker-location.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents a way to determine the analysis worker asset location.
 */
final class WPSEO_Admin_Asset_Analysis_Worker_Location implements WPSEO_Admin_Asset_Location {

	/**
	 * @var WPSEO_Admin_Asset_Location $asset_location.
	 */
	private $asset_location;

	/**
	 * @var WPSEO_Admin_Asset $asset.
	 */
	private $asset;

	/**
	 * Constructs the location of the analysis worker asset.
	 *
	 * @param string $flat_version The flat version of the asset.
	 * @param string $name         The name of the analysis worker asset.
	 */
	public function __construct( $flat_version = '', $name = 'analysis-worker' ) {
		if ( $flat_version === '' ) {
			$asset_manager = new WPSEO_Admin_Asset_Manager();
			$flat_version  = $asset_manager->flatten_version( WPSEO_VERSION );
		}

		$analysis_worker = 'wp-seo-' . $name . '-' . $flat_version;

		$this->asset_location = WPSEO_Admin_Asset_Manager::create_default_location();
		$this->asset          = new WPSEO_Admin_Asset(
			array(
				'name' => $name,
				'src'  => $analysis_worker,
			)
		);
	}

	/**
	 * Retrieves the analysis worker asset.
	 *
	 * @return WPSEO_Admin_Asset The analysis worker asset.
	 */
	public function get_asset() {
		return $this->asset;
	}

	/**
	 * Determines the URL of the asset on the dev server.
	 *
	 * @param WPSEO_Admin_Asset $asset The asset to determine the URL for.
	 * @param string            $type  The type of asset. Usually JS or CSS.
	 *
	 * @return string The URL of the asset.
	 */
	public function get_url( WPSEO_Admin_Asset $asset, $type ) {
		$scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
		if ( in_array( $scheme, array( 'http', 'https' ), true ) ) {
			return $asset->get_src();
		}

		return $this->asset_location->get_url( $asset, $type );
	}
}
PK     ”T]Ç2ñfµ  µ  '  endpoints/class-endpoint-statistics.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Statistics
 */

/**
 * Represents an implementation of the WPSEO_Endpoint interface to register one or multiple endpoints.
 */
class WPSEO_Endpoint_Statistics implements WPSEO_Endpoint {

	/**
	 * @var string
	 */
	const REST_NAMESPACE = 'yoast/v1';

	/**
	 * @var string
	 */
	const ENDPOINT_RETRIEVE = 'statistics';

	/**
	 * @var string
	 */
	const CAPABILITY_RETRIEVE = 'read';

	/**
	 * Service to use.
	 *
	 * @var WPSEO_Statistics_Service
	 */
	protected $service;

	/**
	 * Constructs the WPSEO_Endpoint_Statistics class and sets the service to use.
	 *
	 * @param WPSEO_Statistics_Service $service Service to use.
	 */
	public function __construct( WPSEO_Statistics_Service $service ) {
		$this->service = $service;
	}

	/**
	 * Registers the REST routes that are available on the endpoint.
	 */
	public function register() {
		// Register fetch config.
		$route_args = array(
			'methods'             => 'GET',
			'callback'            => array( $this->service, 'get_statistics' ),
			'permission_callback' => array( $this, 'can_retrieve_data' ),
		);
		register_rest_route( self::REST_NAMESPACE, self::ENDPOINT_RETRIEVE, $route_args );
	}

	/**
	 * Determines whether or not data can be retrieved for the registered endpoints.
	 *
	 * @return bool Whether or not data can be retrieved.
	 */
	public function can_retrieve_data() {
		return current_user_can( self::CAPABILITY_RETRIEVE );
	}
}
PK     ”T]ë(æ/  /  &  endpoints/class-endpoint-file-size.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Endpoints
 */

/**
 * Represents an implementation of the WPSEO_Endpoint interface to register one or multiple endpoints.
 */
class WPSEO_Endpoint_File_Size implements WPSEO_Endpoint {

	/**
	 * @var string
	 */
	const REST_NAMESPACE = 'yoast/v1';

	/**
	 * @var string
	 */
	const ENDPOINT_SINGULAR = 'file_size';

	/**
	 * @var string
	 */
	const CAPABILITY_RETRIEVE = 'manage_options';

	/**
	 * The service provider.
	 *
	 * @var WPSEO_File_Size_Service
	 */
	private $service;

	/**
	 * Sets the service provider.
	 *
	 * @param WPSEO_File_Size_Service $service The service provider.
	 */
	public function __construct( WPSEO_File_Size_Service $service ) {
		$this->service = $service;
	}

	/**
	 * Registers the routes for the endpoints.
	 *
	 * @return void
	 */
	public function register() {
		$route_args = array(
			'methods'             => 'GET',
			'args'                => array(
				'url' => array(
					'required'    => true,
					'type'        => 'string',
					'description' => 'The url to retrieve',
				),
			),
			'callback'            => array(
				$this->service,
				'get',
			),
			'permission_callback' => array(
				$this,
				'can_retrieve_data',
			),
		);
		register_rest_route( self::REST_NAMESPACE, self::ENDPOINT_SINGULAR, $route_args );
	}

	/**
	 * Determines whether or not data can be retrieved for the registered endpoints.
	 *
	 * @return bool Whether or not data can be retrieved.
	 */
	public function can_retrieve_data() {
		return current_user_can( self::CAPABILITY_RETRIEVE );
	}
}
PK     ”T]‘à€—  —  !  endpoints/class-endpoint-ryte.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\OnPage
 */

/**
 * Represents an implementation of the WPSEO_Endpoint interface to register one or multiple endpoints.
 */
class WPSEO_Endpoint_Ryte implements WPSEO_Endpoint {

	/**
	 * @var string
	 */
	const REST_NAMESPACE = 'yoast/v1';

	/**
	 * @var string
	 */
	const ENDPOINT_RETRIEVE = 'ryte';

	/**
	 * @var string
	 */
	const CAPABILITY_RETRIEVE = 'manage_options';

	/**
	 * Service to use.
	 *
	 * @var WPSEO_Ryte_Service
	 */
	protected $service;

	/**
	 * Constructs the WPSEO_Endpoint_Ryte class and sets the service to use.
	 *
	 * @param WPSEO_Ryte_Service $service Service to use.
	 */
	public function __construct( WPSEO_Ryte_Service $service ) {
		$this->service = $service;
	}

	/**
	 * Registers the REST routes that are available on the endpoint.
	 */
	public function register() {
		// Register fetch config.
		$route_args = array(
			'methods'             => 'GET',
			'callback'            => array( $this->service, 'get_statistics' ),
			'permission_callback' => array( $this, 'can_retrieve_data' ),
		);
		register_rest_route( self::REST_NAMESPACE, self::ENDPOINT_RETRIEVE, $route_args );
	}

	/**
	 * Determines whether or not data can be retrieved for the registered endpoints.
	 *
	 * @return bool Whether or not data can be retrieved.
	 */
	public function can_retrieve_data() {
		return current_user_can( self::CAPABILITY_RETRIEVE );
	}
}
PK     ”T]šM{m  m  )  endpoints/interface-endpoint-storable.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Endpoints
 */

/**
 * Dictates the required methods for a storable implementation.
 */
interface WPSEO_Endpoint_Storable {

	/**
	 * Determines whether or not data can be stored for the registered endpoints.
	 *
	 * @return bool Whether or not data can be stored.
	 */
	public function can_store_data();
}
PK     ”T]�SÊ‰í   í     endpoints/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ”T]MûU³  ³  &  endpoints/class-endpoint-indexable.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Endpoints
 */

/**
 * Represents an implementation of the WPSEO_Endpoint interface to register one or multiple endpoints.
 */
class WPSEO_Endpoint_Indexable implements WPSEO_Endpoint, WPSEO_Endpoint_Storable {

	/**
	 * @var string
	 */
	const REST_NAMESPACE = 'yoast/v1';

	/**
	 * @var string
	 */
	const ENDPOINT_SINGULAR = 'indexables/(?P<object_type>\w+)/(?P<object_id>\d+)';

	/**
	 * @var string
	 */
	const CAPABILITY_RETRIEVE = 'manage_options';

	/**
	 * @var string
	 */
	const CAPABILITY_STORE = 'manage_options';

	/**
	 * The indexable service.
	 *
	 * @var WPSEO_Indexable_Service
	 */
	private $service;

	/**
	 * Sets the service provider.
	 *
	 * @param WPSEO_Indexable_Service $service The service provider.
	 */
	public function __construct( WPSEO_Indexable_Service $service ) {
		$this->service = $service;
	}

	/**
	 * Registers the routes for the endpoints.
	 *
	 * @return void
	 */
	public function register() {
		$endpoints = array();

		$endpoints[] = new WPSEO_Endpoint_Factory(
			self::REST_NAMESPACE,
			self::ENDPOINT_SINGULAR,
			array( $this->service, 'get_indexable' ),
			array( $this, 'can_retrieve_data' )
		);

		$endpoints[] = new WPSEO_Endpoint_Factory(
			self::REST_NAMESPACE,
			self::ENDPOINT_SINGULAR,
			array( $this->service, 'patch_indexable' ),
			array( $this, 'can_store_data' ),
			'PATCH'
		);

		foreach ( $endpoints as $endpoint ) {
			$endpoint->register();
		}
	}

	/**
	 * Determines whether or not data can be retrieved for the registered endpoints.
	 *
	 * @return bool Whether or not data can be retrieved.
	 */
	public function can_retrieve_data() {
		return current_user_can( self::CAPABILITY_RETRIEVE );
	}

	/**
	 * Determines whether or not data can be stored for the registered endpoints.
	 *
	 * @return bool Whether or not data can be stored.
	 */
	public function can_store_data() {
		return current_user_can( self::CAPABILITY_STORE );
	}
}
PK     ”T]MC(W×  ×    endpoints/class-endpoint.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Endpoints
 */

/**
 * Dictates the required methods for an Endpoint implementation.
 */
interface WPSEO_Endpoint {

	/**
	 * Registers the routes for the endpoints.
	 *
	 * @return void
	 */
	public function register();

	/**
	 * Determines whether or not data can be retrieved for the registered endpoints.
	 *
	 * @return bool Whether or not data can be retrieved.
	 */
	public function can_retrieve_data();
}
PK     ”T]XË¯l�^  �^    class-yoast-form.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Admin form class.
 *
 * @since 2.0
 */
class Yoast_Form {

	/**
	 * Instance of this class
	 *
	 * @var object
	 * @since 2.0
	 */
	public static $instance;

	/**
	 * @var string
	 * @since 2.0
	 */
	public $option_name;

	/**
	 * @var array
	 * @since 2.0
	 */
	public $options = array();

	/**
	 * Option instance.
	 *
	 * @since 8.4
	 * @var WPSEO_Option|null
	 */
	protected $option_instance = null;

	/**
	 * Get the singleton instance of this class.
	 *
	 * @since 2.0
	 *
	 * @return Yoast_Form
	 */
	public static function get_instance() {
		if ( ! ( self::$instance instanceof self ) ) {
			self::$instance = new self();
		}

		return self::$instance;
	}

	/**
	 * Generates the header for admin pages.
	 *
	 * @since 2.0
	 *
	 * @param bool   $form             Whether or not the form start tag should be included.
	 * @param string $option           The short name of the option to use for the current page.
	 * @param bool   $contains_files   Whether the form should allow for file uploads.
	 * @param bool   $option_long_name Group name of the option.
	 */
	public function admin_header( $form = true, $option = 'wpseo', $contains_files = false, $option_long_name = false ) {
		if ( ! $option_long_name ) {
			$option_long_name = WPSEO_Options::get_group_name( $option );
		}
		?>
		<div class="wrap yoast wpseo-admin-page <?php echo esc_attr( 'page-' . $option ); ?>">
		<?php
		/**
		 * Display the updated/error messages.
		 * Only needed as our settings page is not under options, otherwise it will automatically be included.
		 *
		 * @see settings_errors()
		 */
		require_once ABSPATH . 'wp-admin/options-head.php';
		?>
		<h1 id="wpseo-title"><?php echo esc_html( get_admin_page_title() ); ?></h1>
		<div class="wpseo_content_wrapper">
		<div class="wpseo_content_cell" id="wpseo_content_top">
		<?php
		if ( $form === true ) {
			$enctype = ( $contains_files ) ? ' enctype="multipart/form-data"' : '';

			$network_admin = new Yoast_Network_Admin();
			if ( $network_admin->meets_requirements() ) {
				$action_url       = network_admin_url( 'settings.php' );
				$hidden_fields_cb = array( $network_admin, 'settings_fields' );
			}
			else {
				$action_url       = admin_url( 'options.php' );
				$hidden_fields_cb = 'settings_fields';
			}

			echo '<form action="' . esc_url( $action_url ) . '" method="post" id="wpseo-conf"' . $enctype . ' accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">';
			call_user_func( $hidden_fields_cb, $option_long_name );
		}
		$this->set_option( $option );
	}

	/**
	 * Set the option used in output for form elements.
	 *
	 * @since 2.0
	 *
	 * @param string $option_name Option key.
	 */
	public function set_option( $option_name ) {
		$this->option_name = $option_name;

		$this->options = WPSEO_Options::get_option( $option_name );
		if ( $this->options === null ) {
			$this->options = (array) get_option( $option_name, array() );
		}

		$this->option_instance = WPSEO_Options::get_option_instance( $option_name );
		if ( ! $this->option_instance ) {
			$this->option_instance = null;
		}
	}

	/**
	 * Sets a value in the options.
	 *
	 * @since 5.4
	 *
	 * @param string $key       The key of the option to set.
	 * @param mixed  $value     The value to set the option to.
	 * @param bool   $overwrite Whether to overwrite existing options. Default is false.
	 */
	public function set_options_value( $key, $value, $overwrite = false ) {
		if ( $overwrite || ! array_key_exists( $key, $this->options ) ) {
			$this->options[ $key ] = $value;
		}
	}

	/**
	 * Generates the footer for admin pages.
	 *
	 * @since 2.0
	 *
	 * @param bool $submit       Whether or not a submit button and form end tag should be shown.
	 * @param bool $show_sidebar Whether or not to show the banner sidebar - used by premium plugins to disable it.
	 */
	public function admin_footer( $submit = true, $show_sidebar = true ) {
		if ( $submit ) {
			submit_button( __( 'Save changes', 'wordpress-seo' ) );

			echo '
			</form>';
		}

		/**
		 * Apply general admin_footer hooks.
		 */
		do_action( 'wpseo_admin_footer', $this );

		/**
		 * Run possibly set actions to add for example an i18n box.
		 */
		do_action( 'wpseo_admin_promo_footer' );

		echo '
			</div><!-- end of div wpseo_content_top -->';

		if ( $show_sidebar ) {
			$this->admin_sidebar();
		}

		echo '</div><!-- end of div wpseo_content_wrapper -->';

		do_action( 'wpseo_admin_below_content', $this );

		echo '
			</div><!-- end of wrap -->';
	}

	/**
	 * Generates the sidebar for admin pages.
	 *
	 * @since 2.0
	 */
	public function admin_sidebar() {
		// No banners in Premium.
		$addon_manager = new WPSEO_Addon_Manager();
		if ( WPSEO_Utils::is_yoast_seo_premium() && $addon_manager->has_valid_subscription( WPSEO_Addon_Manager::PREMIUM_SLUG ) ) {
			return;
		}

		require_once 'views/sidebar.php';
	}

	/**
	 * Output a label element.
	 *
	 * @since 2.0
	 *
	 * @param string $text Label text string.
	 * @param array  $attr HTML attributes set.
	 */
	public function label( $text, $attr ) {
		$defaults = array(
			'class'      => 'checkbox',
			'close'      => true,
			'for'        => '',
			'aria_label' => '',
		);

		$attr       = wp_parse_args( $attr, $defaults );
		$aria_label = '';
		if ( $attr['aria_label'] !== '' ) {
			$aria_label = ' aria-label="' . esc_attr( $attr['aria_label'] ) . '"';
		}

		echo "<label class='" . esc_attr( $attr['class'] ) . "' for='" . esc_attr( $attr['for'] ) . "'$aria_label>$text";
		if ( $attr['close'] ) {
			echo '</label>';
		}
	}

	/**
	 * Output a legend element.
	 *
	 * @since 3.4
	 *
	 * @param string $text Legend text string.
	 * @param array  $attr HTML attributes set.
	 */
	public function legend( $text, $attr ) {
		$defaults = array(
			'id'    => '',
			'class' => '',
		);
		$attr     = wp_parse_args( $attr, $defaults );

		$id = ( '' === $attr['id'] ) ? '' : ' id="' . esc_attr( $attr['id'] ) . '"';
		echo '<legend class="yoast-form-legend ' . esc_attr( $attr['class'] ) . '"' . $id . '>' . $text . '</legend>';
	}

	/**
	 * Create a Checkbox input field.
	 *
	 * @since 2.0
	 *
	 * @param string $var        The variable within the option to create the checkbox for.
	 * @param string $label      The label to show for the variable.
	 * @param bool   $label_left Whether the label should be left (true) or right (false).
	 */
	public function checkbox( $var, $label, $label_left = false ) {
		if ( ! isset( $this->options[ $var ] ) ) {
			$this->options[ $var ] = false;
		}

		if ( $this->options[ $var ] === true ) {
			$this->options[ $var ] = 'on';
		}

		$class = '';
		if ( $label_left !== false ) {
			if ( ! empty( $label_left ) ) {
				$label_left .= ':';
			}
			$this->label( $label_left, array( 'for' => $var ) );
		}
		else {
			$class = 'double';
		}

		echo '<input class="checkbox ', esc_attr( $class ), '" type="checkbox" id="', esc_attr( $var ), '" name="', esc_attr( $this->option_name ), '[', esc_attr( $var ), ']" value="on"', checked( $this->options[ $var ], 'on', false ), disabled( $this->is_control_disabled( $var ), true, false ), '/>';

		if ( ! empty( $label ) ) {
			$this->label( $label, array( 'for' => $var ) );
		}

		echo '<br class="clear" />';
	}

	/**
	 * Create a light switch input field using a single checkbox.
	 *
	 * @since 3.1
	 *
	 * @param string $var     The variable within the option to create the checkbox for.
	 * @param string $label   The label element text for the checkbox.
	 * @param array  $buttons Array of two visual labels for the buttons (defaults Disabled/Enabled).
	 * @param bool   $reverse Reverse order of buttons (default true).
	 * @param string $help    Inline Help that will be printed out before the visible toggles text.
	 */
	public function light_switch( $var, $label, $buttons = array(), $reverse = true, $help = '' ) {

		if ( ! isset( $this->options[ $var ] ) ) {
			$this->options[ $var ] = false;
		}

		if ( $this->options[ $var ] === true ) {
			$this->options[ $var ] = 'on';
		}

		$class = 'switch-light switch-candy switch-yoast-seo';

		if ( $reverse ) {
			$class .= ' switch-yoast-seo-reverse';
		}

		if ( empty( $buttons ) ) {
			$buttons = array( __( 'Disabled', 'wordpress-seo' ), __( 'Enabled', 'wordpress-seo' ) );
		}

		list( $off_button, $on_button ) = $buttons;

		$help_class               = '';
		$screen_reader_text_class = '';

		$help_class = ! empty( $help ) ? ' switch-container__has-help' : '';

		echo '<div class="switch-container', $help_class, '">',
		'<span class="switch-light-visual-label" id="', esc_attr( $var . '-label' ), '">', esc_html( $label ), '</span>' . $help,
		'<label class="', $class, '"><b class="switch-yoast-seo-jaws-a11y">&nbsp;</b>',
		'<input type="checkbox" aria-labelledby="', esc_attr( $var . '-label' ), '" id="', esc_attr( $var ), '" name="', esc_attr( $this->option_name ), '[', esc_attr( $var ), ']" value="on"', checked( $this->options[ $var ], 'on', false ), disabled( $this->is_control_disabled( $var ), true, false ), '/>',
		'<span aria-hidden="true">
			<span>', esc_html( $off_button ) ,'</span>
			<span>', esc_html( $on_button ) ,'</span>
			<a></a>
		 </span>
		 </label><div class="clear"></div></div>';
	}

	/**
	 * Create a Text input field.
	 *
	 * @since 2.0
	 * @since 2.1 Introduced the `$attr` parameter.
	 *
	 * @param string       $var   The variable within the option to create the text input field for.
	 * @param string       $label The label to show for the variable.
	 * @param array|string $attr  Extra attributes to add to the input field. Can be class, disabled, autocomplete.
	 */
	public function textinput( $var, $label, $attr = array() ) {
		if ( ! is_array( $attr ) ) {
			$attr = array(
				'class'    => $attr,
				'disabled' => false,
			);
		}

		$defaults   = array(
			'placeholder' => '',
			'class'       => '',
		);
		$attr       = wp_parse_args( $attr, $defaults );
		$val        = isset( $this->options[ $var ] ) ? $this->options[ $var ] : '';
		$attributes = isset( $attr['autocomplete'] ) ? ' autocomplete="' . esc_attr( $attr['autocomplete'] ) . '"' : '';
		if ( isset( $attr['disabled'] ) && $attr['disabled'] ) {
			$attributes .= ' disabled';
		}

		$this->label(
			$label . ':',
			array(
				'for'   => $var,
				'class' => 'textinput',
			)
		);
		echo '<input' . $attributes . ' class="textinput ' . esc_attr( $attr['class'] ) . ' " placeholder="' . esc_attr( $attr['placeholder'] ) . '" type="text" id="', esc_attr( $var ), '" name="', esc_attr( $this->option_name ), '[', esc_attr( $var ), ']" value="', esc_attr( $val ), '"', disabled( $this->is_control_disabled( $var ), true, false ), '/>', '<br class="clear" />';
	}

	/**
	 * Create a textarea.
	 *
	 * @since 2.0
	 *
	 * @param string       $var   The variable within the option to create the textarea for.
	 * @param string       $label The label to show for the variable.
	 * @param string|array $attr  The CSS class or an array of attributes to assign to the textarea.
	 */
	public function textarea( $var, $label, $attr = array() ) {
		if ( ! is_array( $attr ) ) {
			$attr = array(
				'class' => $attr,
			);
		}

		$defaults = array(
			'cols'  => '',
			'rows'  => '',
			'class' => '',
		);
		$attr     = wp_parse_args( $attr, $defaults );
		$val      = ( isset( $this->options[ $var ] ) ) ? $this->options[ $var ] : '';

		$this->label(
			$label . ':',
			array(
				'for'   => $var,
				'class' => 'textinput',
			)
		);
		echo '<textarea cols="' . esc_attr( $attr['cols'] ) . '" rows="' . esc_attr( $attr['rows'] ) . '" class="textinput ' . esc_attr( $attr['class'] ) . '" id="' . esc_attr( $var ) . '" name="' . esc_attr( $this->option_name ) . '[' . esc_attr( $var ) . ']"', disabled( $this->is_control_disabled( $var ), true, false ), '>' . esc_textarea( $val ) . '</textarea><br class="clear" />';
	}

	/**
	 * Create a hidden input field.
	 *
	 * @since 2.0
	 *
	 * @param string $var The variable within the option to create the hidden input for.
	 * @param string $id  The ID of the element.
	 */
	public function hidden( $var, $id = '' ) {
		$val = ( isset( $this->options[ $var ] ) ) ? $this->options[ $var ] : '';
		if ( is_bool( $val ) ) {
			$val = ( $val === true ) ? 'true' : 'false';
		}

		if ( '' === $id ) {
			$id = 'hidden_' . $var;
		}

		echo '<input type="hidden" id="' . esc_attr( $id ) . '" name="' . esc_attr( $this->option_name ) . '[' . esc_attr( $var ) . ']" value="' . esc_attr( $val ) . '"/>';
	}

	/**
	 * Create a Select Box.
	 *
	 * @since 2.0
	 *
	 * @param string $var            The variable within the option to create the select for.
	 * @param string $label          The label to show for the variable.
	 * @param array  $select_options The select options to choose from.
	 * @param string $styled         The select style. Use 'styled' to get a styled select. Default 'unstyled'.
	 * @param bool   $show_label     Whether or not to show the label, if not, it will be applied as an aria-label.
	 */
	public function select( $var, $label, array $select_options, $styled = 'unstyled', $show_label = true ) {

		if ( empty( $select_options ) ) {
			return;
		}

		if ( $show_label ) {
			$this->label(
				$label . ':',
				array(
					'for'   => $var,
					'class' => 'select',

				)
			);
		}

		$select_name       = esc_attr( $this->option_name ) . '[' . esc_attr( $var ) . ']';
		$active_option     = ( isset( $this->options[ $var ] ) ) ? $this->options[ $var ] : '';
		$wrapper_start_tag = '';
		$wrapper_end_tag   = '';

		$select = new Yoast_Input_Select( $var, $select_name, $select_options, $active_option );
		$select->add_attribute( 'class', 'select' );
		if ( $this->is_control_disabled( $var ) ) {
			$select->add_attribute( 'disabled', 'disabled' );
		}
		if ( ! $show_label ) {
			$select->add_attribute( 'aria-label', $label );
		}

		if ( $styled === 'styled' ) {
			$wrapper_start_tag = '<span class="yoast-styled-select">';
			$wrapper_end_tag   = '</span>';
		}

		echo $wrapper_start_tag;
		$select->output_html();
		echo $wrapper_end_tag;
		echo '<br class="clear"/>';
	}

	/**
	 * Create a File upload field.
	 *
	 * @since 2.0
	 *
	 * @param string $var   The variable within the option to create the file upload field for.
	 * @param string $label The label to show for the variable.
	 */
	public function file_upload( $var, $label ) {
		$val = '';
		if ( isset( $this->options[ $var ] ) && is_array( $this->options[ $var ] ) ) {
			$val = $this->options[ $var ]['url'];
		}

		$var_esc = esc_attr( $var );
		$this->label(
			$label . ':',
			array(
				'for'   => $var,
				'class' => 'select',
			)
		);
		echo '<input type="file" value="' . esc_attr( $val ) . '" class="textinput" name="' . esc_attr( $this->option_name ) . '[' . $var_esc . ']" id="' . $var_esc . '"', disabled( $this->is_control_disabled( $var ), true, false ), '/>';

		// Need to save separate array items in hidden inputs, because empty file inputs type will be deleted by settings API.
		if ( ! empty( $this->options[ $var ] ) ) {
			$this->hidden( 'file', $this->option_name . '_file' );
			$this->hidden( 'url', $this->option_name . '_url' );
			$this->hidden( 'type', $this->option_name . '_type' );
		}
		echo '<br class="clear"/>';
	}

	/**
	 * Media input.
	 *
	 * @since 2.0
	 *
	 * @param string $var   Option name.
	 * @param string $label Label message.
	 */
	public function media_input( $var, $label ) {
		$val = '';
		if ( isset( $this->options[ $var ] ) ) {
			$val = $this->options[ $var ];
		}

		$id_value = '';
		if ( isset( $this->options[ $var . '_id' ] ) ) {
			$id_value = $this->options[ $var . '_id' ];
		}

		$var_esc = esc_attr( $var );

		$this->label(
			$label . ':',
			array(
				'for'   => 'wpseo_' . $var,
				'class' => 'select',
			)
		);

		$id_field_id = 'wpseo_' . $var_esc . '_id';

		echo '<span>';
			echo '<input',
				' class="textinput"',
				' id="wpseo_', $var_esc, '"',
				' type="text" size="36"',
				' name="', esc_attr( $this->option_name ), '[', $var_esc, ']"',
				' value="', esc_attr( $val ), '"',
				' readonly="readonly"',
				' /> ';
			echo '<input',
				' id="wpseo_', $var_esc, '_button"',
				' class="wpseo_image_upload_button button"',
				' type="button"',
				' value="', esc_attr__( 'Upload Image', 'wordpress-seo' ), '"',
				' data-target-id="', esc_attr( $id_field_id ), '"',
				disabled( $this->is_control_disabled( $var ), true, false ),
				' /> ';
			echo '<input',
				' class="wpseo_image_remove_button button"',
				' type="button"',
				' value="', esc_attr__( 'Clear Image', 'wordpress-seo' ), '"',
				disabled( $this->is_control_disabled( $var ), true, false ),
				' />';
			echo '<input',
				' type="hidden"',
				' id="', esc_attr( $id_field_id ), '"',
				' name="', esc_attr( $this->option_name ), '[', $var_esc, '_id]"',
				' value="', esc_attr( $id_value ), '"',
				' />';
		echo '</span>';
		echo '<br class="clear"/>';
	}

	/**
	 * Create a Radio input field.
	 *
	 * @since 2.0
	 *
	 * @param string $var         The variable within the option to create the radio button for.
	 * @param array  $values      The radio options to choose from.
	 * @param string $legend      Optional. The legend to show for the field set, if any.
	 * @param array  $legend_attr Optional. The attributes for the legend, if any.
	 */
	public function radio( $var, $values, $legend = '', $legend_attr = array() ) {
		if ( ! is_array( $values ) || $values === array() ) {
			return;
		}
		if ( ! isset( $this->options[ $var ] ) ) {
			$this->options[ $var ] = false;
		}

		$var_esc = esc_attr( $var );

		echo '<fieldset class="yoast-form-fieldset wpseo_radio_block" id="' . $var_esc . '">';

		if ( is_string( $legend ) && '' !== $legend ) {

			$defaults = array(
				'id'    => '',
				'class' => 'radiogroup',
			);

			$legend_attr = wp_parse_args( $legend_attr, $defaults );

			$this->legend( $legend, $legend_attr );
		}

		foreach ( $values as $key => $value ) {
			$label      = $value;
			$aria_label = '';

			if ( is_array( $value ) ) {
				$label      = isset( $value['label'] ) ? $value['label'] : '';
				$aria_label = isset( $value['aria_label'] ) ? $value['aria_label'] : '';
			}

			$key_esc = esc_attr( $key );
			echo '<input type="radio" class="radio" id="' . $var_esc . '-' . $key_esc . '" name="' . esc_attr( $this->option_name ) . '[' . $var_esc . ']" value="' . $key_esc . '" ' . checked( $this->options[ $var ], $key_esc, false ) . disabled( $this->is_control_disabled( $var ), true, false ) . ' />';
			$this->label(
				$label,
				array(
					'for'        => $var_esc . '-' . $key_esc,
					'class'      => 'radio',
					'aria_label' => $aria_label,
				)
			);
		}
		echo '</fieldset>';
	}

	/**
	 * Create a toggle switch input field using two radio buttons.
	 *
	 * @since 3.1
	 *
	 * @param string $var    The variable within the option to create the radio buttons for.
	 * @param array  $values Associative array of on/off keys and their values to be used as
	 *                       the label elements text for the radio buttons. Optionally, each
	 *                       value can be an array of visible label text and screen reader text.
	 * @param string $label  The visual label for the radio buttons group, used as the fieldset legend.
	 * @param string $help   Inline Help that will be printed out before the visible toggles text.
	 */
	public function toggle_switch( $var, $values, $label, $help = '' ) {
		if ( ! is_array( $values ) || $values === array() ) {
			return;
		}
		if ( ! isset( $this->options[ $var ] ) ) {
			$this->options[ $var ] = false;
		}
		if ( $this->options[ $var ] === true ) {
			$this->options[ $var ] = 'on';
		}
		if ( $this->options[ $var ] === false ) {
			$this->options[ $var ] = 'off';
		}

		$help_class = ! empty( $help ) ? ' switch-container__has-help' : '';

		$var_esc = esc_attr( $var );

		printf( '<div class="%s">', esc_attr( 'switch-container' . $help_class ) );
		echo '<fieldset id="', $var_esc, '" class="fieldset-switch-toggle"><legend>', $label, '</legend>', $help;

		echo $this->get_disabled_note( $var );
		echo '<div class="switch-toggle switch-candy switch-yoast-seo">';

		foreach ( $values as $key => $value ) {
			$screen_reader_text_html = '';

			if ( is_array( $value ) ) {
				$screen_reader_text      = $value['screen_reader_text'];
				$screen_reader_text_html = '<span class="screen-reader-text"> ' . esc_html( $screen_reader_text ) . '</span>';
				$value                   = $value['text'];
			}

			$key_esc = esc_attr( $key );
			$for     = $var_esc . '-' . $key_esc;
			echo '<input type="radio" id="' . $for . '" name="' . esc_attr( $this->option_name ) . '[' . $var_esc . ']" value="' . $key_esc . '" ' . checked( $this->options[ $var ], $key_esc, false ) . disabled( $this->is_control_disabled( $var ), true, false ) . ' />',
			'<label for="', $for, '">', esc_html( $value ), $screen_reader_text_html,'</label>';
		}

		echo '<a></a></div></fieldset><div class="clear"></div></div>' . PHP_EOL . PHP_EOL;
	}

	/**
	 * Creates a toggle switch to define whether an indexable should be indexed or not.
	 *
	 * @param string $var   The variable within the option to create the radio buttons for.
	 * @param string $label The visual label for the radio buttons group, used as the fieldset legend.
	 * @param string $help  Inline Help that will be printed out before the visible toggles text.
	 *
	 * @return void
	 */
	public function index_switch( $var, $label, $help = '' ) {
		$index_switch_values = array(
			'off' => __( 'Yes', 'wordpress-seo' ),
			'on'  => __( 'No', 'wordpress-seo' ),
		);

		$this->toggle_switch(
			$var,
			$index_switch_values,
			sprintf(
				/* translators: %s expands to an indexable object's name, like a post type or taxonomy */
				esc_html__( 'Show %s in search results?', 'wordpress-seo' ),
				'<strong>' . esc_html( $label ) . '</strong>'
			),
			$help
		);
	}

	/**
	 * Creates a toggle switch to show hide certain options.
	 *
	 * @param string $var          The variable within the option to create the radio buttons for.
	 * @param string $label        The visual label for the radio buttons group, used as the fieldset legend.
	 * @param bool   $inverse_keys Whether or not the option keys need to be inverted to support older functions.
	 * @param string $help         Inline Help that will be printed out before the visible toggles text.
	 *
	 * @return void
	 */
	public function show_hide_switch( $var, $label, $inverse_keys = false, $help = '' ) {
		$on_key  = ( $inverse_keys ) ? 'off' : 'on';
		$off_key = ( $inverse_keys ) ? 'on' : 'off';

		$show_hide_switch = array(
			$on_key  => __( 'Show', 'wordpress-seo' ),
			$off_key => __( 'Hide', 'wordpress-seo' ),
		);

		$this->toggle_switch( $var, $show_hide_switch, $label, $help );
	}

	/**
	 * Checks whether a given control should be disabled.
	 *
	 * @param string $var The variable within the option to check whether its control should be disabled.
	 *
	 * @return bool True if control should be disabled, false otherwise.
	 */
	protected function is_control_disabled( $var ) {
		if ( $this->option_instance === null ) {
			return false;
		}

		return $this->option_instance->is_disabled( $var );
	}

	/**
	 * Gets the explanation note to print if a given control is disabled.
	 *
	 * @param string $var The variable within the option to print a disabled note for.
	 *
	 * @return string Explanation note HTML string, or empty string if no note necessary.
	 */
	protected function get_disabled_note( $var ) {
		if ( ! $this->is_control_disabled( $var ) ) {
			return '';
		}

		return '<p class="disabled-note">' . esc_html__( 'This feature has been disabled by the network admin.', 'wordpress-seo' ) . '</p>';
	}

	/* ********************* DEPRECATED METHODS ********************* */

	/**
	 * Retrieve options based on whether we're on multisite or not.
	 *
	 * @since 1.2.4
	 * @since 2.0   Moved to this class.
	 * @deprecated 8.4
	 * @codeCoverageIgnore
	 *
	 * @return array The option's value.
	 */
	public function get_option() {
		_deprecated_function( __METHOD__, 'WPSEO 8.4' );

		if ( is_network_admin() ) {
			return get_site_option( $this->option_name );
		}

		return get_option( $this->option_name );
	}
}
PK     ”T]�Ž¼	1  1    class-extensions.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Represents the class that contains the list of possible extensions for Yoast SEO.
 */
class WPSEO_Extensions {

	/**
	 * Array with the Yoast extensions.
	 *
	 * @var array
	 */
	protected $extensions = array(
		'Yoast SEO Premium' => array(
			'slug'          => 'yoast-seo-premium',
			'identifier'    => 'wordpress-seo-premium',
			'classname'     => 'WPSEO_Premium',
			'my-yoast-slug' => WPSEO_Addon_Manager::PREMIUM_SLUG,
		),
		'News SEO' => array(
			'slug'          => 'news-seo',
			'identifier'    => 'wpseo-news',
			'classname'     => 'WPSEO_News',
			'my-yoast-slug' => WPSEO_Addon_Manager::NEWS_SLUG,
		),
		'Yoast WooCommerce SEO' => array(
			'slug'          => 'woocommerce-yoast-seo',
			'identifier'    => 'wpseo-woocommerce',
			'classname'     => 'Yoast_WooCommerce_SEO',
			'my-yoast-slug' => WPSEO_Addon_Manager::WOOCOMMERCE_SLUG,
		),
		'Video SEO' => array(
			'slug'          => 'video-seo-for-wordpress',
			'identifier'    => 'wpseo-video',
			'classname'     => 'WPSEO_Video_Sitemap',
			'my-yoast-slug' => WPSEO_Addon_Manager::VIDEO_SLUG,
		),
		'Local SEO' => array(
			'slug'          => 'local-seo-for-wordpress',
			'identifier'    => 'wpseo-local',
			'classname'     => 'WPSEO_Local_Core',
			'my-yoast-slug' => WPSEO_Addon_Manager::LOCAL_SLUG,
		),
	);

	/**
	 * Returns the set extensions.
	 *
	 * @return array All the extension names.
	 */
	public function get() {
		return array_keys( $this->extensions );
	}

	/**
	 * Checks if the extension is valid.
	 *
	 * @param string $extension The extension to get the name for.
	 *
	 * @return bool Returns true when valid.
	 */
	public function is_valid( $extension ) {
		$addon_manager = new WPSEO_Addon_Manager();
		return $addon_manager->has_valid_subscription( $this->extensions[ $extension ]['my-yoast-slug'] );
	}

	/**
	 * Invalidates the extension by removing its option.
	 *
	 * @param string $extension The extension to invalidate.
	 */
	public function invalidate( $extension ) {
		/*
		 * Make sure we clear the current site and multisite options.
		 *
		 * Because plugins can be site-activated or multi-site activated we need to clear
		 * all possible options.
		 *
		 * If we knew here that the extension in question was network activated
		 * we could do this a lot more easily.
		 */
		delete_option( $this->get_option_name( $extension ) );
		delete_site_option( $this->get_option_name( $extension ) );
	}

	/**
	 * Checks if the plugin has been installed.
	 *
	 * @param string $extension The name of the plugin to check.
	 *
	 * @return bool Returns true when installed.
	 */
	public function is_installed( $extension ) {
		return class_exists( $this->extensions[ $extension ]['classname'] );
	}

	/**
	 * Converts the extension to the required option name.
	 *
	 * @param string $extension The extension name to convert.
	 *
	 * @return string Returns the option name.
	 */
	protected function get_option_name( $extension ) {
		return sanitize_title_with_dashes( $this->extensions[ $extension ]['slug'] . '_', null, 'save' ) . 'license';
	}
}
PK     ”T]Ç´îÒäO  äO  #  class-yoast-notification-center.phpnu „[µü¤        <?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Notifications
 */

/**
 * Handles notifications storage and display.
 */
class Yoast_Notification_Center {

	/**
	 * Option name to store notifications on.
	 *
	 * @var string
	 */
	const STORAGE_KEY = 'yoast_notifications';

	/**
	 * The singleton instance of this object.
	 *
	 * @var \Yoast_Notification_Center
	 */
	private static $instance = null;

	/**
	 * @var \Yoast_Notification[]
	 */
	private $notifications = array();

	/**
	 * Notifications there are newly added.
	 *
	 * @var array
	 */
	private $new = array();

	/**
	 * Notifications that were resolved this execution.
	 *
	 * @var array
	 */
	private $resolved = 0;

	/**
	 * Internal storage for transaction before notifications have been retrieved from storage.
	 *
	 * @var array
	 */
	private $queued_transactions = array();

	/**
	 * Internal flag for whether notifications have been retrieved from storage.
	 *
	 * @var bool
	 */
	private $notifications_retrieved = false;

	/**
	 * Construct.
	 */
	private function __construct() {

		add_action( 'init', array( $this, 'setup_current_notifications' ), 1 );

		add_action( 'all_admin_notices', array( $this, 'display_notifications' ) );

		add_action( 'wp_ajax_yoast_get_notifications', array( $this, 'ajax_get_notifications' ) );

		add_action( 'wpseo_deactivate', array( $this, 'deactivate_hook' ) );
		add_action( 'shutdown', array( $this, 'update_storage' ) );
	}

	/**
	 * Singleton getter.
	 *
	 * @return Yoast_Notification_Center
	 */
	public static function get() {

		if ( null === self::$instance ) {
			self::$instance = new self();
		}

		return self::$instance;
	}

	/**
	 * Dismiss a notification.
	 */
	public static function ajax_dismiss_notification() {

		$notification_center = self::get();

		$notification_id = filter_input( INPUT_POST, 'notification' );
		if ( empty( $notification_id ) ) {
			die( '-1' );
		}

		$notification = $notification_center->get_notification_by_id( $notification_id );
		if ( false === ( $notification instanceof Yoast_Notification ) ) {

			// Permit legacy.
			$options      = array(
				'id'            => $notification_id,
				'dismissal_key' => $notification_id,
			);
			$notification = new Yoast_Notification( '', $options );
		}

		if ( self::maybe_dismiss_notification( $notification ) ) {
			die( '1' );
		}

		die( '-1' );
	}

	/**
	 * Check if the user has dismissed a notification.
	 *
	 * @param Yoast_Notification $notification The notification to check for dismissal.
	 * @param null|int           $user_id      User ID to check on.
	 *
	 * @return bool
	 */
	public static function is_notification_dismissed( Yoast_Notification $notification, $user_id = null ) {

		$user_id       = ( ! is_null( $user_id ) ? $user_id : get_current_user_id() );
		$dismissal_key = $notification->get_dismissal_key();

		// This checks both the site-specific user option and the meta value.
		$current_value = get_user_option( $dismissal_key, $user_id );

		// Migrate old user meta to user option on-the-fly.
		if ( ! empty( $current_value )
			&& metadata_exists( 'user', $user_id, $dismissal_key )
			&& update_user_option( $user_id, $dismissal_key, $current_value ) ) {
			delete_user_meta( $user_id, $dismissal_key );
		}

		return ! empty( $current_value );
	}

	/**
	 * Check if the nofitication is being dismissed.
	 *
	 * @param string|Yoast_Notification $notification Notification to check dismissal of.
	 * @param string                    $meta_value   Value to set the meta value to if dismissed.
	 *
	 * @return bool True if dismissed.
	 */
	public static function maybe_dismiss_notification( Yoast_Notification $notification, $meta_value = 'seen' ) {

		// Only persistent notifications are dismissible.
		if ( ! $notification->is_persistent() ) {
			return false;
		}

		// If notification is already dismissed, we're done.
		if ( self::is_notification_dismissed( $notification ) ) {
			return true;
		}

		$dismissal_key   = $notification->get_dismissal_key();
		$notification_id = $notification->get_id();

		$is_dismissing = ( $dismissal_key === self::get_user_input( 'notification' ) );
		if ( ! $is_dismissing ) {
			$is_dismissing = ( $notification_id === self::get_user_input( 'notification' ) );
		}

		// Fallback to ?dismissal_key=1&nonce=bla when JavaScript fails.
		if ( ! $is_dismissing ) {
			$is_dismissing = ( '1' === self::get_user_input( $dismissal_key ) );
		}

		if ( ! $is_dismissing ) {
			return false;
		}

		$user_nonce = self::get_user_input( 'nonce' );
		if ( false === wp_verify_nonce( $user_nonce, $notification_id ) ) {
			return false;
		}

		return self::dismiss_notification( $notification, $meta_value );
	}

	/**
	 * Dismisses a notification.
	 *
	 * @param Yoast_Notification $notification Notification to dismiss.
	 * @param string             $meta_value   Value to save in the dismissal.
	 *
	 * @return bool True if dismissed, false otherwise.
	 */
	public static function dismiss_notification( Yoast_Notification $notification, $meta_value = 'seen' ) {
		// Dismiss notification.
		return update_user_option( get_current_user_id(), $notification->get_dismissal_key(), $meta_value ) !== false;
	}

	/**
	 * Restores a notification.
	 *
	 * @param Yoast_Notification $notification Notification to restore.
	 *
	 * @return bool True if restored, false otherwise.
	 */
	public static function restore_notification( Yoast_Notification $notification ) {

		$user_id       = get_current_user_id();
		$dismissal_key = $notification->get_dismissal_key();

		// Restore notification.
		$restored = delete_user_option( $user_id, $dismissal_key );

		// Delete unprefixed user meta too for backward-compatibility.
		if ( metadata_exists( 'user', $user_id, $dismissal_key ) ) {
			$restored = delete_user_meta( $user_id, $dismissal_key ) && $restored;
		}

		return $restored;
	}

	/**
	 * Clear dismissal information for the specified Notification.
	 *
	 * When a cause is resolved, the next time it is present we want to show
	 * the message again.
	 *
	 * @param string|Yoast_Notification $notification Notification to clear the dismissal of.
	 *
	 * @return bool
	 */
	public function clear_dismissal( $notification ) {

		global $wpdb;

		if ( $notification instanceof Yoast_Notification ) {
			$dismissal_key = $notification->get_dismissal_key();
		}

		if ( is_string( $notification ) ) {
			$dismissal_key = $notification;
		}

		if ( empty( $dismissal_key ) ) {
			return false;
		}

		// Remove notification dismissal for all users.
		$deleted = delete_metadata( 'user', 0, $wpdb->get_blog_prefix() . $dismissal_key, '', true );

		// Delete unprefixed user meta too for backward-compatibility.
		$deleted = delete_metadata( 'user', 0, $dismissal_key, '', true ) || $deleted;

		return $deleted;
	}

	/**
	 * Retrieves notifications from the storage and merges in previous notification changes.
	 *
	 * The current user in WordPress is not loaded shortly before the 'init' hook, but the plugin
	 * sometimes needs to add or remove notifications before that. In such cases, the transactions
	 * are not actually executed, but added to a queue. That queue is then handled in this method,
	 * after notifications for the current user have been set up.
	 *
	 * @return void
	 */
	public function setup_current_notifications() {
		$this->retrieve_notifications_from_storage();

		foreach ( $this->queued_transactions as $transaction ) {
			list( $callback, $args ) = $transaction;

			call_user_func_array( $callback, $args );
		}

		$this->queued_transactions = array();
	}

	/**
	 * Add notification to the cookie.
	 *
	 * @param Yoast_Notification $notification Notification object instance.
	 */
	public function add_notification( Yoast_Notification $notification ) {

		$callback = array( $this, __METHOD__ );
		$args     = func_get_args();
		if ( $this->queue_transaction( $callback, $args ) ) {
			return;
		}

		// Don't add if the user can't see it.
		if ( ! $notification->display_for_current_user() ) {
			return;
		}

		$notification_id = $notification->get_id();

		// Empty notifications are always added.
		if ( $notification_id !== '' ) {

			// If notification ID exists in notifications, don't add again.
			$present_notification = $this->get_notification_by_id( $notification_id );
			if ( ! is_null( $present_notification ) ) {
				$this->remove_notification( $present_notification, false );
			}

			if ( is_null( $present_notification ) ) {
				$this->new[] = $notification_id;
			}
		}

		// Add to list.
		$this->notifications[] = $notification;
	}

	/**
	 * Get the notification by ID.
	 *
	 * @param string $notification_id The ID of the notification to search for.
	 *
	 * @return null|Yoast_Notification
	 */
	public function get_notification_by_id( $notification_id ) {

		foreach ( $this->notifications as & $notification ) {
			if ( $notification_id === $notification->get_id() ) {
				return $notification;
			}
		}

		return null;
	}

	/**
	 * Display the notifications.
	 *
	 * @param bool $echo_as_json True when notifications should be printed directly.
	 *
	 * @return void
	 */
	public function display_notifications( $echo_as_json = false ) {

		// Never display notifications for network admin.
		if ( function_exists( 'is_network_admin' ) && is_network_admin() ) {
			return;
		}

		$sorted_notifications = $this->get_sorted_notifications();
		$notifications        = array_filter( $sorted_notifications, array( $this, 'is_notification_persistent' ) );

		if ( empty( $notifications ) ) {
			return;
		}

		array_walk( $notifications, array( $this, 'remove_notification' ) );

		$notifications = array_unique( $notifications );
		if ( $echo_as_json ) {
			$notification_json = array();

			/**
			 * @var Yoast_Notification[] $notifications
			 */
			foreach ( $notifications as $notification ) {
				$notification_json[] = $notification->render();
			}

			echo WPSEO_Utils::format_json_encode( $notification_json );

			return;
		}

		foreach ( $notifications as $notification ) {
			echo $notification;
		}
	}

	/**
	 * Remove notification after it has been displayed.
	 *
	 * @param Yoast_Notification $notification Notification to remove.
	 * @param bool               $resolve      Resolve as fixed.
	 */
	public function remove_notification( Yoast_Notification $notification, $resolve = true ) {

		$callback = array( $this, __METHOD__ );
		$args     = func_get_args();
		if ( $this->queue_transaction( $callback, $args ) ) {
			return;
		}

		$index = false;

		// Match persistent Notifications by ID, non persistent by item in the array.
		if ( $notification->is_persistent() ) {
			foreach ( $this->notifications as $current_index => $present_notification ) {
				if ( $present_notification->get_id() === $notification->get_id() ) {
					$index = $current_index;
					break;
				}
			}
		}
		else {
			$index = array_search( $notification, $this->notifications, true );
		}

		if ( false === $index ) {
			return;
		}

		if ( $notification->is_persistent() && $resolve ) {
			$this->resolved++;
			$this->clear_dismissal( $notification );
		}

		unset( $this->notifications[ $index ] );
		$this->notifications = array_values( $this->notifications );
	}

	/**
	 * Removes a notification by its ID.
	 *
	 * @param string $notification_id The notification id.
	 * @param bool   $resolve         Resolve as fixed.
	 *
	 * @return void
	 */
	public function remove_notification_by_id( $notification_id, $resolve = true ) {
		$notification = $this->get_notification_by_id( $notification_id );

		if ( $notification === null ) {
			return;
		}

		$this->remove_notification( $notification, $resolve );
	}

	/**
	 * Get the notification count.
	 *
	 * @param bool $dismissed Count dismissed notifications.
	 *
	 * @return int Number of notifications
	 */
	public function get_notification_count( $dismissed = false ) {

		$notifications = $this->get_notifications();
		$notifications = array_filter( $notifications, array( $this, 'filter_persistent_notifications' ) );

		if ( ! $dismissed ) {
			$notifications = array_filter( $notifications, array( $this, 'filter_dismissed_notifications' ) );
		}

		return count( $notifications );
	}

	/**
	 * Get the number of notifications resolved this execution.
	 *
	 * These notifications have been resolved and should be counted when active again.
	 *
	 * @return int
	 */
	public function get_resolved_notification_count() {

		return $this->resolved;
	}

	/**
	 * Return the notifications sorted on type and priority.
	 *
	 * @return array|Yoast_Notification[] Sorted Notifications
	 */
	public function get_sorted_notifications() {

		$notifications = $this->get_notifications();
		if ( empty( $notifications ) ) {
			return array();
		}

		// Sort by severity, error first.
		usort( $notifications, array( $this, 'sort_notifications' ) );

		return $notifications;
	}

	/**
	 * AJAX display notifications.
	 */
	public function ajax_get_notifications() {
		$echo = filter_input( INPUT_POST, 'version' ) === '2';

		// Display the notices.
		$this->display_notifications( $echo );

		// AJAX die.
		exit;
	}

	/**
	 * Remove storage when the plugin is deactivated.
	 */
	public function deactivate_hook() {

		$this->clear_notifications();
	}

	/**
	 * Save persistent notifications to storage.
	 *
	 * We need to be able to retrieve these so they can be dismissed at any time during the execution.
	 *
	 * @since 3.2
	 *
	 * @return void
	 */
	public function update_storage() {

		$notifications = $this->get_notifications();

		/**
		 * Filter: 'yoast_notifications_before_storage' - Allows developer to filter notifications before saving them.
		 *
		 * @api Yoast_Notification[] $notifications
		 */
		$notifications = apply_filters( 'yoast_notifications_before_storage', $notifications );

		// No notifications to store, clear storage if it was previously present.
		if ( empty( $notifications ) ) {
			$this->remove_storage();

			return;
		}

		$notifications = array_map( array( $this, 'notification_to_array' ), $notifications );

		// Save the notifications to the storage.
		update_user_option( get_current_user_id(), self::STORAGE_KEY, $notifications );
	}

	/**
	 * Provide a way to verify present notifications.
	 *
	 * @return array|Yoast_Notification[] Registered notifications.
	 */
	public function get_notifications() {

		return $this->notifications;
	}

	/**
	 * Get newly added notifications.
	 *
	 * @return array
	 */
	public function get_new_notifications() {

		return array_map( array( $this, 'get_notification_by_id' ), $this->new );
	}

	/**
	 * Get information from the User input.
	 *
	 * @param string $key Key to retrieve.
	 *
	 * @return mixed value of key if set.
	 */
	private static function get_user_input( $key ) {

		$filter_input_type = INPUT_GET;

		if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === strtoupper( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) ) {
			$filter_input_type = INPUT_POST;
		}

		return filter_input( $filter_input_type, $key );
	}

	/**
	 * Retrieve the notifications from storage.
	 *
	 * @return array|void Yoast_Notification[] Notifications.
	 */
	private function retrieve_notifications_from_storage() {

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

		$this->notifications_retrieved = true;

		$stored_notifications = get_user_option( self::STORAGE_KEY, get_current_user_id() );

		// Check if notifications are stored.
		if ( empty( $stored_notifications ) ) {
			return;
		}

		if ( is_array( $stored_notifications ) ) {
			$notifications = array_map( array( $this, 'array_to_notification' ), $stored_notifications );
			// Apply array_values to ensure we get a 0-indexed array.
			$notifications = array_values( array_filter( $notifications, array( $this, 'filter_notification_current_user' ) ) );

			$this->notifications = $notifications;
		}
	}

	/**
	 * Sort on type then priority.
	 *
	 * @param Yoast_Notification $a Compare with B.
	 * @param Yoast_Notification $b Compare with A.
	 *
	 * @return int 1, 0 or -1 for sorting offset.
	 */
	private function sort_notifications( Yoast_Notification $a, Yoast_Notification $b ) {

		$a_type = $a->get_type();
		$b_type = $b->get_type();

		if ( $a_type === $b_type ) {
			return WPSEO_Utils::calc( $b->get_priority(), 'compare', $a->get_priority() );
		}

		if ( 'error' === $a_type ) {
			return -1;
		}

		if ( 'error' === $b_type ) {
			return 1;
		}

		return 0;
	}

	/**
	 * Clear local stored notifications.
	 */
	private function clear_notifications() {

		$this->notifications           = array();
		$this->notifications_retrieved = false;
	}

	/**
	 * Filter out non-persistent notifications.
	 *
	 * @param Yoast_Notification $notification Notification to test for persistent.
	 *
	 * @since 3.2
	 *
	 * @return bool
	 */
	private function filter_persistent_notifications( Yoast_Notification $notification ) {

		return $notification->is_persistent();
	}

	/**
	 * Filter out dismissed notifications.
	 *
	 * @param Yoast_Notification $notification Notification to check.
	 *
	 * @return bool
	 */
	private function filter_dismissed_notifications( Yoast_Notification $notification ) {

		return ! $this->maybe_dismiss_notification( $notification );
	}

	/**
	 * Convert Notification to array representation.
	 *
	 * @param Yoast_Notification $notification Notification to convert.
	 *
	 * @since 3.2
	 *
	 * @return array
	 */
	private function notification_to_array( Yoast_Notification $notification ) {

		$notification_data = $notification->to_array();

		if ( isset( $notification_data['nonce'] ) ) {
			unset( $notification_data['nonce'] );
		}

		return $notification_data;
	}

	/**
	 * Convert stored array to Notification.
	 *
	 * @param array $notification_data Array to convert to Notification.
	 *
	 * @return Yoast_Notification
	 */
	private function array_to_notification( $notification_data ) {

		if ( isset( $notification_data['options']['nonce'] ) ) {
			unset( $notification_data['options']['nonce'] );
		}

		return new Yoast_Notification(
			$notification_data['message'],
			$notification_data['options']
		);
	}

	/**
	 * Filter notifications that should not be displayed for the current user.
	 *
	 * @param Yoast_Notification $notification Notification to test.
	 *
	 * @return bool
	 */
	private function filter_notification_current_user( Yoast_Notification $notification ) {
		return $notification->display_for_current_user();
	}

	/**
	 * Checks if given notification is persistent.
	 *
	 * @param Yoast_Notification $notification The notification to check.
	 *
	 * @return bool True when notification is not persistent.
	 */
	private function is_notification_persistent( Yoast_Notification $notification ) {
		return ! $notification->is_persistent();
	}

	/**
	 * Queues a notification transaction for later execution if notifications are not yet set up.
	 *
	 * @param callable $callback Callback that performs the transaction.
	 * @param array    $args     Arguments to pass to the callback.
	 *
	 * @return bool True if transaction was queued, false if it can be performed immediately.
	 */
	private function queue_transaction( $callback, $args ) {
		if ( $this->notifications_retrieved ) {
			return false;
		}

		$this->add_transaction_to_queue( $callback, $args );

		return true;
	}

	/**
	 * Adds a notification transaction to the queue for later execution.
	 *
	 * @param callable $callback Callback that performs the transaction.
	 * @param array    $args     Arguments to pass to the callback.
	 */
	private function add_transaction_to_queue( $callback, $args ) {
		$this->queued_transactions[] = array( $callback, $args );
	}

	/**
	 * Removes all notifications from storage.
	 *
	 * @return bool True when notifications got removed.
	 */
	protected function remove_storage() {
		if ( ! $this->has_stored_notifications() ) {
			return false;
		}

		delete_user_option( get_current_user_id(), self::STORAGE_KEY );
		return true;
	}

	/**
	 * Checks if there are stored notifications.
	 *
	 * @return bool True when there are stored notifications.
	 */
	protected function has_stored_notifications() {
		$stored_notifications = $this->get_stored_notifications();

		return ! empty( $stored_notifications );
	}

	/**
	 * Retrieves the stored notifications.
	 *
	 * @codeCoverageIgnore
	 *
	 * @return array|false Array with notifications or false when not set.
	 */
	protected function get_stored_notifications() {
		return get_user_option( self::STORAGE_KEY, get_current_user_id() );
	}
}
PK     ŠNT]�±'N9  N9    admin-settings.phpnu „[µü¤        <?php
/**
 * Admin Settings
 *
 * @package    Scripts_To_Footer
 * @subpackage Scripts_To_Footer_Settings
 * @author     Joshua David Nelson <josh@joshuadnelson.com>
 * @copyright  Copyright (c) 2018, Joshua David Nelson
 * @license    http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
 * @link       http://joshuadnelson.com/scripts-to-footer-plugin
 **/

/**
 * Prevent direct access to this file.
 *
 * @since 0.2
 **/
if( !defined( 'ABSPATH' ) ) {
	exit( 'You are not allowed to access this file directly.' );
}

/**
 * Main Settings Class
 *
 * @since 0.6.0
 */
if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {	
	class Scripts_To_Footer_Settings {
		/**
		 * Holds the values to be used in the fields callbacks
		 */
		private $options;

		/**
		 * Start up
		 *
		 * @since 0.6.0
		 */
		public function __construct() {
			add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
			add_action( 'admin_init', array( $this, 'page_init' ) );
		}
		
		/**
		 * Add options page
		 *
		 * @since 0.6.0
		 */
		public function add_plugin_page() {
			// This page will be under "Settings"
			add_options_page(
				'Scripts to Footer Settings', 
				'Scripts to Footer', 
				'manage_options', 
				STF_SETTINGS_FIELD, 
				array( $this, 'create_admin_page' )
			);
		}
		
		/**
		 * Options page callback
		 *
		 * @since 0.6.0
		 */
		public function create_admin_page()  {
			// Set class property
			$this->options = get_option( STF_SETTINGS_FIELD );
			?>
			<div class="wrap">
				<h2>Scripts to Footer Settings</h2>           
				<form method="post" action="options.php">
					<?php
					// This prints out all hidden setting fields
					settings_fields( STF_SETTINGS_FIELD );   
					do_settings_sections( 'stf-settings' );
					submit_button(); 
					?>
				</form>
			</div>
			<?php
		}
		
		/**
		 * Register and add settings
		 *
		 * @since 0.6.0
		 */
		public function page_init() {
			
			// Metabox on Edit screen, for Page/Post Override
			add_action( 'add_meta_boxes', array( $this, 'metabox_register' ) );
			add_action( 'save_post', array( $this, 'metabox_save' ),  1, 2  );
			
			// Admin options page
			register_setting(
				STF_SETTINGS_FIELD, // Option group
				STF_SETTINGS_FIELD, // Option name
				array( $this, 'sanitize' ) // Sanitize
			);
			
			// Template Options Section
			add_settings_section(
				'exclude_options',
				'Exclude Options',
				array( $this, 'print_exclude_options_section_info' ),
				'stf-settings'
			);
			
			// Home page option
			add_settings_field(
				'stf_home',
				'Blog Page', 
				array( $this, 'stf_home' ),
				'stf-settings',
				'exclude_options'          
			);
			
			// Search Results option
			add_settings_field(
				'stf_search',
				'Search Results', 
				array( $this, 'stf_search' ),
				'stf-settings',
				'exclude_options'          
			);
			
			// Search Results option
			add_settings_field(
				'stf_404',
				'404 pages', 
				array( $this, 'stf_404' ),
				'stf-settings',
				'exclude_options'          
			);
			
			// Post Type Archives options
			add_settings_field(
				'stf_post_type_archives',
				'Post Type Archives', 
				array( $this, 'stf_post_type_archives' ),
				'stf-settings',
				'exclude_options'          
			);
			
			// Taxonomy Archives options
			add_settings_field(
				'stf_taxonomy_archives',
				'Taxonomy Archives', 
				array( $this, 'stf_taxonomy_archives' ),
				'stf-settings',
				'exclude_options'          
			);
			
			// Author Archives options
			add_settings_field(
				'stf_author_archive',
				'Author Archives', 
				array( $this, 'stf_author_archive' ),
				'stf-settings',
				'exclude_options'          
			);
			
			// Archive option
			add_settings_field(
				'stf_archive',
				'Other Archive Pages', 
				array( $this, 'stf_archive' ),
				'stf-settings',
				'exclude_options'          
			);
			
			// Header Scripts Section
			add_settings_section(
				'header_script_options',
				'Header Scripts',
				array( $this, 'print_header_script_section_info' ),
				'stf-settings'
			);
			
			// Archive option
			add_settings_field(
				'stf_jquery_header',
				'Keep jQuery in the Header', 
				array( $this, 'stf_jquery_header' ),
				'stf-settings',
				'header_script_options'          
			);
		}
		
		/**
		 * Sanitize each setting field as needed
		 *
		 * @since 0.6.0
		 * @since 0.6.2 added 404 support
		 *
		 * @param array $input Contains all settings fields as array keys
		 */
		public function sanitize( $input ) {
			$new_input = array();
			if( isset( $input['stf_exclude_home'] ) )
				$new_input['stf_exclude_home'] = absint( $input['stf_exclude_home'] );
			
			if( isset( $input['stf_exclude_search'] ) )
				$new_input['stf_exclude_search'] = absint( $input['stf_exclude_search'] );
			
			if( isset( $input['stf_exclude_404'] ) )
				$new_input['stf_exclude_404'] = absint( $input['stf_exclude_404'] );
				
			if( isset( $input['stf_exclude_archive'] ) )
				$new_input['stf_exclude_archive'] = absint( $input['stf_exclude_archive'] );
			
			if( isset( $input['stf_exclude_author_archive'] ) )
				$new_input['stf_exclude_author_archive'] = absint( $input['stf_exclude_author_archive'] );
			
			// Post Type options
			$post_types = $this->post_type_options();
			if( is_array( $post_types ) ) {
				foreach( $post_types as $option ) {
					if( isset( $input[ $option ] ) )
						$new_input[ $option ] = absint( $input[ $option ] );
				}
			}
			
			// Taxonomy options
			$taxes = $this->taxonomy_options();
			if( is_array( $taxes ) ) {
				foreach( $taxes as $option ) {
					if( isset( $input[ $option ] ) )
						$new_input[ $option ] = absint( $input[ $option ] );
				}
			}
			
			if( isset( $input['stf_jquery_header'] ) )
				$new_input['stf_jquery_header'] = absint( $input['stf_jquery_header'] );
				
			return $new_input;
		}
		
		/**
		 * Return the post type settings field names.
		 *
		 * @since 0.6.0
		 *
		 * @return array
		 */
		function post_type_options() {
			$options = array();
			
			global $stf_scripts_to_footer;
			$post_types = $stf_scripts_to_footer->post_types_supported();
			if( is_array( $post_types ) ) {
				foreach( $post_types as $post_type ) {
					 $options[] = "stf_exclude_{$post_type}_archive";
				}
			}
			
			return $options;
		}
		
		/**
		 * Return the post type settings field names.
		 *
		 * @since 0.6.0
		 *
		 * @return array
		 */
		function taxonomy_options() {
			$options = array();
			
			global $stf_scripts_to_footer;
			$taxes = $stf_scripts_to_footer->taxonomies_supported();
			if( is_array( $taxes ) ) {
				foreach( $taxes as $tax ) {
					 $options[] = "stf_exclude_{$tax}_archive";
				}
			}
			
			return $options;
		}
		
		/** 
		 * Print the Section text.
		 *
		 * @since 0.6.0
		 */
		public function print_exclude_options_section_info() {
			echo _x( 'Select which templates should <em><strong>not</strong></em> have scripts moved to the footer:', STF_DOMAIN );
		}

		/** 
		 * Get the settings option array and print one of its values.
		 *
		 * @since 0.6
		 */
		public function stf_home() {
			if( !isset( $this->options['stf_exclude_home'] ) )
				$this->options['stf_exclude_home'] = 0;
				
			echo '<input type="checkbox" name="' . STF_SETTINGS_FIELD . '[stf_exclude_home]" ' . checked( $this->options['stf_exclude_home'], 1, false ) . ' value="1">';
	
		}
		
		/** 
		 * Get the settings option array and print one of its values.
		 *
		 * @since 0.6.0
		 */
		public function stf_search() {
			if( !isset( $this->options['stf_exclude_search'] ) )
				$this->options['stf_exclude_search'] = 0;
			
			echo '<input type="checkbox" name="' . STF_SETTINGS_FIELD . '[stf_exclude_search]" ' . checked( $this->options['stf_exclude_search'], 1, false ) . ' value="1">';
		
		}
		
		/** 
		 * Get the settings option array and print one of its values.
		 *
		 * @since 0.6.2
		 */
		public function stf_404() {
			if( !isset( $this->options['stf_exclude_404'] ) )
				$this->options['stf_exclude_404'] = 0;
			
			echo '<input type="checkbox" name="' . STF_SETTINGS_FIELD . '[stf_exclude_404]" ' . checked( $this->options['stf_exclude_404'], 1, false ) . ' value="1">';
		
		}
		
		/**
		 * Get the settings option array and print one of its values.
		 *
		 * @since 0.6.0
		 */
		public function stf_post_type_archives() {
			global $stf_scripts_to_footer;
			$post_types = $stf_scripts_to_footer->post_types_supported();
			if( is_array( $post_types ) ) {
				echo '<ul>';
				foreach( $post_types as $post_type ) {
					if( !isset( $this->options["stf_exclude_{$post_type}_archive"] ) )
						$this->options["stf_exclude_{$post_type}_archive"] = 0;
					
					$obj = get_post_type_object( $post_type );
					$title = $obj->labels->singular_name;
					echo "<li><input type=\"checkbox\" id=\"stf_exclude_{$post_type}_archive\" name=\"" . STF_SETTINGS_FIELD . "[stf_exclude_{$post_type}_archive]\" " . checked( $this->options["stf_exclude_{$post_type}_archive"], 1, false ) . " value=\"1\"><label for=\"stf_exclude_{$post_type}_archive\">" . $title . ' </label></li>';
				}
				echo '</ul>';
			}
		}
		
		/**
		 * Get the settings option array and print one of its values.
		 *
		 * @since 0.6.0
		 */
		public function stf_taxonomy_archives() {
			global $stf_scripts_to_footer;
			$taxes = $stf_scripts_to_footer->taxonomies_supported();
			if( is_array( $taxes ) ) {
				echo '<ul>';
				foreach( $taxes as $taxonomy ) {
					if( !isset( $this->options["stf_exclude_{$taxonomy}_archive"] ) )
						$this->options["stf_exclude_{$taxonomy}_archive"] = 0;
				
					$obj = get_taxonomy( $taxonomy );
					$title = $obj->labels->singular_name;
					echo "<li><input type=\"checkbox\" id=\"stf_exclude_{$taxonomy}_archive\" name=\"" . STF_SETTINGS_FIELD . "[stf_exclude_{$taxonomy}_archive]\" " . checked( $this->options["stf_exclude_{$taxonomy}_archive"], 1, false ) . " value=\"1\"><label for=\"stf_exclude_{$taxonomy}_archive\">" . $title . ' </label></li>';
				}
				echo '</ul>';
			}
		}
		
		/** 
		 * Get the settings option array and print one of its values.
		 *
		 * @since 0.6.0
		 */
		public function stf_author_archive() {
			if( !isset( $this->options['stf_exclude_author_archive'] ) )
				$this->options['stf_exclude_author_archive'] = 0;
			
			echo '<input type="checkbox" name="' . STF_SETTINGS_FIELD . '[stf_exclude_author_archive]" ' . checked( $this->options['stf_exclude_author_archive'], 1, false ) . ' value="1">';

		}
		
		/** 
		 * Get the settings option array and print one of its values.
		 *
		 * @since 0.6.0
		 */
		public function stf_archive() {
			if( !isset( $this->options['stf_exclude_archive'] ) )
				$this->options['stf_exclude_archive'] = 0;
			
			echo '<input type="checkbox" name="' . STF_SETTINGS_FIELD . '[stf_exclude_archive]" ' . checked( $this->options['stf_exclude_archive'], 1, false ) . ' value="1">';

		}
		
		/** 
		 * Print the Section text.
		 *
		 * @since 0.6.0
		 */
		public function print_header_script_section_info() {
			echo sprintf( __( 'Options for keeping specific scripts in the header, if they occur. Want to exclude a different script? Check out the <a href="%s" title="On Github">documentation</a> for more information.', STF_DOMAIN ), 'https://github.com/joshuadavidnelson/scripts-to-footer/wiki' );
		}
		
		/** 
		 * Get the settings option array and print one of its values.
		 *
		 * @since 0.6.0
		 */
		public function stf_jquery_header() {
			if( !isset( $this->options['stf_jquery_header'] ) )
				$this->options['stf_jquery_header'] = 0;
			
			echo '<input type="checkbox" name="' . STF_SETTINGS_FIELD . '[stf_jquery_header]" ' . checked( $this->options['stf_jquery_header'], 1, false ) . ' value="1">';

		}
		
		///////////// Post Metabox /////////////
		
		/**
		 * Initialize the single post metabox.
		 *
		 * @since 0.6.0
		 */
		function metabox_register() {
			global $stf_scripts_to_footer;
			
			// Check for post type support
			$post_type = get_post_type();
			if( !$post_type || !$stf_scripts_to_footer->post_type_supported( $post_type ) )
				return;
		
			add_meta_box( 'scripts-to-footer', 'Scripts to Footer Settings', array( $this, 'metabox_render' ), $post_type, 'normal', 'high' );
		}
	
		/**
		 * Output the single post metabox.
		 *
		 * @since 0.6.0
		 */
		function metabox_render() {

			// Grab current value
			$exclude = get_post_meta( get_the_ID(), 'stf_exclude', true );
			if( $exclude == 'on' ) {
				update_post_meta( get_the_ID(), 'stf_exclude', 1, 'on' );
				$exclude = 1;
			}
				
			// Security nonce
			wp_nonce_field( 'scripts_to_footer', 'stf_nonce' );

			echo '<p style="padding-top:10px;">';
			
			// Exclude
			printf( '<label for="stf_exclude">%s</label>', __( 'Turn Plugin Off', STF_DOMAIN ) );
	
			echo '<input type="checkbox" id="stf_exclude" name="stf_exclude" ' . checked( true , $exclude, false ) . ' style="margin:0 20px 0 10px;">';
	
			printf( '<span style="color:#999;">%s</span>', __( 'By default, this plugin will run on this post type. This checkbox lets you turn it off for this specific page/post.', STF_DOMAIN ) );
		
			echo '</p>';
		}

		/**
		 * Handle metabox saves
		 *
		 * @since 0.6.0
		 */
		function metabox_save( $post_id, $post ) {

			// Security check
			if ( ! isset( $_POST['stf_nonce'] ) || ! wp_verify_nonce( $_POST['stf_nonce'], 'scripts_to_footer' ) ) {
				return;
			}

			// Bail out if running an autosave, ajax, cron.
			if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
				return;
			}
			if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
				return;
			}
			if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
				return;
			}

			// Bail out if the user doesn't have the correct permissions to update the slider.
			if ( ! current_user_can( 'edit_post', $post_id ) ) {
				return;
			}
		
			// Either save or delete they post meta
			if ( isset( $_POST[ 'stf_exclude' ] ) ) {
				$value = (int) (bool) $_POST[ 'stf_exclude' ];
				update_post_meta( $post_id, 'stf_exclude', $value );
			} else {
				delete_post_meta( $post_id, 'stf_exclude' );
			}
		}
	}
	
	if( is_admin() )
	    $stf_settings = new Scripts_To_Footer_Settings();
}

/**
 * Get custom settings.
 *
 * @since 0.6.0
 *
 * @param string $key The key
 * @param string $setting The settings field
 */
if( !function_exists( 'stf_get_option' ) ) {
	function stf_get_option( $key, $setting = null ) {
		// Get settings field options
		$setting = $setting ? $setting : STF_SETTINGS_FIELD;
		$options = get_option( $setting );
		
		if ( ! is_array( $options ) || ! array_key_exists( $key, $options ) )
			return '';

		return is_array( $options[$key] ) ? stripslashes_deep( $options[$key] ) : stripslashes( wp_kses_decode_entities( $options[$key] ) );
	}
}
PK     ¤^T]2Gñ¡D  D    includes/admin-functions.phpnu „[µü¤        <?php

function wpcf7_current_action() {
	if ( isset( $_REQUEST['action'] ) and -1 != $_REQUEST['action'] ) {
		return $_REQUEST['action'];
	}

	if ( isset( $_REQUEST['action2'] ) and -1 != $_REQUEST['action2'] ) {
		return $_REQUEST['action2'];
	}

	return false;
}

function wpcf7_admin_has_edit_cap() {
	return current_user_can( 'wpcf7_edit_contact_forms' );
}

function wpcf7_add_tag_generator( $name, $title, $elm_id, $callback, $options = array() ) {
	$tag_generator = WPCF7_TagGenerator::get_instance();
	return $tag_generator->add( $name, $title, $callback, $options );
}
PK     ¤^T]�SÊ‰í   í     includes/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ¤^T]#b¦  ¦    includes/welcome-panel.phpnu „[µü¤        <?php

function wpcf7_welcome_panel() {
	$classes = 'welcome-panel';

	$vers = (array) get_user_meta( get_current_user_id(),
		'wpcf7_hide_welcome_panel_on', true );

	if ( wpcf7_version_grep( wpcf7_version( 'only_major=1' ), $vers ) ) {
		$classes .= ' hidden';
	}

?>
<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
	<?php wp_nonce_field( 'wpcf7-welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
	<a class="welcome-panel-close" href="<?php echo esc_url( menu_page_url( 'wpcf7', false ) ); ?>"><?php echo esc_html( __( 'Dismiss', 'contact-form-7' ) ); ?></a>

	<div class="welcome-panel-content">
		<div class="welcome-panel-column-container">

			<div class="welcome-panel-column">
				<h3><span class="dashicons dashicons-shield" aria-hidden="true"></span> <?php echo esc_html( __( "Getting spammed? You have protection.", 'contact-form-7' ) ); ?></h3>

				<p><?php echo esc_html( __( "Spammers target everything; your contact forms aren&#8217;t an exception. Before you get spammed, protect your contact forms with the powerful anti-spam features Contact Form 7 provides.", 'contact-form-7' ) ); ?></p>

				<p><?php
	echo sprintf(
		/* translators: links labeled 1: 'Akismet', 2: 'reCAPTCHA', 3: 'comment blacklist' */
		esc_html( __( 'Contact Form 7 supports spam-filtering with %1$s. Intelligent %2$s blocks annoying spambots. Plus, using %3$s, you can block messages containing specified keywords or those sent from specified IP addresses.', 'contact-form-7' ) ),
		wpcf7_link(
			__( 'https://contactform7.com/spam-filtering-with-akismet/', 'contact-form-7' ),
			__( 'Akismet', 'contact-form-7' )
		),
		wpcf7_link(
			__( 'https://contactform7.com/recaptcha/', 'contact-form-7' ),
			__( 'reCAPTCHA', 'contact-form-7' )
		),
		wpcf7_link(
			__( 'https://contactform7.com/comment-blacklist/', 'contact-form-7' ),
			__( 'comment blacklist', 'contact-form-7' )
		)
	);
				?></p>
			</div>

<?php if ( defined( 'FLAMINGO_VERSION' ) ) : ?>
			<div class="welcome-panel-column">
				<h3><span class="dashicons dashicons-megaphone" aria-hidden="true"></span> <?php echo esc_html( __( "Contact Form 7 needs your support.", 'contact-form-7' ) ); ?></h3>

				<p><?php echo esc_html( __( "It is hard to continue development and support for this plugin without contributions from users like you.", 'contact-form-7' ) ); ?></p>

				<p><?php
	echo sprintf(
		/* translators: %s: link labeled 'making a donation' */
		esc_html( __( 'If you enjoy using Contact Form 7 and find it useful, please consider %s.', 'contact-form-7' ) ),
		wpcf7_link(
			__( 'https://contactform7.com/donate/', 'contact-form-7' ),
			__( 'making a donation', 'contact-form-7' )
		)
	);
				?></p>

				<p><?php echo esc_html( __( "Your donation will help encourage and support the plugin&#8217;s continued development and better user support.", 'contact-form-7' ) ); ?></p>
			</div>
<?php else: ?>
			<div class="welcome-panel-column">
				<h3><span class="dashicons dashicons-editor-help" aria-hidden="true"></span> <?php echo esc_html( __( "Before you cry over spilt mail&#8230;", 'contact-form-7' ) ); ?></h3>

				<p><?php echo esc_html( __( "Contact Form 7 doesn&#8217;t store submitted messages anywhere. Therefore, you may lose important messages forever if your mail server has issues or you make a mistake in mail configuration.", 'contact-form-7' ) ); ?></p>

				<p><?php
	echo sprintf(
		/* translators: %s: link labeled 'Flamingo' */
		esc_html( __( 'Install a message storage plugin before this happens to you. %s saves all messages through contact forms into the database. Flamingo is a free WordPress plugin created by the same author as Contact Form 7.', 'contact-form-7' ) ),
		wpcf7_link(
			__( 'https://contactform7.com/save-submitted-messages-with-flamingo/', 'contact-form-7' ),
			__( 'Flamingo', 'contact-form-7' )
		)
	);
				?></p>
			</div>
<?php endif; ?>

		</div>
	</div>
</div>
<?php
}

add_action( 'wp_ajax_wpcf7-update-welcome-panel',
	'wpcf7_admin_ajax_welcome_panel', 10, 0 );

function wpcf7_admin_ajax_welcome_panel() {
	check_ajax_referer( 'wpcf7-welcome-panel-nonce', 'welcomepanelnonce' );

	$vers = get_user_meta( get_current_user_id(),
		'wpcf7_hide_welcome_panel_on', true );

	if ( empty( $vers ) or ! is_array( $vers ) ) {
		$vers = array();
	}

	if ( empty( $_POST['visible'] ) ) {
		$vers[] = wpcf7_version( 'only_major=1' );
	}

	$vers = array_unique( $vers );

	update_user_meta( get_current_user_id(),
		'wpcf7_hide_welcome_panel_on', $vers );

	wp_die( 1 );
}
PK     ¤^T]Ô¢ø‡:  :    includes/help-tabs.phpnu „[µü¤        <?php

class WPCF7_Help_Tabs {

	private $screen;

	public function __construct( WP_Screen $screen ) {
		$this->screen = $screen;
	}

	public function set_help_tabs( $type ) {
		switch ( $type ) {
			case 'list':
				$this->screen->add_help_tab( array(
					'id' => 'list_overview',
					'title' => __( 'Overview', 'contact-form-7' ),
					'content' => $this->content( 'list_overview' ) ) );

				$this->screen->add_help_tab( array(
					'id' => 'list_available_actions',
					'title' => __( 'Available Actions', 'contact-form-7' ),
					'content' => $this->content( 'list_available_actions' ) ) );

				$this->sidebar();

				return;
			case 'edit':
				$this->screen->add_help_tab( array(
					'id' => 'edit_overview',
					'title' => __( 'Overview', 'contact-form-7' ),
					'content' => $this->content( 'edit_overview' ) ) );

				$this->screen->add_help_tab( array(
					'id' => 'edit_form_tags',
					'title' => __( 'Form-tags', 'contact-form-7' ),
					'content' => $this->content( 'edit_form_tags' ) ) );

				$this->screen->add_help_tab( array(
					'id' => 'edit_mail_tags',
					'title' => __( 'Mail-tags', 'contact-form-7' ),
					'content' => $this->content( 'edit_mail_tags' ) ) );

				$this->sidebar();

				return;
			case 'integration':
				$this->screen->add_help_tab( array(
					'id' => 'integration_overview',
					'title' => __( 'Overview', 'contact-form-7' ),
					'content' => $this->content( 'integration_overview' ) ) );

				$this->sidebar();

				return;
		}
	}

	private function content( $name ) {
		$content = array();

		$content['list_overview'] = '<p>' . __( "On this screen, you can manage contact forms provided by Contact Form 7. You can manage an unlimited number of contact forms. Each contact form has a unique ID and Contact Form 7 shortcode ([contact-form-7 ...]). To insert a contact form into a post or a text widget, insert the shortcode into the target.", 'contact-form-7' ) . '</p>';

		$content['list_available_actions'] = '<p>' . __( "Hovering over a row in the contact forms list will display action links that allow you to manage your contact form. You can perform the following actions:", 'contact-form-7' ) . '</p>';
		$content['list_available_actions'] .= '<p>' . __( "<strong>Edit</strong> - Navigates to the editing screen for that contact form. You can also reach that screen by clicking on the contact form title.", 'contact-form-7' ) . '</p>';
		$content['list_available_actions'] .= '<p>' . __( "<strong>Duplicate</strong> - Clones that contact form. A cloned contact form inherits all content from the original, but has a different ID.", 'contact-form-7' ) . '</p>';

		$content['edit_overview'] = '<p>' . __( "On this screen, you can edit a contact form. A contact form is comprised of the following components:", 'contact-form-7' ) . '</p>';
		$content['edit_overview'] .= '<p>' . __( "<strong>Title</strong> is the title of a contact form. This title is only used for labeling a contact form, and can be edited.", 'contact-form-7' ) . '</p>';
		$content['edit_overview'] .= '<p>' . __( "<strong>Form</strong> is a content of HTML form. You can use arbitrary HTML, which is allowed inside a form element. You can also use Contact Form 7&#8217;s form-tags here.", 'contact-form-7' ) . '</p>';
		$content['edit_overview'] .= '<p>' . __( "<strong>Mail</strong> manages a mail template (headers and message body) that this contact form will send when users submit it. You can use Contact Form 7&#8217;s mail-tags here.", 'contact-form-7' ) . '</p>';
		$content['edit_overview'] .= '<p>' . __( "<strong>Mail (2)</strong> is an additional mail template that works similar to Mail. Mail (2) is different in that it is sent only when Mail has been sent successfully.", 'contact-form-7' ) . '</p>';
		$content['edit_overview'] .= '<p>' . __( "In <strong>Messages</strong>, you can edit various types of messages used for this contact form. These messages are relatively short messages, like a validation error message you see when you leave a required field blank.", 'contact-form-7' ) . '</p>';
		$content['edit_overview'] .= '<p>' . __( "<strong>Additional Settings</strong> provides a place where you can customize the behavior of this contact form by adding code snippets.", 'contact-form-7' ) . '</p>';

		$content['edit_form_tags'] = '<p>' . __( "A form-tag is a short code enclosed in square brackets used in a form content. A form-tag generally represents an input field, and its components can be separated into four parts: type, name, options, and values. Contact Form 7 supports several types of form-tags including text fields, number fields, date fields, checkboxes, radio buttons, menus, file-uploading fields, CAPTCHAs, and quiz fields.", 'contact-form-7' ) . '</p>';
		$content['edit_form_tags'] .= '<p>' . __( "While form-tags have a comparatively complex syntax, you don&#8217;t need to know the syntax to add form-tags because you can use the straightforward tag generator (<strong>Generate Tag</strong> button on this screen).", 'contact-form-7' ) . '</p>';

		$content['edit_mail_tags'] = '<p>' . __( "A mail-tag is also a short code enclosed in square brackets that you can use in every Mail and Mail (2) field. A mail-tag represents a user input value through an input field of a corresponding form-tag.", 'contact-form-7' ) . '</p>';
		$content['edit_mail_tags'] .= '<p>' . __( "There are also special mail-tags that have specific names, but don&#8217;t have corresponding form-tags. They are used to represent meta information of form submissions like the submitter&#8217;s IP address or the URL of the page.", 'contact-form-7' ) . '</p>';

		$content['integration_overview'] = '<p>' . __( "On this screen, you can manage services that are available through Contact Form 7. Using API will allow you to collaborate with any services that are available.", 'contact-form-7' ) . '</p>';
		$content['integration_overview'] .= '<p>' . __( "You may need to first sign up for an account with the service that you plan to use. When you do so, you would need to authorize Contact Form 7 to access the service with your account.", 'contact-form-7' ) . '</p>';
		$content['integration_overview'] .= '<p>' . __( "Any information you provide will not be shared with service providers without your authorization.", 'contact-form-7' ) . '</p>';

		if ( ! empty( $content[$name] ) ) {
			return $content[$name];
		}
	}

	public function sidebar() {
		$content = '<p><strong>' . __( 'For more information:', 'contact-form-7' ) . '</strong></p>';
		$content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/docs/', 'contact-form-7' ), __( 'Docs', 'contact-form-7' ) ) . '</p>';
		$content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/faq/', 'contact-form-7' ), __( 'FAQ', 'contact-form-7' ) ) . '</p>';
		$content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/support/', 'contact-form-7' ), __( 'Support', 'contact-form-7' ) ) . '</p>';

		$this->screen->set_help_sidebar( $content );
	}
}
PK     ¤^T]ÐVˆÉd$  d$    includes/editor.phpnu „[µü¤        <?php

class WPCF7_Editor {

	private $contact_form;
	private $panels = array();

	public function __construct( WPCF7_ContactForm $contact_form ) {
		$this->contact_form = $contact_form;
	}

	public function add_panel( $id, $title, $callback ) {
		if ( wpcf7_is_name( $id ) ) {
			$this->panels[$id] = array(
				'title' => $title,
				'callback' => $callback,
			);
		}
	}

	public function display() {
		if ( empty( $this->panels ) ) {
			return;
		}

		echo '<ul id="contact-form-editor-tabs">';

		foreach ( $this->panels as $id => $panel ) {
			echo sprintf( '<li id="%1$s-tab"><a href="#%1$s">%2$s</a></li>',
				esc_attr( $id ), esc_html( $panel['title'] ) );
		}

		echo '</ul>';

		foreach ( $this->panels as $id => $panel ) {
			echo sprintf( '<div class="contact-form-editor-panel" id="%1$s">',
				esc_attr( $id ) );

			if ( is_callable( $panel['callback'] ) ) {
				$this->notice( $id, $panel );
				call_user_func( $panel['callback'], $this->contact_form );
			}

			echo '</div>';
		}
	}

	public function notice( $id, $panel ) {
		echo '<div class="config-error"></div>';
	}
}

function wpcf7_editor_panel_form( $post ) {
	$desc_link = wpcf7_link(
		__( 'https://contactform7.com/editing-form-template/', 'contact-form-7' ),
		__( 'Editing Form Template', 'contact-form-7' ) );
	$description = __( "You can edit the form template here. For details, see %s.", 'contact-form-7' );
	$description = sprintf( esc_html( $description ), $desc_link );
?>

<h2><?php echo esc_html( __( 'Form', 'contact-form-7' ) ); ?></h2>

<fieldset>
<legend><?php echo $description; ?></legend>

<?php
	$tag_generator = WPCF7_TagGenerator::get_instance();
	$tag_generator->print_buttons();
?>

<textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="24" class="large-text code" data-config-field="form.body"><?php echo esc_textarea( $post->prop( 'form' ) ); ?></textarea>
</fieldset>
<?php
}

function wpcf7_editor_panel_mail( $post ) {
	wpcf7_editor_box_mail( $post );

	echo '<br class="clear" />';

	wpcf7_editor_box_mail( $post, array(
		'id' => 'wpcf7-mail-2',
		'name' => 'mail_2',
		'title' => __( 'Mail (2)', 'contact-form-7' ),
		'use' => __( 'Use Mail (2)', 'contact-form-7' ),
	) );
}

function wpcf7_editor_box_mail( $post, $args = '' ) {
	$args = wp_parse_args( $args, array(
		'id' => 'wpcf7-mail',
		'name' => 'mail',
		'title' => __( 'Mail', 'contact-form-7' ),
		'use' => null,
	) );

	$id = esc_attr( $args['id'] );

	$mail = wp_parse_args( $post->prop( $args['name'] ), array(
		'active' => false,
		'recipient' => '',
		'sender' => '',
		'subject' => '',
		'body' => '',
		'additional_headers' => '',
		'attachments' => '',
		'use_html' => false,
		'exclude_blank' => false,
	) );

?>
<div class="contact-form-editor-box-mail" id="<?php echo $id; ?>">
<h2><?php echo esc_html( $args['title'] ); ?></h2>

<?php
	if ( ! empty( $args['use'] ) ) :
?>
<label for="<?php echo $id; ?>-active"><input type="checkbox" id="<?php echo $id; ?>-active" name="<?php echo $id; ?>[active]" class="toggle-form-table" value="1"<?php echo ( $mail['active'] ) ? ' checked="checked"' : ''; ?> /> <?php echo esc_html( $args['use'] ); ?></label>
<p class="description"><?php echo esc_html( __( "Mail (2) is an additional mail template often used as an autoresponder.", 'contact-form-7' ) ); ?></p>
<?php
	endif;
?>

<fieldset>
<legend>
<?php
	$desc_link = wpcf7_link(
		__( 'https://contactform7.com/setting-up-mail/', 'contact-form-7' ),
		__( 'Setting Up Mail', 'contact-form-7' ) );
	$description = __( "You can edit the mail template here. For details, see %s.", 'contact-form-7' );
	$description = sprintf( esc_html( $description ), $desc_link );
	echo $description;
	echo '<br />';

	echo esc_html( __( "In the following fields, you can use these mail-tags:",
		'contact-form-7' ) );
	echo '<br />';
	$post->suggest_mail_tags( $args['name'] );
?>
</legend>
<table class="form-table">
<tbody>
	<tr>
	<th scope="row">
		<label for="<?php echo $id; ?>-recipient"><?php echo esc_html( __( 'To', 'contact-form-7' ) ); ?></label>
	</th>
	<td>
		<input type="text" id="<?php echo $id; ?>-recipient" name="<?php echo $id; ?>[recipient]" class="large-text code" size="70" value="<?php echo esc_attr( $mail['recipient'] ); ?>" data-config-field="<?php echo sprintf( '%s.recipient', esc_attr( $args['name'] ) ); ?>" />
	</td>
	</tr>

	<tr>
	<th scope="row">
		<label for="<?php echo $id; ?>-sender"><?php echo esc_html( __( 'From', 'contact-form-7' ) ); ?></label>
	</th>
	<td>
		<input type="text" id="<?php echo $id; ?>-sender" name="<?php echo $id; ?>[sender]" class="large-text code" size="70" value="<?php echo esc_attr( $mail['sender'] ); ?>" data-config-field="<?php echo sprintf( '%s.sender', esc_attr( $args['name'] ) ); ?>" />
	</td>
	</tr>

	<tr>
	<th scope="row">
		<label for="<?php echo $id; ?>-subject"><?php echo esc_html( __( 'Subject', 'contact-form-7' ) ); ?></label>
	</th>
	<td>
		<input type="text" id="<?php echo $id; ?>-subject" name="<?php echo $id; ?>[subject]" class="large-text code" size="70" value="<?php echo esc_attr( $mail['subject'] ); ?>" data-config-field="<?php echo sprintf( '%s.subject', esc_attr( $args['name'] ) ); ?>" />
	</td>
	</tr>

	<tr>
	<th scope="row">
		<label for="<?php echo $id; ?>-additional-headers"><?php echo esc_html( __( 'Additional Headers', 'contact-form-7' ) ); ?></label>
	</th>
	<td>
		<textarea id="<?php echo $id; ?>-additional-headers" name="<?php echo $id; ?>[additional_headers]" cols="100" rows="4" class="large-text code" data-config-field="<?php echo sprintf( '%s.additional_headers', esc_attr( $args['name'] ) ); ?>"><?php echo esc_textarea( $mail['additional_headers'] ); ?></textarea>
	</td>
	</tr>

	<tr>
	<th scope="row">
		<label for="<?php echo $id; ?>-body"><?php echo esc_html( __( 'Message Body', 'contact-form-7' ) ); ?></label>
	</th>
	<td>
		<textarea id="<?php echo $id; ?>-body" name="<?php echo $id; ?>[body]" cols="100" rows="18" class="large-text code" data-config-field="<?php echo sprintf( '%s.body', esc_attr( $args['name'] ) ); ?>"><?php echo esc_textarea( $mail['body'] ); ?></textarea>

		<p><label for="<?php echo $id; ?>-exclude-blank"><input type="checkbox" id="<?php echo $id; ?>-exclude-blank" name="<?php echo $id; ?>[exclude_blank]" value="1"<?php echo ( ! empty( $mail['exclude_blank'] ) ) ? ' checked="checked"' : ''; ?> /> <?php echo esc_html( __( 'Exclude lines with blank mail-tags from output', 'contact-form-7' ) ); ?></label></p>

		<p><label for="<?php echo $id; ?>-use-html"><input type="checkbox" id="<?php echo $id; ?>-use-html" name="<?php echo $id; ?>[use_html]" value="1"<?php echo ( $mail['use_html'] ) ? ' checked="checked"' : ''; ?> /> <?php echo esc_html( __( 'Use HTML content type', 'contact-form-7' ) ); ?></label></p>
	</td>
	</tr>

	<tr>
	<th scope="row">
		<label for="<?php echo $id; ?>-attachments"><?php echo esc_html( __( 'File Attachments', 'contact-form-7' ) ); ?></label>
	</th>
	<td>
		<textarea id="<?php echo $id; ?>-attachments" name="<?php echo $id; ?>[attachments]" cols="100" rows="4" class="large-text code" data-config-field="<?php echo sprintf( '%s.attachments', esc_attr( $args['name'] ) ); ?>"><?php echo esc_textarea( $mail['attachments'] ); ?></textarea>
	</td>
	</tr>
</tbody>
</table>
</fieldset>
</div>
<?php
}

function wpcf7_editor_panel_messages( $post ) {
	$desc_link = wpcf7_link(
		__( 'https://contactform7.com/editing-messages/', 'contact-form-7' ),
		__( 'Editing Messages', 'contact-form-7' ) );
	$description = __( "You can edit messages used in various situations here. For details, see %s.", 'contact-form-7' );
	$description = sprintf( esc_html( $description ), $desc_link );

	$messages = wpcf7_messages();

	if ( isset( $messages['captcha_not_match'] )
	and ! wpcf7_use_really_simple_captcha() ) {
		unset( $messages['captcha_not_match'] );
	}

?>
<h2><?php echo esc_html( __( 'Messages', 'contact-form-7' ) ); ?></h2>
<fieldset>
<legend><?php echo $description; ?></legend>
<?php

	foreach ( $messages as $key => $arr ) {
		$field_id = sprintf( 'wpcf7-message-%s', strtr( $key, '_', '-' ) );
		$field_name = sprintf( 'wpcf7-messages[%s]', $key );

?>
<p class="description">
<label for="<?php echo $field_id; ?>"><?php echo esc_html( $arr['description'] ); ?><br />
<input type="text" id="<?php echo $field_id; ?>" name="<?php echo $field_name; ?>" class="large-text" size="70" value="<?php echo esc_attr( $post->message( $key, false ) ); ?>" data-config-field="<?php echo sprintf( 'messages.%s', esc_attr( $key ) ); ?>" />
</label>
</p>
<?php
	}
?>
</fieldset>
<?php
}

function wpcf7_editor_panel_additional_settings( $post ) {
	$desc_link = wpcf7_link(
		__( 'https://contactform7.com/additional-settings/', 'contact-form-7' ),
		__( 'Additional Settings', 'contact-form-7' ) );
	$description = __( "You can add customization code snippets here. For details, see %s.", 'contact-form-7' );
	$description = sprintf( esc_html( $description ), $desc_link );

?>
<h2><?php echo esc_html( __( 'Additional Settings', 'contact-form-7' ) ); ?></h2>
<fieldset>
<legend><?php echo $description; ?></legend>
<textarea id="wpcf7-additional-settings" name="wpcf7-additional-settings" cols="100" rows="8" class="large-text" data-config-field="additional_settings.body"><?php echo esc_textarea( $post->prop( 'additional_settings' ) ); ?></textarea>
</fieldset>
<?php
}
PK     ¤^T]Ñ†Õx'  '    includes/tag-generator.phpnu „[µü¤        <?php

class WPCF7_TagGenerator {

	private static $instance;

	private $panels = array();

	private function __construct() {}

	public static function get_instance() {
		if ( empty( self::$instance ) ) {
			self::$instance = new self;
		}

		return self::$instance;
	}

	public function add( $id, $title, $callback, $options = array() ) {
		$id = trim( $id );

		if ( '' === $id
		or ! wpcf7_is_name( $id ) ) {
			return false;
		}

		$this->panels[$id] = array(
			'title' => $title,
			'content' => 'tag-generator-panel-' . $id,
			'options' => $options,
			'callback' => $callback,
		);

		return true;
	}

	public function print_buttons() {
		echo '<span id="tag-generator-list">';

		foreach ( (array) $this->panels as $panel ) {
			echo sprintf(
				'<a href="#TB_inline?width=900&height=500&inlineId=%1$s" class="thickbox button" title="%2$s">%3$s</a>',
				esc_attr( $panel['content'] ),
				esc_attr( sprintf(
					/* translators: %s: title of form-tag like 'email' or 'checkboxes' */
					__( 'Form-tag Generator: %s', 'contact-form-7' ),
					$panel['title'] ) ),
				esc_html( $panel['title'] )
			);
		}

		echo '</span>';
	}

	public function print_panels( WPCF7_ContactForm $contact_form ) {
		foreach ( (array) $this->panels as $id => $panel ) {
			$callback = $panel['callback'];

			$options = wp_parse_args( $panel['options'], array() );
			$options = array_merge( $options, array(
				'id' => $id,
				'title' => $panel['title'],
				'content' => $panel['content'],
			) );

			if ( is_callable( $callback ) ) {
				echo sprintf( '<div id="%s" class="hidden">',
					esc_attr( $options['content'] ) );
				echo sprintf(
					'<form action="" class="tag-generator-panel" data-id="%s">',
					$options['id'] );

				call_user_func( $callback, $contact_form, $options );

				echo '</form></div>';
			}
		}
	}

}
PK     ¤^T]ªÖ©Ý8  8    includes/config-validator.phpnu „[µü¤        <?php

add_action( 'wpcf7_admin_menu', 'wpcf7_admin_init_bulk_cv', 10, 0 );

function wpcf7_admin_init_bulk_cv() {
	if ( ! wpcf7_validate_configuration()
	or ! current_user_can( 'wpcf7_edit_contact_forms' ) ) {
		return;
	}

	$result = WPCF7::get_option( 'bulk_validate' );
	$last_important_update = '5.1.5';

	if ( ! empty( $result['version'] )
	and version_compare( $last_important_update, $result['version'], '<=' ) ) {
		return;
	}

	add_filter( 'wpcf7_admin_menu_change_notice',
		'wpcf7_admin_menu_change_notice_bulk_cv', 10, 1 );

	add_action( 'wpcf7_admin_warnings',
		'wpcf7_admin_warnings_bulk_cv', 5, 3 );
}

function wpcf7_admin_menu_change_notice_bulk_cv( $counts ) {
	$counts['wpcf7'] += 1;
	return $counts;
}

function wpcf7_admin_warnings_bulk_cv( $page, $action, $object ) {
	if ( 'wpcf7' === $page and 'validate' === $action ) {
		return;
	}

	$link = wpcf7_link(
		add_query_arg(
			array( 'action' => 'validate' ),
			menu_page_url( 'wpcf7', false )
		),
		__( 'Validate Contact Form 7 Configuration', 'contact-form-7' )
	);

	$message = __( "Misconfiguration leads to mail delivery failure or other troubles. Validate your contact forms now.", 'contact-form-7' );

	echo sprintf(
		'<div class="notice notice-warning"><p>%1$s &raquo; %2$s</p></div>',
		esc_html( $message ),
		$link
	);
}

add_action( 'wpcf7_admin_load', 'wpcf7_load_bulk_validate_page', 10, 2 );

function wpcf7_load_bulk_validate_page( $page, $action ) {
	if ( 'wpcf7' != $page
	or 'validate' != $action
	or ! wpcf7_validate_configuration()
	or 'POST' != $_SERVER['REQUEST_METHOD'] ) {
		return;
	}

	check_admin_referer( 'wpcf7-bulk-validate' );

	if ( ! current_user_can( 'wpcf7_edit_contact_forms' ) ) {
		wp_die( __( "You are not allowed to validate configuration.", 'contact-form-7' ) );
	}

	$contact_forms = WPCF7_ContactForm::find();

	$result = array(
		'timestamp' => current_time( 'timestamp' ),
		'version' => WPCF7_VERSION,
		'count_valid' => 0,
		'count_invalid' => 0,
	);

	foreach ( $contact_forms as $contact_form ) {
		$config_validator = new WPCF7_ConfigValidator( $contact_form );
		$config_validator->validate();
		$config_validator->save();

		if ( $config_validator->is_valid() ) {
			$result['count_valid'] += 1;
		} else {
			$result['count_invalid'] += 1;
		}
	}

	WPCF7::update_option( 'bulk_validate', $result );

	$redirect_to = add_query_arg(
		array(
			'message' => 'validated',
		),
		menu_page_url( 'wpcf7', false )
	);

	wp_safe_redirect( $redirect_to );
	exit();
}

function wpcf7_admin_bulk_validate_page() {
	$contact_forms = WPCF7_ContactForm::find();
	$count = WPCF7_ContactForm::count();

	$submit_text = sprintf(
		_n(
			/* translators: %s: number of contact forms */
			"Validate %s Contact Form Now",
			"Validate %s Contact Forms Now",
			$count, 'contact-form-7'
		),
		number_format_i18n( $count )
	);

?>
<div class="wrap">

<h1><?php echo esc_html( __( 'Validate Configuration', 'contact-form-7' ) ); ?></h1>

<form method="post" action="">
	<input type="hidden" name="action" value="validate" />
	<?php wp_nonce_field( 'wpcf7-bulk-validate' ); ?>
	<p><input type="submit" class="button" value="<?php echo esc_attr( $submit_text ); ?>" /></p>
</form>

<?php
	echo wpcf7_link(
		__( 'https://contactform7.com/configuration-validator-faq/', 'contact-form-7' ),
		__( 'FAQ about Configuration Validator', 'contact-form-7' )
	);
?>

</div>
<?php
}
PK     ¤^T]ä#¥Ó  Ó  +  includes/class-contact-forms-list-table.phpnu „[µü¤        <?php

if ( ! class_exists( 'WP_List_Table' ) ) {
	require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}

class WPCF7_Contact_Form_List_Table extends WP_List_Table {

	public static function define_columns() {
		$columns = array(
			'cb' => '<input type="checkbox" />',
			'title' => __( 'Title', 'contact-form-7' ),
			'shortcode' => __( 'Shortcode', 'contact-form-7' ),
			'author' => __( 'Author', 'contact-form-7' ),
			'date' => __( 'Date', 'contact-form-7' ),
		);

		return $columns;
	}

	public function __construct() {
		parent::__construct( array(
			'singular' => 'post',
			'plural' => 'posts',
			'ajax' => false,
		) );
	}

	public function prepare_items() {
		$current_screen = get_current_screen();
		$per_page = $this->get_items_per_page( 'cfseven_contact_forms_per_page' );

		$args = array(
			'posts_per_page' => $per_page,
			'orderby' => 'title',
			'order' => 'ASC',
			'offset' => ( $this->get_pagenum() - 1 ) * $per_page,
		);

		if ( ! empty( $_REQUEST['s'] ) ) {
			$args['s'] = $_REQUEST['s'];
		}

		if ( ! empty( $_REQUEST['orderby'] ) ) {
			if ( 'title' == $_REQUEST['orderby'] ) {
				$args['orderby'] = 'title';
			} elseif ( 'author' == $_REQUEST['orderby'] ) {
				$args['orderby'] = 'author';
			} elseif ( 'date' == $_REQUEST['orderby'] ) {
				$args['orderby'] = 'date';
			}
		}

		if ( ! empty( $_REQUEST['order'] ) ) {
			if ( 'asc' == strtolower( $_REQUEST['order'] ) ) {
				$args['order'] = 'ASC';
			} elseif ( 'desc' == strtolower( $_REQUEST['order'] ) ) {
				$args['order'] = 'DESC';
			}
		}

		$this->items = WPCF7_ContactForm::find( $args );

		$total_items = WPCF7_ContactForm::count();
		$total_pages = ceil( $total_items / $per_page );

		$this->set_pagination_args( array(
			'total_items' => $total_items,
			'total_pages' => $total_pages,
			'per_page' => $per_page,
		) );
	}

	public function get_columns() {
		return get_column_headers( get_current_screen() );
	}

	protected function get_sortable_columns() {
		$columns = array(
			'title' => array( 'title', true ),
			'author' => array( 'author', false ),
			'date' => array( 'date', false ),
		);

		return $columns;
	}

	protected function get_bulk_actions() {
		$actions = array(
			'delete' => __( 'Delete', 'contact-form-7' ),
		);

		return $actions;
	}

	protected function column_default( $item, $column_name ) {
		return '';
	}

	public function column_cb( $item ) {
		return sprintf(
			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
			$this->_args['singular'],
			$item->id()
		);
	}

	public function column_title( $item ) {
		$edit_link = add_query_arg(
			array(
				'post' => absint( $item->id() ),
				'action' => 'edit',
			),
			menu_page_url( 'wpcf7', false )
		);

		$output = sprintf(
			'<a class="row-title" href="%1$s" aria-label="%2$s">%3$s</a>',
			esc_url( $edit_link ),
			esc_attr( sprintf(
				/* translators: %s: title of contact form */
				__( 'Edit &#8220;%s&#8221;', 'contact-form-7' ),
				$item->title()
			) ),
			esc_html( $item->title() )
		);

		$output = sprintf( '<strong>%s</strong>', $output );

		if ( wpcf7_validate_configuration()
		and current_user_can( 'wpcf7_edit_contact_form', $item->id() ) ) {
			$config_validator = new WPCF7_ConfigValidator( $item );
			$config_validator->restore();

			if ( $count_errors = $config_validator->count_errors() ) {
				$error_notice = sprintf(
					_n(
						/* translators: %s: number of errors detected */
						'%s configuration error detected',
						'%s configuration errors detected',
						$count_errors, 'contact-form-7' ),
					number_format_i18n( $count_errors )
				);

				$output .= sprintf(
					'<div class="config-error"><span class="icon-in-circle" aria-hidden="true">!</span> %s</div>',
					$error_notice
				);
			}
		}

		return $output;
	}

	protected function handle_row_actions( $item, $column_name, $primary ) {
		if ( $column_name !== $primary ) {
			return '';
		}

		$edit_link = add_query_arg(
			array(
				'post' => absint( $item->id() ),
				'action' => 'edit',
			),
			menu_page_url( 'wpcf7', false )
		);

		$actions = array(
			'edit' => wpcf7_link( $edit_link, __( 'Edit', 'contact-form-7' ) ),
		);

		if ( current_user_can( 'wpcf7_edit_contact_form', $item->id() ) ) {
			$copy_link = add_query_arg(
				array(
					'post' => absint( $item->id() ),
					'action' => 'copy',
				),
				menu_page_url( 'wpcf7', false )
			);

			$copy_link = wp_nonce_url(
				$copy_link,
				'wpcf7-copy-contact-form_' . absint( $item->id() )
			);

			$actions = array_merge( $actions, array(
				'copy' => wpcf7_link( $copy_link, __( 'Duplicate', 'contact-form-7' ) ),
			) );
		}

		return $this->row_actions( $actions );
	}

	public function column_author( $item ) {
		$post = get_post( $item->id() );

		if ( ! $post ) {
			return;
		}

		$author = get_userdata( $post->post_author );

		if ( false === $author ) {
			return;
		}

		return esc_html( $author->display_name );
	}

	public function column_shortcode( $item ) {
		$shortcodes = array( $item->shortcode() );

		$output = '';

		foreach ( $shortcodes as $shortcode ) {
			$output .= "\n" . '<span class="shortcode"><input type="text"'
				. ' onfocus="this.select();" readonly="readonly"'
				. ' value="' . esc_attr( $shortcode ) . '"'
				. ' class="large-text code" /></span>';
		}

		return trim( $output );
	}

	public function column_date( $item ) {
		$post = get_post( $item->id() );

		if ( ! $post ) {
			return;
		}

		$t_time = mysql2date( __( 'Y/m/d g:i:s A', 'contact-form-7' ),
			$post->post_date, true );
		$m_time = $post->post_date;
		$time = mysql2date( 'G', $post->post_date )
			- get_option( 'gmt_offset' ) * 3600;

		$time_diff = time() - $time;

		if ( $time_diff > 0 and $time_diff < 24*60*60 ) {
			$h_time = sprintf(
				/* translators: %s: time since the creation of the contact form */
				__( '%s ago', 'contact-form-7' ),
				human_time_diff( $time )
			);
		} else {
			$h_time = mysql2date( __( 'Y/m/d', 'contact-form-7' ), $m_time );
		}

		return sprintf( '<abbr title="%2$s">%1$s</abbr>',
			esc_html( $h_time ),
			esc_attr( $t_time )
		);
	}
}
PK     ¤^T]ÉK•qY  Y    css/styles-rtl.cssnu „[µü¤        /*
 * Tabs
 */
#contact-form-editor-tabs {
	padding: 9px 10px 0 15px;
}

/*
 * Form Tab
 */
.tag-generator-panel {
	text-align: right;
}

.tag-generator-panel .control-box > fieldset legend {
	border: 1px solid #dfdfdf;
	border-right: 4px solid #00a0d2;
}

.tag-generator-panel .insert-box input.tag {
	float: right;
}

.tag-generator-panel .insert-box .submitbox input[type="button"] {
	float: left;
}

/*
 * Mail Tab
 */
.contact-form-editor-box-mail span.mailtag {
	margin: 0 4px 0 0;
}

/*
 * Welcome Panel
 */
.welcome-panel .welcome-panel-column,
.welcome-panel .welcome-panel-column:first-child {
	padding: 0 0 0 2%;
}

/*
 * Integration
 */
.card {
	border-left: 1px solid #e5e5e5;
	border-right: 4px solid #e5e5e5;
}

.card img.icon {
	float: right;
	margin: 8px -8px 8px 8px;
}

.card h2.title {
	float: right;
}

.card .infobox {
	float: left;
}
PK     ¤^T]�SÊ‰í   í     css/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ¤^T]²®�|  |    css/styles.cssnu „[µü¤        #titlediv .inside p.description {
	margin: 8px 2px 0;
}

#titlediv .inside p.description label {
	cursor: pointer;
}

span.shortcode {
	display: block;
	margin: 2px 0;
}

span.shortcode.old {
	background: #777;
	color: #fff;
}

span.shortcode input {
	font-size: 12px;
	border: none;
	box-shadow: none;
	padding: 4px 8px;
	margin: 0;
}

#wpcf7-contact-form-list-table span.shortcode input,
#wpcf7-contact-form-editor span.shortcode input {
	background: transparent;
}

#wpcf7-contact-form-list-table span.shortcode input {
	color: #444;
}

#wpcf7-contact-form-editor span.shortcode input {
	color: #fff;
}

#submitpost input.copy {
	margin-bottom: 10px;
}

#submitpost input.delete {
	padding: 0;
	margin: 0;
	border: none;
	cursor: pointer;
	background: inherit;
	color: #a00;
}

#submitpost input.delete:hover {
	color: #f00;
}

#submitpost input.delete:focus {
	outline: thin dotted;
}

.postbox-container .postbox h3 {
	border-bottom: 1px solid transparent;
}

.keyboard-interaction {
	visibility: hidden;
	color: #23282d;
}

div.config-error, span.config-error, ul.config-error {
	color: #444;
	font-style: normal;
	font-size: 13px;
}

ul.config-error {
	margin: 2px 0;
}

ul.config-error li {
	list-style: none;
	padding: 2px 2px;
	margin: 0;
}

[data-config-field][aria-invalid="true"] {
	border-color: #d00;
}

#contact-form-editor-tabs li a .icon-in-circle,
#contact-form-editor .config-error .icon-in-circle,
.wp-list-table .config-error .icon-in-circle,
.icon-in-circle {
	display: inline-block;
	vertical-align: text-top;
	margin: 1px 6px 0;
	padding: 0 5px;
	min-width: 7px;
	height: 17px;
	border-radius: 11px;
	background-color: #ca4a1f;
	color: #fff;
	font-size: 12px;
	font-weight: bold;
	line-height: 17px;
	text-align: center;
	z-index: 26;
}

/*
 * Tabs
 */
#contact-form-editor-tabs {
	border-bottom: 1px solid #aaa;
	padding: 9px 15px 0 10px;
	margin: 0;
}

#contact-form-editor-tabs li {
	display: inline-block;
	list-style: none;
	border: 1px solid #ccc;
	border-bottom: 1px solid #aaa;
	padding: 0;
	margin: 0 4px -1px;
	background-color: #e4e4e4;
}

#contact-form-editor-tabs li:hover {
	background-color: #fff;
}

#contact-form-editor-tabs li.ui-tabs-active,
#contact-form-editor-tabs li.ui-tabs-active:hover {
	border-top: 1px solid #aaa;
	border-right: 1px solid #aaa;
	border-left: 1px solid #aaa;
	border-bottom: 1px solid #f5f5f5;
	background-color: #f5f5f5;
}

#contact-form-editor-tabs li a {
	padding: 6px 10px;
	font-size: 14px;
	font-weight: normal;
	line-height: 30px;
	color: #333;
	text-decoration: none;
}

#contact-form-editor-tabs li.ui-tabs-active a {
	color: #000;
	font-size: 14px;
	font-weight: bold;
}

#contact-form-editor-tabs li a:hover {
	color: #000;
}

#contact-form-editor .contact-form-editor-panel > div.config-error {
	margin-bottom: 1.4em;
}

#contact-form-editor-tabs li.ui-tabs-active a .icon-in-circle {
	display: none;
}

#contact-form-editor .contact-form-editor-panel h2 {
	font-size: 18px;
	font-weight: 400;
	line-height: 24px;
	margin: 8px 0;
	padding: 0;
}

#contact-form-editor .contact-form-editor-panel {
	background-color: #f5f5f5;
	border: 1px solid #aaa;
	border-top: none;
	padding: 16px;
}

#contact-form-editor .form-table th {
	width: 100px;
}

#contact-form-editor .contact-form-editor-panel fieldset legend {
	line-height: 1.5;
	margin: .6em 0 .4em;
}

/*
 * Form Tab
 */
#tag-generator-list a.button {
	font-size: 12px;
	height: 26px;
	line-height: 24px;
	margin: 2px;
	padding: 0 8px 1px;
}

.tag-generator-panel {
	position: relative;
	height: 495px;
}

.tag-generator-panel .control-box {
	padding: 0;
	margin: 0;
	height: 380px;
	overflow: auto;
}

.tag-generator-panel .control-box > fieldset legend {
	border: 1px solid #dfdfdf;
	border-left: 4px solid #00a0d2;
	background: #f7fcfe;
	padding: 4px 12px;
	margin: 4px 0;
	line-height: 1.4em;
	width: 95%;
}

.tag-generator-panel table {
	width: 100%;
}

.tag-generator-panel table.form-table th {
	width: 120px;
	padding: 4px 10px 4px 0;
	font-size: 13px;
}

.tag-generator-panel table.form-table td {
	padding: 4px 10px;
	font-size: 13px;
}

.tag-generator-panel .control-box input.oneline {
	width: 200px;
}

.tag-generator-panel .control-box input.large-text {
	width: 400px;
}

.tag-generator-panel .control-box textarea.values {
	width: 200px;
	height: 6em;
}

.tag-generator-panel .control-box input[type="number"],
.tag-generator-panel .control-box input[type="date"] {
	width: 88px;
}

.tag-generator-panel .control-box table caption {
	text-align: left;
	font-size: 110%;
	font-weight: bold;
	color: #777;
	margin: 10px 0 5px;
}

.tag-generator-panel .control-box table.form-table td label {
	line-height: 1.1em;
}

.tag-generator-panel .control-box table.form-table td label .description {
	line-height: 1.4em;
}

.tag-generator-panel .insert-box {
	position: absolute;
	left: -15px;
	right: -15px;
	bottom: -15px;
	width: 100%;
	height: 84px;
	margin: 0;
	padding: 8px 16px;
	background-color: #fcfcfc;
	border-top: 1px solid #dfdfdf;
	overflow: auto;
}

.tag-generator-panel .insert-box input.tag {
	width: 480px;
	float: left;
	background-color: transparent;
	box-shadow: none;
}

.tag-generator-panel .insert-box .submitbox {
	padding: 2px 4px;
}

.tag-generator-panel .insert-box .submitbox input[type="button"] {
	float: right;
}

.tag-generator-panel .insert-box .description label {
	cursor: text;
}

/*
 * Mail Tab
 */
.contact-form-editor-box-mail span.mailtag {
	display: inline-block;
	margin: 0 0 0 4px;
	padding: 1px 2px;
	cursor: pointer;
	color: #000;
}

.contact-form-editor-box-mail span.mailtag.used {
	color: #666;
}

.contact-form-editor-box-mail span.mailtag.unused {
	font-weight: bold;
}

/*
 * Messages Tab
 */
#messages-panel p.description {
	margin: 5px 0 10px;
}

/*
 * List Table
 */
.fixed .column-title {
	width: 38%;
}

.fixed .column-shortcode {
	width: 38%;
}

/*
 * Welcome Panel
 */
.welcome-panel .welcome-panel-column,
.welcome-panel .welcome-panel-column:first-child {
	width: 48%;
	padding: 0 2% 0 0;
	margin: 0 0 1em 0;
}

@media screen and (max-width: 870px) {
	.welcome-panel .welcome-panel-column,
	.welcome-panel .welcome-panel-column:first-child {
		display: block;
		float: none;
		width: 100%;
	}
}

.welcome-panel h3 {
	font-size: 16px;
	font-weight: 600;
	line-height: 2.1em;
	margin: 1em 0 1.2em;
}

.welcome-panel h3 .dashicons {
	position: relative;
	top: -2px;
	display: inline-block;
	width: 60px;
	color: #575757;
	font-size: 40px;
}

.welcome-panel p a {
	font-weight: bold;
}

.welcome-panel-close {
	z-index: 2;
}

/*
 * Integration
 */
.card {
	background: #fff none repeat scroll 0 0;
	border: 1px solid #e5e5e5;
	border-left: 4px solid #e5e5e5;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
	margin-top: 20px;
	max-width: 520px;
	min-width: 255px;
	padding: 0.7em 2em 1em;
	position: relative;
}

.card.active {
	border-color: #00a0d2;
}

.card img.icon {
	float: left;
	margin: 8px 8px 8px -8px;
}

.card h2.title {
	float: left;
	max-width: 240px;
	font-size: 1.3em;
	font-weight: 600;
}

.card .infobox {
	float: right;
	font-size: 13px;
	color: #666;
	margin: 2px 0 5px;
	line-height: 1.5;
	max-width: 240px;
}

.card .inside .form-table th {
	padding: 15px 10px 15px 0;
	width: 160px;
}

.card .inside .form-table td {
	padding: 10px 10px;
}

.card .checkboxes li {
	margin: 0;
}
PK     ¤^T]ªcypˆ  ˆ    css/styles-dark-mode.cssnu „[µü¤        #wpcf7-contact-form-list-table span.shortcode input,
#wpcf7-contact-form-editor span.shortcode input {
	color: #fff;
}

div.config-error, span.config-error, ul.config-error {
	color: #bbc8d4;
}

.keyboard-interaction {
	color: #bbc8d4;
}

#contact-form-editor .contact-form-editor-panel {
	background-color: #32373c;
}

#contact-form-editor-tabs {
	border-bottom: 1px solid #aaa;
}

#contact-form-editor-tabs li {
	border: 1px solid #ccc;
	border-bottom: 1px solid #aaa;
	background-color: #37444c;
}

#contact-form-editor-tabs li:hover {
	background-color: #000;
}

#contact-form-editor-tabs li.ui-tabs-active,
#contact-form-editor-tabs li.ui-tabs-active:hover {
	border-top: 1px solid #aaa;
	border-right: 1px solid #aaa;
	border-left: 1px solid #aaa;
	border-bottom: 1px solid #32373c;
	background-color: #32373c;
}

#contact-form-editor-tabs li a {
	color: #bbc8d4;
}

#contact-form-editor-tabs li.ui-tabs-active a {
	color: #fff;
}

#contact-form-editor-tabs li a:hover {
	color: #fff;
}

.contact-form-editor-box-mail span.mailtag {
	color: #ddd;
}

.contact-form-editor-box-mail span.mailtag.used {
	color: #999;
}

#mail-panel .contact-form-editor-box-mail table.form-table tr th,
#mail-panel .contact-form-editor-box-mail table.form-table tr td {
	background-color: #32373c;
}

div.wrap#wpcf7-integration .card.active {
	border-color: #00a0d2;
}

div.wrap#wpcf7-integration .card .infobox {
	color: #aaa;
}
PK     ¤^T]à±ï*YC  YC  	  admin.phpnu „[µü¤        <?php

require_once WPCF7_PLUGIN_DIR . '/admin/includes/admin-functions.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/help-tabs.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/tag-generator.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/welcome-panel.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/config-validator.php';

add_action( 'admin_init', 'wpcf7_admin_init', 10, 0 );

function wpcf7_admin_init() {
	do_action( 'wpcf7_admin_init' );
}

add_action( 'admin_menu', 'wpcf7_admin_menu', 9, 0 );

function wpcf7_admin_menu() {
	global $_wp_last_object_menu;

	$_wp_last_object_menu++;

	do_action( 'wpcf7_admin_menu' );

	add_menu_page( __( 'Contact Form 7', 'contact-form-7' ),
		__( 'Contact', 'contact-form-7' )
			. wpcf7_admin_menu_change_notice(),
		'wpcf7_read_contact_forms', 'wpcf7',
		'wpcf7_admin_management_page', 'dashicons-email',
		$_wp_last_object_menu );

	$edit = add_submenu_page( 'wpcf7',
		__( 'Edit Contact Form', 'contact-form-7' ),
		__( 'Contact Forms', 'contact-form-7' )
			. wpcf7_admin_menu_change_notice( 'wpcf7' ),
		'wpcf7_read_contact_forms', 'wpcf7',
		'wpcf7_admin_management_page' );

	add_action( 'load-' . $edit, 'wpcf7_load_contact_form_admin', 10, 0 );

	$addnew = add_submenu_page( 'wpcf7',
		__( 'Add New Contact Form', 'contact-form-7' ),
		__( 'Add New', 'contact-form-7' )
			. wpcf7_admin_menu_change_notice( 'wpcf7-new' ),
		'wpcf7_edit_contact_forms', 'wpcf7-new',
		'wpcf7_admin_add_new_page' );

	add_action( 'load-' . $addnew, 'wpcf7_load_contact_form_admin', 10, 0 );

	$integration = WPCF7_Integration::get_instance();

	if ( $integration->service_exists() ) {
		$integration = add_submenu_page( 'wpcf7',
			__( 'Integration with Other Services', 'contact-form-7' ),
			__( 'Integration', 'contact-form-7' )
				. wpcf7_admin_menu_change_notice( 'wpcf7-integration' ),
			'wpcf7_manage_integration', 'wpcf7-integration',
			'wpcf7_admin_integration_page' );

		add_action( 'load-' . $integration, 'wpcf7_load_integration_page', 10, 0 );
	}
}

function wpcf7_admin_menu_change_notice( $menu_slug = '' ) {
	$counts = apply_filters( 'wpcf7_admin_menu_change_notice',
		array(
			'wpcf7' => 0,
			'wpcf7-new' => 0,
			'wpcf7-integration' => 0,
		)
	);

	if ( empty( $menu_slug ) ) {
		$count = absint( array_sum( $counts ) );
	} elseif ( isset( $counts[$menu_slug] ) ) {
		$count = absint( $counts[$menu_slug] );
	} else {
		$count = 0;
	}

	if ( $count ) {
		return sprintf(
			' <span class="update-plugins %1$d"><span class="plugin-count">%2$s</span></span>',
			$count,
			esc_html( number_format_i18n( $count ) )
		);
	}

	return '';
}

add_action( 'admin_enqueue_scripts', 'wpcf7_admin_enqueue_scripts', 10, 1 );

function wpcf7_admin_enqueue_scripts( $hook_suffix ) {
	if ( false === strpos( $hook_suffix, 'wpcf7' ) ) {
		return;
	}

	wp_enqueue_style( 'contact-form-7-admin',
		wpcf7_plugin_url( 'admin/css/styles.css' ),
		array(), WPCF7_VERSION, 'all'
	);

	if ( wpcf7_is_rtl() ) {
		wp_enqueue_style( 'contact-form-7-admin-rtl',
			wpcf7_plugin_url( 'admin/css/styles-rtl.css' ),
			array(), WPCF7_VERSION, 'all'
		);
	}

	wp_enqueue_script( 'wpcf7-admin',
		wpcf7_plugin_url( 'admin/js/scripts.js' ),
		array( 'jquery', 'jquery-ui-tabs' ),
		WPCF7_VERSION, true
	);

	$args = array(
		'apiSettings' => array(
			'root' => esc_url_raw( rest_url( 'contact-form-7/v1' ) ),
			'namespace' => 'contact-form-7/v1',
			'nonce' => ( wp_installing() && ! is_multisite() )
				? '' : wp_create_nonce( 'wp_rest' ),
		),
		'pluginUrl' => wpcf7_plugin_url(),
		'saveAlert' => __(
			"The changes you made will be lost if you navigate away from this page.",
			'contact-form-7' ),
		'activeTab' => isset( $_GET['active-tab'] )
			? (int) $_GET['active-tab'] : 0,
		'configValidator' => array(
			'errors' => array(),
			'howToCorrect' => __( "How to resolve?", 'contact-form-7' ),
			'oneError' => __( '1 configuration error detected', 'contact-form-7' ),
			'manyErrors' => __( '%d configuration errors detected', 'contact-form-7' ),
			'oneErrorInTab' => __( '1 configuration error detected in this tab panel', 'contact-form-7' ),
			'manyErrorsInTab' => __( '%d configuration errors detected in this tab panel', 'contact-form-7' ),
			'docUrl' => WPCF7_ConfigValidator::get_doc_link(),
			/* translators: screen reader text */
			'iconAlt' => __( '(configuration error)', 'contact-form-7' ),
		),
	);

	if ( $post = wpcf7_get_current_contact_form()
	and current_user_can( 'wpcf7_edit_contact_form', $post->id() )
	and wpcf7_validate_configuration() ) {
		$config_validator = new WPCF7_ConfigValidator( $post );
		$config_validator->restore();
		$args['configValidator']['errors'] =
			$config_validator->collect_error_messages();
	}

	wp_localize_script( 'wpcf7-admin', 'wpcf7', $args );

	add_thickbox();

	wp_enqueue_script( 'wpcf7-admin-taggenerator',
		wpcf7_plugin_url( 'admin/js/tag-generator.js' ),
		array( 'jquery', 'thickbox', 'wpcf7-admin' ), WPCF7_VERSION, true );
}

add_action( 'doing_dark_mode', 'wpcf7_dark_mode_support', 10, 1 );

function wpcf7_dark_mode_support( $user_id ) {
	wp_enqueue_style( 'contact-form-7-admin-dark-mode',
		wpcf7_plugin_url( 'admin/css/styles-dark-mode.css' ),
		array( 'contact-form-7-admin' ), WPCF7_VERSION, 'screen' );
}

add_filter( 'set-screen-option', 'wpcf7_set_screen_options', 10, 3 );

function wpcf7_set_screen_options( $result, $option, $value ) {
	$wpcf7_screens = array(
		'cfseven_contact_forms_per_page',
	);

	if ( in_array( $option, $wpcf7_screens ) ) {
		$result = $value;
	}

	return $result;
}

function wpcf7_load_contact_form_admin() {
	global $plugin_page;

	$action = wpcf7_current_action();

	do_action( 'wpcf7_admin_load',
		isset( $_GET['page'] ) ? trim( $_GET['page'] ) : '',
		$action
	);

	if ( 'save' == $action ) {
		$id = isset( $_POST['post_ID'] ) ? $_POST['post_ID'] : '-1';
		check_admin_referer( 'wpcf7-save-contact-form_' . $id );

		if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
			wp_die( __( 'You are not allowed to edit this item.', 'contact-form-7' ) );
		}

		$args = $_REQUEST;
		$args['id'] = $id;

		$args['title'] = isset( $_POST['post_title'] )
			? $_POST['post_title'] : null;

		$args['locale'] = isset( $_POST['wpcf7-locale'] )
			? $_POST['wpcf7-locale'] : null;

		$args['form'] = isset( $_POST['wpcf7-form'] )
			? $_POST['wpcf7-form'] : '';

		$args['mail'] = isset( $_POST['wpcf7-mail'] )
			? $_POST['wpcf7-mail'] : array();

		$args['mail_2'] = isset( $_POST['wpcf7-mail-2'] )
			? $_POST['wpcf7-mail-2'] : array();

		$args['messages'] = isset( $_POST['wpcf7-messages'] )
			? $_POST['wpcf7-messages'] : array();

		$args['additional_settings'] = isset( $_POST['wpcf7-additional-settings'] )
			? $_POST['wpcf7-additional-settings'] : '';

		$contact_form = wpcf7_save_contact_form( $args );

		if ( $contact_form and wpcf7_validate_configuration() ) {
			$config_validator = new WPCF7_ConfigValidator( $contact_form );
			$config_validator->validate();
			$config_validator->save();
		}

		$query = array(
			'post' => $contact_form ? $contact_form->id() : 0,
			'active-tab' => isset( $_POST['active-tab'] )
				? (int) $_POST['active-tab'] : 0,
		);

		if ( ! $contact_form ) {
			$query['message'] = 'failed';
		} elseif ( -1 == $id ) {
			$query['message'] = 'created';
		} else {
			$query['message'] = 'saved';
		}

		$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( 'copy' == $action ) {
		$id = empty( $_POST['post_ID'] )
			? absint( $_REQUEST['post'] )
			: absint( $_POST['post_ID'] );

		check_admin_referer( 'wpcf7-copy-contact-form_' . $id );

		if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
			wp_die( __( 'You are not allowed to edit this item.', 'contact-form-7' ) );
		}

		$query = array();

		if ( $contact_form = wpcf7_contact_form( $id ) ) {
			$new_contact_form = $contact_form->copy();
			$new_contact_form->save();

			$query['post'] = $new_contact_form->id();
			$query['message'] = 'created';
		}

		$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );

		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( 'delete' == $action ) {
		if ( ! empty( $_POST['post_ID'] ) ) {
			check_admin_referer( 'wpcf7-delete-contact-form_' . $_POST['post_ID'] );
		} elseif ( ! is_array( $_REQUEST['post'] ) ) {
			check_admin_referer( 'wpcf7-delete-contact-form_' . $_REQUEST['post'] );
		} else {
			check_admin_referer( 'bulk-posts' );
		}

		$posts = empty( $_POST['post_ID'] )
			? (array) $_REQUEST['post']
			: (array) $_POST['post_ID'];

		$deleted = 0;

		foreach ( $posts as $post ) {
			$post = WPCF7_ContactForm::get_instance( $post );

			if ( empty( $post ) ) {
				continue;
			}

			if ( ! current_user_can( 'wpcf7_delete_contact_form', $post->id() ) ) {
				wp_die( __( 'You are not allowed to delete this item.', 'contact-form-7' ) );
			}

			if ( ! $post->delete() ) {
				wp_die( __( 'Error in deleting.', 'contact-form-7' ) );
			}

			$deleted += 1;
		}

		$query = array();

		if ( ! empty( $deleted ) ) {
			$query['message'] = 'deleted';
		}

		$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );

		wp_safe_redirect( $redirect_to );
		exit();
	}

	$post = null;

	if ( 'wpcf7-new' == $plugin_page ) {
		$post = WPCF7_ContactForm::get_template( array(
			'locale' => isset( $_GET['locale'] ) ? $_GET['locale'] : null,
		) );
	} elseif ( ! empty( $_GET['post'] ) ) {
		$post = WPCF7_ContactForm::get_instance( $_GET['post'] );
	}

	$current_screen = get_current_screen();

	$help_tabs = new WPCF7_Help_Tabs( $current_screen );

	if ( $post
	and current_user_can( 'wpcf7_edit_contact_form', $post->id() ) ) {
		$help_tabs->set_help_tabs( 'edit' );
	} else {
		$help_tabs->set_help_tabs( 'list' );

		if ( ! class_exists( 'WPCF7_Contact_Form_List_Table' ) ) {
			require_once WPCF7_PLUGIN_DIR . '/admin/includes/class-contact-forms-list-table.php';
		}

		add_filter( 'manage_' . $current_screen->id . '_columns',
			array( 'WPCF7_Contact_Form_List_Table', 'define_columns' ), 10, 0 );

		add_screen_option( 'per_page', array(
			'default' => 20,
			'option' => 'cfseven_contact_forms_per_page',
		) );
	}
}

function wpcf7_admin_management_page() {
	if ( $post = wpcf7_get_current_contact_form() ) {
		$post_id = $post->initial() ? -1 : $post->id();

		require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php';
		require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
		return;
	}

	if ( 'validate' == wpcf7_current_action()
	and wpcf7_validate_configuration()
	and current_user_can( 'wpcf7_edit_contact_forms' ) ) {
		wpcf7_admin_bulk_validate_page();
		return;
	}

	$list_table = new WPCF7_Contact_Form_List_Table();
	$list_table->prepare_items();

?>
<div class="wrap" id="wpcf7-contact-form-list-table">

<h1 class="wp-heading-inline"><?php
	echo esc_html( __( 'Contact Forms', 'contact-form-7' ) );
?></h1>

<?php
	if ( current_user_can( 'wpcf7_edit_contact_forms' ) ) {
		echo wpcf7_link(
			menu_page_url( 'wpcf7-new', false ),
			__( 'Add New', 'contact-form-7' ),
			array( 'class' => 'page-title-action' )
		);
	}

	if ( ! empty( $_REQUEST['s'] ) ) {
		echo sprintf( '<span class="subtitle">'
			/* translators: %s: search keywords */
			. __( 'Search results for &#8220;%s&#8221;', 'contact-form-7' )
			. '</span>', esc_html( $_REQUEST['s'] )
		);
	}
?>

<hr class="wp-header-end">

<?php
	do_action( 'wpcf7_admin_warnings',
		'wpcf7', wpcf7_current_action(), null );

	wpcf7_welcome_panel();

	do_action( 'wpcf7_admin_notices',
		'wpcf7', wpcf7_current_action(), null );
?>

<form method="get" action="">
	<input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
	<?php $list_table->search_box( __( 'Search Contact Forms', 'contact-form-7' ), 'wpcf7-contact' ); ?>
	<?php $list_table->display(); ?>
</form>

</div>
<?php
}

function wpcf7_admin_add_new_page() {
	$post = wpcf7_get_current_contact_form();

	if ( ! $post ) {
		$post = WPCF7_ContactForm::get_template();
	}

	$post_id = -1;

	require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php';
	require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
}

function wpcf7_load_integration_page() {
	do_action( 'wpcf7_admin_load',
		isset( $_GET['page'] ) ? trim( $_GET['page'] ) : '',
		wpcf7_current_action()
	);

	$integration = WPCF7_Integration::get_instance();

	if ( isset( $_REQUEST['service'] )
	and $integration->service_exists( $_REQUEST['service'] ) ) {
		$service = $integration->get_service( $_REQUEST['service'] );
		$service->load( wpcf7_current_action() );
	}

	$help_tabs = new WPCF7_Help_Tabs( get_current_screen() );
	$help_tabs->set_help_tabs( 'integration' );
}

function wpcf7_admin_integration_page() {
	$integration = WPCF7_Integration::get_instance();

	$service = isset( $_REQUEST['service'] )
		? $integration->get_service( $_REQUEST['service'] )
		: null;

?>
<div class="wrap" id="wpcf7-integration">

<h1><?php echo esc_html( __( 'Integration with Other Services', 'contact-form-7' ) ); ?></h1>

<?php
	do_action( 'wpcf7_admin_warnings',
		'wpcf7-integration', wpcf7_current_action(), $service );

	do_action( 'wpcf7_admin_notices',
		'wpcf7-integration', wpcf7_current_action(), $service );

	if ( $service ) {
		$message = isset( $_REQUEST['message'] ) ? $_REQUEST['message'] : '';
		$service->admin_notice( $message );
		$integration->list_services( array( 'include' => $_REQUEST['service'] ) );
	} else {
		$integration->list_services();
	}
?>

</div>
<?php
}

/* Misc */

add_action( 'wpcf7_admin_notices', 'wpcf7_admin_updated_message', 10, 3 );

function wpcf7_admin_updated_message( $page, $action, $object ) {
	if ( ! in_array( $page, array( 'wpcf7', 'wpcf7-new' ) ) ) {
		return;
	}

	if ( empty( $_REQUEST['message'] ) ) {
		return;
	}

	if ( 'created' == $_REQUEST['message'] ) {
		$updated_message = __( "Contact form created.", 'contact-form-7' );
	} elseif ( 'saved' == $_REQUEST['message'] ) {
		$updated_message = __( "Contact form saved.", 'contact-form-7' );
	} elseif ( 'deleted' == $_REQUEST['message'] ) {
		$updated_message = __( "Contact form deleted.", 'contact-form-7' );
	}

	if ( ! empty( $updated_message ) ) {
		echo sprintf( '<div id="message" class="notice notice-success is-dismissible"><p>%s</p></div>', esc_html( $updated_message ) );
		return;
	}

	if ( 'failed' == $_REQUEST['message'] ) {
		$updated_message = __( "There was an error saving the contact form.",
			'contact-form-7' );

		echo sprintf( '<div id="message" class="notice notice-error is-dismissible"><p>%s</p></div>', esc_html( $updated_message ) );
		return;
	}

	if ( 'validated' == $_REQUEST['message'] ) {
		$bulk_validate = WPCF7::get_option( 'bulk_validate', array() );
		$count_invalid = isset( $bulk_validate['count_invalid'] )
			? absint( $bulk_validate['count_invalid'] ) : 0;

		if ( $count_invalid ) {
			$updated_message = sprintf(
				_n(
					/* translators: %s: number of contact forms */
					"Configuration validation completed. %s invalid contact form was found.",
					"Configuration validation completed. %s invalid contact forms were found.",
					$count_invalid, 'contact-form-7'
				),
				number_format_i18n( $count_invalid )
			);

			echo sprintf( '<div id="message" class="notice notice-warning is-dismissible"><p>%s</p></div>', esc_html( $updated_message ) );
		} else {
			$updated_message = __( "Configuration validation completed. No invalid contact form was found.", 'contact-form-7' );

			echo sprintf( '<div id="message" class="notice notice-success is-dismissible"><p>%s</p></div>', esc_html( $updated_message ) );
		}

		return;
	}
}

add_filter( 'plugin_action_links', 'wpcf7_plugin_action_links', 10, 2 );

function wpcf7_plugin_action_links( $links, $file ) {
	if ( $file != WPCF7_PLUGIN_BASENAME ) {
		return $links;
	}

	if ( ! current_user_can( 'wpcf7_read_contact_forms' ) ) {
		return $links;
	}

	$settings_link = wpcf7_link(
		menu_page_url( 'wpcf7', false ),
		__( 'Settings', 'contact-form-7' )
	);

	array_unshift( $links, $settings_link );

	return $links;
}

add_action( 'wpcf7_admin_warnings', 'wpcf7_old_wp_version_error', 10, 3 );

function wpcf7_old_wp_version_error( $page, $action, $object ) {
	$wp_version = get_bloginfo( 'version' );

	if ( ! version_compare( $wp_version, WPCF7_REQUIRED_WP_VERSION, '<' ) ) {
		return;
	}

?>
<div class="notice notice-warning">
<p><?php
	echo sprintf(
		/* translators: 1: version of Contact Form 7, 2: version of WordPress, 3: URL */
		__( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'contact-form-7' ),
		WPCF7_VERSION,
		WPCF7_REQUIRED_WP_VERSION,
		admin_url( 'update-core.php' )
	);
?></p>
</div>
<?php
}

add_action( 'wpcf7_admin_warnings', 'wpcf7_not_allowed_to_edit', 10, 3 );

function wpcf7_not_allowed_to_edit( $page, $action, $object ) {
	if ( $object instanceof WPCF7_ContactForm ) {
		$contact_form = $object;
	} else {
		return;
	}

	if ( current_user_can( 'wpcf7_edit_contact_form', $contact_form->id() ) ) {
		return;
	}

	$message = __( "You are not allowed to edit this contact form.",
		'contact-form-7' );

	echo sprintf(
		'<div class="notice notice-warning"><p>%s</p></div>',
		esc_html( $message ) );
}
PK     ¤^T]q•Œf%  %    edit-contact-form.phpnu „[µü¤        <?php

// don't load directly
if ( ! defined( 'ABSPATH' ) ) {
	die( '-1' );
}

function wpcf7_admin_save_button( $post_id ) {
	static $button = '';

	if ( ! empty( $button ) ) {
		echo $button;
		return;
	}

	$nonce = wp_create_nonce( 'wpcf7-save-contact-form_' . $post_id );

	$onclick = sprintf(
		"this.form._wpnonce.value = '%s';"
		. " this.form.action.value = 'save';"
		. " return true;",
		$nonce );

	$button = sprintf(
		'<input type="submit" class="button-primary" name="wpcf7-save" value="%1$s" onclick="%2$s" />',
		esc_attr( __( 'Save', 'contact-form-7' ) ),
		$onclick );

	echo $button;
}

?><div class="wrap" id="wpcf7-contact-form-editor">

<h1 class="wp-heading-inline"><?php
	if ( $post->initial() ) {
		echo esc_html( __( 'Add New Contact Form', 'contact-form-7' ) );
	} else {
		echo esc_html( __( 'Edit Contact Form', 'contact-form-7' ) );
	}
?></h1>

<?php
	if ( ! $post->initial()
	and current_user_can( 'wpcf7_edit_contact_forms' ) ) {
		echo wpcf7_link(
			menu_page_url( 'wpcf7-new', false ),
			__( 'Add New', 'contact-form-7' ),
			array( 'class' => 'page-title-action' )
		);
	}
?>

<hr class="wp-header-end">

<?php
	do_action( 'wpcf7_admin_warnings',
		$post->initial() ? 'wpcf7-new' : 'wpcf7',
		wpcf7_current_action(),
		$post
	);

	do_action( 'wpcf7_admin_notices',
		$post->initial() ? 'wpcf7-new' : 'wpcf7',
		wpcf7_current_action(),
		$post
	);
?>

<?php
if ( $post ) :

	if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) {
		$disabled = '';
	} else {
		$disabled = ' disabled="disabled"';
	}
?>

<form method="post" action="<?php echo esc_url( add_query_arg( array( 'post' => $post_id ), menu_page_url( 'wpcf7', false ) ) ); ?>" id="wpcf7-admin-form-element"<?php do_action( 'wpcf7_post_edit_form_tag' ); ?>>
<?php
	if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) {
		wp_nonce_field( 'wpcf7-save-contact-form_' . $post_id );
	}
?>
<input type="hidden" id="post_ID" name="post_ID" value="<?php echo (int) $post_id; ?>" />
<input type="hidden" id="wpcf7-locale" name="wpcf7-locale" value="<?php echo esc_attr( $post->locale() ); ?>" />
<input type="hidden" id="hiddenaction" name="action" value="save" />
<input type="hidden" id="active-tab" name="active-tab" value="<?php echo isset( $_GET['active-tab'] ) ? (int) $_GET['active-tab'] : '0'; ?>" />

<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<div id="post-body-content">
<div id="titlediv">
<div id="titlewrap">
	<label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo esc_html( __( 'Enter title here', 'contact-form-7' ) ); ?></label>
<?php
	$posttitle_atts = array(
		'type' => 'text',
		'name' => 'post_title',
		'size' => 30,
		'value' => $post->initial() ? '' : $post->title(),
		'id' => 'title',
		'spellcheck' => 'true',
		'autocomplete' => 'off',
		'disabled' =>
			current_user_can( 'wpcf7_edit_contact_form', $post_id ) ? '' : 'disabled',
	);

	echo sprintf( '<input %s />', wpcf7_format_atts( $posttitle_atts ) );
?>
</div><!-- #titlewrap -->

<div class="inside">
<?php
	if ( ! $post->initial() ) :
?>
	<p class="description">
	<label for="wpcf7-shortcode"><?php echo esc_html( __( "Copy this shortcode and paste it into your post, page, or text widget content:", 'contact-form-7' ) ); ?></label>
	<span class="shortcode wp-ui-highlight"><input type="text" id="wpcf7-shortcode" onfocus="this.select();" readonly="readonly" class="large-text code" value="<?php echo esc_attr( $post->shortcode() ); ?>" /></span>
	</p>
<?php
		if ( $old_shortcode = $post->shortcode( array( 'use_old_format' => true ) ) ) :
?>
	<p class="description">
	<label for="wpcf7-shortcode-old"><?php echo esc_html( __( "You can also use this old-style shortcode:", 'contact-form-7' ) ); ?></label>
	<span class="shortcode old"><input type="text" id="wpcf7-shortcode-old" onfocus="this.select();" readonly="readonly" class="large-text code" value="<?php echo esc_attr( $old_shortcode ); ?>" /></span>
	</p>
<?php
		endif;
	endif;
?>
</div>
</div><!-- #titlediv -->
</div><!-- #post-body-content -->

<div id="postbox-container-1" class="postbox-container">
<?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) : ?>
<div id="submitdiv" class="postbox">
<h3><?php echo esc_html( __( 'Status', 'contact-form-7' ) ); ?></h3>
<div class="inside">
<div class="submitbox" id="submitpost">

<div id="minor-publishing-actions">

<div class="hidden">
	<input type="submit" class="button-primary" name="wpcf7-save" value="<?php echo esc_attr( __( 'Save', 'contact-form-7' ) ); ?>" />
</div>

<?php
	if ( ! $post->initial() ) :
		$copy_nonce = wp_create_nonce( 'wpcf7-copy-contact-form_' . $post_id );
?>
	<input type="submit" name="wpcf7-copy" class="copy button" value="<?php echo esc_attr( __( 'Duplicate', 'contact-form-7' ) ); ?>" <?php echo "onclick=\"this.form._wpnonce.value = '$copy_nonce'; this.form.action.value = 'copy'; return true;\""; ?> />
<?php endif; ?>
</div><!-- #minor-publishing-actions -->

<div id="misc-publishing-actions">
<?php do_action( 'wpcf7_admin_misc_pub_section', $post_id ); ?>
</div><!-- #misc-publishing-actions -->

<div id="major-publishing-actions">

<?php
	if ( ! $post->initial() ) :
		$delete_nonce = wp_create_nonce( 'wpcf7-delete-contact-form_' . $post_id );
?>
<div id="delete-action">
	<input type="submit" name="wpcf7-delete" class="delete submitdelete" value="<?php echo esc_attr( __( 'Delete', 'contact-form-7' ) ); ?>" <?php echo "onclick=\"if (confirm('" . esc_js( __( "You are about to delete this contact form.\n  'Cancel' to stop, 'OK' to delete.", 'contact-form-7' ) ) . "')) {this.form._wpnonce.value = '$delete_nonce'; this.form.action.value = 'delete'; return true;} return false;\""; ?> />
</div><!-- #delete-action -->
<?php endif; ?>

<div id="publishing-action">
	<span class="spinner"></span>
	<?php wpcf7_admin_save_button( $post_id ); ?>
</div>
<div class="clear"></div>
</div><!-- #major-publishing-actions -->
</div><!-- #submitpost -->
</div>
</div><!-- #submitdiv -->
<?php endif; ?>

<div id="informationdiv" class="postbox">
<h3><?php echo esc_html( __( "Do you need help?", 'contact-form-7' ) ); ?></h3>
<div class="inside">
	<p><?php echo esc_html( __( "Here are some available options to help solve your problems.", 'contact-form-7' ) ); ?></p>
	<ol>
		<li><?php echo sprintf(
			/* translators: 1: FAQ, 2: Docs ("FAQ & Docs") */
			__( '%1$s &#38; %2$s', 'contact-form-7' ),
			wpcf7_link(
				__( 'https://contactform7.com/faq/', 'contact-form-7' ),
				__( 'FAQ', 'contact-form-7' )
			),
			wpcf7_link(
				__( 'https://contactform7.com/docs/', 'contact-form-7' ),
				__( 'Docs', 'contact-form-7' )
			)
		); ?></li>
		<li><?php echo wpcf7_link(
			__( 'https://wordpress.org/support/plugin/contact-form-7/', 'contact-form-7' ),
			__( 'Support Forums', 'contact-form-7' )
		); ?></li>
		<li><?php echo wpcf7_link(
			__( 'https://contactform7.com/custom-development/', 'contact-form-7' ),
			__( 'Professional Services', 'contact-form-7' )
		); ?></li>
	</ol>
</div>
</div><!-- #informationdiv -->

</div><!-- #postbox-container-1 -->

<div id="postbox-container-2" class="postbox-container">
<div id="contact-form-editor">
<div class="keyboard-interaction"><?php
	echo sprintf(
		/* translators: 1: â—€ â–¶ dashicon, 2: screen reader text for the dashicon */
		esc_html( __( '%1$s %2$s keys switch panels', 'contact-form-7' ) ),
		'<span class="dashicons dashicons-leftright" aria-hidden="true"></span>',
		sprintf(
			'<span class="screen-reader-text">%s</span>',
			/* translators: screen reader text */
			esc_html( __( '(left and right arrow)', 'contact-form-7' ) )
		)
	);
?></div>

<?php

	$editor = new WPCF7_Editor( $post );
	$panels = array();

	if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) {
		$panels = array(
			'form-panel' => array(
				'title' => __( 'Form', 'contact-form-7' ),
				'callback' => 'wpcf7_editor_panel_form',
			),
			'mail-panel' => array(
				'title' => __( 'Mail', 'contact-form-7' ),
				'callback' => 'wpcf7_editor_panel_mail',
			),
			'messages-panel' => array(
				'title' => __( 'Messages', 'contact-form-7' ),
				'callback' => 'wpcf7_editor_panel_messages',
			),
		);

		$additional_settings = trim( $post->prop( 'additional_settings' ) );
		$additional_settings = explode( "\n", $additional_settings );
		$additional_settings = array_filter( $additional_settings );
		$additional_settings = count( $additional_settings );

		$panels['additional-settings-panel'] = array(
			'title' => $additional_settings
				? sprintf(
					/* translators: %d: number of additional settings */
					__( 'Additional Settings (%d)', 'contact-form-7' ),
					$additional_settings )
				: __( 'Additional Settings', 'contact-form-7' ),
			'callback' => 'wpcf7_editor_panel_additional_settings',
		);
	}

	$panels = apply_filters( 'wpcf7_editor_panels', $panels );

	foreach ( $panels as $id => $panel ) {
		$editor->add_panel( $id, $panel['title'], $panel['callback'] );
	}

	$editor->display();
?>
</div><!-- #contact-form-editor -->

<?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) : ?>
<p class="submit"><?php wpcf7_admin_save_button( $post_id ); ?></p>
<?php endif; ?>

</div><!-- #postbox-container-2 -->

</div><!-- #post-body -->
<br class="clear" />
</div><!-- #poststuff -->
</form>

<?php endif; ?>

</div><!-- .wrap -->

<?php

	$tag_generator = WPCF7_TagGenerator::get_instance();
	$tag_generator->print_panels( $post );

	do_action( 'wpcf7_admin_footer', $post );
PK     ¤^T]�SÊ‰í   í     images/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ¤^T]A'©      js/tag-generator.jsnu „[µü¤        ( function( $ ) {

	'use strict';

	if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) {
		return;
	}

	wpcf7.taggen = {};

	$( function() {
		$( 'form.tag-generator-panel' ).each( function() {
			wpcf7.taggen.update( $( this ) );
		} );
	} );

	$( 'form.tag-generator-panel' ).submit( function() {
		return false;
	} );

	$( 'form.tag-generator-panel .control-box :input' ).change( function() {
		var $form = $( this ).closest( 'form.tag-generator-panel' );
		wpcf7.taggen.normalize( $( this ) );
		wpcf7.taggen.update( $form );
	} );

	$( 'input.insert-tag' ).click( function() {
		var $form = $( this ).closest( 'form.tag-generator-panel' );
		var tag = $form.find( 'input.tag' ).val();
		wpcf7.taggen.insert( tag );
		tb_remove(); // close thickbox
		return false;
	} );

	wpcf7.taggen.update = function( $form ) {
		var id = $form.attr( 'data-id' );
		var name = '';
		var name_fields = $form.find( 'input[name="name"]' );

		if ( name_fields.length ) {
			name = name_fields.val();

			if ( '' === name ) {
				name = id + '-' + Math.floor( Math.random() * 1000 );
				name_fields.val( name );
			}
		}

		if ( $.isFunction( wpcf7.taggen.update[ id ] ) ) {
			return wpcf7.taggen.update[ id ].call( this, $form );
		}

		$form.find( 'input.tag' ).each( function() {
			var tag_type = $( this ).attr( 'name' );

			if ( $form.find( ':input[name="tagtype"]' ).length ) {
				tag_type = $form.find( ':input[name="tagtype"]' ).val();
			}

			if ( $form.find( ':input[name="required"]' ).is( ':checked' ) ) {
				tag_type += '*';
			}

			var components = wpcf7.taggen.compose( tag_type, $form );
			$( this ).val( components );
		} );

		$form.find( 'span.mail-tag' ).text( '[' + name + ']' );

		$form.find( 'input.mail-tag' ).each( function() {
			$( this ).val( '[' + name + ']' );
		} );
	};

	wpcf7.taggen.update.captcha = function( $form ) {
		var captchac = wpcf7.taggen.compose( 'captchac', $form );
		var captchar = wpcf7.taggen.compose( 'captchar', $form );

		$form.find( 'input.tag' ).val( captchac + ' ' + captchar );
	};

	wpcf7.taggen.compose = function( tagType, $form ) {
		var name = $form.find( 'input[name="name"]' ).val();
		var scope = $form.find( '.scope.' + tagType );

		if ( ! scope.length ) {
			scope = $form;
		}

		var options = [];

		scope.find( 'input.option' ).not( ':checkbox,:radio' ).each( function( i ) {
			var val = $( this ).val();

			if ( ! val ) {
				return;
			}

			if ( $( this ).hasClass( 'filetype' ) ) {
				val = val.split( /[,|\s]+/ ).join( '|' );
			}

			if ( $( this ).hasClass( 'color' ) ) {
				val = '#' + val;
			}

			if ( 'class' == $( this ).attr( 'name' ) ) {
				$.each( val.split( ' ' ), function( i, n ) {
					options.push( 'class:' + n );
				} );
			} else {
				options.push( $( this ).attr( 'name' ) + ':' + val );
			}
		} );

		scope.find( 'input:checkbox.option' ).each( function( i ) {
			if ( $( this ).is( ':checked' ) ) {
				options.push( $( this ).attr( 'name' ) );
			}
		} );

		scope.find( 'input:radio.option' ).each( function( i ) {
			if ( $( this ).is( ':checked' ) && ! $( this ).hasClass( 'default' ) ) {
				options.push( $( this ).attr( 'name' ) + ':' + $( this ).val() );
			}
		} );

		if ( 'radio' == tagType ) {
			options.push( 'default:1' );
		}

		options = ( options.length > 0 ) ? options.join( ' ' ) : '';

		var value = '';

		if ( scope.find( ':input[name="values"]' ).val() ) {
			$.each(
				scope.find( ':input[name="values"]' ).val().split( "\n" ),
				function( i, n ) {
					value += ' "' + n.replace( /["]/g, '&quot;' ) + '"';
				}
			);
		}

		var components = [];

		$.each( [ tagType, name, options, value ], function( i, v ) {
			v = $.trim( v );

			if ( '' != v ) {
				components.push( v );
			}
		} );

		components = $.trim( components.join( ' ' ) );
		components = '[' + components + ']';

		var content = scope.find( ':input[name="content"]' ).val();
		content = $.trim( content );

		if ( content ) {
			components += ' ' + content + ' [/' + tagType + ']';
		}

		return components;
	};

	wpcf7.taggen.normalize = function( $input ) {
		var val = $input.val();

		if ( $input.is( 'input[name="name"]' ) ) {
			val = val.replace( /[^0-9a-zA-Z:._-]/g, '' ).replace( /^[^a-zA-Z]+/, '' );
		}

		if ( $input.is( '.numeric' ) ) {
			val = val.replace( /[^0-9.-]/g, '' );
		}

		if ( $input.is( '.idvalue' ) ) {
			val = val.replace( /[^-0-9a-zA-Z_]/g, '' );
		}

		if ( $input.is( '.classvalue' ) ) {
			val = $.map( val.split( ' ' ), function( n ) {
				return n.replace( /[^-0-9a-zA-Z_]/g, '' );
			} ).join( ' ' );

			val = $.trim( val.replace( /\s+/g, ' ' ) );
		}

		if ( $input.is( '.color' ) ) {
			val = val.replace( /[^0-9a-fA-F]/g, '' );
		}

		if ( $input.is( '.filesize' ) ) {
			val = val.replace( /[^0-9kKmMbB]/g, '' );
		}

		if ( $input.is( '.filetype' ) ) {
			val = val.replace( /[^0-9a-zA-Z.,|\s]/g, '' );
		}

		if ( $input.is( '.date' ) ) {
			// 'yyyy-mm-dd' ISO 8601 format
			if ( ! val.match( /^\d{4}-\d{2}-\d{2}$/ ) ) {
				val = '';
			}
		}

		if ( $input.is( ':input[name="values"]' ) ) {
			val = $.trim( val );
		}

		$input.val( val );

		if ( $input.is( ':checkbox.exclusive' ) ) {
			wpcf7.taggen.exclusiveCheckbox( $input );
		}
	};

	wpcf7.taggen.exclusiveCheckbox = function( $cb ) {
		if ( $cb.is( ':checked' ) ) {
			$cb.siblings( ':checkbox.exclusive' ).prop( 'checked', false );
		}
	};

	wpcf7.taggen.insert = function( content ) {
		$( 'textarea#wpcf7-form' ).each( function() {
			this.focus();

			if ( document.selection ) { // IE
				var selection = document.selection.createRange();
				selection.text = content;
			} else if ( this.selectionEnd || 0 === this.selectionEnd ) {
				var val = $( this ).val();
				var end = this.selectionEnd;
				$( this ).val( val.substring( 0, end ) +
					content + val.substring( end, val.length ) );
				this.selectionStart = end + content.length;
				this.selectionEnd = end + content.length;
			} else {
				$( this ).val( $( this ).val() + content );
			}

			this.focus();
		} );
	};

} )( jQuery );
PK     ¤^T]�SÊ‰í   í     js/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     ¤^T]¥ãÚ™  ™    js/scripts.jsnu „[µü¤        ( function( $ ) {

	'use strict';

	if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) {
		return;
	}

	$( function() {
		var welcomePanel = $( '#welcome-panel' );
		var updateWelcomePanel;

		updateWelcomePanel = function( visible ) {
			$.post( ajaxurl, {
				action: 'wpcf7-update-welcome-panel',
				visible: visible,
				welcomepanelnonce: $( '#welcomepanelnonce' ).val()
			} );
		};

		$( 'a.welcome-panel-close', welcomePanel ).click( function( event ) {
			event.preventDefault();
			welcomePanel.addClass( 'hidden' );
			updateWelcomePanel( 0 );
		} );

		$( '#contact-form-editor' ).tabs( {
			active: wpcf7.activeTab,
			activate: function( event, ui ) {
				$( '#active-tab' ).val( ui.newTab.index() );
			}
		} );

		$( '#contact-form-editor-tabs' ).focusin( function( event ) {
			$( '#contact-form-editor .keyboard-interaction' ).css(
				'visibility', 'visible' );
		} ).focusout( function( event ) {
			$( '#contact-form-editor .keyboard-interaction' ).css(
				'visibility', 'hidden' );
		} );

		wpcf7.toggleMail2( 'input:checkbox.toggle-form-table' );

		$( 'input:checkbox.toggle-form-table' ).click( function( event ) {
			wpcf7.toggleMail2( this );
		} );

		if ( '' === $( '#title' ).val() ) {
			$( '#title' ).focus();
		}

		wpcf7.titleHint();

		$( '.contact-form-editor-box-mail span.mailtag' ).click( function( event ) {
			var range = document.createRange();
			range.selectNodeContents( this );
			window.getSelection().addRange( range );
		} );

		wpcf7.updateConfigErrors();

		$( '[data-config-field]' ).change( function() {
			var postId = $( '#post_ID' ).val();

			if ( ! postId || -1 == postId ) {
				return;
			}

			var data = [];

			$( this ).closest( 'form' ).find( '[data-config-field]' ).each( function() {
				data.push( {
					'name': $( this ).attr( 'name' ).replace( /^wpcf7-/, '' ).replace( /-/g, '_' ),
					'value': $( this ).val()
				} );
			} );

			data.push( { 'name': 'context', 'value': 'dry-run' } );

			$.ajax( {
				method: 'POST',
				url: wpcf7.apiSettings.getRoute( '/contact-forms/' + postId ),
				beforeSend: function( xhr ) {
					xhr.setRequestHeader( 'X-WP-Nonce', wpcf7.apiSettings.nonce );
				},
				data: data
			} ).done( function( response ) {
				wpcf7.configValidator.errors = response.config_errors;
				wpcf7.updateConfigErrors();
			} );
		} );

		$( window ).on( 'beforeunload', function( event ) {
			var changed = false;

			$( '#wpcf7-admin-form-element :input[type!="hidden"]' ).each( function() {
				if ( $( this ).is( ':checkbox, :radio' ) ) {
					if ( this.defaultChecked != $( this ).is( ':checked' ) ) {
						changed = true;
					}
				} else if ( $( this ).is( 'select' ) ) {
					$( this ).find( 'option' ).each( function() {
						if ( this.defaultSelected != $( this ).is( ':selected' ) ) {
							changed = true;
						}
					} );
				} else {
					if ( this.defaultValue != $( this ).val() ) {
						changed = true;
					}
				}
			} );

			if ( changed ) {
				event.returnValue = wpcf7.saveAlert;
				return wpcf7.saveAlert;
			}
		} );

		$( '#wpcf7-admin-form-element' ).submit( function() {
			if ( 'copy' != this.action.value ) {
				$( window ).off( 'beforeunload' );
			}

			if ( 'save' == this.action.value ) {
				$( '#publishing-action .spinner' ).addClass( 'is-active' );
			}
		} );
	} );

	wpcf7.toggleMail2 = function( checkbox ) {
		var $checkbox = $( checkbox );
		var $fieldset = $( 'fieldset',
			$checkbox.closest( '.contact-form-editor-box-mail' ) );

		if ( $checkbox.is( ':checked' ) ) {
			$fieldset.removeClass( 'hidden' );
		} else {
			$fieldset.addClass( 'hidden' );
		}
	};

	wpcf7.updateConfigErrors = function() {
		var errors = wpcf7.configValidator.errors;
		var errorCount = { total: 0 };

		$( '[data-config-field]' ).each( function() {
			$( this ).removeAttr( 'aria-invalid' );
			$( this ).next( 'ul.config-error' ).remove();

			var section = $( this ).attr( 'data-config-field' );

			if ( errors[ section ] ) {
				var $list = $( '<ul></ul>' ).attr( {
					'role': 'alert',
					'class': 'config-error'
				} );

				$.each( errors[ section ], function( i, val ) {
					var $li = $( '<li></li>' ).append(
						wpcf7.iconInCircle( '!' )
					).append(
						$( '<span class="screen-reader-text"></span>' ).text( wpcf7.configValidator.iconAlt )
					).append( ' ' );

					if ( val.link ) {
						$li.append(
							$( '<a></a>' ).attr( 'href', val.link ).text( val.message )
						);
					} else {
						$li.text( val.message );
					}

					$li.appendTo( $list );

					var tab = section
						.replace( /^mail_\d+\./, 'mail.' ).replace( /\..*$/, '' );

					if ( ! errorCount[ tab ] ) {
						errorCount[ tab ] = 0;
					}

					errorCount[ tab ] += 1;

					errorCount.total += 1;
				} );

				$( this ).after( $list ).attr( { 'aria-invalid': 'true' } );
			}
		} );

		$( '#contact-form-editor-tabs > li' ).each( function() {
			var $item = $( this );
			$item.find( '.icon-in-circle' ).remove();
			var tab = $item.attr( 'id' ).replace( /-panel-tab$/, '' );

			$.each( errors, function( key, val ) {
				key = key.replace( /^mail_\d+\./, 'mail.' );

				if ( key.replace( /\..*$/, '' ) == tab.replace( '-', '_' ) ) {
					var $mark = wpcf7.iconInCircle( '!' );
					$item.find( 'a.ui-tabs-anchor' ).first().append( $mark );
					return false;
				}
			} );

			var $tabPanelError = $( '#' + tab + '-panel > div.config-error:first' );
			$tabPanelError.empty();

			if ( errorCount[ tab.replace( '-', '_' ) ] ) {
				$tabPanelError.append( wpcf7.iconInCircle( '!' ) );

				if ( 1 < errorCount[ tab.replace( '-', '_' ) ] ) {
					var manyErrorsInTab = wpcf7.configValidator.manyErrorsInTab
						.replace( '%d', errorCount[ tab.replace( '-', '_' ) ] );
					$tabPanelError.append( manyErrorsInTab );
				} else {
					$tabPanelError.append( wpcf7.configValidator.oneErrorInTab );
				}
			}
		} );

		$( '#misc-publishing-actions .misc-pub-section.config-error' ).remove();

		if ( errorCount.total ) {
			var $warning = $( '<div></div>' )
				.addClass( 'misc-pub-section config-error' )
				.append( wpcf7.iconInCircle( '!' ) );

			if ( 1 < errorCount.total ) {
				$warning.append(
					wpcf7.configValidator.manyErrors.replace( '%d', errorCount.total )
				);
			} else {
				$warning.append( wpcf7.configValidator.oneError );
			}

			$warning.append( '<br />' ).append(
				$( '<a></a>' )
					.attr( 'href', wpcf7.configValidator.docUrl )
					.text( wpcf7.configValidator.howToCorrect )
			);

			$( '#misc-publishing-actions' ).append( $warning );
		}
	};

	/**
	 * Copied from wptitlehint() in wp-admin/js/post.js
	 */
	wpcf7.titleHint = function() {
		var $title = $( '#title' );
		var $titleprompt = $( '#title-prompt-text' );

		if ( '' === $title.val() ) {
			$titleprompt.removeClass( 'screen-reader-text' );
		}

		$titleprompt.click( function() {
			$( this ).addClass( 'screen-reader-text' );
			$title.focus();
		} );

		$title.blur( function() {
			if ( '' === $(this).val() ) {
				$titleprompt.removeClass( 'screen-reader-text' );
			}
		} ).focus( function() {
			$titleprompt.addClass( 'screen-reader-text' );
		} ).keydown( function( e ) {
			$titleprompt.addClass( 'screen-reader-text' );
			$( this ).unbind( e );
		} );
	};

	wpcf7.iconInCircle = function( icon ) {
		var $span = $( '<span class="icon-in-circle" aria-hidden="true"></span>' );
		return $span.text( icon );
	};

	wpcf7.apiSettings.getRoute = function( path ) {
		var url = wpcf7.apiSettings.root;

		url = url.replace(
			wpcf7.apiSettings.namespace,
			wpcf7.apiSettings.namespace + path );

		return url;
	};

} )( jQuery );
PK       ”T]Ýp7  7                  import/class-import-plugin.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               …  import/.htaccessnu ƒ7�æm        PK       ”T]ž­ì}  }               ²  import/class-import-settings.phpnu „[µü¤        PK       ”T]ñí:êe   e   1              import/plugins/class-abstract-plugin-importer.phpnu „[µü¤        PK       ”T]%/›8¶	  ¶	  &            E3  import/plugins/class-import-aioseo.phpnu „[µü¤        PK       ”T]nÌ5
  
  -            Q=  import/plugins/class-import-woothemes-seo.phpnu „[µü¤        PK       ”T]UžŠ k  k  1            ºG  import/plugins/class-import-platinum-seo-pack.phpnu „[µü¤        PK       ”T]}ÍmV  V  *            †S  import/plugins/class-import-seopressor.phpnu „[µü¤        PK       ”T]ùóÐ    %            6g  import/plugins/class-import-wpseo.phpnu „[µü¤        PK       ”T]žÙhÑ    )            ¨„  import/plugins/class-import-headspace.phpnu „[µü¤        PK       ”T]™R””o  o  +            ‰  import/plugins/class-import-wp-meta-seo.phpnu „[µü¤        PK       ”T]{H¸j  j  "            à�  import/plugins/class-importers.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               œ“  import/plugins/.htaccessnu ƒ7�æm        PK       ”T]
ÀŸ-  -  0            Ñ”  import/plugins/class-import-premium-seo-pack.phpnu „[µü¤        PK       ”T]ÅˆÂç  ç  '            ^˜  import/plugins/class-import-jetpack.phpnu „[µü¤        PK       ”T]ßäÉ    (            œ›  import/plugins/class-import-squirrly.phpnu „[µü¤        PK       ”T]põÝcå  å  ,            ù¯  import/plugins/class-import-ultimate-seo.phpnu „[µü¤        PK       ”T]Thñ<	  	  9            :µ  import/plugins/class-import-greg-high-performance-seo.phpnu „[µü¤        PK       ”T]A¶ÏÅÃ  Ã  *            ¬¸  import/plugins/class-import-smartcrawl.phpnu „[µü¤        PK       ”T]Nåcûg  g  -            ÉÅ  import/plugins/class-import-seo-framework.phpnu „[µü¤        PK       ”T]g|¨wÝ  Ý               �Í  import/class-import-detector.phpnu „[µü¤        PK       ”T]S‚;ªÊ
  Ê
              ºÐ  import/class-import-status.phpnu „[µü¤        PK       ”T]átÕü    )            ÒÛ  formatter/interface-metabox-formatter.phpnu „[µü¤        PK       ”T]ÅŸ�  �  *            -Ý  formatter/class-post-metabox-formatter.phpnu „[µü¤        PK       ”T]ÇÏv�$  �$  %            ò  formatter/class-metabox-formatter.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               û formatter/.htaccessnu ƒ7�æm        PK       ”T]—¯˜Àê  ê  *            + formatter/class-term-metabox-formatter.phpnu „[µü¤        PK       ”T]^o]                o& class-config.phpnu „[µü¤        PK       ”T]��¼¸  ¸  $            ¼= class-yoast-network-settings-api.phpnu „[µü¤        PK       ”T]yþ%”!  ”!              ÈN class-plugin-conflict.phpnu „[µü¤        PK       ”T]g5NÑ  Ñ  +            ¥p links/class-link-compatibility-notifier.phpnu „[µü¤        PK       ”T]÷+ÜÅ÷  ÷              Ñx links/class-link-columns.phpnu „[µü¤        PK       ”T]_�°rÛ  Û              — links/class-link.phpnu „[µü¤        PK       ”T]Æ6@$?  ?              3œ links/class-link-query.phpnu „[µü¤        PK       ”T]Ùå°üd  d  %            ¼¬ links/class-link-table-accessible.phpnu „[µü¤        PK       ”T]¸£ÞÓN  N  !            uµ links/class-link-column-count.phpnu „[µü¤        PK       ”T]lXýŠ    #            ¾ links/class-link-watcher-loader.phpnu „[µü¤        PK       ”T]æ‹"L  L  $            |À links/class-link-internal-lookup.phpnu „[µü¤        PK       ”T]µ»6ºê  ê              Ã links/class-link-watcher.phpnu „[µü¤        PK       ”T]ÁO3H	  H	  $            RÑ links/class-link-type-classifier.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               îÚ links/.htaccessnu ƒ7�æm        PK       ”T],º¯ÂE  E              Ü links/class-link-notifier.phpnu „[µü¤        PK       ”T]Áâ¿±›  ›              ¬ë links/class-link-filter.phpnu „[µü¤        PK       ”T]œŸ                ’ñ links/class-link-utils.phpnu „[µü¤        PK       ”T]é3!ÈÇ  Ç  .            øó links/class-link-table-accessible-notifier.phpnu „[µü¤        PK       ”T]Jh·  ·              ü links/class-link-extractor.phpnu „[µü¤        PK       ”T]‡<¸c~  ~  &            "  links/class-link-reindex-dashboard.phpnu „[µü¤        PK       ”T]€É}H  H              ö links/class-link-storage.phpnu „[µü¤        PK       ”T]åp§�    *            Š) links/class-link-reindex-post-endpoint.phpnu „[µü¤        PK       ”T]­€–Öª  ª              è. links/class-link-factory.phpnu „[µü¤        PK       ”T]¶ši®    &            Þ7 links/class-link-content-processor.phpnu „[µü¤        PK       ”T]™¯T%�  �  &            EH links/class-link-cleanup-transient.phpnu „[µü¤        PK       ”T]ê%b˜é  é              *L links/class-link-installer.phpnu „[µü¤        PK       ”T]±ßˆ	  	  )            aP links/class-link-reindex-post-service.phpnu „[µü¤        PK       ”T]ë¥O`
  
  "            ÏY metabox/class-metabox-form-tab.phpnu „[µü¤        PK       ”T]é?tb)	  )	  '            2d metabox/class-metabox-section-react.phpnu „[µü¤        PK       ”T]¾·ÁŸ  Ÿ  "            ²m metabox/class-metabox-null-tab.phpnu „[µü¤        PK       ”T]Á+°¡  ¡  .            £o metabox/class-metabox-analysis-readability.phpnu „[µü¤        PK       ”T]&œ²Ô‘  ‘  &            ¢s metabox/class-metabox-analysis-seo.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               ‰w metabox/.htaccessnu ƒ7�æm        PK       ”T]ƒÁ‹X@  @  %            ·x metabox/interface-metabox-section.phpnu „[µü¤        PK       ”T]s6RA[  [  !            Lz metabox/interface-metabox-tab.phpnu „[µü¤        PK       ”T]èO±[·  ·  &            ø{ metabox/interface-metabox-analysis.phpnu „[µü¤        PK       ”T].�±a¢  ¢  '             metabox/class-metabox-addon-section.phpnu „[µü¤        PK       ”T]þY1ÑU  U               þ‚ metabox/class-metabox-editor.phpnu „[µü¤        PK       ”T]HXb4“‡  “‡              £Š metabox/class-metabox.phpnu „[µü¤        PK       ”T]â�Môµ  µ  %             metabox/class-metabox-tab-section.phpnu „[µü¤        PK       ”T]6.ò©	  ©	  !            ‰" class-gutenberg-compatibility.phpnu „[µü¤        PK       ”T]Ækõ                ƒ, class-premium-popup.phpnu „[µü¤        PK       ”T]ÏÒ¸�±  ±  +            Ï7 class-admin-asset-yoast-components-l10n.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               Û< watchers/.htaccessnu ƒ7�æm        PK       ”T]ï£1øÉ  É  &            
> watchers/class-slug-change-watcher.phpnu „[µü¤        PK       ”T]5:K  K  )            )Y class-admin-asset-dev-server-location.phpnu „[µü¤        PK       ”T]«‡×¢&   &   	            Í` index.phpnu „[µü¤        PK       ”T]à³°‘    $            ,a class-premium-upsell-admin-block.phpnu „[µü¤        PK       ”T]+ÄŽ‹  ‹  4            Ÿt class-admin-gutenberg-compatibility-notification.phpnu „[µü¤        PK       ”T]&’?W    (            Ž} class-admin-recommended-replace-vars.phpnu „[µü¤        PK       ”T]‹�    )            û• google_search_console/class-gsc-issue.phpnu „[µü¤        PK       ”T]÷¢™¢V  V  4            [ž google_search_console/class-gsc-category-filters.phpnu „[µü¤        PK       ”T]�SÊ‰í   í   %            ¼ google_search_console/views/.htaccessnu ƒ7�æm        PK       ”T]ê{šë  ë  6            W½ google_search_console/views/gsc-redirect-nopremium.phpnu „[µü¤        PK       ”T]�$uçœ  œ  +            ¨Á google_search_console/views/gsc-display.phpnu „[µü¤        PK       ”T]KÖiõ�'  �'  #            Ÿá google_search_console/class-gsc.phpnu „[µü¤        PK       ”T]º¥.  .  /            �	 google_search_console/class-gsc-bulk-action.phpnu „[µü¤        PK       ”T]�SÊ‰í   í                google_search_console/.htaccessnu ƒ7�æm        PK       ”T]2ÙÕõë  ë  )            J google_search_console/class-gsc-modal.phpnu „[µü¤        PK       ”T])D0Ð'  Ð'  )            Ž google_search_console/class-gsc-table.phpnu „[µü¤        PK       ”T][œ¯^û  û  *            ·@ google_search_console/class-gsc-config.phpnu „[µü¤        PK       ”T]Þì¼_  _  )            C google_search_console/class-gsc-count.phpnu „[µü¤        PK       ”T]°³I    *            ÄY google_search_console/class-gsc-marker.phpnu „[µü¤        PK       ”T]�ÝXw
  w
  (            3f google_search_console/class-gsc-ajax.phpnu „[µü¤        PK       ”T]5žZ‚‚	  ‚	  ,            q google_search_console/class-gsc-settings.phpnu „[µü¤        PK       ”T]¡uo.í  í  *            àz google_search_console/class-gsc-issues.phpnu „[µü¤        PK       ”T]+ŽÍ¶å
  å
  *            'Œ google_search_console/class-gsc-mapper.phpnu „[µü¤        PK       ”T]O®¸3	  3	  1            f— google_search_console/class-gsc-platform-tabs.phpnu „[µü¤        PK       ”T]:$ßK�  �  +            ú  google_search_console/class-gsc-service.phpnu „[µü¤        PK       ”T]÷ö¤ì™  ™              Ö´ class-option-tab.phpnu „[µü¤        PK       ”T]r²#mŸ  Ÿ              ³¼ class-yoast-alerts.phpnu „[µü¤        PK       ”T]ðNwæ)  æ)              ˜Ö ajax.phpnu „[µü¤        PK       ”T]6p-ä  ä              ¶  class-customizer.phpnu „[µü¤        PK       ”T]2hd+–  –              Þ class-recalculate-scores.phpnu „[µü¤        PK       ”T]0NdI	  I	              À class-option-tabs-formatter.phpnu „[µü¤        PK       ”T]öã"`q  q              X) class-meta-storage.phpnu „[µü¤        PK       ”T]±*ß�í  í              5 class-my-yoast-route.phpnu „[µü¤        PK       ”T]…ØëB  B  (            DO exceptions/class-file-size-exception.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               ÞS exceptions/.htaccessnu ƒ7�æm        PK       ”T]0pE©þ  þ              U class-asset.phpnu „[µü¤        PK       ”T].M’¹^  ^  +            Lb taxonomy/class-taxonomy-settings-fields.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               p taxonomy/.htaccessnu ƒ7�æm        PK       ”T]Ì�]ý¯  ¯  )            4q taxonomy/class-taxonomy-social-fields.phpnu „[µü¤        PK       ”T]hºsz  z  "            <… taxonomy/class-taxonomy-fields.phpnu „[µü¤        PK       ”T]N uYÖ  Ö  ,            Œ taxonomy/class-taxonomy-fields-presenter.phpnu „[µü¤        PK       ”T]ŠÑ�¹  ¹  #            :§ taxonomy/class-taxonomy-metabox.phpnu „[µü¤        PK       ”T]gyp%I-  I-              F¾ taxonomy/class-taxonomy.phpnu „[µü¤        PK       ”T]àÍ€\q  q  #            Úë taxonomy/class-taxonomy-columns.phpnu „[µü¤        PK       ”T]MÄ×Õf  f  *            ž taxonomy/class-taxonomy-content-fields.phpnu „[µü¤        PK       ”T]$"‰Ï  Ï              ^ class-my-yoast-proxy.phpnu „[µü¤        PK       ”T]ö•¡î                u& class-help-center-item.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               Å. help_center/.htaccessnu ƒ7�æm        PK       ”T]rÜåÙ€
  €
  ,            ÷/ help_center/class-template-variables-tab.phpnu „[µü¤        PK       ”T]‚ÍÊø¥  ¥              Ó: class-license-page-manager.phpnu „[µü¤        PK       ”T][Ôé?è  è              ÆR class-admin-asset-location.phpnu „[µü¤        PK       ”T]Æpýè	  è	              üT class-admin-utils.phpnu „[µü¤        PK       ”T]¯æò^  ò^              )_ class-admin-init.phpnu „[µü¤        PK       ”T]‰pü½e  e  +            _¾ statistics/class-statistics-integration.phpnu „[µü¤        PK       ”T] :+$û  û  '            Á statistics/class-statistics-service.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               qÝ statistics/.htaccessnu ƒ7�æm        PK       ”T]�SÊ‰í   í               ¢Þ notifiers/.htaccessnu ƒ7�æm        PK       ”T]æ6Gæ,  ,  *            Òß notifiers/class-configuration-notifier.phpnu „[µü¤        PK       ”T]LK¸ˆ  ˆ  :            Xó notifiers/class-post-type-archive-notification-handler.phpnu „[µü¤        PK       ”T]�öµ  µ  ,            J	 notifiers/interface-notification-handler.phpnu „[µü¤        PK       ”T]ûÙ ‘
  ‘
  &            [ notifiers/dismissible-notification.phpnu „[µü¤        PK       ”T]ÖÑtÈ”  ”  &            B config-ui/class-configuration-page.phpnu „[µü¤        PK       ”T]ÃúK~  ~  1            ,4 config-ui/class-configuration-options-adapter.phpnu „[µü¤        PK       ”T]†Ø‡€  €  )            J config-ui/class-configuration-service.phpnu „[µü¤        PK       ”T],rm    9            äZ config-ui/components/class-component-mailchimp-signup.phpnu „[µü¤        PK       ”T]­±‹=2  2  4            Ra config-ui/components/class-component-suggestions.phpnu „[µü¤        PK       ”T]ù°/Úƒ  ƒ  F            èu config-ui/components/class-component-connect-google-search-console.phpnu „[µü¤        PK       ”T]ÍYY÷ë  ë  ,            á‚ config-ui/components/interface-component.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               (… config-ui/components/.htaccessnu ƒ7�æm        PK       ”T]‡¦>¾e  e  +            c† config-ui/class-configuration-structure.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               #– config-ui/factories/.htaccessnu ƒ7�æm        PK       ”T]š‹ÂÖR  R  /            ]— config-ui/factories/class-factory-post-type.phpnu „[µü¤        PK       ”T]�SÊ‰í   í                 config-ui/.htaccessnu ƒ7�æm        PK       ”T]|›ëQU  U  )            >¡ config-ui/class-configuration-storage.phpnu „[µü¤        PK       ”T]YÁÂ?  ?  *            ì³ config-ui/class-configuration-endpoint.phpnu „[µü¤        PK       ”T]uÍd¢  ¢  1            …» config-ui/fields/class-field-choice-post-type.phpnu „[µü¤        PK       ”T]Ì„§Y  Y  4            ˆÃ config-ui/fields/class-field-profile-url-youtube.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               EÇ config-ui/fields/.htaccessnu ƒ7�æm        PK       ”T]yKè÷  ÷  0            |È config-ui/fields/class-field-success-message.phpnu „[µü¤        PK       ”T]sÙÖ…=  =  3            ÓÍ config-ui/fields/class-field-upsell-site-review.phpnu „[µü¤        PK       ”T]Ü½Á    '            sÓ config-ui/fields/class-field-person.phpnu „[µü¤        PK       ”T]¼N    4            ãÖ config-ui/fields/class-field-profile-url-twitter.phpnu „[µü¤        PK       ”T]�¨{—ø  ø  <            XÚ config-ui/fields/class-field-google-search-console-intro.phpnu „[µü¤        PK       ”T][§”>@	  @	  1            ¼ß config-ui/fields/class-field-multiple-authors.phpnu „[µü¤        PK       ”T]©äœ    ,            ]é config-ui/fields/class-field-title-intro.phpnu „[µü¤        PK       ”T]¹µÂ¼Q
  Q
  ,            Õì config-ui/fields/class-field-environment.phpnu „[µü¤        PK       ”T]î†ïôƒ  ƒ  6            ‚÷ config-ui/fields/class-field-profile-url-wikipedia.phpnu „[µü¤        PK       ”T]Üâ®Æ
  
               kû config-ui/fields/class-field.phpnu „[µü¤        PK       ”T]ÜŸÿüh  h  5            × config-ui/fields/class-field-profile-url-facebook.phpnu „[µü¤        PK       ”T]Ó !V  V  4            ¤	 config-ui/fields/class-field-profile-url-myspace.phpnu „[µü¤        PK       ”T]aù�%y  y  '            ^ config-ui/fields/class-field-choice.phpnu „[µü¤        PK       ”T],�¥‚'  '  -            . config-ui/fields/class-field-company-logo.phpnu „[µü¤        PK       ”T]V?²ud  d  5            ² config-ui/fields/class-field-profile-url-linkedin.phpnu „[µü¤        PK       ”T]Õz|3£  £  5            { config-ui/fields/class-field-post-type-visibility.phpnu „[µü¤        PK       ”T]ÔJi  i  6            ƒ config-ui/fields/class-field-profile-url-pinterest.phpnu „[µü¤        PK       ”T]¢=Y  Y  2            R config-ui/fields/class-field-company-or-person.phpnu „[µü¤        PK       ”T]üW/úå  å  *            $ config-ui/fields/class-field-separator.phpnu „[µü¤        PK       ”T]�"ë¶i  i  6            L) config-ui/fields/class-field-profile-url-instagram.phpnu „[µü¤        PK       ”T]oî/L  L  =            - config-ui/fields/class-field-upsell-configuration-service.phpnu „[µü¤        PK       ”T]ë,�[H  H  >            Ô3 config-ui/fields/class-field-connect-google-search-console.phpnu „[µü¤        PK       ”T]]}ÔEþ  þ  ,            Š6 config-ui/fields/class-field-suggestions.phpnu „[µü¤        PK       ”T]y�Z˜  ˜  *            ä: config-ui/fields/class-field-site-name.phpnu „[µü¤        PK       ”T]«ÄÃ	  	  1            Ö@ config-ui/fields/class-field-mailchimp-signup.phpnu „[µü¤        PK       ”T]ö06D      *            OJ config-ui/fields/class-field-site-type.phpnu „[µü¤        PK       ”T]´8:yM  M  -            ÉO config-ui/fields/class-field-company-name.phpnu „[µü¤        PK       ”T]‹£]Ò—  —  .            sS config-ui/class-configuration-translations.phpnu „[µü¤        PK       ”T]¬ßÅž  ž  ,            hX config-ui/class-configuration-components.phpnu „[µü¤        PK       ”T]
Í6H    "            b_ class-admin-asset-seo-location.phpnu „[µü¤        PK       ”T]^µî´„   „               Ìj class-help-center.phpnu „[µü¤        PK       ”T]‹¦™Kd  d              •‹ class-meta-table-accessible.phpnu „[µü¤        PK       ”T]6gtkÃ  Ã              H” class-collector.phpnu „[µü¤        PK       ”T]iYjmn  mn               N˜ class-bulk-editor-list-table.phpnu „[µü¤        PK       ”T]†×:<?'  ?'              	 class-yoast-plugin-conflict.phpnu „[µü¤        PK       ”T]ôhCôN  N  ,            ™.	 class-bulk-description-editor-list-table.phpnu „[µü¤        PK       ”T]o ÔÃË  Ë  '            C6	 tracking/class-tracking-plugin-data.phpnu „[µü¤        PK       ”T]¼ÃsÙý  ý              e;	 tracking/class-tracking.phpnu „[µü¤        PK       ”T]Œ9iš  š  '            ­D	 tracking/class-tracking-server-data.phpnu „[µü¤        PK       ”T]kÿ›¦ß  ß  &            žL	 tracking/class-tracking-theme-data.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               ÓP	 tracking/.htaccessnu ƒ7�æm        PK       ”T]®´÷    (            R	 tracking/class-tracking-default-data.phpnu „[µü¤        PK       ”T]�”¶(Þ  Þ              kU	 class-extension-manager.phpnu „[µü¤        PK       ”T]«%T”Á  Á              ”d	 class-expose-shortlinks.phpnu „[µü¤        PK       ”T]&#(ö  ö  !             v	 class-multiple-keywords-modal.phpnu „[µü¤        PK       ”T]3O¼Í*  *  &            ç	 class-bulk-title-editor-list-table.phpnu „[µü¤        PK       ”T]±å+Òó  ó               gˆ	 class-keyword-synonyms-modal.phpnu „[µü¤        PK       ”T]VE"Ÿ%	  %	              ª‘	 class-admin-help-panel.phpnu „[µü¤        PK       ”T]Ã7$~8  ~8              ›	 class-admin.phpnu „[µü¤        PK       ”T](¬òc $   $              ÖÓ	 class-social-admin.phpnu „[µü¤        PK       ”T]/…eñ  ñ               ø	 class-yoast-dashboard-widget.phpnu „[µü¤        PK       ”T]âÿxu[&  [&              ]	
 class-plugin-availability.phpnu „[µü¤        PK       ”T]~©Îr  r              0
 views/sidebar.phpnu „[µü¤        PK       ”T]$ïÕ®  ®              ¸G
 views/tool-import-export.phpnu „[µü¤        PK       ”T]Â÷£Ig  g              ²W
 views/paper-collapsible.phpnu „[µü¤        PK       ”T]º'QôO  O  #            d^
 views/js-templates-primary-term.phpnu „[µü¤        PK       ”T]±Kž
  
  "            d
 views/class-yoast-input-select.phpnu „[µü¤        PK       ”T]ª/ Æ	  Æ	  !            bo
 views/partial-alerts-template.phpnu „[µü¤        PK       ”T]>PbÌh  h  #            yy
 views/class-yoast-form-fieldset.phpnu „[µü¤        PK       ”T]]UÝ3J  J              4Š
 views/tabs/network/features.phpnu „[µü¤        PK       ”T]—èBê  ê              Í’
 views/tabs/network/general.phpnu „[µü¤        PK       ”T]¡^&ÆŸ  Ÿ  #            ›
 views/tabs/network/restore-site.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               ÷ž
 views/tabs/network/.htaccessnu ƒ7�æm        PK       ”T]ÆÏð@Í  Í              0 
 views/tabs/tool/import-seo.phpnu „[µü¤        PK       ”T]¨ö�Çx  x               K±
 views/tabs/tool/wpseo-export.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               ¶
 views/tabs/tool/.htaccessnu ƒ7�æm        PK       ”T]¥Ñ&Yw  w               I·
 views/tabs/tool/wpseo-import.phpnu „[µü¤        PK       ”T]ç×\N˜  ˜  &            ½
 views/tabs/dashboard/site-analysis.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               þ¾
 views/tabs/dashboard/.htaccessnu ƒ7�æm        PK       ”T]-û    "            9À
 views/tabs/dashboard/dashboard.phpnu „[µü¤        PK       ”T]2Ö5=O  O  !            ¥Å
 views/tabs/dashboard/features.phpnu „[µü¤        PK       ”T]#PóE  E  (            EÍ
 views/tabs/dashboard/webmaster-tools.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               âÚ
 views/tabs/.htaccessnu ƒ7�æm        PK       ”T]"Ê«°Ï  Ï              Ü
 views/tabs/metas/archives.phpnu „[µü¤        PK       ”T]Žû+š  š              /ã
 views/tabs/metas/general.phpnu „[µü¤        PK       ”T]#Òõ 8  8  ,            å
 views/tabs/metas/taxonomies/category-url.phpnu „[µü¤        PK       ”T]�SÊ‰í   í   %            ©è
 views/tabs/metas/taxonomies/.htaccessnu ƒ7�æm        PK       ”T]ŠX½ßé  é  "            ëé
 views/tabs/metas/archives/help.phpnu „[µü¤        PK       ”T]�SÊ‰í   í   #            &ð
 views/tabs/metas/archives/.htaccessnu ƒ7�æm        PK       ”T]Ü¼¸Æœ  œ  2            fñ
 views/tabs/metas/paper-content/general-content.phpnu „[µü¤        PK       ”T]¡BÒFÂ  Â  3            dó
 views/tabs/metas/paper-content/taxonomy-content.phpnu „[µü¤        PK       ”T]†ìH�1  1  0            ‰ü
 views/tabs/metas/paper-content/special-pages.phpnu „[µü¤        PK       ”T]\$�Ý�  �  4              views/tabs/metas/paper-content/post-type-content.phpnu „[µü¤        PK       ”T]¯Tíú    6            ÿ views/tabs/metas/paper-content/post_type/post-type.phpnu „[µü¤        PK       ”T]�SÊ‰í   í   2            r views/tabs/metas/paper-content/post_type/.htaccessnu ƒ7�æm        PK       ”T]8|ÞMœ  œ  B            Á views/tabs/metas/paper-content/post_type/woocommerce-shop-page.phpnu „[µü¤        PK       ”T]�SÊ‰í   í   (            Ï views/tabs/metas/paper-content/.htaccessnu ƒ7�æm        PK       ”T]SP²¸T  T  6             views/tabs/metas/paper-content/breadcrumbs-content.phpnu „[µü¤        PK       ”T]j«m÷Å  Å  0            Î( views/tabs/metas/paper-content/media-content.phpnu „[µü¤        PK       ”T]÷¬˜Á–  –  >            ó0 views/tabs/metas/paper-content/general/force-rewrite-title.phpnu „[µü¤        PK       ”T]fºƒy	  y	  :            ÷3 views/tabs/metas/paper-content/general/knowledge-graph.phpnu „[µü¤        PK       ”T]�SÊ‰í   í   0            Ú= views/tabs/metas/paper-content/general/.htaccessnu ƒ7�æm        PK       ”T]¦×Ýl  l  3            '? views/tabs/metas/paper-content/general/homepage.phpnu „[µü¤        PK       ”T]ü:=�ù  ù  :            öF views/tabs/metas/paper-content/general/title-separator.phpnu „[µü¤        PK       ”T]¶¥žq>  >  :            YK views/tabs/metas/paper-content/author-archive-settings.phpnu „[µü¤        PK       ”T]:Zvàù  ù  .            W views/tabs/metas/paper-content/rss-content.phpnu „[µü¤        PK       ”T]lK¨    9            X_ views/tabs/metas/paper-content/date-archives-settings.phpnu „[µü¤        PK       ”T]íåÖÔÖ  Ö               Ìf views/tabs/metas/breadcrumbs.phpnu „[µü¤        PK       ”T])x˜&  &              òh views/tabs/metas/taxonomies.phpnu „[µü¤        PK       ”T]É–ó°Ž  Ž              gp views/tabs/metas/rss.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               =t views/tabs/metas/.htaccessnu ƒ7�æm        PK       ”T]‘>õ«ú  ú              tu views/tabs/metas/post-types.phpnu „[µü¤        PK       ”T]±oÂ                  ½} views/tabs/metas/media.phpnu „[µü¤        PK       ”T]›,IÛI  I              '‚ views/tabs/social/accounts.phpnu „[µü¤        PK       ”T]Môûbl  l              ¾� views/tabs/social/pinterest.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               y” views/tabs/social/.htaccessnu ƒ7�æm        PK       ”T]˜N¥Aq  q               ±• views/tabs/social/twitterbox.phpnu „[µü¤        PK       ”T]†�–a  a              r™ views/tabs/social/facebook.phpnu „[µü¤        PK       ”T]"_‰ÄJ  J              !¦ views/tool-bulk-editor.phpnu „[µü¤        PK       ”T]³2#d  d              µµ views/tool-file-editor.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               cÒ views/.htaccessnu ƒ7�æm        PK       ”T];¶èá                �Ó views/user-profile.phpnu „[µü¤        PK       ”T]xK0ý’  ’  $            àà views/class-yoast-feature-toggle.phpnu „[µü¤        PK       ”T]’ÝŸd�  �  !            Æì views/partial-alerts-warnings.phpnu „[µü¤        PK       ”T]�ílª,  ,  %            ´ï views/class-yoast-feature-toggles.phpnu „[µü¤        PK       ”T];Šú%û   û   &            5 views/interface-yoast-form-element.phpnu „[µü¤        PK       ”T]ç�J                † views/partial-alerts-errors.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               Ü views/form/.htaccessnu ƒ7�æm        PK       ”T]öÃ&0  0               views/form/fieldset.phpnu „[µü¤        PK       ”T]N™¼©Ž  Ž              „ views/form/select.phpnu „[µü¤        PK       ”T];Öû²#  #              W views/class-view-utils.phpnu „[µü¤        PK       ”T]äOÍG¸4  ¸4              Ä) views/licenses.phpnu „[µü¤        PK       ”T]|é6X  6X              ¾^ class-meta-columns.phpnu „[µü¤        PK       ”T]ëCë                  :· class-yoast-columns.phpnu „[µü¤        PK       ”T]P) 	 "   "              ¡½ class-primary-term-admin.phpnu „[µü¤        PK       ”T]¢TÇG"  "  )            à services/interface-indexable-provider.phpnu „[µü¤        PK       ”T]f¡:Àý  ý  *            ˆä services/class-indexable-post-provider.phpnu „[µü¤        PK       ”T]‘¼�úº	  º	              ßþ services/class-file-size.phpnu „[µü¤        PK       ”T]Ú÷‘{‰  ‰  *            å services/class-indexable-term-provider.phpnu „[µü¤        PK       ”T]ÿ™    %            È services/class-indexable-provider.phpnu „[µü¤        PK       ”T]xayè	  è	              œ services/class-indexable.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               Ð) services/.htaccessnu ƒ7�æm        PK       ”T]Dr                ÿ* interface-collection.phpnu „[µü¤        PK       ”T]=FhJ
J  
J              H, class-admin-asset-manager.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               Ÿv onpage/.htaccessnu ƒ7�æm        PK       ”T]#!±@  @              Ìw onpage/class-ryte-service.phpnu „[µü¤        PK       ”T]Éž*â  â              Y„ onpage/class-onpage-request.phpnu „[µü¤        PK       ”T]À.\&                ŠŒ onpage/class-onpage.phpnu „[µü¤        PK       ”T]Nà÷	  ÷	              é¦ onpage/class-onpage-option.phpnu „[µü¤        PK       ”T]AÌ1
0  0              .± listeners/class-listener.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               ª² listeners/.htaccessnu ƒ7�æm        PK       ”T]��t,_  _  ,            Ú³ class-schema-person-upgrade-notification.phpnu „[µü¤        PK       ”T]î¦§þ   þ               •¼ interface-installable.phpnu „[µü¤        PK       ”T]ªË–e  e              Ü½ class-plugin-compatibility.phpnu „[µü¤        PK       ”T] lÍî¶  ¶              �É class-add-keyword-modal.phpnu „[µü¤        PK       ”T]S–†€-  -  )            �Ò capabilities/class-capability-manager.phpnu „[µü¤        PK       ”T]L’þ·Õ  Õ  '            Ö capabilities/class-capability-utils.phpnu „[µü¤        PK       ”T].¤×§ã  ã  2            BÛ capabilities/class-abstract-capability-manager.phpnu „[µü¤        PK       ”T]§ÌìIZ  Z  1            ‡ä capabilities/class-capability-manager-factory.phpnu „[µü¤        PK       ”T]hp¤C  C  5            Bç capabilities/class-capability-manager-integration.phpnu „[µü¤        PK       ”T]V6˜eÙ  Ù  ,            êó capabilities/class-capability-manager-wp.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               ù capabilities/.htaccessnu ƒ7�æm        PK       ”T]WÿY³¨  ¨  ,            Rú capabilities/class-register-capabilities.phpnu „[µü¤        PK       ”T]šbÜr¯  ¯  -            V capabilities/class-capability-manager-vip.phpnu „[µü¤        PK       ”T]¼ó@/Â  Â              b class-suggested-plugins.phpnu „[µü¤        PK       ”T]Ë8	¤¦  ¦  '            o! recalculate/class-recalculate-posts.phpnu „[µü¤        PK       ”T] ëÑƒa  a  !            l1 recalculate/class-recalculate.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               : recalculate/.htaccessnu ƒ7�æm        PK       ”T]‘ë¼~w  w  '            P; recalculate/class-recalculate-terms.phpnu „[µü¤        PK       ”T]Ý‘IY5  5  ,            K class-admin-editor-specific-replace-vars.phpnu „[µü¤        PK       ”T])Ïâì“  “              ¯d class-export.phpnu „[µü¤        PK       ”T]V ¹s©  ©              ‚r courses-overview.phpnu „[µü¤        PK       ”T]cN=1                ov class-paper-presenter.phpnu „[µü¤        PK       ”T]“@ëc6  6              Ä� class-database-proxy.phpnu „[µü¤        PK       ”T]1L¾—;  ;              Bž class-option-tabs.phpnu „[µü¤        PK       ”T] I/ÐÜ  Ü              Â¦ menu/class-menu.phpnu „[µü¤        PK       ”T]¬’`ý  ý  +            á¯ menu/class-submenu-capability-normalize.phpnu „[µü¤        PK       ”T]ÍöƒÇ  Ç              9´ menu/class-base-menu.phpnu „[µü¤        PK       ”T]Ûq÷¾  ¾              HÐ menu/class-admin-menu.phpnu „[µü¤        PK       ”T]Þ„Ú`*	  *	  !            Oá menu/class-network-admin-menu.phpnu „[µü¤        PK       ”T]™esKŽ  Ž               Êê menu/class-replacevar-editor.phpnu „[µü¤        PK       ”T] 0…w  w              ¨ù menu/class-replacevar-field.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               n menu/.htaccessnu ƒ7�æm        PK       ”T]³A+Þi%  i%              ™ class-yoast-network-admin.phpnu „[µü¤        PK       ”T]à–A¾  ¾  &            O) filters/class-abstract-post-filter.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               c< filters/.htaccessnu ƒ7�æm        PK       ”T]4-—ùÐ  Ð  $            ‘= filters/class-cornerstone-filter.phpnu „[µü¤        PK       ”T]6m—yÒ
  Ò
              µL class-admin-user-profile.phpnu „[µü¤        PK       ”T]�SÊ‰í   í   	            ÓW .htaccessnu ƒ7�æm        PK       ”T]o¾ÿ›  ›              ùX class-remote-request.phpnu „[µü¤        PK       ”T]ýßð2x  x              Üd pages/courses.phpnu „[µü¤        PK       ”T]È+PU  U              •f pages/dashboard.phpnu „[µü¤        PK       ”T]Š})ÓK  K              -m pages/metas.phpnu „[µü¤        PK       ”T]\”FQ  Q              ·s pages/social.phpnu „[µü¤        PK       ”T]	M�2Š
  Š
              Hx pages/tools.phpnu „[µü¤        PK       ”T]Ó¨VIô  ô              ƒ pages/network.phpnu „[µü¤        PK       ”T]^‹þÑ‰  ‰              F† pages/licenses.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               ˆ pages/.htaccessnu ƒ7�æm        PK       ”T]V\óêÝ  Ý  (            =‰ class-admin-media-purge-notification.phpnu „[µü¤        PK       ”T]­åQ¾˜  ˜              r– class-product-upsell-notice.phpnu „[µü¤        PK       ”T]¼?Ô9Ç  Ç              Yª class-extension.phpnu „[µü¤        PK       ”T]QHQ¿"  ¿"              c± class-yoast-notification.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               nÔ roles/.htaccessnu ƒ7�æm        PK       ”T]Ë}
˜¿  ¿               šÕ roles/class-role-manager-vip.phpnu „[µü¤        PK       ”T]¬“ìQ"  "  $            ©Ú roles/class-role-manager-factory.phpnu „[µü¤        PK       ”T]WÛ³°  °  %            Ý roles/class-abstract-role-manager.phpnu „[µü¤        PK       ”T]æ(îwÔ  Ô              $ë roles/class-role-manager-wp.phpnu „[µü¤        PK       ”T]££\Cg  g              Gñ roles/class-register-roles.phpnu „[µü¤        PK       ”T]mÕ²q                üó roles/class-role-manager.phpnu „[µü¤        PK       ”T][�c•  •  '            I÷ ajax/class-yoast-dismissable-notice.phpnu „[µü¤        PK       ”T]üLéÍB  B               5ÿ ajax/class-yoast-onpage-ajax.phpnu „[µü¤        PK       ”T]Ùþ�¶D  D              Ç ajax/class-shortcode-filter.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               Z ajax/.htaccessnu ƒ7�æm        PK       ”T]6àX¢
  ¢
  &            … ajax/class-recalculate-scores-ajax.phpnu „[µü¤        PK       ”T]
õhPñ
  ñ
  )            } ajax/class-yoast-plugin-conflict-ajax.phpnu „[µü¤        PK       ”T]ÁA�
    .            Ç class-admin-asset-analysis-worker-location.phpnu „[µü¤        PK       ”T]Ç2ñfµ  µ  '            A% endpoints/class-endpoint-statistics.phpnu „[µü¤        PK       ”T]ë(æ/  /  &            M+ endpoints/class-endpoint-file-size.phpnu „[µü¤        PK       ”T]‘à€—  —  !            Ò1 endpoints/class-endpoint-ryte.phpnu „[µü¤        PK       ”T]šM{m  m  )            º7 endpoints/interface-endpoint-storable.phpnu „[µü¤        PK       ”T]�SÊ‰í   í               €9 endpoints/.htaccessnu ƒ7�æm        PK       ”T]MûU³  ³  &            °: endpoints/class-endpoint-indexable.phpnu „[µü¤        PK       ”T]MC(W×  ×              ¹B endpoints/class-endpoint.phpnu „[µü¤        PK       ”T]XË¯l�^  �^              ÜD class-yoast-form.phpnu „[µü¤        PK       ”T]�Ž¼	1  1              ¡£ class-extensions.phpnu „[µü¤        PK       ”T]Ç´îÒäO  äO  #            ° class-yoast-notification-center.phpnu „[µü¤        PK       ŠNT]�±'N9  N9              M  admin-settings.phpnu „[µü¤        PK       ¤^T]2Gñ¡D  D              Ý9 includes/admin-functions.phpnu „[µü¤        PK       ¤^T]�SÊ‰í   í               m< includes/.htaccessnu ƒ7�æm        PK       ¤^T]#b¦  ¦              œ= includes/welcome-panel.phpnu „[µü¤        PK       ¤^T]Ô¢ø‡:  :              ŒO includes/help-tabs.phpnu „[µü¤        PK       ¤^T]ÐVˆÉd$  d$              k includes/editor.phpnu „[µü¤        PK       ¤^T]Ñ†Õx'  '              ³� includes/tag-generator.phpnu „[µü¤        PK       ¤^T]ªÖ©Ý8  8              $— includes/config-validator.phpnu „[µü¤        PK       ¤^T]ä#¥Ó  Ó  +            ©¤ includes/class-contact-forms-list-table.phpnu „[µü¤        PK       ¤^T]ÉK•qY  Y              ×¼ css/styles-rtl.cssnu „[µü¤        PK       ¤^T]�SÊ‰í   í               rÀ css/.htaccessnu ƒ7�æm        PK       ¤^T]²®�|  |              œÁ css/styles.cssnu „[µü¤        PK       ¤^T]ªcypˆ  ˆ              VÞ css/styles-dark-mode.cssnu „[µü¤        PK       ¤^T]à±ï*YC  YC  	            &ä admin.phpnu „[µü¤        PK       ¤^T]q•Œf%  %              ¸' edit-contact-form.phpnu „[µü¤        PK       ¤^T]�SÊ‰í   í               M images/.htaccessnu ƒ7�