et_locked_attributes( $atts, $this, $shortcodename, $default, $locked, $content );
Avia_Element_Templates()->add_template_class( $meta, $atts, $default );
$meta = aviaShortcodeTemplate::set_frontend_developer_heading_tag( $atts, $meta );
if( isset( $atts['img_scrset'] ) && 'disabled' == $atts['img_scrset'] )
{
Av_Responsive_Images()->force_disable( 'disabled' );
}
$atts['class'] = $meta['el_class'];
$atts['custom_markup'] = $meta['custom_markup'];
$atts['custom_el_id'] = ! empty( $meta['custom_el_id'] ) ? $meta['custom_el_id'] : '';
$atts['heading_tag'] = ! empty( $meta['heading_tag'] ) ? $meta['heading_tag'] : '';
$atts['heading_class'] = ! empty( $meta['heading_class'] ) ? $meta['heading_class'] : '';
$mag = new avia_magazine( $atts );
$mag->query_entries();
$html = $mag->html();
Av_Responsive_Images()->force_disable( 'reset' );
return $html;
}
}
}
if( ! class_exists( 'avia_magazine' ) )
{
class avia_magazine
{
/**
* @since < 4.0
* @var int
*/
static protected $magazine = 0;
/**
* @since < 4.0
* @var array
*/
protected $atts;
/**
* @since < 4.0
* @var WP_Query
*/
protected $entries;
/**
* @since < 4.5.6
* @var array
*/
protected $screen_options;
/**
*
* @since 4.7.6.4
* @var int
*/
protected $current_page;
/**
* @since < 4.0
* @param array $atts
*/
public function __construct( $atts = array() )
{
$this->atts = shortcode_atts( avia_magazine::get_defaults(), $atts, 'av_magazine' );
// @since 4.8.6.3
if( 'no scaling' == $this->atts['image_big'] )
{
$this->atts['image_big'] = 'full';
}
if( ! empty( $this->atts['image_big'] ) )
{
$this->atts['image_size']['big'] = $this->atts['image_big'];
}
$this->entries = null;
$this->screen_options = AviaHelper::av_mobile_sizes( $atts );
$this->current_page = 1;
self::$magazine++;
/**
* When pagination, tabs are not possible
*/
if( ! empty( $this->atts['paginate'] ) )
{
$this->atts['tabs'] = false;
$this->atts['offset'] = 0;
}
// fetch the taxonomy and the taxonomy ids
$this->extract_terms();
//convert checkbox to true/false
$this->atts['tabs'] = $this->atts['tabs'] === 'aviaTBtabs' ? true : false;
$this->atts['thumbnails'] = $this->atts['thumbnails'] === 'aviaTBthumbnails' ? true : false;
//filter the attributes
$this->atts = apply_filters( 'avf_magazine_settings', $this->atts, self::$magazine );
//set small or big
if( empty( $this->atts['first_big'] ) )
{
$this->atts['first_big_pos'] = '';
}
//set heading text
if( empty( $this->atts['heading_active'] ) )
{
$this->atts['heading'] = '';
}
//set if top bar is active
$this->atts['top_bar'] = ! empty( $this->atts['heading'] ) || ! empty( $this->atts['tabs'] ) ? 'av-magazine-top-bar-active' : '';
}
/**
*
* @since 4.5.6
*/
public function __destruct()
{
unset( $this->screen_options );
unset( $this->atts );
unset( $this->entries );
}
/**
* Returns the defaults array for this class
*
* @since 4.8
* @return array
*/
static public function get_defaults()
{
$default = array(
'class' => '',
'custom_markup' => '',
'items' => '16',
'paginate' => '',
'tabs' => false,
'thumbnails' => true,
'meta_author' => false,
'meta_cats' => false,
'meta_tags' => false,
'heading_active' => false,
'heading' => '',
'heading_link' => '',
'heading_color' => '',
'heading_custom_color' => '',
'first_big' => false,
'first_big_pos' => 'top',
'taxonomy' => 'category',
'link' => '',
'categories' => array(),
'extra_categories' => array(),
'post_type' => array(),
'offset' => 0,
'image_size' => array( 'small' => 'thumbnail', 'big' => 'magazine' ),
'image_big' => 'magazine',
'date_filter' => '',
'date_filter_start' => '',
'date_filter_end' => '',
'date_filter_format' => 'yy/mm/dd', // 'yy/mm/dd' | 'dd-mm-yy' | yyyymmdd
'period_filter_unit_1' => '',
'period_filter_unit_2' => '',
'custom_el_id' => '',
'heading_tag' => '',
'heading_class' => '',
'lazy_loading' => 'enabled',
'img_scrset' => ''
);
return $default;
}
/**
*
* @since < 4.0
*/
protected function extract_terms()
{
if( isset($this->atts['link'] ) )
{
$this->atts['link'] = explode( ',', $this->atts['link'], 2 );
$this->atts['taxonomy'] = $this->atts['link'][0];
if( isset( $this->atts['link'][1] ) )
{
$this->atts['categories'] = $this->atts['link'][1];
}
else
{
$this->atts['categories'] = array();
}
}
}
/**
*
* @since < 4.0
* @return string
*/
protected function sort_buttons()
{
$term_args = array(
'taxonomy' => $this->atts['taxonomy'],
'hide_empty' => true
);
/**
* To display private posts you need to set 'hide_empty' to false,
* otherwise a category with ONLY private posts will not be returned !!
*
* You also need to add post_status 'private' to the query params with filter avf_magazine_entries_query.
*
* @since 4.4.2
* @added_by Günter
* @param array $term_args
* @param string $context
* @return array
*/
$term_args = apply_filters( 'avf_av_magazine_term_args', $term_args, 'sort_button' );
$sort_terms = AviaHelper::get_terms( $term_args );
$current_page_terms = array();
$term_count = array();
$display_terms = is_array( $this->atts['categories'] ) ? $this->atts['categories'] : array_filter( explode( ',', $this->atts['categories'] ) );
$output = '
';
$first_item_name = apply_filters( 'avf_magazine_sort_first_label', __( 'All', 'avia_framework' ), $this->atts );
$output .= '
';
if( count( $this->atts['extra_categories'] ) <= 1 )
{
return '';
}
return $output;
}
/**
* Fetch new entries
*
* @since < 4.0
* @param array $params
* @param boolean $return
* @return WP_Query
*/
public function query_entries( $params = array(), $return = false )
{
global $avia_config;
if( empty( $params ) )
{
$params = $this->atts;
}
if( empty( $params['custom_query'] ) )
{
$query = array();
if( ! empty( $params['categories'] ) )
{
//get the portfolio categories
$terms = explode( ',', $params['categories'] );
}
$this->current_page = ( $params['paginate'] != '' ) ? avia_get_current_pagination_number( 'avia-element-paging' ) : 1;
//if we find no terms for the taxonomy fetch all taxonomy terms
if( empty( $terms[0] ) || is_null( $terms[0] ) || $terms[0] == 'null' )
{
$term_args = array(
'taxonomy' => $params['taxonomy'],
'hide_empty' => true
);
/**
* To display private posts you need to set 'hide_empty' to false,
* otherwise a category with ONLY private posts will not be returned !!
*
* You also need to add post_status 'private' to the query params with filter avf_magazine_entries_query.
*
* @since 4.4.2
* @added_by Günter
* @param array $term_args
* @param string $context
* @return array
*/
$term_args = apply_filters( 'avf_av_magazine_term_args', $term_args, 'query_entries' );
$allTax = AviaHelper::get_terms( $term_args );
$terms = array();
foreach( $allTax as $tax )
{
$terms[] = $tax->term_id;
}
}
if( $params['offset'] == 'no_duplicates' )
{
$params['offset'] = 0;
if( empty($params['ignore_duplicate_rule'] ) )
{
$no_duplicates = true;
}
}
if( empty( $params['post_type'] ) )
{
$params['post_type'] = get_post_types();
}
if( is_string( $params['post_type'] ) )
{
$params['post_type'] = explode( ',', $params['post_type'] );
}
$date_query = AviaHelper::date_query( array(), $params );
$query = array(
'orderby' => 'date',
'order' => 'DESC',
'paged' => $this->current_page,
'post_type' => $params['post_type'],
'post__not_in' => ( ! empty($no_duplicates ) ) ? $avia_config['posts_on_current_page'] : array(),
'offset' => $params['offset'] != 0 ? $params['offset'] : false,
'posts_per_page' => $params['items'],
'date_query' => $date_query,
'tax_query' => array( array(
'taxonomy' => $params['taxonomy'],
'field' => 'id',
'terms' => $terms,
'operator' => 'IN'
)
)
);
}
else
{
$query = $params['custom_query'];
}
/**
*
* @since < 4.0
* @param array $query
* @param array $params
* @return array
*/
$query = apply_filters( 'avf_magazine_entries_query', $query, $params );
$entries = new WP_Query( $query );
if( ( $entries->post_count > 0 ) && empty( $params['ignore_duplicate_rule'] ) )
{
foreach( $entries->posts as $entry )
{
$avia_config['posts_on_current_page'][] = $entry->ID;
}
}
if( $return )
{
return $entries;
}
else
{
$this->entries = $entries;
}
}
/**
*
* @since < 4.0
* @return string
*/
public function html()
{
if( empty( $this->entries->posts ) )
{
return '';
}
$output = '';
$class = ! empty( $this->atts['first_big_pos'] ) ? ' av-magazine-hero-' . $this->atts['first_big_pos'] : '';
$class .= ' ' . $this->atts['top_bar'];
if( ! empty( $this->atts['tabs'] ) )
{
$class .= ' av-magazine-tabs-active';
}
extract( $this->screen_options ); //return $av_font_classes, $av_title_font_classes and $av_display_classes
$id = ! empty( $this->atts['custom_el_id'] ) ? $this->atts['custom_el_id'] : ' id="' . self::$magazine . '" ';
$output .= "";
if( $this->atts['top_bar'] )
{
$link = AviaHelper::get_url( $this->atts['heading_link'] );
$heading = $this->atts['heading'];
$b_class = '';
$b_style = '';
if( $this->atts['heading_color'] != 'theme-color' )
{
if( $this->atts['heading_color'] == 'custom' )
{
$b_style = "style='color: ".$this->atts['heading_custom_color'].";'";
}
$b_class .= "avia-font-color-{$this->atts['heading_color']} avia-inherit-font-color";
}
$output .= "
";
if( $heading )
{
$heading_tag = ( ! in_array( $this->atts['heading_tag'], array( '', 'a' ) ) ) ? $this->atts['heading_tag'] : '';
$heading_class = $this->atts['heading_class'];
if( ! empty( $heading_tag ) )
{
$output .= "<{$heading_tag} class='{$heading_class}'>";
$heading_class = '';
}
$output .= "
{$heading}";
if( ! empty( $heading_tag ) )
{
$output .= "{$heading_tag}>";
$heading_class = '';
}
}
if(!empty($this->atts['tabs']))
{
$output .= $this->sort_buttons();
}
$output .= '
';
}
//magazine main loop
$output .= $this->magazine_loop( $this->entries->posts );
//magazine sub loops
$output .= $this->magazine_sub_loop();
//append pagination
if( $this->atts['paginate'] == 'pagination' && $avia_pagination = avia_pagination( $this->entries->max_num_pages, 'nav', 'avia-element-paging', $this->current_page ) )
{
$output .= "";
}
$output .= '
';
return $output;
}
/**
*
* @since < 4.0
* @return string
*/
protected function magazine_sub_loop()
{
$output = '';
if( ! empty( $this->atts['extra_categories'] ) && count( $this->atts['extra_categories'] ) > 1 )
{
foreach( $this->atts['extra_categories'] as $category )
{
$params = $this->atts;
$params['ignore_duplicate_rule'] = true;
$params['categories'] = $category;
$params['sort_var'] = $category;
$entries = $this->query_entries( $params, true );
$output .= $this->magazine_loop( $entries->posts, $params );
}
}
return $output;
}
/**
*
* @since < 4.0
* @param array $entries WP_Post objects
* @param array $params
* @return string
*/
protected function magazine_loop( array $entries, $params = array() )
{
$output = '';
$loop = 0;
$grid = $this->atts['first_big_pos'] == 'left' ? 'flex_column av_one_half ' : '';
$html = ! empty( $this->atts['first_big_pos'] ) ? array( 'before' => "", 'after' => '
' ) : array( 'before' => '', 'after' => '' );
$css = empty( $params['sort_var'] ) ? 'sort_all' : 'av-hidden-mag sort_' . $params['sort_var'];
if( ! empty( $entries ) )
{
$output .= "";
foreach( $entries as $entry )
{
$loop ++;
$entry->loop = $loop;
$style = ( $loop == 1 && ! empty( $this->atts['first_big'] ) ) ? 'big' : 'small';
if( $loop == 2 && ! empty( $html['before'] ) )
{
$html = array( 'before' => "
" , 'after' => '' );
}
if( $loop == 3 )
{
$html = array( 'before' => '', 'after' => '' );
}
$output .= $html['before'];
$output .= $this->render_entry( $entry, $style );
$output .= $html['after'];
}
if( $loop != 1 && ! empty( $this->atts['first_big_pos'] ) )
{
$output .= '
';
}
$output .= '
';
}
else
{
// output empty container - otherwise frontend sort breaks
$output .= "";
}
return $output;
}
/**
*
* @since < 4.0
* @param WP_Post $entry
* @param string $style
* @return string
*/
protected function render_entry( WP_Post $entry, $style )
{
$output = '';
$post_thumbnail_id = get_post_thumbnail_id( $entry->ID );
if( $this->atts['lazy_loading'] != 'enabled' )
{
Av_Responsive_Images()->add_attachment_id_to_not_lazy_loading( $post_thumbnail_id );
}
$image = get_the_post_thumbnail( $entry->ID, $this->atts['image_size'][ $style ] );
$link = get_permalink( $entry->ID );
$titleAttr = the_title_attribute( array( 'echo' => false, 'post' => $entry->ID ) );
/**
* Allow post-format link same behaviour as on single post
*
* @since 4.7.3
*/
if( get_post_meta( $entry->ID , '_portfolio_custom_link', true ) != '' )
{
$link = get_post_meta( $entry->ID ,'_portfolio_custom_link_url', true );
}
else
{
$post_format = get_post_format( $entry );
if( ( $post_format == 'link' ) && function_exists( 'avia_link_content_filter' ) )
{
$post['title'] = $entry->post_title;
$post['content'] = $entry->post_content;
$post = avia_link_content_filter( $post );
if( ! empty( $post['url'] ) )
{
$link = $post['url'];
}
}
}
$titleAttr = "title='" . __( 'Link to:', 'avia_framework' ) . " {$titleAttr}'";
$title = "". apply_filters( 'avf_magazine_title', get_the_title( $entry->ID ), $entry ) . '';
$excerpt = '';
$time = get_the_time( get_option('date_format'), $entry->ID );
$separator = '';
$default_heading = 'h3';
$args = array(
'heading' => $default_heading,
'extra_class' => ''
);
$extra_args = array( $this, $entry, $style );
/**
* @since 4.5.7.1
* @return array
*/
$args = apply_filters( 'avf_customize_heading_settings', $args, __CLASS__, $extra_args );
$titleTag = ! empty( $args['heading'] ) ? $args['heading'] : $default_heading;
$titleCss = ! empty( $args['extra_class'] ) ? $args['extra_class'] : '';
$author = '';
if( ! empty( $this->atts['meta_author'] ) )
{
$author_link = get_author_posts_url( $entry->post_author );
$author_name = apply_filters( 'avf_author_name', get_the_author_meta( 'display_name', $entry->post_author ), $entry->post_author );
$author_link = '' . $author_name . '';
$author_output = '' . __( 'by', 'avia_framework' ) . ' ';
$author_output .= ' 'author_name', 'echo' => false ) ) . '>';
$author_output .= "";
$author_output .= $author_link;
$author_output .= '';
$author_output .= '';
$author_output .= '';
$author .= '';
$author .= '/';
$author .= $author_output;
$author .= '';
}
$cats = '';
if( ! empty( $this->atts['meta_cats'] ) )
{
$taxonomies = get_object_taxonomies( $entry->post_type );
$excluded_taxonomies = array_merge( get_taxonomies( array( 'public' => false ) ), array( 'post_tag', 'post_format' ) );
/**
* @since 4.5.7.1
* @param array
* @param string $entry->post_type
* @param int $entry->ID
* @return array
*/
$excluded_taxonomies = apply_filters( 'avf_exclude_taxonomies_magazine', $excluded_taxonomies, $entry->post_type, $entry->ID );
if( ! empty( $taxonomies ) )
{
foreach( $taxonomies as $taxonomy )
{
if( ! in_array( $taxonomy, $excluded_taxonomies ) )
{
$cats .= get_the_term_list( $entry->ID, $taxonomy, '', ', ','') . ' ';
}
}
}
if( ! empty( $cats ) )
{
$cats_html = '';
$cats_html .= 'In';
$cats_html .= '';
$cats_html .= $cats;
$cats_html .= '';
$cats_html .= '';
$cats = $cats_html;
}
}
$tags = '';
if( ! empty( $this->atts['meta_tags'] ) )
{
$tag_list = get_the_term_list( $entry->ID, 'post_tag', '' . __( 'Tags:', 'avia_framework' ) . '', ', ', '' );
if( ! empty( $tag_list ) )
{
$tags_html = '';
$tags_html .= $tag_list;
$tags_html .= '';
$tags = $tags_html;
}
}
$markupEntry = avia_markup_helper( array( 'context' => 'entry', 'echo' => false, 'id' => $entry->ID, 'custom_markup' => $this->atts['custom_markup'] ) );
$markupTitle = avia_markup_helper( array( 'context' => 'entry_title', 'echo' => false, 'id' => $entry->ID, 'custom_markup' => $this->atts['custom_markup'] ) );
$markupContent = avia_markup_helper( array( 'context' => 'entry_content', 'echo' => false, 'id' => $entry->ID, 'custom_markup' => $this->atts['custom_markup'] ) );
$markupTime = avia_markup_helper( array( 'context' => 'entry_time', 'echo' => false, 'id' => $entry->ID, 'custom_markup' => $this->atts['custom_markup'] ) );
$format = get_post_format( $entry->ID ) ? get_post_format( $entry->ID ) : 'standard';
$type = get_post_type( $entry->ID );
$icontype = $type == 'post' ? $format : $type;
$icon = "';
$extraClass = '';
if( $style == 'small' )
{
if( empty( $this->atts['thumbnails'] ) )
{
$image = '';
$extraClass = 'av-magazine-no-thumb';
}
}
else
{
$excerpt = ! empty( $entry->post_excerpt ) ? $entry->post_excerpt : avia_backend_truncate( $entry->post_content, apply_filters( 'avf_magazine_excerpt_length', 60 ), apply_filters( 'avf_magazine_excerpt_delimiter', ' ' ), '…', true, '' );
}
$output .= "';
return $output;
}
}
}
{"id":9038,"date":"2024-03-13T03:01:22","date_gmt":"2024-03-13T03:01:22","guid":{"rendered":""},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T23:00:00","slug":"kansspelautoriteit-nieuws","status":"publish","type":"post","link":"https:\/\/www.collotzienenbeleven.nl\/kansspelautoriteit-nieuws\/","title":{"rendered":"Kansspelautoriteit Nieuws"},"content":{"rendered":"