Initial import of Smarty Template Support.
Some of the WP template api has been wrapped in Smarty function calls. Added a Smartyised template of the default theme. A plugin directory has been created for Smarty plugins. Read wp-sitetemplates/readme.html for further information. git-svn-id: http://svn.automattic.com/wordpress/trunk@530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
794e199060
commit
8c8c4a38c8
|
@ -0,0 +1,262 @@
|
|||
<?php
|
||||
|
||||
if( is_object( $smarty ) == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
function smarty_bloginfo( $params )
|
||||
{
|
||||
$show = '';
|
||||
$display = true;
|
||||
extract( $params );
|
||||
return bloginfo($show, $display);
|
||||
}
|
||||
$smarty->register_function( 'bloginfo', 'smarty_bloginfo' );
|
||||
|
||||
function smarty_bloginfo_rss( $params )
|
||||
{
|
||||
$show = '';
|
||||
extract( $params );
|
||||
return bloginfo_rss($show);
|
||||
}
|
||||
$smarty->register_function( 'bloginfo_rss', 'smarty_bloginfo_rss' );
|
||||
|
||||
function smarty_bloginfo_unicode( $params )
|
||||
{
|
||||
$show = '';
|
||||
extract( $params );
|
||||
return bloginfo_unicode( $show );
|
||||
}
|
||||
$smarty->register_function( 'bloginfo_unicode', 'smarty_bloginfo_unicode' );
|
||||
|
||||
function smarty_get_bloginfo( $params )
|
||||
{
|
||||
$show = '';
|
||||
extract( $params );
|
||||
return get_bloginfo( $show );
|
||||
}
|
||||
$smarty->register_function( 'get_bloginfo', 'smarty_get_bloginfo' );
|
||||
|
||||
function smarty_single_post_title( $params )
|
||||
{
|
||||
$display = '';
|
||||
$prefix = '';
|
||||
extract( $params );
|
||||
return single_post_title( $prefix, $display );
|
||||
}
|
||||
$smarty->register_function( 'single_post_title', 'smarty_single_post_title' );
|
||||
|
||||
function smarty_single_cat_title( $params )
|
||||
{
|
||||
$display = '';
|
||||
$prefix = '';
|
||||
extract( $params );
|
||||
return single_cat_title( $prefix, $display );
|
||||
}
|
||||
$smarty->register_function( 'single_cat_title', 'smarty_single_cat_title' );
|
||||
|
||||
function smarty_single_month_title( $params )
|
||||
{
|
||||
$display = '';
|
||||
$prefix = '';
|
||||
extract( $params );
|
||||
return single_month_title( $prefix, $display );
|
||||
}
|
||||
$smarty->register_function( 'single_month_title', 'smarty_single_month_title' );
|
||||
|
||||
function smarty_get_archives_link( $params )
|
||||
{
|
||||
$format = 'html';
|
||||
$before = '';
|
||||
$after = '';
|
||||
extract( $params );
|
||||
return get_archives_link( $url, $text, $format, $before, $after );
|
||||
}
|
||||
$smarty->register_function( 'single_month_title', 'smarty_single_month_title' );
|
||||
|
||||
function smarty_get_archives( $params )
|
||||
{
|
||||
$type = '';
|
||||
$limit = '';
|
||||
$format = 'html';
|
||||
$before = '';
|
||||
$after = '';
|
||||
extract( $params );
|
||||
return get_archives( $type, $limit, $format, $before, $after );
|
||||
}
|
||||
$smarty->register_function( 'get_archives', 'smarty_get_archives' );
|
||||
|
||||
function smarty_the_date_xml()
|
||||
{
|
||||
return the_date_xml();
|
||||
}
|
||||
$smarty->register_function( 'the_date_xml', 'smarty_the_date_xml' );
|
||||
|
||||
function smarty_the_date( $params )
|
||||
{
|
||||
$d = '';
|
||||
$before = '';
|
||||
$after = '';
|
||||
$echo = true;
|
||||
extract( $params );
|
||||
return the_date( $d, $before, $after, $echo );
|
||||
}
|
||||
$smarty->register_function( 'the_date', 'smarty_the_date' );
|
||||
|
||||
function smarty_the_time( $params )
|
||||
{
|
||||
$d = '';
|
||||
$echo = true;
|
||||
extract( $params );
|
||||
return the_time( $d, $echo );
|
||||
}
|
||||
$smarty->register_function( 'the_time', 'smarty_the_time' );
|
||||
|
||||
function smarty_the_weekday()
|
||||
{
|
||||
return the_weekday();
|
||||
}
|
||||
$smarty->register_function( 'the_weekday', 'smarty_the_weekday' );
|
||||
|
||||
function smarty_the_weekday_date( $params )
|
||||
{
|
||||
$before='';
|
||||
$after='';
|
||||
extract( $params );
|
||||
return the_weekday_date( $before, $after );
|
||||
|
||||
}
|
||||
$smarty->register_function( 'the_weekday_date', 'smarty_the_weekday_date' );
|
||||
|
||||
function smarty_get_Lat() {
|
||||
return get_Lat();
|
||||
}
|
||||
$smarty->register_function( 'get_Lat', 'smarty_get_Lat' );
|
||||
|
||||
function smarty_get_Lon() {
|
||||
return get_Lon();
|
||||
}
|
||||
$smarty->register_function( 'get_Lon', 'smarty_get_Lon' );
|
||||
|
||||
function smarty_the_ID()
|
||||
{
|
||||
return the_ID();
|
||||
}
|
||||
$smarty->register_function( 'the_ID', 'smarty_the_ID' );
|
||||
|
||||
function smarty_permalink_link( $params )
|
||||
{
|
||||
$file='';
|
||||
$mode = 'id';
|
||||
extract( $params );
|
||||
return permalink_link( $file, $mode );
|
||||
}
|
||||
$smarty->register_function( 'permalink_link', 'smarty_permalink_link' );
|
||||
|
||||
function smarty_the_title( $params )
|
||||
{
|
||||
$before='';
|
||||
$after='';
|
||||
$echo=true;
|
||||
extract( $params );
|
||||
return the_title( $before, $after, $echo);
|
||||
}
|
||||
$smarty->register_function( 'the_title', 'smarty_the_title' );
|
||||
|
||||
function smarty_the_category_ID( $params )
|
||||
{
|
||||
$echo=true;
|
||||
extract( $params );
|
||||
return the_category_ID( $echo );
|
||||
}
|
||||
$smarty->register_function( 'the_category_ID', 'smarty_the_category_ID' );
|
||||
$smarty->register_function( 'the_category', 'the_category' );
|
||||
$smarty->register_function( 'the_author', 'the_author' );
|
||||
|
||||
function smarty_the_content( $params )
|
||||
{
|
||||
$more_link_text='(more...)';
|
||||
$stripteaser=0;
|
||||
$more_file='';
|
||||
extract( $params );
|
||||
return the_content( $more_link_text, $stripteaser, $more_file );
|
||||
}
|
||||
$smarty->register_function( 'the_content', 'smarty_the_content' );
|
||||
|
||||
function smarty_link_pages( $params )
|
||||
{
|
||||
$before='<br />';
|
||||
$after='<br />';
|
||||
$next_or_number='number';
|
||||
$nextpagelink='next page';
|
||||
$previouspagelink='previous page';
|
||||
$pagelink='%';
|
||||
$more_file='';
|
||||
extract( $params );
|
||||
return link_pages( $before, $after, $next_or_number, $nextpagelink, $previouspagelink, $pagelink, $more_file);
|
||||
}
|
||||
$smarty->register_function( 'link_pages', 'smarty_link_pages' );
|
||||
|
||||
function smarty_comments_popup_link( $params )
|
||||
{
|
||||
$zero='No Comments';
|
||||
$one='1 Comment';
|
||||
$more='% Comments';
|
||||
$CSSclass='';
|
||||
$none='Comments Off';
|
||||
extract( $params );
|
||||
return comments_popup_link( $zero, $one, $more, $CSSclass, $none );
|
||||
}
|
||||
$smarty->register_function( 'comments_popup_link', 'smarty_comments_popup_link' );
|
||||
|
||||
function smarty_trackback_rdf( $params )
|
||||
{
|
||||
$timezone = 0;
|
||||
extract( $params );
|
||||
return trackback_rdf( $timezone );
|
||||
}
|
||||
$smarty->register_function( 'trackback_rdf', 'smarty_trackback_rdf' );
|
||||
|
||||
function smarty_comments_popup_script( $params )
|
||||
{
|
||||
$width=400;
|
||||
$height=400;
|
||||
$file='b2commentspopup.php';
|
||||
extract( $params );
|
||||
return comments_popup_script( $width, $height, $file );
|
||||
}
|
||||
$smarty->register_function( 'comments_popup_script', 'smarty_comments_popup_script' );
|
||||
|
||||
function smarty_get_links( $params )
|
||||
{
|
||||
extract($params);
|
||||
get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, true );
|
||||
}
|
||||
$smarty->register_function( 'get_links', 'smarty_get_links' );
|
||||
|
||||
function smarty_list_cats( $params )
|
||||
{
|
||||
extract($params);
|
||||
list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty);
|
||||
}
|
||||
$smarty->register_function( 'list_cats', 'smarty_list_cats' );
|
||||
|
||||
function smarty_timer_stop( $params )
|
||||
{
|
||||
$display = 0;
|
||||
$precision = 3;
|
||||
extract($params);
|
||||
timer_stop( $display, $precision );
|
||||
}
|
||||
$smarty->register_function( 'timer_stop', 'smarty_timer_stop' );
|
||||
|
||||
function smarty_get_calendar( $params )
|
||||
{
|
||||
$daylength = 1;
|
||||
extract($params);
|
||||
get_calendar( $daylength );
|
||||
}
|
||||
$smarty->register_function( 'get_calendar', 'smarty_get_calendar' );
|
||||
|
||||
?>
|
|
@ -0,0 +1,45 @@
|
|||
<?php /* Don't remove these lines, they call the b2 function files ! */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
require_once( 'Smarty.class.php' );
|
||||
$smarty = new Smarty;
|
||||
$smarty->template_dir = './wp-blogs/main/templates';
|
||||
$smarty->compile_dir = './wp-blogs/main/templates_c';
|
||||
$smarty->cache_dir = './wp-blogs/main/smartycache';
|
||||
$smarty->plugin_dir = './wp-plugins';
|
||||
require_once( 'b2-include/smarty.inc.php' );
|
||||
$blog = 1;
|
||||
require_once('blog.header.php');
|
||||
require_once($abspath.'wp-links/links.php');
|
||||
// not on by default: require_once($abspath.'wp-links/links.weblogs.com.php');
|
||||
|
||||
define( 'NODISPLAY', false );
|
||||
|
||||
$smarty->assign( 'siteurl', $siteurl );
|
||||
$smarty->assign( 'b2_version', $b2_version );
|
||||
|
||||
if($posts)
|
||||
{
|
||||
foreach ($posts as $post)
|
||||
{
|
||||
start_b2();
|
||||
$content .= $smarty->fetch( 'post.html' );
|
||||
ob_start();
|
||||
include($abspath . 'b2comments.php');
|
||||
$txt = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$content .= $txt;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = 'No posts made';
|
||||
}
|
||||
|
||||
$smarty->assign( 'content', $content );
|
||||
$smarty->display( 'top.html' );
|
||||
|
||||
$smarty->display( 'end.html' );
|
||||
|
||||
?>
|
Loading…
Reference in New Issue