Merged in feature/MAW-855-import-code-into-aws (pull request #2)
code import from pantheon * code import from pantheon
This commit is contained in:
@@ -5,18 +5,12 @@
|
||||
* @package WPSEO\Premium
|
||||
*/
|
||||
|
||||
use Yoast\WP\SEO\Helpers\Prominent_Words_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Blocks\Siblings_Block;
|
||||
use Yoast\WP\SEO\Integrations\Blocks\Subpages_Block;
|
||||
use Yoast\WP\SEO\Premium\Addon_Installer;
|
||||
use Yoast\WP\SEO\Presenters\Admin\Help_Link_Presenter;
|
||||
use Yoast\WP\SEO\Repositories\Indexable_Repository;
|
||||
|
||||
if ( ! defined( 'WPSEO_PREMIUM_VERSION' ) ) {
|
||||
header( 'HTTP/1.0 403 Forbidden' );
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class WPSEO_Premium
|
||||
*/
|
||||
@@ -34,7 +28,7 @@ class WPSEO_Premium {
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const PLUGIN_VERSION_NAME = '16.4';
|
||||
const PLUGIN_VERSION_NAME = '21.5';
|
||||
|
||||
/**
|
||||
* Machine readable version for determining whether an upgrade is needed.
|
||||
@@ -61,9 +55,7 @@ class WPSEO_Premium {
|
||||
* Function that will be executed when plugin is activated.
|
||||
*/
|
||||
public static function install() {
|
||||
if ( ! defined( 'WPSEO_VERSION' )
|
||||
|| version_compare( WPSEO_VERSION, Addon_Installer::MINIMUM_YOAST_SEO_VERSION . '-RC0', '<' )
|
||||
) {
|
||||
if ( ! Addon_Installer::is_yoast_seo_up_to_date() ) {
|
||||
delete_option( Addon_Installer::OPTION_KEY );
|
||||
}
|
||||
$wpseo_addon_installer = new Addon_Installer( __DIR__ );
|
||||
@@ -77,7 +69,11 @@ class WPSEO_Premium {
|
||||
|
||||
// Enable tracking.
|
||||
if ( class_exists( WPSEO_Options::class ) ) {
|
||||
WPSEO_Options::set( 'tracking', true );
|
||||
WPSEO_Premium_Option::register_option();
|
||||
if ( WPSEO_Options::get( 'toggled_tracking' ) !== true ) {
|
||||
WPSEO_Options::set( 'tracking', true );
|
||||
}
|
||||
WPSEO_Options::set( 'should_redirect_after_install', true );
|
||||
}
|
||||
|
||||
\do_action( 'wpseo_register_capabilities_premium' );
|
||||
@@ -90,7 +86,8 @@ class WPSEO_Premium {
|
||||
public function __construct() {
|
||||
$this->integrations = [
|
||||
'premium-metabox' => new WPSEO_Premium_Metabox(
|
||||
YoastSEOPremium()->classes->get( Prominent_Words_Helper::class )
|
||||
YoastSEOPremium()->helpers->prominent_words,
|
||||
YoastSEOPremium()->helpers->current_page
|
||||
),
|
||||
'premium-assets' => new WPSEO_Premium_Assets(),
|
||||
'link-suggestions' => new WPSEO_Metabox_Link_Suggestions(),
|
||||
@@ -99,10 +96,6 @@ class WPSEO_Premium {
|
||||
'redirect-export-manager' => new WPSEO_Premium_Redirect_Export_Manager(),
|
||||
'keyword-export-manager' => new WPSEO_Premium_Keyword_Export_Manager(),
|
||||
'orphaned-post-filter' => new WPSEO_Premium_Orphaned_Post_Filter(),
|
||||
// Joost de Valk, April 6th 2019.
|
||||
// Disabling this until we've found a better way to display this data that doesn't become annoying when you have a lot of post types.
|
||||
// 'orphaned-post-notifier' => new WPSEO_Premium_Orphaned_Post_Notifier( array( 'post', 'page' ), Yoast_Notification_Center::get() ), // Commented out.
|
||||
'request-free-translations' => new WPSEO_Premium_Free_Translations(),
|
||||
'expose-javascript-shortlinks' => new WPSEO_Premium_Expose_Shortlinks(),
|
||||
'multi-keyword' => new WPSEO_Multi_Keyword(),
|
||||
'siblings-block' => new Siblings_Block( YoastSEO()->classes->get( Indexable_Repository::class ) ),
|
||||
@@ -116,34 +109,6 @@ class WPSEO_Premium {
|
||||
$this->setup();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a feature toggle to the given feature_toggles.
|
||||
*
|
||||
* @param array $feature_toggles The feature toggles to extend.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add_feature_toggles( array $feature_toggles ) {
|
||||
$feature_toggles[] = (object) [
|
||||
'name' => __( 'Insights', 'wordpress-seo-premium' ),
|
||||
'setting' => 'enable_metabox_insights',
|
||||
'label' => __( 'The Insights section in our metabox shows you useful data about your content, like what words you use most often.', 'wordpress-seo-premium' ),
|
||||
'read_more_label' => __( 'Read more about how the insights can help you improve your content.', 'wordpress-seo-premium' ),
|
||||
'read_more_url' => 'https://yoa.st/2ai',
|
||||
'order' => 41,
|
||||
];
|
||||
$feature_toggles[] = (object) [
|
||||
'name' => __( 'Link suggestions', 'wordpress-seo-premium' ),
|
||||
'setting' => 'enable_link_suggestions',
|
||||
'label' => __( 'The link suggestions metabox contains a list of posts on your blog with similar content that might be interesting to link to.', 'wordpress-seo-premium' ),
|
||||
'read_more_label' => __( 'Read more about how internal linking can improve your site structure.', 'wordpress-seo-premium' ),
|
||||
'read_more_url' => 'https://yoa.st/17g',
|
||||
'order' => 42,
|
||||
];
|
||||
|
||||
return $feature_toggles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the Yoast SEO premium plugin.
|
||||
*
|
||||
@@ -160,12 +125,6 @@ class WPSEO_Premium {
|
||||
if ( is_admin() ) {
|
||||
// Make sure priority is below registration of other implementations of the beacon in News, Video, etc.
|
||||
add_filter( 'wpseo_helpscout_beacon_settings', [ $this, 'filter_helpscout_beacon' ], 1 );
|
||||
add_filter( 'wpseo_feature_toggles', [ $this, 'add_feature_toggles' ] );
|
||||
|
||||
// Only register the yoast i18n when the page is a Yoast SEO page.
|
||||
if ( $this->is_yoast_seo_premium_page( filter_input( INPUT_GET, 'page' ) ) ) {
|
||||
$this->register_i18n_promo_class();
|
||||
}
|
||||
|
||||
add_filter( 'wpseo_enable_tracking', '__return_true', 1 );
|
||||
|
||||
@@ -175,7 +134,7 @@ class WPSEO_Premium {
|
||||
|
||||
// Add input fields to page meta post types.
|
||||
add_action(
|
||||
'Yoast\WP\SEO\admin_post_types_beforearchive',
|
||||
'Yoast\WP\SEO\admin_post_types_beforearchive_internal',
|
||||
[
|
||||
$this,
|
||||
'admin_page_meta_post_types_checkboxes',
|
||||
@@ -213,10 +172,6 @@ class WPSEO_Premium {
|
||||
add_action( 'wpseo_premium_indicator_classes', [ $this, 'change_premium_indicator' ] );
|
||||
add_action( 'wpseo_premium_indicator_text', [ $this, 'change_premium_indicator_text' ] );
|
||||
|
||||
// Only initialize the AJAX for all tabs except settings.
|
||||
$facebook_name = new WPSEO_Facebook_Profile();
|
||||
$facebook_name->set_hooks();
|
||||
|
||||
foreach ( $this->integrations as $integration ) {
|
||||
$integration->register_hooks();
|
||||
}
|
||||
@@ -235,26 +190,6 @@ class WPSEO_Premium {
|
||||
return in_array( $page, $premium_pages, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the promotion class for our GlotPress instance.
|
||||
*
|
||||
* @link https://github.com/Yoast/i18n-module
|
||||
*/
|
||||
private function register_i18n_promo_class() {
|
||||
new Yoast_I18n_v3(
|
||||
[
|
||||
'textdomain' => 'wordpress-seo-premium',
|
||||
'project_slug' => 'wordpress-seo-premium',
|
||||
'plugin_name' => 'Yoast SEO premium',
|
||||
'hook' => 'wpseo_admin_promo_footer',
|
||||
'api_url' => 'https://translationspress.com/app/api/yoast/wordpress-seo-premium/',
|
||||
'glotpress_name' => 'Yoast Translate',
|
||||
'glotpress_logo' => 'https://yoast.com/app/uploads/yoast/Yoast_Translate.svg',
|
||||
'register_url' => 'https://yoa.st/translationspress',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the autoloader for the redirects and instantiates the redirect page object.
|
||||
*
|
||||
@@ -333,7 +268,7 @@ class WPSEO_Premium {
|
||||
$node = [
|
||||
'id' => 'wpseo-premium-create-redirect',
|
||||
'title' => __( 'Create Redirect', 'wordpress-seo-premium' ),
|
||||
'href' => admin_url( 'admin.php?page=wpseo_redirects&old_url=' . $old_url ),
|
||||
'href' => wp_nonce_url( admin_url( 'admin.php?page=wpseo_redirects&old_url=' . $old_url ), 'wpseo_redirects-old-url', 'wpseo_premium_redirects_nonce' ),
|
||||
];
|
||||
$wp_admin_bar->add_menu( $node );
|
||||
}
|
||||
@@ -396,7 +331,7 @@ class WPSEO_Premium {
|
||||
$submenu_pages[] = [
|
||||
'wpseo_dashboard',
|
||||
'',
|
||||
__( 'Redirects', 'wordpress-seo-premium' ),
|
||||
__( 'Redirects', 'wordpress-seo-premium' ) . ' <span class="yoast-badge yoast-premium-badge"></span>',
|
||||
'wpseo_manage_redirects',
|
||||
'wpseo_redirects',
|
||||
[ $this->redirects, 'display' ],
|
||||
|
||||
Reference in New Issue
Block a user