| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor; |
| 4 |
|
| 5 |
use Elementor\Core\Admin\Menu\Admin_Menu_Manager; |
| 6 |
use Elementor\Core\Wp_Api; |
| 7 |
use Elementor\Core\Admin\Admin; |
| 8 |
use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager; |
| 9 |
use Elementor\Core\Common\App as CommonApp; |
| 10 |
use Elementor\Core\Debug\Inspector; |
| 11 |
use Elementor\Core\Documents_Manager; |
| 12 |
use Elementor\Core\Experiments\Manager as Experiments_Manager; |
| 13 |
use Elementor\Core\Kits\Manager as Kits_Manager; |
| 14 |
use Elementor\Core\Editor\Editor; |
| 15 |
use Elementor\Core\Files\Manager as Files_Manager; |
| 16 |
use Elementor\Core\Files\Assets\Manager as Assets_Manager; |
| 17 |
use Elementor\Core\Modules_Manager; |
| 18 |
use Elementor\Core\Settings\Manager as Settings_Manager; |
| 19 |
use Elementor\Core\Settings\Page\Manager as Page_Settings_Manager; |
| 20 |
use Elementor\Modules\History\Revisions_Manager; |
| 21 |
use Elementor\Core\DynamicTags\Manager as Dynamic_Tags_Manager; |
| 22 |
use Elementor\Core\Logger\Manager as Log_Manager; |
| 23 |
use Elementor\Core\Page_Assets\Loader as Assets_Loader; |
| 24 |
use Elementor\Modules\System_Info\Module as System_Info_Module; |
| 25 |
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 |
|
| 29 |
if ( ! defined( 'ABSPATH' ) ) { |
| 30 |
exit; |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Elementor plugin. |
| 35 |
* |
| 36 |
* The main plugin handler class is responsible for initializing Elementor. The |
| 37 |
* class registers and all the components required to run the plugin. |
| 38 |
* |
| 39 |
* @since 1.0.0 |
| 40 |
*/ |
| 41 |
class Plugin { |
| 42 |
|
| 43 |
const ELEMENTOR_DEFAULT_POST_TYPES = [ 'page', 'post' ]; |
| 44 |
|
| 45 |
/** |
| 46 |
* Instance. |
| 47 |
* |
| 48 |
* Holds the plugin instance. |
| 49 |
* |
| 50 |
* @since 1.0.0 |
| 51 |
* @access public |
| 52 |
* @static |
| 53 |
* |
| 54 |
* @var Plugin |
| 55 |
*/ |
| 56 |
public static $instance = null; |
| 57 |
|
| 58 |
/** |
| 59 |
* Database. |
| 60 |
* |
| 61 |
* Holds the plugin database handler which is responsible for communicating |
| 62 |
* with the database. |
| 63 |
* |
| 64 |
* @since 1.0.0 |
| 65 |
* @access public |
| 66 |
* |
| 67 |
* @var DB |
| 68 |
*/ |
| 69 |
public $db; |
| 70 |
|
| 71 |
/** |
| 72 |
* Controls manager. |
| 73 |
* |
| 74 |
* Holds the plugin controls manager handler is responsible for registering |
| 75 |
* and initializing controls. |
| 76 |
* |
| 77 |
* @since 1.0.0 |
| 78 |
* @access public |
| 79 |
* |
| 80 |
* @var Controls_Manager |
| 81 |
*/ |
| 82 |
public $controls_manager; |
| 83 |
|
| 84 |
/** |
| 85 |
* Documents manager. |
| 86 |
* |
| 87 |
* Holds the documents manager. |
| 88 |
* |
| 89 |
* @since 2.0.0 |
| 90 |
* @access public |
| 91 |
* |
| 92 |
* @var Documents_Manager |
| 93 |
*/ |
| 94 |
public $documents; |
| 95 |
|
| 96 |
/** |
| 97 |
* Elements manager. |
| 98 |
* |
| 99 |
* Holds the plugin elements manager. |
| 100 |
* |
| 101 |
* @since 1.0.0 |
| 102 |
* @access public |
| 103 |
* |
| 104 |
* @var Elements_Manager |
| 105 |
*/ |
| 106 |
public $elements_manager; |
| 107 |
|
| 108 |
/** |
| 109 |
* Widgets manager. |
| 110 |
* |
| 111 |
* Holds the plugin widgets manager which is responsible for registering and |
| 112 |
* initializing widgets. |
| 113 |
* |
| 114 |
* @since 1.0.0 |
| 115 |
* @access public |
| 116 |
* |
| 117 |
* @var Widgets_Manager |
| 118 |
*/ |
| 119 |
public $widgets_manager; |
| 120 |
|
| 121 |
/** |
| 122 |
* Revisions manager. |
| 123 |
* |
| 124 |
* Holds the plugin revisions manager which handles history and revisions |
| 125 |
* functionality. |
| 126 |
* |
| 127 |
* @since 1.0.0 |
| 128 |
* @access public |
| 129 |
* |
| 130 |
* @var Revisions_Manager |
| 131 |
*/ |
| 132 |
public $revisions_manager; |
| 133 |
|
| 134 |
/** |
| 135 |
* Images manager. |
| 136 |
* |
| 137 |
* Holds the plugin images manager which is responsible for retrieving image |
| 138 |
* details. |
| 139 |
* |
| 140 |
* @since 2.9.0 |
| 141 |
* @access public |
| 142 |
* |
| 143 |
* @var Images_Manager |
| 144 |
*/ |
| 145 |
public $images_manager; |
| 146 |
|
| 147 |
/** |
| 148 |
* Maintenance mode. |
| 149 |
* |
| 150 |
* Holds the maintenance mode manager responsible for the "Maintenance Mode" |
| 151 |
* and the "Coming Soon" features. |
| 152 |
* |
| 153 |
* @since 1.0.0 |
| 154 |
* @access public |
| 155 |
* |
| 156 |
* @var Maintenance_Mode |
| 157 |
*/ |
| 158 |
public $maintenance_mode; |
| 159 |
|
| 160 |
/** |
| 161 |
* Page settings manager. |
| 162 |
* |
| 163 |
* Holds the page settings manager. |
| 164 |
* |
| 165 |
* @since 1.0.0 |
| 166 |
* @access public |
| 167 |
* |
| 168 |
* @var Page_Settings_Manager |
| 169 |
*/ |
| 170 |
public $page_settings_manager; |
| 171 |
|
| 172 |
/** |
| 173 |
* Dynamic tags manager. |
| 174 |
* |
| 175 |
* Holds the dynamic tags manager. |
| 176 |
* |
| 177 |
* @since 1.0.0 |
| 178 |
* @access public |
| 179 |
* |
| 180 |
* @var Dynamic_Tags_Manager |
| 181 |
*/ |
| 182 |
public $dynamic_tags; |
| 183 |
|
| 184 |
/** |
| 185 |
* Settings. |
| 186 |
* |
| 187 |
* Holds the plugin settings. |
| 188 |
* |
| 189 |
* @since 1.0.0 |
| 190 |
* @access public |
| 191 |
* |
| 192 |
* @var Settings |
| 193 |
*/ |
| 194 |
public $settings; |
| 195 |
|
| 196 |
/** |
| 197 |
* Role Manager. |
| 198 |
* |
| 199 |
* Holds the plugin role manager. |
| 200 |
* |
| 201 |
* @since 2.0.0 |
| 202 |
* @access public |
| 203 |
* |
| 204 |
* @var Core\RoleManager\Role_Manager |
| 205 |
*/ |
| 206 |
public $role_manager; |
| 207 |
|
| 208 |
/** |
| 209 |
* Admin. |
| 210 |
* |
| 211 |
* Holds the plugin admin. |
| 212 |
* |
| 213 |
* @since 1.0.0 |
| 214 |
* @access public |
| 215 |
* |
| 216 |
* @var Admin |
| 217 |
*/ |
| 218 |
public $admin; |
| 219 |
|
| 220 |
/** |
| 221 |
* Tools. |
| 222 |
* |
| 223 |
* Holds the plugin tools. |
| 224 |
* |
| 225 |
* @since 1.0.0 |
| 226 |
* @access public |
| 227 |
* |
| 228 |
* @var Tools |
| 229 |
*/ |
| 230 |
public $tools; |
| 231 |
|
| 232 |
/** |
| 233 |
* Preview. |
| 234 |
* |
| 235 |
* Holds the plugin preview. |
| 236 |
* |
| 237 |
* @since 1.0.0 |
| 238 |
* @access public |
| 239 |
* |
| 240 |
* @var Preview |
| 241 |
*/ |
| 242 |
public $preview; |
| 243 |
|
| 244 |
/** |
| 245 |
* Editor. |
| 246 |
* |
| 247 |
* Holds the plugin editor. |
| 248 |
* |
| 249 |
* @since 1.0.0 |
| 250 |
* @access public |
| 251 |
* |
| 252 |
* @var Editor |
| 253 |
*/ |
| 254 |
public $editor; |
| 255 |
|
| 256 |
/** |
| 257 |
* Frontend. |
| 258 |
* |
| 259 |
* Holds the plugin frontend. |
| 260 |
* |
| 261 |
* @since 1.0.0 |
| 262 |
* @access public |
| 263 |
* |
| 264 |
* @var Frontend |
| 265 |
*/ |
| 266 |
public $frontend; |
| 267 |
|
| 268 |
/** |
| 269 |
* Heartbeat. |
| 270 |
* |
| 271 |
* Holds the plugin heartbeat. |
| 272 |
* |
| 273 |
* @since 1.0.0 |
| 274 |
* @access public |
| 275 |
* |
| 276 |
* @var Heartbeat |
| 277 |
*/ |
| 278 |
public $heartbeat; |
| 279 |
|
| 280 |
/** |
| 281 |
* System info. |
| 282 |
* |
| 283 |
* Holds the system info data. |
| 284 |
* |
| 285 |
* @since 1.0.0 |
| 286 |
* @access public |
| 287 |
* |
| 288 |
* @var System_Info_Module |
| 289 |
*/ |
| 290 |
public $system_info; |
| 291 |
|
| 292 |
/** |
| 293 |
* Template library manager. |
| 294 |
* |
| 295 |
* Holds the template library manager. |
| 296 |
* |
| 297 |
* @since 1.0.0 |
| 298 |
* @access public |
| 299 |
* |
| 300 |
* @var TemplateLibrary\Manager |
| 301 |
*/ |
| 302 |
public $templates_manager; |
| 303 |
|
| 304 |
/** |
| 305 |
* Skins manager. |
| 306 |
* |
| 307 |
* Holds the skins manager. |
| 308 |
* |
| 309 |
* @since 1.0.0 |
| 310 |
* @access public |
| 311 |
* |
| 312 |
* @var Skins_Manager |
| 313 |
*/ |
| 314 |
public $skins_manager; |
| 315 |
|
| 316 |
/** |
| 317 |
* Files manager. |
| 318 |
* |
| 319 |
* Holds the plugin files manager. |
| 320 |
* |
| 321 |
* @since 2.1.0 |
| 322 |
* @access public |
| 323 |
* |
| 324 |
* @var Files_Manager |
| 325 |
*/ |
| 326 |
public $files_manager; |
| 327 |
|
| 328 |
/** |
| 329 |
* Assets manager. |
| 330 |
* |
| 331 |
* Holds the plugin assets manager. |
| 332 |
* |
| 333 |
* @since 2.6.0 |
| 334 |
* @access public |
| 335 |
* |
| 336 |
* @var Assets_Manager |
| 337 |
*/ |
| 338 |
public $assets_manager; |
| 339 |
|
| 340 |
/** |
| 341 |
* Icons Manager. |
| 342 |
* |
| 343 |
* Holds the plugin icons manager. |
| 344 |
* |
| 345 |
* @access public |
| 346 |
* |
| 347 |
* @var Icons_Manager |
| 348 |
*/ |
| 349 |
public $icons_manager; |
| 350 |
|
| 351 |
/** |
| 352 |
* WordPress widgets manager. |
| 353 |
* |
| 354 |
* Holds the WordPress widgets manager. |
| 355 |
* |
| 356 |
* @since 1.0.0 |
| 357 |
* @access public |
| 358 |
* |
| 359 |
* @var WordPress_Widgets_Manager |
| 360 |
*/ |
| 361 |
public $wordpress_widgets_manager; |
| 362 |
|
| 363 |
/** |
| 364 |
* Modules manager. |
| 365 |
* |
| 366 |
* Holds the plugin modules manager. |
| 367 |
* |
| 368 |
* @since 1.0.0 |
| 369 |
* @access public |
| 370 |
* |
| 371 |
* @var Modules_Manager |
| 372 |
*/ |
| 373 |
public $modules_manager; |
| 374 |
|
| 375 |
/** |
| 376 |
* Beta testers. |
| 377 |
* |
| 378 |
* Holds the plugin beta testers. |
| 379 |
* |
| 380 |
* @since 1.0.0 |
| 381 |
* @access public |
| 382 |
* |
| 383 |
* @var Beta_Testers |
| 384 |
*/ |
| 385 |
public $beta_testers; |
| 386 |
|
| 387 |
/** |
| 388 |
* Inspector. |
| 389 |
* |
| 390 |
* Holds the plugin inspector data. |
| 391 |
* |
| 392 |
* @since 2.1.2 |
| 393 |
* @access public |
| 394 |
* |
| 395 |
* @var Inspector |
| 396 |
*/ |
| 397 |
public $inspector; |
| 398 |
|
| 399 |
/** |
| 400 |
* @var Admin_Menu_Manager |
| 401 |
*/ |
| 402 |
public $admin_menu_manager; |
| 403 |
|
| 404 |
/** |
| 405 |
* Common functionality. |
| 406 |
* |
| 407 |
* Holds the plugin common functionality. |
| 408 |
* |
| 409 |
* @since 2.3.0 |
| 410 |
* @access public |
| 411 |
* |
| 412 |
* @var CommonApp |
| 413 |
*/ |
| 414 |
public $common; |
| 415 |
|
| 416 |
/** |
| 417 |
* Log manager. |
| 418 |
* |
| 419 |
* Holds the plugin log manager. |
| 420 |
* |
| 421 |
* @access public |
| 422 |
* |
| 423 |
* @var Log_Manager |
| 424 |
*/ |
| 425 |
public $logger; |
| 426 |
|
| 427 |
/** |
| 428 |
* Upgrade manager. |
| 429 |
* |
| 430 |
* Holds the plugin upgrade manager. |
| 431 |
* |
| 432 |
* @access public |
| 433 |
* |
| 434 |
* @var Core\Upgrade\Manager |
| 435 |
*/ |
| 436 |
public $upgrade; |
| 437 |
|
| 438 |
/** |
| 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 |
* @var Core\Kits\Manager |
| 455 |
*/ |
| 456 |
public $kits_manager; |
| 457 |
|
| 458 |
/** |
| 459 |
* @var \Elementor\Data\V2\Manager |
| 460 |
*/ |
| 461 |
public $data_manager_v2; |
| 462 |
|
| 463 |
/** |
| 464 |
* Legacy mode. |
| 465 |
* |
| 466 |
* Holds the plugin legacy mode data. |
| 467 |
* |
| 468 |
* @access public |
| 469 |
* |
| 470 |
* @var array |
| 471 |
*/ |
| 472 |
public $legacy_mode; |
| 473 |
|
| 474 |
/** |
| 475 |
* App. |
| 476 |
* |
| 477 |
* Holds the plugin app data. |
| 478 |
* |
| 479 |
* @since 3.0.0 |
| 480 |
* @access public |
| 481 |
* |
| 482 |
* @var App\App |
| 483 |
*/ |
| 484 |
public $app; |
| 485 |
|
| 486 |
/** |
| 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 |
* Clone. |
| 550 |
* |
| 551 |
* Disable class cloning and throw an error on object clone. |
| 552 |
* |
| 553 |
* The whole idea of the singleton design pattern is that there is a single |
| 554 |
* object. Therefore, we don't want the object to be cloned. |
| 555 |
* |
| 556 |
* @access public |
| 557 |
* @since 1.0.0 |
| 558 |
*/ |
| 559 |
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 |
); |
| 565 |
} |
| 566 |
|
| 567 |
/** |
| 568 |
* Wakeup. |
| 569 |
* |
| 570 |
* Disable unserializing of the class. |
| 571 |
* |
| 572 |
* @access public |
| 573 |
* @since 1.0.0 |
| 574 |
*/ |
| 575 |
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 |
); |
| 581 |
} |
| 582 |
|
| 583 |
/** |
| 584 |
* Instance. |
| 585 |
* |
| 586 |
* Ensures only one instance of the plugin class is loaded or can be loaded. |
| 587 |
* |
| 588 |
* @since 1.0.0 |
| 589 |
* @access public |
| 590 |
* @static |
| 591 |
* |
| 592 |
* @return Plugin An instance of the class. |
| 593 |
*/ |
| 594 |
public static function instance() { |
| 595 |
if ( is_null( self::$instance ) ) { |
| 596 |
self::$instance = new self(); |
| 597 |
|
| 598 |
/** |
| 599 |
* Elementor loaded. |
| 600 |
* |
| 601 |
* Fires when Elementor was fully loaded and instantiated. |
| 602 |
* |
| 603 |
* @since 1.0.0 |
| 604 |
*/ |
| 605 |
do_action( 'elementor/loaded' ); |
| 606 |
} |
| 607 |
|
| 608 |
return self::$instance; |
| 609 |
} |
| 610 |
|
| 611 |
/** |
| 612 |
* Init. |
| 613 |
* |
| 614 |
* Initialize Elementor Plugin. Register Elementor support for all the |
| 615 |
* supported post types and initialize Elementor components. |
| 616 |
* |
| 617 |
* @since 1.0.0 |
| 618 |
* @access public |
| 619 |
*/ |
| 620 |
public function init() { |
| 621 |
$this->add_cpt_support(); |
| 622 |
|
| 623 |
$this->init_components(); |
| 624 |
|
| 625 |
/** |
| 626 |
* Elementor init. |
| 627 |
* |
| 628 |
* Fires when Elementor components are initialized. |
| 629 |
* |
| 630 |
* After Elementor finished loading but before any headers are sent. |
| 631 |
* |
| 632 |
* @since 1.0.0 |
| 633 |
*/ |
| 634 |
do_action( 'elementor/init' ); |
| 635 |
} |
| 636 |
|
| 637 |
/** |
| 638 |
* Get install time. |
| 639 |
* |
| 640 |
* Retrieve the time when Elementor was installed. |
| 641 |
* |
| 642 |
* @since 2.6.0 |
| 643 |
* @access public |
| 644 |
* @static |
| 645 |
* |
| 646 |
* @return int Unix timestamp when Elementor was installed. |
| 647 |
*/ |
| 648 |
public function get_install_time() { |
| 649 |
$installed_time = get_option( '_elementor_installed_time' ); |
| 650 |
|
| 651 |
if ( ! $installed_time ) { |
| 652 |
$installed_time = time(); |
| 653 |
|
| 654 |
update_option( '_elementor_installed_time', $installed_time ); |
| 655 |
} |
| 656 |
|
| 657 |
return $installed_time; |
| 658 |
} |
| 659 |
|
| 660 |
/** |
| 661 |
* @since 2.3.0 |
| 662 |
* @access public |
| 663 |
*/ |
| 664 |
public function on_rest_api_init() { |
| 665 |
// On admin/frontend sometimes the rest API is initialized after the common is initialized. |
| 666 |
if ( ! $this->common ) { |
| 667 |
$this->init_common(); |
| 668 |
} |
| 669 |
} |
| 670 |
|
| 671 |
/** |
| 672 |
* Init components. |
| 673 |
* |
| 674 |
* Initialize Elementor components. Register actions, run setting manager, |
| 675 |
* initialize all the components that run elementor, and if in admin page |
| 676 |
* initialize admin components. |
| 677 |
* |
| 678 |
* @since 1.0.0 |
| 679 |
* @access private |
| 680 |
*/ |
| 681 |
private function init_components() { |
| 682 |
$this->experiments = new Experiments_Manager(); |
| 683 |
$this->breakpoints = new Breakpoints_Manager(); |
| 684 |
$this->inspector = new Inspector(); |
| 685 |
|
| 686 |
Settings_Manager::run(); |
| 687 |
|
| 688 |
$this->db = new DB(); |
| 689 |
$this->controls_manager = new Controls_Manager(); |
| 690 |
$this->documents = new Documents_Manager(); |
| 691 |
$this->kits_manager = new Kits_Manager(); |
| 692 |
$this->elements_manager = new Elements_Manager(); |
| 693 |
$this->widgets_manager = new Widgets_Manager(); |
| 694 |
$this->skins_manager = new Skins_Manager(); |
| 695 |
$this->files_manager = new Files_Manager(); |
| 696 |
$this->assets_manager = new Assets_Manager(); |
| 697 |
$this->icons_manager = new Icons_Manager(); |
| 698 |
$this->settings = new Settings(); |
| 699 |
$this->tools = new Tools(); |
| 700 |
$this->editor = new Editor(); |
| 701 |
$this->preview = new Preview(); |
| 702 |
$this->frontend = new Frontend(); |
| 703 |
$this->maintenance_mode = new Maintenance_Mode(); |
| 704 |
$this->dynamic_tags = new Dynamic_Tags_Manager(); |
| 705 |
$this->modules_manager = new Modules_Manager(); |
| 706 |
$this->templates_manager = new TemplateLibrary\Manager(); |
| 707 |
$this->role_manager = new Core\RoleManager\Role_Manager(); |
| 708 |
$this->system_info = new System_Info_Module(); |
| 709 |
$this->revisions_manager = new Revisions_Manager(); |
| 710 |
$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 |
|
| 715 |
$this->admin_menu_manager = new Admin_Menu_Manager(); |
| 716 |
$this->admin_menu_manager->register_actions(); |
| 717 |
|
| 718 |
User::init(); |
| 719 |
User_Data::init(); |
| 720 |
Api::init(); |
| 721 |
Tracker::init(); |
| 722 |
|
| 723 |
$this->upgrade = new Core\Upgrade\Manager(); |
| 724 |
$this->custom_tasks = new Core\Upgrade\Custom_Tasks_Manager(); |
| 725 |
|
| 726 |
$this->app = new App\App(); |
| 727 |
|
| 728 |
if ( is_admin() ) { |
| 729 |
$this->heartbeat = new Heartbeat(); |
| 730 |
$this->wordpress_widgets_manager = new WordPress_Widgets_Manager(); |
| 731 |
$this->admin = new Admin(); |
| 732 |
$this->beta_testers = new Beta_Testers(); |
| 733 |
} |
| 734 |
} |
| 735 |
|
| 736 |
/** |
| 737 |
* @since 2.3.0 |
| 738 |
* @access public |
| 739 |
*/ |
| 740 |
public function init_common() { |
| 741 |
$this->common = new CommonApp(); |
| 742 |
|
| 743 |
$this->common->init_components(); |
| 744 |
} |
| 745 |
|
| 746 |
/** |
| 747 |
* Add custom post type support. |
| 748 |
* |
| 749 |
* Register Elementor support for all the supported post types defined by |
| 750 |
* the user in the admin screen and saved as `elementor_cpt_support` option |
| 751 |
* in WordPress `$wpdb->options` table. |
| 752 |
* |
| 753 |
* If no custom post type selected, usually in new installs, this method |
| 754 |
* will return the two default post types: `page` and `post`. |
| 755 |
* |
| 756 |
* @since 1.0.0 |
| 757 |
* @access private |
| 758 |
*/ |
| 759 |
private function add_cpt_support() { |
| 760 |
$cpt_support = get_option( 'elementor_cpt_support', self::ELEMENTOR_DEFAULT_POST_TYPES ); |
| 761 |
|
| 762 |
foreach ( $cpt_support as $cpt_slug ) { |
| 763 |
add_post_type_support( $cpt_slug, 'elementor' ); |
| 764 |
} |
| 765 |
} |
| 766 |
|
| 767 |
/** |
| 768 |
* Register autoloader. |
| 769 |
* |
| 770 |
* Elementor autoloader loads all the classes needed to run the plugin. |
| 771 |
* |
| 772 |
* @since 1.6.0 |
| 773 |
* @access private |
| 774 |
*/ |
| 775 |
private function register_autoloader() { |
| 776 |
require_once ELEMENTOR_PATH . '/includes/autoloader.php'; |
| 777 |
|
| 778 |
Autoloader::run(); |
| 779 |
} |
| 780 |
|
| 781 |
/** |
| 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 |
* Plugin constructor. |
| 811 |
* |
| 812 |
* Initializing Elementor plugin. |
| 813 |
* |
| 814 |
* @since 1.0.0 |
| 815 |
* @access private |
| 816 |
*/ |
| 817 |
private function __construct() { |
| 818 |
$this->register_autoloader(); |
| 819 |
|
| 820 |
$this->logger = Log_Manager::instance(); |
| 821 |
$this->data_manager_v2 = Data_Manager_V2::instance(); |
| 822 |
|
| 823 |
Maintenance::init(); |
| 824 |
Compatibility::register_actions(); |
| 825 |
|
| 826 |
add_action( 'init', [ $this, 'init' ], 0 ); |
| 827 |
add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ], 9 ); |
| 828 |
} |
| 829 |
|
| 830 |
final public static function get_title() { |
| 831 |
return esc_html__( 'Elementor', 'elementor' ); |
| 832 |
} |
| 833 |
} |
| 834 |
|
| 835 |
if ( ! defined( 'ELEMENTOR_TESTS' ) ) { |
| 836 |
// In tests we run the instance manually. |
| 837 |
Plugin::instance(); |
| 838 |
} |
| 839 |
|