403Webshell
Server IP : 198.38.94.67  /  Your IP : 216.73.217.178
Web Server : LiteSpeed
System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
User : azfilmst ( 1070)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/azfilmst/public_html/wp-content/plugins/haru-frames/includes/widgets/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/azfilmst/public_html/wp-content/plugins/haru-frames/includes/widgets/video-creative.php
<?php
/** 
 * @package    HaruTheme/Haru Frames
 * @version    1.0.0
 * @author     Administrator <admin@harutheme.com>
 * @copyright  Copyright (c) 2017, HaruTheme
 * @license    http://opensource.org/licenses/gpl-2.0.php GPL v2 or later
 * @link       http://harutheme.com
*/

namespace Haru_Frames\Widgets;

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

use \Elementor\Widget_Base;
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Background;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Group_Control_Typography;
use \Elementor\Utils;
use \Elementor\Plugin;
use \Haru_Frames\Classes\Helper as ControlsHelper;
use \Haru_Frames\Classes\Haru_Template;

if ( ! class_exists( 'Haru_Frames_Video_Creative_Widget' ) ) {
    class Haru_Frames_Video_Creative_Widget extends Widget_Base {

        public function get_name() {
            return 'haru-video-creative';
        }

        public function get_title() {
            return esc_html__( 'Haru Video Creative', 'haru-frames' );
        }

        public function get_icon() {
            return 'eicon-video-playlist';
        }

        public function get_categories() {
            return [ 'haru-elements' ];
        }

        public function get_keywords() {
            return [
                'video',
                'videos',
                'grid',
                'video grid',
                'videos grid',
                'custom videos',
                'creative',
            ];
        }

        public function get_custom_help_url() {
            return 'https://document.harutheme.com/elementor/';
        }

        public function get_script_depends() {

            if ( Plugin::$instance->editor->is_edit_mode() || Plugin::$instance->preview->is_preview_mode() ) {
                return ['imagesloaded', 'isotope'];
            }

            return ['imagesloaded', 'isotope'];

        }

        protected function register_controls() {

            $post_types = array();
            $post_types['haru_video'] = __( 'Videos', 'haru-frames' );
            $post_types['by_id'] = __( 'Manual Selection', 'haru-frames' );

            $taxonomies = get_taxonomies( [ 'object_type' => [ 'haru_video' ] ], 'objects' );

            $this->start_controls_section(
                'content_section',
                [
                    'label'     => esc_html__( 'Content', 'haru-frames' ),
                    'tab'       => Controls_Manager::TAB_CONTENT,
                ]
            );

            $this->add_control(
                'layout',
                [
                  'label' => __( 'Layout', 'haru-frames' ),
                  'type' => Controls_Manager::SELECT,
                  'default' => 'creative-1',
                  'options' => [
                    'creative-1'  => __( 'Creative 1', 'haru-frames' ),
                  ]
                ]
            );

            $this->add_control(
                'post_type',
                [
                    'label' => __( 'Source', 'haru-frames' ),
                    'type' => Controls_Manager::SELECT,
                    'options' => $post_types,
                    'default' => key($post_types),
                ]
            );

            $this->add_control(
                'videos_ids',
                [
                    'label' => __( 'Search & Select', 'haru-frames' ),
                    'type' => Controls_Manager::SELECT2,
                    'options' => ControlsHelper::get_post_list('haru_video'),
                    'label_block' => true,
                    'multiple' => true,
                    'condition' => [
                        'post_type' => 'by_id',
                    ],
                ]
            );

            foreach ($taxonomies as $taxonomy => $object) {
                if ( ( ! isset( $object->object_type[0] ) ) || ( ! in_array( $object->object_type[0], array_keys($post_types) ) ) ) {
                    continue;
                }

                $this->add_control(
                    $taxonomy . '_ids',
                    [
                        'label' => $object->label,
                        'type' => Controls_Manager::SELECT2,
                        'label_block' => true,
                        'multiple' => true,
                        'object_type' => $taxonomy,
                        'options' => wp_list_pluck( get_terms( $taxonomy ), 'name', 'term_id' ),
                        'condition' => [
                            'post_type' => $object->object_type,
                        ],
                    ]
                );
            }

            $this->add_control(
                'post__not_in',
                [
                    'label' => __( 'Exclude', 'haru-frames' ),
                    'type' => Controls_Manager::SELECT2,
                    'options' => ControlsHelper::get_post_list('haru_video'),
                    'label_block' => true,
                    'post_type' => '',
                    'multiple' => true,
                    'condition' => [
                        'layout!' => ['by_id'],
                    ],
                ]
            );

            $this->add_control(
                'posts_per_page',
                [
                    'label' => __( 'Posts Per Page', 'haru-frames' ),
                    'description'   => __( 'You can set -1 to show all. With Zigzag layout please set Even number like 2, 4, 6, 8,... If not the last video maybe does not display.', 'haru-frames' ),
                    'type' => Controls_Manager::NUMBER,
                    'default' => '6',
                    'condition' => [
                        'layout!' => ['creative-1'],
                    ],
                ]
            );

            $this->add_control(
                'orderby',
                [
                    'label' => __( 'Order By', 'haru-frames' ),
                    'type' => Controls_Manager::SELECT,
                    'options' => ControlsHelper::get_post_orderby_options(),
                    'default' => 'date',

                ]
            );

            $this->add_control(
                'order',
                [
                    'label' => __( 'Order', 'haru-frames' ),
                    'type' => Controls_Manager::SELECT,
                    'options' => [
                        'asc' => 'Ascending',
                        'desc' => 'Descending',
                    ],
                    'default' => 'desc',

                ]
            );

            $this->add_control(
                'el_class',
                [
                    'label' => __( 'CSS Classes', 'haru-frames' ),
                    'type' => Controls_Manager::TEXT,
                    'default' => '',
                    'title' => __( 'Add your custom class WITHOUT the dot. e.g: my-class', 'haru-frames' ),
                ]
            );

            $this->end_controls_section();

            $this->start_controls_section(
                'layout_section',
                [
                    'label' => esc_html__( 'Layout Options', 'haru-frames' ),
                    'tab' => Controls_Manager::TAB_STYLE,
                ]
            );

            $this->add_control(
                'background_dark',
                [
                    'label'         => __( 'Background Dark', 'haru-frames' ),
                    'type'          => Controls_Manager::SWITCHER,
                    'description'   => __( 'Enable if use for section has background dark.', 'haru-frames' ),
                    'default'       => 'no',
                    'return_value'  => 'yes',
                ]
            );

            $this->add_control(
                'video_filter',
                [
                  'label' => __( 'Video Filter', 'haru-frames' ),
                  'type' => Controls_Manager::SELECT,
                  'default' => 'hide',
                  'options' => [
                    'hide'     => __( 'Hide', 'haru-frames' ),
                    'style-1'     => __( 'Style 1', 'haru-frames' ),
                    'style-2'     => __( 'Style 2', 'haru-frames' ),
                  ]
                ]
            );

            $this->add_control(
                'video_filter_all',
                [
                    'label' => __( 'Video Filter All', 'haru-frames' ),
                    'type' => Controls_Manager::SELECT,
                    'default' => 'show',
                    'options' => [
                        'show'     => __( 'Show', 'haru-frames' ),
                        'hide'     => __( 'Hide', 'haru-frames' ),
                    ],
                    'condition' => [
                        'video_filter!' => [ '' ],
                    ],
                ]
            );

            $this->add_responsive_control(
                'video_filter_align',
                [
                    'label' => __( 'Video Filter Align', 'haru-frames' ),
                    'type' => Controls_Manager::CHOOSE,
                    'options' => [
                        'left' => [
                            'title' => __( 'Left', 'haru-frames' ),
                            'icon' => 'eicon-text-align-left',
                        ],
                        'center' => [
                            'title' => __( 'Center', 'haru-frames' ),
                            'icon' => 'eicon-text-align-center',
                        ],
                        'right' => [
                            'title' => __( 'Right', 'haru-frames' ),
                            'icon' => 'eicon-text-align-right',
                        ],
                        'justify' => [
                            'title' => __( 'Justified', 'haru-frames' ),
                            'icon' => 'eicon-text-align-justify',
                        ],
                    ],
                    'default' => 'left',
                    'selectors' => [
                        '{{WRAPPER}} .video-filter' => 'text-align: {{VALUE}};',
                    ],
                    'condition' => [
                        'video_filter!' => [ '' ],
                    ],
                ]
            );

            $this->add_control(
                'view_more',
                [
                  'label' => __( 'View More', 'haru-frames' ),
                  'type' => Controls_Manager::SELECT,
                  'default' => 'none',
                  'options' => [
                    'none'     => __( 'None', 'haru-frames' ),
                    // 'arrow'     => __( 'Arrow', 'haru-frames' ),
                    'button'     => __( 'Button', 'haru-frames' ),
                  ]
                ]
            );

            $this->add_control(
                'view_more_text',
                [
                    'label' => __( 'View More Text', 'haru-frames' ),
                    'type' => Controls_Manager::TEXT,
                    'default' => '',
                    'condition' => [
                        'view_more' => [ 'button' ],
                    ],
                ]
            );

            $this->add_control(
                'hide_counter',
                [
                    'label'         => __( 'Hide Counter Title', 'haru-frames' ),
                    'type'          => Controls_Manager::SWITCHER,
                    'description'   => __( 'Enable if you want to hide counter number in the title.', 'haru-frames' ),
                    'default'       => 'no',
                    'return_value'  => 'yes',
                ]
            );

            $this->end_controls_section();

        }

        protected function render() {
            $settings = $this->get_settings_for_display();

            $this->add_render_attribute( 'video', 'class', 'haru-video-creative' );

            $this->add_render_attribute( 'video', 'class', 'haru-video-creative--' . $settings['layout'] );

            $this->add_render_attribute( 'video', 'id', 'haru-video-creative' . rand() );

            // Process some special case
            if ( in_array( $settings['layout'], array( 'creative-1' ) ) ) {
                $settings['posts_per_page'] = 6;
            }

            $this->add_render_attribute( 'video', 'data-settings', htmlentities( json_encode( $settings ) ) );

            if ( ! empty( $settings['el_class'] ) ) {
                $this->add_render_attribute( 'video', 'class', $settings['el_class'] );
            }

            ?>
            <?php if ( Plugin::$instance->editor->is_edit_mode() || Plugin::$instance->preview->is_preview_mode() ) : ?>
                <div class="haru-notice"><?php echo esc_html__( 'Please note layout or action may doesn\'t works on Preview Mode or Editor Mode but works fine on Frontend Mode.', 'haru-frames' ); ?></div>
            <?php endif; ?>

            <?php if ( 'yes' == $settings['background_dark'] ) : ?>
                <div class="background-dark">
            <?php endif; ?>
                <div <?php echo $this->get_render_attribute_string( 'video' ); ?>>
                    <?php echo Haru_Template::haru_get_template( 'video-creative/video-creative.php', $settings ); ?>
                </div>
            <?php if ( 'yes' == $settings['background_dark'] ) : ?>
                </div>
            <?php endif; ?>

            <?php
        }

    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit