'widget_klasik_events', 'description' => __('KlasikThemes Events','klasik') ); $this->WP_Widget('klasik-events-widget', __('KlasikThemes Events','klasik'), $widget_ops); } /** @see WP_Widget::widget */ function widget($args, $instance) { extract( $args ); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']); $subtitle = apply_filters('widget_subtitle', empty($instance['subtitle']) ? '' : $instance['subtitle']); $category = apply_filters('widget_category', $instance['category']); $cols = apply_filters('widget_cols', empty($instance['cols']) ? '' : $instance['cols']); $showposts = apply_filters('widget_showpost', empty($instance['showpost']) ? '' : $instance['showpost']); $longdesc = apply_filters('widget_longdesc', empty($instance['longdesc']) ? '' : $instance['longdesc']); $customclass = apply_filters('widget_customclass', empty($instance['customclass']) ? '' : $instance['customclass']); $order = apply_filters('widget_order', empty($instance['order']) ? '' : $instance['order']); $onlyfuture = isset($instance['onlyfuture']) ? $instance['onlyfuture'] : false; $show_advanced_option = isset($instance['show_advanced_option']) ? $instance['show_advanced_option'] : false; $layout = apply_filters('widget_layout', empty($instance['layout']) ? '' : $instance['layout']); $spacingtop = apply_filters('widget_spacingtop', empty($instance['spacingtop']) ? '' : $instance['spacingtop']); $spacingbottom = apply_filters('widget_spacingbottom', empty($instance['spacingbottom']) ? '' : $instance['spacingbottom']); $spacingside = apply_filters('widget_spacingside', empty($instance['spacingside']) ? '' : $instance['spacingside']); $border_top = apply_filters('widget_border_top', empty($instance['border_top']) ? '' : $instance['border_top']); $border_bottom = apply_filters('widget_border_bottom', empty($instance['border_bottom']) ? '' : $instance['border_bottom']); $customize_background = isset($instance['customize_background']) ? $instance['customize_background'] : false; $background_image = apply_filters('widget_background_image', empty($instance['background_image']) ? '' : $instance['background_image']); $background_color = apply_filters('widget_background_color', empty($instance['background_color']) ? '' : $instance['background_color']); $background_repeat = apply_filters('widget_background_repeat', empty($instance['background_repeat']) ? '' : $instance['background_repeat']); $background_position = apply_filters('widget_background_position', empty($instance['background_position']) ? '' : $instance['background_position']); $background_attachment = apply_filters('widget_background_attachment', empty($instance['background_attachment']) ? '' : $instance['background_attachment']); $background_size = apply_filters('widget_background_size', empty($instance['background_size']) ? '' : $instance['background_size']); $background_opacity = apply_filters('widget_background_opacity', empty($instance['background_opacity']) ? '' : $instance['background_opacity']); $instance['category'] = esc_attr(isset($instance['category'])? $instance['category'] : ""); global $wp_query; $longdesc = (!is_numeric($longdesc) || empty($longdesc))? 0 : $longdesc; $showposts = (!is_numeric($showposts))? get_option('posts_per_page') : $showposts; $cols = intval($cols); if(!is_numeric($cols) || $cols < 1 || $cols > 6){ $cols = 4; } if ( $customclass ) { $before_widget = str_replace('class="', 'class="'. $customclass . ' ', $before_widget); } echo $before_widget; $spacing_left_right = ''; $spacing_top_bottom = ''; $border = ''; if($show_advanced_option){ if($border_top){ $border .= 'border-top:'.$border_top.'; '; } if($border_bottom){ $border .= 'border-bottom:'.$border_bottom.'; '; } if($spacingtop){ $spacing_top_bottom .= 'padding-top:'.$spacingtop.'; '; } if($spacingbottom){ $spacing_top_bottom .= 'padding-bottom:'.$spacingbottom.'; '; } if($spacingside){ $spacing_left_right .= 'padding-left:'.$spacingside.'; '; $spacing_left_right .= 'padding-right:'.$spacingside.'; '; } } $bgcolor_rgba=''; $bgopacity =''; if($background_opacity != "default" ){ $bgopacity = $background_opacity; } $klasik_color = $background_color; $rgb = klasik_hex2rgba($klasik_color); $rgba = klasik_hex2rgba($klasik_color, $bgopacity); $background=''; if($customize_background){ if($background_color){ $bgcolor_rgba = 'background-color:'.$rgba.'; '; } if($background_image){ $background .= 'background-image:url('.$background_image.'); '; } if($background_repeat != "default"){ $background .= 'background-repeat:'.$background_repeat.'; '; } if($background_position != "default"){ $background .= 'background-position:'.$background_position.'; '; } if($background_attachment != "default"){ $background .= 'background-attachment:'.$background_attachment.'; '; } if($background_size != "default"){ $background .= 'background-size:'.$background_size.'; '; } } $layoutcss=''; if( $layout == 'fullwidth'){$layoutcss = 'fullwidth';} else {$layoutcss = 'boxed';} echo '
'; echo '
'; echo '
'; if( $layout == 'fullwidth'){} else{ echo '
'; } echo '
'; $subtitlewrap =""; if($subtitle){ $subtitlewrap =''.$subtitle.''; } $titleline=''; if ( $title!='' ) echo $before_title . esc_html($title). $subtitlewrap . $titleline . $after_title; $output = ""; $output .='
'; $output .='
'; if($cols==1){ $colclass = "twelve"; }elseif($cols==2){ $colclass = "one_half"; }elseif($cols==3){ $colclass = "one_third"; }elseif($cols==4){ $colclass = "one_fourth"; }elseif($cols==5){ $colclass = "one_fifth"; }elseif($cols==6){ $colclass = "one_sixth"; } if($onlyfuture){ $futures ="future"; }else{ $futures = array( 'publish', 'future' ); } $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $args = array( "post_type" => "post", "ignore_sticky_posts" => true, "post_status" => $futures, "showposts" => $showposts, "order" => $order ); if($category == 0) $category = ""; if( $category!="" ){ $args['tax_query'] = array( array( 'taxonomy' => 'category', 'field' => 'id', 'terms' => $category ) ); } $wp_query->query($args); global $post; $tpl ='
'; $tpl .= '
'; $tpl .= '
%%DAY%%
%%MONTH%
%%YEAR%
'; $tpl .= '
'; $tpl .= '

%%TITLE%%

'; $tpl .= '
%%TEXT%%
'; $tpl .= '
'; $tpl .= '
'; $tpl .= '
'; $tpl .= '
'; $tpl = apply_filters( 'klasik_events_item_template', $tpl ); if ($wp_query->have_posts()) : $x = 0; while ($wp_query->have_posts()) : $wp_query->the_post(); $template = $tpl; $custom = get_post_custom($post->ID); $cf_thumb = get_the_post_thumbnail($post->ID, 'widget-events', array('class' => 'alignleft')); $x++; if($x%$cols==0){ $omega = "omega"; }elseif($x%$cols==1){ $omega = "alpha"; }else{ $omega = ""; } //POSTID $template = str_replace( '%%ID%%', $post->ID, $template ); //postformat $postformat = ''; $postformat .= 'format-'.get_post_format($post->ID); $template = str_replace( '%%FORMAT%%', $postformat, $template ); //POSTCLASS $postclass = 'columns '; $postclass .= $colclass.' '; $postclass .= $omega; $template = str_replace( '%%CLASS%%', $postclass, $template ); //POSTTITLE $posttitle = ''; $posttitle .= get_the_title(); $template = str_replace( '%%TITLE%%', $posttitle, $template ); //TAGS $maintags = ""; $posttags = get_the_tags(); $count=0; if ($posttags) { $maintags .= '
'; foreach($posttags as $tag) { $count++; if (1 == $count) { $maintags .= $tag->name . ' '; } } $maintags .= '
' ; } $template = str_replace( '%%TAG%%', $maintags, $template ); //AllTAGS $alltags = ''; $alltags = get_the_tag_list('
  • ','
  • ','
'); $template = str_replace( '%%ALLTAGS%%', $alltags, $template ); //POSTDATE $postdate = ''; $postdate .= get_the_time( get_option('date_format') ); $template = str_replace( '%%DATE%%', $postdate, $template ); //POSTCATEGORY $categories = get_the_category(); $separator = apply_filters( 'klasik_advancedpost_cat_separator', ', ' ); $atitle = apply_filters( 'klasik_advancedpost_cat_linktitle', __( "View all posts in %s", 'klasik' ) ); $postcat = ''; $i = 0; if($categories){ foreach($categories as $category) { $i++; $postcat .= ''.$category->cat_name.''; if($i != count($categories)){ $postcat .= $separator; } } } $template = str_replace( '%%CATEGORY%%', $postcat, $template ); //POST-DAY $postday = ''; $postday .= get_the_time( 'd' ); $template = str_replace( '%%DAY%%', $postday, $template ); //POST-MONTH $postmonth = ''; $postmonth .= get_the_time('M'); $template = str_replace( '%%MONTH%', $postmonth, $template ); //POST-YEAR $postyear = ''; $postyear .= get_the_time('Y'); $template = str_replace( '%%YEAR%', $postyear, $template ); //POSTLINK $postlink = get_permalink(); $template = str_replace( '%%LINK%%', $postlink, $template ); //POSTAUTHOR $postauthor = get_the_author(); $template = str_replace( '%%AUTHOR%%', $postauthor, $template ); //POSTAUTHORLINK $postauthorlink = get_author_posts_url( get_the_author_meta( 'ID' ) ); $template = str_replace( '%%AUTHORLINK%%', $postauthorlink, $template ); //POSTTHUMB $postthumb = ''; if($cf_thumb){ $postthumb .= '
'.$cf_thumb.'
'; } $template = str_replace( '%%THUMB%%', $postthumb, $template ); //POSTTEXT $posttext = ''; if($longdesc>0){ $excerpt = klasik_string_limit_char(get_the_excerpt(), $longdesc); }else{ $excerpt = get_the_excerpt(); } $posttext .= $excerpt; $template = str_replace( '%%TEXT%%', $posttext, $template ); $output .= $template; endwhile; endif; $wp_query = null; $wp_query = $temp; wp_reset_query(); $output.='
'; $output .='
'; $output.='
'; $output .='
'; echo do_shortcode($output); echo '
'; if( $layout == 'fullwidth'){} else{ echo '
'; } echo '
'; echo '
'; echo '
'; echo $after_widget; } /** @see WP_Widget::update */ function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['subtitle'] = strip_tags($new_instance['subtitle']); $instance['category'] = strip_tags($new_instance['category']); $instance['cols'] = strip_tags($new_instance['cols']); $instance['showpost'] = strip_tags($new_instance['showpost']); $instance['longdesc'] = strip_tags($new_instance['longdesc']); $instance['customclass'] = strip_tags($new_instance['customclass']); $instance['order'] = strip_tags($new_instance['order']); $instance['onlyfuture'] = strip_tags($new_instance['onlyfuture']); $instance['show_advanced_option'] = isset($new_instance['show_advanced_option']) ? $new_instance['show_advanced_option'] : false; $instance['layout'] = strip_tags($new_instance['layout']); $instance['spacingtop'] = strip_tags($new_instance['spacingtop']); $instance['spacingbottom'] = strip_tags($new_instance['spacingbottom']); $instance['spacingside'] = strip_tags($new_instance['spacingside']); $instance['border_top'] = strip_tags($new_instance['border_top']); $instance['border_bottom'] = strip_tags($new_instance['border_bottom']); $instance['customize_background'] = isset($new_instance['customize_background']) ? $new_instance['customize_background'] : false; $instance['background_image'] = esc_url($new_instance['background_image']); $instance['background_color'] = strip_tags($new_instance['background_color']); $instance['background_repeat'] = strip_tags($new_instance['background_repeat']); $instance['background_position'] = strip_tags($new_instance['background_position']); $instance['background_attachment'] = strip_tags($new_instance['background_attachment']); $instance['background_size'] = strip_tags($new_instance['background_size']); $instance['background_opacity'] = strip_tags($new_instance['background_opacity']); return $instance; } /** @see WP_Widget::form */ function form($instance) { $instance['title'] = (isset($instance['title']))? $instance['title'] : ""; $instance['subtitle'] = (isset($instance['subtitle']))? $instance['subtitle'] : ""; $instance['category'] = (isset($instance['category']))? $instance['category'] : ""; $instance['cols'] = (isset($instance['cols']))? $instance['cols'] : ""; $instance['showpost'] = (isset($instance['showpost']))? $instance['showpost'] : ""; $instance['longdesc'] = (isset($instance['longdesc']))? $instance['longdesc'] : ""; $instance['customclass'] = (isset($instance['customclass']))? $instance['customclass'] : ""; $instance['order'] = (isset($instance['order']))? $instance['order'] : ""; $instance['onlyfuture'] = (isset($instance['onlyfuture']))? $instance['onlyfuture'] : ""; $show_advanced_option = isset($instance['show_advanced_option']) ? esc_attr($instance['show_advanced_option']) : ""; $instance['layout'] = (isset($instance['layout']))? $instance['layout'] : ""; $instance['spacingtop'] = (isset($instance['spacingtop']))? $instance['spacingtop'] : ""; $instance['spacingbottom'] = (isset($instance['spacingbottom']))? $instance['spacingbottom'] : ""; $instance['spacingside'] = (isset($instance['spacingside']))? $instance['spacingside'] : ""; $instance['border_top'] = (isset($instance['border_top']))? $instance['border_top'] : ""; $instance['border_bottom'] = (isset($instance['border_bottom']))? $instance['border_bottom'] : ""; $customize_background = isset($instance['customize_background']) ? esc_attr($instance['customize_background']) : ""; $instance['background_image'] = (isset($instance['background_image']))? $instance['background_image'] : ""; $instance['background_color'] = (isset($instance['background_color']))? $instance['background_color'] : ""; $instance['background_repeat'] = (isset($instance['background_repeat']))? $instance['background_repeat'] : ""; $instance['background_position'] = (isset($instance['background_position']))? $instance['background_position'] : ""; $instance['background_attachment'] = (isset($instance['background_attachment']))? $instance['background_attachment'] : ""; $instance['background_size'] = (isset($instance['background_size']))? $instance['background_size'] : ""; $instance['background_opacity'] = (isset($instance['background_opacity']))? $instance['background_opacity'] : ""; $title = esc_attr($instance['title']); $subtitle = esc_attr($instance['subtitle']); $category = esc_attr($instance['category']); $cols = esc_attr($instance['cols']); $longdesc = esc_attr($instance['longdesc']); $customclass = esc_attr($instance['customclass']); $showpost = esc_attr($instance['showpost']); $order = esc_attr($instance['order']); $onlyfuture = esc_attr($instance['onlyfuture']); $layout = esc_attr($instance['layout']); $spacingtop = esc_attr($instance['spacingtop']); $spacingbottom = esc_attr($instance['spacingbottom']); $spacingside = esc_attr($instance['spacingside']); $border_top = esc_attr($instance['border_top']); $border_bottom = esc_attr($instance['border_bottom']); $background_image = esc_attr($instance['background_image']); $background_color = esc_attr($instance['background_color']); $background_repeat = esc_attr($instance['background_repeat']); $background_position = esc_attr($instance['background_position']); $background_attachment = esc_attr($instance['background_attachment']); $background_size = esc_attr($instance['background_size']); $background_opacity = esc_attr($instance['background_opacity']); ?>


/>

onchange="showAdvancedOps(this)"/>

class="hidden_options">


class="hidden_options">

onchange="showFeaturedImageOps(this)"/>

class="hidden_options">







__( 'Default', 'klasik' ), 'repeat' => __( 'Repeat', 'klasik' ), 'repeat-x' => __( 'Repeat Horizontal', 'klasik' ), 'repeat-y' => __( 'Repeat Vertical', 'klasik' ), 'no-repeat' => __( 'No Repeat', 'klasik' ) ); } // End get_bg_repeat_options() protected function get_bg_position_options (){ return array( 'default' => __( 'Default', 'klasik' ), 'left' => __( 'Left', 'klasik' ), 'center' => __( 'Center', 'klasik' ), 'right' => __( 'Right', 'klasik' ), 'top left' => __( 'Top', 'klasik' ), 'top center' => __( 'Top Center', 'klasik' ), 'top right' => __( 'Top Right', 'klasik' ), 'bottom left' => __( 'Bottom', 'klasik' ), 'bottom center' => __( 'Bottom Center', 'klasik' ), 'bottom right' => __( 'Bottom Right', 'klasik' ) ); } // End get_bg_position_options() protected function get_bg_attachment_options () { return array( 'default' => __( 'Default', 'klasik' ), 'scroll' => __( 'scroll', 'klasik' ), 'fixed' => __( 'fixed', 'klasik' ) ); } // End get_bg_attachment_options() protected function get_bg_size_options () { return array( 'default' => __( 'Default', 'klasik' ), 'auto' => __( 'auto', 'klasik' ), 'cover' => __( 'cover', 'klasik' ), 'contain' => __( 'contain', 'klasik' ) ); } // End get_bg_attachment_options() protected function get_bg_opacity_options () { return array( 'default' => __( 'Default', 'klasik' ), '0.1' => __( '10%', 'klasik' ), '0.2' => __( '20%', 'klasik' ), '0.3' => __( '30%', 'klasik' ), '0.4' => __( '40%', 'klasik' ), '0.5' => __( '50%', 'klasik' ), '0.6' => __( '60%', 'klasik' ), '0.7' => __( '70%', 'klasik' ), '0.8' => __( '80%', 'klasik' ), '0.9' => __( '90%', 'klasik' ), '1' => __( '100%', 'klasik' ) ); } // End get_bg_opacity_options() protected function get_layout_options () { return array( 'boxed' => __( 'Boxed', 'klasik' ), 'fullwidth' => __( 'Full Width', 'klasik' ) ); } // End get_layout_options() protected function get_number_options () { return array( '1' => __( '1 Column', 'klasik' ), '2' => __( '2 Column', 'klasik' ), '3' => __( '3 Column', 'klasik' ), '4' => __( '4 Column', 'klasik' ), '5' => __( '5 Column', 'klasik' ), '6' => __( '6 Column', 'klasik' ) ); } // End get_number_options() protected function get_order_options () { return array( 'DESC' => __( 'Descending', 'klasik' ), 'ASC' => __( 'Ascending', 'klasik' ) ); } // End get_order_options() } // class Widget