| Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/ |
| Current File : /home/x/b/o/xbodynamge/namtation/wp-content/conditionals.tar |
wp-robots-conditional.php 0000666 00000000525 15112303201 0011504 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Class that checks if wp_robots exists.
*/
class WP_Robots_Conditional implements Conditional {
/**
* Checks if the wp_robots function exists.
*
* @return bool True when the wp_robots function exists.
*/
public function is_met() {
return \function_exists( 'wp_robots' );
}
}
web-stories-conditional.php 0000666 00000000670 15112303201 0012014 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when Web Stories are active.
*/
class Web_Stories_Conditional implements Conditional {
/**
* Returns `true` when the Web Stories plugins is installed and active.
*
* @return bool `true` when the Web Stories plugins is installed and active.
*/
public function is_met() {
return \function_exists( '\Google\Web_Stories\get_plugin_instance' );
}
}
no-tool-selected-conditional.php 0000666 00000000775 15112303201 0012734 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when current page is not a specific tool's page.
*/
class No_Tool_Selected_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We just check whether a URL parameter does not exist.
return ! isset( $_GET['tool'] );
}
}
conditional-interface.php 0000666 00000000452 15112303201 0011507 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional interface, used to prevent integrations from loading.
*/
interface Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met();
}
wincher-enabled-conditional.php 0000666 00000001343 15112303201 0012576 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
use Yoast\WP\SEO\Helpers\Options_Helper;
/**
* Conditional that is only met when the Wincher integration is enabled.
*/
class Wincher_Enabled_Conditional implements Conditional {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options;
/**
* Wincher_Enabled_Conditional constructor.
*
* @param Options_Helper $options The options helper.
*/
public function __construct( Options_Helper $options ) {
$this->options = $options;
}
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return $this->options->get( 'wincher_integration_active', false );
}
}
updated-importer-framework-conditional.php 0000666 00000000637 15112303201 0015034 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Feature flag conditional for the updated importer framework.
*/
class Updated_Importer_Framework_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the updated importer framework feature flag.
*
* @return string The name of the feature flag.
*/
protected function get_feature_flag() {
return 'UPDATED_IMPORTER_FRAMEWORK';
}
}
the-events-calendar-conditional.php 0000666 00000000573 15112303201 0013404 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when The Events Calendar exists.
*/
class The_Events_Calendar_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return \defined( 'TRIBE_EVENTS_FILE' );
}
}
get-request-conditional.php 0000666 00000000722 15112303201 0012014 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when the current request uses the GET method.
*/
class Get_Request_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'GET' ) {
return true;
}
return false;
}
}
new-settings-ui-conditional.php 0000666 00000000543 15112303201 0012612 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Feature flag conditional for the new settings UI.
*/
class New_Settings_Ui_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
*
* @return string The name of the feature flag.
*/
protected function get_feature_flag() {
return 'NEW_SETTINGS_UI';
}
}
xmlrpc-conditional.php 0000666 00000000670 15112303201 0011056 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is met when the current request is an XML-RPC request.
*/
class XMLRPC_Conditional implements Conditional {
/**
* Returns whether the current request is an XML-RPC request.
*
* @return bool `true` when the current request is an XML-RPC request, `false` if not.
*/
public function is_met() {
return ( \defined( 'XMLRPC_REQUEST' ) && \XMLRPC_REQUEST );
}
}
jetpack-conditional.php 0000666 00000000637 15112303201 0011175 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when Jetpack exists.
*/
class Jetpack_Conditional implements Conditional {
/**
* Returns `true` when the Jetpack plugin exists on this
* WordPress installation.
*
* @return bool `true` when the Jetpack plugin exists on this WordPress installation.
*/
public function is_met() {
return \class_exists( 'Jetpack' );
}
}
admin/post-conditional.php 0000666 00000001340 15112303201 0011621 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Admin;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when on a post edit or new post page.
*/
class Post_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
global $pagenow;
// Current page is the creation of a new post (type, i.e. post, page, custom post or attachment).
if ( $pagenow === 'post-new.php' ) {
return true;
}
// Current page is the edit page of an existing post (type, i.e. post, page, custom post or attachment).
if ( $pagenow === 'post.php' ) {
return true;
}
return false;
}
}
admin/doing-post-quick-edit-save-conditional.php 0000666 00000001771 15112303201 0015720 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Admin;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Checks if the post is saved by inline-save. This is the case when doing quick edit.
*
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded -- Base class can't be written shorter without abbreviating.
*/
class Doing_Post_Quick_Edit_Save_Conditional implements Conditional {
/**
* Checks if the current request is ajax and the action is inline-save.
*
* @return bool True when the quick edit action is executed.
*/
public function is_met() {
if ( ! \wp_doing_ajax() ) {
return false;
}
// Do the same nonce check as is done in wp_ajax_inline_save because we hook into that request.
if ( ! \check_ajax_referer( 'inlineeditnonce', '_inline_edit', false ) ) {
return false;
}
if ( ! isset( $_POST['action'] ) ) {
return false;
}
$sanitized_action = \sanitize_text_field( \wp_unslash( $_POST['action'] ) );
return ( $sanitized_action === 'inline-save' );
}
}
admin/licenses-page-conditional.php 0000666 00000001212 15112303201 0013351 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Admin;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when current page is the tools page.
*/
class Licenses_Page_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
global $pagenow;
if ( $pagenow !== 'admin.php' ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification -- This is not a form.
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wpseo_licenses' ) {
return true;
}
return false;
}
}
admin/posts-overview-or-ajax-conditional.php 0000666 00000000746 15112303201 0015220 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Admin;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when on a post overview page or during an ajax request.
*/
class Posts_Overview_Or_Ajax_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
global $pagenow;
return $pagenow === 'edit.php' || \wp_doing_ajax();
}
}
admin/estimated-reading-time-conditional.php 0000666 00000003112 15112303201 0015155 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Admin;
use Yoast\WP\SEO\Conditionals\Conditional;
use Yoast\WP\SEO\Helpers\Input_Helper;
/**
* Conditional that is only when we want the Estimated Reading Time.
*/
class Estimated_Reading_Time_Conditional implements Conditional {
/**
* The Post Conditional.
*
* @var Post_Conditional
*/
protected $post_conditional;
/**
* The Input Helper.
*
* @var Input_Helper
*/
protected $input_helper;
/**
* Constructs the Estimated Reading Time Conditional.
*
* @param Post_Conditional $post_conditional The post conditional.
* @param Input_Helper $input_helper The input helper.
*/
public function __construct( Post_Conditional $post_conditional, Input_Helper $input_helper ) {
$this->post_conditional = $post_conditional;
$this->input_helper = $input_helper;
}
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
// Check if we are in our Elementor ajax request (for saving).
if ( \wp_doing_ajax() ) {
$post_action = $this->input_helper->filter( \INPUT_POST, 'action', \FILTER_SANITIZE_STRING );
if ( $post_action === 'wpseo_elementor_save' ) {
return true;
}
}
if ( ! $this->post_conditional->is_met() ) {
return false;
}
// We don't support Estimated Reading Time on the attachment post type.
$post_id = (int) $this->input_helper->filter( \INPUT_GET, 'post', \FILTER_SANITIZE_NUMBER_INT );
if ( \get_post_type( $post_id ) === 'attachment' ) {
return false;
}
return true;
}
}
import-tool-selected-conditional.php 0000666 00000001050 15112303201 0013615 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when current page is not a specific tool's page.
*/
class Import_Tool_Selected_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We just check whether a URL parameter does not exist.
return ( isset( $_GET['tool'] ) && $_GET['tool'] === 'import-export' );
}
}
migrations-conditional.php 0000666 00000001457 15112303201 0011731 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
use Yoast\WP\SEO\Config\Migration_Status;
/**
* Class for integrations that depend on having all migrations run.
*/
class Migrations_Conditional implements Conditional {
/**
* The migration status.
*
* @var Migration_Status
*/
protected $migration_status;
/**
* Migrations_Conditional constructor.
*
* @param Migration_Status $migration_status The migration status object.
*/
public function __construct( Migration_Status $migration_status ) {
$this->migration_status = $migration_status;
}
/**
* Returns `true` when all database migrations have been run.
*
* @return bool `true` when all database migrations have been run.
*/
public function is_met() {
return $this->migration_status->is_version( 'free', \WPSEO_VERSION );
}
}
yoast-tools-page-conditional.php 0000666 00000001176 15112303201 0012762 0 ustar 00 <?php // phpcs:ignore Yoast.Files.FileName.InvalidClassFileName -- Reason: this explicitly concerns the Yoast tools page.
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when current page is the tools page.
*/
class Yoast_Tools_Page_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
global $pagenow;
if ( $pagenow !== 'admin.php' ) {
return false;
}
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wpseo_tools' ) {
return true;
}
return false;
}
}
non-multisite-conditional.php 0000666 00000000564 15112303201 0012362 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when we aren't in a multisite setup.
*/
class Non_Multisite_Conditional implements Conditional {
/**
* Returns `true` when we aren't in a multisite setup.
*
* @return bool `true` when we aren't in a multisite setup.
*/
public function is_met() {
return ! \is_multisite();
}
}
robots-txt-conditional.php 0000666 00000003312 15112303201 0011672 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when on the front end or Yoast file editor page.
*/
class Robots_Txt_Conditional implements Conditional {
/**
* Holds the Front_End_Conditional instance.
*
* @var Front_End_Conditional
*/
protected $front_end_conditional;
/**
* Constructs the class.
*
* @param Front_End_Conditional $front_end_conditional The front end conditional.
*/
public function __construct( Front_End_Conditional $front_end_conditional ) {
$this->front_end_conditional = $front_end_conditional;
}
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return $this->front_end_conditional->is_met() || $this->is_file_editor_page();
}
/**
* Returns whether the current page is the file editor page.
*
* This checks for two locations:
* - Multisite network admin file editor page
* - Single site file editor page (under tools)
*
* @return bool
*/
protected function is_file_editor_page() {
global $pagenow;
if ( $pagenow !== 'admin.php' ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification -- This is not a form.
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wpseo_files' && \is_multisite() && \is_network_admin() ) {
return true;
}
// phpcs:ignore WordPress.Security.NonceVerification -- This is not a form.
if ( ! ( isset( $_GET['page'] ) && $_GET['page'] === 'wpseo_tools' ) ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification -- This is not a form.
if ( isset( $_GET['tool'] ) && $_GET['tool'] === 'file-editor' ) {
return true;
}
return false;
}
}
third-party/elementor-edit-conditional.php 0000666 00000001612 15112303201 0014732 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when on an Elementor edit page or when the current
* request is an ajax request for saving our post meta data.
*/
class Elementor_Edit_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
global $pagenow;
// Check if we are on an Elementor edit page.
$get_action = \filter_input( \INPUT_GET, 'action', \FILTER_SANITIZE_STRING );
if ( $pagenow === 'post.php' && $get_action === 'elementor' ) {
return true;
}
// Check if we are in our Elementor ajax request.
$post_action = \filter_input( \INPUT_POST, 'action', \FILTER_SANITIZE_STRING );
return \wp_doing_ajax() && $post_action === 'wpseo_elementor_save';
}
}
third-party/wpml-wpseo-conditional.php 0000666 00000001301 15112303201 0014122 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is met when the Yoast SEO Multilingual plugin,
* a glue plugin developed by and for WPML, is active.
*/
class WPML_WPSEO_Conditional implements Conditional {
/**
* Path to the Yoast SEO Multilingual plugin file.
*
* @internal
*/
const PATH_TO_WPML_WPSEO_PLUGIN_FILE = 'wp-seo-multilingual/plugin.php';
/**
* Returns whether or not the Yoast SEO Multilingual plugin is active.
*
* @return bool Whether or not the Yoast SEO Multilingual plugin is active.
*/
public function is_met() {
return \is_plugin_active( self::PATH_TO_WPML_WPSEO_PLUGIN_FILE );
}
}
third-party/wordproof-plugin-inactive-conditional.php 0000666 00000000751 15112303201 0017135 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is met when the WordProof Timestamp plugin is inactive.
*/
class Wordproof_Plugin_Inactive_Conditional implements Conditional {
/**
* Returns whether or not the WordProof Timestamp plugin is active.
*
* @return bool Whether or not the WordProof Timestamp plugin is active.
*/
public function is_met() {
return ! \defined( 'WORDPROOF_VERSION' );
}
}
third-party/w3-total-cache-conditional.php 0000666 00000000747 15112303201 0014540 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when in the admin.
*/
class W3_Total_Cache_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
if ( ! \defined( 'W3TC_DIR' ) ) {
return false;
}
return \function_exists( 'w3tc_objectcache_flush' );
}
}
third-party/coauthors-plus-activated-conditional.php 0000666 00000000775 15112303201 0016760 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is met when the CoAuthors Plus plugin is installed and activated.
*/
class CoAuthors_Plus_Activated_Conditional implements Conditional {
/**
* Checks if the CoAuthors Plus plugin is installed and activated.
*
* @return bool `true` when the CoAuthors Plus plugin is installed and activated.
*/
public function is_met() {
return \defined( 'COAUTHORS_PLUS_VERSION' );
}
}
third-party/elementor-activated-conditional.php 0000666 00000000745 15112303201 0015757 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is met when the Elementor plugin is installed and activated.
*/
class Elementor_Activated_Conditional implements Conditional {
/**
* Checks if the Elementor plugins is installed and activated.
*
* @return bool `true` when the Elementor plugin is installed and activated.
*/
public function is_met() {
return \defined( 'ELEMENTOR__FILE__' );
}
}
third-party/polylang-conditional.php 0000666 00000000666 15112303201 0013652 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when the Polylang plugin is active.
*/
class Polylang_Conditional implements Conditional {
/**
* Checks whether the Polylang plugin is installed and active.
*
* @return bool Whether Polylang is installed and active.
*/
public function is_met() {
return \defined( 'POLYLANG_FILE' );
}
}
third-party/coauthors-plus-flag-conditional.php 0000666 00000000721 15112303201 0015714 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Feature_Flag_Conditional;
/**
* Feature flag conditional for the CoAuthors Plus integration.
*/
class CoAuthors_Plus_Flag_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the CoAuthors Plus integration feature flag.
*
* @return string The name of the feature flag.
*/
protected function get_feature_flag() {
return 'COAUTHORS_PLUS';
}
}
third-party/wordproof-integration-active-conditional.php 0000666 00000001516 15112303201 0017633 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
use Yoast\WP\SEO\Helpers\Wordproof_Helper;
/**
* Conditional that is met when the WordProof integration is toggled on.
*/
class Wordproof_Integration_Active_Conditional implements Conditional {
/**
* The WordProof helper.
*
* @var Wordproof_Helper
*/
private $wordproof;
/**
* WordProof integration active constructor.
*
* @param Wordproof_Helper $wordproof The options helper.
*/
public function __construct( Wordproof_Helper $wordproof ) {
$this->wordproof = $wordproof;
}
/**
* Returns whether or not the WordProof Timestamp plugin is active.
*
* @return bool Whether or not the WordProof Timestamp plugin is active.
*/
public function is_met() {
return $this->wordproof->integration_is_active();
}
}
third-party/wpml-conditional.php 0000666 00000000627 15112303201 0013001 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when WPML is active.
*/
class WPML_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return \defined( 'WPML_PLUGIN_FILE' );
}
}
third-party/translatepress-conditional.php 0000666 00000000710 15112303201 0015065 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when the TranslatePress plugin is active.
*/
class TranslatePress_Conditional implements Conditional {
/**
* Checks whether the TranslatePress plugin is active.
*
* @return bool Whether the TranslatePress plugin is active.
*/
public function is_met() {
return \class_exists( 'TRP_Translate_Press' );
}
}
front-end-conditional.php 0000666 00000000512 15112303201 0011440 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when NOT in the admin.
*/
class Front_End_Conditional implements Conditional {
/**
* Returns `true` when NOT on an admin page.
*
* @return bool `true` when NOT on an admin page.
*/
public function is_met() {
return ! \is_admin();
}
}
woocommerce-conditional.php 0000666 00000000634 15112303201 0012070 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when WooCommerce is active.
*/
class WooCommerce_Conditional implements Conditional {
/**
* Returns `true` when the WooCommerce plugin is installed and activated.
*
* @return bool `true` when the WooCommerce plugin is installed and activated.
*/
public function is_met() {
return \class_exists( 'WooCommerce' );
}
}
primary-category-conditional.php 0000666 00000002620 15112303201 0013044 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
use Yoast\WP\SEO\Helpers\Current_Page_Helper;
/**
* Conditional that is only met when in frontend or page is a post overview or post add/edit form.
*/
class Primary_Category_Conditional implements Conditional {
/**
* The current page helper.
*
* @var Current_Page_Helper
*/
private $current_page;
/**
* Primary_Category_Conditional constructor.
*
* @param Current_Page_Helper $current_page The current page helper.
*/
public function __construct( Current_Page_Helper $current_page ) {
$this->current_page = $current_page;
}
/**
* Returns `true` when on the frontend,
* or when on the post overview, post edit or new post admin page,
* or when on additional admin pages, allowed by filter.
*
* @return bool `true` when on the frontend, or when on the post overview,
* post edit, new post admin page or additional admin pages, allowed by filter.
*/
public function is_met() {
if ( ! \is_admin() ) {
return true;
}
/**
* Filter: Adds the possibility to use primary category at additional admin pages.
*
* @param array $admin_pages List of additional admin pages.
*/
$additional_pages = \apply_filters( 'wpseo_primary_category_admin_pages', [] );
return \in_array( $this->current_page->get_current_admin_page(), \array_merge( [ 'edit.php', 'post.php', 'post-new.php' ], $additional_pages ), true );
}
}
wincher-conditional.php 0000666 00000000240 15112303201 0011201 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional for the Wincher integration.
*/
class Wincher_Conditional extends Non_Multisite_Conditional {}
no-conditionals-trait.php 0000666 00000000575 15112303201 0011475 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Trait for integrations that do not have any conditionals.
*/
trait No_Conditionals {
/**
* Returns an empty array, meaning no conditionals are required to load whatever uses this trait.
*
* @return array The conditionals that must be met to load this.
*/
public static function get_conditionals() {
return [];
}
}
should-index-links-conditional.php 0000666 00000002014 15112303201 0013264 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
use Yoast\WP\SEO\Helpers\Options_Helper;
/**
* Should_Index_Links_Conditional class.
*/
class Should_Index_Links_Conditional implements Conditional {
/**
* The options helper.
*
* @var Options_Helper
*/
protected $options_helper;
/**
* Should_Index_Links_Conditional constructor.
*
* @param Options_Helper $options_helper The options helper.
*/
public function __construct( Options_Helper $options_helper ) {
$this->options_helper = $options_helper;
}
/**
* Returns `true` when the links on this website should be indexed.
*
* @return bool `true` when the links on this website should be indexed.
*/
public function is_met() {
$should_index_links = $this->options_helper->get( 'enable_text_link_counter' );
/**
* Filter: 'wpseo_should_index_links' - Allows disabling of Yoast's links indexation.
*
* @api bool To disable the indexation, return false.
*/
return \apply_filters( 'wpseo_should_index_links', $should_index_links );
}
}
premium-inactive-conditional.php 0000666 00000000611 15112303201 0013022 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Abstract class for creating conditionals based on feature flags.
*/
class Premium_Inactive_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return ! \YoastSEO()->helpers->product->is_premium();
}
}
feature-flag-conditional.php 0000666 00000001617 15112303201 0012115 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Abstract class for creating conditionals based on feature flags.
*/
abstract class Feature_Flag_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
$feature_flag = \strtoupper( $this->get_feature_flag() );
return \defined( 'YOAST_SEO_' . $feature_flag ) && \constant( 'YOAST_SEO_' . $feature_flag ) === true;
}
/**
* Returns the name of the feature flag.
* 'YOAST_SEO_' is automatically prepended to it and it will be uppercased.
*
* @return string the name of the feature flag.
*/
abstract protected function get_feature_flag();
/**
* Returns the feature name.
*
* @return string the name of the feature flag.
*/
public function get_feature_name() {
return $this->get_feature_flag();
}
}
settings-conditional.php 0000666 00000002703 15112303201 0011410 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Class Settings_Conditional.
*/
class Settings_Conditional implements Conditional {
/**
* Holds New_Settings_Ui_Conditional.
*
* @var New_Settings_Ui_Conditional
*/
protected $new_settings_ui_conditional;
/**
* Holds User_Can_Manage_Wpseo_Options_Conditional.
*
* @var User_Can_Manage_Wpseo_Options_Conditional
*/
protected $user_can_manage_wpseo_options_conditional;
/**
* Constructs Settings_Conditional.
*
* @param New_Settings_Ui_Conditional $new_settings_ui_conditional The New_Settings_Ui_Conditional.
* @param User_Can_Manage_Wpseo_Options_Conditional $user_can_manage_wpseo_options_conditional The User_Can_Manage_Wpseo_Options_Conditional.
*/
public function __construct(
New_Settings_Ui_Conditional $new_settings_ui_conditional,
User_Can_Manage_Wpseo_Options_Conditional $user_can_manage_wpseo_options_conditional
) {
$this->new_settings_ui_conditional = $new_settings_ui_conditional;
$this->user_can_manage_wpseo_options_conditional = $user_can_manage_wpseo_options_conditional;
}
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
if ( ! $this->new_settings_ui_conditional->is_met() ) {
return false;
}
if ( ! $this->user_can_manage_wpseo_options_conditional->is_met() ) {
return false;
}
return true;
}
}
admin-conditional.php 0000666 00000000513 15112303201 0010635 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when in the admin.
*/
class Admin_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return \is_admin();
}
}
indexables-page-conditional.php 0000666 00000000547 15112303201 0012604 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Feature flag conditional for the new indexables page.
*/
class Indexables_Page_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
*
* @return string The name of the feature flag.
*/
protected function get_feature_flag() {
return 'INDEXABLES_PAGE';
}
}
schema-blocks-conditional.php 0000666 00000000661 15112303201 0012264 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Checks if the YOAST_SEO_SCHEMA_BLOCKS constant is set.
*/
class Schema_Blocks_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
* 'YOAST_SEO_' is automatically prepended to it and it will be uppercased.
*
* @return string the name of the feature flag.
*/
protected function get_feature_flag() {
return 'SCHEMA_BLOCKS';
}
}
development-conditional.php 0000666 00000000601 15112303201 0012065 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
use WPSEO_Utils;
/**
* Conditional that is only met when in development mode.
*/
class Development_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return WPSEO_Utils::is_development_mode();
}
}
not-admin-ajax-conditional.php 0000666 00000000556 15112303201 0012363 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when not in a admin-ajax request.
*/
class Not_Admin_Ajax_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return ( ! \wp_doing_ajax() );
}
}
wincher-token-conditional.php 0000666 00000001250 15112303201 0012321 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
use Yoast\WP\SEO\Config\Wincher_Client;
/**
* Conditional that is only met when the Wincher token is set.
*/
class Wincher_Token_Conditional implements Conditional {
/**
* The Wincher client.
*
* @var Wincher_Client
*/
private $client;
/**
* Wincher_Token_Conditional constructor.
*
* @param Wincher_Client $client The Wincher client.
*/
public function __construct( Wincher_Client $client ) {
$this->client = $client;
}
/**
* Returns whether this conditional is met.
*
* @return bool Whether the conditional is met.
*/
public function is_met() {
return $this->client->has_valid_tokens();
}
}
wincher-automatically-track-conditional.php 0000666 00000001367 15112303201 0015164 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
use Yoast\WP\SEO\Helpers\Options_Helper;
/**
* Conditional that is only met when the Wincher automatic tracking is enabled.
*/
class Wincher_Automatically_Track_Conditional implements Conditional {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options;
/**
* Wincher_Automatically_Track_Conditional constructor.
*
* @param Options_Helper $options The options helper.
*/
public function __construct( Options_Helper $options ) {
$this->options = $options;
}
/**
* Returns whether this conditional is met.
*
* @return bool Whether the conditional is met.
*/
public function is_met() {
return $this->options->get( 'wincher_automatically_add_keyphrases' );
}
}
user-can-publish-posts-and-pages-conditional.php 0000666 00000001036 15112303201 0015732 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when the current user has the `wpseo_manage_options` capability.
*
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
*/
class User_Can_Publish_Posts_And_Pages_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return \current_user_can( 'publish_posts' ) && \current_user_can( 'publish_pages' );
}
}
yoast-admin-and-dashboard-conditional.php 0000666 00000003170 15112303201 0014461 0 ustar 00 <?php // phpcs:ignore Yoast.Files.FileName.InvalidClassFileName -- Reason: this explicitly concerns the Yoast admin and dashboard.
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when in the admin dashboard, update or Yoast SEO pages.
*/
class Yoast_Admin_And_Dashboard_Conditional implements Conditional {
/**
* Returns `true` when on the admin dashboard, update or Yoast SEO pages.
*
* @return bool `true` when on the admin dashboard, update or Yoast SEO pages.
*/
public function is_met() {
global $pagenow;
// Bail out early if we're not on the front-end.
if ( ! \is_admin() ) {
return false;
}
// Do not output on plugin / theme upgrade pages or when WordPress is upgrading.
if ( ( \defined( 'IFRAME_REQUEST' ) && \IFRAME_REQUEST ) || $this->on_upgrade_page() || \wp_installing() ) {
return false;
}
if ( $pagenow === 'admin.php' && isset( $_GET['page'] ) && \strpos( $_GET['page'], 'wpseo' ) === 0 ) {
return true;
}
$target_pages = [
'index.php',
'plugins.php',
'update-core.php',
'options-permalink.php',
];
return \in_array( $pagenow, $target_pages, true );
}
/**
* Checks if we are on a theme or plugin upgrade page.
*
* @return bool Whether we are on a theme or plugin upgrade page.
*/
private function on_upgrade_page() {
/*
* IFRAME_REQUEST is not defined on these pages,
* though these action pages do show when upgrading themes or plugins.
*/
$actions = [ 'do-theme-upgrade', 'do-plugin-upgrade', 'do-core-upgrade', 'do-core-reinstall' ];
return isset( $_GET['action'] ) && \in_array( $_GET['action'], $actions, true );
}
}
user-can-manage-wpseo-options-conditional.php 0000666 00000000772 15112303201 0015343 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when the current user has the `wpseo_manage_options` capability.
*
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
*/
class User_Can_Manage_Wpseo_Options_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return \current_user_can( 'wpseo_manage_options' );
}
}
headless-rest-endpoints-enabled-conditional.php 0000666 00000001457 15112303201 0015711 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
use Yoast\WP\SEO\Helpers\Options_Helper;
/**
* Conditional that is only met when the headless rest endpoints are enabled.
*/
class Headless_Rest_Endpoints_Enabled_Conditional implements Conditional {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options;
/**
* Headless_Rest_Endpoints_Enabled_Conditional constructor.
*
* @param Options_Helper $options The options helper.
*/
public function __construct( Options_Helper $options ) {
$this->options = $options;
}
/**
* Returns `true` whether the headless REST endpoints have been enabled.
*
* @return bool `true` when the headless REST endpoints have been enabled.
*/
public function is_met() {
return $this->options->get( 'enable_headless_rest_endpoints' );
}
}
premium-active-conditional.php 0000666 00000000546 15112303201 0012502 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Class Premium_Active_Conditional.
*/
class Premium_Active_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return \YoastSEO()->helpers->product->is_premium();
}
}
addon-installation-conditional.php 0000666 00000000666 15112303201 0013342 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Checks if the Addon_Installation constant is set.
*/
class Addon_Installation_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
* 'YOAST_SEO_' is automatically prepended to it and it will be uppercased.
*
* @return string the name of the feature flag.
*/
protected function get_feature_flag() {
return 'ADDON_INSTALLATION';
}
}
news-conditional.php 0000666 00000000550 15112303201 0010522 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when news SEO is activated.
*/
class News_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return \defined( 'WPSEO_NEWS_VERSION' );
}
}
open-graph-conditional.php 0000666 00000001330 15112303201 0011603 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
use Yoast\WP\SEO\Helpers\Options_Helper;
/**
* Conditional that is only met when the Open Graph feature is enabled.
*/
class Open_Graph_Conditional implements Conditional {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options;
/**
* Open_Graph_Conditional constructor.
*
* @param Options_Helper $options The options helper.
*/
public function __construct( Options_Helper $options ) {
$this->options = $options;
}
/**
* Returns `true` when the Open Graph feature is enabled.
*
* @return bool `true` when the Open Graph feature is enabled.
*/
public function is_met() {
return $this->options->get( 'opengraph' ) === true;
}
}
semrush-enabled-conditional.php 0000666 00000001343 15112303201 0012625 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
use Yoast\WP\SEO\Helpers\Options_Helper;
/**
* Conditional that is only met when the SEMrush integration is enabled.
*/
class SEMrush_Enabled_Conditional implements Conditional {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options;
/**
* SEMrush_Enabled_Conditional constructor.
*
* @param Options_Helper $options The options helper.
*/
public function __construct( Options_Helper $options ) {
$this->options = $options;
}
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return $this->options->get( 'semrush_integration_active', false );
}
}
text-formality-conditional.php 0000666 00000000661 15112303201 0012541 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Checks if the YOAST_SEO_TEXT_FORMALITY constant is set.
*/
class Text_Formality_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
* 'YOAST_SEO_' is automatically prepended to it and it will be uppercased.
*
* @return string the name of the feature flag.
*/
public function get_feature_flag() {
return 'TEXT_FORMALITY';
}
}
norwegian-readability-conditional.php 0000666 00000001132 15114006663 0014041 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Checks if the YOAST_SEO_NORWEGIAN_READABILITY constant is set.
*
* @deprecated 16.8
* @codeCoverageIgnore
*/
class Norwegian_Readability_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
* 'YOAST_SEO_' is automatically prepended to it and it will be uppercased.
*
* @deprecated 16.8
* @codeCoverageIgnore
*
* @return string the name of the feature flag.
*/
public function get_feature_flag() {
\_deprecated_function( __METHOD__, 'WPSEO 16.8' );
return 'NORWEGIAN_READABILITY';
}
}
greek-support-conditional.php 0000666 00000001102 15114006663 0012365 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Checks if the YOAST_SEO_GREEK_SUPPORT constant is set.
*
* @deprecated 17.5
* @codeCoverageIgnore
*/
class Greek_Support_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
* 'YOAST_SEO_' is automatically prepended to it and it will be uppercased.
*
* @deprecated 17.5
* @codeCoverageIgnore
*
* @return string the name of the feature flag.
*/
public function get_feature_flag() {
\_deprecated_function( __METHOD__, 'WPSEO 17.5' );
return 'GREEK_SUPPORT';
}
}
farsi-support-conditional.php 0000666 00000001102 15114006663 0012374 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Checks if the YOAST_SEO_FARSI_SUPPORT constant is set.
*
* @deprecated 17.2
* @codeCoverageIgnore
*/
class Farsi_Support_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
* 'YOAST_SEO_' is automatically prepended to it and it will be uppercased.
*
* @deprecated 17.2
* @codeCoverageIgnore
*
* @return string the name of the feature flag.
*/
public function get_feature_flag() {
\_deprecated_function( __METHOD__, 'WPSEO 17.2' );
return 'FARSI_SUPPORT';
}
}
japanese-support-conditional.php 0000666 00000001113 15114006663 0013060 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Checks if the YOAST_SEO_JAPANESE_SUPPORT constant is set.
*
* @deprecated 17.9
* @codeCoverageIgnore
*/
class Japanese_Support_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
* 'YOAST_SEO_' is automatically prepended to it and it will be uppercased.
*
* @deprecated 17.9
* @codeCoverageIgnore
*
* @return string the name of the feature flag.
*/
public function get_feature_flag() {
\_deprecated_function( __METHOD__, 'WPSEO 17.9' );
return 'JAPANESE_SUPPORT';
}
}
front-end-inspector-conditional.php 0000666 00000000724 15114006663 0013467 0 ustar 00 <?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Feature flag conditional for the front-end inspector.
*
* @deprecated 19.5
*/
class Front_End_Inspector_Conditional extends Feature_Flag_Conditional {
/**
* Returns the name of the feature flag.
*
* @deprecated 19.5
*
* @return string The name of the feature flag.
*/
protected function get_feature_flag() {
\_deprecated_function( __METHOD__, 'WPSEO 19.5' );
return 'FRONT_END_INSPECTOR';
}
}
.htaccess 0000666 00000000424 15114513302 0006341 0 ustar 00 <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
Deny from all
</FilesMatch>
</IfModule>