Ejemplo n.º 1
0
/**
 * SlideDeck markup creator
 * 
 * @param object $slidedeck_id The ID of the SlideDeck to render
 * @param array $styles [optional] The styles to apply to the main SlideDeck tag ( usually just width and height )
 * 
 * @uses slidedeck_load()
 * @uses slidedeck_load_slides()
 * @uses slidedeck_dir()
 * @uses slidedeck_dynamic_template_content()
 * @uses slidedeck_get_skin()
 * @uses WP_Query
 * @uses get_the_title()
 * @uses get_the_time()
 * @uses human_time_diff()
 * @uses wp_trim_excerpt()
 * @uses get_permalink()
 * @uses get_post_custom_values()
 * @uses get_post_meta()
 * @uses slidedeck_get_dynamic_option()
 * @uses slidedeck_parse_html_for_images()
 * @uses slidedeck_get_option()
 * @uses slidedeck_prepare_excerpt()
 * @uses slidedeck_output()
 * 
 * @return Rendered SlideDeck markup and JavaScript tag to initialize SlideDeck render
 */
function slidedeck_process_template($slidedeck_id, $styles = array('width' => '100%', 'height' => '300px'))
{
    global $slidedeck_skin_included, $slidedeck_footer_scripts;
    // Lookup the SlideDeck requested
    $slidedeck = slidedeck_load($slidedeck_id);
    if (isset($slidedeck) && !empty($slidedeck)) {
        $is_dynamic = (bool) $slidedeck['dynamic'];
        $image_skin = false;
        $vertical_smart_skin = false;
        $skin = slidedeck_get_skin(isset($slidedeck['skin']) && !empty($slidedeck['skin']) ? $slidedeck['skin'] : 'default');
        if ($skin['meta']['Skin Type'] == "fixed") {
            $styles['height'] = $skin['meta']['Skin Height'] . "px";
        }
        if ($skin['meta']['Skin Slide Type'] == "image") {
            $image_skin = true;
        }
        $skin_image_width = isset($skin['meta']['Skin Image Width']) ? $skin['meta']['Skin Image Width'] : '270px';
        $skin_image_height = isset($skin['meta']['Skin Image Height']) ? $skin['meta']['Skin Image Height'] : '250px';
        if ($skin['meta']['Skin Slide Type'] == "vertical") {
            $vertical_smart_skin = true;
        }
        // Setup styles array as inline style string
        $styles_str = "";
        $sep = "";
        foreach ((array) $styles as $style => $def) {
            $styles_str .= $sep . $style . ":" . $def;
            $sep = ";";
        }
        srand();
        // Seed the random number generator
        // Create unique SlideDeck ID for this SlideDeck
        $slidedeck_uid = "SlideDeck_" . rand(100, 999) . "_" . $slidedeck['id'];
        if ($is_dynamic === true) {
            $args = array('post_type' => slidedeck_get_dynamic_option($slidedeck, 'post_type'), 'post_status' => 'publish', 'posts_per_page' => $slidedeck['dynamic_options']['total']);
            if ($slidedeck['dynamic_options']['filter_by_category'] == '1' && slidedeck_get_dynamic_option($slidedeck, 'post_type') == 'post') {
                $args['cat'] = implode(',', $slidedeck['dynamic_options']['filter_categories']);
            }
            switch ($slidedeck['dynamic_options']['type']) {
                case "recent":
                    $args['orderby'] = 'date';
                    $args['order'] = 'DESC';
                    break;
                case "featured":
                    $args['meta_key'] = '_slidedeck_post_featured';
                    $args['meta_value'] = '1';
                    $args['orderby'] = 'date';
                    $args['order'] = 'DESC';
                    break;
                case "popular":
                    $args['orderby'] = '_slidedeck_popularity';
                    $args['order'] = 'DESC';
                    break;
            }
            $excerpt_length_with_image = intval(slidedeck_get_dynamic_option($slidedeck, 'excerpt_length_with_image')) > -1 ? intval(slidedeck_get_dynamic_option($slidedeck, 'excerpt_length_with_image')) : SLIDEDECK_EXCERPT_LENGTH_WITH_IMAGE;
            $excerpt_length_without_image = intval(slidedeck_get_dynamic_option($slidedeck, 'excerpt_length_without_image')) > -1 ? intval(slidedeck_get_dynamic_option($slidedeck, 'excerpt_length_without_image')) : SLIDEDECK_EXCERPT_LENGTH_WITHOUT_IMAGE;
            $title_length_with_image = intval(slidedeck_get_dynamic_option($slidedeck, 'title_length_with_image')) > -1 ? intval(slidedeck_get_dynamic_option($slidedeck, 'title_length_with_image')) : SLIDEDECK_TITLE_LENGTH_WITH_IMAGE;
            $title_length_without_image = intval(slidedeck_get_dynamic_option($slidedeck, 'title_length_without_image')) > -1 ? intval(slidedeck_get_dynamic_option($slidedeck, 'title_length_without_image')) : SLIDEDECK_TITLE_LENGTH_WITHOUT_IMAGE;
            if ($slidedeck['dynamic_options']['type'] != 'rss') {
                // Post Based Dynamic SlideDeck.
                $dynamic_posts = new WP_Query($args);
                $slides = array();
                foreach ($dynamic_posts->posts as $post) {
                    $post_id = $post->ID;
                    $slide = array();
                    $slide_nodes = array('type' => $slidedeck['dynamic_options']['type'], 'title' => html_entity_decode(get_the_title($post_id), ENT_QUOTES, 'UTF-8'), 'timestamp' => get_the_time('U', $post_id), 'timesince' => "Posted " . human_time_diff(get_the_time('U', $post_id), current_time('timestamp')) . " ago", 'permalink' => get_permalink($post_id));
                    $post_content = $post->post_content;
                    $post_excerpt = false;
                    if (!empty($post->post_excerpt)) {
                        $post_excerpt = $post->post_excerpt;
                    }
                    switch (slidedeck_get_dynamic_option($slidedeck, 'image_source')) {
                        case 'none':
                            $slide_nodes['image'] = null;
                            break;
                        default:
                        case 'content':
                            $slide_nodes['image'] = slidedeck_parse_html_for_images($post_content, slidedeck_get_dynamic_option($slidedeck, 'validate_images'));
                            break;
                        case 'gallery':
                            // Get the image attachments and output the first one.
                            $attachments = get_children(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order', 'post_parent' => $post_id));
                            if (!empty($attachments)) {
                                $attachment = wp_get_attachment_image_src(reset($attachments)->ID, array($skin_image_width, $skin_image_height));
                                if ($attachment) {
                                    $slide_nodes['image']['src'] = $attachment[0];
                                    $slide_nodes['image']['width'] = $attachment[1];
                                    $slide_nodes['image']['height'] = $attachment[2];
                                }
                            }
                            break;
                        case 'thumbnail':
                            // Get the id of the post thumbnail.
                            if (current_theme_supports('post-thumbnails') && has_post_thumbnail($post_id)) {
                                $thumbnail_id = get_post_thumbnail_id($post_id, array($skin_image_width, $skin_image_height));
                                // Get more detailed info on the image that's being used as the post thumbnail.
                                $attachment = wp_get_attachment_image_src($thumbnail_id, array($skin_image_width, $skin_image_height));
                                if ($attachment) {
                                    $slide_nodes['image']['src'] = $attachment[0];
                                    $slide_nodes['image']['width'] = $attachment[1];
                                    $slide_nodes['image']['height'] = $attachment[2];
                                }
                            }
                            break;
                    }
                    // Unfortunately we cannot use WP's built in excerpt shortener since
                    // we cannot easily access the existing set excerpt length and shouldn't
                    // modify the user's perferences here
                    if ($post_excerpt === false) {
                        $the_excerpt = strip_shortcodes($post_content);
                    } else {
                        $the_excerpt = $post_excerpt;
                    }
                    $the_excerpt_limit = isset($slide_nodes['image']) ? $excerpt_length_with_image : $excerpt_length_without_image;
                    $slide_nodes['excerpt'] = slidedeck_prepare_excerpt($the_excerpt, $the_excerpt_limit);
                    $title_chracter_limit = !empty($slide_nodes['image']) ? $title_length_with_image : $title_length_without_image;
                    $slide_nodes['title'] = slidedeck_prepare_title($slide_nodes['title'], $title_chracter_limit);
                    // Process content nodes through template to create slide content
                    ob_start();
                    foreach ($slide_nodes as $node => $val) {
                        ${$node} = $val;
                    }
                    if (empty($slide_nodes['image']) && $image_skin) {
                        // Keep looking if we don't find a post with an image
                        continue;
                    } else {
                        // Until a full template selection system is built, just get the first one in the folder
                        $template = reset($skin['templates']);
                        include $template['file'];
                        $slide['content'] = ob_get_contents();
                    }
                    foreach ($slide_nodes as $node => $val) {
                        ${$node} = null;
                    }
                    ob_end_clean();
                    // Process slide title with post title or specified slide title
                    $spine_title = get_post_meta($post_id, '_slidedeck_slide_title', true);
                    $slide['title'] = !empty($spine_title) ? $spine_title : get_the_title($post_id);
                    $slide['timestamp'] = $slide_nodes['timestamp'];
                    $slides[] = $slide;
                }
            } else {
                // RSS Based Dynamic SlideDeck.
                // Uses simple file-based persistent caching.
                // Generate a filename for this feed and smart SlideDeck
                $cache_file = slidedeck_dir('/cache/') . md5($slidedeck_id . $slidedeck['dynamic_options']['feed_url']) . '.tmp';
                $cache_dir = slidedeck_dir('/cache/');
                $use_cache = false;
                $user_set_minutes = intval($slidedeck['dynamic_options']['cache_minutes']);
                if ($user_set_minutes > -1) {
                    // After testing the user input values, we check to see that it's in the valid range.
                    $cache_duration_minutes = $user_set_minutes;
                } else {
                    // set default cache duration (in minutes)
                    $cache_duration_minutes = 30;
                }
                // If a cache file exists, check its modification time against the cache time limit.
                // Decide if we should use the cache or fetch new data.
                if (file_exists($cache_file) && is_writable($cache_dir)) {
                    $cache_modified = filemtime($cache_file);
                    $cache_age = floor((time() - $cache_modified) / 60);
                    if ($cache_age <= $cache_duration_minutes) {
                        $use_cache = true;
                    } else {
                        $use_cache = false;
                    }
                }
                if ($use_cache) {
                    // Use cached data. Load the cache file and read contents.
                    $feed_xml = @file_get_contents($cache_file);
                } else {
                    // Fetch new info from Feed provider.
                    $feed_xml = @wp_remote_fopen($slidedeck['dynamic_options']['feed_url']);
                    if (is_writable($cache_dir)) {
                        // Add the newly fetched information to the cache.
                        $fh = fopen($cache_file, 'w');
                        fwrite($fh, $feed_xml);
                        fclose($fh);
                    }
                }
                // Load the XML data from the previous caching calculations.
                if ($xml = @simplexml_load_string($feed_xml)) {
                    if ($xml->entry) {
                        $feed_format = 'atom';
                        $items = $xml->entry;
                    } elseif ($xml->item) {
                        $feed_format = 'rss';
                        $feed = $xml->item;
                        $items = $feed;
                        $namespaces = $xml->getNamespaces(true);
                    } elseif ($xml->channel->item) {
                        $feed_format = 'rss';
                        $feed = $xml->channel;
                        $items = $feed->item;
                        $namespaces = $xml->getNamespaces(true);
                    }
                } else {
                    unlink($cache_file);
                    echo 'Invalid Feed URL Provided for Smart SlideDeck';
                    $items = array();
                }
                // Loop through the RSS items and build the Smart SlideDeck.
                $entry_count = 0;
                foreach ($items as $item) {
                    if ($entry_count < $slidedeck['dynamic_options']['total']) {
                        switch ($feed_format) {
                            case 'atom':
                                $slide_nodes = array('type' => $slidedeck['dynamic_options']['type'], 'title' => html_entity_decode($item->title, ENT_QUOTES, 'UTF-8'), 'timestamp' => strtotime($item->published), 'timesince' => "Posted " . human_time_diff(strtotime($item->published)) . " ago", 'permalink' => $item->link['href']);
                                $item_content = $item->content;
                                break;
                            case 'rss':
                                if ($xml->item) {
                                    $date = $item->children($feed['namespaces']['dc'])->date;
                                } else {
                                    $date = $item->pubDate;
                                }
                                $slide_nodes = array('type' => $slidedeck['dynamic_options']['type'], 'title' => html_entity_decode($item->title, ENT_QUOTES, 'UTF-8'), 'timestamp' => strtotime($date), 'timesince' => "Posted " . human_time_diff(strtotime($date)) . " ago", 'permalink' => $item->link);
                                $item_content = !empty($item->children($namespaces['content'])->encoded) ? $item->children($namespaces['content'])->encoded : $item->description;
                                break;
                        }
                        // Look for images
                        switch ($slidedeck['dynamic_options']['image_source']) {
                            case 'none':
                                $slide_nodes['image'] = null;
                                break;
                            default:
                            case 'content':
                                $slide_nodes['image'] = slidedeck_parse_html_for_images($item_content, slidedeck_get_dynamic_option($slidedeck, 'validate_images'));
                                break;
                        }
                        // Set the character limits and trim the content.
                        $chracter_limit = !empty($slide_nodes['image']) ? $excerpt_length_with_image : $excerpt_length_without_image;
                        $slide_nodes['excerpt'] = slidedeck_prepare_excerpt($item_content, $chracter_limit);
                        $title_chracter_limit = !empty($slide_nodes['image']) ? $title_length_with_image : $title_length_without_image;
                        $slide_nodes['title'] = slidedeck_prepare_title($slide_nodes['title'], $title_chracter_limit);
                        // Process content nodes through template to create slide content
                        ob_start();
                        foreach ($slide_nodes as $node => $val) {
                            ${$node} = $val;
                        }
                        if (empty($slide_nodes['image']) && $image_skin) {
                            // Keep looking if we don't find a post with an image
                            continue;
                        } else {
                            // Until a full template selection system is built, just get the first one in the folder
                            $template = reset($skin['templates']);
                            include $template['file'];
                            $slide['content'] = ob_get_contents();
                        }
                        foreach ($slide_nodes as $node => $val) {
                            ${$node} = null;
                        }
                        ob_end_clean();
                        // Process slide title with post title or specified slide title
                        $spine_title = html_entity_decode($item->title, ENT_QUOTES, 'UTF-8');
                        $slide['title'] = $spine_title;
                        $slide['timestamp'] = $slide_nodes['timestamp'];
                        $slides[] = $slide;
                        $entry_count++;
                    }
                }
            }
        } else {
            // Get the Slides for the SlideDeck requested
            $slides = slidedeck_load_slides($slidedeck_id);
            $slide_backgrounds = slidedeck_get_option($slidedeck, 'slide_backgrounds');
            for ($i = 0; $i < count($slides); $i++) {
                $slide_id = $slides[$i]['id'];
                if (isset($slide_backgrounds[$slide_id]) && !empty($slide_backgrounds[$slide_id])) {
                    $slides[$i]['background'] = $slide_backgrounds[$slide_id];
                }
            }
        }
        // Generate markup for the template string.
        $template_str = slidedeck_output($slidedeck, $slidedeck_uid, $slides, $styles_str, $vertical_smart_skin);
        $vertical_addition = "";
        if (slidedeck_has_vertical_slides($slidedeck) || $vertical_smart_skin) {
            $vertical_addition = '.vertical( { ';
            $vertical_addition .= 'speed: ' . slidedeck_get_option($slidedeck, 'speed');
            $vertical_addition .= ', scroll: ' . slidedeck_get_option($slidedeck, 'scroll');
            $vertical_addition .= ', continueScrolling: ' . slidedeck_get_option($slidedeck, 'continueScrolling');
            $vertical_addition .= ' } )';
            // Unset the vertical slides option so it's not output to the view.
            unset($slidedeck['slidedeck_options']['vertical_slides']);
            // Unset the continueScrolling option so it's not output to the slidedeck() function.
            unset($slidedeck['slidedeck_options']['continueScrolling']);
        }
        // Unset the slide_backgrounds option so it isn't output to the view.
        unset($slidedeck['slidedeck_options']['slide_backgrounds']);
        // Build the JavaScript statement.
        $slidedeck_options_json = "{ ";
        $sep = "";
        foreach ((array) $slidedeck['slidedeck_options'] as $key => $val) {
            $slidedeck_options_json .= $sep . $key . ": ";
            if ($val == 'true' || $val == 'false') {
                $slidedeck_options_json .= $val;
            } elseif (is_numeric($val)) {
                $slidedeck_options_json .= $val;
            } else {
                $slidedeck_options_json .= (string) "'{$val}'";
            }
            $sep = ", ";
        }
        $slidedeck_options_json .= " }";
        if ($is_dynamic === true && !$vertical_smart_skin) {
            $template_str .= slidedeck_dynamic_template_content($slidedeck, $slides);
        }
        $template_str .= '</div>';
        $slidedeck_footer_scripts .= '<script type="text/javascript">jQuery( \'#' . $slidedeck_uid . '\' ).slidedeck( ' . $slidedeck_options_json . ' )' . $vertical_addition . ';</script>';
        if (!isset($slidedeck_skin_included[$skin['slug']])) {
            $slidedeck_skin_included[$skin['slug']] = true;
            $skin_css_tags = slidedeck_get_skin_css($skin);
            $template_str = $skin_css_tags . $template_str;
            if (isset($skin['script_url']) && !empty($skin['script_url'])) {
                $slidedeck_footer_scripts .= '<script type="text/javascript" src="' . $skin['script_url'] . '"></script>';
            }
        }
    } else {
        $template_str = "";
    }
    return $template_str;
}
Ejemplo n.º 2
0
/**
 * SlideDeck markup creator
 * 
 * @param object $slidedeck_id The ID of the SlideDeck to render
 * @param array $styles [optional] The styles to apply to the main SlideDeck tag ( usually just width and height )
 * @param boolean $include_skin_files Include the files for this SlideDeck's skin?
 * 
 * @uses slidedeck_load()
 * @uses slidedeck_load_slides()
 * @uses slidedeck_dir()
 * @uses slidedeck_dynamic_template_content()
 * @uses slidedeck_get_skin()
 * @uses WP_Query
 * @uses get_the_title()
 * @uses get_the_time()
 * @uses human_time_diff()
 * @uses wp_trim_excerpt()
 * @uses get_permalink()
 * @uses get_post_custom_values()
 * @uses get_post_meta()
 * @uses slidedeck_get_dynamic_option()
 * @uses slidedeck_parse_html_for_images()
 * @uses slidedeck_get_option()
 * @uses slidedeck_prepare_excerpt()
 * @uses slidedeck_output()
 * 
 * @return Rendered SlideDeck markup and JavaScript tag to initialize SlideDeck render
 */
function slidedeck_process_template($slidedeck_id, $styles = array('width' => '100%', 'height' => '300px'), $include_skin_files = true)
{
    global $slidedeck_skin_included, $slidedeck_footer_scripts;
    // Lookup the SlideDeck requested
    $slidedeck = slidedeck_load($slidedeck_id);
    if (isset($slidedeck) && !empty($slidedeck)) {
        $is_dynamic = (bool) $slidedeck['dynamic'];
        $image_skin = false;
        $skin = slidedeck_get_skin(isset($slidedeck['skin']) && !empty($slidedeck['skin']) ? $slidedeck['skin'] : 'default');
        if ($skin['meta']['Skin Type'] == "fixed") {
            $styles['height'] = $skin['meta']['Skin Height'] . "px";
        }
        if ($skin['meta']['Skin Slide Type'] == "image") {
            $image_skin = true;
        }
        $skin_image_width = isset($skin['meta']['Skin Image Width']) ? $skin['meta']['Skin Image Width'] : '270px';
        $skin_image_height = isset($skin['meta']['Skin Image Height']) ? $skin['meta']['Skin Image Height'] : '250px';
        // Setup styles array as inline style string
        $styles_str = "";
        $sep = "";
        foreach ((array) $styles as $style => $def) {
            $styles_str .= $sep . $style . ":" . $def;
            $sep = ";";
        }
        srand();
        // Seed the random number generator
        // Create unique SlideDeck ID for this SlideDeck
        $slidedeck_uid = "SlideDeck_" . rand(100, 999) . "_" . $slidedeck['id'];
        if ($is_dynamic === true) {
            $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $slidedeck['dynamic_options']['total']);
            if ($slidedeck['dynamic_options']['filter_by_category'] == '1') {
                $args['cat'] = implode(',', $slidedeck['dynamic_options']['filter_categories']);
            }
            switch ($slidedeck['dynamic_options']['type']) {
                case "recent":
                    $args['orderby'] = 'date';
                    $args['order'] = 'DESC';
                    break;
                case "featured":
                    $args['meta_key'] = '_slidedeck_post_featured';
                    $args['meta_value'] = '1';
                    $args['orderby'] = 'date';
                    $args['order'] = 'DESC';
                    break;
                case "popular":
                    $args['orderby'] = '_slidedeck_popularity';
                    $args['order'] = 'DESC';
                    break;
            }
            $excerpt_length_with_image = SLIDEDECK_EXCERPT_LENGTH_WITH_IMAGE;
            $excerpt_length_without_image = SLIDEDECK_EXCERPT_LENGTH_WITHOUT_IMAGE;
            $title_length_with_image = SLIDEDECK_TITLE_LENGTH_WITH_IMAGE;
            $title_length_without_image = SLIDEDECK_TITLE_LENGTH_WITHOUT_IMAGE;
            // Post Based Dynamic SlideDeck.
            $dynamic_posts = new WP_Query($args);
            $slides = array();
            foreach ($dynamic_posts->posts as $post) {
                $post_id = $post->ID;
                $slide = array();
                $slide_nodes = array('type' => $slidedeck['dynamic_options']['type'], 'title' => html_entity_decode(get_the_title($post_id), ENT_QUOTES, 'UTF-8'), 'timestamp' => get_the_time('U', $post_id), 'timesince' => "Posted " . human_time_diff(get_the_time('U', $post_id), current_time('timestamp')) . " ago", 'permalink' => get_permalink($post_id));
                $post_content = $post->post_content;
                $post_excerpt = false;
                if (!empty($post->post_excerpt)) {
                    $post_excerpt = $post->post_excerpt;
                }
                switch (slidedeck_get_dynamic_option($slidedeck, 'image_source')) {
                    case 'none':
                        $slide_nodes['image'] = null;
                        break;
                    default:
                    case 'content':
                        $slide_nodes['image'] = slidedeck_parse_html_for_images($post_content, slidedeck_get_dynamic_option($slidedeck, 'validate_images'));
                        break;
                }
                // Unfortunately we cannot use WP's built in excerpt shortener since
                // we cannot easily access the existing set excerpt length and shouldn't
                // modify the user's perferences here
                $title_chracter_limit = !empty($slide_nodes['image']) ? $title_length_with_image : $title_length_without_image;
                $the_excerpt_limit = isset($slide_nodes['image']) ? $excerpt_length_with_image : $excerpt_length_without_image;
                if ($post_excerpt === false) {
                    $the_excerpt = strip_shortcodes($post_content);
                } else {
                    $the_excerpt = $post_excerpt;
                }
                $slide_nodes['excerpt'] = slidedeck_prepare_excerpt($the_excerpt, $the_excerpt_limit);
                $slide_nodes['title'] = slidedeck_prepare_title($slide_nodes['title'], $title_chracter_limit);
                // Process content nodes through template to create slide content
                ob_start();
                foreach ($slide_nodes as $node => $val) {
                    ${$node} = $val;
                }
                if (empty($slide_nodes['image']) && $image_skin) {
                    // Keep looking if we don't find a post with an image
                    continue;
                } else {
                    // Until a full template selection system is built, just get the first one in the folder
                    $template = reset($skin['templates']);
                    include $template['file'];
                    $slide['content'] = ob_get_contents();
                }
                foreach ($slide_nodes as $node => $val) {
                    ${$node} = null;
                }
                ob_end_clean();
                // Process slide title with post title or specified slide title
                $spine_title = get_post_meta($post_id, '_slidedeck_slide_title', true);
                $slide['title'] = !empty($spine_title) ? $spine_title : get_the_title($post_id);
                $slide['timestamp'] = $slide_nodes['timestamp'];
                $slides[] = $slide;
            }
        } else {
            // Get the Slides for the SlideDeck requested
            $slides = slidedeck_load_slides($slidedeck_id);
        }
        // Generate markup for the template string.
        $template_str = slidedeck_output($slidedeck, $slidedeck_uid, $slides, $styles_str);
        // Build the JavaScript statement.
        $slidedeck_options_json = "{ ";
        $sep = "";
        foreach ((array) $slidedeck['slidedeck_options'] as $key => $val) {
            $slidedeck_options_json .= $sep . $key . ": ";
            if ($val == 'true' || $val == 'false') {
                $slidedeck_options_json .= $val;
            } elseif (is_numeric($val)) {
                $slidedeck_options_json .= $val;
            } else {
                $slidedeck_options_json .= (string) "'{$val}'";
            }
            $sep = ", ";
        }
        $slidedeck_options_json .= " }";
        if ($is_dynamic === true) {
            $template_str .= slidedeck_dynamic_template_content($slidedeck, $slides);
        }
        $template_str .= '</div>';
        $slidedeck_footer_scripts .= '<script type="text/javascript">jQuery( \'#' . $slidedeck_uid . '\' ).slidedeck( ' . $slidedeck_options_json . ' );</script>';
        if (!isset($slidedeck_skin_included[$skin['slug']]) && $include_skin_files === true) {
            $slidedeck_skin_included[$skin['slug']] = true;
            $skin_css_tags = slidedeck_get_skin_css($skin);
            $template_str = $skin_css_tags . $template_str;
            if (isset($skin['script_url']) && !empty($skin['script_url'])) {
                $slidedeck_footer_scripts .= '<script type="text/javascript" src="' . $skin['script_url'] . '"></script>';
            }
        }
    } else {
        $template_str = "";
    }
    return $template_str;
}