当前位置: 首页>>代码示例>>PHP>>正文


PHP Settings::get_online_languages方法代码示例

本文整理汇总了PHP中Settings::get_online_languages方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::get_online_languages方法的具体用法?PHP Settings::get_online_languages怎么用?PHP Settings::get_online_languages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Settings的用法示例。


在下文中一共展示了Settings::get_online_languages方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: filter_on_published

 /**
  * Adds Published filtering on articles get_lang_list() call
  *
  * @param bool
  * @param null
  *
  */
 protected function filter_on_published($on = TRUE, $lang = NULL)
 {
     if ($on === TRUE) {
         $this->{$this->db_group}->where($this->parent_table . '.online', '1');
         if ($lang !== NULL && count(Settings::get_online_languages()) > 1) {
             $this->{$this->db_group}->where($this->lang_table . '.online', '1');
         }
         $this->{$this->db_group}->where('((article.publish_off > ', 'now()', FALSE);
         $this->{$this->db_group}->or_where('article.publish_off = ', '0)', FALSE);
         $this->{$this->db_group}->where('(article.publish_on < ', 'now()', FALSE);
         $this->{$this->db_group}->or_where('article.publish_on = ', '0))', FALSE);
     }
 }
开发者ID:pompalini,项目名称:emngo,代码行数:20,代码来源:search_model.php

示例2: feed

 /**
  * Show the feed
  *
  * @access	public
  * @return	parsed view
  */
 function feed($lang = FALSE)
 {
     $id_pages = explode(',', config_item('module_rss_pages'));
     $articles = $this->rss_model->get_articles($id_pages, $lang);
     // Articles ID array
     $articles_id = array();
     foreach ($articles as $article) {
         $articles_id[] = $article['id_article'];
     }
     // Pages context, regarding the articles ID
     $pages_context = $this->page_model->get_lang_contexts($articles_id, $lang);
     // Add pages contexts data to articles
     foreach ($articles as &$article) {
         $contexts = array();
         foreach ($pages_context as $context) {
             if ($context['id_article'] == $article['id_article']) {
                 $contexts[] = $context;
             }
         }
         $page = array_shift($contexts);
         // Find the Main Parent
         if (!empty($contexts)) {
             foreach ($contexts as $context) {
                 if ($context['main_parent'] == '1') {
                     $page = $context;
                 }
             }
         }
         // Article's URL
         $url = $article['url'];
         if (count(Settings::get_online_languages()) > 1) {
             $article['url'] = base_url() . $lang . '/' . $page['url'] . '/' . $url;
         } else {
             $article['url'] = base_url() . $page['url'] . '/' . $url;
         }
     }
     unset($article);
     // Sort the articles on date
     $kdate = array();
     foreach ($articles as $key => $article) {
         $kdate[$key] = strtotime($article['date']);
     }
     // Sort the results by realm occurences DESC first, by date DESC second.
     array_multisort($kdate, SORT_DESC, $articles);
     // Output the feed
     $this->output->set_header("Content-Type: application/rss+xml; charset=UTF-8");
     $this->load->view('rss', array('charset' => 'utf-8', 'language' => $lang, 'articles' => $articles));
 }
开发者ID:nbourguig,项目名称:ionize,代码行数:54,代码来源:rss.php

示例3: get_urls

 public function get_urls()
 {
     $get_all_lang = FALSE;
     $langs = Settings::get_online_languages();
     if (Settings::get('force_lang_urls') or count($langs) > 1) {
         $get_all_lang = TRUE;
     }
     $sql = "\r\n\t\t\tselect\r\n\t\t\t\tu.lang,\r\n\t\t\t\tu.path,\r\n\t\t\t\tp.priority,\r\n\t\t\t\tp.created,\r\n\t\t\t\tp.updated,\r\n\t\t\t\tp.publish_on,\r\n\t\t\t\tp.publish_off,\r\n\t\t\t\tp.logical_date\r\n\t\t\tfrom url u\r\n\t\t\tinner join page p on p.id_page = u.id_entity and p.has_url = 1\r\n\t\t\twhere\r\n\t\t\t\tu.type = 'page'\r\n\t\t\t\tand u.active = 1\r\n\t\t\t\tand u.canonical = 1\r\n\t\t\t\tand p.priority > 0\r\n\t\t\t\tand (p.publish_off = '0000-00-00 00:00:00' OR p.publish_off > now())\r\n\t\t";
     if (!$get_all_lang) {
         $sql .= "\r\n\t\t\t\tand u.lang='" . Settings::get_lang('default') . "'\r\n\t\t\t";
     }
     $sql .= "\r\n\t\t\tunion\r\n\r\n\t\t\tselect\r\n\t\t\t\tu.lang,\r\n\t\t\t\tu.path,\r\n\t\t\t\ta.priority,\r\n\t\t\t\ta.created,\r\n\t\t\t\ta.updated,\r\n\t\t\t\ta.publish_on,\r\n\t\t\t\ta.publish_off,\r\n\t\t\t\ta.logical_date\r\n\t\t\tfrom url u\r\n\t\t\tinner join article_lang al on al.id_article= u.id_entity and al.lang=u.lang and al.online=1\r\n\t\t\tinner join article a on a.id_article = al.id_article\r\n\t\t\twhere\r\n\t\t\t\tu.type = 'article'\r\n\t\t\t\tand u.active = 1\r\n\t\t\t\tand u.canonical = 1\r\n\t\t\t\tand a.indexed = 1\r\n\t\t\t\tand a.priority > 0\r\n\t\t\t\tand (a.publish_off = '0000-00-00 00:00:00' OR a.publish_off > now())\r\n\t\t";
     if (!$get_all_lang) {
         $sql .= "\r\n\t\t\t\tand u.lang='" . Settings::get_lang('default') . "'\r\n\t\t\t";
     }
     $query = $this->{$this->db_group}->query($sql);
     $data = $query->result_array();
     return $data;
 }
开发者ID:pompalini,项目名称:emngo,代码行数:19,代码来源:sitemap_model.php

示例4: tag_article_categories

 /**
  * Returns HTML categories links wrapped by the given tag
  *
  * @TODO : 	Add the open and closing tag for each anchor.
  *			Example : <li><a>... here is the anchor ... </a></li>
  *
  */
 public static function tag_article_categories($tag)
 {
     $data = array();
     // HTML Separatorof each category
     $separator = !empty($tag->attr['separator']) ? $tag->attr['separator'] : ' | ';
     // Make a link from each category or not. Default : TRUE
     $link = !empty($tag->attr['link']) && $tag->attr['link'] == 'false' ? FALSE : TRUE;
     // Field to return for each category. "title" by default, but can be "name", "subtitle'
     $field = !empty($tag->attr['field']) ? $tag->attr['field'] : 'title';
     // don't display the lang URL (by default)
     $lang_url = '';
     // Global tag and class, for memory
     $html_tag = !empty($tag->attr['tag']) ? $tag->attr['tag'] : FALSE;
     $class = !empty($tag->attr['class']) ? $tag->attr['class'] : FALSE;
     // Tag and class for each category, if set.
     $subtag = !empty($tag->attr['subtag']) ? $tag->attr['subtag'] : FALSE;
     $subclass = !empty($tag->attr['subclass']) ? ' class="' . $tag->attr['subclass'] . '"' : FALSE;
     // If lang attribute is set to TRUE, force the lang code to be in the URL
     // Usefull only if the website has only one language
     if (isset($tag->attr['lang']) && $tag->attr['lang'] == 'TRUE') {
         $lang_url = TRUE;
     }
     // Only returns the URL containing the lang code when languages > 1
     // or atribute lang set to TRUE
     if (count(Settings::get_online_languages()) > 1 or $lang_url === TRUE) {
         $lang_url = Settings::get_lang() . '/';
     }
     // Current page
     $page = $tag->locals->page;
     // Get the category URI segment from /config/ionize.php config file
     $uri_config = self::$ci->config->item('special_uri');
     $uri_config = array_flip($uri_config);
     $category_uri = $uri_config['category'];
     // Get the categories from current article
     $categories = $tag->locals->article['categories'];
     // Build the anchor array
     foreach ($categories as $category) {
         $category_string = '';
         if ($subtag !== FALSE) {
             // Set the local category, to get the class from current category
             $tag->locals->category = $category;
             $subclass = self::get_attribute($tag, 'subclass');
             $subtag = self::get_attribute($tag, 'subtag');
             // Replace the class and tag by the subclass and subtag
             $tag->attr['class'] = $subclass;
             $tag->attr['tag'] = $subtag;
             $category_string = self::wrap($tag, $category[$field]);
         } else {
             $category_string = $category[$field];
         }
         $url = anchor(base_url() . $lang_url . $page['name'] . '/' . $category_uri . '/' . $category['name'], $category_string);
         if ($link == TRUE) {
             $category_string = $url;
         }
         $data[] = $category_string;
         // To make nested tags working...
         //			$category['url'] = $url;
         //			$tag->locals->category = $category;
         //			$tag->expand();
     }
     $tag->attr['tag'] = $html_tag;
     $tag->attr['class'] = $class;
     return self::wrap($tag, implode($separator, $data));
 }
开发者ID:nbourguig,项目名称:ionize,代码行数:71,代码来源:Page.php

示例5: __construct

 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     // $this->output->enable_profiler(true);
     // Unlock filtering if admin or editor users is logged in
     //		$this->load->library('connect');
     $this->connect = Connect::get_instance();
     // Libraries
     $this->load->library('structure');
     $this->load->library('widget');
     // FTL parser
     //		require_once APPPATH.'libraries/ftl/parser.php';
     // Models
     //		$this->load->model('structure_model', '', true);
     $this->load->model('menu_model', '', true);
     // Modules config
     $this->get_modules_config();
     /*
      * Installed modules
      *
      */
     require APPPATH . 'config/modules.php';
     $installed_modules = $modules;
     foreach ($installed_modules as $module) {
         // Path to Module
         Finder::add_path(MODPATH . $module . '/');
     }
     /*
      * Theme
      *
      */
     // Set the current theme
     Theme::set_theme(Settings::get('theme'));
     // Theme config file
     // Overwrite Ionize standard config.
     if (is_file($file = Theme::get_theme_path() . 'config/config.php')) {
         include $file;
         if (!empty($config)) {
             foreach ($config as $k => $v) {
                 $this->config->set_item($k, $v);
             }
             unset($config);
         }
     }
     /*
      * Menus
      *
      */
     Settings::set('menus', $this->menu_model->get_list());
     /*
      * Language
      *
      */
     // Get all the website languages from DB and store them into config file "languages" key
     $languages = $this->settings_model->get_languages();
     // Put all DB languages array to Settings
     Settings::set_languages($languages);
     // Set all languages online if conected as editor or more
     if (Connect()->is('editors', true)) {
         Settings::set_all_languages_online();
     }
     // Simple languages code array, used to detect if Routers found language is in DB languages
     $online_lang_codes = array();
     foreach (Settings::get_online_languages() as $language) {
         $online_lang_codes[] = $language['lang'];
     }
     // If Router detected that the lang code is not in DB languages, set it to the DB default one
     if (!in_array(config_item('language_abbr'), $online_lang_codes)) {
         // Settings::get_lang('default') returns the DB default lang code
         Settings::set('current_lang', Settings::get_lang('default'));
         $this->config->set_item('language_abbr', Settings::get_lang('default'));
     } else {
         // Store the current lang code (found by Router) to Settings
         Settings::set('current_lang', config_item('language_abbr'));
     }
     // Lang dependant settings for the current language : Meta, etc.
     Settings::set_settings_from_list($this->settings_model->get_lang_settings(config_item('language_abbr')), 'name', 'content');
     /*
      * Static language
      *
      */
     $lang_folder = Theme::get_theme_path() . 'language/' . Settings::get_lang() . '/';
     $lang_files = array();
     // Core languages files : Including except "admin_lang.php"
     if (is_dir(APPPATH . 'language/' . Settings::get_lang())) {
         $lang_files = glob(APPPATH . 'language/' . Settings::get_lang() . '/*_lang.php', GLOB_BRACE);
         foreach ($lang_files as $key => $lang_file) {
             if ($lang_file == APPPATH . 'language/' . Settings::get_lang() . '/admin_lang.php') {
                 unset($lang_files[$key]);
             }
         }
     }
     // Theme languages files : Including. Can be empty
     $lf = glob(FCPATH . Theme::get_theme_path() . 'language/' . Settings::get_lang() . '/*_lang.php');
     if (!empty($lf)) {
         $lang_files = array_merge($lf, (array) $lang_files);
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zillatek-project-svn-to-git,代码行数:101,代码来源:MY_Controller.php

示例6: _filter_on_published

 /**
  * Filters the article  on published one
  *
  * @param bool $on
  * @param null $lang
  *
  */
 protected function _filter_on_published($on = TRUE, $lang = NULL)
 {
     if ($on === TRUE) {
         $this->{$this->db_group}->join('article_lang', 'article_lang.id_article = article.id_article', 'left');
         if (!is_null($lang)) {
             $this->{$this->db_group}->where('article_lang.lang', $lang);
         }
         $this->{$this->db_group}->where('page_article.online', '1');
         if ($lang !== NULL && count(Settings::get_online_languages()) > 1) {
             $this->{$this->db_group}->where('article_lang.online', '1');
         }
         $this->{$this->db_group}->where('((article.publish_off > ', 'now()', FALSE);
         $this->{$this->db_group}->or_where('article.publish_off = ', '0)', FALSE);
         $this->{$this->db_group}->where('(article.publish_on < ', 'now()', FALSE);
         $this->{$this->db_group}->or_where('article.publish_on = ', '0))', FALSE);
     }
 }
开发者ID:pompalini,项目名称:emngo,代码行数:24,代码来源:tag_model.php

示例7: get_base_url

 public static function get_base_url()
 {
     if (Authority::can('access', 'admin') && Settings::get('display_front_offline_content') == 1) {
         Settings::set_all_languages_online();
     }
     if (count(Settings::get_online_languages()) > 1) {
         return base_url() . Settings::get_lang() . '/';
     }
     return base_url();
 }
开发者ID:pompalini,项目名称:emngo,代码行数:10,代码来源:Tagmanager.php

示例8: init_articles_urls

 /**
  * Inits articles URLs
  * Get the contexts of all given articles and define each article correct URL
  *
  * @param $articles
  *
  */
 public function init_articles_urls(&$articles)
 {
     // Page URL key to use
     $page_url_key = config_item('url_mode') == 'short' ? 'url' : 'path';
     // Array of all articles IDs
     $articles_id = array();
     foreach ($articles as $article) {
         $articles_id[] = $article['id_article'];
     }
     // Articles contexts of all articles
     $pages_context = self::$ci->page_model->get_lang_contexts($articles_id, Settings::get_lang('current'));
     // Add pages contexts data to articles
     foreach ($articles as &$article) {
         $contexts = array();
         foreach ($pages_context as $context) {
             if ($context['id_article'] == $article['id_article']) {
                 $contexts[] = $context;
             }
         }
         $page = array_shift($contexts);
         // Get the context of the Main Parent
         if (!empty($contexts)) {
             foreach ($contexts as $context) {
                 if ($context['main_parent'] == '1') {
                     $page = $context;
                 }
             }
         }
         // Basic article URL : its lang URL (without "http://")
         $url = $article['url'];
         // Link ?
         if ($article['link_type'] != '') {
             // External
             if ($article['link_type'] == 'external') {
                 $article['absolute_url'] = $article['link'];
             } else {
                 if ($article['link_type'] == 'email') {
                     $article['absolute_url'] = auto_link($article['link'], 'both', TRUE);
                 } else {
                     // Article
                     if ($article['link_type'] == 'article') {
                         // Get the article to which this page links
                         $rel = explode('.', $article['link_id']);
                         $target_article = self::$ci->article_model->get_context($rel[1], $rel[0], Settings::get_lang('current'));
                         // Of course, only if not empty...
                         if (!empty($target_article)) {
                             // Get the article's parent page
                             $parent_page = self::$ci->page_model->get_by_id($rel[0], Settings::get_lang('current'));
                             if (!empty($parent_page)) {
                                 $article['absolute_url'] = $parent_page[$page_url_key] . '/' . $target_article['url'];
                             }
                         }
                     } else {
                         $target_page = self::$ci->page_model->get_by_id($article['link_id'], Settings::get_lang('current'));
                         // If target page is offline, 'path' is not set
                         if (isset($target_page[$page_url_key])) {
                             $article['absolute_url'] = $target_page[$page_url_key];
                         } else {
                             $article['absolute_url'] = '#';
                         }
                     }
                     $article['relative_url'] = $article['absolute_url'];
                     $article['relative_lang_url'] = $article['absolute_url'];
                     // Correct the URL : Lang + Base URL
                     if (count(Settings::get_online_languages()) > 1 or Settings::get('force_lang_urls') == '1') {
                         $article['absolute_url'] = Settings::get_lang('current') . '/' . $article['absolute_url'];
                         $article['relative_lang_url'] = $article['absolute_url'];
                     }
                     $article['absolute_url'] = base_url() . $article['absolute_url'];
                 }
             }
         } else {
             $article['relative_url'] = $article['relative_lang_url'] = $page[$page_url_key] . '/' . $url;
             if (count(Settings::get_online_languages()) > 1 or Settings::get('force_lang_urls') == '1') {
                 $article['relative_lang_url'] = Settings::get_lang('current') . '/' . $article['relative_url'];
                 $article['absolute_url'] = base_url() . $article['relative_lang_url'];
             } else {
                 $article['absolute_url'] = base_url() . $article['relative_url'];
             }
         }
     }
 }
开发者ID:pompalini,项目名称:emngo,代码行数:89,代码来源:Article.php

示例9: tag_languages

 /**
  * Languages tag
  * 
  * @param	FTL_Binding
  *
  * @return 	null|string
  *
  * @usage	<ion:languages [helper="helper:helper_method"]>
  * 				...
  * 			<ion:languages>
  *
  */
 public static function tag_languages(FTL_Binding $tag)
 {
     $languages = Authority::can('access', 'admin') && Settings::get('display_front_offline_content') == 1 ? Settings::get_languages() : Settings::get_online_languages();
     $page = self::registry('page');
     $article = self::registry('article');
     // Current active language class
     $active_class = $tag->getAttribute('active_class', 'active');
     // Ignore current language in output
     $ignore_current = $tag->getAttribute('ignore_current');
     // helper
     $helper = $tag->getAttribute('helper');
     $str = '';
     $tag->set('count', count($languages));
     foreach ($languages as $idx => &$lang) {
         $lang_code = $lang['lang'];
         $p_data = $page['languages'][$lang_code];
         if ($ignore_current == TRUE && $lang_code == Settings::get_lang('current')) {
             continue;
         }
         // Correct the Home page URL
         if ($p_data['online'] == 1 or $p_data['online'] == 0 && Authority::can('access', 'admin') && Settings::get('display_front_offline_content') == 1) {
             if ($page['home'] != 1) {
                 $lang['absolute_url'] = !empty($page['absolute_urls'][$lang_code]) ? $page['absolute_urls'][$lang_code] : base_url() . $lang_code;
             } else {
                 $lang['absolute_url'] = base_url() . $lang_code;
             }
         } else {
             $lang['absolute_url'] = NULL;
         }
         $lang['active_class'] = $lang_code == Settings::get_lang('current') ? $active_class : '';
         $lang['is_active'] = $lang_code == Settings::get_lang('current');
         $lang['id'] = $lang_code;
         if (!is_null($article)) {
             $a_data = $article['languages'][$lang_code];
             if (!is_null($a_data['url']) && $a_data['online'] == 1 or $a_data['online'] == 0 && Authority::can('access', 'admin') && Settings::get('display_front_offline_content') == 1) {
                 if ($page['home'] != 1) {
                     $lang['absolute_url'] .= '/' . $a_data['url'];
                 } else {
                     $lang['absolute_url'] .= '/' . $page['urls'][$lang_code] . '/' . $a_data['url'];
                 }
             } else {
                 $lang['absolute_url'] = NULL;
             }
         }
         // Tag locals
         $tag->set('language', $lang);
         $tag->set('id', $lang_code);
         $tag->set('absolute_url', $lang['absolute_url']);
         $tag->set('active_class', $lang['active_class']);
         $tag->set('is_active', $lang['is_active']);
         $tag->set('index', $idx);
         if (!is_null($lang['absolute_url'])) {
             $str .= $tag->expand();
         }
     }
     // Try to return the helper function result
     if ($str != '' && !is_null($helper)) {
         $helper_function = substr(strrchr($helper, ':'), 1) ? substr(strrchr($helper, ':'), 1) : 'get_language_navigation';
         $helper = strpos($helper, ':') !== FALSE ? substr($helper, 0, strpos($helper, ':')) : $helper;
         self::$ci->load->helper($helper);
         if (function_exists($helper_function)) {
             $nav = call_user_func($helper_function, $languages);
             return self::wrap($tag, $nav);
         }
     }
     return self::wrap($tag, $str);
 }
开发者ID:trk,项目名称:ionize,代码行数:79,代码来源:Navigation.php

示例10: build_multilingual_sitemap

 /**
  * Multilingual Sitemap build
  * Author: Bhagya Silva (http://www.about.me/bhagyas)
  * Uses the lib : http://signalkraft.com/sitemaps-for-codeigniter
  * @param bool $force
  */
 function build_multilingual_sitemap($force = FALSE)
 {
     $ci =& get_instance();
     $ci->config->load('sitemaps');
     $ci->load->model('notification_model', '', TRUE);
     $auto_create = config_item('sitemaps_auto_create');
     if ($auto_create or $force) {
         $ci->load->library('sitemaps');
         $ci->load->model('sitemap_model', '', TRUE);
         $get_all_lang = FALSE;
         $langs = Settings::get_online_languages();
         if (Settings::get('force_lang_urls') or count($langs) > 1) {
             $get_all_lang = TRUE;
         }
         $urls = $ci->sitemap_model->get_multilingual_urls();
         $multilingual_urls = array();
         //iterate every url and build a map based on the key
         foreach ($urls as $url) {
             $url['date'] = $url['created'];
             if (strtotime($url['updated']) > strtotime($url['date'])) {
                 $url['date'] = $url['updated'];
             }
             if (strtotime($url['publish_on']) > strtotime($url['date'])) {
                 $url['date'] = $url['publish_on'];
             }
             if (strtotime($url['logical_date']) > strtotime($url['date'])) {
                 $url['date'] = $url['logical_date'];
             }
             $loc = $get_all_lang == TRUE ? base_url() . $url['lang'] . '/' . $url['path'] : base_url() . $url['path'];
             $alternative_urls = array();
             foreach ($urls as $other_url) {
                 if ($other_url['lang'] != $url['lang'] && $other_url['id_'] == $url['id_']) {
                     $other_loc = $get_all_lang == TRUE ? base_url() . $other_url['lang'] . '/' . $other_url['path'] : base_url() . $other_url['path'];
                     $other_lang = $other_url['lang'];
                     $alternative_urls[$other_lang] = $other_loc;
                 }
             }
             $item = array('loc' => $loc, 'lang' => $url['lang'], 'lastmod' => date("c", strtotime($url['date'])), 'changefreq' => 'weekly', 'priority' => number_format($url['priority'] / 10, 1, '.', ''), 'alternative_urls' => $alternative_urls);
             array_push($multilingual_urls, $url['id_'], $item);
             $ci->sitemaps->add_item($item);
         }
         $ci->sitemaps->build_multilingual('sitemap.xml');
         // Set notifications as read
         $ci->notification_model->set_code_as_read('sitemap_refresh');
     } else {
         // Create one notification : The sitemap should be rebuild !
         $ci->notification_model->create_notification(lang('ionize_notification_title_sitemap_refresh'), lang('ionize_notification_message_sitemap_refresh'), 'sitemap_refresh', 'System', TRUE);
     }
 }
开发者ID:trk,项目名称:ionize,代码行数:55,代码来源:Structure.php

示例11: tag_languages

 /**
  * Languages tag
  * 
  * @param	FTL_Binding		The binded tag to parse
  *
  */
 public static function tag_languages($tag)
 {
     $languages = Settings::get_online_languages();
     //		$infos = self::get_url_infos();
     // Current active language class
     $active_class = isset($tag->attr['active_class']) ? $tag->attr['active_class'] : 'active';
     // helper
     $helper = isset($tag->attr['helper']) ? $tag->attr['helper'] : 'navigation';
     // No helper ?
     $no_helper = isset($tag->attr['no_helper']) ? TRUE : FALSE;
     $str = '';
     foreach ($languages as &$lang) {
         $tag->locals->lang = $lang;
         $tag->locals->url = $lang['url'] = $tag->locals->page['absolute_urls'][$lang['lang']];
         $tag->locals->active = $lang['active_class'] = $lang['lang'] == Settings::get_lang('current') ? $active_class : '';
         if (Connect()->is('editors', TRUE) or $lang['online'] == 1) {
             $str .= $tag->expand();
         }
     }
     // Get helper method
     $helper_function = substr(strrchr($helper, ':'), 1) ? substr(strrchr($helper, ':'), 1) : 'get_language_navigation';
     $helper = strpos($helper, ':') !== FALSE ? substr($helper, 0, strpos($helper, ':')) : $helper;
     // load the helper
     self::$ci->load->helper($helper);
     // Return the helper function result
     if (function_exists($helper_function) && $no_helper === FALSE) {
         $nav = call_user_func($helper_function, $languages);
         return self::wrap($tag, $nav);
     } else {
         return self::wrap($tag, $str);
     }
 }
开发者ID:nbourguig,项目名称:ionize,代码行数:38,代码来源:Navigation.php

示例12: build_sitemap

 /**
  * Sitemap build
  * Uses the lib : http://signalkraft.com/sitemaps-for-codeigniter
  *
  */
 function build_sitemap($force = FALSE)
 {
     $ci =& get_instance();
     $ci->config->load('sitemaps');
     $ci->load->model('notification_model', '', TRUE);
     $auto_create = config_item('sitemaps_auto_create');
     if ($auto_create or $force) {
         $ci->load->library('sitemaps');
         $ci->load->model('sitemap_model', '', TRUE);
         $get_all_lang = FALSE;
         $langs = Settings::get_online_languages();
         if (Settings::get('force_lang_urls') or count($langs) > 1) {
             $get_all_lang = TRUE;
         }
         $urls = $ci->sitemap_model->get_urls();
         foreach ($urls as $url) {
             $url['date'] = $url['created'];
             if (strtotime($url['updated']) > strtotime($url['date'])) {
                 $url['date'] = $url['updated'];
             }
             if (strtotime($url['publish_on']) > strtotime($url['date'])) {
                 $url['date'] = $url['publish_on'];
             }
             if (strtotime($url['logical_date']) > strtotime($url['date'])) {
                 $url['date'] = $url['logical_date'];
             }
             $loc = $get_all_lang == TRUE ? base_url() . $url['lang'] . '/' . $url['path'] : base_url() . $url['path'];
             $item = array('loc' => $loc, 'lastmod' => date("c", strtotime($url['date'])), 'changefreq' => 'weekly', 'priority' => number_format($url['priority'] / 10, 1, '.', ''));
             $ci->sitemaps->add_item($item);
         }
         /*
         
         
         			$langs = Settings::get_online_languages();
         			$full = (config_item('url_mode') == 'full') ? TRUE : FALSE;
         			$default_lang = config_item('default_lang_code');
         
         			if (count($langs) > 1 OR Settings::get('force_lang_urls') == '1')
         			{
         				// Get pages
         				$pages = array();
         
         				foreach($langs as $lang)
         				{
         					$pages[$lang['lang']] = $ci->sitemap_model->get_pages($lang['lang']);
         				}
         
         				foreach($langs as $lang)
         				{
         					// Prepare pages :
         					foreach($pages[$lang['lang']] as &$p)
         					{
         						$p['date'] = $p['created'];
         						if (strtotime($p['updated']) > strtotime($p['date'])) $p['date'] = $p['updated'];
         						if (strtotime($p['publish_on']) > strtotime($p['date'])) $p['date'] = $p['publish_on'];
         						if (strtotime($p['logical_date']) > strtotime($p['date'])) $p['date'] = $p['logical_date'];
         					}
         				}
         
         				foreach($langs as $lang)
         				{
         					$code = $lang['lang'];
         
         					foreach($pages[$code] as $page)
         					{
         						$item = array(
         							'loc' => ($full == TRUE) ? base_url() . ($page['home'] == '1' && $code == $default_lang ? '' : $code . '/') .  ($page['home'] != '1' ? $page['path'] : '') : base_url() . $code . '/' . ($page['home'] != '1' ? $page['url'] : ''),
         							'lastmod' => date("c", strtotime($page['date'])),
         							'changefreq' => 'weekly',
         							'priority' => number_format(($page['priority'] / 10), 1,'.','')
         						);
         
         						$ci->sitemaps->add_item($item);
         					}
         				}
         			}
         			// No lang in URLs
         			else
         			{
         				// Get pages
         				$pages = $ci->sitemap_model->get_pages();
         
         				// Prepare pages :
         				foreach($pages as &$p)
         				{
         					$p['date'] = $p['created'];
         					if (strtotime($p['updated']) > strtotime($p['date'])) $p['date'] = $p['updated'];
         					if (strtotime($p['publish_on']) > strtotime($p['date'])) $p['date'] = $p['publish_on'];
         					if (strtotime($p['logical_date']) > strtotime($p['date'])) $p['date'] = $p['logical_date'];
         				}
         
         				foreach($pages as $page)
         				{
         					$item = array(
         						'loc' => ($full == TRUE) ? base_url() . ($page['home'] != '1' ? $page['path'] : '') : base_url() . ($page['home'] != '1' ? $page['url'] : ''),
//.........这里部分代码省略.........
开发者ID:pompalini,项目名称:emngo,代码行数:101,代码来源:Structure.php

示例13: build_sitemap

 function build_sitemap()
 {
     $ci =& get_instance();
     $ci->load->library('sitemaps');
     $ci->load->model('sitemap_model', '', TRUE);
     $langs = Settings::get_online_languages();
     if (count($langs) > 1 or Settings::get('force_lang_urls') == '1') {
         // Get pages
         $pages = array();
         foreach ($langs as $lang) {
             $pages[$lang['lang']] = $ci->sitemap_model->get_pages($lang['lang']);
         }
         foreach ($langs as $lang) {
             // Prepare pages :
             foreach ($pages[$lang['lang']] as &$p) {
                 $p['date'] = $p['created'];
                 if (strtotime($p['updated']) > strtotime($p['date'])) {
                     $p['date'] = $p['updated'];
                 }
                 if (strtotime($p['publish_on']) > strtotime($p['date'])) {
                     $p['date'] = $p['publish_on'];
                 }
                 if (strtotime($p['logical_date']) > strtotime($p['date'])) {
                     $p['date'] = $p['logical_date'];
                 }
             }
         }
         foreach ($langs as $lang) {
             $code = $lang['lang'];
             foreach ($pages[$code] as $page) {
                 $item = array('loc' => base_url() . $code . '/' . $page['url'], 'lastmod' => date("c", strtotime($page['date'])), 'changefreq' => 'weekly', 'priority' => $page['priority'] / 10);
                 $ci->sitemaps->add_item($item);
             }
         }
     } else {
         // Get pages
         $pages = $ci->sitemap_model->get_pages();
         // Prepare pages :
         //
         foreach ($pages as &$p) {
             $p['date'] = $p['created'];
             if (strtotime($p['updated']) > strtotime($p['date'])) {
                 $p['date'] = $p['updated'];
             }
             if (strtotime($p['publish_on']) > strtotime($p['date'])) {
                 $p['date'] = $p['publish_on'];
             }
             if (strtotime($p['logical_date']) > strtotime($p['date'])) {
                 $p['date'] = $p['logical_date'];
             }
         }
         foreach ($pages as $page) {
             $item = array('loc' => base_url() . $page['url'], 'lastmod' => date("c", strtotime($page['date'])), 'changefreq' => 'weekly', 'priority' => $page['priority'] / 10);
             $ci->sitemaps->add_item($item);
         }
     }
     $file_name = $ci->sitemaps->build('sitemap.xml');
 }
开发者ID:nbourguig,项目名称:ionize,代码行数:58,代码来源:Structure.php

示例14: tag_static_items

 /**
  * Element's items tag
  *
  * @param FTL_Binding $tag
  *
  * @return string
  *
  * @usage   With "stickers" as your definition name :
  * 			<ion:static:stickers:items />
  */
 public static function tag_static_items(FTL_Binding $tag)
 {
     $return = $tag->getAttribute('return');
     $str = '';
     // Limit ?
     $limit = $tag->getAttribute('limit') ? (int) $tag->getAttribute('limit') : FALSE;
     $items = $tag->get('items');
     $tag->set('count', 0);
     // Process the elements
     if (!empty($items)) {
         if (is_null($return)) {
             $count = count($items);
             $limit = ($limit == FALSE or $limit > $count) ? $count : $limit;
             $tag->set('count', $limit);
             for ($i = 0; $i < $limit; $i++) {
                 $item = $items[$i];
                 // item : One element instance
                 $tag->set('item', $item);
                 $tag->set('index', $i + 1);
                 $tag->set('count', $limit);
                 $str .= $tag->expand();
             }
             $str = self::wrap($tag, $str);
         } else {
             if ($return == 'json') {
                 // Ugly process of links in case
                 // of link type extend fields
                 // @todo: rewrite
                 self::$ci->load->model('extend_fields_model', '', TRUE);
                 if (count(Settings::get_online_languages()) > 1 or Settings::get('force_lang_urls') == '1') {
                     $base_url = base_url() . Settings::get_lang('current') . '/';
                 } else {
                     $base_url = base_url();
                 }
                 foreach ($items as $k1 => $item) {
                     foreach ($item['fields'] as $k2 => $field) {
                         if ($field['html_element_type'] == 'link') {
                             $items[$k1]['ion_urls'] = array();
                             $links = self::$ci->extend_fields_model->get_extend_link_list_from_content($field['content']);
                             foreach ($links as $link) {
                                 $items[$k1]['ion_urls'][] = $base_url . $link['path'];
                             }
                         }
                     }
                 }
                 // End @todo
                 $str = json_encode($items, TRUE);
                 $str = str_replace("'", "\\'", $str);
             }
         }
     }
     return $str;
 }
开发者ID:pompalini,项目名称:emngo,代码行数:63,代码来源:Item.php

示例15: __construct

 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     $module_uri = $this->uri->segment(1);
     // Set Module's config
     $module_config = Modules()->get_module_config_from_uri($module_uri);
     foreach ($module_config as $item => $value) {
         $this->config->set_item($item, $value);
     }
     if (!empty($module_config)) {
         // Languages
         $online_lang_codes = array();
         foreach (Settings::get_online_languages() as $language) {
             $online_lang_codes[] = $language['lang'];
         }
         // If the lang code detected by the Router is not in the DB languages, set it to the DB default one
         if (!in_array(config_item('detected_lang_code'), $online_lang_codes)) {
             Settings::set('current_lang', Settings::get_lang('default'));
             $this->config->set_item('detected_lang_code', Settings::get_lang('default'));
         } else {
             // Store the current lang code (found by Router) to Settings
             Settings::set('current_lang', config_item('detected_lang_code'));
         }
         // Set the current theme
         Theme::set_theme(Settings::get('theme'));
         // Load Theme Events library
         if (is_file($file = FCPATH . Theme::get_theme_path() . 'libraries/theme_events.php')) {
             Event::load_event_library($file);
         }
         // Static translations
         $lang_files = array();
         $lang_folder = APPPATH . 'language/' . Settings::get_lang();
         // Core languages files : Including except "admin_lang.php"
         if (is_dir($lang_folder)) {
             $lang_files = glob($lang_folder . '/*_lang.php', GLOB_BRACE);
             foreach ($lang_files as $key => $lang_file) {
                 if ($lang_file == $lang_folder . '/admin_lang.php') {
                     unset($lang_files[$key]);
                 }
             }
         }
         // Check if theme lang folder exist
         $theme_lang_folder = FCPATH . Theme::get_theme_path() . 'language/' . Settings::get_lang() . '/';
         if (file_exists($theme_lang_folder)) {
             // Theme static translations
             $lf = glob($theme_lang_folder . '*_lang.php');
             foreach ($lf as $key => $tlf) {
                 if (basename($tlf) === 'theme_lang.php') {
                     unset($lf[$key]);
                     array_unshift($lf, $tlf);
                     break;
                 }
             }
             if (!empty($lf)) {
                 $lang_files = array_merge($lf, (array) $lang_files);
             }
         }
         // Module translation files
         $lang_file = MODPATH . $module_config['folder'] . '/language/' . Settings::get_lang('current') . '/' . $module_config['key'] . '_lang.php';
         if (is_file($lang_file)) {
             array_push($lang_files, $lang_file);
         }
         // Load all lang files
         if (!empty($lang_files)) {
             foreach ($lang_files as $l) {
                 if (is_file($l) && '.' . end(explode('.', $l)) == EXT) {
                     include $l;
                     if (!empty($lang)) {
                         foreach ($lang as $key => $translation) {
                             // If the term doesn't exists
                             if (!isset($this->lang->language[$key]) or $this->lang->language[$key] == '') {
                                 $this->lang->language[$key] = $translation;
                             } else {
                                 // Only replace by default (theme vs. module) if the translation is empty
                                 if (empty($this->lang->language[$key])) {
                                     $this->lang->language[$key] = $translation;
                                 }
                             }
                         }
                         unset($lang);
                     }
                 }
             }
         }
     }
 }
开发者ID:rockylo,项目名称:ionize,代码行数:90,代码来源:MY_Controller.php


注:本文中的Settings::get_online_languages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。