PluginProbe
Elementor Website Builder – more than just a page builder / 3.5.0-dev9
Elementor Website Builder – more than just a page builder v3.5.0-dev9
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
← All changes | core/app/modules/kit-library/module.php +64 -11 4.2.23.5.0-dev9 View file →
@@ -1,28 +1,81 @@
1 1 <?php
2 2 namespace Elementor\Core\App\Modules\KitLibrary;
3 3
4 +use Elementor\Plugin;
5 +use Elementor\TemplateLibrary\Source_Local;
4 6 use Elementor\Core\Base\Module as BaseModule;
7 +use Elementor\Core\App\Modules\KitLibrary\Connect\Kit_Library;
8 +use Elementor\Core\Common\Modules\Connect\Module as ConnectModule;
9 +use Elementor\Core\App\Modules\KitLibrary\Data\Kits\Controller as Kits_Controller;
10 +use Elementor\Core\App\Modules\KitLibrary\Data\Taxonomies\Controller as Taxonomies_Controller;
5 11
6 12 if ( ! defined( 'ABSPATH' ) ) {
7 - exit; // Exit if accessed directly.
13 + exit; // Exit if accessed directly
8 14 }
9 15
10 -/**
11 - * This App class exists for backwards compatibility with 3rd parties.
12 - *
13 - * @deprecated 3.8.0
14 - */
15 16 class Module extends BaseModule {
17 + /**
18 + * Get name.
19 + *
20 + * @access public
21 + *
22 + * @return string
23 + */
24 + public function get_name() {
25 + return 'kit-library';
26 + }
16 27
17 28 /**
18 - * @deprecated 3.8.0
29 + * Register the admin menu.
19 30 */
20 - const VERSION = '1.0.0';
31 + private function register_admin_menu() {
32 + add_submenu_page(
33 + Source_Local::ADMIN_MENU_SLUG,
34 + __( 'Kit Library', 'elementor' ),
35 + __( 'Kit Library', 'elementor' ),
36 + 'manage_options',
37 + Plugin::$instance->app->get_base_url() . '#/kit-library'
38 + );
39 + }
21 40
41 + private function set_kit_library_settings() {
42 + if ( ! Plugin::$instance->common ) {
43 + return;
44 + }
45 +
46 + /** @var ConnectModule $connect */
47 + $connect = Plugin::$instance->common->get_component( 'connect' );
48 +
49 + /** @var Kit_Library $kit_library */
50 + $kit_library = $connect->get_app( 'kit-library' );
51 +
52 + Plugin::$instance->app->set_settings( 'kit-library', [
53 + 'has_access_to_module' => current_user_can( 'administrator' ),
54 + 'subscription_plans' => $connect->get_subscription_plans( 'wp-kit-library' ),
55 + 'is_pro' => false,
56 + 'is_library_connected' => $kit_library->is_connected(),
57 + 'library_connect_url' => $kit_library->get_admin_url( 'authorize' ),
58 + 'access_level' => ConnectModule::ACCESS_LEVEL_CORE,
59 + ] );
60 + }
61 +
22 62 /**
23 - * @deprecated 3.8.0
63 + * Module constructor.
24 64 */
25 - public function get_name() {
26 - return 'kit-library-bc';
65 + public function __construct() {
66 + Plugin::$instance->data_manager->register_controller( Kits_Controller::class );
67 + Plugin::$instance->data_manager->register_controller( Taxonomies_Controller::class );
68 +
69 + add_action( 'admin_menu', function () {
70 + $this->register_admin_menu();
71 + }, 50 /* after Elementor page */ );
72 +
73 + add_action( 'elementor/connect/apps/register', function ( ConnectModule $connect_module ) {
74 + $connect_module->register_app( 'kit-library', Kit_Library::get_class_name() );
75 + } );
76 +
77 + add_action( 'elementor/init', function () {
78 + $this->set_kit_library_settings();
79 + }, 12 /** after the initiation of the connect kit library */ );
27 80 }
28 81 }