1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
<?php
/**
* Misc Functions to be called from the template
*
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
* @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
*
* @package evocore
* @author This file built upon code from original b2 - http://cafelog.com/
*/
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
/**
* Includes:
*/
require_once( dirname(__FILE__).'/_functions_cats.php' );
require_once( dirname(__FILE__).'/_functions_blogs.php' );
require_once( dirname(__FILE__).'/_functions_bposts.php' );
require_once( dirname(__FILE__).'/_functions_comments.php' );
require_once( dirname(__FILE__).'/_functions_trackback.php' );
require_once( dirname(__FILE__).'/_functions_pingback.php' );
/**
* Template function: output base URL to b2evo's image folder
*
* {@internal imgbase(-)}}
*/
function imgbase()
{
global $img_url;
echo $img_url, '/';
}
/**
* single_month_title(-)
*
* fplanque: 0.8.3: changed defaults
*
* @todo Respect locales datefmt
*
* @param string prefix to display, default is 'Archives for: '
* @param string format to output, default 'htmlbody'
* @param boolean show the year as link to year's archive (in monthly mode)
*/
function single_month_title( $prefix = '#', $display = 'htmlbody', $linktoyeararchive = true, $blogurl = '', $params = '' )
{
global $m, $w, $month;
if( $prefix == '#' ) $prefix = ' '.T_('Archives for').': ';
if( !empty($m) && $display )
{
$my_year = substr($m,0,4);
if( strlen($m) > 4 )
$my_month = T_($month[substr($m,4,2)]);
else
$my_month = '';
$my_day = substr($m,6,2);
if( $display == 'htmlbody' && !empty( $my_month ) && $linktoyeararchive )
{ // display year as link to year's archive
$my_year = '<a href="' . archive_link( $my_year, '', '', '', false, $blogurl, $params ) . '">' . $my_year . '</a>';
}
$title = $prefix.$my_month.' '.$my_year;
if( !empty( $my_day ) )
{ // We also want to display a day
$title .= ", $my_day";
}
if( !empty($w) && ($w>=0) ) // Note: week # can be 0
{ // We also want to display a week number
$title .= ", week $w";
}
echo format_to_output( $title, $display );
}
}
/**
* Display "Archive Directory" title if it has been requested
*
* {@internal arcdir_title(-) }}
*
* @param string Prefix to be displayed if something is going to be displayed
* @param mixed Output format, see {@link format_to_output()} or false to
* return value instead of displaying it
*/
function arcdir_title( $prefix = ' ', $display = 'htmlbody' )
{
global $disp;
if( $disp == 'arcdir' )
{
$info = $prefix.T_('Archive Directory');
if ($display)
echo format_to_output( $info, $display );
else
return $info;
}
}
/**
* Create a link to archive
*
* {@internal archive_link(-)}}
*
* @param string year
* @param string month
* @param string day
* @param string week
* @param boolean show or return
* @param string link, instead of blogurl
* @param string GET params for 'file'
*/
function archive_link( $year, $month, $day = '', $week = '', $show = true, $file = '', $params = '' )
{
global $Settings;
if( empty($file) )
$link = get_bloginfo('blogurl');
else
$link = $file;
if( (! $Settings->get('links_extrapath')) || (!empty($params)) )
{ // We reference by Query: Dirty but explicit permalinks
$link = url_add_param( $link, $params );
$link = url_add_param( $link, 'm=' );
$separator = '';
}
else
{
$link .= '/';
$separator = '/';
}
$link .= $year;
if( !empty( $month ) )
{
$link .= $separator.zeroise($month,2);
if( !empty( $day ) )
{
$link .= $separator.zeroise($day,2);
}
}
elseif( $week !== '' ) // Note: week # can be 0 !
{
if( ! $Settings->get('links_extrapath') )
{ // We reference by Query: Dirty but explicit permalinks
$link = url_add_param( $link, 'w='.$week );
}
else
{
$link .= '/w'.zeroise($week,2);
}
}
$link .= $separator;
if( $show )
{
echo $link;
}
return $link;
}
?>
|