Current File : /home/tekstore/public_html/wp-content/themes/kuteshop/shortcode/ovic_blog/config/widget.php
<?php
if ( !defined( 'ABSPATH' ) ) {
    exit;
}

if ( !class_exists( 'Widget_Ovic_Blog' ) ) {
    class Widget_Ovic_Blog extends OVIC_Widget
    {
        /**
         * Constructor.
         */
        public function __construct()
        {
            $this->widget_cssclass    = 'ovic-blog';
            $this->widget_description = 'Display the customer blog.';
            $this->widget_id          = 'ovic_blog';
            $this->widget_name        = esc_html__( 'Ovic: Blog', 'kuteshop' );
            $this->settings           = array(
                'title'    => array(
                    'type'  => 'text',
                    'title' => esc_html__( 'Title', 'kuteshop' ),
                ),
                'style'    => array(
                    'type'    => 'select_preview',
                    'title'   => esc_html__( 'Select style', 'kuteshop' ),
                    'options' => kuteshop_file_options( '/shortcode/ovic_blog/layout/', '' ),
                    'default' => 'style-01',
                ),
                'target'   => array(
                    'type'       => 'select',
                    'title'      => esc_html__( 'Target', 'kuteshop' ),
                    'options'    => array(
                        'recent_post' => esc_html__( 'Recent post', 'kuteshop' ),
                        'popularity'  => esc_html__( 'Popularity', 'kuteshop' ),
                        'date'        => esc_html__( 'Date', 'kuteshop' ),
                        'title'       => esc_html__( 'Title', 'kuteshop' ),
                        'random'      => esc_html__( 'Random', 'kuteshop' ),
                    ),
                    'attributes' => array(
                        'data-depend-id' => 'target',
                        'style'          => 'width:100%',
                    ),
                    'default'    => 'recent_post',
                ),
                'category' => array(
                    'type'           => 'select',
                    'title'          => esc_html__( 'Category Blog', 'kuteshop' ),
                    'options'        => 'categories',
                    'chosen'         => true,
                    'query_args'     => array(
                        'orderby' => 'name',
                        'order'   => 'ASC',
                    ),
                    'default_option' => esc_html__( 'Select a category', 'kuteshop' ),
                    'placeholder'    => esc_html__( 'Select a category', 'kuteshop' ),
                ),
                'limit'    => array(
                    'type'        => 'number',
                    'unit'        => 'items(s)',
                    'default'     => '6',
                    'title'       => esc_html__( 'Limit', 'kuteshop' ),
                    'description' => esc_html__( 'How much items per page to show', 'kuteshop' ),
                ),
                'orderby'  => array(
                    'type'        => 'select',
                    'title'       => esc_html__( 'Order by', 'kuteshop' ),
                    'options'     => array(
                        ''              => esc_html__( 'None', 'kuteshop' ),
                        'date'          => esc_html__( 'Date', 'kuteshop' ),
                        'ID'            => esc_html__( 'ID', 'kuteshop' ),
                        'author'        => esc_html__( 'Author', 'kuteshop' ),
                        'title'         => esc_html__( 'Title', 'kuteshop' ),
                        'modified'      => esc_html__( 'Modified', 'kuteshop' ),
                        'rand'          => esc_html__( 'Random', 'kuteshop' ),
                        'comment_count' => esc_html__( 'Comment count', 'kuteshop' ),
                        'menu_order'    => esc_html__( 'Menu order', 'kuteshop' ),
                    ),
                    'attributes'  => array(
                        'style' => 'width:100%',
                    ),
                    'description' => sprintf( esc_html__( 'Select how to sort retrieved products. More at %s.',
                        'kuteshop' ),
                        '<a href="' . esc_url( 'http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters' ) . '" target="_blank">' . esc_html__( 'WordPress codex page',
                            'kuteshop' ) . '</a>' ),
                ),
                'order'    => array(
                    'type'        => 'select',
                    'title'       => esc_html__( 'Sort order', 'kuteshop' ),
                    'options'     => array(
                        ''     => esc_html__( 'None', 'kuteshop' ),
                        'DESC' => esc_html__( 'Descending', 'kuteshop' ),
                        'ASC'  => esc_html__( 'Ascending', 'kuteshop' ),
                    ),
                    'attributes'  => array(
                        'style' => 'width:100%',
                    ),
                    'description' => sprintf( esc_html__( 'Designates the ascending or descending order. More at %s.',
                        'kuteshop' ),
                        '<a href="' . esc_url( 'http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters' ) . '" target="_blank">' . esc_html__( 'WordPress codex page',
                            'kuteshop' ) . '</a>' ),
                ),
            );

            parent::__construct();
        }

        /**
         * Output widget.
         *
         * @param  array $args
         * @param  array $instance
         *
         * @see WP_Widget
         *
         */
        public function widget( $args, $instance )
        {
            $atts                 = $instance;
            $atts['title']        = '';
            $atts['list_style']   = 'none';
            $atts['carousel']     = '';
            $atts['image_width']  = 330;
            $atts['image_height'] = 209;
            if ( $atts['style'] == 'style-01' ) {
                $atts['image_width']  = 90;
                $atts['image_height'] = 57;
            }

            $this->widget_start( $args, $instance );

            unset( $instance['title'] );

            echo ovic_do_shortcode( 'ovic_blog', $atts );

            $this->widget_end( $args );
        }
    }
}