b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (0.9.x) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _functions_skins.php

Documentation is available at _functions_skins.php

  1. <?php
  2. /**
  3.  * evoSkins support functions
  4.  * 
  5.  * b2evolution - {@link http://b2evolution.net/}
  6.  * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
  7.  * @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
  8.  *
  9.  * @package evocore
  10.  */
  11. if!defined('DB_USER') ) die'Please, do not access this page directly.' );
  12.  
  13. /**
  14.  * Template function: output base URL to current skin
  15.  *
  16.  * {@internal skinbase(-)}}
  17.  */
  18. function skinbase()
  19. {
  20.     global $baseurl$skins_subdir$skin$blog;
  21.     
  22.     if!empty$skin ) )
  23.     {
  24.         echo "$baseurl/$skins_subdir/$skin/";
  25.     }
  26.     else
  27.     {    // No skin used:
  28.         ifisset$blog && $blog )
  29.         {
  30.             bloginfo'baseurl''raw' );
  31.         }
  32.         else
  33.         {
  34.             echo "$baseurl/";
  35.         }
  36.     }
  37. }
  38.  
  39.  
  40. /**
  41.  * checks if a skin exists
  42.  *
  43.  * {@internal skin_exists(-)}}
  44.  *
  45.  * @return boolean true is exists, false if not
  46.  * @param skin name (directory name)
  47.  */
  48. function skin_exists$name )
  49. {
  50.     return is_dir(get_path'skins' ).'/'.$name);
  51. }
  52.  
  53.  
  54. /**
  55.  * Outputs an <option> set with default skin selected
  56.  *
  57.  * skin_options(-)
  58.  *
  59.  */
  60. function skin_options$default '' )
  61. {
  62.     forskin_list_start()skin_list_next())
  63.     {
  64.         echo '<option value="';
  65.         skin_list_iteminfo'name' );
  66.         echo '"';
  67.         ifskin_list_iteminfo'name',false == $default echo ' selected="selected" ';
  68.         echo '>';
  69.         skin_list_iteminfo'name' );
  70.         echo "</option>\n";
  71.     }
  72. }
  73.  
  74. /** 
  75.  * Initializes skin list iterator
  76.  *
  77.  * lists all folders in skin directory
  78.  *
  79.  * {@internal skin_list_start(-) }}
  80.  */
  81. function skin_list_start()
  82. {
  83.     global $skin_path$skin_dir;
  84.  
  85.     $skin_path get_path'skins' );
  86.     $skin_dir dir$skin_path );
  87. }
  88.  
  89.  
  90. /** 
  91.  * Get next skin
  92.  *
  93.  * Lists all folders in skin directory,
  94.  * except the ones starting with a . (UNIX style) or a _ (FrontPage style)
  95.  *
  96.  * {@internal skin_list_start(-) }}
  97.  *
  98.  * @return string skin name
  99.  */
  100. function skin_list_next()
  101. {
  102.     global $skin_path$skin_dir$skin_name;
  103.  
  104.     do
  105.     // Find next subfolder:
  106.         if!($skin_name $skin_dir->read()) )
  107.             return false;        // No more subfolder
  108.     while( ( is_dir($skin_path.'/'.$skin_name) )    // skip regular files
  109.                         || ($skin_name[0== '.')                                // skip UNIX hidden files/dirs
  110.                         || ($skin_name[0== '_')                                // skip FRONTPAGE hidden files/dirs
  111.                         || ($skin_name == 'CVS' ) );                        // Skip CVS directory
  112.     // echo 'ret=',  $skin_name;
  113.     return $skin_name;
  114. }
  115.  
  116.  
  117. /**
  118.  * skin_list_iteminfo(-)
  119.  * 
  120.  * Display info about item
  121.  *
  122.  * fplanque: created
  123.  */
  124. function skin_list_iteminfo$what=''$display true )
  125. {
  126.     global $skin_path$skin_name;
  127.  
  128.     switch$what )
  129.     {
  130.         case 'path':
  131.             $info $skin_path.'/'.$skin_name;
  132.         
  133.         case 'name':
  134.         default:
  135.             $info $skin_name;
  136.     }
  137.     
  138.     if$display echo $skin_name;
  139.     
  140.     return $skin_name;
  141. }
  142.  
  143.  
  144. /**
  145.  * skin_change_url(-)
  146.  */
  147. function skin_change_url()
  148. {
  149.     echo url_add_paramget_bloginfo('blogurl')'skin='.rawurlencode(skin_list_iteminfo('name',false)) );
  150. }
  151.  
  152. ?>

Documentation generated on Tue, 20 May 2008 01:55:03 +0200 by phpDocumentor 1.4.2