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

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

87 lines 2.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\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 'utm_source' => 'kit-library',
59 'utm_medium' => 'wp-dash',
60 'utm_campaign' => 'library-connect',
61 'utm_term' => '%%page%%', // Will be replaced in the frontend.
62 ] ),
63 'access_level' => ConnectModule::ACCESS_LEVEL_CORE,
64 ] );
65 }
66
67 /**
68 * Module constructor.
69 */
70 public function __construct() {
71 Plugin::$instance->data_manager_v2->register_controller( new Kits_Controller() );
72 Plugin::$instance->data_manager_v2->register_controller( new Taxonomies_Controller() );
73
74 add_action( 'admin_menu', function () {
75 $this->register_admin_menu();
76 }, 50 /* after Elementor page */ );
77
78 add_action( 'elementor/connect/apps/register', function ( ConnectModule $connect_module ) {
79 $connect_module->register_app( 'kit-library', Kit_Library::get_class_name() );
80 } );
81
82 add_action( 'elementor/init', function () {
83 $this->set_kit_library_settings();
84 }, 12 /** after the initiation of the connect kit library */ );
85 }
86 }
87