Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 3.145.72.55
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/wavevlvu/diixadigital.com/wp-content/plugins/meto-plugin/inc/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wavevlvu/diixadigital.com/wp-content/plugins/meto-plugin/inc/helpers/widgets.php
<?php
///----Blog widgets---
//Recent Post
class Meto_Recent_Post extends WP_Widget
{
    /** constructor */
    public function __construct()
    {
        parent::__construct( /* Base ID */'Meto_Recent_Post', /* Name */esc_html__('Meto Recent Post', 'meto'), array( 'description' => esc_html__('Show the Recent Post', 'meto')));
    }


    /** @see WP_Widget::widget */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);

        echo wp_kses_post($before_widget); ?>

		<!-- Categories Widget -->
        <div class="popular-posts">
            <?php echo wp_kses_post($before_title.$title.$after_title); ?>
            <div class="widget-content">
                <?php $query_string = 'posts_per_page='.$instance['number'];
					if ($instance['cat']) {
						$query_string .= '&cat='.$instance['cat'];
					}
					$this->posts($query_string); 
				?>
            </div>
        </div>
        
        <?php echo wp_kses_post($after_widget);
    }


    /** @see WP_Widget::update */
    public function update($new_instance, $old_instance)
    {
        $instance = $old_instance;

        $instance['title'] = strip_tags($new_instance['title']);
        $instance['number'] = $new_instance['number'];
        $instance['cat'] = $new_instance['cat'];

        return $instance;
    }

    /** @see WP_Widget::form */
    public function form($instance)
    {
        $title = ($instance) ? esc_attr($instance['title']) : esc_html__('Recent Post', 'meto');
        $number = ($instance) ? esc_attr($instance['number']) : 3;
        $cat = ($instance) ? esc_attr($instance['cat']) : ''; ?>

        <p>
            <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title: ', 'meto'); ?></label>
            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('number')); ?>"><?php esc_html_e('No. of Posts:', 'meto'); ?></label>
            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('number')); ?>" name="<?php echo esc_attr($this->get_field_name('number')); ?>" type="text" value="<?php echo esc_attr($number); ?>" />
        </p>

        <p>
            <label for="<?php echo esc_attr($this->get_field_id('categories')); ?>"><?php esc_html_e('Category', 'meto'); ?></label>
            <?php wp_dropdown_categories(array('show_option_all'=>esc_html__('All Categories', 'meto'), 'selected'=>$cat, 'class'=>'widefat', 'name'=>$this->get_field_name('categories'))); ?>
        </p>

        <?php
    }

    public function posts($query_string)
    {
        $query = new WP_Query($query_string);
        if ($query->have_posts()):?>

            <!-- Title -->
            <?php
                global $post;
				while ($query->have_posts()): $query->the_post();
				$post_thumbnail_id = get_post_thumbnail_id($post->ID);
				$post_thumbnail_url = wp_get_attachment_url($post_thumbnail_id);
			?>
            <article class="post">
                <figure class="post-thumb" style="background-image:url(<?php echo esc_url($post_thumbnail_url); ?>); "><a href="<?php echo esc_url(get_permalink(get_the_id())); ?>" class="overlay-box"><span class="icon fa fa-link"></span></a></figure>
                <div class="text"><a href="<?php echo esc_url(get_the_permalink(get_the_id())); ?>"><?php echo wp_trim_words(get_the_title(), 7, '...'); ?></a></div>
                <div class="post-info"><?php echo get_the_date(); ?></div>
            </article>
            <?php endwhile; ?>

        <?php endif;
        wp_reset_postdata();
    }
}

//Our Team
class Meto_Our_Team extends WP_Widget
{
    /** constructor */
    public function __construct()
    {
        parent::__construct( /* Base ID */'Meto_Our_Team', /* Name */esc_html__('Meto Our Team', 'meto'), array( 'description' => esc_html__('Show the Our Team', 'meto')));
    }

    /** @see WP_Widget::widget */
    public function widget($args, $instance)
    {
        extract($args);
        
        echo wp_kses_post($before_widget); ?>

        <!-- Author Widget -->
        <div class="author-widget">
            <?php
				$args = array('post_type' => 'meto_team', 'showposts'=>$instance['number']);
				if ($instance['cat']) {
					$args['tax_query'] = array(array('taxonomy' => 'team_cat','field' => 'id','terms' => (array)$instance['cat']));
				}
				$this->posts($args); 
			?>
        </div>
        
        <?php echo wp_kses_post($after_widget);
    }


    /** @see WP_Widget::update */
    public function update($new_instance, $old_instance)
    {
        $instance = $old_instance;

        $instance['number'] = $new_instance['number'];
        $instance['cat'] = $new_instance['cat'];

        return $instance;
    }
    /** @see WP_Widget::form */
    public function form($instance)
    {
        $number = ($instance) ? esc_attr($instance['number']) : 1;
        $cat = ($instance) ? esc_attr($instance['cat']) : ''; ?>

        <p>
            <label for="<?php echo esc_attr($this->get_field_id('number')); ?>"><?php esc_html_e('Number of posts: ', 'meto'); ?></label>
            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('number')); ?>" name="<?php echo esc_attr($this->get_field_name('number')); ?>" type="text" value="<?php echo esc_attr($number); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('cat')); ?>"><?php esc_html_e('Category', 'meto'); ?></label>
            <?php wp_dropdown_categories(array('show_option_all'=>esc_html__('All Categories', 'meto'), 'selected'=>$cat, 'taxonomy' => 'team_cat', 'class'=>'widefat', 'name'=>$this->get_field_name('cat'))); ?>
        </p>

        <?php
    }

    public function posts($args)
    {
        $query = new WP_Query($args);
        if ($query->have_posts()):?>

            <!-- Title -->
            <?php
               global $post;
			   while ($query->have_posts()): $query->the_post();
			?>
            
            <div class="widget-content" style="background-image: url(<?php echo get_template_directory_uri(); ?>/assets/images/background/author-bg.jpg)">
                <div class="image">
                    <?php the_post_thumbnail('meto_140x140'); ?>
                </div>
                <div class="name"><?php the_title(); ?></div>
                <div class="text"><?php the_excerpt(); ?></div>
                <!-- Social Box -->
                <?php $icons = get_post_meta(get_the_id(), 'social_profile', true); if (! empty($icons)) : ?>
                <ul class="social-box">
                    <?php
						foreach ($icons as $h_icon) :
						$header_social_icons = json_decode(urldecode(meto_set($h_icon, 'data')));
						if (meto_set($header_social_icons, 'enable') == '') {
							continue;
						}
						$icon_class = explode('-', meto_set($header_social_icons, 'icon')); 
					?>
                    <li><a href="<?php echo meto_set($header_social_icons, 'url'); ?>" style="background-color:<?php echo meto_set($header_social_icons, 'background'); ?>; color: <?php echo meto_set($header_social_icons, 'color'); ?>" class="fa <?php echo esc_attr(meto_set($header_social_icons, 'icon')); ?>"></a></li>
					<?php endforeach; ?>
                </ul>
                <?php endif; ?>
            </div>
            <?php endwhile; ?>

        <?php endif;
        wp_reset_postdata();
    }
}

//Our Gallery
class Meto_Our_Gallery extends WP_Widget
{
    /** constructor */
    public function __construct()
    {
        parent::__construct( /* Base ID */'Meto_Our_Gallery', /* Name */esc_html__('Meto Our Gallery', 'meto'), array( 'description' => esc_html__('Show the Our Gallery', 'meto')));
    }

    /** @see WP_Widget::widget */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);

        echo wp_kses_post($before_widget); ?>

        <!-- Instagram Widget -->
        <div class="instagram-widget">
            <?php echo wp_kses_post($before_title.$title.$after_title); ?>
            <div class="widget-content">
                <div class="clearfix">
                    <?php
                        $args = array('post_type' => 'meto_project', 'showposts'=>$instance['number']);
						if ($instance['cat']) {
							$args['tax_query'] = array(array('taxonomy' => 'project_cat','field' => 'id','terms' => (array)$instance['cat']));
						}
						$this->posts($args); 
					?>
                </div>
            </div>
        </div>

        <?php echo wp_kses_post($after_widget);
    }


    /** @see WP_Widget::update */
    public function update($new_instance, $old_instance)
    {
        $instance = $old_instance;

        $instance['title'] = strip_tags($new_instance['title']);
        $instance['number'] = $new_instance['number'];
        $instance['cat'] = $new_instance['cat'];

        return $instance;
    }
    /** @see WP_Widget::form */
    public function form($instance)
    {
        $title = ($instance) ? esc_attr($instance['title']) : 'Our Gallery';
        $number = ($instance) ? esc_attr($instance['number']) : 6;
        $cat = ($instance) ? esc_attr($instance['cat']) : ''; ?>

        <p>
            <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'meto'); ?></label>
            <input placeholder="<?php esc_attr_e('Our Projects', 'meto'); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('number')); ?>"><?php esc_html_e('Number of posts: ', 'meto'); ?></label>
            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('number')); ?>" name="<?php echo esc_attr($this->get_field_name('number')); ?>" type="text" value="<?php echo esc_attr($number); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('cat')); ?>"><?php esc_html_e('Category', 'meto'); ?></label>
            <?php wp_dropdown_categories(array('show_option_all'=>esc_html__('All Categories', 'meto'), 'selected'=>$cat, 'taxonomy' => 'project_cat', 'class'=>'widefat', 'name'=>$this->get_field_name('cat'))); ?>
        </p>

        <?php
    }

    public function posts($args)
    {
        $query = new WP_Query($args);
        if ($query->have_posts()):?>

            <!-- Title -->
            <?php
                global $post;
				while ($query->have_posts()): $query->the_post();
				$post_thumbnail_id = get_post_thumbnail_id($post->ID);
				$post_thumbnail_url = wp_get_attachment_url($post_thumbnail_id); 
			?>
            <figure class="post-thumb"><?php the_post_thumbnail('meto_110x110'); ?><a href="<?php echo esc_url(the_permalink(get_the_id())); ?>" class="overlay-box"><span class="icon fa fa-link"></span></a></figure>
            <?php endwhile; ?>

        <?php endif;
        wp_reset_postdata();
    }
}



///----footer widgets---
//About Company
class Meto_About_Us extends WP_Widget
{

    /** constructor */
    public function __construct()
    {
        parent::__construct( /* Base ID */'Meto_About_Us', /* Name */esc_html__('Meto About Us', 'meto'), array( 'description' => esc_html__('Show the About Us', 'meto')));
    }

    /** @see WP_Widget::widget */
    public function widget($args, $instance)
    {
        extract($args);

        echo wp_kses_post($before_widget); ?>

            <!--Footer Column-->
            <div class="logo-widget">
                <div class="logo">
                    <a href="<?php echo esc_url(home_url('/')); ?>"><img src="<?php echo esc_url($instance['widget_logo_img']); ?>" alt="<?php esc_attr_e('Awesome Image', 'meto'); ?>" /></a>
                </div>
                <div class="text"><?php echo wp_kses_post($instance['content']); ?></div>
                <!-- Social Box -->
                <?php if( $instance['show'] ): ?>
				<ul class="social-box">
					<?php echo wp_kses_post(meto_get_social_icons2()); ?>
                </ul>
                <?php endif; ?>
            </div>
            
        <?php

        echo wp_kses_post($after_widget);
    }


    /** @see WP_Widget::update */
    public function update($new_instance, $old_instance)
    {
        $instance = $old_instance;

        $instance['widget_logo_img'] = $new_instance['widget_logo_img'];
        $instance['content'] = $new_instance['content'];
        $instance['show'] = $new_instance['show'];

        return $instance;
    }

    /** @see WP_Widget::form */
    public function form($instance)
    {
        $widget_logo_img = ($instance) ? esc_attr($instance['widget_logo_img']) : 'https://expert-themes.com/newwp/meto/wp-content/uploads/2020/07/logo.png';
        $content = ($instance) ? esc_attr($instance['content']) : '';
        $show = ($instance) ? esc_attr($instance['show']) : ''; ?>

        <p>
            <label for="<?php echo esc_attr($this->get_field_id('widget_logo_img')); ?>"><?php esc_html_e('Logo url here:', 'meto'); ?></label>
            <input placeholder="<?php esc_attr_e('Logo url', 'meto'); ?>" class="widefat experts_media_url" id="<?php echo esc_attr($this->get_field_id('widget_logo_img')); ?>" name="<?php echo esc_attr($this->get_field_name('widget_logo_img')); ?>" type="text" value="<?php echo esc_attr($widget_logo_img); ?>" />
            <a href="#" class="button experts_media_upload"><?php esc_html_e('Upload', 'meto'); ?></a>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('content')); ?>"><?php esc_html_e('Content:', 'meto'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('content')); ?>" name="<?php echo esc_attr($this->get_field_name('content')); ?>" ><?php echo wp_kses_post($content); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('show')); ?>"><?php esc_html_e('Show Social Icons:', 'meto'); ?></label>
            <?php $selected = ($show) ? ' checked="checked"' : ''; ?>
            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('show')); ?>"<?php echo esc_attr($selected); ?> name="<?php echo esc_attr($this->get_field_name('show')); ?>" type="checkbox" value="true" />
        </p>


        <?php
    }
}

//Footer Gallery
class Meto_Footer_Gallery extends WP_Widget
{
    /** constructor */
    public function __construct()
    {
        parent::__construct( /* Base ID */'Meto_Footer_Gallery', /* Name */esc_html__('Meto Footer Gallery', 'meto'), array( 'description' => esc_html__('Show the Our Projects', 'meto')));
    }

    /** @see WP_Widget::widget */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);

        echo wp_kses_post($before_widget); ?>

		<!-- Instagram Widget -->
        <div class="gallery-widget">
            <?php echo wp_kses_post($before_title.$title.$after_title); ?>
            <div class="widget-content">
                <div class="images-outer clearfix">
                    <?php
                        $args = array('post_type' => 'meto_project', 'showposts'=>$instance['number']);
						if ($instance['cat']) {
							$args['tax_query'] = array(array('taxonomy' => 'project_cat','field' => 'id','terms' => (array)$instance['cat']));
						}
						$this->posts($args); 
					?>
                </div>
            </div>
        </div>        
        
        <?php echo wp_kses_post($after_widget);
    }


    /** @see WP_Widget::update */
    public function update($new_instance, $old_instance)
    {
        $instance = $old_instance;

        $instance['title'] = strip_tags($new_instance['title']);
        $instance['number'] = $new_instance['number'];
        $instance['cat'] = $new_instance['cat'];

        return $instance;
    }
    /** @see WP_Widget::form */
    public function form($instance)
    {
        $title = ($instance) ? esc_attr($instance['title']) : 'Our Gallery';
        $number = ($instance) ? esc_attr($instance['number']) : 6;
        $cat = ($instance) ? esc_attr($instance['cat']) : ''; ?>

        <p>
            <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'meto'); ?></label>
            <input placeholder="<?php esc_attr_e('Our Gallery', 'meto'); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('number')); ?>"><?php esc_html_e('Number of posts: ', 'meto'); ?></label>
            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('number')); ?>" name="<?php echo esc_attr($this->get_field_name('number')); ?>" type="text" value="<?php echo esc_attr($number); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('cat')); ?>"><?php esc_html_e('Category', 'meto'); ?></label>
            <?php wp_dropdown_categories(array('show_option_all'=>esc_html__('All Categories', 'meto'), 'selected'=>$cat, 'taxonomy' => 'project_cat', 'class'=>'widefat', 'name'=>$this->get_field_name('cat'))); ?>
        </p>

        <?php
    }

    public function posts($args)
    {
        $query = new WP_Query($args);
        if ($query->have_posts()):?>

            <!-- Title -->
            <?php
                global $post;
				while ($query->have_posts()): $query->the_post();
				$post_thumbnail_id = get_post_thumbnail_id($post->ID);
				$post_thumbnail_url = wp_get_attachment_url($post_thumbnail_id); 
			?>
            <!--Image Box-->
            <figure class="image-box"><a href="<?php echo esc_url($post_thumbnail_url); ?>" class="lightbox-image" data-fancybox="footer-gallery" title="Image Title Here" data-fancybox-group="footer-gallery"><?php the_post_thumbnail('meto_110x100'); ?></a></figure>
            <?php endwhile; ?>

        <?php endif;
        wp_reset_postdata();
    }
}

//Contact Us
class Meto_Contact_Us extends WP_Widget
{
    /** constructor */
    public function __construct()
    {
        parent::__construct( /* Base ID */'Meto_Contact_Us', /* Name */esc_html__('Meto Contact Us', 'meto'), array( 'description' => esc_html__('Show the information about company', 'meto')));
    }

    /** @see WP_Widget::widget */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        
        echo wp_kses_post($before_widget); ?>

        <!--Footer Column-->
        <div class="links-widget">
            <?php echo wp_kses_post($before_title.$title.$after_title); ?>
            <ul class="list-style-two">
                <?php if ($instance['address']):?><li><span class="icon flaticon-maps-and-flags"></span><?php echo wp_kses_post($instance['address']); ?></li><?php endif; ?>
                <?php if ($instance['working_hours']):?><li><span class="icon flaticon-clock"></span><?php echo wp_kses_post($instance['working_hours']); ?></li><?php endif; ?>
                <?php if ($instance['phone']):?><li><span class="icon flaticon-call"></span><?php echo wp_kses_post($instance['phone']); ?></li><?php endif; ?>
                <?php if ($instance['email']):?><li><span class="icon flaticon-email-4"></span><?php echo wp_kses_post($instance['email']); ?></li><?php endif; ?>
            </ul>
        </div>

        <?php echo wp_kses_post($after_widget);
    }

    /** @see WP_Widget::update */
    public function update($new_instance, $old_instance)
    {
        $instance = $old_instance;

        $instance['title'] = $new_instance['title'];
        $instance['address'] = $new_instance['address'];
        $instance['working_hours'] = $new_instance['working_hours'];
        $instance['phone'] = $new_instance['phone'];
        $instance['email'] = $new_instance['email'];

        return $instance;
    }

    /** @see WP_Widget::form */
    public function form($instance)
    {
        $title = ($instance) ? esc_attr($instance['title']) : esc_html__('Contact info', 'meto');
        $address = ($instance) ? esc_attr($instance['address']) : '';
        $working_hours = ($instance) ? esc_attr($instance['working_hours']) : '';
        $phone = ($instance) ? esc_attr($instance['phone']) : '';
        $email = ($instance) ? esc_attr($instance['email']) : ''; ?>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'meto'); ?></label>
            <input placeholder="<?php esc_attr_e('Contact info', 'meto'); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('address')); ?>"><?php esc_html_e('Address:', 'meto'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('address')); ?>" name="<?php echo esc_attr($this->get_field_name('address')); ?>" ><?php echo wp_kses_post($address); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('working_hours')); ?>"><?php esc_html_e('Working Days and Time:', 'meto'); ?></label>
            <input placeholder="<?php esc_attr_e('Working Days', 'meto'); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('working_hours')); ?>" name="<?php echo esc_attr($this->get_field_name('working_hours')); ?>" type="text" value="<?php echo esc_attr($working_hours); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('phone')); ?>"><?php esc_html_e('Phone Number:', 'meto'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('phone')); ?>" name="<?php echo esc_attr($this->get_field_name('phone')); ?>" ><?php echo wp_kses_post($phone); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('email')); ?>"><?php esc_html_e('Email Address:', 'meto'); ?></label>
            <input placeholder="<?php esc_attr_e('Email Address', 'meto'); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('email')); ?>" name="<?php echo esc_attr($this->get_field_name('email')); ?>" type="text" value="<?php echo esc_attr($email); ?>" />
        </p>

        <?php
    }
}

//Subcribe Form
class Meto_Subscribe extends WP_Widget
{
    /** constructor */
    public function __construct()
    {
        parent::__construct( /* Base ID */'Meto_Subscribe', /* Name */esc_html__('Meto Subscribe Form', 'meto'), array( 'description' => esc_html__('Show the information about company', 'meto')));
    }

    /** @see WP_Widget::widget */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);

        echo wp_kses_post($before_widget); ?>

        <!--Footer Column-->
        <div class="subscribe-widget">
            <?php echo wp_kses_post($before_title.$title.$after_title); ?>
            <div class="text"><?php echo wp_kses_post($instance['text']); ?></div>
            <div class="newsletter-form">
                <?php echo do_shortcode($instance['id']); ?>
            </div>
        </div>

        <?php echo wp_kses_post($after_widget);
    }

    /** @see WP_Widget::update */
    public function update($new_instance, $old_instance)
    {
        $instance = $old_instance;

        $instance['title'] = $new_instance['title'];
        $instance['text'] = $new_instance['text'];
        $instance['id'] = $new_instance['id'];

        return $instance;
    }

    /** @see WP_Widget::form */
    public function form($instance)
    {
        $title = ($instance) ? esc_attr($instance['title']) : esc_html__('Subscribe Now', 'meto');
        $text = ($instance) ? esc_attr($instance['text']) : '';
        $id = ($instance) ? esc_attr($instance['id']) : ''; ?>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'meto'); ?></label>
            <input placeholder="<?php esc_attr_e('Title', 'meto'); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('text')); ?>"><?php esc_html_e('Content:', 'meto'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('text')); ?>" name="<?php echo esc_attr($this->get_field_name('text')); ?>" ><?php echo wp_kses_post($text); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Subcribe ID:', 'meto'); ?></label>
            <input placeholder="<?php esc_attr_e('MailChimp Form Id', 'meto'); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('id')); ?>" name="<?php echo esc_attr($this->get_field_name('id')); ?>" type="text" value="<?php echo esc_attr($id); ?>" />
        </p>

        <?php
    }
}


///----Service Sidebar widgets---
//Services SideBar
class Meto_services_sidebar extends WP_Widget
{
    /** constructor */
    public function __construct()
    {
        parent::__construct( /* Base ID */'Meto_services_sidebar', /* Name */esc_html__('Meto Services Sidebar', 'meto'), array( 'description' => esc_html__('Show the Services Sidebar', 'meto')));
    }

    /** @see WP_Widget::widget */
    public function widget($args, $instance)
    {
        extract($args);

        echo wp_kses_post($before_widget); ?>

        <!-- Services -->
        <div class="sidebar-widget">
            <ul class="service-list">
            <?php
                $args = array('post_type' => 'meto_service', 'showposts'=>$instance['number']);
				if ($instance['cat']) {
					$args['tax_query'] = array(array('taxonomy' => 'service_cat','field' => 'id','terms' => (array)$instance['cat']));
				}
				$this->posts($args); 
			?>
            </ul>
        </div>

        <?php echo wp_kses_post($after_widget);
    }


    /** @see WP_Widget::update */
    public function update($new_instance, $old_instance)
    {
        $instance = $old_instance;

        $instance['number'] = $new_instance['number'];
        $instance['cat'] = $new_instance['cat'];

        return $instance;
    }
    /** @see WP_Widget::form */
    public function form($instance)
    {
        $number = ($instance) ? esc_attr($instance['number']) : 6;
        $cat = ($instance) ? esc_attr($instance['cat']) : ''; ?>

        <p>
            <label for="<?php echo esc_attr($this->get_field_id('number')); ?>"><?php esc_html_e('Number of posts: ', 'meto'); ?></label>
            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('number')); ?>" name="<?php echo esc_attr($this->get_field_name('number')); ?>" type="text" value="<?php echo esc_attr($number); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('cat')); ?>"><?php esc_html_e('Category', 'meto'); ?></label>
            <?php wp_dropdown_categories(array('show_option_all'=>esc_html__('All Categories', 'meto'), 'selected'=>$cat, 'taxonomy' => 'service_cat', 'class'=>'widefat', 'name'=>$this->get_field_name('cat'))); ?>
        </p>

        <?php
    }

    public function posts($args)
    {
        $query = new WP_Query($args);
        if ($query->have_posts()):?>

            <!-- Title -->
            <?php
                $curr_post = get_the_id();
        while ($query->have_posts()): $query->the_post();
        global $post;
        $post_name = $post->ID; ?>
            <li class="<?php if ($post_name == $curr_post) {
            echo 'current';
        } ?>"><a href="<?php echo esc_url(get_the_permalink(get_the_id())); ?>"><?php the_title(); ?></a></li>
            <?php endwhile; ?>

        <?php endif;
        wp_reset_postdata();
    }
}

//Our Brochures
class Meto_Brochures extends WP_Widget
{

    /** constructor */
    public function __construct()
    {
        parent::__construct( /* Base ID */'Meto_Brochures', /* Name */esc_html__('Meto Our Brochures', 'meto'), array( 'description' => esc_html__('Show the info Our Brochures', 'meto')));
    }
    /** @see WP_Widget::widget */
    public function widget($args, $instance)
    {
        extract($args);

        echo wp_kses_post($before_widget); ?>

			<div class="broucher-widget">
                <div class="widget-content">
                    <h3><?php echo wp_kses_post($instance['title']); ?></h3>
                    <div class="content-inner">
                        <div class="icon flaticon-pdf-1"></div>
                        <div class="text"><?php echo wp_kses_post($instance['content']); ?></div>
                        <?php if($instance['btn_link'] and $instance['btn_title']){ ?>
                        <a href="<?php echo esc_url($instance['btn_link']); ?>" class="download"><?php echo wp_kses_post($instance['btn_title']); ?></a>
                    	<?php } ?>
                    </div>
                </div>
            </div>

        <?php

        echo wp_kses_post($after_widget);
    }


    /** @see WP_Widget::update */
    public function update($new_instance, $old_instance)
    {
        $instance = $old_instance;

        $instance['title'] = $new_instance['title'];
        $instance['content'] = $new_instance['content'];
        $instance['btn_link'] = $new_instance['btn_link'];
        $instance['btn_title'] = $new_instance['btn_title'];

        return $instance;
    }
    /** @see WP_Widget::form */
    public function form($instance)
    {
        $title = ($instance) ? esc_attr($instance['title']) : 'Download Our Brochures';
        $content = ($instance) ? esc_attr($instance['content']) : '';
        $btn_link = ($instance) ? esc_attr($instance['btn_link']) : '';
        $btn_title = ($instance) ? esc_attr($instance['btn_title']) : ''; ?>

        <p>
            <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'meto'); ?></label>
            <input placeholder="<?php esc_attr_e('Download Our Brochures', 'meto'); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('content')); ?>"><?php esc_html_e('Content:', 'meto'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('content')); ?>" name="<?php echo esc_attr($this->get_field_name('content')); ?>" ><?php echo wp_kses_post($content); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('btn_link')); ?>"><?php esc_html_e('Button Link:', 'meto'); ?></label>
            <input placeholder="<?php esc_attr_e('#', 'meto'); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('btn_link')); ?>" name="<?php echo esc_attr($this->get_field_name('btn_link')); ?>" type="text" value="<?php echo esc_attr($btn_link); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('btn_title')); ?>"><?php esc_html_e('Button Title:', 'meto'); ?></label>
            <input placeholder="<?php esc_attr_e('Click here to download', 'meto'); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('btn_title')); ?>" name="<?php echo esc_attr($this->get_field_name('btn_title')); ?>" type="text" value="<?php echo esc_attr($btn_title); ?>" />
        </p>

        <?php
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit