示例#1
0
文件: Navigation.php 项目: trk/ionize
 /**
  * Standalone language tag
  *
  * @param 	FTL_Binding $tag
  *
  * @return 	string
  *
  * @usage	<ion:language>
  * 				<ion:code />
  * 				<ion:name />
  * 				<ion:url />
  * 				<ion:is_default />
  * 				<ion:is_active />
  * 			</ion:language>
  */
 public static function tag_language(FTL_Binding $tag)
 {
     if (is_null(self::$_current_language)) {
         $page = self::registry('page');
         foreach (Settings::get_languages() as $language) {
             if ($language['lang'] == Settings::get_lang()) {
                 $language['id'] = $language['lang'];
                 $language['absolute_url'] = $page['absolute_urls'][$language['lang']];
                 self::$_current_language = $language;
                 break;
             }
         }
     }
     $tag->set('language', self::$_current_language);
     return $tag->expand();
 }
示例#2
0
 /**
  * Get the current URL and feed the URL infos
  * 
  */
 public static function get_url_infos()
 {
     self::$ci =& get_instance();
     $uri = preg_replace("|/*(.+?)/*\$|", "\\1", self::$ci->uri->uri_string);
     self::$uri_segments = explode('/', $uri);
     // Returned data
     $infos = array('type' => 'page', 'page' => self::$uri_segments[0], 'article' => '');
     // Get the special URI config array (see /config/ionize.php)
     $uri_config = self::$ci->config->item('special_uri');
     // Get the potential special URI
     $special_uri = isset(self::$uri_segments[1]) && array_key_exists(self::$uri_segments[1], $uri_config) ? self::$uri_segments[1] : FALSE;
     // If a special URI exists, get the articles from it.
     if ($special_uri !== FALSE) {
         $infos['type'] = 'special';
         $infos['page'] = self::$uri_segments[0];
     } else {
         if (isset(self::$uri_segments[1])) {
             $infos['type'] = 'article';
             $infos['page'] = $uri_segments[0];
             $infos['article'] = self::$uri_segments[1];
         }
     }
     return $infos;
 }