PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.4
Elementor Website Builder – more than just a page builder v3.0.4
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.4, at core/editor/editor.php

1,283 lines 39.5 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
613 // Global Styles
614 'new_global_color' => __( 'New Global Color', 'elementor' ),
615 'global_colors_title' => __( 'Global Colors', 'elementor' ),
616 'manage_global_colors' => __( 'Manage Global Colors', 'elementor' ),
617 'create_global_color' => __( 'Create New Global Color', 'elementor' ),
618 'delete_global_color' => __( 'Delete Global Color', 'elementor' ),
619 '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' ),
620 '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' ),
621 'typography' => __( 'Typography', 'elementor' ),
622 'new_typography_setting' => __( 'New Typography Setting', 'elementor' ),
623 'global_fonts_title' => __( 'Global Fonts', 'elementor' ),
624 'manage_global_fonts' => __( 'Manage Global Fonts', 'elementor' ),
625 'create_global_font' => __( 'Create New Global Font', 'elementor' ),
626 'delete_global_font' => __( 'Delete Global Font', 'elementor' ),
627 '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' ),
628 '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' ),
629 'default' => __( 'Default', 'elementor' ),
630 'create' => __( 'Create', 'elementor' ),
631 'global_color_confirm_text' => __( 'Are you sure you want to create a new Global Color?', 'elementor' ),
632 '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' ),
633 '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' ),
634 'global_fonts_confirm_text' => __( 'Are you sure you want to create a new Global Font setting?', 'elementor' ),
635 'custom' => __( 'Custom', 'elementor' ),
636
637 // Menu.
638 'site_settings' => __( 'Site Settings', 'elementor' ),
639 'theme_builder' => __( 'Theme Builder', 'elementor' ),
640 'user_preferences' => __( 'User Preferences', 'elementor' ),
641 'settings' => __( 'Settings', 'elementor' ),
642 'more' => __( 'More', 'elementor' ),
643 'navigate_from_page' => __( 'Navigate From Page', 'elementor' ),
644 'view_page' => __( 'View Page', 'elementor' ),
645 'exit_to_dashboard' => __( 'Exit To Dashboard', 'elementor' ),
646
647 // Elements.
648 'inner_section' => __( 'Inner Section', 'elementor' ),
649
650 // Control Order.
651 'asc' => __( 'Ascending order', 'elementor' ),
652 'desc' => __( 'Descending order', 'elementor' ),
653
654 // Clear Page.
655 'clear_page' => __( 'Delete All Content', 'elementor' ),
656 'dialog_confirm_clear_page' => __( 'Attention: We are going to DELETE ALL CONTENT from this page. Are you sure you want to do that?', 'elementor' ),
657
658 // Enable unfiltered file uploads.
659 'enable_unfiltered_files_upload' => __( 'Enable Unfiltered File Uploads', 'elementor' ),
660 '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' ),
661
662 // Enable fontawesome 5 if needed.
663 'enable_fa5' => __( 'Elementor\'s New Icon Library', 'elementor' ),
664 '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>',
665
666 // Panel Preview Mode.
667 'back_to_editor' => __( 'Show Panel', 'elementor' ),
668 'preview' => __( 'Hide Panel', 'elementor' ),
669
670 // Inline Editing.
671 'type_here' => __( 'Type Here', 'elementor' ),
672
673 // Library.
674 'an_error_occurred' => __( 'An error occurred', 'elementor' ),
675 'category' => __( 'Category', 'elementor' ),
676 'delete_template' => __( 'Delete Template', 'elementor' ),
677 'delete_template_confirm' => __( 'Are you sure you want to delete this template?', 'elementor' ),
678 'import_template_dialog_header' => __( 'Import Document Settings', 'elementor' ),
679 'import_template_dialog_message' => __( 'Do you want to also import the document settings of the template?', 'elementor' ),
680 'import_template_dialog_message_attention' => __( 'Attention: Importing may override previous settings.', 'elementor' ),
681 'library' => __( 'Library', 'elementor' ),
682 'no' => __( 'No', 'elementor' ),
683 'page' => __( 'Page', 'elementor' ),
684 /* translators: %s: Template type. */
685 'save_your_template' => __( 'Save Your %s to Library', 'elementor' ),
686 'save_your_template_description' => __( 'Your designs will be available for export and reuse on any page or website', 'elementor' ),
687 'section' => __( 'Section', 'elementor' ),
688 'templates_empty_message' => __( 'This is where your templates should be. Design it. Save it. Reuse it.', 'elementor' ),
689 'templates_empty_title' => __( 'Haven’t Saved Templates Yet?', 'elementor' ),
690 'templates_no_favorites_message' => __( 'You can mark any pre-designed template as a favorite.', 'elementor' ),
691 'templates_no_favorites_title' => __( 'No Favorite Templates', 'elementor' ),
692 'templates_no_results_message' => __( 'Please make sure your search is spelled correctly or try a different words.', 'elementor' ),
693 'templates_no_results_title' => __( 'No Results Found', 'elementor' ),
694 'templates_request_error' => __( 'The following error(s) occurred while processing the request:', 'elementor' ),
695 'yes' => __( 'Yes', 'elementor' ),
696 'blocks' => __( 'Blocks', 'elementor' ),
697 'pages' => __( 'Pages', 'elementor' ),
698 'my_templates' => __( 'My Templates', 'elementor' ),
699
700 // Incompatible Device.
701 'device_incompatible_header' => __( 'Your browser isn\'t compatible', 'elementor' ),
702 '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' ),
703 'proceed_anyway' => __( 'Proceed Anyway', 'elementor' ),
704
705 // Preview not loaded.
706 'learn_more' => __( 'Learn More', 'elementor' ),
707 'preview_el_not_found_header' => __( 'Sorry, the content area was not found in your page.', 'elementor' ),
708 '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' ),
709
710 // Gallery.
711 'delete_gallery' => __( 'Reset Gallery', 'elementor' ),
712 'dialog_confirm_gallery_delete' => __( 'Are you sure you want to reset this gallery?', 'elementor' ),
713 /* translators: %s: The number of images. */
714 'gallery_images_selected' => __( '%s Images Selected', 'elementor' ),
715 'gallery_no_images_selected' => __( 'No Images Selected', 'elementor' ),
716 'insert_media' => __( 'Insert Media', 'elementor' ),
717
718 // Take Over.
719 /* translators: %s: User name. */
720 'dialog_user_taken_over' => __( '%s has taken over and is currently editing. Do you want to take over this page editing?', 'elementor' ),
721 'go_back' => __( 'Go Back', 'elementor' ),
722 'take_over' => __( 'Take Over', 'elementor' ),
723
724 // Revisions.
725 /* translators: %s: Template type. */
726 'dialog_confirm_delete' => __( 'Are you sure you want to remove this %s?', 'elementor' ),
727
728 // Saver.
729 'before_unload_alert' => __( 'Please note: All unsaved changes will be lost.', 'elementor' ),
730 'published' => __( 'Published', 'elementor' ),
731 'publish' => __( 'Publish', 'elementor' ),
732 'save' => __( 'Save', 'elementor' ),
733 'saved' => __( 'Saved', 'elementor' ),
734 'update' => __( 'Update', 'elementor' ),
735 'enable' => __( 'Enable', 'elementor' ),
736 'submit' => __( 'Submit', 'elementor' ),
737 'working_on_draft_notification' => __( 'This is just a draft. Play around and when you\'re done - click update.', 'elementor' ),
738 'keep_editing' => __( 'Keep Editing', 'elementor' ),
739 'have_a_look' => __( 'Have a look', 'elementor' ),
740 'view_all_revisions' => __( 'View All Revisions', 'elementor' ),
741 'dismiss' => __( 'Dismiss', 'elementor' ),
742 'saving_disabled' => __( 'Saving has been disabled until you’re reconnected.', 'elementor' ),
743
744 // Ajax
745 'server_error' => __( 'Server Error', 'elementor' ),
746 'server_connection_lost' => __( 'Connection Lost', 'elementor' ),
747 'unknown_error' => __( 'Unknown Error', 'elementor' ),
748
749 // Context Menu
750 'duplicate' => __( 'Duplicate', 'elementor' ),
751 'copy' => __( 'Copy', 'elementor' ),
752 'paste' => __( 'Paste', 'elementor' ),
753 'copy_style' => __( 'Copy Style', 'elementor' ),
754 'paste_style' => __( 'Paste Style', 'elementor' ),
755 'reset_style' => __( 'Reset Style', 'elementor' ),
756 'save_as_global' => __( 'Save as a Global', 'elementor' ),
757 'save_as_block' => __( 'Save as Template', 'elementor' ),
758 'new_column' => __( 'Add New Column', 'elementor' ),
759 'copy_all_content' => __( 'Copy All Content', 'elementor' ),
760 'delete_all_content' => __( 'Delete All Content', 'elementor' ),
761 'navigator' => __( 'Navigator', 'elementor' ),
762
763 // Right Click Introduction
764 'meet_right_click_header' => __( 'Meet Right Click', 'elementor' ),
765 'meet_right_click_message' => __( 'Now you can access all editing actions using right click.', 'elementor' ),
766
767 // Hotkeys screen
768 'keyboard_shortcuts' => __( 'Keyboard Shortcuts', 'elementor' ),
769
770 // Deprecated Control
771 'deprecated_notice' => __( 'The <strong>%1$s</strong> widget has been deprecated since %2$s %3$s.', 'elementor' ),
772 'deprecated_notice_replacement' => __( 'It has been replaced by <strong>%1$s</strong>.', 'elementor' ),
773 'deprecated_notice_last' => __( 'Note that %1$s will be completely removed once %2$s %3$s is released.', 'elementor' ),
774
775 //Preview Debug
776 'preview_debug_link_text' => __( 'Click here for preview debug', 'elementor' ),
777
778 'icon_library' => __( 'Icon Library', 'elementor' ),
779 'my_libraries' => __( 'My Libraries', 'elementor' ),
780 'upload' => __( 'Upload', 'elementor' ),
781 'icons_promotion' => __( 'Become a Pro user to upload unlimited font icon folders to your website.', 'elementor' ),
782 'go_pro' => __( 'Go Pro', 'elementor' ),
783 'custom_positioning' => __( 'Custom Positioning', 'elementor' ),
784
785 'element_promotion_dialog_header' => __( '%s Widget', 'elementor' ),
786 'element_promotion_dialog_message' => __( 'Use %s widget and dozens more pro features to extend your toolbox and build sites faster and better.', 'elementor' ),
787 'see_it_in_action' => __( 'See it in Action', 'elementor' ),
788 'dynamic_content' => __( 'Dynamic Content', 'elementor' ),
789 'dynamic_promotion_message' => __( 'Create more personalized and dynamic sites by populating data from various sources with dozens of dynamic tags to choose from.', 'elementor' ),
790
791 // TODO: Remove.
792 'autosave' => __( 'Autosave', 'elementor' ),
793 'elementor_docs' => __( 'Documentation', 'elementor' ),
794 'reload_page' => __( 'Reload Page', 'elementor' ),
795 'session_expired_header' => __( 'Timeout', 'elementor' ),
796 'session_expired_message' => __( 'Your session has expired. Please reload the page to continue editing.', 'elementor' ),
797 'soon' => __( 'Soon', 'elementor' ),
798 'unknown_value' => __( 'Unknown Value', 'elementor' ),
799 ],
800 ];
801
802 if ( ! Utils::has_pro() && current_user_can( 'manage_options' ) ) {
803 $config['promotionWidgets'] = Api::get_promotion_widgets();
804 }
805
806 $this->bc_move_document_filters();
807
808 /**
809 * Localize editor settings.
810 *
811 * Filters the editor localized settings.
812 *
813 * @since 1.0.0
814 *
815 * @param array $config Editor configuration.
816 * @param int $post_id The ID of the current post being edited.
817 */
818 $config = apply_filters( 'elementor/editor/localize_settings', $config );
819
820 Utils::print_js_config( 'elementor-editor', 'ElementorConfig', $config );
821
822 wp_enqueue_script( 'elementor-editor' );
823
824 $plugin->controls_manager->enqueue_control_scripts();
825
826 /**
827 * After editor enqueue scripts.
828 *
829 * Fires after Elementor editor scripts are enqueued.
830 *
831 * @since 1.0.0
832 */
833 do_action( 'elementor/editor/after_enqueue_scripts' );
834 }
835
836 /**
837 * Enqueue styles.
838 *
839 * Registers all the editor styles and enqueues them.
840 *
841 * @since 1.0.0
842 * @access public
843 */
844 public function enqueue_styles() {
845 /**
846 * Before editor enqueue styles.
847 *
848 * Fires before Elementor editor styles are enqueued.
849 *
850 * @since 1.0.0
851 */
852 do_action( 'elementor/editor/before_enqueue_styles' );
853
854 $suffix = Utils::is_script_debug() ? '' : '.min';
855
856 $direction_suffix = is_rtl() ? '-rtl' : '';
857
858 wp_register_style(
859 'font-awesome',
860 ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/font-awesome' . $suffix . '.css',
861 [],
862 '4.7.0'
863 );
864
865 wp_register_style(
866 'elementor-select2',
867 ELEMENTOR_ASSETS_URL . 'lib/e-select2/css/e-select2' . $suffix . '.css',
868 [],
869 '4.0.6-rc.1'
870 );
871
872 wp_register_style(
873 'google-font-roboto',
874 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700',
875 [],
876 ELEMENTOR_VERSION
877 );
878
879 wp_register_style(
880 'flatpickr',
881 ELEMENTOR_ASSETS_URL . 'lib/flatpickr/flatpickr' . $suffix . '.css',
882 [],
883 '1.12.0'
884 );
885
886 wp_register_style(
887 'pickr',
888 ELEMENTOR_ASSETS_URL . 'lib/pickr/themes/monolith.min.css',
889 [],
890 '1.5.0'
891 );
892
893 wp_register_style(
894 'elementor-editor',
895 ELEMENTOR_ASSETS_URL . 'css/editor' . $direction_suffix . $suffix . '.css',
896 [
897 'elementor-common',
898 'elementor-select2',
899 'elementor-icons',
900 'wp-auth-check',
901 'google-font-roboto',
902 'flatpickr',
903 'pickr',
904 ],
905 ELEMENTOR_VERSION
906 );
907
908 wp_enqueue_style( 'elementor-editor' );
909
910 $ui_theme = SettingsManager::get_settings_managers( 'editorPreferences' )->get_model()->get_settings( 'ui_theme' );
911
912 if ( 'light' !== $ui_theme ) {
913 $ui_theme_media_queries = 'all';
914
915 if ( 'auto' === $ui_theme ) {
916 $ui_theme_media_queries = '(prefers-color-scheme: dark)';
917 }
918
919 wp_enqueue_style(
920 'elementor-editor-dark-mode',
921 ELEMENTOR_ASSETS_URL . 'css/editor-dark-mode' . $suffix . '.css',
922 [
923 'elementor-editor',
924 ],
925 ELEMENTOR_VERSION,
926 $ui_theme_media_queries
927 );
928 }
929
930 if ( Responsive::has_custom_breakpoints() ) {
931 $breakpoints = Responsive::get_breakpoints();
932
933 wp_add_inline_style( 'elementor-editor', '.elementor-device-tablet #elementor-preview-responsive-wrapper { width: ' . $breakpoints['md'] . 'px; }' );
934 }
935
936 /**
937 * After editor enqueue styles.
938 *
939 * Fires after Elementor editor styles are enqueued.
940 *
941 * @since 1.0.0
942 */
943 do_action( 'elementor/editor/after_enqueue_styles' );
944 }
945
946 /**
947 * Get WordPress editor config.
948 *
949 * Config the default WordPress editor with custom settings for Elementor use.
950 *
951 * @since 1.9.0
952 * @access private
953 */
954 private function get_wp_editor_config() {
955 // Remove all TinyMCE plugins.
956 remove_all_filters( 'mce_buttons', 10 );
957 remove_all_filters( 'mce_external_plugins', 10 );
958
959 if ( ! class_exists( '\_WP_Editors', false ) ) {
960 require ABSPATH . WPINC . '/class-wp-editor.php';
961 }
962
963 // WordPress 4.8 and higher
964 if ( method_exists( '\_WP_Editors', 'print_tinymce_scripts' ) ) {
965 \_WP_Editors::print_default_editor_scripts();
966 \_WP_Editors::print_tinymce_scripts();
967 }
968 ob_start();
969
970 wp_editor(
971 '%%EDITORCONTENT%%',
972 'elementorwpeditor',
973 [
974 'editor_class' => 'elementor-wp-editor',
975 'editor_height' => 250,
976 'drag_drop_upload' => true,
977 ]
978 );
979
980 $config = ob_get_clean();
981
982 // Don't call \_WP_Editors methods again
983 remove_action( 'admin_print_footer_scripts', [ '_WP_Editors', 'editor_js' ], 50 );
984 remove_action( 'admin_print_footer_scripts', [ '_WP_Editors', 'print_default_editor_scripts' ], 45 );
985
986 \_WP_Editors::editor_js();
987
988 return $config;
989 }
990
991 /**
992 * Editor head trigger.
993 *
994 * Fires the 'elementor/editor/wp_head' action in the head tag in Elementor
995 * editor.
996 *
997 * @since 1.0.0
998 * @access public
999 */
1000 public function editor_head_trigger() {
1001 /**
1002 * Elementor editor head.
1003 *
1004 * Fires on Elementor editor head tag.
1005 *
1006 * Used to prints scripts or any other data in the head tag.
1007 *
1008 * @since 1.0.0
1009 */
1010 do_action( 'elementor/editor/wp_head' );
1011 }
1012
1013 /**
1014 * Add editor template.
1015 *
1016 * Registers new editor templates.
1017 *
1018 * @since 1.0.0
1019 * @deprecated 2.3.0 Use `Plugin::$instance->common->add_template()`
1020 * @access public
1021 *
1022 * @param string $template Can be either a link to template file or template
1023 * HTML content.
1024 * @param string $type Optional. Whether to handle the template as path
1025 * or text. Default is `path`.
1026 */
1027 public function add_editor_template( $template, $type = 'path' ) {
1028 _deprecated_function( __METHOD__, '2.3.0', 'Plugin::$instance->common->add_template()' );
1029
1030 $common = Plugin::$instance->common;
1031
1032 if ( $common ) {
1033 Plugin::$instance->common->add_template( $template, $type );
1034 }
1035 }
1036
1037 /**
1038 * WP footer.
1039 *
1040 * Prints Elementor editor with all the editor templates, and render controls,
1041 * widgets and content elements.
1042 *
1043 * Fired by `wp_footer` action.
1044 *
1045 * @since 1.0.0
1046 * @access public
1047 */
1048 public function wp_footer() {
1049 $plugin = Plugin::$instance;
1050
1051 $plugin->controls_manager->render_controls();
1052 $plugin->widgets_manager->render_widgets_content();
1053 $plugin->elements_manager->render_elements_content();
1054
1055 $plugin->schemes_manager->print_schemes_templates();
1056
1057 $plugin->dynamic_tags->print_templates();
1058
1059 $this->init_editor_templates();
1060
1061 /**
1062 * Elementor editor footer.
1063 *
1064 * Fires on Elementor editor before closing the body tag.
1065 *
1066 * Used to prints scripts or any other HTML before closing the body tag.
1067 *
1068 * @since 1.0.0
1069 */
1070 do_action( 'elementor/editor/footer' );
1071 }
1072
1073 /**
1074 * Set edit mode.
1075 *
1076 * Used to update the edit mode.
1077 *
1078 * @since 1.0.0
1079 * @access public
1080 *
1081 * @param bool $edit_mode Whether the edit mode is active.
1082 */
1083 public function set_edit_mode( $edit_mode ) {
1084 $this->is_edit_mode = $edit_mode;
1085 }
1086
1087 /**
1088 * Editor constructor.
1089 *
1090 * Initializing Elementor editor and redirect from old URL structure of
1091 * Elementor editor.
1092 *
1093 * @since 1.0.0
1094 * @access public
1095 */
1096 public function __construct() {
1097 Plugin::$instance->data_manager->register_controller( Data\Globals\Controller::class );
1098
1099 $this->notice_bar = new Notice_Bar();
1100
1101 add_action( 'admin_action_elementor', [ $this, 'init' ] );
1102 add_action( 'template_redirect', [ $this, 'redirect_to_new_url' ] );
1103
1104 // Handle autocomplete feature for URL control.
1105 add_filter( 'wp_link_query_args', [ $this, 'filter_wp_link_query_args' ] );
1106 add_filter( 'wp_link_query', [ $this, 'filter_wp_link_query' ] );
1107 }
1108
1109 /**
1110 * @since 2.2.0
1111 * @access public
1112 */
1113 public function filter_wp_link_query_args( $query ) {
1114 $library_cpt_key = array_search( Source_Local::CPT, $query['post_type'], true );
1115 if ( false !== $library_cpt_key ) {
1116 unset( $query['post_type'][ $library_cpt_key ] );
1117 }
1118
1119 return $query;
1120 }
1121
1122 /**
1123 * @since 2.2.0
1124 * @access public
1125 */
1126 public function filter_wp_link_query( $results ) {
1127 if ( isset( $_POST['editor'] ) && 'elementor' === $_POST['editor'] ) {
1128 $post_type_object = get_post_type_object( 'post' );
1129 $post_label = $post_type_object->labels->singular_name;
1130
1131 foreach ( $results as & $result ) {
1132 if ( 'post' === get_post_type( $result['ID'] ) ) {
1133 $result['info'] = $post_label;
1134 }
1135 }
1136 }
1137
1138 return $results;
1139 }
1140
1141 /**
1142 * Create nonce.
1143 *
1144 * If the user has edit capabilities, it creates a cryptographic token to
1145 * give him access to Elementor editor.
1146 *
1147 * @since 1.8.1
1148 * @since 1.8.7 The `$post_type` parameter was introduces.
1149 * @deprecated 2.3.0 Use `Plugin::$instance->common->get_component( 'ajax' )->create_nonce()` instead
1150 * @access public
1151 *
1152 * @param string $post_type The post type to check capabilities.
1153 *
1154 * @return null|string The nonce token, or `null` if the user has no edit
1155 * capabilities.
1156 */
1157 public function create_nonce( $post_type ) {
1158 _deprecated_function( __METHOD__, '2.3.0', 'Plugin::$instance->common->get_component( \'ajax\' )->create_nonce()' );
1159
1160 /** @var Ajax $ajax */
1161 $ajax = Plugin::$instance->common->get_component( 'ajax' );
1162
1163 return $ajax->create_nonce();
1164 }
1165
1166 /**
1167 * Verify nonce.
1168 *
1169 * The user is given an amount of time to use the token, so therefore, since
1170 * the user ID and `$action` remain the same, the independent variable is
1171 * the time.
1172 *
1173 * @since 1.8.1
1174 * @deprecated 2.3.0
1175 * @access public
1176 *
1177 * @param string $nonce Nonce to verify.
1178 *
1179 * @return false|int If the nonce is invalid it returns `false`. If the
1180 * nonce is valid and generated between 0-12 hours ago it
1181 * returns `1`. If the nonce is valid and generated
1182 * between 12-24 hours ago it returns `2`.
1183 */
1184 public function verify_nonce( $nonce ) {
1185 _deprecated_function( __METHOD__, '2.3.0', 'wp_verify_nonce()' );
1186
1187 return wp_verify_nonce( $nonce );
1188 }
1189
1190 /**
1191 * Verify request nonce.
1192 *
1193 * Whether the request nonce verified or not.
1194 *
1195 * @since 1.8.1
1196 * @deprecated 2.3.0 Use `Plugin::$instance->common->get_component( 'ajax' )->verify_request_nonce()` instead
1197 * @access public
1198 *
1199 * @return bool True if request nonce verified, False otherwise.
1200 */
1201 public function verify_request_nonce() {
1202 _deprecated_function( __METHOD__, '2.3.0', 'Plugin::$instance->common->get_component( \'ajax\' )->verify_request_nonce()' );
1203
1204 /** @var Ajax $ajax */
1205 $ajax = Plugin::$instance->common->get_component( 'ajax' );
1206
1207 return $ajax->verify_request_nonce();
1208 }
1209
1210 /**
1211 * Verify ajax nonce.
1212 *
1213 * Verify request nonce and send a JSON request, if not verified returns an
1214 * error.
1215 *
1216 * @since 1.9.0
1217 * @deprecated 2.3.0
1218 * @access public
1219 */
1220 public function verify_ajax_nonce() {
1221 _deprecated_function( __METHOD__, '2.3.0' );
1222
1223 /** @var Ajax $ajax */
1224 $ajax = Plugin::$instance->common->get_component( 'ajax' );
1225
1226 if ( ! $ajax->verify_request_nonce() ) {
1227 wp_send_json_error( new \WP_Error( 'token_expired', 'Nonce token expired.' ) );
1228 }
1229 }
1230
1231 /**
1232 * Init editor templates.
1233 *
1234 * Initialize default elementor templates used in the editor panel.
1235 *
1236 * @since 1.7.0
1237 * @access private
1238 */
1239 private function init_editor_templates() {
1240 $template_names = [
1241 'global',
1242 'panel',
1243 'panel-elements',
1244 'repeater',
1245 'templates',
1246 'navigator',
1247 'hotkeys',
1248 ];
1249
1250 foreach ( $template_names as $template_name ) {
1251 Plugin::$instance->common->add_template( ELEMENTOR_PATH . "includes/editor-templates/$template_name.php" );
1252 }
1253 }
1254
1255 private function bc_move_document_filters() {
1256 global $wp_filter;
1257
1258 $old_tag = 'elementor/editor/localize_settings';
1259 $new_tag = 'elementor/document/config';
1260
1261 if ( ! has_filter( $old_tag ) ) {
1262 return;
1263 }
1264
1265 foreach ( $wp_filter[ $old_tag ] as $priority => $filters ) {
1266 foreach ( $filters as $filter_id => $filter_args ) {
1267 if ( 2 === $filter_args['accepted_args'] ) {
1268 remove_filter( $old_tag, $filter_id, $priority );
1269
1270 add_filter( $new_tag, $filter_args['function'], $priority, 2 );
1271
1272 // TODO: Hard deprecation
1273 // _deprecated_hook( '`' . $old_tag . ` is no longer using post_id', '2.9.0', $new_tag' );
1274 }
1275 }
1276 }
1277 }
1278
1279 public function set_post_id( $post_id ) {
1280 $this->post_id = $post_id;
1281 }
1282 }
1283