| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Core\Admin\Menu; |
| 4 |
|
| 5 |
use Elementor\Core\Admin\Menu\Interfaces\Admin_Menu_Item_With_Page; |
| 6 |
|
| 7 |
if ( ! defined( 'ABSPATH' ) ) { |
| 8 |
exit; // Exit if accessed directly. |
| 9 |
} |
| 10 |
|
| 11 |
/** |
| 12 |
* Cloud Hosting Plans Menu Item. |
| 13 |
*/ |
| 14 |
class Cloud_Hosting_Plans_Menu_Item implements Admin_Menu_Item_With_Page { |
| 15 |
const URL = 'https://go.elementor.com/host-local-side-menu/'; |
| 16 |
|
| 17 |
public function is_visible() { |
| 18 |
$env_type = wp_get_environment_type(); |
| 19 |
|
| 20 |
if ( in_array( $env_type, [ 'development', 'local', 'staging' ] ) ) { |
| 21 |
return true; |
| 22 |
} |
| 23 |
|
| 24 |
$ip = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : ''; |
| 25 |
$host = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : ''; |
| 26 |
|
| 27 |
$is_dev = ( |
| 28 |
false !== strpos( $host, '.local' ) |
| 29 |
|| false !== strpos( $host, 'localhost' ) |
| 30 |
|| preg_match( '/^192\.168\./', $ip ) |
| 31 |
|| '127.0.0.1' === $ip |
| 32 |
); |
| 33 |
|
| 34 |
return $is_dev; |
| 35 |
} |
| 36 |
|
| 37 |
public function get_parent_slug() { |
| 38 |
return 'edit.php?post_type=elementor_library'; |
| 39 |
} |
| 40 |
|
| 41 |
public function get_label() { |
| 42 |
return esc_html__( 'Hosting Plans', 'elementor' ); |
| 43 |
} |
| 44 |
|
| 45 |
public function get_capability() { |
| 46 |
return 'manage_options'; |
| 47 |
} |
| 48 |
|
| 49 |
public function get_page_title() { |
| 50 |
return esc_html__( 'Hosting Plans', 'elementor' ); |
| 51 |
} |
| 52 |
|
| 53 |
public function render() { |
| 54 |
exit; |
| 55 |
} |
| 56 |
|
| 57 |
public static function get_url() { |
| 58 |
return self::URL; |
| 59 |
} |
| 60 |
} |
| 61 |
|