dep
3 weeks ago
premium-banner.php
1 day ago
premium-blog.php
2 weeks ago
premium-button.php
2 weeks ago
premium-carousel.php
2 weeks ago
premium-contactform.php
2 weeks ago
premium-countdown.php
2 weeks ago
premium-counter.php
2 weeks ago
premium-dual-header.php
2 weeks ago
premium-fancytext.php
2 weeks ago
premium-grid.php
2 weeks ago
premium-icon-list.php
2 weeks ago
premium-image-button.php
2 weeks ago
premium-image-scroll.php
2 weeks ago
premium-image-separator.php
2 weeks ago
premium-lottie.php
2 weeks ago
premium-maps.php
2 days ago
premium-media-wheel.php
2 weeks ago
premium-mobile-menu.php
2 weeks ago
premium-modalbox.php
2 days ago
premium-nav-menu.php
2 weeks ago
premium-notifications.php
2 weeks ago
premium-person.php
2 weeks ago
premium-pinterest-feed.php
2 weeks ago
premium-post-ticker.php
2 weeks ago
premium-pricing-table.php
2 days ago
premium-progressbar.php
2 weeks ago
premium-search-form.php
2 days ago
premium-svg-drawer.php
2 weeks ago
premium-tcloud.php
2 weeks ago
premium-testimonials.php
2 weeks ago
premium-textual-showcase.php
2 weeks ago
premium-tiktok-feed.php
2 weeks ago
premium-title.php
2 days ago
premium-videobox.php
2 weeks ago
premium-vscroll.php
2 weeks ago
premium-weather.php
2 weeks ago
premium-world-clock.php
2 weeks ago
premium-tiktok-feed.php
3248 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Premium TikTok Feed. |
| 4 | */ |
| 5 | |
| 6 | namespace PremiumAddons\Widgets; |
| 7 | |
| 8 | // Elementor Classes. |
| 9 | use Elementor\Plugin; |
| 10 | use Elementor\Widget_Base; |
| 11 | use Elementor\Icons_Manager; |
| 12 | use Elementor\Control_Media; |
| 13 | use Elementor\Controls_Manager; |
| 14 | use Elementor\Group_Control_Border; |
| 15 | use Elementor\Group_Control_Typography; |
| 16 | use Elementor\Group_Control_Text_Shadow; |
| 17 | use Elementor\Group_Control_Box_Shadow; |
| 18 | use PremiumAddons\Includes\Controls\Premium_Background; |
| 19 | use Elementor\Group_Control_Css_Filter; |
| 20 | use Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 21 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 22 | |
| 23 | // PremiumAddons Classes. |
| 24 | use PremiumAddons\Includes\Helper_Functions; |
| 25 | |
| 26 | if ( ! defined( 'ABSPATH' ) ) { |
| 27 | exit; // If this file is called directly, abort. |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Class Premium_Tiktok_Feed. |
| 32 | */ |
| 33 | class Premium_Tiktok_Feed extends Widget_Base { |
| 34 | |
| 35 | /** |
| 36 | * Check Premium Addons Pro Version. |
| 37 | * |
| 38 | * @var bool $papro_activated |
| 39 | */ |
| 40 | private $papro_activated; |
| 41 | |
| 42 | /** |
| 43 | * Retrieve Widget Name. |
| 44 | * |
| 45 | * @since 1.0.0 |
| 46 | * @access public |
| 47 | */ |
| 48 | public function get_name() { |
| 49 | return 'premium-tiktok-feed'; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Retrieve Widget Title. |
| 54 | * |
| 55 | * @since 1.0.0 |
| 56 | * @access public |
| 57 | */ |
| 58 | public function get_title() { |
| 59 | return __( 'TikTok Feed', 'premium-addons-for-elementor' ); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Retrieve Widget Icon. |
| 64 | * |
| 65 | * @since 1.0.0 |
| 66 | * @access public |
| 67 | * |
| 68 | * @return string widget icon. |
| 69 | */ |
| 70 | public function get_icon() { |
| 71 | return 'pa-tiktok'; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Retrieve Widget Dependent CSS. |
| 76 | * |
| 77 | * @since 1.0.0 |
| 78 | * @access public |
| 79 | * |
| 80 | * @return array CSS style handles. |
| 81 | */ |
| 82 | public function get_style_depends() { |
| 83 | return array( |
| 84 | 'pa-glass', |
| 85 | 'font-awesome-5-all', |
| 86 | 'pa-share-btn', |
| 87 | 'pa-load-animations', |
| 88 | 'pa-image-effects', |
| 89 | 'pa-slick', |
| 90 | 'elementor-common-css', |
| 91 | 'premium-addons', |
| 92 | ); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Retrieve Widget Dependent JS. |
| 97 | * |
| 98 | * @since 1.0.0 |
| 99 | * @access public |
| 100 | * |
| 101 | * @return array JS script handles. |
| 102 | */ |
| 103 | public function get_script_depends() { |
| 104 | |
| 105 | $is_edit = Helper_Functions::is_edit_mode(); |
| 106 | |
| 107 | $scripts = array( 'imagesloaded' ); |
| 108 | |
| 109 | if ( $is_edit ) { |
| 110 | |
| 111 | $scripts = array_merge( $scripts, array( 'pa-glass', 'isotope-js', 'pa-slick' ) ); |
| 112 | |
| 113 | } else { |
| 114 | $settings = $this->get_settings(); |
| 115 | |
| 116 | if ( 'none' !== $settings['tiktok_lq_effect'] ) { |
| 117 | $scripts[] = 'pa-glass'; |
| 118 | } |
| 119 | |
| 120 | if ( 'yes' === $settings['carousel'] ) { |
| 121 | $scripts[] = 'pa-slick'; |
| 122 | } |
| 123 | |
| 124 | if ( 'masonry' === $settings['outer_layout'] ) { |
| 125 | $scripts[] = 'isotope-js'; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | $scripts[] = 'premium-addons'; |
| 130 | |
| 131 | return $scripts; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Retrieve Widget Categories. |
| 136 | * |
| 137 | * @since 1.5.1 |
| 138 | * @access public |
| 139 | * |
| 140 | * @return array Widget categories. |
| 141 | */ |
| 142 | public function get_categories() { |
| 143 | return array( 'premium-elements' ); |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * Retrieve Widget Dependent CSS. |
| 148 | * |
| 149 | * @since 1.0.0 |
| 150 | * @access public |
| 151 | * |
| 152 | * @return array CSS style handles. |
| 153 | */ |
| 154 | public function get_keywords() { |
| 155 | return array( 'pa', 'premium', 'premium tiktok feed', 'tiktok', 'feed', 'social', 'video' ); |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Retrieve Widget Support URL. |
| 160 | * |
| 161 | * @access public |
| 162 | * |
| 163 | * @return string support URL. |
| 164 | */ |
| 165 | public function get_custom_help_url() { |
| 166 | return 'https://premiumaddons.com/support/'; |
| 167 | } |
| 168 | |
| 169 | public function has_widget_inner_wrapper(): bool { |
| 170 | return ! Helper_Functions::check_elementor_experiment( 'e_optimized_markup' ); |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Register Tiktok Feed controls. |
| 175 | * |
| 176 | * @since 1.0.0 |
| 177 | * @access protected |
| 178 | */ |
| 179 | protected function register_controls() { |
| 180 | |
| 181 | $this->papro_activated = Helper_Functions::check_papro_version(); |
| 182 | |
| 183 | $this->add_login_controls(); |
| 184 | |
| 185 | $this->add_query_controls(); |
| 186 | |
| 187 | $this->add_general_controls(); |
| 188 | |
| 189 | $this->add_feed_settings_controls(); |
| 190 | |
| 191 | $this->add_video_settings_controls(); |
| 192 | |
| 193 | $this->add_profile_controls(); |
| 194 | |
| 195 | $this->add_carousel_section(); |
| 196 | |
| 197 | $this->add_helpful_info_section(); |
| 198 | |
| 199 | // style Controls. |
| 200 | $this->add_video_style_controls(); |
| 201 | |
| 202 | $this->add_info_style_controls(); |
| 203 | |
| 204 | $this->add_feed_box_style_controls(); |
| 205 | |
| 206 | if ( $this->papro_activated ) { |
| 207 | do_action( 'pa_tiktok_profile_style', $this ); |
| 208 | } |
| 209 | |
| 210 | $this->add_carousel_style(); |
| 211 | |
| 212 | if ( $this->papro_activated ) { |
| 213 | do_action( 'pa_tiktok_loadmore_style', $this ); |
| 214 | } |
| 215 | |
| 216 | $this->add_share_btn_style(); |
| 217 | |
| 218 | $this->add_share_links_style(); |
| 219 | |
| 220 | $this->add_container_style_controls(); |
| 221 | } |
| 222 | |
| 223 | /** Login Controls. */ |
| 224 | private function add_login_controls() { |
| 225 | |
| 226 | $this->start_controls_section( |
| 227 | 'access_credentials_section', |
| 228 | array( |
| 229 | 'label' => __( 'Access Credentials', 'premium-addons-for-elementor' ), |
| 230 | ) |
| 231 | ); |
| 232 | |
| 233 | $this->add_control( |
| 234 | 'tiktok_login', |
| 235 | array( |
| 236 | 'type' => Controls_Manager::RAW_HTML, |
| 237 | 'raw' => '<form onsubmit="connectTiktokInit(this);" action="javascript:void(0);"><input type="submit" value="Log in with TikTok" class="elementor-button" style="background-color: #000; color: #fff;"></form>', |
| 238 | 'label_block' => true, |
| 239 | ) |
| 240 | ); |
| 241 | |
| 242 | $this->add_control( |
| 243 | 'access_token', |
| 244 | array( |
| 245 | 'label' => __( 'Access Token', 'premium-addons-for-elementor' ), |
| 246 | 'type' => Controls_Manager::TEXTAREA, |
| 247 | 'dynamic' => array( 'active' => true ), |
| 248 | 'ai' => array( |
| 249 | 'active' => false, |
| 250 | ), |
| 251 | ) |
| 252 | ); |
| 253 | |
| 254 | $this->add_control( |
| 255 | 'reload', |
| 256 | array( |
| 257 | 'label' => __( 'Refresh Cached Data Once Every', 'premium-addons-for-elementor' ), |
| 258 | 'type' => Controls_Manager::SELECT, |
| 259 | 'options' => array( |
| 260 | 'day' => __( 'Day', 'premium-addons-for-elementor' ), |
| 261 | 'week' => __( 'Week', 'premium-addons-for-elementor' ), |
| 262 | 'month' => __( 'Month', 'premium-addons-for-elementor' ), |
| 263 | 'year' => __( 'Year', 'premium-addons-for-elementor' ), |
| 264 | ), |
| 265 | 'default' => 'week', |
| 266 | ) |
| 267 | ); |
| 268 | |
| 269 | $this->end_controls_section(); |
| 270 | } |
| 271 | |
| 272 | /** Content Controls. */ |
| 273 | private function add_query_controls() { |
| 274 | |
| 275 | $this->start_controls_section( |
| 276 | 'pa_tiktok_query_sec', |
| 277 | array( |
| 278 | 'label' => __( 'Query', 'premium-addons-for-elementor' ), |
| 279 | ) |
| 280 | ); |
| 281 | |
| 282 | $this->add_control( |
| 283 | 'scheme', |
| 284 | array( |
| 285 | 'label' => __( 'Scheme', 'premium-addons-for-elementor' ), |
| 286 | 'type' => Controls_Manager::SELECT, |
| 287 | 'prefix_class' => 'premium-tiktok-feed__scheme-', |
| 288 | 'options' => array( |
| 289 | 'light' => __( 'Light', 'premium-addons-for-elementor' ), |
| 290 | 'dark' => __( 'Dark', 'premium-addons-for-elementor' ), |
| 291 | ), |
| 292 | 'default' => 'light', |
| 293 | ) |
| 294 | ); |
| 295 | |
| 296 | $this->add_control( |
| 297 | 'show_feed', |
| 298 | array( |
| 299 | 'label' => __( 'Videos', 'premium-addons-for-elementor' ), |
| 300 | 'type' => Controls_Manager::SWITCHER, |
| 301 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 302 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 303 | 'default' => 'yes', |
| 304 | ) |
| 305 | ); |
| 306 | |
| 307 | $this->add_control( |
| 308 | 'sort', |
| 309 | array( |
| 310 | 'label' => __( 'Order By Date', 'premium-addons-for-elementor' ), |
| 311 | 'type' => Controls_Manager::SELECT, |
| 312 | 'label_block' => true, |
| 313 | 'options' => array( |
| 314 | 'default' => __( 'Descending', 'premium-addons-for-elementor' ), |
| 315 | 'reverse' => __( 'Ascending', 'premium-addons-for-elementor' ), |
| 316 | ), |
| 317 | 'default' => 'default', |
| 318 | 'render_type' => 'template', |
| 319 | 'condition' => array( |
| 320 | 'match_id' => '', |
| 321 | 'show_feed' => 'yes', |
| 322 | ), |
| 323 | ) |
| 324 | ); |
| 325 | |
| 326 | $this->add_control( |
| 327 | 'match_id', |
| 328 | array( |
| 329 | 'label' => apply_filters( 'pa_pro_label', __( 'Filter By ID (PRO)', 'premium-addons-for-elementor' ) ), |
| 330 | 'type' => Controls_Manager::TEXT, |
| 331 | 'label_block' => true, |
| 332 | 'description' => 'Enter the video ID(s) you want to display separated by ",", leave it empty to display all the available items.', |
| 333 | 'dynamic' => array( 'active' => true ), |
| 334 | 'render_type' => 'template', |
| 335 | 'condition' => array( |
| 336 | 'show_feed' => 'yes', |
| 337 | ), |
| 338 | 'ai' => array( |
| 339 | 'active' => false, |
| 340 | ), |
| 341 | ) |
| 342 | ); |
| 343 | |
| 344 | $this->add_control( |
| 345 | 'exclude_id', |
| 346 | array( |
| 347 | 'label' => apply_filters( 'pa_pro_label', __( 'Exclude IDs (PRO)', 'premium-addons-for-elementor' ) ), |
| 348 | 'type' => Controls_Manager::TEXT, |
| 349 | 'label_block' => true, |
| 350 | 'description' => 'Enter the video IDs you want to ecxclude separated by ","', |
| 351 | 'dynamic' => array( 'active' => true ), |
| 352 | 'render_type' => 'template', |
| 353 | 'condition' => array( |
| 354 | 'match_id' => '', |
| 355 | 'show_feed' => 'yes', |
| 356 | ), |
| 357 | 'ai' => array( |
| 358 | 'active' => false, |
| 359 | ), |
| 360 | ) |
| 361 | ); |
| 362 | |
| 363 | if ( ! $this->papro_activated ) { |
| 364 | $get_pro = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'tiktok-widget', 'wp-editor', 'get-pro' ); |
| 365 | |
| 366 | $this->add_control( |
| 367 | 'query_notice', |
| 368 | array( |
| 369 | 'type' => Controls_Manager::RAW_HTML, |
| 370 | '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>', |
| 371 | 'content_classes' => 'papro-upgrade-notice', |
| 372 | 'conditions' => array( |
| 373 | 'relation' => 'or', |
| 374 | 'terms' => array( |
| 375 | array( |
| 376 | 'name' => 'match_id', |
| 377 | 'operator' => '!==', |
| 378 | 'value' => '', |
| 379 | ), |
| 380 | array( |
| 381 | 'name' => 'exclude_id', |
| 382 | 'operator' => '!==', |
| 383 | 'value' => '', |
| 384 | ), |
| 385 | ), |
| 386 | ), |
| 387 | ) |
| 388 | ); |
| 389 | |
| 390 | } |
| 391 | |
| 392 | $this->end_controls_section(); |
| 393 | } |
| 394 | |
| 395 | private function add_profile_controls() { |
| 396 | |
| 397 | $this->start_controls_section( |
| 398 | 'pa_tiktok_profile_sec', |
| 399 | array( |
| 400 | 'label' => __( 'Profile Header', 'premium-addons-for-elementor' ), |
| 401 | ) |
| 402 | ); |
| 403 | |
| 404 | $this->add_control( |
| 405 | 'profile_header', |
| 406 | array( |
| 407 | 'label' => __( 'Profile Header', 'premium-addons-for-elementor' ), |
| 408 | 'type' => Controls_Manager::SWITCHER, |
| 409 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 410 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 411 | ) |
| 412 | ); |
| 413 | |
| 414 | if ( ! $this->papro_activated ) { |
| 415 | $get_pro = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'tiktok-widget', 'wp-editor', 'get-pro' ); |
| 416 | |
| 417 | $this->add_control( |
| 418 | 'profile_header_notice', |
| 419 | array( |
| 420 | 'type' => Controls_Manager::RAW_HTML, |
| 421 | '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>', |
| 422 | 'content_classes' => 'papro-upgrade-notice', |
| 423 | 'condition' => array( |
| 424 | 'profile_header' => 'yes', |
| 425 | ), |
| 426 | ) |
| 427 | ); |
| 428 | |
| 429 | } else { |
| 430 | do_action( 'pa_tiktok_profile_controls', $this ); |
| 431 | } |
| 432 | |
| 433 | $this->end_controls_section(); |
| 434 | } |
| 435 | |
| 436 | private function add_feed_settings_controls() { |
| 437 | |
| 438 | $this->start_controls_section( |
| 439 | 'pa_tiktok_vid_sec', |
| 440 | array( |
| 441 | 'label' => __( 'Feed Settings', 'premium-addons-for-elementor' ), |
| 442 | 'condition' => array( |
| 443 | 'show_feed' => 'yes', |
| 444 | ), |
| 445 | ) |
| 446 | ); |
| 447 | |
| 448 | $options = apply_filters( |
| 449 | 'pa_tiktok_options', |
| 450 | array( |
| 451 | 'layouts' => array( |
| 452 | 'layout-1' => __( 'Card', 'premium-addons-for-elementor' ), |
| 453 | 'layout-2' => __( 'Banner (Pro)', 'premium-addons-for-elementor' ), |
| 454 | 'layout-3' => __( 'On Side (Pro)', 'premium-addons-for-elementor' ), |
| 455 | ), |
| 456 | ) |
| 457 | ); |
| 458 | |
| 459 | $this->add_control( |
| 460 | 'vid_layout', |
| 461 | array( |
| 462 | 'label' => __( 'Skin', 'premium-addons-for-elementor' ), |
| 463 | 'type' => Controls_Manager::SELECT, |
| 464 | 'prefix_class' => 'premium-tiktok-feed__vid-', |
| 465 | 'render_type' => 'template', |
| 466 | 'default' => 'layout-1', |
| 467 | 'options' => $options['layouts'], |
| 468 | ) |
| 469 | ); |
| 470 | |
| 471 | $this->add_responsive_control( |
| 472 | 'info_order', |
| 473 | array( |
| 474 | 'label' => __( 'Info Order', 'premium-addons-for-elementor' ), |
| 475 | 'type' => Controls_Manager::CHOOSE, |
| 476 | 'toggle' => false, |
| 477 | 'options' => array( |
| 478 | '0' => array( |
| 479 | 'title' => __( 'Before Video', 'premium-addons-for-elementor' ), |
| 480 | 'icon' => 'eicon-order-start', |
| 481 | ), |
| 482 | '2' => array( |
| 483 | 'title' => __( 'After Video', 'premium-addons-for-elementor' ), |
| 484 | 'icon' => 'eicon-order-end', |
| 485 | ), |
| 486 | ), |
| 487 | 'default' => '2', |
| 488 | 'selectors' => array( |
| 489 | '{{WRAPPER}}.premium-tiktok-feed__vid-layout-1 .premium-tiktok-feed__vid-desc, |
| 490 | {{WRAPPER}}.premium-tiktok-feed__vid-layout-3 .premium-tiktok-feed__vid-meta-wrapper' => 'order: {{VALUE}}', |
| 491 | ), |
| 492 | 'condition' => array( |
| 493 | 'vid_layout!' => 'layout-2', |
| 494 | ), |
| 495 | ) |
| 496 | ); |
| 497 | |
| 498 | $this->add_control( |
| 499 | 'vid_settings_heading', |
| 500 | array( |
| 501 | 'label' => esc_html__( 'Display Options', 'premium-addons-for-elementor' ), |
| 502 | 'type' => Controls_Manager::HEADING, |
| 503 | 'separator' => 'before', |
| 504 | ) |
| 505 | ); |
| 506 | |
| 507 | $this->add_control( |
| 508 | 'vid_tiktok_icon', |
| 509 | array( |
| 510 | 'label' => __( 'TikTok Icon', 'premium-addons-for-elementor' ), |
| 511 | 'type' => Controls_Manager::SWITCHER, |
| 512 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 513 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 514 | 'default' => 'yes', |
| 515 | ) |
| 516 | ); |
| 517 | |
| 518 | $this->add_responsive_control( |
| 519 | 'tiktok_icon_size', |
| 520 | array( |
| 521 | 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ), |
| 522 | 'type' => Controls_Manager::SLIDER, |
| 523 | 'size_units' => array( 'px', 'em' ), |
| 524 | 'separator' => 'before', |
| 525 | 'selectors' => array( |
| 526 | '{{WRAPPER}} .premium-tiktok-feed__vid-meta-wrapper .premium-tiktok-feed__tiktok-icon svg' => 'width: {{SIZE}}px; height: {{SIZE}}px;', |
| 527 | ), |
| 528 | 'condition' => array( |
| 529 | 'vid_tiktok_icon' => 'yes', |
| 530 | ), |
| 531 | ) |
| 532 | ); |
| 533 | |
| 534 | $this->add_control( |
| 535 | 'vid_username', |
| 536 | array( |
| 537 | 'label' => __( 'Username', 'premium-addons-for-elementor' ), |
| 538 | 'type' => Controls_Manager::SWITCHER, |
| 539 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 540 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 541 | 'default' => 'yes', |
| 542 | ) |
| 543 | ); |
| 544 | |
| 545 | $this->add_control( |
| 546 | 'vid_desc', |
| 547 | array( |
| 548 | 'label' => __( 'Description', 'premium-addons-for-elementor' ), |
| 549 | 'type' => Controls_Manager::SWITCHER, |
| 550 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 551 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 552 | 'default' => 'yes', |
| 553 | ) |
| 554 | ); |
| 555 | |
| 556 | $this->add_control( |
| 557 | 'vid_desc_len', |
| 558 | array( |
| 559 | 'label' => __( 'Description Length (Word)', 'premium-addons-for-elementor' ), |
| 560 | 'type' => Controls_Manager::NUMBER, |
| 561 | 'default' => 8, |
| 562 | 'condition' => array( |
| 563 | 'vid_desc' => 'yes', |
| 564 | ), |
| 565 | ) |
| 566 | ); |
| 567 | |
| 568 | $this->add_control( |
| 569 | 'vid_desc_postfix', |
| 570 | array( |
| 571 | 'label' => __( 'Postfix', 'premium-addons-for-elementor' ), |
| 572 | 'type' => Controls_Manager::SELECT, |
| 573 | 'options' => array( |
| 574 | 'dots' => __( 'Dots', 'premium-addons-for-elementor' ), |
| 575 | 'link' => __( 'Link', 'premium-addons-for-elementor' ), |
| 576 | ), |
| 577 | 'default' => 'dots', |
| 578 | 'label_block' => true, |
| 579 | 'condition' => array( |
| 580 | 'vid_desc' => 'yes', |
| 581 | 'vid_desc_len!' => '', |
| 582 | ), |
| 583 | ) |
| 584 | ); |
| 585 | |
| 586 | $this->add_control( |
| 587 | 'vid_desc_postfix_txt', |
| 588 | array( |
| 589 | 'label' => __( 'Read More Text', 'premium-addons-for-elementor' ), |
| 590 | 'type' => Controls_Manager::TEXT, |
| 591 | 'default' => __( 'Read More »', 'premium-addons-for-elementor' ), |
| 592 | 'condition' => array( |
| 593 | 'vid_desc' => 'yes', |
| 594 | 'vid_desc_len!' => '', |
| 595 | 'vid_desc_postfix' => 'link', |
| 596 | ), |
| 597 | ) |
| 598 | ); |
| 599 | |
| 600 | $this->add_control( |
| 601 | 'create_time', |
| 602 | array( |
| 603 | 'label' => __( 'Date', 'premium-addons-for-elementor' ), |
| 604 | 'type' => Controls_Manager::SWITCHER, |
| 605 | 'default' => 'yes', |
| 606 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 607 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 608 | ) |
| 609 | ); |
| 610 | |
| 611 | $this->add_control( |
| 612 | 'date_format', |
| 613 | array( |
| 614 | 'label' => __( 'Date Format', 'premium-addons-for-elementor' ), |
| 615 | 'type' => Controls_Manager::TEXT, |
| 616 | 'label_block' => true, |
| 617 | 'description' => __( 'Know more about date format from ', 'premium-addons-for-elementor' ) . '<a href="https://wordpress.org/documentation/article/customize-date-and-time-format/" target="_blank">here</a>', |
| 618 | 'default' => 'F j, Y', |
| 619 | 'condition' => array( |
| 620 | 'create_time' => 'yes', |
| 621 | ), |
| 622 | 'ai' => array( |
| 623 | 'active' => false, |
| 624 | ), |
| 625 | ) |
| 626 | ); |
| 627 | |
| 628 | $this->add_control( |
| 629 | 'like_count', |
| 630 | array( |
| 631 | 'label' => __( 'Likes Count', 'premium-addons-for-elementor' ), |
| 632 | 'type' => Controls_Manager::SWITCHER, |
| 633 | 'default' => 'yes', |
| 634 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 635 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 636 | ) |
| 637 | ); |
| 638 | |
| 639 | $this->add_control( |
| 640 | 'comment_count', |
| 641 | array( |
| 642 | 'label' => __( 'Comments Count', 'premium-addons-for-elementor' ), |
| 643 | 'type' => Controls_Manager::SWITCHER, |
| 644 | 'default' => 'yes', |
| 645 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 646 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 647 | ) |
| 648 | ); |
| 649 | |
| 650 | $this->add_control( |
| 651 | 'view_count', |
| 652 | array( |
| 653 | 'label' => __( 'View Count', 'premium-addons-for-elementor' ), |
| 654 | 'type' => Controls_Manager::SWITCHER, |
| 655 | 'default' => 'yes', |
| 656 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 657 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 658 | ) |
| 659 | ); |
| 660 | |
| 661 | $this->add_control( |
| 662 | 'share_count', |
| 663 | array( |
| 664 | 'label' => __( 'Share Button', 'premium-addons-for-elementor' ), |
| 665 | 'type' => Controls_Manager::SWITCHER, |
| 666 | 'separator' => 'before', |
| 667 | 'default' => 'yes', |
| 668 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 669 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 670 | ) |
| 671 | ); |
| 672 | |
| 673 | $this->add_control( |
| 674 | 'counters_alignment', |
| 675 | array( |
| 676 | 'label' => __( 'Counters Alignment', 'premium-addons-for-elementor' ), |
| 677 | 'type' => Controls_Manager::CHOOSE, |
| 678 | 'options' => array( |
| 679 | 'flex-start' => array( |
| 680 | 'title' => __( 'Start', 'premium-addons-for-elementor' ), |
| 681 | 'icon' => 'eicon-order-start', |
| 682 | ), |
| 683 | 'center' => array( |
| 684 | 'title' => __( 'Center', 'premium-addons-for-elementor' ), |
| 685 | 'icon' => 'eicon-h-align-center', |
| 686 | ), |
| 687 | 'flex-end' => array( |
| 688 | 'title' => __( 'End', 'premium-addons-for-elementor' ), |
| 689 | 'icon' => 'eicon-order-end', |
| 690 | ), |
| 691 | ), |
| 692 | 'selectors' => array( |
| 693 | '{{WRAPPER}} .premium-tiktok-feed__video-counts' => 'justify-content: {{VALUE}};', |
| 694 | '{{WRAPPER}} .premium-tiktok-feed__shares' => 'margin-left: unset !important;', |
| 695 | ), |
| 696 | 'condition' => array( |
| 697 | 'vid_layout' => 'layout-3', |
| 698 | ), |
| 699 | ) |
| 700 | ); |
| 701 | |
| 702 | $this->end_controls_section(); |
| 703 | } |
| 704 | |
| 705 | private function add_video_settings_controls() { |
| 706 | |
| 707 | $this->start_controls_section( |
| 708 | 'videos_settings_section', |
| 709 | array( |
| 710 | 'label' => __( 'Video Settings', 'premium-addons-for-elementor' ), |
| 711 | 'condition' => array( |
| 712 | 'show_feed' => 'yes', |
| 713 | ), |
| 714 | ) |
| 715 | ); |
| 716 | |
| 717 | $this->add_responsive_control( |
| 718 | 'pa_pin_img_height', |
| 719 | array( |
| 720 | 'label' => __( 'Video Height', 'premium-addons-for-elementor' ), |
| 721 | 'type' => Controls_Manager::SLIDER, |
| 722 | 'size_units' => array( 'px', 'custom' ), |
| 723 | 'range' => array( |
| 724 | 'px' => array( |
| 725 | 'min' => 0, |
| 726 | 'max' => 1000, |
| 727 | ), |
| 728 | ), |
| 729 | 'selectors' => array( |
| 730 | '{{WRAPPER}} .premium-tiktok-feed__video-media' => 'height: {{SIZE}}{{UNIT}};', |
| 731 | ), |
| 732 | ) |
| 733 | ); |
| 734 | |
| 735 | $this->add_responsive_control( |
| 736 | 'object_fit', |
| 737 | array( |
| 738 | 'label' => __( 'Object Fit', 'premium-addons-for-elementor' ), |
| 739 | 'type' => Controls_Manager::SELECT, |
| 740 | 'options' => array( |
| 741 | '' => __( 'Default', 'premium-addons-for-elementor' ), |
| 742 | 'fill' => __( 'Fill', 'premium-addons-for-elementor' ), |
| 743 | 'cover' => __( 'Cover', 'premium-addons-for-elementor' ), |
| 744 | 'contain' => __( 'Contain', 'premium-addons-for-elementor' ), |
| 745 | ), |
| 746 | 'default' => 'cover', |
| 747 | 'selectors' => array( |
| 748 | '{{WRAPPER}} .premium-tiktok-feed__video-media video' => 'object-fit: {{VALUE}};', |
| 749 | ), |
| 750 | ) |
| 751 | ); |
| 752 | |
| 753 | $this->add_control( |
| 754 | 'autoplay_all', |
| 755 | array( |
| 756 | 'label' => __( 'Autoplay All Videos', 'premium-addons-for-elementor' ), |
| 757 | 'type' => Controls_Manager::SWITCHER, |
| 758 | ) |
| 759 | ); |
| 760 | |
| 761 | $this->add_control( |
| 762 | 'autoplay_first', |
| 763 | array( |
| 764 | 'label' => apply_filters( 'pa_pro_label', __( 'Autoplay First Video (PRO)', 'premium-addons-for-elementor' ) ), |
| 765 | 'type' => Controls_Manager::SWITCHER, |
| 766 | 'condition' => array( |
| 767 | 'autoplay_all!' => 'yes', |
| 768 | ), |
| 769 | ) |
| 770 | ); |
| 771 | |
| 772 | $this->add_control( |
| 773 | 'autoplay_hover', |
| 774 | array( |
| 775 | 'label' => apply_filters( 'pa_pro_label', __( 'Autoplay On Hover (PRO)', 'premium-addons-for-elementor' ) ), |
| 776 | 'type' => Controls_Manager::SWITCHER, |
| 777 | 'condition' => array( |
| 778 | 'autoplay_all!' => 'yes', |
| 779 | 'onclick!' => 'play', |
| 780 | ), |
| 781 | ) |
| 782 | ); |
| 783 | |
| 784 | $this->add_control( |
| 785 | 'mute_videos', |
| 786 | array( |
| 787 | 'label' => __( 'Mute Videos', 'premium-addons-for-elementor' ), |
| 788 | 'type' => Controls_Manager::SWITCHER, |
| 789 | ) |
| 790 | ); |
| 791 | |
| 792 | $this->add_control( |
| 793 | 'loop_videos', |
| 794 | array( |
| 795 | 'label' => __( 'Loop Videos', 'premium-addons-for-elementor' ), |
| 796 | 'type' => Controls_Manager::SWITCHER, |
| 797 | ) |
| 798 | ); |
| 799 | |
| 800 | $this->add_control( |
| 801 | 'onclick', |
| 802 | array( |
| 803 | 'label' => __( 'On Click', 'premium-addons-for-elementor' ), |
| 804 | 'type' => Controls_Manager::SELECT, |
| 805 | 'options' => array( |
| 806 | 'default' => __( 'Redirect To TikTok', 'premium-addons-for-elementor' ), |
| 807 | 'play' => __( 'Play Video', 'premium-addons-for-elementor' ), |
| 808 | ), |
| 809 | 'default' => 'play', |
| 810 | 'separator' => 'before', |
| 811 | ) |
| 812 | ); |
| 813 | |
| 814 | $this->add_control( |
| 815 | 'vid_play_icon', |
| 816 | array( |
| 817 | 'label' => __( 'Play Icon', 'premium-addons-for-elementor' ), |
| 818 | 'type' => Controls_Manager::SWITCHER, |
| 819 | 'separator' => 'before', |
| 820 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 821 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 822 | 'default' => 'yes', |
| 823 | 'condition' => array( |
| 824 | 'autoplay_all!' => 'yes', |
| 825 | ), |
| 826 | ) |
| 827 | ); |
| 828 | |
| 829 | $this->add_control( |
| 830 | 'play_icon_color', |
| 831 | array( |
| 832 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 833 | 'type' => Controls_Manager::COLOR, |
| 834 | 'selectors' => array( |
| 835 | '{{WRAPPER}} .premium-tiktok-feed__video-media .premium-tiktok-feed__play-icon i' => 'color: {{VALUE}};', |
| 836 | ), |
| 837 | 'condition' => array( |
| 838 | 'vid_play_icon' => 'yes', |
| 839 | 'autoplay_all!' => 'yes', |
| 840 | ), |
| 841 | ) |
| 842 | ); |
| 843 | |
| 844 | $this->add_responsive_control( |
| 845 | 'play_icon_size', |
| 846 | array( |
| 847 | 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ), |
| 848 | 'type' => Controls_Manager::SLIDER, |
| 849 | 'size_units' => array( 'px', 'em' ), |
| 850 | 'selectors' => array( |
| 851 | '{{WRAPPER}} .premium-tiktok-feed__video-media .premium-tiktok-feed__play-icon i' => 'font-size: {{SIZE}}px;', |
| 852 | ), |
| 853 | 'condition' => array( |
| 854 | 'vid_play_icon' => 'yes', |
| 855 | 'autoplay_all!' => 'yes', |
| 856 | ), |
| 857 | ) |
| 858 | ); |
| 859 | |
| 860 | $this->add_responsive_control( |
| 861 | 'play_icon_hor', |
| 862 | array( |
| 863 | 'label' => __( 'Horizontal Position', 'premium-addons-for-elementor' ), |
| 864 | 'type' => Controls_Manager::SLIDER, |
| 865 | 'size_units' => array( 'px', '%' ), |
| 866 | 'selectors' => array( |
| 867 | '{{WRAPPER}} .premium-tiktok-feed__video-media .premium-tiktok-feed__play-icon' => 'right: {{SIZE}}px;', |
| 868 | ), |
| 869 | 'condition' => array( |
| 870 | 'vid_play_icon' => 'yes', |
| 871 | 'autoplay_all!' => 'yes', |
| 872 | ), |
| 873 | ) |
| 874 | ); |
| 875 | |
| 876 | $this->add_responsive_control( |
| 877 | 'play_icon_ver', |
| 878 | array( |
| 879 | 'label' => __( 'Vertical Position', 'premium-addons-for-elementor' ), |
| 880 | 'type' => Controls_Manager::SLIDER, |
| 881 | 'size_units' => array( 'px', '%' ), |
| 882 | 'selectors' => array( |
| 883 | '{{WRAPPER}} .premium-tiktok-feed__video-media .premium-tiktok-feed__play-icon' => 'top: {{SIZE}}px;', |
| 884 | ), |
| 885 | 'condition' => array( |
| 886 | 'vid_play_icon' => 'yes', |
| 887 | 'autoplay_all!' => 'yes', |
| 888 | ), |
| 889 | ) |
| 890 | ); |
| 891 | |
| 892 | $this->end_controls_section(); |
| 893 | } |
| 894 | |
| 895 | private function add_general_controls() { |
| 896 | |
| 897 | $this->start_controls_section( |
| 898 | 'pa_gen_section', |
| 899 | array( |
| 900 | 'label' => __( 'General Settings', 'premium-addons-for-elementor' ), |
| 901 | 'condition' => array( |
| 902 | 'show_feed' => 'yes', |
| 903 | ), |
| 904 | ) |
| 905 | ); |
| 906 | |
| 907 | $this->add_control( |
| 908 | 'outer_layout', |
| 909 | array( |
| 910 | 'label' => __( 'Layout', 'premium-addons-for-elementor' ), |
| 911 | 'type' => Controls_Manager::SELECT, |
| 912 | 'prefix_class' => 'premium-tiktok-feed__', |
| 913 | 'render_type' => 'template', |
| 914 | 'label_block' => true, |
| 915 | 'options' => array( |
| 916 | 'grid' => __( 'Grid', 'premium-addons-for-elementor' ), |
| 917 | 'masonry' => __( 'Masonry', 'premium-addons-for-elementor' ), |
| 918 | ), |
| 919 | 'default' => 'grid', |
| 920 | ) |
| 921 | ); |
| 922 | |
| 923 | $this->add_responsive_control( |
| 924 | 'pa_tiktok_cols', |
| 925 | array( |
| 926 | 'label' => __( 'Number of Columns', 'premium-addons-for-elementor' ), |
| 927 | 'type' => Controls_Manager::SELECT, |
| 928 | 'options' => array( |
| 929 | '1' => __( '1 Column', 'premium-addons-for-elementor' ), |
| 930 | '2' => __( '2 Columns', 'premium-addons-for-elementor' ), |
| 931 | '3' => __( '3 Columns', 'premium-addons-for-elementor' ), |
| 932 | '4' => __( '4 Columns', 'premium-addons-for-elementor' ), |
| 933 | '5' => __( '5 Columns', 'premium-addons-for-elementor' ), |
| 934 | '6' => __( '6 Columns', 'premium-addons-for-elementor' ), |
| 935 | ), |
| 936 | 'default' => '3', |
| 937 | 'tablet_default' => '2', |
| 938 | 'mobile_default' => '1', |
| 939 | 'render_type' => 'template', |
| 940 | 'label_block' => true, |
| 941 | 'selectors' => array( |
| 942 | '{{WRAPPER}} .premium-tiktok-feed__video-outer-wrapper' => 'width: calc( 100% / {{VALUE}} );', |
| 943 | ), |
| 944 | ) |
| 945 | ); |
| 946 | |
| 947 | $this->add_responsive_control( |
| 948 | 'no_of_posts', |
| 949 | array( |
| 950 | 'label' => __( 'Videos Per Page', 'premium-addons-for-elementor' ), |
| 951 | 'description' => __( 'Set the number of Videos per page', 'premium-addons-for-elementor' ), |
| 952 | 'type' => Controls_Manager::NUMBER, |
| 953 | 'min' => 1, |
| 954 | 'default' => 4, |
| 955 | 'condition' => array( |
| 956 | 'match_id' => '', |
| 957 | 'show_feed' => 'yes', |
| 958 | ), |
| 959 | ) |
| 960 | ); |
| 961 | |
| 962 | $this->add_control( |
| 963 | 'loading_animation', |
| 964 | array( |
| 965 | 'label' => __( 'Loading Animation', 'premium-addons-for-elementor' ), |
| 966 | 'type' => Controls_Manager::SELECT, |
| 967 | 'prefix_class' => 'premium-loading-animation__slide-', |
| 968 | 'options' => array( |
| 969 | 'none' => __( 'None', 'premium-addons-for-elementor' ), |
| 970 | 'up' => __( 'Slide Up', 'premium-addons-for-elementor' ), |
| 971 | 'down' => __( 'Slide Down', 'premium-addons-for-elementor' ), |
| 972 | 'left' => __( 'Slide Left', 'premium-addons-for-elementor' ), |
| 973 | 'right' => __( 'Slide Right', 'premium-addons-for-elementor' ), |
| 974 | ), |
| 975 | 'default' => 'up', |
| 976 | 'condition' => array( |
| 977 | 'load_more_btn' => 'yes', |
| 978 | 'carousel!' => 'yes', |
| 979 | ), |
| 980 | ) |
| 981 | ); |
| 982 | |
| 983 | $this->add_responsive_control( |
| 984 | 'pa_tiktok_spacing', |
| 985 | array( |
| 986 | 'label' => __( 'Spacing', 'premium-addons-for-elementor' ), |
| 987 | 'type' => Controls_Manager::SLIDER, |
| 988 | 'size_units' => array( 'px' ), |
| 989 | 'separator' => 'before', |
| 990 | 'selectors' => array( |
| 991 | '{{WRAPPER}} .premium-tiktok-feed__video-outer-wrapper' => 'padding: {{SIZE}}px;', |
| 992 | ), |
| 993 | ) |
| 994 | ); |
| 995 | |
| 996 | $this->add_control( |
| 997 | 'load_more_btn', |
| 998 | array( |
| 999 | 'label' => __( 'Load More Button', 'premium-addons-for-elementor' ), |
| 1000 | 'type' => Controls_Manager::SWITCHER, |
| 1001 | 'render_type' => 'template', |
| 1002 | 'condition' => array( |
| 1003 | 'carousel!' => 'yes', |
| 1004 | ), |
| 1005 | ) |
| 1006 | ); |
| 1007 | |
| 1008 | if ( $this->papro_activated ) { |
| 1009 | do_action( 'pa_tiktok_load_more_options', $this ); |
| 1010 | } |
| 1011 | |
| 1012 | $this->end_controls_section(); |
| 1013 | } |
| 1014 | |
| 1015 | private function add_carousel_section() { |
| 1016 | |
| 1017 | $this->start_controls_section( |
| 1018 | 'pa_tiktok_carousel_settings', |
| 1019 | array( |
| 1020 | 'label' => __( 'Carousel', 'premium-addons-for-elementor' ), |
| 1021 | 'condition' => array( |
| 1022 | 'show_feed' => 'yes', |
| 1023 | ), |
| 1024 | ) |
| 1025 | ); |
| 1026 | |
| 1027 | $this->add_control( |
| 1028 | 'carousel', |
| 1029 | array( |
| 1030 | 'label' => __( 'Enable Carousel', 'premium-addons-for-elementor' ), |
| 1031 | 'type' => Controls_Manager::SWITCHER, |
| 1032 | 'prefix_class' => 'premium-carousel-', |
| 1033 | 'render_type' => 'template', |
| 1034 | ) |
| 1035 | ); |
| 1036 | |
| 1037 | $this->add_control( |
| 1038 | 'fade', |
| 1039 | array( |
| 1040 | 'label' => __( 'Fade', 'premium-addons-for-elementor' ), |
| 1041 | 'type' => Controls_Manager::SWITCHER, |
| 1042 | 'condition' => array( |
| 1043 | 'carousel' => 'yes', |
| 1044 | 'pa_tiktok_cols' => '1', |
| 1045 | ), |
| 1046 | ) |
| 1047 | ); |
| 1048 | |
| 1049 | $this->add_control( |
| 1050 | 'auto_play', |
| 1051 | array( |
| 1052 | 'label' => __( 'Auto Play', 'premium-addons-for-elementor' ), |
| 1053 | 'type' => Controls_Manager::SWITCHER, |
| 1054 | 'condition' => array( |
| 1055 | 'carousel' => 'yes', |
| 1056 | ), |
| 1057 | ) |
| 1058 | ); |
| 1059 | |
| 1060 | $this->add_control( |
| 1061 | 'autoplay_speed', |
| 1062 | array( |
| 1063 | 'label' => __( 'Autoplay Speed', 'premium-addons-for-elementor' ), |
| 1064 | 'description' => __( 'Autoplay Speed means at which time the next slide should come. Set a value in milliseconds (ms)', 'premium-addons-for-elementor' ), |
| 1065 | 'type' => Controls_Manager::NUMBER, |
| 1066 | 'default' => 5000, |
| 1067 | 'condition' => array( |
| 1068 | 'carousel' => 'yes', |
| 1069 | 'auto_play' => 'yes', |
| 1070 | ), |
| 1071 | ) |
| 1072 | ); |
| 1073 | |
| 1074 | $this->add_control( |
| 1075 | 'slides_to_scroll', |
| 1076 | array( |
| 1077 | 'label' => __( 'Slides To Scroll', 'premium-addons-for-elementor' ), |
| 1078 | 'type' => Controls_Manager::NUMBER, |
| 1079 | 'condition' => array( |
| 1080 | 'carousel' => 'yes', |
| 1081 | ), |
| 1082 | ) |
| 1083 | ); |
| 1084 | |
| 1085 | $this->add_control( |
| 1086 | 'carousel_speed', |
| 1087 | array( |
| 1088 | 'label' => __( 'Transition Speed (ms)', 'premium-addons-for-elementor' ), |
| 1089 | 'description' => __( 'Set the speed of the carousel animation in milliseconds (ms)', 'premium-addons-for-elementor' ), |
| 1090 | 'type' => Controls_Manager::NUMBER, |
| 1091 | 'default' => 300, |
| 1092 | 'render_type' => 'template', |
| 1093 | 'selectors' => array( |
| 1094 | '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper .slick-slide' => 'transition: all {{VALUE}}ms !important', |
| 1095 | ), |
| 1096 | 'condition' => array( |
| 1097 | 'carousel' => 'yes', |
| 1098 | ), |
| 1099 | 'frontend_available' => true, |
| 1100 | ) |
| 1101 | ); |
| 1102 | |
| 1103 | $this->add_control( |
| 1104 | 'carousel_center', |
| 1105 | array( |
| 1106 | 'label' => __( 'Center Mode', 'premium-addons-for-elementor' ), |
| 1107 | 'type' => Controls_Manager::SWITCHER, |
| 1108 | 'condition' => array( |
| 1109 | 'carousel' => 'yes', |
| 1110 | ), |
| 1111 | ) |
| 1112 | ); |
| 1113 | |
| 1114 | $this->add_control( |
| 1115 | 'carousel_spacing', |
| 1116 | array( |
| 1117 | 'label' => __( 'Slides\' Spacing', 'premium-addons-for-elementor' ), |
| 1118 | 'description' => __( 'Set a spacing value in pixels (px)', 'premium-addons-for-elementor' ), |
| 1119 | 'type' => Controls_Manager::NUMBER, |
| 1120 | 'default' => '15', |
| 1121 | 'condition' => array( |
| 1122 | 'carousel' => 'yes', |
| 1123 | ), |
| 1124 | ) |
| 1125 | ); |
| 1126 | |
| 1127 | $this->add_control( |
| 1128 | 'carousel_dots', |
| 1129 | array( |
| 1130 | 'label' => __( 'Navigation Dots', 'premium-addons-for-elementor' ), |
| 1131 | 'type' => Controls_Manager::SWITCHER, |
| 1132 | 'condition' => array( |
| 1133 | 'carousel' => 'yes', |
| 1134 | ), |
| 1135 | ) |
| 1136 | ); |
| 1137 | |
| 1138 | $this->add_control( |
| 1139 | 'carousel_arrows', |
| 1140 | array( |
| 1141 | 'label' => __( 'Navigation Arrows', 'premium-addons-for-elementor' ), |
| 1142 | 'type' => Controls_Manager::SWITCHER, |
| 1143 | 'default' => 'yes', |
| 1144 | 'condition' => array( |
| 1145 | 'carousel' => 'yes', |
| 1146 | ), |
| 1147 | ) |
| 1148 | ); |
| 1149 | |
| 1150 | $this->add_responsive_control( |
| 1151 | 'carousel_arrows_pos', |
| 1152 | array( |
| 1153 | 'label' => __( 'Arrows Position', 'premium-addons-for-elementor' ), |
| 1154 | 'type' => Controls_Manager::SLIDER, |
| 1155 | 'size_units' => array( 'px', 'em' ), |
| 1156 | 'range' => array( |
| 1157 | 'px' => array( |
| 1158 | 'min' => -100, |
| 1159 | 'max' => 100, |
| 1160 | ), |
| 1161 | 'em' => array( |
| 1162 | 'min' => -10, |
| 1163 | 'max' => 10, |
| 1164 | ), |
| 1165 | ), |
| 1166 | 'condition' => array( |
| 1167 | 'carousel' => 'yes', |
| 1168 | 'carousel_arrows' => 'yes', |
| 1169 | ), |
| 1170 | 'selectors' => array( |
| 1171 | '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper a.carousel-arrow.carousel-next' => 'right: {{SIZE}}{{UNIT}};', |
| 1172 | '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper a.carousel-arrow.carousel-prev' => 'left: {{SIZE}}{{UNIT}};', |
| 1173 | ), |
| 1174 | ) |
| 1175 | ); |
| 1176 | |
| 1177 | $this->end_controls_section(); |
| 1178 | } |
| 1179 | |
| 1180 | private function add_helpful_info_section() { |
| 1181 | |
| 1182 | $this->start_controls_section( |
| 1183 | 'section_pa_docs', |
| 1184 | array( |
| 1185 | 'label' => __( 'Help & Docs', 'premium-addons-for-elementor' ), |
| 1186 | ) |
| 1187 | ); |
| 1188 | |
| 1189 | $docs = array( |
| 1190 | 'https://premiumaddons.com/docs/elementor-tiktok-feed-widget/' => __( 'Getting started »', 'premium-addons-for-elementor' ), |
| 1191 | ); |
| 1192 | |
| 1193 | $doc_index = 1; |
| 1194 | foreach ( $docs as $url => $title ) { |
| 1195 | |
| 1196 | $doc_url = Helper_Functions::get_campaign_link( $url, 'tiktok-widget', 'wp-editor', 'get-support' ); |
| 1197 | |
| 1198 | $this->add_control( |
| 1199 | 'doc_' . $doc_index, |
| 1200 | array( |
| 1201 | 'type' => Controls_Manager::RAW_HTML, |
| 1202 | 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc_url, $title ), |
| 1203 | 'content_classes' => 'editor-pa-doc', |
| 1204 | ) |
| 1205 | ); |
| 1206 | |
| 1207 | ++$doc_index; |
| 1208 | |
| 1209 | } |
| 1210 | |
| 1211 | Helper_Functions::register_element_feedback_controls( $this ); |
| 1212 | |
| 1213 | $this->end_controls_section(); |
| 1214 | } |
| 1215 | |
| 1216 | /** Style Controls. */ |
| 1217 | private function add_feed_box_style_controls() { |
| 1218 | |
| 1219 | $this->start_controls_section( |
| 1220 | 'pa_feedbox_style_sec', |
| 1221 | array( |
| 1222 | 'label' => __( 'Feed Box', 'premium-addons-for-elementor' ), |
| 1223 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1224 | 'condition' => array( |
| 1225 | 'show_feed' => 'yes', |
| 1226 | ), |
| 1227 | ) |
| 1228 | ); |
| 1229 | |
| 1230 | $this->add_group_control( |
| 1231 | Group_Control_Box_Shadow::get_type(), |
| 1232 | array( |
| 1233 | 'name' => 'feed_box_shadow', |
| 1234 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__video-wrapper', |
| 1235 | ) |
| 1236 | ); |
| 1237 | |
| 1238 | $this->add_group_control( |
| 1239 | Premium_Background::get_type(), |
| 1240 | array( |
| 1241 | 'name' => 'feed_box_background', |
| 1242 | 'types' => array( 'classic', 'gradient' ), |
| 1243 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__video-wrapper', |
| 1244 | ) |
| 1245 | ); |
| 1246 | |
| 1247 | $this->add_control( |
| 1248 | 'tiktok_lq_effect', |
| 1249 | array( |
| 1250 | 'label' => __( 'Liquid Glass Effect', 'premium-addons-for-elementor' ), |
| 1251 | 'type' => Controls_Manager::SELECT, |
| 1252 | 'description' => sprintf( |
| 1253 | /* translators: 1: `<a>` opening tag, 2: `</a>` closing tag. */ |
| 1254 | 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' ), |
| 1255 | '<a href="https://premiumaddons.com/liquid-glass/" target="_blank">', |
| 1256 | '</a>' |
| 1257 | ), |
| 1258 | 'options' => array( |
| 1259 | 'none' => __( 'None', 'premium-addons-for-elementor' ), |
| 1260 | 'glass1' => __( 'Preset 01', 'premium-addons-for-elementor' ), |
| 1261 | 'glass2' => __( 'Preset 02', 'premium-addons-for-elementor' ), |
| 1262 | 'glass3' => apply_filters( 'pa_pro_label', __( 'Preset 03 (Pro)', 'premium-addons-for-elementor' ) ), |
| 1263 | 'glass4' => apply_filters( 'pa_pro_label', __( 'Preset 04 (Pro)', 'premium-addons-for-elementor' ) ), |
| 1264 | 'glass5' => apply_filters( 'pa_pro_label', __( 'Preset 05 (Pro)', 'premium-addons-for-elementor' ) ), |
| 1265 | 'glass6' => apply_filters( 'pa_pro_label', __( 'Preset 06 (Pro)', 'premium-addons-for-elementor' ) ), |
| 1266 | ), |
| 1267 | 'default' => 'none', |
| 1268 | 'label_block' => true, |
| 1269 | ) |
| 1270 | ); |
| 1271 | |
| 1272 | $this->add_group_control( |
| 1273 | Group_Control_Border::get_type(), |
| 1274 | array( |
| 1275 | 'name' => 'feed_box_border', |
| 1276 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__video-wrapper', |
| 1277 | ) |
| 1278 | ); |
| 1279 | |
| 1280 | $this->add_control( |
| 1281 | 'feed_box_border_rad', |
| 1282 | array( |
| 1283 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 1284 | 'type' => Controls_Manager::SLIDER, |
| 1285 | 'size_units' => array( 'px', '%', 'em' ), |
| 1286 | 'default' => array( |
| 1287 | 'size' => 15, |
| 1288 | 'unit' => 'px', |
| 1289 | ), |
| 1290 | 'selectors' => array( |
| 1291 | '{{WRAPPER}} .premium-tiktok-feed__video-wrapper' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 1292 | ), |
| 1293 | ) |
| 1294 | ); |
| 1295 | |
| 1296 | $this->add_responsive_control( |
| 1297 | 'feed_box_padding', |
| 1298 | array( |
| 1299 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 1300 | 'type' => Controls_Manager::DIMENSIONS, |
| 1301 | 'size_units' => array( 'px', 'em' ), |
| 1302 | 'selectors' => array( |
| 1303 | '{{WRAPPER}} .premium-tiktok-feed__video-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1304 | ), |
| 1305 | ) |
| 1306 | ); |
| 1307 | |
| 1308 | $this->end_controls_section(); |
| 1309 | } |
| 1310 | |
| 1311 | private function add_container_style_controls() { |
| 1312 | |
| 1313 | $this->start_controls_section( |
| 1314 | 'pa_feed_cont_style_sec', |
| 1315 | array( |
| 1316 | 'label' => __( 'Feed Container', 'premium-addons-for-elementor' ), |
| 1317 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1318 | 'condition' => array( |
| 1319 | 'show_feed' => 'yes', |
| 1320 | ), |
| 1321 | ) |
| 1322 | ); |
| 1323 | |
| 1324 | $this->add_group_control( |
| 1325 | Group_Control_Box_Shadow::get_type(), |
| 1326 | array( |
| 1327 | 'name' => 'feed_cont_shadow', |
| 1328 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper', |
| 1329 | ) |
| 1330 | ); |
| 1331 | |
| 1332 | $this->add_group_control( |
| 1333 | Premium_Background::get_type(), |
| 1334 | array( |
| 1335 | 'name' => 'feed_cont_background', |
| 1336 | 'types' => array( 'classic', 'gradient' ), |
| 1337 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper', |
| 1338 | ) |
| 1339 | ); |
| 1340 | |
| 1341 | $this->add_group_control( |
| 1342 | Group_Control_Border::get_type(), |
| 1343 | array( |
| 1344 | 'name' => 'feed_cont_border', |
| 1345 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper', |
| 1346 | ) |
| 1347 | ); |
| 1348 | |
| 1349 | $this->add_control( |
| 1350 | 'feed_cont_border_rad', |
| 1351 | array( |
| 1352 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 1353 | 'type' => Controls_Manager::SLIDER, |
| 1354 | 'size_units' => array( 'px', '%', 'em' ), |
| 1355 | 'selectors' => array( |
| 1356 | '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 1357 | ), |
| 1358 | ) |
| 1359 | ); |
| 1360 | |
| 1361 | $this->add_responsive_control( |
| 1362 | 'feed_cont_padding', |
| 1363 | array( |
| 1364 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 1365 | 'type' => Controls_Manager::DIMENSIONS, |
| 1366 | 'size_units' => array( 'px', 'em' ), |
| 1367 | 'selectors' => array( |
| 1368 | '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1369 | ), |
| 1370 | ) |
| 1371 | ); |
| 1372 | |
| 1373 | $this->add_responsive_control( |
| 1374 | 'feed_cont_margin', |
| 1375 | array( |
| 1376 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 1377 | 'type' => Controls_Manager::DIMENSIONS, |
| 1378 | 'size_units' => array( 'px', 'em' ), |
| 1379 | 'selectors' => array( |
| 1380 | '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1381 | ), |
| 1382 | ) |
| 1383 | ); |
| 1384 | |
| 1385 | $this->end_controls_section(); |
| 1386 | } |
| 1387 | |
| 1388 | private function add_video_style_controls() { |
| 1389 | |
| 1390 | $this->start_controls_section( |
| 1391 | 'pa_tiktok_video_style_section', |
| 1392 | array( |
| 1393 | 'label' => __( 'Video Style', 'premium-addons-for-elementor' ), |
| 1394 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1395 | 'condition' => array( |
| 1396 | 'show_feed' => 'yes', |
| 1397 | ), |
| 1398 | ) |
| 1399 | ); |
| 1400 | |
| 1401 | $this->add_group_control( |
| 1402 | Premium_Background::get_type(), |
| 1403 | array( |
| 1404 | 'name' => 'feed_box_overlay', |
| 1405 | 'label' => __( 'Overlay', 'premium-addons-for-elementor' ), |
| 1406 | 'types' => array( 'classic', 'gradient' ), |
| 1407 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__vid-meta-wrapper', |
| 1408 | 'condition' => array( |
| 1409 | 'vid_layout' => 'layout-2', |
| 1410 | ), |
| 1411 | ) |
| 1412 | ); |
| 1413 | |
| 1414 | $this->add_group_control( |
| 1415 | Group_Control_Css_Filter::get_type(), |
| 1416 | array( |
| 1417 | 'name' => 'css_filters', |
| 1418 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__video-media video', |
| 1419 | ) |
| 1420 | ); |
| 1421 | |
| 1422 | $this->add_group_control( |
| 1423 | Group_Control_Css_Filter::get_type(), |
| 1424 | array( |
| 1425 | 'name' => 'hover_css_filters', |
| 1426 | 'label' => __( 'Hover CSS Filters', 'premium-addons-for-elementor' ), |
| 1427 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__video-wrapper:hover video', |
| 1428 | ) |
| 1429 | ); |
| 1430 | |
| 1431 | $this->add_group_control( |
| 1432 | Group_Control_Box_Shadow::get_type(), |
| 1433 | array( |
| 1434 | 'name' => 'feed_img_shadow', |
| 1435 | 'separator' => 'before', |
| 1436 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__video-media', |
| 1437 | 'condition' => array( |
| 1438 | 'vid_layout!' => 'layout-2', |
| 1439 | ), |
| 1440 | ) |
| 1441 | ); |
| 1442 | |
| 1443 | $this->add_group_control( |
| 1444 | Group_Control_Border::get_type(), |
| 1445 | array( |
| 1446 | 'name' => 'feed_img_border', |
| 1447 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__video-media', |
| 1448 | 'condition' => array( |
| 1449 | 'vid_layout!' => 'layout-2', |
| 1450 | ), |
| 1451 | ) |
| 1452 | ); |
| 1453 | |
| 1454 | $this->add_control( |
| 1455 | 'feed_img_radius', |
| 1456 | array( |
| 1457 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 1458 | 'type' => Controls_Manager::DIMENSIONS, |
| 1459 | 'size_units' => array( 'px', 'em', '%' ), |
| 1460 | 'selectors' => array( |
| 1461 | '{{WRAPPER}} .premium-tiktok-feed__video-media' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 1462 | ), |
| 1463 | 'condition' => array( |
| 1464 | 'vid_layout!' => 'layout-2', |
| 1465 | ), |
| 1466 | ) |
| 1467 | ); |
| 1468 | |
| 1469 | $this->end_controls_section(); |
| 1470 | } |
| 1471 | |
| 1472 | private function add_info_style_controls() { |
| 1473 | |
| 1474 | $counters_cond = array( |
| 1475 | 'relation' => 'or', |
| 1476 | 'terms' => array( |
| 1477 | array( |
| 1478 | 'name' => 'like_count', |
| 1479 | 'value' => 'yes', |
| 1480 | ), |
| 1481 | array( |
| 1482 | 'name' => 'comment_count', |
| 1483 | 'value' => 'yes', |
| 1484 | ), |
| 1485 | array( |
| 1486 | 'name' => 'share_count', |
| 1487 | 'value' => 'yes', |
| 1488 | ), |
| 1489 | array( |
| 1490 | 'name' => 'view_count', |
| 1491 | 'value' => 'yes', |
| 1492 | ), |
| 1493 | ), |
| 1494 | ); |
| 1495 | |
| 1496 | $this->start_controls_section( |
| 1497 | 'pa_tiktok_info_style_section', |
| 1498 | array( |
| 1499 | 'label' => __( 'Feed Info', 'premium-addons-for-elementor' ), |
| 1500 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1501 | 'condition' => array( |
| 1502 | 'show_feed' => 'yes', |
| 1503 | ), |
| 1504 | ) |
| 1505 | ); |
| 1506 | |
| 1507 | $this->add_control( |
| 1508 | 'username_heading', |
| 1509 | array( |
| 1510 | 'label' => esc_html__( 'Username', 'premium-addons-for-elementor' ), |
| 1511 | 'type' => Controls_Manager::HEADING, |
| 1512 | 'condition' => array( |
| 1513 | 'vid_username' => 'yes', |
| 1514 | ), |
| 1515 | ) |
| 1516 | ); |
| 1517 | |
| 1518 | $this->add_group_control( |
| 1519 | Group_Control_Typography::get_type(), |
| 1520 | array( |
| 1521 | 'name' => 'vid_username_typo', |
| 1522 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__vid-creator a', |
| 1523 | 'condition' => array( |
| 1524 | 'vid_username' => 'yes', |
| 1525 | ), |
| 1526 | ) |
| 1527 | ); |
| 1528 | |
| 1529 | $this->add_control( |
| 1530 | 'vid_username_color', |
| 1531 | array( |
| 1532 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1533 | 'type' => Controls_Manager::COLOR, |
| 1534 | 'selectors' => array( |
| 1535 | '{{WRAPPER}} .premium-tiktok-feed__vid-creator a' => 'color: {{VALUE}};', |
| 1536 | ), |
| 1537 | 'condition' => array( |
| 1538 | 'vid_username' => 'yes', |
| 1539 | ), |
| 1540 | ) |
| 1541 | ); |
| 1542 | |
| 1543 | $this->add_responsive_control( |
| 1544 | 'vid_username_margin', |
| 1545 | array( |
| 1546 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 1547 | 'type' => Controls_Manager::DIMENSIONS, |
| 1548 | 'size_units' => array( 'px', 'em' ), |
| 1549 | 'selectors' => array( |
| 1550 | '{{WRAPPER}} .premium-tiktok-feed__vid-creator a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1551 | ), |
| 1552 | 'condition' => array( |
| 1553 | 'vid_username' => 'yes', |
| 1554 | ), |
| 1555 | ) |
| 1556 | ); |
| 1557 | |
| 1558 | $this->add_control( |
| 1559 | 'date_heading', |
| 1560 | array( |
| 1561 | 'label' => esc_html__( 'Date', 'premium-addons-for-elementor' ), |
| 1562 | 'type' => Controls_Manager::HEADING, |
| 1563 | 'separator' => 'before', |
| 1564 | 'condition' => array( |
| 1565 | 'create_time' => 'yes', |
| 1566 | ), |
| 1567 | ) |
| 1568 | ); |
| 1569 | |
| 1570 | $this->add_group_control( |
| 1571 | Group_Control_Typography::get_type(), |
| 1572 | array( |
| 1573 | 'name' => 'date_typo', |
| 1574 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__created-at', |
| 1575 | 'condition' => array( |
| 1576 | 'create_time' => 'yes', |
| 1577 | ), |
| 1578 | ) |
| 1579 | ); |
| 1580 | |
| 1581 | $this->add_control( |
| 1582 | 'date_color', |
| 1583 | array( |
| 1584 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1585 | 'type' => Controls_Manager::COLOR, |
| 1586 | 'selectors' => array( |
| 1587 | '{{WRAPPER}} .premium-tiktok-feed__created-at' => 'color: {{VALUE}};', |
| 1588 | ), |
| 1589 | 'condition' => array( |
| 1590 | 'create_time' => 'yes', |
| 1591 | ), |
| 1592 | ) |
| 1593 | ); |
| 1594 | |
| 1595 | $this->add_responsive_control( |
| 1596 | 'date_username_padding', |
| 1597 | array( |
| 1598 | 'label' => __( 'Username/Date Margin', 'premium-addons-for-elementor' ), |
| 1599 | 'type' => Controls_Manager::DIMENSIONS, |
| 1600 | 'size_units' => array( 'px', 'em' ), |
| 1601 | 'separator' => 'before', |
| 1602 | 'selectors' => array( |
| 1603 | '{{WRAPPER}} .premium-tiktok-feed__vid-meta-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1604 | ), |
| 1605 | 'default' => array( |
| 1606 | 'top' => 15, |
| 1607 | 'right' => 15, |
| 1608 | 'bottom' => 15, |
| 1609 | 'left' => 15, |
| 1610 | 'unit' => 'px', |
| 1611 | ), |
| 1612 | 'conditions' => array( |
| 1613 | 'relation' => 'or', |
| 1614 | 'terms' => array( |
| 1615 | array( |
| 1616 | 'name' => 'vid_username', |
| 1617 | 'value' => 'yes', |
| 1618 | ), |
| 1619 | array( |
| 1620 | 'name' => 'create_time', |
| 1621 | 'value' => 'yes', |
| 1622 | ), |
| 1623 | ), |
| 1624 | ), |
| 1625 | ) |
| 1626 | ); |
| 1627 | |
| 1628 | $this->add_control( |
| 1629 | 'desc_heading', |
| 1630 | array( |
| 1631 | 'label' => esc_html__( 'Description', 'premium-addons-for-elementor' ), |
| 1632 | 'type' => Controls_Manager::HEADING, |
| 1633 | 'separator' => 'before', |
| 1634 | 'condition' => array( |
| 1635 | 'vid_desc' => 'yes', |
| 1636 | ), |
| 1637 | ) |
| 1638 | ); |
| 1639 | |
| 1640 | $this->add_group_control( |
| 1641 | Group_Control_Typography::get_type(), |
| 1642 | array( |
| 1643 | 'name' => 'vid_desc_typo', |
| 1644 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__vid-desc', |
| 1645 | 'condition' => array( |
| 1646 | 'vid_desc' => 'yes', |
| 1647 | ), |
| 1648 | ) |
| 1649 | ); |
| 1650 | |
| 1651 | $this->add_control( |
| 1652 | 'vid_desc_color', |
| 1653 | array( |
| 1654 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1655 | 'type' => Controls_Manager::COLOR, |
| 1656 | 'selectors' => array( |
| 1657 | '{{WRAPPER}} .premium-tiktok-feed__vid-desc' => 'color: {{VALUE}};', |
| 1658 | ), |
| 1659 | 'condition' => array( |
| 1660 | 'vid_desc' => 'yes', |
| 1661 | ), |
| 1662 | ) |
| 1663 | ); |
| 1664 | |
| 1665 | $this->add_responsive_control( |
| 1666 | 'vid_desc_margin', |
| 1667 | array( |
| 1668 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 1669 | 'type' => Controls_Manager::DIMENSIONS, |
| 1670 | 'size_units' => array( 'px', 'em' ), |
| 1671 | 'default' => array( |
| 1672 | 'top' => 15, |
| 1673 | 'right' => 15, |
| 1674 | 'bottom' => 15, |
| 1675 | 'left' => 15, |
| 1676 | 'unit' => 'px', |
| 1677 | ), |
| 1678 | 'selectors' => array( |
| 1679 | '{{WRAPPER}} .premium-tiktok-feed__vid-desc' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1680 | ), |
| 1681 | 'condition' => array( |
| 1682 | 'vid_desc' => 'yes', |
| 1683 | ), |
| 1684 | ) |
| 1685 | ); |
| 1686 | |
| 1687 | $this->add_control( |
| 1688 | 'read_more_heading', |
| 1689 | array( |
| 1690 | 'label' => esc_html__( 'Read More', 'premium-addons-for-elementor' ), |
| 1691 | 'type' => Controls_Manager::HEADING, |
| 1692 | 'separator' => 'before', |
| 1693 | 'condition' => array( |
| 1694 | 'vid_desc' => 'yes', |
| 1695 | 'vid_desc_len!' => '', |
| 1696 | 'vid_desc_postfix' => 'link', |
| 1697 | ), |
| 1698 | ) |
| 1699 | ); |
| 1700 | |
| 1701 | $this->add_group_control( |
| 1702 | Group_Control_Typography::get_type(), |
| 1703 | array( |
| 1704 | 'name' => 'read_more_typo', |
| 1705 | 'selector' => '{{WRAPPER}} .premium-read-more', |
| 1706 | 'condition' => array( |
| 1707 | 'vid_desc' => 'yes', |
| 1708 | 'vid_desc_len!' => '', |
| 1709 | 'vid_desc_postfix' => 'link', |
| 1710 | ), |
| 1711 | ) |
| 1712 | ); |
| 1713 | |
| 1714 | $this->add_control( |
| 1715 | 'read_more_color', |
| 1716 | array( |
| 1717 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1718 | 'type' => Controls_Manager::COLOR, |
| 1719 | 'selectors' => array( |
| 1720 | '{{WRAPPER}} .premium-read-more' => 'color: {{VALUE}};', |
| 1721 | ), |
| 1722 | 'condition' => array( |
| 1723 | 'vid_desc' => 'yes', |
| 1724 | 'vid_desc_len!' => '', |
| 1725 | 'vid_desc_postfix' => 'link', |
| 1726 | ), |
| 1727 | ) |
| 1728 | ); |
| 1729 | |
| 1730 | $this->add_control( |
| 1731 | 'read_more_color_hov', |
| 1732 | array( |
| 1733 | 'label' => __( 'Hover Color', 'premium-addons-for-elementor' ), |
| 1734 | 'type' => Controls_Manager::COLOR, |
| 1735 | 'selectors' => array( |
| 1736 | '{{WRAPPER}} .premium-read-more:hover' => 'color: {{VALUE}};', |
| 1737 | ), |
| 1738 | 'condition' => array( |
| 1739 | 'vid_desc' => 'yes', |
| 1740 | 'vid_desc_len!' => '', |
| 1741 | 'vid_desc_postfix' => 'link', |
| 1742 | ), |
| 1743 | ) |
| 1744 | ); |
| 1745 | |
| 1746 | $this->add_responsive_control( |
| 1747 | 'read_more_margin', |
| 1748 | array( |
| 1749 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 1750 | 'type' => Controls_Manager::DIMENSIONS, |
| 1751 | 'size_units' => array( 'px', 'em' ), |
| 1752 | 'selectors' => array( |
| 1753 | '{{WRAPPER}} .premium-read-more' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1754 | ), |
| 1755 | 'condition' => array( |
| 1756 | 'vid_desc' => 'yes', |
| 1757 | 'vid_desc_len!' => '', |
| 1758 | 'vid_desc_postfix' => 'link', |
| 1759 | ), |
| 1760 | ) |
| 1761 | ); |
| 1762 | |
| 1763 | $this->add_control( |
| 1764 | 'tiktok_icon_heading', |
| 1765 | array( |
| 1766 | 'label' => __( 'Tiktok Icon', 'premium-addons-for-elementor' ), |
| 1767 | 'type' => Controls_Manager::HEADING, |
| 1768 | 'separator' => 'before', |
| 1769 | 'condition' => array( |
| 1770 | 'vid_tiktok_icon' => 'yes', |
| 1771 | ), |
| 1772 | ) |
| 1773 | ); |
| 1774 | |
| 1775 | $this->add_control( |
| 1776 | 'tiktok_icon_color', |
| 1777 | array( |
| 1778 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1779 | 'type' => Controls_Manager::COLOR, |
| 1780 | 'selectors' => array( |
| 1781 | '{{WRAPPER}} .premium-tiktok-icon-video svg circle' => 'fill: {{VALUE}};', |
| 1782 | ), |
| 1783 | 'condition' => array( |
| 1784 | 'vid_tiktok_icon' => 'yes', |
| 1785 | ), |
| 1786 | ) |
| 1787 | ); |
| 1788 | |
| 1789 | $this->add_control( |
| 1790 | 'tiktok_icon_back', |
| 1791 | array( |
| 1792 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 1793 | 'type' => Controls_Manager::COLOR, |
| 1794 | 'selectors' => array( |
| 1795 | '{{WRAPPER}} .premium-tiktok-icon-video' => 'background-color: {{VALUE}};', |
| 1796 | ), |
| 1797 | 'condition' => array( |
| 1798 | 'vid_tiktok_icon' => 'yes', |
| 1799 | ), |
| 1800 | ) |
| 1801 | ); |
| 1802 | |
| 1803 | $this->add_control( |
| 1804 | 'tiktok_icon_radius', |
| 1805 | array( |
| 1806 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 1807 | 'type' => Controls_Manager::SLIDER, |
| 1808 | 'size_units' => array( 'px', '%' ), |
| 1809 | 'selectors' => array( |
| 1810 | '{{WRAPPER}} .premium-tiktok-icon-video' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 1811 | ), |
| 1812 | 'condition' => array( |
| 1813 | 'vid_tiktok_icon' => 'yes', |
| 1814 | ), |
| 1815 | ) |
| 1816 | ); |
| 1817 | |
| 1818 | $this->add_responsive_control( |
| 1819 | 'tiktok_icon_padding', |
| 1820 | array( |
| 1821 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 1822 | 'type' => Controls_Manager::DIMENSIONS, |
| 1823 | 'size_units' => array( 'px', 'em' ), |
| 1824 | 'selectors' => array( |
| 1825 | '{{WRAPPER}} .premium-tiktok-icon-video' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1826 | ), |
| 1827 | 'condition' => array( |
| 1828 | 'vid_tiktok_icon' => 'yes', |
| 1829 | ), |
| 1830 | ) |
| 1831 | ); |
| 1832 | |
| 1833 | $this->add_responsive_control( |
| 1834 | 'tiktok_icon_margin', |
| 1835 | array( |
| 1836 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 1837 | 'type' => Controls_Manager::DIMENSIONS, |
| 1838 | 'size_units' => array( 'px', 'em' ), |
| 1839 | 'selectors' => array( |
| 1840 | '{{WRAPPER}} .premium-tiktok-icon-video' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1841 | ), |
| 1842 | 'condition' => array( |
| 1843 | 'vid_tiktok_icon' => 'yes', |
| 1844 | ), |
| 1845 | ) |
| 1846 | ); |
| 1847 | |
| 1848 | $this->add_control( |
| 1849 | 'counters_heading', |
| 1850 | array( |
| 1851 | 'label' => esc_html__( 'Counters', 'premium-addons-for-elementor' ), |
| 1852 | 'type' => Controls_Manager::HEADING, |
| 1853 | 'separator' => 'before', |
| 1854 | 'conditions' => $counters_cond, |
| 1855 | ) |
| 1856 | ); |
| 1857 | |
| 1858 | $this->add_group_control( |
| 1859 | Group_Control_Typography::get_type(), |
| 1860 | array( |
| 1861 | 'name' => 'counters_typo', |
| 1862 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__video-counts > span:not(.premium-tiktok-feed__shares)', |
| 1863 | 'conditions' => $counters_cond, |
| 1864 | ) |
| 1865 | ); |
| 1866 | |
| 1867 | $this->add_control( |
| 1868 | 'counters_icon_size', |
| 1869 | array( |
| 1870 | 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ), |
| 1871 | 'type' => Controls_Manager::SLIDER, |
| 1872 | 'size_units' => array( 'px', '%', 'em' ), |
| 1873 | 'selectors' => array( |
| 1874 | '{{WRAPPER}} .premium-tiktok-feed__video-counts > span > i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 1875 | '{{WRAPPER}} .premium-tiktok-feed__video-counts > span > svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 1876 | ), |
| 1877 | 'conditions' => $counters_cond, |
| 1878 | ) |
| 1879 | ); |
| 1880 | |
| 1881 | $this->add_control( |
| 1882 | 'counter_color_color', |
| 1883 | array( |
| 1884 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1885 | 'type' => Controls_Manager::COLOR, |
| 1886 | 'selectors' => array( |
| 1887 | '{{WRAPPER}} .premium-tiktok-feed__video-counts > span:not(.premium-tiktok-feed__shares)' => 'color: {{VALUE}};', |
| 1888 | ), |
| 1889 | 'conditions' => $counters_cond, |
| 1890 | ) |
| 1891 | ); |
| 1892 | |
| 1893 | $this->add_control( |
| 1894 | 'counter_icon_color', |
| 1895 | array( |
| 1896 | 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ), |
| 1897 | 'type' => Controls_Manager::COLOR, |
| 1898 | 'selectors' => array( |
| 1899 | '{{WRAPPER}} .premium-tiktok-feed__video-counts > span > i' => 'color: {{VALUE}};', |
| 1900 | '{{WRAPPER}} .premium-tiktok-feed__video-counts > span > svg, {{WRAPPER}} .premium-tiktok-feed__video-counts > span > svg *' => 'fill: {{VALUE}};', |
| 1901 | |
| 1902 | ), |
| 1903 | 'conditions' => $counters_cond, |
| 1904 | ) |
| 1905 | ); |
| 1906 | |
| 1907 | $this->add_group_control( |
| 1908 | Group_Control_Text_Shadow::get_type(), |
| 1909 | array( |
| 1910 | 'name' => 'counters_text_shadow', |
| 1911 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__video-counts > span:not(.premium-tiktok-feed__shares)', |
| 1912 | 'conditions' => $counters_cond, |
| 1913 | ) |
| 1914 | ); |
| 1915 | |
| 1916 | $this->add_group_control( |
| 1917 | Premium_Background::get_type(), |
| 1918 | array( |
| 1919 | 'name' => 'counters_bg', |
| 1920 | 'types' => array( 'classic', 'gradient' ), |
| 1921 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__video-counts', |
| 1922 | 'conditions' => $counters_cond, |
| 1923 | ) |
| 1924 | ); |
| 1925 | |
| 1926 | $this->add_group_control( |
| 1927 | Group_Control_Border::get_type(), |
| 1928 | array( |
| 1929 | 'name' => 'counters_border', |
| 1930 | 'selector' => '{{WRAPPER}} .premium-tiktok-feed__video-counts', |
| 1931 | 'conditions' => $counters_cond, |
| 1932 | ) |
| 1933 | ); |
| 1934 | |
| 1935 | $this->add_control( |
| 1936 | 'counters_rad', |
| 1937 | array( |
| 1938 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 1939 | 'type' => Controls_Manager::DIMENSIONS, |
| 1940 | 'size_units' => array( 'px', '%', 'em' ), |
| 1941 | 'selectors' => array( |
| 1942 | '{{WRAPPER}} .premium-tiktok-feed__video-counts' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1943 | ), |
| 1944 | 'conditions' => $counters_cond, |
| 1945 | ) |
| 1946 | ); |
| 1947 | |
| 1948 | $this->add_responsive_control( |
| 1949 | 'counters_padding', |
| 1950 | array( |
| 1951 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 1952 | 'type' => Controls_Manager::DIMENSIONS, |
| 1953 | 'size_units' => array( 'px', 'em' ), |
| 1954 | 'selectors' => array( |
| 1955 | '{{WRAPPER}} .premium-tiktok-feed__video-counts' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1956 | ), |
| 1957 | 'conditions' => $counters_cond, |
| 1958 | ) |
| 1959 | ); |
| 1960 | |
| 1961 | $this->add_responsive_control( |
| 1962 | 'counters_margin', |
| 1963 | array( |
| 1964 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 1965 | 'type' => Controls_Manager::DIMENSIONS, |
| 1966 | 'size_units' => array( 'px', 'em' ), |
| 1967 | 'default' => array( |
| 1968 | 'top' => 15, |
| 1969 | 'right' => 15, |
| 1970 | 'bottom' => 15, |
| 1971 | 'left' => 15, |
| 1972 | 'unit' => 'px', |
| 1973 | ), |
| 1974 | 'selectors' => array( |
| 1975 | '{{WRAPPER}} .premium-tiktok-feed__video-counts' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1976 | ), |
| 1977 | 'conditions' => array( |
| 1978 | 'terms' => array( |
| 1979 | array( |
| 1980 | 'name' => 'vid_layout', |
| 1981 | 'operator' => '!==', |
| 1982 | 'value' => 'layout-3', |
| 1983 | ), |
| 1984 | $counters_cond, |
| 1985 | ), |
| 1986 | ), |
| 1987 | ) |
| 1988 | ); |
| 1989 | |
| 1990 | $this->add_control( |
| 1991 | 'counters_spacing', |
| 1992 | array( |
| 1993 | 'label' => __( 'Spacing', 'premium-addons-for-elementor' ), |
| 1994 | 'type' => Controls_Manager::SLIDER, |
| 1995 | 'size_units' => array( 'px', '%', 'em' ), |
| 1996 | 'separator' => 'before', |
| 1997 | 'selectors' => array( |
| 1998 | '{{WRAPPER}} .premium-tiktok-feed__video-counts' => 'column-gap: {{SIZE}}{{UNIT}};', |
| 1999 | ), |
| 2000 | 'conditions' => $counters_cond, |
| 2001 | ) |
| 2002 | ); |
| 2003 | |
| 2004 | $this->add_control( |
| 2005 | 'counters_icon_spacing', |
| 2006 | array( |
| 2007 | 'label' => __( 'Icon Spacing', 'premium-addons-for-elementor' ), |
| 2008 | 'type' => Controls_Manager::SLIDER, |
| 2009 | 'size_units' => array( 'px', '%', 'em' ), |
| 2010 | 'separator' => 'before', |
| 2011 | 'selectors' => array( |
| 2012 | '{{WRAPPER}} .premium-tiktok-feed__video-counts > span > i, {{WRAPPER}} .premium-tiktok-feed__video-counts > span > svg ' => 'margin: 0 {{SIZE}}{{UNIT}};', |
| 2013 | ), |
| 2014 | 'conditions' => $counters_cond, |
| 2015 | ) |
| 2016 | ); |
| 2017 | |
| 2018 | $this->end_controls_section(); |
| 2019 | } |
| 2020 | |
| 2021 | private function add_carousel_style() { |
| 2022 | |
| 2023 | $this->start_controls_section( |
| 2024 | 'carousel_dots_style', |
| 2025 | array( |
| 2026 | 'label' => __( 'Carousel Dots', 'premium-addons-for-elementor' ), |
| 2027 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2028 | 'condition' => array( |
| 2029 | 'carousel' => 'yes', |
| 2030 | 'carousel_dots' => 'yes', |
| 2031 | ), |
| 2032 | ) |
| 2033 | ); |
| 2034 | |
| 2035 | $this->add_control( |
| 2036 | 'dot_color', |
| 2037 | array( |
| 2038 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 2039 | 'type' => Controls_Manager::COLOR, |
| 2040 | 'global' => array( |
| 2041 | 'default' => Global_Colors::COLOR_SECONDARY, |
| 2042 | ), |
| 2043 | 'selectors' => array( |
| 2044 | '{{WRAPPER}} ul.slick-dots li' => 'color: {{VALUE}}', |
| 2045 | ), |
| 2046 | ) |
| 2047 | ); |
| 2048 | |
| 2049 | $this->add_control( |
| 2050 | 'dot_color_act', |
| 2051 | array( |
| 2052 | 'label' => __( 'Active Color', 'premium-addons-for-elementor' ), |
| 2053 | 'type' => Controls_Manager::COLOR, |
| 2054 | 'global' => array( |
| 2055 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 2056 | ), |
| 2057 | 'selectors' => array( |
| 2058 | '{{WRAPPER}} ul.slick-dots li.slick-active' => 'color: {{VALUE}}', |
| 2059 | ), |
| 2060 | ) |
| 2061 | ); |
| 2062 | |
| 2063 | $this->end_controls_section(); |
| 2064 | |
| 2065 | $this->start_controls_section( |
| 2066 | 'carousel_arrows_style', |
| 2067 | array( |
| 2068 | 'label' => __( 'Carousel Arrows', 'premium-addons-for-elementor' ), |
| 2069 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2070 | 'condition' => array( |
| 2071 | 'carousel' => 'yes', |
| 2072 | 'carousel_arrows' => 'yes', |
| 2073 | ), |
| 2074 | ) |
| 2075 | ); |
| 2076 | |
| 2077 | $this->add_control( |
| 2078 | 'arrow_color', |
| 2079 | array( |
| 2080 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 2081 | 'type' => Controls_Manager::COLOR, |
| 2082 | 'global' => array( |
| 2083 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 2084 | ), |
| 2085 | 'selectors' => array( |
| 2086 | '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper .slick-arrow' => 'color: {{VALUE}};', |
| 2087 | ), |
| 2088 | ) |
| 2089 | ); |
| 2090 | |
| 2091 | $this->add_responsive_control( |
| 2092 | 'arrow_size', |
| 2093 | array( |
| 2094 | 'label' => __( 'Size', 'premium-addons-for-elementor' ), |
| 2095 | 'type' => Controls_Manager::SLIDER, |
| 2096 | 'size_units' => array( 'px', '%', 'em' ), |
| 2097 | 'selectors' => array( |
| 2098 | '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper .slick-arrow i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 2099 | ), |
| 2100 | ) |
| 2101 | ); |
| 2102 | |
| 2103 | $this->add_control( |
| 2104 | 'arrow_bg', |
| 2105 | array( |
| 2106 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 2107 | 'type' => Controls_Manager::COLOR, |
| 2108 | 'global' => array( |
| 2109 | 'default' => Global_Colors::COLOR_SECONDARY, |
| 2110 | ), |
| 2111 | 'selectors' => array( |
| 2112 | '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper .slick-arrow' => 'background-color: {{VALUE}};', |
| 2113 | ), |
| 2114 | ) |
| 2115 | ); |
| 2116 | |
| 2117 | $this->add_control( |
| 2118 | 'border_radius', |
| 2119 | array( |
| 2120 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2121 | 'type' => Controls_Manager::SLIDER, |
| 2122 | 'size_units' => array( 'px', '%', 'em' ), |
| 2123 | 'selectors' => array( |
| 2124 | '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper .slick-arrow' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 2125 | ), |
| 2126 | ) |
| 2127 | ); |
| 2128 | |
| 2129 | $this->add_control( |
| 2130 | 'arrow_padding', |
| 2131 | array( |
| 2132 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 2133 | 'type' => Controls_Manager::SLIDER, |
| 2134 | 'size_units' => array( 'px', '%', 'em' ), |
| 2135 | 'selectors' => array( |
| 2136 | '{{WRAPPER}} .premium-tiktok-feed__videos-wrapper .slick-arrow' => 'padding: {{SIZE}}{{UNIT}};', |
| 2137 | ), |
| 2138 | ) |
| 2139 | ); |
| 2140 | |
| 2141 | $this->end_controls_section(); |
| 2142 | } |
| 2143 | |
| 2144 | private function add_share_btn_style() { |
| 2145 | |
| 2146 | $icon_spacing = is_rtl() ? 'left' : 'right'; |
| 2147 | |
| 2148 | $this->start_controls_section( |
| 2149 | 'pa_tiktok_Sb_style', |
| 2150 | array( |
| 2151 | 'label' => __( 'Share Button', 'premium-addons-for-elementor' ), |
| 2152 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2153 | 'condition' => array( |
| 2154 | 'share_count' => 'yes', |
| 2155 | ), |
| 2156 | ) |
| 2157 | ); |
| 2158 | |
| 2159 | $this->add_responsive_control( |
| 2160 | 'pa_share_btn_icon_size', |
| 2161 | array( |
| 2162 | 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ), |
| 2163 | 'type' => Controls_Manager::SLIDER, |
| 2164 | 'size_units' => array( 'px', 'em', '%' ), |
| 2165 | 'range' => array( |
| 2166 | 'px' => array( |
| 2167 | 'min' => 0, |
| 2168 | 'max' => 50, |
| 2169 | ), |
| 2170 | 'em' => array( |
| 2171 | 'min' => 1, |
| 2172 | 'max' => 100, |
| 2173 | ), |
| 2174 | ), |
| 2175 | 'default' => array( |
| 2176 | 'size' => 17, |
| 2177 | 'unit' => 'px', |
| 2178 | ), |
| 2179 | 'selectors' => array( |
| 2180 | '{{WRAPPER}} .fa.custom-fa' => 'font-size: {{SIZE}}{{UNIT}};', |
| 2181 | ), |
| 2182 | ) |
| 2183 | ); |
| 2184 | |
| 2185 | $this->add_group_control( |
| 2186 | Group_Control_Typography::get_type(), |
| 2187 | array( |
| 2188 | 'name' => 'pa_share_btn_typo', |
| 2189 | 'selector' => '{{WRAPPER}} .premium-tiktok-sharer', |
| 2190 | ) |
| 2191 | ); |
| 2192 | |
| 2193 | $this->add_control( |
| 2194 | 'pa_share_btn_bg', |
| 2195 | array( |
| 2196 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 2197 | 'type' => Controls_Manager::COLOR, |
| 2198 | 'selectors' => array( |
| 2199 | '{{WRAPPER}} .premium-tiktok-share-container' => 'background-color: {{VALUE}};', |
| 2200 | ), |
| 2201 | ) |
| 2202 | ); |
| 2203 | |
| 2204 | $this->add_responsive_control( |
| 2205 | 'pa_share_btn_spacing', |
| 2206 | array( |
| 2207 | 'label' => __( 'Icon Spacing', 'premium-addons-for-elementor' ), |
| 2208 | 'type' => Controls_Manager::SLIDER, |
| 2209 | 'size_units' => array( 'px', 'em', '%' ), |
| 2210 | 'range' => array( |
| 2211 | 'px' => array( |
| 2212 | 'min' => 0, |
| 2213 | 'max' => 50, |
| 2214 | ), |
| 2215 | 'em' => array( |
| 2216 | 'min' => 1, |
| 2217 | 'max' => 100, |
| 2218 | ), |
| 2219 | ), |
| 2220 | 'default' => array( |
| 2221 | 'size' => 10, |
| 2222 | 'unit' => 'px', |
| 2223 | ), |
| 2224 | 'selectors' => array( |
| 2225 | '{{WRAPPER}} .fa.custom-fa' => 'margin-' . $icon_spacing . ': {{SIZE}}{{UNIT}};', |
| 2226 | ), |
| 2227 | ) |
| 2228 | ); |
| 2229 | |
| 2230 | $this->start_controls_tabs( 'pa_share_buttons' ); |
| 2231 | |
| 2232 | $this->start_controls_tab( |
| 2233 | 'pa_sb_normal', |
| 2234 | array( |
| 2235 | 'label' => __( 'Normal', 'premium-addons-for-elementor' ), |
| 2236 | ) |
| 2237 | ); |
| 2238 | |
| 2239 | $this->add_control( |
| 2240 | 'pa_share_btn_icon_color', |
| 2241 | array( |
| 2242 | 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ), |
| 2243 | 'type' => Controls_Manager::COLOR, |
| 2244 | 'selectors' => array( |
| 2245 | '{{WRAPPER}} .fa.custom-fa' => '-webkit-text-stroke-color: {{VALUE}};', |
| 2246 | ), |
| 2247 | ) |
| 2248 | ); |
| 2249 | |
| 2250 | $this->add_control( |
| 2251 | 'pa_share_btn_color', |
| 2252 | array( |
| 2253 | 'label' => __( 'Text Color', 'premium-addons-for-elementor' ), |
| 2254 | 'type' => Controls_Manager::COLOR, |
| 2255 | 'selectors' => array( |
| 2256 | '{{WRAPPER}} .premium-tiktok-sharer' => 'color: {{VALUE}};', |
| 2257 | ), |
| 2258 | ) |
| 2259 | ); |
| 2260 | |
| 2261 | $this->end_controls_tab(); |
| 2262 | |
| 2263 | $this->start_controls_tab( |
| 2264 | 'pa_sb_hover', |
| 2265 | array( |
| 2266 | 'label' => __( 'Hover', 'premium-addons-for-elementor' ), |
| 2267 | ) |
| 2268 | ); |
| 2269 | |
| 2270 | $this->add_control( |
| 2271 | 'pa_share_btn_Icolor_hov', |
| 2272 | array( |
| 2273 | 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ), |
| 2274 | 'type' => Controls_Manager::COLOR, |
| 2275 | 'selectors' => array( |
| 2276 | '{{WRAPPER}} .premium-tiktok-share-button:hover .fa.custom-fa' => '-webkit-text-stroke-color: {{VALUE}};', |
| 2277 | ), |
| 2278 | ) |
| 2279 | ); |
| 2280 | |
| 2281 | $this->add_control( |
| 2282 | 'pa_share_btn_color_hov', |
| 2283 | array( |
| 2284 | 'label' => __( 'Text Color', 'premium-addons-for-elementor' ), |
| 2285 | 'type' => Controls_Manager::COLOR, |
| 2286 | 'selectors' => array( |
| 2287 | '{{WRAPPER}} .premium-tiktok-share-button:hover .premium-tiktok-sharer' => 'color: {{VALUE}};', |
| 2288 | ), |
| 2289 | ) |
| 2290 | ); |
| 2291 | |
| 2292 | $this->end_controls_tab(); |
| 2293 | |
| 2294 | $this->end_controls_tabs(); |
| 2295 | |
| 2296 | $this->add_group_control( |
| 2297 | Group_Control_Border::get_type(), |
| 2298 | array( |
| 2299 | 'name' => 'pa_share_btn_border', |
| 2300 | 'selector' => '{{WRAPPER}} .premium-tiktok-share-container', |
| 2301 | 'separator' => 'before', |
| 2302 | ) |
| 2303 | ); |
| 2304 | |
| 2305 | $this->add_control( |
| 2306 | 'pa_share_btn_border_radius', |
| 2307 | array( |
| 2308 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2309 | 'type' => Controls_Manager::SLIDER, |
| 2310 | 'size_units' => array( 'px', '%', 'em' ), |
| 2311 | 'selectors' => array( |
| 2312 | '{{WRAPPER}} .premium-tiktok-share-container' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 2313 | ), |
| 2314 | ) |
| 2315 | ); |
| 2316 | |
| 2317 | $this->add_responsive_control( |
| 2318 | 'pa_share_btn_margin', |
| 2319 | array( |
| 2320 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 2321 | 'type' => Controls_Manager::DIMENSIONS, |
| 2322 | 'size_units' => array( 'px', 'em', '%' ), |
| 2323 | 'selectors' => array( |
| 2324 | '{{WRAPPER}} .premium-tiktok-share-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2325 | ), |
| 2326 | ) |
| 2327 | ); |
| 2328 | |
| 2329 | $this->add_responsive_control( |
| 2330 | 'pa_share_btn_padding', |
| 2331 | array( |
| 2332 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 2333 | 'type' => Controls_Manager::DIMENSIONS, |
| 2334 | 'size_units' => array( 'px', 'em', '%' ), |
| 2335 | 'selectors' => array( |
| 2336 | '{{WRAPPER}} .premium-tiktok-share-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2337 | ), |
| 2338 | ) |
| 2339 | ); |
| 2340 | |
| 2341 | $this->end_controls_section(); |
| 2342 | } |
| 2343 | |
| 2344 | private function add_share_links_style() { |
| 2345 | |
| 2346 | $icon_spacing = is_rtl() ? 'left' : 'right'; |
| 2347 | |
| 2348 | $this->start_controls_section( |
| 2349 | 'pa_tiktok_Sl_style', |
| 2350 | array( |
| 2351 | 'label' => __( 'Share Links', 'premium-addons-for-elementor' ), |
| 2352 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2353 | 'condition' => array( |
| 2354 | 'share_count' => 'yes', |
| 2355 | ), |
| 2356 | ) |
| 2357 | ); |
| 2358 | |
| 2359 | $this->add_control( |
| 2360 | 'pa_sl_menu_bg', |
| 2361 | array( |
| 2362 | 'label' => __( 'Menu Background Color', 'premium-addons-for-elementor' ), |
| 2363 | 'type' => Controls_Manager::COLOR, |
| 2364 | 'selectors' => array( |
| 2365 | '{{WRAPPER}} .premium-tiktok-share-menu' => 'background-color: {{VALUE}};', |
| 2366 | ), |
| 2367 | ) |
| 2368 | ); |
| 2369 | |
| 2370 | $this->add_group_control( |
| 2371 | Group_Control_Typography::get_type(), |
| 2372 | array( |
| 2373 | 'name' => 'pa_sl_typo', |
| 2374 | 'selector' => '{{WRAPPER}} .premium-tiktok-share-text', |
| 2375 | ) |
| 2376 | ); |
| 2377 | |
| 2378 | $this->add_responsive_control( |
| 2379 | 'pa_sl_icon_size', |
| 2380 | array( |
| 2381 | 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ), |
| 2382 | 'type' => Controls_Manager::SLIDER, |
| 2383 | 'size_units' => array( 'px', 'em', '%' ), |
| 2384 | 'range' => array( |
| 2385 | 'px' => array( |
| 2386 | 'min' => 0, |
| 2387 | 'max' => 50, |
| 2388 | ), |
| 2389 | 'em' => array( |
| 2390 | 'min' => 1, |
| 2391 | 'max' => 100, |
| 2392 | ), |
| 2393 | ), |
| 2394 | 'default' => array( |
| 2395 | 'size' => 17, |
| 2396 | 'unit' => 'px', |
| 2397 | ), |
| 2398 | 'selectors' => array( |
| 2399 | '{{WRAPPER}} .premium-tiktok-share-item i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 2400 | ), |
| 2401 | ) |
| 2402 | ); |
| 2403 | |
| 2404 | $this->add_control( |
| 2405 | 'pa_sl_border_radius', |
| 2406 | array( |
| 2407 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2408 | 'type' => Controls_Manager::SLIDER, |
| 2409 | 'size_units' => array( 'px', '%', 'em' ), |
| 2410 | 'selectors' => array( |
| 2411 | '{{WRAPPER}} .premium-tiktok-share-menu' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 2412 | ), |
| 2413 | ) |
| 2414 | ); |
| 2415 | |
| 2416 | $this->add_responsive_control( |
| 2417 | 'pa_sl_spacing', |
| 2418 | array( |
| 2419 | 'label' => __( 'Icon Spacing', 'premium-addons-for-elementor' ), |
| 2420 | 'type' => Controls_Manager::SLIDER, |
| 2421 | 'size_units' => array( 'px', 'em', '%' ), |
| 2422 | 'range' => array( |
| 2423 | 'px' => array( |
| 2424 | 'min' => 0, |
| 2425 | 'max' => 50, |
| 2426 | ), |
| 2427 | 'em' => array( |
| 2428 | 'min' => 1, |
| 2429 | 'max' => 100, |
| 2430 | ), |
| 2431 | ), |
| 2432 | 'default' => array( |
| 2433 | 'size' => 3, |
| 2434 | 'unit' => 'px', |
| 2435 | ), |
| 2436 | 'selectors' => array( |
| 2437 | '{{WRAPPER}} .premium-tiktok-share-item i' => 'margin-' . $icon_spacing . ': {{SIZE}}{{UNIT}};', |
| 2438 | ), |
| 2439 | ) |
| 2440 | ); |
| 2441 | |
| 2442 | $this->add_responsive_control( |
| 2443 | 'pa_sl_spacing_ver', |
| 2444 | array( |
| 2445 | 'label' => __( 'Vertical Spacing', 'premium-addons-for-elementor' ), |
| 2446 | 'type' => Controls_Manager::SLIDER, |
| 2447 | 'size_units' => array( 'px', 'em', '%' ), |
| 2448 | 'range' => array( |
| 2449 | 'px' => array( |
| 2450 | 'min' => 0, |
| 2451 | 'max' => 50, |
| 2452 | ), |
| 2453 | 'em' => array( |
| 2454 | 'min' => 1, |
| 2455 | 'max' => 100, |
| 2456 | ), |
| 2457 | ), |
| 2458 | 'selectors' => array( |
| 2459 | '{{WRAPPER}} .premium-tiktok-share-item' => 'margin-top: {{SIZE}}{{UNIT}}; margin-bottom: {{SIZE}}{{UNIT}};', |
| 2460 | ), |
| 2461 | ) |
| 2462 | ); |
| 2463 | |
| 2464 | $this->start_controls_tabs( 'pa_share_links' ); |
| 2465 | |
| 2466 | $this->start_controls_tab( |
| 2467 | 'pa_sl_normal', |
| 2468 | array( |
| 2469 | 'label' => __( 'Normal', 'premium-addons-for-elementor' ), |
| 2470 | ) |
| 2471 | ); |
| 2472 | |
| 2473 | $this->add_control( |
| 2474 | 'pa_sl_color', |
| 2475 | array( |
| 2476 | 'label' => __( 'Text Color', 'premium-addons-for-elementor' ), |
| 2477 | 'type' => Controls_Manager::COLOR, |
| 2478 | 'selectors' => array( |
| 2479 | '{{WRAPPER}} .premium-tiktok-share-text' => 'color: {{VALUE}};', |
| 2480 | ), |
| 2481 | ) |
| 2482 | ); |
| 2483 | |
| 2484 | $this->end_controls_tab(); |
| 2485 | |
| 2486 | $this->start_controls_tab( |
| 2487 | 'pa_sl_hover', |
| 2488 | array( |
| 2489 | 'label' => __( 'Hover', 'premium-addons-for-elementor' ), |
| 2490 | ) |
| 2491 | ); |
| 2492 | |
| 2493 | $this->add_control( |
| 2494 | 'pa_sl_color_hov', |
| 2495 | array( |
| 2496 | 'label' => __( 'Text Color', 'premium-addons-for-elementor' ), |
| 2497 | 'type' => Controls_Manager::COLOR, |
| 2498 | 'selectors' => array( |
| 2499 | '{{WRAPPER}} .premium-tiktok-share-item:hover .premium-tiktok-share-text' => 'color: {{VALUE}};', |
| 2500 | ), |
| 2501 | ) |
| 2502 | ); |
| 2503 | |
| 2504 | $this->end_controls_tab(); |
| 2505 | |
| 2506 | $this->end_controls_tabs(); |
| 2507 | |
| 2508 | $this->end_controls_section(); |
| 2509 | } |
| 2510 | |
| 2511 | |
| 2512 | /** |
| 2513 | * Render title widget output on the frontend. |
| 2514 | * |
| 2515 | * Written in PHP and used to generate the final HTML. |
| 2516 | * |
| 2517 | * @since 1.0.0 |
| 2518 | * @access protected |
| 2519 | */ |
| 2520 | protected function render() { |
| 2521 | |
| 2522 | $settings = $this->get_settings_for_display(); |
| 2523 | |
| 2524 | $this->papro_activated = Helper_Functions::check_papro_version(); |
| 2525 | |
| 2526 | if ( ! $this->papro_activated || version_compare( PREMIUM_PRO_ADDONS_VERSION, '2.9.4', '<' ) ) { |
| 2527 | |
| 2528 | if ( 'layout-1' !== $settings['vid_layout'] || 'yes' === $settings['load_more_btn'] || 'yes' === $settings['profile_header'] || 'yes' === $settings['autoplay_hover'] || 'yes' === $settings['autoplay_first'] || ! empty( $settings['match_id'] ) || ! empty( $settings['exclude_id'] ) ) { |
| 2529 | |
| 2530 | ?> |
| 2531 | <div class="premium-error-notice"> |
| 2532 | <?php |
| 2533 | $message = __( 'This option is available in <b>Premium Addons Pro</b>.', 'premium-addons-for-elementor' ); |
| 2534 | echo wp_kses_post( $message ); |
| 2535 | ?> |
| 2536 | </div> |
| 2537 | <?php |
| 2538 | return false; |
| 2539 | |
| 2540 | } |
| 2541 | } |
| 2542 | |
| 2543 | $widget_id = $this->get_id(); |
| 2544 | |
| 2545 | $access_token = $settings['access_token']; |
| 2546 | |
| 2547 | if ( empty( $access_token ) ) { |
| 2548 | ?> |
| 2549 | <div class="premium-error-notice"> |
| 2550 | <?php echo esc_html( __( 'Please fill the required fields: Access Token', 'premium-addons-for-elementor' ) ); ?> |
| 2551 | </div> |
| 2552 | <?php |
| 2553 | return; |
| 2554 | } |
| 2555 | |
| 2556 | $shortened_token = substr( $access_token, -8 ); |
| 2557 | $is_valid = get_transient( 'pa_tiktok_token_' . $shortened_token ); |
| 2558 | |
| 2559 | if ( false === $is_valid ) { |
| 2560 | |
| 2561 | $refreshed_token = refresh_tiktok_token( $shortened_token ); |
| 2562 | |
| 2563 | $settings['access_token'] = $refreshed_token; |
| 2564 | } else { |
| 2565 | $settings['access_token'] = $is_valid; |
| 2566 | } |
| 2567 | |
| 2568 | $show_feed = 'yes' === $settings['show_feed']; |
| 2569 | $show_profile = 'yes' === $settings['profile_header']; |
| 2570 | $profile_data = get_tiktok_profile_data( $widget_id, $settings ); |
| 2571 | |
| 2572 | if ( 'error' === $profile_data ) { |
| 2573 | return; |
| 2574 | } |
| 2575 | |
| 2576 | if ( $show_feed ) { |
| 2577 | |
| 2578 | $tiktok_feed = get_tiktok_data( $widget_id, $settings ); |
| 2579 | |
| 2580 | get_tiktok_videos_urls( $settings, $tiktok_feed, $widget_id ); |
| 2581 | |
| 2582 | $user_info = array( |
| 2583 | 'username' => $profile_data['display_name'], |
| 2584 | 'url' => $profile_data['profile_deep_link'], |
| 2585 | 'is_verified' => $profile_data['is_verified'], |
| 2586 | ); |
| 2587 | |
| 2588 | $carousel = 'yes' === $settings['carousel']; |
| 2589 | $load_more_btn = ! $carousel && 'yes' === $settings['load_more_btn']; |
| 2590 | |
| 2591 | $tiktok_settings = array( |
| 2592 | 'carousel' => $carousel, |
| 2593 | 'layout' => $settings['outer_layout'], |
| 2594 | 'playOnHover' => 'yes' === $settings['autoplay_hover'], |
| 2595 | 'onClick' => $settings['onclick'], |
| 2596 | ); |
| 2597 | |
| 2598 | if ( $carousel ) { |
| 2599 | |
| 2600 | $carousel_settings = array( |
| 2601 | 'slidesToScroll' => $settings['slides_to_scroll'], |
| 2602 | 'slidesToShow' => empty( $settings['pa_tiktok_cols'] ) ? 4 : $settings['pa_tiktok_cols'], |
| 2603 | 'slidesToShowTab' => isset( $settings['pa_tiktok_cols_tablet'] ) ? $settings['pa_tiktok_cols_tablet'] : 1, |
| 2604 | 'slidesToShowMobile' => isset( $settings['pa_tiktok_cols_mobile'] ) ? $settings['pa_tiktok_cols_mobile'] : 1, |
| 2605 | 'fade' => 'yes' === $settings['fade'], |
| 2606 | 'autoPlay' => 'yes' === $settings['auto_play'], |
| 2607 | 'autoplaySpeed' => $settings['autoplay_speed'], |
| 2608 | 'centerMode' => 'yes' === $settings['carousel_center'], |
| 2609 | 'centerPadding' => $settings['carousel_spacing'], |
| 2610 | 'arrows' => 'yes' === $settings['carousel_arrows'], |
| 2611 | 'dots' => 'yes' === $settings['carousel_dots'], |
| 2612 | 'speed' => $settings['carousel_speed'], |
| 2613 | ); |
| 2614 | |
| 2615 | $this->add_render_attribute( 'outer_container', 'data-pa-carousel', wp_json_encode( $carousel_settings ) ); |
| 2616 | } |
| 2617 | |
| 2618 | if ( $load_more_btn ) { |
| 2619 | $load_more_count = empty( $settings['no_per_load'] ) ? 3 : $settings['no_per_load']; |
| 2620 | $tiktok_settings['loadMore'] = true; |
| 2621 | $tiktok_settings['loadMoreCount'] = empty( $settings['no_per_load'] ) ? 3 : $settings['no_per_load']; |
| 2622 | |
| 2623 | $this->add_render_attribute( 'outer_container', 'data-pa-load-bookmark', $settings['pa_tiktok_cols'] ); |
| 2624 | } |
| 2625 | |
| 2626 | $this->add_render_attribute( 'videos_container', 'class', 'premium-tiktok-feed__videos-wrapper' ); |
| 2627 | |
| 2628 | $this->add_render_attribute( 'outer_container', 'data-pa-tiktok-settings', wp_json_encode( $tiktok_settings ) ); |
| 2629 | } |
| 2630 | |
| 2631 | $this->add_render_attribute( 'outer_container', 'class', 'premium-tiktok-feed__outer-wrapper' ); |
| 2632 | |
| 2633 | ?> |
| 2634 | <div <?php $this->print_render_attribute_string( 'outer_container' ); ?>> |
| 2635 | <?php |
| 2636 | if ( $show_profile ) { |
| 2637 | ?> |
| 2638 | <div class="premium-tiktok-feed__profile-header"> <?php $this->render_user_profile( $widget_id, $settings, $profile_data ); ?> </div> |
| 2639 | <?php |
| 2640 | } |
| 2641 | |
| 2642 | if ( $show_feed ) { |
| 2643 | $this->render_tiktok_videos( $tiktok_feed, $settings, $user_info ); |
| 2644 | |
| 2645 | if ( $load_more_btn ) { |
| 2646 | ?> |
| 2647 | <div class="premium-tiktok-feed__load-more-wrapper"> |
| 2648 | <a type="button" data-role="none" role="button" class="premium-tiktok-feed__load-more-btn"><?php echo esc_html( $settings['more_btn_txt'] ); ?></a> |
| 2649 | </div> |
| 2650 | <?php |
| 2651 | } |
| 2652 | } |
| 2653 | ?> |
| 2654 | </div> |
| 2655 | <?php |
| 2656 | |
| 2657 | if ( Plugin::instance()->editor->is_edit_mode() ) { |
| 2658 | |
| 2659 | if ( 'masonry' === $settings['outer_layout'] && 'yes' !== $settings['carousel'] ) { |
| 2660 | $this->render_editor_script(); |
| 2661 | } |
| 2662 | } |
| 2663 | } |
| 2664 | |
| 2665 | /** |
| 2666 | * Renders TikTok Videos. |
| 2667 | * |
| 2668 | * @access private |
| 2669 | * @since 4.10.3 |
| 2670 | * |
| 2671 | * @param array $tiktok_feed videos feed. |
| 2672 | * @param array $settings widget settings. |
| 2673 | * @param array $user_info user info. |
| 2674 | */ |
| 2675 | private function render_tiktok_videos( $tiktok_feed, $settings, $user_info ) { |
| 2676 | |
| 2677 | $videos_path = set_url_scheme( wp_upload_dir()['baseurl'] . '/tiktok-videos' ); |
| 2678 | |
| 2679 | $vid_layout = $settings['vid_layout']; |
| 2680 | $exclude_arr = array(); |
| 2681 | $load_more_btn = 'yes' !== $settings['carousel'] && 'yes' === $settings['load_more_btn']; |
| 2682 | $load_more_count = 3; |
| 2683 | |
| 2684 | $vid_settings = array( |
| 2685 | 'tiktok_icon' => 'yes' === $settings['vid_tiktok_icon'], |
| 2686 | 'username' => 'yes' === $settings['vid_username'], |
| 2687 | 'desc' => 'yes' === $settings['vid_desc'], |
| 2688 | 'date' => 'yes' === $settings['create_time'], |
| 2689 | 'likes' => 'yes' === $settings['like_count'], |
| 2690 | 'comments' => 'yes' === $settings['comment_count'], |
| 2691 | 'shares' => 'yes' === $settings['share_count'], |
| 2692 | 'views' => 'yes' === $settings['view_count'], |
| 2693 | ); |
| 2694 | |
| 2695 | $show_vid_counters = $vid_settings['likes'] || $vid_settings['comments'] || $vid_settings['shares'] || $vid_settings['views']; |
| 2696 | |
| 2697 | if ( $load_more_btn ) { |
| 2698 | $load_more_count = empty( $settings['no_per_load'] ) ? $load_more_count : $settings['no_per_load']; |
| 2699 | } |
| 2700 | |
| 2701 | if ( empty( $settings['match_id'] ) ) { |
| 2702 | |
| 2703 | if ( 'reverse' === $settings['sort'] ) { |
| 2704 | $tiktok_feed = array_reverse( $tiktok_feed ); |
| 2705 | } |
| 2706 | |
| 2707 | if ( ! empty( $settings['exclude_id'] ) ) { |
| 2708 | $exclude_arr = explode( ',', $settings['exclude_id'] ); |
| 2709 | } |
| 2710 | } |
| 2711 | |
| 2712 | $this->add_render_attribute( 'video_wrap', 'class', 'premium-tiktok-feed__video-wrapper' ); |
| 2713 | |
| 2714 | if ( 'none' !== $settings['tiktok_lq_effect'] ) { |
| 2715 | $this->add_render_attribute( 'video_wrap', 'class', 'premium-con-lq__' . $settings['tiktok_lq_effect'] ); |
| 2716 | } |
| 2717 | |
| 2718 | ?> |
| 2719 | <div <?php $this->print_render_attribute_string( 'videos_container' ); ?>> |
| 2720 | <?php |
| 2721 | foreach ( $tiktok_feed as $index => $feed ) { |
| 2722 | |
| 2723 | $video_url = $videos_path . '/' . $feed['id'] . '.mp4'; |
| 2724 | |
| 2725 | $video_html = '<video src="' . $video_url . '#t=0.001" playsinline'; |
| 2726 | |
| 2727 | $play_icon = 'yes' === $settings['vid_play_icon'] ? 'premium-tiktok-feed__play-icon ' : ''; |
| 2728 | if ( 'yes' === $settings['autoplay_all'] || ( 0 === $index && 'yes' === $settings['autoplay_first'] ) ) { |
| 2729 | |
| 2730 | $video_html .= ' autoplay'; |
| 2731 | |
| 2732 | $video_html .= ' class="video-playing"'; |
| 2733 | |
| 2734 | if ( ! empty( $play_icon ) ) { |
| 2735 | if ( 'yes' !== $settings['autoplay_hover'] || ( 0 === $index && 'yes' === $settings['autoplay_first'] ) ) { |
| 2736 | $play_icon .= 'premium-addons__v-hidden'; |
| 2737 | } |
| 2738 | } |
| 2739 | } |
| 2740 | |
| 2741 | if ( 'yes' === $settings['mute_videos'] ) { |
| 2742 | $video_html .= ' muted'; |
| 2743 | } |
| 2744 | |
| 2745 | if ( 'yes' === $settings['loop_videos'] ) { |
| 2746 | $video_html .= ' loop'; |
| 2747 | } |
| 2748 | |
| 2749 | $video_html .= '></video>'; |
| 2750 | |
| 2751 | if ( count( $exclude_arr ) && in_array( $feed['id'], $exclude_arr, true ) ) { |
| 2752 | continue; |
| 2753 | } |
| 2754 | |
| 2755 | $this->add_render_attribute( 'vid_outer_container' . $index, 'class', 'premium-tiktok-feed__video-outer-wrapper' ); |
| 2756 | |
| 2757 | if ( $load_more_btn && $index >= $settings['pa_tiktok_cols'] ) { |
| 2758 | $this->add_render_attribute( 'vid_outer_container' . $index, 'class', 'premium-display-none' ); |
| 2759 | } |
| 2760 | ?> |
| 2761 | <div <?php $this->print_render_attribute_string( 'vid_outer_container' . $index ); ?>> |
| 2762 | <div <?php $this->print_render_attribute_string( 'video_wrap' ); ?>> |
| 2763 | <?php if ( 'layout-1' === $vid_layout ) { ?> |
| 2764 | |
| 2765 | <div class="premium-tiktok-feed__vid-meta-wrapper"> |
| 2766 | <?php |
| 2767 | if ( $vid_settings['username'] || $vid_settings['date'] ) { |
| 2768 | $this->get_video_meta( $settings, $vid_settings, $feed, $user_info ); |
| 2769 | } |
| 2770 | ?> |
| 2771 | |
| 2772 | <?php if ( $vid_settings['tiktok_icon'] ) : ?> |
| 2773 | <?php $this->render_tiktok_icon(); ?> |
| 2774 | <?php endif; ?> |
| 2775 | </div> |
| 2776 | <?php if ( $vid_settings['desc'] ) : ?> |
| 2777 | <div class="premium-tiktok-feed__vid-desc"><?php $this->render_feed_desc( $feed['video_description'], $feed['share_url'], $settings ); ?> </div> |
| 2778 | <?php endif; ?> |
| 2779 | |
| 2780 | <div class="premium-tiktok-feed__video-media" data-pa-tiktok-user="<?php echo esc_attr( $user_info['username'] ); ?>" data-pa-tiktok-embed="<?php echo esc_attr( $feed['id'] ); ?>" data-pa-tiktok-embed-width="<?php echo esc_attr( $feed['width'] ); ?>" data-pa-tiktok-embed-height="<?php echo esc_attr( $feed['height'] ); ?>"> |
| 2781 | <?php if ( ! empty( $play_icon ) ) : ?> |
| 2782 | <span class="<?php echo esc_attr( $play_icon ); ?>"> |
| 2783 | <i class="fas fa-play" aria-hidden="true"></i> |
| 2784 | </span> |
| 2785 | <?php endif; ?> |
| 2786 | |
| 2787 | <?php echo wp_kses_post( $video_html ); ?> |
| 2788 | |
| 2789 | <?php if ( 'default' === $settings['onclick'] ) : ?> |
| 2790 | <a class="premium-tiktok-feed__video-link" href="<?php echo esc_url( $feed['share_url'] ); ?>" target="_blank"></a> |
| 2791 | <?php endif; ?> |
| 2792 | </div> |
| 2793 | |
| 2794 | <?php |
| 2795 | if ( $show_vid_counters ) { |
| 2796 | $this->get_video_counters( $vid_settings, $feed ); |
| 2797 | } |
| 2798 | ?> |
| 2799 | <?php } elseif ( 'layout-2' === $vid_layout ) { ?> |
| 2800 | <div class="premium-tiktok-feed__vid-meta-wrapper"> |
| 2801 | <div class="premium-tiktok-feed__vid-inner-meta"> |
| 2802 | <?php |
| 2803 | if ( $vid_settings['username'] || $vid_settings['date'] ) { |
| 2804 | $this->get_video_meta( $settings, $vid_settings, $feed, $user_info ); |
| 2805 | } |
| 2806 | ?> |
| 2807 | |
| 2808 | <?php if ( $vid_settings['tiktok_icon'] ) : ?> |
| 2809 | <?php $this->render_tiktok_icon(); ?> |
| 2810 | <?php endif; ?> |
| 2811 | </div> |
| 2812 | |
| 2813 | <?php if ( $vid_settings['desc'] ) : ?> |
| 2814 | <div class="premium-tiktok-feed__vid-desc"><?php $this->render_feed_desc( $feed['video_description'], $feed['share_url'], $settings ); ?></div> |
| 2815 | <?php endif; ?> |
| 2816 | |
| 2817 | <?php |
| 2818 | if ( $show_vid_counters ) { |
| 2819 | $this->get_video_counters( $vid_settings, $feed ); |
| 2820 | } |
| 2821 | ?> |
| 2822 | </div> |
| 2823 | <div class="premium-tiktok-feed__video-media" data-pa-tiktok-user="<?php echo esc_attr( $user_info['username'] ); ?>" data-pa-tiktok-embed="<?php echo esc_attr( $feed['id'] ); ?>" data-pa-tiktok-embed-width="<?php echo esc_attr( $feed['width'] ); ?>" data-pa-tiktok-embed-height="<?php echo esc_attr( $feed['height'] ); ?>"> |
| 2824 | <?php if ( ! empty( $play_icon ) ) : ?> |
| 2825 | <span class="<?php echo esc_attr( $play_icon ); ?>"> |
| 2826 | <i class="fas fa-play" aria-hidden="true"></i> |
| 2827 | </span> |
| 2828 | <?php endif; ?> |
| 2829 | |
| 2830 | <?php echo wp_kses_post( $video_html ); ?> |
| 2831 | |
| 2832 | <?php if ( 'default' === $settings['onclick'] ) : ?> |
| 2833 | <a class="premium-tiktok-feed__video-link" href="<?php echo esc_url( $feed['share_url'] ); ?>" target="_blank"></a> |
| 2834 | <?php endif; ?> |
| 2835 | </div> |
| 2836 | <?php } else { ?> |
| 2837 | |
| 2838 | <div class="premium-tiktok-feed__vid-meta-wrapper"> |
| 2839 | |
| 2840 | <?php if ( $vid_settings['tiktok_icon'] ) : ?> |
| 2841 | <?php $this->render_tiktok_icon(); ?> |
| 2842 | <?php endif; ?> |
| 2843 | |
| 2844 | <?php if ( $vid_settings['desc'] ) : ?> |
| 2845 | <div class="premium-tiktok-feed__vid-desc"><?php $this->render_feed_desc( $feed['video_description'], $feed['share_url'], $settings ); ?> </div> |
| 2846 | <?php endif; ?> |
| 2847 | |
| 2848 | <?php |
| 2849 | if ( $vid_settings['username'] || $vid_settings['date'] ) { |
| 2850 | $this->get_video_meta( $settings, $vid_settings, $feed, $user_info ); |
| 2851 | } |
| 2852 | |
| 2853 | if ( $show_vid_counters ) { |
| 2854 | $this->get_video_counters( $vid_settings, $feed ); |
| 2855 | } |
| 2856 | ?> |
| 2857 | </div> |
| 2858 | <div class="premium-tiktok-feed__video-media" data-pa-tiktok-user="<?php echo esc_attr( $user_info['username'] ); ?>" data-pa-tiktok-embed="<?php echo esc_attr( $feed['id'] ); ?>" data-pa-tiktok-embed-width="<?php echo esc_attr( $feed['width'] ); ?>" data-pa-tiktok-embed-height="<?php echo esc_attr( $feed['height'] ); ?>"> |
| 2859 | |
| 2860 | <?php if ( ! empty( $play_icon ) ) : ?> |
| 2861 | <span class="<?php echo esc_attr( $play_icon ); ?>"> |
| 2862 | <i class="fas fa-play" aria-hidden="true"></i> |
| 2863 | </span> |
| 2864 | <?php endif; ?> |
| 2865 | |
| 2866 | <?php echo wp_kses_post( $video_html ); ?> |
| 2867 | |
| 2868 | <?php if ( 'default' === $settings['onclick'] ) : ?> |
| 2869 | <a class="premium-tiktok-feed__video-link" href="<?php echo esc_url( $feed['share_url'] ); ?>" target="_blank"></a> |
| 2870 | <?php endif; ?> |
| 2871 | </div> |
| 2872 | <?php } ?> |
| 2873 | </div> |
| 2874 | </div> |
| 2875 | <?php |
| 2876 | } |
| 2877 | ?> |
| 2878 | </div> |
| 2879 | <?php |
| 2880 | } |
| 2881 | |
| 2882 | /** |
| 2883 | * Renders user profile. |
| 2884 | * |
| 2885 | * @access private |
| 2886 | * @since 4.10.3 |
| 2887 | * |
| 2888 | * @param string $id widget id. |
| 2889 | * @param array $settings widget settings. |
| 2890 | * @param array $profile_data profile data. |
| 2891 | */ |
| 2892 | private function render_user_profile( $id, $settings, $profile_data ) { |
| 2893 | |
| 2894 | $show_counts = 'yes' === $settings['following_count'] || 'yes' === $settings['follower_count'] || 'yes' === $settings['likes_count']; |
| 2895 | $show_desc = 'yes' === $settings['bio_description']; |
| 2896 | $show_follow_btn = 'yes' === $settings['follow_button']; |
| 2897 | $is_inline = 'row' === $settings['profile_basic_display']; |
| 2898 | |
| 2899 | $show_avatar = 'yes' === $settings['avatar_url']; |
| 2900 | $show_username = 'yes' === $settings['username']; |
| 2901 | |
| 2902 | $follow_url = ''; |
| 2903 | if ( $show_follow_btn ) { |
| 2904 | $follow_url = $profile_data['profile_deep_link']; |
| 2905 | } |
| 2906 | |
| 2907 | ?> |
| 2908 | <div class="premium-tiktok-feed__user-info-wrapper"> |
| 2909 | |
| 2910 | <?php if ( $show_avatar || $show_username ) : ?> |
| 2911 | <div class="premium-tiktok-feed__user-info"> |
| 2912 | <?php if ( $show_avatar ) : ?> |
| 2913 | <div class="premium-tiktok-feed__avatar"> |
| 2914 | <a href="<?php echo esc_url( $follow_url ); ?>" target="_blank"> |
| 2915 | <img src="<?php echo esc_url( $profile_data['avatar_url'] ); ?>" alt="<?php echo esc_attr( $profile_data['display_name'] ); ?>" > |
| 2916 | </a> |
| 2917 | </div> |
| 2918 | <?php endif; ?> |
| 2919 | |
| 2920 | <?php if ( $show_username ) : ?> |
| 2921 | <span class="premium-tiktok-feed__username"> |
| 2922 | <a href="<?php echo esc_url( $follow_url ); ?>" target="_blank"> <?php echo esc_html( $profile_data['display_name'] ); ?> </a> |
| 2923 | </span> |
| 2924 | <?php endif; ?> |
| 2925 | </div> |
| 2926 | <?php endif; ?> |
| 2927 | <?php |
| 2928 | if ( $show_follow_btn && $is_inline ) { |
| 2929 | ?> |
| 2930 | <a class="premium-tiktok-feed__follow-button" href="<?php echo esc_url( $follow_url ); ?>" target="_blank"> |
| 2931 | <?php $this->render_tiktok_icon( 'follow' ); ?> |
| 2932 | <span class="premium-tiktok-feed__follow-text"><?php echo esc_html__( 'Follow', 'premium-addons-for-elementor' ); ?></span> |
| 2933 | </a> |
| 2934 | |
| 2935 | <?php } ?> |
| 2936 | </div> |
| 2937 | |
| 2938 | <?php if ( $show_counts ) : ?> |
| 2939 | <div class="premium-tiktok-feed__profile-counts"> <?php $this->get_counters( $settings, $profile_data ); ?></div> |
| 2940 | <?php endif; ?> |
| 2941 | <?php if ( $show_desc ) : ?> |
| 2942 | <div class="premium-tiktok-feed__profile-desc"><?php echo esc_html( $profile_data['bio_description'] ); ?></div> |
| 2943 | <?php endif; ?> |
| 2944 | <?php |
| 2945 | if ( $show_follow_btn && ! $is_inline ) { |
| 2946 | |
| 2947 | ?> |
| 2948 | <a class="premium-tiktok-feed__follow-button" href="<?php echo esc_url( $follow_url ); ?>" target="_blank"> |
| 2949 | <?php $this->render_tiktok_icon( 'follow' ); ?> |
| 2950 | <span class="premium-tiktok-feed__follow-text"><?php echo esc_html__( 'Follow', 'premium-addons-for-elementor' ); ?></span> |
| 2951 | </a> |
| 2952 | |
| 2953 | <?php |
| 2954 | } |
| 2955 | ?> |
| 2956 | <?php |
| 2957 | } |
| 2958 | |
| 2959 | /** |
| 2960 | * Render tiktok Icon |
| 2961 | * |
| 2962 | * @access private |
| 2963 | * @since 4.10.3 |
| 2964 | * |
| 2965 | * @param string $from icon location. |
| 2966 | */ |
| 2967 | private function render_tiktok_icon( $from = 'video' ) { |
| 2968 | |
| 2969 | $follow_class = 'premium-tiktok-icon-' . $from; |
| 2970 | ?> |
| 2971 | <span class="premium-tiktok-feed__tiktok-icon <?php echo esc_attr( $follow_class ); ?>"> |
| 2972 | <svg id="TikTok" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="18.72" height="18.72" viewBox="0 0 18.72 18.72"><defs><style>.premium-tiktok-icon-1{fill:#25f4ee;}.premium-tiktok-icon-1,.premium-tiktok-icon-2,.premium-tiktok-icon-3{fill-rule:evenodd;}.premium-tiktok-icon-2{fill:#fff;}.premium-tiktok-icon-3{fill:#ff1753;}</style></defs><circle cx="9.36" cy="9.36" r="9.36"/><path class="premium-tiktok-icon-3" d="m11.91,7.68c.76.56,1.69.89,2.71.9l.03-1.95c-.19,0-.38-.03-.57-.07l-.02,1.53c-1.01-.01-1.95-.35-2.71-.9l-.05,3.98c-.03,1.99-1.66,3.58-3.65,3.56-.74,0-1.43-.24-2-.64.65.68,1.55,1.1,2.56,1.12,1.99.03,3.63-1.57,3.65-3.56l.05-3.98h0Zm.73-1.96c-.39-.43-.64-.99-.68-1.6v-.25s-.54,0-.54,0c.13.78.58,1.45,1.22,1.86h0Zm-5.72,6.86c-.21-.29-.33-.64-.32-1,.01-.91.76-1.64,1.67-1.63.17,0,.34.03.5.08l.03-1.99c-.19-.03-.38-.04-.57-.04l-.02,1.55c-.16-.05-.33-.08-.5-.08-.91-.01-1.66.72-1.67,1.63,0,.64.35,1.21.89,1.48Z"/><path class="premium-tiktok-icon-2" d="m11.35,7.19c.76.56,1.69.89,2.71.9l.02-1.53c-.56-.13-1.06-.43-1.43-.85-.64-.41-1.1-1.08-1.22-1.86l-1.42-.02-.1,7.79c-.01.91-.76,1.63-1.67,1.62-.54,0-1.01-.27-1.3-.67-.53-.28-.9-.84-.89-1.48.01-.91.76-1.64,1.67-1.63.17,0,.34.03.5.08l.02-1.55c-1.96.01-3.55,1.59-3.58,3.56-.01.98.37,1.87.99,2.53.57.39,1.26.63,2,.64,1.99.03,3.63-1.57,3.65-3.56l.05-3.98Z"/><path class="premium-tiktok-icon-1" d="m14.08,6.56v-.41c-.5,0-1-.16-1.43-.43.38.42.88.72,1.43.85Zm-2.65-2.7c-.01-.07-.02-.15-.03-.22v-.25s-1.96-.03-1.96-.03l-.1,7.79c-.01.91-.76,1.63-1.67,1.62-.27,0-.52-.07-.74-.19.3.4.77.66,1.3.67.91.01,1.66-.71,1.67-1.62l.1-7.79,1.42.02Zm-3.19,4.14v-.44c-.16-.02-.32-.04-.49-.04-1.99-.03-3.63,1.57-3.65,3.56-.02,1.25.6,2.35,1.56,3.01-.63-.66-1.01-1.55-.99-2.53.03-1.96,1.62-3.54,3.58-3.56h0Z"/></svg> |
| 2973 | </span> |
| 2974 | <?php |
| 2975 | } |
| 2976 | |
| 2977 | /** |
| 2978 | * Displays profile counters. |
| 2979 | * |
| 2980 | * @access private |
| 2981 | * @since 4.10.3 |
| 2982 | * |
| 2983 | * @param array $settings widget settings. |
| 2984 | * @param array $data feed data. |
| 2985 | */ |
| 2986 | private function get_counters( $settings, $data ) { |
| 2987 | ?> |
| 2988 | <?php if ( $settings['follower_count'] && ! is_null( $data['follower_count'] ) ) : ?> |
| 2989 | <span class="premium-tiktok-feed__followers" title="Followers"> |
| 2990 | <span class="premium-tiktok-feed__count"> <?php echo esc_html( Helper_Functions::premium_format_numbers( $data['follower_count'] ) ); ?></span> |
| 2991 | <span>Followers</span> |
| 2992 | </span> |
| 2993 | <?php endif; ?> |
| 2994 | |
| 2995 | <?php if ( $settings['following_count'] && ! is_null( $data['following_count'] ) ) : ?> |
| 2996 | <span class="premium-tiktok-feed__followings" title="Following"> |
| 2997 | <span class="premium-tiktok-feed__count"><?php echo esc_html( Helper_Functions::premium_format_numbers( $data['following_count'] ) ); ?></span> |
| 2998 | <span>Following</span> |
| 2999 | </span> |
| 3000 | <?php endif; ?> |
| 3001 | |
| 3002 | <?php if ( $settings['likes_count'] && ! is_null( $data['likes_count'] ) ) : ?> |
| 3003 | <span class="premium-tiktok-feed__views" title="Likes"> |
| 3004 | <span class="premium-tiktok-feed__count"><?php echo esc_html( Helper_Functions::premium_format_numbers( $data['likes_count'] ) ); ?></span> |
| 3005 | <span>Likes</span> |
| 3006 | </span> |
| 3007 | <?php endif; ?> |
| 3008 | <?php |
| 3009 | } |
| 3010 | |
| 3011 | /** |
| 3012 | * Displays Video Likes, Comments, Views, Shares counters. |
| 3013 | * |
| 3014 | * @access private |
| 3015 | * @since 4.10.3 |
| 3016 | * |
| 3017 | * @param array $vid_settings video settings. |
| 3018 | * @param array $feed videos feed. |
| 3019 | */ |
| 3020 | private function get_video_counters( $vid_settings, $feed ) { |
| 3021 | |
| 3022 | $settings = $this->get_settings_for_display(); |
| 3023 | |
| 3024 | $layout = $settings['vid_layout']; |
| 3025 | |
| 3026 | ?> |
| 3027 | <div class="premium-tiktok-feed__video-counts"> |
| 3028 | |
| 3029 | <?php if ( $vid_settings['likes'] ) : ?> |
| 3030 | <span class="premium-tiktok-feed__likes" title="Likes"> |
| 3031 | <i class="far fa-heart" aria-hidden="true"></i> |
| 3032 | <span class="premium-tiktok-feed__count"> <?php echo esc_html( Helper_Functions::premium_format_numbers( $feed['like_count'] ) ); ?></span> |
| 3033 | </span> |
| 3034 | <?php endif; ?> |
| 3035 | |
| 3036 | <?php if ( $vid_settings['comments'] ) : ?> |
| 3037 | <span class="premium-tiktok-feed__comments" title="Comments"> |
| 3038 | <i class="far fa-comment" aria-hidden="true"></i> |
| 3039 | <span class="premium-tiktok-feed__count"><?php echo esc_html( Helper_Functions::premium_format_numbers( $feed['comment_count'] ) ); ?></span> |
| 3040 | </span> |
| 3041 | <?php endif; ?> |
| 3042 | |
| 3043 | <?php if ( $vid_settings['views'] ) : ?> |
| 3044 | <span class="premium-tiktok-feed__views" title="Views"> |
| 3045 | <i class="far fa-eye" aria-hidden="true"></i> |
| 3046 | <span class="premium-tiktok-feed__count"><?php echo esc_html( Helper_Functions::premium_format_numbers( $feed['view_count'] ) ); ?></span> |
| 3047 | </span> |
| 3048 | <?php endif; ?> |
| 3049 | |
| 3050 | <?php if ( $vid_settings['shares'] ) : ?> |
| 3051 | <span class="premium-tiktok-feed__shares" title="Shares"> |
| 3052 | <?php $this->render_share_button( $feed['share_url'] ); ?> |
| 3053 | </span> |
| 3054 | <?php endif; ?> |
| 3055 | |
| 3056 | <?php if ( 'layout-2' !== $layout ) : ?> |
| 3057 | <a class="premium-tiktok-feed__video-link" href="<?php echo esc_url( $feed['share_url'] ); ?>" target="_blank"></a> |
| 3058 | <?php endif; ?> |
| 3059 | |
| 3060 | </div> |
| 3061 | <?php |
| 3062 | } |
| 3063 | |
| 3064 | /** |
| 3065 | * Displays Video Meta Info. |
| 3066 | * |
| 3067 | * @access private |
| 3068 | * @since 4.10.3 |
| 3069 | * |
| 3070 | * @param array $settings widget settings. |
| 3071 | * @param array $vid_settings video settings. |
| 3072 | * @param array $feed video obj. |
| 3073 | * @param array $user_info user info. |
| 3074 | */ |
| 3075 | private function get_video_meta( $settings, $vid_settings, $feed, $user_info ) { |
| 3076 | ?> |
| 3077 | <div class="premium-tiktok-feed__meta"> |
| 3078 | |
| 3079 | <?php if ( $vid_settings['username'] ) : ?> |
| 3080 | <span class="premium-tiktok-feed__vid-creator"> |
| 3081 | <a href="<?php echo esc_url( $user_info['url'] ); ?>" target="_blank"><?php echo esc_html( $user_info['username'] ); ?></a> |
| 3082 | <?php if ( $user_info['is_verified'] ) : ?> |
| 3083 | <i class="far fa-check-circle" aria-hidden="true"></i> |
| 3084 | <?php endif; ?> |
| 3085 | </span> |
| 3086 | <?php endif; ?> |
| 3087 | |
| 3088 | <?php |
| 3089 | if ( $vid_settings['date'] ) : |
| 3090 | $t_date = ! empty( $feed['create_time'] ) ? $feed['create_time'] : false; |
| 3091 | ?> |
| 3092 | <span class="premium-tiktok-feed__created-at"><?php echo esc_html( wp_date( $settings['date_format'], $t_date ) ); ?></span> |
| 3093 | <?php endif; ?> |
| 3094 | |
| 3095 | </div> |
| 3096 | <?php |
| 3097 | } |
| 3098 | |
| 3099 | /** |
| 3100 | * Render Feed Description. |
| 3101 | * |
| 3102 | * @access private |
| 3103 | * @since 4.10.3 |
| 3104 | * |
| 3105 | * @param string $desc feed description. |
| 3106 | * @param string $url feed URL. |
| 3107 | * @param array $settings widget settings. |
| 3108 | */ |
| 3109 | private function render_feed_desc( $desc, $url, $settings ) { |
| 3110 | |
| 3111 | $len = $settings['vid_desc_len']; |
| 3112 | |
| 3113 | if ( ! empty( $len ) ) { |
| 3114 | |
| 3115 | $desc = $this->get_feed_desc( $desc, $len, $url, $settings ); |
| 3116 | } |
| 3117 | |
| 3118 | echo wp_kses_post( $desc ); |
| 3119 | } |
| 3120 | |
| 3121 | /** |
| 3122 | * Render Feed Description. |
| 3123 | * |
| 3124 | * @access private |
| 3125 | * @since 4.10.3 |
| 3126 | * |
| 3127 | * @param string $desc feed description. |
| 3128 | * @param integer $len description length. |
| 3129 | * @param string $url feed URL. |
| 3130 | * @param array $settings widget settings. |
| 3131 | * |
| 3132 | * @return string |
| 3133 | */ |
| 3134 | private function get_feed_desc( $desc, $len, $url, $settings ) { |
| 3135 | |
| 3136 | $desc = trim( $desc ); |
| 3137 | |
| 3138 | $words = explode( ' ', $desc, $len + 1 ); |
| 3139 | |
| 3140 | $postfix_type = $settings['vid_desc_postfix']; |
| 3141 | |
| 3142 | if ( count( $words ) > $len ) { |
| 3143 | |
| 3144 | array_pop( $words ); |
| 3145 | |
| 3146 | $desc = implode( ' ', $words ); |
| 3147 | |
| 3148 | if ( 'dots' === $postfix_type ) { |
| 3149 | $desc .= '...'; |
| 3150 | } else { |
| 3151 | $desc .= '<a class="premium-read-more" target="_blank" href="' . $url . '">' . $settings['vid_desc_postfix_txt'] . '</a>'; |
| 3152 | } |
| 3153 | } |
| 3154 | |
| 3155 | return $desc; |
| 3156 | } |
| 3157 | |
| 3158 | /** |
| 3159 | * Render share button. |
| 3160 | * |
| 3161 | * @access private |
| 3162 | * @since 4.10.3 |
| 3163 | * |
| 3164 | * @param string $link feed link. |
| 3165 | */ |
| 3166 | private function render_share_button( $link ) { |
| 3167 | ?> |
| 3168 | <div class="premium-tiktok-feed__share-outer"> |
| 3169 | <div class="premium-tiktok-share-container"> |
| 3170 | <span class="premium-tiktok-share-button"> |
| 3171 | <i class="fa fa-share custom-fa" aria-hidden="true"></i> |
| 3172 | <span class="premium-tiktok-sharer">Share</span> |
| 3173 | <div class="premium-tiktok-share-menu"> |
| 3174 | <a data-pa-link="<?php echo esc_url( $link ); ?>" href="javascript:;" class="premium-tiktok-share-item premium-copy-link"> |
| 3175 | <i class="fas fa-link if-link" aria-hidden="true"></i> |
| 3176 | <span class="premium-tiktok-share-text pre-infs-fb">Copy to Clipboard</span> |
| 3177 | </a> |
| 3178 | <a data-pa-link="https://www.facebook.com/sharer/sharer.php?u=<?php echo esc_url( $link ); ?>" href="javascript:;" class="premium-tiktok-share-item"> |
| 3179 | <i class="fab fa-facebook-f if-fb" aria-hidden="true"></i> |
| 3180 | <span class="premium-tiktok-share-text pre-infs-fb">Share on Facebook</span> |
| 3181 | </a> |
| 3182 | <a data-pa-link="https://twitter.com/intent/tweet?text=tweet&url=<?php echo esc_url( $link ); ?>" href="javascript:;" class="premium-tiktok-share-item"> |
| 3183 | <i class="fab fa-twitter if-tw" aria-hidden="true"></i> |
| 3184 | <span class="premium-tiktok-share-text pre-infs-tw">Share on Twitter</span> |
| 3185 | </a> |
| 3186 | <a data-pin-do="buttonPin" data-pa-link="https://www.pinterest.com/pin/create/button/?url=<?php echo esc_url( $link ); ?>" href="javascript:;" class="premium-tiktok-share-item"> |
| 3187 | <i class="fab fa-pinterest-p if-pi" aria-hidden="true"></i> |
| 3188 | <span class="premium-tiktok-share-text pre-infs-pi">Share on Pinterest</span> |
| 3189 | </a> |
| 3190 | </div> |
| 3191 | </span> |
| 3192 | </div> |
| 3193 | </div> |
| 3194 | <?php |
| 3195 | } |
| 3196 | |
| 3197 | /** |
| 3198 | * Render Editor Masonry Script. |
| 3199 | * |
| 3200 | * @since 3.12.3 |
| 3201 | * @access protected |
| 3202 | */ |
| 3203 | protected function render_editor_script() { |
| 3204 | |
| 3205 | ?> |
| 3206 | <script type="text/javascript"> |
| 3207 | jQuery( document ).ready( function( $ ) { |
| 3208 | |
| 3209 | $( '.premium-tiktok-feed__videos-wrapper' ).each( function() { |
| 3210 | |
| 3211 | var $node_id = '<?php echo esc_attr( $this->get_id() ); ?>', |
| 3212 | scope = $( '[data-id="' + $node_id + '"]' ), |
| 3213 | selector = $(this); |
| 3214 | |
| 3215 | |
| 3216 | if ( selector.closest( scope ).length < 1 ) { |
| 3217 | return; |
| 3218 | } |
| 3219 | |
| 3220 | |
| 3221 | var masonryArgs = { |
| 3222 | itemSelector : '.premium-tiktok-feed__video-outer-wrapper', |
| 3223 | percentPosition : true, |
| 3224 | layoutMode : 'masonry', |
| 3225 | }; |
| 3226 | |
| 3227 | var $isotopeObj = {}; |
| 3228 | |
| 3229 | selector.imagesLoaded( function() { |
| 3230 | |
| 3231 | $isotopeObj = selector.isotope( masonryArgs ); |
| 3232 | |
| 3233 | $isotopeObj.imagesLoaded().progress(function() { |
| 3234 | $isotopeObj.isotope("layout"); |
| 3235 | }); |
| 3236 | |
| 3237 | selector.find('.premium-tiktok-feed__video-outer-wrapper').resize( function() { |
| 3238 | $isotopeObj.isotope( 'layout' ); |
| 3239 | }); |
| 3240 | }); |
| 3241 | |
| 3242 | }); |
| 3243 | }); |
| 3244 | </script> |
| 3245 | <?php |
| 3246 | } |
| 3247 | } |
| 3248 |