Esempio n. 1
0
function tva_ajaxdata()
{
    if (isset($_POST)) {
        $data_contents = $data_source = $type = '';
    }
    $type = isset($_POST['type']) ? $_POST['type'] : '';
    $data_source = isset($_POST['source']) ? $_POST['source'] : '';
    $query = isset($_POST['query']) ? $_POST['query'] : '';
    $data_offset = isset($_POST['data_offset']) ? $_POST['data_offset'] : '';
    $load_value = isset($_POST['load_value']) ? $_POST['load_value'] : '';
    $postlayout = isset($_POST['postlayout']) ? $_POST['postlayout'] : '';
    $grid_columns = isset($_POST['grid_columns']) ? $_POST['grid_columns'] : '';
    $config = isset($_POST['attributes']) ? $_POST['attributes'] : '';
    $attributes = !empty($config) ? explode('|', $config) : array();
    foreach ($attributes as $attribute) {
        list($key, $value) = explode(":", $attribute);
        $config_attributes[$key] = $value;
    }
    // Configuration Options
    $NV_gridcolumns = $grid_columns;
    $NV_slidercolumns = $load_value;
    $NV_groupgridcontent = !empty($config_attributes['content']) ? $config_attributes['content'] : '';
    $NV_imgwidth = !empty($config_attributes['img_width']) ? $config_attributes['img_width'] : '';
    $NV_imgheight = !empty($config_attributes['img_height']) ? $config_attributes['img_height'] : '';
    $NV_lightbox = !empty($config_attributes['lightbox']) ? $config_attributes['lightbox'] : '';
    $NV_imageeffect = !empty($config_attributes['imageeffect']) ? $config_attributes['imageeffect'] : '';
    $NV_customlayer = !empty($config_attributes['customlayer']) ? $config_attributes['customlayer'] : '';
    $NV_zoomhover = !empty($config_attributes['zoomhover']) ? $config_attributes['zoomhover'] : '';
    $NV_gridcolumns_text = !empty($NV_gridcolumns) ? $NV_slidercolumns_text = numberToWords($NV_gridcolumns) : '';
    $columnpadding = !empty($config_attributes['columnpadding']) ? $config_attributes['columnpadding'] : '';
    $NV_shortcode_id = !empty($config_attributes['shortcodeid']) ? $config_attributes['shortcodeid'] : '';
    $NV_blackwhite = '';
    if ($NV_imageeffect == 'shadowblackwhite' || $NV_imageeffect == 'frameblackwhite' || $NV_imageeffect == 'blackwhite') {
        $NV_blackwhite = 'blackwhite';
        if ($NV_imageeffect == 'shadowblackwhite') {
            $NV_imageeffect = 'shadow';
        }
        if ($NV_imageeffect == 'frameblackwhite') {
            $NV_imageeffect = 'frame';
        }
        if ($NV_imageeffect == 'blackwhite') {
            $NV_imageeffect = 'none';
        }
    }
    if ($data_source == 'data-4') {
        if (!is_array($query)) {
            $slide_sets = rtrim($query, ',');
            $slide_sets = explode(",", $query);
        } else {
            $slide_sets = implode(",", $query);
            // needed to upgrades of older versions
            $slide_sets = explode(",", $query);
        }
        $sorted_slidesets = array();
        foreach ($slide_sets as $slide_set) {
            if (is_numeric($slide_set)) {
                $slide_id = $slide_set;
                $slide_name = get_the_title($slide_set);
                $sorted_slidesets[$slide_name] = $slide_id;
            } else {
                $name = get_page_by_title($slide_set, 'OBJECT', "slide-sets");
                $slide_id = $name->ID;
                $slide_name = $slide_set;
                $sorted_slidesets[$slide_name] = $slide_id;
            }
        }
        ksort($sorted_slidesets);
        $slide_sets = $sorted_slidesets;
        $slide_set_array = array();
        $postcount = 0;
        $slidecount = 0;
        $data_id = $data_offset;
        foreach ($slide_sets as $slide_set) {
            $slide_xml = get_post_meta($slide_set, 'slide_manager_xml', true);
            $slide_data = new DOMDocument();
            $slide_data->loadXML($slide_xml);
            $slide_set = $slide_data->documentElement;
            foreach ($slide_set->childNodes as $slide) {
                // Get Attached / Post Image Data
                $get_image_src = wp_get_attachment_image_src(find_xml_value($slide, 'image'), 'full');
                // Get Image Meta Data Attachment ID
                $attachment_meta = themeva_attachment_data(find_xml_value($slide, 'image'));
                $slide_set_array[$slidecount]['img'] = $get_image_src;
                $slide_set_array[$slidecount]['img_url'] = $get_image_src[0];
                $slide_set_array[$slidecount]['media_url'] = find_xml_value($slide, 'media_url');
                $slide_set_array[$slidecount]['embed_type'] = find_xml_value($slide, 'embed_type');
                $slide_set_array[$slidecount]['autoplay'] = find_xml_value($slide, 'autoplay');
                $slide_set_array[$slidecount]['title'] = find_xml_value($slide, 'title') != '' ? find_xml_value($slide, 'title') : $attachment_meta['title'];
                $slide_set_array[$slidecount]['description'] = find_xml_value($slide, 'description') != '' ? find_xml_value($slide, 'description') : $attachment_meta['description'];
                $slide_set_array[$slidecount]['link_url'] = find_xml_value($slide, 'link_url');
                $slide_set_array[$slidecount]['css_classes'] = find_xml_value($slide, 'css_classes');
                $slide_set_array[$slidecount]['readmore_link'] = find_xml_value($slide, 'readmore_link');
                $slide_set_array[$slidecount]['timeout'] = find_xml_value($slide, 'timeout');
                $slide_set_array[$slidecount]['filter_tags'] = find_xml_value($slide, 'filter_tags');
                $slidecount++;
            }
        }
        $slide_set_array = array_slice($slide_set_array, $data_offset, $load_value);
        foreach ($slide_set_array as $slide_set) {
            $NV_disablegallink = $NV_movieurl = $NV_previewimgurl = $NV_cssclasses = $NV_galexturl = $NV_videotype = $NV_videoautoplay = $NV_posttitle = $NV_description = $NV_slidetimeout = $img = '';
            $img = $slide_set['img'];
            $NV_previewimgurl = $slide_set['img_url'];
            $NV_movieurl = $slide_set['media_url'];
            $NV_videotype = $slide_set['embed_type'];
            $NV_videoautoplay = $slide_set['autoplay'];
            $NV_posttitle = $slide_set['title'];
            $NV_description = $slide_set['description'];
            $NV_galexturl = $slide_set['link_url'];
            $NV_cssclasses = $slide_set['css_classes'];
            $NV_disablereadmore = $slide_set['readmore_link'];
            $NV_slidetimeout = $slide_set['timeout'];
            $tags_array = $slide_set['filter_tags'];
            $NV_disablegallink = empty($NV_galexturl) ? 'yes' : '';
            $NV_disablereadmore = $NV_disablereadmore == 'off' ? 'yes' : '';
            $NV_videoautoplay = $NV_videoautoplay == 'on' ? '1' : '0';
            $categories = '';
            // Enter Categories into an Array
            if (!empty($tags_array)) {
                $tags_array = str_replace(" ", "", $tags_array);
                $tags_array = explode(',', $tags_array);
                foreach ($tags_array as $tag) {
                    $categories .= $tag . $NV_shortcode_id . ',';
                }
                $replace_arr = array(' ', ',');
                $replace_with = array('_', ' ');
                $categories = str_replace($replace_arr, $replace_with, $categories);
            }
            // Assign unique video ID
            $video_id = $postcount + $data_id;
            $postcount++;
            $data_id++;
            $output = '';
            $NV_show_slider = $type;
            // Check is Timthumb is Enabled or Disabled
            if (of_get_option('timthumb_disable') != 'disable' && empty($NV_customlayer)) {
                require_once NV_FILES . '/adm/functions/BFI_Thumb.php';
                if (!empty($NV_imgwidth)) {
                    $params['width'] = $NV_imgwidth;
                }
                if (!empty($NV_imgheight)) {
                    $params['height'] = $NV_imgheight;
                }
                if ($NV_imgzoomcrop == '0') {
                    $params['crop'] = true;
                }
                if ($NV_imageeffect == 'circular') {
                    $params['height'] = $params['width'];
                }
                $NV_imagepath = bfi_thumb(dyn_getimagepath($NV_previewimgurl), $params);
            } else {
                $NV_imagepath = dyn_getimagepath($NV_previewimgurl);
            }
            require get_slider_frame($type);
            $data_contents .= $output;
        }
    }
    die($data_contents);
}
Esempio n. 2
0
        if (is_numeric($slide_set)) {
            $slide_name = get_the_title($slide_set);
            $slide_id = $slide_set;
        } else {
            $name = get_page_by_title($slide_set, 'OBJECT', "slide-sets");
            $slide_id = $name->ID;
            $slide_name = $slide_set;
        }
        $sorted_slidesets[$slide_name] = $slide_id;
    }
    ksort($sorted_slidesets);
    // Assign new order
    $NV_slide_sets = $sorted_slidesets;
}
// Get Slider Frame Path
$slider_frame = get_slider_frame($NV_show_slider);
// Ajax Settings
if (!empty($load_ajax)) {
    $load_limit = !empty($load_limit) ? $load_limit : get_option('posts_per_page');
    $load_value = !empty($load_value) ? $load_value : (!empty($NV_gridcolumns) ? $NV_gridcolumns : 1);
}
// Get Total Slide Count if multiple slides selected
if (is_array($NV_slide_sets)) {
    foreach ($NV_slide_sets as $NV_slide_set) {
        // Check if Name or ID
        if (is_numeric($NV_slide_set)) {
            $post_id = $NV_slide_set;
        } else {
            $name = get_page_by_title($NV_slide_set, 'OBJECT', "slide-sets");
            $post_id = $name->ID;
        }