breadcrumbs.php
6 months ago
copyright.php
6 months ago
current-time.php
6 months ago
logo.php
6 months ago
menu.php
6 months ago
modern-search.php
6 months ago
search.php
6 months ago
select.php
6 months ago
shopping-cart.php
6 months ago
site-title.php
6 months ago
copyright.php
282 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements\Theme_Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | use Elementor\Group_Control_Typography; |
| 8 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 9 | use Elementor\Group_Control_Text_Shadow; |
| 10 | |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; // Exit if accessed directly. |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Elementor 'Copyright' widget. |
| 18 | * |
| 19 | * Elementor widget that displays an 'Copyright'. |
| 20 | * |
| 21 | * @since 1.0.0 |
| 22 | */ |
| 23 | class Copyright extends Widget_Base { |
| 24 | |
| 25 | /** |
| 26 | * Get widget name. |
| 27 | * |
| 28 | * Retrieve 'Copyright' widget name. |
| 29 | * |
| 30 | * @since 1.0.0 |
| 31 | * @access public |
| 32 | * |
| 33 | * @return string Widget name. |
| 34 | */ |
| 35 | public function get_name() { |
| 36 | return 'aux_copyright'; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Get widget title. |
| 41 | * |
| 42 | * Retrieve 'Copyright' widget title. |
| 43 | * |
| 44 | * @since 1.0.0 |
| 45 | * @access public |
| 46 | * |
| 47 | * @return string Widget title. |
| 48 | */ |
| 49 | public function get_title() { |
| 50 | return __( 'Copyright', 'auxin-elements' ); |
| 51 | } |
| 52 | |
| 53 | public function has_widget_inner_wrapper(): bool { |
| 54 | return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 55 | } |
| 56 | |
| 57 | |
| 58 | /** |
| 59 | * Get widget icon. |
| 60 | * |
| 61 | * Retrieve 'Copyright' widget icon. |
| 62 | * |
| 63 | * @since 1.0.0 |
| 64 | * @access public |
| 65 | * |
| 66 | * @return string Widget icon. |
| 67 | */ |
| 68 | public function get_icon() { |
| 69 | return 'eicon-t-letter auxin-badge'; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Get widget categories. |
| 74 | * |
| 75 | * Retrieve 'Copyright' widget icon. |
| 76 | * |
| 77 | * @since 1.0.0 |
| 78 | * @access public |
| 79 | * |
| 80 | * @return string Widget icon. |
| 81 | */ |
| 82 | public function get_categories() { |
| 83 | return array( 'auxin-core', 'auxin-theme-elements' ); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Register 'Copyright' widget controls. |
| 88 | * |
| 89 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 90 | * |
| 91 | * @since 1.0.0 |
| 92 | * @access protected |
| 93 | */ |
| 94 | protected function register_controls() { |
| 95 | |
| 96 | $this->start_controls_section( |
| 97 | 'general', |
| 98 | array( |
| 99 | 'label' => __( 'General', 'auxin-elements' ), |
| 100 | ) |
| 101 | ); |
| 102 | |
| 103 | $this->add_control( |
| 104 | 'copyright_text', |
| 105 | array( |
| 106 | 'type' => Controls_Manager::TEXT, |
| 107 | 'label' => __( 'Copyright Text', 'auxin-elements' ), |
| 108 | 'label_block' => true, |
| 109 | 'default' => sprintf( __( '© %s. All rights reserved.', 'auxin-elements' ), '{{Y}} {{sitename}}' ), |
| 110 | 'separator' => 'after', |
| 111 | ) |
| 112 | ); |
| 113 | |
| 114 | $this->add_control( |
| 115 | 'attribution', |
| 116 | array( |
| 117 | 'label' => __( 'Show Theme Attribution', 'auxin-elements' ), |
| 118 | 'description' => __( 'Show the "Powered By" text with link to theme homepage in footer.', 'auxin-elements' ), |
| 119 | 'type' => Controls_Manager::SWITCHER, |
| 120 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 121 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 122 | 'return_value' => 'yes', |
| 123 | 'default' => 'no' |
| 124 | ) |
| 125 | ); |
| 126 | |
| 127 | $this->add_control( |
| 128 | 'show_privacy_policy', |
| 129 | array( |
| 130 | 'label' => __( 'Show Privacy Policy', 'auxin-elements' ), |
| 131 | 'description' => __( 'Show a link to privacy policy page in the footer.', 'auxin-elements' ), |
| 132 | 'type' => Controls_Manager::SWITCHER, |
| 133 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 134 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 135 | 'return_value' => 'yes', |
| 136 | 'default' => 'no' |
| 137 | ) |
| 138 | ); |
| 139 | |
| 140 | $this->add_responsive_control( |
| 141 | 'align', |
| 142 | array( |
| 143 | 'label' => __( 'Alignment', 'auxin-elements' ), |
| 144 | 'type' => Controls_Manager::CHOOSE, |
| 145 | 'options' => array( |
| 146 | 'left' => array( |
| 147 | 'title' => __( 'Left', 'auxin-elements' ), |
| 148 | 'icon' => 'eicon-text-align-left', |
| 149 | ), |
| 150 | 'center' => array( |
| 151 | 'title' => __( 'Center', 'auxin-elements' ), |
| 152 | 'icon' => 'eicon-text-align-center', |
| 153 | ), |
| 154 | 'right' => array( |
| 155 | 'title' => __( 'Right', 'auxin-elements' ), |
| 156 | 'icon' => 'eicon-text-align-right', |
| 157 | ), |
| 158 | ), |
| 159 | 'selectors' => array( |
| 160 | '{{WRAPPER}}' => 'text-align: {{VALUE}};', |
| 161 | ), |
| 162 | ) |
| 163 | ); |
| 164 | |
| 165 | $this->end_controls_section(); |
| 166 | |
| 167 | $this->start_controls_section( |
| 168 | 'section_style_copyright', |
| 169 | array( |
| 170 | 'label' => __( 'Copyright', 'auxin-elements' ), |
| 171 | 'tab' => Controls_Manager::TAB_STYLE, |
| 172 | ) |
| 173 | ); |
| 174 | |
| 175 | $this->start_controls_tabs( 'copyright_colors' ); |
| 176 | |
| 177 | $this->start_controls_tab( |
| 178 | 'copyright_color_normal', |
| 179 | array( |
| 180 | 'label' => __( 'Normal', 'auxin-elements' ), |
| 181 | ) |
| 182 | ); |
| 183 | |
| 184 | $this->add_control( |
| 185 | 'copyright_color', |
| 186 | array( |
| 187 | 'label' => __( 'Color', 'auxin-elements' ), |
| 188 | 'type' => Controls_Manager::COLOR, |
| 189 | 'selectors' => array( |
| 190 | '{{WRAPPER}} small' => 'color: {{VALUE}};', |
| 191 | ), |
| 192 | ) |
| 193 | ); |
| 194 | |
| 195 | $this->add_group_control( |
| 196 | Group_Control_Typography::get_type(), |
| 197 | array( |
| 198 | 'name' => 'copyright_typo', |
| 199 | 'global' => [ |
| 200 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 201 | ], |
| 202 | 'selector' => '{{WRAPPER}} small', |
| 203 | ) |
| 204 | ); |
| 205 | |
| 206 | $this->add_group_control( |
| 207 | Group_Control_Text_Shadow::get_type(), |
| 208 | array( |
| 209 | 'name' => 'copyright_text_shadow', |
| 210 | 'selector' => '{{WRAPPER}} small', |
| 211 | ) |
| 212 | ); |
| 213 | |
| 214 | $this->end_controls_tab(); |
| 215 | |
| 216 | $this->start_controls_tab( |
| 217 | 'copyright_color_hover', |
| 218 | array( |
| 219 | 'label' => __( 'Hover', 'auxin-elements' ), |
| 220 | ) |
| 221 | ); |
| 222 | |
| 223 | $this->add_control( |
| 224 | 'copyright_hover_color', |
| 225 | array( |
| 226 | 'label' => __( 'Color', 'auxin-elements' ), |
| 227 | 'type' => Controls_Manager::COLOR, |
| 228 | 'selectors' => array( |
| 229 | '{{WRAPPER}} small:hover' => 'color: {{VALUE}} !important;', |
| 230 | ), |
| 231 | ) |
| 232 | ); |
| 233 | |
| 234 | $this->add_group_control( |
| 235 | Group_Control_Typography::get_type(), |
| 236 | array( |
| 237 | 'name' => 'copyright_typo_hover', |
| 238 | 'global' => [ |
| 239 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 240 | ], |
| 241 | 'selector' => '{{WRAPPER}} small:hover', |
| 242 | ) |
| 243 | ); |
| 244 | |
| 245 | $this->add_group_control( |
| 246 | Group_Control_Text_Shadow::get_type(), |
| 247 | array( |
| 248 | 'name' => 'copyright_text_shadow_hover', |
| 249 | 'selector' => '{{WRAPPER}} small:hover', |
| 250 | ) |
| 251 | ); |
| 252 | |
| 253 | $this->end_controls_tab(); |
| 254 | |
| 255 | $this->end_controls_tabs(); |
| 256 | |
| 257 | $this->end_controls_section(); |
| 258 | |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Render image box widget output on the frontend. |
| 263 | * |
| 264 | * Written in PHP and used to generate the final HTML. |
| 265 | * |
| 266 | * @since 1.0.0 |
| 267 | * @access protected |
| 268 | */ |
| 269 | protected function render() { |
| 270 | $settings = $this->get_settings_for_display(); |
| 271 | |
| 272 | $args = [ |
| 273 | 'copyright_text' => $settings['copyright_text'], |
| 274 | 'attribution' => $settings['attribution'], |
| 275 | 'show_privacy_policy' => $settings['show_privacy_policy'] |
| 276 | ]; |
| 277 | |
| 278 | auxin_footer_copyright_markup( true, $args ); |
| 279 | } |
| 280 | |
| 281 | } |
| 282 |