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


PHP Lang::load方法代码示例

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


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

示例1: run

 public static function run($uri)
 {
     self::$router = new Router($uri);
     self::$db = new DB(Config::get('db.host'), Config::get('db.user'), Config::get('db.password'), Config::get('db.db_name'));
     Lang::load(self::$router->getLanguage());
     $controller_class = ucfirst(self::$router->getController()) . "Controller";
     $controller_method = strtolower(self::$router->getMethodPrefix() . self::$router->getAction());
     $layout = self::$router->getRoute();
     if ($layout == "admin" && Session::get("role") != "admin") {
         if ($controller_method != "admin_login") {
             Router::redirect("/admin/users/login");
         }
     }
     //Calling controller's method
     $controller_object = new $controller_class();
     if (method_exists($controller_object, $controller_method)) {
         $view_path = $controller_object->{$controller_method}();
         $view_object = new View($controller_object->getData(), $view_path);
         $content = $view_object->render();
     } else {
         throw new Exception("Method {$controller_method} does not exist in {$controller_class}");
     }
     $layout_path = VIEWS_PATH . DS . $layout . ".html";
     $layout_view_object = new View(compact('content'), $layout_path);
     echo $layout_view_object->render();
 }
开发者ID:Denbora,项目名称:mvc_phpAcademy,代码行数:26,代码来源:app.class.php

示例2: run

 public static function run($uri)
 {
     self::$router = new Router($uri);
     # создаем обект базы данных и передаем параметры подключения
     self::$db = new DB(Config::get('db.host'), Config::get('db.user'), Config::get('db.password'), Config::get('db.db_name'));
     Lang::load(self::$router->getLanguage());
     $controller_class = ucfirst(self::$router->getController()) . 'Controller';
     $controller_method = strtolower(self::$router->getMethodPrefix() . self::$router->getAction());
     # при каждом запросе к руту admin выполняется проверка, имеет ли пользователь на это права
     $layout = self::$router->getRoute();
     if ($layout == 'admin' && Session::get('role') != 'admin') {
         if ($controller_method != 'admin_login') {
             Router::redirect('/admin/users/login');
         }
     }
     // Calling controller's method
     $controller_object = new $controller_class();
     if (method_exists($controller_object, $controller_method)) {
         $view_path = $controller_object->{$controller_method}();
         $view_object = new View($controller_object->getData(), $view_path);
         $content = $view_object->render();
     } else {
         throw new Exception('Method ' . $controller_method . ' of class ' . $controller_class . ' does not exist.');
     }
     # код віполняющий рендеринг
     $layout_path = VIEWS_PATH . DS . $layout . '.html';
     $layout_view_object = new View(compact('content'), $layout_path);
     echo $layout_view_object->render();
 }
开发者ID:vovella,项目名称:homeworks,代码行数:29,代码来源:app.class.php

示例3: displayForm

 /** @inheritdoc */
 public static function displayForm($value, &$settings, $model)
 {
     // No point in ever showing this field if lang isn't enabled
     if (!\CMF::$lang_enabled) {
         return '';
     }
     \Lang::load('languages', true, 'en', true, true);
     $settings = static::settings($settings);
     $include_label = isset($settings['label']) ? $settings['label'] : true;
     $required = isset($settings['required']) ? $settings['required'] : false;
     $errors = $model->getErrorsForField($settings['mapping']['fieldName']);
     $has_errors = count($errors) > 0;
     $input_attributes = isset($settings['input_attributes']) ? $settings['input_attributes'] : array('class' => 'input-xxlarge');
     if ($settings['active_only']) {
         $options = array_map(function ($lang) {
             return \Arr::get(\Lang::$lines, 'en.languages.' . $lang['code'], \Lang::get('admin.errors.language.name_not_found'));
         }, \CMF\Model\Language::select('item.code', 'item', 'item.code')->orderBy('item.pos', 'ASC')->where('item.visible = true')->getQuery()->getArrayResult());
     } else {
         $options = \Arr::get(\Lang::$lines, 'en.languages', array());
     }
     // Whether to allow an empty option
     if (isset($settings['mapping']['nullable']) && $settings['mapping']['nullable'] && !$required && $settings['allow_empty']) {
         $options = array('' => '') + $options;
     }
     $label = !$include_label ? '' : \Form::label($settings['title'] . ($required ? ' *' : '') . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName'], array('class' => 'item-label'));
     $input = \Form::select($settings['mapping']['fieldName'], $value, $options, $input_attributes);
     if (isset($settings['wrap']) && $settings['wrap'] === false) {
         return $label . $input;
     }
     return html_tag('div', array('class' => 'controls control-group' . ($has_errors ? ' error' : '')), $label . $input);
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:32,代码来源:Language.php

示例4: __construct

 /**
  * Cart constructor
  *
  * @param void
  * @return void
  */
 public function __construct()
 {
     // Initialize DB
     $this->_db = App::get('db');
     // Load language file
     Lang::load('com_cart');
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:13,代码来源:Cart.php

示例5: run

 public static function run($uri)
 {
     self::$router = new Router($uri);
     self::$db = new DB(config::get('db.host'), config::get('db.name'), config::get('db.user'), config::get('db.password'));
     Lang::load(self::$router->getLanguage());
     if ($_POST and (isset($_POST['username_in']) and isset($_POST['password_in'])) or isset($_POST['exit'])) {
         $us = new RegisterController();
         if (isset($_POST['exit'])) {
             $us->LogOut();
         } else {
             $us->Login($_POST);
         }
     }
     if (self::$router->getController() == 'admin' and !Session::getSession('root') or self::$router->getController() == 'myblog' and !Session::getSession('id')) {
         self::$router->setController(Config::get('default_controller'));
         self::$router->setAction(Config::get('default_action'));
         Session::setSession('message', 'Отказ в доступе');
     }
     $controller_class = ucfirst(self::$router->getController()) . 'Controller';
     $controller_method = strtolower(self::$router->getMethodPrefix() . self::$router->getAction());
     $controller_object = new $controller_class();
     if (method_exists($controller_object, $controller_method)) {
         $controller_object->{$controller_method}();
         $view_object = new View($controller_object->getData());
         $content = $view_object->render();
     } else {
         throw new Exception('Method ' . $controller_method . ' of class ' . $controller_class . ' does not exist');
     }
     $layout = self::$router->getRoute();
     $layout_path = VIEWS_PATH . DS . $layout . '.html';
     $layout_view_object = new View(compact('content'), $layout_path);
     echo $layout_view_object->render();
 }
开发者ID:seletskyy,项目名称:blog_mvc,代码行数:33,代码来源:app.class.php

示例6: sendMailByParams

 /**
  * ユーザーにメールを送信
  *
  * @para $name メールの識別子 $params 差し込むデータ $to 送り先(指定しなければ langの値を使用) $options Fuel準拠のEmailオプション
  * @access protected
  * @return bool
  * @author kobayasi
  * @author shimma
  */
 public function sendMailByParams($name, $params = array(), $to = null, $options = null)
 {
     Lang::load("email/{$name}");
     $email = Email::forge();
     $email->from(Lang::get('from'), Lang::get('from_name'));
     $email->subject($this->renderTemplate(Lang::get('subject'), $params, false));
     $email->body($this->renderTemplate(Lang::get('body'), $params));
     if (!$to) {
         $to = Lang::get('email');
     }
     $email->to($to);
     if (Lang::get('bcc') != '') {
         $email->bcc(Lang::get('bcc'));
     }
     if (!empty($options)) {
         foreach ($options as $option => $value) {
             if (empty($value)) {
                 continue;
             }
             switch ($option) {
                 case 'bcc':
                     $email->bcc($value);
                     break;
                 case 'reply_to':
                     $email->reply_to($value);
                     break;
                 case 'subject':
                     $email->subject($value);
                     break;
             }
         }
     }
     return $email->send();
 }
开发者ID:eva-tuantran,项目名称:use-knife-solo-instead-chef-solo-day13,代码行数:43,代码来源:email.php

示例7: IndexbaseModule

 function IndexbaseModule()
 {
     define_module();
     Lang::load(module_lang('common'));
     $this->visitor =& env('visitor');
     parent::__construct();
 }
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:7,代码来源:module.base.php

示例8: run

 public static function run($uri)
 {
     self::$router = new Router($uri);
     self::$db = DB::getInstance(Config::get('db.host'), Config::get('db.user'), Config::get('db.password'), Config::get('db.db_name'));
     Lang::load(self::$router->getLanguage());
     $controller_class = ucfirst(self::$router->getController()) . 'controller';
     $controller_method = strtolower(self::$router->getMethod_prefix() . self::$router->getAction());
     $controller_parametr = self::$router->getParams();
     $layout = self::$router->getRoute();
     if ($layout == 'admin' && Session::get('role') != 'admin') {
         if ($controller_method != 'admin_login') {
             Router::redirect('/admin/users/login');
         }
     }
     //Calling conrollers method
     $controller_object = new $controller_class();
     if (method_exists($controller_object, $controller_method)) {
         $view_path = $controller_object->{$controller_method}();
         $view_object = new View($controller_object->getData(), $view_path);
         $content = $view_object->render();
     } else {
         throw new Exception('Метод ' . $controller_method . ' в классе ' . $controller_class . 'не найден');
     }
     $layout_path = VIEW_PATH . DS . $layout . '.html';
     $layout_view_object = new View(compact('content'), $layout_path);
     // основной рендер вывода страниц
     echo $layout_view_object->render();
 }
开发者ID:Skynet2004x,项目名称:SkynetPR,代码行数:28,代码来源:app.class.php

示例9: _init

 public static function _init()
 {
     \Lang::load('menu');
     \Config::load('petro', true);
     static::$table = \Config::get('petro.menu.table', 'menu');
     static::$template = \Config::get('petro.template.menu');
 }
开发者ID:ratiw,项目名称:petro,代码行数:7,代码来源:menu.php

示例10: test_line_invalid

 /**
  * Test for Lang::get()
  *
  * @test
  */
 public function test_line_invalid()
 {
     Lang::load('test');
     $output = Lang::get('non_existant_hello', array('name' => 'Bob'));
     $expected = false;
     $this->assertEquals($expected, $output);
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:12,代码来源:lang.php

示例11: before

 /**
  * Run this code before the other methods.
  */
 public function before()
 {
     // Load the error strings.
     \Lang::load('v1::errors', true);
     \Lang::load('v1::log', true);
     \Lang::load('v1::response', true);
 }
开发者ID:bitapihub,项目名称:api-optimization-engine,代码行数:10,代码来源:v1.php

示例12: before

 /**
  *  Run this before every call
  *  
  *  @return void
  *  @access public
  */
 public function before()
 {
     // Profile the loader
     \Profiler::mark('Start of loader\'s before() function');
     \Profiler::mark_memory($this, 'Start of loader\'s before() function');
     // Set the environment
     parent::before();
     // Load the config for Segment so we can process analytics data.
     \Config::load('segment', true);
     // Load the config file for event names. Having events names in one place keeps things synchronized.
     \Config::load('analyticsstrings', true);
     // Engine configuration
     \Config::load('engine', true);
     // Load the package configuration file.
     \Config::load('tiers', true);
     // Soccket connection configuration
     \Config::load('socket', true);
     /**
      * Ensure that all user language strings are appropriately translated.
      * 
      * @link https://github.com/fuel/core/issues/1860#issuecomment-92022320
      */
     if (is_string(\Input::post('language', false))) {
         \Environment::set_language(\Input::post('language', 'en'));
     }
     // Load the error strings.
     \Lang::load('errors', true);
 }
开发者ID:bitapihub,项目名称:api-optimization-engine,代码行数:34,代码来源:loader.php

示例13: _init

 public static function _init()
 {
     \Config::load('petro', true);
     \Lang::load('petro');
     static::$template = \Config::get('petro.template');
     static::$csrf_token_key = \Config::get('security.csrf_token_key', 'fuel_csrf_token');
 }
开发者ID:ratiw,项目名称:petro,代码行数:7,代码来源:form.php

示例14: action_index

 public function action_index()
 {
     // clear redirect referrer
     \Session::delete('submitted_redirect');
     // load language
     \Lang::load('index');
     // read flash message for display errors.
     $form_status = \Session::get_flash('form_status');
     if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
         $output['form_status'] = $form_status['form_status'];
         $output['form_status_message'] = $form_status['form_status_message'];
     }
     unset($form_status);
     // get total accounts
     $output['total_accounts'] = \Model_Accounts::count();
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = $this->generateTitle(\Lang::get('admin_administrator_dashbord'));
     // <head> output ----------------------------------------------------------------------------------------------
     // breadcrumb -------------------------------------------------------------------------------------------------
     $page_breadcrumb = [];
     $page_breadcrumb[0] = ['name' => \Lang::get('admin_admin_home'), 'url' => \Uri::create('admin')];
     $output['page_breadcrumb'] = $page_breadcrumb;
     unset($page_breadcrumb);
     // breadcrumb -------------------------------------------------------------------------------------------------
     // the admin views or theme should follow this structure. (admin/templates/controller/method) and follow with _v in the end.
     return $this->generatePage('admin/templates/index/index_v', $output, false);
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:27,代码来源:index.php

示例15: emailMemberDigest

 /**
  * Email member activity digest
  *
  * Current limitations include a lack of queuing/scheduling. This means that this cron job
  * should not be set to run more than once daily, otherwise it will continue to send out the
  * same digest to people over and over again.
  *
  * @param   object  $job  \Components\Cron\Models\Job
  * @return  bool
  */
 public function emailMemberDigest(\Components\Cron\Models\Job $job)
 {
     // Make sure digests are enabled?  The cron job being on may be evidence enough...
     if (!Plugin::params('members', 'activity')->get('email_digests', false)) {
         return true;
     }
     // Load language files
     Lang::load('plg_members_activity') || Lang::load('plg_members_activity', PATH_CORE . DS . 'plugins' . DS . 'members' . DS . 'activity');
     // Database connection
     $db = App::get('db');
     // 0 = no email
     // 1 = immediately
     // 2 = digest daily
     // 3 = digest weekly
     // 4 = digest monthly
     $intervals = array(0 => 'none', 1 => 'now', 2 => 'day', 3 => 'week', 4 => 'month');
     // Check frequency (this plugin should run early every morning)
     // If daily, run every day
     // If weekly, only run this one on mondays
     // If monthly, only run this on on the 1st of the month
     $isDay = true;
     $isWeek = Date::of('now')->toLocal('N') == 1 ? true : false;
     $isMonth = Date::of('now')->toLocal('j') == 1 ? true : false;
     foreach ($intervals as $val => $interval) {
         // Skip the first two options for now
         if ($val < 2) {
             continue;
         }
         if ($val == 3 && !$isWeek) {
             continue;
         }
         if ($val == 4 && !$isMonth) {
             continue;
         }
         // Find all users that want weekly digests and the last time the digest
         // was sent was NEVER or older than 1 month ago.
         $previous = Date::of('now')->subtract('1 ' . $interval)->toSql();
         // Set up the query
         $query = "SELECT DISTINCT(scope_id) FROM `#__activity_digests` WHERE `scope`=" . $db->quote('user') . " AND `frequency`=" . $db->quote($val) . " AND (`sent` = '0000-00-00 00:00:00' OR `sent` <= " . $db->quote($previous) . ")";
         $db->setQuery($query);
         $users = $db->loadColumn();
         // Loop through members and get their groups that have the digest set
         if ($users && count($users) > 0) {
             foreach ($users as $user) {
                 $posts = \Hubzero\Activity\Recipient::all()->including('log')->whereEquals('scope', 'user')->whereEquals('scope_id', $user)->whereEquals('state', 1)->where('created', '>', $previous)->ordered()->rows();
                 // Gather up applicable posts and queue up the emails
                 if (count($posts) > 0) {
                     if ($this->sendEmail($user, $posts, $interval)) {
                         // Update the last sent timestamp
                         $query = "UPDATE `#__activity_digests` SET `sent`=" . $db->quote(Date::toSql()) . " WHERE `scope`=" . $db->quote('user') . " AND `scope_id`=" . $db->quote($user);
                         $db->setQuery($query);
                         $db->query();
                     }
                 }
             }
         }
     }
     return true;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:69,代码来源:activity.php


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