Example #1
0
 function avia_slideshow($post_id = false, $showcaption = true)
 {
     global $avia_config;
     ///if no id was passed get it
     if (!$post_id) {
         $post_id = avia_get_the_ID();
     }
     if (!$post_id) {
         return false;
     }
     $this->defaultSlider = 'fade_slider';
     $this->post_id = $post_id;
     $this->slides = avia_post_meta($this->post_id, 'slideshow');
     $this->type = avia_post_meta($this->post_id, '_slideshow_type');
     $this->autoplay = avia_post_meta($this->post_id, '_slideshow_autoplay');
     if ($this->autoplay == "true") {
         $this->duration = avia_post_meta($this->post_id, '_slideshow_duration');
     }
     $this->showcaption = $showcaption;
     $this->slidecount = $this->slidecount_calc();
     if (!$this->type) {
         $this->type = $this->defaultSlider;
     }
     $this->show_thumbnails = false;
     $this->img_size = "featured";
     $this->link_overwrite = false;
     /*create default settings based on the slideshow selected*/
     switch ($this->type) {
         case 'aviaslider':
             wp_enqueue_script('avia-slider');
             $this->img_size = "aviacordion";
             $this->show_thumbnails = true;
             break;
         case 'fade_slider':
             break;
         case 'piecemaker':
             break;
         case 'caption_slider':
             break;
         case 'aviacordion':
             wp_enqueue_script('aviacordion');
             $this->img_size = "aviacordion";
             $this->slideshowSize = " style='height: " . $avia_config['imgSize']['aviacordion']['height'];
             $this->slideshowSize .= "px; width: " . $avia_config['imgSize']['featured']['width'] . "px;'";
             break;
     }
 }
 /**
  * Fetches a url based on values set in the backend
  * @param array $option_array array that at least needs to contain the linking method and depending on that, the appropriate 2nd id value
  * @param string $keyprefix option set key that must be in front of every element key
  * @param string $inside if inside is passed it will be wrapped inside <a> tags with the href set to the previously returned link url
  * @param string $post_id if the function is called outside of the loop we might want to retrieve the permalink of a different post with this id
  * @return string url (with image inside <a> tag if the image string was passed)
  */
 function avia_get_link($option_array, $keyprefix, $inside = false, $post_id = false, $attr = "")
 {
     if (empty($option_array[$keyprefix . 'link'])) {
         $option_array[$keyprefix . 'link'] = "";
     }
     //check which value the link array has (possible are empty, lightbox, page, post, cat, url) and create the according link
     switch ($option_array[$keyprefix . 'link']) {
         case "lightbox":
             $url = avia_image_by_id($option_array[$keyprefix . 'image'], array('width' => 8000, 'height' => 8000), 'url');
             break;
         case "cat":
             $url = get_category_link($option_array[$keyprefix . 'link_cat']);
             break;
         case "page":
             $url = get_page_link($option_array[$keyprefix . 'link_page']);
             break;
         case "self":
             if (!is_singular() || $post_id != avia_get_the_ID() || !isset($option_array[$keyprefix . 'image'])) {
                 $url = get_permalink($post_id);
             } else {
                 $url = avia_image_by_id($option_array[$keyprefix . 'image'], array('width' => 8000, 'height' => 8000), 'url');
             }
             break;
         case "url":
             $url = $option_array[$keyprefix . 'link_url'];
             break;
         case "video":
             $video_url = $option_array[$keyprefix . 'link_video'];
             if (avia_backend_is_file($video_url, 'html5video')) {
                 $output = avia_html5_video_embed($video_url);
                 $class = "html5video";
             } else {
                 global $wp_embed;
                 $output = $wp_embed->run_shortcode("[embed]" . $video_url . "[/embed]");
                 $class = "embeded_video";
             }
             $output = "<div class='slideshow_video {$class}'>" . $output . "</div>";
             return $inside . $output;
             break;
         default:
             $url = $inside;
             break;
     }
     if (!$inside || $url == $inside) {
         return $url;
     } else {
         return "<a {$attr} href='" . $url . "'>" . $inside . "</a>";
     }
 }
Example #3
0
function avia_woocommerce_sidebar_filter($menu)
{
    $id = avia_get_the_ID();
    if (is_cart() || is_checkout() || get_option('woocommerce_thanks_page_id') == $id) {
        $menu = "";
    }
    return $menu;
}
 function avia_backend_admin_bar_menu()
 {
     if (!current_user_can('manage_options')) {
         return;
     }
     global $avia, $wp_admin_bar;
     $real_id = is_admin() ? false : avia_get_the_ID();
     //home edit button for frontpage
     if (is_front_page()) {
         $front_id = avia_get_option('frontpage');
         $parent = "";
         if ($front_id && $real_id == $front_id) {
             $menu = array('id' => 'edit', 'title' => __('Edit Frontpage', 'avia_framework'), 'href' => admin_url('post.php?post=' . $real_id . '&action=edit'), 'meta' => array('target' => 'blank'));
             $wp_admin_bar->add_menu($menu);
         }
     }
     //dynamic tempalte edit for current entry, in case a dynamic tempalte is applied
     if ($real_id && ($template = avia_is_dynamic_template())) {
         $safeSlug = avia_backend_safe_string($template);
         $menu = array('id' => 'avia_edit', 'title' => __('Edit this entry', 'avia_framework'), 'href' => admin_url('post.php?post=' . $real_id . '&action=edit'), 'meta' => array('target' => 'blank'), 'parent' => 'edit');
         $wp_admin_bar->add_menu($menu);
         $menu = array('id' => 'avia_edit_dynamic', 'title' => __('Edit Dynamic Template of this entry', 'avia_framework'), 'href' => admin_url("admin.php?page=templates#goto_" . $safeSlug), 'meta' => array('target' => 'blank'), 'parent' => 'edit');
         $wp_admin_bar->add_menu($menu);
     }
     // add all option pages
     if (empty($avia->option_pages)) {
         return;
     }
     $urlBase = admin_url('admin.php');
     foreach ($avia->option_pages as $avia_page) {
         $safeSlug = avia_backend_safe_string($avia_page['title']);
         $menu = array('id' => $avia_page['slug'], 'title' => strip_tags($avia_page['title']), 'href' => $urlBase . "?page=" . $avia_page['slug'], 'meta' => array('target' => 'blank'));
         if ($avia_page['slug'] != $avia_page['parent']) {
             $menu['parent'] = $avia_page['parent'];
             $menu['href'] = $urlBase . "?page=" . $avia_page['parent'] . "#goto_" . $avia_page['slug'];
         }
         if (is_admin()) {
             $menu['meta'] = array('onclick' => 'self.location.replace(encodeURI("' . $menu['href'] . '")); window.location.reload(true);  ');
         }
         $wp_admin_bar->add_menu($menu);
     }
 }
 function avia_set_layout_array($post_type = false, $post_id = false)
 {
     global $avia_config;
     //check which string to use
     $result = false;
     $layout = 'blog_layout';
     if (empty($post_id)) {
         $post_id = avia_get_the_ID();
     }
     if (is_page() || is_search() || is_404() || is_attachment()) {
         $layout = 'page_layout';
     }
     if (is_archive()) {
         $layout = 'archive_layout';
     }
     if (is_single()) {
         $layout = 'single_layout';
     }
     //on a single page check if the layout is overwritten
     if (is_singular()) {
         $result = get_post_meta($post_id, 'layout', true);
     }
     //if we got no result from the previous get_pst_meta query or we are not on a single post get the setting defined on the option page
     if (!$result) {
         $result = avia_get_option($layout);
     }
     //if we stil got no result, probably because no option page was saved
     if (!$result) {
         $result = 'sidebar_right';
     }
     if ($result) {
         $avia_config['layout']['current'] = $avia_config['layout'][$result];
         $avia_config['layout']['current']['main'] = $result;
     }
     $avia_config['layout'] = apply_filters('avia_layout_filter', $avia_config['layout'], $post_id);
 }
Example #6
0
 /**
  * This function creates the html code necessary for a dynamic heading line. 
  *
  * @param array $element is an array with all the data necessary for creating the html code (it contains the element data and the saved values for the element)
  * @return string $output the string returned contains the html code generated within the method
  */
 function heading($element)
 {
     if (!isset($element['saved_value'][0])) {
         return;
     }
     extract($element['saved_value'][0]);
     $output = $titleClass = "";
     switch ($dynamic_heading_type) {
         case 'self':
             $heading = get_the_title(avia_get_the_ID());
             break;
         case 'custom':
             $heading = $dynamic_heading_custom;
             break;
     }
     if ($heading) {
         $output .= "<div class='title_container {$titleClass}'>";
         if ($dynamic_heading_bc == 'yes' && !is_front_page()) {
             $output .= avia_breadcrumbs();
         }
         $output .= "<h1>" . $heading . "</h1>";
         if ($dynamic_heading_custom_sub) {
             $output .= wpautop($dynamic_heading_custom_sub);
         }
         $output .= "</div>";
     }
     return $output;
 }
Example #7
0
<?php

global $avia_config, $post_loop_count;
if (empty($post_loop_count)) {
    $post_loop_count = 1;
}
$blog_style = !empty($avia_config['blog_style']) ? $avia_config['blog_style'] : avia_get_option('blog_style', 'multi-big');
if (is_single()) {
    $blog_style = avia_get_option('single_post_style', 'single-big');
}
$blog_global_style = avia_get_option('blog_global_style', '');
//alt: elegant-blog
$initial_id = avia_get_the_ID();
// check if we got posts to display:
if (have_posts()) {
    while (have_posts()) {
        the_post();
        /*
         * get the current post id, the current post class and current post format
         */
        $url = "";
        $current_post = array();
        $current_post['post_loop_count'] = $post_loop_count;
        $current_post['the_id'] = get_the_ID();
        $current_post['parity'] = $post_loop_count % 2 ? 'odd' : 'even';
        $current_post['last'] = count($wp_query->posts) == $post_loop_count ? " post-entry-last " : "";
        $current_post['post_type'] = get_post_type($current_post['the_id']);
        $current_post['post_class'] = "post-entry-" . $current_post['the_id'] . " post-loop-" . $post_loop_count . " post-parity-" . $current_post['parity'] . $current_post['last'] . " " . $blog_style;
        $current_post['post_class'] .= $current_post['post_type'] == "post" ? '' : ' post';
        $current_post['post_format'] = get_post_format() ? get_post_format() : 'standard';
        $current_post['post_layout'] = avia_layout_class('main', false);
function avia_prepare_dynamic_styles($options = false)
{
    global $avia_config;
    if (!$options) {
        $options = avia_get_option();
    }
    $color_set = $styles = array();
    $post_id = avia_get_the_ID();
    $options = apply_filters('avia_pre_prepare_colors', $options);
    //boxed or stretched layout
    $avia_config['box_class'] = empty($options['color-body_style']) ? "stretched" : $options['color-body_style'];
    //transparency color for header menu
    $avia_config['backend_colors']['menu_transparent'] = empty($options['header_replacement_menu']) ? "" : $options['header_replacement_menu'];
    //iterate over the options array to get the color and bg image options and save them to new array
    foreach ($options as $key => $option) {
        if (strpos($key, 'colorset-') === 0) {
            $newkey = explode('-', $key);
            //add the option to the new array
            $color_set[$newkey[1]][$newkey[2]] = $option;
        }
        if (strpos($key, 'color-') === 0) {
            $newkey = explode('-', $key);
            //add the option to the new array
            $styles[$newkey[1]] = $option;
        }
    }
    //make sure that main color is added later than alternate color so we can nest main color elements within alternate color elements and the styling is applied.
    $color_set = array_reverse($color_set);
    ######################################################################
    # optimize the styles array and set teh background image and sizing
    ######################################################################
    /* only needed if we got a boxed layout option */
    if (empty($styles['body_img'])) {
        $styles['body_img'] = "";
    }
    if (empty($styles['body_repeat'])) {
        $styles['body_repeat'] = "no-repeat";
    }
    if (empty($styles['body_attach'])) {
        $styles['body_attach'] = "fixed";
    }
    if (empty($styles['body_pos'])) {
        $styles['body_pos'] = "top left";
    }
    if ($styles['body_img'] == 'custom') {
        $styles['body_img'] = $styles['body_customimage'];
        unset($styles['body_customimage']);
    }
    if ($styles['body_repeat'] == 'fullscreen') {
        $styles['body_img'] = trim($styles['body_img']);
        if (!empty($styles['body_img'])) {
            $avia_config['fullscreen_image'] = $styles['body_img'];
        }
        unset($styles['body_img']);
        $styles['body_background'] = "";
    } else {
        $styles['body_img'] = trim($styles['body_img']);
        $url = empty($styles['body_img']) ? "" : "url(" . $styles['body_img'] . ")";
        $bg = empty($styles['body_color']) ? 'transparent' : $styles['body_color'];
        $styles['body_background'] = "{$bg}  {$url} " . $styles['body_pos'] . "  " . $styles['body_repeat'] . " " . $styles['body_attach'];
    }
    /*
     */
    ######################################################################
    # optimize the array to make it smaller
    ######################################################################
    foreach ($color_set as $key => $set) {
        if ($color_set[$key]['bg'] == '') {
            $color_set[$key]['bg'] = 'transparent';
        }
        if ($color_set[$key]['bg2'] == '') {
            $color_set[$key]['bg2'] = 'transparent';
        }
        if ($color_set[$key]['primary'] == '') {
            $color_set[$key]['primary'] = 'transparent';
        }
        if ($color_set[$key]['secondary'] == '') {
            $color_set[$key]['secondary'] = 'transparent';
        }
        if ($color_set[$key]['color'] == '') {
            $color_set[$key]['color'] = 'transparent';
        }
        if ($color_set[$key]['border'] == '') {
            $color_set[$key]['border'] = 'transparent';
        }
        if ($color_set[$key]['img'] == 'custom') {
            $color_set[$key]['img'] = $color_set[$key]['customimage'];
            unset($color_set[$key]['customimage']);
        }
        if ($color_set[$key]['img'] == '') {
            unset($color_set[$key]['img'], $color_set[$key]['pos'], $color_set[$key]['repeat'], $color_set[$key]['attach']);
        } else {
            $bg = empty($color_set[$key]['bg']) ? 'transparent' : $color_set[$key]['bg'];
            $repeat = $color_set[$key]['repeat'] == "fullscreen" ? "no-repeat" : $color_set[$key]['repeat'];
            $color_set[$key]['img'] = trim($color_set[$key]['img']);
            $url = empty($color_set[$key]['img']) ? "" : "url(" . $color_set[$key]['img'] . ")";
            $color_set[$key]['background_image'] = "{$bg} {$url} " . $color_set[$key]['pos'] . "  " . $repeat . " " . $color_set[$key]['attach'];
        }
        if (isset($color_set[$key]['customimage'])) {
            unset($color_set[$key]['customimage']);
        }
        //checks if we have a dark or light background and then creates a stronger version of the main font color for headings
        $shade = avia_backend_calc_preceived_brightness($color_set[$key]['bg'], 100) ? 'lighter' : 'darker';
        $color_set[$key]['heading'] = avia_backend_calculate_similar_color($color_set[$key]['color'], $shade, 4);
        // creates a new color from the background color and the heading color (results in a lighter color)
        $color_set[$key]['meta'] = avia_backend_merge_colors($color_set[$key]['heading'], $color_set[$key]['bg']);
    }
    $avia_config['backend_colors']['color_set'] = $color_set;
    $avia_config['backend_colors']['style'] = $styles;
    require AVIA_BASE . 'css/dynamic-css.php';
}
Example #9
0
<style type='text/css'> .one_fourth	{ width:21.5%;} div{zoom:1;}</style>
<![endif]-->

</head>



<?php 
/*
 * prepare big slideshow if available
 * If we are displaying a dynamic template the slideshow might already be set
 * therefore we dont need to call it here
 */
if (!avia_special_dynamic_template()) {
    avia_template_set_page_layout();
    $slider = new avia_slideshow(avia_get_the_ID());
    $avia_config['slide_output'] = $slider->display();
}
$style = avia_get_option('boxed', 'boxed');
?>


<body id="top" <?php 
body_class($style . " " . avia_get_browser());
?>
>
	
	<div class='mobile_wrap'>
	
			<!-- ####### HEAD CONTAINER ####### -->
			
Example #10
0
<?php

global $avia_config;
/* 
 * create a new dynamic template object and display it.
 * The rendering class is located in includes/helper-templates.php
 */
$post_id = avia_get_the_ID();
$template_name = avia_post_meta($post_id, 'dynamic_templates');
$template = new avia_dynamic_template($template_name);
$template->set_layout();
$template->generate_html();
$template->special_slider_config();
/*
 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
 */
get_header();
if (isset($avia_config['new_query'])) {
    query_posts($avia_config['new_query']);
    the_post();
}
?>
	

		
		<!-- ####### MAIN CONTAINER ####### -->
		<div class='container_wrap <?php 
echo $avia_config['layout'];
?>
' id='main'>