Example #1
0
function vanilla_widget_template_markup($block = null)
{
    global $wp_registered_sidebars, $wp_registered_widgets;
    $tpl_source = "";
    $block = sanitize_title($block);
    foreach ((array) $wp_registered_sidebars as $key => $value) {
        if (sanitize_title($value['name']) == $block) {
            $block = $key;
            break;
        }
    }
    $sidebars_widgets = wp_get_sidebars_widgets();
    if (empty($wp_registered_sidebars[$block]) || !array_key_exists($block, $sidebars_widgets) || !is_array($sidebars_widgets[$block]) || empty($sidebars_widgets[$block])) {
        return "";
    }
    $sidebar = $wp_registered_sidebars[$block];
    foreach ((array) $sidebars_widgets[$block] as $id) {
        $params = array_merge(array(array_merge($sidebar, array('widget_id' => $id, 'widget_name' => $wp_registered_widgets[$id]['name']))), (array) $wp_registered_widgets[$id]['params']);
        $params = apply_filters('dynamic_sidebar_params', $params);
        $callback = $wp_registered_widgets[$id]['callback'];
        $widget_name = str_replace("widget_", "", strtolower($callback));
        $active_template = vanilla_get_template('widgets/' . str_replace("_", "-", $widget_name) . ".html");
        if (!$active_template) {
            return "";
        }
        //echo $widget_name . " " . $widget_filename;
        if (is_callable($callback)) {
            call_user_func_array($callback, $params);
            $tpl_source .= '<span metal:use-macro="' . $active_template . '/loader" />' . "\n" . '<span tal:condition="php:VANILLA_DEBUG" class="widget-debug">WIDGET: ' . $widget_name . '</span>' . "\n" . '<span metal:define-slot="' . $widget_name . '" />' . "\n";
        }
    }
    return $tpl_source;
}
Example #2
0
function vanilla_shortcode($shortcode)
{
    global $tpl_set, $tpl;
    $active_template = vanilla_get_template('shortcodes/' . $shortcode . ".html");
    if (!$active_template) {
        return "";
    }
    // No need to include the PHP tpl file here. Already loaded at init.
    $tpl_source = '<metal:block define-macro="' . $shortcode . '_shortcode">' . "\n" . "<!-- shortcode: " . $shortcode . " -->\n" . '<span tal:condition="php:VANILLA_DEBUG" class="widget-debug">SHORTCODE: ' . $shortcode . '</span>' . "\n" . '<span metal:use-macro="' . $active_template . '/loader" />' . "\n" . '<span metal:define-slot="' . $shortcode . '" />' . "\n" . '</metal:block><metal:block use-macro="' . $shortcode . '_shortcode" />' . "\n";
    //return "<textarea style='width:500px; height:300px;'> $tpl_source </textarea>";
    // Load and fire the PHPTAL template!
    $template = new PHPTAL();
    $template->setSource($tpl_source, $tpl_set . $shortcode);
    $template->set('vanilla', $tpl);
    try {
        return $template->execute();
    } catch (Exception $e) {
        return $e;
    }
}
Example #3
0
function vanilla_load_tpl_includes()
{
    global $tpl_set;
    // list of directories containing pairs of PHP/HTML template files. Include the PHP files now for later use...
    $dirs = array("shortcodes");
    foreach ($dirs as $dir) {
        // load template item from either parent or child theme
        $files = cfct_files(CFCT_PATH . $tpl_set . $dir);
        foreach ($files as $file) {
            include_once vanilla_get_template($dir . '/' . $file);
        }
    }
}
Example #4
0
	warrant to Australis Media Pty Ltd that your use of the Vanilla
	theme software will comply with the CC-GNU-GPL.
*/
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
    die;
}
if (CFCT_DEBUG) {
    cfct_banner(__FILE__);
}
global $vnl_width, $vnl_nesting, $vnl_template, $vnl_utility, $tpl;
$vnl_width = isset($vnl_width) ? $vnl_width : vanilla_get_option("vnl_grid_width");
$vnl_nesting = isset($vnl_nesting) ? $vnl_nesting : vanilla_get_option("vnl_grid_nesting");
$vnl_template = isset($vnl_template) ? $vnl_template : vanilla_get_option("vnl_grid_template");
$vnl_utility = isset($vnl_utility) ? $vnl_utility : vanilla_get_option("vnl_utility_nesting");
// Page-specific overides
//$vnl_width = "yui-d3";
//$vnl_nesting = "yui-gd";
//$vnl_template = "yui-t2";
//$vnl_utility = "yui-bg";
// create a new PHPTAL template object
$template = new PHPTAL(vanilla_get_template('posts/tag.html'));
$template->cleanUpCache();
$tag_title = '<a href="' . get_tag_link(intval(get_query_var('tag_id'))) . '" title="">' . single_tag_title('', false) . '</a>';
$tag_title = sprintf(__('Tag Archives: %s', 'carrington'), $tag_title);
$tpl["page"] = array("width" => $vnl_width, "nesting" => $vnl_nesting, "template" => $vnl_template, "utility" => $vnl_utility, "body_class" => sandbox_body_class(false), "bd_class" => "{$vnl_width} {$vnl_template}", "tag_title" => $tag_title, "cat_description" => $cat_description ? $cat_description : 0);
get_header();
vnl_include('loop');
vnl_include('nav-posts');
get_footer();
// Execute the PHPTAL template
vanilla_output_page($template);
Example #5
0
	You may use the Vanilla theme software in accordance with the
	terms of that license. You agree that you are solely responsible
	for your use of the Vanilla theme software and you represent and 
	warrant to Australis Media Pty Ltd that your use of the Vanilla
	theme software will comply with the CC-GNU-GPL.
*/
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
    die;
}
if (CFCT_DEBUG) {
    cfct_banner(__FILE__);
}
global $vnl_width, $vnl_nesting, $vnl_template, $vnl_utility, $tpl;
$vnl_width = isset($vnl_width) ? $vnl_width : vanilla_get_option("vnl_grid_width");
$vnl_nesting = isset($vnl_nesting) ? $vnl_nesting : vanilla_get_option("vnl_grid_nesting");
$vnl_template = isset($vnl_template) ? $vnl_template : vanilla_get_option("vnl_grid_template");
$vnl_utility = isset($vnl_utility) ? $vnl_utility : vanilla_get_option("vnl_utility_nesting");
// Page-specific overides
//$vnl_width = "yui-d3";
//$vnl_nesting = "yui-gd";
//$vnl_template = "yui-t2";
//$vnl_utility = "yui-bg";
// create a new PHPTAL template object
$template = new PHPTAL(vanilla_get_template('error/404.html'));
$template->cleanUpCache();
$tpl["page"] = array("base_path" => CFCT_PATH, "width" => $vnl_width, "nesting" => $vnl_nesting, "template" => $vnl_template, "utility" => $vnl_utility, "body_class" => sandbox_body_class(false), "bd_class" => $vnl_width . " " . $vnl_template);
get_header();
vnl_include('search');
get_footer();
// Execute the PHPTAL template
vanilla_output_page($template);
Example #6
0
	theme software will comply with the CC-GNU-GPL.
*/
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
    die;
}
if (CFCT_DEBUG) {
    cfct_banner(__FILE__);
}
global $vnl_width, $vnl_nesting, $vnl_template, $vnl_utility, $tpl;
$vnl_width = isset($vnl_width) ? $vnl_width : vanilla_get_option("vnl_grid_width");
$vnl_nesting = isset($vnl_nesting) ? $vnl_nesting : vanilla_get_option("vnl_grid_nesting");
$vnl_template = isset($vnl_template) ? $vnl_template : vanilla_get_option("vnl_grid_template");
$vnl_utility = isset($vnl_utility) ? $vnl_utility : vanilla_get_option("vnl_utility_nesting");
// Page-specific overides
//$vnl_width = "yui-d3";
//$vnl_nesting = "yui-gd";
//$vnl_template = "yui-t2";
//$vnl_utility = "yui-bg";
// create a new PHPTAL template object
$template = new PHPTAL(vanilla_get_template('posts/search.html'));
$template->cleanUpCache();
$s = get_query_var('s');
$search_title = '<a href="' . get_bloginfo('url') . '/?s=' . attribute_escape($s) . '" title="">' . htmlspecialchars($s) . '</a>';
$tpl["page"] = array("base_path" => CFCT_PATH, "width" => $vnl_width, "nesting" => $vnl_nesting, "template" => $vnl_template, "utility" => $vnl_utility, "body_class" => sandbox_body_class(false), "bd_class" => $vnl_width . " " . $vnl_template, "search_title" => sprintf(__('Search Results for: %s', 'carrington'), $search_title));
get_header();
vnl_include('search');
vnl_include('loop');
vnl_include('nav-posts');
get_footer();
// Execute the PHPTAL template
vanilla_output_page($template);
Example #7
0
	terms of that license. You agree that you are solely responsible
	for your use of the Vanilla theme software and you represent and 
	warrant to Australis Media Pty Ltd that your use of the Vanilla
	theme software will comply with the CC-GNU-GPL.
*/
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
    die;
}
if (CFCT_DEBUG) {
    cfct_banner(__FILE__);
}
global $vnl_width, $vnl_nesting, $vnl_template, $vnl_utility, $tpl;
$vnl_width = isset($vnl_width) ? $vnl_width : vanilla_get_option("vnl_grid_width");
$vnl_nesting = isset($vnl_nesting) ? $vnl_nesting : vanilla_get_option("vnl_grid_nesting");
$vnl_template = isset($vnl_template) ? $vnl_template : vanilla_get_option("vnl_grid_template");
$vnl_utility = isset($vnl_utility) ? $vnl_utility : vanilla_get_option("vnl_utility_nesting");
// Page-specific overides
//$vnl_width = "yui-d3";
//$vnl_nesting = "yui-gd";
//$vnl_template = "yui-t2";
//$vnl_utility = "yui-bg";
// create a new PHPTAL template object
$template = new PHPTAL(vanilla_get_template('posts/author.html'));
$template->cleanUpCache();
$tpl["page"] = array("width" => $vnl_width, "nesting" => $vnl_nesting, "template" => $vnl_template, "utility" => $vnl_utility, "body_class" => sandbox_body_class(false), "bd_class" => $vnl_width . " " . $vnl_template);
get_header();
vnl_include('loop');
vnl_include('nav-posts');
get_footer();
// Execute the PHPTAL template
vanilla_output_page($template);
Example #8
0
//}
// Various helper libraries
//require_once(CFCT_PATH.'_tarski/helpers/template_helper.php');
//require_once(CFCT_PATH.'_tarski/helpers/content_helper.php');
//require_once(CFCT_PATH.'_tarski/helpers/author_helper.php');
//require_once(CFCT_PATH.'_tarski/helpers/tag_helper.php');
//require_once(CFCT_PATH.'_tarski/helpers/widgets.php');
// API files
//require_once(CFCT_PATH.'_tarski/api/hooks.php');
//require_once(CFCT_PATH.'_tarski/api/constants_helper.php');
//include_once(CFCT_PATH.'_tarski/api/deprecated.php');
// Launch
//require_once(CFCT_PATH.'_tarski/launcher.php');
$tpl_set = vanilla_get_option('vnl_tpl_set') . '-set/';
// Load template set's specific functions.php file
include_once vanilla_get_template('functions.php');
cfct_load_plugins();
function cfct_init()
{
    cfct_admin_request_handler();
    if (cfct_get_option('cfct_ajax_load') == 'yes') {
        cfct_ajax_load();
    }
}
add_action('init', 'cfct_init');
/* ========================================
   Header JS Additions
   ======================================== */
wp_enqueue_script('jquery');
wp_enqueue_script('carrington', get_bloginfo('template_directory') . '/js/carrington.js', 'jquery', '1.0');
/* ========================================
Example #9
0
	warrant to Australis Media Pty Ltd that your use of the Vanilla
	theme software will comply with the CC-GNU-GPL.
*/
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
    die;
}
if (CFCT_DEBUG) {
    cfct_banner(__FILE__);
}
global $vnl_width, $vnl_nesting, $vnl_template, $vnl_utility, $tpl;
$vnl_width = isset($vnl_width) ? $vnl_width : vanilla_get_option("vnl_grid_width");
$vnl_nesting = isset($vnl_nesting) ? $vnl_nesting : vanilla_get_option("vnl_grid_nesting");
$vnl_template = isset($vnl_template) ? $vnl_template : vanilla_get_option("vnl_grid_template");
$vnl_utility = isset($vnl_utility) ? $vnl_utility : vanilla_get_option("vnl_utility_nesting");
// Page-specific overides
//$vnl_width = "yui-d3";
//$vnl_nesting = "yui-gd";
//$vnl_template = "yui-t2";
//$vnl_utility = "yui-bg";
// create a new PHPTAL template object
$template = new PHPTAL(vanilla_get_template('posts/category.html'));
$template->cleanUpCache();
$cat_title = '<a href="' . get_category_link(intval(get_query_var('cat'))) . '" title="">' . single_cat_title('', false) . '</a>';
$cat_description = category_description();
$tpl["page"] = array("width" => $vnl_width, "nesting" => $vnl_nesting, "template" => $vnl_template, "utility" => $vnl_utility, "body_class" => sandbox_body_class(false), "bd_class" => "{$vnl_width} {$vnl_template}", "cat_title" => $cat_title, "cat_description" => $cat_description ? $cat_description : 0);
get_header();
vnl_include('loop');
vnl_include('nav-posts');
get_footer();
// Execute the PHPTAL template
vanilla_output_page($template);
Example #10
0
{
    global $post;
    $post = get_post($post);
    $attachments = array_values(get_children(array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID')));
    foreach ($attachments as $k => $attachment) {
        if ($attachment->ID == $post->ID) {
            break;
        }
    }
    $k = $prev ? $k - 1 : $k + 1;
    if (isset($attachments[$k])) {
        return wp_get_attachment_link($attachments[$k]->ID, 'thumbnail', true);
    }
}
// create a new PHPTAL template object
$template = new PHPTAL(vanilla_get_template('misc/image.html'));
$template->cleanUpCache();
get_header();
$four04 = 0;
if (have_posts()) {
    while (have_posts()) {
        the_post();
        $parent_permalink = get_permalink($post->post_parent);
        $parent_title = get_the_title($post->post_parent);
        $prev_image_link = vanilla_adjacent_image_link(true);
        $next_image_link = vanilla_adjacent_image_link(false);
        $image_url = wp_get_attachment_url($post->ID);
        $image_link = wp_get_attachment_image($post->ID, 'full aligncenter');
        $image_title = get_the_title();
        $image_caption = !empty($post->post_excerpt) ? get_the_excerpt() : 0;
        $image_description = get_the_content();
Example #11
0
	for your use of the Vanilla theme software and you represent and 
	warrant to Australis Media Pty Ltd that your use of the Vanilla
	theme software will comply with the CC-GNU-GPL.
*/
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
    die;
}
if (CFCT_DEBUG) {
    cfct_banner(__FILE__);
}
global $vnl_width, $vnl_nesting, $vnl_template, $vnl_utility, $tpl;
$vnl_width = isset($vnl_width) ? $vnl_width : vanilla_get_option("vnl_grid_width");
$vnl_nesting = isset($vnl_nesting) ? $vnl_nesting : vanilla_get_option("vnl_grid_nesting");
$vnl_template = isset($vnl_template) ? $vnl_template : vanilla_get_option("vnl_grid_template");
$vnl_utility = isset($vnl_utility) ? $vnl_utility : vanilla_get_option("vnl_utility_nesting");
// Page-specific overides
//$vnl_width = "yui-d3";
$vnl_nesting = "yui-gf";
$vnl_template = "yui-t2";
//$vnl_utility = "yui-bg";
// create a new PHPTAL template object
$template = new PHPTAL(vanilla_get_template('single/single-default.html'));
$template->cleanUpCache();
$tpl["page"] = array("width" => $vnl_width, "nesting" => $vnl_nesting, "template" => $vnl_template, "utility" => $vnl_utility, "body_class" => sandbox_body_class(false), "bd_class" => $vnl_width . " " . $vnl_template);
get_header();
the_post();
vnl_include('content');
comments_template();
get_footer();
// Execute the PHPTAL template
vanilla_output_page($template);
Example #12
0
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// **********************************************************************
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
    die;
}
if (CFCT_DEBUG) {
    cfct_banner(__FILE__);
}
global $vnl_width, $vnl_nesting, $vnl_template, $vnl_utility, $tpl;
$vnl_width = isset($vnl_width) ? $vnl_width : vanilla_get_option("vnl_grid_width");
$vnl_nesting = isset($vnl_nesting) ? $vnl_nesting : vanilla_get_option("vnl_grid_nesting");
$vnl_template = isset($vnl_template) ? $vnl_template : vanilla_get_option("vnl_grid_template");
$vnl_utility = isset($vnl_utility) ? $vnl_utility : vanilla_get_option("vnl_utility_nesting");
// Page-specific overides
//$vnl_width = "yui-d3";
//$vnl_nesting = "yui-gf";
//$vnl_template = "yui-t2";
//$vnl_utility = "yui-bg";
// create a new PHPTAL template object
$template = new PHPTAL(vanilla_get_template('pages/pages-default.html'));
$template->cleanUpCache();
$tpl["page"] = array("width" => $vnl_width, "nesting" => $vnl_nesting, "template" => $vnl_template, "utility" => $vnl_utility, "body_class" => sandbox_body_class(false), "bd_class" => $vnl_width . " " . $vnl_template);
get_header();
cfct_loop();
cfct_comments();
get_footer();
// Execute the PHPTAL template
vanilla_output_page($template);
Example #13
0
	terms of that license. You agree that you are solely responsible
	for your use of the Vanilla theme software and you represent and 
	warrant to Australis Media Pty Ltd that your use of the Vanilla
	theme software will comply with the CC-GNU-GPL.
*/
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
    die;
}
if (CFCT_DEBUG) {
    cfct_banner(__FILE__);
}
global $vnl_width, $vnl_nesting, $vnl_template, $vnl_utility, $tpl;
$vnl_width = isset($vnl_width) ? $vnl_width : vanilla_get_option("vnl_grid_width");
$vnl_nesting = isset($vnl_nesting) ? $vnl_nesting : vanilla_get_option("vnl_grid_nesting");
$vnl_template = isset($vnl_template) ? $vnl_template : vanilla_get_option("vnl_grid_template");
$vnl_utility = isset($vnl_utility) ? $vnl_utility : vanilla_get_option("vnl_utility_nesting");
// Page-specific overides
//$vnl_width = "yui-d3";
//$vnl_nesting = "yui-gd";
//$vnl_template = "yui-t2";
//$vnl_utility = "yui-bg";
// create a new PHPTAL template object
$template = new PHPTAL(vanilla_get_template('posts/posts-default.html'));
$template->cleanUpCache();
$tpl["page"] = array("width" => $vnl_width, "nesting" => $vnl_nesting, "template" => $vnl_template, "utility" => $vnl_utility, "body_class" => sandbox_body_class(false), "bd_class" => $vnl_width . " " . $vnl_template);
get_header();
vnl_include('loop');
vnl_include('nav-posts');
get_footer();
// Execute the PHPTAL template
vanilla_output_page($template);