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
|
<?php
/**
* evoSkins support functions
*
* 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
*/
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
/**
* Template function: output base URL to current skin
*
* {@internal skinbase(-)}}
*/
function skinbase()
{
global $baseurl, $skins_subdir, $skin, $blog;
if( !empty( $skin ) )
{
echo "$baseurl/$skins_subdir/$skin/";
}
else
{ // No skin used:
if( isset( $blog ) && $blog > 0 )
{
bloginfo( 'baseurl', 'raw' );
}
else
{
echo "$baseurl/";
}
}
}
/**
* checks if a skin exists
*
* {@internal skin_exists(-)}}
*
* @return boolean true is exists, false if not
* @param skin name (directory name)
*/
function skin_exists( $name )
{
return is_dir(get_path( 'skins' ).'/'.$name);
}
/**
* Outputs an <option> set with default skin selected
*
* skin_options(-)
*
*/
function skin_options( $default = '' )
{
for( skin_list_start(); skin_list_next(); )
{
echo '<option value="';
skin_list_iteminfo( 'name' );
echo '"';
if( skin_list_iteminfo( 'name',false ) == $default ) echo ' selected="selected" ';
echo '>';
skin_list_iteminfo( 'name' );
echo "</option>\n";
}
}
/**
* Initializes skin list iterator
*
* lists all folders in skin directory
*
* {@internal skin_list_start(-) }}
*/
function skin_list_start()
{
global $skin_path, $skin_dir;
$skin_path = get_path( 'skins' );
$skin_dir = dir( $skin_path );
}
/**
* Get next skin
*
* Lists all folders in skin directory,
* except the ones starting with a . (UNIX style) or a _ (FrontPage style)
*
* {@internal skin_list_start(-) }}
*
* @return string skin name
*/
function skin_list_next()
{
global $skin_path, $skin_dir, $skin_name;
do
{ // Find next subfolder:
if( !($skin_name = $skin_dir->read()) )
return false; // No more subfolder
} while( ( ! is_dir($skin_path.'/'.$skin_name) ) // skip regular files
|| ($skin_name[0] == '.') // skip UNIX hidden files/dirs
|| ($skin_name[0] == '_') // skip FRONTPAGE hidden files/dirs
|| ($skin_name == 'CVS' ) ); // Skip CVS directory
// echo 'ret=', $skin_name;
return $skin_name;
}
/**
* skin_list_iteminfo(-)
*
* Display info about item
*
* fplanque: created
*/
function skin_list_iteminfo( $what='', $display = true )
{
global $skin_path, $skin_name;
switch( $what )
{
case 'path':
$info = $skin_path.'/'.$skin_name;
case 'name':
default:
$info = $skin_name;
}
if( $display ) echo $skin_name;
return $skin_name;
}
/**
* skin_change_url(-)
*/
function skin_change_url()
{
echo url_add_param( get_bloginfo('blogurl'), 'skin='.rawurlencode(skin_list_iteminfo('name',false)) );
}
?>
|