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_CITY_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.     if (array_key_exists('rub'$array)) {
  41.       $url_maked .= $array['rub'];
  42.     }
  43.     if (array_key_exists('filter'$array)) {
  44.       $url_maked .= URI_SEPARATOR '@@'.$array['filter'];
  45.     }
  46.     if (array_key_exists('name'$array)) {
  47.       $url_maked .= URI_SEPARATOR stripText(stripAccents($array['name']))','$array['id'];
  48.     }
  49.     else {
  50.       if (array_key_exists('id'$array)) {
  51.  
  52.         $url_maked .= URI_SEPARATOR $array['id'];
  53.       }
  54.     }
  55.     if (array_key_exists('parentid'$array)) {
  56.       $url_maked .= URI_SEPARATOR $array['parentid'];
  57.     }
  58.     if (array_key_exists('parentparentid'$array)) {
  59.       $url_maked .= URI_SEPARATOR $array['parentparentid'];
  60.     }
  61.     if (array_key_exists('debut'$array)) {
  62.       $url_maked .= URI_SEPARATOR '-' $array['debut''-' ;
  63.     }
  64.     $url_maked .= '.html';
  65.   }
  66.   else
  67.   {
  68.     $url_maked get_permalink($array);
  69.   }
  70.   return $url_maked;
  71. }
  72.  
  73. /**
  74.  * display_permalink()
  75.  * Display permalink
  76.  * @param array $array 
  77.  * @return string 
  78.  */
  79. function formatted_permalink($array$sep ''{
  80.  
  81.   if(defined('MOD_REWRITE'&& MOD_REWRITE == 1{
  82.     return $sep.'<a href="'.get_permalink($array).'" title="'_t('divers','permalink').'" class="permalink"><span>'._t('divers','permalink').'</span></a>';
  83.   else {
  84.     return '';
  85.   }
  86. }
  87.  
  88. /**
  89.  * get_permalink()
  90.  * Get permalink
  91.  * @param array $array 
  92.  * @return string 
  93.  */
  94. function get_permalink($array{
  95.   if(isset($array['name'])) unset($array['name']);
  96.   if(isset($array['rewrite_override'])) unset($array['rewrite_override']);
  97.   if (function_exists('http_build_query')) $url_string http_build_query($array);
  98.   else {
  99.     $url_string '';
  100.     $sep '';
  101.     while (list($key$valueeach ($array)) {
  102.       if (!empty($value)) {
  103.         $url_string .= $sep $key '=' $value;
  104.         $sep OUTPUT_SEP;
  105.       }
  106.     }
  107.   }
  108.   $url_maked 'index.php?' $url_string;
  109.  
  110.   return $url_maked;
  111. }
  112.  
  113. /**
  114.  * DisplayTemplate()
  115.  * Include the required template
  116.  * if no user template is found in /public/
  117.  * includes the /public/dist/ version.
  118.  *
  119.  * @return void 
  120.  ***/
  121. function DisplayTemplate()
  122. {
  123.   $key ActiveItemKey($GLOBALS['activeitem']);
  124.   $current_template $GLOBALS['links'][LANGUAGE][$key]['template'];
  125.   distInclude(THEME_PUBLIC_PATH.'tpl_' $current_template '.php'THEME_PUBLIC_DIST);
  126. }
  127.  
  128. /**
  129.  * ActiveItem()
  130.  * Détermine l'item actif et le place en var global
  131.  *
  132.  * @return void 
  133.  */
  134. function ActiveItem()
  135. {
  136.   if (array_key_exists('rub'$_REQUEST)) $GLOBALS['activeitem'$_REQUEST['rub'];
  137.   else $GLOBALS['activeitem'$GLOBALS['links'][LANGUAGE]['home']['linkvalue'];
  138. }
  139.  
  140. /**
  141.  * ActiveItemKey()
  142.  * Return the Active item key
  143.  * @param string $item 
  144.  * @return string 
  145.  ***/
  146. function ActiveItemKey($item)
  147. {
  148.   foreach ($GLOBALS['links'][LANGUAGEas $key => $value{
  149.     if ($GLOBALS['links'][LANGUAGE][$key]['linkvalue'== $item)  return $key;
  150.   }
  151.   return false;
  152. }
  153.  
  154. /**
  155.  * ActiveItemAlias()
  156.  * Return the active item
  157.  * or its alias
  158.  * @param string $item 
  159.  * @return string 
  160.  ***/
  161. function ActiveItemAlias($item)
  162. {
  163.   $key ActiveItemKey($item);
  164.   if ($GLOBALS['links'][LANGUAGE][$key]['alias'=== falsereturn $key;
  165.   else return $GLOBALS['links'][LANGUAGE][$key]['alias'];
  166. }
  167.  
  168. ?>

Documentation generated on Fri, 16 Oct 2009 09:34:22 +0200 by phpDocumentor 1.4.1