Elementor Beta (Developer Edition) - Version 1.1.0

Version Description

  • 2021-01-12 =
  • Tweak: Added support for Elementor Pro v3.1.0
Download this release

Release Info

Developer KingYes
Plugin Icon 128x128 Elementor Beta (Developer Edition)
Version 1.1.0
Comparing to
See all releases

Code changes from version 1.0.0 to 1.1.0

autoloader.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- namespace ElementorDev;
3
 
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit; // Exit if accessed directly.
1
  <?php
2
+ namespace ElementorBeta;
3
 
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit; // Exit if accessed directly.
bootstrap.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
- namespace ElementorDev;
3
 
4
- use ElementorDev\Core\Plugin;
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
7
  exit; // Exit if accessed directly.
@@ -9,6 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) {
9
 
10
  class Bootstrap {
11
  const ELEMENTOR_PLUGIN_NAME = 'elementor/elementor.php';
 
12
 
13
  /**
14
  * Bootstrap constructor.
1
  <?php
2
+ namespace ElementorBeta;
3
 
4
+ use ElementorBeta\Core\Plugin;
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
7
  exit; // Exit if accessed directly.
9
 
10
  class Bootstrap {
11
  const ELEMENTOR_PLUGIN_NAME = 'elementor/elementor.php';
12
+ const ELEMENTOR_PRO_PLUGIN_NAME = 'elementor-pro/elementor-pro.php';
13
 
14
  /**
15
  * Bootstrap constructor.
core/base/module.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- namespace ElementorDev\Core\Base;
3
 
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit; // Exit if accessed directly.
1
  <?php
2
+ namespace ElementorBeta\Core\Base;
3
 
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit; // Exit if accessed directly.
core/modules-manager.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
- namespace ElementorDev\Core;
3
 
4
- use ElementorDev\Core\Base\Module;
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
7
  exit; // Exit if accessed directly.
1
  <?php
2
+ namespace ElementorBeta\Core;
3
 
4
+ use ElementorBeta\Core\Base\Module;
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
7
  exit; // Exit if accessed directly.
core/plugin.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- namespace ElementorDev\Core;
3
 
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit; // Exit if accessed directly.
@@ -39,7 +39,7 @@ class Plugin {
39
  public function __construct() {
40
  $this->modules_manager = new Modules_Manager();
41
 
42
- add_action( 'init', [ $this, 'init' ] );
43
  }
44
 
45
  /**
1
  <?php
2
+ namespace ElementorBeta\Core;
3
 
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit; // Exit if accessed directly.
39
  public function __construct() {
40
  $this->modules_manager = new Modules_Manager();
41
 
42
+ add_action( 'init', [ $this, 'init' ], -1 /* Should run BEFORE Elementor */ );
43
  }
44
 
45
  /**
elementor-beta.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Elementor Beta (Developer Edition)
4
  * Plugin URI: https://elementor.com
5
  * Description: Elementor Developer Edition gives you direct access into Elementor’s development process, and lets you take an active part in perfecting our product. Each Developer Edition release will contain experimental functionalities that developers will be able to use to get familiar with the next releases before they are published.
6
- * Version: 1.0.0
7
  * Author: Elementor.com
8
  * Author URI: https://elementor.com/?utm_source=wp-plugins&utm_campaign=dev-author-uri&utm_medium=wp-dash
9
  * Text Domain: elementor-beta
@@ -11,10 +11,10 @@
11
  * @package elementor-beta
12
  */
13
 
14
- use ElementorDev\Bootstrap;
15
- use ElementorDev\Autoloader;
16
- use ElementorDev\Modules\DeveloperEdition\Admin_Bar;
17
- use ElementorDev\Modules\DeveloperEdition\Version_Control;
18
 
19
  if ( ! defined( 'ABSPATH' ) ) {
20
  exit; // Exit if accessed directly.
@@ -37,18 +37,18 @@ if ( ! defined( 'ELEMENTOR_BETA_URL' ) ) {
37
  }
38
 
39
  if ( ! defined( 'ELEMENTOR_BETA_NAMESPACE' ) ) {
40
- define( 'ELEMENTOR_BETA_NAMESPACE', 'ElementorDev' );
41
  }
42
 
43
  if ( ! defined( 'ELEMENTOR_BETA_VERSION' ) ) {
44
- define( 'ELEMENTOR_BETA_VERSION', '1.0.0' );
45
  }
46
 
47
  // Run autoloader
48
  require_once __DIR__ . '/autoloader.php';
49
  Autoloader::run();
50
 
51
- $activate_and_deactivate_action = [ Version_Control::class, 'on_activate_and_deactivate_plugin' ];
52
 
53
  register_activation_hook( __FILE__, $activate_and_deactivate_action );
54
  register_activation_hook( __FILE__, [ Admin_Bar::class, 'enable_elementor_inspector' ] );
3
  * Plugin Name: Elementor Beta (Developer Edition)
4
  * Plugin URI: https://elementor.com
5
  * Description: Elementor Developer Edition gives you direct access into Elementor’s development process, and lets you take an active part in perfecting our product. Each Developer Edition release will contain experimental functionalities that developers will be able to use to get familiar with the next releases before they are published.
6
+ * Version: 1.1.0
7
  * Author: Elementor.com
8
  * Author URI: https://elementor.com/?utm_source=wp-plugins&utm_campaign=dev-author-uri&utm_medium=wp-dash
9
  * Text Domain: elementor-beta
11
  * @package elementor-beta
12
  */
13
 
14
+ use ElementorBeta\Bootstrap;
15
+ use ElementorBeta\Autoloader;
16
+ use ElementorBeta\Modules\DeveloperEdition\Module;
17
+ use ElementorBeta\Modules\DeveloperEdition\Admin_Bar;
18
 
19
  if ( ! defined( 'ABSPATH' ) ) {
20
  exit; // Exit if accessed directly.
37
  }
38
 
39
  if ( ! defined( 'ELEMENTOR_BETA_NAMESPACE' ) ) {
40
+ define( 'ELEMENTOR_BETA_NAMESPACE', 'ElementorBeta' );
41
  }
42
 
43
  if ( ! defined( 'ELEMENTOR_BETA_VERSION' ) ) {
44
+ define( 'ELEMENTOR_BETA_VERSION', '1.1.0' );
45
  }
46
 
47
  // Run autoloader
48
  require_once __DIR__ . '/autoloader.php';
49
  Autoloader::run();
50
 
51
+ $activate_and_deactivate_action = [ Module::class, 'on_activate_and_deactivate_plugin' ];
52
 
53
  register_activation_hook( __FILE__, $activate_and_deactivate_action );
54
  register_activation_hook( __FILE__, [ Admin_Bar::class, 'enable_elementor_inspector' ] );
modules/developer-edition/admin-bar.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
- namespace ElementorDev\Modules\DeveloperEdition;
3
 
4
- use ElementorDev\Bootstrap;
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
7
  exit; // Exit if accessed directly.
@@ -34,7 +34,7 @@ class Admin_Bar {
34
  public function add_menu_in_admin_bar( \WP_Admin_Bar $wp_admin_bar ) {
35
  // Always add "report an issue" link even at admin pages.
36
  $wp_admin_bar->add_node( [
37
- 'id' => 'elementor_dev_secondary_report_issue',
38
  'title' => __( 'Report an issue', 'elementor-beta' ),
39
  'parent' => 'top-secondary',
40
  'href' => self::REPORT_AN_ISSUE_URL,
@@ -53,15 +53,15 @@ class Admin_Bar {
53
  ] );
54
 
55
  $wp_admin_bar->add_menu( [
56
- 'id' => 'elementor_inspector_elementor_dev',
57
  'parent' => 'elementor_inspector',
58
  'title' => __( 'Developer Edition', 'elementor-beta' ),
59
  ] );
60
 
61
  if ( current_user_can( 'manage_options' ) ) {
62
  $wp_admin_bar->add_menu( [
63
- 'id' => 'elementor_inspector_elementor_dev_system',
64
- 'parent' => 'elementor_inspector_elementor_dev',
65
  'href' => self_admin_url( 'admin.php?page=elementor-system-info' ),
66
  'title' => '<strong>' . __( 'System info', 'elementor-beta' ) . '</strong>',
67
  'meta' => [
@@ -71,8 +71,8 @@ class Admin_Bar {
71
  }
72
 
73
  $wp_admin_bar->add_menu( [
74
- 'id' => 'elementor_inspector_elementor_dev_report',
75
- 'parent' => 'elementor_inspector_elementor_dev',
76
  'href' => self::REPORT_AN_ISSUE_URL,
77
  'title' => '<strong>' . __( 'Report an issue', 'elementor-beta' ) . '</strong>',
78
  'meta' => [
@@ -80,22 +80,29 @@ class Admin_Bar {
80
  ],
81
  ] );
82
 
83
- $elementor_version = null;
84
- $elementor_path = plugin_dir_path( Bootstrap::ELEMENTOR_PLUGIN_NAME );
 
 
85
 
86
- if ( defined( 'ELEMENTOR_VERSION' ) ) {
87
- $elementor_version = ELEMENTOR_VERSION;
88
- } elseif ( is_readable( $elementor_path ) ) {
89
- $elementor_version = get_file_data( $elementor_path, [ 'Version' => 'Version' ], false )['Version'];
90
- }
91
 
92
  if ( $elementor_version ) {
93
  $wp_admin_bar->add_menu( [
94
- 'id' => 'elementor_inspector_elementor_dev_elementor_ver',
95
- 'parent' => 'elementor_inspector_elementor_dev',
96
  'title' => __( 'Elementor', 'elementor-beta' ) . ' v' . $elementor_version,
97
  ] );
98
  }
 
 
 
 
 
 
 
 
99
  }
100
 
101
  /**
@@ -106,11 +113,11 @@ class Admin_Bar {
106
  return;
107
  }
108
 
109
- wp_register_style( 'elementor-dev-admin-bar-inline', false, [], ELEMENTOR_BETA_VERSION );
110
- wp_enqueue_style( 'elementor-dev-admin-bar-inline' );
111
 
112
- wp_add_inline_style('elementor-dev-admin-bar-inline', '
113
- #wpadminbar #wp-admin-bar-elementor_dev_secondary_report_issue > .ab-item::before {
114
  content: "\e813";
115
  font-family: eicons;
116
  top: 3px;
1
  <?php
2
+ namespace ElementorBeta\Modules\DeveloperEdition;
3
 
4
+ use ElementorBeta\Core\Plugin;
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
7
  exit; // Exit if accessed directly.
34
  public function add_menu_in_admin_bar( \WP_Admin_Bar $wp_admin_bar ) {
35
  // Always add "report an issue" link even at admin pages.
36
  $wp_admin_bar->add_node( [
37
+ 'id' => 'elementor_beta_secondary_report_issue',
38
  'title' => __( 'Report an issue', 'elementor-beta' ),
39
  'parent' => 'top-secondary',
40
  'href' => self::REPORT_AN_ISSUE_URL,
53
  ] );
54
 
55
  $wp_admin_bar->add_menu( [
56
+ 'id' => 'elementor_inspector_elementor_beta',
57
  'parent' => 'elementor_inspector',
58
  'title' => __( 'Developer Edition', 'elementor-beta' ),
59
  ] );
60
 
61
  if ( current_user_can( 'manage_options' ) ) {
62
  $wp_admin_bar->add_menu( [
63
+ 'id' => 'elementor_inspector_elementor_beta_system',
64
+ 'parent' => 'elementor_inspector_elementor_beta',
65
  'href' => self_admin_url( 'admin.php?page=elementor-system-info' ),
66
  'title' => '<strong>' . __( 'System info', 'elementor-beta' ) . '</strong>',
67
  'meta' => [
71
  }
72
 
73
  $wp_admin_bar->add_menu( [
74
+ 'id' => 'elementor_inspector_elementor_beta_report',
75
+ 'parent' => 'elementor_inspector_elementor_beta',
76
  'href' => self::REPORT_AN_ISSUE_URL,
77
  'title' => '<strong>' . __( 'Report an issue', 'elementor-beta' ) . '</strong>',
78
  'meta' => [
80
  ],
81
  ] );
82
 
83
+ /** @var Module $module */
84
+ $module = Plugin::instance()
85
+ ->modules_manager
86
+ ->get_modules( 'developer-edition' );
87
 
88
+ $elementor_version = $module->core_version_control->get_current_version();
89
+ $elementor_pro_version = $module->pro_version_control->get_current_version();
 
 
 
90
 
91
  if ( $elementor_version ) {
92
  $wp_admin_bar->add_menu( [
93
+ 'id' => 'elementor_inspector_elementor_beta_elementor_ver',
94
+ 'parent' => 'elementor_inspector_elementor_beta',
95
  'title' => __( 'Elementor', 'elementor-beta' ) . ' v' . $elementor_version,
96
  ] );
97
  }
98
+
99
+ if ( $elementor_pro_version ) {
100
+ $wp_admin_bar->add_menu( [
101
+ 'id' => 'elementor_inspector_elementor_beta_elementor_pro_ver',
102
+ 'parent' => 'elementor_inspector_elementor_beta',
103
+ 'title' => __( 'Elementor Pro', 'elementor-beta' ) . ' v' . $elementor_pro_version,
104
+ ] );
105
+ }
106
  }
107
 
108
  /**
113
  return;
114
  }
115
 
116
+ wp_register_style( 'elementor-beta-admin-bar-inline', false, [], ELEMENTOR_BETA_VERSION );
117
+ wp_enqueue_style( 'elementor-beta-admin-bar-inline' );
118
 
119
+ wp_add_inline_style('elementor-beta-admin-bar-inline', '
120
+ #wpadminbar #wp-admin-bar-elementor_beta_secondary_report_issue > .ab-item::before {
121
  content: "\e813";
122
  font-family: eicons;
123
  top: 3px;
modules/developer-edition/assets/css/developer-edition.css CHANGED
@@ -1,5 +1,5 @@
1
- .elementor-dev .elementor-panel #elementor-panel-header-title.elementor-dev-badge::after,
2
- .elementor-dev #toplevel_page_elementor .wp-menu-name::after {
3
  content: "DEV";
4
  display: inline-block;
5
  position: relative;
@@ -11,61 +11,61 @@
11
  margin-left: 10px;
12
  }
13
 
14
- html[dir="rtl"] .elementor-dev .elementor-panel #elementor-panel-header-title.elementor-dev-badge::after,
15
- html[dir="rtl"] .elementor-dev #toplevel_page_elementor .wp-menu-name::after {
16
  margin-left: 0;
17
  margin-right: 10px;
18
  }
19
 
20
- .elementor-dev .elementor-panel #elementor-panel-header-title.elementor-dev-badge::after {
21
  top: -3px;
22
  color: #495157;
23
  background-color: #fff;
24
  }
25
 
26
- .elementor-dev #toplevel_page_elementor .wp-menu-name::after {
27
  top: -1px;
28
  background-color: rgba(240, 245, 250, 0.6);
29
  color: #23282d;
30
  }
31
 
32
- .elementor-dev #toplevel_page_elementor a.wp-has-current-submenu .wp-menu-name::after {
33
  top: -1px;
34
  background-color: #fff;
35
  }
36
 
37
- .admin-color-light.elementor-dev #toplevel_page_elementor .wp-menu-name::after {
38
  background-color: #999;
39
  color: #fff;
40
  }
41
 
42
- .admin-color-light.elementor-dev #toplevel_page_elementor a.wp-has-current-submenu .wp-menu-name::after {
43
  background-color: #ccc;
44
  color: #23282d;
45
  }
46
 
47
- html[dir="rtl"] .elementor-dev #toplevel_page_elementor .wp-menu-name::after {
48
  top: -3px;
49
  }
50
 
51
- .elementor-dev .elementor-panel .elementor-panel-navigation .elementor-panel-navigation-tab.elementor-active {
52
  border-bottom: 3px solid #23282d;
53
  }
54
 
55
- .elementor-dev.elementor-dev-theme-dark .elementor-panel .elementor-panel-navigation .elementor-panel-navigation-tab.elementor-active {
56
  border-bottom: 3px solid #fff;
57
  }
58
 
59
- .elementor-dev .elementor-panel #elementor-panel-header {
60
  background-color: #495157;
61
  }
62
 
63
- .elementor-dev.elementor-dev-theme-dark .elementor-panel #elementor-panel-header {
64
  background-color: #26292C;
65
  }
66
 
67
  @media (prefers-color-scheme: dark) {
68
- .elementor-dev.elementor-dev-theme-auto .elementor-panel #elementor-panel-header {
69
  background-color: #26292C;
70
  }
71
  }
1
+ .elementor-beta .elementor-panel #elementor-panel-header-title.elementor-beta-badge::after,
2
+ .elementor-beta #toplevel_page_elementor .wp-menu-name::after {
3
  content: "DEV";
4
  display: inline-block;
5
  position: relative;
11
  margin-left: 10px;
12
  }
13
 
14
+ html[dir="rtl"] .elementor-beta .elementor-panel #elementor-panel-header-title.elementor-beta-badge::after,
15
+ html[dir="rtl"] .elementor-beta #toplevel_page_elementor .wp-menu-name::after {
16
  margin-left: 0;
17
  margin-right: 10px;
18
  }
19
 
20
+ .elementor-beta .elementor-panel #elementor-panel-header-title.elementor-beta-badge::after {
21
  top: -3px;
22
  color: #495157;
23
  background-color: #fff;
24
  }
25
 
26
+ .elementor-beta #toplevel_page_elementor .wp-menu-name::after {
27
  top: -1px;
28
  background-color: rgba(240, 245, 250, 0.6);
29
  color: #23282d;
30
  }
31
 
32
+ .elementor-beta #toplevel_page_elementor a.wp-has-current-submenu .wp-menu-name::after {
33
  top: -1px;
34
  background-color: #fff;
35
  }
36
 
37
+ .admin-color-light.elementor-beta #toplevel_page_elementor .wp-menu-name::after {
38
  background-color: #999;
39
  color: #fff;
40
  }
41
 
42
+ .admin-color-light.elementor-beta #toplevel_page_elementor a.wp-has-current-submenu .wp-menu-name::after {
43
  background-color: #ccc;
44
  color: #23282d;
45
  }
46
 
47
+ html[dir="rtl"] .elementor-beta #toplevel_page_elementor .wp-menu-name::after {
48
  top: -3px;
49
  }
50
 
51
+ .elementor-beta .elementor-panel .elementor-panel-navigation .elementor-panel-navigation-tab.elementor-active {
52
  border-bottom: 3px solid #23282d;
53
  }
54
 
55
+ .elementor-beta.elementor-beta-theme-dark .elementor-panel .elementor-panel-navigation .elementor-panel-navigation-tab.elementor-active {
56
  border-bottom: 3px solid #fff;
57
  }
58
 
59
+ .elementor-beta .elementor-panel #elementor-panel-header {
60
  background-color: #495157;
61
  }
62
 
63
+ .elementor-beta.elementor-beta-theme-dark .elementor-panel #elementor-panel-header {
64
  background-color: #26292C;
65
  }
66
 
67
  @media (prefers-color-scheme: dark) {
68
+ .elementor-beta.elementor-beta-theme-auto .elementor-panel #elementor-panel-header {
69
  background-color: #26292C;
70
  }
71
  }
modules/developer-edition/assets/js/developer-edition.js CHANGED
@@ -1,8 +1,8 @@
1
  document.addEventListener( 'DOMContentLoaded', () => {
2
- document.body.classList.add( 'elementor-dev' );
3
 
4
- if ( elementorDevUiTheme ) {
5
- document.body.classList.add( `elementor-dev-theme-${ elementorDevUiTheme }` )
6
  }
7
 
8
  const routeCommandsToShowDevBadge = [
@@ -14,6 +14,6 @@ document.addEventListener( 'DOMContentLoaded', () => {
14
  $e.routes.on( 'run:after', () => {
15
  document.getElementById( 'elementor-panel-header-title' )
16
  .classList
17
- .toggle( 'elementor-dev-badge', routeCommandsToShowDevBadge.includes( $e.routes.current.panel ) )
18
  } );
19
  } );
1
  document.addEventListener( 'DOMContentLoaded', () => {
2
+ document.body.classList.add( 'elementor-beta' );
3
 
4
+ if ( elementorBetaUiTheme ) {
5
+ document.body.classList.add( `elementor-beta-theme-${ elementorBetaUiTheme }` )
6
  }
7
 
8
  const routeCommandsToShowDevBadge = [
14
  $e.routes.on( 'run:after', () => {
15
  document.getElementById( 'elementor-panel-header-title' )
16
  .classList
17
+ .toggle( 'elementor-beta-badge', routeCommandsToShowDevBadge.includes( $e.routes.current.panel ) )
18
  } );
19
  } );
modules/developer-edition/base-version-control.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace ElementorBeta\Modules\DeveloperEdition;
3
+
4
+ if ( ! defined( 'ABSPATH' ) ) {
5
+ exit; // Exit if accessed directly.
6
+ }
7
+
8
+ abstract class Base_Version_Control {
9
+ /**
10
+ * @return string|null
11
+ */
12
+ public function get_current_version() {
13
+
14
+ $plugin_config = $this->get_plugin_config();
15
+
16
+ if ( ! $plugin_config['is_active'] ) {
17
+ return null;
18
+ }
19
+
20
+ if ( defined( $plugin_config['version_const'] ) ) {
21
+ return constant( $plugin_config['version_const'] );
22
+ }
23
+
24
+ $plugin_path = plugin_dir_path( $plugin_config['plugin_name'] );
25
+
26
+ if ( is_readable( $plugin_path ) ) {
27
+ return get_file_data( $plugin_path, [ 'Version' => 'Version' ], false )['Version'];
28
+ }
29
+
30
+ return null;
31
+ }
32
+
33
+ /**
34
+ * Return true if the version is stable or with the same channel
35
+ *
36
+ * Examples for valid version: 1.0.0, 1.0.0-dev1, 1.0.0.1, 1.0.0.1-dev2
37
+ *
38
+ * @param $is_valid
39
+ * @param $version
40
+ *
41
+ * @return bool
42
+ */
43
+ protected function is_valid_rollback_version( $is_valid, $version ) {
44
+ return (bool) preg_match( '/^\d+(\.\d+){2,3}(-dev\d*)?$/', $version );
45
+ }
46
+
47
+ /**
48
+ * @return array {
49
+ * @type string $version_const
50
+ * @type string $plugin_name
51
+ * @type boolean $is_active
52
+ * }
53
+ */
54
+ abstract protected function get_plugin_config();
55
+ }
modules/developer-edition/{version-control.php → core-version-control.php} RENAMED
@@ -2,15 +2,15 @@
2
  /**
3
  * Inspired by: Woocommerce Beta Tester (https://github.com/woocommerce/woocommerce-beta-tester).
4
  */
5
- namespace ElementorDev\Modules\DeveloperEdition;
6
 
7
- use ElementorDev\Bootstrap;
8
 
9
  if ( ! defined( 'ABSPATH' ) ) {
10
  exit; // Exit if accessed directly.
11
  }
12
 
13
- class Version_Control {
14
 
15
  /**
16
  * WordPress info url for the elementor plugin.
@@ -21,8 +21,10 @@ class Version_Control {
21
  * Version_Control constructor.
22
  */
23
  public function __construct() {
24
- add_filter( 'pre_set_site_transient_update_plugins', [ $this, 'pre_set_site_transient_update_plugins' ] );
25
- add_filter( 'elementor/settings/tools/rollback/is_valid_rollback_version', [ $this, 'is_valid_rollback_version' ], 10, 2 );
 
 
26
  }
27
 
28
  /**
@@ -34,25 +36,12 @@ class Version_Control {
34
  static $key;
35
 
36
  if ( ! $key ) {
37
- $key = md5( 'elementor_dev_wp_org_data' );
38
  }
39
 
40
  return $key;
41
  }
42
 
43
- /**
44
- * Will be execute when the plugin is on activate or deactivate mode.
45
- */
46
- public static function on_activate_and_deactivate_plugin() {
47
- // Force recheck for new plugin versions
48
- delete_site_transient( 'update_plugins' );
49
-
50
- if ( defined( 'ELEMENTOR_VERSION' ) ) {
51
- // Force recalculate rollback versions in elementor.
52
- delete_transient( 'elementor_rollback_versions_' . ELEMENTOR_VERSION );
53
- }
54
- }
55
-
56
  /**
57
  * Checks if the elementor should updated or not based on the latest dev tag release.
58
  *
@@ -61,7 +50,10 @@ class Version_Control {
61
  * @return object
62
  */
63
  public function pre_set_site_transient_update_plugins( $transient ) {
64
- $current_version = $this->get_elementor_plugin_data()['Version'];
 
 
 
65
  $latest_dev_release = $this->get_latest_dev_release();
66
 
67
  if ( ! $latest_dev_release ) {
@@ -74,38 +66,20 @@ class Version_Control {
74
  return $transient;
75
  }
76
 
77
- // Populate response data.
78
- if ( ! isset( $transient->response[ Bootstrap::ELEMENTOR_PLUGIN_NAME ] ) ) {
79
- $transient->response[ Bootstrap::ELEMENTOR_PLUGIN_NAME ] = (object) [
80
- 'plugin' => Bootstrap::ELEMENTOR_PLUGIN_NAME,
81
- 'slug' => basename( Bootstrap::ELEMENTOR_PLUGIN_NAME, '.php' ),
82
- 'url' => 'https://elementor.com/',
83
- ];
84
- }
85
-
86
  $download_url = $this->get_download_url( $latest_dev_release );
87
 
88
- $transient->response[ Bootstrap::ELEMENTOR_PLUGIN_NAME ]->new_version = $latest_dev_release;
89
- $transient->response[ Bootstrap::ELEMENTOR_PLUGIN_NAME ]->zip_url = $download_url;
90
- $transient->response[ Bootstrap::ELEMENTOR_PLUGIN_NAME ]->package = $download_url;
 
 
 
 
 
91
 
92
  return $transient;
93
  }
94
 
95
- /**
96
- * Return true if the version is stable or with the same channel
97
- *
98
- * Examples for valid version: 1.0.0, 1.0.0-dev1, 1.0.0.1, 1.0.0.1-dev2
99
- *
100
- * @param $is_valid
101
- * @param $version
102
- *
103
- * @return bool
104
- */
105
- public function is_valid_rollback_version( $is_valid, $version ) {
106
- return (bool) preg_match( '/^\d+(\.\d+){2,3}(-dev\d*)?$/', $version );
107
- }
108
-
109
  /**
110
  * Returns the latest dev tag release.
111
  *
@@ -124,6 +98,17 @@ class Version_Control {
124
  return $this->get_latest_release_by_channel( 'stable' );
125
  }
126
 
 
 
 
 
 
 
 
 
 
 
 
127
  /**
128
  * @param $channel
129
  *
@@ -211,13 +196,4 @@ class Version_Control {
211
 
212
  return $data[ $version ];
213
  }
214
-
215
- /**
216
- * Get Plugin data.
217
- *
218
- * @return array
219
- */
220
- protected function get_elementor_plugin_data() {
221
- return get_plugin_data( WP_PLUGIN_DIR . '/' . Bootstrap::ELEMENTOR_PLUGIN_NAME );
222
- }
223
  }
2
  /**
3
  * Inspired by: Woocommerce Beta Tester (https://github.com/woocommerce/woocommerce-beta-tester).
4
  */
5
+ namespace ElementorBeta\Modules\DeveloperEdition;
6
 
7
+ use ElementorBeta\Bootstrap;
8
 
9
  if ( ! defined( 'ABSPATH' ) ) {
10
  exit; // Exit if accessed directly.
11
  }
12
 
13
+ class Core_Version_Control extends Base_Version_Control {
14
 
15
  /**
16
  * WordPress info url for the elementor plugin.
21
  * Version_Control constructor.
22
  */
23
  public function __construct() {
24
+ add_filter( 'pre_set_site_transient_update_plugins', [ $this, 'pre_set_site_transient_update_plugins' ], 11 /* After Elementor beta */ );
25
+ add_filter( 'elementor/settings/tools/rollback/is_valid_rollback_version', function ( $is_valid, $version ) {
26
+ return $this->is_valid_rollback_version( $is_valid, $version );
27
+ }, 10, 2 );
28
  }
29
 
30
  /**
36
  static $key;
37
 
38
  if ( ! $key ) {
39
+ $key = md5( 'elementor_beta_wp_org_data' );
40
  }
41
 
42
  return $key;
43
  }
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  /**
46
  * Checks if the elementor should updated or not based on the latest dev tag release.
47
  *
50
  * @return object
51
  */
52
  public function pre_set_site_transient_update_plugins( $transient ) {
53
+ // Make sure that "elementor beta - developer edition" is the only channel for version updates.
54
+ unset( $transient->response[ Bootstrap::ELEMENTOR_PLUGIN_NAME ] );
55
+
56
+ $current_version = $this->get_current_version();
57
  $latest_dev_release = $this->get_latest_dev_release();
58
 
59
  if ( ! $latest_dev_release ) {
66
  return $transient;
67
  }
68
 
 
 
 
 
 
 
 
 
 
69
  $download_url = $this->get_download_url( $latest_dev_release );
70
 
71
+ $transient->response[ Bootstrap::ELEMENTOR_PLUGIN_NAME ] = (object) [
72
+ 'plugin' => Bootstrap::ELEMENTOR_PLUGIN_NAME,
73
+ 'slug' => basename( Bootstrap::ELEMENTOR_PLUGIN_NAME, '.php' ),
74
+ 'url' => 'https://elementor.com/',
75
+ 'new_version' => $latest_dev_release,
76
+ 'zip_url' => $download_url,
77
+ 'package' => $download_url,
78
+ ];
79
 
80
  return $transient;
81
  }
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  /**
84
  * Returns the latest dev tag release.
85
  *
98
  return $this->get_latest_release_by_channel( 'stable' );
99
  }
100
 
101
+ /**
102
+ * @return array
103
+ */
104
+ protected function get_plugin_config() {
105
+ return [
106
+ 'plugin_name' => Bootstrap::ELEMENTOR_PLUGIN_NAME,
107
+ 'version_const' => 'ELEMENTOR_VERSION',
108
+ 'is_active' => true,
109
+ ];
110
+ }
111
+
112
  /**
113
  * @param $channel
114
  *
196
 
197
  return $data[ $version ];
198
  }
 
 
 
 
 
 
 
 
 
199
  }
modules/developer-edition/experiments.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace ElementorBeta\Modules\DeveloperEdition;
3
+
4
+ use Elementor\Core\Experiments\Manager as ExperimentsManager;
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit; // Exit if accessed directly.
8
+ }
9
+
10
+ class Experiments {
11
+ /**
12
+ * Enable some experiments based on some conditions
13
+ *
14
+ * @param ExperimentsManager $experiments_manager
15
+ * @param array $experimental_data
16
+ */
17
+ public function enable_experiments( ExperimentsManager $experiments_manager, array $experimental_data ) {
18
+ if ( ! $this->is_beta_release_or_higher( $experimental_data ) ) {
19
+ return;
20
+ }
21
+
22
+ $experiments_manager->set_feature_default_state( $experimental_data['name'], ExperimentsManager::STATE_ACTIVE );
23
+ }
24
+
25
+ /**
26
+ * Check if the experimental is in beta release or higher.
27
+ *x
28
+ * @param array $experimental_data
29
+ *
30
+ * @return bool
31
+ */
32
+ private function is_beta_release_or_higher( array $experimental_data ) {
33
+ $changeable_release_statues = [
34
+ ExperimentsManager::RELEASE_STATUS_BETA,
35
+ ExperimentsManager::RELEASE_STATUS_RC,
36
+ ExperimentsManager::RELEASE_STATUS_STABLE,
37
+ ];
38
+
39
+ return in_array( $experimental_data['release_status'], $changeable_release_statues, true );
40
+ }
41
+
42
+ /**
43
+ * Experiments constructor.
44
+ */
45
+ public function __construct() {
46
+ add_action( 'elementor/experiments/feature-registered', function ( ExperimentsManager $experiments_manager, array $experimental_data ) {
47
+ $this->enable_experiments( $experiments_manager, $experimental_data );
48
+ }, 10, 2 );
49
+ }
50
+ }
modules/developer-edition/module.php CHANGED
@@ -1,27 +1,54 @@
1
  <?php
2
- namespace ElementorDev\Modules\DeveloperEdition;
3
 
4
- use \ElementorDev\Core\Base\Module as BaseModule;
 
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
7
  exit; // Exit if accessed directly.
8
  }
9
 
10
  class Module extends BaseModule {
11
- const SETTINGS_KEY = 'elementor_dev_developer_edition';
12
 
13
  /**
14
- * @var Version_Control
15
  */
16
- public $version_control;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  /**
19
  * Module constructor.
20
  */
21
  public function __construct() {
22
- $this->version_control = new Version_Control();
 
 
23
  new Settings_Page();
24
  new Admin_Bar();
25
  new UI();
 
26
  }
27
  }
1
  <?php
2
+ namespace ElementorBeta\Modules\DeveloperEdition;
3
 
4
+ use ElementorBeta\Bootstrap;
5
+ use \ElementorBeta\Core\Base\Module as BaseModule;
6
 
7
  if ( ! defined( 'ABSPATH' ) ) {
8
  exit; // Exit if accessed directly.
9
  }
10
 
11
  class Module extends BaseModule {
12
+ const SETTINGS_KEY = 'elementor_beta_developer_edition';
13
 
14
  /**
15
+ * @var Core_Version_Control
16
  */
17
+ public $core_version_control;
18
+
19
+ /**
20
+ * @var Pro_Version_Control
21
+ */
22
+ public $pro_version_control;
23
+
24
+ /**
25
+ * Will be execute when the plugin is on activate or deactivate mode.
26
+ */
27
+ public static function on_activate_and_deactivate_plugin() {
28
+ // Force recheck for new plugin versions
29
+ delete_site_transient( 'update_plugins' );
30
+
31
+ if ( defined( 'ELEMENTOR_VERSION' ) ) {
32
+ // Force recalculate rollback versions in elementor.
33
+ delete_transient( 'elementor_rollback_versions_' . ELEMENTOR_VERSION );
34
+ }
35
+
36
+ if ( defined( 'ELEMENTOR_PRO_VERSION' ) ) {
37
+ // Force recalculate rollback versions in elementor pro.
38
+ delete_transient( 'elementor_pro_rollback_versions_' . ELEMENTOR_PRO_VERSION );
39
+ }
40
+ }
41
 
42
  /**
43
  * Module constructor.
44
  */
45
  public function __construct() {
46
+ $this->core_version_control = new Core_Version_Control();
47
+ $this->pro_version_control = new Pro_Version_Control( class_exists( 'ElementorPro\\Plugin' ) );
48
+
49
  new Settings_Page();
50
  new Admin_Bar();
51
  new UI();
52
+ new Experiments();
53
  }
54
  }
modules/developer-edition/pro-version-control.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace ElementorBeta\Modules\DeveloperEdition;
3
+
4
+ use ElementorBeta\Bootstrap;
5
+ use ElementorPro\License\API;
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit; // Exit if accessed directly.
9
+ }
10
+
11
+ class Pro_Version_Control extends Base_Version_Control {
12
+ /**
13
+ * @var boolean
14
+ */
15
+ protected $is_plugin_active;
16
+
17
+ /**
18
+ * @return array
19
+ */
20
+ protected function get_plugin_config() {
21
+ return [
22
+ 'plugin_name' => Bootstrap::ELEMENTOR_PRO_PLUGIN_NAME,
23
+ 'version_const' => 'ELEMENTOR_PRO_VERSION',
24
+ 'is_active' => $this->is_plugin_active,
25
+ ];
26
+ }
27
+
28
+ /**
29
+ * @param array $args
30
+ * @param $url
31
+ *
32
+ * @return array
33
+ */
34
+ private function add_dev_param_to_get_version_request( array $args, $url ) {
35
+ if (
36
+ API::STORE_URL !== $url ||
37
+ ! isset( $args['body']['edd_action'] )
38
+ || 'get_version' !== $args['body']['edd_action']
39
+ ) {
40
+ return $args;
41
+ }
42
+
43
+ $args['body']['dev'] = '1';
44
+
45
+ return $args;
46
+ }
47
+
48
+ /**
49
+ * Pro_Version_Control constructor.
50
+ *
51
+ * @param $is_plugin_active
52
+ */
53
+ public function __construct( $is_plugin_active ) {
54
+ $this->is_plugin_active = $is_plugin_active;
55
+
56
+ if ( $this->is_plugin_active ) {
57
+ add_filter( 'http_request_args', function ( array $args, $url ) {
58
+ return $this->add_dev_param_to_get_version_request( $args, $url );
59
+ }, 10, 2 );
60
+
61
+ add_filter( 'elementor-pro/settings/tools/rollback/is_valid_rollback_version', function ( $is_valid, $version ) {
62
+ return $this->is_valid_rollback_version( $is_valid, $version );
63
+ }, 10, 2 );
64
+ }
65
+ }
66
+ }
modules/developer-edition/settings-page.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
- namespace ElementorDev\Modules\DeveloperEdition;
3
 
4
  use Elementor\Plugin;
5
  use Elementor\Settings;
6
- use ElementorDev\Bootstrap;
7
 
8
  if ( ! defined( 'ABSPATH' ) ) {
9
  exit; // Exit if accessed directly.
@@ -13,55 +13,88 @@ class Settings_Page {
13
  /**
14
  * The page id
15
  */
16
- const PAGE_ID = 'elementor_dev_settings';
17
 
18
  /**
19
  * Init all the settings that should be saved
20
  */
21
  public function settings_init() {
22
  add_settings_section(
23
- 'elementor-dev-developer-edition-update',
24
  __( 'Elementor Developer Edition', 'elementor-beta' ),
25
  null,
26
  static::PAGE_ID
27
  );
28
 
29
  add_settings_field(
30
- 'elementor-dev-developer-edition-update-child',
31
  __( 'Get updates', 'elementor-beta' ),
32
  function () {
33
  $this->load_view( 'settings-page-get-updates.php' );
34
  },
35
  static::PAGE_ID,
36
- 'elementor-dev-developer-edition-update'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  );
38
 
39
  if ( current_user_can( 'update_plugins' ) ) {
40
  add_settings_section(
41
- 'elementor-dev-developer-edition-auto-update',
42
  __( 'Auto Plugin Updates', 'elementor-beta' ),
43
  null,
44
  static::PAGE_ID
45
  );
46
 
47
- register_setting( Module::SETTINGS_KEY, 'elementor_dev_auto_update', [
48
  'sanitize_callback' => [ $this, 'sanitize_update_auto_update' ],
49
  ] );
50
 
51
  add_settings_field(
52
- 'elementor-dev-developer-edition-auto-update-field',
53
  __( 'Auto update Elementor', 'elementor-beta' ),
54
  function () {
55
  $this->load_view( 'settings-page-auto-update.php' );
56
  },
57
  static::PAGE_ID,
58
- 'elementor-dev-developer-edition-auto-update'
59
  );
60
  }
61
 
62
  if ( 'yes' !== get_option( 'elementor_allow_tracking', 'no' ) ) {
63
  add_settings_section(
64
- 'elementor-dev-developer-edition-improve',
65
  __( 'Improve Elementor', 'elementor-beta' ),
66
  null,
67
  static::PAGE_ID
@@ -70,13 +103,13 @@ class Settings_Page {
70
  register_setting( Module::SETTINGS_KEY, 'elementor_allow_tracking' );
71
 
72
  add_settings_field(
73
- 'elementor-dev-developer-edition-improve-field',
74
  __( 'Usage Data Sharing', 'elementor-beta' ),
75
  function () {
76
  $this->load_view( 'settings-page-improve-elementor.php' );
77
  },
78
  static::PAGE_ID,
79
- 'elementor-dev-developer-edition-improve'
80
  );
81
  }
82
  }
@@ -146,7 +179,7 @@ class Settings_Page {
146
  /**
147
  * Load the get updates modal into elementor templates.
148
  */
149
- public function add_elementor_dev_modal_template() {
150
  if ( ! $this->is_elementor_dev_settings_page() ) {
151
  return;
152
  }
@@ -224,8 +257,8 @@ class Settings_Page {
224
  add_action( 'admin_menu', [ $this, 'add_to_menus' ], 206 /* After elementor tools sub menu */ );
225
  add_action( 'admin_init', [ $this, 'settings_init' ] );
226
  add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
227
- add_action( 'admin_head', [ $this, 'add_elementor_dev_modal_template' ] );
228
- add_filter( 'admin_footer_text', [ $this, 'admin_footer_text' ] );
229
  add_filter( "plugin_action_links_{$plugin_name}", [ $this, 'plugin_action_links' ] );
230
  }
231
  }
1
  <?php
2
+ namespace ElementorBeta\Modules\DeveloperEdition;
3
 
4
  use Elementor\Plugin;
5
  use Elementor\Settings;
6
+ use ElementorBeta\Bootstrap;
7
 
8
  if ( ! defined( 'ABSPATH' ) ) {
9
  exit; // Exit if accessed directly.
13
  /**
14
  * The page id
15
  */
16
+ const PAGE_ID = 'elementor_beta_settings';
17
 
18
  /**
19
  * Init all the settings that should be saved
20
  */
21
  public function settings_init() {
22
  add_settings_section(
23
+ 'elementor-beta-developer-edition-update',
24
  __( 'Elementor Developer Edition', 'elementor-beta' ),
25
  null,
26
  static::PAGE_ID
27
  );
28
 
29
  add_settings_field(
30
+ 'elementor-beta-developer-edition-update-child',
31
  __( 'Get updates', 'elementor-beta' ),
32
  function () {
33
  $this->load_view( 'settings-page-get-updates.php' );
34
  },
35
  static::PAGE_ID,
36
+ 'elementor-beta-developer-edition-update'
37
+ );
38
+
39
+ add_settings_field(
40
+ 'elementor-beta-developer-edition-update-child-core',
41
+ __( 'Elementor', 'elementor-beta' ),
42
+ function () {
43
+ $this->load_view( 'settings-page-get-updates-core.php' );
44
+ },
45
+ static::PAGE_ID,
46
+ 'elementor-beta-developer-edition-update'
47
+ );
48
+
49
+ if ( is_plugin_active( Bootstrap::ELEMENTOR_PRO_PLUGIN_NAME ) ) {
50
+ add_settings_field(
51
+ 'elementor-beta-developer-edition-update-child-pro',
52
+ __( 'Elementor Pro', 'elementor-beta' ),
53
+ function () {
54
+ $this->load_view( 'settings-page-get-updates-pro.php' );
55
+ },
56
+ static::PAGE_ID,
57
+ 'elementor-beta-developer-edition-update'
58
+ );
59
+ }
60
+
61
+
62
+ add_settings_field(
63
+ 'elementor-beta-developer-edition-update-child-description',
64
+ '',
65
+ function () {
66
+ $this->load_view( 'settings-page-get-updates-description.php' );
67
+ },
68
+ static::PAGE_ID,
69
+ 'elementor-beta-developer-edition-update'
70
  );
71
 
72
  if ( current_user_can( 'update_plugins' ) ) {
73
  add_settings_section(
74
+ 'elementor-beta-developer-edition-auto-update',
75
  __( 'Auto Plugin Updates', 'elementor-beta' ),
76
  null,
77
  static::PAGE_ID
78
  );
79
 
80
+ register_setting( Module::SETTINGS_KEY, 'elementor_beta_auto_update', [
81
  'sanitize_callback' => [ $this, 'sanitize_update_auto_update' ],
82
  ] );
83
 
84
  add_settings_field(
85
+ 'elementor-beta-developer-edition-auto-update-field',
86
  __( 'Auto update Elementor', 'elementor-beta' ),
87
  function () {
88
  $this->load_view( 'settings-page-auto-update.php' );
89
  },
90
  static::PAGE_ID,
91
+ 'elementor-beta-developer-edition-auto-update'
92
  );
93
  }
94
 
95
  if ( 'yes' !== get_option( 'elementor_allow_tracking', 'no' ) ) {
96
  add_settings_section(
97
+ 'elementor-beta-developer-edition-improve',
98
  __( 'Improve Elementor', 'elementor-beta' ),
99
  null,
100
  static::PAGE_ID
103
  register_setting( Module::SETTINGS_KEY, 'elementor_allow_tracking' );
104
 
105
  add_settings_field(
106
+ 'elementor-beta-developer-edition-improve-field',
107
  __( 'Usage Data Sharing', 'elementor-beta' ),
108
  function () {
109
  $this->load_view( 'settings-page-improve-elementor.php' );
110
  },
111
  static::PAGE_ID,
112
+ 'elementor-beta-developer-edition-improve'
113
  );
114
  }
115
  }
179
  /**
180
  * Load the get updates modal into elementor templates.
181
  */
182
+ public function add_elementor_beta_modal_template() {
183
  if ( ! $this->is_elementor_dev_settings_page() ) {
184
  return;
185
  }
257
  add_action( 'admin_menu', [ $this, 'add_to_menus' ], 206 /* After elementor tools sub menu */ );
258
  add_action( 'admin_init', [ $this, 'settings_init' ] );
259
  add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
260
+ add_action( 'admin_head', [ $this, 'add_elementor_beta_modal_template' ] );
261
+ add_filter( 'admin_footer_text', [ $this, 'admin_footer_text' ], 11 /* After elementor */ );
262
  add_filter( "plugin_action_links_{$plugin_name}", [ $this, 'plugin_action_links' ] );
263
  }
264
  }
modules/developer-edition/ui.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- namespace ElementorDev\Modules\DeveloperEdition;
3
 
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit; // Exit if accessed directly.
@@ -11,7 +11,7 @@ class UI {
11
  */
12
  public function enqueue_scripts() {
13
  wp_enqueue_script(
14
- 'elementor-dev-developer-edition',
15
  ELEMENTOR_BETA_URL . 'modules/developer-edition/assets/js/developer-edition.js',
16
  [],
17
  ELEMENTOR_BETA_VERSION,
@@ -25,7 +25,7 @@ class UI {
25
  $ui_theme = $elementor_preferences['ui_theme'];
26
  }
27
 
28
- wp_add_inline_script( 'elementor-dev-developer-edition', "const elementorDevUiTheme = '{$ui_theme}';" );
29
  }
30
 
31
  /**
@@ -33,7 +33,7 @@ class UI {
33
  */
34
  public function enqueue_styles() {
35
  wp_enqueue_style(
36
- 'elementor-dev-developer-edition',
37
  ELEMENTOR_BETA_URL . 'modules/developer-edition/assets/css/developer-edition.css',
38
  [],
39
  ELEMENTOR_BETA_VERSION
@@ -48,7 +48,7 @@ class UI {
48
  * @return array
49
  */
50
  public function add_body_class( array $classes ) {
51
- $classes[] = 'elementor-dev';
52
 
53
  return $classes;
54
  }
@@ -61,7 +61,7 @@ class UI {
61
  * @return string
62
  */
63
  public function add_admin_body_class( $classes ) {
64
- return $classes . ' elementor-dev';
65
  }
66
 
67
  /**
1
  <?php
2
+ namespace ElementorBeta\Modules\DeveloperEdition;
3
 
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit; // Exit if accessed directly.
11
  */
12
  public function enqueue_scripts() {
13
  wp_enqueue_script(
14
+ 'elementor-beta-developer-edition',
15
  ELEMENTOR_BETA_URL . 'modules/developer-edition/assets/js/developer-edition.js',
16
  [],
17
  ELEMENTOR_BETA_VERSION,
25
  $ui_theme = $elementor_preferences['ui_theme'];
26
  }
27
 
28
+ wp_add_inline_script( 'elementor-beta-developer-edition', "const elementorBetaUiTheme = '{$ui_theme}';" );
29
  }
30
 
31
  /**
33
  */
34
  public function enqueue_styles() {
35
  wp_enqueue_style(
36
+ 'elementor-beta-developer-edition',
37
  ELEMENTOR_BETA_URL . 'modules/developer-edition/assets/css/developer-edition.css',
38
  [],
39
  ELEMENTOR_BETA_VERSION
48
  * @return array
49
  */
50
  public function add_body_class( array $classes ) {
51
+ $classes[] = 'elementor-beta';
52
 
53
  return $classes;
54
  }
61
  * @return string
62
  */
63
  public function add_admin_body_class( $classes ) {
64
+ return $classes . ' elementor-beta';
65
  }
66
 
67
  /**
modules/developer-edition/views/settings-page-auto-update.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- use ElementorDev\Bootstrap;
4
 
5
  if ( ! defined( 'ABSPATH' ) ) {
6
  exit;
@@ -13,11 +13,11 @@ if ( in_array( Bootstrap::ELEMENTOR_PLUGIN_NAME, $auto_updates, true ) ) {
13
  $is_checked = true;
14
  }
15
  ?>
16
- <label for="elementor-dev-auto-update">
17
  <input
18
  type="checkbox"
19
- id="elementor_dev_auto_update"
20
- name="elementor_dev_auto_update"
21
  value="yes"
22
  <?php checked( $is_checked ); ?>
23
  />
1
  <?php
2
 
3
+ use ElementorBeta\Bootstrap;
4
 
5
  if ( ! defined( 'ABSPATH' ) ) {
6
  exit;
13
  $is_checked = true;
14
  }
15
  ?>
16
+ <label for="elementor-beta-auto-update">
17
  <input
18
  type="checkbox"
19
+ id="elementor_beta_auto_update"
20
+ name="elementor_beta_auto_update"
21
  value="yes"
22
  <?php checked( $is_checked ); ?>
23
  />
modules/developer-edition/views/settings-page-get-updates-core.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use ElementorBeta\Bootstrap;
4
+ use ElementorBeta\Core\Plugin;
5
+ use ElementorBeta\Modules\DeveloperEdition\Module;
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ /** @var Module $module */
12
+ $module = Plugin::instance()
13
+ ->modules_manager
14
+ ->get_modules( 'developer-edition' );
15
+
16
+ $core_version_control = $module->core_version_control;
17
+
18
+ $elementor_version = $module->core_version_control->get_current_version();
19
+
20
+ $latest_stable_version = $core_version_control->get_latest_stable_release();
21
+
22
+ $should_update_elementor = array_key_exists( Bootstrap::ELEMENTOR_PLUGIN_NAME, get_plugin_updates() );
23
+ $should_reinstall_elementor = ! version_compare( $latest_stable_version, $elementor_version, '=' );
24
+
25
+ $update_elementor_url = $should_update_elementor
26
+ ? wp_nonce_url(
27
+ self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . Bootstrap::ELEMENTOR_PLUGIN_NAME ),
28
+ 'upgrade-plugin_' . Bootstrap::ELEMENTOR_PLUGIN_NAME
29
+ )
30
+ : '#';
31
+
32
+ $reinstall_elementor_url = $should_reinstall_elementor
33
+ ? wp_nonce_url(
34
+ self_admin_url( 'admin-post.php?action=elementor_rollback&version=' . $latest_stable_version ),
35
+ 'elementor_rollback'
36
+ )
37
+ : '#';
38
+ ?>
39
+
40
+ <strong>
41
+ <?php
42
+ $should_update_elementor
43
+ ? esc_html_e( 'Updated version of Elementor is available.', 'elementor-beta' )
44
+ : esc_html_e( 'Hooray! You’re up to date with the latest versions of Elementor.', 'elementor-beta' );
45
+ ?>
46
+ </strong>
47
+
48
+ <br/><br/>
49
+
50
+ <a
51
+ class="button <?php echo $should_update_elementor ? 'button-primary' : 'button-disabled'; ?>"
52
+ href="<?php echo $update_elementor_url; ?>"
53
+ data-loading-text="<?php esc_html_e( 'Updating...', 'elementor-beta' ); ?>"
54
+ >
55
+ <?php esc_html_e( 'Update Now', 'elementor-beta' ); ?>
56
+ </a>
57
+
58
+ <br/><br/>
59
+
60
+ <p>
61
+ <?php esc_html_e( 'If you need to re-install the latest stable version, you can do so here:', 'elementor-beta' ); ?>
62
+ </p>
63
+
64
+ <br/>
65
+
66
+ <a
67
+ class="button <?php echo $should_reinstall_elementor ? '' : 'button-disabled'; ?>"
68
+ href="<?php echo $reinstall_elementor_url; ?>"
69
+ data-loading-text="<?php esc_html_e( 'Re-installing...', 'elementor-beta' ); ?>"
70
+ >
71
+ <?php esc_html_e( 'Re-install Now', 'elementor-beta' ); ?>
72
+ </a>
modules/developer-edition/views/settings-page-get-updates-description.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+ ?>
7
+ <p>
8
+ <?php
9
+ /* translators: %s: Plugin name. */
10
+ echo sprintf( __( '%s is a testing tool for new features and should not be used on live sites. Use staging environments only, and backup all your data before updating.', 'elementor-beta' ), __( 'Elementor Developer Edition', 'elementor-beta' ) );
11
+ ?>
12
+ <br/>
13
+ <?php
14
+ /* translators: %1$s: Learn more link, %2$s: Plugin name */
15
+ echo sprintf(
16
+ __( '%1$s about %2$s.', 'elementor-beta' ),
17
+ sprintf( '<a href="https://go.elementor.com/wp-dash-developer-edition" target="_blank">%s</a>', __( 'Learn more', 'elementor-beta' ) ),
18
+ __( 'Elementor Developer Edition', 'elementor-beta' )
19
+ )
20
+ ?>
21
+ </p>
22
+
23
+ <br/>
24
+
25
+ <p>
26
+ <?php
27
+ echo sprintf(
28
+ /* translators: %s: email updates link */
29
+ __( '%s to join our first-to-know email updates.', 'elementor-beta' ),
30
+ sprintf( '<a href="#" id="beta-tester-first-to-know">%s</a>', __( 'Click here', 'elementor-beta' ) )
31
+ )
32
+ ?>
33
+ </p>
modules/developer-edition/views/settings-page-get-updates-pro.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use ElementorBeta\Bootstrap;
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+
9
+ $should_update_elementor_pro = array_key_exists( Bootstrap::ELEMENTOR_PRO_PLUGIN_NAME, get_plugin_updates() );
10
+
11
+ $update_elementor_pro_url = $should_update_elementor_pro
12
+ ? wp_nonce_url(
13
+ self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . Bootstrap::ELEMENTOR_PRO_PLUGIN_NAME ),
14
+ 'upgrade-plugin_' . Bootstrap::ELEMENTOR_PRO_PLUGIN_NAME
15
+ )
16
+ : '#';
17
+ ?>
18
+
19
+ <strong>
20
+ <?php
21
+ $should_update_elementor_pro
22
+ ? esc_html_e( 'Updated version of Elementor Pro is available.', 'elementor-beta' )
23
+ : esc_html_e( 'Hooray! You’re up to date with the latest versions of Elementor Pro.', 'elementor-beta' );
24
+ ?>
25
+ </strong>
26
+
27
+ <br/><br/>
28
+
29
+ <a
30
+ class="button <?php echo $should_update_elementor_pro ? 'button-primary' : 'button-disabled'; ?>"
31
+ href="<?php echo $update_elementor_pro_url; ?>"
32
+ data-loading-text="<?php esc_html_e( 'Updating...', 'elementor-beta' ); ?>"
33
+ >
34
+ <?php esc_html_e( 'Update Now', 'elementor-beta' ); ?>
35
+ </a>
36
+
37
+ <br /><br />
38
+
39
+ <p>
40
+ <?php
41
+ echo sprintf(
42
+ __( 'If you wish to revert to the latest stable Pro version please use %s', 'elementor-beta' ),
43
+ '<a href="' . admin_url( 'admin.php?page=elementor-tools#tab-versions' ) . '">' . __( 'Elementor Rollback screen.', 'elementor-beta' ) . '</a>'
44
+ )
45
+ ?>
46
+ </p>
modules/developer-edition/views/settings-page-get-updates.php CHANGED
@@ -1,148 +1,34 @@
1
  <?php
2
 
3
- use ElementorDev\Bootstrap;
4
- use Elementor\Beta_Testers;
5
- use ElementorDev\Core\Plugin;
6
 
7
  if ( ! defined( 'ABSPATH' ) ) {
8
  exit;
9
  }
10
 
11
- $latest_stable_version = Plugin::instance()
 
12
  ->modules_manager
13
- ->get_modules( 'developer-edition' )
14
- ->version_control
15
- ->get_latest_stable_release();
16
 
17
- $elementor_version = get_plugin_data( WP_PLUGIN_DIR . '/' . Bootstrap::ELEMENTOR_PLUGIN_NAME )['Version'];
18
- $should_update_elementor = array_key_exists( Bootstrap::ELEMENTOR_PLUGIN_NAME, get_plugin_updates() );
19
- $should_reinstall_elementor = ! version_compare( $latest_stable_version, $elementor_version, '=' );
20
 
21
- $update_elementor_url = $should_update_elementor
22
- ? wp_nonce_url(
23
- self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . Bootstrap::ELEMENTOR_PLUGIN_NAME ),
24
- 'upgrade-plugin_' . Bootstrap::ELEMENTOR_PLUGIN_NAME
25
- )
26
- : '#';
27
-
28
- $reinstall_elementor_url = $should_reinstall_elementor
29
- ? wp_nonce_url(
30
- self_admin_url( 'admin-post.php?action=elementor_rollback&version=' . $latest_stable_version ),
31
- 'elementor_rollback'
32
- )
33
- : '#';
34
-
35
- $should_open_popup = false;
36
- $all_introductions = get_user_meta( get_current_user_id(), 'elementor_introduction', true );
37
-
38
- if (
39
- ! is_array( $all_introductions ) ||
40
- ! array_key_exists( Beta_Testers::BETA_TESTER_SIGNUP, $all_introductions )
41
- ) {
42
- $should_open_popup = true;
43
- }
44
  ?>
45
 
46
  <p><?php
47
- /* translators: %s: elementor version. */
48
- echo sprintf( __( 'You are using Elementor %s', 'elementor-beta' ), '<strong>' . $elementor_version . '</strong>' );
49
- ?></p>
50
-
51
- <?php if ( $should_update_elementor ) : ?>
52
- <p><?php
53
- esc_html_e( 'You can update to the latest development builds automatically:', 'elementor-beta' );
54
- ?></p>
55
- <?php endif; ?>
56
-
57
- <br/>
58
-
59
- <strong>
60
- <?php
61
- $should_update_elementor
62
- ? esc_html_e( 'Updated version of Elementor is available.', 'elementor-beta' )
63
- : esc_html_e( 'Hooray! You’re up to date with the latest versions of Elementor.', 'elementor-beta' );
64
- ?>
65
- </strong>
66
-
67
- <br/><br/>
68
-
69
- <a
70
- class="button <?php echo $should_update_elementor ? 'button-primary' : 'button-disabled'; ?>"
71
- href="<?php echo $update_elementor_url; ?>"
72
- data-loading-text="<?php esc_html_e( 'Updating...', 'elementor-beta' ); ?>"
73
- >
74
- <?php esc_html_e( 'Update Now', 'elementor-beta' ); ?>
75
- </a>
76
-
77
- <br/><br/>
78
-
79
- <p>
80
- <?php esc_html_e( 'If you need to re-install the latest stable version, you can do so here:', 'elementor-beta' ); ?>
81
- </p>
82
 
83
- <br/>
84
-
85
- <a
86
- class="button <?php echo $should_reinstall_elementor ? '' : 'button-disabled'; ?>"
87
- href="<?php echo $reinstall_elementor_url; ?>"
88
- data-loading-text="<?php esc_html_e( 'Re-installing...', 'elementor-beta' ); ?>"
89
- >
90
- <?php esc_html_e( 'Re-install Now', 'elementor-beta' ); ?>
91
- </a>
92
-
93
- <br/><br/>
94
-
95
- <p>
96
- <?php
97
- /* translators: %s: Plugin name. */
98
- echo sprintf( __( '%s is a testing tool for new features and should not be used on live sites. Use staging environments only, and backup all your data before updating.', 'elementor-beta' ), __( 'Elementor Developer Edition', 'elementor-beta' ) );
99
- ?>
100
- <br/>
101
- <?php
102
- /* translators: %1$s: Learn more link, %2$s: Plugin name */
103
- echo sprintf(
104
- __( '%1$s about %2$s.', 'elementor-beta' ),
105
- sprintf( '<a href="https://go.elementor.com/wp-dash-developer-edition" target="_blank">%s</a>', __( 'Learn more', 'elementor-beta' ) ),
106
- __( 'Elementor Developer Edition', 'elementor-beta' )
107
- )
108
- ?>
109
- </p>
110
-
111
- <br/><br/>
112
 
113
  <p>
114
- <?php
115
- echo sprintf(
116
- /* translators: %s: email updates link */
117
- __( '%s to join our first-to-know email updates.', 'elementor-beta' ),
118
- sprintf( '<a href="#" id="beta-tester-first-to-know">%s</a>', __( 'Click here', 'elementor-beta' ) )
119
- )
120
- ?>
121
  </p>
122
-
123
- <?php if ( $should_open_popup ) : ?>
124
- <script>
125
- document.addEventListener( 'DOMContentLoaded', () => {
126
- if ( ! window.elementorBetaTester ) {
127
- return;
128
- }
129
-
130
- window.elementorBetaTester.showLayout( true )
131
- } );
132
- </script>
133
- <?php endif; ?>
134
-
135
- <script>
136
- document.querySelectorAll( 'a[data-loading-text]' ).forEach( ( el ) => {
137
- el.addEventListener( 'click', ( e ) => {
138
- if ( e.target.classList.contains( 'button-disabled' ) ) {
139
- e.preventDefault();
140
-
141
- return;
142
- }
143
-
144
- e.target.classList.add( 'button-disabled' );
145
- e.target.innerHTML = e.target.dataset.loadingText;
146
- } )
147
- } );
148
- </script>
1
  <?php
2
 
3
+ use ElementorBeta\Core\Plugin;
4
+ use ElementorBeta\Modules\DeveloperEdition\Module;
 
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
7
  exit;
8
  }
9
 
10
+ /** @var Module $module */
11
+ $module = Plugin::instance()
12
  ->modules_manager
13
+ ->get_modules( 'developer-edition' );
 
 
14
 
15
+ $core_version_control = $module->core_version_control;
 
 
16
 
17
+ $elementor_version = $module->core_version_control->get_current_version();
18
+ $elementor_pro_version = $module->pro_version_control->get_current_version();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  ?>
20
 
21
  <p><?php
22
+ /* translators: %s: elementor version. */
23
+ echo sprintf( __( 'You are using Elementor %s', 'elementor-beta' ), '<strong>' . $elementor_version . '</strong>' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
+ if ( $elementor_pro_version ) {
26
+ /* translators: %s: elementor pro version. */
27
+ echo ', ';
28
+ echo sprintf( __( 'and Elementor Pro %s', 'elementor-beta' ), '<strong>' . $elementor_pro_version . '</strong>' );
29
+ }
30
+ ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  <p>
33
+ <?php esc_html_e( 'You can update to the latest development builds automatically:', 'elementor-beta' ); ?>
 
 
 
 
 
 
34
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules/developer-edition/views/settings-page.php CHANGED
@@ -1,11 +1,22 @@
1
  <?php
2
 
3
- use ElementorDev\Modules\DeveloperEdition\Module;
4
- use ElementorDev\Modules\DeveloperEdition\Settings_Page;
 
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
7
  exit;
8
  }
 
 
 
 
 
 
 
 
 
 
9
  ?>
10
 
11
  <div class="wrap">
@@ -25,4 +36,31 @@ if ( ! defined( 'ABSPATH' ) ) {
25
  ?>
26
  </form>
27
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  <?php
1
  <?php
2
 
3
+ use Elementor\Beta_Testers;
4
+ use ElementorBeta\Modules\DeveloperEdition\Module;
5
+ use ElementorBeta\Modules\DeveloperEdition\Settings_Page;
6
 
7
  if ( ! defined( 'ABSPATH' ) ) {
8
  exit;
9
  }
10
+
11
+ $should_open_popup = false;
12
+ $all_introductions = get_user_meta( get_current_user_id(), 'elementor_introduction', true );
13
+
14
+ if (
15
+ ! is_array( $all_introductions ) ||
16
+ ! array_key_exists( Beta_Testers::BETA_TESTER_SIGNUP, $all_introductions )
17
+ ) {
18
+ $should_open_popup = true;
19
+ }
20
  ?>
21
 
22
  <div class="wrap">
36
  ?>
37
  </form>
38
  </div>
39
+
40
+ <?php if ( $should_open_popup ) : ?>
41
+ <script>
42
+ document.addEventListener( 'DOMContentLoaded', () => {
43
+ if ( ! window.elementorBetaTester ) {
44
+ return;
45
+ }
46
+
47
+ window.elementorBetaTester.showLayout( true )
48
+ } );
49
+ </script>
50
+ <?php endif; ?>
51
+
52
+ <script>
53
+ document.querySelectorAll( 'a[data-loading-text]' ).forEach( ( el ) => {
54
+ el.addEventListener( 'click', ( e ) => {
55
+ if ( e.target.classList.contains( 'button-disabled' ) ) {
56
+ e.preventDefault();
57
+
58
+ return;
59
+ }
60
+
61
+ e.target.classList.add( 'button-disabled' );
62
+ e.target.innerHTML = e.target.dataset.loadingText;
63
+ } )
64
+ } );
65
+ </script>
66
  <?php
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Elementor Beta (Developer Edition) ===
2
- Contributors: elemntor, KingYes, ariel.k
3
  Tags: elementor, website builder, beta, developer, bleeding edge, testing, landing page, drag-and-drop, visual editor
4
  Requires at least: 5.0
5
  Tested up to: 5.6
6
  Requires PHP: 5.6
7
- Stable tag: 1.0.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -76,5 +76,8 @@ Beta versions are the designated version for release. Developer Edition versions
76
 
77
  == Changelog ==
78
 
 
 
 
79
  = 1.0.0 - 2020-11-26 =
80
  * Initial release
1
  === Elementor Beta (Developer Edition) ===
2
+ Contributors: nevog, elemntor, KingYes, ariel.k
3
  Tags: elementor, website builder, beta, developer, bleeding edge, testing, landing page, drag-and-drop, visual editor
4
  Requires at least: 5.0
5
  Tested up to: 5.6
6
  Requires PHP: 5.6
7
+ Stable tag: 1.1.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
76
 
77
  == Changelog ==
78
 
79
+ = 1.1.0 - 2021-01-12 =
80
+ * Tweak: Added support for Elementor Pro v3.1.0
81
+
82
  = 1.0.0 - 2020-11-26 =
83
  * Initial release
views/admin-notices/elementor-not-active.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- use ElementorDev\Bootstrap;
3
 
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit;
1
  <?php
2
+ use ElementorBeta\Bootstrap;
3
 
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit;