| @@ -1,11 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Base\Document; | |
| 5 | 4 | use Elementor\Core\DocumentTypes\PageBase; |
| 6 | 5 | use Elementor\TemplateLibrary\Source_Local; |
| 7 | -use Elementor\Utils; | |
| 8 | 6 | |
| 9 | 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | 8 | exit; // Exit if accessed directly. |
| 11 | 9 | } |
| @@ -34,9 +32,8 @@ | ||
| 34 | 32 | public static function register_actions() { |
| 35 | 33 | add_action( 'init', [ __CLASS__, 'init' ] ); |
| 36 | 34 | |
| 37 | 35 | self::polylang_compatibility(); |
| 38 | - self::yoast_duplicate_post(); | |
| 39 | 36 | |
| 40 | 37 | if ( is_admin() || defined( 'WP_LOAD_IMPORTERS' ) ) { |
| 41 | 38 | add_filter( 'wp_import_post_meta', [ __CLASS__, 'on_wp_import_post_meta' ] ); |
| 42 | 39 | add_filter( 'wxr_importer.pre_process.post_meta', [ __CLASS__, 'on_wxr_importer_pre_process_post_meta' ] ); |
| @@ -42,19 +39,10 @@ | ||
| 42 | 39 | add_filter( 'wxr_importer.pre_process.post_meta', [ __CLASS__, 'on_wxr_importer_pre_process_post_meta' ] ); |
| 43 | 40 | } |
| 44 | 41 | |
| 45 | 42 | add_action( 'elementor/maintenance_mode/mode_changed', [ __CLASS__, 'clear_3rd_party_cache' ] ); |
| 46 | - | |
| 47 | - // Enable floating buttons and link in bio experiment for all. | |
| 48 | - // TODO Remove in version 3.26. | |
| 49 | - add_filter( 'pre_option_elementor_experiment-floating-buttons', [ __CLASS__, 'return_active' ] ); | |
| 50 | - add_filter( 'pre_option_elementor_experiment-link-in-bio', [ __CLASS__, 'return_active' ] ); | |
| 51 | 43 | } |
| 52 | 44 | |
| 53 | - public static function return_active() { | |
| 54 | - return 'active'; | |
| 55 | - } | |
| 56 | - | |
| 57 | 45 | public static function clear_3rd_party_cache() { |
| 58 | 46 | // W3 Total Cache. |
| 59 | 47 | if ( function_exists( 'w3tc_flush_all' ) ) { |
| 60 | 48 | w3tc_flush_all(); |
| @@ -64,9 +52,9 @@ | ||
| 64 | 52 | if ( ! empty( $GLOBALS['wp_fastest_cache'] ) && method_exists( $GLOBALS['wp_fastest_cache'], 'deleteCache' ) ) { |
| 65 | 53 | $GLOBALS['wp_fastest_cache']->deleteCache(); |
| 66 | 54 | } |
| 67 | 55 | |
| 68 | - // WP Super Cache. | |
| 56 | + // WP Super Cache | |
| 69 | 57 | if ( function_exists( 'wp_cache_clean_cache' ) ) { |
| 70 | 58 | global $file_prefix; |
| 71 | 59 | wp_cache_clean_cache( $file_prefix, true ); |
| 72 | 60 | } |
| @@ -87,20 +75,20 @@ | ||
| 87 | 75 | if ( ! User::is_current_user_can_edit_post_type( $typenow ) ) { |
| 88 | 76 | return; |
| 89 | 77 | } |
| 90 | 78 | |
| 91 | - // Introduced in WP 5.0. | |
| 79 | + // Introduced in WP 5.0 | |
| 92 | 80 | if ( function_exists( 'use_block_editor_for_post' ) && ! use_block_editor_for_post( $typenow ) ) { |
| 93 | 81 | return; |
| 94 | 82 | } |
| 95 | 83 | |
| 96 | - // Deprecated/removed in Gutenberg plugin v5.3.0. | |
| 84 | + // Deprecated/removed in Gutenberg plugin v5.3.0 | |
| 97 | 85 | if ( function_exists( 'gutenberg_can_edit_post_type' ) && ! gutenberg_can_edit_post_type( $typenow ) ) { |
| 98 | 86 | return; |
| 99 | 87 | } |
| 100 | 88 | |
| 101 | 89 | ?> |
| 102 | - <script> | |
| 90 | + <script type="text/javascript"> | |
| 103 | 91 | document.addEventListener( 'DOMContentLoaded', function() { |
| 104 | 92 | var dropdown = document.querySelector( '#split-page-title-action .dropdown' ); |
| 105 | 93 | |
| 106 | 94 | if ( ! dropdown ) { |
| @@ -213,12 +201,12 @@ | ||
| 213 | 201 | remove_filter( 'pum_admin_var', [ $pum_admin_instance, 'pum_admin_var' ] ); |
| 214 | 202 | } ); |
| 215 | 203 | } |
| 216 | 204 | |
| 217 | - // Fix Preview URL for https://github.com/wpmudev/domain-mapping plugin. | |
| 205 | + // Fix Preview URL for https://github.com/wpmudev/domain-mapping plugin | |
| 218 | 206 | if ( class_exists( 'domain_map' ) ) { |
| 219 | 207 | add_filter( 'elementor/document/urls/preview', function( $preview_url ) { |
| 220 | - if ( wp_parse_url( $preview_url, PHP_URL_HOST ) !== Utils::get_super_global_value( $_SERVER, 'HTTP_HOST' ) ) { | |
| 208 | + if ( wp_parse_url( $preview_url, PHP_URL_HOST ) !== $_SERVER['HTTP_HOST'] ) { | |
| 221 | 209 | $preview_url = \domain_map::utils()->unswap_url( $preview_url ); |
| 222 | 210 | $preview_url = add_query_arg( [ |
| 223 | 211 | 'dm' => \Domainmap_Module_Mapping::BYPASS, |
| 224 | 212 | ], $preview_url ); |
| @@ -227,9 +215,9 @@ | ||
| 227 | 215 | return $preview_url; |
| 228 | 216 | } ); |
| 229 | 217 | } |
| 230 | 218 | |
| 231 | - // Gutenberg. | |
| 219 | + // Gutenberg | |
| 232 | 220 | if ( function_exists( 'gutenberg_init' ) ) { |
| 233 | 221 | add_action( 'admin_print_scripts-edit.php', [ __CLASS__, 'add_new_button_to_gutenberg' ], 11 ); |
| 234 | 222 | } |
| 235 | 223 | } |
| @@ -249,9 +237,9 @@ | ||
| 249 | 237 | * @access private |
| 250 | 238 | * @static |
| 251 | 239 | */ |
| 252 | 240 | private static function polylang_compatibility() { |
| 253 | - // Copy elementor data while polylang creates a translation copy. | |
| 241 | + // Copy elementor data while polylang creates a translation copy | |
| 254 | 242 | add_filter( 'pll_copy_post_metas', [ __CLASS__, 'save_polylang_meta' ], 10, 4 ); |
| 255 | 243 | } |
| 256 | 244 | |
| 257 | 245 | /** |
| @@ -278,29 +266,8 @@ | ||
| 278 | 266 | Plugin::$instance->db->copy_elementor_meta( $from, $to ); |
| 279 | 267 | } |
| 280 | 268 | |
| 281 | 269 | return $keys; |
| 282 | - } | |
| 283 | - | |
| 284 | - private static function yoast_duplicate_post() { | |
| 285 | - add_filter( 'duplicate_post_excludelist_filter', function( $meta_excludelist ) { | |
| 286 | - $exclude_list = [ | |
| 287 | - Document::TYPE_META_KEY, | |
| 288 | - '_elementor_page_assets', | |
| 289 | - '_elementor_controls_usage', | |
| 290 | - '_elementor_css', | |
| 291 | - '_elementor_screenshot', | |
| 292 | - ]; | |
| 293 | - | |
| 294 | - return array_merge( $meta_excludelist, $exclude_list ); | |
| 295 | - } ); | |
| 296 | - | |
| 297 | - add_action( 'duplicate_post_post_copy', function( $new_post_id, $post ) { | |
| 298 | - $original_template_type = get_post_meta( $post->ID, Document::TYPE_META_KEY, true ); | |
| 299 | - if ( ! empty( $original_template_type ) ) { | |
| 300 | - update_post_meta( $new_post_id, Document::TYPE_META_KEY, $original_template_type ); | |
| 301 | - } | |
| 302 | - }, 10, 2 ); | |
| 303 | 270 | } |
| 304 | 271 | |
| 305 | 272 | /** |
| 306 | 273 | * Process post meta before WP importer. |