Commit realizado el 12:13:52 08-04-2024
This commit is contained in:
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/assets/css/divi.css
vendored
Normal file
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/assets/css/divi.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/assets/js/divi-admin.js
vendored
Normal file
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/assets/js/divi-admin.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/assets/js/divi-iframe.js
vendored
Normal file
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/assets/js/divi-iframe.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/assets/js/divi.js
vendored
Normal file
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/assets/js/divi.js
vendored
Normal file
File diff suppressed because one or more lines are too long
61
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/class-divi-admin.php
vendored
Normal file
61
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/class-divi-admin.php
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Divi admin integration.
|
||||
*
|
||||
* @since TODO
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Core
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
namespace RankMath\Divi;
|
||||
|
||||
use RankMath\Traits\Hooker;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Divi class.
|
||||
*/
|
||||
class Divi_Admin {
|
||||
|
||||
use Hooker;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Intialize Divi admin.
|
||||
*/
|
||||
public function init() {
|
||||
$screen = get_current_screen();
|
||||
if ( 'toplevel_page_et_divi_options' === $screen->id ) {
|
||||
$this->action( 'admin_enqueue_scripts', 'enqueue_divi_admin_scripts' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts for Divi admin options screen.
|
||||
*/
|
||||
public function enqueue_divi_admin_scripts() {
|
||||
wp_enqueue_script(
|
||||
'rank-math-divi-admin',
|
||||
rank_math()->plugin_url() . 'includes/3rdparty/divi/assets/js/divi-admin.js',
|
||||
[
|
||||
'jquery',
|
||||
'react',
|
||||
'react-dom',
|
||||
'wp-components',
|
||||
'wp-element',
|
||||
'wp-i18n',
|
||||
'wp-polyfill',
|
||||
],
|
||||
rank_math()->version,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
355
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/class-divi.php
vendored
Normal file
355
wp-content/plugins/seo-by-rank-math/includes/3rdparty/divi/class-divi.php
vendored
Normal file
@@ -0,0 +1,355 @@
|
||||
<?php
|
||||
/**
|
||||
* Divi integration.
|
||||
*
|
||||
* @since 0.9.0
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Core
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
namespace RankMath\Divi;
|
||||
|
||||
use RankMath\KB;
|
||||
use RankMath\Helper;
|
||||
use RankMath\Helpers\Editor;
|
||||
use RankMath\Helpers\Str;
|
||||
use RankMath\Schema\DB as Schema_DB;
|
||||
use RankMath\Schema\Admin as Schema_Admin;
|
||||
use RankMath\Traits\Hooker;
|
||||
use RankMath\Admin\Metabox\Screen;
|
||||
use WP_Dependencies;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Divi class.
|
||||
*/
|
||||
class Divi {
|
||||
|
||||
use Hooker;
|
||||
|
||||
/**
|
||||
* Screen object.
|
||||
*
|
||||
* @var Screen
|
||||
*/
|
||||
private $screen;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->action( 'wp', 'init' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Intialize.
|
||||
*/
|
||||
public function init() {
|
||||
if ( ! $this->can_add_seo_tab() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->screen = new Screen();
|
||||
$this->screen->load_screen( 'post' );
|
||||
|
||||
$this->action( 'template_redirect', 'set_window_lodash', 0 );
|
||||
$this->action( 'wp_enqueue_scripts', 'register_rankmath_react' );
|
||||
$this->action( 'wp_enqueue_scripts', 'add_json_data', 0 );
|
||||
$this->action( 'wp_footer', 'footer_enqueue_scripts', 11 );
|
||||
remove_action( 'wp_footer', [ rank_math()->json, 'output' ], 0 );
|
||||
add_action( 'wp_footer', [ rank_math()->json, 'output' ], 11 );
|
||||
$this->filter( 'script_loader_tag', 'add_et_tag', 10, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the global lodash variable.
|
||||
*
|
||||
* Lodash's `noConflict` would prevent UnderscoreJS from taking over the underscore (_)
|
||||
* global variable. Because Underscore.js will later also be assigned to the underscore (_)
|
||||
* global this function should run as early as possible.
|
||||
*/
|
||||
public function set_window_lodash() {
|
||||
wp_register_script( 'rm-set-window-lodash', '', [ 'lodash' ], rank_math()->version, false );
|
||||
wp_enqueue_script( 'rm-set-window-lodash' );
|
||||
wp_add_inline_script(
|
||||
'rm-set-window-lodash',
|
||||
join(
|
||||
"\r\n ",
|
||||
[
|
||||
'window.isLodash = function() {',
|
||||
"if ( typeof window._ !== 'function' || typeof window._.forEach !== 'function' ) {",
|
||||
'return false;',
|
||||
'}',
|
||||
'var isLodash = true;',
|
||||
'window._.forEach(',
|
||||
"[ 'cloneDeep', 'at', 'add', 'ary', 'attempt' ],",
|
||||
'function( fn ) {',
|
||||
"if ( isLodash && typeof window._[ fn ] !== 'function' ) {",
|
||||
'isLodash = false;',
|
||||
'}',
|
||||
'}',
|
||||
');',
|
||||
'return isLodash;',
|
||||
'}',
|
||||
'if ( window.isLodash() ) { window.lodash = window._.noConflict(); }',
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register RankMath React and ReactDOM.
|
||||
*
|
||||
* Registers the native WP version of react with a custom handle for use in the
|
||||
* RankMath module. Divi builder dequeues and deregisters native WP react scripts
|
||||
* and replaces them with their own copy of React. Their copy might not be of the
|
||||
* same version as the one RankMath requires.
|
||||
*/
|
||||
public function register_rankmath_react() {
|
||||
$path = site_url( '/wp-includes/js/dist/vendor/' );
|
||||
$suffix = wp_scripts_get_suffix();
|
||||
wp_register_script( 'rm-react', "{$path}react{$suffix}.js", [ 'wp-polyfill', 'react' ], '16.13.1', true );
|
||||
wp_register_script( 'rm-react-dom', "{$path}react-dom{$suffix}.js", [ 'rm-react', 'react-dom' ], '16.13.1', true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add JSON data.
|
||||
*/
|
||||
public function add_json_data() {
|
||||
|
||||
if ( Helper::has_cap( 'onpage_snippet' ) ) {
|
||||
|
||||
// Schema.
|
||||
$schemas = $this->get_schema_data( get_the_ID() );
|
||||
Helper::add_json( 'schemas', $schemas );
|
||||
Helper::add_json( 'customSchemaImage', esc_url( rank_math()->plugin_url() . 'includes/modules/schema/assets/img/custom-schema-builder.jpg' ) );
|
||||
|
||||
// Trends.
|
||||
$trends_upgrade_link = KB::get( 'pro', 'Divi General Tab Trends' );
|
||||
Helper::add_json( 'trendsUpgradeLink', esc_url_raw( $trends_upgrade_link ) );
|
||||
Helper::add_json( 'trendsPreviewImage', esc_url( rank_math()->plugin_url() . 'assets/admin/img/trends-preview.jpg' ) );
|
||||
}
|
||||
|
||||
Helper::add_json(
|
||||
'api',
|
||||
[
|
||||
'root' => esc_url_raw( get_rest_url() ),
|
||||
'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
|
||||
]
|
||||
);
|
||||
|
||||
Helper::add_json(
|
||||
'keywordsApi',
|
||||
[
|
||||
'url' => 'https://api.rankmath.com/ltkw/v1/',
|
||||
]
|
||||
);
|
||||
|
||||
Helper::add_json( 'links', KB::get_links() );
|
||||
|
||||
Helper::add_json(
|
||||
'validationl10n',
|
||||
[
|
||||
'regexErrorDefault' => __( 'Please use the correct format.', 'rank-math' ),
|
||||
'requiredErrorDefault' => __( 'This field is required.', 'rank-math' ),
|
||||
'emailErrorDefault' => __( 'Please enter a valid email address.', 'rank-math' ),
|
||||
'urlErrorDefault' => __( 'Please enter a valid URL.', 'rank-math' ),
|
||||
]
|
||||
);
|
||||
|
||||
Helper::add_json( 'capitalizeTitle', Helper::get_settings( 'titles.capitalize_titles' ) );
|
||||
Helper::add_json( 'blogName', get_bloginfo( 'name' ) );
|
||||
|
||||
if ( is_admin_bar_showing() && Helper::has_cap( 'admin_bar' ) ) {
|
||||
Helper::add_json( 'objectID', get_the_ID() );
|
||||
Helper::add_json( 'objectType', 'post' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts.
|
||||
*/
|
||||
public function footer_enqueue_scripts() {
|
||||
/**
|
||||
* Allow other plugins to enqueue/dequeue admin styles or scripts before plugin assets.
|
||||
*/
|
||||
$this->do_action( 'admin/before_editor_scripts' );
|
||||
|
||||
$divi_deps = [
|
||||
'jquery',
|
||||
'lodash',
|
||||
'rm-react',
|
||||
'rm-react-dom',
|
||||
'rm-set-window-lodash',
|
||||
'et-dynamic-asset-helpers',
|
||||
'wp-api-fetch',
|
||||
'wp-block-editor',
|
||||
'wp-components',
|
||||
'wp-compose',
|
||||
'wp-core-data',
|
||||
'wp-data',
|
||||
'wp-element',
|
||||
'wp-hooks',
|
||||
'wp-media-utils',
|
||||
'rank-math-analyzer',
|
||||
'rank-math-app',
|
||||
];
|
||||
|
||||
if ( is_admin_bar_showing() && Helper::has_cap( 'admin_bar' ) ) {
|
||||
wp_enqueue_style( 'rank-math', rank_math()->assets() . 'css/rank-math.css', null, rank_math()->version );
|
||||
wp_enqueue_script( 'rank-math', rank_math()->assets() . 'js/rank-math.js', [ 'jquery' ], rank_math()->version, true );
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'rank-math-common', rank_math()->plugin_url() . 'assets/admin/css/common.css', null, rank_math()->version );
|
||||
wp_enqueue_style( 'wp-components' );
|
||||
wp_enqueue_style( 'rank-math-editor', rank_math()->plugin_url() . 'includes/3rdparty/divi/assets/css/divi.css', [], rank_math()->version );
|
||||
|
||||
wp_register_script( 'rank-math-analyzer', rank_math()->plugin_url() . 'assets/admin/js/analyzer.js', null, rank_math()->version, true );
|
||||
wp_enqueue_script( 'rank-math-editor', rank_math()->plugin_url() . 'includes/3rdparty/divi/assets/js/divi.js', $divi_deps, rank_math()->version, true );
|
||||
wp_enqueue_script( 'rank-math-divi-iframe', rank_math()->plugin_url() . 'includes/3rdparty/divi/assets/js/divi-iframe.js', [ 'jquery', 'lodash' ], rank_math()->version, true );
|
||||
|
||||
if ( Helper::is_module_active( 'rich-snippet' ) ) {
|
||||
wp_enqueue_style( 'rank-math-schema', rank_math()->plugin_url() . 'includes/modules/schema/assets/css/schema.css', [ 'wp-components' ], rank_math()->version );
|
||||
|
||||
wp_enqueue_script( 'rank-math-schema', rank_math()->plugin_url() . 'includes/modules/schema/assets/js/schema-gutenberg.js', [ 'rank-math-editor' ], rank_math()->version, true );
|
||||
wp_set_script_translations( 'rank-math-schema', 'rank-math', rank_math()->plugin_dir() . 'languages/' );
|
||||
}
|
||||
|
||||
rank_math()->variables->setup();
|
||||
rank_math()->variables->setup_json();
|
||||
|
||||
$this->screen->localize();
|
||||
|
||||
$this->print_react_containers();
|
||||
|
||||
/**
|
||||
* Allow other plugins to enqueue/dequeue admin styles or scripts after plugin assets.
|
||||
*/
|
||||
$this->do_action( 'admin/editor_scripts' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add et attributes to script tags.
|
||||
*
|
||||
* @param string $tag The <script> tag for the enqueued script.
|
||||
* @param string $handle The script's registered handle.
|
||||
* @param string $src The script's source URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function add_et_tag( $tag, $handle, $src ) {
|
||||
$script_handles = [
|
||||
'rm-react',
|
||||
'rm-react-dom',
|
||||
'lodash',
|
||||
'moment',
|
||||
'rank-math',
|
||||
'rank-math-analyzer',
|
||||
'rank-math-schema',
|
||||
'rank-math-editor',
|
||||
'rank-math-content-ai',
|
||||
'rank-math-app',
|
||||
// Scripts required by pro version.
|
||||
'wp-plugins',
|
||||
'jquery-ui-autocomplete',
|
||||
'rank-math-pro-editor',
|
||||
'rank-math-schema-pro',
|
||||
'rank-math-pro-schema-filters',
|
||||
'rank-math-pro-news',
|
||||
];
|
||||
|
||||
$exclude_handles = [
|
||||
'wp-util',
|
||||
'wp-backbone',
|
||||
'wp-plupload',
|
||||
'wp-mediaelement',
|
||||
'wp-color-picker',
|
||||
'wp-color-picker-alpha',
|
||||
'wp-embed',
|
||||
'wp-hooks',
|
||||
];
|
||||
|
||||
if ( in_array( $handle, $exclude_handles, true ) ) {
|
||||
return $tag;
|
||||
}
|
||||
|
||||
if ( Str::starts_with( 'wp-', $handle ) || in_array( $handle, $script_handles, true ) ) {
|
||||
// These tags load in parent window only, not in Divi iframe.
|
||||
return '<script type="text/javascript" src="' . $src . '" class="et_fb_ignore_iframe"></script>' . "\n"; // phpcs:ignore
|
||||
}
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print React containers onto the screen.
|
||||
*/
|
||||
public function print_react_containers() {
|
||||
echo '<div id="rank-math-rm-app-root" class="et_fb_ignore_iframe"></div>';
|
||||
echo '<div id="rank-math-rm-settings-bar-root" class="et_fb_ignore_iframe"></div>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can add SEO in Divi Page Builder.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function can_add_seo_tab() {
|
||||
if (
|
||||
! Helper::is_divi_frontend_editor() ||
|
||||
! defined( 'ET_BUILDER_PRODUCT_VERSION' ) ||
|
||||
! version_compare( '4.9.2', ET_BUILDER_PRODUCT_VERSION, 'le' )
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter to show/hide SEO Tab in Divi Editor.
|
||||
*/
|
||||
if ( ! $this->do_filter( 'divi/add_seo_tab', true ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$post_type = get_post_type();
|
||||
if ( $post_type && ! Helper::get_settings( 'titles.pt_' . $post_type . '_add_meta_box' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Editor::can_add_editor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Schema Data.
|
||||
*
|
||||
* @param int $post_id Post ID.
|
||||
*
|
||||
* @return array $schemas Schema Data.
|
||||
*/
|
||||
private function get_schema_data( $post_id ) {
|
||||
$schemas = Schema_DB::get_schemas( $post_id );
|
||||
if ( ! empty( $schemas ) || metadata_exists( 'post', $post_id, 'rank_math_rich_snippet' ) ) {
|
||||
return $schemas;
|
||||
}
|
||||
|
||||
$post_type = get_post_type( $post_id );
|
||||
$default_type = ucfirst( Helper::get_default_schema_type( $post_id ) );
|
||||
if ( ! $default_type ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$schemas['new-9999'] = [
|
||||
'@type' => $default_type,
|
||||
'metadata' => [
|
||||
'title' => Helper::sanitize_schema_title( $default_type ),
|
||||
'type' => 'template',
|
||||
'shortcode' => uniqid( 's-' ),
|
||||
'isPrimary' => true,
|
||||
],
|
||||
];
|
||||
|
||||
return $schemas;
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/elementor/assets/css/elementor.css
vendored
Normal file
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/elementor/assets/css/elementor.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/elementor/assets/js/elementor.js
vendored
Normal file
1
wp-content/plugins/seo-by-rank-math/includes/3rdparty/elementor/assets/js/elementor.js
vendored
Normal file
File diff suppressed because one or more lines are too long
213
wp-content/plugins/seo-by-rank-math/includes/3rdparty/elementor/class-elementor.php
vendored
Normal file
213
wp-content/plugins/seo-by-rank-math/includes/3rdparty/elementor/class-elementor.php
vendored
Normal file
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
/**
|
||||
* Elementor integration.
|
||||
*
|
||||
* @since 0.9.0
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Core
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
namespace RankMath\Elementor;
|
||||
|
||||
use RankMath\Helper;
|
||||
use RankMath\Traits\Hooker;
|
||||
use RankMath\Helpers\Editor;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Elementor class.
|
||||
*/
|
||||
class Elementor {
|
||||
|
||||
use Hooker;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->action( 'init', 'init' );
|
||||
$this->filter( 'rank_math/frontend/robots', 'robots' );
|
||||
$this->filter( 'rank_math/frontend/disable_integration', 'disable_frontend_integration' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Intialize.
|
||||
*/
|
||||
public function init() {
|
||||
if ( ! $this->can_add_seo_tab() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->action( 'elementor/editor/before_enqueue_scripts', 'enqueue' );
|
||||
add_action( 'elementor/editor/footer', [ rank_math()->json, 'output' ], 0 );
|
||||
$this->action( 'elementor/editor/footer', 'start_capturing', 0 );
|
||||
$this->action( 'elementor/editor/footer', 'end_capturing', 999 );
|
||||
$this->filter( 'rank_math/sitemap/content_before_parse_html_images', 'apply_builder_in_content', 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable frontend integration on Elementor Maintenance page.
|
||||
*
|
||||
* @since 1.0.91
|
||||
*
|
||||
* @param boolean $value Whether to run the frontend integration.
|
||||
*/
|
||||
public function disable_frontend_integration( $value ) {
|
||||
$mode = get_option( 'elementor_maintenance_mode_mode' );
|
||||
if ( ! in_array( $mode, [ 'maintenance', 'coming_soon' ], true ) ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ( ! get_option( 'elementor_maintenance_mode_template_id' ) ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$exclude_mode = get_option( 'elementor_maintenance_mode_exclude_mode', [] );
|
||||
if ( 'logged_in' === $exclude_mode && is_user_logged_in() ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ( 'custom' !== $exclude_mode ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$exclude_roles = get_option( 'elementor_maintenance_mode_exclude_roles', [] );
|
||||
$user = wp_get_current_user();
|
||||
$user_roles = $user->roles;
|
||||
|
||||
if ( is_multisite() && is_super_admin() ) {
|
||||
$user_roles[] = 'super_admin';
|
||||
}
|
||||
|
||||
$compare_roles = array_intersect( $user_roles, $exclude_roles );
|
||||
|
||||
return ! empty( $compare_roles ) ? $value : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start capturing buffer.
|
||||
*/
|
||||
public function start_capturing() {
|
||||
ob_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* End capturing buffer and add button.
|
||||
*/
|
||||
public function end_capturing() {
|
||||
$output = \ob_get_clean();
|
||||
$search = '/(<(div|button) class="elementor-component-tab elementor-panel-navigation-tab" data-tab="global">.*<\/(div|button)>)/m';
|
||||
$replace = '${1}<${2} class="elementor-component-tab elementor-panel-navigation-tab" data-tab="rank-math">SEO</${2}>';
|
||||
echo \preg_replace(
|
||||
$search,
|
||||
$replace,
|
||||
$output
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts.
|
||||
*/
|
||||
public function enqueue() {
|
||||
$deps = [
|
||||
'wp-core-data',
|
||||
'wp-components',
|
||||
'wp-block-editor',
|
||||
'wp-element',
|
||||
'wp-data',
|
||||
'wp-api-fetch',
|
||||
'wp-media-utils',
|
||||
'site-health',
|
||||
'rank-math-analyzer',
|
||||
'backbone-marionette',
|
||||
'elementor-common-modules',
|
||||
'rank-math-app',
|
||||
];
|
||||
|
||||
$mode = \Elementor\Core\Settings\Manager::get_settings_managers( 'editorPreferences' )->get_model()->get_settings( 'ui_theme' );
|
||||
wp_deregister_style( 'rank-math-editor' );
|
||||
|
||||
wp_enqueue_style( 'wp-components' );
|
||||
wp_enqueue_style( 'site-health' );
|
||||
wp_enqueue_style( 'rank-math-editor', rank_math()->plugin_url() . 'includes/3rdparty/elementor/assets/css/elementor.css', [ 'rank-math-common' ], rank_math()->version );
|
||||
$media_query = '';
|
||||
|
||||
$dark_styles = $this->do_filter(
|
||||
'elementor/dark_styles',
|
||||
[
|
||||
'rank-math-elementor-dark' => rank_math()->plugin_url() . 'includes/3rdparty/elementor/assets/css/elementor-dark.css',
|
||||
]
|
||||
);
|
||||
|
||||
if ( 'light' !== $mode ) {
|
||||
$media_query = 'auto' === $mode ? '(prefers-color-scheme: dark)' : 'all';
|
||||
foreach ( $dark_styles as $handle => $src ) {
|
||||
wp_enqueue_style( $handle, $src, [], rank_math()->version, $media_query );
|
||||
}
|
||||
}
|
||||
|
||||
Helper::add_json( 'elementorDarkMode', $dark_styles );
|
||||
|
||||
wp_enqueue_script( 'rank-math-editor', rank_math()->plugin_url() . 'includes/3rdparty/elementor/assets/js/elementor.js', $deps, rank_math()->version, true );
|
||||
rank_math()->variables->setup();
|
||||
rank_math()->variables->setup_json();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the post content before it is parsed for Sitmeap images..
|
||||
* Used to apply the Elementor page editor on the post content.
|
||||
*
|
||||
* @since 1.0.38
|
||||
*
|
||||
* @param string $content The post content.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return string The post content.
|
||||
*/
|
||||
public function apply_builder_in_content( $content, $post_id ) {
|
||||
if ( \Elementor\Plugin::$instance->db->is_built_with_elementor( $post_id ) ) {
|
||||
return \Elementor\Plugin::$instance->frontend->get_builder_content( $post_id );
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add SEO tab in Elementor Page Builder.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function can_add_seo_tab() {
|
||||
/**
|
||||
* Filter to show/hide SEO Tab in the Elementor Editor.
|
||||
*/
|
||||
if ( ! $this->do_filter( 'elementor/add_seo_tab', true ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$post_type = isset( $_GET['post'] ) ? get_post_type( $_GET['post'] ) : '';
|
||||
if ( $post_type && ! Helper::get_settings( 'titles.pt_' . $post_type . '_add_meta_box' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Editor::can_add_editor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Change robots for Elementor Templates pages
|
||||
*
|
||||
* @param array $robots Array of robots to sanitize.
|
||||
*
|
||||
* @return array Modified robots.
|
||||
*/
|
||||
public function robots( $robots ) {
|
||||
if ( is_singular( 'elementor_library' ) ) {
|
||||
$robots['index'] = 'noindex';
|
||||
$robots['follow'] = 'nofollow';
|
||||
}
|
||||
|
||||
return $robots;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user