dep
1 month ago
premium-banner.php
3 weeks ago
premium-blog.php
3 weeks ago
premium-button.php
3 weeks ago
premium-carousel.php
3 weeks ago
premium-contactform.php
3 weeks ago
premium-countdown.php
3 weeks ago
premium-counter.php
3 weeks ago
premium-dual-header.php
3 weeks ago
premium-fancytext.php
3 weeks ago
premium-grid.php
3 weeks ago
premium-icon-list.php
3 weeks ago
premium-image-button.php
3 weeks ago
premium-image-scroll.php
3 weeks ago
premium-image-separator.php
3 weeks ago
premium-lottie.php
3 weeks ago
premium-maps.php
3 weeks ago
premium-media-wheel.php
3 weeks ago
premium-mobile-menu.php
3 weeks ago
premium-modalbox.php
3 weeks ago
premium-nav-menu.php
3 weeks ago
premium-notifications.php
3 weeks ago
premium-person.php
3 weeks ago
premium-pinterest-feed.php
3 weeks ago
premium-post-ticker.php
3 weeks ago
premium-pricing-table.php
3 weeks ago
premium-progressbar.php
3 weeks ago
premium-search-form.php
3 weeks ago
premium-svg-drawer.php
3 weeks ago
premium-tcloud.php
3 weeks ago
premium-testimonials.php
3 weeks ago
premium-textual-showcase.php
3 weeks ago
premium-tiktok-feed.php
3 weeks ago
premium-title.php
3 weeks ago
premium-videobox.php
3 weeks ago
premium-vscroll.php
3 weeks ago
premium-weather.php
3 weeks ago
premium-world-clock.php
3 weeks ago
premium-post-ticker.php
4235 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Premium Post Ticker. |
| 4 | */ |
| 5 | |
| 6 | namespace PremiumAddons\Widgets; |
| 7 | |
| 8 | // Elementor Classes. |
| 9 | use Elementor\Plugin; |
| 10 | use Elementor\Repeater; |
| 11 | use Elementor\Widget_Base; |
| 12 | use Elementor\Icons_Manager; |
| 13 | use Elementor\Controls_Manager; |
| 14 | use Elementor\Group_Control_Border; |
| 15 | use Elementor\Group_Control_Image_Size; |
| 16 | use PremiumAddons\Includes\Controls\Premium_Background; |
| 17 | use Elementor\Group_Control_Typography; |
| 18 | use Elementor\Group_Control_Box_Shadow; |
| 19 | use Elementor\Group_Control_Text_Shadow; |
| 20 | use Elementor\Group_Control_Text_Stroke; |
| 21 | use Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 22 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 23 | |
| 24 | |
| 25 | // PremiumAddons Classes. |
| 26 | use PremiumAddons\Admin\Includes\Admin_Helper; |
| 27 | use PremiumAddons\Includes\Helper_Functions; |
| 28 | use PremiumAddons\Includes\Controls\Premium_Post_Filter; |
| 29 | use PremiumAddons\Includes\Premium_Template_Tags as Posts_Helper; |
| 30 | |
| 31 | // PremiumAddonsPro Classes. |
| 32 | use PremiumAddonsPro\Includes\Pa_Post_Ticker_Helper as API_Handler; |
| 33 | |
| 34 | if ( ! defined( 'ABSPATH' ) ) { |
| 35 | exit; // If this file is called directly, abort. |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Class Premium_Post_Ticker. |
| 40 | */ |
| 41 | class Premium_Post_Ticker extends Widget_Base { |
| 42 | |
| 43 | /** |
| 44 | * Check if the icon draw is enabled. |
| 45 | * |
| 46 | * @since 4.9.26 |
| 47 | * @access private |
| 48 | * |
| 49 | * @var bool |
| 50 | */ |
| 51 | private $is_draw_enabled = null; |
| 52 | |
| 53 | /** |
| 54 | * Options |
| 55 | * |
| 56 | * @var options |
| 57 | */ |
| 58 | private $options = null; |
| 59 | |
| 60 | /** |
| 61 | * Check Premium Addons Pro Version. |
| 62 | * |
| 63 | * @var bool $papro_activated |
| 64 | */ |
| 65 | private $papro_activated; |
| 66 | |
| 67 | /** |
| 68 | * Check Icon Draw Option. |
| 69 | * |
| 70 | * @since 4.9.26 |
| 71 | * @access public |
| 72 | */ |
| 73 | public function check_icon_draw() { |
| 74 | |
| 75 | if ( null === $this->is_draw_enabled ) { |
| 76 | $this->is_draw_enabled = Admin_Helper::check_svg_draw( 'premium-post-ticker' ); |
| 77 | } |
| 78 | |
| 79 | return $this->is_draw_enabled; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Retrieve Widget Name. |
| 84 | * |
| 85 | * @since 1.0.0 |
| 86 | * @access public |
| 87 | */ |
| 88 | public function get_name() { |
| 89 | return 'premium-post-ticker'; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Retrieve Widget Title. |
| 94 | * |
| 95 | * @since 1.0.0 |
| 96 | * @access public |
| 97 | */ |
| 98 | public function get_title() { |
| 99 | return __( 'News Ticker', 'premium-addons-for-elementor' ); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Retrieve Widget Icon. |
| 104 | * |
| 105 | * @since 1.0.0 |
| 106 | * @access public |
| 107 | * |
| 108 | * @return string widget icon. |
| 109 | */ |
| 110 | public function get_icon() { |
| 111 | return 'pa-ticker'; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Retrieve Widget Keywords. |
| 116 | * |
| 117 | * @since 1.0.0 |
| 118 | * @access public |
| 119 | * |
| 120 | * @return string Widget keywords. |
| 121 | */ |
| 122 | public function get_keywords() { |
| 123 | return array( 'pa', 'premium', 'premium news ticker', 'magazine', 'news', 'posts', 'listing', 'ticker', 'grid', 'blog' ); |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Retrieve Widget Categories. |
| 128 | * |
| 129 | * @since 1.5.1 |
| 130 | * @access public |
| 131 | * |
| 132 | * @return array Widget categories. |
| 133 | */ |
| 134 | public function get_categories() { |
| 135 | return array( 'premium-elements' ); |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Widget preview refresh button. |
| 140 | * |
| 141 | * @since 1.0.0 |
| 142 | * @access public |
| 143 | */ |
| 144 | public function is_reload_preview_required() { |
| 145 | return true; |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Retrieve Widget Dependent CSS. |
| 150 | * |
| 151 | * @since 1.0.0 |
| 152 | * @access public |
| 153 | * |
| 154 | * @return array CSS style handles. |
| 155 | */ |
| 156 | public function get_style_depends() { |
| 157 | |
| 158 | return array( |
| 159 | 'pa-glass', |
| 160 | 'font-awesome-5-all', |
| 161 | 'pa-slick', |
| 162 | 'premium-addons', |
| 163 | ); |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * Retrieve Widget Dependent JS. |
| 168 | * |
| 169 | * @since 1.0.0 |
| 170 | * @access public |
| 171 | * |
| 172 | * @return array JS script handles. |
| 173 | */ |
| 174 | public function get_script_depends() { |
| 175 | |
| 176 | $is_edit = Helper_Functions::is_edit_mode(); |
| 177 | |
| 178 | $scripts = array( 'pa-slick' ); |
| 179 | |
| 180 | if ( $is_edit ) { |
| 181 | |
| 182 | $draw_scripts = $this->check_icon_draw() ? array( 'pa-tweenmax', 'pa-motionpath' ) : array(); |
| 183 | |
| 184 | $scripts = array_merge( $draw_scripts, array( 'pa-glass', 'lottie-js' ) ); |
| 185 | |
| 186 | } else { |
| 187 | |
| 188 | $settings = $this->get_settings(); |
| 189 | |
| 190 | $draw_js = false; |
| 191 | $lottie_js = false; |
| 192 | |
| 193 | if ( 'yes' === $settings['draw_svg'] ) { |
| 194 | $scripts[] = 'pa-tweenmax'; |
| 195 | $scripts[] = 'pa-motionpath'; |
| 196 | $draw_js = true; |
| 197 | } |
| 198 | |
| 199 | if ( 'lottie' === $settings['icon_type'] ) { |
| 200 | $scripts[] = 'lottie-js'; |
| 201 | $lottie_js = true; |
| 202 | } |
| 203 | |
| 204 | if ( ! empty( $settings['text_content'] ) ) { |
| 205 | |
| 206 | foreach ( $settings['text_content'] as $item ) { |
| 207 | |
| 208 | if ( ! $draw_js && 'yes' === $item['draw_svg'] ) { |
| 209 | $scripts[] = 'pa-tweenmax'; |
| 210 | $scripts[] = 'pa-motionpath'; |
| 211 | $draw_js = true; |
| 212 | } |
| 213 | |
| 214 | if ( ! $lottie_js && 'lottie' === $item['icon_type'] ) { |
| 215 | $scripts[] = 'lottie-js'; |
| 216 | $lottie_js = true; |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | if ( 'none' !== $settings['post_lq_effect'] ) { |
| 222 | $scripts[] = 'pa-glass'; |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | $scripts[] = 'premium-addons'; |
| 227 | |
| 228 | return $scripts; |
| 229 | } |
| 230 | |
| 231 | /** |
| 232 | * Retrieve Widget Support URL. |
| 233 | * |
| 234 | * @access public |
| 235 | * |
| 236 | * @return string support URL. |
| 237 | */ |
| 238 | public function get_custom_help_url() { |
| 239 | return 'https://premiumaddons.com/support/'; |
| 240 | } |
| 241 | |
| 242 | public function has_widget_inner_wrapper(): bool { |
| 243 | return ! Helper_Functions::check_elementor_experiment( 'e_optimized_markup' ); |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Register Smart Post Listing controls. |
| 248 | * |
| 249 | * @since 1.0.0 |
| 250 | * @access protected |
| 251 | */ |
| 252 | protected function register_controls() { |
| 253 | |
| 254 | $this->options = apply_filters( |
| 255 | 'pa_ticker_options', |
| 256 | array( |
| 257 | 'layouts' => array( |
| 258 | 'layout-1' => __( 'Layout 1', 'premium-addons-for-elementor' ), |
| 259 | 'layout-2' => __( 'Layout 2', 'premium-addons-for-elementor' ), |
| 260 | 'layout-3' => __( 'Layout 3 (Pro)', 'premium-addons-for-elementor' ), |
| 261 | 'layout-4' => __( 'Layout 4 (Pro)', 'premium-addons-for-elementor' ), |
| 262 | ), |
| 263 | 'layout_condition' => array( 'layout-3', 'layout-4' ), |
| 264 | ) |
| 265 | ); |
| 266 | |
| 267 | $this->register_content_tab_controls(); |
| 268 | $this->register_style_tab_controls(); |
| 269 | } |
| 270 | |
| 271 | /** |
| 272 | * Adds content tab controls. |
| 273 | * |
| 274 | * @access private |
| 275 | * @since 4.9.37 |
| 276 | */ |
| 277 | private function register_content_tab_controls() { |
| 278 | |
| 279 | $this->add_general_section_controls(); |
| 280 | $this->add_query_section_controls(); |
| 281 | $this->add_posts_section_controls(); |
| 282 | |
| 283 | $this->papro_activated = Helper_Functions::check_papro_version(); |
| 284 | |
| 285 | if ( $this->papro_activated ) { |
| 286 | do_action( 'pa_ticker_stock_controls', $this ); |
| 287 | } |
| 288 | |
| 289 | $this->add_slider_section_controls(); |
| 290 | |
| 291 | $this->add_helpful_info_section(); |
| 292 | |
| 293 | Helper_Functions::register_papro_promotion_controls( $this, 'ticker' ); |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Adds style tab controls. |
| 298 | * |
| 299 | * @access private |
| 300 | * @since 4.9.37 |
| 301 | */ |
| 302 | private function register_style_tab_controls() { |
| 303 | |
| 304 | $this->add_ticker_title_style(); |
| 305 | |
| 306 | $this->add_ticker_date_style(); |
| 307 | |
| 308 | $this->add_posts_style(); |
| 309 | |
| 310 | $this->add_posts_container_style(); |
| 311 | |
| 312 | $this->add_navigation_style(); |
| 313 | |
| 314 | $this->add_separator_style(); |
| 315 | } |
| 316 | |
| 317 | /** |
| 318 | * Adds General controls. |
| 319 | * |
| 320 | * @access private |
| 321 | * @since 4.9.37 |
| 322 | */ |
| 323 | private function add_general_section_controls() { |
| 324 | |
| 325 | $draw_icon = $this->check_icon_draw(); |
| 326 | |
| 327 | $this->start_controls_section( |
| 328 | 'pa_ticker_general_section', |
| 329 | array( |
| 330 | 'label' => __( 'General', 'premium-addons-for-elementor' ), |
| 331 | ) |
| 332 | ); |
| 333 | |
| 334 | $demo = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-news-ticker-widget/', 'ticker', 'wp-editor', 'demo' ); |
| 335 | Helper_Functions::add_templates_controls( $this, 'news-ticker', $demo ); |
| 336 | |
| 337 | $this->add_control( |
| 338 | 'layout', |
| 339 | array( |
| 340 | 'label' => __( 'Layout', 'premium-addons-for-elementor' ), |
| 341 | 'type' => Controls_Manager::SELECT, |
| 342 | 'prefix_class' => 'premium-post-ticker__', |
| 343 | 'render_type' => 'template', |
| 344 | 'label_block' => true, |
| 345 | 'options' => $this->options['layouts'], |
| 346 | 'default' => 'layout-1', |
| 347 | ) |
| 348 | ); |
| 349 | |
| 350 | $this->papro_activated = Helper_Functions::check_papro_version(); |
| 351 | if ( ! $this->papro_activated ) { |
| 352 | |
| 353 | $get_pro = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'ticker-widget', 'wp-editor', 'get-pro' ); |
| 354 | |
| 355 | $this->add_control( |
| 356 | 'ticker_notice', |
| 357 | array( |
| 358 | 'type' => Controls_Manager::RAW_HTML, |
| 359 | 'raw' => __( 'This option is available in Premium Addons Pro. ', 'premium-addons-for-elementor' ) . '<a href="' . esc_url( $get_pro ) . '" target="_blank">' . __( 'Upgrade now!', 'premium-addons-for-elementor' ) . '</a>', |
| 360 | 'content_classes' => 'papro-upgrade-notice', |
| 361 | 'condition' => array( |
| 362 | 'layout' => $this->options['layout_condition'], |
| 363 | ), |
| 364 | ) |
| 365 | ); |
| 366 | |
| 367 | } |
| 368 | |
| 369 | $this->add_control( |
| 370 | 'ticker_title', |
| 371 | array( |
| 372 | 'label' => __( 'Ticker Title', 'premium-addons-for-elementor' ), |
| 373 | 'type' => Controls_Manager::TEXT, |
| 374 | 'label_block' => true, |
| 375 | 'default' => __( 'TRENDING', 'premium-addons-for-elementor' ), |
| 376 | 'dynamic' => array( 'active' => true ), |
| 377 | ) |
| 378 | ); |
| 379 | |
| 380 | $this->add_control( |
| 381 | 'ticker_icon_sw', |
| 382 | array( |
| 383 | 'label' => __( 'Icon', 'premium-addons-for-elementor' ), |
| 384 | 'type' => Controls_Manager::SWITCHER, |
| 385 | 'render_type' => 'template', |
| 386 | 'condition' => array( |
| 387 | 'ticker_title!' => '', |
| 388 | ), |
| 389 | ) |
| 390 | ); |
| 391 | |
| 392 | $this->add_control( |
| 393 | 'icon_type', |
| 394 | array( |
| 395 | 'label' => __( 'Icon Type', 'premium-addons-for-elementor' ), |
| 396 | 'type' => Controls_Manager::SELECT, |
| 397 | 'render_type' => 'template', |
| 398 | 'options' => array( |
| 399 | 'icon' => __( 'Icon', 'premium-addons-for-elementor' ), |
| 400 | 'lottie' => __( 'Lottie Animation', 'premium-addons-for-elementor' ), |
| 401 | 'image' => __( 'Image', 'premium-addons-for-elementor' ), |
| 402 | 'svg' => __( 'SVG Code', 'premium-addons-for-elementor' ), |
| 403 | ), |
| 404 | 'default' => 'icon', |
| 405 | 'condition' => array( |
| 406 | 'ticker_icon_sw' => 'yes', |
| 407 | 'ticker_title!' => '', |
| 408 | ), |
| 409 | ) |
| 410 | ); |
| 411 | |
| 412 | $common_conditions = array( |
| 413 | 'ticker_icon_sw' => 'yes', |
| 414 | 'ticker_title!' => '', |
| 415 | ); |
| 416 | |
| 417 | $this->add_control( |
| 418 | 'pa_ticker_icon', |
| 419 | array( |
| 420 | 'label' => __( 'Choose Icon', 'premium-addons-for-elementor' ), |
| 421 | 'type' => Controls_Manager::ICONS, |
| 422 | 'label_block' => false, |
| 423 | 'skin' => 'inline', |
| 424 | 'default' => array( |
| 425 | 'value' => 'fas fa-star', |
| 426 | 'library' => 'fa-solid', |
| 427 | ), |
| 428 | 'condition' => array( |
| 429 | 'ticker_icon_sw' => 'yes', |
| 430 | 'ticker_title!' => '', |
| 431 | 'icon_type' => 'icon', |
| 432 | ), |
| 433 | ) |
| 434 | ); |
| 435 | |
| 436 | $this->add_control( |
| 437 | 'custom_svg', |
| 438 | array( |
| 439 | 'label' => __( 'SVG Code', 'premium-addons-for-elementor' ), |
| 440 | 'type' => Controls_Manager::TEXTAREA, |
| 441 | 'description' => 'You can use these sites to create SVGs: <a href="https://danmarshall.github.io/google-font-to-svg-path/" target="_blank">Google Fonts</a> and <a href="https://boxy-svg.com/" target="_blank">Boxy SVG</a>', |
| 442 | 'condition' => array( |
| 443 | 'ticker_icon_sw' => 'yes', |
| 444 | 'ticker_title!' => '', |
| 445 | 'icon_type' => 'svg', |
| 446 | ), |
| 447 | 'ai' => array( |
| 448 | 'active' => false, |
| 449 | ), |
| 450 | ) |
| 451 | ); |
| 452 | |
| 453 | $this->add_control( |
| 454 | 'image', |
| 455 | array( |
| 456 | 'label' => __( 'Image', 'premium-addons-for-elementor' ), |
| 457 | 'type' => Controls_Manager::MEDIA, |
| 458 | 'media_types' => array( 'image' ), |
| 459 | 'dynamic' => array( 'active' => true ), |
| 460 | 'condition' => array( |
| 461 | 'ticker_icon_sw' => 'yes', |
| 462 | 'ticker_title!' => '', |
| 463 | 'icon_type' => 'image', |
| 464 | ), |
| 465 | ) |
| 466 | ); |
| 467 | |
| 468 | $this->add_control( |
| 469 | 'lottie_url', |
| 470 | array( |
| 471 | 'label' => __( 'Animation JSON URL', 'premium-addons-for-elementor' ), |
| 472 | 'type' => Controls_Manager::TEXT, |
| 473 | 'dynamic' => array( 'active' => true ), |
| 474 | 'description' => 'Get JSON code URL from <a href="https://lottiefiles.com/" target="_blank">here</a>', |
| 475 | 'label_block' => true, |
| 476 | 'condition' => array( |
| 477 | 'ticker_icon_sw' => 'yes', |
| 478 | 'ticker_title!' => '', |
| 479 | 'icon_type' => 'lottie', |
| 480 | ), |
| 481 | 'ai' => array( |
| 482 | 'active' => false, |
| 483 | ), |
| 484 | ) |
| 485 | ); |
| 486 | |
| 487 | $animation_conds = array( |
| 488 | 'terms' => array( |
| 489 | array( |
| 490 | 'name' => 'ticker_icon_sw', |
| 491 | 'value' => 'yes', |
| 492 | ), |
| 493 | array( |
| 494 | 'name' => 'ticker_title', |
| 495 | 'operator' => '!==', |
| 496 | 'value' => '', |
| 497 | ), |
| 498 | array( |
| 499 | 'relation' => 'or', |
| 500 | 'terms' => array( |
| 501 | array( |
| 502 | 'name' => 'icon_type', |
| 503 | 'value' => 'lottie', |
| 504 | ), |
| 505 | array( |
| 506 | 'terms' => array( |
| 507 | array( |
| 508 | 'relation' => 'or', |
| 509 | 'terms' => array( |
| 510 | array( |
| 511 | 'name' => 'icon_type', |
| 512 | 'value' => 'icon', |
| 513 | ), |
| 514 | array( |
| 515 | 'name' => 'icon_type', |
| 516 | 'value' => 'svg', |
| 517 | ), |
| 518 | ), |
| 519 | ), |
| 520 | array( |
| 521 | 'name' => 'draw_svg', |
| 522 | 'value' => 'yes', |
| 523 | ), |
| 524 | ), |
| 525 | ), |
| 526 | ), |
| 527 | ), |
| 528 | ), |
| 529 | ); |
| 530 | |
| 531 | $this->add_control( |
| 532 | 'draw_svg', |
| 533 | array( |
| 534 | 'label' => __( 'Draw Icon', 'premium-addons-for-elementor' ), |
| 535 | 'type' => Controls_Manager::SWITCHER, |
| 536 | 'description' => __( 'Enable this option to make the icon drawable. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=ZLr0bRe0RAY" target="_blank">tutorial</a>', |
| 537 | 'classes' => $draw_icon ? '' : 'editor-pa-control-disabled', |
| 538 | 'condition' => array_merge( |
| 539 | $common_conditions, |
| 540 | array( |
| 541 | 'icon_type' => array( 'icon', 'svg' ), |
| 542 | 'pa_ticker_icon[library]!' => 'svg', |
| 543 | ) |
| 544 | ), |
| 545 | ) |
| 546 | ); |
| 547 | |
| 548 | if ( $draw_icon ) { |
| 549 | |
| 550 | $this->add_control( |
| 551 | 'path_width', |
| 552 | array( |
| 553 | 'label' => __( 'Path Thickness', 'premium-addons-for-elementor' ), |
| 554 | 'type' => Controls_Manager::SLIDER, |
| 555 | 'range' => array( |
| 556 | 'px' => array( |
| 557 | 'min' => 0, |
| 558 | 'max' => 50, |
| 559 | 'step' => 0.1, |
| 560 | ), |
| 561 | ), |
| 562 | 'condition' => array_merge( |
| 563 | $common_conditions, |
| 564 | array( |
| 565 | 'icon_type' => array( 'icon', 'svg' ), |
| 566 | ) |
| 567 | ), |
| 568 | 'selectors' => array( |
| 569 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item) svg *' => 'stroke-width: {{SIZE}}', |
| 570 | ), |
| 571 | ) |
| 572 | ); |
| 573 | |
| 574 | $this->add_control( |
| 575 | 'svg_sync', |
| 576 | array( |
| 577 | 'label' => __( 'Draw All Paths Together', 'premium-addons-for-elementor' ), |
| 578 | 'type' => Controls_Manager::SWITCHER, |
| 579 | 'condition' => array_merge( |
| 580 | $common_conditions, |
| 581 | array( |
| 582 | 'icon_type' => array( 'icon', 'svg' ), |
| 583 | 'draw_svg' => 'yes', |
| 584 | ) |
| 585 | ), |
| 586 | ) |
| 587 | ); |
| 588 | |
| 589 | $this->add_control( |
| 590 | 'frames', |
| 591 | array( |
| 592 | 'label' => __( 'Speed', 'premium-addons-for-elementor' ), |
| 593 | 'type' => Controls_Manager::NUMBER, |
| 594 | 'description' => __( 'Larger value means longer animation duration.', 'premium-addons-for-elementor' ), |
| 595 | 'default' => 5, |
| 596 | 'min' => 1, |
| 597 | 'max' => 100, |
| 598 | 'condition' => array_merge( |
| 599 | $common_conditions, |
| 600 | array( |
| 601 | 'icon_type' => array( 'icon', 'svg' ), |
| 602 | 'draw_svg' => 'yes', |
| 603 | ) |
| 604 | ), |
| 605 | ) |
| 606 | ); |
| 607 | |
| 608 | } else { |
| 609 | |
| 610 | Helper_Functions::get_draw_svg_notice( |
| 611 | $this, |
| 612 | 'ticker', |
| 613 | array_merge( |
| 614 | $common_conditions, |
| 615 | array( |
| 616 | 'icon_type' => array( 'icon', 'svg' ), |
| 617 | 'pa_ticker_icon[library]!' => 'svg', |
| 618 | ) |
| 619 | ) |
| 620 | ); |
| 621 | |
| 622 | } |
| 623 | |
| 624 | $this->add_control( |
| 625 | 'lottie_loop', |
| 626 | array( |
| 627 | 'label' => __( 'Loop', 'premium-addons-for-elementor' ), |
| 628 | 'type' => Controls_Manager::SWITCHER, |
| 629 | 'return_value' => 'true', |
| 630 | 'default' => 'true', |
| 631 | 'conditions' => $animation_conds, |
| 632 | ) |
| 633 | ); |
| 634 | |
| 635 | $this->add_control( |
| 636 | 'lottie_reverse', |
| 637 | array( |
| 638 | 'label' => __( 'Reverse', 'premium-addons-for-elementor' ), |
| 639 | 'type' => Controls_Manager::SWITCHER, |
| 640 | 'return_value' => 'true', |
| 641 | 'conditions' => $animation_conds, |
| 642 | ) |
| 643 | ); |
| 644 | |
| 645 | if ( $draw_icon ) { |
| 646 | |
| 647 | $this->add_control( |
| 648 | 'start_point', |
| 649 | array( |
| 650 | 'label' => __( 'Start Point (%)', 'premium-addons-for-elementor' ), |
| 651 | 'type' => Controls_Manager::SLIDER, |
| 652 | 'description' => __( 'Set the point that the SVG should start from.', 'premium-addons-for-elementor' ), |
| 653 | 'default' => array( |
| 654 | 'unit' => '%', |
| 655 | 'size' => 0, |
| 656 | ), |
| 657 | 'condition' => array( |
| 658 | 'icon_type' => array( 'icon', 'svg' ), |
| 659 | 'draw_svg' => 'yes', |
| 660 | 'lottie_reverse!' => 'true', |
| 661 | ), |
| 662 | |
| 663 | ) |
| 664 | ); |
| 665 | |
| 666 | $this->add_control( |
| 667 | 'end_point', |
| 668 | array( |
| 669 | 'label' => __( 'End Point (%)', 'premium-addons-for-elementor' ), |
| 670 | 'type' => Controls_Manager::SLIDER, |
| 671 | 'description' => __( 'Set the point that the SVG should end at.', 'premium-addons-for-elementor' ), |
| 672 | 'default' => array( |
| 673 | 'unit' => '%', |
| 674 | 'size' => 0, |
| 675 | ), |
| 676 | 'condition' => array( |
| 677 | 'icon_type' => array( 'icon', 'svg' ), |
| 678 | 'draw_svg' => 'yes', |
| 679 | 'lottie_reverse' => 'true', |
| 680 | ), |
| 681 | |
| 682 | ) |
| 683 | ); |
| 684 | |
| 685 | $this->add_control( |
| 686 | 'svg_yoyo', |
| 687 | array( |
| 688 | 'label' => __( 'Yoyo Effect', 'premium-addons-for-elementor' ), |
| 689 | 'type' => Controls_Manager::SWITCHER, |
| 690 | 'condition' => array( |
| 691 | 'icon_type' => array( 'icon', 'svg' ), |
| 692 | 'draw_svg' => 'yes', |
| 693 | 'lottie_loop' => 'true', |
| 694 | ), |
| 695 | ) |
| 696 | ); |
| 697 | } |
| 698 | |
| 699 | $this->add_control( |
| 700 | 'icon_order', |
| 701 | array( |
| 702 | 'label' => __( 'Icon Order', 'premium-addons-for-elementor' ), |
| 703 | 'type' => Controls_Manager::CHOOSE, |
| 704 | 'toggle' => false, |
| 705 | 'options' => array( |
| 706 | '0' => array( |
| 707 | 'title' => __( 'Before Title', 'premium-addons-for-elementor' ), |
| 708 | 'icon' => is_rtl() ? 'eicon-order-end' : 'eicon-order-start', |
| 709 | ), |
| 710 | '2' => array( |
| 711 | 'title' => __( 'After Title', 'premium-addons-for-elementor' ), |
| 712 | 'icon' => 'eicon-order-end', |
| 713 | 'icon' => is_rtl() ? 'eicon-order-start' : 'eicon-order-end', |
| 714 | ), |
| 715 | ), |
| 716 | 'separator' => 'before', |
| 717 | 'default' => '0', |
| 718 | 'condition' => array( |
| 719 | 'ticker_icon_sw' => 'yes', |
| 720 | 'ticker_title!' => '', |
| 721 | ), |
| 722 | 'selectors' => array( |
| 723 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item)' => 'order: {{VALUE}}', |
| 724 | ), |
| 725 | ) |
| 726 | ); |
| 727 | |
| 728 | $this->add_responsive_control( |
| 729 | 'icon_size', |
| 730 | array( |
| 731 | 'label' => __( 'Icon Size (px)', 'premium-addons-for-elementor' ), |
| 732 | 'type' => Controls_Manager::SLIDER, |
| 733 | 'size_units' => array( 'px' ), |
| 734 | 'range' => array( |
| 735 | 'px' => array( |
| 736 | 'min' => 0, |
| 737 | 'max' => 500, |
| 738 | ), |
| 739 | ), |
| 740 | 'selectors' => array( |
| 741 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item) i' => 'font-size: {{SIZE}}px;', |
| 742 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item) img' => 'width: {{SIZE}}px', |
| 743 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item) > svg, |
| 744 | {{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item) .premium-lottie-animation, |
| 745 | {{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item) .premium-drawable-icon' => 'width: {{SIZE}}px; height: {{SIZE}}px; line-height: {{SIZE}}px;', |
| 746 | ), |
| 747 | 'condition' => array( |
| 748 | 'ticker_icon_sw' => 'yes', |
| 749 | 'ticker_title!' => '', |
| 750 | ), |
| 751 | ) |
| 752 | ); |
| 753 | |
| 754 | $this->add_group_control( |
| 755 | Group_Control_Image_Size::get_type(), |
| 756 | array( |
| 757 | 'name' => 'thumbnail', |
| 758 | 'default' => 'full', |
| 759 | 'condition' => array( |
| 760 | 'ticker_icon_sw' => 'yes', |
| 761 | 'ticker_title!' => '', |
| 762 | 'icon_type' => 'image', |
| 763 | ), |
| 764 | ) |
| 765 | ); |
| 766 | |
| 767 | $this->add_responsive_control( |
| 768 | 'icon_spacing', |
| 769 | array( |
| 770 | 'label' => __( 'Spacing (px)', 'premium-addons-for-elementor' ), |
| 771 | 'type' => Controls_Manager::SLIDER, |
| 772 | 'size_units' => array( 'px' ), |
| 773 | 'selectors' => array( |
| 774 | '{{WRAPPER}} .premium-post-ticker__title-wrapper' => 'column-gap: {{SIZE}}px', |
| 775 | ), |
| 776 | 'condition' => array( |
| 777 | 'ticker_icon_sw' => 'yes', |
| 778 | 'ticker_title!' => '', |
| 779 | ), |
| 780 | ) |
| 781 | ); |
| 782 | |
| 783 | $this->add_control( |
| 784 | 'hide_title_on', |
| 785 | array( |
| 786 | 'label' => __( 'Hide Title On', 'premium-addons-for-elementor' ), |
| 787 | 'type' => Controls_Manager::SELECT2, |
| 788 | 'options' => Helper_Functions::get_all_breakpoints(), |
| 789 | 'separator' => 'after', |
| 790 | 'multiple' => true, |
| 791 | 'label_block' => true, |
| 792 | 'default' => array(), |
| 793 | 'condition' => array( |
| 794 | 'ticker_title!' => '', |
| 795 | ), |
| 796 | ) |
| 797 | ); |
| 798 | |
| 799 | $this->add_control( |
| 800 | 'show_date', |
| 801 | array( |
| 802 | 'label' => __( 'Show Current Date', 'premium-addons-for-elementor' ), |
| 803 | 'type' => Controls_Manager::SWITCHER, |
| 804 | 'default' => 'yes', |
| 805 | ) |
| 806 | ); |
| 807 | |
| 808 | $this->add_control( |
| 809 | 'ticker_date_pos', |
| 810 | array( |
| 811 | 'label' => __( 'Position', 'premium-addons-for-elementor' ), |
| 812 | 'type' => Controls_Manager::CHOOSE, |
| 813 | 'toggle' => false, |
| 814 | 'options' => array( |
| 815 | 'flex-start' => array( |
| 816 | 'title' => __( 'Start', 'premium-addons-for-elementor' ), |
| 817 | 'icon' => is_rtl() ? 'eicon-order-end' : 'eicon-order-start', |
| 818 | ), |
| 819 | 'flex-end' => array( |
| 820 | 'title' => __( 'End', 'premium-addons-for-elementor' ), |
| 821 | 'icon' => is_rtl() ? 'eicon-order-start' : 'eicon-order-end', |
| 822 | ), |
| 823 | ), |
| 824 | 'default' => 'flex-start', |
| 825 | 'condition' => array( |
| 826 | 'show_date' => 'yes', |
| 827 | 'layout' => 'layout-1', |
| 828 | ), |
| 829 | 'selectors' => array( |
| 830 | '{{WRAPPER}}.premium-post-ticker__layout-1 .premium-post-ticker__header-wrapper' => 'align-self: {{VALUE}}', |
| 831 | ), |
| 832 | ) |
| 833 | ); |
| 834 | |
| 835 | $this->add_control( |
| 836 | 'ticker_date_order', |
| 837 | array( |
| 838 | 'label' => __( 'Order', 'premium-addons-for-elementor' ), |
| 839 | 'type' => Controls_Manager::CHOOSE, |
| 840 | 'toggle' => false, |
| 841 | 'options' => array( |
| 842 | '0' => array( |
| 843 | 'title' => __( 'Before Title', 'premium-addons-for-elementor' ), |
| 844 | 'icon' => 'eicon-order-start', |
| 845 | ), |
| 846 | '1' => array( |
| 847 | 'title' => __( 'After Title', 'premium-addons-for-elementor' ), |
| 848 | 'icon' => 'eicon-order-end', |
| 849 | ), |
| 850 | ), |
| 851 | 'default' => '0', |
| 852 | 'condition' => array( |
| 853 | 'show_date' => 'yes', |
| 854 | 'layout' => 'layout-4', |
| 855 | ), |
| 856 | 'selectors' => array( |
| 857 | '{{WRAPPER}}.premium-post-ticker__layout-4 .premium-post-ticker__date-wrapper' => 'order: {{VALUE}}', |
| 858 | ), |
| 859 | ) |
| 860 | ); |
| 861 | |
| 862 | $this->add_control( |
| 863 | 'date_format', |
| 864 | array( |
| 865 | 'label' => __( 'Date Format', 'premium-addons-for-elementor' ), |
| 866 | 'type' => Controls_Manager::TEXT, |
| 867 | 'label_block' => true, |
| 868 | 'description' => __( 'Know more abour date format from ', 'premium-addons-for-elementor' ) . '<a href="https://wordpress.org/documentation/article/customize-date-and-time-format/" target="_blank">here</a>', |
| 869 | 'default' => get_option( 'date_format' ), |
| 870 | 'condition' => array( |
| 871 | 'show_date' => 'yes', |
| 872 | ), |
| 873 | 'ai' => array( |
| 874 | 'active' => false, |
| 875 | ), |
| 876 | ) |
| 877 | ); |
| 878 | |
| 879 | $this->add_control( |
| 880 | 'hide_date_on', |
| 881 | array( |
| 882 | 'label' => __( 'Hide Date On', 'premium-addons-for-elementor' ), |
| 883 | 'type' => Controls_Manager::SELECT2, |
| 884 | 'options' => Helper_Functions::get_all_breakpoints(), |
| 885 | 'separator' => 'after', |
| 886 | 'multiple' => true, |
| 887 | 'label_block' => true, |
| 888 | 'default' => array(), |
| 889 | 'condition' => array( |
| 890 | 'show_date' => 'yes', |
| 891 | ), |
| 892 | ) |
| 893 | ); |
| 894 | |
| 895 | $this->add_control( |
| 896 | 'premium_blog_number_of_posts', |
| 897 | array( |
| 898 | 'label' => __( 'Posts To Load', 'premium-addons-for-elementor' ), |
| 899 | 'type' => Controls_Manager::NUMBER, |
| 900 | 'min' => 1, |
| 901 | 'default' => 4, |
| 902 | 'condition' => array( |
| 903 | 'post_type_filter!' => array( 'stock', 'gold', 'text' ), |
| 904 | ), |
| 905 | ) |
| 906 | ); |
| 907 | |
| 908 | $this->add_control( |
| 909 | 'additional_heading', |
| 910 | array( |
| 911 | 'label' => __( 'Additional Settings', 'premium-addons-for-elementor' ), |
| 912 | 'type' => Controls_Manager::HEADING, |
| 913 | 'separator' => 'before', |
| 914 | ) |
| 915 | ); |
| 916 | |
| 917 | $this->add_control( |
| 918 | 'reverse', |
| 919 | array( |
| 920 | 'label' => __( 'Reverse Direction', 'premium-addons-for-elementor' ), |
| 921 | 'type' => Controls_Manager::SWITCHER, |
| 922 | 'prefix_class' => 'premium-reversed-', |
| 923 | 'render_type' => 'template', |
| 924 | ) |
| 925 | ); |
| 926 | |
| 927 | $this->add_control( |
| 928 | 'infinite', |
| 929 | array( |
| 930 | 'label' => __( 'Marquee Effect', 'premium-addons-for-elementor' ), |
| 931 | 'type' => Controls_Manager::SWITCHER, |
| 932 | 'separator' => 'before', |
| 933 | 'render_type' => 'template', |
| 934 | 'default' => 'yes', |
| 935 | 'prefix_class' => 'pa-infinite-ticker-', |
| 936 | ) |
| 937 | ); |
| 938 | |
| 939 | $this->add_control( |
| 940 | 'fade_color', |
| 941 | array( |
| 942 | 'label' => __( 'Fade Color', 'premium-addons-for-elementor' ), |
| 943 | 'type' => Controls_Manager::COLOR, |
| 944 | 'separator' => 'after', |
| 945 | 'condition' => array( |
| 946 | 'infinite' => 'yes', |
| 947 | ), |
| 948 | 'selectors' => array( |
| 949 | '{{WRAPPER}}.premium-post-ticker__layout-1 .premium-post-ticker__posts-wrapper::after, {{WRAPPER}}.premium-post-ticker__layout-2 .premium-post-ticker__posts-wrapper::after' => 'background: linear-gradient(to right, {{VALUE}}, {{VALUE}} 0%, transparent 10%, transparent 90%, {{VALUE}}) !important;', |
| 950 | '{{WRAPPER}}.premium-post-ticker__layout-3 .premium-post-ticker__content::after' => 'background: linear-gradient(to right, {{VALUE}}, {{VALUE}} 0%, transparent 10%, transparent 90%, {{VALUE}}) !important;', |
| 951 | '{{WRAPPER}}.premium-post-ticker__layout-4 .premium-post-ticker__posts-wrapper::after' => 'background: linear-gradient(to bottom, {{VALUE}}, {{VALUE}} 0%, transparent 15%, transparent 85%, {{VALUE}}) !important;', |
| 952 | ), |
| 953 | ) |
| 954 | ); |
| 955 | |
| 956 | $this->add_control( |
| 957 | 'separator', |
| 958 | array( |
| 959 | 'label' => __( 'Separator', 'premium-addons-for-elementor' ), |
| 960 | 'type' => Controls_Manager::SWITCHER, |
| 961 | 'condition' => array( |
| 962 | 'infinite' => 'yes', |
| 963 | 'layout!' => 'layout-4', |
| 964 | ), |
| 965 | ) |
| 966 | ); |
| 967 | |
| 968 | $this->add_control( |
| 969 | 'typing', |
| 970 | array( |
| 971 | 'label' => __( 'Typing Effect', 'premium-addons-for-elementor' ), |
| 972 | 'type' => Controls_Manager::SWITCHER, |
| 973 | 'render_type' => 'template', |
| 974 | 'prefix_class' => 'premium-typing-', |
| 975 | 'description' => __( 'Note: Set the<b> Animaiton Speed </b>option to 0 for better visual.', 'premium-addons-for-elementor' ), |
| 976 | 'condition' => array( |
| 977 | 'post_type_filter!' => array( 'stock', 'gold' ), |
| 978 | 'infinite!' => 'yes', |
| 979 | 'layout!' => 'layout-4', |
| 980 | ), |
| 981 | ) |
| 982 | ); |
| 983 | |
| 984 | $this->add_control( |
| 985 | 'cursor', |
| 986 | array( |
| 987 | 'label' => __( 'Typing Cursor', 'premium-addons-for-elementor' ), |
| 988 | 'type' => Controls_Manager::TEXT, |
| 989 | 'label_block' => true, |
| 990 | 'default' => '_', |
| 991 | 'selectors' => array( |
| 992 | '{{WRAPPER}} .premium-text-typing::after' => 'content: "{{VALUE}}";', |
| 993 | ), |
| 994 | 'condition' => array( |
| 995 | 'post_type_filter!' => array( 'stock', 'gold' ), |
| 996 | 'infinite!' => 'yes', |
| 997 | 'typing' => 'yes', |
| 998 | 'layout!' => 'layout-4', |
| 999 | ), |
| 1000 | 'ai' => array( |
| 1001 | 'active' => false, |
| 1002 | ), |
| 1003 | ) |
| 1004 | ); |
| 1005 | |
| 1006 | $this->add_control( |
| 1007 | 'entrance_animation', |
| 1008 | array( |
| 1009 | 'label' => __( 'Entrance Animation', 'premium-addons-for-elementor' ), |
| 1010 | 'type' => Controls_Manager::ANIMATION, |
| 1011 | 'render_type' => 'template', |
| 1012 | 'default' => '', |
| 1013 | 'label_block' => true, |
| 1014 | 'condition' => array( |
| 1015 | 'infinite!' => 'yes', |
| 1016 | 'layout!' => 'layout-4', |
| 1017 | 'typing!' => 'yes', |
| 1018 | ), |
| 1019 | ) |
| 1020 | ); |
| 1021 | |
| 1022 | $this->add_control( |
| 1023 | 'ticker_pointer', |
| 1024 | array( |
| 1025 | 'label' => __( 'Title Pointer', 'premium-addons-for-elementor' ), |
| 1026 | 'type' => Controls_Manager::SWITCHER, |
| 1027 | 'prefix_class' => 'premium-ticker-pointer-', |
| 1028 | 'condition' => array( |
| 1029 | 'ticker_title!' => '', |
| 1030 | 'layout' => array( 'layout-1', 'layout-2' ), |
| 1031 | ), |
| 1032 | ) |
| 1033 | ); |
| 1034 | |
| 1035 | $this->add_control( |
| 1036 | 'ticker_pointer_color', |
| 1037 | array( |
| 1038 | 'label' => __( 'Pointer Color', 'premium-addons-for-elementor' ), |
| 1039 | 'type' => Controls_Manager::COLOR, |
| 1040 | 'separator' => 'before', |
| 1041 | 'selectors' => array( |
| 1042 | 'body:not(.rtl) {{WRAPPER}}.premium-ticker-pointer-yes:not(.premium-reversed-yes) .premium-post-ticker__content > div:first-child::after, |
| 1043 | .rtl {{WRAPPER}}.premium-ticker-pointer-yes.premium-reversed-yes .premium-post-ticker__content > div:first-child::after' => 'border-left-color: {{VALUE}};', |
| 1044 | 'body:not(.rtl) {{WRAPPER}}.premium-ticker-pointer-yes.premium-reversed-yes .premium-post-ticker__content > div:first-child::after, |
| 1045 | .rtl {{WRAPPER}}.premium-ticker-pointer-yes:not(.premium-reversed-yes) .premium-post-ticker__content > div:first-child::after' => 'border-right-color: {{VALUE}};', |
| 1046 | ), |
| 1047 | 'global' => array( |
| 1048 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 1049 | ), |
| 1050 | 'condition' => array( |
| 1051 | 'ticker_title!' => '', |
| 1052 | 'ticker_pointer' => 'yes', |
| 1053 | 'layout' => array( 'layout-1', 'layout-2' ), |
| 1054 | ), |
| 1055 | ) |
| 1056 | ); |
| 1057 | |
| 1058 | $this->add_group_control( |
| 1059 | Premium_Background::get_type(), |
| 1060 | array( |
| 1061 | 'name' => 'pointer_bg', |
| 1062 | 'description' => __( 'Pointer Color', 'premium-addons-for-elementor' ), |
| 1063 | 'types' => array( 'classic', 'gradient' ), |
| 1064 | 'fields_options' => array( |
| 1065 | 'background' => array( |
| 1066 | 'default' => 'classic', |
| 1067 | ), |
| 1068 | 'color' => array( |
| 1069 | 'global' => array( |
| 1070 | 'default' => Global_Colors::COLOR_TEXT, |
| 1071 | ), |
| 1072 | ), |
| 1073 | ), |
| 1074 | 'selector' => '{{WRAPPER}}.premium-post-ticker__layout-3 .premium-post-ticker__header-wrapper::after', |
| 1075 | 'condition' => array( |
| 1076 | 'layout' => 'layout-3', |
| 1077 | 'ticker_title' => '', |
| 1078 | ), |
| 1079 | ) |
| 1080 | ); |
| 1081 | |
| 1082 | $this->add_responsive_control( |
| 1083 | 'pointer_width', |
| 1084 | array( |
| 1085 | 'label' => __( 'Pointer Width (px)', 'premium-addons-for-elementor' ), |
| 1086 | 'type' => Controls_Manager::SLIDER, |
| 1087 | 'size_units' => array( 'px' ), |
| 1088 | 'selectors' => array( |
| 1089 | '{{WRAPPER}}.premium-ticker-pointer-yes .premium-post-ticker__content > div:first-child::after' => 'border-top-width: {{SIZE}}px; border-bottom-width: {{SIZE}}px;', |
| 1090 | ), |
| 1091 | 'condition' => array( |
| 1092 | 'ticker_title!' => '', |
| 1093 | 'ticker_pointer' => 'yes', |
| 1094 | 'layout' => array( 'layout-1', 'layout-2' ), |
| 1095 | ), |
| 1096 | ) |
| 1097 | ); |
| 1098 | |
| 1099 | $this->add_responsive_control( |
| 1100 | 'pointer_height', |
| 1101 | array( |
| 1102 | 'label' => __( 'Pointer Height (px)', 'premium-addons-for-elementor' ), |
| 1103 | 'type' => Controls_Manager::SLIDER, |
| 1104 | 'size_units' => array( 'px' ), |
| 1105 | 'selectors' => array( |
| 1106 | 'body:not(.rtl) {{WRAPPER}}.premium-ticker-pointer-yes:not(.premium-reversed-yes) .premium-post-ticker__content > div:first-child::after, |
| 1107 | .rtl {{WRAPPER}}.premium-ticker-pointer-yes.premium-reversed-yes .premium-post-ticker__content > div:first-child::after' => 'border-left-width: {{SIZE}}px;', |
| 1108 | 'body:not(.rtl) {{WRAPPER}}.premium-ticker-pointer-yes.premium-reversed-yes .premium-post-ticker__content > div:first-child::after, |
| 1109 | .rtl {{WRAPPER}}.premium-ticker-pointer-yes:not(.premium-reversed-yes) .premium-post-ticker__content > div:first-child::after' => 'border-right-width: {{SIZE}}px; left: calc(-1 * ({{SIZE}}px - 1px));', |
| 1110 | |
| 1111 | ), |
| 1112 | 'condition' => array( |
| 1113 | 'ticker_title!' => '', |
| 1114 | 'ticker_pointer' => 'yes', |
| 1115 | 'layout' => array( 'layout-1', 'layout-2' ), |
| 1116 | ), |
| 1117 | ) |
| 1118 | ); |
| 1119 | |
| 1120 | $this->add_control( |
| 1121 | 'ticker_title_tag', |
| 1122 | array( |
| 1123 | 'label' => __( 'Title HTML Tag', 'premium-addons-for-elementor' ), |
| 1124 | 'type' => Controls_Manager::SELECT, |
| 1125 | 'options' => array( |
| 1126 | 'h1' => 'H1', |
| 1127 | 'h2' => 'H2', |
| 1128 | 'h3' => 'H3', |
| 1129 | 'h4' => 'H4', |
| 1130 | 'h5' => 'H5', |
| 1131 | 'h6' => 'H6', |
| 1132 | 'div' => 'div', |
| 1133 | 'span' => 'span', |
| 1134 | 'p' => 'p', |
| 1135 | ), |
| 1136 | 'default' => 'h4', |
| 1137 | 'label_block' => true, |
| 1138 | 'conditions' => array( |
| 1139 | 'relation' => 'or', |
| 1140 | 'terms' => array( |
| 1141 | array( |
| 1142 | 'name' => 'ticker_title', |
| 1143 | 'operator' => '!==', |
| 1144 | 'value' => '', |
| 1145 | ), |
| 1146 | array( |
| 1147 | 'name' => 'post_type_filter', |
| 1148 | 'value' => 'post', |
| 1149 | ), |
| 1150 | ), |
| 1151 | ), |
| 1152 | ) |
| 1153 | ); |
| 1154 | |
| 1155 | $this->end_controls_section(); |
| 1156 | } |
| 1157 | |
| 1158 | /** |
| 1159 | * Adds query controls. |
| 1160 | * |
| 1161 | * @access private |
| 1162 | * @since 4.9.37 |
| 1163 | */ |
| 1164 | private function add_query_section_controls() { |
| 1165 | |
| 1166 | $this->start_controls_section( |
| 1167 | 'pa_spl_query_section', |
| 1168 | array( |
| 1169 | 'label' => __( 'Query', 'premium-addons-for-elementor' ), |
| 1170 | ) |
| 1171 | ); |
| 1172 | |
| 1173 | $post_types = Posts_Helper::get_posts_types(); |
| 1174 | |
| 1175 | $post_types = array_merge( |
| 1176 | $post_types, |
| 1177 | array( |
| 1178 | 'related' => __( 'Related', 'premium-addons-for-elementor' ), |
| 1179 | 'stock' => __( 'Stock Prices', 'premium-addons-for-elementor' ), |
| 1180 | 'gold' => __( 'Gold Prices', 'premium-addons-for-elementor' ), |
| 1181 | 'text' => __( 'Text Content', 'premium-addons-for-elementor' ), |
| 1182 | ) |
| 1183 | ); |
| 1184 | |
| 1185 | foreach ( $post_types as $id => $label ) { |
| 1186 | |
| 1187 | if ( ! in_array( $id, array( 'post', 'text' ), true ) ) { |
| 1188 | $post_types[ $id ] .= apply_filters( 'pa_pro_label', __( ' (Pro)', 'premium-addons-for-elementor' ) ); |
| 1189 | } |
| 1190 | } |
| 1191 | |
| 1192 | $this->add_control( |
| 1193 | 'post_type_filter', |
| 1194 | array( |
| 1195 | 'label' => __( 'Source', 'premium-addons-for-elementor' ), |
| 1196 | 'type' => Controls_Manager::SELECT, |
| 1197 | 'label_block' => true, |
| 1198 | 'options' => $post_types, |
| 1199 | 'default' => 'post', |
| 1200 | ) |
| 1201 | ); |
| 1202 | |
| 1203 | foreach ( $post_types as $key => $type ) { |
| 1204 | |
| 1205 | // Get all the taxonomies associated with the selected post type. |
| 1206 | $taxonomy = Posts_Helper::get_taxnomies( $key ); |
| 1207 | |
| 1208 | if ( ! empty( $taxonomy ) ) { |
| 1209 | |
| 1210 | // Batch-fetch terms for all taxonomies of this post type in one query. |
| 1211 | $all_terms = get_terms( |
| 1212 | array( |
| 1213 | 'taxonomy' => array_keys( $taxonomy ), |
| 1214 | 'hide_empty' => false, |
| 1215 | ) |
| 1216 | ); |
| 1217 | $terms_by_tax = array(); |
| 1218 | if ( ! is_wp_error( $all_terms ) ) { |
| 1219 | foreach ( $all_terms as $t ) { |
| 1220 | $terms_by_tax[ $t->taxonomy ][] = $t; |
| 1221 | } |
| 1222 | } |
| 1223 | |
| 1224 | // Get all taxonomy values under the taxonomy. |
| 1225 | foreach ( $taxonomy as $index => $tax ) { |
| 1226 | |
| 1227 | $terms = isset( $terms_by_tax[ $index ] ) ? $terms_by_tax[ $index ] : array(); |
| 1228 | |
| 1229 | $related_tax = array(); |
| 1230 | |
| 1231 | if ( ! empty( $terms ) ) { |
| 1232 | |
| 1233 | foreach ( $terms as $t_index => $t_obj ) { |
| 1234 | |
| 1235 | $related_tax[ $t_obj->slug ] = $t_obj->name; |
| 1236 | } |
| 1237 | |
| 1238 | // Add filter rule for the each taxonomy. |
| 1239 | $this->add_control( |
| 1240 | $index . '_' . $key . '_filter_rule', |
| 1241 | array( |
| 1242 | /* translators: %s Taxnomy Label */ |
| 1243 | 'label' => sprintf( __( '%s Filter Rule', 'premium-addons-for-elementor' ), $tax->label ), |
| 1244 | 'type' => Controls_Manager::SELECT, |
| 1245 | 'default' => 'IN', |
| 1246 | 'label_block' => true, |
| 1247 | 'options' => array( |
| 1248 | /* translators: %s: Taxnomy Label */ |
| 1249 | 'IN' => sprintf( __( 'Match %s', 'premium-addons-for-elementor' ), $tax->label ), |
| 1250 | /* translators: %s: Taxnomy Label */ |
| 1251 | 'NOT IN' => sprintf( __( 'Exclude %s', 'premium-addons-for-elementor' ), $tax->label ), |
| 1252 | ), |
| 1253 | 'condition' => array( |
| 1254 | 'post_type_filter' => $key, |
| 1255 | ), |
| 1256 | ) |
| 1257 | ); |
| 1258 | |
| 1259 | // Add select control for each taxonomy. |
| 1260 | $this->add_control( |
| 1261 | 'tax_' . $index . '_' . $key . '_filter', |
| 1262 | array( |
| 1263 | /* translators: %s Taxnomy Label */ |
| 1264 | 'label' => sprintf( __( '%s Filter', 'premium-addons-for-elementor' ), $tax->label ), |
| 1265 | 'type' => Controls_Manager::SELECT2, |
| 1266 | 'default' => '', |
| 1267 | 'multiple' => true, |
| 1268 | 'label_block' => true, |
| 1269 | 'options' => $related_tax, |
| 1270 | 'condition' => array( |
| 1271 | 'post_type_filter' => $key, |
| 1272 | ), |
| 1273 | ) |
| 1274 | ); |
| 1275 | |
| 1276 | } |
| 1277 | } |
| 1278 | } |
| 1279 | } |
| 1280 | |
| 1281 | $this->add_control( |
| 1282 | 'author_filter_rule', |
| 1283 | array( |
| 1284 | 'label' => __( 'Filter By Author Rule', 'premium-addons-for-elementor' ), |
| 1285 | 'type' => Controls_Manager::SELECT, |
| 1286 | 'default' => 'author__in', |
| 1287 | 'label_block' => true, |
| 1288 | 'options' => array( |
| 1289 | 'author__in' => __( 'Match Authors', 'premium-addons-for-elementor' ), |
| 1290 | 'author__not_in' => __( 'Exclude Authors', 'premium-addons-for-elementor' ), |
| 1291 | ), |
| 1292 | 'condition' => array( |
| 1293 | 'post_type_filter!' => array( 'stock', 'gold', 'text' ), |
| 1294 | ), |
| 1295 | ) |
| 1296 | ); |
| 1297 | |
| 1298 | $this->add_control( |
| 1299 | 'premium_blog_users', |
| 1300 | array( |
| 1301 | 'label' => __( 'Authors', 'premium-addons-for-elementor' ), |
| 1302 | 'type' => Controls_Manager::SELECT2, |
| 1303 | 'label_block' => true, |
| 1304 | 'multiple' => true, |
| 1305 | 'options' => Posts_Helper::get_authors(), |
| 1306 | 'condition' => array( |
| 1307 | 'post_type_filter!' => array( 'stock', 'gold', 'text' ), |
| 1308 | ), |
| 1309 | ) |
| 1310 | ); |
| 1311 | |
| 1312 | $this->add_control( |
| 1313 | 'posts_filter_rule', |
| 1314 | array( |
| 1315 | 'label' => __( 'Filter By Post Rule', 'premium-addons-for-elementor' ), |
| 1316 | 'type' => Controls_Manager::SELECT, |
| 1317 | 'default' => 'post__not_in', |
| 1318 | 'label_block' => true, |
| 1319 | 'options' => array( |
| 1320 | 'post__in' => __( 'Match Post', 'premium-addons-for-elementor' ), |
| 1321 | 'post__not_in' => __( 'Exclude Post', 'premium-addons-for-elementor' ), |
| 1322 | ), |
| 1323 | 'condition' => array( |
| 1324 | 'post_type_filter!' => array( 'stock', 'gold', 'related', 'text' ), |
| 1325 | ), |
| 1326 | ) |
| 1327 | ); |
| 1328 | |
| 1329 | $this->add_control( |
| 1330 | 'premium_blog_posts_exclude', |
| 1331 | array( |
| 1332 | 'label' => __( 'Posts', 'premium-addons-for-elementor' ), |
| 1333 | 'type' => Premium_Post_Filter::TYPE, |
| 1334 | 'label_block' => true, |
| 1335 | 'multiple' => true, |
| 1336 | 'source' => 'post', |
| 1337 | 'condition' => array( |
| 1338 | 'post_type_filter' => 'post', |
| 1339 | ), |
| 1340 | ) |
| 1341 | ); |
| 1342 | |
| 1343 | $this->add_control( |
| 1344 | 'custom_posts_filter', |
| 1345 | array( |
| 1346 | 'label' => __( 'Posts', 'premium-addons-for-elementor' ), |
| 1347 | 'type' => Premium_Post_Filter::TYPE, |
| 1348 | 'render_type' => 'template', |
| 1349 | 'label_block' => true, |
| 1350 | 'multiple' => true, |
| 1351 | 'frontend_available' => true, |
| 1352 | 'condition' => array( |
| 1353 | 'post_type_filter!' => array( 'post', 'related', 'stock', 'gold', 'text' ), |
| 1354 | ), |
| 1355 | |
| 1356 | ) |
| 1357 | ); |
| 1358 | |
| 1359 | $this->add_control( |
| 1360 | 'ignore_sticky_posts', |
| 1361 | array( |
| 1362 | 'label' => __( 'Ignore Sticky Posts', 'premium-addons-for-elementor' ), |
| 1363 | 'type' => Controls_Manager::SWITCHER, |
| 1364 | 'label_on' => __( 'Yes', 'premium-addons-for-elementor' ), |
| 1365 | 'label_off' => __( 'No', 'premium-addons-for-elementor' ), |
| 1366 | 'default' => 'yes', |
| 1367 | 'condition' => array( |
| 1368 | 'post_type_filter!' => array( 'stock', 'gold', 'text' ), |
| 1369 | ), |
| 1370 | ) |
| 1371 | ); |
| 1372 | |
| 1373 | $this->add_control( |
| 1374 | 'premium_blog_offset', |
| 1375 | array( |
| 1376 | 'label' => __( 'Offset', 'premium-addons-for-elementor' ), |
| 1377 | 'description' => __( 'This option is used to exclude number of initial posts from being display.', 'premium-addons-for-elementor' ), |
| 1378 | 'type' => Controls_Manager::NUMBER, |
| 1379 | 'default' => '0', |
| 1380 | 'min' => '0', |
| 1381 | 'condition' => array( |
| 1382 | 'post_type_filter!' => array( 'stock', 'gold', 'text' ), |
| 1383 | ), |
| 1384 | ) |
| 1385 | ); |
| 1386 | |
| 1387 | $this->add_control( |
| 1388 | 'query_exclude_current', |
| 1389 | array( |
| 1390 | 'label' => __( 'Exclude Current Post', 'premium-addons-for-elementor' ), |
| 1391 | 'type' => Controls_Manager::SWITCHER, |
| 1392 | 'description' => __( 'This option will remove the current post from the query.', 'premium-addons-for-elementor' ), |
| 1393 | 'label_on' => __( 'Yes', 'premium-addons-for-elementor' ), |
| 1394 | 'label_off' => __( 'No', 'premium-addons-for-elementor' ), |
| 1395 | 'condition' => array( |
| 1396 | 'post_type_filter!' => array( 'stock', 'gold', 'related', 'text' ), |
| 1397 | ), |
| 1398 | ) |
| 1399 | ); |
| 1400 | |
| 1401 | $this->add_control( |
| 1402 | 'premium_blog_order_by', |
| 1403 | array( |
| 1404 | 'label' => __( 'Order By', 'premium-addons-for-elementor' ), |
| 1405 | 'type' => Controls_Manager::SELECT, |
| 1406 | 'label_block' => true, |
| 1407 | 'options' => array( |
| 1408 | 'none' => __( 'None', 'premium-addons-for-elementor' ), |
| 1409 | 'ID' => __( 'ID', 'premium-addons-for-elementor' ), |
| 1410 | 'author' => __( 'Author', 'premium-addons-for-elementor' ), |
| 1411 | 'title' => __( 'Title', 'premium-addons-for-elementor' ), |
| 1412 | 'name' => __( 'Name', 'premium-addons-for-elementor' ), |
| 1413 | 'date' => __( 'Date', 'premium-addons-for-elementor' ), |
| 1414 | 'modified' => __( 'Last Modified', 'premium-addons-for-elementor' ), |
| 1415 | 'rand' => __( 'Random', 'premium-addons-for-elementor' ), |
| 1416 | 'comment_count' => __( 'Number of Comments', 'premium-addons-for-elementor' ), |
| 1417 | ), |
| 1418 | 'default' => 'date', |
| 1419 | 'condition' => array( |
| 1420 | 'post_type_filter!' => array( 'stock', 'gold', 'text' ), |
| 1421 | ), |
| 1422 | ) |
| 1423 | ); |
| 1424 | |
| 1425 | $this->add_control( |
| 1426 | 'premium_blog_order', |
| 1427 | array( |
| 1428 | 'label' => __( 'Order', 'premium-addons-for-elementor' ), |
| 1429 | 'type' => Controls_Manager::SELECT, |
| 1430 | 'label_block' => true, |
| 1431 | 'options' => array( |
| 1432 | 'DESC' => __( 'Descending', 'premium-addons-for-elementor' ), |
| 1433 | 'ASC' => __( 'Ascending', 'premium-addons-for-elementor' ), |
| 1434 | ), |
| 1435 | 'default' => 'DESC', |
| 1436 | 'condition' => array( |
| 1437 | 'post_type_filter!' => array( 'stock', 'gold', 'text' ), |
| 1438 | ), |
| 1439 | ) |
| 1440 | ); |
| 1441 | |
| 1442 | $this->add_control( |
| 1443 | 'empty_query_text', |
| 1444 | array( |
| 1445 | 'label' => __( 'Empty Query Text', 'premium-addons-for-elementor' ), |
| 1446 | 'type' => Controls_Manager::TEXT, |
| 1447 | 'label_block' => true, |
| 1448 | 'dynamic' => array( 'active' => true ), |
| 1449 | 'condition' => array( |
| 1450 | 'post_type_filter!' => array( 'stock', 'gold', 'text' ), |
| 1451 | ), |
| 1452 | ) |
| 1453 | ); |
| 1454 | |
| 1455 | $this->add_responsive_control( |
| 1456 | 'txt_align', |
| 1457 | array( |
| 1458 | 'label' => __( 'Position', 'premium-addons-for-elementor' ), |
| 1459 | 'type' => Controls_Manager::CHOOSE, |
| 1460 | 'options' => array( |
| 1461 | 'flex-start' => array( |
| 1462 | 'title' => __( 'Start', 'premium-addons-for-elementor' ), |
| 1463 | 'icon' => is_rtl() ? 'eicon-h-align-right' : 'eicon-h-align-left', |
| 1464 | ), |
| 1465 | 'center' => array( |
| 1466 | 'title' => __( 'Center', 'premium-addons-for-elementor' ), |
| 1467 | 'icon' => 'eicon-h-align-center', |
| 1468 | ), |
| 1469 | 'flex-end' => array( |
| 1470 | 'title' => __( 'End', 'premium-addons-for-elementor' ), |
| 1471 | 'icon' => is_rtl() ? 'eicon-h-align-left' : 'eicon-h-align-right', |
| 1472 | ), |
| 1473 | ), |
| 1474 | 'default' => 'flex-start', |
| 1475 | 'toggle' => false, |
| 1476 | 'selectors' => array( |
| 1477 | '{{WRAPPER}} .premium-post-ticker__post-wrapper' => 'justify-content: {{VALUE}}', |
| 1478 | ), |
| 1479 | 'condition' => array( |
| 1480 | 'post_type_filter' => 'text', |
| 1481 | ), |
| 1482 | ) |
| 1483 | ); |
| 1484 | |
| 1485 | $this->add_control( |
| 1486 | 'txt_icon_order', |
| 1487 | array( |
| 1488 | 'label' => __( 'Icon Order', 'premium-addons-for-elementor' ), |
| 1489 | 'type' => Controls_Manager::CHOOSE, |
| 1490 | 'toggle' => false, |
| 1491 | 'options' => array( |
| 1492 | '0' => array( |
| 1493 | 'title' => __( 'After Title', 'premium-addons-for-elementor' ), |
| 1494 | 'icon' => is_rtl() ? 'eicon-order-end' : 'eicon-order-start', |
| 1495 | ), |
| 1496 | '2' => array( |
| 1497 | 'title' => __( 'Before Title', 'premium-addons-for-elementor' ), |
| 1498 | 'icon' => is_rtl() ? 'eicon-order-start' : 'eicon-order-end', |
| 1499 | ), |
| 1500 | ), |
| 1501 | 'condition' => array( |
| 1502 | 'post_type_filter' => 'text', |
| 1503 | ), |
| 1504 | 'selectors' => array( |
| 1505 | '{{WRAPPER}} .premium-post-ticker__post-wrapper .premium-post-ticker__post-title' => 'order: {{VALUE}}', |
| 1506 | ), |
| 1507 | ) |
| 1508 | ); |
| 1509 | |
| 1510 | $this->add_responsive_control( |
| 1511 | 'txt_icon_size', |
| 1512 | array( |
| 1513 | 'label' => __( 'Icon Size (px)', 'premium-addons-for-elementor' ), |
| 1514 | 'type' => Controls_Manager::SLIDER, |
| 1515 | 'size_units' => array( 'px' ), |
| 1516 | 'range' => array( |
| 1517 | 'px' => array( |
| 1518 | 'min' => 0, |
| 1519 | 'max' => 500, |
| 1520 | ), |
| 1521 | ), |
| 1522 | 'selectors' => array( |
| 1523 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper.premium-repeater-item i' => 'font-size: {{SIZE}}px;', |
| 1524 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper.premium-repeater-item img' => 'width: {{SIZE}}px', |
| 1525 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper.premium-repeater-item > svg, |
| 1526 | {{WRAPPER}} .premium-post-ticker__icon-wrapper.premium-repeater-item .premium-lottie-animation, |
| 1527 | {{WRAPPER}} .premium-post-ticker__icon-wrapper.premium-repeater-item .premium-drawable-icon' => 'width: {{SIZE}}px; height: {{SIZE}}px; line-height: {{SIZE}}px;', |
| 1528 | ), |
| 1529 | 'condition' => array( |
| 1530 | 'post_type_filter' => 'text', |
| 1531 | ), |
| 1532 | ) |
| 1533 | ); |
| 1534 | |
| 1535 | // $this->add_group_control( |
| 1536 | // Group_Control_Image_Size::get_type(), |
| 1537 | // array( |
| 1538 | // 'name' => 'txt_thumbnail', |
| 1539 | // 'default' => 'full', |
| 1540 | // 'condition' => array( |
| 1541 | // 'post_type_filter' => 'text', |
| 1542 | // ), |
| 1543 | // ) |
| 1544 | // ); |
| 1545 | |
| 1546 | $this->add_responsive_control( |
| 1547 | 'txt_icon_spacing', |
| 1548 | array( |
| 1549 | 'label' => __( 'Spacing (px)', 'premium-addons-for-elementor' ), |
| 1550 | 'type' => Controls_Manager::SLIDER, |
| 1551 | 'size_units' => array( 'px' ), |
| 1552 | 'selectors' => array( |
| 1553 | '{{WRAPPER}} .premium-post-ticker__post-wrapper' => 'column-gap: {{SIZE}}px', |
| 1554 | ), |
| 1555 | 'condition' => array( |
| 1556 | 'post_type_filter' => 'text', |
| 1557 | ), |
| 1558 | ) |
| 1559 | ); |
| 1560 | |
| 1561 | $draw_icon = $this->check_icon_draw(); |
| 1562 | |
| 1563 | $text_repeater = new Repeater(); |
| 1564 | |
| 1565 | $text_repeater->add_control( |
| 1566 | 'text', |
| 1567 | array( |
| 1568 | 'label' => __( 'Text', 'premium-addons-for-elementor' ), |
| 1569 | 'type' => Controls_Manager::TEXT, |
| 1570 | 'dynamic' => array( 'active' => true ), |
| 1571 | 'label_block' => true, |
| 1572 | ) |
| 1573 | ); |
| 1574 | |
| 1575 | $text_repeater->add_control( |
| 1576 | 'item_link', |
| 1577 | array( |
| 1578 | 'label' => __( 'Link', 'premium-addons-for-elementor' ), |
| 1579 | 'type' => Controls_Manager::URL, |
| 1580 | 'dynamic' => array( 'active' => true ), |
| 1581 | 'default' => array( |
| 1582 | 'url' => '#', |
| 1583 | ), |
| 1584 | 'placeholder' => 'https://premiumaddons.com/', |
| 1585 | 'label_block' => true, |
| 1586 | ) |
| 1587 | ); |
| 1588 | |
| 1589 | $text_repeater->add_control( |
| 1590 | 'txt_icon_sw', |
| 1591 | array( |
| 1592 | 'label' => __( 'Text Icon', 'premium-addons-for-elementor' ), |
| 1593 | 'type' => Controls_Manager::SWITCHER, |
| 1594 | 'render_type' => 'template', |
| 1595 | ) |
| 1596 | ); |
| 1597 | |
| 1598 | $text_repeater->add_control( |
| 1599 | 'icon_type', |
| 1600 | array( |
| 1601 | 'label' => __( 'Icon Type', 'premium-addons-for-elementor' ), |
| 1602 | 'type' => Controls_Manager::SELECT, |
| 1603 | 'render_type' => 'template', |
| 1604 | 'options' => array( |
| 1605 | 'icon' => __( 'Icon', 'premium-addons-for-elementor' ), |
| 1606 | 'lottie' => __( 'Lottie Animation', 'premium-addons-for-elementor' ), |
| 1607 | 'image' => __( 'Image', 'premium-addons-for-elementor' ), |
| 1608 | 'svg' => __( 'SVG Code', 'premium-addons-for-elementor' ), |
| 1609 | ), |
| 1610 | 'default' => 'icon', |
| 1611 | 'condition' => array( |
| 1612 | 'txt_icon_sw' => 'yes', |
| 1613 | ), |
| 1614 | ) |
| 1615 | ); |
| 1616 | |
| 1617 | $common_conditions = array( |
| 1618 | 'txt_icon_sw' => 'yes', |
| 1619 | ); |
| 1620 | |
| 1621 | $text_repeater->add_control( |
| 1622 | 'pa_ticker_icon', |
| 1623 | array( |
| 1624 | 'label' => __( 'Choose Icon', 'premium-addons-for-elementor' ), |
| 1625 | 'type' => Controls_Manager::ICONS, |
| 1626 | 'label_block' => false, |
| 1627 | 'skin' => 'inline', |
| 1628 | 'default' => array( |
| 1629 | 'value' => 'fas fa-star', |
| 1630 | 'library' => 'fa-solid', |
| 1631 | ), |
| 1632 | 'condition' => array( |
| 1633 | 'txt_icon_sw' => 'yes', |
| 1634 | 'icon_type' => 'icon', |
| 1635 | ), |
| 1636 | ) |
| 1637 | ); |
| 1638 | |
| 1639 | $text_repeater->add_control( |
| 1640 | 'custom_svg', |
| 1641 | array( |
| 1642 | 'label' => __( 'SVG Code', 'premium-addons-for-elementor' ), |
| 1643 | 'type' => Controls_Manager::TEXTAREA, |
| 1644 | 'description' => 'You can use these sites to create SVGs: <a href="https://danmarshall.github.io/google-font-to-svg-path/" target="_blank">Google Fonts</a> and <a href="https://boxy-svg.com/" target="_blank">Boxy SVG</a>', |
| 1645 | 'condition' => array( |
| 1646 | 'txt_icon_sw' => 'yes', |
| 1647 | 'icon_type' => 'svg', |
| 1648 | ), |
| 1649 | 'ai' => array( |
| 1650 | 'active' => false, |
| 1651 | ), |
| 1652 | ) |
| 1653 | ); |
| 1654 | |
| 1655 | $text_repeater->add_control( |
| 1656 | 'image', |
| 1657 | array( |
| 1658 | 'label' => __( 'Image', 'premium-addons-for-elementor' ), |
| 1659 | 'type' => Controls_Manager::MEDIA, |
| 1660 | 'media_types' => array( 'image' ), |
| 1661 | 'dynamic' => array( 'active' => true ), |
| 1662 | 'condition' => array( |
| 1663 | 'txt_icon_sw' => 'yes', |
| 1664 | 'icon_type' => 'image', |
| 1665 | ), |
| 1666 | ) |
| 1667 | ); |
| 1668 | |
| 1669 | $text_repeater->add_control( |
| 1670 | 'lottie_url', |
| 1671 | array( |
| 1672 | 'label' => __( 'Animation JSON URL', 'premium-addons-for-elementor' ), |
| 1673 | 'type' => Controls_Manager::TEXT, |
| 1674 | 'dynamic' => array( 'active' => true ), |
| 1675 | 'description' => 'Get JSON code URL from <a href="https://lottiefiles.com/" target="_blank">here</a>', |
| 1676 | 'label_block' => true, |
| 1677 | 'condition' => array( |
| 1678 | 'txt_icon_sw' => 'yes', |
| 1679 | 'icon_type' => 'lottie', |
| 1680 | ), |
| 1681 | 'ai' => array( |
| 1682 | 'active' => false, |
| 1683 | ), |
| 1684 | ) |
| 1685 | ); |
| 1686 | |
| 1687 | $animation_conds = array( |
| 1688 | 'terms' => array( |
| 1689 | array( |
| 1690 | 'name' => 'txt_icon_sw', |
| 1691 | 'value' => 'yes', |
| 1692 | ), |
| 1693 | array( |
| 1694 | 'relation' => 'or', |
| 1695 | 'terms' => array( |
| 1696 | array( |
| 1697 | 'name' => 'icon_type', |
| 1698 | 'value' => 'lottie', |
| 1699 | ), |
| 1700 | array( |
| 1701 | 'terms' => array( |
| 1702 | array( |
| 1703 | 'relation' => 'or', |
| 1704 | 'terms' => array( |
| 1705 | array( |
| 1706 | 'name' => 'icon_type', |
| 1707 | 'value' => 'icon', |
| 1708 | ), |
| 1709 | array( |
| 1710 | 'name' => 'icon_type', |
| 1711 | 'value' => 'svg', |
| 1712 | ), |
| 1713 | ), |
| 1714 | ), |
| 1715 | array( |
| 1716 | 'name' => 'draw_svg', |
| 1717 | 'value' => 'yes', |
| 1718 | ), |
| 1719 | ), |
| 1720 | ), |
| 1721 | ), |
| 1722 | ), |
| 1723 | ), |
| 1724 | ); |
| 1725 | |
| 1726 | $text_repeater->add_control( |
| 1727 | 'draw_svg', |
| 1728 | array( |
| 1729 | 'label' => __( 'Draw Icon', 'premium-addons-for-elementor' ), |
| 1730 | 'type' => Controls_Manager::SWITCHER, |
| 1731 | 'description' => __( 'Enable this option to make the icon drawable. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=ZLr0bRe0RAY" target="_blank">tutorial</a>', |
| 1732 | 'classes' => $draw_icon ? '' : 'editor-pa-control-disabled', |
| 1733 | 'condition' => array( |
| 1734 | 'txt_icon_sw' => 'yes', |
| 1735 | 'icon_type' => array( 'icon', 'svg' ), |
| 1736 | 'pa_ticker_icon[library]!' => 'svg', |
| 1737 | ), |
| 1738 | ) |
| 1739 | ); |
| 1740 | |
| 1741 | if ( $draw_icon ) { |
| 1742 | |
| 1743 | $text_repeater->add_control( |
| 1744 | 'path_width', |
| 1745 | array( |
| 1746 | 'label' => __( 'Path Thickness', 'premium-addons-for-elementor' ), |
| 1747 | 'type' => Controls_Manager::SLIDER, |
| 1748 | 'range' => array( |
| 1749 | 'px' => array( |
| 1750 | 'min' => 0, |
| 1751 | 'max' => 50, |
| 1752 | 'step' => 0.1, |
| 1753 | ), |
| 1754 | ), |
| 1755 | 'condition' => array( |
| 1756 | 'txt_icon_sw' => 'yes', |
| 1757 | 'icon_type' => array( 'icon', 'svg' ), |
| 1758 | ), |
| 1759 | 'selectors' => array( |
| 1760 | '{{WRAPPER}} {{CURRENT_ITEM}} .premium-post-ticker__icon-wrapper svg *' => 'stroke-width: {{SIZE}}', |
| 1761 | ), |
| 1762 | ) |
| 1763 | ); |
| 1764 | |
| 1765 | } else { |
| 1766 | Helper_Functions::get_draw_svg_notice( |
| 1767 | $text_repeater, |
| 1768 | 'ticker', |
| 1769 | array( |
| 1770 | 'txt_icon_sw' => 'yes', |
| 1771 | 'icon_type' => array( 'icon', 'svg' ), |
| 1772 | 'pa_ticker_icon[library]!' => 'svg', |
| 1773 | ) |
| 1774 | ); |
| 1775 | } |
| 1776 | |
| 1777 | $text_repeater->add_control( |
| 1778 | 'lottie_loop', |
| 1779 | array( |
| 1780 | 'label' => __( 'Loop', 'premium-addons-for-elementor' ), |
| 1781 | 'type' => Controls_Manager::SWITCHER, |
| 1782 | 'return_value' => 'true', |
| 1783 | 'default' => 'true', |
| 1784 | 'conditions' => $animation_conds, |
| 1785 | ) |
| 1786 | ); |
| 1787 | |
| 1788 | $this->add_control( |
| 1789 | 'text_content', |
| 1790 | array( |
| 1791 | 'label' => __( 'Text', 'premium-addons-for-elementor' ), |
| 1792 | 'type' => Controls_Manager::REPEATER, |
| 1793 | 'default' => array( |
| 1794 | array( |
| 1795 | 'text' => 'Premium News Ticker', |
| 1796 | ), |
| 1797 | array( |
| 1798 | 'text' => 'Premium Addons For Elementor', |
| 1799 | ), |
| 1800 | ), |
| 1801 | 'fields' => $text_repeater->get_controls(), |
| 1802 | 'title_field' => '{{{ text }}}', |
| 1803 | 'prevent_empty' => false, |
| 1804 | 'condition' => array( |
| 1805 | 'post_type_filter' => 'text', |
| 1806 | ), |
| 1807 | ) |
| 1808 | ); |
| 1809 | |
| 1810 | $this->papro_activated = Helper_Functions::check_papro_version(); |
| 1811 | if ( $this->papro_activated ) { |
| 1812 | do_action( 'pa_ticker_stock_query', $this ); |
| 1813 | |
| 1814 | } |
| 1815 | |
| 1816 | $this->end_controls_section(); |
| 1817 | } |
| 1818 | |
| 1819 | /** |
| 1820 | * Adds Posts controls. |
| 1821 | * |
| 1822 | * @access private |
| 1823 | * @since 4.9.37 |
| 1824 | */ |
| 1825 | private function add_posts_section_controls() { |
| 1826 | |
| 1827 | $this->start_controls_section( |
| 1828 | 'pa_ticker_posts_section', |
| 1829 | array( |
| 1830 | 'label' => __( 'Post Options', 'premium-addons-for-elementor' ), |
| 1831 | 'condition' => array( |
| 1832 | 'post_type_filter!' => array( 'stock', 'gold', 'text' ), |
| 1833 | ), |
| 1834 | ) |
| 1835 | ); |
| 1836 | |
| 1837 | $this->add_control( |
| 1838 | 'new_tab', |
| 1839 | array( |
| 1840 | 'label' => __( 'Open Post Link in New Tab', 'premium-addons-for-elementor' ), |
| 1841 | 'type' => Controls_Manager::SWITCHER, |
| 1842 | 'default' => 'yes', |
| 1843 | ) |
| 1844 | ); |
| 1845 | |
| 1846 | $this->add_control( |
| 1847 | 'article_tag_switcher', |
| 1848 | array( |
| 1849 | 'label' => __( 'Change Post HTML Tag To Article', 'premium-addons-for-elementor' ), |
| 1850 | 'type' => Controls_Manager::SWITCHER, |
| 1851 | ) |
| 1852 | ); |
| 1853 | |
| 1854 | $this->add_control( |
| 1855 | 'content_length', |
| 1856 | array( |
| 1857 | 'label' => __( 'Content Length (words)', 'premium-addons-for-elementor' ), |
| 1858 | 'description' => __( 'Set the number of words of the content, leave it empty to display the full length.', 'premium-addons-for-elementor' ), |
| 1859 | 'type' => Controls_Manager::NUMBER, |
| 1860 | 'min' => '0', |
| 1861 | ) |
| 1862 | ); |
| 1863 | |
| 1864 | $this->add_control( |
| 1865 | 'post_img', |
| 1866 | array( |
| 1867 | 'label' => __( 'Show Post Thumbnail', 'premium-addons-for-elementor' ), |
| 1868 | 'type' => Controls_Manager::SWITCHER, |
| 1869 | ) |
| 1870 | ); |
| 1871 | |
| 1872 | $this->add_group_control( |
| 1873 | Group_Control_Image_Size::get_type(), |
| 1874 | array( |
| 1875 | 'name' => 'image', |
| 1876 | 'default' => 'thumbnail', |
| 1877 | 'condition' => array( |
| 1878 | 'post_img' => 'yes', |
| 1879 | ), |
| 1880 | ) |
| 1881 | ); |
| 1882 | |
| 1883 | $this->add_responsive_control( |
| 1884 | 'img_width', |
| 1885 | array( |
| 1886 | 'label' => __( 'Width (px)', 'premium-addons-for-elementor' ), |
| 1887 | 'type' => Controls_Manager::SLIDER, |
| 1888 | 'size_units' => array( 'px', 'em' ), |
| 1889 | 'range' => array( |
| 1890 | 'px' => array( |
| 1891 | 'min' => 0, |
| 1892 | 'max' => 500, |
| 1893 | ), |
| 1894 | ), |
| 1895 | 'selectors' => array( |
| 1896 | '{{WRAPPER}} .premium-post-ticker__thumbnail-wrapper img' => 'width: {{SIZE}}{{UNIT}};', |
| 1897 | ), |
| 1898 | 'condition' => array( |
| 1899 | 'post_img' => 'yes', |
| 1900 | ), |
| 1901 | ) |
| 1902 | ); |
| 1903 | |
| 1904 | $this->add_control( |
| 1905 | 'hide_thumb_on', |
| 1906 | array( |
| 1907 | 'label' => __( 'Hide Thumbnail On', 'premium-addons-for-elementor' ), |
| 1908 | 'type' => Controls_Manager::SELECT2, |
| 1909 | 'options' => Helper_Functions::get_all_breakpoints(), |
| 1910 | 'separator' => 'after', |
| 1911 | 'multiple' => true, |
| 1912 | 'label_block' => true, |
| 1913 | 'default' => array(), |
| 1914 | 'condition' => array( |
| 1915 | 'post_img' => 'yes', |
| 1916 | ), |
| 1917 | ) |
| 1918 | ); |
| 1919 | |
| 1920 | $this->add_control( |
| 1921 | 'author_meta', |
| 1922 | array( |
| 1923 | 'label' => __( 'Author Meta', 'premium-addons-for-elementor' ), |
| 1924 | 'type' => Controls_Manager::SWITCHER, |
| 1925 | ) |
| 1926 | ); |
| 1927 | |
| 1928 | $this->add_control( |
| 1929 | 'hide_author_on', |
| 1930 | array( |
| 1931 | 'label' => __( 'Hide Author On', 'premium-addons-for-elementor' ), |
| 1932 | 'type' => Controls_Manager::SELECT2, |
| 1933 | 'options' => Helper_Functions::get_all_breakpoints(), |
| 1934 | 'separator' => 'after', |
| 1935 | 'multiple' => true, |
| 1936 | 'label_block' => true, |
| 1937 | 'default' => array(), |
| 1938 | 'condition' => array( |
| 1939 | 'author_meta' => 'yes', |
| 1940 | ), |
| 1941 | ) |
| 1942 | ); |
| 1943 | |
| 1944 | $this->add_control( |
| 1945 | 'date_meta', |
| 1946 | array( |
| 1947 | 'label' => __( 'Date Meta', 'premium-addons-for-elementor' ), |
| 1948 | 'type' => Controls_Manager::SWITCHER, |
| 1949 | 'default' => 'yes', |
| 1950 | ) |
| 1951 | ); |
| 1952 | |
| 1953 | $this->add_control( |
| 1954 | 'post_date_format', |
| 1955 | array( |
| 1956 | 'label' => __( 'Date Format', 'premium-addons-for-elementor' ), |
| 1957 | 'type' => Controls_Manager::TEXT, |
| 1958 | 'label_block' => true, |
| 1959 | 'description' => __( 'Know more abour date format from ', 'premium-addons-for-elementor' ) . '<a href="https://wordpress.org/documentation/article/customize-date-and-time-format/" target="_blank">here</a>', |
| 1960 | 'default' => get_option( 'date_format' ), |
| 1961 | 'condition' => array( |
| 1962 | 'date_meta' => 'yes', |
| 1963 | ), |
| 1964 | 'ai' => array( |
| 1965 | 'active' => false, |
| 1966 | ), |
| 1967 | ) |
| 1968 | ); |
| 1969 | |
| 1970 | $this->add_control( |
| 1971 | 'hide_post_date_on', |
| 1972 | array( |
| 1973 | 'label' => __( 'Hide Date On', 'premium-addons-for-elementor' ), |
| 1974 | 'type' => Controls_Manager::SELECT2, |
| 1975 | 'options' => Helper_Functions::get_all_breakpoints(), |
| 1976 | 'multiple' => true, |
| 1977 | 'label_block' => true, |
| 1978 | 'default' => array(), |
| 1979 | 'condition' => array( |
| 1980 | 'date_meta' => 'yes', |
| 1981 | ), |
| 1982 | ) |
| 1983 | ); |
| 1984 | |
| 1985 | $this->end_controls_section(); |
| 1986 | } |
| 1987 | |
| 1988 | private function add_slider_section_controls() { |
| 1989 | |
| 1990 | $this->start_controls_section( |
| 1991 | 'slider_section_tab', |
| 1992 | array( |
| 1993 | 'label' => __( 'Animation Settings', 'premium-addons-for-elementor' ), |
| 1994 | ) |
| 1995 | ); |
| 1996 | |
| 1997 | $this->add_control( |
| 1998 | 'slides_to_show', |
| 1999 | array( |
| 2000 | 'label' => __( 'Slides To Show', 'premium-addons-for-elementor' ), |
| 2001 | 'type' => Controls_Manager::NUMBER, |
| 2002 | 'default' => 3, |
| 2003 | 'condition' => array( |
| 2004 | 'layout' => 'layout-4', |
| 2005 | ), |
| 2006 | ) |
| 2007 | ); |
| 2008 | |
| 2009 | $this->add_control( |
| 2010 | 'vertical', |
| 2011 | array( |
| 2012 | 'label' => __( 'Vertical', 'premium-addons-for-elementor' ), |
| 2013 | 'type' => Controls_Manager::SWITCHER, |
| 2014 | 'condition' => array( |
| 2015 | 'fade!' => 'yes', |
| 2016 | 'typing!' => 'yes', |
| 2017 | 'layout!' => 'layout-4', |
| 2018 | ), |
| 2019 | ) |
| 2020 | ); |
| 2021 | |
| 2022 | $this->add_control( |
| 2023 | 'fade', |
| 2024 | array( |
| 2025 | 'label' => __( 'Fade', 'premium-addons-for-elementor' ), |
| 2026 | 'type' => Controls_Manager::SWITCHER, |
| 2027 | 'prefix_class' => 'premium-fade-', |
| 2028 | 'render_type' => 'template', |
| 2029 | 'condition' => array( |
| 2030 | 'layout!' => 'layout-4', |
| 2031 | 'infinite!' => 'yes', |
| 2032 | 'typing!' => 'yes', |
| 2033 | ), |
| 2034 | ) |
| 2035 | ); |
| 2036 | |
| 2037 | $this->add_control( |
| 2038 | 'auto_play', |
| 2039 | array( |
| 2040 | 'label' => __( 'Autoplay', 'premium-addons-for-elementor' ), |
| 2041 | 'type' => Controls_Manager::SWITCHER, |
| 2042 | 'default' => 'yes', |
| 2043 | 'condition' => array( |
| 2044 | 'infinite!' => 'yes', |
| 2045 | ), |
| 2046 | ) |
| 2047 | ); |
| 2048 | |
| 2049 | $this->add_control( |
| 2050 | 'autoplay_speed', |
| 2051 | array( |
| 2052 | 'label' => __( 'Autoplay Speed (ms)', 'premium-addons-for-elementor' ), |
| 2053 | 'type' => Controls_Manager::NUMBER, |
| 2054 | 'default' => 5000, |
| 2055 | 'condition' => array( |
| 2056 | 'auto_play' => 'yes', |
| 2057 | 'infinite!' => 'yes', |
| 2058 | ), |
| 2059 | ) |
| 2060 | ); |
| 2061 | |
| 2062 | $this->add_control( |
| 2063 | 'speed', |
| 2064 | array( |
| 2065 | 'label' => __( 'Animation Speed (ms)', 'premium-addons-for-elementor' ), |
| 2066 | 'description' => __( 'Set the speed of the animation in milliseconds (ms)', 'premium-addons-for-elementor' ), |
| 2067 | 'type' => Controls_Manager::NUMBER, |
| 2068 | 'default' => 5000, |
| 2069 | 'render_type' => 'template', |
| 2070 | ) |
| 2071 | ); |
| 2072 | |
| 2073 | $this->add_control( |
| 2074 | 'carousel_arrows', |
| 2075 | array( |
| 2076 | 'label' => __( 'Navigation Arrows', 'premium-addons-for-elementor' ), |
| 2077 | 'type' => Controls_Manager::SWITCHER, |
| 2078 | 'default' => 'yes', |
| 2079 | 'condition' => array( |
| 2080 | 'infinite!' => 'yes', |
| 2081 | ), |
| 2082 | ) |
| 2083 | ); |
| 2084 | |
| 2085 | $this->add_control( |
| 2086 | 'pause_on_hover', |
| 2087 | array( |
| 2088 | 'label' => __( 'Pause On Hover', 'premium-addons-for-elementor' ), |
| 2089 | 'type' => Controls_Manager::SWITCHER, |
| 2090 | 'default' => 'yes', |
| 2091 | 'conditions' => array( |
| 2092 | 'relation' => 'or', |
| 2093 | 'terms' => array( |
| 2094 | array( |
| 2095 | 'name' => 'auto_play', |
| 2096 | 'value' => 'yes', |
| 2097 | ), |
| 2098 | array( |
| 2099 | 'name' => 'infinite', |
| 2100 | 'value' => 'yes', |
| 2101 | ), |
| 2102 | ), |
| 2103 | ), |
| 2104 | ) |
| 2105 | ); |
| 2106 | |
| 2107 | $this->end_controls_section(); |
| 2108 | } |
| 2109 | |
| 2110 | private function add_helpful_info_section() { |
| 2111 | |
| 2112 | $this->start_controls_section( |
| 2113 | 'section_pa_docs', |
| 2114 | array( |
| 2115 | 'label' => __( 'Help & Docs', 'premium-addons-for-elementor' ), |
| 2116 | ) |
| 2117 | ); |
| 2118 | |
| 2119 | $docs = array( |
| 2120 | 'https://premiumaddons.com/docs/elementor-news-ticker-widget/' => __( 'Getting started »', 'premium-addons-for-elementor' ), |
| 2121 | ); |
| 2122 | |
| 2123 | $doc_index = 1; |
| 2124 | foreach ( $docs as $url => $title ) { |
| 2125 | |
| 2126 | $doc_url = Helper_Functions::get_campaign_link( $url, 'ticker-widget', 'wp-editor', 'get-support' ); |
| 2127 | |
| 2128 | $this->add_control( |
| 2129 | 'doc_' . $doc_index, |
| 2130 | array( |
| 2131 | 'type' => Controls_Manager::RAW_HTML, |
| 2132 | 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc_url, $title ), |
| 2133 | 'content_classes' => 'editor-pa-doc', |
| 2134 | ) |
| 2135 | ); |
| 2136 | |
| 2137 | ++$doc_index; |
| 2138 | |
| 2139 | } |
| 2140 | |
| 2141 | Helper_Functions::register_element_feedback_controls( $this ); |
| 2142 | |
| 2143 | $this->end_controls_section(); |
| 2144 | } |
| 2145 | |
| 2146 | /** Style Controls.*/ |
| 2147 | |
| 2148 | /** |
| 2149 | * Adds posts title style controls. |
| 2150 | * |
| 2151 | * @access private |
| 2152 | * @since 4.9.37 |
| 2153 | */ |
| 2154 | private function add_ticker_title_style() { |
| 2155 | |
| 2156 | $draw_icon = $this->check_icon_draw(); |
| 2157 | |
| 2158 | $this->start_controls_section( |
| 2159 | 'pa_ticker_title_tab', |
| 2160 | array( |
| 2161 | 'label' => __( 'Title', 'premium-addons-for-elementor' ), |
| 2162 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2163 | 'condition' => array( |
| 2164 | 'ticker_title!' => '', |
| 2165 | ), |
| 2166 | ) |
| 2167 | ); |
| 2168 | |
| 2169 | $this->add_group_control( |
| 2170 | Group_Control_Typography::get_type(), |
| 2171 | array( |
| 2172 | 'name' => 'ticker_title_typo', |
| 2173 | 'selector' => '{{WRAPPER}} .premium-post-ticker__title', |
| 2174 | ) |
| 2175 | ); |
| 2176 | |
| 2177 | $this->add_control( |
| 2178 | 'ticker_title_color', |
| 2179 | array( |
| 2180 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 2181 | 'type' => Controls_Manager::COLOR, |
| 2182 | 'selectors' => array( |
| 2183 | '{{WRAPPER}} .premium-post-ticker__title' => 'color: {{VALUE}}', |
| 2184 | ), |
| 2185 | ) |
| 2186 | ); |
| 2187 | |
| 2188 | $this->add_control( |
| 2189 | 'title_icon_color', |
| 2190 | array( |
| 2191 | 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ), |
| 2192 | 'type' => Controls_Manager::COLOR, |
| 2193 | 'selectors' => array( |
| 2194 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item) i' => 'color: {{VALUE}}', |
| 2195 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item) .premium-drawable-icon *, |
| 2196 | {{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item) svg:not([class*="premium-"])' => 'fill: {{VALUE}};', |
| 2197 | ), |
| 2198 | 'condition' => array( |
| 2199 | 'ticker_icon_sw' => 'yes', |
| 2200 | 'icon_type' => 'icon', |
| 2201 | ), |
| 2202 | ) |
| 2203 | ); |
| 2204 | |
| 2205 | if ( $draw_icon ) { |
| 2206 | $this->add_control( |
| 2207 | 'stroke_color', |
| 2208 | array( |
| 2209 | 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ), |
| 2210 | 'type' => Controls_Manager::COLOR, |
| 2211 | 'global' => array( |
| 2212 | 'default' => Global_Colors::COLOR_ACCENT, |
| 2213 | ), |
| 2214 | 'condition' => array( |
| 2215 | 'icon_type' => array( 'icon', 'svg' ), |
| 2216 | ), |
| 2217 | 'selectors' => array( |
| 2218 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item) .premium-drawable-icon *, |
| 2219 | {{WRAPPER}} .premium-post-ticker__icon-wrapper:not(.premium-repeater-item) svg:not([class*="premium-"])' => 'stroke: {{VALUE}};', |
| 2220 | ), |
| 2221 | ) |
| 2222 | ); |
| 2223 | } |
| 2224 | |
| 2225 | $this->add_group_control( |
| 2226 | Group_Control_Text_Shadow::get_type(), |
| 2227 | array( |
| 2228 | 'name' => 'ticker_title_text_shadow', |
| 2229 | 'selector' => '{{WRAPPER}} .premium-post-ticker__title', |
| 2230 | ) |
| 2231 | ); |
| 2232 | |
| 2233 | $this->add_group_control( |
| 2234 | Premium_Background::get_type(), |
| 2235 | array( |
| 2236 | 'name' => 'ticker_title_bg', |
| 2237 | 'types' => array( 'classic', 'gradient' ), |
| 2238 | 'fields_options' => array( |
| 2239 | 'background' => array( |
| 2240 | 'default' => 'classic', |
| 2241 | ), |
| 2242 | 'color' => array( |
| 2243 | 'global' => array( |
| 2244 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 2245 | ), |
| 2246 | ), |
| 2247 | ), |
| 2248 | 'selector' => '{{WRAPPER}} .premium-post-ticker__title-wrapper, {{WRAPPER}}.premium-post-ticker__layout-2 .premium-post-ticker__title-wrapper::after, {{WRAPPER}}.premium-post-ticker__layout-3 .premium-post-ticker__header-wrapper::after', |
| 2249 | ) |
| 2250 | ); |
| 2251 | |
| 2252 | $this->add_group_control( |
| 2253 | Group_Control_Border::get_type(), |
| 2254 | array( |
| 2255 | 'name' => 'ticker_title_border', |
| 2256 | 'selector' => '{{WRAPPER}} .premium-post-ticker__title-wrapper', |
| 2257 | 'condition' => array( |
| 2258 | 'layout!' => 'layout-3', |
| 2259 | ), |
| 2260 | ) |
| 2261 | ); |
| 2262 | |
| 2263 | $this->add_control( |
| 2264 | 'ticker_title_border_radius', |
| 2265 | array( |
| 2266 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2267 | 'type' => Controls_Manager::DIMENSIONS, |
| 2268 | 'size_units' => array( 'px', 'em', '%' ), |
| 2269 | 'selectors' => array( |
| 2270 | '{{WRAPPER}} .premium-post-ticker__title-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2271 | ), |
| 2272 | 'condition' => array( |
| 2273 | 'layout!' => 'layout-3', |
| 2274 | 'title_adv_radius!' => 'yes', |
| 2275 | ), |
| 2276 | ) |
| 2277 | ); |
| 2278 | |
| 2279 | $this->add_control( |
| 2280 | 'title_adv_radius', |
| 2281 | array( |
| 2282 | 'label' => __( 'Advanced Border Radius', 'premium-addons-for-elementor' ), |
| 2283 | 'type' => Controls_Manager::SWITCHER, |
| 2284 | 'description' => __( 'Apply custom radius values. Get the radius value from ', 'premium-addons-for-elementor' ) . '<a href="https://9elements.github.io/fancy-border-radius/" target="_blank">here</a>' . __( '. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=S0BJazLHV-M" target="_blank">tutorial</a>', |
| 2285 | ) |
| 2286 | ); |
| 2287 | |
| 2288 | $this->add_control( |
| 2289 | 'title_adv_radius_value', |
| 2290 | array( |
| 2291 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2292 | 'type' => Controls_Manager::TEXT, |
| 2293 | 'dynamic' => array( 'active' => true ), |
| 2294 | 'selectors' => array( |
| 2295 | '{{WRAPPER}} .premium-post-ticker__title-wrapper' => 'border-radius: {{VALUE}};', |
| 2296 | ), |
| 2297 | 'condition' => array( |
| 2298 | 'title_adv_radius' => 'yes', |
| 2299 | ), |
| 2300 | 'ai' => array( |
| 2301 | 'active' => false, |
| 2302 | ), |
| 2303 | ) |
| 2304 | ); |
| 2305 | |
| 2306 | $this->add_responsive_control( |
| 2307 | 'ticker_title_padding', |
| 2308 | array( |
| 2309 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 2310 | 'type' => Controls_Manager::DIMENSIONS, |
| 2311 | 'size_units' => array( 'px', 'em', '%' ), |
| 2312 | 'selectors' => array( |
| 2313 | '{{WRAPPER}} .premium-post-ticker__title-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2314 | ), |
| 2315 | ) |
| 2316 | ); |
| 2317 | |
| 2318 | $this->end_controls_section(); |
| 2319 | } |
| 2320 | |
| 2321 | private function add_ticker_date_style() { |
| 2322 | |
| 2323 | $this->start_controls_section( |
| 2324 | 'pa_ticker_date_tab', |
| 2325 | array( |
| 2326 | 'label' => __( 'Date', 'premium-addons-for-elementor' ), |
| 2327 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2328 | 'condition' => array( |
| 2329 | 'show_date' => 'yes', |
| 2330 | ), |
| 2331 | ) |
| 2332 | ); |
| 2333 | |
| 2334 | $this->add_group_control( |
| 2335 | Group_Control_Typography::get_type(), |
| 2336 | array( |
| 2337 | 'name' => 'date_typo', |
| 2338 | 'selector' => '{{WRAPPER}} .premium-post-ticker__date-wrapper', |
| 2339 | ) |
| 2340 | ); |
| 2341 | |
| 2342 | $this->add_control( |
| 2343 | 'date_color', |
| 2344 | array( |
| 2345 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 2346 | 'type' => Controls_Manager::COLOR, |
| 2347 | 'selectors' => array( |
| 2348 | '{{WRAPPER}} .premium-post-ticker__date' => 'color: {{VALUE}}', |
| 2349 | ), |
| 2350 | ) |
| 2351 | ); |
| 2352 | |
| 2353 | $this->add_group_control( |
| 2354 | Group_Control_Text_Shadow::get_type(), |
| 2355 | array( |
| 2356 | 'name' => 'date_text_shadow', |
| 2357 | 'selector' => '{{WRAPPER}} .premium-post-ticker__date-wrapper', |
| 2358 | ) |
| 2359 | ); |
| 2360 | |
| 2361 | $this->add_group_control( |
| 2362 | Premium_Background::get_type(), |
| 2363 | array( |
| 2364 | 'name' => 'date_bg', |
| 2365 | 'types' => array( 'classic', 'gradient' ), |
| 2366 | 'selector' => '{{WRAPPER}} .premium-post-ticker__date-wrapper', |
| 2367 | ) |
| 2368 | ); |
| 2369 | |
| 2370 | $this->add_group_control( |
| 2371 | Group_Control_Border::get_type(), |
| 2372 | array( |
| 2373 | 'name' => 'date_border', |
| 2374 | 'selector' => '{{WRAPPER}} .premium-post-ticker__date-wrapper', |
| 2375 | 'condition' => array( |
| 2376 | 'layout!' => 'layout-3', |
| 2377 | ), |
| 2378 | ) |
| 2379 | ); |
| 2380 | |
| 2381 | $this->add_control( |
| 2382 | 'date_border_radius', |
| 2383 | array( |
| 2384 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2385 | 'type' => Controls_Manager::DIMENSIONS, |
| 2386 | 'size_units' => array( 'px', 'em', '%' ), |
| 2387 | 'selectors' => array( |
| 2388 | '{{WRAPPER}} .premium-post-ticker__date-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2389 | ), |
| 2390 | 'condition' => array( |
| 2391 | 'layout!' => 'layout-3', |
| 2392 | ), |
| 2393 | ) |
| 2394 | ); |
| 2395 | |
| 2396 | $this->add_responsive_control( |
| 2397 | 'date_padding', |
| 2398 | array( |
| 2399 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 2400 | 'type' => Controls_Manager::DIMENSIONS, |
| 2401 | 'size_units' => array( 'px', 'em', '%' ), |
| 2402 | 'selectors' => array( |
| 2403 | '{{WRAPPER}} .premium-post-ticker__date-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2404 | ), |
| 2405 | ) |
| 2406 | ); |
| 2407 | |
| 2408 | $this->add_responsive_control( |
| 2409 | 'date_margin', |
| 2410 | array( |
| 2411 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 2412 | 'type' => Controls_Manager::DIMENSIONS, |
| 2413 | 'size_units' => array( 'px', 'em', '%' ), |
| 2414 | 'selectors' => array( |
| 2415 | '{{WRAPPER}} .premium-post-ticker__date-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2416 | ), |
| 2417 | 'condition' => array( |
| 2418 | 'layout!' => 'layout-3', |
| 2419 | ), |
| 2420 | ) |
| 2421 | ); |
| 2422 | |
| 2423 | $this->end_controls_section(); |
| 2424 | } |
| 2425 | |
| 2426 | private function add_posts_style() { |
| 2427 | |
| 2428 | $draw_icon = $this->check_icon_draw(); |
| 2429 | |
| 2430 | $this->start_controls_section( |
| 2431 | 'pa_posts_style', |
| 2432 | array( |
| 2433 | 'label' => __( 'Ticker Element', 'premium-addons-for-elementor' ), |
| 2434 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2435 | ) |
| 2436 | ); |
| 2437 | |
| 2438 | // content. |
| 2439 | $this->add_control( |
| 2440 | 'pa_post_title_heading', |
| 2441 | array( |
| 2442 | 'label' => __( 'Content', 'premium-addons-for-elementor' ), |
| 2443 | 'type' => Controls_Manager::HEADING, |
| 2444 | 'separator' => 'before', |
| 2445 | 'condition' => array( |
| 2446 | 'post_type_filter!' => array( 'gold', 'stock' ), |
| 2447 | ), |
| 2448 | ) |
| 2449 | ); |
| 2450 | |
| 2451 | $this->add_group_control( |
| 2452 | Group_Control_Typography::get_type(), |
| 2453 | array( |
| 2454 | 'name' => 'pa_post_title_typo', |
| 2455 | 'selector' => '{{WRAPPER}} .premium-post-ticker__post-title a', |
| 2456 | 'condition' => array( |
| 2457 | 'post_type_filter!' => array( 'gold', 'stock' ), |
| 2458 | ), |
| 2459 | ) |
| 2460 | ); |
| 2461 | |
| 2462 | $this->add_control( |
| 2463 | 'pa_post_title_color', |
| 2464 | array( |
| 2465 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 2466 | 'type' => Controls_Manager::COLOR, |
| 2467 | 'selectors' => array( |
| 2468 | '{{WRAPPER}} .premium-post-ticker__post-title a, {{WRAPPER}} .premium-text-typing::after' => 'color: {{VALUE}};', |
| 2469 | ), |
| 2470 | 'condition' => array( |
| 2471 | 'post_type_filter!' => array( 'gold', 'stock' ), |
| 2472 | ), |
| 2473 | ) |
| 2474 | ); |
| 2475 | |
| 2476 | $this->add_control( |
| 2477 | 'pa_post_title_color_hov', |
| 2478 | array( |
| 2479 | 'label' => __( 'Hover Color', 'premium-addons-for-elementor' ), |
| 2480 | 'type' => Controls_Manager::COLOR, |
| 2481 | 'selectors' => array( |
| 2482 | '{{WRAPPER}} .premium-post-ticker__post-title:hover a, {{WRAPPER}} .premium-text-typing:hover::after' => 'color: {{VALUE}};', |
| 2483 | ), |
| 2484 | 'condition' => array( |
| 2485 | 'post_type_filter!' => array( 'gold', 'stock' ), |
| 2486 | ), |
| 2487 | ) |
| 2488 | ); |
| 2489 | |
| 2490 | $this->add_group_control( |
| 2491 | Group_Control_Text_Stroke::get_type(), |
| 2492 | array( |
| 2493 | 'name' => 'element_text_stroke', |
| 2494 | 'separator' => 'after', |
| 2495 | 'selector' => '{{WRAPPER}} .premium-post-ticker__post-title', |
| 2496 | 'condition' => array( |
| 2497 | 'post_type_filter!' => array( 'gold', 'stock' ), |
| 2498 | ), |
| 2499 | ) |
| 2500 | ); |
| 2501 | |
| 2502 | $this->add_control( |
| 2503 | 'text_icon_color', |
| 2504 | array( |
| 2505 | 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ), |
| 2506 | 'type' => Controls_Manager::COLOR, |
| 2507 | 'separator' => 'before', |
| 2508 | 'selectors' => array( |
| 2509 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper.premium-repeater-item i' => 'color: {{VALUE}}', |
| 2510 | '{{WRAPPER}} .premium-post-ticker__icon-wrapper.premium-repeater-item .premium-drawable-icon *, |
| 2511 | {{WRAPPER}} .premium-post-ticker__icon-wrapper.premium-repeater-item svg:not([class*="premium-"])' => 'fill: {{VALUE}};', |
| 2512 | ), |
| 2513 | 'condition' => array( |
| 2514 | 'post_type_filter' => 'text', |
| 2515 | ), |
| 2516 | ) |
| 2517 | ); |
| 2518 | |
| 2519 | if ( $draw_icon ) { |
| 2520 | $this->add_control( |
| 2521 | 'text_stroke_color', |
| 2522 | array( |
| 2523 | 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ), |
| 2524 | 'type' => Controls_Manager::COLOR, |
| 2525 | 'global' => array( |
| 2526 | 'default' => Global_Colors::COLOR_ACCENT, |
| 2527 | ), |
| 2528 | 'condition' => array( |
| 2529 | 'post_type_filter' => 'text', |
| 2530 | ), |
| 2531 | 'selectors' => array( |
| 2532 | '{{WRAPPER}} .premium-drawable-icon *, {{WRAPPER}} svg:not([class*="premium-"])' => 'stroke: {{VALUE}};', |
| 2533 | ), |
| 2534 | ) |
| 2535 | ); |
| 2536 | } |
| 2537 | |
| 2538 | // Date. |
| 2539 | $this->add_control( |
| 2540 | 'pa_post_date_heading', |
| 2541 | array( |
| 2542 | 'label' => __( 'Date', 'premium-addons-for-elementor' ), |
| 2543 | 'type' => Controls_Manager::HEADING, |
| 2544 | 'separator' => 'before', |
| 2545 | 'condition' => array( |
| 2546 | 'date_meta' => 'yes', |
| 2547 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2548 | ), |
| 2549 | ) |
| 2550 | ); |
| 2551 | |
| 2552 | $this->add_group_control( |
| 2553 | Group_Control_Typography::get_type(), |
| 2554 | array( |
| 2555 | 'name' => 'pa_post_date_typo', |
| 2556 | 'global' => array( |
| 2557 | 'default' => Global_Typography::TYPOGRAPHY_SECONDARY, |
| 2558 | ), |
| 2559 | 'selector' => '{{WRAPPER}} .premium-post-ticker__post-date span', |
| 2560 | 'condition' => array( |
| 2561 | 'date_meta' => 'yes', |
| 2562 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2563 | ), |
| 2564 | ) |
| 2565 | ); |
| 2566 | |
| 2567 | $this->add_control( |
| 2568 | 'pa_post_date_color', |
| 2569 | array( |
| 2570 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 2571 | 'type' => Controls_Manager::COLOR, |
| 2572 | 'selectors' => array( |
| 2573 | '{{WRAPPER}} .premium-post-ticker__post-date span' => 'color: {{VALUE}};', |
| 2574 | ), |
| 2575 | 'condition' => array( |
| 2576 | 'date_meta' => 'yes', |
| 2577 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2578 | ), |
| 2579 | ) |
| 2580 | ); |
| 2581 | |
| 2582 | // Author. |
| 2583 | $this->add_control( |
| 2584 | 'pa_author_heading', |
| 2585 | array( |
| 2586 | 'label' => __( 'Author', 'premium-addons-for-elementor' ), |
| 2587 | 'type' => Controls_Manager::HEADING, |
| 2588 | 'separator' => 'before', |
| 2589 | 'condition' => array( |
| 2590 | 'author_meta' => 'yes', |
| 2591 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2592 | ), |
| 2593 | ) |
| 2594 | ); |
| 2595 | |
| 2596 | $this->add_group_control( |
| 2597 | Group_Control_Typography::get_type(), |
| 2598 | array( |
| 2599 | 'name' => 'pa_author_typo', |
| 2600 | 'global' => array( |
| 2601 | 'default' => Global_Typography::TYPOGRAPHY_SECONDARY, |
| 2602 | ), |
| 2603 | 'fields_options' => array( |
| 2604 | 'font_size' => array( |
| 2605 | 'selectors' => array( |
| 2606 | '{{WRAPPER}} .premium-post-ticker__post-author a, {{WRAPPER}} .premium-post-ticker__post-author i' => 'font-size: {{SIZE}}{{UNIT}}', |
| 2607 | ), |
| 2608 | ), |
| 2609 | ), |
| 2610 | 'selector' => '{{WRAPPER}} .premium-post-ticker__post-author a', |
| 2611 | 'condition' => array( |
| 2612 | 'author_meta' => 'yes', |
| 2613 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2614 | ), |
| 2615 | ) |
| 2616 | ); |
| 2617 | |
| 2618 | $this->add_control( |
| 2619 | 'pa_author_color', |
| 2620 | array( |
| 2621 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 2622 | 'type' => Controls_Manager::COLOR, |
| 2623 | 'selectors' => array( |
| 2624 | '{{WRAPPER}} .premium-post-ticker__post-author *' => 'color: {{VALUE}};', |
| 2625 | ), |
| 2626 | 'condition' => array( |
| 2627 | 'author_meta' => 'yes', |
| 2628 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2629 | ), |
| 2630 | ) |
| 2631 | ); |
| 2632 | |
| 2633 | $this->add_control( |
| 2634 | 'pa_author_color_hov', |
| 2635 | array( |
| 2636 | 'label' => __( 'Hover Color', 'premium-addons-for-elementor' ), |
| 2637 | 'type' => Controls_Manager::COLOR, |
| 2638 | 'selectors' => array( |
| 2639 | '{{WRAPPER}} .premium-post-ticker__post-author:hover *' => 'color: {{VALUE}};', |
| 2640 | ), |
| 2641 | 'condition' => array( |
| 2642 | 'author_meta' => 'yes', |
| 2643 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2644 | ), |
| 2645 | ) |
| 2646 | ); |
| 2647 | |
| 2648 | // featured image. |
| 2649 | $this->add_control( |
| 2650 | 'pa_post_img', |
| 2651 | array( |
| 2652 | 'label' => __( 'Featured Image', 'premium-addons-for-elementor' ), |
| 2653 | 'type' => Controls_Manager::HEADING, |
| 2654 | 'separator' => 'before', |
| 2655 | 'condition' => array( |
| 2656 | 'post_img' => 'yes', |
| 2657 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2658 | ), |
| 2659 | ) |
| 2660 | ); |
| 2661 | |
| 2662 | $this->add_group_control( |
| 2663 | Group_Control_Box_Shadow::get_type(), |
| 2664 | array( |
| 2665 | 'name' => 'pa_post_img_shadow', |
| 2666 | 'selector' => '{{WRAPPER}} .premium-post-ticker__thumbnail-wrapper', |
| 2667 | 'condition' => array( |
| 2668 | 'post_img' => 'yes', |
| 2669 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2670 | ), |
| 2671 | ) |
| 2672 | ); |
| 2673 | |
| 2674 | $this->add_group_control( |
| 2675 | Group_Control_Border::get_type(), |
| 2676 | array( |
| 2677 | 'name' => 'pa_post_img_border', |
| 2678 | 'selector' => '{{WRAPPER}} .premium-post-ticker__thumbnail-wrapper', |
| 2679 | 'condition' => array( |
| 2680 | 'post_img' => 'yes', |
| 2681 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2682 | ), |
| 2683 | ) |
| 2684 | ); |
| 2685 | |
| 2686 | $this->add_control( |
| 2687 | 'pa_post_img_border_radius', |
| 2688 | array( |
| 2689 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2690 | 'type' => Controls_Manager::SLIDER, |
| 2691 | 'size_units' => array( 'px', 'em', '%' ), |
| 2692 | 'selectors' => array( |
| 2693 | '{{WRAPPER}} .premium-post-ticker__thumbnail-wrapper, {{WRAPPER}} .premium-post-ticker__thumbnail-wrapper *' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 2694 | ), |
| 2695 | 'condition' => array( |
| 2696 | 'post_img' => 'yes', |
| 2697 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2698 | ), |
| 2699 | ) |
| 2700 | ); |
| 2701 | |
| 2702 | $this->add_responsive_control( |
| 2703 | 'pa_post_img_margin', |
| 2704 | array( |
| 2705 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 2706 | 'type' => Controls_Manager::DIMENSIONS, |
| 2707 | 'size_units' => array( 'px', 'em', '%' ), |
| 2708 | 'selectors' => array( |
| 2709 | '{{WRAPPER}} .premium-post-ticker__thumbnail-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2710 | ), |
| 2711 | 'condition' => array( |
| 2712 | 'post_img' => 'yes', |
| 2713 | 'post_type_filter!' => array( 'gold', 'stock', 'text' ), |
| 2714 | ), |
| 2715 | ) |
| 2716 | ); |
| 2717 | |
| 2718 | $this->papro_activated = Helper_Functions::check_papro_version(); |
| 2719 | if ( $this->papro_activated ) { |
| 2720 | do_action( 'pa_ticker_stock_style', $this ); |
| 2721 | } |
| 2722 | |
| 2723 | // box / container. |
| 2724 | $this->add_control( |
| 2725 | 'pa_post_box_heading', |
| 2726 | array( |
| 2727 | 'label' => __( 'Container', 'premium-addons-for-elementor' ), |
| 2728 | 'type' => Controls_Manager::HEADING, |
| 2729 | 'separator' => 'before', |
| 2730 | ) |
| 2731 | ); |
| 2732 | |
| 2733 | $this->add_group_control( |
| 2734 | Group_Control_Box_Shadow::get_type(), |
| 2735 | array( |
| 2736 | 'name' => 'pa_post_box_shadow', |
| 2737 | 'selector' => '{{WRAPPER}} .premium-post-ticker__post-wrapper', |
| 2738 | ) |
| 2739 | ); |
| 2740 | |
| 2741 | $this->add_group_control( |
| 2742 | Premium_Background::get_type(), |
| 2743 | array( |
| 2744 | 'name' => 'pa_post_box_bg', |
| 2745 | 'types' => array( 'classic', 'gradient' ), |
| 2746 | 'selector' => '{{WRAPPER}} .premium-post-ticker__post-wrapper, {{WRAPPER}}:not(.premium-post-ticker__layout-4) .premium-post-ticker__arrows, {{WRAPPER}}.premium-post-ticker__layout-3 .premium-post-ticker__content', |
| 2747 | ) |
| 2748 | ); |
| 2749 | |
| 2750 | $this->add_group_control( |
| 2751 | Group_Control_Border::get_type(), |
| 2752 | array( |
| 2753 | 'name' => 'pa_post_box_border', |
| 2754 | 'selector' => '{{WRAPPER}} .premium-post-ticker__post-wrapper', |
| 2755 | ) |
| 2756 | ); |
| 2757 | |
| 2758 | $this->add_control( |
| 2759 | 'pa_post_box_border_radius', |
| 2760 | array( |
| 2761 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2762 | 'type' => Controls_Manager::SLIDER, |
| 2763 | 'size_units' => array( 'px', 'em', '%' ), |
| 2764 | 'selectors' => array( |
| 2765 | '{{WRAPPER}} .premium-post-ticker__post-wrapper' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 2766 | ), |
| 2767 | ) |
| 2768 | ); |
| 2769 | |
| 2770 | $this->add_responsive_control( |
| 2771 | 'pa_post_box_padding', |
| 2772 | array( |
| 2773 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 2774 | 'type' => Controls_Manager::DIMENSIONS, |
| 2775 | 'size_units' => array( 'px', 'em', '%' ), |
| 2776 | 'selectors' => array( |
| 2777 | '{{WRAPPER}} .premium-post-ticker__post-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2778 | ), |
| 2779 | ) |
| 2780 | ); |
| 2781 | |
| 2782 | $this->add_responsive_control( |
| 2783 | 'pa_post_box_magin', |
| 2784 | array( |
| 2785 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 2786 | 'type' => Controls_Manager::DIMENSIONS, |
| 2787 | 'size_units' => array( 'px', 'em', '%' ), |
| 2788 | 'selectors' => array( |
| 2789 | '{{WRAPPER}} .premium-post-ticker__post-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2790 | ), |
| 2791 | ) |
| 2792 | ); |
| 2793 | |
| 2794 | $this->end_controls_section(); |
| 2795 | } |
| 2796 | |
| 2797 | private function add_posts_container_style() { |
| 2798 | |
| 2799 | $this->start_controls_section( |
| 2800 | 'posts_container_style', |
| 2801 | array( |
| 2802 | 'label' => __( 'Ticker Elements Container', 'premium-addons-for-elementor' ), |
| 2803 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2804 | ) |
| 2805 | ); |
| 2806 | |
| 2807 | $this->add_group_control( |
| 2808 | Premium_Background::get_type(), |
| 2809 | array( |
| 2810 | 'name' => 'posts_container_background', |
| 2811 | 'types' => array( 'classic', 'gradient' ), |
| 2812 | 'selector' => '{{WRAPPER}} .premium-post-ticker__content', |
| 2813 | ) |
| 2814 | ); |
| 2815 | |
| 2816 | $this->add_control( |
| 2817 | 'post_lq_effect', |
| 2818 | array( |
| 2819 | 'label' => __( 'Liquid Glass Effect', 'premium-addons-for-elementor' ), |
| 2820 | 'type' => Controls_Manager::SELECT, |
| 2821 | 'description' => sprintf( |
| 2822 | /* translators: 1: `<a>` opening tag, 2: `</a>` closing tag. */ |
| 2823 | esc_html__( 'Important: Make sure this element has a semi-transparent background color to see the effect. See all presets from %1$shere%2$s.', 'premium-addons-for-elementor' ), |
| 2824 | '<a href="https://premiumaddons.com/liquid-glass/" target="_blank">', |
| 2825 | '</a>' |
| 2826 | ), |
| 2827 | 'options' => array( |
| 2828 | 'none' => __( 'None', 'premium-addons-for-elementor' ), |
| 2829 | 'glass1' => __( 'Preset 01', 'premium-addons-for-elementor' ), |
| 2830 | 'glass2' => __( 'Preset 02', 'premium-addons-for-elementor' ), |
| 2831 | 'glass3' => apply_filters( 'pa_pro_label', __( 'Preset 03 (Pro)', 'premium-addons-for-elementor' ) ), |
| 2832 | 'glass4' => apply_filters( 'pa_pro_label', __( 'Preset 04 (Pro)', 'premium-addons-for-elementor' ) ), |
| 2833 | 'glass5' => apply_filters( 'pa_pro_label', __( 'Preset 05 (Pro)', 'premium-addons-for-elementor' ) ), |
| 2834 | 'glass6' => apply_filters( 'pa_pro_label', __( 'Preset 06 (Pro)', 'premium-addons-for-elementor' ) ), |
| 2835 | ), |
| 2836 | 'default' => 'none', |
| 2837 | 'label_block' => true, |
| 2838 | 'render_type' => 'template', |
| 2839 | ) |
| 2840 | ); |
| 2841 | |
| 2842 | $this->add_group_control( |
| 2843 | Group_Control_Border::get_type(), |
| 2844 | array( |
| 2845 | 'name' => 'posts_container_border', |
| 2846 | 'selector' => '{{WRAPPER}} .premium-post-ticker__content', |
| 2847 | ) |
| 2848 | ); |
| 2849 | |
| 2850 | $this->add_control( |
| 2851 | 'posts_container_border_radius', |
| 2852 | array( |
| 2853 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2854 | 'type' => Controls_Manager::SLIDER, |
| 2855 | 'size_units' => array( 'px', '%', 'em' ), |
| 2856 | 'selectors' => array( |
| 2857 | '{{WRAPPER}} .premium-post-ticker__content' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 2858 | ), |
| 2859 | ) |
| 2860 | ); |
| 2861 | |
| 2862 | $this->add_group_control( |
| 2863 | Group_Control_Box_Shadow::get_type(), |
| 2864 | array( |
| 2865 | 'name' => 'posts_container_shadow', |
| 2866 | 'selector' => '{{WRAPPER}} .premium-post-ticker__content', |
| 2867 | ) |
| 2868 | ); |
| 2869 | |
| 2870 | $this->add_responsive_control( |
| 2871 | 'posts_container_margin', |
| 2872 | array( |
| 2873 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 2874 | 'type' => Controls_Manager::DIMENSIONS, |
| 2875 | 'size_units' => array( 'px', 'em', '%' ), |
| 2876 | 'selectors' => array( |
| 2877 | '{{WRAPPER}} .premium-post-ticker__content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 2878 | ), |
| 2879 | ) |
| 2880 | ); |
| 2881 | |
| 2882 | $this->add_responsive_control( |
| 2883 | 'posts_container_padding', |
| 2884 | array( |
| 2885 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 2886 | 'type' => Controls_Manager::DIMENSIONS, |
| 2887 | 'size_units' => array( 'px', 'em', '%' ), |
| 2888 | 'selectors' => array( |
| 2889 | '{{WRAPPER}} .premium-post-ticker__content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 2890 | ), |
| 2891 | ) |
| 2892 | ); |
| 2893 | |
| 2894 | $this->end_controls_section(); |
| 2895 | } |
| 2896 | |
| 2897 | /** |
| 2898 | * Adds pagination style controls. |
| 2899 | * |
| 2900 | * @access private |
| 2901 | * @since 4.9.37 |
| 2902 | */ |
| 2903 | private function add_navigation_style() { |
| 2904 | |
| 2905 | $this->start_controls_section( |
| 2906 | 'pa_nav_style', |
| 2907 | array( |
| 2908 | 'label' => __( 'Arrows', 'premium-addons-for-elementor' ), |
| 2909 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2910 | 'condition' => array( |
| 2911 | 'carousel_arrows' => 'yes', |
| 2912 | ), |
| 2913 | ) |
| 2914 | ); |
| 2915 | |
| 2916 | $this->add_responsive_control( |
| 2917 | 'nav_icon_size', |
| 2918 | array( |
| 2919 | 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ), |
| 2920 | 'type' => Controls_Manager::SLIDER, |
| 2921 | 'size_units' => array( 'px', '%', 'em' ), |
| 2922 | 'selectors' => array( |
| 2923 | '{{WRAPPER}} .premium-post-ticker__arrows i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 2924 | '{{WRAPPER}} .premium-post-ticker__arrows a' => 'line-height: {{SIZE}}{{UNIT}};', |
| 2925 | ), |
| 2926 | ) |
| 2927 | ); |
| 2928 | |
| 2929 | $this->start_controls_tabs( 'nav_colors' ); |
| 2930 | |
| 2931 | $this->start_controls_tab( |
| 2932 | 'pa_nav_nomral', |
| 2933 | array( |
| 2934 | 'label' => __( 'Normal', 'premium-addons-for-elementor' ), |
| 2935 | ) |
| 2936 | ); |
| 2937 | |
| 2938 | $this->add_control( |
| 2939 | 'pa_nav_color', |
| 2940 | array( |
| 2941 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 2942 | 'type' => Controls_Manager::COLOR, |
| 2943 | 'global' => array( |
| 2944 | 'default' => Global_Colors::COLOR_SECONDARY, |
| 2945 | ), |
| 2946 | 'selectors' => array( |
| 2947 | '{{WRAPPER}} .premium-post-ticker__arrows a' => 'color: {{VALUE}};', |
| 2948 | ), |
| 2949 | ) |
| 2950 | ); |
| 2951 | |
| 2952 | $this->add_control( |
| 2953 | 'pa_nav_bg', |
| 2954 | array( |
| 2955 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 2956 | 'type' => Controls_Manager::COLOR, |
| 2957 | 'selectors' => array( |
| 2958 | '{{WRAPPER}} .premium-post-ticker__arrows a' => 'background-color: {{VALUE}};', |
| 2959 | ), |
| 2960 | ) |
| 2961 | ); |
| 2962 | |
| 2963 | $this->add_group_control( |
| 2964 | Group_Control_Border::get_type(), |
| 2965 | array( |
| 2966 | 'name' => 'pa_nav_border', |
| 2967 | 'selector' => '{{WRAPPER}} .premium-post-ticker__arrows a', |
| 2968 | ) |
| 2969 | ); |
| 2970 | |
| 2971 | $this->add_control( |
| 2972 | 'pa_nav_border_radius', |
| 2973 | array( |
| 2974 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2975 | 'type' => Controls_Manager::SLIDER, |
| 2976 | 'size_units' => array( 'px', '%', 'em' ), |
| 2977 | 'selectors' => array( |
| 2978 | '{{WRAPPER}} .premium-post-ticker__arrows a' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 2979 | ), |
| 2980 | ) |
| 2981 | ); |
| 2982 | |
| 2983 | $this->end_controls_tab(); |
| 2984 | |
| 2985 | $this->start_controls_tab( |
| 2986 | 'premium_blog_pa_nav_hover', |
| 2987 | array( |
| 2988 | 'label' => __( 'Hover', 'premium-addons-for-elementor' ), |
| 2989 | |
| 2990 | ) |
| 2991 | ); |
| 2992 | |
| 2993 | $this->add_control( |
| 2994 | 'pa_nav_color_hov', |
| 2995 | array( |
| 2996 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 2997 | 'type' => Controls_Manager::COLOR, |
| 2998 | 'global' => array( |
| 2999 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 3000 | ), |
| 3001 | 'selectors' => array( |
| 3002 | '{{WRAPPER}} .premium-post-ticker__arrows a:hover' => 'color: {{VALUE}};', |
| 3003 | ), |
| 3004 | ) |
| 3005 | ); |
| 3006 | |
| 3007 | $this->add_control( |
| 3008 | 'pa_nav_bg_hov', |
| 3009 | array( |
| 3010 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 3011 | 'type' => Controls_Manager::COLOR, |
| 3012 | 'global' => array( |
| 3013 | 'default' => Global_Colors::COLOR_SECONDARY, |
| 3014 | ), |
| 3015 | 'selectors' => array( |
| 3016 | '{{WRAPPER}} .premium-post-ticker__arrows a:hover' => 'background-color: {{VALUE}};', |
| 3017 | ), |
| 3018 | ) |
| 3019 | ); |
| 3020 | |
| 3021 | $this->add_group_control( |
| 3022 | Group_Control_Border::get_type(), |
| 3023 | array( |
| 3024 | 'name' => 'pa_nav_border_hov', |
| 3025 | 'selector' => '{{WRAPPER}} .premium-post-ticker__arrows a:hover', |
| 3026 | ) |
| 3027 | ); |
| 3028 | |
| 3029 | $this->add_control( |
| 3030 | 'pa_nav_border_radius_hov', |
| 3031 | array( |
| 3032 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 3033 | 'type' => Controls_Manager::SLIDER, |
| 3034 | 'size_units' => array( 'px', '%', 'em' ), |
| 3035 | 'selectors' => array( |
| 3036 | '{{WRAPPER}} .premium-post-ticker__arrows a:hover' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 3037 | ), |
| 3038 | ) |
| 3039 | ); |
| 3040 | |
| 3041 | $this->end_controls_tab(); |
| 3042 | |
| 3043 | $this->end_controls_tabs(); |
| 3044 | |
| 3045 | $this->add_responsive_control( |
| 3046 | 'pa_nav_margin', |
| 3047 | array( |
| 3048 | 'label' => __( 'Spacing', 'premium-addons-for-elementor' ), |
| 3049 | 'type' => Controls_Manager::SLIDER, |
| 3050 | 'size_units' => array( 'px' ), |
| 3051 | 'separator' => 'before', |
| 3052 | 'selectors' => array( |
| 3053 | '{{WRAPPER}} .premium-post-ticker__arrows' => 'column-gap: {{SIZE}}px;', |
| 3054 | ), |
| 3055 | ) |
| 3056 | ); |
| 3057 | |
| 3058 | $this->add_responsive_control( |
| 3059 | 'pa_nav_padding', |
| 3060 | array( |
| 3061 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 3062 | 'type' => Controls_Manager::DIMENSIONS, |
| 3063 | 'size_units' => array( 'px', 'em', '%' ), |
| 3064 | 'selectors' => array( |
| 3065 | '{{WRAPPER}} .premium-post-ticker__arrows a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3066 | ), |
| 3067 | ) |
| 3068 | ); |
| 3069 | |
| 3070 | $this->add_control( |
| 3071 | 'arrows_container', |
| 3072 | array( |
| 3073 | 'label' => __( 'Outer Container', 'premium-addons-for-elementor' ), |
| 3074 | 'type' => Controls_Manager::HEADING, |
| 3075 | 'separator' => 'before', |
| 3076 | ) |
| 3077 | ); |
| 3078 | |
| 3079 | $this->add_group_control( |
| 3080 | Group_Control_Border::get_type(), |
| 3081 | array( |
| 3082 | 'name' => 'arrow_container_border', |
| 3083 | 'selector' => '{{WRAPPER}} .premium-post-ticker__arrows', |
| 3084 | ) |
| 3085 | ); |
| 3086 | |
| 3087 | $this->add_control( |
| 3088 | 'arrow_container_rad', |
| 3089 | array( |
| 3090 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 3091 | 'type' => Controls_Manager::SLIDER, |
| 3092 | 'size_units' => array( 'px', '%', 'em' ), |
| 3093 | 'selectors' => array( |
| 3094 | '{{WRAPPER}} .premium-post-ticker__arrows' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 3095 | ), |
| 3096 | ) |
| 3097 | ); |
| 3098 | |
| 3099 | $this->add_responsive_control( |
| 3100 | 'arrow_container_padding', |
| 3101 | array( |
| 3102 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 3103 | 'type' => Controls_Manager::DIMENSIONS, |
| 3104 | 'size_units' => array( 'px', 'em', '%' ), |
| 3105 | 'selectors' => array( |
| 3106 | '{{WRAPPER}} .premium-post-ticker__arrows' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3107 | ), |
| 3108 | ) |
| 3109 | ); |
| 3110 | |
| 3111 | $this->add_responsive_control( |
| 3112 | 'arrow_container_margin', |
| 3113 | array( |
| 3114 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 3115 | 'type' => Controls_Manager::DIMENSIONS, |
| 3116 | 'size_units' => array( 'px', 'em', '%' ), |
| 3117 | 'selectors' => array( |
| 3118 | '{{WRAPPER}} .premium-post-ticker__arrows' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3119 | ), |
| 3120 | ) |
| 3121 | ); |
| 3122 | |
| 3123 | $this->end_controls_section(); |
| 3124 | } |
| 3125 | |
| 3126 | /** |
| 3127 | * Adds separator style controls. |
| 3128 | * |
| 3129 | * @access private |
| 3130 | * @since 4.9.37 |
| 3131 | */ |
| 3132 | private function add_separator_style() { |
| 3133 | |
| 3134 | $this->start_controls_section( |
| 3135 | 'pa_separator_style', |
| 3136 | array( |
| 3137 | 'label' => __( 'Separator', 'premium-addons-for-elementor' ), |
| 3138 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3139 | 'condition' => array( |
| 3140 | 'infinite' => 'yes', |
| 3141 | 'separator' => 'yes', |
| 3142 | 'layout!' => 'layout-4', |
| 3143 | ), |
| 3144 | ) |
| 3145 | ); |
| 3146 | |
| 3147 | $this->add_responsive_control( |
| 3148 | 'separator_position', |
| 3149 | array( |
| 3150 | 'label' => __( 'Position', 'premium-addons-for-elementor' ), |
| 3151 | 'type' => Controls_Manager::SLIDER, |
| 3152 | 'size_units' => array( 'px', 'em', '%', 'custom' ), |
| 3153 | 'selectors' => array( |
| 3154 | '{{WRAPPER}} .premium-post-ticker__separator' => 'right: {{SIZE}}{{UNIT}}', |
| 3155 | ), |
| 3156 | ) |
| 3157 | ); |
| 3158 | |
| 3159 | $this->add_responsive_control( |
| 3160 | 'separator_width', |
| 3161 | array( |
| 3162 | 'label' => __( 'Width', 'premium-addons-for-elementor' ), |
| 3163 | 'type' => Controls_Manager::SLIDER, |
| 3164 | 'size_units' => array( 'px', 'em', 'custom' ), |
| 3165 | 'selectors' => array( |
| 3166 | '{{WRAPPER}} .premium-post-ticker__separator' => 'width: {{SIZE}}{{UNIT}}', |
| 3167 | ), |
| 3168 | ) |
| 3169 | ); |
| 3170 | |
| 3171 | $this->add_responsive_control( |
| 3172 | 'separator_height', |
| 3173 | array( |
| 3174 | 'label' => __( 'Height', 'premium-addons-for-elementor' ), |
| 3175 | 'type' => Controls_Manager::SLIDER, |
| 3176 | 'size_units' => array( 'px', 'em', 'custom' ), |
| 3177 | 'selectors' => array( |
| 3178 | '{{WRAPPER}} .premium-post-ticker__separator' => 'height: {{SIZE}}{{UNIT}} !important', |
| 3179 | ), |
| 3180 | ) |
| 3181 | ); |
| 3182 | |
| 3183 | $this->add_control( |
| 3184 | 'separator_color', |
| 3185 | array( |
| 3186 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 3187 | 'type' => Controls_Manager::COLOR, |
| 3188 | 'selectors' => array( |
| 3189 | '{{WRAPPER}} .premium-post-ticker__separator' => 'background-color: {{VALUE}};', |
| 3190 | ), |
| 3191 | ) |
| 3192 | ); |
| 3193 | |
| 3194 | $this->add_control( |
| 3195 | 'separator_rad', |
| 3196 | array( |
| 3197 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 3198 | 'type' => Controls_Manager::SLIDER, |
| 3199 | 'size_units' => array( 'px', '%', 'em' ), |
| 3200 | 'selectors' => array( |
| 3201 | '{{WRAPPER}} .premium-post-ticker__separator' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 3202 | ), |
| 3203 | ) |
| 3204 | ); |
| 3205 | |
| 3206 | $this->end_controls_section(); |
| 3207 | } |
| 3208 | |
| 3209 | /** |
| 3210 | * Render post ticker widget output on the frontend. |
| 3211 | * Written in PHP and used to generate the final HTML. |
| 3212 | * |
| 3213 | * @since 1.0.0 |
| 3214 | * @access protected |
| 3215 | */ |
| 3216 | protected function render() { |
| 3217 | |
| 3218 | $settings = $this->get_settings_for_display(); |
| 3219 | |
| 3220 | $this->papro_activated = Helper_Functions::check_papro_version(); |
| 3221 | |
| 3222 | if ( ! $this->papro_activated && ( in_array( $settings['layout'], array( 'layout-3', 'layout-4' ), true ) || ! in_array( $settings['post_type_filter'], array( 'post', 'text' ), true ) ) ) { |
| 3223 | ?> |
| 3224 | <div class="premium-error-notice"> |
| 3225 | <?php |
| 3226 | $message = __( 'This option is available in <b>Premium Addons Pro</b>.', 'premium-addons-for-elementor' ); |
| 3227 | echo wp_kses_post( $message ); |
| 3228 | ?> |
| 3229 | </div> |
| 3230 | <?php |
| 3231 | return false; |
| 3232 | } |
| 3233 | |
| 3234 | $id = $this->get_id(); |
| 3235 | |
| 3236 | $settings['widget_id'] = $id; |
| 3237 | $settings['widget_type'] = 'premium-post-ticker'; |
| 3238 | |
| 3239 | $source = $settings['post_type_filter']; |
| 3240 | |
| 3241 | if ( 'stock' === $source ) { |
| 3242 | |
| 3243 | $api_key = apply_filters( 'pa_stock_api', $settings['api_key'] ); |
| 3244 | |
| 3245 | if ( empty( $api_key ) ) { |
| 3246 | |
| 3247 | $notice = __( 'Please enter a valid API key.', 'premium-addons-for-elementor' ); |
| 3248 | ?> |
| 3249 | <div class="premium-error-notice"> |
| 3250 | <?php echo wp_kses_post( $notice ); ?> |
| 3251 | </div> |
| 3252 | <?php |
| 3253 | return; |
| 3254 | } |
| 3255 | |
| 3256 | $function = $settings['req_function']; |
| 3257 | $symbol = 'CURRENCY_EXCHANGE_RATE' === $function ? $settings['from_currency'] : $settings['symbol']; |
| 3258 | $to_currency = ''; |
| 3259 | $show_curr_change = false; |
| 3260 | |
| 3261 | if ( empty( $symbol ) ) { |
| 3262 | $notice = __( 'Please Enter symbols/tokens to query of your choice.', 'premium-addons-for-elementor' ); |
| 3263 | ?> |
| 3264 | <div class="premium-error-notice"> |
| 3265 | <?php echo wp_kses_post( $notice ); ?> |
| 3266 | </div> |
| 3267 | <?php |
| 3268 | return; |
| 3269 | } |
| 3270 | |
| 3271 | if ( 'CURRENCY_EXCHANGE_RATE' === $function ) { |
| 3272 | $to_currency = $settings['to_currency']; |
| 3273 | $show_curr_change = 'yes' === $settings['curr_change'] ? true : false; |
| 3274 | |
| 3275 | if ( empty( $to_currency ) ) { |
| 3276 | $notice = __( 'Please Enter symbols/tokens to exchange to.', 'premium-addons-for-elementor' ); |
| 3277 | ?> |
| 3278 | <div class="premium-error-notice"> |
| 3279 | <?php echo wp_kses_post( $notice ); ?> |
| 3280 | </div> |
| 3281 | <?php |
| 3282 | return; |
| 3283 | } |
| 3284 | } |
| 3285 | |
| 3286 | $transient_name = sprintf( 'papro_%s_%s_%s_%s_%s', $id, $api_key, $source, $symbol, $to_currency ); |
| 3287 | |
| 3288 | $req_data = get_transient( $transient_name ); |
| 3289 | |
| 3290 | if ( ! $req_data ) { |
| 3291 | |
| 3292 | $api_settings = array( |
| 3293 | 'id' => $id, |
| 3294 | 'api_key' => $api_key, |
| 3295 | 'source' => $source, |
| 3296 | 'function' => $function, |
| 3297 | 'symbols' => $this->extract_stock_symbols( $symbol ), |
| 3298 | 'to_currency' => $this->extract_stock_symbols( $to_currency ), |
| 3299 | ); |
| 3300 | |
| 3301 | if ( $show_curr_change ) { |
| 3302 | $api_settings['old_data_key'] = $transient_name . '_old'; |
| 3303 | } |
| 3304 | |
| 3305 | $api_handler = new API_Handler( $api_settings ); |
| 3306 | |
| 3307 | $req_data = $api_handler::get_req_data( $api_settings ); |
| 3308 | |
| 3309 | if ( ! $req_data ) { |
| 3310 | return; |
| 3311 | } |
| 3312 | |
| 3313 | $expire_time = HOUR_IN_SECONDS * apply_filters( 'pa_ticker_reload_' . $id, $settings['reload'] ); |
| 3314 | |
| 3315 | $api_handler::delete_existing_transient(); |
| 3316 | |
| 3317 | set_transient( $transient_name, $req_data, $expire_time ); |
| 3318 | |
| 3319 | if ( $show_curr_change ) { |
| 3320 | update_option( $transient_name . '_old', $req_data ); |
| 3321 | } |
| 3322 | } |
| 3323 | } elseif ( 'gold' === $source ) { |
| 3324 | |
| 3325 | $api_key = apply_filters( 'pa_gold_api', $settings['gold_api_key'] ); |
| 3326 | |
| 3327 | if ( empty( $api_key ) ) { |
| 3328 | |
| 3329 | $notice = __( 'Please enter a valid API key.', 'premium-addons-for-elementor' ); |
| 3330 | ?> |
| 3331 | <div class="premium-error-notice"> |
| 3332 | <?php echo wp_kses_post( $notice ); ?> |
| 3333 | </div> |
| 3334 | <?php |
| 3335 | return; |
| 3336 | } |
| 3337 | |
| 3338 | $currencies = $settings['currencies']; |
| 3339 | |
| 3340 | if ( empty( $currencies ) ) { |
| 3341 | $notice = __( 'Please Enter Currencies of your choice to query.', 'premium-addons-for-elementor' ); |
| 3342 | ?> |
| 3343 | <div class="premium-error-notice"> |
| 3344 | <?php echo wp_kses_post( $notice ); ?> |
| 3345 | </div> |
| 3346 | <?php |
| 3347 | return; |
| 3348 | } |
| 3349 | |
| 3350 | $transient_name = sprintf( 'papro_%s_%s_%s_%s', $id, $api_key, $source, $currencies ); |
| 3351 | |
| 3352 | $req_data = get_transient( $transient_name ); |
| 3353 | |
| 3354 | if ( ! $req_data ) { |
| 3355 | |
| 3356 | $api_settings = array( |
| 3357 | 'id' => $id, |
| 3358 | 'api_key' => $api_key, |
| 3359 | 'to_currency' => $currencies, |
| 3360 | ); |
| 3361 | |
| 3362 | $api_handler = new API_Handler( $api_settings ); |
| 3363 | |
| 3364 | $will_alter = false; |
| 3365 | |
| 3366 | $req_data = $api_handler::get_gold_data( $api_settings, $will_alter ); |
| 3367 | |
| 3368 | if ( isset( $req_data['is_error_msg'] ) && $req_data['is_error_msg'] ) { |
| 3369 | |
| 3370 | if ( ! empty( $settings['alter_api_key'] ) ) { |
| 3371 | |
| 3372 | $will_alter = true; |
| 3373 | |
| 3374 | $api_settings['api_key'] = $settings['alter_api_key']; |
| 3375 | |
| 3376 | $req_data = $api_handler::get_gold_data( $api_settings, $will_alter ); |
| 3377 | |
| 3378 | if ( ! $req_data ) { |
| 3379 | return; |
| 3380 | } |
| 3381 | } else { |
| 3382 | |
| 3383 | $err_msg = sprintf( 'Something went wrong: %s', $req_data['error_msg'] ); |
| 3384 | ?> |
| 3385 | <div class="premium-error-notice"> |
| 3386 | <?php echo wp_kses_post( $err_msg ); ?> |
| 3387 | </div> |
| 3388 | <?php |
| 3389 | return; |
| 3390 | } |
| 3391 | } |
| 3392 | |
| 3393 | $expire_time = HOUR_IN_SECONDS * apply_filters( 'pa_ticker_reload_' . $id, $settings['gold_reload'] ); |
| 3394 | |
| 3395 | $api_handler::delete_existing_transient(); |
| 3396 | |
| 3397 | set_transient( $transient_name, $req_data, $expire_time ); |
| 3398 | } |
| 3399 | } elseif ( 'text' === $source ) { |
| 3400 | |
| 3401 | $text_content = $settings['text_content']; |
| 3402 | |
| 3403 | } else { |
| 3404 | $posts_helper = Posts_Helper::getInstance(); |
| 3405 | |
| 3406 | $posts_helper->set_widget_settings( $settings, '*' ); |
| 3407 | |
| 3408 | $query = $posts_helper->get_query_posts(); |
| 3409 | |
| 3410 | if ( ! $query->have_posts() ) { |
| 3411 | |
| 3412 | $query_notice = $settings['empty_query_text']; |
| 3413 | |
| 3414 | $posts_helper->get_empty_query_message( $query_notice ); |
| 3415 | return; |
| 3416 | } |
| 3417 | } |
| 3418 | |
| 3419 | $layout = $settings['layout']; |
| 3420 | $title = ! empty( $settings['ticker_title'] ) ? $settings['ticker_title'] : false; |
| 3421 | $current_date = 'yes' === $settings['show_date'] ? true : false; |
| 3422 | |
| 3423 | // slider settings. |
| 3424 | $infinite = 'yes' === $settings['infinite']; |
| 3425 | $auto_play = 'yes' === $settings['auto_play']; |
| 3426 | $arrows = 'yes' === $settings['carousel_arrows']; |
| 3427 | $fade = 'yes' === $settings['fade'] && 'layout-4' !== $layout ? true : false; |
| 3428 | $typing = ! in_array( $source, array( 'stock', 'gold' ), true ) && 'layout-4' !== $settings['layout'] && 'yes' === $settings['typing'] ? true : false; |
| 3429 | $vertical = 'yes' === $settings['vertical']; |
| 3430 | $speed = $settings['speed']; |
| 3431 | |
| 3432 | if ( $fade ) { |
| 3433 | $vertical = false; |
| 3434 | } |
| 3435 | |
| 3436 | if ( $typing ) { |
| 3437 | $vertical = false; |
| 3438 | $fade = false; |
| 3439 | } |
| 3440 | |
| 3441 | if ( $infinite ) { |
| 3442 | $fade = false; |
| 3443 | $auto_play = true; |
| 3444 | $arrows = false; |
| 3445 | $typing = false; |
| 3446 | } |
| 3447 | |
| 3448 | $should_be_rtl = false; |
| 3449 | |
| 3450 | if ( 'layout-4' !== $layout && ! $fade ) { |
| 3451 | $is_reverse = isset( $settings['reverse'] ) && 'yes' === $settings['reverse']; |
| 3452 | $should_be_rtl = ( is_rtl() && ! $is_reverse ) || ( ! is_rtl() && $is_reverse ); |
| 3453 | |
| 3454 | // Special case: RTL + reversed + typing enabled |
| 3455 | if ( is_rtl() && $is_reverse && $typing ) { |
| 3456 | $should_be_rtl = true; |
| 3457 | } |
| 3458 | |
| 3459 | $this->add_render_attribute( 'inner-wrapper', 'dir', $should_be_rtl ? 'rtl' : 'ltr' ); |
| 3460 | } |
| 3461 | |
| 3462 | $slider_settings = array( |
| 3463 | 'layout' => $settings['layout'], |
| 3464 | 'typing' => $typing, |
| 3465 | 'fade' => $fade, |
| 3466 | 'arrows' => $arrows, |
| 3467 | 'infinite' => $infinite, |
| 3468 | 'autoPlay' => $auto_play, |
| 3469 | 'vertical' => $vertical, |
| 3470 | 'speed' => $speed, |
| 3471 | 'slidesToShow' => $settings['slides_to_show'], |
| 3472 | 'pauseOnHover' => 'yes' === $settings['pause_on_hover'] ? true : false, |
| 3473 | 'animation' => ! $infinite && ! $typing ? $settings['entrance_animation'] : '', |
| 3474 | 'shouldBeRtl' => $should_be_rtl, |
| 3475 | ); |
| 3476 | |
| 3477 | if ( $auto_play ) { |
| 3478 | $slider_settings['autoplaySpeed'] = $settings['autoplay_speed']; |
| 3479 | } |
| 3480 | |
| 3481 | $this->add_render_attribute( |
| 3482 | 'outer-wrapper', |
| 3483 | array( |
| 3484 | 'class' => 'premium-post-ticker__outer-wrapper premium-post-ticker__hidden ', |
| 3485 | 'data-ticker-settings' => wp_json_encode( $slider_settings ), |
| 3486 | ) |
| 3487 | ); |
| 3488 | |
| 3489 | $this->add_render_attribute( 'inner-wrapper', 'class', 'premium-post-ticker__posts-wrapper' ); |
| 3490 | |
| 3491 | $this->add_render_attribute( 'ticker_content', 'class', 'premium-post-ticker__content' ); |
| 3492 | |
| 3493 | if ( 'none' !== $settings['post_lq_effect'] ) { |
| 3494 | $this->add_render_attribute( 'ticker_content', 'class', 'premium-con-lq__' . $settings['post_lq_effect'] ); |
| 3495 | } |
| 3496 | |
| 3497 | ?> |
| 3498 | <div <?php $this->print_render_attribute_string( 'outer-wrapper' ); ?>> |
| 3499 | <?php if ( 'layout-1' === $layout ) { ?> |
| 3500 | <?php if ( $current_date ) : ?> |
| 3501 | <div class="premium-post-ticker__header-wrapper"> |
| 3502 | <?php $this->render_ticker_date( $settings ); ?> |
| 3503 | </div> |
| 3504 | <?php endif; ?> |
| 3505 | |
| 3506 | <div <?php $this->print_render_attribute_string( 'ticker_content' ); ?>> |
| 3507 | <?php |
| 3508 | if ( $title ) { |
| 3509 | $this->render_ticker_title( $settings ); |
| 3510 | } |
| 3511 | ?> |
| 3512 | |
| 3513 | <div <?php $this->print_render_attribute_string( 'inner-wrapper' ); ?>> |
| 3514 | <?php |
| 3515 | if ( in_array( $source, array( 'stock', 'gold' ), true ) ) { |
| 3516 | $this->render_detailed_stock_element( $req_data, $settings ); |
| 3517 | } elseif ( 'text' === $source ) { |
| 3518 | $this->render_ticker_text_content( $text_content, $settings ); |
| 3519 | } else { |
| 3520 | $this->render_ticker_post( $query, $settings, $posts_helper ); |
| 3521 | } |
| 3522 | ?> |
| 3523 | </div> |
| 3524 | |
| 3525 | <?php |
| 3526 | if ( $arrows ) { |
| 3527 | $this->render_ticker_arrows( $settings ); |
| 3528 | } |
| 3529 | ?> |
| 3530 | </div> |
| 3531 | <?php } elseif ( 'layout-2' === $layout ) { ?> |
| 3532 | |
| 3533 | <?php if ( $title ) : ?> |
| 3534 | <div class="premium-post-ticker__header-wrapper"> |
| 3535 | <?php $this->render_ticker_title( $settings ); ?> |
| 3536 | </div> |
| 3537 | <?php endif; ?> |
| 3538 | |
| 3539 | <div <?php $this->print_render_attribute_string( 'ticker_content' ); ?>> |
| 3540 | <?php |
| 3541 | if ( $current_date ) { |
| 3542 | $this->render_ticker_date( $settings ); |
| 3543 | } |
| 3544 | ?> |
| 3545 | |
| 3546 | <div <?php $this->print_render_attribute_string( 'inner-wrapper' ); ?>> |
| 3547 | <?php |
| 3548 | if ( in_array( $source, array( 'stock', 'gold' ), true ) ) { |
| 3549 | $this->render_detailed_stock_element( $req_data, $settings ); |
| 3550 | } elseif ( 'text' === $source ) { |
| 3551 | $this->render_ticker_text_content( $text_content, $settings ); |
| 3552 | } else { |
| 3553 | $this->render_ticker_post( $query, $settings, $posts_helper ); |
| 3554 | } |
| 3555 | ?> |
| 3556 | </div> |
| 3557 | |
| 3558 | <?php |
| 3559 | if ( $arrows ) { |
| 3560 | $this->render_ticker_arrows( $settings ); |
| 3561 | } |
| 3562 | ?> |
| 3563 | </div> |
| 3564 | |
| 3565 | <?php } elseif ( 'layout-3' === $layout ) { ?> |
| 3566 | <?php if ( $title || $current_date ) : ?> |
| 3567 | <div class="premium-post-ticker__header-wrapper"> |
| 3568 | <?php |
| 3569 | if ( $current_date ) { |
| 3570 | $this->render_ticker_date( $settings ); |
| 3571 | } |
| 3572 | |
| 3573 | if ( $title ) { |
| 3574 | $this->render_ticker_title( $settings ); |
| 3575 | } |
| 3576 | ?> |
| 3577 | </div> |
| 3578 | <?php endif; ?> |
| 3579 | |
| 3580 | <div <?php $this->print_render_attribute_string( 'ticker_content' ); ?>> |
| 3581 | <div <?php $this->print_render_attribute_string( 'inner-wrapper' ); ?>> |
| 3582 | <?php |
| 3583 | if ( in_array( $source, array( 'stock', 'gold' ), true ) ) { |
| 3584 | $this->render_detailed_stock_element( $req_data, $settings ); |
| 3585 | } elseif ( 'text' === $source ) { |
| 3586 | $this->render_ticker_text_content( $text_content, $settings ); |
| 3587 | } else { |
| 3588 | $this->render_ticker_post( $query, $settings, $posts_helper ); |
| 3589 | } |
| 3590 | ?> |
| 3591 | </div> |
| 3592 | |
| 3593 | <?php |
| 3594 | if ( $arrows ) { |
| 3595 | $this->render_ticker_arrows( $settings ); |
| 3596 | } |
| 3597 | ?> |
| 3598 | </div> |
| 3599 | <?php } else { ?> |
| 3600 | <?php if ( $title || $current_date || $arrows ) : ?> |
| 3601 | <div class="premium-post-ticker__header-wrapper"> |
| 3602 | <?php |
| 3603 | if ( $current_date ) { |
| 3604 | $this->render_ticker_date( $settings ); |
| 3605 | } |
| 3606 | |
| 3607 | if ( $title ) { |
| 3608 | $this->render_ticker_title( $settings ); |
| 3609 | } |
| 3610 | |
| 3611 | if ( $arrows ) { |
| 3612 | $this->render_ticker_arrows( $settings ); |
| 3613 | } |
| 3614 | ?> |
| 3615 | </div> |
| 3616 | <?php endif; ?> |
| 3617 | |
| 3618 | <div <?php $this->print_render_attribute_string( 'ticker_content' ); ?>> |
| 3619 | <div <?php $this->print_render_attribute_string( 'inner-wrapper' ); ?>> |
| 3620 | <?php |
| 3621 | if ( in_array( $source, array( 'stock', 'gold' ), true ) ) { |
| 3622 | $this->render_detailed_stock_element( $req_data, $settings ); |
| 3623 | } elseif ( 'text' === $source ) { |
| 3624 | $this->render_ticker_text_content( $text_content, $settings ); |
| 3625 | } else { |
| 3626 | $this->render_ticker_post( $query, $settings, $posts_helper ); |
| 3627 | } |
| 3628 | ?> |
| 3629 | </div> |
| 3630 | </div> |
| 3631 | <?php } ?> |
| 3632 | </div> |
| 3633 | <?php |
| 3634 | } |
| 3635 | |
| 3636 | /** |
| 3637 | * Extracts Stock Symbols from a string separated by ",". |
| 3638 | * |
| 3639 | * @access public |
| 3640 | * @since 2.8.23 |
| 3641 | * |
| 3642 | * @param string $symbol_str symbols strings. |
| 3643 | * |
| 3644 | * @return array |
| 3645 | */ |
| 3646 | private function extract_stock_symbols( $symbol_str ) { |
| 3647 | |
| 3648 | $symbols = explode( ',', $symbol_str ); |
| 3649 | |
| 3650 | $symbols = array_slice( $symbols, 0, 5 ); |
| 3651 | |
| 3652 | return $symbols; |
| 3653 | } |
| 3654 | |
| 3655 | /** |
| 3656 | * Render stock elements. |
| 3657 | * |
| 3658 | * @access private |
| 3659 | * @since 2.8.22 |
| 3660 | * |
| 3661 | * @param array $stock_symbols stock symbols data. |
| 3662 | * @param array $settings widget settings. |
| 3663 | */ |
| 3664 | private function render_detailed_stock_element( $stock_symbols, $settings ) { |
| 3665 | |
| 3666 | $is_stock_element = 'stock' === $settings['post_type_filter']; |
| 3667 | $function = $settings['req_function']; |
| 3668 | $is_equity = $is_stock_element && 'GLOBAL_QUOTE' === $function; |
| 3669 | |
| 3670 | $symbols_names = false; |
| 3671 | $show_symbol = true; |
| 3672 | $show_price = 'yes' === $settings['show_price']; |
| 3673 | |
| 3674 | $show_change = 'yes' === $settings['show_change']; |
| 3675 | $show_change_per = 'yes' === $settings['show_change_per']; |
| 3676 | |
| 3677 | if ( $is_equity ) { |
| 3678 | if ( 'yes' === $settings['symbol_names_sw'] && ! empty( $settings['symbol_name'] ) ) { |
| 3679 | $symbols_names = $this->extract_stock_symbols( $settings['symbol_name'] ); |
| 3680 | } |
| 3681 | |
| 3682 | if ( 'yes' !== $settings['show_symbol'] ) { |
| 3683 | $show_symbol = false; |
| 3684 | } |
| 3685 | } |
| 3686 | |
| 3687 | if ( $is_stock_element && 'CURRENCY_EXCHANGE_RATE' === $function ) { |
| 3688 | if ( 'yes' !== $settings['curr_change'] ) { |
| 3689 | $show_change = false; |
| 3690 | $show_change_per = false; |
| 3691 | } |
| 3692 | } |
| 3693 | |
| 3694 | if ( $show_price || $show_change || $show_change_per ) { |
| 3695 | $change_indicator = $settings['change_indicator']; |
| 3696 | $decimal_places = empty( $settings['decimal_places'] ) ? 0 : $settings['decimal_places']; |
| 3697 | } |
| 3698 | |
| 3699 | foreach ( $stock_symbols as $symbol => $data ) { |
| 3700 | |
| 3701 | $name = false; |
| 3702 | |
| 3703 | if ( $show_change || $show_change_per ) { |
| 3704 | $dir_cls = ''; |
| 3705 | |
| 3706 | if ( 0 < $data['change'] ) { |
| 3707 | $dir_cls = 'up'; |
| 3708 | } elseif ( 0 > $data['change'] ) { |
| 3709 | $dir_cls = 'down'; |
| 3710 | } |
| 3711 | } |
| 3712 | |
| 3713 | if ( $show_price || $show_change || $show_change_per ) { |
| 3714 | |
| 3715 | if ( $show_price ) { |
| 3716 | $price = number_format( (float) $data['price'], $decimal_places, '.', ',' ); |
| 3717 | |
| 3718 | if ( $is_equity ) { |
| 3719 | $price = '$' . $price; |
| 3720 | } |
| 3721 | } |
| 3722 | |
| 3723 | if ( $show_change ) { |
| 3724 | $change = 'sign' === $change_indicator ? $data['change'] : abs( $data['change'] ); |
| 3725 | $change = number_format( (float) $change, $decimal_places, '.', ',' ); |
| 3726 | } |
| 3727 | |
| 3728 | if ( $show_change_per ) { |
| 3729 | |
| 3730 | $percent_change = str_replace( '%', '', $data['percent_change'] ); |
| 3731 | |
| 3732 | $change_percent = 'sign' === $change_indicator ? $percent_change : abs( $percent_change ); |
| 3733 | |
| 3734 | $change_percent = number_format( (float) str_replace( '%', '', $change_percent ), $decimal_places, '.', ',' ); |
| 3735 | } |
| 3736 | } |
| 3737 | |
| 3738 | if ( false !== $symbols_names && isset( $symbols_names[ $symbol ] ) ) { |
| 3739 | $name = $symbols_names[ $symbol ]; |
| 3740 | } |
| 3741 | |
| 3742 | if ( 'yes' === $settings['show_symbol_icon'] ) { |
| 3743 | |
| 3744 | $icons_repeater = $settings['symbol_icons_repeater']; |
| 3745 | |
| 3746 | $currency_symbol = 'CURRENCY_EXCHANGE_RATE' === $function ? substr( $data['symbol'], 0, 3 ) : $data['symbol']; |
| 3747 | |
| 3748 | $custom_icon = ''; |
| 3749 | |
| 3750 | if ( count( $icons_repeater ) > 0 ) { |
| 3751 | array_map( |
| 3752 | function ( $repeater_item ) use ( $currency_symbol, &$custom_icon ) { |
| 3753 | if ( $repeater_item['symbol_name'] === $currency_symbol ) { |
| 3754 | $custom_icon = $repeater_item['symbol_img']['url']; |
| 3755 | }}, |
| 3756 | $icons_repeater |
| 3757 | ); |
| 3758 | } |
| 3759 | |
| 3760 | if ( ! empty( $custom_icon ) ) { |
| 3761 | $data['icon_src'] = $custom_icon; |
| 3762 | } else { |
| 3763 | |
| 3764 | $currency_symbol = strtolower( $currency_symbol ); |
| 3765 | if ( 'CURRENCY_EXCHANGE_RATE' === $function ) { |
| 3766 | |
| 3767 | $data['icon_src'] = sprintf( 'https://assets.coincap.io/assets/icons/%s@2x.png', $currency_symbol ); |
| 3768 | $data['icon_alternative'] = $data['icon_src']; |
| 3769 | |
| 3770 | } else { |
| 3771 | |
| 3772 | $data['icon_src'] = sprintf( 'https://eodhistoricaldata.com/img/logos/US/%s.png', $data['symbol'] ); |
| 3773 | $data['icon_alternative'] = sprintf( 'https://eodhistoricaldata.com/img/logos/US/%s.png', $currency_symbol ); |
| 3774 | |
| 3775 | } |
| 3776 | } |
| 3777 | } |
| 3778 | |
| 3779 | ?> |
| 3780 | <div class="premium-post-ticker__post-wrapper premium-post-sticker__stock-element-wrapper"> |
| 3781 | |
| 3782 | <?php if ( 'yes' === $settings['show_symbol_icon'] ) : ?> |
| 3783 | <img class='premium-post-ticker__symbol-icon' src='<?php echo esc_attr( $data['icon_src'] ); ?>' alt='<?php echo esc_attr( $currency_symbol ); ?>' onerror="<?php echo 'CURRENCY_EXCHANGE_RATE' === $function ? '' : esc_attr( 'this.src="' . $data['icon_alternative'] . '"' ); ?>"> |
| 3784 | <?php endif; ?> |
| 3785 | |
| 3786 | <?php if ( false !== $name ) : ?> |
| 3787 | <span class='premium-post-ticker__symbol-name' title='Name' aria-label='<?php echo esc_attr( $name ); ?>'><?php echo esc_html( $name ); ?></span> |
| 3788 | <?php endif; ?> |
| 3789 | |
| 3790 | <?php if ( $show_symbol ) : ?> |
| 3791 | <span class='premium-post-ticker__symbol' title='Symbol' aria-label='<?php echo esc_attr( $data['symbol'] ); ?>'> <?php echo esc_html( $data['symbol'] ); ?></span> |
| 3792 | <?php endif; ?> |
| 3793 | |
| 3794 | <span class="premium-post-ticker__change-wrapper"> |
| 3795 | |
| 3796 | <?php if ( $show_price ) : ?> |
| 3797 | <span class="premium-post-ticker__price" title="Price |
| 3798 | <?php |
| 3799 | if ( ! $is_stock_element ) { |
| 3800 | echo 'Per Ounce'; } |
| 3801 | ?> |
| 3802 | " aria-label="<?php echo esc_attr( $price ); ?>"><?php echo esc_html( $price ); ?></span> |
| 3803 | <?php endif; ?> |
| 3804 | |
| 3805 | <?php if ( $show_change ) : ?> |
| 3806 | <span class="premium-post-ticker__change <?php echo esc_attr( $dir_cls ); ?>" title="Change" aria-label="<?php echo esc_attr( $data['change'] ); ?>"><?php echo esc_html( $change ); ?></span> |
| 3807 | <?php endif; ?> |
| 3808 | |
| 3809 | <?php if ( $show_change_per ) : ?> |
| 3810 | <span class="premium-post-ticker__change-percent <?php echo esc_attr( $dir_cls ); ?>" title="Change Percent" aria-label="<?php echo esc_attr( $data['percent_change'] ); ?>"> |
| 3811 | <?php |
| 3812 | echo esc_html( $change_percent . '%' ); |
| 3813 | |
| 3814 | if ( 'arrow' === $change_indicator ) { |
| 3815 | if ( 0 < $data['change'] ) { |
| 3816 | ?> |
| 3817 | <i class="<?php echo esc_attr( $settings['arrow_style'] ); ?>-up" aria-hidden="true"></i> |
| 3818 | <?php |
| 3819 | } elseif ( 0 > $data['change'] ) { |
| 3820 | ?> |
| 3821 | <i class="<?php echo esc_attr( $settings['arrow_style'] ); ?>-down" aria-hidden="true"></i> |
| 3822 | <?php |
| 3823 | } |
| 3824 | } |
| 3825 | ?> |
| 3826 | </span> |
| 3827 | <?php endif; ?> |
| 3828 | |
| 3829 | </span> |
| 3830 | </div> |
| 3831 | <?php |
| 3832 | } |
| 3833 | } |
| 3834 | |
| 3835 | /** |
| 3836 | * Render Ticker Title. |
| 3837 | * |
| 3838 | * @access private |
| 3839 | * @since 2.8.22 |
| 3840 | * |
| 3841 | * @param array $settings widget settings. |
| 3842 | */ |
| 3843 | private function render_ticker_title( $settings ) { |
| 3844 | |
| 3845 | $title = ! empty( $settings['ticker_title'] ) ? $settings['ticker_title'] : false; |
| 3846 | |
| 3847 | $title_tag = Helper_Functions::validate_html_tag( $settings['ticker_title_tag'] ); |
| 3848 | $title_classes = ! $title ? array() : Helper_Functions::get_element_classes( $settings['hide_title_on'], array( 'premium-post-ticker__title-wrapper' ) ); |
| 3849 | |
| 3850 | $icon_enabled = 'yes' === $settings['ticker_icon_sw'] ? true : false; |
| 3851 | |
| 3852 | $this->add_render_attribute( 'title', 'class', $title_classes ); |
| 3853 | |
| 3854 | ?> |
| 3855 | <div <?php $this->print_render_attribute_string( 'title' ); ?>> |
| 3856 | <?php |
| 3857 | if ( $icon_enabled ) { |
| 3858 | $this->render_ticker_icon( $settings ); |
| 3859 | } |
| 3860 | ?> |
| 3861 | |
| 3862 | <<?php echo wp_kses_post( $title_tag ); ?> class="premium-post-ticker__title"> <?php echo esc_html( $title ); ?> </<?php echo wp_kses_post( $title_tag ); ?>> |
| 3863 | </div> |
| 3864 | <?php |
| 3865 | } |
| 3866 | |
| 3867 | /** |
| 3868 | * Render Ticker Data. |
| 3869 | * |
| 3870 | * @access private |
| 3871 | * @since 2.8.22 |
| 3872 | * |
| 3873 | * @param array $settings widget settings. |
| 3874 | */ |
| 3875 | private function render_ticker_date( $settings ) { |
| 3876 | |
| 3877 | $current_date = 'yes' === $settings['show_date'] ? true : false; |
| 3878 | $date_format = ! empty( $settings['date_format'] ) ? $settings['date_format'] : get_option( 'date_format' ); |
| 3879 | $date_classes = ! $current_date ? array() : Helper_Functions::get_element_classes( $settings['hide_date_on'], array( 'premium-post-ticker__date-wrapper' ) ); |
| 3880 | |
| 3881 | $this->add_render_attribute( 'date', 'class', $date_classes ); |
| 3882 | |
| 3883 | ?> |
| 3884 | <div <?php $this->print_render_attribute_string( 'date' ); ?>> |
| 3885 | <span class="premium-post-ticker__date"> <?php echo esc_html( date_i18n( $date_format ) ); ?></span> |
| 3886 | </div> |
| 3887 | <?php |
| 3888 | } |
| 3889 | |
| 3890 | /** |
| 3891 | * Render Ticker Arrows. |
| 3892 | * |
| 3893 | * @access private |
| 3894 | * @since 2.8.22 |
| 3895 | * |
| 3896 | * @param array $settings widget settings. |
| 3897 | */ |
| 3898 | private function render_ticker_arrows( $settings ) { |
| 3899 | |
| 3900 | $prev = 'layout-4' === $settings['layout'] ? 'eicon-arrow-down' : 'fas fa-angle-left'; |
| 3901 | $next = 'layout-4' === $settings['layout'] ? 'eicon-arrow-up' : 'fas fa-angle-right'; |
| 3902 | ?> |
| 3903 | <div class="premium-post-ticker__arrows"> |
| 3904 | <a class="prev-arrow" type="button" role="button" aria-label="Previous"> |
| 3905 | <i class="<?php echo esc_attr( $prev ); ?>" aria-hidden="true"></i> |
| 3906 | </a> |
| 3907 | <a class="next-arrow" type="button" role="button" aria-label="Next"> |
| 3908 | <i class="<?php echo esc_attr( $next ); ?>" aria-hidden="true"></i> |
| 3909 | </a> |
| 3910 | </div> |
| 3911 | <?php |
| 3912 | } |
| 3913 | |
| 3914 | /** |
| 3915 | * Render Ticker Icon. |
| 3916 | * |
| 3917 | * @access private |
| 3918 | * @since 2.8.22 |
| 3919 | * |
| 3920 | * @param array $settings widget settings. |
| 3921 | * @param boolean $is_repeater_item is repeater item. |
| 3922 | */ |
| 3923 | private function render_ticker_icon( $settings, $is_repeater_item = false ) { |
| 3924 | $index = $is_repeater_item ? $settings['_id'] : ''; |
| 3925 | ?> |
| 3926 | <div class="premium-post-ticker__icon-wrapper <?php echo $is_repeater_item ? 'premium-repeater-item' : ''; ?>"> |
| 3927 | <?php |
| 3928 | $icon_type = $settings['icon_type']; |
| 3929 | |
| 3930 | if ( 'icon' === $icon_type || 'svg' === $icon_type ) { |
| 3931 | |
| 3932 | if ( 'icon' === $icon_type && 'yes' !== $settings['draw_svg'] ) { |
| 3933 | |
| 3934 | Icons_Manager::render_icon( |
| 3935 | $settings['pa_ticker_icon'], |
| 3936 | array( |
| 3937 | 'class' => array( 'premium-svg-nodraw', 'premium-drawable-icon' ), |
| 3938 | 'aria-hidden' => 'true', |
| 3939 | ) |
| 3940 | ); |
| 3941 | |
| 3942 | } else { |
| 3943 | |
| 3944 | $this->add_render_attribute( 'icon' . $index, 'class', 'premium-drawable-icon' ); |
| 3945 | |
| 3946 | if ( 'yes' === $settings['draw_svg'] ) { |
| 3947 | |
| 3948 | $this->add_render_attribute( 'outer-wrapper' . $index, 'class', 'elementor-invisible' ); |
| 3949 | |
| 3950 | // if ( 'icon' === $icon_type ) { |
| 3951 | |
| 3952 | // $this->add_render_attribute( 'icon' . $index, 'class', $settings['pa_ticker_icon']['value'] ); |
| 3953 | |
| 3954 | // } |
| 3955 | |
| 3956 | $this->add_render_attribute( |
| 3957 | 'icon' . $index, |
| 3958 | array( |
| 3959 | 'class' => 'premium-svg-drawer', |
| 3960 | 'data-svg-reverse' => $is_repeater_item ? 'false' : $settings['lottie_reverse'], |
| 3961 | 'data-svg-loop' => $settings['lottie_loop'], |
| 3962 | 'data-svg-sync' => $is_repeater_item ? 'true' : $settings['svg_sync'], |
| 3963 | 'data-svg-fill' => $is_repeater_item ? $settings['text_icon_color'] : $settings['title_icon_color'], |
| 3964 | 'data-svg-frames' => $is_repeater_item ? '5' : $settings['frames'], |
| 3965 | 'data-svg-yoyo' => $is_repeater_item ? 'false' : $settings['svg_yoyo'], |
| 3966 | ) |
| 3967 | ); |
| 3968 | |
| 3969 | if ( $is_repeater_item ) { |
| 3970 | $this->add_render_attribute( 'icon' . $index, 'data-svg-point', '0' ); |
| 3971 | } else { |
| 3972 | $this->add_render_attribute( 'icon' . $index, 'data-svg-point', $settings['lottie_reverse'] ? $settings['end_point']['size'] : $settings['start_point']['size'] ); |
| 3973 | } |
| 3974 | } else { |
| 3975 | $this->add_render_attribute( 'icon' . $index, 'class', 'premium-svg-nodraw' ); |
| 3976 | } |
| 3977 | |
| 3978 | if ( 'icon' === $icon_type ) { |
| 3979 | |
| 3980 | echo Helper_Functions::get_svg_by_icon( |
| 3981 | $settings['pa_ticker_icon'], |
| 3982 | $this->get_render_attribute_string( 'icon' . $index ) |
| 3983 | ); |
| 3984 | |
| 3985 | } |
| 3986 | } |
| 3987 | |
| 3988 | if ( 'svg' === $icon_type ) { |
| 3989 | ?> |
| 3990 | <div <?php $this->print_render_attribute_string( 'icon' . $index ); ?>> |
| 3991 | <?php |
| 3992 | if ( $is_repeater_item ) { |
| 3993 | echo Helper_Functions::sanitize_svg( $settings['custom_svg'] ); |
| 3994 | } else { |
| 3995 | echo Helper_Functions::sanitize_svg( $this->get_settings_for_display( 'custom_svg' ) ); |
| 3996 | } |
| 3997 | ?> |
| 3998 | </div> |
| 3999 | <?php |
| 4000 | } |
| 4001 | } elseif ( 'image' === $icon_type ) { |
| 4002 | |
| 4003 | if ( ! empty( $settings['image']['url'] ) ) { |
| 4004 | $image_html = Group_Control_Image_Size::get_attachment_image_html( $settings, 'thumbnail', 'image' ); |
| 4005 | echo wp_kses_post( $image_html ); |
| 4006 | } |
| 4007 | } elseif ( 'lottie' === $icon_type ) { |
| 4008 | |
| 4009 | $this->add_render_attribute( |
| 4010 | 'pa_ticker_lottie', |
| 4011 | array( |
| 4012 | 'class' => array( |
| 4013 | 'premium-lottie-animation', |
| 4014 | ), |
| 4015 | 'data-lottie-url' => $settings['lottie_url'], |
| 4016 | 'data-lottie-loop' => $settings['lottie_loop'], |
| 4017 | 'data-lottie-reverse' => $is_repeater_item ? false : $settings['lottie_reverse'], |
| 4018 | ) |
| 4019 | ); |
| 4020 | ?> |
| 4021 | <div <?php $this->print_render_attribute_string( 'pa_ticker_lottie' ); ?>></div> |
| 4022 | <?php |
| 4023 | } |
| 4024 | |
| 4025 | ?> |
| 4026 | </div> |
| 4027 | <?php |
| 4028 | } |
| 4029 | |
| 4030 | /** |
| 4031 | * Render Ticker Post. |
| 4032 | * |
| 4033 | * @access private |
| 4034 | * @since 2.8.22 |
| 4035 | * |
| 4036 | * @param object $query query results. |
| 4037 | * @param array $settings widget settings. |
| 4038 | */ |
| 4039 | private function render_ticker_post( $query, $settings ) { |
| 4040 | |
| 4041 | $posts = $query->posts; |
| 4042 | |
| 4043 | global $post; |
| 4044 | |
| 4045 | foreach ( $posts as $post ) { |
| 4046 | |
| 4047 | setup_postdata( $post ); |
| 4048 | |
| 4049 | $this->get_ticker_post_layout( $settings ); |
| 4050 | } |
| 4051 | |
| 4052 | wp_reset_postdata(); |
| 4053 | } |
| 4054 | |
| 4055 | /** |
| 4056 | * Render Ticker Text Content. |
| 4057 | * |
| 4058 | * @access private |
| 4059 | * @since 2.8.22 |
| 4060 | * |
| 4061 | * @param object $content text content. |
| 4062 | * @param array $settings widget settings. |
| 4063 | */ |
| 4064 | private function render_ticker_text_content( $content, $settings ) { |
| 4065 | |
| 4066 | $typing_enabled = 'yes' === $settings['typing'] && 'layout-4' !== $settings['layout'] ? true : false; |
| 4067 | |
| 4068 | foreach ( $content as $index => $item ) { |
| 4069 | |
| 4070 | $txt_id = $item['_id']; |
| 4071 | |
| 4072 | $this->add_render_attribute( 'post-title' . $txt_id, 'class', 'premium-post-ticker__post-title' ); |
| 4073 | |
| 4074 | $this->add_render_attribute( 'post-wrapper' . $txt_id, 'class', array( 'premium-post-ticker__post-wrapper', 'elementor-repeater-item-' . $txt_id ) ); |
| 4075 | |
| 4076 | $this->add_link_attributes( 'post-link' . $txt_id, $item['item_link'] ); |
| 4077 | |
| 4078 | if ( $typing_enabled ) { |
| 4079 | $this->add_render_attribute( 'post-link' . $txt_id, 'data-typing', esc_attr( $item['text'] ) ); |
| 4080 | } |
| 4081 | |
| 4082 | if ( '' !== $settings['entrance_animation'] ) { |
| 4083 | $this->add_render_attribute( 'post-wrapper' . $txt_id, 'class', 'animated ' . $settings['entrance_animation'] ); |
| 4084 | } |
| 4085 | |
| 4086 | ?> |
| 4087 | <div <?php $this->print_render_attribute_string( 'post-wrapper' . $txt_id ); ?>> |
| 4088 | <div <?php $this->print_render_attribute_string( 'post-title' . $txt_id ); ?>> |
| 4089 | <a <?php $this->print_render_attribute_string( 'post-link' . $txt_id ); ?>> |
| 4090 | <?php echo wp_kses_post( $item['text'] ); ?> |
| 4091 | </a> |
| 4092 | </div> |
| 4093 | <?php |
| 4094 | if ( 'yes' === $item['txt_icon_sw'] ) { |
| 4095 | $item['text_icon_color'] = isset( $settings['text_icon_color'] ) ? $settings['text_icon_color'] : ''; |
| 4096 | $item['index'] = $index; |
| 4097 | $this->render_ticker_icon( $item, true ); |
| 4098 | } |
| 4099 | ?> |
| 4100 | <?php if ( 'yes' === $settings['separator'] && 'yes' === $settings['infinite'] && 'layout-4' !== $settings['layout'] ) : ?> |
| 4101 | <div class="premium-post-ticker__separator"></div> |
| 4102 | <?php endif; ?> |
| 4103 | </div> |
| 4104 | <?php |
| 4105 | } |
| 4106 | } |
| 4107 | |
| 4108 | /** |
| 4109 | * Render Post Layout. |
| 4110 | * |
| 4111 | * @access private |
| 4112 | * @since 2.8.22 |
| 4113 | * |
| 4114 | * @param array $settings widget settings. |
| 4115 | */ |
| 4116 | private function get_ticker_post_layout( $settings ) { |
| 4117 | |
| 4118 | $post_id = get_the_ID(); |
| 4119 | |
| 4120 | $show_thumbnail = 'yes' === $settings['post_img'] ? true : false; |
| 4121 | |
| 4122 | $show_author = 'yes' === $settings['author_meta'] ? true : false; |
| 4123 | |
| 4124 | $show_date = 'yes' === $settings['date_meta'] ? true : false; |
| 4125 | |
| 4126 | $title_tag = Helper_Functions::validate_html_tag( $settings['ticker_title_tag'] ); |
| 4127 | |
| 4128 | $link_target = 'yes' === $settings['new_tab'] ? '_blank' : '_self'; |
| 4129 | |
| 4130 | $post_tag = 'yes' === $settings['article_tag_switcher'] ? 'article' : 'div'; |
| 4131 | |
| 4132 | $content_length = ! empty( $settings['content_length'] ) ? $settings['content_length'] : false; |
| 4133 | |
| 4134 | $typing_enabled = 'yes' === $settings['typing'] && 'layout-4' !== $settings['layout'] ? true : false; |
| 4135 | |
| 4136 | if ( ! $content_length ) { |
| 4137 | $title = the_title( '', '', false ); |
| 4138 | } else { |
| 4139 | $title = implode( ' ', array_slice( explode( ' ', the_title( '', '', false ) ), 0, $content_length ) ) . '...'; |
| 4140 | } |
| 4141 | |
| 4142 | if ( $show_thumbnail ) { |
| 4143 | |
| 4144 | $settings['image'] = array( |
| 4145 | 'id' => get_post_thumbnail_id(), |
| 4146 | ); |
| 4147 | |
| 4148 | $thumbnail_html = Group_Control_Image_Size::get_attachment_image_html( $settings, 'image' ); |
| 4149 | |
| 4150 | $author_classes = Helper_Functions::get_element_classes( $settings['hide_thumb_on'], array( 'premium-post-ticker__thumbnail-wrapper' ) ); |
| 4151 | |
| 4152 | $this->add_render_attribute( 'thumbnail' . $post_id, 'class', $author_classes ); |
| 4153 | } |
| 4154 | |
| 4155 | if ( $show_author ) { |
| 4156 | $author_classes = Helper_Functions::get_element_classes( $settings['hide_author_on'], array( 'premium-post-ticker__post-author' ) ); |
| 4157 | |
| 4158 | $this->add_render_attribute( 'author' . $post_id, 'class', $author_classes ); |
| 4159 | } |
| 4160 | |
| 4161 | if ( $show_date ) { |
| 4162 | |
| 4163 | $date_format = ! empty( $settings['post_date_format'] ) ? $settings['post_date_format'] : get_option( 'date_format' ); |
| 4164 | |
| 4165 | $author_classes = Helper_Functions::get_element_classes( $settings['hide_post_date_on'], array( 'premium-post-ticker__post-date' ) ); |
| 4166 | |
| 4167 | $this->add_render_attribute( 'post-date' . $post_id, 'class', $author_classes ); |
| 4168 | } |
| 4169 | |
| 4170 | $this->add_render_attribute( 'post-title' . $post_id, 'class', 'premium-post-ticker__post-title' ); |
| 4171 | |
| 4172 | $this->add_render_attribute( 'post-wrapper' . $post_id, 'class', 'premium-post-ticker__post-wrapper' ); |
| 4173 | |
| 4174 | $this->add_render_attribute( |
| 4175 | 'post-link' . $post_id, |
| 4176 | array( |
| 4177 | 'href' => esc_url( get_permalink() ), |
| 4178 | 'target' => esc_attr( $link_target ), |
| 4179 | ) |
| 4180 | ); |
| 4181 | |
| 4182 | if ( $typing_enabled ) { |
| 4183 | $this->add_render_attribute( 'post-link' . $post_id, 'data-typing', esc_attr( $title ) ); |
| 4184 | } |
| 4185 | |
| 4186 | if ( '' !== $settings['entrance_animation'] ) { |
| 4187 | $this->add_render_attribute( 'post-wrapper' . $post_id, 'class', 'animated ' . $settings['entrance_animation'] ); |
| 4188 | } |
| 4189 | ?> |
| 4190 | |
| 4191 | <<?php echo wp_kses_post( $post_tag . ' ' . $this->get_render_attribute_string( 'post-wrapper' . $post_id ) ); ?>> |
| 4192 | |
| 4193 | <?php if ( $show_thumbnail ) : ?> |
| 4194 | <div <?php $this->print_render_attribute_string( 'thumbnail' . $post_id ); ?>> |
| 4195 | <a href="<?php the_permalink(); ?>" target="<?php echo esc_attr( $link_target ); ?>"> |
| 4196 | <?php echo wp_kses_post( $thumbnail_html ); ?> |
| 4197 | </a> |
| 4198 | </div> |
| 4199 | <?php endif; ?> |
| 4200 | |
| 4201 | <?php if ( $show_author ) : ?> |
| 4202 | <div> |
| 4203 | <span <?php $this->print_render_attribute_string( 'author' . $post_id ); ?>> |
| 4204 | <i class="fa fa-user fa-fw" aria-hidden="true"></i> |
| 4205 | <?php the_author_posts_link(); ?> |
| 4206 | </span> |
| 4207 | </div> |
| 4208 | <?php endif; ?> |
| 4209 | |
| 4210 | <div> |
| 4211 | <<?php echo wp_kses_post( $title_tag . ' ' . $this->get_render_attribute_string( 'post-title' . $post_id ) ); ?>> |
| 4212 | <a <?php $this->print_render_attribute_string( 'post-link' . $post_id ); ?>> |
| 4213 | <?php echo wp_kses_post( $title ); ?> |
| 4214 | </a> |
| 4215 | </<?php echo wp_kses_post( $title_tag ); ?>> |
| 4216 | </div> |
| 4217 | |
| 4218 | <?php if ( $show_date ) : ?> |
| 4219 | <div> |
| 4220 | <span <?php $this->print_render_attribute_string( 'post-date' . $post_id ); ?>> |
| 4221 | <span><?php the_time( $date_format ); ?></span> |
| 4222 | </span> |
| 4223 | </div> |
| 4224 | <?php endif; ?> |
| 4225 | |
| 4226 | <?php if ( 'yes' === $settings['separator'] && 'yes' === $settings['infinite'] && 'layout-4' !== $settings['layout'] ) : ?> |
| 4227 | <div class="premium-post-ticker__separator"></div> |
| 4228 | <?php endif; ?> |
| 4229 | |
| 4230 | </<?php echo wp_kses_post( $post_tag ); ?>> |
| 4231 | |
| 4232 | <?php |
| 4233 | } |
| 4234 | } |
| 4235 |