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.140.195.142
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/misswavenigeria.com/wp-content/plugins/ombre-features/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wavevlvu/misswavenigeria.com/wp-content/plugins/ombre-features/ombre-widgets.php
<?php
/* ----------------------------------------------------------
Page Builder Custom Row Fields
------------------------------------------------------------- */
function ombre_hero_row ($fields) {
  $fields['ombregridhero'] = array(
      'name'        => __('Grid Hero', 'ombre'),
      'type'        => 'checkbox',
      'group'       => 'design',
      'priority'    => 1,
  );
  return $fields;
}
add_filter( 'siteorigin_panels_row_style_fields', 'ombre_hero_row' );

function ombre_row_style_attributes( $attributes, $args ) {
    if( !empty( $args['ombregridhero'] ) ) {
        array_push($attributes['class'], 'ombregridhero');
    }

    return $attributes;
}
add_filter('siteorigin_panels_row_style_attributes', 'ombre_row_style_attributes', 10, 2);

/* ----------------------------------------------------------
Page Builder Widget Groups
------------------------------------------------------------- */
function ombre_add_widget_tabs($tabs) {
    $tabs[] = array(
        'title' => __('Ombre Widgets', 'ombre'),
        'filter' => array(
            'groups' => array('ombre')
        )
    );
    return $tabs;
}
add_filter('siteorigin_panels_widget_dialog_tabs', 'ombre_add_widget_tabs', 20);

/* ----------------------------------------------------------
Our team widget
------------------------------------------------------------- */

add_action( 'widgets_init', 'ombre_team_widget' );

function ombre_team_widget() {
	register_widget( 'ombre_teamwidget' );
}

class ombre_teamwidget extends WP_Widget {

    function __construct() {
		parent::__construct(
			'ombre-team-widget', // Base ID
			esc_attr__('Ombre Our Team', 'ombre'), // Name
			array( 'description' => esc_attr__('Our Team Carousel Widget', 'ombre'),'panels_groups' => array('ombre'),'panels_icon' => 'dashicons dashicons-image-flip-horizontal' ) // Args
		);
	}
	
	public function widget( $args, $instance ) {
		extract( $args );
        $max = $instance['max'];
        $columns = $instance['columns'];
        $autoplay = $instance['autoplay'];
        $duration = $instance['duration'];

		echo $args['before_widget'];
		if ( ! empty( $instance['title'] ) ) {
			echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
		}  
        echo do_shortcode("[ourteam max='" . esc_attr($max) . "' columns='" . esc_attr($columns) . "' autoplay='" . esc_attr($autoplay) . "' duration='" . esc_attr($duration) . "']");
		
		echo $args['after_widget'];
	}
	 
	public function update( $new_instance, $old_instance ) {
		$instance = array();
		$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
        $instance['max'] = $new_instance['max'];
        $instance['columns'] = $new_instance['columns'];
        $instance['autoplay'] = $new_instance['autoplay'];
        $instance['duration'] = $new_instance['duration'];

		return $instance;
	}

	
	public function form( $instance ) {
		$defaults = array('title' => '', 'max' => '99', 'duration' => '4');
		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_attr_e('Title:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'max' )); ?>"><?php esc_attr_e('Maximum number of person:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'max' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'max' )); ?>" value="<?php if (isset($instance['max'])) { echo esc_attr($instance['max']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'columns' )); ?>"><?php esc_attr_e('Columns:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'columns' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'columns' )); ?>">
        <option value="4" <?php if (isset($instance['columns'])) { if ($instance['columns'] == 4) { echo esc_attr('selected="selected"'); }} ?>>4</option>
        <option value="3" <?php if (isset($instance['columns'])) { if ($instance['columns'] == 3) { echo esc_attr('selected="selected"'); }} ?>>3</option>
        <option value="2" <?php if (isset($instance['columns'])) { if ($instance['columns'] == 2) { echo esc_attr('selected="selected"'); }} ?>>2</option>
        <option value="1" <?php if (isset($instance['columns'])) { if ($instance['columns'] == 1) { echo esc_attr('selected="selected"'); }} ?>>1</option>
    </select>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'autoplay' )); ?>"><?php esc_attr_e('Autoplay:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'autoplay' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'autoplay' )); ?>">
        <option value="false" <?php if (isset($instance['autoplay'])) { if ($instance['autoplay'] == 'false') { echo esc_attr('selected="selected"'); }} ?>>False</option>
        <option value="true" <?php if (isset($instance['autoplay'])) { if ($instance['autoplay'] == 'true') { echo esc_attr('selected="selected"'); }} ?>>True</option>
    </select>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'duration' )); ?>"><?php esc_attr_e('Autoplay duration (second):', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'duration' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'duration' )); ?>" value="<?php if (isset($instance['duration'])) { echo esc_attr($instance['duration']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>
<?php }} ?>
<?php

/* ----------------------------------------------------------
Testimonials widget
------------------------------------------------------------- */

add_action( 'widgets_init', 'ombre_testimonials_widget' );

function ombre_testimonials_widget() {
	register_widget( 'ombre_testimonialswidget' );
}

class ombre_testimonialswidget extends WP_Widget {

    function __construct() {
		parent::__construct(
			'ombre-testimonials-widget', // Base ID
			esc_attr__('Ombre Testimonials', 'ombre'), // Name
			array( 'description' => esc_attr__('Testimonials Slider Widget', 'ombre'),'panels_groups' => array('ombre'),'panels_icon' => 'dashicons dashicons-format-quote' ) // Args
		);
	}
	
	public function widget( $args, $instance ) {
		extract( $args );
        $autoplay = $instance['autoplay'];
        $duration = $instance['duration'];
        $autoheight = $instance['autoheight'];

		echo $args['before_widget'];
		if ( ! empty( $instance['title'] ) ) {
			echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
		}  
        echo do_shortcode("[testimonials autoplay='" . esc_attr($autoplay) . "' duration='" . esc_attr($duration) . "' autoheight='" . esc_attr($autoheight) . "']");
		
		echo $args['after_widget'];
	}
	 
	public function update( $new_instance, $old_instance ) {
		$instance = array();
		$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
        $instance['autoplay'] = $new_instance['autoplay'];
        $instance['duration'] = $new_instance['duration'];
        $instance['autoheight'] = $new_instance['autoheight'];

		return $instance;
	}

	
	public function form( $instance ) {
		$defaults = array('title' => '', 'duration' => '4');
		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_attr_e('Title:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'autoplay' )); ?>"><?php esc_attr_e('Autoplay:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'autoplay' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'autoplay' )); ?>">
        <option value="true" <?php if (isset($instance['autoplay'])) { if ($instance['autoplay'] == 'true') { echo esc_attr('selected="selected"'); }} ?>>True</option>
        <option value="false" <?php if (isset($instance['autoplay'])) { if ($instance['autoplay'] == 'false') { echo esc_attr('selected="selected"'); }} ?>>False</option>
    </select>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'duration' )); ?>"><?php esc_attr_e('Autoplay duration (second):', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'duration' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'duration' )); ?>" value="<?php if (isset($instance['duration'])) { echo esc_attr($instance['duration']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'autoheight' )); ?>"><?php esc_attr_e('Auto Height:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'autoheight' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'autoheight' )); ?>">
        <option value="false" <?php if (isset($instance['autoheight'])) { if ($instance['autoheight'] == 'false') { echo esc_attr('selected="selected"'); }} ?>>False</option>
        <option value="true" <?php if (isset($instance['autoheight'])) { if ($instance['autoheight'] == 'true') { echo esc_attr('selected="selected"'); }} ?>>True</option>
    </select>
</p>
<?php }} ?>
<?php

/* ----------------------------------------------------------
Divider widget
------------------------------------------------------------- */

add_action( 'widgets_init', 'ombre_divider_widget' );

function ombre_divider_widget() {
	register_widget( 'ombre_dividerwidget' );
}

class ombre_dividerwidget extends WP_Widget {

    function __construct() {
		parent::__construct(
			'ombre-divider-widget', // Base ID
			esc_attr__('Ombre Divider', 'ombre'), // Name
			array( 'description' => esc_attr__('Divider Widget', 'ombre'),'panels_groups' => array('ombre'),'panels_icon' => 'dashicons dashicons-minus' ) // Args
		);
	}
	
	public function widget( $args, $instance ) {
		extract( $args );
        $left = $instance['left'];
        $right = $instance['right'];
        $top = $instance['top'];
        $bottom = $instance['bottom'];

		echo $args['before_widget'];

        echo do_shortcode('<hr style="margin-left:' . esc_attr($left) . 'px;margin-right:' . esc_attr($right) . 'px;margin-top:' . esc_attr($top) . 'px;margin-bottom:' . esc_attr($bottom) . 'px;" />');
		
		echo $args['after_widget'];
	}
	 
	public function update( $new_instance, $old_instance ) {
		$instance = array();
        $instance['left'] = $new_instance['left'];
        $instance['right'] = $new_instance['right'];
        $instance['top'] = $new_instance['top'];
        $instance['bottom'] = $new_instance['bottom'];

		return $instance;
	}

	
	public function form( $instance ) {
		$defaults = array( 'left' => '-60', 'right' => '-60', 'top' => '60', 'bottom' => '30');
		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'left' )); ?>"><?php esc_attr_e('Margin-left (px):', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'left' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'left' )); ?>" value="<?php if (isset($instance['left'])) { echo esc_attr($instance['left']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'right' )); ?>"><?php esc_attr_e('Margin-right (px):', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'right' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'right' )); ?>" value="<?php if (isset($instance['right'])) { echo esc_attr($instance['right']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'top' )); ?>"><?php esc_attr_e('Margin-top (px):', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'top' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'top' )); ?>" value="<?php if (isset($instance['top'])) { echo esc_attr($instance['top']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'bottom' )); ?>"><?php esc_attr_e('Margin-bottom (px):', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'bottom' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'bottom' )); ?>" value="<?php if (isset($instance['bottom'])) { echo esc_attr($instance['bottom']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>
<?php }} ?>
<?php

/* ----------------------------------------------------------
Models widget
------------------------------------------------------------- */

add_action( 'widgets_init', 'ombre_models_widget' );

function ombre_models_widget() {
	register_widget( 'ombre_modelswidget' );
}

class ombre_modelswidget extends WP_Widget {

    function __construct() {
		parent::__construct(
			'ombre-models-widget', // Base ID
			esc_attr__('Ombre Models', 'ombre'), // Name
			array( 'description' => esc_attr__('Models Carousel Widget', 'ombre'),'panels_groups' => array('ombre'),'panels_icon' => 'dashicons dashicons-groups' ) // Args
		);
	}
	
	public function widget( $args, $instance ) {
		extract( $args );
        $max = $instance['max'];
        $columns = $instance['columns'];
        $autoplay = $instance['autoplay'];
        $duration = $instance['duration'];
        $categoryid = $instance['categoryid'];

		echo $args['before_widget'];
		if ( ! empty( $instance['title'] ) ) {
			echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
		}  
        echo do_shortcode("[models max='" . esc_attr($max) . "' columns='" . esc_attr($columns) . "' autoplay='" . esc_attr($autoplay) . "' duration='" . esc_attr($duration) . "' categoryid='" . esc_attr($categoryid) . "']");
		
		echo $args['after_widget'];
	}
	 
	public function update( $new_instance, $old_instance ) {
		$instance = array();
		$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
        $instance['max'] = $new_instance['max'];
        $instance['columns'] = $new_instance['columns'];
        $instance['autoplay'] = $new_instance['autoplay'];
        $instance['duration'] = $new_instance['duration'];
        $instance['categoryid'] = $new_instance['categoryid'];

		return $instance;
	}

	
	public function form( $instance ) {
		$defaults = array('title' => '', 'max' => '99', 'duration' => '4');
		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_attr_e('Title:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'max' )); ?>"><?php esc_attr_e('Maximum number of person:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'max' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'max' )); ?>" value="<?php if (isset($instance['max'])) { echo esc_attr($instance['max']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'columns' )); ?>"><?php esc_attr_e('Columns:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'columns' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'columns' )); ?>">
        <option value="4" <?php if (isset($instance['columns'])) { if ($instance['columns'] == 4) { echo esc_attr('selected="selected"'); }} ?>>4</option>
        <option value="3" <?php if (isset($instance['columns'])) { if ($instance['columns'] == 3) { echo esc_attr('selected="selected"'); }} ?>>3</option>
        <option value="2" <?php if (isset($instance['columns'])) { if ($instance['columns'] == 2) { echo esc_attr('selected="selected"'); }} ?>>2</option>
        <option value="1" <?php if (isset($instance['columns'])) { if ($instance['columns'] == 1) { echo esc_attr('selected="selected"'); }} ?>>1</option>
    </select>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'autoplay' )); ?>"><?php esc_attr_e('Autoplay:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'autoplay' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'autoplay' )); ?>">
        <option value="false" <?php if (isset($instance['autoplay'])) { if ($instance['autoplay'] == 'false') { echo esc_attr('selected="selected"'); }} ?>>False</option>
        <option value="true" <?php if (isset($instance['autoplay'])) { if ($instance['autoplay'] == 'true') { echo esc_attr('selected="selected"'); }} ?>>True</option>
    </select>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'duration' )); ?>"><?php esc_attr_e('Autoplay duration (second):', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'duration' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'duration' )); ?>" value="<?php if (isset($instance['duration'])) { echo esc_attr($instance['duration']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>


<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'categoryid' )); ?>"><?php esc_attr_e('Category:', 'ombre'); ?></label>
    <select class="fwselect" id="<?php echo $this->get_field_id('categoryid'); ?>" name="<?php echo $this->get_field_name('categoryid'); ?>">
        <option value=""><?php esc_attr_e('All Categories', 'ombre'); ?></option>
        <?php foreach(get_terms('ombremodelcats','parent=0&hide_empty=0') as $term) { ?>
        <option <?php if (isset($instance['categoryid'])) { if ($instance['categoryid'] == $term->term_id) { echo esc_attr('selected="selected"'); }} ?> value="<?php echo $term->term_id; ?>"><?php echo $term->name; ?></option>
        <?php } ?>      
    </select>
</p>
<?php }} ?>
<?php

/* ----------------------------------------------------------
Icon widget
------------------------------------------------------------- */

add_action( 'widgets_init', 'ombre_icon_widget' );

function ombre_icon_widget() {
	register_widget( 'ombre_iconwidget' );
}

class ombre_iconwidget extends WP_Widget {

    function __construct() {
		parent::__construct(
			'ombre-icon-widget', // Base ID
			esc_attr__('Ombre Icon', 'ombre'), // Name
			array( 'description' => esc_attr__('Font Awesome Icon Widget', 'ombre'),'panels_groups' => array('ombre'),'panels_icon' => 'dashicons dashicons-star-filled' ) // Args
		);
	}
	
	public function widget( $args, $instance ) {
		extract( $args );
        $icon = $instance['icon'];
        $url = $instance['url'];
        $icontitle = $instance['icontitle'];
        $headerlevel = $instance['headerlevel'];
        $align = $instance['align'];
        $content = $instance['content'];

		echo $args['before_widget'];

        echo do_shortcode("[ombreicon title='" . esc_attr($icontitle) . "' headerlevel='" . esc_attr($headerlevel) . "' text='" . esc_attr($content) . "' icon='" . esc_attr($icon) . "' align='" . esc_attr($align) . "' link='" . esc_attr($url) . "']");
		
		echo $args['after_widget'];
	}
	 
	public function update( $new_instance, $old_instance ) {
		$instance = array();
        $instance['icon'] = $new_instance['icon'];
        $instance['url'] = $new_instance['url'];
        $instance['icontitle'] = $new_instance['icontitle'];
        $instance['headerlevel'] = $new_instance['headerlevel'];
        $instance['align'] = $new_instance['align'];
        $instance['content'] = $new_instance['content'];

		return $instance;
	}

	
	public function form( $instance ) {
		$defaults = array('icontitle' => esc_attr__('Icon Title', 'ombre'), 'headerlevel' => 'h3', 'icon' => 'star');
		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'icontitle' )); ?>"><?php esc_attr_e('Title:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'icontitle' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'icontitle' )); ?>" value="<?php if (isset($instance['icontitle'])) { echo esc_attr($instance['icontitle']); } ?>" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'headerlevel' )); ?>"><?php esc_attr_e('Header level:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'headerlevel' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'headerlevel' )); ?>">
        <option value="h1" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h1') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 1', 'ombre'); ?></option>
        <option value="h2" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h2') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 2', 'ombre'); ?></option>
        <option value="h3" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h3') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 3', 'ombre'); ?></option>
        <option value="h4" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h4') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 4', 'ombre'); ?></option>
        <option value="h5" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h5') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 5', 'ombre'); ?></option>
        <option value="h6" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h6') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 6', 'ombre'); ?></option>
    </select>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'icon' )); ?>"><?php esc_attr_e('Font Awesome icon name:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'icon' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'icon' )); ?>" value="<?php if (isset($instance['icon'])) { echo esc_attr($instance['icon']); } ?>" class="fwtext" />
</p>
<p><a href="https://fortawesome.github.io/Font-Awesome/icons/" style="text-decoration:underline" target="_blank">Font Awesome Icons</a>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'align' )); ?>"><?php esc_attr_e('Icon align:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'align' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'align' )); ?>">
        <option value="center" <?php if (isset($instance['align'])) { if ($instance['align'] == 'center') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Center', 'ombre'); ?></option>
        <option value="left" <?php if (isset($instance['align'])) { if ($instance['align'] == 'left') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Left', 'ombre'); ?></option>
        <option value="right" <?php if (isset($instance['align'])) { if ($instance['align'] == 'right') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Right', 'ombre'); ?></option>
    </select>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'url' )); ?>"><?php esc_attr_e('Destination url (optional):', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'url' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'url' )); ?>" value="<?php if (isset($instance['url'])) { echo esc_attr($instance['url']); } ?>" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'content' )); ?>"><?php esc_attr_e('Text:', 'ombre'); ?></label>
    <textarea id="<?php echo esc_attr($this->get_field_id( 'content' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'content' )); ?>" style="width:100%;height:200px;"><?php if (isset($instance['content'])) { echo esc_attr($instance['content']); } ?></textarea>
</p>
<?php }} ?>
<?php

/* ----------------------------------------------------------
Image widget
------------------------------------------------------------- */

add_action( 'widgets_init', 'ombre_image_widget' );

function ombre_image_widget() {
	register_widget( 'ombre_imagewidget' );
}

class ombre_imagewidget extends WP_Widget {

    function __construct() {
		parent::__construct(
			'ombre-image-widget', // Base ID
			esc_attr__('Ombre Image', 'ombre'), // Name
			array( 'description' => esc_attr__('Image Widget', 'ombre'),'panels_groups' => array('ombre'),'panels_icon' => 'dashicons dashicons-format-image' ) // Args
		);
	}
	
	public function widget( $args, $instance ) {
		extract( $args );
        $image = $instance['image'];
        $caption = $instance['caption'];
        $url = $instance['url'];
        $target = $instance['target'];
        $marginbottom = $instance['marginbottom'];

		echo $args['before_widget'];
		if ( ! empty( $instance['title'] ) ) {
			echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
		}  
        if ( ! empty( $instance['url'] ) ) {
            if ( ! empty( $instance['caption'] ) ) {
                echo do_shortcode('<figure style="margin-bottom:' . esc_attr($marginbottom) . 'px !important;" class="caption-image img-widget"><a class="o-gallery link" href="' . esc_url($url) . '" target="_' . esc_attr($target) . '"><img src="' . esc_url($image) . '" alt="' . esc_attr($caption) . '" /></a><figcaption><div>' . esc_attr($caption) . '</div></figcaption></figure>');
            }
            else {
                echo do_shortcode('<figure style="margin-bottom:' . esc_attr($marginbottom) . 'px !important;" class="caption-image img-widget"><a class="o-gallery link" href="' . esc_url($url) . '" target="_' . esc_attr($target) . '"><img src="' . esc_url($image) . '" alt="" /></a></figure>');
            }
        }
        else {
            if ( ! empty( $instance['caption'] ) ) {
                echo do_shortcode('<figure style="margin-bottom:' . esc_attr($marginbottom) . 'px !important;" class="caption-image img-widget"><img src="' . esc_url($image) . '" alt="' . esc_attr($caption) . '" /><figcaption><div>' . esc_attr($caption) . '</div></figcaption></figure>');
            }
            else {
                echo do_shortcode('<figure style="margin-bottom:' . esc_attr($marginbottom) . 'px !important;" class="caption-image img-widget"><img src="' . esc_url($image) . '" alt="' . esc_attr($caption) . '" /></figure>');
            }
        }
		
		echo $args['after_widget'];
	}
	 
	public function update( $new_instance, $old_instance ) {
        
		$instance = array();
        $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
        $instance['image'] = $new_instance['image'];
        $instance['caption'] = $new_instance['caption'];
        $instance['url'] = $new_instance['url'];
        $instance['target'] = $new_instance['target'];
        $instance['marginbottom'] = $new_instance['marginbottom'];

		return $instance;
	}

	
	public function form( $instance ) {
		$defaults = array('title' => '', 'target' => 'self', 'marginbottom' => 0);
		$instance = wp_parse_args( (array) $instance, $defaults );
?>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_attr_e('Title:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'image' )); ?>"><?php esc_attr_e('Image:', 'ombre'); ?></label>   
    <input type="text" name="<?php echo esc_attr($this->get_field_name( 'image' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'image' )); ?>" class="fwtext" value="<?php if (isset($instance['image'])) { echo esc_attr($instance['image']); } ?>" />
        <input id="ombreiframe" onclick="image_button_click('<?php esc_attr_e( 'Choose Image', 'ombre') ?>','<?php esc_attr_e( 'Select Image', 'ombre') ?>','<?php echo esc_attr($this->get_field_id( 'image' ));  ?>');" class="button" type="button" value="<?php esc_attr_e( 'Upload Image', 'ombre') ?>" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'caption' )); ?>"><?php esc_attr_e('Caption:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'caption' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'caption' )); ?>" value="<?php if (isset($instance['caption'])) { echo esc_attr($instance['caption']); } ?>" type="text" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'url' )); ?>"><?php esc_attr_e('Url (Optional):', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'url' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'url' )); ?>" value="<?php if (isset($instance['url'])) { echo esc_attr($instance['url']); } ?>" type="text" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'target' )); ?>"><?php esc_attr_e('Link target:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'target' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'target' )); ?>">
        <option value="self" <?php if (isset($instance['target'])) { if ($instance['target'] == 'self') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Self', 'ombre'); ?></option>
        <option value="blank" <?php if (isset($instance['target'])) { if ($instance['target'] == 'blank') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Blank', 'ombre'); ?></option>
        <option value="parent" <?php if (isset($instance['target'])) { if ($instance['target'] == 'parent') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Parent', 'ombre'); ?></option>
        <option value="top" <?php if (isset($instance['target'])) { if ($instance['target'] == 'top') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Top', 'ombre'); ?></option>
    </select>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'marginbottom' )); ?>"><?php esc_attr_e('Margin bottom:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'marginbottom' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'marginbottom' )); ?>" value="<?php if (isset($instance['marginbottom'])) { echo esc_attr($instance['marginbottom']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>
<?php }} ?>
<?php

/* ----------------------------------------------------------
Google map widget
------------------------------------------------------------- */

add_action( 'widgets_init', 'ombre_map_widget' );

function ombre_map_widget() {
	register_widget( 'ombre_mapwidget' );
}

class ombre_mapwidget extends WP_Widget {

    function __construct() {
		parent::__construct(
			'ombre-map-widget', // Base ID
			esc_attr__('Ombre Google Map', 'ombre'), // Name
			array( 'description' => esc_attr__('Custom Google Map Widget', 'ombre'),'panels_groups' => array('ombre'),'panels_icon' => 'dashicons dashicons-location-alt' ) // Args
		);
	}
	
	public function widget( $args, $instance ) {
		extract( $args );
        $latitute = $instance['latitute'];
        $longitude = $instance['longitude'];
        $zoom = $instance['zoom'];
        $grayscale = $instance['grayscale'];
        $markercolor = $instance['markercolor'];
        $widescreen = $instance['widescreen'];

		echo $args['before_widget'];
		if ( ! empty( $instance['title'] ) ) {
			echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
		}  
        echo do_shortcode("[googlemap latitute='" . esc_attr($latitute) . "' longitude='" . esc_attr($longitude) . "' zoom='" . esc_attr($zoom) . "' grayscale='" . esc_attr($grayscale) . "' markercolor='" . esc_attr($markercolor) . "' widescreen='" . esc_attr($widescreen) . "']");
		
		echo $args['after_widget'];
	}
	 
	public function update( $new_instance, $old_instance ) {
		$instance = array();
        $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
        $instance['latitute'] = $new_instance['latitute'];
        $instance['longitude'] = $new_instance['longitude'];
        $instance['zoom'] = $new_instance['zoom'];
        $instance['grayscale'] = $new_instance['grayscale'];
        $instance['markercolor'] = $new_instance['markercolor'];
        $instance['widescreen'] = $new_instance['widescreen'];
		return $instance;
	}
	
	public function form( $instance ) {
		$defaults = array('title' => '', 'latitute' => '40.714353','longitude' => '-74.005973','zoom' => '17','grayscale' => 'true','widescreen' => 'widescreen');
		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_attr_e('Title:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'latitute' )); ?>"><?php esc_attr_e('Latitute:', 'ombre'); ?></label>   
    <input type="text" name="<?php echo esc_attr($this->get_field_name( 'latitute' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'latitute' )); ?>" class="fwtext" value="<?php if (isset($instance['latitute'])) { echo esc_attr($instance['latitute']); } ?>" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'longitude' )); ?>"><?php esc_attr_e('Longitude:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'longitude' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'longitude' )); ?>" value="<?php if (isset($instance['longitude'])) { echo esc_attr($instance['longitude']); } ?>" type="text" class="fwtext" />
</p>
<p>
    <a href="https://www.latlong.net/" target="_blank">Click here to find your coordinates</a>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'zoom' )); ?>"><?php esc_attr_e('Zoom:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'zoom' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'zoom' )); ?>">
<?php
$arr = array(19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
foreach ($arr as $value) { ?>
        <option value="<?php echo esc_attr($value); ?>" <?php if (isset($instance['zoom'])) { if ($instance['zoom'] == $value ) { echo esc_attr('selected="selected"'); }} ?>><?php echo esc_attr($value); ?></option>
<?php }
unset($value);
?>
    </select>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'grayscale' )); ?>"><?php esc_attr_e('Grayscale:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'grayscale' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'grayscale' )); ?>">
        <option value="true" <?php if (isset($instance['grayscale'])) { if ($instance['grayscale'] == 'true') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('True', 'ombre'); ?></option>
        <option value="false" <?php if (isset($instance['grayscale'])) { if ($instance['grayscale'] == 'false') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('False', 'ombre'); ?></option>
    </select>
</p>
<p>
    <label style="display:block;width:100%;" for="<?php echo esc_attr($this->get_field_id( 'markercolor' )); ?>"><?php esc_attr_e('Marker color:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'markercolor' )); ?>" class="fwtext" name="<?php echo esc_attr($this->get_field_name( 'markercolor' )); ?>" value="<?php echo esc_attr($instance['markercolor']); ?>" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'widescreen' )); ?>"><?php esc_attr_e('Widescreen:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'widescreen' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'widescreen' )); ?>">
        <option value="true" <?php if (isset($instance['widescreen'])) { if ($instance['widescreen'] == 'true') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('True', 'ombre'); ?></option>
        <option value="false" <?php if (isset($instance['widescreen'])) { if ($instance['widescreen'] == 'false') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('False', 'ombre'); ?></option>
    </select>
</p>
<?php }} ?>
<?php

/* ----------------------------------------------------------
Ombre grid hero box widget
------------------------------------------------------------- */

add_action( 'widgets_init', 'ombre_ombregridbox_widget' );

function ombre_ombregridbox_widget() {
	register_widget( 'ombre_ombregridboxwidget' );
}

class ombre_ombregridboxwidget extends WP_Widget {

    function __construct() {
		parent::__construct(
			'ombre-ombregridbox-widget', // Base ID
			esc_attr__('Ombre Grid Hero Box', 'ombre'), // Name
			array( 'description' => esc_attr__('Ombre Grid Hero Box', 'ombre'),'panels_groups' => array('ombre'),'panels_icon' => 'dashicons dashicons-align-center' ) // Args
		);
	}

	public function widget( $args, $instance ) {
		extract( $args );
        $herotitle = $instance['herotitle'];
        $herosubtitle = $instance['herosubtitle'];
        $headerlevel = $instance['headerlevel'];
        $buttontext = $instance['buttontext'];
        $buttonurl = $instance['buttonurl'];
        $target = $instance['target'];

		echo $args['before_widget'];
        ?>
<div class="ombregridherobox">
        <?php
		if ( ! empty( $herotitle ) ) {
			echo '<' . esc_attr($headerlevel) . '>'. esc_attr($herotitle) . '</' . esc_attr($headerlevel) . '>'; 
		}  
        if ( ! empty( $herosubtitle ) ) {
			echo '<p>' . esc_attr($herosubtitle) . '</p>'; 
		}
        if ( ! empty( $buttonurl ) ) {
			echo '<div class="ombregridherobutton"><a class="button" target="_' . esc_attr($target) . '" href="'. esc_url($buttonurl) . '">' . esc_attr($buttontext) . '</a></div>'; 
		}
		?>
</div>
        <?php
		echo $args['after_widget'];
	}
	 
	public function update( $new_instance, $old_instance ) {
		$instance = array();
        $instance['herotitle'] = $new_instance['herotitle'];
        $instance['herosubtitle'] = $new_instance['herosubtitle'];
        $instance['headerlevel'] = $new_instance['headerlevel'];
        $instance['buttontext'] = $new_instance['buttontext'];
        $instance['buttonurl'] = $new_instance['buttonurl'];
        $instance['target'] = $new_instance['target'];

		return $instance;
	}

	
	public function form( $instance ) {
		$defaults = array('herotitle' => '','headerlevel' => 'h3','herosubtitle' => '','buttonurl' => '','buttontext' => 'Click Here', 'target' => 'self');
		$instance = wp_parse_args( (array) $instance, $defaults );
?>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'herotitle' )); ?>"><?php esc_attr_e('Title:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'herotitle' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'herotitle' )); ?>" value="<?php echo esc_attr($instance['herotitle']); ?>" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'headerlevel' )); ?>"><?php esc_attr_e('Header level:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'headerlevel' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'headerlevel' )); ?>">
        <option value="h1" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h1') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 1', 'ombre'); ?></option>
        <option value="h2" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h2') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 2', 'ombre'); ?></option>
        <option value="h3" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h3') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 3', 'ombre'); ?></option>
        <option value="h4" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h4') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 4', 'ombre'); ?></option>
        <option value="h5" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h5') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 5', 'ombre'); ?></option>
        <option value="h6" <?php if (isset($instance['headerlevel'])) { if ($instance['headerlevel'] == 'h6') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Heading 6', 'ombre'); ?></option>
    </select>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'herosubtitle' )); ?>"><?php esc_attr_e('Sub title:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'herosubtitle' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'herosubtitle' )); ?>" value="<?php echo esc_attr($instance['herosubtitle']); ?>" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'buttonurl' )); ?>"><?php esc_attr_e('Destination url:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'buttonurl' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'buttonurl' )); ?>" value="<?php echo esc_attr($instance['buttonurl']); ?>" class="fwtext" />
    <span class="ombrewidgetinfo"><?php esc_attr_e('To enable the button, you should add a link to this field', 'ombre'); ?></span>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'target' )); ?>"><?php esc_attr_e('Button link target:', 'ombre'); ?></label>
    <select class="fwselect" name="<?php echo esc_attr($this->get_field_name( 'target' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'target' )); ?>">
        <option value="self" <?php if (isset($instance['target'])) { if ($instance['target'] == 'self') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Self', 'ombre'); ?></option>
        <option value="blank" <?php if (isset($instance['target'])) { if ($instance['target'] == 'blank') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Blank', 'ombre'); ?></option>
        <option value="parent" <?php if (isset($instance['target'])) { if ($instance['target'] == 'parent') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Parent', 'ombre'); ?></option>
        <option value="top" <?php if (isset($instance['target'])) { if ($instance['target'] == 'top') { echo esc_attr('selected="selected"'); }} ?>><?php esc_attr_e('Top', 'ombre'); ?></option>
    </select>
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'buttontext' )); ?>"><?php esc_attr_e('Button text:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'buttontext' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'buttontext' )); ?>" value="<?php echo esc_attr($instance['buttontext']); ?>" class="fwtext" />
</p>
<?php }} ?>
<?php
/* ----------------------------------------------------------
Latest Posts widget
------------------------------------------------------------- */

add_action( 'widgets_init', 'ombre_latestposts_widget' );

function ombre_latestposts_widget() {
	register_widget( 'ombre_latestpostswidget' );
}

class ombre_latestpostswidget extends WP_Widget {

    function __construct() {
		parent::__construct(
			'ombre-latestposts-widget', // Base ID
			esc_attr__('Ombre Latest Posts', 'ombre'), // Name
			array( 'description' => esc_attr__('Ombre Latest Posts Widget', 'ombre'),'panels_groups' => array('ombre'),'panels_icon' => 'dashicons dashicons-admin-post' ) // Args
		);
	}
	
	public function widget( $args, $instance ) {
		extract( $args );
        $maxposts = $instance['maxposts'];

		echo $args['before_widget'];
		if ( ! empty( $instance['title'] ) ) {
			echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
		}  
        
        $latestposts_query = new WP_Query( 
            array(
                'posts_per_page' => $maxposts,
                'meta_query' => array(
                    array(
                        'key' => '_thumbnail_id',
                        'compare' => 'EXISTS'
                    ),
                ))
        );
?>
<ul class="sidebar-posts">
    <?php while($latestposts_query->have_posts()) : $latestposts_query->the_post(); ?>
    <?php 
$thumb_id = get_post_thumbnail_id();
$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail', true);
$thumb_url = $thumb_url_array[0];
    ?>
    <li>
        <a href="<?php the_permalink(); ?>">
            <div class="sidebar-posts-img">
                <img src="<?php echo esc_url($thumb_url); ?>" alt="<?php the_title(); ?>" />
            </div>
            <p class="sidebar-post-title"><span><?php the_title(); ?></span></p>
            <p class="sidebar-post-date"><?php echo esc_attr(the_time(get_option('date_format'))); ?></p>
        </a>
    </li>
    <?php endwhile; ?>
</ul>
<?php 
        wp_reset_query();
        echo $args['after_widget'];
	}
	 
	public function update( $new_instance, $old_instance ) {
		$instance = array();
		$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
        $instance['maxposts'] = $new_instance['maxposts'];
		return $instance;
	}
	
	public function form( $instance ) {
		$defaults = array( 'title' => '', 'maxposts' => '4');
		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_attr_e('Title:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'maxposts' )); ?>"><?php esc_attr_e('Maximum number of posts:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'maxposts' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'maxposts' )); ?>" value="<?php if (isset($instance['maxposts'])) { echo esc_attr($instance['maxposts']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>
<?php }} ?>
<?php

/* ----------------------------------------------------------
Colorbox Image widget
------------------------------------------------------------- */

add_action( 'widgets_init', 'ombre_clrboximage_widget' );

function ombre_clrboximage_widget() {
	register_widget( 'ombre_clrboximagewidget' );
}

class ombre_clrboximagewidget extends WP_Widget {

    function __construct() {
		parent::__construct(
			'ombre-clrboximage-widget', // Base ID
			esc_attr__('Ombre Colorbox Image', 'ombre'), // Name
			array( 'description' => esc_attr__('Colorbox Image Widget', 'ombre'),'panels_groups' => array('ombre'),'panels_icon' => 'dashicons dashicons-format-gallery' ) // Args
		);
	}
	
	public function widget( $args, $instance ) {
		extract( $args );
        $image = $instance['image'];
        $clrboximage = $instance['clrboximage'];
        $caption = $instance['caption'];
        $marginbottom = $instance['marginbottom'];

		echo $args['before_widget'];
		if ( ! empty( $instance['title'] ) ) {
			echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
		}  
        if ( ! empty( $instance['caption'] ) ) {
            echo do_shortcode('<figure style="margin-bottom:' . esc_attr($marginbottom) . 'px !important;" class="caption-image img-widget"><a class="o-gallery photo enable-colorbox" data-title="' . esc_attr($caption) . '" href="' . esc_url($clrboximage) . '"><img src="' . esc_url($image) . '" alt="' . esc_attr($caption) . '" /></a><figcaption><div>' . esc_attr($caption) . '</div></figcaption></figure>');
        }
        else {
            echo do_shortcode('<figure style="margin-bottom:' . esc_attr($marginbottom) . 'px !important;" class="caption-image img-widget"><a class="o-gallery photo enable-colorbox" data-title="' . esc_attr($caption) . '" href="' . esc_url($clrboximage) . '"><img src="' . esc_url($image) . '" alt="" /></a></figure>');
        }
		
		echo $args['after_widget'];
	}
	 
	public function update( $new_instance, $old_instance ) {
        
		$instance = array();
        $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
        $instance['image'] = $new_instance['image'];
        $instance['clrboximage'] = $new_instance['clrboximage'];
        $instance['caption'] = $new_instance['caption'];
        $instance['marginbottom'] = $new_instance['marginbottom'];

		return $instance;
	}

	
	public function form( $instance ) {
		$defaults = array('title' => '', 'marginbottom' => 0);
		$instance = wp_parse_args( (array) $instance, $defaults );
?>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_attr_e('Title:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'image' )); ?>"><?php esc_attr_e('Image:', 'ombre'); ?></label>   
    <input type="text" name="<?php echo esc_attr($this->get_field_name( 'image' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'image' )); ?>" class="fwtext" value="<?php if (isset($instance['image'])) { echo esc_attr($instance['image']); } ?>" />
    <input id="ombreclrbox" onclick="image_button_click('<?php esc_attr_e( 'Choose Image', 'ombre') ?>','<?php esc_attr_e( 'Select Image', 'ombre') ?>','<?php echo esc_attr($this->get_field_id( 'image' ));  ?>');" class="button" type="button" value="<?php esc_attr_e( 'Upload Image', 'ombre') ?>" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'clrboximage' )); ?>"><?php esc_attr_e('Colorbox image:', 'ombre'); ?></label>   
    <input type="text" name="<?php echo esc_attr($this->get_field_name( 'clrboximage' )); ?>" id="<?php echo esc_attr($this->get_field_id( 'clrboximage' )); ?>" class="fwtext" value="<?php if (isset($instance['clrboximage'])) { echo esc_attr($instance['clrboximage']); } ?>" />
    <input id="ombreclrboximg" onclick="image_button_click('<?php esc_attr_e( 'Choose Image', 'ombre') ?>','<?php esc_attr_e( 'Select Image', 'ombre') ?>','<?php echo esc_attr($this->get_field_id( 'clrboximage' ));  ?>');" class="button" type="button" value="<?php esc_attr_e( 'Upload Image', 'ombre') ?>" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'caption' )); ?>"><?php esc_attr_e('Caption:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'caption' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'caption' )); ?>" value="<?php if (isset($instance['caption'])) { echo esc_attr($instance['caption']); } ?>" type="text" class="fwtext" />
</p>
<p>
    <label for="<?php echo esc_attr($this->get_field_id( 'marginbottom' )); ?>"><?php esc_attr_e('Margin bottom:', 'ombre'); ?></label>
    <input id="<?php echo esc_attr($this->get_field_id( 'marginbottom' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'marginbottom' )); ?>" value="<?php if (isset($instance['marginbottom'])) { echo esc_attr($instance['marginbottom']); } ?>" onkeypress="return validate(event)" type="number" class="fwtext" />
</p>
<?php }} ?>

Youez - 2016 - github.com/yon3zu
LinuXploit