PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev2
Elementor Website Builder – more than just a page builder v3.28.0-dev2
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 / modules / cloud-library / module.php

module.php in Elementor Website Builder – more than just a page builder 3.28.0-dev2, at modules/cloud-library/module.php

80 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\CloudLibrary;
3
4 use Elementor\Core\Base\Module as BaseModule;
5 use Elementor\Core\Common\Modules\Connect\Module as ConnectModule;
6 use Elementor\Modules\CloudLibrary\Connect\Cloud_Library;
7 use Elementor\Core\Common\Modules\Connect\Apps\Library;
8 use Elementor\Core\Experiments\Manager as ExperimentsManager;
9 use Elementor\Plugin;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly.
13 }
14
15 class Module extends BaseModule {
16
17 public function get_name(): string {
18 return 'cloud-library';
19 }
20
21 public function __construct() {
22 parent::__construct();
23
24 $this->register_experiment();
25
26 if ( Plugin::$instance->experiments->is_feature_active( $this->get_name() ) ) {
27 $this->register_app();
28
29 add_action( 'elementor/init', function () {
30 $this->set_cloud_library_settings();
31 }, 12 /** After the initiation of the connect cloud library */ );
32 }
33 }
34
35 private function register_experiment() {
36 Plugin::$instance->experiments->add_feature( [
37 'name' => $this->get_name(),
38 'title' => esc_html__( 'Cloud Library', 'elementor' ),
39 'description' => esc_html__( 'Enable Cloud Library.', 'elementor' ),
40 'release_status' => ExperimentsManager::RELEASE_STATUS_DEV,
41 'default' => ExperimentsManager::STATE_INACTIVE,
42 'hidden' => true,
43 ] );
44 }
45
46 private function register_app() {
47 add_action( 'elementor/connect/apps/register', function ( ConnectModule $connect_module ) {
48 $connect_module->register_app( 'cloud-library', Cloud_Library::get_class_name() );
49 } );
50 }
51
52 private function set_cloud_library_settings() {
53 if ( ! Plugin::$instance->common ) {
54 return;
55 }
56
57 /** @var ConnectModule $connect */
58 $connect = Plugin::$instance->common->get_component( 'connect' );
59
60 /** @var Library $library */
61 $library = $connect->get_app( 'library' );
62
63 if ( ! $library ) {
64 return;
65 }
66
67 Plugin::$instance->app->set_settings( 'cloud-library', [
68 'library_connect_url' => esc_url( $library->get_admin_url( 'authorize', [
69 'utm_source' => 'template-library',
70 'utm_medium' => 'wp-dash',
71 'utm_campaign' => 'library-connect',
72 'utm_content' => 'cloud-library',
73 ] ) ),
74 'library_connect_title' => esc_html__( 'Connect', 'elementor' ),
75 'library_connect_sub_title' => esc_html__( 'Sub Title', 'elementor' ),
76 'library_connect_button_text' => esc_html__( 'Connect', 'elementor' ),
77 ] );
78 }
79 }
80