← All changes
|
core/kits/documents/tabs/settings-site-identity.php
+15
-60
4.3.1
→
3.0.7
View file →
| @@ -2,13 +2,12 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Core\Kits\Documents\Tabs; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Controls_Manager; |
| 6 | -use Elementor\Core\Base\Document; | |
| 7 | -use Elementor\Core\Files\Uploads_Manager; | |
| 6 | +use Elementor\DB; | |
| 8 | 7 | |
| 9 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | - exit; // Exit if accessed directly. | |
| 9 | + exit; // Exit if accessed directly | |
| 11 | 10 | } |
| 12 | 11 | |
| 13 | 12 | class Settings_Site_Identity extends Tab_Base { |
| 14 | 13 | |
| @@ -16,23 +15,11 @@ | ||
| 16 | 15 | return 'settings-site-identity'; |
| 17 | 16 | } |
| 18 | 17 | |
| 19 | 18 | public function get_title() { |
| 20 | - return esc_html__( 'Site Identity', 'elementor' ); | |
| 19 | + return __( 'Site Identity', 'elementor' ); | |
| 21 | 20 | } |
| 22 | 21 | |
| 23 | - public function get_group() { | |
| 24 | - return 'settings'; | |
| 25 | - } | |
| 26 | - | |
| 27 | - public function get_icon() { | |
| 28 | - return 'eicon-site-identity'; | |
| 29 | - } | |
| 30 | - | |
| 31 | - public function get_help_url() { | |
| 32 | - return 'https://go.elementor.com/global-site-identity/'; | |
| 33 | - } | |
| 34 | - | |
| 35 | 22 | protected function register_tab_controls() { |
| 36 | 23 | $custom_logo_id = get_theme_mod( 'custom_logo' ); |
| 37 | 24 | $custom_logo_src = wp_get_attachment_image_src( $custom_logo_id, 'full' ); |
| 38 | 25 | |
| @@ -38,11 +25,8 @@ | ||
| 38 | 25 | |
| 39 | 26 | $site_icon_id = get_option( 'site_icon' ); |
| 40 | 27 | $site_icon_src = wp_get_attachment_image_src( $site_icon_id, 'full' ); |
| 41 | 28 | |
| 42 | - // If CANNOT upload svg normally, it will add a custom inline option to force svg upload if requested. (in logo and favicon) | |
| 43 | - $should_include_svg_inline_option = ! Uploads_Manager::are_unfiltered_uploads_enabled(); | |
| 44 | - | |
| 45 | 29 | $this->start_controls_section( |
| 46 | 30 | 'section_' . $this->get_id(), |
| 47 | 31 | [ |
| 48 | 32 | 'label' => $this->get_title(), |
| @@ -52,17 +36,11 @@ | ||
| 52 | 36 | |
| 53 | 37 | $this->add_control( |
| 54 | 38 | $this->get_id() . '_refresh_notice', |
| 55 | 39 | [ |
| 56 | - 'type' => Controls_Manager::ALERT, | |
| 57 | - 'alert_type' => 'info', | |
| 58 | - 'content' => sprintf( | |
| 59 | - /* translators: 1: Link open tag, 2: Link open tag, 3: Link close tag. */ | |
| 60 | - esc_html__( 'Changes will be reflected only after %1$s saving %3$s and %2$s reloading %3$s preview.', 'elementor' ), | |
| 61 | - '<a href="javascript: $e.run( \'document/save/default\' )">', | |
| 62 | - '<a href="javascript: $e.run( \'preview/reload\' )">', | |
| 63 | - '</a>' | |
| 64 | - ), | |
| 40 | + 'type' => Controls_Manager::RAW_HTML, | |
| 41 | + 'raw' => __( 'Changes will be reflected in the preview only after the page reloads.', 'elementor' ), | |
| 42 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', | |
| 65 | 43 | ] |
| 66 | 44 | ); |
| 67 | 45 | |
| 68 | 46 | $this->add_control( |
| @@ -67,13 +45,12 @@ | ||
| 67 | 45 | |
| 68 | 46 | $this->add_control( |
| 69 | 47 | 'site_name', |
| 70 | 48 | [ |
| 71 | - 'label' => esc_html__( 'Site Name', 'elementor' ), | |
| 49 | + 'label' => __( 'Site Name', 'elementor' ), | |
| 72 | 50 | 'default' => get_option( 'blogname' ), |
| 73 | - 'placeholder' => esc_html__( 'Choose name', 'elementor' ), | |
| 51 | + 'placeholder' => __( 'Choose name', 'elementor' ), | |
| 74 | 52 | 'label_block' => true, |
| 75 | - 'export' => false, | |
| 76 | 53 | ] |
| 77 | 54 | ); |
| 78 | 55 | |
| 79 | 56 | $this->add_control( |
| @@ -78,13 +55,12 @@ | ||
| 78 | 55 | |
| 79 | 56 | $this->add_control( |
| 80 | 57 | 'site_description', |
| 81 | 58 | [ |
| 82 | - 'label' => esc_html__( 'Site Description', 'elementor' ), | |
| 59 | + 'label' => __( 'Site Description', 'elementor' ), | |
| 83 | 60 | 'default' => get_option( 'blogdescription' ), |
| 84 | - 'placeholder' => esc_html__( 'Choose description', 'elementor' ), | |
| 61 | + 'placeholder' => __( 'Choose description', 'elementor' ), | |
| 85 | 62 | 'label_block' => true, |
| 86 | - 'export' => false, | |
| 87 | 63 | ] |
| 88 | 64 | ); |
| 89 | 65 | |
| 90 | 66 | $this->add_control( |
| @@ -89,27 +65,15 @@ | ||
| 89 | 65 | |
| 90 | 66 | $this->add_control( |
| 91 | 67 | 'site_logo', |
| 92 | 68 | [ |
| 93 | - 'label' => esc_html__( 'Site Logo', 'elementor' ), | |
| 69 | + 'label' => __( 'Site Logo', 'elementor' ), | |
| 94 | 70 | 'type' => Controls_Manager::MEDIA, |
| 95 | - 'should_include_svg_inline_option' => $should_include_svg_inline_option, | |
| 96 | 71 | 'default' => [ |
| 97 | 72 | 'id' => $custom_logo_id, |
| 98 | 73 | 'url' => $custom_logo_src ? $custom_logo_src[0] : '', |
| 99 | 74 | ], |
| 100 | - 'description' => sprintf( | |
| 101 | - /* translators: 1: Width number pixel, 2: Height number pixel. */ | |
| 102 | - esc_html__( 'Suggested image dimensions: %1$s × %2$s pixels.', 'elementor' ), | |
| 103 | - '350', | |
| 104 | - '100' | |
| 105 | - ), | |
| 106 | - 'export' => false, | |
| 107 | - 'ai' => [ | |
| 108 | - 'active' => true, | |
| 109 | - 'type' => 'media', | |
| 110 | - 'category' => 'vector', | |
| 111 | - ], | |
| 75 | + 'description' => __( 'Suggested image dimensions: 350 × 100 pixels.', 'elementor' ), | |
| 112 | 76 | ] |
| 113 | 77 | ); |
| 114 | 78 | |
| 115 | 79 | $this->add_control( |
| @@ -114,17 +78,15 @@ | ||
| 114 | 78 | |
| 115 | 79 | $this->add_control( |
| 116 | 80 | 'site_favicon', |
| 117 | 81 | [ |
| 118 | - 'label' => esc_html__( 'Site Favicon', 'elementor' ), | |
| 82 | + 'label' => __( 'Site Favicon', 'elementor' ), | |
| 119 | 83 | 'type' => Controls_Manager::MEDIA, |
| 120 | - 'should_include_svg_inline_option' => $should_include_svg_inline_option, | |
| 121 | 84 | 'default' => [ |
| 122 | 85 | 'id' => $site_icon_id, |
| 123 | 86 | 'url' => $site_icon_src ? $site_icon_src[0] : '', |
| 124 | 87 | ], |
| 125 | - 'description' => esc_html__( 'Suggested favicon dimensions: 512 × 512 pixels.', 'elementor' ), | |
| 126 | - 'export' => false, | |
| 88 | + 'description' => __( 'Suggested favicon dimensions: 512 × 512 pixels.', 'elementor' ), | |
| 127 | 89 | ] |
| 128 | 90 | ); |
| 129 | 91 | |
| 130 | 92 | $this->end_controls_section(); |
| @@ -130,18 +92,11 @@ | ||
| 130 | 92 | $this->end_controls_section(); |
| 131 | 93 | } |
| 132 | 94 | |
| 133 | 95 | public function on_save( $data ) { |
| 134 | - if ( | |
| 135 | - ! isset( $data['settings']['post_status'] ) || | |
| 136 | - Document::STATUS_PUBLISH !== $data['settings']['post_status'] || | |
| 137 | - // Should check for the current action to avoid infinite loop | |
| 138 | - // when updating options like: "blogname" and "blogdescription". | |
| 139 | - strpos( current_action(), 'update_option_' ) === 0 | |
| 140 | - ) { | |
| 96 | + if ( ! isset( $data['settings'] ) || DB::STATUS_PUBLISH !== $data['settings']['post_status'] ) { | |
| 141 | 97 | return; |
| 142 | 98 | } |
| 143 | - | |
| 144 | 99 | if ( isset( $data['settings']['site_name'] ) ) { |
| 145 | 100 | update_option( 'blogname', $data['settings']['site_name'] ); |
| 146 | 101 | } |
| 147 | 102 | |