Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../public_h.../wp-conte.../plugins/wordpres.../src/integrat.../third-pa...
File: elementor.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Integrations\Third_Party;
[2] Fix | Delete
[3] Fix | Delete
use Elementor\Controls_Manager;
[4] Fix | Delete
use Elementor\Core\DocumentTypes\PageBase;
[5] Fix | Delete
use WP_Post;
[6] Fix | Delete
use WP_Screen;
[7] Fix | Delete
use WPSEO_Admin_Asset_Manager;
[8] Fix | Delete
use WPSEO_Admin_Recommended_Replace_Vars;
[9] Fix | Delete
use WPSEO_Language_Utils;
[10] Fix | Delete
use WPSEO_Meta;
[11] Fix | Delete
use WPSEO_Metabox_Analysis_Inclusive_Language;
[12] Fix | Delete
use WPSEO_Metabox_Analysis_Readability;
[13] Fix | Delete
use WPSEO_Metabox_Analysis_SEO;
[14] Fix | Delete
use WPSEO_Metabox_Formatter;
[15] Fix | Delete
use WPSEO_Post_Metabox_Formatter;
[16] Fix | Delete
use WPSEO_Replace_Vars;
[17] Fix | Delete
use WPSEO_Shortlinker;
[18] Fix | Delete
use WPSEO_Utils;
[19] Fix | Delete
use Yoast\WP\SEO\Actions\Alert_Dismissal_Action;
[20] Fix | Delete
use Yoast\WP\SEO\Conditionals\Third_Party\Elementor_Edit_Conditional;
[21] Fix | Delete
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
[22] Fix | Delete
use Yoast\WP\SEO\Helpers\Capability_Helper;
[23] Fix | Delete
use Yoast\WP\SEO\Helpers\Options_Helper;
[24] Fix | Delete
use Yoast\WP\SEO\Integrations\Integration_Interface;
[25] Fix | Delete
use Yoast\WP\SEO\Introductions\Infrastructure\Wistia_Embed_Permission_Repository;
[26] Fix | Delete
use Yoast\WP\SEO\Presenters\Admin\Meta_Fields_Presenter;
[27] Fix | Delete
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
[28] Fix | Delete
[29] Fix | Delete
/**
[30] Fix | Delete
* Integrates the Yoast SEO metabox in the Elementor editor.
[31] Fix | Delete
*/
[32] Fix | Delete
class Elementor implements Integration_Interface {
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* The identifier for the elementor tab.
[36] Fix | Delete
*/
[37] Fix | Delete
public const YOAST_TAB = 'yoast-tab';
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Represents the post.
[41] Fix | Delete
*
[42] Fix | Delete
* @var WP_Post|null
[43] Fix | Delete
*/
[44] Fix | Delete
protected $post;
[45] Fix | Delete
[46] Fix | Delete
/**
[47] Fix | Delete
* Represents the admin asset manager.
[48] Fix | Delete
*
[49] Fix | Delete
* @var WPSEO_Admin_Asset_Manager
[50] Fix | Delete
*/
[51] Fix | Delete
protected $asset_manager;
[52] Fix | Delete
[53] Fix | Delete
/**
[54] Fix | Delete
* Represents the options helper.
[55] Fix | Delete
*
[56] Fix | Delete
* @var Options_Helper
[57] Fix | Delete
*/
[58] Fix | Delete
protected $options;
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* Represents the capability helper.
[62] Fix | Delete
*
[63] Fix | Delete
* @var Capability_Helper
[64] Fix | Delete
*/
[65] Fix | Delete
protected $capability;
[66] Fix | Delete
[67] Fix | Delete
/**
[68] Fix | Delete
* Holds whether the socials are enabled.
[69] Fix | Delete
*
[70] Fix | Delete
* @var bool
[71] Fix | Delete
*/
[72] Fix | Delete
protected $social_is_enabled;
[73] Fix | Delete
[74] Fix | Delete
/**
[75] Fix | Delete
* Holds whether the advanced settings are enabled.
[76] Fix | Delete
*
[77] Fix | Delete
* @var bool
[78] Fix | Delete
*/
[79] Fix | Delete
protected $is_advanced_metadata_enabled;
[80] Fix | Delete
[81] Fix | Delete
/**
[82] Fix | Delete
* Helper to determine whether or not the SEO analysis is enabled.
[83] Fix | Delete
*
[84] Fix | Delete
* @var WPSEO_Metabox_Analysis_SEO
[85] Fix | Delete
*/
[86] Fix | Delete
protected $seo_analysis;
[87] Fix | Delete
[88] Fix | Delete
/**
[89] Fix | Delete
* Helper to determine whether or not the readability analysis is enabled.
[90] Fix | Delete
*
[91] Fix | Delete
* @var WPSEO_Metabox_Analysis_Readability
[92] Fix | Delete
*/
[93] Fix | Delete
protected $readability_analysis;
[94] Fix | Delete
[95] Fix | Delete
/**
[96] Fix | Delete
* Helper to determine whether or not the inclusive language analysis is enabled.
[97] Fix | Delete
*
[98] Fix | Delete
* @var WPSEO_Metabox_Analysis_Inclusive_Language
[99] Fix | Delete
*/
[100] Fix | Delete
protected $inclusive_language_analysis;
[101] Fix | Delete
[102] Fix | Delete
/**
[103] Fix | Delete
* Holds the promotion manager.
[104] Fix | Delete
*
[105] Fix | Delete
* @var Promotion_Manager
[106] Fix | Delete
*/
[107] Fix | Delete
protected $promotion_manager;
[108] Fix | Delete
[109] Fix | Delete
/**
[110] Fix | Delete
* Returns the conditionals based in which this loadable should be active.
[111] Fix | Delete
*
[112] Fix | Delete
* @return array
[113] Fix | Delete
*/
[114] Fix | Delete
public static function get_conditionals() {
[115] Fix | Delete
return [ Elementor_Edit_Conditional::class ];
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
/**
[119] Fix | Delete
* Constructor.
[120] Fix | Delete
*
[121] Fix | Delete
* @param WPSEO_Admin_Asset_Manager $asset_manager The asset manager.
[122] Fix | Delete
* @param Options_Helper $options The options helper.
[123] Fix | Delete
* @param Capability_Helper $capability The capability helper.
[124] Fix | Delete
* @param Promotion_Manager $promotion_manager The promotion manager.
[125] Fix | Delete
*/
[126] Fix | Delete
public function __construct(
[127] Fix | Delete
WPSEO_Admin_Asset_Manager $asset_manager,
[128] Fix | Delete
Options_Helper $options,
[129] Fix | Delete
Capability_Helper $capability,
[130] Fix | Delete
Promotion_Manager $promotion_manager
[131] Fix | Delete
) {
[132] Fix | Delete
$this->asset_manager = $asset_manager;
[133] Fix | Delete
$this->options = $options;
[134] Fix | Delete
$this->capability = $capability;
[135] Fix | Delete
$this->promotion_manager = $promotion_manager;
[136] Fix | Delete
[137] Fix | Delete
$this->seo_analysis = new WPSEO_Metabox_Analysis_SEO();
[138] Fix | Delete
$this->readability_analysis = new WPSEO_Metabox_Analysis_Readability();
[139] Fix | Delete
$this->inclusive_language_analysis = new WPSEO_Metabox_Analysis_Inclusive_Language();
[140] Fix | Delete
$this->social_is_enabled = $this->options->get( 'opengraph', false ) || $this->options->get( 'twitter', false );
[141] Fix | Delete
$this->is_advanced_metadata_enabled = $this->capability->current_user_can( 'wpseo_edit_advanced_metadata' ) || $this->options->get( 'disableadvanced_meta' ) === false;
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
/**
[145] Fix | Delete
* Initializes the integration.
[146] Fix | Delete
*
[147] Fix | Delete
* This is the place to register hooks and filters.
[148] Fix | Delete
*
[149] Fix | Delete
* @return void
[150] Fix | Delete
*/
[151] Fix | Delete
public function register_hooks() {
[152] Fix | Delete
\add_action( 'wp_ajax_wpseo_elementor_save', [ $this, 'save_postdata' ] );
[153] Fix | Delete
[154] Fix | Delete
// We need to delay the post type lookup to give other plugins a chance to register custom post types.
[155] Fix | Delete
\add_action( 'init', [ $this, 'register_elementor_hooks' ], \PHP_INT_MAX );
[156] Fix | Delete
}
[157] Fix | Delete
[158] Fix | Delete
/**
[159] Fix | Delete
* Registers our Elementor hooks.
[160] Fix | Delete
* This is done for pages with metabox on page load and not on ajax request.
[161] Fix | Delete
*
[162] Fix | Delete
* @return void
[163] Fix | Delete
*/
[164] Fix | Delete
public function register_elementor_hooks() {
[165] Fix | Delete
[166] Fix | Delete
if ( $this->get_metabox_post() === null || ! $this->display_metabox( $this->get_metabox_post()->post_type ) ) {
[167] Fix | Delete
return;
[168] Fix | Delete
}
[169] Fix | Delete
[170] Fix | Delete
\add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'init' ] );
[171] Fix | Delete
[172] Fix | Delete
// We are too late for elementor/init. We should see if we can be on time, or else this workaround works (we do always get the "else" though).
[173] Fix | Delete
if ( ! \did_action( 'elementor/init' ) ) {
[174] Fix | Delete
\add_action( 'elementor/init', [ $this, 'add_yoast_panel_tab' ] );
[175] Fix | Delete
}
[176] Fix | Delete
else {
[177] Fix | Delete
$this->add_yoast_panel_tab();
[178] Fix | Delete
}
[179] Fix | Delete
\add_action( 'elementor/documents/register_controls', [ $this, 'register_document_controls' ] );
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
/**
[183] Fix | Delete
* Initializes the integration.
[184] Fix | Delete
*
[185] Fix | Delete
* @return void
[186] Fix | Delete
*/
[187] Fix | Delete
public function init() {
[188] Fix | Delete
$this->asset_manager->register_assets();
[189] Fix | Delete
$this->enqueue();
[190] Fix | Delete
$this->render_hidden_fields();
[191] Fix | Delete
}
[192] Fix | Delete
[193] Fix | Delete
/**
[194] Fix | Delete
* Register a panel tab slug, in order to allow adding controls to this tab.
[195] Fix | Delete
*
[196] Fix | Delete
* @return void
[197] Fix | Delete
*/
[198] Fix | Delete
public function add_yoast_panel_tab() {
[199] Fix | Delete
Controls_Manager::add_tab( $this::YOAST_TAB, 'Yoast SEO' );
[200] Fix | Delete
}
[201] Fix | Delete
[202] Fix | Delete
/**
[203] Fix | Delete
* Register additional document controls.
[204] Fix | Delete
*
[205] Fix | Delete
* @param PageBase $document The PageBase document.
[206] Fix | Delete
*
[207] Fix | Delete
* @return void
[208] Fix | Delete
*/
[209] Fix | Delete
public function register_document_controls( $document ) {
[210] Fix | Delete
// PageBase is the base class for documents like `post` `page` and etc.
[211] Fix | Delete
if ( ! $document instanceof PageBase || ! $document::get_property( 'has_elements' ) ) {
[212] Fix | Delete
return;
[213] Fix | Delete
}
[214] Fix | Delete
[215] Fix | Delete
// This is needed to get the tab to appear, but will be overwritten in the JavaScript.
[216] Fix | Delete
$document->start_controls_section(
[217] Fix | Delete
'yoast_temporary_section',
[218] Fix | Delete
[
[219] Fix | Delete
'label' => 'Yoast SEO',
[220] Fix | Delete
'tab' => self::YOAST_TAB,
[221] Fix | Delete
]
[222] Fix | Delete
);
[223] Fix | Delete
[224] Fix | Delete
$document->end_controls_section();
[225] Fix | Delete
}
[226] Fix | Delete
[227] Fix | Delete
// Below is mostly copied from `class-metabox.php`. That constructor has side-effects we do not need.
[228] Fix | Delete
[229] Fix | Delete
/**
[230] Fix | Delete
* Determines whether the metabox should be shown for the passed identifier.
[231] Fix | Delete
*
[232] Fix | Delete
* By default, the check is done for post types, but can also be used for taxonomies.
[233] Fix | Delete
*
[234] Fix | Delete
* @param string|null $identifier The identifier to check.
[235] Fix | Delete
* @param string $type The type of object to check. Defaults to post_type.
[236] Fix | Delete
*
[237] Fix | Delete
* @return bool Whether the metabox should be displayed.
[238] Fix | Delete
*/
[239] Fix | Delete
public function display_metabox( $identifier = null, $type = 'post_type' ) {
[240] Fix | Delete
return WPSEO_Utils::is_metabox_active( $identifier, $type );
[241] Fix | Delete
}
[242] Fix | Delete
[243] Fix | Delete
/**
[244] Fix | Delete
* Saves the WP SEO metadata for posts.
[245] Fix | Delete
*
[246] Fix | Delete
* Outputs JSON via wp_send_json then stops code execution.
[247] Fix | Delete
*
[248] Fix | Delete
* {@internal $_POST parameters are validated via sanitize_post_meta().}}
[249] Fix | Delete
*
[250] Fix | Delete
* @return void
[251] Fix | Delete
*/
[252] Fix | Delete
public function save_postdata() {
[253] Fix | Delete
global $post;
[254] Fix | Delete
[255] Fix | Delete
if ( ! isset( $_POST['post_id'] ) || ! \is_string( $_POST['post_id'] ) ) {
[256] Fix | Delete
\wp_send_json_error( 'Bad Request', 400 );
[257] Fix | Delete
}
[258] Fix | Delete
[259] Fix | Delete
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: No sanitization needed because we cast to an integer.
[260] Fix | Delete
$post_id = (int) \wp_unslash( $_POST['post_id'] );
[261] Fix | Delete
[262] Fix | Delete
if ( $post_id <= 0 ) {
[263] Fix | Delete
\wp_send_json_error( 'Bad Request', 400 );
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
if ( ! \current_user_can( 'edit_post', $post_id ) ) {
[267] Fix | Delete
\wp_send_json_error( 'Forbidden', 403 );
[268] Fix | Delete
}
[269] Fix | Delete
[270] Fix | Delete
\check_ajax_referer( 'wpseo_elementor_save', '_wpseo_elementor_nonce' );
[271] Fix | Delete
[272] Fix | Delete
// Bail if this is a multisite installation and the site has been switched.
[273] Fix | Delete
if ( \is_multisite() && \ms_is_switched() ) {
[274] Fix | Delete
\wp_send_json_error( 'Switched multisite', 409 );
[275] Fix | Delete
}
[276] Fix | Delete
[277] Fix | Delete
\clean_post_cache( $post_id );
[278] Fix | Delete
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- To setup the post we need to do this explicitly.
[279] Fix | Delete
$post = \get_post( $post_id );
[280] Fix | Delete
[281] Fix | Delete
if ( ! \is_object( $post ) ) {
[282] Fix | Delete
// Non-existent post.
[283] Fix | Delete
\wp_send_json_error( 'Post not found', 400 );
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
\do_action( 'wpseo_save_compare_data', $post );
[287] Fix | Delete
[288] Fix | Delete
// Initialize meta, amongst other things it registers sanitization.
[289] Fix | Delete
WPSEO_Meta::init();
[290] Fix | Delete
[291] Fix | Delete
$social_fields = [];
[292] Fix | Delete
if ( $this->social_is_enabled ) {
[293] Fix | Delete
$social_fields = WPSEO_Meta::get_meta_field_defs( 'social', $post->post_type );
[294] Fix | Delete
}
[295] Fix | Delete
[296] Fix | Delete
// The below methods use the global post so make sure it is setup.
[297] Fix | Delete
\setup_postdata( $post );
[298] Fix | Delete
$meta_boxes = \apply_filters( 'wpseo_save_metaboxes', [] );
[299] Fix | Delete
$meta_boxes = \array_merge(
[300] Fix | Delete
$meta_boxes,
[301] Fix | Delete
WPSEO_Meta::get_meta_field_defs( 'general', $post->post_type ),
[302] Fix | Delete
WPSEO_Meta::get_meta_field_defs( 'advanced', $post->post_type ),
[303] Fix | Delete
$social_fields,
[304] Fix | Delete
WPSEO_Meta::get_meta_field_defs( 'schema', $post->post_type )
[305] Fix | Delete
);
[306] Fix | Delete
[307] Fix | Delete
foreach ( $meta_boxes as $key => $meta_box ) {
[308] Fix | Delete
// If analysis is disabled remove that analysis score value from the DB.
[309] Fix | Delete
if ( $this->is_meta_value_disabled( $key ) ) {
[310] Fix | Delete
WPSEO_Meta::delete( $key, $post_id );
[311] Fix | Delete
continue;
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
$data = null;
[315] Fix | Delete
$field_name = WPSEO_Meta::$form_prefix . $key;
[316] Fix | Delete
[317] Fix | Delete
if ( $meta_box['type'] === 'checkbox' ) {
[318] Fix | Delete
$data = isset( $_POST[ $field_name ] ) ? 'on' : 'off';
[319] Fix | Delete
}
[320] Fix | Delete
else {
[321] Fix | Delete
if ( isset( $_POST[ $field_name ] ) ) {
[322] Fix | Delete
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: Sanitized through sanitize_post_meta.
[323] Fix | Delete
$data = \wp_unslash( $_POST[ $field_name ] );
[324] Fix | Delete
[325] Fix | Delete
// For multi-select.
[326] Fix | Delete
if ( \is_array( $data ) ) {
[327] Fix | Delete
$data = \array_map( [ 'WPSEO_Utils', 'sanitize_text_field' ], $data );
[328] Fix | Delete
}
[329] Fix | Delete
[330] Fix | Delete
if ( \is_string( $data ) ) {
[331] Fix | Delete
$data = ( $key !== 'canonical' ) ? WPSEO_Utils::sanitize_text_field( $data ) : WPSEO_Utils::sanitize_url( $data );
[332] Fix | Delete
}
[333] Fix | Delete
}
[334] Fix | Delete
[335] Fix | Delete
// Reset options when no entry is present with multiselect - only applies to `meta-robots-adv` currently.
[336] Fix | Delete
if ( ! isset( $_POST[ $field_name ] ) && ( $meta_box['type'] === 'multiselect' ) ) {
[337] Fix | Delete
$data = [];
[338] Fix | Delete
}
[339] Fix | Delete
}
[340] Fix | Delete
[341] Fix | Delete
if ( $data !== null ) {
[342] Fix | Delete
WPSEO_Meta::set_value( $key, $data, $post_id );
[343] Fix | Delete
}
[344] Fix | Delete
}
[345] Fix | Delete
[346] Fix | Delete
if ( isset( $_POST[ WPSEO_Meta::$form_prefix . 'slug' ] ) && \is_string( $_POST[ WPSEO_Meta::$form_prefix . 'slug' ] ) ) {
[347] Fix | Delete
$slug = \sanitize_title( \wp_unslash( $_POST[ WPSEO_Meta::$form_prefix . 'slug' ] ) );
[348] Fix | Delete
if ( $post->post_name !== $slug ) {
[349] Fix | Delete
$post_array = $post->to_array();
[350] Fix | Delete
$post_array['post_name'] = $slug;
[351] Fix | Delete
[352] Fix | Delete
$save_successful = \wp_insert_post( $post_array );
[353] Fix | Delete
if ( \is_wp_error( $save_successful ) ) {
[354] Fix | Delete
\wp_send_json_error( 'Slug not saved', 400 );
[355] Fix | Delete
}
[356] Fix | Delete
[357] Fix | Delete
// Update the post object to ensure we have the actual slug.
[358] Fix | Delete
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- Updating the post is needed to get the current slug.
[359] Fix | Delete
$post = \get_post( $post_id );
[360] Fix | Delete
if ( ! \is_object( $post ) ) {
[361] Fix | Delete
\wp_send_json_error( 'Updated slug not found', 400 );
[362] Fix | Delete
}
[363] Fix | Delete
}
[364] Fix | Delete
}
[365] Fix | Delete
[366] Fix | Delete
\do_action( 'wpseo_saved_postdata' );
[367] Fix | Delete
[368] Fix | Delete
// Output the slug, because it is processed by WP and we need the actual slug again.
[369] Fix | Delete
\wp_send_json_success( [ 'slug' => $post->post_name ] );
[370] Fix | Delete
}
[371] Fix | Delete
[372] Fix | Delete
/**
[373] Fix | Delete
* Determines if the given meta value key is disabled.
[374] Fix | Delete
*
[375] Fix | Delete
* @param string $key The key of the meta value.
[376] Fix | Delete
*
[377] Fix | Delete
* @return bool Whether the given meta value key is disabled.
[378] Fix | Delete
*/
[379] Fix | Delete
public function is_meta_value_disabled( $key ) {
[380] Fix | Delete
if ( $key === 'linkdex' && ! $this->seo_analysis->is_enabled() ) {
[381] Fix | Delete
return true;
[382] Fix | Delete
}
[383] Fix | Delete
[384] Fix | Delete
if ( $key === 'content_score' && ! $this->readability_analysis->is_enabled() ) {
[385] Fix | Delete
return true;
[386] Fix | Delete
}
[387] Fix | Delete
[388] Fix | Delete
if ( $key === 'inclusive_language_score' && ! $this->inclusive_language_analysis->is_enabled() ) {
[389] Fix | Delete
return true;
[390] Fix | Delete
}
[391] Fix | Delete
[392] Fix | Delete
return false;
[393] Fix | Delete
}
[394] Fix | Delete
[395] Fix | Delete
/**
[396] Fix | Delete
* Enqueues all the needed JS and CSS.
[397] Fix | Delete
*
[398] Fix | Delete
* @return void
[399] Fix | Delete
*/
[400] Fix | Delete
public function enqueue() {
[401] Fix | Delete
$post_id = \get_queried_object_id();
[402] Fix | Delete
if ( empty( $post_id ) ) {
[403] Fix | Delete
$post_id = 0;
[404] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[405] Fix | Delete
if ( isset( $_GET['post'] ) && \is_string( $_GET['post'] ) ) {
[406] Fix | Delete
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended -- Reason: No sanitization needed because we cast to an integer,We are not processing form information.
[407] Fix | Delete
$post_id = (int) \wp_unslash( $_GET['post'] );
[408] Fix | Delete
}
[409] Fix | Delete
}
[410] Fix | Delete
[411] Fix | Delete
if ( $post_id !== 0 ) {
[412] Fix | Delete
// Enqueue files needed for upload functionality.
[413] Fix | Delete
\wp_enqueue_media( [ 'post' => $post_id ] );
[414] Fix | Delete
}
[415] Fix | Delete
[416] Fix | Delete
$this->asset_manager->enqueue_style( 'admin-global' );
[417] Fix | Delete
$this->asset_manager->enqueue_style( 'metabox-css' );
[418] Fix | Delete
$this->asset_manager->enqueue_style( 'scoring' );
[419] Fix | Delete
$this->asset_manager->enqueue_style( 'monorepo' );
[420] Fix | Delete
$this->asset_manager->enqueue_style( 'admin-css' );
[421] Fix | Delete
$this->asset_manager->enqueue_style( 'ai-generator' );
[422] Fix | Delete
$this->asset_manager->enqueue_style( 'elementor' );
[423] Fix | Delete
[424] Fix | Delete
$this->asset_manager->enqueue_script( 'admin-global' );
[425] Fix | Delete
$this->asset_manager->enqueue_script( 'elementor' );
[426] Fix | Delete
[427] Fix | Delete
$this->asset_manager->localize_script( 'elementor', 'wpseoAdminGlobalL10n', \YoastSEO()->helpers->wincher->get_admin_global_links() );
[428] Fix | Delete
$this->asset_manager->localize_script( 'elementor', 'wpseoAdminL10n', WPSEO_Utils::get_admin_l10n() );
[429] Fix | Delete
$this->asset_manager->localize_script( 'elementor', 'wpseoFeaturesL10n', WPSEO_Utils::retrieve_enabled_features() );
[430] Fix | Delete
[431] Fix | Delete
$plugins_script_data = [
[432] Fix | Delete
'replaceVars' => [
[433] Fix | Delete
'no_parent_text' => \__( '(no parent)', 'wordpress-seo' ),
[434] Fix | Delete
'replace_vars' => $this->get_replace_vars(),
[435] Fix | Delete
'recommended_replace_vars' => $this->get_recommended_replace_vars(),
[436] Fix | Delete
'hidden_replace_vars' => $this->get_hidden_replace_vars(),
[437] Fix | Delete
'scope' => $this->determine_scope(),
[438] Fix | Delete
'has_taxonomies' => $this->current_post_type_has_taxonomies(),
[439] Fix | Delete
],
[440] Fix | Delete
'shortcodes' => [
[441] Fix | Delete
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
[442] Fix | Delete
'wpseo_filter_shortcodes_nonce' => \wp_create_nonce( 'wpseo-filter-shortcodes' ),
[443] Fix | Delete
],
[444] Fix | Delete
];
[445] Fix | Delete
[446] Fix | Delete
$worker_script_data = [
[447] Fix | Delete
'url' => \YoastSEO()->helpers->asset->get_asset_url( 'yoast-seo-analysis-worker' ),
[448] Fix | Delete
'dependencies' => \YoastSEO()->helpers->asset->get_dependency_urls_by_handle( 'yoast-seo-analysis-worker' ),
[449] Fix | Delete
'keywords_assessment_url' => \YoastSEO()->helpers->asset->get_asset_url( 'yoast-seo-used-keywords-assessment' ),
[450] Fix | Delete
'log_level' => WPSEO_Utils::get_analysis_worker_log_level(),
[451] Fix | Delete
// We need to make the feature flags separately available inside of the analysis web worker.
[452] Fix | Delete
'enabled_features' => WPSEO_Utils::retrieve_enabled_features(),
[453] Fix | Delete
];
[454] Fix | Delete
[455] Fix | Delete
$alert_dismissal_action = \YoastSEO()->classes->get( Alert_Dismissal_Action::class );
[456] Fix | Delete
$dismissed_alerts = $alert_dismissal_action->all_dismissed();
[457] Fix | Delete
$woocommerce_conditional = new WooCommerce_Conditional();
[458] Fix | Delete
[459] Fix | Delete
$script_data = [
[460] Fix | Delete
'media' => [ 'choose_image' => \__( 'Use Image', 'wordpress-seo' ) ],
[461] Fix | Delete
'metabox' => $this->get_metabox_script_data(),
[462] Fix | Delete
'userLanguageCode' => WPSEO_Language_Utils::get_language( \get_user_locale() ),
[463] Fix | Delete
'isPost' => true,
[464] Fix | Delete
'isBlockEditor' => WP_Screen::get()->is_block_editor(),
[465] Fix | Delete
'isElementorEditor' => true,
[466] Fix | Delete
'isWooCommerceActive' => $woocommerce_conditional->is_met(),
[467] Fix | Delete
'postStatus' => \get_post_status( $post_id ),
[468] Fix | Delete
'postType' => \get_post_type( $post_id ),
[469] Fix | Delete
'analysis' => [
[470] Fix | Delete
'plugins' => $plugins_script_data,
[471] Fix | Delete
'worker' => $worker_script_data,
[472] Fix | Delete
],
[473] Fix | Delete
'dismissedAlerts' => $dismissed_alerts,
[474] Fix | Delete
'webinarIntroElementorUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/webinar-intro-elementor' ),
[475] Fix | Delete
'currentPromotions' => $this->promotion_manager->get_current_promotions(),
[476] Fix | Delete
'usedKeywordsNonce' => \wp_create_nonce( 'wpseo-keyword-usage-and-post-types' ),
[477] Fix | Delete
'linkParams' => WPSEO_Shortlinker::get_query_params(),
[478] Fix | Delete
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
[479] Fix | Delete
'wistiaEmbedPermission' => \YoastSEO()->classes->get( Wistia_Embed_Permission_Repository::class )->get_value_for_user( \get_current_user_id() ),
[480] Fix | Delete
];
[481] Fix | Delete
[482] Fix | Delete
if ( \post_type_supports( $this->get_metabox_post()->post_type, 'thumbnail' ) ) {
[483] Fix | Delete
$this->asset_manager->enqueue_style( 'featured-image' );
[484] Fix | Delete
[485] Fix | Delete
$script_data['featuredImage'] = [
[486] Fix | Delete
'featured_image_notice' => \__( 'SEO issue: The featured image should be at least 200 by 200 pixels to be picked up by Facebook and other social media sites.', 'wordpress-seo' ),
[487] Fix | Delete
];
[488] Fix | Delete
}
[489] Fix | Delete
[490] Fix | Delete
$this->asset_manager->localize_script( 'elementor', 'wpseoScriptData', $script_data );
[491] Fix | Delete
$this->asset_manager->enqueue_user_language_script();
[492] Fix | Delete
}
[493] Fix | Delete
[494] Fix | Delete
/**
[495] Fix | Delete
* Renders the metabox hidden fields.
[496] Fix | Delete
*
[497] Fix | Delete
* @return void
[498] Fix | Delete
*/
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function