Version Description
- 2020-11-26 =
- Initial release
Download this release
Release Info
Developer | KingYes |
Plugin | Elementor Beta (Developer Edition) |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- autoloader.php +53 -0
- bootstrap.php +104 -0
- core/base/module.php +37 -0
- core/modules-manager.php +85 -0
- core/plugin.php +51 -0
- elementor-beta.php +58 -0
- modules/developer-edition/admin-bar.php +121 -0
- modules/developer-edition/assets/css/developer-edition.css +71 -0
- modules/developer-edition/assets/js/developer-edition.js +19 -0
- modules/developer-edition/module.php +27 -0
- modules/developer-edition/settings-page.php +231 -0
- modules/developer-edition/ui.php +77 -0
- modules/developer-edition/version-control.php +223 -0
- modules/developer-edition/views/settings-page-auto-update.php +29 -0
- modules/developer-edition/views/settings-page-get-updates-modal.php +36 -0
- modules/developer-edition/views/settings-page-get-updates.php +148 -0
- modules/developer-edition/views/settings-page-improve-elementor.php +16 -0
- modules/developer-edition/views/settings-page.php +28 -0
- readme.txt +80 -0
- views/admin-notices/elementor-not-active.php +36 -0
- views/admin-notices/elementor-not-installed.php +31 -0
autoloader.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ElementorDev;
|
3 |
+
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
+
exit; // Exit if accessed directly.
|
6 |
+
}
|
7 |
+
|
8 |
+
class Autoloader {
|
9 |
+
/**
|
10 |
+
* Run autoloader.
|
11 |
+
*/
|
12 |
+
public static function run() {
|
13 |
+
spl_autoload_register( [ __CLASS__, 'autoload' ] );
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Autoload.
|
18 |
+
*
|
19 |
+
* For a given class, check if it exist and load it.
|
20 |
+
*
|
21 |
+
* @param $class
|
22 |
+
*/
|
23 |
+
private static function autoload( $class ) {
|
24 |
+
if ( ! class_exists( $class ) ) {
|
25 |
+
self::load_class( $class );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Load class.
|
31 |
+
*
|
32 |
+
* For a given class name, require the class file.
|
33 |
+
*
|
34 |
+
* @param $relative_class_name
|
35 |
+
*/
|
36 |
+
private static function load_class( $relative_class_name ) {
|
37 |
+
$relative_class_name = str_replace( ELEMENTOR_BETA_NAMESPACE . '\\', '', $relative_class_name );
|
38 |
+
|
39 |
+
$filename = strtolower(
|
40 |
+
preg_replace(
|
41 |
+
[ '/([a-z])([A-Z])/', '/_/', '/\\\/' ],
|
42 |
+
[ '$1-$2', '-', DIRECTORY_SEPARATOR ],
|
43 |
+
$relative_class_name
|
44 |
+
)
|
45 |
+
);
|
46 |
+
|
47 |
+
$filename = ELEMENTOR_BETA_DIR . $filename . '.php';
|
48 |
+
|
49 |
+
if ( is_readable( $filename ) ) {
|
50 |
+
require_once $filename;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
bootstrap.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ElementorDev;
|
3 |
+
|
4 |
+
use ElementorDev\Core\Plugin;
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
+
exit; // Exit if accessed directly.
|
8 |
+
}
|
9 |
+
|
10 |
+
class Bootstrap {
|
11 |
+
const ELEMENTOR_PLUGIN_NAME = 'elementor/elementor.php';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Bootstrap constructor.
|
15 |
+
*/
|
16 |
+
public function __construct() {
|
17 |
+
add_action( 'plugins_loaded', [ $this, 'plugins_loaded' ] );
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Plugins loaded.
|
22 |
+
*/
|
23 |
+
public function plugins_loaded() {
|
24 |
+
load_plugin_textdomain( 'elementor-beta' );
|
25 |
+
|
26 |
+
if ( ! $this->is_elementor_class_exists() ) {
|
27 |
+
add_action( 'admin_notices', [ $this, 'notice_elementor_class_not_exists' ] );
|
28 |
+
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
// initiate the plugin.
|
33 |
+
Plugin::instance();
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Notice to admin that elementor class is not exists.
|
38 |
+
*/
|
39 |
+
public function notice_elementor_class_not_exists() {
|
40 |
+
if ( $this->is_install_screen() ) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
|
44 |
+
if ( ! $this->is_elementor_installed() && current_user_can( 'install_plugins' ) ) {
|
45 |
+
require __DIR__ . '/views/admin-notices/elementor-not-installed.php';
|
46 |
+
} elseif ( ! $this->is_elementor_active() && current_user_can( 'activate_plugin', self::ELEMENTOR_PLUGIN_NAME ) ) {
|
47 |
+
require __DIR__ . '/views/admin-notices/elementor-not-active.php';
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Get all the plugins.
|
53 |
+
*
|
54 |
+
* This method is mostly for unit tests (mock this method to demonstrate a case that elementor is not installed).
|
55 |
+
*
|
56 |
+
* @return array[]
|
57 |
+
*/
|
58 |
+
protected function get_plugins() {
|
59 |
+
return get_plugins();
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Checks if elementor is active.
|
64 |
+
*
|
65 |
+
* This method is protected and not private mostly for unit tests (mock this method to demonstrate a case that elementor is not active).
|
66 |
+
*
|
67 |
+
* @return bool
|
68 |
+
*/
|
69 |
+
protected function is_elementor_active() {
|
70 |
+
return is_plugin_active( self::ELEMENTOR_PLUGIN_NAME );
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Checks if elementor class exists.
|
75 |
+
* this is an early check before it can check if the plugin installed or active.
|
76 |
+
*
|
77 |
+
* @return bool
|
78 |
+
*/
|
79 |
+
private function is_elementor_class_exists() {
|
80 |
+
return class_exists( 'Elementor\\Plugin' );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Checks if elementor is installed.
|
85 |
+
*
|
86 |
+
* @return bool
|
87 |
+
*/
|
88 |
+
private function is_elementor_installed() {
|
89 |
+
$installed_plugins = $this->get_plugins();
|
90 |
+
|
91 |
+
return isset( $installed_plugins[ self::ELEMENTOR_PLUGIN_NAME ] );
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Checks if is in install page.
|
96 |
+
*
|
97 |
+
* @return bool
|
98 |
+
*/
|
99 |
+
private function is_install_screen() {
|
100 |
+
$screen = get_current_screen();
|
101 |
+
|
102 |
+
return isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id;
|
103 |
+
}
|
104 |
+
}
|
core/base/module.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ElementorDev\Core\Base;
|
3 |
+
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
+
exit; // Exit if accessed directly.
|
6 |
+
}
|
7 |
+
|
8 |
+
abstract class Module {
|
9 |
+
/**
|
10 |
+
* Class instance.
|
11 |
+
*
|
12 |
+
* @var static
|
13 |
+
*/
|
14 |
+
protected static $instance = null;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Instance.
|
18 |
+
*
|
19 |
+
* Ensures only one instance of the class is loaded or can be loaded.
|
20 |
+
*
|
21 |
+
* @return static An instance of the class.
|
22 |
+
*/
|
23 |
+
public static function instance() {
|
24 |
+
if ( is_null( static::$instance ) ) {
|
25 |
+
static::$instance = new static();
|
26 |
+
}
|
27 |
+
|
28 |
+
return static::$instance;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @return bool
|
33 |
+
*/
|
34 |
+
public static function is_active() {
|
35 |
+
return true;
|
36 |
+
}
|
37 |
+
}
|
core/modules-manager.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ElementorDev\Core;
|
3 |
+
|
4 |
+
use ElementorDev\Core\Base\Module;
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
+
exit; // Exit if accessed directly.
|
8 |
+
}
|
9 |
+
|
10 |
+
class Modules_Manager {
|
11 |
+
/**
|
12 |
+
* Registered modules.
|
13 |
+
*
|
14 |
+
* Holds the list of all the registered modules.
|
15 |
+
*
|
16 |
+
* @var array
|
17 |
+
*/
|
18 |
+
private $modules = [];
|
19 |
+
|
20 |
+
public function load_modules() {
|
21 |
+
$modules_namespace_prefix = $this->get_modules_namespace_prefix();
|
22 |
+
|
23 |
+
foreach ( $this->get_modules_names() as $module_name ) {
|
24 |
+
$class_name = str_replace(
|
25 |
+
' ',
|
26 |
+
'',
|
27 |
+
ucwords(
|
28 |
+
str_replace( '-', ' ', $module_name )
|
29 |
+
)
|
30 |
+
);
|
31 |
+
|
32 |
+
/** @var Module $class_name */
|
33 |
+
$class_name = $modules_namespace_prefix . '\\Modules\\' . $class_name . '\Module';
|
34 |
+
|
35 |
+
if ( $class_name::is_active() ) {
|
36 |
+
$this->modules[ $module_name ] = $class_name::instance();
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Get modules names.
|
43 |
+
*
|
44 |
+
* Retrieve the modules names.
|
45 |
+
*
|
46 |
+
* @return string[] Modules names.
|
47 |
+
*/
|
48 |
+
public function get_modules_names() {
|
49 |
+
return [
|
50 |
+
'developer-edition',
|
51 |
+
];
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get modules.
|
56 |
+
*
|
57 |
+
* Retrieve all the registered modules or a specific module.
|
58 |
+
*
|
59 |
+
* @param string $module_name Module name.
|
60 |
+
*
|
61 |
+
* @return null|Module|Module[] All the registered modules or a specific module.
|
62 |
+
*/
|
63 |
+
public function get_modules( $module_name ) {
|
64 |
+
if ( $module_name ) {
|
65 |
+
if ( isset( $this->modules[ $module_name ] ) ) {
|
66 |
+
return $this->modules[ $module_name ];
|
67 |
+
}
|
68 |
+
|
69 |
+
return null;
|
70 |
+
}
|
71 |
+
|
72 |
+
return $this->modules;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get modules namespace prefix.
|
77 |
+
*
|
78 |
+
* Retrieve the modules namespace prefix.
|
79 |
+
*
|
80 |
+
* @return string Modules namespace prefix.
|
81 |
+
*/
|
82 |
+
protected function get_modules_namespace_prefix() {
|
83 |
+
return ELEMENTOR_BETA_NAMESPACE;
|
84 |
+
}
|
85 |
+
}
|
core/plugin.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ElementorDev\Core;
|
3 |
+
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
+
exit; // Exit if accessed directly.
|
6 |
+
}
|
7 |
+
|
8 |
+
class Plugin {
|
9 |
+
/**
|
10 |
+
* Class instance.
|
11 |
+
*
|
12 |
+
* @var static
|
13 |
+
*/
|
14 |
+
protected static $instance = null;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var Modules_Manager
|
18 |
+
*/
|
19 |
+
public $modules_manager;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Instance.
|
23 |
+
*
|
24 |
+
* Ensures only one instance of the class is loaded or can be loaded.
|
25 |
+
*
|
26 |
+
* @return static An instance of the class.
|
27 |
+
*/
|
28 |
+
public static function instance() {
|
29 |
+
if ( is_null( static::$instance ) ) {
|
30 |
+
static::$instance = new static();
|
31 |
+
}
|
32 |
+
|
33 |
+
return static::$instance;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Plugin constructor.
|
38 |
+
*/
|
39 |
+
public function __construct() {
|
40 |
+
$this->modules_manager = new Modules_Manager();
|
41 |
+
|
42 |
+
add_action( 'init', [ $this, 'init' ] );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Init.
|
47 |
+
*/
|
48 |
+
public function init() {
|
49 |
+
$this->modules_manager->load_modules();
|
50 |
+
}
|
51 |
+
}
|
elementor-beta.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
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
|
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.
|
21 |
+
}
|
22 |
+
|
23 |
+
if ( ! defined( 'ELEMENTOR_BETA_FILE' ) ) {
|
24 |
+
define( 'ELEMENTOR_BETA_FILE', __FILE__ );
|
25 |
+
}
|
26 |
+
|
27 |
+
if ( ! defined( 'ELEMENTOR_BETA_BASENAME' ) ) {
|
28 |
+
define( 'ELEMENTOR_BETA_BASENAME', plugin_basename( ELEMENTOR_BETA_FILE ) );
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( ! defined( 'ELEMENTOR_BETA_DIR' ) ) {
|
32 |
+
define( 'ELEMENTOR_BETA_DIR', plugin_dir_path( __FILE__ ) );
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( ! defined( 'ELEMENTOR_BETA_URL' ) ) {
|
36 |
+
define( 'ELEMENTOR_BETA_URL', plugin_dir_url( __FILE__ ) );
|
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' ] );
|
55 |
+
register_deactivation_hook( __FILE__, $activate_and_deactivate_action );
|
56 |
+
|
57 |
+
// Bootstrap the plugin
|
58 |
+
new Bootstrap();
|
modules/developer-edition/admin-bar.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ElementorDev\Modules\DeveloperEdition;
|
3 |
+
|
4 |
+
use ElementorDev\Bootstrap;
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
+
exit; // Exit if accessed directly.
|
8 |
+
}
|
9 |
+
|
10 |
+
class Admin_Bar {
|
11 |
+
const REPORT_AN_ISSUE_URL = 'https://go.elementor.com/wp-dash-report-an-issue/';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Admin_Bar constructor.
|
15 |
+
*/
|
16 |
+
public function __construct() {
|
17 |
+
add_action( 'admin_bar_menu', [ $this, 'add_menu_in_admin_bar' ], 202 /* after elementor inspector */ );
|
18 |
+
add_action( 'wp_enqueue_scripts', [ $this, 'print_style' ] );
|
19 |
+
add_action( 'admin_enqueue_scripts', [ $this, 'print_style' ] );
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* When activate the plugin it automatically enable elementor inspector.
|
24 |
+
*/
|
25 |
+
public static function enable_elementor_inspector() {
|
26 |
+
update_option( 'elementor_enable_inspector', 'enable' );
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Register all the admin bar links.
|
31 |
+
*
|
32 |
+
* @param \WP_Admin_Bar $wp_admin_bar
|
33 |
+
*/
|
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,
|
41 |
+
'meta' => [
|
42 |
+
'target' => '_blank',
|
43 |
+
],
|
44 |
+
] );
|
45 |
+
|
46 |
+
if ( is_admin() ) {
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
+
$wp_admin_bar->add_node( [
|
51 |
+
'id' => 'elementor_inspector',
|
52 |
+
'title' => __( 'Elementor Debugger', 'elementor-beta' ),
|
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' => [
|
68 |
+
'target' => '_blank',
|
69 |
+
],
|
70 |
+
] );
|
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' => [
|
79 |
+
'target' => '_blank',
|
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 |
+
/**
|
102 |
+
* Print out the report issue icon.
|
103 |
+
*/
|
104 |
+
public function print_style() {
|
105 |
+
if ( ! is_admin_bar_showing() ) {
|
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;
|
117 |
+
font-size: 18px;
|
118 |
+
}
|
119 |
+
');
|
120 |
+
}
|
121 |
+
}
|
modules/developer-edition/assets/css/developer-edition.css
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
6 |
+
font-size: 9px;
|
7 |
+
padding: 2px 3px;
|
8 |
+
line-height: 1;
|
9 |
+
border-radius: 2px;
|
10 |
+
font-weight: 600;
|
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 |
+
}
|
modules/developer-edition/assets/js/developer-edition.js
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 = [
|
9 |
+
'panel/elements/global',
|
10 |
+
'panel/elements/categories',
|
11 |
+
'panel/menu',
|
12 |
+
]
|
13 |
+
|
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 |
+
} );
|
modules/developer-edition/module.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
}
|
modules/developer-edition/settings-page.php
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
10 |
+
}
|
11 |
+
|
12 |
+
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
|
68 |
+
);
|
69 |
+
|
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 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Adds developer edition into elementor menu.
|
86 |
+
*/
|
87 |
+
public function add_to_menus() {
|
88 |
+
add_submenu_page(
|
89 |
+
Settings::PAGE_ID,
|
90 |
+
__( 'Elementor Developer Edition', 'elementor-beta' ),
|
91 |
+
__( 'Developer Edition', 'elementor-beta' ),
|
92 |
+
'install_plugins',
|
93 |
+
static::PAGE_ID,
|
94 |
+
function () {
|
95 |
+
$this->settings_page_html();
|
96 |
+
}
|
97 |
+
);
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Change the admin footer text.
|
102 |
+
*
|
103 |
+
* @param $footer_text
|
104 |
+
*
|
105 |
+
* @return string
|
106 |
+
*/
|
107 |
+
public function admin_footer_text( $footer_text ) {
|
108 |
+
if ( ! $this->is_elementor_dev_settings_page() ) {
|
109 |
+
return $footer_text;
|
110 |
+
}
|
111 |
+
|
112 |
+
return sprintf(
|
113 |
+
/* translators: %s: Link to issues report */
|
114 |
+
__( 'See something that isn’t working properly? %s', 'elementor-beta' ),
|
115 |
+
'<a href="https://github.com/elementor/elementor/issues" target="_blank">' . __( 'Let us know.', 'elementor-beta' ) . '</a>'
|
116 |
+
);
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Show action links on the plugin screen.
|
121 |
+
*
|
122 |
+
* @param array $links Plugin Action links.
|
123 |
+
* @return array
|
124 |
+
*/
|
125 |
+
public function plugin_action_links( $links ) {
|
126 |
+
return array_merge( [
|
127 |
+
'settings' => sprintf(
|
128 |
+
'<a href="%s">%s</a>',
|
129 |
+
esc_url( admin_url( 'admin.php?page=' . static::PAGE_ID ) ),
|
130 |
+
esc_html__( 'Settings', 'elementor-beta' )
|
131 |
+
),
|
132 |
+
], $links );
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Enqueue settings scripts.
|
137 |
+
*/
|
138 |
+
public function enqueue_scripts() {
|
139 |
+
if ( ! $this->is_elementor_dev_settings_page() ) {
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
|
143 |
+
Plugin::$instance->admin->enqueue_beta_tester_scripts();
|
144 |
+
}
|
145 |
+
|
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 |
+
}
|
153 |
+
|
154 |
+
Plugin::$instance->common->add_template( __DIR__ . '/views/settings-page-get-updates-modal.php' );
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Update auto update plugins option.
|
159 |
+
*
|
160 |
+
* @param $value
|
161 |
+
*
|
162 |
+
* @return false
|
163 |
+
*/
|
164 |
+
public function sanitize_update_auto_update( $value ) {
|
165 |
+
$auto_updates = (array) get_site_option( 'auto_update_plugins', [] );
|
166 |
+
|
167 |
+
if ( 'yes' === $value ) {
|
168 |
+
$auto_updates = array_unique( array_merge( $auto_updates, [ Bootstrap::ELEMENTOR_PLUGIN_NAME ] ) );
|
169 |
+
} else {
|
170 |
+
$auto_updates = array_filter( $auto_updates, function ( $plugin ) {
|
171 |
+
return Bootstrap::ELEMENTOR_PLUGIN_NAME !== $plugin;
|
172 |
+
} );
|
173 |
+
}
|
174 |
+
|
175 |
+
update_site_option( 'auto_update_plugins', $auto_updates );
|
176 |
+
|
177 |
+
return false;
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Render settings page html.
|
182 |
+
*/
|
183 |
+
private function settings_page_html() {
|
184 |
+
if ( ! current_user_can( 'install_plugins' ) ) {
|
185 |
+
return;
|
186 |
+
}
|
187 |
+
|
188 |
+
// show error/update messages.
|
189 |
+
settings_errors();
|
190 |
+
|
191 |
+
$this->load_view( 'settings-page.php' );
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Load a specific view base on the $name arg
|
196 |
+
*
|
197 |
+
* @param $name
|
198 |
+
*/
|
199 |
+
private function load_view( $name ) {
|
200 |
+
require __DIR__ . '/views/' . $name;
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Checks if the current screen is elementor dev settings.
|
205 |
+
*
|
206 |
+
* @return bool
|
207 |
+
*/
|
208 |
+
private function is_elementor_dev_settings_page() {
|
209 |
+
$screen = get_current_screen();
|
210 |
+
|
211 |
+
return $screen && Settings::PAGE_ID . '_page_' . static::PAGE_ID === $screen->id;
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Settings_Page constructor.
|
216 |
+
*/
|
217 |
+
public function __construct() {
|
218 |
+
if ( ! is_admin() ) {
|
219 |
+
return;
|
220 |
+
}
|
221 |
+
|
222 |
+
$plugin_name = plugin_basename( ELEMENTOR_BETA_FILE );
|
223 |
+
|
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 |
+
}
|
modules/developer-edition/ui.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace ElementorDev\Modules\DeveloperEdition;
|
3 |
+
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
+
exit; // Exit if accessed directly.
|
6 |
+
}
|
7 |
+
|
8 |
+
class UI {
|
9 |
+
/**
|
10 |
+
* Enqueue scrips.
|
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,
|
18 |
+
true
|
19 |
+
);
|
20 |
+
|
21 |
+
$ui_theme = 'auto';
|
22 |
+
$elementor_preferences = get_user_meta( get_current_user_id(), 'elementor_preferences', true );
|
23 |
+
|
24 |
+
if ( isset( $elementor_preferences['ui_theme'] ) ) {
|
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 |
+
/**
|
32 |
+
* Enqueue styles
|
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
|
40 |
+
);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Add Elementor dev class into frontend body.
|
45 |
+
*
|
46 |
+
* @param $classes
|
47 |
+
*
|
48 |
+
* @return array
|
49 |
+
*/
|
50 |
+
public function add_body_class( array $classes ) {
|
51 |
+
$classes[] = 'elementor-dev';
|
52 |
+
|
53 |
+
return $classes;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Add Elementor dev class into admin body.
|
58 |
+
*
|
59 |
+
* @param $classes
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function add_admin_body_class( $classes ) {
|
64 |
+
return $classes . ' elementor-dev';
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* UI constructor.
|
69 |
+
*/
|
70 |
+
public function __construct() {
|
71 |
+
add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
|
72 |
+
add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_styles' ] );
|
73 |
+
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_styles' ] );
|
74 |
+
add_filter( 'body_class', [ $this, 'add_body_class' ] );
|
75 |
+
add_filter( 'admin_body_class', [ $this, 'add_admin_body_class' ] );
|
76 |
+
}
|
77 |
+
}
|
modules/developer-edition/version-control.php
ADDED
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
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.
|
17 |
+
*/
|
18 |
+
const WP_ORG_ELEMENTOR_INFO_ENDPOINT = 'https://api.wordpress.org/plugins/info/1.0/elementor.json';
|
19 |
+
|
20 |
+
/**
|
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 |
+
/**
|
29 |
+
* Holds the transient key of the versions data that returns from wp.org.
|
30 |
+
*
|
31 |
+
* @return string
|
32 |
+
*/
|
33 |
+
public static function get_wp_org_data_transient_key() {
|
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 |
+
*
|
59 |
+
* @param $transient
|
60 |
+
*
|
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 ) {
|
68 |
+
return $transient;
|
69 |
+
}
|
70 |
+
|
71 |
+
$should_update = version_compare( $latest_dev_release, $current_version, '>' );
|
72 |
+
|
73 |
+
if ( ! $should_update ) {
|
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 |
+
*
|
112 |
+
* @return string|null
|
113 |
+
*/
|
114 |
+
public function get_latest_dev_release() {
|
115 |
+
return $this->get_latest_release_by_channel( 'dev' );
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Returns the latest stable tag release.
|
120 |
+
*
|
121 |
+
* @return string|null
|
122 |
+
*/
|
123 |
+
public function get_latest_stable_release() {
|
124 |
+
return $this->get_latest_release_by_channel( 'stable' );
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* @param $channel
|
129 |
+
*
|
130 |
+
* @return int|string|null
|
131 |
+
*/
|
132 |
+
private function get_latest_release_by_channel( $channel ) {
|
133 |
+
$tagged_version = null;
|
134 |
+
|
135 |
+
$data = $this->get_wp_org_data();
|
136 |
+
|
137 |
+
if ( ! $data ) {
|
138 |
+
return null;
|
139 |
+
}
|
140 |
+
|
141 |
+
$regex = "/^\d+(\.\d+){2,3}-{$channel}\d*$/";
|
142 |
+
|
143 |
+
if ( 'stable' === $channel ) {
|
144 |
+
$regex = '/^\d+(\.\d+){2,3}$/';
|
145 |
+
}
|
146 |
+
|
147 |
+
foreach ( $data as $version => $download_url ) {
|
148 |
+
if ( 'trunk' === $version ) {
|
149 |
+
continue;
|
150 |
+
}
|
151 |
+
|
152 |
+
if ( 0 === preg_match_all( $regex, $version ) ) {
|
153 |
+
continue;
|
154 |
+
}
|
155 |
+
|
156 |
+
$tagged_version = $version;
|
157 |
+
}
|
158 |
+
|
159 |
+
return $tagged_version;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Get Data from wp.org API.
|
164 |
+
*
|
165 |
+
* @return array
|
166 |
+
*/
|
167 |
+
private function get_wp_org_data() {
|
168 |
+
$data = get_site_transient( static::get_wp_org_data_transient_key() );
|
169 |
+
|
170 |
+
if ( ! empty( $data ) ) {
|
171 |
+
return $data;
|
172 |
+
}
|
173 |
+
|
174 |
+
$data = wp_remote_get( self::WP_ORG_ELEMENTOR_INFO_ENDPOINT );
|
175 |
+
|
176 |
+
if ( 200 !== (int) wp_remote_retrieve_response_code( $data ) ) {
|
177 |
+
return [];
|
178 |
+
}
|
179 |
+
|
180 |
+
$data = json_decode( $data['body'], true )['versions'];
|
181 |
+
|
182 |
+
// The versions that returns from the WordPress API are in a wrong order.
|
183 |
+
// so before caching it, the function below reorders the versions from earlier version to the latest.
|
184 |
+
uasort( $data, function ( $ver_a, $ver_b ) {
|
185 |
+
if ( version_compare( $ver_a, $ver_b, '<' ) ) {
|
186 |
+
return -1;
|
187 |
+
}
|
188 |
+
|
189 |
+
return 1;
|
190 |
+
} );
|
191 |
+
|
192 |
+
// Store cache for 6 hours.
|
193 |
+
set_site_transient( static::get_wp_org_data_transient_key(), $data, HOUR_IN_SECONDS * 6 );
|
194 |
+
|
195 |
+
return $data;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Get plugin download URL.
|
200 |
+
*
|
201 |
+
* @param string $version The version.
|
202 |
+
*
|
203 |
+
* @return string
|
204 |
+
*/
|
205 |
+
private function get_download_url( $version ) {
|
206 |
+
$data = $this->get_wp_org_data();
|
207 |
+
|
208 |
+
if ( empty( $data[ $version ] ) ) {
|
209 |
+
return false;
|
210 |
+
}
|
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 |
+
}
|
modules/developer-edition/views/settings-page-auto-update.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use ElementorDev\Bootstrap;
|
4 |
+
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
+
exit;
|
7 |
+
}
|
8 |
+
|
9 |
+
$is_checked = false;
|
10 |
+
$auto_updates = (array) get_site_option( 'auto_update_plugins', [] );
|
11 |
+
|
12 |
+
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 |
+
/>
|
24 |
+
<?php esc_html_e( 'Activate Auto Updates', 'elementor-beta' ); ?>
|
25 |
+
</label>
|
26 |
+
<br/><br/>
|
27 |
+
<p style="max-width: 900px;">
|
28 |
+
<?php esc_html_e( 'Activating auto updates will periodically update your Elementor plugin to the latest available release.', 'elementor-beta' ); ?>
|
29 |
+
</p>
|
modules/developer-edition/views/settings-page-get-updates-modal.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Elementor\Plugin;
|
4 |
+
use Elementor\Beta_Testers;
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
+
exit; // Exit if accessed directly
|
8 |
+
}
|
9 |
+
|
10 |
+
$user = wp_get_current_user();
|
11 |
+
|
12 |
+
$ajax = Plugin::$instance->common->get_component( 'ajax' );
|
13 |
+
|
14 |
+
$email = $user->user_email;
|
15 |
+
?>
|
16 |
+
<script type="text/template" id="tmpl-elementor-beta-tester">
|
17 |
+
<form id="elementor-beta-tester-form" method="post">
|
18 |
+
<input type="hidden" name="_nonce" value="<?php echo $ajax->create_nonce(); ?>">
|
19 |
+
<input type="hidden" name="action" value="elementor_beta_tester_signup" />
|
20 |
+
<div id="elementor-beta-tester-form__caption"><?php echo __( 'Get Developer Updates', 'elementor-beta' ); ?></div>
|
21 |
+
<div id="elementor-beta-tester-form__description"><?php echo __( 'You’ll receive an update that includes a developer version of Elementor, and it’s content directly to your Email', 'elementor-beta' ); ?></div>
|
22 |
+
<div id="elementor-beta-tester-form__input-wrapper">
|
23 |
+
<input id="elementor-beta-tester-form__email" name="beta_tester_email" type="email" placeholder="<?php echo __( 'Your Email', 'elementor-beta' ); ?>" required value="<?php echo $email; ?>" />
|
24 |
+
<button id="elementor-beta-tester-form__submit" class="elementor-button elementor-button-success">
|
25 |
+
<span class="elementor-state-icon">
|
26 |
+
<i class="eicon-loading eicon-animation-spin" aria-hidden="true"></i>
|
27 |
+
</span>
|
28 |
+
<?php echo __( 'Sign Up', 'elementor-beta' ); ?>
|
29 |
+
</button>
|
30 |
+
</div>
|
31 |
+
<div id="elementor-beta-tester-form__terms">
|
32 |
+
<?php echo sprintf( __( 'By clicking Sign Up, you agree to Elementor\'s <a href="%1$s">Terms of Service</a> and <a href="%2$s">Privacy Policy</a>', 'elementor-beta' ), Beta_Testers::NEWSLETTER_TERMS_URL, Beta_Testers::NEWSLETTER_PRIVACY_URL ); ?>
|
33 |
+
</div>
|
34 |
+
</form>
|
35 |
+
</script>
|
36 |
+
|
modules/developer-edition/views/settings-page-get-updates.php
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|
modules/developer-edition/views/settings-page-improve-elementor.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
?>
|
6 |
+
<label>
|
7 |
+
<input
|
8 |
+
type="checkbox"
|
9 |
+
id="elementor_allow_tracking"
|
10 |
+
name="elementor_allow_tracking"
|
11 |
+
value="yes"
|
12 |
+
<?php checked( get_option( 'elementor_allow_tracking', false ), 'yes' ); ?>
|
13 |
+
>
|
14 |
+
<?php esc_html_e( 'Become a super contributor by opting in to share non-sensitive plugin data and to receive periodic email updates from us.', 'elementor-beta' ); ?>
|
15 |
+
<a href="https://go.elementor.com/usage-data-tracking/" target="_blank"> <?php esc_html_e( 'Learn more', 'elementor-beta' ); ?> </a>
|
16 |
+
</label>
|
modules/developer-edition/views/settings-page.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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">
|
12 |
+
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
|
13 |
+
<p style="max-width: 750px;">
|
14 |
+
<?php esc_html_e(
|
15 |
+
'This plugin 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.',
|
16 |
+
'elementor-beta'
|
17 |
+
); ?>
|
18 |
+
</p>
|
19 |
+
<form action="options.php" method="post">
|
20 |
+
<br/>
|
21 |
+
<?php
|
22 |
+
settings_fields( Module::SETTINGS_KEY );
|
23 |
+
do_settings_sections( Settings_Page::PAGE_ID );
|
24 |
+
submit_button();
|
25 |
+
?>
|
26 |
+
</form>
|
27 |
+
</div>
|
28 |
+
<?php
|
readme.txt
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
11 |
+
Elementor Beta (Developer Edition) gives you direct access into [Elementor's](https://elementor.com/?utm_source=wp-repo&utm_medium=link&utm_campaign=dev-edition-readme) 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.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
Be part of our future releases
|
16 |
+
|
17 |
+
By installing the Developer Edition plugin, [Elementor](https://elementor.com/?utm_source=wp-repo&utm_medium=link&utm_campaign=dev-edition-readme) users can now get a sneak peek of future features before they roll out. We invite you to participate and test features on our Developer Edition. This way, you’ll help us extend our ability to perfect our product and produce experimental and groundbreaking features.
|
18 |
+
|
19 |
+
The Elementor Developer Edition gives you first access to Elementor’s newest features and improvements. 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. We will use this plugin to validate new features and gain feedback before they are released.
|
20 |
+
This is why we don’t recommend using it on live sites.
|
21 |
+
We recommend using it on staging environments only, and backing up your entire website before updating.
|
22 |
+
|
23 |
+
== Installation ==
|
24 |
+
|
25 |
+
= Minimum Requirements =
|
26 |
+
|
27 |
+
* WordPress 5.0 or greater
|
28 |
+
* PHP version 5.6 or greater
|
29 |
+
* MySQL version 5.0 or greater
|
30 |
+
|
31 |
+
= We recommend your host supports: =
|
32 |
+
|
33 |
+
* PHP version 7.0 or greater
|
34 |
+
* MySQL version 5.6 or greater
|
35 |
+
* WordPress Memory limit of 64 MB or greater (128 MB or higher is preferred)
|
36 |
+
|
37 |
+
= Installation =
|
38 |
+
|
39 |
+
1. Install using the WordPress built-in Plugin installer, or Extract the zip file and drop the contents in the `wp-content/plugins/` directory of your WordPress installation.
|
40 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
41 |
+
3. Go to Pages > Add New
|
42 |
+
4. Press the 'Edit with Elementor' button.
|
43 |
+
5. Now you can drag and drop widgets from the left panel onto the content area, as well as add new sections and columns that make up the page structure.
|
44 |
+
|
45 |
+
For documentation and tutorials visit our [Knowledge Base](https://docs.elementor.com/?utm_source=wp-repo&utm_medium=link&utm_campaign=readme).
|
46 |
+
|
47 |
+
== Frequently Asked Questions ==
|
48 |
+
|
49 |
+
**Why am I not seeing the update notification?**
|
50 |
+
|
51 |
+
There are some instances where the notification takes a while to appear. Try to refresh it by going to “Dashboard” > “Updates”, and click on “Check again”. In addition, you can try clearing your site’s cache and see if the update appears.
|
52 |
+
|
53 |
+
**Where can I report bugs or contribute to Elementor?**
|
54 |
+
|
55 |
+
On the top admin bar, you will see a button with the text ‘Report an issue’. Once you click on the link you will be redirected to the issue template form.
|
56 |
+
|
57 |
+
**Where do updates come from?**
|
58 |
+
|
59 |
+
Elementor Dev versions are downloaded from the WordPress.org SVN repository. These versions will only be available to your site if you use the Elementor Developer Edition plugin.
|
60 |
+
|
61 |
+
**Can I rollback to an earlier version?**
|
62 |
+
|
63 |
+
Yes! You can always take advantage of Elementor’s rollback option and revert to an earlier more stable version, or alternatively click “Re-install Now” on the Developer Edition page.
|
64 |
+
|
65 |
+
**Is it safe to use Developer Edition?**
|
66 |
+
|
67 |
+
The Developer edition is an unstable version and should be used for staging sites only. We advise you to backup your website before trying the version.
|
68 |
+
|
69 |
+
**Which features will roll out to the next version of Elementor?**
|
70 |
+
|
71 |
+
The features that roll out to stable versions will do so gradually. This means not all features presented in the Elementor Developer Edition will be incorporated into the upcoming version. We might even remove features from this version from time to time based on the experiment status.
|
72 |
+
|
73 |
+
**I’m already a beta tester, isn’t it the same?**
|
74 |
+
|
75 |
+
Beta versions are the designated version for release. Developer Edition versions will include extra features for testing purposes and will be rolled out gradually.
|
76 |
+
|
77 |
+
== Changelog ==
|
78 |
+
|
79 |
+
= 1.0.0 - 2020-11-26 =
|
80 |
+
* Initial release
|
views/admin-notices/elementor-not-active.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
use ElementorDev\Bootstrap;
|
3 |
+
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
+
exit;
|
6 |
+
}
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="notice notice-error" id="elementor-not-active">
|
10 |
+
<p>
|
11 |
+
<?php
|
12 |
+
echo sprintf(
|
13 |
+
esc_html__(
|
14 |
+
/* translators: %s: Name of plugin */
|
15 |
+
'%s requires Elementor to be activate.',
|
16 |
+
'elementor-beta'
|
17 |
+
),
|
18 |
+
'<strong>' . esc_html__( 'Elementor Developer Edition', 'elementor-beta' ) . '</strong>'
|
19 |
+
);
|
20 |
+
?>
|
21 |
+
</p>
|
22 |
+
<p>
|
23 |
+
<?php
|
24 |
+
$activate_url = esc_url(
|
25 |
+
wp_nonce_url(
|
26 |
+
self_admin_url( 'plugins.php?action=activate&plugin=' . Bootstrap::ELEMENTOR_PLUGIN_NAME . '&plugin_status=active' ),
|
27 |
+
'activate-plugin_' . Bootstrap::ELEMENTOR_PLUGIN_NAME
|
28 |
+
)
|
29 |
+
);
|
30 |
+
?>
|
31 |
+
|
32 |
+
<a href="<?php echo esc_url( $activate_url ); ?>" class="button button-primary">
|
33 |
+
<?php echo esc_html__( 'Activate', 'elementor-beta' ); ?>
|
34 |
+
</a>
|
35 |
+
</p>
|
36 |
+
</div>
|
views/admin-notices/elementor-not-installed.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
?>
|
6 |
+
|
7 |
+
<div class="notice notice-error" id="elementor-not-installed">
|
8 |
+
<p>
|
9 |
+
<?php
|
10 |
+
echo sprintf(
|
11 |
+
esc_html__(
|
12 |
+
/* translators: %s: Name of plugin */
|
13 |
+
'%s requires Elementor for functioning properly. Please Install and Activate Elementor plugin',
|
14 |
+
'elementor-beta'
|
15 |
+
),
|
16 |
+
'<strong>' . esc_html__( 'Elementor Developer Edition', 'elementor-beta' ) . '</strong>'
|
17 |
+
);
|
18 |
+
?>
|
19 |
+
</p>
|
20 |
+
|
21 |
+
<?php
|
22 |
+
$install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' );
|
23 |
+
?>
|
24 |
+
|
25 |
+
<p>
|
26 |
+
<a href="<?php echo esc_url( $install_url ); ?>" class="button button-primary">
|
27 |
+
<?php echo esc_html__( 'Install & Activate', 'elementor-beta' ); ?>
|
28 |
+
</a>
|
29 |
+
</p>
|
30 |
+
</div>
|
31 |
+
|