Advertisement
rejuancse

slider-two

Oct 3rd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.99 KB | None | 0 0
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3.     exit; // Exit if accessed directly.
  4. }
  5.  
  6.  
  7.     class Themeum_Slider_Two {
  8.  
  9.         public function get_name() {
  10.             return 'themeum-slider-two';
  11.         }
  12.  
  13.         public function get_title() {
  14.             return 'Slider Two';
  15.         }
  16.  
  17.         public function get_icon() {
  18.             return 'wppb-font-full-slider';
  19.         }
  20.  
  21.         public function get_category_name(){
  22.             return __( 'Backnow Widgets', 'themeum-core' );
  23.         }
  24.  
  25.         # Script ...
  26.         public function get_enqueue_script(){
  27.             return array( 'backnow-main', 'slick-js' );
  28.         }
  29.  
  30.         public function get_settings() {
  31.  
  32.         $settings = array(
  33.  
  34.  
  35.             'slider_list' => array(
  36.                 'title' => 'Slider Items',
  37.                 'type' => 'repeatable',
  38.                 'attr' => array(
  39.  
  40.                     'slider_title' => array(
  41.                         'type'  => 'text',
  42.                         'title' => 'Title',
  43.                         'std'   => ''
  44.                     ),
  45.  
  46.                     'title_animation' => array(
  47.                         'type'      => 'select',
  48.                         'title'     => 'Title Animation',
  49.                         'values'    => array(
  50.                                 'bounce'        => 'bounce',
  51.                                 'bounceIn'      => 'bounceIn',
  52.                                 'bounceInDown'  => 'bounceInDown',
  53.                                 'bounceInLeft'  => 'bounceInLeft',
  54.                                 'bounceInRight' => 'bounceInRight',
  55.                                 'bounceInUp'    => 'bounceInUp',
  56.                                 'fadeIn'        => 'fadeIn',
  57.                                 'fadeInDown'    => 'fadeInDown',
  58.                                 'fadeInDownBig' => 'fadeInDownBig',
  59.                                 'fadeInLeft'    => 'fadeInLeft',
  60.                                 'fadeInLeftBig' => 'fadeInLeftBig',
  61.                                 'fadeInRight'   => 'fadeInRight',
  62.                                 'fadeInRightBig'=> 'fadeInRightBig',
  63.                                 'fadeInUp'      => 'fadeInUp',
  64.                                 'fadeInUpBig'   => 'fadeInUpBig',
  65.                                 'slideInUp'     => 'slideInUp',
  66.                                 'slideInDown'   => 'slideInDown',
  67.                                 'slideInLeft'   => 'slideInLeft',
  68.                                 'slideInRight'  => 'slideInRight',
  69.                                 'zoomInDown'    => 'zoomInDown',
  70.                                 'zoomInLeft'    => 'zoomInLeft',
  71.                                 'zoomInRight'   => 'zoomInRight',
  72.                                 'zoomInUp'      => 'zoomInUp'
  73.                         ),
  74.                     ),
  75.  
  76.                     'title_speed' => array(
  77.                         'type'      => 'select',
  78.                         'title'     => 'Title Speed',
  79.                         'values'    => array(
  80.                                 '1.25s'     => '1.25s',
  81.                                 '.25s'      => '.25s',
  82.                                 '.50s'      => '.50s',
  83.                                 '.75s'      => '.75s',
  84.                                 '1s'        => '1s',
  85.                                 '1.25s'     => '1.25s',
  86.                                 '1.50s'     => '1.50s',
  87.                                 '1.75s'     => '1.75s',
  88.                                 '2s'        => '2s'
  89.                         ),
  90.                     ),
  91.  
  92.                     'slider_subtitle' => array(
  93.                         'type'  => 'text',
  94.                         'title' => 'Sub Title',
  95.                         'std'   => ''
  96.                     ),
  97.  
  98.                     'subtitle_animation' => array(
  99.                         'type'      => 'select',
  100.                         'title'     => 'Sub Title Animation',
  101.                         'values'    => array(
  102.                                 'bounce'        => 'bounce',
  103.                                 'bounceIn'      => 'bounceIn',
  104.                                 'bounceInDown'  => 'bounceInDown',
  105.                                 'bounceInLeft'  => 'bounceInLeft',
  106.                                 'bounceInRight' => 'bounceInRight',
  107.                                 'bounceInUp'    => 'bounceInUp',
  108.                                 'fadeIn'        => 'fadeIn',
  109.                                 'fadeInDown'    => 'fadeInDown',
  110.                                 'fadeInDownBig' => 'fadeInDownBig',
  111.                                 'fadeInLeft'    => 'fadeInLeft',
  112.                                 'fadeInLeftBig' => 'fadeInLeftBig',
  113.                                 'fadeInRight'   => 'fadeInRight',
  114.                                 'fadeInRightBig'=> 'fadeInRightBig',
  115.                                 'fadeInUp'      => 'fadeInUp',
  116.                                 'fadeInUpBig'   => 'fadeInUpBig',
  117.                                 'slideInUp'     => 'slideInUp',
  118.                                 'slideInDown'   => 'slideInDown',
  119.                                 'slideInLeft'   => 'slideInLeft',
  120.                                 'slideInRight'  => 'slideInRight',
  121.                                 'zoomInDown'    => 'zoomInDown',
  122.                                 'zoomInLeft'    => 'zoomInLeft',
  123.                                 'zoomInRight'   => 'zoomInRight',
  124.                                 'zoomInUp'      => 'zoomInUp'
  125.                         ),
  126.                     ),
  127.  
  128.                     'subtitle_speed' => array(
  129.                         'type'      => 'select',
  130.                         'title'     => 'Sub Title Speed',
  131.                         'values'    => array(
  132.                                 '1.25s'     => '1.25s',
  133.                                 '.25s'      => '.25s',
  134.                                 '.50s'      => '.50s',
  135.                                 '.75s'      => '.75s',
  136.                                 '1s'        => '1s',
  137.                                 '1.25s'     => '1.25s',
  138.                                 '1.50s'     => '1.50s',
  139.                                 '1.75s'     => '1.75s',
  140.                                 '2s'        => '2s'
  141.                         ),
  142.                     ),
  143.  
  144.                     'slider_content' => array(
  145.                         'type'  => 'textarea',
  146.                         'title' => 'Sub Slider Content',
  147.                         'std'   => ''
  148.                     ),
  149.  
  150.                     'content_animation' => array(
  151.                         'type'      => 'select',
  152.                         'title'     => 'Content Animation',
  153.                         'values'    => array(
  154.                                 'bounce'        => 'bounce',
  155.                                 'bounceIn'      => 'bounceIn',
  156.                                 'bounceInDown'  => 'bounceInDown',
  157.                                 'bounceInLeft'  => 'bounceInLeft',
  158.                                 'bounceInRight' => 'bounceInRight',
  159.                                 'bounceInUp'    => 'bounceInUp',
  160.                                 'fadeIn'        => 'fadeIn',
  161.                                 'fadeInDown'    => 'fadeInDown',
  162.                                 'fadeInDownBig' => 'fadeInDownBig',
  163.                                 'fadeInLeft'    => 'fadeInLeft',
  164.                                 'fadeInLeftBig' => 'fadeInLeftBig',
  165.                                 'fadeInRight'   => 'fadeInRight',
  166.                                 'fadeInRightBig'=> 'fadeInRightBig',
  167.                                 'fadeInUp'      => 'fadeInUp',
  168.                                 'fadeInUpBig'   => 'fadeInUpBig',
  169.                                 'slideInUp'     => 'slideInUp',
  170.                                 'slideInDown'   => 'slideInDown',
  171.                                 'slideInLeft'   => 'slideInLeft',
  172.                                 'slideInRight'  => 'slideInRight',
  173.                                 'zoomInDown'    => 'zoomInDown',
  174.                                 'zoomInLeft'    => 'zoomInLeft',
  175.                                 'zoomInRight'   => 'zoomInRight',
  176.                                 'zoomInUp'      => 'zoomInUp'
  177.                         ),
  178.                     ),
  179.                     'content_speed' => array(
  180.                         'type'      => 'select',
  181.                         'title'     => 'Content Speed',
  182.                         'values'    => array(
  183.                                 '1.25s'     => '1.25s',
  184.                                 '.25s'      => '.25s',
  185.                                 '.50s'      => '.50s',
  186.                                 '.75s'      => '.75s',
  187.                                 '1s'        => '1s',
  188.                                 '1.25s'     => '1.25s',
  189.                                 '1.50s'     => '1.50s',
  190.                                 '1.75s'     => '1.75s',
  191.                                 '2s'        => '2s'
  192.                         ),
  193.                     ),
  194.  
  195.  
  196.                     'slider_button_1' => array(
  197.                         'type'  => 'text',
  198.                         'title' => 'Button Text 1',
  199.                         'std'   => 'Button Text'
  200.                     ),
  201.  
  202.                     'slider_button_link_1' => array(
  203.                         'type'  => 'text',
  204.                         'title' => 'Button Link 1',
  205.                         'std'   => '#'
  206.                     ),
  207.                     'button1_animation' => array(
  208.                         'type'      => 'select',
  209.                         'title'     => 'Button 1 Animation',
  210.                         'values'    => array(
  211.                                 'bounce'        => 'bounce',
  212.                                 'bounceIn'      => 'bounceIn',
  213.                                 'bounceInDown'  => 'bounceInDown',
  214.                                 'bounceInLeft'  => 'bounceInLeft',
  215.                                 'bounceInRight' => 'bounceInRight',
  216.                                 'bounceInUp'    => 'bounceInUp',
  217.                                 'fadeIn'        => 'fadeIn',
  218.                                 'fadeInDown'    => 'fadeInDown',
  219.                                 'fadeInDownBig' => 'fadeInDownBig',
  220.                                 'fadeInLeft'    => 'fadeInLeft',
  221.                                 'fadeInLeftBig' => 'fadeInLeftBig',
  222.                                 'fadeInRight'   => 'fadeInRight',
  223.                                 'fadeInRightBig'=> 'fadeInRightBig',
  224.                                 'fadeInUp'      => 'fadeInUp',
  225.                                 'fadeInUpBig'   => 'fadeInUpBig',
  226.                                 'slideInUp'     => 'slideInUp',
  227.                                 'slideInDown'   => 'slideInDown',
  228.                                 'slideInLeft'   => 'slideInLeft',
  229.                                 'slideInRight'  => 'slideInRight',
  230.                                 'zoomInDown'    => 'zoomInDown',
  231.                                 'zoomInLeft'    => 'zoomInLeft',
  232.                                 'zoomInRight'   => 'zoomInRight',
  233.                                 'zoomInUp'      => 'zoomInUp'
  234.                         ),
  235.                     ),
  236.                     'button1_speed' => array(
  237.                         'type'      => 'select',
  238.                         'title'     => 'Button 1 Speed',
  239.                         'values'    => array(
  240.                                 '1.25s'     => '1.25s',
  241.                                 '.25s'      => '.25s',
  242.                                 '.50s'      => '.50s',
  243.                                 '.75s'      => '.75s',
  244.                                 '1s'        => '1s',
  245.                                 '1.25s'     => '1.25s',
  246.                                 '1.50s'     => '1.50s',
  247.                                 '1.75s'     => '1.75s',
  248.                                 '2s'        => '2s'
  249.                         ),
  250.                     ),
  251.                    
  252.  
  253.  
  254.                     'slider_button_2' => array(
  255.                         'type'  => 'text',
  256.                         'title' => 'Button Text 2',
  257.                         'std'   => 'Button Text'
  258.                     ),
  259.  
  260.                     'slider_button_link_2' => array(
  261.                         'type'  => 'text',
  262.                         'title' => 'Button Link 2',
  263.                         'std'   => '#'
  264.                     ),
  265.                     'button2_animation' => array(
  266.                         'type'      => 'select',
  267.                         'title'     => 'Button 1 Animation',
  268.                         'values'    => array(
  269.                                 'bounce'        => 'bounce',
  270.                                 'bounceIn'      => 'bounceIn',
  271.                                 'bounceInDown'  => 'bounceInDown',
  272.                                 'bounceInLeft'  => 'bounceInLeft',
  273.                                 'bounceInRight' => 'bounceInRight',
  274.                                 'bounceInUp'    => 'bounceInUp',
  275.                                 'fadeIn'        => 'fadeIn',
  276.                                 'fadeInDown'    => 'fadeInDown',
  277.                                 'fadeInDownBig' => 'fadeInDownBig',
  278.                                 'fadeInLeft'    => 'fadeInLeft',
  279.                                 'fadeInLeftBig' => 'fadeInLeftBig',
  280.                                 'fadeInRight'   => 'fadeInRight',
  281.                                 'fadeInRightBig'=> 'fadeInRightBig',
  282.                                 'fadeInUp'      => 'fadeInUp',
  283.                                 'fadeInUpBig'   => 'fadeInUpBig',
  284.                                 'slideInUp'     => 'slideInUp',
  285.                                 'slideInDown'   => 'slideInDown',
  286.                                 'slideInLeft'   => 'slideInLeft',
  287.                                 'slideInRight'  => 'slideInRight',
  288.                                 'zoomInDown'    => 'zoomInDown',
  289.                                 'zoomInLeft'    => 'zoomInLeft',
  290.                                 'zoomInRight'   => 'zoomInRight',
  291.                                 'zoomInUp'      => 'zoomInUp'
  292.                         ),
  293.                     ),
  294.                     'button2_speed' => array(
  295.                         'type'      => 'select',
  296.                         'title'     => 'Button 1 Speed',
  297.                         'values'    => array(
  298.                                 '1.25s'     => '1.25s',
  299.                                 '.25s'      => '.25s',
  300.                                 '.50s'      => '.50s',
  301.                                 '.75s'      => '.75s',
  302.                                 '1s'        => '1s',
  303.                                 '1.25s'     => '1.25s',
  304.                                 '1.50s'     => '1.50s',
  305.                                 '1.75s'     => '1.75s',
  306.                                 '2s'        => '2s'
  307.                         ),
  308.                     ),
  309.  
  310.  
  311.                     'background_image' => array(
  312.                         'type'      => 'media',
  313.                         'title'     => __('Background Image','backnow'),
  314.                         'std'       => '',
  315.                     ),
  316.  
  317.                     'align' => array(
  318.                         'type'      => 'select',
  319.                         'title'     => __('Select Order', 'themeum-core'),
  320.                         'values'    => array(
  321.                                 'left'      => __( 'Align Left', 'themeum-core' ),
  322.                                 'right'     => __( 'Align Right', 'themeum-core' ),
  323.                                 'center'    => __( 'Align Center', 'themeum-core' ),
  324.                             ),
  325.                         'std'       => 'center',
  326.                     ),
  327.  
  328.                     'gradient_color_a' => array(
  329.                         'type'      => 'color2',
  330.                         'title'     => __('Gradient Color A','wp-pagebuilder'),
  331.                         'tab'       => 'style',
  332.                         'clip'      => true,
  333.                         'selector'  => '{{SELECTOR}} .wppb-addon-title'
  334.                     ),
  335.                     'gradient_color_b' => array(
  336.                         'type'      => 'color2',
  337.                         'title'     => __('Gradient Color B','wp-pagebuilder'),
  338.                         'tab'       => 'style',
  339.                         'clip'      => true,
  340.                         'selector'  => '{{SELECTOR}} .wppb-addon-title'
  341.                     ),
  342.  
  343.                     # Style..................................................
  344.  
  345.  
  346.                    
  347.                    
  348.  
  349.  
  350.                 ),
  351.                 'std' => array(
  352.                     array(
  353.                         'icon_list' => 'fa fa-twitch',
  354.                         'social_url' => '#',
  355.                     ),
  356.                     array(
  357.                         'icon_list' => 'fa fa-twitter',
  358.                         'social_url' => '#',
  359.                     ),
  360.                 ),
  361.             ),
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.         );
  371.  
  372.         return $settings;
  373.     }
  374.  
  375.         // Alert Render HTML
  376.         public function render($data = null){
  377.             $settings = $data['settings'];
  378.             $slider_list = $settings['slider_list'] ;
  379.  
  380.  
  381.  
  382.             ?>
  383.  
  384.  
  385.             <div class="slider_content_wrapper">
  386.  
  387.                 <?php foreach ( $settings['slider_list'] as $item ) : ?>   
  388.                    
  389.                     <?php
  390.                     $bg = 'style="';
  391.                     $align = '';
  392.                     if( $item['background_image']['url'] ){
  393.                         $bg .= ' background-image: url('.$item["background_image"]["url"].') ';
  394.                     }
  395.                     // if( $item['gradient_color_a'] && $item['gradient_color_b'] ){
  396.                     //  if( $item['background_image']['url'] ){
  397.                     //      $bg .= ', linear-gradient( '.$item["gradient_color_a"].' , '.$item["gradient_color_b"].' );';
  398.                     //  }else{
  399.                     //      $bg .= 'background-image: linear-gradient( '.$item["gradient_color_a"].' 0%, '.$item["gradient_color_b"].' 100%);';
  400.                     //  }
  401.                     // }else{
  402.                     //  if( $item['gradient_color_a'] ){
  403.                     //      $bg .= 'background-color: '.$item["gradient_color_a"].';';
  404.                     //  }else{
  405.                     //      $bg .= ';';
  406.                     //  }
  407.                     // }
  408.                     $bg .= '"';
  409.  
  410.                     $align      = isset($item['align']) ? $item['align'] : array();
  411.  
  412.                     if( $align ){ $align = 'text-'.$align; } ?>
  413.  
  414.                     <div class="slider-single-wrapper d-flex align-items-center" <?php echo $bg; ?>>
  415.                         <div class="container">
  416.                             <div class="row">
  417.                                
  418.                                 <div class="col-12 center_text <?php echo $align; ?>">
  419.                                     <?php if( $item['slider_subtitle'] ): ?><div class="slider-subtitle animated" data-animation="<?php echo $item['subtitle_animation']; ?>" data-speed="<?php echo $item['subtitle_speed']; ?>"><?php echo $item['slider_subtitle']; ?></div><?php endif; ?>
  420.                                     <?php if( $item['slider_title'] ): ?><div class="slider-title animated" data-animation="<?php echo $item['title_animation']; ?>" data-speed="<?php echo $item['title_speed']; ?>"><?php echo $item['slider_title']; ?></div><?php endif; ?>
  421.                                     <?php if( $item['slider_content'] ): ?><div class="slider-content animated" data-animation="<?php echo $item['content_animation']; ?>" data-speed="<?php echo $item['content_speed']; ?>"><?php echo $item['slider_content']; ?></div><?php endif; ?>
  422.                                     <?php if( $item['slider_button_1'] || $item['slider_button_2'] ): ?>
  423.                                         <div class="slider-button">
  424.  
  425.                                             <?php if( isset($item['slider_button_1']) ): ?><a class="d-inline-block slider-button-1 animated" data-animation="<?php echo $item['button1_animation']; ?>" data-speed="<?php echo $item['button1_speed']; ?>" href="<?php echo $item['slider_button_link_1']; ?>"><?php echo $item['slider_button_1']; ?></a><?php endif; ?>
  426.  
  427.                                             <?php if( isset($item['slider_button_2']) ): ?>
  428.                                                 <a class="d-inline-block slider-button-2 animated" data-animation="<?php echo $item['button2_animation']; ?>" data-speed="<?php echo $item['button2_speed']; ?>" href="<?php echo $item['slider_button_link_2']; ?>">
  429.                                                     <?php echo $item['slider_button_2']; ?>
  430.                                                 </a>
  431.                                             <?php endif; ?>
  432.                                         </div>
  433.                                     <?php endif; ?>
  434.                                 </div>
  435.                                
  436.                             </div>
  437.                         </div>
  438.                     </div>
  439.                 <?php endforeach; ?>
  440.  
  441.             </div>
  442.  
  443.  
  444.             <?php
  445.         }
  446.  
  447.  
  448.  
  449.    
  450. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement