| 1 |
<?php |
| 2 |
namespace Elementor\Core\Editor\Config_Providers; |
| 3 |
|
| 4 |
use Elementor\Core\Editor\Editor; |
| 5 |
use Elementor\Plugin; |
| 6 |
use Elementor\Utils; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; // Exit if accessed directly. |
| 10 |
} |
| 11 |
|
| 12 |
class Config_Provider_Factory { |
| 13 |
public static function create() { |
| 14 |
$is_editor_v2_active = Plugin::$instance->experiments->is_feature_active( Editor::EDITOR_V2_EXPERIMENT_NAME ); |
| 15 |
|
| 16 |
// Nonce verification is not required, using param for routing purposes. |
| 17 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 18 |
$editor_version = Utils::get_super_global_value( $_GET, 'v' ) ?? ( $is_editor_v2_active ? '2' : '1' ); |
| 19 |
|
| 20 |
if ( '2' === $editor_version ) { |
| 21 |
return new Editor_V2_Config_Provider(); |
| 22 |
} |
| 23 |
|
| 24 |
return new Editor_V1_Config_Provider(); |
| 25 |
} |
| 26 |
} |
| 27 |
|