PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.1
Elementor Website Builder – more than just a page builder v3.0.1
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / core / editor / editor.php

editor.php in Elementor Website Builder – more than just a page builder 3.0.1, at core/editor/editor.php

1,289 lines 39.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Core\Editor;
3
4 use Elementor\Api;
5 use Elementor\Core\Common\Modules\Ajax\Module;
6 use Elementor\Core\Common\Modules\Ajax\Module as Ajax;
7 use Elementor\Core\Debug\Loading_Inspection_Manager;
8 use Elementor\Core\Files\Assets\Files_Upload_Handler;
9 use Elementor\Core\Responsive\Responsive;
10 use Elementor\Core\Schemes\Manager as Schemes_Manager;
11 use Elementor\Core\Settings\Manager as SettingsManager;
12 use Elementor\Icons_Manager;
13 use Elementor\Plugin;
14 use Elementor\Settings;
15 use Elementor\Shapes;
16 use Elementor\TemplateLibrary\Source_Local;
17 use Elementor\Tools;
18 use Elementor\User;
19 use Elementor\Utils;
20 use Elementor\Core\Editor\Data;
21
22 if ( ! defined( 'ABSPATH' ) ) {
23 exit; // Exit if accessed directly.
24 }
25
26 /**
27 * Elementor editor.
28 *
29 * Elementor editor handler class is responsible for initializing Elementor
30 * editor and register all the actions needed to display the editor.
31 *
32 * @since 1.0.0
33 */
34 class Editor {
35
36 /**
37 * The nonce key for Elementor editor.
38 * @deprecated 2.3.0
39 */
40 const EDITING_NONCE_KEY = 'elementor-editing';
41
42 /**
43 * User capability required to access Elementor editor.
44 */
45 const EDITING_CAPABILITY = 'edit_posts';
46
47 /**
48 * Post ID.
49 *
50 * Holds the ID of the current post being edited.
51 *
52 * @since 1.0.0
53 * @access private
54 *
55 * @var int Post ID.
56 */
57 private $post_id;
58
59 /**
60 * Whether the edit mode is active.
61 *
62 * Used to determine whether we are in edit mode.
63 *
64 * @since 1.0.0
65 * @access private
66 *
67 * @var bool Whether the edit mode is active.
68 */
69 private $is_edit_mode;
70
71 /**
72 * @var Notice_Bar
73 */
74 public $notice_bar;
75
76 /**
77 * Init.
78 *
79 * Initialize Elementor editor. Registers all needed actions to run Elementor,
80 * removes conflicting actions etc.
81 *
82 * Fired by `admin_action_elementor` action.
83 *
84 * @since 1.0.0
85 * @access public
86 *
87 * @param bool $die Optional. Whether to die at the end. Default is `true`.
88 */
89 public function init( $die = true ) {
90 if ( empty( $_REQUEST['post'] ) ) {
91 return;
92 }
93
94 $this->set_post_id( absint( $_REQUEST['post'] ) );
95
96 if ( ! $this->is_edit_mode( $this->post_id ) ) {
97 return;
98 }
99
100 // BC: From 2.9.0, the editor shouldn't handle the global post / current document.
101 // Use requested id and not the global in order to avoid conflicts with plugins that changes the global post.
102 query_posts( [
103 'p' => $this->post_id,
104 'post_type' => get_post_type( $this->post_id ),
105 ] );
106
107 Plugin::$instance->db->switch_to_post( $this->post_id );
108
109 $document = Plugin::$instance->documents->get( $this->post_id );
110
111 Plugin::$instance->documents->switch_to_document( $document );
112
113 // Change mode to Builder
114 Plugin::$instance->db->set_is_elementor_page( $this->post_id );
115
116 // End BC.
117
118 Loading_Inspection_Manager::instance()->register_inspections();
119
120 // Send MIME Type header like WP admin-header.
121 @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
122
123 // Temp: Allow plugins to know that the editor route is ready. TODO: Remove on 2.7.3.
124 define( 'ELEMENTOR_EDITOR_USE_ROUTER', true );
125
126 add_filter( 'show_admin_bar', '__return_false' );
127
128 // Remove all WordPress actions
129 remove_all_actions( 'wp_head' );
130 remove_all_actions( 'wp_print_styles' );
131 remove_all_actions( 'wp_print_head_scripts' );
132 remove_all_actions( 'wp_footer' );
133
134 // Handle `wp_head`
135 add_action( 'wp_head', 'wp_enqueue_scripts', 1 );
136 add_action( 'wp_head', 'wp_print_styles', 8 );
137 add_action( 'wp_head', 'wp_print_head_scripts', 9 );
138 add_action( 'wp_head', 'wp_site_icon' );
139 add_action( 'wp_head', [ $this, 'editor_head_trigger' ], 30 );
140
141 // Handle `wp_footer`
142 add_action( 'wp_footer', 'wp_print_footer_scripts', 20 );
143 add_action( 'wp_footer', 'wp_auth_check_html', 30 );
144 add_action( 'wp_footer', [ $this, 'wp_footer' ] );
145
146 // Handle `wp_enqueue_scripts`
147 remove_all_actions( 'wp_enqueue_scripts' );
148
149 // Also remove all scripts hooked into after_wp_tiny_mce.
150 remove_all_actions( 'after_wp_tiny_mce' );
151
152 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ], 999999 );
153 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_styles' ], 999999 );
154
155 // Setup default heartbeat options
156 add_filter( 'heartbeat_settings', function( $settings ) {
157 $settings['interval'] = 15;
158 return $settings;
159 } );
160
161 // Tell to WP Cache plugins do not cache this request.
162 Utils::do_not_cache();
163
164 do_action( 'elementor/editor/init' );
165
166 $this->print_editor_template();
167
168 // From the action it's an empty string, from tests its `false`
169 if ( false !== $die ) {
170 die;
171 }
172 }
173
174 /**
175 * Retrieve post ID.
176 *
177 * Get the ID of the current post.
178 *
179 * @since 1.8.0
180 * @access public
181 *
182 * @return int Post ID.
183 */
184 public function get_post_id() {
185 return $this->post_id;
186 }
187
188 /**
189 * Redirect to new URL.
190 *
191 * Used as a fallback function for the old URL structure of Elementor page
192 * edit URL.
193 *
194 * Fired by `template_redirect` action.
195 *
196 * @since 1.6.0
197 * @access public
198 */
199 public function redirect_to_new_url() {
200 if ( ! isset( $_GET['elementor'] ) ) {
201 return;
202 }
203
204 $document = Plugin::$instance->documents->get( get_the_ID() );
205
206 if ( ! $document ) {
207 wp_die( __( 'Document not found.', 'elementor' ) );
208 }
209
210 if ( ! $document->is_editable_by_current_user() || ! $document->is_built_with_elementor() ) {
211 return;
212 }
213
214 wp_safe_redirect( $document->get_edit_url() );
215 die;
216 }
217
218 /**
219 * Whether the edit mode is active.
220 *
221 * Used to determine whether we are in the edit mode.
222 *
223 * @since 1.0.0
224 * @access public
225 *
226 * @param int $post_id Optional. Post ID. Default is `null`, the current
227 * post ID.
228 *
229 * @return bool Whether the edit mode is active.
230 */
231 public function is_edit_mode( $post_id = null ) {
232 if ( null !== $this->is_edit_mode ) {
233 return $this->is_edit_mode;
234 }
235
236 if ( empty( $post_id ) ) {
237 $post_id = $this->post_id;
238 }
239
240 $document = Plugin::$instance->documents->get( $post_id );
241
242 if ( ! $document || ! $document->is_editable_by_current_user() ) {
243 return false;
244 }
245
246 /** @var Module ajax */
247 $ajax_data = Plugin::$instance->common->get_component( 'ajax' )->get_current_action_data();
248
249 if ( ! empty( $ajax_data ) && 'get_document_config' === $ajax_data['action'] ) {
250 return true;
251 }
252
253 // Ajax request as Editor mode
254 $actions = [
255 'elementor',
256
257 // Templates
258 'elementor_get_templates',
259 'elementor_save_template',
260 'elementor_get_template',
261 'elementor_delete_template',
262 'elementor_import_template',
263 'elementor_library_direct_actions',
264 ];
265
266 if ( isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $actions ) ) {
267 return true;
268 }
269
270 return false;
271 }
272
273 /**
274 * Lock post.
275 *
276 * Mark the post as currently being edited by the current user.
277 *
278 * @since 1.0.0
279 * @access public
280 *
281 * @param int $post_id The ID of the post being edited.
282 */
283 public function lock_post( $post_id ) {
284 if ( ! function_exists( 'wp_set_post_lock' ) ) {
285 require_once ABSPATH . 'wp-admin/includes/post.php';
286 }
287
288 wp_set_post_lock( $post_id );
289 }
290
291 /**
292 * Get locked user.
293 *
294 * Check what user is currently editing the post.
295 *
296 * @since 1.0.0
297 * @access public
298 *
299 * @param int $post_id The ID of the post being edited.
300 *
301 * @return \WP_User|false User information or false if the post is not locked.
302 */
303 public function get_locked_user( $post_id ) {
304 if ( ! function_exists( 'wp_check_post_lock' ) ) {
305 require_once ABSPATH . 'wp-admin/includes/post.php';
306 }
307
308 $locked_user = wp_check_post_lock( $post_id );
309 if ( ! $locked_user ) {
310 return false;
311 }
312
313 return get_user_by( 'id', $locked_user );
314 }
315
316 /**
317 * Print Editor Template.
318 *
319 * Include the wrapper template of the editor.
320 *
321 * @since 2.2.0
322 * @access public
323 */
324 public function print_editor_template() {
325 include ELEMENTOR_PATH . 'includes/editor-templates/editor-wrapper.php';
326 }
327
328 /**
329 * Enqueue scripts.
330 *
331 * Registers all the editor scripts and enqueues them.
332 *
333 * @since 1.0.0
334 * @access public
335 */
336 public function enqueue_scripts() {
337 remove_action( 'wp_enqueue_scripts', [ $this, __FUNCTION__ ], 999999 );
338
339 global $wp_styles, $wp_scripts;
340
341 $plugin = Plugin::$instance;
342
343 // Reset global variable
344 $wp_styles = new \WP_Styles(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
345 $wp_scripts = new \WP_Scripts(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
346
347 $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined( 'ELEMENTOR_TESTS' ) && ELEMENTOR_TESTS ) ? '' : '.min';
348
349 wp_register_script(
350 'elementor-editor-modules',
351 ELEMENTOR_ASSETS_URL . 'js/editor-modules' . $suffix . '.js',
352 [
353 'elementor-common-modules',
354 ],
355 ELEMENTOR_VERSION,
356 true
357 );
358
359 wp_register_script(
360 'elementor-editor-document',
361 ELEMENTOR_ASSETS_URL . 'js/editor-document' . $suffix . '.js',
362 [
363 'elementor-common-modules',
364 ],
365 ELEMENTOR_VERSION,
366 true
367 );
368 // Hack for waypoint with editor mode.
369 wp_register_script(
370 'elementor-waypoints',
371 ELEMENTOR_ASSETS_URL . 'lib/waypoints/waypoints-for-editor.js',
372 [
373 'jquery',
374 ],
375 '4.0.2',
376 true
377 );
378
379 wp_register_script(
380 'perfect-scrollbar',
381 ELEMENTOR_ASSETS_URL . 'lib/perfect-scrollbar/js/perfect-scrollbar' . $suffix . '.js',
382 [],
383 '1.4.0',
384 true
385 );
386
387 wp_register_script(
388 'jquery-easing',
389 ELEMENTOR_ASSETS_URL . 'lib/jquery-easing/jquery-easing' . $suffix . '.js',
390 [
391 'jquery',
392 ],
393 '1.3.2',
394 true
395 );
396
397 wp_register_script(
398 'nprogress',
399 ELEMENTOR_ASSETS_URL . 'lib/nprogress/nprogress' . $suffix . '.js',
400 [],
401 '0.2.0',
402 true
403 );
404
405 wp_register_script(
406 'tipsy',
407 ELEMENTOR_ASSETS_URL . 'lib/tipsy/tipsy' . $suffix . '.js',
408 [
409 'jquery',
410 ],
411 '1.0.0',
412 true
413 );
414
415 wp_register_script(
416 'jquery-elementor-select2',
417 ELEMENTOR_ASSETS_URL . 'lib/e-select2/js/e-select2.full' . $suffix . '.js',
418 [
419 'jquery',
420 ],
421 '4.0.6-rc.1',
422 true
423 );
424
425 wp_register_script(
426 'flatpickr',
427 ELEMENTOR_ASSETS_URL . 'lib/flatpickr/flatpickr' . $suffix . '.js',
428 [
429 'jquery',
430 ],
431 '1.12.0',
432 true
433 );
434
435 wp_register_script(
436 'ace',
437 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.5/ace.js',
438 [],
439 '1.2.5',
440 true
441 );
442
443 wp_register_script(
444 'ace-language-tools',
445 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.5/ext-language_tools.js',
446 [
447 'ace',
448 ],
449 '1.2.5',
450 true
451 );
452
453 wp_register_script(
454 'jquery-hover-intent',
455 ELEMENTOR_ASSETS_URL . 'lib/jquery-hover-intent/jquery-hover-intent' . $suffix . '.js',
456 [],
457 '1.0.0',
458 true
459 );
460
461 wp_register_script(
462 'nouislider',
463 ELEMENTOR_ASSETS_URL . 'lib/nouislider/nouislider' . $suffix . '.js',
464 [],
465 '13.0.0',
466 true
467 );
468
469 wp_register_script(
470 'pickr',
471 ELEMENTOR_ASSETS_URL . 'lib/pickr/pickr.min.js',
472 [],
473 '1.5.0',
474 true
475 );
476
477 wp_register_script(
478 'elementor-editor',
479 ELEMENTOR_ASSETS_URL . 'js/editor' . $suffix . '.js',
480 [
481 'elementor-common',
482 'elementor-editor-modules',
483 'elementor-editor-document',
484 'wp-auth-check',
485 'jquery-ui-sortable',
486 'jquery-ui-resizable',
487 'perfect-scrollbar',
488 'nprogress',
489 'tipsy',
490 'imagesloaded',
491 'heartbeat',
492 'jquery-elementor-select2',
493 'flatpickr',
494 'ace',
495 'ace-language-tools',
496 'jquery-hover-intent',
497 'nouislider',
498 'pickr',
499 'react',
500 'react-dom',
501 ],
502 ELEMENTOR_VERSION,
503 true
504 );
505
506 /**
507 * Before editor enqueue scripts.
508 *
509 * Fires before Elementor editor scripts are enqueued.
510 *
511 * @since 1.0.0
512 */
513 do_action( 'elementor/editor/before_enqueue_scripts' );
514
515 // Tweak for WP Admin menu icons
516 wp_print_styles( 'editor-buttons' );
517
518 $page_title_selector = Plugin::$instance->kits_manager->get_current_settings( 'page_title_selector' );
519
520 $page_title_selector .= ', .elementor-page-title';
521
522 $settings = SettingsManager::get_settings_managers_config();
523 // Moved to document since 2.9.0.
524 unset( $settings['page'] );
525
526 $document = Plugin::$instance->documents->get_doc_or_auto_save( $this->post_id );
527 $kits_manager = Plugin::$instance->kits_manager;
528
529 $config = [
530 'initial_document' => $document->get_config(),
531 'version' => ELEMENTOR_VERSION,
532 'home_url' => home_url(),
533 'admin_settings_url' => admin_url( 'admin.php?page=' . Settings::PAGE_ID ),
534 'autosave_interval' => AUTOSAVE_INTERVAL,
535 'tabs' => $plugin->controls_manager->get_tabs(),
536 'controls' => $plugin->controls_manager->get_controls_data(),
537 'elements' => $plugin->elements_manager->get_element_types_config(),
538 'schemes' => [
539 'items' => $plugin->schemes_manager->get_registered_schemes_data(),
540 'enabled_schemes' => Schemes_Manager::get_enabled_schemes(),
541 ],
542 'globals' => [
543 'defaults_enabled' => [
544 'colors' => $kits_manager->is_custom_colors_enabled(),
545 'typography' => $kits_manager->is_custom_typography_enabled(),
546 ],
547 ],
548 'icons' => [
549 'libraries' => Icons_Manager::get_icon_manager_tabs_config(),
550 'goProURL' => Utils::get_pro_link( 'https://elementor.com/pro/?utm_source=icon-library&utm_campaign=gopro&utm_medium=wp-dash' ),
551 ],
552 'filesUpload' => [
553 'unfilteredFiles' => Files_Upload_Handler::is_enabled(),
554 ],
555 'fa4_to_fa5_mapping_url' => ELEMENTOR_ASSETS_URL . 'lib/font-awesome/migration/mapping.js',
556 'default_schemes' => $plugin->schemes_manager->get_schemes_defaults(),
557 'settings' => $settings,
558 'system_schemes' => $plugin->schemes_manager->get_system_schemes(),
559 'wp_editor' => $this->get_wp_editor_config(),
560 'settings_page_link' => Settings::get_url(),
561 'tools_page_link' => Tools::get_url(),
562 'elementor_site' => 'https://go.elementor.com/about-elementor/',
563 'docs_elementor_site' => 'https://go.elementor.com/docs/',
564 'help_the_content_url' => 'https://go.elementor.com/the-content-missing/',
565 'help_right_click_url' => 'https://go.elementor.com/meet-right-click/',
566 'help_flexbox_bc_url' => 'https://go.elementor.com/flexbox-layout-bc/',
567 'elementPromotionURL' => 'https://go.elementor.com/go-pro-%s',
568 'dynamicPromotionURL' => 'https://go.elementor.com/go-pro-dynamic-tag',
569 'additional_shapes' => Shapes::get_additional_shapes_for_config(),
570 'user' => [
571 'restrictions' => $plugin->role_manager->get_user_restrictions_array(),
572 'is_administrator' => current_user_can( 'manage_options' ),
573 'introduction' => User::get_introduction_meta(),
574 ],
575 'preview' => [
576 'help_preview_error_url' => 'https://go.elementor.com/preview-not-loaded/',
577 'help_preview_http_error_url' => 'https://go.elementor.com/preview-not-loaded/#permissions',
578 'help_preview_http_error_500_url' => 'https://go.elementor.com/500-error/',
579 'debug_data' => Loading_Inspection_Manager::instance()->run_inspections(),
580 ],
581 'locale' => get_locale(),
582 'rich_editing_enabled' => filter_var( get_user_meta( get_current_user_id(), 'rich_editing', true ), FILTER_VALIDATE_BOOLEAN ),
583 'page_title_selector' => $page_title_selector,
584 'tinymceHasCustomConfig' => class_exists( 'Tinymce_Advanced' ),
585 'inlineEditing' => Plugin::$instance->widgets_manager->get_inline_editing_config(),
586 'dynamicTags' => Plugin::$instance->dynamic_tags->get_config(),
587 'ui' => [
588 'darkModeStylesheetURL' => ELEMENTOR_ASSETS_URL . 'css/editor-dark-mode' . $suffix . '.css',
589 ],
590 // Legacy Mode - for backwards compatibility of older HTML markup.
591 'legacyMode' => [
592 'elementWrappers' => Plugin::instance()->get_legacy_mode( 'elementWrappers' ),
593 ],
594 'i18n' => [
595 'elementor' => __( 'Elementor', 'elementor' ),
596 'edit' => __( 'Edit', 'elementor' ),
597 'delete' => __( 'Delete', 'elementor' ),
598 'cancel' => __( 'Cancel', 'elementor' ),
599 'clear' => __( 'Clear', 'elementor' ),
600 'done' => __( 'Done', 'elementor' ),
601 'got_it' => __( 'Got It', 'elementor' ),
602 /* translators: %s: Element type. */
603 'add_element' => __( 'Add %s', 'elementor' ),
604 /* translators: %s: Element name. */
605 'edit_element' => __( 'Edit %s', 'elementor' ),
606 /* translators: %s: Element type. */
607 'duplicate_element' => __( 'Duplicate %s', 'elementor' ),
608 /* translators: %s: Element type. */
609 'delete_element' => __( 'Delete %s', 'elementor' ),
610 'flexbox_attention_header' => __( 'Note: Flexbox Changes', 'elementor' ),
611 'flexbox_attention_message' => __( 'Elementor 2.5 introduces key changes to the layout using CSS Flexbox. Your existing pages might have been affected, please review your page before publishing.', 'elementor' ),
612 'saved_colors' => __( 'Saved Colors', 'elementor' ),
613 'drag_to_delete' => __( 'Drag To Delete', 'elementor' ),
614 'color_picker' => __( 'Color Picker', 'elementor' ),
615
616 // Global Styles
617 'add_picked_color' => __( 'Add Picked Color', 'elementor' ),
618 'new_global_color' => __( 'New Global Color', 'elementor' ),
619 'global_colors_title' => __( 'Global Colors', 'elementor' ),
620 'manage_global_colors' => __( 'Manage Global Colors', 'elementor' ),
621 'create_global_color' => __( 'Create New Global Color', 'elementor' ),
622 'delete_global_color' => __( 'Delete Global Color', 'elementor' ),
623 'delete_global_color_info' => __( 'You\'re about to delete a Global Color. Note that if it\'s being used anywhere on your site, it will inherit a default color.', 'elementor' ),
624 'global_colors_info' => __( 'Global Colors help you work smarter. Save a color, and use it anywhere throughout your site. Access and edit your global colors by clicking the Manage button.', 'elementor' ),
625 'typography' => __( 'Typography', 'elementor' ),
626 'new_typography_setting' => __( 'New Typography Setting', 'elementor' ),
627 'global_fonts_title' => __( 'Global Fonts', 'elementor' ),
628 'manage_global_fonts' => __( 'Manage Global Fonts', 'elementor' ),
629 'create_global_font' => __( 'Create New Global Font', 'elementor' ),
630 'delete_global_font' => __( 'Delete Global Font', 'elementor' ),
631 'delete_global_font_info' => __( 'You\'re about to delete a Global Font. Note that if it\'s being used anywhere on your site, it will inherit a default typography.', 'elementor' ),
632 'global_fonts_info' => __( 'Global Fonts help you work smarter. Save a Typography, and use it anywhere throughout your site. Access and edit your Global Fonts by clicking the Manage button.', 'elementor' ),
633 'default' => __( 'Default', 'elementor' ),
634 'create' => __( 'Create', 'elementor' ),
635 'global_color_confirm_text' => __( 'Are you sure you want to create a new Global Color?', 'elementor' ),
636 'global_color_already_exists' => __( 'Please note that the same exact color already exists in your Global Colors list. Are you sure you want to create it?', 'elementor' ),
637 'global_color_name_already_exists' => __( 'Please note that a color with the same exact name already exists in your Global Colors list. Are you sure you want to create it?', 'elementor' ),
638 'global_fonts_confirm_text' => __( 'Are you sure you want to create a new Global Font setting?', 'elementor' ),
639 'custom' => __( 'Custom', 'elementor' ),
640
641 // Menu.
642 'about_elementor' => __( 'About Elementor', 'elementor' ),
643 'elementor_settings' => __( 'Dashboard Settings', 'elementor' ),
644 'site_settings' => __( 'Site Settings', 'elementor' ),
645 'theme_builder' => __( 'Theme Builder', 'elementor' ),
646 'user_preferences' => __( 'User Preferences', 'elementor' ),
647 'settings' => __( 'Settings', 'elementor' ),
648 'more' => __( 'More', 'elementor' ),
649 'navigate_from_page' => __( 'Navigate From Page', 'elementor' ),
650 'view_page' => __( 'View Page', 'elementor' ),
651 'exit_to_dashboard' => __( 'Exit To Dashboard', 'elementor' ),
652
653 // Elements.
654 'inner_section' => __( 'Inner Section', 'elementor' ),
655
656 // Control Order.
657 'asc' => __( 'Ascending order', 'elementor' ),
658 'desc' => __( 'Descending order', 'elementor' ),
659
660 // Clear Page.
661 'clear_page' => __( 'Delete All Content', 'elementor' ),
662 'dialog_confirm_clear_page' => __( 'Attention: We are going to DELETE ALL CONTENT from this page. Are you sure you want to do that?', 'elementor' ),
663
664 // Enable unfiltered file uploads.
665 'enable_unfiltered_files_upload' => __( 'Enable Unfiltered File Uploads', 'elementor' ),
666 'dialog_confirm_enable_unfiltered_files_upload' => __( 'Before you enable unfiltered files upload, note that this kind of files include a security risk. Elementor does run a process to remove possible malicious code, but there is still risk involved when using such files.', 'elementor' ),
667
668 // Enable fontawesome 5 if needed.
669 'enable_fa5' => __( 'Elementor\'s New Icon Library', 'elementor' ),
670 'dialog_confirm_enable_fa5' => __( 'Elementor v2.6 includes an upgrade from Font Awesome 4 to 5. In order to continue using icons, be sure to click "Upgrade".', 'elementor' ) . ' <a href="https://go.elementor.com/fontawesome-migration/" target="_blank">' . __( 'Learn More', 'elementor' ) . '</a>',
671
672 // Panel Preview Mode.
673 'back_to_editor' => __( 'Show Panel', 'elementor' ),
674 'preview' => __( 'Hide Panel', 'elementor' ),
675
676 // Inline Editing.
677 'type_here' => __( 'Type Here', 'elementor' ),
678
679 // Library.
680 'an_error_occurred' => __( 'An error occurred', 'elementor' ),
681 'category' => __( 'Category', 'elementor' ),
682 'delete_template' => __( 'Delete Template', 'elementor' ),
683 'delete_template_confirm' => __( 'Are you sure you want to delete this template?', 'elementor' ),
684 'import_template_dialog_header' => __( 'Import Document Settings', 'elementor' ),
685 'import_template_dialog_message' => __( 'Do you want to also import the document settings of the template?', 'elementor' ),
686 'import_template_dialog_message_attention' => __( 'Attention: Importing may override previous settings.', 'elementor' ),
687 'library' => __( 'Library', 'elementor' ),
688 'no' => __( 'No', 'elementor' ),
689 'page' => __( 'Page', 'elementor' ),
690 /* translators: %s: Template type. */
691 'save_your_template' => __( 'Save Your %s to Library', 'elementor' ),
692 'save_your_template_description' => __( 'Your designs will be available for export and reuse on any page or website', 'elementor' ),
693 'section' => __( 'Section', 'elementor' ),
694 'templates_empty_message' => __( 'This is where your templates should be. Design it. Save it. Reuse it.', 'elementor' ),
695 'templates_empty_title' => __( 'Haven’t Saved Templates Yet?', 'elementor' ),
696 'templates_no_favorites_message' => __( 'You can mark any pre-designed template as a favorite.', 'elementor' ),
697 'templates_no_favorites_title' => __( 'No Favorite Templates', 'elementor' ),
698 'templates_no_results_message' => __( 'Please make sure your search is spelled correctly or try a different words.', 'elementor' ),
699 'templates_no_results_title' => __( 'No Results Found', 'elementor' ),
700 'templates_request_error' => __( 'The following error(s) occurred while processing the request:', 'elementor' ),
701 'yes' => __( 'Yes', 'elementor' ),
702 'blocks' => __( 'Blocks', 'elementor' ),
703 'pages' => __( 'Pages', 'elementor' ),
704 'my_templates' => __( 'My Templates', 'elementor' ),
705
706 // Incompatible Device.
707 'device_incompatible_header' => __( 'Your browser isn\'t compatible', 'elementor' ),
708 'device_incompatible_message' => __( 'Your browser isn\'t compatible with all of Elementor\'s editing features. We recommend you switch to another browser like Chrome or Firefox.', 'elementor' ),
709 'proceed_anyway' => __( 'Proceed Anyway', 'elementor' ),
710
711 // Preview not loaded.
712 'learn_more' => __( 'Learn More', 'elementor' ),
713 'preview_el_not_found_header' => __( 'Sorry, the content area was not found in your page.', 'elementor' ),
714 'preview_el_not_found_message' => __( 'You must call \'the_content\' function in the current template, in order for Elementor to work on this page.', 'elementor' ),
715
716 // Gallery.
717 'delete_gallery' => __( 'Reset Gallery', 'elementor' ),
718 'dialog_confirm_gallery_delete' => __( 'Are you sure you want to reset this gallery?', 'elementor' ),
719 /* translators: %s: The number of images. */
720 'gallery_images_selected' => __( '%s Images Selected', 'elementor' ),
721 'gallery_no_images_selected' => __( 'No Images Selected', 'elementor' ),
722 'insert_media' => __( 'Insert Media', 'elementor' ),
723
724 // Take Over.
725 /* translators: %s: User name. */
726 'dialog_user_taken_over' => __( '%s has taken over and is currently editing. Do you want to take over this page editing?', 'elementor' ),
727 'go_back' => __( 'Go Back', 'elementor' ),
728 'take_over' => __( 'Take Over', 'elementor' ),
729
730 // Revisions.
731 /* translators: %s: Template type. */
732 'dialog_confirm_delete' => __( 'Are you sure you want to remove this %s?', 'elementor' ),
733
734 // Saver.
735 'before_unload_alert' => __( 'Please note: All unsaved changes will be lost.', 'elementor' ),
736 'published' => __( 'Published', 'elementor' ),
737 'publish' => __( 'Publish', 'elementor' ),
738 'save' => __( 'Save', 'elementor' ),
739 'saved' => __( 'Saved', 'elementor' ),
740 'update' => __( 'Update', 'elementor' ),
741 'enable' => __( 'Enable', 'elementor' ),
742 'submit' => __( 'Submit', 'elementor' ),
743 'working_on_draft_notification' => __( 'This is just a draft. Play around and when you\'re done - click update.', 'elementor' ),
744 'keep_editing' => __( 'Keep Editing', 'elementor' ),
745 'have_a_look' => __( 'Have a look', 'elementor' ),
746 'view_all_revisions' => __( 'View All Revisions', 'elementor' ),
747 'dismiss' => __( 'Dismiss', 'elementor' ),
748 'saving_disabled' => __( 'Saving has been disabled until you’re reconnected.', 'elementor' ),
749
750 // Ajax
751 'server_error' => __( 'Server Error', 'elementor' ),
752 'server_connection_lost' => __( 'Connection Lost', 'elementor' ),
753 'unknown_error' => __( 'Unknown Error', 'elementor' ),
754
755 // Context Menu
756 'duplicate' => __( 'Duplicate', 'elementor' ),
757 'copy' => __( 'Copy', 'elementor' ),
758 'paste' => __( 'Paste', 'elementor' ),
759 'copy_style' => __( 'Copy Style', 'elementor' ),
760 'paste_style' => __( 'Paste Style', 'elementor' ),
761 'reset_style' => __( 'Reset Style', 'elementor' ),
762 'save_as_global' => __( 'Save as a Global', 'elementor' ),
763 'save_as_block' => __( 'Save as Template', 'elementor' ),
764 'new_column' => __( 'Add New Column', 'elementor' ),
765 'copy_all_content' => __( 'Copy All Content', 'elementor' ),
766 'delete_all_content' => __( 'Delete All Content', 'elementor' ),
767 'navigator' => __( 'Navigator', 'elementor' ),
768
769 // Right Click Introduction
770 'meet_right_click_header' => __( 'Meet Right Click', 'elementor' ),
771 'meet_right_click_message' => __( 'Now you can access all editing actions using right click.', 'elementor' ),
772
773 // Hotkeys screen
774 'keyboard_shortcuts' => __( 'Keyboard Shortcuts', 'elementor' ),
775
776 // Deprecated Control
777 'deprecated_notice' => __( 'The <strong>%1$s</strong> widget has been deprecated since %2$s %3$s.', 'elementor' ),
778 'deprecated_notice_replacement' => __( 'It has been replaced by <strong>%1$s</strong>.', 'elementor' ),
779 'deprecated_notice_last' => __( 'Note that %1$s will be completely removed once %2$s %3$s is released.', 'elementor' ),
780
781 //Preview Debug
782 'preview_debug_link_text' => __( 'Click here for preview debug', 'elementor' ),
783
784 'icon_library' => __( 'Icon Library', 'elementor' ),
785 'my_libraries' => __( 'My Libraries', 'elementor' ),
786 'upload' => __( 'Upload', 'elementor' ),
787 'icons_promotion' => __( 'Become a Pro user to upload unlimited font icon folders to your website.', 'elementor' ),
788 'go_pro' => __( 'Go Pro', 'elementor' ),
789 'custom_positioning' => __( 'Custom Positioning', 'elementor' ),
790
791 'element_promotion_dialog_header' => __( '%s Widget', 'elementor' ),
792 'element_promotion_dialog_message' => __( 'Use %s widget and dozens more pro features to extend your toolbox and build sites faster and better.', 'elementor' ),
793 'see_it_in_action' => __( 'See it in Action', 'elementor' ),
794 'dynamic_content' => __( 'Dynamic Content', 'elementor' ),
795 'dynamic_promotion_message' => __( 'Create more personalized and dynamic sites by populating data from various sources with dozens of dynamic tags to choose from.', 'elementor' ),
796
797 // TODO: Remove.
798 'autosave' => __( 'Autosave', 'elementor' ),
799 'elementor_docs' => __( 'Documentation', 'elementor' ),
800 'reload_page' => __( 'Reload Page', 'elementor' ),
801 'session_expired_header' => __( 'Timeout', 'elementor' ),
802 'session_expired_message' => __( 'Your session has expired. Please reload the page to continue editing.', 'elementor' ),
803 'soon' => __( 'Soon', 'elementor' ),
804 'unknown_value' => __( 'Unknown Value', 'elementor' ),
805 ],
806 ];
807
808 if ( ! Utils::has_pro() && current_user_can( 'manage_options' ) ) {
809 $config['promotionWidgets'] = Api::get_promotion_widgets();
810 }
811
812 $this->bc_move_document_filters();
813
814 /**
815 * Localize editor settings.
816 *
817 * Filters the editor localized settings.
818 *
819 * @since 1.0.0
820 *
821 * @param array $config Editor configuration.
822 * @param int $post_id The ID of the current post being edited.
823 */
824 $config = apply_filters( 'elementor/editor/localize_settings', $config );
825
826 Utils::print_js_config( 'elementor-editor', 'ElementorConfig', $config );
827
828 wp_enqueue_script( 'elementor-editor' );
829
830 $plugin->controls_manager->enqueue_control_scripts();
831
832 /**
833 * After editor enqueue scripts.
834 *
835 * Fires after Elementor editor scripts are enqueued.
836 *
837 * @since 1.0.0
838 */
839 do_action( 'elementor/editor/after_enqueue_scripts' );
840 }
841
842 /**
843 * Enqueue styles.
844 *
845 * Registers all the editor styles and enqueues them.
846 *
847 * @since 1.0.0
848 * @access public
849 */
850 public function enqueue_styles() {
851 /**
852 * Before editor enqueue styles.
853 *
854 * Fires before Elementor editor styles are enqueued.
855 *
856 * @since 1.0.0
857 */
858 do_action( 'elementor/editor/before_enqueue_styles' );
859
860 $suffix = Utils::is_script_debug() ? '' : '.min';
861
862 $direction_suffix = is_rtl() ? '-rtl' : '';
863
864 wp_register_style(
865 'font-awesome',
866 ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/font-awesome' . $suffix . '.css',
867 [],
868 '4.7.0'
869 );
870
871 wp_register_style(
872 'elementor-select2',
873 ELEMENTOR_ASSETS_URL . 'lib/e-select2/css/e-select2' . $suffix . '.css',
874 [],
875 '4.0.6-rc.1'
876 );
877
878 wp_register_style(
879 'google-font-roboto',
880 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700',
881 [],
882 ELEMENTOR_VERSION
883 );
884
885 wp_register_style(
886 'flatpickr',
887 ELEMENTOR_ASSETS_URL . 'lib/flatpickr/flatpickr' . $suffix . '.css',
888 [],
889 '1.12.0'
890 );
891
892 wp_register_style(
893 'pickr',
894 ELEMENTOR_ASSETS_URL . 'lib/pickr/themes/monolith.min.css',
895 [],
896 '1.5.0'
897 );
898
899 wp_register_style(
900 'elementor-editor',
901 ELEMENTOR_ASSETS_URL . 'css/editor' . $direction_suffix . $suffix . '.css',
902 [
903 'elementor-common',
904 'elementor-select2',
905 'elementor-icons',
906 'wp-auth-check',
907 'google-font-roboto',
908 'flatpickr',
909 'pickr',
910 ],
911 ELEMENTOR_VERSION
912 );
913
914 wp_enqueue_style( 'elementor-editor' );
915
916 $ui_theme = SettingsManager::get_settings_managers( 'editorPreferences' )->get_model()->get_settings( 'ui_theme' );
917
918 if ( 'light' !== $ui_theme ) {
919 $ui_theme_media_queries = 'all';
920
921 if ( 'auto' === $ui_theme ) {
922 $ui_theme_media_queries = '(prefers-color-scheme: dark)';
923 }
924
925 wp_enqueue_style(
926 'elementor-editor-dark-mode',
927 ELEMENTOR_ASSETS_URL . 'css/editor-dark-mode' . $suffix . '.css',
928 [
929 'elementor-editor',
930 ],
931 ELEMENTOR_VERSION,
932 $ui_theme_media_queries
933 );
934 }
935
936 if ( Responsive::has_custom_breakpoints() ) {
937 $breakpoints = Responsive::get_breakpoints();
938
939 wp_add_inline_style( 'elementor-editor', '.elementor-device-tablet #elementor-preview-responsive-wrapper { width: ' . $breakpoints['md'] . 'px; }' );
940 }
941
942 /**
943 * After editor enqueue styles.
944 *
945 * Fires after Elementor editor styles are enqueued.
946 *
947 * @since 1.0.0
948 */
949 do_action( 'elementor/editor/after_enqueue_styles' );
950 }
951
952 /**
953 * Get WordPress editor config.
954 *
955 * Config the default WordPress editor with custom settings for Elementor use.
956 *
957 * @since 1.9.0
958 * @access private
959 */
960 private function get_wp_editor_config() {
961 // Remove all TinyMCE plugins.
962 remove_all_filters( 'mce_buttons', 10 );
963 remove_all_filters( 'mce_external_plugins', 10 );
964
965 if ( ! class_exists( '\_WP_Editors', false ) ) {
966 require ABSPATH . WPINC . '/class-wp-editor.php';
967 }
968
969 // WordPress 4.8 and higher
970 if ( method_exists( '\_WP_Editors', 'print_tinymce_scripts' ) ) {
971 \_WP_Editors::print_default_editor_scripts();
972 \_WP_Editors::print_tinymce_scripts();
973 }
974 ob_start();
975
976 wp_editor(
977 '%%EDITORCONTENT%%',
978 'elementorwpeditor',
979 [
980 'editor_class' => 'elementor-wp-editor',
981 'editor_height' => 250,
982 'drag_drop_upload' => true,
983 ]
984 );
985
986 $config = ob_get_clean();
987
988 // Don't call \_WP_Editors methods again
989 remove_action( 'admin_print_footer_scripts', [ '_WP_Editors', 'editor_js' ], 50 );
990 remove_action( 'admin_print_footer_scripts', [ '_WP_Editors', 'print_default_editor_scripts' ], 45 );
991
992 \_WP_Editors::editor_js();
993
994 return $config;
995 }
996
997 /**
998 * Editor head trigger.
999 *
1000 * Fires the 'elementor/editor/wp_head' action in the head tag in Elementor
1001 * editor.
1002 *
1003 * @since 1.0.0
1004 * @access public
1005 */
1006 public function editor_head_trigger() {
1007 /**
1008 * Elementor editor head.
1009 *
1010 * Fires on Elementor editor head tag.
1011 *
1012 * Used to prints scripts or any other data in the head tag.
1013 *
1014 * @since 1.0.0
1015 */
1016 do_action( 'elementor/editor/wp_head' );
1017 }
1018
1019 /**
1020 * Add editor template.
1021 *
1022 * Registers new editor templates.
1023 *
1024 * @since 1.0.0
1025 * @deprecated 2.3.0 Use `Plugin::$instance->common->add_template()`
1026 * @access public
1027 *
1028 * @param string $template Can be either a link to template file or template
1029 * HTML content.
1030 * @param string $type Optional. Whether to handle the template as path
1031 * or text. Default is `path`.
1032 */
1033 public function add_editor_template( $template, $type = 'path' ) {
1034 _deprecated_function( __METHOD__, '2.3.0', 'Plugin::$instance->common->add_template()' );
1035
1036 $common = Plugin::$instance->common;
1037
1038 if ( $common ) {
1039 Plugin::$instance->common->add_template( $template, $type );
1040 }
1041 }
1042
1043 /**
1044 * WP footer.
1045 *
1046 * Prints Elementor editor with all the editor templates, and render controls,
1047 * widgets and content elements.
1048 *
1049 * Fired by `wp_footer` action.
1050 *
1051 * @since 1.0.0
1052 * @access public
1053 */
1054 public function wp_footer() {
1055 $plugin = Plugin::$instance;
1056
1057 $plugin->controls_manager->render_controls();
1058 $plugin->widgets_manager->render_widgets_content();
1059 $plugin->elements_manager->render_elements_content();
1060
1061 $plugin->schemes_manager->print_schemes_templates();
1062
1063 $plugin->dynamic_tags->print_templates();
1064
1065 $this->init_editor_templates();
1066
1067 /**
1068 * Elementor editor footer.
1069 *
1070 * Fires on Elementor editor before closing the body tag.
1071 *
1072 * Used to prints scripts or any other HTML before closing the body tag.
1073 *
1074 * @since 1.0.0
1075 */
1076 do_action( 'elementor/editor/footer' );
1077 }
1078
1079 /**
1080 * Set edit mode.
1081 *
1082 * Used to update the edit mode.
1083 *
1084 * @since 1.0.0
1085 * @access public
1086 *
1087 * @param bool $edit_mode Whether the edit mode is active.
1088 */
1089 public function set_edit_mode( $edit_mode ) {
1090 $this->is_edit_mode = $edit_mode;
1091 }
1092
1093 /**
1094 * Editor constructor.
1095 *
1096 * Initializing Elementor editor and redirect from old URL structure of
1097 * Elementor editor.
1098 *
1099 * @since 1.0.0
1100 * @access public
1101 */
1102 public function __construct() {
1103 Plugin::$instance->data_manager->register_controller( Data\Globals\Controller::class );
1104
1105 $this->notice_bar = new Notice_Bar();
1106
1107 add_action( 'admin_action_elementor', [ $this, 'init' ] );
1108 add_action( 'template_redirect', [ $this, 'redirect_to_new_url' ] );
1109
1110 // Handle autocomplete feature for URL control.
1111 add_filter( 'wp_link_query_args', [ $this, 'filter_wp_link_query_args' ] );
1112 add_filter( 'wp_link_query', [ $this, 'filter_wp_link_query' ] );
1113 }
1114
1115 /**
1116 * @since 2.2.0
1117 * @access public
1118 */
1119 public function filter_wp_link_query_args( $query ) {
1120 $library_cpt_key = array_search( Source_Local::CPT, $query['post_type'], true );
1121 if ( false !== $library_cpt_key ) {
1122 unset( $query['post_type'][ $library_cpt_key ] );
1123 }
1124
1125 return $query;
1126 }
1127
1128 /**
1129 * @since 2.2.0
1130 * @access public
1131 */
1132 public function filter_wp_link_query( $results ) {
1133 if ( isset( $_POST['editor'] ) && 'elementor' === $_POST['editor'] ) {
1134 $post_type_object = get_post_type_object( 'post' );
1135 $post_label = $post_type_object->labels->singular_name;
1136
1137 foreach ( $results as & $result ) {
1138 if ( 'post' === get_post_type( $result['ID'] ) ) {
1139 $result['info'] = $post_label;
1140 }
1141 }
1142 }
1143
1144 return $results;
1145 }
1146
1147 /**
1148 * Create nonce.
1149 *
1150 * If the user has edit capabilities, it creates a cryptographic token to
1151 * give him access to Elementor editor.
1152 *
1153 * @since 1.8.1
1154 * @since 1.8.7 The `$post_type` parameter was introduces.
1155 * @deprecated 2.3.0 Use `Plugin::$instance->common->get_component( 'ajax' )->create_nonce()` instead
1156 * @access public
1157 *
1158 * @param string $post_type The post type to check capabilities.
1159 *
1160 * @return null|string The nonce token, or `null` if the user has no edit
1161 * capabilities.
1162 */
1163 public function create_nonce( $post_type ) {
1164 _deprecated_function( __METHOD__, '2.3.0', 'Plugin::$instance->common->get_component( \'ajax\' )->create_nonce()' );
1165
1166 /** @var Ajax $ajax */
1167 $ajax = Plugin::$instance->common->get_component( 'ajax' );
1168
1169 return $ajax->create_nonce();
1170 }
1171
1172 /**
1173 * Verify nonce.
1174 *
1175 * The user is given an amount of time to use the token, so therefore, since
1176 * the user ID and `$action` remain the same, the independent variable is
1177 * the time.
1178 *
1179 * @since 1.8.1
1180 * @deprecated 2.3.0
1181 * @access public
1182 *
1183 * @param string $nonce Nonce to verify.
1184 *
1185 * @return false|int If the nonce is invalid it returns `false`. If the
1186 * nonce is valid and generated between 0-12 hours ago it
1187 * returns `1`. If the nonce is valid and generated
1188 * between 12-24 hours ago it returns `2`.
1189 */
1190 public function verify_nonce( $nonce ) {
1191 _deprecated_function( __METHOD__, '2.3.0', 'wp_verify_nonce()' );
1192
1193 return wp_verify_nonce( $nonce );
1194 }
1195
1196 /**
1197 * Verify request nonce.
1198 *
1199 * Whether the request nonce verified or not.
1200 *
1201 * @since 1.8.1
1202 * @deprecated 2.3.0 Use `Plugin::$instance->common->get_component( 'ajax' )->verify_request_nonce()` instead
1203 * @access public
1204 *
1205 * @return bool True if request nonce verified, False otherwise.
1206 */
1207 public function verify_request_nonce() {
1208 _deprecated_function( __METHOD__, '2.3.0', 'Plugin::$instance->common->get_component( \'ajax\' )->verify_request_nonce()' );
1209
1210 /** @var Ajax $ajax */
1211 $ajax = Plugin::$instance->common->get_component( 'ajax' );
1212
1213 return $ajax->verify_request_nonce();
1214 }
1215
1216 /**
1217 * Verify ajax nonce.
1218 *
1219 * Verify request nonce and send a JSON request, if not verified returns an
1220 * error.
1221 *
1222 * @since 1.9.0
1223 * @deprecated 2.3.0
1224 * @access public
1225 */
1226 public function verify_ajax_nonce() {
1227 _deprecated_function( __METHOD__, '2.3.0' );
1228
1229 /** @var Ajax $ajax */
1230 $ajax = Plugin::$instance->common->get_component( 'ajax' );
1231
1232 if ( ! $ajax->verify_request_nonce() ) {
1233 wp_send_json_error( new \WP_Error( 'token_expired', 'Nonce token expired.' ) );
1234 }
1235 }
1236
1237 /**
1238 * Init editor templates.
1239 *
1240 * Initialize default elementor templates used in the editor panel.
1241 *
1242 * @since 1.7.0
1243 * @access private
1244 */
1245 private function init_editor_templates() {
1246 $template_names = [
1247 'global',
1248 'panel',
1249 'panel-elements',
1250 'repeater',
1251 'templates',
1252 'navigator',
1253 'hotkeys',
1254 ];
1255
1256 foreach ( $template_names as $template_name ) {
1257 Plugin::$instance->common->add_template( ELEMENTOR_PATH . "includes/editor-templates/$template_name.php" );
1258 }
1259 }
1260
1261 private function bc_move_document_filters() {
1262 global $wp_filter;
1263
1264 $old_tag = 'elementor/editor/localize_settings';
1265 $new_tag = 'elementor/document/config';
1266
1267 if ( ! has_filter( $old_tag ) ) {
1268 return;
1269 }
1270
1271 foreach ( $wp_filter[ $old_tag ] as $priority => $filters ) {
1272 foreach ( $filters as $filter_id => $filter_args ) {
1273 if ( 2 === $filter_args['accepted_args'] ) {
1274 remove_filter( $old_tag, $filter_id, $priority );
1275
1276 add_filter( $new_tag, $filter_args['function'], $priority, 2 );
1277
1278 // TODO: Hard deprecation
1279 // _deprecated_hook( '`' . $old_tag . ` is no longer using post_id', '2.9.0', $new_tag' );
1280 }
1281 }
1282 }
1283 }
1284
1285 public function set_post_id( $post_id ) {
1286 $this->post_id = $post_id;
1287 }
1288 }
1289