403Webshell
Server IP : 103.82.32.14  /  Your IP : 216.73.217.121
Web Server : Apache/2.2.32 (Unix) mod_ssl/2.2.32 OpenSSL/1.0.1e-fips mod_fcgid/2.3.9
System : Linux cloud.lonmanhoabinh.com 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64
User : lonmakmf ( 524)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /home/lonmakmf/public_html/wp-content/themes/origamiez/parts/widgets/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/lonmakmf/public_html/wp-content/themes/origamiez/parts/widgets/posts-list-slider.php
<?php

add_action('widgets_init', array('Origamiez_Widget_Posts_List_Slider', 'register'));

class Origamiez_Widget_Posts_List_Slider extends Origamiez_Posts_Widget {

    public static function register(){
        register_widget('Origamiez_Widget_Posts_List_Slider');
    }

    function __construct() {
        $widget_ops = array('classname' => 'origamiez-widget-posts-slider', 'description' => __('Display a slider with three block: two static blocks, one dynamic (carousel) block.', 'origamiez'));
        $control_ops = array('width' => 'auto', 'height' => 'auto');
        parent::__construct('origamiez-widget-posts-slider', __('Origamiez Posts Slider', 'origamiez'), $widget_ops, $control_ops);
    }

    function widget($args, $instance) {
        extract($args);

        $instance = wp_parse_args((array) $instance, $this->get_default());

        extract($instance);

        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);

        echo $before_widget;
        if (!empty($title))
            echo $before_title . $title . $after_title;

        $query = $this->get_query($instance);

        echo '<div class="row clearfix">';

        $posts = new WP_Query(array_merge($query, array('posts_per_page' => 2)));

        if ($posts->have_posts()):
            ?>          

            <div class="col-left col-sm-4 col-xs-4">                
                <?php
                $is_first   = true;
                $loop_index = 1;
                while ($posts->have_posts()):
                    $posts->the_post();
                    $post_title = get_the_title();
                    $post_url   = get_permalink();
                    $post_format= get_post_format();

                    if (has_post_thumbnail()):
                        $classes   = array('item');
                        $classes[] = $is_first ? 'item-top' : 'item-bottom';
                        ?>                        
                        <article <?php post_class($classes); ?>>                            
                            <?php the_post_thumbnail('origamiez-posts-slide-metro', array('class' => 'img-responsive')); ?>                                    

                            <div class="caption">
                                <h5>
                                    <a class="entry-title" href="<?php echo $post_url; ?>" title="<?php echo $post_title; ?>">
                                        <?php echo $post_title; ?>        
                                    </a>                                
                                </h5>

                                <?php if($is_show_date || $is_show_comments): ?>
                                    <p class="metadata clearfix hidden">
                                        <?php get_template_part('parts/metadata/author'); ?>

                                        <?php if($is_show_date): ?>
                                            <?php get_template_part('parts/metadata/date'); ?>                                
                                        <?php endif;?>
                                        
                                        <?php if($is_show_date && $is_show_comments): ?>
                                            <?php get_template_part('parts/metadata/divider'); ?>
                                        <?php endif;?>

                                        <?php if($is_show_comments): ?>
                                            <?php get_template_part('parts/metadata/comments'); ?>
                                        <?php endif;?>        
                                    </p> 
                                <?php endif;?>                                                          

                                <?php
                                if($excerpt_words_limit):
                                    add_filter('excerpt_length', "origamiez_return_{$excerpt_words_limit}");
                                    ?>
                                    <p class="entry-excerpt clearfix hidden"><?php echo get_the_excerpt(); ?></p>
                                    <?php
                                    remove_filter('excerpt_length', "origamiez_return_{$excerpt_words_limit}");
                                    endif;
                                ?>

                            </div>

                        </article>
                        <?php
                        $is_first = false;
                    endif;
                    $loop_index++;
                endwhile;                
                ?>               
            </div>           
            <?php
        endif;
        wp_reset_postdata();

        $posts = new WP_Query(array_merge($query, array('offset' => 2, 'posts_per_page' => (int) $instance['posts_per_page'] - 2)));

        if ($posts->have_posts()):
            ?>          

            <div class="col-right col-sm-8 col-xs-8">
                <div class="owl-carousel owl-theme">
                    <?php
                    while ($posts->have_posts()):
                        $posts->the_post();
                        $post_title = get_the_title();
                        $post_url   = get_permalink();
                        $post_format= get_post_format();
                        if (has_post_thumbnail()):
                            ?>                        
                            <article <?php post_class('item'); ?>>                                
                                <?php the_post_thumbnail('origamiez-posts-slide-metro', array('class' => 'img-responsive')); ?>                                                                    

                                <div class="caption">
                                    <h2>
                                        <a class="entry-title" href="<?php echo $post_url; ?>" title="<?php echo $post_title; ?>">
                                            <?php echo $post_title; ?>                                            
                                        </a>
                                    </h2>

                                    <?php if($is_show_date || $is_show_comments): ?>
                                        <p class="metadata clearfix">
                                            <?php get_template_part('parts/metadata/author'); ?>

                                            <?php if($is_show_date): ?>
                                                <?php get_template_part('parts/metadata/date'); ?>                                
                                            <?php endif;?>
                                            
                                            <?php if($is_show_date && $is_show_comments): ?>
                                                <?php get_template_part('parts/metadata/divider'); ?>
                                            <?php endif;?>

                                            <?php if($is_show_comments): ?>
                                                <?php get_template_part('parts/metadata/comments'); ?>
                                            <?php endif;?>        
                                        </p> 
                                    <?php endif;?>

                                    <?php
                                    if($excerpt_words_limit):
                                        add_filter('excerpt_length', "origamiez_return_{$excerpt_words_limit}");
                                        ?>
                                        <p class="entry-excerpt clearfix"><?php echo get_the_excerpt(); ?></p>
                                        <?php
                                        remove_filter('excerpt_length', "origamiez_return_{$excerpt_words_limit}");
                                        endif;
                                    ?>                              

                                </div>                            

                            </article>
                            <?php
                        endif;
                        
                        $loop_index++;

                    endwhile;
                    ?>
                </div>
            </div>           
            <?php
        endif;
        wp_reset_postdata();

        echo '</div>';

        echo $after_widget;
    }

    function update($new_instance, $old_instance) {
        $instance = parent::update($new_instance, $old_instance);        
        $instance['excerpt_words_limit'] = isset($new_instance['excerpt_words_limit']) ? (int) $new_instance['excerpt_words_limit'] : 0;
        $instance['is_show_date']        = isset($new_instance['is_show_date']) ? 1 : 0;
        $instance['is_show_comments']    = isset($new_instance['is_show_comments']) ? 1 : 0;
        return $instance;
    }

    function form($instance) {
        parent::form($instance);
        $instance = wp_parse_args((array) $instance, $this->get_default());
        extract($instance);
        ?>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('excerpt_words_limit')); ?>"><?php _e('Excerpt words limit:', 'origamiez'); ?></label>            
            <select class="widefat" 
                id="<?php echo esc_attr($this->get_field_id('excerpt_words_limit')); ?>" 
                name="<?php echo esc_attr($this->get_field_name('excerpt_words_limit')); ?>">
                <?php
                $limits = array(0, 10, 15, 20, 30, 60);
                foreach ($limits as $limit) {
                    ?>
                    <option value="<?php echo esc_attr($limit); ?>" <?php selected($instance['excerpt_words_limit'], $limit); ?>><?php echo esc_attr($limit); ?></option>
                    <?php
                }
                ?>
            </select>            
        </p>
        <p>            
            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('is_show_date')); ?>" name="<?php echo esc_attr($this->get_field_name('is_show_date')); ?>" type="checkbox" value="1" <?php checked(1, (int)$is_show_date, true); ?> />            
            <label for="<?php echo esc_attr($this->get_field_id('is_show_date')); ?>"><?php _e('Is show date:', 'origamiez'); ?></label>            
        </p>
        <p>
            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('is_show_comments')); ?>" name="<?php echo esc_attr($this->get_field_name('is_show_comments')); ?>" type="checkbox" value="1" <?php checked(1, (int)$is_show_comments, true); ?> />            
            <label for="<?php echo esc_attr($this->get_field_id('is_show_comments')); ?>"><?php _e('Is show comments:', 'origamiez'); ?></label>                        
        </p>
        <?php
    }

    protected function get_default() {
        $default = parent::get_default();            
        $default['excerpt_words_limit'] = 0;
        $default['is_show_date']        = 1;
        $default['is_show_comments']    = 1;

        return $default;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit