Merged in feature/from-pantheon (pull request #16)
code from pantheon * code from pantheon
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* Graceful deprecation of various classes which were renamed.
|
||||
*
|
||||
* {@internal As this file is just (temporarily) put in place to warn extending
|
||||
* plugins about the class name changes, it is exempt from select CS standards.}
|
||||
*
|
||||
* @package Yoast\WP\SEO\Premium
|
||||
*
|
||||
* @since 16.1
|
||||
* @deprecated 16.1
|
||||
*
|
||||
* @phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound
|
||||
* @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound
|
||||
* @phpcs:disable Yoast.Commenting.CodeCoverageIgnoreDeprecated
|
||||
* @phpcs:disable Yoast.Commenting.FileComment.Unnecessary
|
||||
* @phpcs:disable Yoast.Files.FileName.InvalidClassFileName
|
||||
*/
|
||||
|
||||
namespace Yoast\WP\SEO\Actions\Prominent_Words;
|
||||
|
||||
use WPSEO_Premium_Prominent_Words_Support;
|
||||
use Yoast\WP\SEO\Helpers\Meta_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Prominent_Words_Helper;
|
||||
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
|
||||
use Yoast\WP\SEO\Premium\Actions\Prominent_Words\Complete_Action as New_Complete_Action;
|
||||
use Yoast\WP\SEO\Premium\Actions\Prominent_Words\Content_Action as New_Content_Action;
|
||||
use Yoast\WP\SEO\Premium\Actions\Prominent_Words\Save_Action as New_Save_Action;
|
||||
use Yoast\WP\SEO\Repositories\Indexable_Repository;
|
||||
use Yoast\WP\SEO\Repositories\Prominent_Words_Repository;
|
||||
|
||||
\_deprecated_file( \basename( __FILE__ ), 'Yoast SEO Premium 16.1' );
|
||||
|
||||
/**
|
||||
* Class Complete_Action.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\Actions\Prominent_Words\Complete_Action} instead.
|
||||
*/
|
||||
class Complete_Action extends New_Complete_Action {
|
||||
|
||||
/**
|
||||
* Complete_Action constructor.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\Actions\Prominent_Words\Complete_Action} instead.
|
||||
*
|
||||
* @param Prominent_Words_Helper $prominent_words_helper The prominent words helper.
|
||||
*/
|
||||
public function __construct( Prominent_Words_Helper $prominent_words_helper ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 16.1', '\Yoast\WP\SEO\Premium\Actions\Prominent_Words\Complete_Action' );
|
||||
parent::__construct( $prominent_words_helper );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Content_Action.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\Actions\Prominent_Words\Content_Action} instead.
|
||||
*/
|
||||
class Content_Action extends New_Content_Action {
|
||||
|
||||
/**
|
||||
* Content_Action constructor.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\Actions\Prominent_Words\Content_Action} instead.
|
||||
*
|
||||
* @param WPSEO_Premium_Prominent_Words_Support $prominent_words_support An instance of
|
||||
* WPSEO_Premium_Prominent_Words_Support.
|
||||
* @param Indexable_Repository $indexable_repository An instance of Indexable_Repository.
|
||||
* @param Meta_Tags_Context_Memoizer $memoizer The meta tags context memoizer.
|
||||
* @param Meta_Helper $meta The meta value helper.
|
||||
*/
|
||||
public function __construct(
|
||||
WPSEO_Premium_Prominent_Words_Support $prominent_words_support,
|
||||
Indexable_Repository $indexable_repository,
|
||||
Meta_Tags_Context_Memoizer $memoizer,
|
||||
Meta_Helper $meta
|
||||
) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 16.1', '\Yoast\WP\SEO\Premium\Actions\Prominent_Words\Content_Action' );
|
||||
parent::__construct( $prominent_words_support, $indexable_repository, $memoizer, $meta );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Save_Action.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\Actions\Prominent_Words\Save_Action} instead.
|
||||
*/
|
||||
class Save_Action extends New_Save_Action {
|
||||
|
||||
/**
|
||||
* Prominent_Words_Link_Service constructor.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\Actions\Prominent_Words\Save_Action} instead.
|
||||
*
|
||||
* @param Prominent_Words_Repository $prominent_words_repository The repository to create, read, update and delete
|
||||
* prominent words from.
|
||||
* @param Indexable_Repository $indexable_repository The repository to read, update and delete
|
||||
* indexables from.
|
||||
* @param Prominent_Words_Helper $prominent_words_helper The prominent words helper.
|
||||
*/
|
||||
public function __construct(
|
||||
Prominent_Words_Repository $prominent_words_repository,
|
||||
Indexable_Repository $indexable_repository,
|
||||
Prominent_Words_Helper $prominent_words_helper
|
||||
) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 16.1', '\Yoast\WP\SEO\Premium\Actions\Prominent_Words\Save_Action' );
|
||||
parent::__construct( $prominent_words_repository, $indexable_repository, $prominent_words_helper );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* Graceful deprecation of various classes which were renamed.
|
||||
*
|
||||
* {@internal As this file is just (temporarily) put in place to warn extending
|
||||
* plugins about the class name changes, it is exempt from select CS standards.}
|
||||
*
|
||||
* @package Yoast\WP\SEO\Premium
|
||||
*
|
||||
* @since 16.1
|
||||
* @deprecated 16.1
|
||||
*
|
||||
* @phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound
|
||||
* @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound
|
||||
* @phpcs:disable Yoast.Commenting.CodeCoverageIgnoreDeprecated
|
||||
* @phpcs:disable Yoast.Commenting.FileComment.Unnecessary
|
||||
* @phpcs:disable Yoast.Files.FileName.InvalidClassFileName
|
||||
*/
|
||||
|
||||
namespace Yoast\WP\SEO\Actions;
|
||||
|
||||
use WPSEO_Premium_Prominent_Words_Support;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Prominent_Words_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Zapier_Helper;
|
||||
use Yoast\WP\SEO\Premium\Actions\Link_Suggestions_Action as New_Link_Suggestions_Action;
|
||||
use Yoast\WP\SEO\Premium\Actions\Zapier_Action as New_Zapier_Action;
|
||||
use Yoast\WP\SEO\Repositories\Indexable_Repository;
|
||||
use Yoast\WP\SEO\Repositories\Prominent_Words_Repository;
|
||||
|
||||
\_deprecated_file( \basename( __FILE__ ), 'Yoast SEO Premium 16.1' );
|
||||
|
||||
/**
|
||||
* Class Link_Suggestions_Action.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\Actions\Link_Suggestions_Action} instead.
|
||||
*/
|
||||
class Link_Suggestions_Action extends New_Link_Suggestions_Action {
|
||||
|
||||
/**
|
||||
* Link_Suggestions_Service constructor.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\Actions\Link_Suggestions_Action} instead.
|
||||
*
|
||||
* @param Prominent_Words_Repository $prominent_words_repository The repository to retrieve prominent words from.
|
||||
* @param Indexable_Repository $indexable_repository The repository to retrieve indexables from.
|
||||
* @param Prominent_Words_Helper $prominent_words_helper Class with helper methods for prominent words.
|
||||
* @param WPSEO_Premium_Prominent_Words_Support $prominent_words_support The prominent words support class.
|
||||
*/
|
||||
public function __construct(
|
||||
Prominent_Words_Repository $prominent_words_repository,
|
||||
Indexable_Repository $indexable_repository,
|
||||
Prominent_Words_Helper $prominent_words_helper,
|
||||
WPSEO_Premium_Prominent_Words_Support $prominent_words_support
|
||||
) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 16.1', '\Yoast\WP\SEO\Premium\Actions\Link_Suggestions_Action' );
|
||||
|
||||
parent::__construct(
|
||||
$prominent_words_repository,
|
||||
$indexable_repository,
|
||||
$prominent_words_helper,
|
||||
$prominent_words_support
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Zapier_Action.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\Actions\Zapier_Action} instead.
|
||||
*/
|
||||
class Zapier_Action extends New_Zapier_Action {
|
||||
|
||||
/**
|
||||
* Zapier_Action constructor.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\Actions\Zapier_Action} instead.
|
||||
*
|
||||
* @param Options_Helper $options_helper The Options Helper.
|
||||
* @param Zapier_Helper $zapier_helper The Zapier helper.
|
||||
* @param Indexable_Repository $indexable_repository The Indexable repository.
|
||||
*/
|
||||
public function __construct(
|
||||
Options_Helper $options_helper,
|
||||
Zapier_Helper $zapier_helper,
|
||||
Indexable_Repository $indexable_repository
|
||||
) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 16.1', '\Yoast\WP\SEO\Premium\Actions\Zapier_Action' );
|
||||
|
||||
parent::__construct( $options_helper, $zapier_helper, $indexable_repository );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Actions;
|
||||
|
||||
use Yoast\WP\SEO\Premium\Helpers\Zapier_Helper;
|
||||
use Yoast\WP\SEO\Repositories\Indexable_Repository;
|
||||
|
||||
/**
|
||||
* Handles the actual requests to the Zapier endpoints.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Zapier_Action {
|
||||
|
||||
/**
|
||||
* The Zapier helper.
|
||||
*
|
||||
* @var Zapier_Helper
|
||||
*/
|
||||
protected $zapier_helper;
|
||||
|
||||
/**
|
||||
* The Indexable repository.
|
||||
*
|
||||
* @var Indexable_Repository
|
||||
*/
|
||||
protected $indexable_repository;
|
||||
|
||||
/**
|
||||
* Zapier_Action constructor.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Zapier_Helper $zapier_helper The Zapier helper.
|
||||
* @param Indexable_Repository $indexable_repository The Indexable repository.
|
||||
*/
|
||||
public function __construct( Zapier_Helper $zapier_helper, Indexable_Repository $indexable_repository ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$this->zapier_helper = $zapier_helper;
|
||||
$this->indexable_repository = $indexable_repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribes Zapier and stores the passed URL for later usage.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $url The URL to subscribe.
|
||||
* @param string $api_key The API key from Zapier to check against the one stored in the options.
|
||||
*
|
||||
* @return object The response object.
|
||||
*/
|
||||
public function subscribe( $url, $api_key ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( ! $this->zapier_helper->is_valid_api_key( $api_key ) ) {
|
||||
return (object) [
|
||||
'data' => [],
|
||||
'message' => 'The API key does not match.',
|
||||
'status' => 500,
|
||||
];
|
||||
}
|
||||
|
||||
if ( $this->zapier_helper->is_connected() ) {
|
||||
return (object) [
|
||||
'data' => [],
|
||||
'message' => 'Subscribing failed. A subscription already exists.',
|
||||
'status' => 500,
|
||||
];
|
||||
}
|
||||
|
||||
$subscription_data = $this->zapier_helper->subscribe_url( $url );
|
||||
|
||||
if ( ! $subscription_data ) {
|
||||
return (object) [
|
||||
'data' => [],
|
||||
'message' => 'Subscribing failed.',
|
||||
'status' => 500,
|
||||
];
|
||||
}
|
||||
|
||||
return (object) [
|
||||
'data' => $subscription_data,
|
||||
'status' => 200,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribes Zapier based on the passed ID.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $id The ID to unsubscribe.
|
||||
*
|
||||
* @return object The response object.
|
||||
*/
|
||||
public function unsubscribe( $id ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( ! $this->zapier_helper->is_subscribed_id( $id ) ) {
|
||||
return (object) [
|
||||
'message' => \sprintf( 'Unsubscribing failed. Subscription with ID `%s` does not exist.', $id ),
|
||||
'status' => 404,
|
||||
];
|
||||
}
|
||||
|
||||
if ( ! $this->zapier_helper->unsubscribe_id( $id ) ) {
|
||||
return (object) [
|
||||
'message' => 'Unsubscribing failed. Unable to delete subscription.',
|
||||
'status' => 500,
|
||||
];
|
||||
}
|
||||
|
||||
return (object) [
|
||||
'message' => \sprintf( 'Successfully unsubscribed subscription with ID `%s`.', $id ),
|
||||
'status' => 200,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the API key submitted by Zapier.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $api_key The API key from Zapier to check against the one
|
||||
* stored in the options.
|
||||
*
|
||||
* @return object The response object.
|
||||
*/
|
||||
public function check_api_key( $api_key ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( ! $this->zapier_helper->is_valid_api_key( $api_key ) ) {
|
||||
return (object) [
|
||||
'data' => [],
|
||||
'message' => 'The API key does not match.',
|
||||
'status' => 500,
|
||||
];
|
||||
}
|
||||
|
||||
return (object) [
|
||||
'data' => [],
|
||||
'message' => 'The API key is valid.',
|
||||
'status' => 200,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an array of the last published post URLs.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $api_key The API key from Zapier to check against the one
|
||||
* stored in the options.
|
||||
*
|
||||
* @return object The response object.
|
||||
*/
|
||||
public function perform_list( $api_key ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( ! $this->zapier_helper->is_valid_api_key( $api_key ) ) {
|
||||
return (object) [
|
||||
'data' => [],
|
||||
'message' => 'The API key does not match.',
|
||||
'status' => 500,
|
||||
];
|
||||
}
|
||||
|
||||
$latest_post = \get_posts(
|
||||
[
|
||||
'numberposts' => 1,
|
||||
]
|
||||
);
|
||||
$zapier_data = [];
|
||||
foreach ( $latest_post as $item ) {
|
||||
$indexable = $this->indexable_repository->find_by_id_and_type( $item->ID, 'post' );
|
||||
if ( $indexable ) {
|
||||
$zapier_data[] = (object) $this->zapier_helper->get_data_for_zapier( $indexable );
|
||||
}
|
||||
}
|
||||
|
||||
return (object) [
|
||||
'data' => $zapier_data,
|
||||
'status' => 200,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if Zapier is connected.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return object The response object.
|
||||
*/
|
||||
public function is_connected() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return (object) [
|
||||
'data' => [
|
||||
'is_connected' => $this->zapier_helper->is_connected(),
|
||||
],
|
||||
'status' => 200,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the API key in the DB.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $api_key The API key to be reset.
|
||||
*
|
||||
* @return object The response object.
|
||||
*/
|
||||
public function reset_api_key( $api_key ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( ! $this->zapier_helper->is_valid_api_key( $api_key ) ) {
|
||||
return (object) [
|
||||
'data' => [],
|
||||
'message' => 'The API key does not match.',
|
||||
'status' => 500,
|
||||
];
|
||||
}
|
||||
|
||||
$this->zapier_helper->reset_api_key_and_subscription();
|
||||
$new_api_key = $this->zapier_helper->get_or_generate_zapier_api_key();
|
||||
|
||||
return (object) [
|
||||
'data' => [
|
||||
'zapier_api_key' => $new_api_key,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO Premium plugin file.
|
||||
*
|
||||
* @package WPSEO\Premium\Classes
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class represents the fetching of a full name for a user who has filled in a Facebook profile url. The class
|
||||
* will try to fetch the full name via the Facebook following plugin (widget). If the user has chosen to disallow
|
||||
* following of his profile, there isn't returned any name - only an empty string.
|
||||
*
|
||||
* To prevent doing request all the time, the obtained name will be stored as user meta for the user.
|
||||
*
|
||||
* @deprecated 20.3
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class WPSEO_Facebook_Profile {
|
||||
|
||||
const TRANSIENT_NAME = 'yoast_facebook_profiles';
|
||||
|
||||
/**
|
||||
* URL providing us the full name belonging to the user.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $facebook_endpoint = 'https://www.facebook.com/plugins/follow.php?href=';
|
||||
|
||||
/**
|
||||
* Sets the AJAX action hook, to catch the AJAX request for getting the name on Facebook.
|
||||
*
|
||||
* @deprecated 20.3
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function set_hooks() {
|
||||
_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.3' );
|
||||
add_action( 'wp_ajax_wpseo_get_facebook_name', [ $this, 'ajax_get_facebook_name' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user id and prints the full Facebook name.
|
||||
*
|
||||
* @deprecated 20.3
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function ajax_get_facebook_name() {
|
||||
_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.3' );
|
||||
if ( wp_doing_ajax() ) {
|
||||
check_ajax_referer( 'get_facebook_name' );
|
||||
|
||||
$user_id = (int) filter_input( INPUT_GET, 'user_id' );
|
||||
$facebook_profile = $this->get_facebook_profile( $user_id );
|
||||
|
||||
// Only try to get the name when the user has a profile set.
|
||||
if ( $facebook_profile !== '' ) {
|
||||
wp_die( esc_html( $this->get_name( $facebook_profile ) ) );
|
||||
}
|
||||
|
||||
wp_die();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Facebook profile url from the user profile.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param int $user_id The user to get the Facebook profile field for.
|
||||
*
|
||||
* @return string URL or empty string if the field is not set or empty.
|
||||
*/
|
||||
private function get_facebook_profile( $user_id ) {
|
||||
$facebook_profile = get_the_author_meta( 'facebook', $user_id );
|
||||
|
||||
if ( ! empty( $facebook_profile ) ) {
|
||||
return $facebook_profile;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name used on Facebook from the transient cache, if the name isn't
|
||||
* fetched already get it from the Facebook follow widget.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $facebook_profile The profile to get.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function get_name( $facebook_profile ) {
|
||||
$cached_facebook_name = $this->get_cached_name( $facebook_profile );
|
||||
if ( $cached_facebook_name !== false ) {
|
||||
return $cached_facebook_name;
|
||||
}
|
||||
|
||||
$facebook_name = $this->get_name_from_facebook( $facebook_profile );
|
||||
|
||||
$this->set_cached_name( $facebook_profile, $facebook_name );
|
||||
|
||||
return $facebook_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the stored name from the user meta.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $facebook_profile The Facebook profile to look for.
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
private function get_cached_name( $facebook_profile ) {
|
||||
$facebook_profiles = get_transient( self::TRANSIENT_NAME );
|
||||
if ( is_array( $facebook_profiles ) && array_key_exists( $facebook_profile, $facebook_profiles ) ) {
|
||||
return $facebook_profiles[ $facebook_profile ];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the fetched Facebook name to the user meta.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $facebook_profile The Facebook profile belonging to the name.
|
||||
* @param string $facebook_name The name the user got on Facebook.
|
||||
*/
|
||||
private function set_cached_name( $facebook_profile, $facebook_name ) {
|
||||
$facebook_profiles = get_transient( self::TRANSIENT_NAME );
|
||||
|
||||
$facebook_profiles[ $facebook_profile ] = $facebook_name;
|
||||
|
||||
set_transient( self::TRANSIENT_NAME, $facebook_profiles, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Do request to Facebook to get the HTML for the follow widget.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $facebook_profile The profile URL to lookup.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function get_name_from_facebook( $facebook_profile ) {
|
||||
$response = wp_remote_get(
|
||||
$this->facebook_endpoint . $facebook_profile,
|
||||
[
|
||||
'headers' => [ 'Accept-Language' => 'en_US' ],
|
||||
]
|
||||
);
|
||||
|
||||
if ( wp_remote_retrieve_response_code( $response ) === 200 ) {
|
||||
return $this->extract_name_from_response(
|
||||
wp_remote_retrieve_body( $response )
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to extract the full name from the response.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $response_body The response HTML to lookup for the full name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function extract_name_from_response( $response_body ) {
|
||||
$full_name_regex = '/<div class="pluginButton pluginButtonInline pluginConnectButtonDisconnected" title="Follow(.*)'s public updates">/i';
|
||||
|
||||
if ( preg_match( $full_name_regex, $response_body, $matches ) ) {
|
||||
if ( ! empty( $matches[1] ) ) {
|
||||
return $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Conditionals;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Conditional;
|
||||
use Yoast\WP\SEO\Premium\Helpers\Zapier_Helper;
|
||||
|
||||
/**
|
||||
* Conditional that is only met when the Zapier integration is enabled.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Zapier_Enabled_Conditional implements Conditional {
|
||||
|
||||
/**
|
||||
* The Zapier helper.
|
||||
*
|
||||
* @var Zapier_Helper
|
||||
*/
|
||||
private $zapier;
|
||||
|
||||
/**
|
||||
* Zapier_Enabled_Conditional constructor.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Zapier_Helper $zapier The Zapier helper.
|
||||
*/
|
||||
public function __construct( Zapier_Helper $zapier ) {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO Premium 20.7' );
|
||||
|
||||
$this->zapier = $zapier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not this conditional is met.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return bool Whether or not the conditional is met.
|
||||
*/
|
||||
public function is_met() {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO Premium 20.7' );
|
||||
|
||||
return $this->zapier->is_enabled();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Graceful deprecation of various classes which were renamed.
|
||||
*
|
||||
* {@internal As this file is just (temporarily) put in place to warn extending
|
||||
* plugins about the class name changes, it is exempt from select CS standards.}
|
||||
*
|
||||
* @package Yoast\WP\SEO\Premium
|
||||
*
|
||||
* @since 16.3
|
||||
* @deprecated 16.3
|
||||
*
|
||||
* @phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound
|
||||
* @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound
|
||||
* @phpcs:disable Yoast.Commenting.CodeCoverageIgnoreDeprecated
|
||||
* @phpcs:disable Yoast.Commenting.FileComment.Unnecessary
|
||||
* @phpcs:disable Yoast.Files.FileName.InvalidClassFileName
|
||||
*/
|
||||
|
||||
namespace Yoast\WP\SEO\Database;
|
||||
|
||||
use Yoast\WP\SEO\Premium\Database\Migration_Runner_Premium as New_Migration_Runner_Premium;
|
||||
|
||||
\_deprecated_file( \basename( __FILE__ ), 'Yoast SEO Premium 16.3' );
|
||||
|
||||
/**
|
||||
* Class Migration_Runner_Premium.
|
||||
*
|
||||
* @deprecated 16.3 Use {@see \Yoast\WP\SEO\Premium\Database\Migration_Runner_Premium} instead.
|
||||
*/
|
||||
class Migration_Runner_Premium extends New_Migration_Runner_Premium {
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @deprecated 16.3 Use {@see \Yoast\WP\SEO\Premium\Database\Migration_Runner_Premium} instead.
|
||||
*/
|
||||
public function __construct() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 16.3', '\Yoast\WP\SEO\Premium\Database\Migration_Runner_Premium' );
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Helpers;
|
||||
|
||||
use WPSEO_Utils;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Models\Indexable;
|
||||
use Yoast\WP\SEO\Surfaces\Meta_Surface;
|
||||
|
||||
/**
|
||||
* Class Zapier_Helper
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @package Yoast\WP\SEO\Helpers
|
||||
*/
|
||||
class Zapier_Helper {
|
||||
|
||||
/**
|
||||
* The options helper.
|
||||
*
|
||||
* @var Options_Helper
|
||||
*/
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* The meta surface.
|
||||
*
|
||||
* @var Meta_Surface
|
||||
*/
|
||||
protected $meta_surface;
|
||||
|
||||
/**
|
||||
* Zapier_Helper constructor.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore It only sets dependencies.
|
||||
*
|
||||
* @param Options_Helper $options The options helper.
|
||||
* @param Meta_Surface $meta_surface The Meta surface.
|
||||
*/
|
||||
public function __construct( Options_Helper $options, Meta_Surface $meta_surface ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$this->options = $options;
|
||||
$this->meta_surface = $meta_surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a subscription exists in the database.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return bool Whether a subscription exists in the database.
|
||||
*/
|
||||
public function is_connected() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$subscription = $this->options->get( 'zapier_subscription' );
|
||||
|
||||
if ( \is_array( $subscription )
|
||||
&& ! empty( $subscription['id'] )
|
||||
&& \filter_var( $subscription['url'], \FILTER_VALIDATE_URL )
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the Zapier integration is currently enabled.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return bool Whether the integration is enabled.
|
||||
*/
|
||||
public function is_enabled() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return (bool) $this->options->get( 'zapier_integration_active', false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the stored Zapier API Key.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The Zapier API Key.
|
||||
*/
|
||||
public function get_or_generate_zapier_api_key() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$zapier_api_key = $this->options->get( 'zapier_api_key' );
|
||||
|
||||
if ( empty( $zapier_api_key ) ) {
|
||||
$zapier_api_key = \wp_generate_password( 32, false );
|
||||
$this->options->set( 'zapier_api_key', $zapier_api_key );
|
||||
}
|
||||
|
||||
return $zapier_api_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the stored Zapier API Key and subscription data.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reset_api_key_and_subscription() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
|
||||
$this->options->set( 'zapier_api_key', '' );
|
||||
$this->options->set( 'zapier_subscription', [] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string matches the API key in the DB, if present.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $api_key The API key to test.
|
||||
*
|
||||
* @return bool Whether the API key is valid or not.
|
||||
*/
|
||||
public function is_valid_api_key( $api_key ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return ( ! empty( $api_key ) && $this->options->get( 'zapier_api_key' ) === $api_key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Zapier hook URL of the trigger if present, null otherwise.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string|null The hook URL, null if not set.
|
||||
*/
|
||||
public function get_trigger_url() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( $this->is_connected() ) {
|
||||
$subscription = $this->options->get( 'zapier_subscription', [] );
|
||||
|
||||
return $subscription['url'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the submitted id is present in the subscriptions.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $id The id to be tested.
|
||||
*
|
||||
* @return bool Whether the id is present in the subscriptions.
|
||||
*/
|
||||
public function is_subscribed_id( $id ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( $this->is_connected() ) {
|
||||
$subscription = $this->options->get( 'zapier_subscription', [] );
|
||||
|
||||
return $subscription['id'] === $id;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribes the submitted id.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $id The id to be unsubscribed.
|
||||
*
|
||||
* @return bool Whether the unsubscription was successful.
|
||||
*/
|
||||
public function unsubscribe_id( $id ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( $this->is_connected() && $this->is_subscribed_id( $id ) ) {
|
||||
return $this->options->set( 'zapier_subscription', [] );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new subscription with the submitted URL.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $url The URL to be subscribed.
|
||||
*
|
||||
* @return array|bool The subscription data (id and URL) if successful, false otherwise.
|
||||
*/
|
||||
public function subscribe_url( $url ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( ! $this->is_connected() ) {
|
||||
$subscription_data = [
|
||||
'id' => \wp_generate_password( 32, false ),
|
||||
'url' => \esc_url_raw( $url, [ 'http', 'https' ] ),
|
||||
];
|
||||
|
||||
if ( $this->options->set( 'zapier_subscription', $subscription_data ) ) {
|
||||
return $subscription_data;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds and returns the data for Zapier.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Indexable $indexable The indexable from which the data must be extracted.
|
||||
*
|
||||
* @return array[] The array of data ready to be sent to Zapier.
|
||||
*/
|
||||
public function get_data_for_zapier( Indexable $indexable ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$post = \get_post( $indexable->object_id );
|
||||
if ( ! $post ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$meta = $this->meta_surface->for_indexable( $indexable );
|
||||
|
||||
$open_graph_image = '';
|
||||
if ( \count( $meta->open_graph_images ) > 0 ) {
|
||||
$open_graph_image_array = \reset( $meta->open_graph_images );
|
||||
$open_graph_image = $open_graph_image_array['url'];
|
||||
}
|
||||
|
||||
return [
|
||||
'url' => $indexable->permalink,
|
||||
'post_type' => $post->post_type,
|
||||
'post_title' => \html_entity_decode( $post->post_title ),
|
||||
'author' => \get_the_author_meta( 'display_name', $post->post_author ),
|
||||
'tags' => \html_entity_decode( \implode( ', ', \wp_get_post_tags( $post->ID, [ 'fields' => 'names' ] ) ) ),
|
||||
'categories' => \html_entity_decode( \implode( ', ', \wp_get_post_categories( $post->ID, [ 'fields' => 'names' ] ) ) ),
|
||||
'primary_category' => \html_entity_decode( \yoast_get_primary_term( 'category', $post ) ),
|
||||
'meta_description' => \html_entity_decode( $meta->description ),
|
||||
'open_graph_title' => \html_entity_decode( $meta->open_graph_title ),
|
||||
'open_graph_description' => \html_entity_decode( $meta->open_graph_description ),
|
||||
'open_graph_image' => $open_graph_image,
|
||||
'twitter_title' => \html_entity_decode( $meta->twitter_title ),
|
||||
'twitter_description' => \html_entity_decode( $meta->twitter_description ),
|
||||
'twitter_image' => $meta->twitter_image,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the post type is supported by the Zapier integration.
|
||||
*
|
||||
* The Zapier integration should be visible and working only for post types
|
||||
* that support the Yoast Metabox. We filter out attachments regardless of
|
||||
* the Yoast SEO settings, anyway.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $post_type The post type to be checked.
|
||||
*
|
||||
* @return bool Whether the post type is supported by the Zapier integration.
|
||||
*/
|
||||
public function is_post_type_supported( $post_type ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return $post_type !== 'attachment' && WPSEO_Utils::is_metabox_active( $post_type, 'post_type' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Initializers;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Current_Page_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Url_Helper;
|
||||
use Yoast\WP\SEO\Initializers\Initializer_Interface;
|
||||
|
||||
/**
|
||||
* Class Crawl_Cleanup_Permalinks.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Crawl_Cleanup_Permalinks implements Initializer_Interface {
|
||||
|
||||
/**
|
||||
* The current page helper
|
||||
*
|
||||
* @var Current_Page_Helper
|
||||
*/
|
||||
private $current_page_helper;
|
||||
|
||||
/**
|
||||
* The options helper.
|
||||
*
|
||||
* @var Options_Helper
|
||||
*/
|
||||
private $options_helper;
|
||||
|
||||
/**
|
||||
* The URL helper.
|
||||
*
|
||||
* @var Url_Helper
|
||||
*/
|
||||
private $url_helper;
|
||||
|
||||
/**
|
||||
* Crawl Cleanup Permalinks constructor.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Current_Page_Helper $current_page_helper The current page helper.
|
||||
* @param Options_Helper $options_helper The option helper.
|
||||
* @param Url_Helper $url_helper The URL helper.
|
||||
*/
|
||||
public function __construct(
|
||||
Current_Page_Helper $current_page_helper,
|
||||
Options_Helper $options_helper,
|
||||
Url_Helper $url_helper
|
||||
) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Initializers\Crawl_Cleanup_Permalinks' );
|
||||
|
||||
$this->current_page_helper = $current_page_helper;
|
||||
$this->options_helper = $options_helper;
|
||||
$this->url_helper = $url_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initialize() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Initializers\Crawl_Cleanup_Permalinks::initialize()' );
|
||||
|
||||
// We need to hook after 10 because otherwise our options helper isn't available yet.
|
||||
\add_action( 'plugins_loaded', [ $this, 'register_hooks' ], 15 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooks our required hooks.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Initializers\Crawl_Cleanup_Permalinks::register_hooks()' );
|
||||
|
||||
if ( $this->options_helper->get( 'clean_campaign_tracking_urls' ) && ! empty( \get_option( 'permalink_structure' ) ) ) {
|
||||
\add_action( 'template_redirect', [ $this, 'utm_redirect' ], 0 );
|
||||
}
|
||||
if ( $this->options_helper->get( 'clean_permalinks' ) && ! empty( \get_option( 'permalink_structure' ) ) ) {
|
||||
\add_action( 'template_redirect', [ $this, 'clean_permalinks' ], 1 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array The array of conditionals.
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Initializers\Crawl_Cleanup_Permalinks::get_conditionals()' );
|
||||
|
||||
return [ Front_End_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect utm variables away.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function utm_redirect() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Initializers\Crawl_Cleanup_Permalinks::utm_redirect()' );
|
||||
|
||||
// Prevents WP CLI from throwing an error.
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput
|
||||
if ( ! isset( $_SERVER['REQUEST_URI'] ) || \strpos( $_SERVER['REQUEST_URI'], '?' ) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput
|
||||
if ( ! \stripos( $_SERVER['REQUEST_URI'], 'utm_' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput
|
||||
$parsed = \wp_parse_url( $_SERVER['REQUEST_URI'] );
|
||||
|
||||
$query = \explode( '&', $parsed['query'] );
|
||||
$utms = [];
|
||||
$other_args = [];
|
||||
|
||||
foreach ( $query as $query_arg ) {
|
||||
if ( \stripos( $query_arg, 'utm_' ) === 0 ) {
|
||||
$utms[] = $query_arg;
|
||||
continue;
|
||||
}
|
||||
$other_args[] = $query_arg;
|
||||
}
|
||||
|
||||
if ( empty( $utms ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$other_args_str = '';
|
||||
if ( \count( $other_args ) > 0 ) {
|
||||
$other_args_str = '?' . \implode( '&', $other_args );
|
||||
}
|
||||
|
||||
$new_path = $parsed['path'] . $other_args_str . '#' . \implode( '&', $utms );
|
||||
|
||||
$message = \sprintf(
|
||||
/* translators: %1$s: Yoast SEO Premium */
|
||||
\__( '%1$s: redirect utm variables to #', 'wordpress-seo-premium' ),
|
||||
'Yoast SEO Premium'
|
||||
);
|
||||
|
||||
\wp_safe_redirect( \trailingslashit( $this->url_helper->recreate_current_url( false ) ) . \ltrim( $new_path, '/' ), 301, $message );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes unneeded query variables from the URL.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clean_permalinks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Initializers\Crawl_Cleanup_Permalinks::clean_permalinks()' );
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We're not processing anything yet...
|
||||
if ( \is_robots() || \get_query_var( 'sitemap' ) || empty( $_GET ) || \is_user_logged_in() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$current_url = $this->url_helper->recreate_current_url();
|
||||
|
||||
/**
|
||||
* Filter: 'Yoast\WP\SEO\allowlist_permalink_vars' - Allows plugins to register their own variables not to clean.
|
||||
*
|
||||
* Note: This is a Premium plugin-only hook.
|
||||
*
|
||||
* @since 19.2.0
|
||||
*
|
||||
* @param array $allowed_extravars The list of the allowed vars (empty by default).
|
||||
*/
|
||||
$allowed_extravars = \apply_filters( 'Yoast\WP\SEO\allowlist_permalink_vars', [] );
|
||||
|
||||
if ( $this->options_helper->get( 'clean_permalinks_extra_variables' ) !== '' ) {
|
||||
$allowed_extravars = \array_merge( $allowed_extravars, \explode( ',', $this->options_helper->get( 'clean_permalinks_extra_variables' ) ) );
|
||||
}
|
||||
|
||||
$allowed_query = [];
|
||||
|
||||
// @todo parse_str changes spaces in param names into `_`, we should find a better way to support them.
|
||||
\wp_parse_str( \wp_parse_url( $current_url, \PHP_URL_QUERY ), $query );
|
||||
|
||||
if ( ! empty( $allowed_extravars ) ) {
|
||||
foreach ( $allowed_extravars as $get ) {
|
||||
$get = \trim( $get );
|
||||
if ( isset( $query[ $get ] ) ) {
|
||||
$allowed_query[ $get ] = \rawurlencode_deep( $query[ $get ] );
|
||||
unset( $query[ $get ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we had only allowed params, let's just bail out, no further processing needed.
|
||||
if ( \count( $query ) === 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $wp_query;
|
||||
|
||||
$proper_url = '';
|
||||
|
||||
if ( \is_singular() ) {
|
||||
global $post;
|
||||
$proper_url = \get_permalink( $post->ID );
|
||||
|
||||
$page = \get_query_var( 'page' );
|
||||
if ( $page && $page !== 1 ) {
|
||||
$the_post = \get_post( $post->ID );
|
||||
$page_count = \substr_count( $the_post->post_content, '<!--nextpage-->' );
|
||||
$proper_url = \user_trailingslashit( \trailingslashit( $proper_url ) . $page );
|
||||
if ( $page > ( $page_count + 1 ) ) {
|
||||
$proper_url = \user_trailingslashit( \trailingslashit( $proper_url ) . ( $page_count + 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Fix reply to comment links, whoever decided this should be a GET variable?
|
||||
// phpcs:ignore WordPress.Security -- We know this is scary.
|
||||
if ( isset( $_SERVER['REQUEST_URI'] ) && \preg_match( '`(\?replytocom=[^&]+)`', \sanitize_text_field( $_SERVER['REQUEST_URI'] ), $matches ) ) {
|
||||
$proper_url .= \str_replace( '?replytocom=', '#comment-', $matches[0] );
|
||||
}
|
||||
unset( $matches );
|
||||
|
||||
// Prevent cleaning out posts & page previews for people capable of viewing them.
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We know this is scary.
|
||||
if ( isset( $_GET['preview'] ) && isset( $_GET['preview_nonce'] ) && \current_user_can( 'edit_post' ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
elseif ( \is_front_page() ) {
|
||||
if ( $this->current_page_helper->is_home_posts_page() ) {
|
||||
$proper_url = \home_url( '/' );
|
||||
}
|
||||
elseif ( $this->current_page_helper->is_home_static_page() ) {
|
||||
$proper_url = \get_permalink( $GLOBALS['post']->ID );
|
||||
}
|
||||
}
|
||||
elseif ( $this->current_page_helper->is_posts_page() ) {
|
||||
$proper_url = \get_permalink( \get_option( 'page_for_posts' ) );
|
||||
}
|
||||
elseif ( \is_category() || \is_tag() || \is_tax() ) {
|
||||
$term = $wp_query->get_queried_object();
|
||||
if ( \is_feed() ) {
|
||||
$proper_url = \get_term_feed_link( $term->term_id, $term->taxonomy );
|
||||
}
|
||||
else {
|
||||
$proper_url = \get_term_link( $term, $term->taxonomy );
|
||||
}
|
||||
}
|
||||
elseif ( \is_search() ) {
|
||||
$s = \get_search_query();
|
||||
$proper_url = \get_bloginfo( 'url' ) . '/?s=' . \rawurlencode( $s );
|
||||
}
|
||||
elseif ( \is_404() ) {
|
||||
if ( \is_multisite() && ! \is_subdomain_install() && \is_main_site() ) {
|
||||
if ( $current_url === \get_bloginfo( 'url' ) . '/blog/' || $current_url === \get_bloginfo( 'url' ) . '/blog' ) {
|
||||
if ( $this->current_page_helper->is_home_static_page() ) {
|
||||
$proper_url = \get_permalink( \get_option( 'page_for_posts' ) );
|
||||
}
|
||||
else {
|
||||
$proper_url = \get_bloginfo( 'url' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! empty( $proper_url ) && $wp_query->query_vars['paged'] !== 0 && $wp_query->post_count !== 0 ) {
|
||||
if ( \is_search() ) {
|
||||
$proper_url = \get_bloginfo( 'url' ) . '/page/' . $wp_query->query_vars['paged'] . '/?s=' . \rawurlencode( \get_search_query() );
|
||||
}
|
||||
else {
|
||||
$proper_url = \user_trailingslashit( \trailingslashit( $proper_url ) . 'page/' . $wp_query->query_vars['paged'] );
|
||||
}
|
||||
}
|
||||
|
||||
$proper_url = \add_query_arg( $allowed_query, $proper_url );
|
||||
|
||||
if ( ! empty( $proper_url ) && $current_url !== $proper_url ) {
|
||||
\header( 'Content-Type: redirect', true );
|
||||
\header_remove( 'Content-Type' );
|
||||
\header_remove( 'Last-Modified' );
|
||||
\header_remove( 'X-Pingback' );
|
||||
|
||||
$message = \sprintf(
|
||||
/* translators: %1$s: Yoast SEO Premium */
|
||||
\__( '%1$s: unregistered URL parameter removed', 'wordpress-seo-premium' ),
|
||||
'Yoast SEO Premium'
|
||||
);
|
||||
|
||||
\wp_safe_redirect( $proper_url, 301, $message );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,412 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Admin;
|
||||
|
||||
use WPSEO_Option;
|
||||
use WPSEO_Shortlinker;
|
||||
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
use Yoast\WP\SEO\Presenters\Admin\Alert_Presenter;
|
||||
use Yoast_Form;
|
||||
|
||||
/**
|
||||
* Crawl_Settings_Integration class
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Crawl_Settings_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Holds the settings + labels for the head clean up piece.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $basic_settings;
|
||||
|
||||
/**
|
||||
* Holds the settings + labels for the feeds clean up.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $feed_settings;
|
||||
|
||||
/**
|
||||
* Holds the settings + labels for permalink cleanup settings.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $permalink_cleanup_settings;
|
||||
|
||||
/**
|
||||
* Holds the settings + labels for search cleanup settings.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $search_cleanup_settings;
|
||||
|
||||
/**
|
||||
* Holds the settings + labels for unused resources settings.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $unused_resources_settings;
|
||||
|
||||
/**
|
||||
* The shortlinker.
|
||||
*
|
||||
* @var WPSEO_Shortlinker
|
||||
*/
|
||||
private $shortlinker;
|
||||
|
||||
/**
|
||||
* The options' helper.
|
||||
*
|
||||
* @var Options_Helper
|
||||
*/
|
||||
private $options_helper;
|
||||
|
||||
/**
|
||||
* Crawl_Settings_Integration constructor.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Options_Helper $options_helper The options helper.
|
||||
* @param WPSEO_Shortlinker $shortlinker The shortlinker.
|
||||
*/
|
||||
public function __construct( Options_Helper $options_helper, WPSEO_Shortlinker $shortlinker ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Admin\Crawl_Settings_Integration' );
|
||||
|
||||
$this->options_helper = $options_helper;
|
||||
$this->shortlinker = $shortlinker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* In this case: when on an admin page.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Admin\Crawl_Settings_Integration::get_conditionals()' );
|
||||
|
||||
return [ Admin_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an action to add a new tab to the General page.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Admin\Crawl_Settings_Integration::register_hooks()' );
|
||||
|
||||
$this->register_setting_labels();
|
||||
|
||||
\add_action( 'wpseo_settings_tab_crawl_cleanup_network', [ $this, 'add_crawl_settings_tab_content_network' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue the workouts app.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function enqueue_assets() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Admin\Crawl_Settings_Integration::enqueue_assets()' );
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved.
|
||||
if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'wpseo_dashboard' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
\wp_enqueue_script( 'wp-seo-premium-crawl-settings' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds content to the Crawl Cleanup tab.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Yoast_Form $yform The yoast form object.
|
||||
*/
|
||||
public function add_crawl_settings_tab_content( $yform ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4' );
|
||||
|
||||
$this->add_crawl_settings( $yform, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds content to the Crawl Cleanup network tab.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Yoast_Form $yform The yoast form object.
|
||||
*/
|
||||
public function add_crawl_settings_tab_content_network( $yform ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Admin\Crawl_Settings_Integration::add_crawl_settings_tab_content_network( $yform )' );
|
||||
|
||||
$this->add_crawl_settings( $yform, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects the settings to their labels.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function register_setting_labels() {
|
||||
$this->feed_settings = [
|
||||
'remove_feed_global' => \__( 'Global feed', 'wordpress-seo-premium' ),
|
||||
'remove_feed_global_comments' => \__( 'Global comment feeds', 'wordpress-seo-premium' ),
|
||||
'remove_feed_post_comments' => \__( 'Post comments feeds', 'wordpress-seo-premium' ),
|
||||
'remove_feed_authors' => \__( 'Post authors feeds', 'wordpress-seo-premium' ),
|
||||
'remove_feed_post_types' => \__( 'Post type feeds', 'wordpress-seo-premium' ),
|
||||
'remove_feed_categories' => \__( 'Category feeds', 'wordpress-seo-premium' ),
|
||||
'remove_feed_tags' => \__( 'Tag feeds', 'wordpress-seo-premium' ),
|
||||
'remove_feed_custom_taxonomies' => \__( 'Custom taxonomy feeds', 'wordpress-seo-premium' ),
|
||||
'remove_feed_search' => \__( 'Search results feeds', 'wordpress-seo-premium' ),
|
||||
'remove_atom_rdf_feeds' => \__( 'Atom/RDF feeds', 'wordpress-seo-premium' ),
|
||||
];
|
||||
|
||||
$this->basic_settings = [
|
||||
'remove_shortlinks' => \__( 'Shortlinks', 'wordpress-seo-premium' ),
|
||||
'remove_rest_api_links' => \__( 'REST API links', 'wordpress-seo-premium' ),
|
||||
'remove_rsd_wlw_links' => \__( 'RSD / WLW links', 'wordpress-seo-premium' ),
|
||||
'remove_oembed_links' => \__( 'oEmbed links', 'wordpress-seo-premium' ),
|
||||
'remove_generator' => \__( 'Generator tag', 'wordpress-seo-premium' ),
|
||||
'remove_pingback_header' => \__( 'Pingback HTTP header', 'wordpress-seo-premium' ),
|
||||
'remove_powered_by_header' => \__( 'Powered by HTTP header', 'wordpress-seo-premium' ),
|
||||
];
|
||||
|
||||
$this->permalink_cleanup_settings = [
|
||||
'clean_campaign_tracking_urls' => \__( 'Campaign tracking URL parameters', 'wordpress-seo-premium' ),
|
||||
'clean_permalinks' => \__( 'Unregistered URL parameters', 'wordpress-seo-premium' ),
|
||||
];
|
||||
|
||||
$this->search_cleanup_settings = [
|
||||
'search_cleanup' => \__( 'Filter search terms', 'wordpress-seo-premium' ),
|
||||
'search_cleanup_emoji' => \__( 'Filter searches with emojis and other special characters', 'wordpress-seo-premium' ),
|
||||
'search_cleanup_patterns' => \__( 'Filter searches with common spam patterns', 'wordpress-seo-premium' ),
|
||||
'deny_search_crawling' => \__( 'Prevent search engines from crawling site search URLs', 'wordpress-seo-premium' ),
|
||||
'redirect_search_pretty_urls' => \__( 'Redirect pretty URLs for search pages to raw format', 'wordpress-seo-premium' ),
|
||||
];
|
||||
|
||||
$this->unused_resources_settings = [
|
||||
'remove_emoji_scripts' => \__( 'Emoji scripts', 'wordpress-seo-premium' ),
|
||||
'deny_wp_json_crawling' => \__( 'Prevent search engines from crawling /wp-json/', 'wordpress-seo-premium' ),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the settings sections.
|
||||
*
|
||||
* @param Yoast_Form $yform The Yoast form class.
|
||||
* @param bool $is_network Whether we're on the network site.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function add_crawl_settings( $yform, $is_network ) {
|
||||
$this->print_toggles( $this->basic_settings, $yform, $is_network, \__( 'Basic crawl settings', 'wordpress-seo-premium' ), \__( 'Remove links added by WordPress to the header and <head>.', 'wordpress-seo-premium' ) );
|
||||
|
||||
$this->print_toggles( $this->feed_settings, $yform, $is_network, \__( 'Feed crawl settings', 'wordpress-seo-premium' ), \__( "Remove feed links added by WordPress that aren't needed for this site.", 'wordpress-seo-premium' ) );
|
||||
$this->print_toggles( $this->unused_resources_settings, $yform, $is_network, \__( 'Remove unused resources', 'wordpress-seo-premium' ), \__( 'WordPress loads lots of resources, some of which your site might not need. If you’re not using these, removing them can speed up your pages and save resources.', 'wordpress-seo-premium' ) );
|
||||
|
||||
$first_search_setting = \array_slice( $this->search_cleanup_settings, 0, 1 );
|
||||
$rest_search_settings = \array_slice( $this->search_cleanup_settings, 1 );
|
||||
$search_settings_toggles = [
|
||||
'off' => \__( 'Disabled', 'wordpress-seo-premium' ),
|
||||
'on' => \__( 'Enabled', 'wordpress-seo-premium' ),
|
||||
];
|
||||
|
||||
$this->print_toggles( $first_search_setting, $yform, $is_network, \__( 'Search cleanup settings', 'wordpress-seo-premium' ), \__( 'Clean up and filter searches to prevent search spam.', 'wordpress-seo-premium' ), $search_settings_toggles );
|
||||
|
||||
if ( ! $is_network ) {
|
||||
echo '<div id="search_character_limit_container" class="yoast-crawl-single-setting">';
|
||||
$yform->number(
|
||||
'search_character_limit',
|
||||
\__( 'Max number of characters to allow in searches', 'wordpress-seo-premium' ),
|
||||
[
|
||||
'min' => 1,
|
||||
'max' => 1000,
|
||||
]
|
||||
);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
$this->print_toggles( $rest_search_settings, $yform, $is_network, '', '', $search_settings_toggles );
|
||||
|
||||
$permalink_warning = \sprintf(
|
||||
/* Translators: %1$s expands to an opening anchor tag for a link leading to the Yoast SEO page of the Permalink Cleanup features, %2$s expands to a closing anchor tag. */
|
||||
\esc_html__(
|
||||
'These are expert features, so make sure you know what you\'re doing before removing the parameters. %1$sRead more about how your site can be affected%2$s.',
|
||||
'wordpress-seo-premium'
|
||||
),
|
||||
'<a href="' . \esc_url( $this->shortlinker->build_shortlink( 'https://yoa.st/permalink-cleanup' ) ) . '" target="_blank" rel="noopener noreferrer">',
|
||||
'</a>'
|
||||
);
|
||||
|
||||
|
||||
$this->print_toggles( $this->permalink_cleanup_settings, $yform, $is_network, \__( 'Permalink cleanup settings', 'wordpress-seo-premium' ), \__( 'Remove unwanted URL parameters from your URLs.', 'wordpress-seo-premium' ), [], $permalink_warning );
|
||||
|
||||
if ( ! $is_network && ! empty( \get_option( 'permalink_structure' ) ) ) {
|
||||
echo '<div id="clean_permalinks_extra_variables_container" class="yoast-crawl-single-setting">';
|
||||
$yform->textinput( 'clean_permalinks_extra_variables', \__( 'Additional URL parameters to allow', 'wordpress-seo-premium' ) );
|
||||
echo '<p class="desc label yoast-extra-variables-label">';
|
||||
\esc_html_e( 'Please use a comma to separate multiple URL parameters.', 'wordpress-seo-premium' );
|
||||
echo '</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
else {
|
||||
// Also add the original option as hidden, so as not to lose any values if it's disabled and the form is saved.
|
||||
$yform->hidden( 'clean_permalinks_extra_variables', 'clean_permalinks_extra_variables' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a list of toggles for an array of settings with labels.
|
||||
*
|
||||
* @param array $settings The settings being displayed.
|
||||
* @param Yoast_Form $yform The Yoast form class.
|
||||
* @param bool $is_network Whether we're on the network site.
|
||||
* @param string $title Optional title for the settings being displayed.
|
||||
* @param string $description Optional description of the settings being displayed.
|
||||
* @param array $toggles Optional naming of the toggle buttons.
|
||||
* @param string $warning Optional warning to be displayed above the toggles.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function print_toggles( array $settings, Yoast_Form $yform, $is_network = false, $title = '', $description = '', $toggles = [], $warning = '' ) {
|
||||
if ( ! empty( $title ) ) {
|
||||
echo '<h3 class="yoast-crawl-settings">', \esc_html( $title ), '</h3>';
|
||||
}
|
||||
if ( ! $is_network && ! empty( $description ) ) {
|
||||
echo '<p class="yoast-crawl-settings-explanation">', \esc_html( $description ), '</p>';
|
||||
}
|
||||
|
||||
if ( ! empty( $warning ) ) {
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output escaped in Alert_Presenter.
|
||||
echo new Alert_Presenter( $warning, 'warning' );
|
||||
}
|
||||
|
||||
if ( empty( $toggles ) ) {
|
||||
$toggles = [
|
||||
'off' => \__( 'Keep', 'wordpress-seo-premium' ),
|
||||
'on' => \__( 'Remove', 'wordpress-seo-premium' ),
|
||||
];
|
||||
}
|
||||
$setting_prefix = '';
|
||||
|
||||
if ( $is_network ) {
|
||||
$setting_prefix = WPSEO_Option::ALLOW_KEY_PREFIX;
|
||||
$toggles = [
|
||||
// phpcs:ignore WordPress.WP.I18n.TextDomainMismatch -- Reason: text is originally from Yoast SEO.
|
||||
'on' => \__( 'Allow Control', 'wordpress-seo' ),
|
||||
// phpcs:ignore WordPress.WP.I18n.TextDomainMismatch -- Reason: text is originally from Yoast SEO.
|
||||
'off' => \__( 'Disable', 'wordpress-seo' ),
|
||||
];
|
||||
}
|
||||
|
||||
foreach ( $settings as $setting => $label ) {
|
||||
$attr = [];
|
||||
$variable = $setting_prefix . $setting;
|
||||
|
||||
if ( $this->should_feature_be_disabled_permalink( $setting, $is_network ) ) {
|
||||
$attr = [
|
||||
'disabled' => true,
|
||||
];
|
||||
$variable = $setting_prefix . $setting . '_disabled';
|
||||
|
||||
// Also add the original option as hidden, so as not to lose any values if it's disabled and the form is saved.
|
||||
$yform->hidden( $setting_prefix . $setting, $setting_prefix . $setting );
|
||||
}
|
||||
elseif ( $this->should_feature_be_disabled_multisite( $setting ) ) {
|
||||
$attr = [
|
||||
'disabled' => true,
|
||||
'preserve_disabled_value' => false,
|
||||
];
|
||||
}
|
||||
|
||||
$yform->toggle_switch(
|
||||
$variable,
|
||||
$toggles,
|
||||
$label,
|
||||
'',
|
||||
$attr
|
||||
);
|
||||
if ( $setting === 'remove_feed_global_comments' && ! $is_network ) {
|
||||
echo '<p class="yoast-crawl-settings-help">';
|
||||
echo \esc_html__( 'By removing Global comments feed, Post comments feeds will be removed too.', 'wordpress-seo-premium' );
|
||||
echo '</p>';
|
||||
}
|
||||
if ( $this->should_feature_be_disabled_permalink( $setting, $is_network ) ) {
|
||||
echo '<p class="yoast-crawl-settings-help">';
|
||||
if ( \current_user_can( 'manage_options' ) ) {
|
||||
echo \sprintf(
|
||||
/* translators: 1: Link start tag to the Permalinks settings page, 2: Link closing tag. */
|
||||
\esc_html__( 'This feature is disabled when your site is not using %1$spretty permalinks%2$s.', 'wordpress-seo-premium' ),
|
||||
'<a href="' . \esc_url( \admin_url( 'options-permalink.php' ) ) . '">',
|
||||
'</a>'
|
||||
);
|
||||
}
|
||||
else {
|
||||
echo \esc_html__( 'This feature is disabled when your site is not using pretty permalinks.', 'wordpress-seo-premium' );
|
||||
}
|
||||
echo '</p>';
|
||||
}
|
||||
elseif ( $this->should_feature_be_disabled_multisite( $setting ) ) {
|
||||
echo '<p>';
|
||||
\esc_html_e( 'This feature is not available for multisites.', 'wordpress-seo-premium' );
|
||||
echo '</p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the feature should be disabled due to non-pretty permalinks.
|
||||
*
|
||||
* @param string $setting The setting to be displayed.
|
||||
* @param bool $is_network Whether we're on the network site.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function should_feature_be_disabled_permalink( $setting, $is_network ) {
|
||||
return (
|
||||
\in_array( $setting, [ 'clean_permalinks', 'clean_campaign_tracking_urls' ], true )
|
||||
&& ! $is_network
|
||||
&& empty( \get_option( 'permalink_structure' ) )
|
||||
&& ! $this->is_control_disabled( $setting )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the feature should be disabled due to the site being a multisite.
|
||||
*
|
||||
* @param string $setting The setting to be displayed.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function should_feature_be_disabled_multisite( $setting ) {
|
||||
return (
|
||||
\in_array( $setting, [ 'deny_search_crawling', 'deny_wp_json_crawling' ], true )
|
||||
&& \is_multisite()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a given control should be disabled, because of the network admin.
|
||||
*
|
||||
* @param string $variable 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( $variable ) {
|
||||
return ! $this->options_helper->get( 'allow_' . $variable, true );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Admin;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
|
||||
/**
|
||||
* Integrations_Page class
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Integrations_Page implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The options helper.
|
||||
*
|
||||
* @var Options_Helper
|
||||
*/
|
||||
private $options_helper;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return [ Admin_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Workouts_Integration constructor.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Options_Helper $options_helper The options helper.
|
||||
*/
|
||||
public function __construct( Options_Helper $options_helper ) {
|
||||
\deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$this->options_helper = $options_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue the workouts app.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function enqueue_assets() {
|
||||
\deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Integrations\Admin;
|
||||
|
||||
use Yoast\WP\SEO\Actions\Indexing\Indexable_General_Indexation_Action;
|
||||
use Yoast\WP\SEO\Actions\Indexing\Indexable_Post_Indexation_Action;
|
||||
use Yoast\WP\SEO\Actions\Indexing\Indexable_Post_Type_Archive_Indexation_Action;
|
||||
use Yoast\WP\SEO\Actions\Indexing\Indexable_Term_Indexation_Action;
|
||||
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Capability_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
use Yoast\WP\SEO\Premium\Actions\Prominent_Words\Content_Action;
|
||||
use Yoast_Notification_Center;
|
||||
|
||||
/**
|
||||
* Integration for determining and showing the notification
|
||||
* to ask users to calculate prominent words for their site.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @package Yoast\WP\SEO\Integrations\Admin
|
||||
*/
|
||||
class Prominent_Words_Notification implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The ID of the notification.
|
||||
*/
|
||||
const NOTIFICATION_ID = 'wpseo-premium-prominent-words-recalculate';
|
||||
|
||||
/**
|
||||
* How many indexables without prominent words should exist before this notification is shown to the user.
|
||||
*/
|
||||
const UNINDEXED_THRESHOLD = 25;
|
||||
|
||||
/**
|
||||
* Prominent_Words_Notification_Integration constructor.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Yoast_Notification_Center $notification_center The notification center.
|
||||
* @param Content_Action $content_action The content action.
|
||||
* @param Indexable_Post_Indexation_Action $post_indexation The post indexing action.
|
||||
* @param Indexable_Term_Indexation_Action $term_indexation The term indexing action.
|
||||
* @param Indexable_General_Indexation_Action $general_indexation The general indexing action.
|
||||
* @param Indexable_Post_Type_Archive_Indexation_Action $post_type_archive_indexation The post type indexing action.
|
||||
* @param Capability_Helper $capability The capability helper.
|
||||
* @param Options_Helper $options The options helper.
|
||||
*/
|
||||
public function __construct(
|
||||
Yoast_Notification_Center $notification_center,
|
||||
Content_Action $content_action,
|
||||
Indexable_Post_Indexation_Action $post_indexation,
|
||||
Indexable_Term_Indexation_Action $term_indexation,
|
||||
Indexable_General_Indexation_Action $general_indexation,
|
||||
Indexable_Post_Type_Archive_Indexation_Action $post_type_archive_indexation,
|
||||
Capability_Helper $capability,
|
||||
Options_Helper $options
|
||||
) {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration by registering the right hooks and filters.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
return [ Admin_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the option change to make sure the notification will be removed when link suggestions are disabled.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param mixed $old_value The old value.
|
||||
* @param mixed $new_value The new value.
|
||||
*/
|
||||
public function handle_option_change( $old_value, $new_value ) {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages, for each user, if the notification should be shown or removed.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function manage_notification() {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up the notification for all applicable users.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function cleanup_notification() {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Integrations\Admin\Prominent_Words;
|
||||
|
||||
/**
|
||||
* Class Indexation_Integration. Indexing integration for prominent words.
|
||||
*
|
||||
* @deprecated 15.2
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Indexation_Integration extends Indexing_Integration {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Integrations\Admin\Prominent_Words;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\No_Conditionals;
|
||||
use Yoast\WP\SEO\Integrations\Admin\Prominent_Words_Notification;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
|
||||
/**
|
||||
* Integration for the prominent words notification event used in the cron job.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Notification_Event_Integration implements Integration_Interface {
|
||||
|
||||
use No_Conditionals;
|
||||
|
||||
/**
|
||||
* Notification_Event_Integration constructor.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Prominent_Words_Notification $prominent_words_notification The prominent words notification integration.
|
||||
*/
|
||||
public function __construct( Prominent_Words_Notification $prominent_words_notification ) {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration by registering the right hooks and filters.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Admin;
|
||||
|
||||
use WPSEO_Admin_Asset_Manager;
|
||||
use WPSEO_Options;
|
||||
use WPSEO_Shortlinker;
|
||||
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Capability_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
use Yoast\WP\SEO\Premium\Conditionals\Zapier_Enabled_Conditional;
|
||||
use Yoast\WP\SEO\Presenters\Admin\Notice_Presenter;
|
||||
|
||||
/**
|
||||
* Shows a notification telling the user that zapier integration will be removed.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Zapier_Notification_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Holds the name of the user meta key.
|
||||
*
|
||||
* The value of this database field holds whether the user has dismissed this notice or not.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const USER_META_DISMISSED = 'is_dismissed_zapier_notice';
|
||||
|
||||
/**
|
||||
* The capability helper.
|
||||
*
|
||||
* @var Capability_Helper
|
||||
*/
|
||||
private $capability_helper;
|
||||
|
||||
/**
|
||||
* The admin asset manager.
|
||||
*
|
||||
* @var WPSEO_Admin_Asset_Manager
|
||||
*/
|
||||
private $admin_asset_manager;
|
||||
|
||||
/**
|
||||
* The admin asset manager.
|
||||
*
|
||||
* @var Zapier_Enabled_Conditional
|
||||
*/
|
||||
private $zapier_enable_conditional;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return [ Admin_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Zapier_Notification_Integration constructor.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param WPSEO_Admin_Asset_Manager $admin_asset_manager The admin asset manager.
|
||||
* @param Capability_Helper $capability_helper The capability helper.
|
||||
* @param Zapier_Enabled_Conditional $zapier_enable_conditional The capability helper.
|
||||
*/
|
||||
public function __construct(
|
||||
WPSEO_Admin_Asset_Manager $admin_asset_manager,
|
||||
Capability_Helper $capability_helper,
|
||||
Zapier_Enabled_Conditional $zapier_enable_conditional
|
||||
) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$this->admin_asset_manager = $admin_asset_manager;
|
||||
$this->capability_helper = $capability_helper;
|
||||
$this->zapier_enable_conditional = $zapier_enable_conditional;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
\add_action( 'admin_notices', [ $this, 'zapier_notice' ] );
|
||||
\add_action( 'wp_ajax_dismiss_zapier_notice', [ $this, 'dismiss_zapier_notice' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a notice if zapier is enabled and it's not being dismissed before.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function zapier_notice() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( ! $this->capability_helper->current_user_can( 'wpseo_manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $this->is_notice_dismissed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$is_zapier_connected = WPSEO_Options::get( 'zapier_subscription', [] );
|
||||
|
||||
if ( $is_zapier_connected ) {
|
||||
$this->admin_asset_manager->enqueue_style( 'monorepo' );
|
||||
|
||||
/* translators: %1$s for Yoast SEO */
|
||||
$title = \sprintf( \__( 'Zapier integration will be removed from %1$s', 'wordpress-seo-premium' ), 'Yoast SEO' );
|
||||
$content = \sprintf(
|
||||
/* translators: %1$s and %2$s expands to the link to https://yoast.com/features/zapier, %3$s for Yoast SEO, %4$s for support email. */
|
||||
\esc_html__( 'The %1$sZapier integration%2$s (on the Integrations page) will be removed from %3$s in 20.7 (release date May 9th). If you have any questions, please reach out to %4$s.', 'wordpress-seo-premium' ),
|
||||
'<a href="' . WPSEO_Shortlinker::get( 'http://yoa.st/zapier-removal-notification' ) . '" target="_blank">',
|
||||
'</a>',
|
||||
'Yoast SEO',
|
||||
'support@yoast.com'
|
||||
);
|
||||
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- Output of the title escaped in the Notice_Presenter.
|
||||
echo new Notice_Presenter(
|
||||
$title,
|
||||
$content,
|
||||
null,
|
||||
null,
|
||||
true,
|
||||
'yoast-zapier-notice'
|
||||
);
|
||||
// phpcs:enable
|
||||
|
||||
// Enable permanently dismissing the notice.
|
||||
echo '<script>
|
||||
jQuery( document ).ready( function() {
|
||||
jQuery( "body" ).on( "click", "#yoast-zapier-notice .notice-dismiss", function() {
|
||||
const data = { "action": "dismiss_zapier_notice", "nonce": "' . \esc_attr( \wp_create_nonce( 'dismiss_zapier_notice' ) ) . '" };
|
||||
jQuery.post( ajaxurl, data, function( response ) {
|
||||
jQuery( this ).parent( "#yoast-zapier-notice" ).hide();
|
||||
});
|
||||
} );
|
||||
} );
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Was the notice dismissed by the user.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function is_notice_dismissed() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return \get_user_meta( \get_current_user_id(), self::USER_META_DISMISSED, true ) === '1';
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismisses the notice.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function dismiss_zapier_notice() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( ! \check_ajax_referer( 'dismiss_zapier_notice', 'nonce', false ) || ! $this->capability_helper->current_user_can( 'wpseo_manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
\update_user_meta( \get_current_user_id(), self::USER_META_DISMISSED, true );
|
||||
return WPSEO_Options::set( 'is_dismissed_zapier_notice', true );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Integrations\Blocks;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\No_Conditionals;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
use Yoast\WP\SEO\Schema_Templates\Block_Patterns\Block_Pattern;
|
||||
|
||||
/**
|
||||
* Registers the block patterns needed for the Premium Schema blocks.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Block_Patterns implements Integration_Interface {
|
||||
|
||||
use No_Conditionals;
|
||||
|
||||
/**
|
||||
* The block patterns to register.
|
||||
*
|
||||
* @var Block_Pattern[]
|
||||
*/
|
||||
protected $block_patterns = [];
|
||||
|
||||
/**
|
||||
* Block_Patterns integration constructor.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Block_Pattern ...$block_patterns The block patterns to register.
|
||||
*/
|
||||
public function __construct( Block_Pattern ...$block_patterns ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
$this->block_patterns = $block_patterns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the block patterns with WordPress.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_block_patterns() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the block pattern category with WordPress.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_block_pattern_category() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Integrations\Blocks;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\No_Conditionals;
|
||||
use Yoast\WP\SEO\Helpers\Wordpress_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
|
||||
/**
|
||||
* Adds the block categories for the Jobs Posting block.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Job_Posting_Block implements Integration_Interface {
|
||||
|
||||
use No_Conditionals;
|
||||
|
||||
/**
|
||||
* Represents the WordPress helper.
|
||||
*
|
||||
* @var Wordpress_Helper
|
||||
*/
|
||||
protected $wordpress_helper;
|
||||
|
||||
/**
|
||||
* Job_Posting_Block constructor.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Wordpress_Helper $wordpress_helper The WordPress helper.
|
||||
*/
|
||||
public function __construct( Wordpress_Helper $wordpress_helper ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
$this->wordpress_helper = $wordpress_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the hooks.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Yoast block categories.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param array $categories The categories to filter.
|
||||
*
|
||||
* @return array The filtered categories.
|
||||
*/
|
||||
public function add_block_categories( $categories ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
return $categories;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Blocks;
|
||||
|
||||
use WPSEO_Admin_Asset_Manager;
|
||||
use Yoast\WP\SEO\Conditionals\No_Conditionals;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
|
||||
/**
|
||||
* Loads the Premium schema block templates into Gutenberg.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Schema_Blocks implements Integration_Interface {
|
||||
|
||||
use No_Conditionals;
|
||||
|
||||
/**
|
||||
* Schema_Blocks constructor.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param WPSEO_Admin_Asset_Manager $asset_manager The asset manager.
|
||||
*/
|
||||
public function __construct( WPSEO_Admin_Asset_Manager $asset_manager ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects the Premium structured data blocks templates.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param array $templates The templates from Yoast SEO.
|
||||
*
|
||||
* @return array All the templates that should be loaded.
|
||||
*/
|
||||
public function add_premium_templates( $templates ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues the schema blocks css file.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function enqueue_assets() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Front_End;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
|
||||
/**
|
||||
* Class Crawl_Cleanup_Basic.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Crawl_Cleanup_Basic implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The options helper.
|
||||
*
|
||||
* @var Options_Helper
|
||||
*/
|
||||
private $options_helper;
|
||||
|
||||
/**
|
||||
* Crawl Cleanup Basic integration constructor.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Options_Helper $options_helper The option helper.
|
||||
*/
|
||||
public function __construct( Options_Helper $options_helper ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Basic' );
|
||||
|
||||
$this->options_helper = $options_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Basic::register_hooks()' );
|
||||
|
||||
// Remove HTTP headers we don't want.
|
||||
\add_action( 'wp', [ $this, 'clean_headers' ], 0 );
|
||||
|
||||
if ( $this->is_true( 'remove_shortlinks' ) ) {
|
||||
// Remove shortlinks.
|
||||
\remove_action( 'wp_head', 'wp_shortlink_wp_head' );
|
||||
\remove_action( 'template_redirect', 'wp_shortlink_header', 11 );
|
||||
}
|
||||
|
||||
if ( $this->is_true( 'remove_rest_api_links' ) ) {
|
||||
// Remove REST API links.
|
||||
\remove_action( 'wp_head', 'rest_output_link_wp_head' );
|
||||
\remove_action( 'template_redirect', 'rest_output_link_header', 11 );
|
||||
}
|
||||
|
||||
if ( $this->is_true( 'remove_rsd_wlw_links' ) ) {
|
||||
// Remove RSD and WLW Manifest links.
|
||||
\remove_action( 'wp_head', 'rsd_link' );
|
||||
\remove_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' );
|
||||
\remove_action( 'wp_head', 'wlwmanifest_link' );
|
||||
}
|
||||
|
||||
if ( $this->is_true( 'remove_oembed_links' ) ) {
|
||||
// Remove JSON+XML oEmbed links.
|
||||
\remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
|
||||
}
|
||||
|
||||
if ( $this->is_true( 'remove_generator' ) ) {
|
||||
\remove_action( 'wp_head', 'wp_generator' );
|
||||
}
|
||||
|
||||
if ( $this->is_true( 'remove_emoji_scripts' ) ) {
|
||||
// Remove emoji scripts and additional stuff they cause.
|
||||
\remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
|
||||
\remove_action( 'wp_print_styles', 'print_emoji_styles' );
|
||||
\remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
|
||||
\remove_action( 'admin_print_styles', 'print_emoji_styles' );
|
||||
\add_filter( 'wp_resource_hints', [ $this, 'resource_hints_plain_cleanup' ], 1 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array The array of conditionals.
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Basic::get_conditionals()' );
|
||||
|
||||
return [ Front_End_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes X-Pingback and X-Powered-By headers as they're unneeded.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function clean_headers() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Basic::clean_headers()' );
|
||||
|
||||
if ( \headers_sent() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $this->is_true( 'remove_powered_by_header' ) ) {
|
||||
\header_remove( 'X-Powered-By' );
|
||||
}
|
||||
if ( $this->is_true( 'remove_pingback_header' ) ) {
|
||||
\header_remove( 'X-Pingback' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the core s.w.org hint as it's only used for emoji stuff we don't use.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param array $hints The hints we're adding to.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function resource_hints_plain_cleanup( $hints ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Basic::resource_hints_plain_cleanup( $hints )' );
|
||||
|
||||
foreach ( $hints as $key => $hint ) {
|
||||
if ( \strpos( $hint, '//s.w.org' ) !== false ) {
|
||||
unset( $hints[ $key ] );
|
||||
}
|
||||
}
|
||||
|
||||
return $hints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the value of an option is set to true.
|
||||
*
|
||||
* @param string $option_name The option name.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function is_true( $option_name ) {
|
||||
return $this->options_helper->get( $option_name ) === true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Front_End;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
|
||||
/**
|
||||
* Adds actions that cleanup unwanted rss feed links.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Crawl_Cleanup_Rss implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The options helper.
|
||||
*
|
||||
* @var Options_Helper
|
||||
*/
|
||||
private $options_helper;
|
||||
|
||||
/**
|
||||
* Crawl Cleanup RSS integration constructor.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Options_Helper $options_helper The option helper.
|
||||
*/
|
||||
public function __construct( Options_Helper $options_helper ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Rss' );
|
||||
|
||||
$this->options_helper = $options_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based on which this loadable should be active.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array The conditionals.
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Rss::get_conditionals()' );
|
||||
|
||||
return [ Front_End_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Register our RSS related hooks.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Rss::register_hooks()' );
|
||||
|
||||
if ( $this->is_true( 'remove_feed_global' ) ) {
|
||||
\add_action( 'feed_links_show_posts_feed', '__return_false' );
|
||||
}
|
||||
|
||||
if ( $this->is_true( 'remove_feed_global_comments' ) ) {
|
||||
\add_action( 'feed_links_show_comments_feed', '__return_false' );
|
||||
}
|
||||
|
||||
\add_action( 'wp', [ $this, 'maybe_disable_feeds' ] );
|
||||
\add_action( 'wp', [ $this, 'maybe_redirect_feeds' ], -10000 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable feeds on selected cases.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function maybe_disable_feeds() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Rss::maybe_disable_feeds()' );
|
||||
|
||||
if ( \is_singular() && $this->is_true( 'remove_feed_post_comments' )
|
||||
|| ( \is_author() && $this->is_true( 'remove_feed_authors' ) )
|
||||
|| ( \is_category() && $this->is_true( 'remove_feed_categories' ) )
|
||||
|| ( \is_tag() && $this->is_true( 'remove_feed_tags' ) )
|
||||
|| ( \is_tax() && $this->is_true( 'remove_feed_custom_taxonomies' ) )
|
||||
|| ( \is_post_type_archive() && $this->is_true( 'remove_feed_post_types' ) )
|
||||
|| ( \is_search() && $this->is_true( 'remove_feed_search' ) ) ) {
|
||||
\remove_action( 'wp_head', 'feed_links_extra', 3 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect feeds we don't want away.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function maybe_redirect_feeds() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Rss::maybe_redirect_feeds()' );
|
||||
|
||||
global $wp_query;
|
||||
|
||||
if ( ! \is_feed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( \in_array( \get_query_var( 'feed' ), [ 'atom', 'rdf' ], true ) && $this->is_true( 'remove_atom_rdf_feeds' ) ) {
|
||||
$this->redirect_feed( \home_url(), 'We disable Atom/RDF feeds for performance reasons.' );
|
||||
}
|
||||
|
||||
// Only if we're on the global feed, the query is _just_ `'feed' => 'feed'`, hence this check.
|
||||
if ( ( $wp_query->query === [ 'feed' => 'feed' ]
|
||||
|| $wp_query->query === [ 'feed' => 'atom' ]
|
||||
|| $wp_query->query === [ 'feed' => 'rdf' ] )
|
||||
&& $this->is_true( 'remove_feed_global' ) ) {
|
||||
$this->redirect_feed( \home_url(), 'We disable the RSS feed for performance reasons.' );
|
||||
}
|
||||
|
||||
if ( \is_comment_feed() && ! ( \is_singular() || \is_attachment() ) && $this->is_true( 'remove_feed_global_comments' ) ) {
|
||||
$this->redirect_feed( \home_url(), 'We disable comment feeds for performance reasons.' );
|
||||
}
|
||||
elseif ( \is_comment_feed()
|
||||
&& \is_singular()
|
||||
&& ( $this->is_true( 'remove_feed_post_comments' ) || $this->is_true( 'remove_feed_global_comments' ) ) ) {
|
||||
$url = \get_permalink( \get_queried_object() );
|
||||
$this->redirect_feed( $url, 'We disable post comment feeds for performance reasons.' );
|
||||
}
|
||||
|
||||
if ( \is_author() && $this->is_true( 'remove_feed_authors' ) ) {
|
||||
$author_id = (int) \get_query_var( 'author' );
|
||||
$url = \get_author_posts_url( $author_id );
|
||||
$this->redirect_feed( $url, 'We disable author feeds for performance reasons.' );
|
||||
}
|
||||
|
||||
if ( ( \is_category() && $this->is_true( 'remove_feed_categories' ) )
|
||||
|| ( \is_tag() && $this->is_true( 'remove_feed_tags' ) )
|
||||
|| ( \is_tax() && $this->is_true( 'remove_feed_custom_taxonomies' ) ) ) {
|
||||
$term = \get_queried_object();
|
||||
$url = \get_term_link( $term, $term->taxonomy );
|
||||
if ( \is_wp_error( $url ) ) {
|
||||
$url = \home_url();
|
||||
}
|
||||
$this->redirect_feed( $url, 'We disable taxonomy feeds for performance reasons.' );
|
||||
}
|
||||
|
||||
if ( ( \is_post_type_archive() ) && $this->is_true( 'remove_feed_post_types' ) ) {
|
||||
$url = \get_post_type_archive_link( $this->get_queried_post_type() );
|
||||
$this->redirect_feed( $url, 'We disable post type feeds for performance reasons.' );
|
||||
}
|
||||
|
||||
if ( \is_search() && $this->is_true( 'remove_feed_search' ) ) {
|
||||
$url = \trailingslashit( \home_url() ) . '?s=' . \get_search_query();
|
||||
$this->redirect_feed( $url, 'We disable search RSS feeds for performance reasons.' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a cache control header.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param int $expiration The expiration time.
|
||||
*/
|
||||
public function cache_control_header( $expiration ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Rss::cache_control_header( $expiration )' );
|
||||
|
||||
\header_remove( 'Expires' );
|
||||
|
||||
// The cacheability of the current request. 'public' allows caching, 'private' would not allow caching by proxies like CloudFlare.
|
||||
$cacheability = 'public';
|
||||
$format = '%1$s, max-age=%2$d, s-maxage=%2$d, stale-while-revalidate=120, stale-if-error=14400';
|
||||
|
||||
if ( \is_user_logged_in() ) {
|
||||
$expiration = 0;
|
||||
$cacheability = 'private';
|
||||
$format = '%1$s, max-age=%2$d';
|
||||
}
|
||||
|
||||
\header( \sprintf( 'Cache-Control: ' . $format, $cacheability, $expiration ), true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect a feed result to somewhere else.
|
||||
*
|
||||
* @param string $url The location we're redirecting to.
|
||||
* @param string $reason The reason we're redirecting.
|
||||
*/
|
||||
private function redirect_feed( $url, $reason ) {
|
||||
\header_remove( 'Content-Type' );
|
||||
\header_remove( 'Last-Modified' );
|
||||
|
||||
$this->cache_control_header( 7 * \DAY_IN_SECONDS );
|
||||
|
||||
\wp_safe_redirect( $url, 301, 'Yoast SEO: ' . $reason );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the queried post type.
|
||||
*
|
||||
* @return string The queried post type.
|
||||
*/
|
||||
private function get_queried_post_type() {
|
||||
$post_type = \get_query_var( 'post_type' );
|
||||
if ( \is_array( $post_type ) ) {
|
||||
$post_type = \reset( $post_type );
|
||||
}
|
||||
return $post_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the value of an option is set to true.
|
||||
*
|
||||
* @param string $option_name The option name.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function is_true( $option_name ) {
|
||||
return $this->options_helper->get( $option_name ) === true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Front_End;
|
||||
|
||||
use WP_Query;
|
||||
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Redirect_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
|
||||
/**
|
||||
* Class Crawl_Cleanup_Searches.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Crawl_Cleanup_Searches implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Patterns to match against to find spam.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $patterns = [
|
||||
'/[:()【】[]]+/u',
|
||||
'/(TALK|QQ)\:/iu',
|
||||
];
|
||||
|
||||
/**
|
||||
* The options helper.
|
||||
*
|
||||
* @var Options_Helper
|
||||
*/
|
||||
private $options_helper;
|
||||
|
||||
/**
|
||||
* The redirect helper.
|
||||
*
|
||||
* @var Redirect_Helper
|
||||
*/
|
||||
private $redirect_helper;
|
||||
|
||||
/**
|
||||
* Crawl_Cleanup_Searches integration constructor.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Options_Helper $options_helper The option helper.
|
||||
* @param Redirect_Helper $redirect_helper The redirect helper.
|
||||
*/
|
||||
public function __construct( Options_Helper $options_helper, Redirect_Helper $redirect_helper ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Searches' );
|
||||
|
||||
$this->options_helper = $options_helper;
|
||||
$this->redirect_helper = $redirect_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Searches::register_hooks()' );
|
||||
|
||||
if ( $this->options_helper->get( 'search_cleanup' ) ) {
|
||||
\add_filter( 'pre_get_posts', [ $this, 'validate_search' ] );
|
||||
}
|
||||
if ( $this->options_helper->get( 'redirect_search_pretty_urls' ) && ! empty( \get_option( 'permalink_structure' ) ) ) {
|
||||
\add_action( 'template_redirect', [ $this, 'maybe_redirect_searches' ], 2 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array The array of conditionals.
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Searches::get_conditionals()' );
|
||||
|
||||
return [ Front_End_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we want to allow this search to happen.
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param WP_Query $query The main query.
|
||||
*
|
||||
* @return WP_Query
|
||||
*/
|
||||
public function validate_search( WP_Query $query ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Searches::validate_search( WP_Query $query )' );
|
||||
|
||||
if ( ! $query->is_search() ) {
|
||||
return $query;
|
||||
}
|
||||
// First check against emoji and patterns we might not want.
|
||||
$this->check_unwanted_patterns( $query );
|
||||
|
||||
// Then limit characters if still needed.
|
||||
$this->limit_characters();
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect pretty search URLs to the "raw" equivalent
|
||||
*
|
||||
* @deprecated 20.4
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function maybe_redirect_searches() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.4', 'Yoast\WP\SEO\Integrations\Front_End\Crawl_Cleanup_Searches::maybe_redirect_searches()' );
|
||||
|
||||
if ( ! \is_search() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput
|
||||
if ( isset( $_SERVER['REQUEST_URI'] ) && \stripos( $_SERVER['REQUEST_URI'], '/search/' ) === 0 ) {
|
||||
$args = [];
|
||||
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput
|
||||
$parsed = \wp_parse_url( $_SERVER['REQUEST_URI'] );
|
||||
|
||||
if ( ! empty( $parsed['query'] ) ) {
|
||||
\wp_parse_str( $parsed['query'], $args );
|
||||
}
|
||||
|
||||
$args['s'] = \get_search_query();
|
||||
|
||||
$proper_url = \home_url( '/' );
|
||||
|
||||
if ( \intval( \get_query_var( 'paged' ) ) > 1 ) {
|
||||
$proper_url .= \sprintf( 'page/%s/', \get_query_var( 'paged' ) );
|
||||
unset( $args['paged'] );
|
||||
}
|
||||
|
||||
$proper_url = \add_query_arg( \array_map( 'rawurlencode_deep', $args ), $proper_url );
|
||||
|
||||
if ( ! empty( $parsed['fragment'] ) ) {
|
||||
$proper_url .= '#' . \rawurlencode( $parsed['fragment'] );
|
||||
}
|
||||
|
||||
$this->redirect_away( 'We redirect pretty URLs to the raw format.', $proper_url );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check query against unwanted search patterns.
|
||||
*
|
||||
* @param WP_Query $query The main WordPress query.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function check_unwanted_patterns( WP_Query $query ) {
|
||||
$s = \rawurldecode( $query->query_vars['s'] );
|
||||
if ( $this->options_helper->get( 'search_cleanup_emoji' ) && $this->has_emoji( $s ) ) {
|
||||
$this->redirect_away( 'We don\'t allow searches with emojis and other special characters.' );
|
||||
}
|
||||
|
||||
if ( ! $this->options_helper->get( 'search_cleanup_patterns' ) ) {
|
||||
return;
|
||||
}
|
||||
foreach ( $this->patterns as $pattern ) {
|
||||
$outcome = \preg_match( $pattern, $s, $matches );
|
||||
if ( $outcome && $matches !== [] ) {
|
||||
$this->redirect_away( 'Your search matched a common spam pattern.' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to the homepage for invalid searches.
|
||||
*
|
||||
* @param string $reason The reason for redirecting away.
|
||||
* @param string $to_url The URL to redirect to.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function redirect_away( $reason, $to_url = '' ) {
|
||||
if ( empty( $to_url ) ) {
|
||||
$to_url = \get_home_url();
|
||||
}
|
||||
|
||||
$this->redirect_helper->do_safe_redirect( $to_url, 301, 'Yoast Search Filtering: ' . $reason );
|
||||
}
|
||||
|
||||
/**
|
||||
* Limits the number of characters in the search query.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function limit_characters() {
|
||||
// We retrieve the search term unescaped because we want to count the characters properly. We make sure to escape it afterwards, if we do something with it.
|
||||
$unescaped_s = \get_search_query( false );
|
||||
|
||||
// We then unslash the search term, again because we want to count the characters properly. We make sure to slash it afterwards, if we do something with it.
|
||||
$raw_s = \wp_unslash( $unescaped_s );
|
||||
if ( \mb_strlen( $raw_s, 'UTF-8' ) > $this->options_helper->get( 'search_character_limit' ) ) {
|
||||
$new_s = \mb_substr( $raw_s, 0, $this->options_helper->get( 'search_character_limit' ), 'UTF-8' );
|
||||
\set_query_var( 's', \wp_slash( \esc_attr( $new_s ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a text string contains an emoji or not.
|
||||
*
|
||||
* @param string $text The text string to detect emoji in.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function has_emoji( $text ) {
|
||||
$emojis_regex = '/([^-\p{L}\x00-\x7F]+)/u';
|
||||
\preg_match( $emojis_regex, $text, $matches );
|
||||
|
||||
return ! empty( $matches );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Third_Party;
|
||||
|
||||
use WP_Post;
|
||||
use WPSEO_Admin_Utils;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
use Yoast\WP\SEO\Premium\Conditionals\Zapier_Enabled_Conditional;
|
||||
use Yoast\WP\SEO\Premium\Helpers\Zapier_Helper;
|
||||
|
||||
/**
|
||||
* Class to manage the Zapier integration in the Classic editor.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Zapier_Classic_Editor implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The Zapier helper.
|
||||
*
|
||||
* @var Zapier_Helper
|
||||
*/
|
||||
protected $zapier_helper;
|
||||
|
||||
/**
|
||||
* Zapier constructor.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Zapier_Helper $zapier_helper The Zapier helper.
|
||||
*/
|
||||
public function __construct( Zapier_Helper $zapier_helper ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$this->zapier_helper = $zapier_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return [ Zapier_Enabled_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
\add_action( 'wpseo_publishbox_misc_actions', [ $this, 'add_publishbox_text' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the Zapier text to the Classic Editor publish box.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param WP_Post $post The current post object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add_publishbox_text( $post ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( ! \is_a( $post, 'WP_Post' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! $this->zapier_helper->is_post_type_supported( $post->post_type ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="misc-pub-section yoast yoast-seo-score yoast-zapier-text">
|
||||
<span class="yoast-logo svg"></span>
|
||||
<span>
|
||||
<?php
|
||||
if ( $this->zapier_helper->is_connected() ) {
|
||||
\printf(
|
||||
/* translators: 1: Zapier, 2: Link start tag, 3: Zapier, 4: Link closing tag. */
|
||||
\esc_html__( 'You’re successfully connected to %1$s. Publishing a post will trigger automated actions based on your Zap’s configuration. %2$sManage your Zap in %3$s%4$s.', 'wordpress-seo-premium' ),
|
||||
'Zapier',
|
||||
'<a href="' . \esc_url( 'https://zapier.com/app/zaps' ) . '" target="_blank">',
|
||||
'Zapier',
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- The content is already escaped.
|
||||
WPSEO_Admin_Utils::get_new_tab_message() . '</a>'
|
||||
);
|
||||
}
|
||||
else {
|
||||
\printf(
|
||||
/* translators: 1: Link start tag, 2: Yoast SEO, 3: Zapier, 4: Link closing tag. */
|
||||
\esc_html__( '%1$sConnect %2$s with %3$s%4$s to instantly share your published posts with 2000+ destinations such as Twitter, Facebook and more.', 'wordpress-seo-premium' ),
|
||||
'<a href="' . \esc_url( \admin_url( 'admin.php?page=wpseo_integrations' ) ) . '" target="_blank">',
|
||||
'Yoast SEO',
|
||||
'Zapier',
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- The content is already escaped.
|
||||
WPSEO_Admin_Utils::get_new_tab_message() . '</a>'
|
||||
);
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Third_Party;
|
||||
|
||||
use WP_Error;
|
||||
use Yoast\WP\SEO\Helpers\Meta_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
use Yoast\WP\SEO\Models\Indexable;
|
||||
use Yoast\WP\SEO\Premium\Conditionals\Zapier_Enabled_Conditional;
|
||||
use Yoast\WP\SEO\Premium\Helpers\Zapier_Helper;
|
||||
|
||||
/**
|
||||
* Class to manage the triggering of the Zapier integration.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Zapier_Trigger implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The meta helper.
|
||||
*
|
||||
* @var Meta_Helper
|
||||
*/
|
||||
protected $meta_helper;
|
||||
|
||||
/**
|
||||
* The Zapier helper.
|
||||
*
|
||||
* @var Zapier_Helper
|
||||
*/
|
||||
protected $zapier_helper;
|
||||
|
||||
/**
|
||||
* Zapier constructor.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Meta_Helper $meta_helper The meta helper.
|
||||
* @param Zapier_Helper $zapier_helper The Zapier helper.
|
||||
*/
|
||||
public function __construct( Meta_Helper $meta_helper, Zapier_Helper $zapier_helper ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$this->meta_helper = $meta_helper;
|
||||
$this->zapier_helper = $zapier_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return [ Zapier_Enabled_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
\add_action( 'wpseo_save_indexable', [ $this, 'maybe_call_zapier' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Decides if Zapier should be triggered.
|
||||
*
|
||||
* Zapier should be triggered only if:
|
||||
* - we have a connection established
|
||||
* - the item is a post (in the Indexable sense, as opposed to taxonomies etc.)
|
||||
* - the item status is 'publish'
|
||||
* - we are not serving a REST request (to avoid triggering on the first request by the block editor)
|
||||
* - if the item hasn't been sent before
|
||||
* - if the post_date is recent (so we are not just updating a post published before enabling Zapier)
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Indexable $indexable The indexable.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_call_zapier( Indexable $indexable ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( ! $this->zapier_helper->is_connected()
|
||||
|| $indexable->object_type !== 'post'
|
||||
|| $indexable->post_status !== 'publish'
|
||||
|| \defined( 'REST_REQUEST' ) && \REST_REQUEST
|
||||
|| $this->meta_helper->get_value( 'zapier_trigger_sent', $indexable->object_id ) === '1' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// All dates are GMT to prevent failing checks due to timezone differences.
|
||||
$post = \get_post( $indexable->object_id );
|
||||
$published_datetime_gmt = \strtotime( $post->post_date_gmt . ' +0000' );
|
||||
$half_an_hour_ago_datetime_gmt = ( \time() - ( \MINUTE_IN_SECONDS * 30 ) );
|
||||
if ( ! $this->zapier_helper->is_post_type_supported( $post->post_type )
|
||||
|| $published_datetime_gmt < $half_an_hour_ago_datetime_gmt ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->call_zapier( $indexable );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a request to the Zapier trigger hook.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Indexable $indexable The indexable.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function call_zapier( Indexable $indexable ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$trigger_url = $this->zapier_helper->get_trigger_url();
|
||||
$zapier_data = $this->zapier_helper->get_data_for_zapier( $indexable );
|
||||
|
||||
$response = \wp_remote_post(
|
||||
$trigger_url,
|
||||
[
|
||||
'body' => $zapier_data,
|
||||
]
|
||||
);
|
||||
|
||||
if ( ! $response instanceof WP_Error ) {
|
||||
// Need to cast the new value to a string as booleans aren't supported.
|
||||
$this->meta_helper->set_value( 'zapier_trigger_sent', '1', $indexable->object_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
246
wp/wp-content/plugins/wordpress-seo-premium/src/deprecated/integrations/third-party/zapier.php
vendored
Normal file
246
wp/wp-content/plugins/wordpress-seo-premium/src/deprecated/integrations/third-party/zapier.php
vendored
Normal file
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Third_Party;
|
||||
|
||||
use WPSEO_Admin_Asset_Manager;
|
||||
use WPSEO_Admin_Utils;
|
||||
use Yoast\WP\SEO\Conditionals\Yoast_Admin_And_Dashboard_Conditional;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
use Yoast\WP\SEO\Premium\Helpers\Zapier_Helper;
|
||||
use Yoast\WP\SEO\Presenters\Admin\Alert_Presenter;
|
||||
use Yoast_Feature_Toggle;
|
||||
|
||||
/**
|
||||
* Zapier integration class for managing the toggle and the connection setup.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Zapier implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The Zapier dashboard URL.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const ZAPIER_DASHBOARD_URL = 'https://zapier.com/app/zaps';
|
||||
|
||||
/**
|
||||
* Represents the admin asset manager.
|
||||
*
|
||||
* @var WPSEO_Admin_Asset_Manager
|
||||
*/
|
||||
protected $asset_manager;
|
||||
|
||||
/**
|
||||
* The Zapier helper.
|
||||
*
|
||||
* @var Zapier_Helper
|
||||
*/
|
||||
protected $zapier_helper;
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return [ Yoast_Admin_And_Dashboard_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Zapier constructor.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param WPSEO_Admin_Asset_Manager $asset_manager The admin asset manager.
|
||||
* @param Zapier_Helper $zapier_helper The Zapier helper.
|
||||
*/
|
||||
public function __construct( WPSEO_Admin_Asset_Manager $asset_manager, Zapier_Helper $zapier_helper ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$this->asset_manager = $asset_manager;
|
||||
$this->zapier_helper = $zapier_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
// Add the Zapier toggle to the Integrations tab in the admin.
|
||||
\add_action( 'Yoast\WP\SEO\admin_integration_after', [ $this, 'toggle_after' ] );
|
||||
\add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
|
||||
\add_filter( 'wpseo_premium_integrations_page_data', [ $this, 'enhance_integrations_page_data' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues the required assets.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue_assets() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved.
|
||||
if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'wpseo_integrations' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->asset_manager->enqueue_style( 'monorepo' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns additional content to be displayed after the Zapier toggle.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Yoast_Feature_Toggle $integration The integration feature we've shown the toggle for.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function toggle_after( $integration ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( $integration->setting !== 'zapier_integration_active' ) {
|
||||
return;
|
||||
}
|
||||
if ( $this->zapier_helper->is_connected() ) {
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is already escaped in function.
|
||||
echo $this->get_connected_content();
|
||||
return;
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is already escaped in function.
|
||||
echo $this->get_not_connected_content();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns additional content to be displayed when Zapier is connected.
|
||||
*
|
||||
* @return string The additional content.
|
||||
*/
|
||||
private function get_connected_content() {
|
||||
$alert = new Alert_Presenter(
|
||||
\sprintf(
|
||||
/* translators: 1: Yoast SEO, 2: Zapier. */
|
||||
\esc_html__( '%1$s is successfully connected to %2$s!', 'wordpress-seo-premium' ),
|
||||
'Yoast SEO',
|
||||
'Zapier'
|
||||
),
|
||||
'success'
|
||||
);
|
||||
|
||||
$output = '<div id="zapier-connection">';
|
||||
$output .= $alert->present();
|
||||
$output .= '<p><a href="' . self::ZAPIER_DASHBOARD_URL . '" class="yoast-button yoast-button--primary" type="button" target="_blank">' . \sprintf(
|
||||
/* translators: %s: Zapier. */
|
||||
\esc_html__( 'Go to your %s Dashboard', 'wordpress-seo-premium' ),
|
||||
'Zapier'
|
||||
) . WPSEO_Admin_Utils::get_new_tab_message() . '</a></p>';
|
||||
$output .= '<p>' . \sprintf(
|
||||
/* translators: 1: Zapier, 2: The Zapier API Key. */
|
||||
\esc_html__( '%1$s uses this API Key: %2$s', 'wordpress-seo-premium' ),
|
||||
'Zapier',
|
||||
'<strong>' . $this->zapier_helper->get_or_generate_zapier_api_key() . '</strong>'
|
||||
) . '</p>';
|
||||
$output .= '<p><button name="zapier_api_key_reset" value="1" type="submit" class="yoast-button yoast-button--secondary">' . \esc_html__( 'Reset API Key', 'wordpress-seo-premium' ) . '</button></p>';
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns additional content to be displayed when Zapier is not connected.
|
||||
*
|
||||
* @return string The additional content.
|
||||
*/
|
||||
private function get_not_connected_content() {
|
||||
$content = \sprintf(
|
||||
/* translators: 1: Yoast SEO, 2: Zapier, 3: Emphasis open tag, 4: Emphasis close tag. */
|
||||
\esc_html__( '%1$s is not connected to %2$s. To set up a connection, make sure you click %3$sSave changes%4$s first, then copy the given API key below and use it to %3$screate%4$s and %3$sturn on%4$s a Zap within your %2$s account.', 'wordpress-seo-premium' ),
|
||||
'Yoast SEO',
|
||||
'Zapier',
|
||||
'<em>',
|
||||
'</em>'
|
||||
);
|
||||
|
||||
$content .= '<br/><br/>';
|
||||
$content .= ' ' . \sprintf(
|
||||
/* translators: 1: Yoast SEO. */
|
||||
\esc_html__( 'Please note that you can only create 1 Zap with a trigger event from %1$s. Within this Zap you can choose one or more actions.', 'wordpress-seo-premium' ),
|
||||
'Yoast SEO'
|
||||
);
|
||||
|
||||
$alert = new Alert_Presenter(
|
||||
$content,
|
||||
'info'
|
||||
);
|
||||
|
||||
$output = '<div id="zapier-connection">';
|
||||
$output .= $alert->present();
|
||||
$output .= '<div class="yoast-field-group">';
|
||||
$output .= '<div class="yoast-field-group__title yoast-field-group__title--light">';
|
||||
$output .= '<label for="zapier-api-key">' . \sprintf(
|
||||
/* translators: %s: Zapier. */
|
||||
\esc_html__( '%s will ask for an API key. Use this one:', 'wordpress-seo-premium' ),
|
||||
'Zapier'
|
||||
) . '</label>';
|
||||
$output .= '</div>';
|
||||
$output .= '<div class="yoast-field-group__inline">';
|
||||
$output .= '<input class="yoast-field-group__inputfield" readonly type="text" id="zapier-api-key" name="wpseo[zapier_api_key]" value="' . $this->zapier_helper->get_or_generate_zapier_api_key() . '">';
|
||||
$output .= '<button type="button" class="yoast-button yoast-button--secondary" id="copy-zapier-api-key" data-clipboard-target="#zapier-api-key">' . \esc_html__( 'Copy to clipboard', 'wordpress-seo-premium' ) . '</button><br />';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
$output .= '<p><a href="' . self::ZAPIER_DASHBOARD_URL . '" class="yoast-button yoast-button--primary" type="button" target="_blank">' . \sprintf(
|
||||
/* translators: %s: Zapier. */
|
||||
\esc_html__( 'Create a Zap in %s', 'wordpress-seo-premium' ),
|
||||
'Zapier'
|
||||
) . WPSEO_Admin_Utils::get_new_tab_message() . '</a></p>';
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enhances the array for the integrations page script with additional data.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param array $data The array to add data to.
|
||||
*
|
||||
* @return array The enhances data.
|
||||
*/
|
||||
public function enhance_integrations_page_data( $data ) {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO Premium 20.7' );
|
||||
|
||||
if ( ! \is_array( $data ) ) {
|
||||
$data = [ $data ];
|
||||
}
|
||||
|
||||
$data['zapierKey'] = $this->zapier_helper->get_or_generate_zapier_api_key();
|
||||
$data['zapierUrl'] = self::ZAPIER_DASHBOARD_URL;
|
||||
$data['zapierIsConnected'] = $this->zapier_helper->is_connected();
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Watchers;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\No_Conditionals;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
|
||||
/**
|
||||
* Watcher for the wpseo option on Premium.
|
||||
*
|
||||
* Represents the option wpseo watcher for Premium.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Premium_Option_Wpseo_Watcher implements Integration_Interface {
|
||||
|
||||
use No_Conditionals;
|
||||
|
||||
/**
|
||||
* The options helper.
|
||||
*
|
||||
* @var Options_Helper
|
||||
*/
|
||||
private $options;
|
||||
|
||||
/**
|
||||
* Watcher constructor.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Options_Helper $options The options helper.
|
||||
*/
|
||||
public function __construct( Options_Helper $options ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
\add_action( 'update_option_wpseo', [ $this, 'check_zapier_option_disabled' ], 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the Zapier integration is disabled; if so, deletes the data.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param array $old_value The old value of the option.
|
||||
* @param array $new_value The new value of the option.
|
||||
*
|
||||
* @return bool Whether the Zapier data has been deleted or not.
|
||||
*/
|
||||
public function check_zapier_option_disabled( $old_value, $new_value ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
if ( \array_key_exists( 'zapier_integration_active', $new_value )
|
||||
&& $old_value['zapier_integration_active'] === true
|
||||
&& $new_value['zapier_integration_active'] === false ) {
|
||||
$this->options->set( 'zapier_subscription', [] );
|
||||
$this->options->set( 'zapier_api_key', '' );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Integrations\Watchers;
|
||||
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
use Yoast\WP\SEO\Premium\Conditionals\Zapier_Enabled_Conditional;
|
||||
|
||||
/**
|
||||
* Watcher for resetting the Zapier API key.
|
||||
*
|
||||
* Represents the Zapier API key reset watcher for Premium.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
|
||||
*/
|
||||
class Zapier_APIKey_Reset_Watcher implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The options helper.
|
||||
*
|
||||
* @var Options_Helper
|
||||
*/
|
||||
private $options;
|
||||
|
||||
/**
|
||||
* Watcher constructor.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Options_Helper $options The options helper.
|
||||
*/
|
||||
public function __construct( Options_Helper $options ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
|
||||
return [ Zapier_Enabled_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the Zapier API key must be reset; if so, deletes the data.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return bool Whether the Zapier data has been deleted or not.
|
||||
*/
|
||||
public function zapier_api_key_reset() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- The nonce is already validated.
|
||||
if ( \current_user_can( 'manage_options' ) && isset( $_POST['zapier_api_key_reset'] ) && $_POST['zapier_api_key_reset'] === '1' ) {
|
||||
$this->options->set( 'zapier_api_key', '' );
|
||||
$this->options->set( 'zapier_subscription', [] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Presenters\Admin\Prominent_Words;
|
||||
|
||||
use Yoast\WP\SEO\Presenters\Abstract_Presenter;
|
||||
|
||||
/**
|
||||
* Represents the list item presenter for the prominent words indexing.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @package Yoast\WP\SEO\Presentations\Admin
|
||||
*/
|
||||
class Indexation_List_Item_Presenter extends Abstract_Presenter {
|
||||
|
||||
/**
|
||||
* Prominent_Words_Indexation_List_Item_Presenter constructor.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param int $total_unindexed The number of objects that need to be indexed.
|
||||
*/
|
||||
public function __construct( $total_unindexed ) {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the output as string.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The output.
|
||||
*/
|
||||
public function present() {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Presenters\Admin\Prominent_Words;
|
||||
|
||||
use Yoast\WP\SEO\Presenters\Abstract_Presenter;
|
||||
|
||||
/**
|
||||
* Class Indexation_Modal_Presenter.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Indexation_Modal_Presenter extends Abstract_Presenter {
|
||||
|
||||
/**
|
||||
* Indexation_Modal constructor.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param int $total_unindexed The number of objects that need to be indexed.
|
||||
*/
|
||||
public function __construct( $total_unindexed ) {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Presents the modal.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The modal HTML.
|
||||
*/
|
||||
public function present() {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Presenters;
|
||||
|
||||
/**
|
||||
* Class Prominent_Words_Notification_Presenter
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @package Yoast\WP\SEO\Presenters
|
||||
*/
|
||||
class Prominent_Words_Notification extends Abstract_Presenter {
|
||||
|
||||
/**
|
||||
* Presents the notification.
|
||||
*
|
||||
* @deprecated 15.1
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The notification.
|
||||
*/
|
||||
public function present() {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO 15.1' );
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO Premium plugin file.
|
||||
*
|
||||
* @package WPSEO\Premium\Classes
|
||||
*/
|
||||
|
||||
use Yoast\WP\SEO\Initializers\Redirect_Handler;
|
||||
|
||||
/**
|
||||
* WPSEO_Redirect_Handler class
|
||||
*
|
||||
* @deprecated 16.0
|
||||
*/
|
||||
class WPSEO_Redirect_Handler extends Redirect_Handler {
|
||||
|
||||
/**
|
||||
* Constructor to throw deprecation notice.
|
||||
*
|
||||
* @deprecated 16.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function __construct() {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO Premium 16.0', \esc_html( Redirect_Handler::class ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the redirect handler.
|
||||
*
|
||||
* @deprecated 16.0
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function load() {
|
||||
\_deprecated_function( __METHOD__, 'WPSEO Premium 16.0', \esc_html( Redirect_Handler::class . '::initialize' ) );
|
||||
$this->initialize();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Premium\Routes;
|
||||
|
||||
use WP_REST_Request;
|
||||
use WP_REST_Response;
|
||||
use Yoast\WP\SEO\Main;
|
||||
use Yoast\WP\SEO\Premium\Actions\Zapier_Action;
|
||||
use Yoast\WP\SEO\Premium\Conditionals\Zapier_Enabled_Conditional;
|
||||
use Yoast\WP\SEO\Routes\Route_Interface;
|
||||
|
||||
/**
|
||||
* Registers the route for the Zapier integration.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Zapier_Route implements Route_Interface {
|
||||
|
||||
/**
|
||||
* The Zapier route prefix.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const ROUTE_PREFIX = 'zapier';
|
||||
|
||||
/**
|
||||
* The subscribe route constant.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const SUBSCRIBE_ROUTE = self::ROUTE_PREFIX . '/subscribe';
|
||||
|
||||
/**
|
||||
* The unsubscribe route constant.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const UNSUBSCRIBE_ROUTE = self::ROUTE_PREFIX . '/unsubscribe';
|
||||
|
||||
/**
|
||||
* The check route constant.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const CHECK_API_KEY_ROUTE = self::ROUTE_PREFIX . '/check';
|
||||
|
||||
/**
|
||||
* The perform list route constant.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const PERFORM_LIST = self::ROUTE_PREFIX . '/list';
|
||||
|
||||
/**
|
||||
* The is_connected route constant.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const IS_CONNECTED = self::ROUTE_PREFIX . '/is_connected';
|
||||
|
||||
/**
|
||||
* The reset_api_key route constant.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const RESET_API_KEY = self::ROUTE_PREFIX . '/reset_api_key';
|
||||
|
||||
/**
|
||||
* Instance of the Zapier_Action.
|
||||
*
|
||||
* @var Zapier_Action
|
||||
*/
|
||||
protected $zapier_action;
|
||||
|
||||
/**
|
||||
* Zapier_Route constructor.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Zapier_Action $zapier_action The action to handle the requests to the endpoint.
|
||||
*/
|
||||
public function __construct( Zapier_Action $zapier_action ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$this->zapier_action = $zapier_action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers routes with WordPress.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_routes() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$subscribe_route_args = [
|
||||
'methods' => 'POST',
|
||||
'args' => [
|
||||
'url' => [
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'description' => 'The callback URL to use.',
|
||||
],
|
||||
'api_key' => [
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'description' => 'The API key to validate.',
|
||||
],
|
||||
],
|
||||
'callback' => [ $this, 'subscribe' ],
|
||||
'permission_callback' => '__return_true',
|
||||
];
|
||||
\register_rest_route( Main::API_V1_NAMESPACE, self::SUBSCRIBE_ROUTE, $subscribe_route_args );
|
||||
|
||||
$unsubscribe_route_args = [
|
||||
'methods' => 'DELETE',
|
||||
'args' => [
|
||||
'id' => [
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'description' => 'The ID of the subscription to unsubscribe.',
|
||||
],
|
||||
],
|
||||
'callback' => [ $this, 'unsubscribe' ],
|
||||
'permission_callback' => '__return_true',
|
||||
];
|
||||
\register_rest_route( Main::API_V1_NAMESPACE, self::UNSUBSCRIBE_ROUTE, $unsubscribe_route_args );
|
||||
|
||||
$check_api_key_route_args = [
|
||||
'methods' => 'POST',
|
||||
'args' => [
|
||||
'api_key' => [
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'description' => 'The API key to validate.',
|
||||
],
|
||||
],
|
||||
'callback' => [ $this, 'check_api_key' ],
|
||||
'permission_callback' => '__return_true',
|
||||
];
|
||||
\register_rest_route( Main::API_V1_NAMESPACE, self::CHECK_API_KEY_ROUTE, $check_api_key_route_args );
|
||||
|
||||
$perform_list_route_args = [
|
||||
'methods' => 'GET',
|
||||
'args' => [
|
||||
'api_key' => [
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'description' => 'The API key to validate.',
|
||||
],
|
||||
],
|
||||
'callback' => [ $this, 'perform_list' ],
|
||||
'permission_callback' => '__return_true',
|
||||
];
|
||||
\register_rest_route( Main::API_V1_NAMESPACE, self::PERFORM_LIST, $perform_list_route_args );
|
||||
|
||||
$is_connected_route_args = [
|
||||
'methods' => 'GET',
|
||||
'args' => [],
|
||||
'callback' => [ $this, 'is_connected' ],
|
||||
'permission_callback' => [ $this, 'check_permissions' ],
|
||||
];
|
||||
\register_rest_route( Main::API_V1_NAMESPACE, self::IS_CONNECTED, $is_connected_route_args );
|
||||
|
||||
$reset_api_key_route_args = [
|
||||
'methods' => 'POST',
|
||||
'args' => [
|
||||
'api_key' => [
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'description' => 'The API key to reset.',
|
||||
],
|
||||
],
|
||||
'callback' => [ $this, 'reset_api_key' ],
|
||||
'permission_callback' => [ $this, 'check_permissions' ],
|
||||
];
|
||||
\register_rest_route( Main::API_V1_NAMESPACE, self::RESET_API_KEY, $reset_api_key_route_args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the subscribe action.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param WP_REST_Request $request The request object.
|
||||
*
|
||||
* @return WP_REST_Response The response of the subscribe action.
|
||||
*/
|
||||
public function subscribe( WP_REST_Request $request ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$subscription = $this->zapier_action->subscribe( $request['url'], $request['api_key'] );
|
||||
$response = $subscription->data;
|
||||
|
||||
if ( empty( $response ) && \property_exists( $subscription, 'message' ) ) {
|
||||
$response = $subscription->message;
|
||||
}
|
||||
|
||||
return new WP_REST_Response( $response, $subscription->status );
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the unsubscribe action.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param WP_REST_Request $request The request object.
|
||||
*
|
||||
* @return WP_REST_Response The response of the unsubscribe action.
|
||||
*/
|
||||
public function unsubscribe( WP_REST_Request $request ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$subscription = $this->zapier_action->unsubscribe( $request['id'] );
|
||||
|
||||
return new WP_REST_Response( $subscription->message, $subscription->status );
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the check_api_key action.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param WP_REST_Request $request The request object.
|
||||
*
|
||||
* @return WP_REST_Response The response of the check_api_key action.
|
||||
*/
|
||||
public function check_api_key( WP_REST_Request $request ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$check = $this->zapier_action->check_api_key( $request['api_key'] );
|
||||
|
||||
return new WP_REST_Response( $check->message, $check->status );
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the perform_list action.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param WP_REST_Request $request The request object.
|
||||
*
|
||||
* @return WP_REST_Response The response of the perform_list action.
|
||||
*/
|
||||
public function perform_list( WP_REST_Request $request ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$response = $this->zapier_action->perform_list( $request['api_key'] );
|
||||
|
||||
return new WP_REST_Response( $response->data, $response->status );
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the is_connected action.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return WP_REST_Response The response of the is_connected action.
|
||||
*/
|
||||
public function is_connected() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$response = $this->zapier_action->is_connected();
|
||||
|
||||
return new WP_REST_Response( [ 'json' => $response->data ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the reset_api_key action.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param WP_REST_Request $request The request object.
|
||||
*
|
||||
* @return WP_REST_Response The response of the reset_api_key action.
|
||||
*/
|
||||
public function reset_api_key( WP_REST_Request $request ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
$result = $this->zapier_action->reset_api_key( $request['api_key'] );
|
||||
|
||||
return new WP_REST_Response( [ 'json' => $result->data ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user is authorised to query the connection status or reset the key.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore Just a wrapper for a WordPress function.
|
||||
*
|
||||
* @return bool Whether the user is authorised to query the connection status or reset the key.
|
||||
*/
|
||||
public function check_permissions() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return \current_user_can( 'wpseo_manage_options' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which these routes should be active.
|
||||
*
|
||||
* @deprecated 20.7
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array The list of conditionals.
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.7' );
|
||||
|
||||
return [ Zapier_Enabled_Conditional::class ];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Schema_Templates\Block_Patterns;
|
||||
|
||||
/**
|
||||
* Holds the names of the block pattern categories.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Block_Pattern_Categories {
|
||||
|
||||
const YOAST_JOB_POSTING = 'yoast_job_posting';
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Schema_Templates\Block_Patterns;
|
||||
|
||||
/**
|
||||
* Holds the names of the block pattern keywords.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Block_Pattern_Keywords {
|
||||
|
||||
const YOAST_JOB_POSTING = [ 'yoast', 'job', 'posting', 'vacancy' ];
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Schema_Templates\Block_Patterns;
|
||||
|
||||
/**
|
||||
* A Gutenberg block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
abstract class Block_Pattern {
|
||||
|
||||
/**
|
||||
* Returns the block pattern configuration.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string[] The configuration.
|
||||
*/
|
||||
public function get_configuration() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
return [
|
||||
'title' => '',
|
||||
'content' => '',
|
||||
'categories' => [],
|
||||
'keywords' => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The name of this block pattern.
|
||||
*/
|
||||
abstract public function get_name();
|
||||
|
||||
/**
|
||||
* Gets the title of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The title of this block pattern.
|
||||
*/
|
||||
abstract public function get_title();
|
||||
|
||||
/**
|
||||
* Gets the contents of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The contents of this block pattern.
|
||||
*/
|
||||
abstract public function get_content();
|
||||
|
||||
/**
|
||||
* Gets the categories of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string[] The categories of this block pattern.
|
||||
*/
|
||||
abstract public function get_categories();
|
||||
|
||||
/**
|
||||
* Gets the keywords of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string[] The keywords of this block pattern.
|
||||
*/
|
||||
abstract public function get_keywords();
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Schema_Templates\Block_Patterns;
|
||||
|
||||
/**
|
||||
* A minimal job posting, containing required blocks only.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
|
||||
*/
|
||||
abstract class Job_Posting_Base_Pattern extends Block_Pattern {
|
||||
|
||||
/**
|
||||
* Includes this Job Posting block pattern in the Yoast Job Posting block pattern category.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array The categories under which this block pattern should be shown.
|
||||
*/
|
||||
public function get_categories() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the keywords of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array The keywords that help users discover the pattern while searching.
|
||||
*/
|
||||
public function get_keywords() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Schema_Templates\Block_Patterns;
|
||||
|
||||
/**
|
||||
* A job posting containing all the required and recommended blocks, shown in one column (with a three-column header).
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
|
||||
*/
|
||||
class Job_Posting_One_Column extends Job_Posting_Base_Pattern {
|
||||
|
||||
/**
|
||||
* Gets the name of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The name of this block pattern.
|
||||
*/
|
||||
public function get_name() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
return 'yoast/job-posting/one-column';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The title of this block pattern.
|
||||
*/
|
||||
public function get_title() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
return 'Three-column header and one centered column of text';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the contents of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The contents of this block pattern.
|
||||
*/
|
||||
public function get_content() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
return '<!-- wp:columns {"align":"wide"} -->
|
||||
<div class="wp-block-columns alignwide"><!-- wp:column -->
|
||||
<div class="wp-block-column"><!-- wp:html -->
|
||||
<strong>Employment</strong>
|
||||
<!-- /wp:html -->
|
||||
|
||||
<!-- wp:yoast/job-employment-type {"employmentType":"FULL_TIME"} -->
|
||||
<div class="yoast-job-block__employment "><div><span data-id="employmentType" data-value="FULL_TIME">Full time</span></div></div>
|
||||
<!-- /wp:yoast/job-employment-type --></div>
|
||||
<!-- /wp:column -->
|
||||
|
||||
<!-- wp:column -->
|
||||
<div class="wp-block-column"><!-- wp:html -->
|
||||
<strong>Base salary</strong>
|
||||
<!-- /wp:html -->
|
||||
|
||||
<!-- wp:yoast/job-salary -->
|
||||
<div class=""><!-- wp:yoast/job-base-salary {"currency":"USD","value":"4000","unit":"MONTH"} -->
|
||||
<div class="yoast-job-block__salary "><div class="yoast-schema-flex"><span data-id="currency" data-value="USD">USD</span> 4000 / <span data-id="unit" data-value="MONTH">month</span></div></div>
|
||||
<!-- /wp:yoast/job-base-salary --></div>
|
||||
<!-- /wp:yoast/job-salary --></div>
|
||||
<!-- /wp:column --></div>
|
||||
<!-- /wp:columns -->
|
||||
|
||||
<!-- wp:separator {"align":"wide"} -->
|
||||
<hr class="wp-block-separator alignwide"/>
|
||||
<!-- /wp:separator -->
|
||||
|
||||
<!-- wp:columns {"align":"wide"} -->
|
||||
<div class="wp-block-columns alignwide"><!-- wp:column {"width":"66.66%"} -->
|
||||
<div class="wp-block-column" style="flex-basis:66.66%"><!-- wp:paragraph {"style":{"typography":{"fontSize":24}}} -->
|
||||
<p style="font-size:24px">Our company is growing! And we’re searching for an ambitious employee! Do you believe that a hard work is fundamental for your business? If you do, we’re probably looking for you!</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 id="h-about-the-job">About the job</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:yoast/job-description -->
|
||||
<div class="yoast-job-block__description "><p data-id="description">You’ll be part of an interdisciplinary team and together you’ll work on challenging, varied projects. You’ll get the freedom and responsibility to reach your full potential!</p></div>
|
||||
<!-- /wp:yoast/job-description -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 id="h-about-you">About you</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Do you you have a passion for your job? Are you aware of current trends in your field? Do you love diving into details?</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>We’re looking for someone who is proactive, patient and smart, has an eye for details, and is a great communicator and motivator. If you also have a sense of humor and an enthusiasm for participating in discussions, you’re probably a fit!</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:yoast/job-requirements {"title_level":2} -->
|
||||
<h2 data-id="title">To summarize</h2><div class="yoast-job-block__requirements "><ul data-id="requirements"><li>You enjoy working in a fast-paced team environment.</li><li>You don’t ever think “good enough” is good enough.</li><li>You are available for 40 hours per week.</li><li>You speak and write English fluently (preferably with at least proficiency level C1).</li></ul></div>
|
||||
<!-- /wp:yoast/job-requirements -->
|
||||
|
||||
<!-- wp:yoast/job-benefits {"title_level":2,"className":"yoast-job-block__benefits"} -->
|
||||
<h2 data-id="title">What we’re offering</h2><div class="yoast-job-block__benefits yoast-job-block__benefits"><ul data-id="benefits"><li>A challenging job in a fast-growing, dynamic, ambitious and international atmosphere.</li><li>25 vacation days (on the base of 40 hours).</li><li>You’ll be able to spend 10% of your salary on education.</li><li>We have a really fun company culture with lots of team building activities.</li><li>Are you interested? Then please send your application to this@emailaddress.com before January 1, 2022. Do you have any questions? We’ll be happy to answer them.</li></ul></div>
|
||||
<!-- /wp:yoast/job-benefits -->
|
||||
|
||||
<!-- wp:yoast/job-application-closing-date {"closingDate":"2022-01-01"} -->
|
||||
<div class="yoast-job-block__application-closing-date "><span data-id="title">Apply before</span> <time datetime="2022-01-01">January 1, 2022</time></div>
|
||||
<!-- /wp:yoast/job-application-closing-date --></div>
|
||||
<!-- /wp:column -->
|
||||
|
||||
<!-- wp:column {"width":"33.33%"} -->
|
||||
<div class="wp-block-column" style="flex-basis:33.33%"><!-- wp:yoast/job-location -->
|
||||
<div class=""><!-- wp:yoast/office-location -->
|
||||
<div class="yoast-job-block__location "><!-- wp:yoast/job-location-address -->
|
||||
<div class="yoast-job-block__location__address "><span data-id="address">350 5th Avenue</span></div>
|
||||
<!-- /wp:yoast/job-location-address -->
|
||||
|
||||
<!-- wp:yoast/job-location-city -->
|
||||
<div class="yoast-job-block__location__city "><span data-id="city">New York</span></div>
|
||||
<!-- /wp:yoast/job-location-city -->
|
||||
|
||||
<!-- wp:yoast/job-location-postal-code -->
|
||||
<div class="yoast-job-block__location__postal-code "><span data-id="postal-code">NY 10118</span></div>
|
||||
<!-- /wp:yoast/job-location-postal-code -->
|
||||
|
||||
<!-- wp:yoast/job-location-country -->
|
||||
<div class="yoast-job-block__location__country "><span data-id="country">United States of America</span></div>
|
||||
<!-- /wp:yoast/job-location-country --></div>
|
||||
<!-- /wp:yoast/office-location --></div>
|
||||
<!-- /wp:yoast/job-location --></div>
|
||||
<!-- /wp:column --></div>
|
||||
<!-- /wp:columns -->';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Schema_Templates\Block_Patterns;
|
||||
|
||||
/**
|
||||
* A job posting containing all the required and recommended blocks, shown in two columns (with a two-column header).
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
|
||||
*/
|
||||
class Job_Posting_Two_Columns extends Job_Posting_Base_Pattern {
|
||||
|
||||
/**
|
||||
* Gets the name of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The name of this block pattern.
|
||||
*/
|
||||
public function get_name() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
return 'yoast/job-posting/two-columns';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The title of this block pattern.
|
||||
*/
|
||||
public function get_title() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
return 'Two-column header and two columns of text';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the contents of this block pattern.
|
||||
*
|
||||
* @deprecated 20.5
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string The contents of this block pattern.
|
||||
*/
|
||||
public function get_content() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 20.5' );
|
||||
return '<!-- wp:columns {"align":"wide"} -->
|
||||
<div class="wp-block-columns alignwide"><!-- wp:column -->
|
||||
<div class="wp-block-column"><!-- wp:html -->
|
||||
<strong>Employment</strong>
|
||||
<!-- /wp:html -->
|
||||
|
||||
<!-- wp:yoast/job-employment-type {"employmentType":"FULL_TIME"} -->
|
||||
<div class="yoast-job-block__employment "><div><span data-id="employmentType" data-value="FULL_TIME">Full time</span></div></div>
|
||||
<!-- /wp:yoast/job-employment-type --></div>
|
||||
<!-- /wp:column -->
|
||||
|
||||
<!-- wp:column -->
|
||||
<div class="wp-block-column"><!-- wp:html -->
|
||||
<strong>Salary range</strong>
|
||||
<!-- /wp:html -->
|
||||
|
||||
<!-- wp:yoast/job-salary -->
|
||||
<div class=""><!-- wp:yoast/job-salary-range {"currency":"USD","minValue":"1000","maxValue":"2000","unit":"MONTH"} -->
|
||||
<div class="yoast-job-block__salary "><div class="yoast-schema-flex"><span data-id="currency" data-value="USD">USD</span> 1000 - 2000 / <span data-id="unit" data-value="MONTH">month</span></div></div>
|
||||
<!-- /wp:yoast/job-salary-range --></div>
|
||||
<!-- /wp:yoast/job-salary --></div>
|
||||
<!-- /wp:column -->
|
||||
|
||||
<!-- wp:column -->
|
||||
<div class="wp-block-column"><!-- wp:html -->
|
||||
<strong>Location</strong>
|
||||
<!-- /wp:html -->
|
||||
|
||||
<!-- wp:yoast/job-location -->
|
||||
<div class=""><!-- wp:yoast/office-location -->
|
||||
<div class="yoast-job-block__location "><!-- wp:yoast/job-location-address -->
|
||||
<div class="yoast-job-block__location__address "><span data-id="address">350 5th Avenue</span></div>
|
||||
<!-- /wp:yoast/job-location-address -->
|
||||
|
||||
<!-- wp:yoast/job-location-postal-code -->
|
||||
<div class="yoast-job-block__location__postal-code "><span data-id="postal-code">10118</span></div>
|
||||
<!-- /wp:yoast/job-location-postal-code -->
|
||||
|
||||
<!-- wp:yoast/job-location-city -->
|
||||
<div class="yoast-job-block__location__city "><span data-id="city">New York</span></div>
|
||||
<!-- /wp:yoast/job-location-city -->
|
||||
|
||||
<!-- wp:yoast/job-location-region -->
|
||||
<div class="yoast-job-block__location__region "><span data-id="region">NY</span></div>
|
||||
<!-- /wp:yoast/job-location-region -->
|
||||
|
||||
<!-- wp:yoast/job-location-country -->
|
||||
<div class="yoast-job-block__location__country "><span data-id="country">United States of America</span></div>
|
||||
<!-- /wp:yoast/job-location-country --></div>
|
||||
<!-- /wp:yoast/office-location --></div>
|
||||
<!-- /wp:yoast/job-location --></div>
|
||||
<!-- /wp:column --></div>
|
||||
<!-- /wp:columns -->
|
||||
|
||||
<!-- wp:separator {"align":"wide"} -->
|
||||
<hr class="wp-block-separator alignwide"/>
|
||||
<!-- /wp:separator -->
|
||||
|
||||
<!-- wp:paragraph {"style":{"typography":{"fontSize":24}}} -->
|
||||
<p style="font-size:24px">Our company is growing! And we’re searching for an ambitious employee! Do you believe that a hard work is fundamental for your business? If you do, we’re probably looking for you!</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 id="h-about-the-job">About the job</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:yoast/job-description -->
|
||||
<div class="yoast-job-block__description "><p data-id="description">You’ll be part of a interdisciplinary team and together you’ll work on challenging, varied projects. You’ll get the freedom and responsibility to reach your full potential!</p></div>
|
||||
<!-- /wp:yoast/job-description -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 id="h-about-you">About you</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Do you you have a passion for your job? Are you aware of current trends in your field? Do you love diving into details?</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>We’re looking for someone who is proactive, patient and smart, has an eye for details, and is a great communicator and motivator. If you also have a sense of humor and an enthusiasm for participating in discussions, you’re probably a fit!</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:yoast/job-requirements {"title_level":2} -->
|
||||
<h2 data-id="title">Requirements</h2><div class="yoast-job-block__requirements "><ul data-id="requirements"><li>You enjoy working in a fast-paced team environment.</li><li>You don’t ever think “good enough” is good enough.</li><li>You are available for 40 hours per week.</li><li>You speak and write English fluently (preferably with at least proficiency level C1).</li></ul></div>
|
||||
<!-- /wp:yoast/job-requirements -->
|
||||
|
||||
<!-- wp:yoast/job-benefits {"title_level":2} -->
|
||||
<h2 data-id="title">Benefits</h2><div class="yoast-job-block__benefits "><ul data-id="benefits"><li>A challenging job in a fast-growing, dynamic, ambitious and international atmosphere.</li><li>25 vacation days (on the base of 40 hours).</li><li>You’ll be able to spend 10% of your salary on education.</li><li>We have a really fun company culture with lots of team building activities.</li></ul></div>
|
||||
<!-- /wp:yoast/job-benefits -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Are you interested? Then please send your application to this@emailaddress.com before January 1, 2022. Do you have any questions? We’ll be happy to answer them.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:yoast/job-application-closing-date {"closingDate":"2022-01-01"} -->
|
||||
<div class="yoast-job-block__application-closing-date "><span data-id="title">Apply before</span> <time datetime="2022-01-01">January 1, 2022</time></div>
|
||||
<!-- /wp:yoast/job-application-closing-date -->
|
||||
|
||||
<!-- wp:separator {"align":"wide"} -->
|
||||
<hr class="wp-block-separator alignwide"/>
|
||||
<!-- /wp:separator -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p></p>
|
||||
<!-- /wp:paragraph -->';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Graceful deprecation of various classes which were renamed.
|
||||
*
|
||||
* {@internal As this file is just (temporarily) put in place to warn extending
|
||||
* plugins about the class name changes, it is exempt from select CS standards.}
|
||||
*
|
||||
* @package Yoast\WP\SEO\Premium
|
||||
*
|
||||
* @since 16.1
|
||||
* @deprecated 16.1
|
||||
*
|
||||
* @phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound
|
||||
* @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound
|
||||
* @phpcs:disable Yoast.Commenting.CodeCoverageIgnoreDeprecated
|
||||
* @phpcs:disable Yoast.Commenting.FileComment.Unnecessary
|
||||
* @phpcs:disable Yoast.Files.FileName.InvalidClassFileName
|
||||
*/
|
||||
|
||||
namespace Yoast\WP\SEO\WordPress;
|
||||
|
||||
use Yoast\WP\SEO\Premium\WordPress\Wrapper;
|
||||
|
||||
\_deprecated_file( \basename( __FILE__ ), 'Yoast SEO Premium 16.1' );
|
||||
|
||||
/**
|
||||
* Class Premium_Wrapper.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\WordPress\Wrapper} instead.
|
||||
*/
|
||||
class Premium_Wrapper extends Wrapper {
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @deprecated 16.1 Use {@see \Yoast\WP\SEO\Premium\WordPress\Wrapper} instead.
|
||||
*/
|
||||
public function __construct() {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO Premium 16.1', '\Yoast\WP\SEO\Premium\WordPress\Wrapper' );
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user