linea21-utils
[ class tree: linea21-utils ] [ index: linea21-utils ] [ all elements ]

Source for file items.php

Documentation is available at items.php

  1. <?php
  2. /**
  3.  * @package linea21.utils
  4.  * @subpackage lib
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. /**
  12.  * SetHTMLTitle()
  13.  * Aggregate string
  14.  * to the global array $GLOBALS['current_title']
  15.  * @param $str string
  16.  * @return void 
  17.  */
  18. function SetHTMLTitle($str)
  19. {
  20.   if(count($GLOBALS['current_title']== 0array_push($GLOBALS['current_title']SITE_NAME);
  21.   array_push($GLOBALS['current_title']$str);
  22. }
  23.  
  24.  
  25.  
  26. /**
  27.  * HrefMaker()
  28.  * Generated a well-formed string URL for SEO
  29.  * if MOD_REWRITE is set to 1
  30.  * Can be override if the given array contains a key
  31.  * named 'rewrite_override'
  32.  * @param array $array 
  33.  * @return string $url_maked
  34.  ***/
  35. function HrefMaker($array)
  36. {
  37.   $url_maked '';
  38.  
  39.   if (defined("MOD_REWRITE"&& MOD_REWRITE == true && !in_array('rewrite_override'$array)) {
  40.      
  41.     if(in_array('#'$array)) {
  42.       $anchor '#'.$array['#'];
  43.     else {
  44.       $anchor '';
  45.     }
  46.      
  47.     if (array_key_exists('rub'$array)) {
  48.       $url_maked .= $array['rub'];
  49.     }
  50.     if (array_key_exists('filter'$array)) {
  51.       $url_maked .= URI_SEPARATOR '@@'.$array['filter'];
  52.     }
  53.     if (array_key_exists('name'$array)) {
  54.       $url_maked .= URI_SEPARATOR stripText(stripAccents($array['name']))','$array['id'];
  55.     }
  56.     else {
  57.       if (array_key_exists('id'$array)) {
  58.  
  59.         $url_maked .= URI_SEPARATOR $array['id'];
  60.       }
  61.     }
  62.     if (array_key_exists('parentid'$array)) {
  63.       $url_maked .= URI_SEPARATOR $array['parentid'];
  64.     }
  65.     if (array_key_exists('parentparentid'$array)) {
  66.       $url_maked .= URI_SEPARATOR $array['parentparentid'];
  67.     }
  68.     if (array_key_exists('debut'$array)) {
  69.       $url_maked .= URI_SEPARATOR '-' $array['debut''-' ;
  70.     }
  71.     $url_maked .= '.html'.$anchor;
  72.   }
  73.   else
  74.   {
  75.     $url_maked get_permalink($array);
  76.   }
  77.   return $url_maked;
  78. }
  79.  
  80. /**
  81.  * display_permalink()
  82.  * Display permalink
  83.  * @param array $array 
  84.  * @return string 
  85.  */
  86. function formatted_permalink($array$sep ''{
  87.  
  88.   if(defined('MOD_REWRITE'&& MOD_REWRITE == 1{
  89.     return $sep.'<a href="'.get_permalink($array).'" title="'_t('divers','permalink').'" class="permalink"><span>'._t('divers','permalink').'</span></a>';
  90.   else {
  91.     return '';
  92.   }
  93. }
  94.  
  95. /**
  96.  * get_permalink()
  97.  * Get permalink
  98.  * @param array $array 
  99.  * @return string 
  100.  */
  101. function get_permalink($array{
  102.   if(isset($array['name'])) unset($array['name']);
  103.   if(isset($array['#'])) {
  104.     $anchor '#'.$array['#'];
  105.     unset($array['#']);
  106.   else {
  107.     $anchor '';
  108.   }
  109.   if(isset($array['rewrite_override'])) unset($array['rewrite_override']);
  110.   if (function_exists('http_build_query')) $url_string http_build_query($array);
  111.   else {
  112.     $url_string '';
  113.     $sep '';
  114.     while (list($key$valueeach ($array)) {
  115.       if (!empty($value)) {
  116.         $url_string .= $sep $key '=' $value;
  117.         $sep OUTPUT_SEP;
  118.       }
  119.     }
  120.   }
  121.   $url_maked 'index.php?' $url_string.$anchor;
  122.  
  123.   return $url_maked;
  124. }
  125.  
  126. /**
  127.  * DisplayTemplate()
  128.  * Include the required template
  129.  * if no user template is found in /public/
  130.  * includes the /public/dist/ version.
  131.  *
  132.  * @return void 
  133.  ***/
  134. function DisplayTemplate()
  135. {
  136.   $key ActiveItemKey($GLOBALS['activeitem']);
  137.   $current_template $GLOBALS['links'][U_L][$key]['template'];
  138.   distInclude(THEME_PUBLIC_PATH.'tpl_' $current_template '.php'THEME_PUBLIC_DIST);
  139. }
  140.  
  141. /**
  142.  * ActiveItem()
  143.  * Détermine l'item actif et le place en var global
  144.  *
  145.  * @return void 
  146.  */
  147. function ActiveItem()
  148. {
  149.   if (array_key_exists('rub'$_REQUEST)) $GLOBALS['activeitem'$_REQUEST['rub'];
  150.   else $GLOBALS['activeitem'$GLOBALS['links'][U_L]['home']['linkvalue'];
  151. }
  152.  
  153. /**
  154.  * ActiveItemKey()
  155.  * Return the Active item key
  156.  * @param string $item 
  157.  * @return string 
  158.  ***/
  159. function ActiveItemKey($item)
  160. {
  161.   foreach ($GLOBALS['links'][U_Las $key => $value{
  162.     if ($GLOBALS['links'][U_L][$key]['linkvalue'== $item)  return $key;
  163.   }
  164.   return false;
  165. }
  166.  
  167. /**
  168.  * ActiveItemAlias()
  169.  * Return the active item
  170.  * or its alias
  171.  * @param string $item 
  172.  * @return string 
  173.  ***/
  174. function ActiveItemAlias($item)
  175. {
  176.   $key ActiveItemKey($item);
  177.  
  178.   if($key == nullheader("Location: error.php");
  179.   if ($GLOBALS['links'][U_L][$key]['alias'=== falsereturn $key;
  180.   else return $GLOBALS['links'][U_L][$key]['alias'];
  181. }
  182.  
  183. ?>

Documentation generated on Fri, 01 Apr 2011 09:31:45 +0200 by phpDocumentor 1.4.1