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