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
logo.php
758 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_Image_Size; |
| 8 | use Elementor\Group_Control_Typography; |
| 9 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 10 | use Elementor\Group_Control_Border; |
| 11 | use Elementor\Group_Control_Box_Shadow; |
| 12 | use Elementor\Group_Control_Text_Shadow; |
| 13 | use Elementor\Group_Control_Css_Filter; |
| 14 | |
| 15 | |
| 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | exit; // Exit if accessed directly. |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Elementor 'Logo' widget. |
| 22 | * |
| 23 | * Elementor widget that displays an 'Logo'. |
| 24 | * |
| 25 | * @since 1.0.0 |
| 26 | */ |
| 27 | class Logo extends Widget_Base { |
| 28 | |
| 29 | /** |
| 30 | * Get widget name. |
| 31 | * |
| 32 | * Retrieve 'Logo' widget name. |
| 33 | * |
| 34 | * @since 1.0.0 |
| 35 | * @access public |
| 36 | * |
| 37 | * @return string Widget name. |
| 38 | */ |
| 39 | public function get_name() { |
| 40 | return 'aux_logo'; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Get widget title. |
| 45 | * |
| 46 | * Retrieve 'Logo' widget title. |
| 47 | * |
| 48 | * @since 1.0.0 |
| 49 | * @access public |
| 50 | * |
| 51 | * @return string Widget title. |
| 52 | */ |
| 53 | public function get_title() { |
| 54 | return __('Logo', 'auxin-elements' ); |
| 55 | } |
| 56 | |
| 57 | public function has_widget_inner_wrapper(): bool { |
| 58 | return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 59 | } |
| 60 | |
| 61 | |
| 62 | /** |
| 63 | * Get widget icon. |
| 64 | * |
| 65 | * Retrieve 'Logo' widget icon. |
| 66 | * |
| 67 | * @since 1.0.0 |
| 68 | * @access public |
| 69 | * |
| 70 | * @return string Widget icon. |
| 71 | */ |
| 72 | public function get_icon() { |
| 73 | return 'eicon-date auxin-badge'; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Get widget categories. |
| 78 | * |
| 79 | * Retrieve 'Logo' widget icon. |
| 80 | * |
| 81 | * @since 1.0.0 |
| 82 | * @access public |
| 83 | * |
| 84 | * @return string Widget icon. |
| 85 | */ |
| 86 | public function get_categories() { |
| 87 | return array( 'auxin-core', 'auxin-theme-elements' ); |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Register 'Logo' widget controls. |
| 92 | * |
| 93 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 94 | * |
| 95 | * @since 1.0.0 |
| 96 | * @access protected |
| 97 | */ |
| 98 | protected function register_controls() { |
| 99 | |
| 100 | /*-----------------------------------------------------------------------------------*/ |
| 101 | /* button_section |
| 102 | /*-----------------------------------------------------------------------------------*/ |
| 103 | |
| 104 | $this->start_controls_section( |
| 105 | 'general', |
| 106 | array( |
| 107 | 'label' => __('General', 'auxin-elements' ), |
| 108 | ) |
| 109 | ); |
| 110 | |
| 111 | $custom_logo_id = get_theme_mod( 'custom_logo' ); |
| 112 | |
| 113 | |
| 114 | if ( empty( $custom_logo_id ) ) { |
| 115 | $this->add_control( |
| 116 | 'custom_logo_page', |
| 117 | array( |
| 118 | 'type' => Controls_Manager::RAW_HTML, |
| 119 | 'raw' => sprintf( __( '<strong>There are no logo in your site.</strong><br>Go to the <a href="%s" target="_blank" style="color: #2271b1;text-decoration: underline;font-style: normal;">Customizer</a> to add one.', 'auxin-elements' ), add_query_arg( "autofocus[section]", "title_tagline", admin_url( 'customize.php' ) ) ), |
| 120 | 'separator' => 'after', |
| 121 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 122 | ) |
| 123 | ); |
| 124 | } else { |
| 125 | $this->add_control( |
| 126 | 'custom_logo_page', |
| 127 | array( |
| 128 | 'type'=> Controls_Manager::RAW_HTML, |
| 129 | 'raw' => '<strong>'. __( 'Your site logo is set in customizer.', 'auxin-elements' ). '</strong><br>'. |
| 130 | sprintf( __( 'Go to %s Customizer %s to change it.', 'auxin-elements' ), '<a href="'. add_query_arg( "autofocus[section]", "title_tagline", admin_url( 'customize.php' ) ) .'" target="_blank" style="color: #2271b1;text-decoration: underline;font-style: normal;">', "</a>" ), |
| 131 | 'separator' => 'after', |
| 132 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 133 | ) |
| 134 | ); |
| 135 | } |
| 136 | |
| 137 | $this->add_control( |
| 138 | 'logo_type', |
| 139 | array( |
| 140 | 'label' => __( 'Type', 'auxin-elements' ), |
| 141 | 'type' => Controls_Manager::SELECT, |
| 142 | 'default' => 'primary', |
| 143 | 'options' => array( |
| 144 | 'primary' => __( 'Primary', 'auxin-elements' ), |
| 145 | 'secondary' => __( 'Secondary', 'auxin-elements' ), |
| 146 | ), |
| 147 | ) |
| 148 | ); |
| 149 | |
| 150 | $this->add_group_control( |
| 151 | Group_Control_Image_Size::get_type(), |
| 152 | array( |
| 153 | 'name' => 'image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `image_size` and `image_custom_dimension`. |
| 154 | 'default' => 'full', |
| 155 | 'separator' => 'none', |
| 156 | ) |
| 157 | ); |
| 158 | |
| 159 | $this->add_responsive_control( |
| 160 | 'align', |
| 161 | array( |
| 162 | 'label' => __( 'Alignment', 'auxin-elements' ), |
| 163 | 'type' => Controls_Manager::CHOOSE, |
| 164 | 'options' => array( |
| 165 | 'left' => array( |
| 166 | 'title' => __( 'Left', 'auxin-elements' ), |
| 167 | 'icon' => 'eicon-text-align-left', |
| 168 | ), |
| 169 | 'center' => array( |
| 170 | 'title' => __( 'Center', 'auxin-elements' ), |
| 171 | 'icon' => 'eicon-text-align-center', |
| 172 | ), |
| 173 | 'right' => array( |
| 174 | 'title' => __( 'Right', 'auxin-elements' ), |
| 175 | 'icon' => 'eicon-text-align-right', |
| 176 | ), |
| 177 | ), |
| 178 | 'selectors' => array( |
| 179 | '{{WRAPPER}}' => 'text-align: {{VALUE}};', |
| 180 | ), |
| 181 | ) |
| 182 | ); |
| 183 | |
| 184 | $this->add_control( |
| 185 | 'link_to', |
| 186 | array( |
| 187 | 'label' => __( 'Link', 'auxin-elements' ), |
| 188 | 'type' => Controls_Manager::SELECT, |
| 189 | 'default' => 'home', |
| 190 | 'options' => array( |
| 191 | 'home' => __( 'Home Page', 'auxin-elements' ), |
| 192 | 'file' => __( 'Media File', 'auxin-elements' ), |
| 193 | 'custom' => __( 'Custom URL', 'auxin-elements' ), |
| 194 | ), |
| 195 | ) |
| 196 | ); |
| 197 | |
| 198 | $this->add_control( |
| 199 | 'link', |
| 200 | array( |
| 201 | 'label' => __( 'Link', 'auxin-elements' ), |
| 202 | 'type' => Controls_Manager::URL, |
| 203 | 'placeholder' => __( 'https://your-link.com', 'auxin-elements' ), |
| 204 | 'dynamic' => [ |
| 205 | 'active' => true |
| 206 | ], |
| 207 | 'condition' => array( |
| 208 | 'link_to' => 'custom', |
| 209 | ), |
| 210 | 'show_label' => false, |
| 211 | ) |
| 212 | ); |
| 213 | |
| 214 | $this->end_controls_section(); |
| 215 | |
| 216 | $this->start_controls_section( |
| 217 | 'section_style_image', |
| 218 | array( |
| 219 | 'label' => __( 'Image', 'auxin-elements' ), |
| 220 | 'tab' => Controls_Manager::TAB_STYLE, |
| 221 | ) |
| 222 | ); |
| 223 | |
| 224 | $this->add_responsive_control( |
| 225 | 'width', |
| 226 | array( |
| 227 | 'label' => __( 'Width', 'auxin-elements' ), |
| 228 | 'type' => Controls_Manager::SLIDER, |
| 229 | 'default' => array( |
| 230 | 'unit' => '%', |
| 231 | ), |
| 232 | 'tablet_default' => array( |
| 233 | 'unit' => '%', |
| 234 | ), |
| 235 | 'mobile_default' => array( |
| 236 | 'unit' => '%', |
| 237 | ), |
| 238 | 'size_units' => array( '%', 'px', 'vw' ), |
| 239 | 'range' => array( |
| 240 | '%' => array( |
| 241 | 'min' => 1, |
| 242 | 'max' => 100, |
| 243 | ), |
| 244 | 'px' => array( |
| 245 | 'min' => 1, |
| 246 | 'max' => 1000, |
| 247 | ), |
| 248 | 'vw' => array( |
| 249 | 'min' => 1, |
| 250 | 'max' => 100, |
| 251 | ), |
| 252 | ), |
| 253 | 'selectors' => array( |
| 254 | '{{WRAPPER}} .aux-has-logo img' => 'width: {{SIZE}}{{UNIT}};', |
| 255 | ), |
| 256 | ) |
| 257 | ); |
| 258 | |
| 259 | $this->add_responsive_control( |
| 260 | 'space', |
| 261 | array( |
| 262 | 'label' => __( 'Max Width', 'auxin-elements' ) . ' (%)', |
| 263 | 'type' => Controls_Manager::SLIDER, |
| 264 | 'default' => array( |
| 265 | 'unit' => '%', |
| 266 | ), |
| 267 | 'tablet_default' => array( |
| 268 | 'unit' => '%', |
| 269 | ), |
| 270 | 'mobile_default' => array( |
| 271 | 'unit' => '%', |
| 272 | ), |
| 273 | 'size_units' => array( '%' ), |
| 274 | 'range' => array( |
| 275 | '%' => array( |
| 276 | 'min' => 1, |
| 277 | 'max' => 100, |
| 278 | ), |
| 279 | ), |
| 280 | 'selectors' => array( |
| 281 | '{{WRAPPER}} .aux-has-logo img' => 'max-width: {{SIZE}}{{UNIT}};', |
| 282 | ), |
| 283 | ) |
| 284 | ); |
| 285 | |
| 286 | $this->add_control( |
| 287 | 'separator_panel_style', |
| 288 | array( |
| 289 | 'type' => Controls_Manager::DIVIDER, |
| 290 | 'style' => 'thick', |
| 291 | ) |
| 292 | ); |
| 293 | |
| 294 | $this->start_controls_tabs( 'image_effects' ); |
| 295 | |
| 296 | $this->start_controls_tab( 'normal', |
| 297 | array( |
| 298 | 'label' => __( 'Normal', 'auxin-elements' ), |
| 299 | ) |
| 300 | ); |
| 301 | |
| 302 | $this->add_control( |
| 303 | 'opacity', |
| 304 | array( |
| 305 | 'label' => __( 'Opacity', 'auxin-elements' ), |
| 306 | 'type' => Controls_Manager::SLIDER, |
| 307 | 'range' => array( |
| 308 | 'px' => array( |
| 309 | 'max' => 1, |
| 310 | 'min' => 0.10, |
| 311 | 'step' => 0.01, |
| 312 | ), |
| 313 | ), |
| 314 | 'selectors' => array( |
| 315 | '{{WRAPPER}} .aux-has-logo img' => 'opacity: {{SIZE}};', |
| 316 | ), |
| 317 | ) |
| 318 | ); |
| 319 | |
| 320 | $this->add_group_control( |
| 321 | Group_Control_Css_Filter::get_type(), |
| 322 | array( |
| 323 | 'name' => 'css_filters', |
| 324 | 'selector' => '{{WRAPPER}} .aux-has-logo img', |
| 325 | ) |
| 326 | ); |
| 327 | |
| 328 | $this->end_controls_tab(); |
| 329 | |
| 330 | $this->start_controls_tab( 'hover', |
| 331 | array( |
| 332 | 'label' => __( 'Hover', 'auxin-elements' ), |
| 333 | ) |
| 334 | ); |
| 335 | |
| 336 | $this->add_control( |
| 337 | 'opacity_hover', |
| 338 | array( |
| 339 | 'label' => __( 'Opacity', 'auxin-elements' ), |
| 340 | 'type' => Controls_Manager::SLIDER, |
| 341 | 'range' => array( |
| 342 | 'px' => array( |
| 343 | 'max' => 1, |
| 344 | 'min' => 0.10, |
| 345 | 'step' => 0.01, |
| 346 | ), |
| 347 | ), |
| 348 | 'selectors' => array( |
| 349 | '{{WRAPPER}} .aux-has-logo:hover img' => 'opacity: {{SIZE}};', |
| 350 | ), |
| 351 | ) |
| 352 | ); |
| 353 | |
| 354 | $this->add_group_control( |
| 355 | Group_Control_Css_Filter::get_type(), |
| 356 | array( |
| 357 | 'name' => 'css_filters_hover', |
| 358 | 'selector' => '{{WRAPPER}} .aux-has-logo:hover img', |
| 359 | ) |
| 360 | ); |
| 361 | |
| 362 | $this->add_control( |
| 363 | 'background_hover_transition', |
| 364 | array( |
| 365 | 'label' => __( 'Transition Duration', 'auxin-elements' ), |
| 366 | 'type' => Controls_Manager::SLIDER, |
| 367 | 'range' => array( |
| 368 | 'px' => array( |
| 369 | 'max' => 3, |
| 370 | 'step' => 0.1, |
| 371 | ), |
| 372 | ), |
| 373 | 'selectors' => array( |
| 374 | '{{WRAPPER}} .aux-has-logo img' => 'transition-duration: {{SIZE}}s', |
| 375 | ), |
| 376 | ) |
| 377 | ); |
| 378 | |
| 379 | $this->end_controls_tab(); |
| 380 | |
| 381 | $this->end_controls_tabs(); |
| 382 | |
| 383 | $this->add_group_control( |
| 384 | Group_Control_Border::get_type(), |
| 385 | array( |
| 386 | 'name' => 'image_border', |
| 387 | 'selector' => '{{WRAPPER}} .aux-has-logo img', |
| 388 | 'separator' => 'before', |
| 389 | ) |
| 390 | ); |
| 391 | |
| 392 | $this->add_responsive_control( |
| 393 | 'image_border_radius', |
| 394 | array( |
| 395 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 396 | 'type' => Controls_Manager::DIMENSIONS, |
| 397 | 'size_units' => array( 'px', '%' ), |
| 398 | 'selectors' => array( |
| 399 | '{{WRAPPER}} .aux-has-logo img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 400 | ), |
| 401 | ) |
| 402 | ); |
| 403 | |
| 404 | $this->add_group_control( |
| 405 | Group_Control_Box_Shadow::get_type(), |
| 406 | array( |
| 407 | 'name' => 'image_box_shadow', |
| 408 | 'exclude' => array( |
| 409 | 'box_shadow_position', |
| 410 | ), |
| 411 | 'selector' => '{{WRAPPER}} .aux-has-logo img', |
| 412 | ) |
| 413 | ); |
| 414 | |
| 415 | $this->add_control( |
| 416 | 'image_sticky_scale', |
| 417 | array( |
| 418 | 'label' => __( 'Scale on sticky', 'auxin-elements' ), |
| 419 | 'type' => Controls_Manager::SWITCHER, |
| 420 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 421 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 422 | 'return_value' => 'yes', |
| 423 | 'default' => 'off', |
| 424 | ) |
| 425 | ); |
| 426 | |
| 427 | $this->add_responsive_control( |
| 428 | 'sticky_scale', |
| 429 | array( |
| 430 | 'label' => __('Scale','auxin-elements' ), |
| 431 | 'type' => Controls_Manager::SLIDER, |
| 432 | 'size_units' => array('px'), |
| 433 | 'range' => array( |
| 434 | 'px' => array( |
| 435 | 'min' => 0, |
| 436 | 'max' => 1, |
| 437 | 'step' => 0.05 |
| 438 | ) |
| 439 | ), |
| 440 | 'default' => array( |
| 441 | 'unit' => 'px', |
| 442 | 'size' => 0.85, |
| 443 | ), |
| 444 | 'condition' => array( |
| 445 | 'image_sticky_scale' => 'yes', |
| 446 | ), |
| 447 | 'selectors' => array( |
| 448 | '.aux-sticky {{WRAPPER}} .aux-logo-anchor' => 'transition: transform 300ms ease-out; transform-origin: left; transform: scale({{SIZE}});' |
| 449 | ) |
| 450 | |
| 451 | ) |
| 452 | ); |
| 453 | |
| 454 | $this->end_controls_section(); |
| 455 | |
| 456 | $this->start_controls_section( |
| 457 | 'section_style_title', |
| 458 | array( |
| 459 | 'label' => __( 'Title', 'auxin-elements' ), |
| 460 | 'tab' => Controls_Manager::TAB_STYLE, |
| 461 | ) |
| 462 | ); |
| 463 | |
| 464 | $this->add_responsive_control( |
| 465 | 'title_color', |
| 466 | array( |
| 467 | 'label' => __( 'Color', 'auxin-elements' ), |
| 468 | 'type' => Controls_Manager::COLOR, |
| 469 | 'selectors' => array( |
| 470 | '{{WRAPPER}} .site-title a, {{WRAPPER}} .site-title' => 'color: {{VALUE}};' |
| 471 | ) |
| 472 | ) |
| 473 | ); |
| 474 | |
| 475 | $this->add_responsive_control( |
| 476 | 'title_hover_color', |
| 477 | array( |
| 478 | 'label' => __( 'Hover Color', 'auxin-elements' ), |
| 479 | 'type' => Controls_Manager::COLOR, |
| 480 | 'selectors' => array( |
| 481 | '{{WRAPPER}} .site-title a:hover, {{WRAPPER}} .site-title:hover' => 'color: {{VALUE}};', |
| 482 | ), |
| 483 | ) |
| 484 | ); |
| 485 | |
| 486 | $this->add_group_control( |
| 487 | Group_Control_Typography::get_type(), |
| 488 | array( |
| 489 | 'name' => 'title_typography', |
| 490 | 'global' => [ |
| 491 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 492 | ], |
| 493 | 'selector' => '{{WRAPPER}} .site-title a' |
| 494 | ) |
| 495 | ); |
| 496 | |
| 497 | $this->add_responsive_control( |
| 498 | 'title_margin', |
| 499 | array( |
| 500 | 'label' => __( 'Margin', 'auxin-elements' ), |
| 501 | 'type' => Controls_Manager::DIMENSIONS, |
| 502 | 'size_units' => array( 'px', 'em' ), |
| 503 | 'allowed_dimensions' => 'all', |
| 504 | 'selectors' => array( |
| 505 | '{{WRAPPER}} .site-title' => 'margin:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 506 | ) |
| 507 | ) |
| 508 | ); |
| 509 | |
| 510 | $this->add_group_control( |
| 511 | Group_Control_Text_Shadow::get_type(), |
| 512 | array( |
| 513 | 'name' => 'title_text_shadow', |
| 514 | 'label' => __( 'Text Shadow', 'auxin-elements' ), |
| 515 | 'selector' => '{{WRAPPER}} .site-title a' |
| 516 | ) |
| 517 | ); |
| 518 | |
| 519 | $this->add_responsive_control( |
| 520 | 'title_width', |
| 521 | array( |
| 522 | 'label' => __('Max Width','auxin-elements' ), |
| 523 | 'type' => Controls_Manager::SLIDER, |
| 524 | 'size_units' => array('px', 'em','%'), |
| 525 | 'range' => array( |
| 526 | '%' => array( |
| 527 | 'min' => 1, |
| 528 | 'max' => 100, |
| 529 | 'step' => 1 |
| 530 | ), |
| 531 | 'em' => array( |
| 532 | 'min' => 1, |
| 533 | 'max' => 100, |
| 534 | 'step' => 1 |
| 535 | ), |
| 536 | 'px' => array( |
| 537 | 'min' => 1, |
| 538 | 'max' => 1600, |
| 539 | 'step' => 1 |
| 540 | ) |
| 541 | ), |
| 542 | 'selectors' => array( |
| 543 | '{{WRAPPER}} .site-title' => 'max-width:{{SIZE}}{{UNIT}};' |
| 544 | ) |
| 545 | ) |
| 546 | ); |
| 547 | |
| 548 | $this->end_controls_section(); |
| 549 | |
| 550 | $this->start_controls_section( |
| 551 | 'section_style_desc', |
| 552 | array( |
| 553 | 'label' => __( 'Description', 'auxin-elements' ), |
| 554 | 'tab' => Controls_Manager::TAB_STYLE, |
| 555 | ) |
| 556 | ); |
| 557 | |
| 558 | $this->add_responsive_control( |
| 559 | 'desc_color', |
| 560 | array( |
| 561 | 'label' => __( 'Color', 'auxin-elements' ), |
| 562 | 'type' => Controls_Manager::COLOR, |
| 563 | 'selectors' => array( |
| 564 | '{{WRAPPER}} .site-description' => 'color: {{VALUE}};' |
| 565 | ) |
| 566 | ) |
| 567 | ); |
| 568 | |
| 569 | $this->add_responsive_control( |
| 570 | 'desc_hover_color', |
| 571 | array( |
| 572 | 'label' => __( 'Hover Color', 'auxin-elements' ), |
| 573 | 'type' => Controls_Manager::COLOR, |
| 574 | 'selectors' => array( |
| 575 | '{{WRAPPER}} .site-description:hover' => 'color: {{VALUE}};', |
| 576 | ), |
| 577 | ) |
| 578 | ); |
| 579 | |
| 580 | $this->add_group_control( |
| 581 | Group_Control_Typography::get_type(), |
| 582 | array( |
| 583 | 'name' => 'desc_typography', |
| 584 | 'global' => [ |
| 585 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 586 | ], |
| 587 | 'selector' => '{{WRAPPER}} .site-description' |
| 588 | ) |
| 589 | ); |
| 590 | |
| 591 | $this->add_responsive_control( |
| 592 | 'desc_margin', |
| 593 | array( |
| 594 | 'label' => __( 'Margin', 'auxin-elements' ), |
| 595 | 'type' => Controls_Manager::DIMENSIONS, |
| 596 | 'size_units' => array( 'px', 'em' ), |
| 597 | 'allowed_dimensions' => 'all', |
| 598 | 'selectors' => array( |
| 599 | '{{WRAPPER}} .site-description' => 'margin:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 600 | ) |
| 601 | ) |
| 602 | ); |
| 603 | |
| 604 | $this->add_group_control( |
| 605 | Group_Control_Text_Shadow::get_type(), |
| 606 | array( |
| 607 | 'name' => 'desc_text_shadow', |
| 608 | 'label' => __( 'Text Shadow', 'auxin-elements' ), |
| 609 | 'selector' => '{{WRAPPER}} .site-description' |
| 610 | ) |
| 611 | ); |
| 612 | |
| 613 | $this->add_responsive_control( |
| 614 | 'desc_width', |
| 615 | array( |
| 616 | 'label' => __('Max Width','auxin-elements' ), |
| 617 | 'type' => Controls_Manager::SLIDER, |
| 618 | 'size_units' => array('px', 'em','%'), |
| 619 | 'range' => array( |
| 620 | '%' => array( |
| 621 | 'min' => 1, |
| 622 | 'max' => 100, |
| 623 | 'step' => 1 |
| 624 | ), |
| 625 | 'em' => array( |
| 626 | 'min' => 1, |
| 627 | 'max' => 100, |
| 628 | 'step' => 1 |
| 629 | ), |
| 630 | 'px' => array( |
| 631 | 'min' => 1, |
| 632 | 'max' => 1600, |
| 633 | 'step' => 1 |
| 634 | ) |
| 635 | ), |
| 636 | 'selectors' => array( |
| 637 | '{{WRAPPER}} .site-description' => 'max-width:{{SIZE}}{{UNIT}};' |
| 638 | ) |
| 639 | ) |
| 640 | ); |
| 641 | |
| 642 | $this->end_controls_section(); |
| 643 | |
| 644 | } |
| 645 | |
| 646 | /** |
| 647 | * Render image box widget output on the frontend. |
| 648 | * |
| 649 | * Written in PHP and used to generate the final HTML. |
| 650 | * |
| 651 | * @since 1.0.0 |
| 652 | * @access protected |
| 653 | */ |
| 654 | protected function render() { |
| 655 | global $aux_main_post; |
| 656 | $settings = $this->get_settings_for_display(); |
| 657 | $logo_desc = get_bloginfo( 'description' ); |
| 658 | |
| 659 | // get logo id |
| 660 | if ( ! empty( $aux_main_post ) ) { |
| 661 | if( empty( $custom_logo_id = auxin_get_post_meta( $aux_main_post->ID, 'aux_custom_logo' ) ) || ! is_numeric( $custom_logo_id ) ){ |
| 662 | $custom_logo_id = get_theme_mod( 'custom_logo' ); |
| 663 | } |
| 664 | |
| 665 | if( empty( $secondary_logo_id = auxin_get_post_meta( $aux_main_post->ID, 'aux_custom_logo2' ) ) || ! is_numeric( $secondary_logo_id ) ){ |
| 666 | $secondary_logo_id = auxin_get_option('custom_logo2'); |
| 667 | } |
| 668 | } else { |
| 669 | $custom_logo_id = get_theme_mod( 'custom_logo' ); |
| 670 | $secondary_logo_id = auxin_get_option('custom_logo2'); |
| 671 | } |
| 672 | |
| 673 | $blog_display_name = get_bloginfo( 'name', 'display' ); |
| 674 | $blog_name = get_bloginfo( 'name' ); |
| 675 | $home_url = home_url( '/' ); |
| 676 | $link_attr = array( |
| 677 | 'class' => 'aux-logo-anchor aux-has-logo', |
| 678 | 'title' => esc_attr( $blog_display_name ) |
| 679 | ); |
| 680 | $logo_markup = ''; |
| 681 | $output = ''; |
| 682 | |
| 683 | |
| 684 | if ( 'home' === $settings['link_to'] ) { |
| 685 | $link_attr['href'] = esc_url ( $home_url ); |
| 686 | } else if ( 'file' === $settings['link_to'] ) { |
| 687 | $link_attr['href'] = esc_url ( wp_get_attachment_url( $custom_logo_id ) ) ; |
| 688 | } else { |
| 689 | $link_attr['href'] = esc_url ( $settings['link']['url'] ) ; |
| 690 | |
| 691 | if ( auxin_is_true( $settings['link']['is_external'] ) ) { |
| 692 | $link_attr['target'] = '_blank'; |
| 693 | } |
| 694 | |
| 695 | if ( auxin_is_true( $settings['link']['nofollow'] ) ) { |
| 696 | $link_attr['rel'] = 'nofollow'; |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | $link_attr = auxin_make_html_attributes( $link_attr ); |
| 701 | |
| 702 | if ( $custom_logo_id ) { |
| 703 | |
| 704 | $logo_image_markup = ''; |
| 705 | $logo_id = 'primary' === $settings['logo_type'] ? $custom_logo_id : $secondary_logo_id; |
| 706 | |
| 707 | if ( $settings['image_custom_dimension'] ) { |
| 708 | $image_size = $settings['image_custom_dimension']; |
| 709 | } else { |
| 710 | $image_size = $settings['image_size']; |
| 711 | } |
| 712 | |
| 713 | $logo_image_markup = auxin_get_the_responsive_attachment( $logo_id, |
| 714 | array( |
| 715 | 'quality' => 100, |
| 716 | 'size' => $image_size, |
| 717 | 'crop' => true, |
| 718 | 'add_hw' => true, |
| 719 | 'upscale' => false, |
| 720 | 'preloadable' => false |
| 721 | ) |
| 722 | ); |
| 723 | |
| 724 | $logo_markup = '<a ' . $link_attr . ' >' . $logo_image_markup . '</a>'; |
| 725 | |
| 726 | // add secondary sticky logo |
| 727 | if ( $secondary_logo_id ) { |
| 728 | $secondary_logo_image_markup = auxin_get_the_responsive_attachment( $secondary_logo_id, |
| 729 | array( |
| 730 | 'quality' => 100, |
| 731 | 'size' => $image_size, |
| 732 | 'crop' => true, |
| 733 | 'add_hw' => true, |
| 734 | 'upscale' => false, |
| 735 | 'preloadable' => false |
| 736 | ) |
| 737 | ); |
| 738 | $logo_2_link_attr = \str_replace( 'aux-logo-anchor', 'aux-logo-anchor aux-logo-sticky aux-logo-hidden', $link_attr ); |
| 739 | $logo_markup .= '<a ' . $logo_2_link_attr . ' >' . $secondary_logo_image_markup . '</a>'; |
| 740 | } |
| 741 | } |
| 742 | |
| 743 | echo '<div class="aux-widget-logo">'; |
| 744 | echo wp_kses_post( $logo_markup ); |
| 745 | echo '<section class="aux-logo-text">'; |
| 746 | echo '<h3 class="site-title">'; |
| 747 | echo '<a href="' . esc_url( $home_url ) . '" title="' . esc_attr( $blog_display_name ) . '">'; |
| 748 | echo esc_html( $blog_name ); |
| 749 | echo '</a>'; |
| 750 | echo '</h3>'; |
| 751 | echo $logo_desc ? '<p class="site-description">' . esc_html( $logo_desc ) . '</p>' : ''; |
| 752 | echo '</section>'; |
| 753 | echo '</div>'; |
| 754 | |
| 755 | } |
| 756 | |
| 757 | } |
| 758 |