| @@ -1,31 +1,26 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | 2 | namespace Elementor; |
| 4 | 3 | |
| 5 | -use Elementor\Core\Admin\Menu\Admin_Menu_Manager; | |
| 6 | -use Elementor\Core\Wp_Api; | |
| 7 | 4 | use Elementor\Core\Admin\Admin; |
| 8 | -use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager; | |
| 5 | +use Elementor\Core\Common\Modules\Ajax\Module as Ajax; | |
| 9 | 6 | use Elementor\Core\Common\App as CommonApp; |
| 10 | 7 | use Elementor\Core\Debug\Inspector; |
| 11 | 8 | use Elementor\Core\Documents_Manager; |
| 12 | -use Elementor\Core\Experiments\Manager as Experiments_Manager; | |
| 13 | 9 | use Elementor\Core\Kits\Manager as Kits_Manager; |
| 14 | 10 | use Elementor\Core\Editor\Editor; |
| 15 | 11 | use Elementor\Core\Files\Manager as Files_Manager; |
| 16 | 12 | use Elementor\Core\Files\Assets\Manager as Assets_Manager; |
| 17 | 13 | use Elementor\Core\Modules_Manager; |
| 14 | +use Elementor\Core\Schemes\Manager as Schemes_Manager; | |
| 18 | 15 | use Elementor\Core\Settings\Manager as Settings_Manager; |
| 19 | 16 | use Elementor\Core\Settings\Page\Manager as Page_Settings_Manager; |
| 17 | +use Elementor\Core\Upgrade\Manager as Upgrades_Manager; | |
| 20 | 18 | use Elementor\Modules\History\Revisions_Manager; |
| 21 | 19 | use Elementor\Core\DynamicTags\Manager as Dynamic_Tags_Manager; |
| 22 | 20 | use Elementor\Core\Logger\Manager as Log_Manager; |
| 23 | -use Elementor\Core\Page_Assets\Loader as Assets_Loader; | |
| 24 | 21 | use Elementor\Modules\System_Info\Module as System_Info_Module; |
| 25 | 22 | use Elementor\Data\Manager as Data_Manager; |
| 26 | -use Elementor\Data\V2\Manager as Data_Manager_V2; | |
| 27 | -use Elementor\Core\Files\Uploads_Manager; | |
| 28 | 23 | |
| 29 | 24 | if ( ! defined( 'ABSPATH' ) ) { |
| 30 | 25 | exit; |
| 31 | 26 | } |
| @@ -39,10 +34,8 @@ | ||
| 39 | 34 | * @since 1.0.0 |
| 40 | 35 | */ |
| 41 | 36 | class Plugin { |
| 42 | 37 | |
| 43 | - const ELEMENTOR_DEFAULT_POST_TYPES = [ 'page', 'post' ]; | |
| 44 | - | |
| 45 | 38 | /** |
| 46 | 39 | * Instance. |
| 47 | 40 | * |
| 48 | 41 | * Holds the plugin instance. |
| @@ -57,10 +50,9 @@ | ||
| 57 | 50 | |
| 58 | 51 | /** |
| 59 | 52 | * Database. |
| 60 | 53 | * |
| 61 | - * Holds the plugin database handler which is responsible for communicating | |
| 62 | - * with the database. | |
| 54 | + * Holds the plugin database. | |
| 63 | 55 | * |
| 64 | 56 | * @since 1.0.0 |
| 65 | 57 | * @access public |
| 66 | 58 | * |
| @@ -68,12 +60,24 @@ | ||
| 68 | 60 | */ |
| 69 | 61 | public $db; |
| 70 | 62 | |
| 71 | 63 | /** |
| 64 | + * Ajax Manager. | |
| 65 | + * | |
| 66 | + * Holds the plugin ajax manager. | |
| 67 | + * | |
| 68 | + * @since 1.9.0 | |
| 69 | + * @deprecated 2.3.0 Use `Plugin::$instance->common->get_component( 'ajax' )` instead | |
| 70 | + * @access public | |
| 71 | + * | |
| 72 | + * @var Ajax | |
| 73 | + */ | |
| 74 | + public $ajax; | |
| 75 | + | |
| 76 | + /** | |
| 72 | 77 | * Controls manager. |
| 73 | 78 | * |
| 74 | - * Holds the plugin controls manager handler is responsible for registering | |
| 75 | - * and initializing controls. | |
| 79 | + * Holds the plugin controls manager. | |
| 76 | 80 | * |
| 77 | 81 | * @since 1.0.0 |
| 78 | 82 | * @access public |
| 79 | 83 | * |
| @@ -93,8 +97,20 @@ | ||
| 93 | 97 | */ |
| 94 | 98 | public $documents; |
| 95 | 99 | |
| 96 | 100 | /** |
| 101 | + * Schemes manager. | |
| 102 | + * | |
| 103 | + * Holds the plugin schemes manager. | |
| 104 | + * | |
| 105 | + * @since 1.0.0 | |
| 106 | + * @access public | |
| 107 | + * | |
| 108 | + * @var Schemes_Manager | |
| 109 | + */ | |
| 110 | + public $schemes_manager; | |
| 111 | + | |
| 112 | + /** | |
| 97 | 113 | * Elements manager. |
| 98 | 114 | * |
| 99 | 115 | * Holds the plugin elements manager. |
| 100 | 116 | * |
| @@ -107,10 +123,9 @@ | ||
| 107 | 123 | |
| 108 | 124 | /** |
| 109 | 125 | * Widgets manager. |
| 110 | 126 | * |
| 111 | - * Holds the plugin widgets manager which is responsible for registering and | |
| 112 | - * initializing widgets. | |
| 127 | + * Holds the plugin widgets manager. | |
| 113 | 128 | * |
| 114 | 129 | * @since 1.0.0 |
| 115 | 130 | * @access public |
| 116 | 131 | * |
| @@ -120,10 +135,9 @@ | ||
| 120 | 135 | |
| 121 | 136 | /** |
| 122 | 137 | * Revisions manager. |
| 123 | 138 | * |
| 124 | - * Holds the plugin revisions manager which handles history and revisions | |
| 125 | - * functionality. | |
| 139 | + * Holds the plugin revisions manager. | |
| 126 | 140 | * |
| 127 | 141 | * @since 1.0.0 |
| 128 | 142 | * @access public |
| 129 | 143 | * |
| @@ -133,10 +147,9 @@ | ||
| 133 | 147 | |
| 134 | 148 | /** |
| 135 | 149 | * Images manager. |
| 136 | 150 | * |
| 137 | - * Holds the plugin images manager which is responsible for retrieving image | |
| 138 | - * details. | |
| 151 | + * Holds the plugin images manager. | |
| 139 | 152 | * |
| 140 | 153 | * @since 2.9.0 |
| 141 | 154 | * @access public |
| 142 | 155 | * |
| @@ -146,10 +159,9 @@ | ||
| 146 | 159 | |
| 147 | 160 | /** |
| 148 | 161 | * Maintenance mode. |
| 149 | 162 | * |
| 150 | - * Holds the maintenance mode manager responsible for the "Maintenance Mode" | |
| 151 | - * and the "Coming Soon" features. | |
| 163 | + * Holds the plugin maintenance mode. | |
| 152 | 164 | * |
| 153 | 165 | * @since 1.0.0 |
| 154 | 166 | * @access public |
| 155 | 167 | * |
| @@ -195,14 +207,14 @@ | ||
| 195 | 207 | |
| 196 | 208 | /** |
| 197 | 209 | * Role Manager. |
| 198 | 210 | * |
| 199 | - * Holds the plugin role manager. | |
| 211 | + * Holds the plugin Role Manager | |
| 200 | 212 | * |
| 201 | 213 | * @since 2.0.0 |
| 202 | 214 | * @access public |
| 203 | 215 | * |
| 204 | - * @var Core\RoleManager\Role_Manager | |
| 216 | + * @var \Elementor\Core\RoleManager\Role_Manager | |
| 205 | 217 | */ |
| 206 | 218 | public $role_manager; |
| 207 | 219 | |
| 208 | 220 | /** |
| @@ -284,9 +296,9 @@ | ||
| 284 | 296 | * |
| 285 | 297 | * @since 1.0.0 |
| 286 | 298 | * @access public |
| 287 | 299 | * |
| 288 | - * @var System_Info_Module | |
| 300 | + * @var System_Info\Main | |
| 289 | 301 | */ |
| 290 | 302 | public $system_info; |
| 291 | 303 | |
| 292 | 304 | /** |
| @@ -313,11 +325,11 @@ | ||
| 313 | 325 | */ |
| 314 | 326 | public $skins_manager; |
| 315 | 327 | |
| 316 | 328 | /** |
| 317 | - * Files manager. | |
| 329 | + * Files Manager. | |
| 318 | 330 | * |
| 319 | - * Holds the plugin files manager. | |
| 331 | + * Holds the files manager. | |
| 320 | 332 | * |
| 321 | 333 | * @since 2.1.0 |
| 322 | 334 | * @access public |
| 323 | 335 | * |
| @@ -325,11 +337,11 @@ | ||
| 325 | 337 | */ |
| 326 | 338 | public $files_manager; |
| 327 | 339 | |
| 328 | 340 | /** |
| 329 | - * Assets manager. | |
| 341 | + * Assets Manager. | |
| 330 | 342 | * |
| 331 | - * Holds the plugin assets manager. | |
| 343 | + * Holds the Assets manager. | |
| 332 | 344 | * |
| 333 | 345 | * @since 2.6.0 |
| 334 | 346 | * @access public |
| 335 | 347 | * |
| @@ -337,17 +349,19 @@ | ||
| 337 | 349 | */ |
| 338 | 350 | public $assets_manager; |
| 339 | 351 | |
| 340 | 352 | /** |
| 341 | - * Icons Manager. | |
| 353 | + * Files Manager. | |
| 342 | 354 | * |
| 343 | - * Holds the plugin icons manager. | |
| 355 | + * Holds the files manager. | |
| 344 | 356 | * |
| 357 | + * @since 1.0.0 | |
| 345 | 358 | * @access public |
| 359 | + * @deprecated 2.1.0 Use `Plugin::$files_manager` instead | |
| 346 | 360 | * |
| 347 | - * @var Icons_Manager | |
| 361 | + * @var Files_Manager | |
| 348 | 362 | */ |
| 349 | - public $icons_manager; | |
| 363 | + public $posts_css_manager; | |
| 350 | 364 | |
| 351 | 365 | /** |
| 352 | 366 | * WordPress widgets manager. |
| 353 | 367 | * |
| @@ -362,9 +376,9 @@ | ||
| 362 | 376 | |
| 363 | 377 | /** |
| 364 | 378 | * Modules manager. |
| 365 | 379 | * |
| 366 | - * Holds the plugin modules manager. | |
| 380 | + * Holds the modules manager. | |
| 367 | 381 | * |
| 368 | 382 | * @since 1.0.0 |
| 369 | 383 | * @access public |
| 370 | 384 | * |
| @@ -384,169 +398,51 @@ | ||
| 384 | 398 | */ |
| 385 | 399 | public $beta_testers; |
| 386 | 400 | |
| 387 | 401 | /** |
| 388 | - * Inspector. | |
| 389 | - * | |
| 390 | - * Holds the plugin inspector data. | |
| 391 | - * | |
| 392 | - * @since 2.1.2 | |
| 393 | - * @access public | |
| 394 | - * | |
| 395 | 402 | * @var Inspector |
| 403 | + * @deprecated 2.1.2 Use $inspector. | |
| 396 | 404 | */ |
| 397 | - public $inspector; | |
| 405 | + public $debugger; | |
| 398 | 406 | |
| 399 | 407 | /** |
| 400 | - * @var Admin_Menu_Manager | |
| 408 | + * @var Inspector | |
| 401 | 409 | */ |
| 402 | - public $admin_menu_manager; | |
| 410 | + public $inspector; | |
| 403 | 411 | |
| 404 | 412 | /** |
| 405 | - * Common functionality. | |
| 406 | - * | |
| 407 | - * Holds the plugin common functionality. | |
| 408 | - * | |
| 409 | - * @since 2.3.0 | |
| 410 | - * @access public | |
| 411 | - * | |
| 412 | 413 | * @var CommonApp |
| 413 | 414 | */ |
| 414 | 415 | public $common; |
| 415 | 416 | |
| 416 | 417 | /** |
| 417 | - * Log manager. | |
| 418 | - * | |
| 419 | - * Holds the plugin log manager. | |
| 420 | - * | |
| 421 | - * @access public | |
| 422 | - * | |
| 423 | 418 | * @var Log_Manager |
| 424 | 419 | */ |
| 425 | 420 | public $logger; |
| 426 | 421 | |
| 427 | 422 | /** |
| 428 | - * Upgrade manager. | |
| 429 | - * | |
| 430 | - * Holds the plugin upgrade manager. | |
| 431 | - * | |
| 432 | - * @access public | |
| 433 | - * | |
| 434 | 423 | * @var Core\Upgrade\Manager |
| 435 | 424 | */ |
| 436 | 425 | public $upgrade; |
| 437 | 426 | |
| 438 | 427 | /** |
| 439 | - * Tasks manager. | |
| 440 | - * | |
| 441 | - * Holds the plugin tasks manager. | |
| 442 | - * | |
| 443 | - * @var Core\Upgrade\Custom_Tasks_Manager | |
| 444 | - */ | |
| 445 | - public $custom_tasks; | |
| 446 | - | |
| 447 | - /** | |
| 448 | - * Kits manager. | |
| 449 | - * | |
| 450 | - * Holds the plugin kits manager. | |
| 451 | - * | |
| 452 | - * @access public | |
| 453 | - * | |
| 454 | 428 | * @var Core\Kits\Manager |
| 455 | 429 | */ |
| 456 | 430 | public $kits_manager; |
| 457 | 431 | |
| 458 | 432 | /** |
| 459 | - * @var \Elementor\Data\V2\Manager | |
| 433 | + * @var \Core\Data\Manager | |
| 460 | 434 | */ |
| 461 | - public $data_manager_v2; | |
| 435 | + public $data_manager; | |
| 462 | 436 | |
| 463 | - /** | |
| 464 | - * Legacy mode. | |
| 465 | - * | |
| 466 | - * Holds the plugin legacy mode data. | |
| 467 | - * | |
| 468 | - * @access public | |
| 469 | - * | |
| 470 | - * @var array | |
| 471 | - */ | |
| 472 | 437 | public $legacy_mode; |
| 473 | 438 | |
| 474 | 439 | /** |
| 475 | - * App. | |
| 476 | - * | |
| 477 | - * Holds the plugin app data. | |
| 478 | - * | |
| 479 | - * @since 3.0.0 | |
| 480 | - * @access public | |
| 481 | - * | |
| 482 | - * @var App\App | |
| 440 | + * @var Core\App\App | |
| 483 | 441 | */ |
| 484 | 442 | public $app; |
| 485 | 443 | |
| 486 | 444 | /** |
| 487 | - * WordPress API. | |
| 488 | - * | |
| 489 | - * Holds the methods that interact with WordPress Core API. | |
| 490 | - * | |
| 491 | - * @since 3.0.0 | |
| 492 | - * @access public | |
| 493 | - * | |
| 494 | - * @var Wp_Api | |
| 495 | - */ | |
| 496 | - public $wp; | |
| 497 | - | |
| 498 | - /** | |
| 499 | - * Experiments manager. | |
| 500 | - * | |
| 501 | - * Holds the plugin experiments manager. | |
| 502 | - * | |
| 503 | - * @since 3.1.0 | |
| 504 | - * @access public | |
| 505 | - * | |
| 506 | - * @var Experiments_Manager | |
| 507 | - */ | |
| 508 | - public $experiments; | |
| 509 | - | |
| 510 | - /** | |
| 511 | - * Uploads manager. | |
| 512 | - * | |
| 513 | - * Holds the plugin uploads manager responsible for handling file uploads | |
| 514 | - * that are not done with WordPress Media. | |
| 515 | - * | |
| 516 | - * @since 3.3.0 | |
| 517 | - * @access public | |
| 518 | - * | |
| 519 | - * @var Uploads_Manager | |
| 520 | - */ | |
| 521 | - public $uploads_manager; | |
| 522 | - | |
| 523 | - /** | |
| 524 | - * Breakpoints manager. | |
| 525 | - * | |
| 526 | - * Holds the plugin breakpoints manager. | |
| 527 | - * | |
| 528 | - * @since 3.2.0 | |
| 529 | - * @access public | |
| 530 | - * | |
| 531 | - * @var Breakpoints_Manager | |
| 532 | - */ | |
| 533 | - public $breakpoints; | |
| 534 | - | |
| 535 | - /** | |
| 536 | - * Assets loader. | |
| 537 | - * | |
| 538 | - * Holds the plugin assets loader responsible for conditionally enqueuing | |
| 539 | - * styles and script assets that were pre-enabled. | |
| 540 | - * | |
| 541 | - * @since 3.3.0 | |
| 542 | - * @access public | |
| 543 | - * | |
| 544 | - * @var Assets_Loader | |
| 545 | - */ | |
| 546 | - public $assets_loader; | |
| 547 | - | |
| 548 | - /** | |
| 549 | 445 | * Clone. |
| 550 | 446 | * |
| 551 | 447 | * Disable class cloning and throw an error on object clone. |
| 552 | 448 | * |
| @@ -556,13 +452,10 @@ | ||
| 556 | 452 | * @access public |
| 557 | 453 | * @since 1.0.0 |
| 558 | 454 | */ |
| 559 | 455 | public function __clone() { |
| 560 | - _doing_it_wrong( | |
| 561 | - __FUNCTION__, | |
| 562 | - sprintf( 'Cloning instances of the singleton "%s" class is forbidden.', get_class( $this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 563 | - '1.0.0' | |
| 564 | - ); | |
| 456 | + // Cloning instances of the class is forbidden. | |
| 457 | + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' ); | |
| 565 | 458 | } |
| 566 | 459 | |
| 567 | 460 | /** |
| 568 | 461 | * Wakeup. |
| @@ -572,13 +465,10 @@ | ||
| 572 | 465 | * @access public |
| 573 | 466 | * @since 1.0.0 |
| 574 | 467 | */ |
| 575 | 468 | public function __wakeup() { |
| 576 | - _doing_it_wrong( | |
| 577 | - __FUNCTION__, | |
| 578 | - sprintf( 'Unserializing instances of the singleton "%s" class is forbidden.', get_class( $this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 579 | - '1.0.0' | |
| 580 | - ); | |
| 469 | + // Unserializing instances of the class is forbidden. | |
| 470 | + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' ); | |
| 581 | 471 | } |
| 582 | 472 | |
| 583 | 473 | /** |
| 584 | 474 | * Instance. |
| @@ -624,12 +514,11 @@ | ||
| 624 | 514 | |
| 625 | 515 | /** |
| 626 | 516 | * Elementor init. |
| 627 | 517 | * |
| 628 | - * Fires when Elementor components are initialized. | |
| 518 | + * Fires on Elementor init, after Elementor has finished loading but | |
| 519 | + * before any headers are sent. | |
| 629 | 520 | * |
| 630 | - * After Elementor finished loading but before any headers are sent. | |
| 631 | - * | |
| 632 | 521 | * @since 1.0.0 |
| 633 | 522 | */ |
| 634 | 523 | do_action( 'elementor/init' ); |
| 635 | 524 | } |
| @@ -678,11 +567,10 @@ | ||
| 678 | 567 | * @since 1.0.0 |
| 679 | 568 | * @access private |
| 680 | 569 | */ |
| 681 | 570 | private function init_components() { |
| 682 | - $this->experiments = new Experiments_Manager(); | |
| 683 | - $this->breakpoints = new Breakpoints_Manager(); | |
| 684 | 571 | $this->inspector = new Inspector(); |
| 572 | + $this->debugger = $this->inspector; | |
| 685 | 573 | |
| 686 | 574 | Settings_Manager::run(); |
| 687 | 575 | |
| 688 | 576 | $this->db = new DB(); |
| @@ -688,8 +576,9 @@ | ||
| 688 | 576 | $this->db = new DB(); |
| 689 | 577 | $this->controls_manager = new Controls_Manager(); |
| 690 | 578 | $this->documents = new Documents_Manager(); |
| 691 | 579 | $this->kits_manager = new Kits_Manager(); |
| 580 | + $this->schemes_manager = new Schemes_Manager(); | |
| 692 | 581 | $this->elements_manager = new Elements_Manager(); |
| 693 | 582 | $this->widgets_manager = new Widgets_Manager(); |
| 694 | 583 | $this->skins_manager = new Skins_Manager(); |
| 695 | 584 | $this->files_manager = new Files_Manager(); |
| @@ -694,37 +583,33 @@ | ||
| 694 | 583 | $this->skins_manager = new Skins_Manager(); |
| 695 | 584 | $this->files_manager = new Files_Manager(); |
| 696 | 585 | $this->assets_manager = new Assets_Manager(); |
| 697 | 586 | $this->icons_manager = new Icons_Manager(); |
| 587 | + /* | |
| 588 | + * @TODO: Remove deprecated alias | |
| 589 | + */ | |
| 590 | + $this->posts_css_manager = $this->files_manager; | |
| 698 | 591 | $this->settings = new Settings(); |
| 699 | 592 | $this->tools = new Tools(); |
| 700 | 593 | $this->editor = new Editor(); |
| 701 | 594 | $this->preview = new Preview(); |
| 702 | 595 | $this->frontend = new Frontend(); |
| 596 | + $this->templates_manager = new TemplateLibrary\Manager(); | |
| 703 | 597 | $this->maintenance_mode = new Maintenance_Mode(); |
| 704 | 598 | $this->dynamic_tags = new Dynamic_Tags_Manager(); |
| 705 | 599 | $this->modules_manager = new Modules_Manager(); |
| 706 | - $this->templates_manager = new TemplateLibrary\Manager(); | |
| 707 | 600 | $this->role_manager = new Core\RoleManager\Role_Manager(); |
| 708 | 601 | $this->system_info = new System_Info_Module(); |
| 709 | 602 | $this->revisions_manager = new Revisions_Manager(); |
| 710 | 603 | $this->images_manager = new Images_Manager(); |
| 711 | - $this->wp = new Wp_Api(); | |
| 712 | - $this->assets_loader = new Assets_Loader(); | |
| 713 | - $this->uploads_manager = new Uploads_Manager(); | |
| 714 | 604 | |
| 715 | - $this->admin_menu_manager = new Admin_Menu_Manager(); | |
| 716 | - $this->admin_menu_manager->register_actions(); | |
| 717 | - | |
| 718 | 605 | User::init(); |
| 719 | - User_Data::init(); | |
| 720 | 606 | Api::init(); |
| 721 | 607 | Tracker::init(); |
| 722 | 608 | |
| 723 | 609 | $this->upgrade = new Core\Upgrade\Manager(); |
| 724 | - $this->custom_tasks = new Core\Upgrade\Custom_Tasks_Manager(); | |
| 725 | 610 | |
| 726 | - $this->app = new App\App(); | |
| 611 | + $this->app = new Core\App\App(); | |
| 727 | 612 | |
| 728 | 613 | if ( is_admin() ) { |
| 729 | 614 | $this->heartbeat = new Heartbeat(); |
| 730 | 615 | $this->wordpress_widgets_manager = new WordPress_Widgets_Manager(); |
| @@ -740,10 +625,39 @@ | ||
| 740 | 625 | public function init_common() { |
| 741 | 626 | $this->common = new CommonApp(); |
| 742 | 627 | |
| 743 | 628 | $this->common->init_components(); |
| 629 | + | |
| 630 | + $this->ajax = $this->common->get_component( 'ajax' ); | |
| 744 | 631 | } |
| 745 | 632 | |
| 633 | + public function get_legacy_mode( $mode_name = null ) { | |
| 634 | + if ( ! $this->legacy_mode ) { | |
| 635 | + $optimized_dom_output = get_option( 'elementor_optimized_dom_output' ); | |
| 636 | + | |
| 637 | + if ( $optimized_dom_output ) { | |
| 638 | + $element_wrappers_legacy_mode = 'disabled' === $optimized_dom_output; | |
| 639 | + } else { | |
| 640 | + $element_wrappers_legacy_mode = true; | |
| 641 | + } | |
| 642 | + | |
| 643 | + $this->legacy_mode = [ | |
| 644 | + 'elementWrappers' => $element_wrappers_legacy_mode, | |
| 645 | + ]; | |
| 646 | + } | |
| 647 | + | |
| 648 | + if ( ! $mode_name ) { | |
| 649 | + return $this->legacy_mode; | |
| 650 | + } | |
| 651 | + | |
| 652 | + if ( isset( $this->legacy_mode[ $mode_name ] ) ) { | |
| 653 | + return $this->legacy_mode[ $mode_name ]; | |
| 654 | + } | |
| 655 | + | |
| 656 | + // If there is no legacy mode with the given mode name; | |
| 657 | + return false; | |
| 658 | + } | |
| 659 | + | |
| 746 | 660 | /** |
| 747 | 661 | * Add custom post type support. |
| 748 | 662 | * |
| 749 | 663 | * Register Elementor support for all the supported post types defined by |
| @@ -756,9 +670,9 @@ | ||
| 756 | 670 | * @since 1.0.0 |
| 757 | 671 | * @access private |
| 758 | 672 | */ |
| 759 | 673 | private function add_cpt_support() { |
| 760 | - $cpt_support = get_option( 'elementor_cpt_support', self::ELEMENTOR_DEFAULT_POST_TYPES ); | |
| 674 | + $cpt_support = get_option( 'elementor_cpt_support', [ 'page', 'post' ] ); | |
| 761 | 675 | |
| 762 | 676 | foreach ( $cpt_support as $cpt_slug ) { |
| 763 | 677 | add_post_type_support( $cpt_slug, 'elementor' ); |
| 764 | 678 | } |
| @@ -778,36 +692,8 @@ | ||
| 778 | 692 | Autoloader::run(); |
| 779 | 693 | } |
| 780 | 694 | |
| 781 | 695 | /** |
| 782 | - * Magic getter for accessing certain properties. | |
| 783 | - * | |
| 784 | - * @since 3.1.0 | |
| 785 | - * @access public | |
| 786 | - * | |
| 787 | - * @param string $property The property name. | |
| 788 | - * @return mixed The property value or null if not found. | |
| 789 | - * @throws \Exception If trying to access a private property. | |
| 790 | - */ | |
| 791 | - public function __get( $property ) { | |
| 792 | - if ( 'posts_css_manager' === $property ) { | |
| 793 | - self::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_argument( 'Plugin::$instance->posts_css_manager', '2.7.0', 'Plugin::$instance->files_manager' ); | |
| 794 | - | |
| 795 | - return $this->files_manager; | |
| 796 | - } | |
| 797 | - | |
| 798 | - if ( 'data_manager' === $property ) { | |
| 799 | - return Data_Manager::instance(); | |
| 800 | - } | |
| 801 | - | |
| 802 | - if ( property_exists( $this, $property ) ) { | |
| 803 | - throw new \Exception( 'Cannot access private property.' ); | |
| 804 | - } | |
| 805 | - | |
| 806 | - return null; | |
| 807 | - } | |
| 808 | - | |
| 809 | - /** | |
| 810 | 696 | * Plugin constructor. |
| 811 | 697 | * |
| 812 | 698 | * Initializing Elementor plugin. |
| 813 | 699 | * |
| @@ -817,19 +703,19 @@ | ||
| 817 | 703 | private function __construct() { |
| 818 | 704 | $this->register_autoloader(); |
| 819 | 705 | |
| 820 | 706 | $this->logger = Log_Manager::instance(); |
| 821 | - $this->data_manager_v2 = Data_Manager_V2::instance(); | |
| 707 | + $this->data_manager = Data_Manager::instance(); | |
| 822 | 708 | |
| 823 | 709 | Maintenance::init(); |
| 824 | 710 | Compatibility::register_actions(); |
| 825 | 711 | |
| 826 | 712 | add_action( 'init', [ $this, 'init' ], 0 ); |
| 827 | - add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ], 9 ); | |
| 713 | + add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ] ); | |
| 828 | 714 | } |
| 829 | 715 | |
| 830 | 716 | final public static function get_title() { |
| 831 | - return esc_html__( 'Elementor', 'elementor' ); | |
| 717 | + return __( 'Elementor', 'elementor' ); | |
| 832 | 718 | } |
| 833 | 719 | } |
| 834 | 720 | |
| 835 | 721 | if ( ! defined( 'ELEMENTOR_TESTS' ) ) { |