403Webshell
Server IP : 62.60.133.156  /  Your IP : 216.73.217.51
Web Server : LiteSpeed
System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64
User : mimradmin ( 1166)
PHP Version : 7.4.33
Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : OFF |  Pkexec : OFF
Directory :  /home/mimradmin/theme/digitaz/inc/elementor/widgets/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/mimradmin/theme/digitaz/inc/elementor/widgets/products-recently.php
<?php

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

if (!digitaz_is_woocommerce_activated()) {
    return;
}

use Elementor\Controls_Manager;

/**
 * Elementor tabs widget.
 *
 * Elementor widget that displays vertical or horizontal tabs with different
 * pieces of content.
 *
 * @since 1.0.0
 */
class Digitaz_Elementor_Widget_Products_Recently extends \Elementor\Widget_Base
{


    public function get_categories()
    {
        return array('digitaz-addons');
    }

    /**
     * Get widget name.
     *
     * Retrieve tabs widget name.
     *
     * @return string Widget name.
     * @since  1.0.0
     * @access public
     *
     */
    public function get_name()
    {
        return 'digitaz-products-recently';
    }

    /**
     * Get widget title.
     *
     * Retrieve tabs widget title.
     *
     * @return string Widget title.
     * @since  1.0.0
     * @access public
     *
     */
    public function get_title()
    {
        return esc_html__('Products Recently', 'digitaz');
    }

    /**
     * Get widget icon.
     *
     * Retrieve tabs widget icon.
     *
     * @return string Widget icon.
     * @since  1.0.0
     * @access public
     *
     */
    public function get_icon()
    {
        return 'eicon-tabs';
    }

    /**
     * Register tabs widget controls.
     *
     * Adds different input fields to allow the user to change and customize the widget settings.
     *
     * @since  1.0.0
     * @access protected
     */
    protected function register_controls()
    {

        //Section Query
        $this->start_controls_section(
            'section_setting',
            [
                'label' => esc_html__('Settings', 'digitaz'),
                'tab' => Controls_Manager::TAB_CONTENT,
            ]
        );

        $this->add_control(
            'column',
            [
                'label' => esc_html__('columns', 'digitaz'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'default' => 3,
                'tablet_default' => 2,
                'mobile_default' => 1,
                'options' => [1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6],
            ]
        );


        $this->add_control(
            'limit',
            [
                'label' => esc_html__('Posts Per Page', 'digitaz'),
                'type' => Controls_Manager::NUMBER,
                'default' => 10,
            ]
        );

        $this->add_responsive_control(
            'product_gutter',
            [
                'label' => esc_html__('Gutter', 'digitaz'),
                'type' => Controls_Manager::SLIDER,
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 50,
                    ],
                ],
                'size_units' => ['px'],
                'selectors' => [
                    '{{WRAPPER}} ul.product_list_recently li' => 'padding-left: calc({{SIZE}}{{UNIT}} / 2); padding-right: calc({{SIZE}}{{UNIT}} / 2); margin-bottom: {{SIZE}}{{UNIT}};',
                    '{{WRAPPER}} ul.product_list_recently' => 'margin-left: calc({{SIZE}}{{UNIT}} / -2); margin-right: calc({{SIZE}}{{UNIT}} / -2);',
                ],
            ]
        );

        $this->add_control(
            'style',
            [
                'label' => esc_html__('Block Style', 'digitaz'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'default' => '1',
                'options' => [
                    '1' => esc_html__('Style 1', 'digitaz'),
                    '2' => esc_html__('Style 2', 'digitaz'),
                ],
            ]
        );

        $this->end_controls_section();
    }

    /**
     * Render tabs widget output on the frontend.
     *
     * Written in PHP and used to generate the final HTML.
     *
     * @since  1.0.0
     * @access protected
     */
    protected function render()
    {
        $settings = $this->get_settings_for_display();

        $viewed_products = !empty($_COOKIE['woocommerce_recently_viewed']) ? (array)explode('|', wp_unslash($_COOKIE['woocommerce_recently_viewed'])) : array(); // @codingStandardsIgnoreLine
        $viewed_products = array_reverse(array_filter(array_map('absint', $viewed_products)));

        if (empty($viewed_products)) {
            echo '<p class="recently-notice">' . esc_html__('There’s no item that you viewed recently.', 'digitaz') . '</p>';
            return;
        }

        ob_start();

        $number = !empty($settings['limit']) ? absint($settings['limit']) : 10;

        $query_args = array(
            'posts_per_page' => $number,
            'columns' => $settings['column'],
            'no_found_rows' => 1,
            'post_status' => 'publish',
            'post_type' => 'product',
            'post__in' => $viewed_products,
            'orderby' => 'post__in',
        );

        if ('yes' === get_option('woocommerce_hide_out_of_stock_items')) {
            $query_args['tax_query'] = array(
                array(
                    'taxonomy' => 'product_visibility',
                    'field' => 'name',
                    'terms' => 'outofstock',
                    'operator' => 'NOT IN',
                ),
            ); // WPCS: slow query ok.
        }

        $r = new WP_Query(apply_filters('woocommerce_recently_viewed_products_widget_query_args', $query_args));
        if ($settings['style'] === '1') {
            if ($r->have_posts()) {

                echo '<ul class="product_list_recently">';

                while ($r->have_posts()) {
                    $r->the_post();
                    global $product;

                    if (!is_a($product, 'WC_Product')) {
                        break;
                    }
                    ?>
                    <li>
                        <a href="<?php echo esc_url($product->get_permalink()); ?>"
                           title="<?php echo esc_attr($product->get_name()); ?>">
                            <?php printf('%s', $product->get_image()); ?>
                            <span class="screen-reader-text"><?php echo wp_kses_post($product->get_name()); ?></span>
                        </a>
                    </li>
                    <?php
                }

                echo '</ul>';

            }
        } else if ($settings['style'] === '2') {
            if ($r->have_posts()) {

                ?>
                    <div class="digitaz-products-border <?php echo esc_attr(wc_get_loop_prop('columns_responsive')); ?>">
                    <ul class="<?php echo esc_attr(wc_get_loop_prop('product-class', 'products')); ?> columns-<?php echo esc_html__($settings['column'], 'digitaz')?>">
                <?php

                while ($r->have_posts()) {
                    $r->the_post();

                    /**
                     * Hook: woocommerce_shop_loop.
                     */
                    do_action('woocommerce_shop_loop');
                    wc_get_template_part('content-product');

                }
                ?>
                    </ul>
                    </div>
                <?php
            }
        }


        wp_reset_postdata();

        echo ob_get_clean();
    }

}

$widgets_manager->register(new Digitaz_Elementor_Widget_Products_Recently());

Youez - 2016 - github.com/yon3zu