← All changes
|
core/kits/documents/tabs/settings-site-identity.php
+15
-67
4.3.1
→
3.0.3
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,33 +15,15 @@ | ||
| 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 | |
| 39 | - $site_icon_id = get_option( 'site_icon' ); | |
| 40 | - $site_icon_src = wp_get_attachment_image_src( $site_icon_id, 'full' ); | |
| 41 | - | |
| 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 | 26 | $this->start_controls_section( |
| 46 | 27 | 'section_' . $this->get_id(), |
| 47 | 28 | [ |
| 48 | 29 | 'label' => $this->get_title(), |
| @@ -52,17 +33,11 @@ | ||
| 52 | 33 | |
| 53 | 34 | $this->add_control( |
| 54 | 35 | $this->get_id() . '_refresh_notice', |
| 55 | 36 | [ |
| 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 | - ), | |
| 37 | + 'type' => Controls_Manager::RAW_HTML, | |
| 38 | + 'raw' => __( 'Changes will be reflected in the preview only after the page reloads.', 'elementor' ), | |
| 39 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', | |
| 65 | 40 | ] |
| 66 | 41 | ); |
| 67 | 42 | |
| 68 | 43 | $this->add_control( |
| @@ -67,13 +42,12 @@ | ||
| 67 | 42 | |
| 68 | 43 | $this->add_control( |
| 69 | 44 | 'site_name', |
| 70 | 45 | [ |
| 71 | - 'label' => esc_html__( 'Site Name', 'elementor' ), | |
| 46 | + 'label' => __( 'Site Name', 'elementor' ), | |
| 72 | 47 | 'default' => get_option( 'blogname' ), |
| 73 | - 'placeholder' => esc_html__( 'Choose name', 'elementor' ), | |
| 48 | + 'placeholder' => __( 'Choose name', 'elementor' ), | |
| 74 | 49 | 'label_block' => true, |
| 75 | - 'export' => false, | |
| 76 | 50 | ] |
| 77 | 51 | ); |
| 78 | 52 | |
| 79 | 53 | $this->add_control( |
| @@ -78,13 +52,12 @@ | ||
| 78 | 52 | |
| 79 | 53 | $this->add_control( |
| 80 | 54 | 'site_description', |
| 81 | 55 | [ |
| 82 | - 'label' => esc_html__( 'Site Description', 'elementor' ), | |
| 56 | + 'label' => __( 'Site Description', 'elementor' ), | |
| 83 | 57 | 'default' => get_option( 'blogdescription' ), |
| 84 | - 'placeholder' => esc_html__( 'Choose description', 'elementor' ), | |
| 58 | + 'placeholder' => __( 'Choose description', 'elementor' ), | |
| 85 | 59 | 'label_block' => true, |
| 86 | - 'export' => false, | |
| 87 | 60 | ] |
| 88 | 61 | ); |
| 89 | 62 | |
| 90 | 63 | $this->add_control( |
| @@ -89,27 +62,15 @@ | ||
| 89 | 62 | |
| 90 | 63 | $this->add_control( |
| 91 | 64 | 'site_logo', |
| 92 | 65 | [ |
| 93 | - 'label' => esc_html__( 'Site Logo', 'elementor' ), | |
| 66 | + 'label' => __( 'Site Logo', 'elementor' ), | |
| 94 | 67 | 'type' => Controls_Manager::MEDIA, |
| 95 | - 'should_include_svg_inline_option' => $should_include_svg_inline_option, | |
| 96 | 68 | 'default' => [ |
| 97 | 69 | 'id' => $custom_logo_id, |
| 98 | 70 | 'url' => $custom_logo_src ? $custom_logo_src[0] : '', |
| 99 | 71 | ], |
| 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 | - ], | |
| 72 | + 'description' => __( 'Suggested image dimensions: 350 × 100 pixels.', 'elementor' ), | |
| 112 | 73 | ] |
| 113 | 74 | ); |
| 114 | 75 | |
| 115 | 76 | $this->add_control( |
| @@ -114,17 +75,11 @@ | ||
| 114 | 75 | |
| 115 | 76 | $this->add_control( |
| 116 | 77 | 'site_favicon', |
| 117 | 78 | [ |
| 118 | - 'label' => esc_html__( 'Site Favicon', 'elementor' ), | |
| 79 | + 'label' => __( 'Site Favicon', 'elementor' ), | |
| 119 | 80 | 'type' => Controls_Manager::MEDIA, |
| 120 | - 'should_include_svg_inline_option' => $should_include_svg_inline_option, | |
| 121 | - 'default' => [ | |
| 122 | - 'id' => $site_icon_id, | |
| 123 | - 'url' => $site_icon_src ? $site_icon_src[0] : '', | |
| 124 | - ], | |
| 125 | - 'description' => esc_html__( 'Suggested favicon dimensions: 512 × 512 pixels.', 'elementor' ), | |
| 126 | - 'export' => false, | |
| 81 | + 'description' => __( 'Suggested favicon dimensions: 512 × 512 pixels.', 'elementor' ), | |
| 127 | 82 | ] |
| 128 | 83 | ); |
| 129 | 84 | |
| 130 | 85 | $this->end_controls_section(); |
| @@ -130,18 +85,11 @@ | ||
| 130 | 85 | $this->end_controls_section(); |
| 131 | 86 | } |
| 132 | 87 | |
| 133 | 88 | 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 | - ) { | |
| 89 | + if ( ! isset( $data['settings'] ) || DB::STATUS_PUBLISH !== $data['settings']['post_status'] ) { | |
| 141 | 90 | return; |
| 142 | 91 | } |
| 143 | - | |
| 144 | 92 | if ( isset( $data['settings']['site_name'] ) ) { |
| 145 | 93 | update_option( 'blogname', $data['settings']['site_name'] ); |
| 146 | 94 | } |
| 147 | 95 | |