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


PHP Lang::get_lang方法代码示例

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


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

示例1: languageSwitchDropdown

/**
 * System front end theme function
 * 
 * @author Vee W.
 * @license http://opensource.org/licenses/MIT
 * 
 */
function languageSwitchDropdown()
{
    $languages = \Config::get('locales');
    // no languages, language is empty, there is only just one language
    if (empty($languages) || !is_array($languages) || count($languages) <= 1) {
        return null;
    }
    ksort($languages);
    $current_lang = \Lang::get_lang();
    $output = "\n" . '<div class="dropdown">' . "\n";
    $output .= "\t" . '<button class="btn btn-default dropdown-toggle" type="button" id="language-switch-dropdown" data-toggle="dropdown">';
    $output .= $languages[$current_lang]['name'];
    $output .= '<span class="caret"></span>';
    $output .= '</button>' . "\n";
    if (is_array($languages) && !empty($languages) && count($languages) > 1) {
        $output .= '<ul class="dropdown-menu" role="menu" aria-labelledby="language-switch-dropdown">' . "\n";
        foreach ($languages as $language => $item) {
            if ($language != $current_lang) {
                $output .= "\t" . '<li>' . \Html::anchor(\Uri::createNL($language), $item['name']) . '</li>' . "\n";
            }
        }
        $output .= '</ul>' . "\n";
    }
    $output .= '</div>' . "\n";
    return $output;
}
开发者ID:rundiz,项目名称:fuel-start,代码行数:33,代码来源:functions.php

示例2: before

 public function before()
 {
     if (!\CMF\Auth::check(null, 'view', 'admin_site')) {
         \Response::redirect("/admin/login?next=" . \Uri::string(), 'location');
     }
     \Lang::$autosave = false;
     // Find the lang from the session, or from the user
     if ($this->lang_enabled = \Config::get('cmf.languages.enabled', false)) {
         $lang = \Session::get('cmf.admin.language');
         if ($lang === null) {
             $user = \CMF\Auth::current_user();
             $lang = $user->default_language;
         }
         if (!empty($lang) && strlen($lang) !== 0 && $lang !== null) {
             \CMF::setLang($lang);
         }
     }
     // Allows us to set the interface template via an integer
     $this->mode = \Input::param('_mode', 'default');
     $this->interface_template = \Config::get('cmf.admin.interface_templates.' . $this->mode);
     // A unique ID that can be passed through
     $this->cid = \Input::param('_cid', 'none');
     // Lang info
     $this->current_lang = \Lang::get_lang();
     $this->fallback_lang = \Lang::$fallback;
     $this->lang_lines = \Lang::$lines;
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:27,代码来源:base.php

示例3: readTemplate

 /**
  * read template
  *
  * @author Vee Winch.
  * @param string $email_file email file.
  * @param string $template_path path to folder that store email file.
  * @return mixed
  */
 public static function readTemplate($email_file = '', $template_path = null)
 {
     if ($email_file == null) {
         return null;
     }
     if ($template_path == null) {
         $template_path = APPPATH . 'lang' . DS . \Lang::get_lang() . DS . 'email' . DS;
     }
     if (file_exists($template_path . $email_file)) {
         $site_name = \Model_Config::getval('site_name');
         $output = file_get_contents($template_path . $email_file);
         $output = str_replace("%site_name%", $site_name, $output);
         $output = str_replace("%site_url%", \Uri::base(), $output);
         $output = str_replace("%site_admin%", \Uri::create('admin'), $output);
         unset($site_name, $template_path);
         return $output;
     } else {
         return false;
     }
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:28,代码来源:emailtemplate.php

示例4: languageUrls

 /**
  * Gets a list of the active languages that have been configured
  */
 public static function languageUrls()
 {
     if (static::$languageUrls !== null) {
         return static::$languageUrls;
     }
     if (!static::$lang_enabled) {
         return static::$languageUrls = array(\Lang::get_lang());
     }
     $url = static::original_uri();
     if (empty($url)) {
         $url = '/';
     } else {
         $url = '/' . trim($url, '/');
     }
     try {
         $currentUrl = static::currentUrl();
         $languages = \DB::query("SELECT l.id, l.code, l.top_level_domain, u.url url, t.content url_translated FROM languages AS l LEFT JOIN urls AS u ON (u.id = " . (!empty($currentUrl) ? $currentUrl->id : '0') . ") LEFT JOIN ext_translations AS t ON (t.locale = l.code AND t.object_class = 'CMF\\\\Model\\\\URL' AND t.field = 'url' AND t.foreign_key = " . (!empty($currentUrl) ? $currentUrl->id : "0") . ") WHERE l.visible = 1 ORDER BY l.pos ASC")->execute()->as_array();
         foreach ($languages as &$language) {
             $language['url'] = static::link(!empty($language['url_translated']) ? $language['url_translated'] : $language['url'], $language['code']);
             unset($language['url_translated']);
         }
         return static::$languageUrls = $languages;
     } catch (\Exception $e) {
         return array(array('id' => 0, 'code' => \Lang::get_lang(), 'top_level_domain' => '', 'url' => $url));
     }
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:29,代码来源:CMF.php

示例5: languageSwitchAdminSelectBox

/**
 * language switch for admin page. display as select box.
 * 
 * @return string
 */
function languageSwitchAdminSelectBox()
{
    $languages = \Config::get('locales');
    ksort($languages);
    $current_lang = \Lang::get_lang();
    $output = "\n" . '<select name="admin_language" onchange="change_redirect($(this));" class="form-control chosen-select">' . "\n";
    if (is_array($languages) && !empty($languages)) {
        foreach ($languages as $language => $item) {
            $output .= "\t" . '<option value="' . \Uri::createNL($language . '/admin') . '"';
            if ($language == $current_lang) {
                $output .= ' selected="selected"';
            }
            $output .= '>' . $item['name'] . '</option>' . "\n";
        }
    } else {
        $output .= "\t" . '<option></option>' . "\n";
    }
    $output .= '</select>' . "\n";
    unset($current_lang, $languages);
    return $output;
}
开发者ID:rundiz,项目名称:fuel-start,代码行数:26,代码来源:inc_functions.php


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