PluginProbe
Elementor Website Builder – more than just a page builder / 3.4.6
Elementor Website Builder – more than just a page builder v3.4.6
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 / app / modules / kit-library / module.php

module.php in Elementor Website Builder – more than just a page builder 3.4.6, at core/app/modules/kit-library/module.php

82 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Core\App\Modules\KitLibrary;
3
4 use Elementor\Plugin;
5 use Elementor\TemplateLibrary\Source_Local;
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;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly
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 }
27
28 /**
29 * Register the admin menu.
30 */
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 }
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
62 /**
63 * Module constructor.
64 */
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 */ );
80 }
81 }
82