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