| @@ -1,13 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Files\Fonts\Google_Font; | |
| 5 | -use Elementor\Modules\Promotions\Module as Promotions_Module; | |
| 6 | 4 | use Elementor\TemplateLibrary\Source_Local; |
| 7 | -use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider; | |
| 8 | -use Elementor\Includes\Settings\AdminMenuItems\Editor_One_Home_Menu; | |
| 9 | -use Elementor\Includes\Settings\AdminMenuItems\Editor_One_Settings_Menu; | |
| 10 | 5 | |
| 11 | 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | 7 | exit; // Exit if accessed directly. |
| 13 | 8 | } |
| @@ -27,9 +22,9 @@ | ||
| 27 | 22 | */ |
| 28 | 23 | const PAGE_ID = 'elementor'; |
| 29 | 24 | |
| 30 | 25 | /** |
| 31 | - * Upgrade menu priority. | |
| 26 | + * Go Pro menu priority. | |
| 32 | 27 | */ |
| 33 | 28 | const MENU_PRIORITY_GO_PRO = 502; |
| 34 | 29 | |
| 35 | 30 | /** |
| @@ -42,8 +37,13 @@ | ||
| 42 | 37 | */ |
| 43 | 38 | const TAB_GENERAL = 'general'; |
| 44 | 39 | |
| 45 | 40 | /** |
| 41 | + * Settings page style tab slug. | |
| 42 | + */ | |
| 43 | + const TAB_STYLE = 'style'; | |
| 44 | + | |
| 45 | + /** | |
| 46 | 46 | * Settings page integrations tab slug. |
| 47 | 47 | */ |
| 48 | 48 | const TAB_INTEGRATIONS = 'integrations'; |
| 49 | 49 | |
| @@ -52,17 +52,8 @@ | ||
| 52 | 52 | */ |
| 53 | 53 | const TAB_ADVANCED = 'advanced'; |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - * Settings page performance tab slug. | |
| 57 | - */ | |
| 58 | - const TAB_PERFORMANCE = 'performance'; | |
| 59 | - | |
| 60 | - const ADMIN_MENU_PRIORITY = 10; | |
| 61 | - | |
| 62 | - const MENU_CAPABILITY_EDIT_POSTS = 'edit_posts'; | |
| 63 | - | |
| 64 | - /** | |
| 65 | 56 | * Register admin menu. |
| 66 | 57 | * |
| 67 | 58 | * Add new Elementor Settings admin menu. |
| 68 | 59 | * |
| @@ -71,36 +62,318 @@ | ||
| 71 | 62 | * @since 1.0.0 |
| 72 | 63 | * @access public |
| 73 | 64 | */ |
| 74 | 65 | public function register_admin_menu() { |
| 75 | - if ( ! current_user_can( self::MENU_CAPABILITY_EDIT_POSTS ) ) { | |
| 66 | + global $menu; | |
| 67 | + | |
| 68 | + $menu[] = [ '', 'read', 'separator-elementor', '', 'wp-menu-separator elementor' ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited | |
| 69 | + | |
| 70 | + if ( ! current_user_can( 'manage_options' ) ) { | |
| 76 | 71 | return; |
| 77 | 72 | } |
| 78 | 73 | |
| 79 | 74 | add_menu_page( |
| 80 | - esc_html__( 'Elementor', 'elementor' ), | |
| 81 | - esc_html__( 'Elementor', 'elementor' ), | |
| 82 | - self::MENU_CAPABILITY_EDIT_POSTS, | |
| 75 | + __( 'Elementor', 'elementor' ), | |
| 76 | + __( 'Elementor', 'elementor' ), | |
| 77 | + 'manage_options', | |
| 83 | 78 | self::PAGE_ID, |
| 84 | - [ $this, 'display_home_screen' ], | |
| 79 | + [ $this, 'display_settings_page' ], | |
| 85 | 80 | '', |
| 86 | 81 | '58.5' |
| 87 | 82 | ); |
| 88 | 83 | } |
| 89 | 84 | |
| 90 | - public function display_home_screen() { | |
| 91 | - echo '<div id="e-home-screen"></div>'; | |
| 85 | + /** | |
| 86 | + * Reorder the Elementor menu items in admin. | |
| 87 | + * Based on WC. | |
| 88 | + * | |
| 89 | + * @since 2.4.0 | |
| 90 | + * | |
| 91 | + * @param array $menu_order Menu order. | |
| 92 | + * @return array | |
| 93 | + */ | |
| 94 | + public function menu_order( $menu_order ) { | |
| 95 | + // Initialize our custom order array. | |
| 96 | + $elementor_menu_order = []; | |
| 97 | + | |
| 98 | + // Get the index of our custom separator. | |
| 99 | + $elementor_separator = array_search( 'separator-elementor', $menu_order, true ); | |
| 100 | + | |
| 101 | + // Get index of library menu. | |
| 102 | + $elementor_library = array_search( Source_Local::ADMIN_MENU_SLUG, $menu_order, true ); | |
| 103 | + | |
| 104 | + // Loop through menu order and do some rearranging. | |
| 105 | + foreach ( $menu_order as $index => $item ) { | |
| 106 | + if ( 'elementor' === $item ) { | |
| 107 | + $elementor_menu_order[] = 'separator-elementor'; | |
| 108 | + $elementor_menu_order[] = $item; | |
| 109 | + $elementor_menu_order[] = Source_Local::ADMIN_MENU_SLUG; | |
| 110 | + | |
| 111 | + unset( $menu_order[ $elementor_separator ] ); | |
| 112 | + unset( $menu_order[ $elementor_library ] ); | |
| 113 | + } elseif ( ! in_array( $item, [ 'separator-elementor' ], true ) ) { | |
| 114 | + $elementor_menu_order[] = $item; | |
| 115 | + } | |
| 116 | + } | |
| 117 | + | |
| 118 | + // Return order. | |
| 119 | + return $elementor_menu_order; | |
| 92 | 120 | } |
| 93 | 121 | |
| 94 | - private function register_editor_one_settings_menu( Menu_Data_Provider $menu_data_provider ) { | |
| 95 | - $menu_data_provider->register_menu( new Editor_One_Settings_Menu() ); | |
| 122 | + /** | |
| 123 | + * Register Elementor Pro sub-menu. | |
| 124 | + * | |
| 125 | + * Add new Elementor Pro sub-menu under the main Elementor menu. | |
| 126 | + * | |
| 127 | + * Fired by `admin_menu` action. | |
| 128 | + * | |
| 129 | + * @since 1.0.0 | |
| 130 | + * @access public | |
| 131 | + */ | |
| 132 | + public function register_pro_menu() { | |
| 133 | + add_submenu_page( | |
| 134 | + self::PAGE_ID, | |
| 135 | + __( 'Submissions', 'elementor' ), | |
| 136 | + __( 'Submissions', 'elementor' ), | |
| 137 | + 'manage_options', | |
| 138 | + 'e-form-submissions', | |
| 139 | + function() { | |
| 140 | + $this->elementor_form_submissions(); | |
| 141 | + } | |
| 142 | + ); | |
| 143 | + | |
| 144 | + add_submenu_page( | |
| 145 | + self::PAGE_ID, | |
| 146 | + __( 'Custom Fonts', 'elementor' ), | |
| 147 | + __( 'Custom Fonts', 'elementor' ), | |
| 148 | + 'manage_options', | |
| 149 | + 'elementor_custom_fonts', | |
| 150 | + [ $this, 'elementor_custom_fonts' ] | |
| 151 | + ); | |
| 152 | + | |
| 153 | + add_submenu_page( | |
| 154 | + self::PAGE_ID, | |
| 155 | + __( 'Custom Icons', 'elementor' ), | |
| 156 | + __( 'Custom Icons', 'elementor' ), | |
| 157 | + 'manage_options', | |
| 158 | + 'elementor_custom_icons', | |
| 159 | + [ $this, 'elementor_custom_icons' ] | |
| 160 | + ); | |
| 161 | + | |
| 162 | + add_submenu_page( | |
| 163 | + self::PAGE_ID, | |
| 164 | + '', | |
| 165 | + '<span class="dashicons dashicons-star-filled" style="font-size: 17px"></span> ' . esc_html__( 'Go Pro', 'elementor' ), | |
| 166 | + 'manage_options', | |
| 167 | + 'go_elementor_pro', | |
| 168 | + [ $this, 'handle_external_redirects' ] | |
| 169 | + ); | |
| 170 | + | |
| 171 | + add_submenu_page( Source_Local::ADMIN_MENU_SLUG, esc_html__( 'Popups', 'elementor' ), esc_html__( 'Popups', 'elementor' ), 'manage_options', 'popup_templates', [ $this, 'elementor_popups' ] ); | |
| 96 | 172 | } |
| 97 | 173 | |
| 98 | - private function register_editor_one_home_menu( Menu_Data_Provider $menu_data_provider ) { | |
| 99 | - $menu_data_provider->register_menu( new Editor_One_Home_Menu() ); | |
| 174 | + /** | |
| 175 | + * Register Elementor knowledge base sub-menu. | |
| 176 | + * | |
| 177 | + * Add new Elementor knowledge base sub-menu under the main Elementor menu. | |
| 178 | + * | |
| 179 | + * Fired by `admin_menu` action. | |
| 180 | + * | |
| 181 | + * @since 2.0.3 | |
| 182 | + * @access public | |
| 183 | + */ | |
| 184 | + public function register_knowledge_base_menu() { | |
| 185 | + add_submenu_page( | |
| 186 | + self::PAGE_ID, | |
| 187 | + '', | |
| 188 | + __( 'Getting Started', 'elementor' ), | |
| 189 | + 'manage_options', | |
| 190 | + 'elementor-getting-started', | |
| 191 | + [ $this, 'elementor_getting_started' ] | |
| 192 | + ); | |
| 193 | + | |
| 194 | + add_submenu_page( | |
| 195 | + self::PAGE_ID, | |
| 196 | + '', | |
| 197 | + __( 'Get Help', 'elementor' ), | |
| 198 | + 'manage_options', | |
| 199 | + 'go_knowledge_base_site', | |
| 200 | + [ $this, 'handle_external_redirects' ] | |
| 201 | + ); | |
| 100 | 202 | } |
| 101 | 203 | |
| 102 | 204 | /** |
| 205 | + * Go Elementor Pro. | |
| 206 | + * | |
| 207 | + * Redirect the Elementor Pro page the clicking the Elementor Pro menu link. | |
| 208 | + * | |
| 209 | + * Fired by `admin_init` action. | |
| 210 | + * | |
| 211 | + * @since 2.0.3 | |
| 212 | + * @access public | |
| 213 | + */ | |
| 214 | + public function handle_external_redirects() { | |
| 215 | + if ( empty( $_GET['page'] ) ) { | |
| 216 | + return; | |
| 217 | + } | |
| 218 | + | |
| 219 | + if ( 'go_elementor_pro' === $_GET['page'] ) { | |
| 220 | + wp_redirect( Utils::get_pro_link( 'https://elementor.com/pro/?utm_source=wp-menu&utm_campaign=gopro&utm_medium=wp-dash' ) ); | |
| 221 | + die; | |
| 222 | + } | |
| 223 | + | |
| 224 | + if ( 'go_knowledge_base_site' === $_GET['page'] ) { | |
| 225 | + wp_redirect( 'https://go.elementor.com/docs-admin-menu/' ); | |
| 226 | + die; | |
| 227 | + } | |
| 228 | + } | |
| 229 | + | |
| 230 | + /** | |
| 231 | + * Display settings page. | |
| 232 | + * | |
| 233 | + * Output the content for the getting started page. | |
| 234 | + * | |
| 235 | + * @since 2.2.0 | |
| 236 | + * @access public | |
| 237 | + */ | |
| 238 | + public function elementor_getting_started() { | |
| 239 | + if ( User::is_current_user_can_edit_post_type( 'page' ) ) { | |
| 240 | + $create_new_label = esc_html__( 'Create Your First Page', 'elementor' ); | |
| 241 | + $create_new_cpt = 'page'; | |
| 242 | + } elseif ( User::is_current_user_can_edit_post_type( 'post' ) ) { | |
| 243 | + $create_new_label = esc_html__( 'Create Your First Post', 'elementor' ); | |
| 244 | + $create_new_cpt = 'post'; | |
| 245 | + } | |
| 246 | + | |
| 247 | + ?> | |
| 248 | + <div class="wrap"> | |
| 249 | + <div class="e-getting-started"> | |
| 250 | + <div class="e-getting-started__box postbox"> | |
| 251 | + <div class="e-getting-started__header"> | |
| 252 | + <div class="e-getting-started__title"> | |
| 253 | + <div class="e-logo-wrapper"> | |
| 254 | + <i class="eicon-elementor"></i> | |
| 255 | + </div> | |
| 256 | + <?php echo esc_html__( 'Getting Started', 'elementor' ); ?> | |
| 257 | + </div> | |
| 258 | + <a class="e-getting-started__skip" href="<?php echo esc_url( admin_url() ); ?>"> | |
| 259 | + <i class="eicon-close" aria-hidden="true" title="<?php esc_attr_e( 'Skip', 'elementor' ); ?>"></i> | |
| 260 | + <span class="elementor-screen-only"><?php echo esc_html__( 'Skip', 'elementor' ); ?></span> | |
| 261 | + </a> | |
| 262 | + </div> | |
| 263 | + <div class="e-getting-started__content"> | |
| 264 | + <div class="e-getting-started__content--narrow"> | |
| 265 | + <h2><?php echo esc_html__( 'Welcome to Elementor', 'elementor' ); ?></h2> | |
| 266 | + <p><?php echo esc_html__( 'Get introduced to Elementor by watching our "Getting Started" video series. It will guide you through the steps needed to create your website. Then click to create your first page.', 'elementor' ); ?></p> | |
| 267 | + </div> | |
| 268 | + | |
| 269 | + <div class="e-getting-started__video"> | |
| 270 | + <iframe width="620" height="350" src="https://www.youtube-nocookie.com/embed/videoseries?v=icTcREd1tAg&list=PLZyp9H25CboE6dhe7MnUxUdp4zU7OsNSe&index=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | |
| 271 | + </div> | |
| 272 | + | |
| 273 | + <div class="e-getting-started__actions e-getting-started__content--narrow"> | |
| 274 | + <?php if ( ! empty( $create_new_cpt ) ) : ?> | |
| 275 | + <a href="<?php echo esc_url( Plugin::$instance->documents->get_create_new_post_url( $create_new_cpt ) ); ?>" class="button button-primary button-hero"><?php echo esc_html( $create_new_label ); ?></a> | |
| 276 | + <?php endif; ?> | |
| 277 | + | |
| 278 | + <a href="https://go.elementor.com/getting-started/" target="_blank" class="button button-secondary button-hero"><?php echo esc_html__( 'Watch the Full Guide', 'elementor' ); ?></a> | |
| 279 | + </div> | |
| 280 | + </div> | |
| 281 | + </div> | |
| 282 | + </div> | |
| 283 | + </div><!-- /.wrap --> | |
| 284 | + <?php | |
| 285 | + } | |
| 286 | + | |
| 287 | + /** | |
| 288 | + * Display settings page. | |
| 289 | + * | |
| 290 | + * Output the content for the custom fonts page. | |
| 291 | + * | |
| 292 | + * @since 2.0.0 | |
| 293 | + * @access public | |
| 294 | + */ | |
| 295 | + public function elementor_custom_fonts() { | |
| 296 | + ?> | |
| 297 | + <div class="wrap"> | |
| 298 | + <div class="elementor-blank_state"> | |
| 299 | + <?php // PHPCS - No need to escape an SVG image from the Elementor assets/images folder. ?> | |
| 300 | + <img src="<?php echo ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" /> | |
| 301 | + <h2><?php echo esc_html__( 'Add Your Custom Fonts', 'elementor' ); ?></h2> | |
| 302 | + <p><?php echo esc_html__( 'Custom Fonts allows you to add your self-hosted fonts and use them on your Elementor projects to create a unique brand language.', 'elementor' ); ?></p> | |
| 303 | + <?php // PHPCS - No need to escape a URL. The query arg is sanitized. ?> | |
| 304 | + <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="<?php echo Utils::get_pro_link( 'https://elementor.com/pro/?utm_source=wp-custom-fonts&utm_campaign=gopro&utm_medium=wp-dash' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a> | |
| 305 | + </div> | |
| 306 | + </div><!-- /.wrap --> | |
| 307 | + <?php | |
| 308 | + } | |
| 309 | + | |
| 310 | + /** | |
| 311 | + * Display settings page. | |
| 312 | + * | |
| 313 | + * Output the content for the custom icons page. | |
| 314 | + * | |
| 315 | + * @since 2.8.0 | |
| 316 | + * @access public | |
| 317 | + */ | |
| 318 | + public function elementor_custom_icons() { | |
| 319 | + ?> | |
| 320 | + <div class="wrap"> | |
| 321 | + <div class="elementor-blank_state"> | |
| 322 | + <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg' ); ?>" /> | |
| 323 | + <h2><?php echo esc_html__( 'Add Your Custom Icons', 'elementor' ); ?></h2> | |
| 324 | + <p><?php echo esc_html__( 'Don\'t rely solely on the FontAwesome icons everyone else is using! Differentiate your website and your style with custom icons you can upload from your favorite icons source.', 'elementor' ); ?></p> | |
| 325 | + <?php // PHPCS - No need to escape a URL. The query arg is sanitized. ?> | |
| 326 | + <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="<?php echo Utils::get_pro_link( 'https://elementor.com/pro/?utm_source=wp-custom-icons&utm_campaign=gopro&utm_medium=wp-dash' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a> | |
| 327 | + </div> | |
| 328 | + </div><!-- /.wrap --> | |
| 329 | + <?php | |
| 330 | + } | |
| 331 | + | |
| 332 | + /** | |
| 333 | + * Display settings page. | |
| 334 | + * | |
| 335 | + * Output the content for the Popups page. | |
| 336 | + * | |
| 337 | + * @since 2.4.0 | |
| 338 | + * @access public | |
| 339 | + */ | |
| 340 | + public function elementor_popups() { | |
| 341 | + ?> | |
| 342 | + <div class="wrap"> | |
| 343 | + <div class="elementor-blank_state"> | |
| 344 | + <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg' ); ?>" /> | |
| 345 | + <h2><?php echo esc_html__( 'Get Popup Builder', 'elementor' ); ?></h2> | |
| 346 | + <p><?php echo esc_html__( 'Popup Builder lets you take advantage of all the amazing features in Elementor, so you can build beautiful & highly converting popups. Go pro and start designing your popups today.', 'elementor' ); ?></p> | |
| 347 | + <?php // PHPCS - No need to escape a URL. The query arg is sanitized. ?> | |
| 348 | + <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="<?php echo Utils::get_pro_link( 'https://elementor.com/popup-builder/?utm_source=popup-templates&utm_campaign=gopro&utm_medium=wp-dash' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a> | |
| 349 | + </div> | |
| 350 | + </div><!-- /.wrap --> | |
| 351 | + <?php | |
| 352 | + } | |
| 353 | + | |
| 354 | + public function elementor_form_submissions() { | |
| 355 | + ?> | |
| 356 | + <div class="wrap"> | |
| 357 | + <div class="elementor-blank_state"> | |
| 358 | + <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL ); ?>images/go-pro-wp-dashboard.svg" /> | |
| 359 | + <h2><?php echo esc_html__( 'Collect Your Form Submissions', 'elementor' ); ?></h2> | |
| 360 | + <p> | |
| 361 | + <?php echo esc_html__( 'Save and manage all of your form submissions in one single place. | |
| 362 | +All within a simple, intuitive place.', 'elementor' ); ?> | |
| 363 | + <a href="http://go.elementor.com/wp-dash-submissions" target="_blank" rel="nofollow"> | |
| 364 | + <?php echo esc_html__( 'Learn More', 'elementor' ); ?> | |
| 365 | + </a> | |
| 366 | + </p> | |
| 367 | + <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="<?php | |
| 368 | + Utils::print_unescaped_internal_string( Utils::get_pro_link( 'https://go.elementor.com/go-pro-submissions' ) ); | |
| 369 | + ?>"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a> | |
| 370 | + </div> | |
| 371 | + </div><!-- /.wrap --> | |
| 372 | + <?php | |
| 373 | + } | |
| 374 | + | |
| 375 | + /** | |
| 103 | 376 | * On admin init. |
| 104 | 377 | * |
| 105 | 378 | * Preform actions on WordPress admin initialization. |
| 106 | 379 | * |
| @@ -109,12 +382,28 @@ | ||
| 109 | 382 | * @since 2.0.0 |
| 110 | 383 | * @access public |
| 111 | 384 | */ |
| 112 | 385 | public function on_admin_init() { |
| 386 | + $this->handle_external_redirects(); | |
| 387 | + | |
| 113 | 388 | $this->maybe_remove_all_admin_notices(); |
| 114 | 389 | } |
| 115 | 390 | |
| 116 | 391 | /** |
| 392 | + * Change "Settings" menu name. | |
| 393 | + * | |
| 394 | + * Update the name of the Settings admin menu from "Elementor" to "Settings". | |
| 395 | + * | |
| 396 | + * Fired by `admin_menu` action. | |
| 397 | + * | |
| 398 | + * @since 1.0.0 | |
| 399 | + * @access public | |
| 400 | + */ | |
| 401 | + public function admin_menu_change_name() { | |
| 402 | + Utils::change_submenu_first_item_label( 'elementor', esc_html__( 'Settings', 'elementor' ) ); | |
| 403 | + } | |
| 404 | + | |
| 405 | + /** | |
| 117 | 406 | * Update CSS print method. |
| 118 | 407 | * |
| 119 | 408 | * Clear post CSS cache. |
| 120 | 409 | * |
| @@ -122,9 +411,9 @@ | ||
| 122 | 411 | * `update_option_elementor_css_print_method` actions. |
| 123 | 412 | * |
| 124 | 413 | * @since 1.7.5 |
| 125 | 414 | * @access public |
| 126 | - * @deprecated 3.0.0 Use `Plugin::$instance->files_manager->clear_cache()` method instead. | |
| 415 | + * @deprecated 3.0.0 | |
| 127 | 416 | */ |
| 128 | 417 | public function update_css_print_method() { |
| 129 | 418 | Plugin::$instance->files_manager->clear_cache(); |
| 130 | 419 | } |
| @@ -146,15 +435,8 @@ | ||
| 146 | 435 | self::TAB_GENERAL => [ |
| 147 | 436 | 'label' => esc_html__( 'General', 'elementor' ), |
| 148 | 437 | 'sections' => [ |
| 149 | 438 | 'general' => [ |
| 150 | - 'label' => esc_html__( 'General', 'elementor' ), | |
| 151 | - 'callback' => function() { | |
| 152 | - printf( | |
| 153 | - '<p>%s</p><br><hr><br>', | |
| 154 | - esc_html__( 'Tailor how Elementor enhances your site, from post types to other functions.', 'elementor' ) | |
| 155 | - ); | |
| 156 | - }, | |
| 157 | 439 | 'fields' => [ |
| 158 | 440 | self::UPDATE_TIME_FIELD => [ |
| 159 | 441 | 'full_field_id' => self::UPDATE_TIME_FIELD, |
| 160 | 442 | 'field_args' => [ |
| @@ -194,8 +476,32 @@ | ||
| 194 | 476 | 'fields' => $this->get_usage_fields(), |
| 195 | 477 | ], |
| 196 | 478 | ], |
| 197 | 479 | ], |
| 480 | + self::TAB_STYLE => [ | |
| 481 | + 'label' => esc_html__( 'Style', 'elementor' ), | |
| 482 | + 'sections' => [ | |
| 483 | + 'style' => [ | |
| 484 | + 'fields' => [ | |
| 485 | + 'notice' => [ | |
| 486 | + 'label' => esc_html__( 'Looking for the Style settings?', 'elementor' ), | |
| 487 | + 'field_args' => [ | |
| 488 | + 'type' => 'raw_html', | |
| 489 | + 'html' => sprintf( | |
| 490 | + /* translators: 1: Bold open tag, 2: Bold close tag */ | |
| 491 | + esc_html__( 'The Style settings changed its location and can now be found within Elementor Editor\'s %1$sPanel > Hamburger Menu > Site Settings%2$s.', 'elementor' ), | |
| 492 | + '<strong>', | |
| 493 | + '</strong>' | |
| 494 | + ) . | |
| 495 | + '<br>' . | |
| 496 | + esc_html__( 'You can use the Site Settings to make changes and see them live!', 'elementor' ) . | |
| 497 | + sprintf( ' <a target="_blank" href="http://go.elementor.com/panel-layout-settings">%s</a>', esc_html__( 'Learn More', 'elementor' ) ), | |
| 498 | + ], | |
| 499 | + ], | |
| 500 | + ], | |
| 501 | + ], | |
| 502 | + ], | |
| 503 | + ], | |
| 198 | 504 | self::TAB_INTEGRATIONS => [ |
| 199 | 505 | 'label' => esc_html__( 'Integrations', 'elementor' ), |
| 200 | 506 | 'sections' => [ |
| 201 | 507 | 'google_maps' => [ |
| @@ -223,16 +529,22 @@ | ||
| 223 | 529 | self::TAB_ADVANCED => [ |
| 224 | 530 | 'label' => esc_html__( 'Advanced', 'elementor' ), |
| 225 | 531 | 'sections' => [ |
| 226 | 532 | 'advanced' => [ |
| 227 | - 'label' => esc_html__( 'Advanced', 'elementor' ), | |
| 228 | - 'callback' => function() { | |
| 229 | - printf( | |
| 230 | - '<p>%s</p><br><hr><br>', | |
| 231 | - esc_html__( 'Personalize the way Elementor works on your website by choosing the advanced features and how they operate.', 'elementor' ) | |
| 232 | - ); | |
| 233 | - }, | |
| 234 | 533 | 'fields' => [ |
| 534 | + 'css_print_method' => [ | |
| 535 | + 'label' => esc_html__( 'CSS Print Method', 'elementor' ), | |
| 536 | + 'field_args' => [ | |
| 537 | + 'class' => 'elementor_css_print_method', | |
| 538 | + 'type' => 'select', | |
| 539 | + 'std' => 'internal', | |
| 540 | + 'options' => [ | |
| 541 | + 'external' => esc_html__( 'External File', 'elementor' ), | |
| 542 | + 'internal' => esc_html__( 'Internal Embedding', 'elementor' ), | |
| 543 | + ], | |
| 544 | + 'desc' => '<div class="elementor-css-print-method-description" data-value="external" style="display: none">' . esc_html__( 'Use external CSS files for all generated stylesheets. Choose this setting for better performance (recommended).', 'elementor' ) . '</div><div class="elementor-css-print-method-description" data-value="internal" style="display: none">' . esc_html__( 'Use internal CSS that is embedded in the head of the page. For troubleshooting server configuration conflicts and managing development environments.', 'elementor' ) . '</div>', | |
| 545 | + ], | |
| 546 | + ], | |
| 235 | 547 | 'editor_break_lines' => [ |
| 236 | 548 | 'label' => esc_html__( 'Switch Editor Loader Method', 'elementor' ), |
| 237 | 549 | 'field_args' => [ |
| 238 | 550 | 'type' => 'select', |
| @@ -255,25 +567,8 @@ | ||
| 255 | 567 | ], |
| 256 | 568 | 'desc' => esc_html__( 'Please note! Allowing uploads of any files (SVG & JSON included) is a potential security risk.', 'elementor' ) . '<br>' . esc_html__( 'Elementor will try to sanitize the unfiltered files, removing potential malicious code and scripts.', 'elementor' ) . '<br>' . esc_html__( 'We recommend you only enable this feature if you understand the security risks involved.', 'elementor' ), |
| 257 | 569 | ], |
| 258 | 570 | ], |
| 259 | - 'google_font' => [ | |
| 260 | - 'label' => esc_html__( 'Google Fonts', 'elementor' ), | |
| 261 | - 'field_args' => [ | |
| 262 | - 'type' => 'select', | |
| 263 | - 'std' => '1', | |
| 264 | - 'options' => [ | |
| 265 | - '1' => esc_html__( 'Enable', 'elementor' ), | |
| 266 | - '0' => esc_html__( 'Disable', 'elementor' ), | |
| 267 | - ], | |
| 268 | - 'desc' => sprintf( | |
| 269 | - /* translators: 1: Link opening tag, 2: Link closing tag */ | |
| 270 | - esc_html__( 'Disable this option if you want to prevent Google Fonts from being loaded. This setting is recommended when loading fonts from a different source (plugin, theme or %1$scustom fonts%2$s).', 'elementor' ), | |
| 271 | - '<a href="' . admin_url( 'admin.php?page=elementor_custom_fonts' ) . '">', | |
| 272 | - '</a>' | |
| 273 | - ), | |
| 274 | - ], | |
| 275 | - ], | |
| 276 | 571 | 'font_display' => [ |
| 277 | 572 | 'label' => esc_html__( 'Google Fonts Load', 'elementor' ), |
| 278 | 573 | 'field_args' => [ |
| 279 | 574 | 'type' => 'select', |
| @@ -284,9 +579,9 @@ | ||
| 284 | 579 | 'swap' => esc_html__( 'Swap', 'elementor' ), |
| 285 | 580 | 'fallback' => esc_html__( 'Fallback', 'elementor' ), |
| 286 | 581 | 'optional' => esc_html__( 'Optional', 'elementor' ), |
| 287 | 582 | ], |
| 288 | - 'desc' => esc_html__( 'Font-display property defines how font files are loaded and displayed by the browser.', 'elementor' ) . '<br>' . esc_html__( 'Set the way Google Fonts are being loaded by selecting the font-display property (Recommended: Swap).', 'elementor' ), | |
| 583 | + 'desc' => esc_html__( 'Font-display property defines how font files are loaded and displayed by the browser.', 'elementor' ) . '<br>' . esc_html__( 'Set the way Google Fonts are being loaded by selecting the font-display property (Default: Auto).', 'elementor' ), | |
| 289 | 584 | ], |
| 290 | 585 | ], |
| 291 | 586 | ], |
| 292 | 587 | ], |
| @@ -291,94 +586,8 @@ | ||
| 291 | 586 | ], |
| 292 | 587 | ], |
| 293 | 588 | ], |
| 294 | 589 | ], |
| 295 | - self::TAB_PERFORMANCE => [ | |
| 296 | - 'label' => esc_html__( 'Performance', 'elementor' ), | |
| 297 | - 'sections' => [ | |
| 298 | - 'performance' => [ | |
| 299 | - 'label' => esc_html__( 'Performance', 'elementor' ), | |
| 300 | - 'callback' => function() { | |
| 301 | - printf( | |
| 302 | - '<p>%s</p><br><hr><br>', | |
| 303 | - esc_html__( 'Improve loading times on your site by selecting the optimization tools that best fit your requirements.', 'elementor' ) | |
| 304 | - ); | |
| 305 | - }, | |
| 306 | - 'fields' => [ | |
| 307 | - 'css_print_method' => [ | |
| 308 | - 'label' => esc_html__( 'CSS Print Method', 'elementor' ), | |
| 309 | - 'field_args' => [ | |
| 310 | - 'class' => 'elementor_css_print_method', | |
| 311 | - 'type' => 'select', | |
| 312 | - 'std' => 'external', | |
| 313 | - 'options' => [ | |
| 314 | - 'external' => esc_html__( 'External File', 'elementor' ), | |
| 315 | - 'internal' => esc_html__( 'Internal Embedding', 'elementor' ), | |
| 316 | - ], | |
| 317 | - 'desc' => sprintf( | |
| 318 | - /* translators: %s: <head> tag. */ | |
| 319 | - esc_html__( 'Internal Embedding places all CSS in the %s which works great for troubleshooting, while External File uses external CSS file for better performance (recommended).', 'elementor' ), | |
| 320 | - '<code><head></code>', | |
| 321 | - ), | |
| 322 | - ], | |
| 323 | - ], | |
| 324 | - 'optimized_image_loading' => [ | |
| 325 | - 'label' => esc_html__( 'Optimized Image Loading', 'elementor' ), | |
| 326 | - 'field_args' => [ | |
| 327 | - 'type' => 'select', | |
| 328 | - 'std' => '1', | |
| 329 | - 'options' => [ | |
| 330 | - '1' => esc_html__( 'Enable', 'elementor' ), | |
| 331 | - '0' => esc_html__( 'Disable', 'elementor' ), | |
| 332 | - ], | |
| 333 | - 'desc' => sprintf( | |
| 334 | - /* translators: 1: fetchpriority attribute, 2: lazy loading attribute. */ | |
| 335 | - esc_html__( 'Improve performance by applying %1$s on LCP image and %2$s on images below the fold.', 'elementor' ), | |
| 336 | - '<code>fetchpriority="high"</code>', | |
| 337 | - '<code>loading="lazy"</code>' | |
| 338 | - ), | |
| 339 | - ], | |
| 340 | - ], | |
| 341 | - 'optimized_gutenberg_loading' => [ | |
| 342 | - 'label' => esc_html__( 'Optimized Gutenberg Loading', 'elementor' ), | |
| 343 | - 'field_args' => [ | |
| 344 | - 'type' => 'select', | |
| 345 | - 'std' => '1', | |
| 346 | - 'options' => [ | |
| 347 | - '1' => esc_html__( 'Enable', 'elementor' ), | |
| 348 | - '0' => esc_html__( 'Disable', 'elementor' ), | |
| 349 | - ], | |
| 350 | - 'desc' => esc_html__( 'Reduce unnecessary render-blocking loads by dequeuing unused Gutenberg block editor scripts and styles.', 'elementor' ), | |
| 351 | - ], | |
| 352 | - ], | |
| 353 | - 'lazy_load_background_images' => [ | |
| 354 | - 'label' => esc_html__( 'Lazy Load Background Images', 'elementor' ), | |
| 355 | - 'field_args' => [ | |
| 356 | - 'type' => 'select', | |
| 357 | - 'std' => '1', | |
| 358 | - 'options' => [ | |
| 359 | - '1' => esc_html__( 'Enable', 'elementor' ), | |
| 360 | - '0' => esc_html__( 'Disable', 'elementor' ), | |
| 361 | - ], | |
| 362 | - 'desc' => esc_html__( 'Improve initial page load performance by lazy loading all background images except the first one.', 'elementor' ), | |
| 363 | - ], | |
| 364 | - ], | |
| 365 | - 'local_google_fonts' => [ | |
| 366 | - 'label' => esc_html__( 'Load Google Fonts Locally', 'elementor' ), | |
| 367 | - 'field_args' => [ | |
| 368 | - 'type' => 'select', | |
| 369 | - 'std' => '0', | |
| 370 | - 'options' => [ | |
| 371 | - '1' => esc_html__( 'Enable', 'elementor' ), | |
| 372 | - '0' => esc_html__( 'Disable', 'elementor' ), | |
| 373 | - ], | |
| 374 | - 'desc' => esc_html__( 'Load Google fonts locally to benefit from faster performance and ensure GDPR compliance. Fonts will be served from your own server instead of Google’s. Only the very first load (in the editor and on the front end) may take slightly longer.', 'elementor' ), | |
| 375 | - ], | |
| 376 | - ], | |
| 377 | - ], | |
| 378 | - ], | |
| 379 | - ], | |
| 380 | - ], | |
| 381 | 590 | ]; |
| 382 | 591 | } |
| 383 | 592 | |
| 384 | 593 | /** |
| @@ -391,9 +600,9 @@ | ||
| 391 | 600 | * |
| 392 | 601 | * @return string Settings page title. |
| 393 | 602 | */ |
| 394 | 603 | protected function get_page_title() { |
| 395 | - return esc_html__( 'Elementor', 'elementor' ); | |
| 604 | + return __( 'Elementor', 'elementor' ); | |
| 396 | 605 | } |
| 397 | 606 | |
| 398 | 607 | /** |
| 399 | 608 | * @since 2.2.0 |
| @@ -400,16 +609,13 @@ | ||
| 400 | 609 | * @access private |
| 401 | 610 | */ |
| 402 | 611 | private function maybe_remove_all_admin_notices() { |
| 403 | 612 | $elementor_pages = [ |
| 404 | - 'elementor-system-info', | |
| 405 | - 'e-form-submissions', | |
| 613 | + 'elementor-getting-started', | |
| 406 | 614 | 'elementor_custom_fonts', |
| 407 | 615 | 'elementor_custom_icons', |
| 408 | 616 | 'elementor-license', |
| 409 | - 'elementor_custom_code', | |
| 410 | 617 | 'popup_templates', |
| 411 | - 'elementor-apps', | |
| 412 | 618 | ]; |
| 413 | 619 | |
| 414 | 620 | if ( empty( $_GET['page'] ) || ! in_array( $_GET['page'], $elementor_pages, true ) ) { |
| 415 | 621 | return; |
| @@ -417,21 +623,8 @@ | ||
| 417 | 623 | |
| 418 | 624 | remove_all_actions( 'admin_notices' ); |
| 419 | 625 | } |
| 420 | 626 | |
| 421 | - public function add_generator_tag_settings( $settings ) { | |
| 422 | - $css_print_method = get_option( 'elementor_css_print_method', 'external' ); | |
| 423 | - $settings[] = 'css_print_method-' . $css_print_method; | |
| 424 | - | |
| 425 | - $google_font = Fonts::is_google_fonts_enabled() ? 'enabled' : 'disabled'; | |
| 426 | - $settings[] = 'google_font-' . $google_font; | |
| 427 | - | |
| 428 | - $font_display = Fonts::get_font_display_setting(); | |
| 429 | - $settings[] = 'font_display-' . $font_display; | |
| 430 | - | |
| 431 | - return $settings; | |
| 432 | - } | |
| 433 | - | |
| 434 | 627 | /** |
| 435 | 628 | * Settings page constructor. |
| 436 | 629 | * |
| 437 | 630 | * Initializing Elementor "Settings" page. |
| @@ -442,17 +635,13 @@ | ||
| 442 | 635 | public function __construct() { |
| 443 | 636 | parent::__construct(); |
| 444 | 637 | |
| 445 | 638 | add_action( 'admin_init', [ $this, 'on_admin_init' ] ); |
| 446 | - add_filter( 'elementor/generator_tag/settings', [ $this, 'add_generator_tag_settings' ] ); | |
| 447 | - | |
| 448 | 639 | add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 20 ); |
| 640 | + add_action( 'admin_menu', [ $this, 'admin_menu_change_name' ], 200 ); | |
| 641 | + add_action( 'admin_menu', [ $this, 'register_pro_menu' ], self::MENU_PRIORITY_GO_PRO ); | |
| 642 | + add_action( 'admin_menu', [ $this, 'register_knowledge_base_menu' ], 501 ); | |
| 449 | 643 | |
| 450 | - add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) { | |
| 451 | - $this->register_editor_one_settings_menu( $menu_data_provider ); | |
| 452 | - $this->register_editor_one_home_menu( $menu_data_provider ); | |
| 453 | - } ); | |
| 454 | - | |
| 455 | 644 | $clear_cache_callback = [ Plugin::$instance->files_manager, 'clear_cache' ]; |
| 456 | 645 | |
| 457 | 646 | // Clear CSS Meta after change css related methods. |
| 458 | 647 | $css_settings = [ |
| @@ -458,9 +647,8 @@ | ||
| 458 | 647 | $css_settings = [ |
| 459 | 648 | 'elementor_disable_color_schemes', |
| 460 | 649 | 'elementor_disable_typography_schemes', |
| 461 | 650 | 'elementor_css_print_method', |
| 462 | - 'elementor_local_google_fonts', | |
| 463 | 651 | ]; |
| 464 | 652 | |
| 465 | 653 | foreach ( $css_settings as $option_name ) { |
| 466 | 654 | add_action( "add_option_{$option_name}", $clear_cache_callback ); |
| @@ -466,7 +654,8 @@ | ||
| 466 | 654 | add_action( "add_option_{$option_name}", $clear_cache_callback ); |
| 467 | 655 | add_action( "update_option_{$option_name}", $clear_cache_callback ); |
| 468 | 656 | } |
| 469 | 657 | |
| 470 | - add_action( 'update_option_elementor_font_display', [ Google_Font::class, 'clear_cache' ] ); | |
| 658 | + add_filter( 'custom_menu_order', '__return_true' ); | |
| 659 | + add_filter( 'menu_order', [ $this, 'menu_order' ] ); | |
| 471 | 660 | } |
| 472 | 661 | } |