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


PHP Lang类代码示例

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


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

示例1: import

 public function import($entity)
 {
     $appHelper = new libs\AppHelper();
     $className = $appHelper->getNameSpace() . $entity;
     $model = new $className();
     $table = $model->getTable();
     $columns = \Schema::getColumnListing($table);
     $key = $model->getKeyName();
     $notNullColumnNames = array();
     $notNullColumnsList = \DB::select(\DB::raw("SHOW COLUMNS FROM `" . $table . "` where `Null` = 'no'"));
     if (!empty($notNullColumnsList)) {
         foreach ($notNullColumnsList as $notNullColumn) {
             $notNullColumnNames[] = $notNullColumn->Field;
         }
     }
     $status = \Input::get('status');
     $filePath = null;
     if (\Input::hasFile('import_file') && \Input::file('import_file')->isValid()) {
         $filePath = \Input::file('import_file')->getRealPath();
     }
     if ($filePath) {
         \Excel::load($filePath, function ($reader) use($model, $columns, $key, $status, $notNullColumnNames) {
             $this->importDataToDB($reader, $model, $columns, $key, $status, $notNullColumnNames);
         });
     }
     $importMessage = $this->failed == true ? \Lang::get('panel::fields.importDataFailure') : \Lang::get('panel::fields.importDataSuccess');
     return \Redirect::to('panel/' . $entity . '/all')->with('import_message', $importMessage);
 }
开发者ID:aoslee,项目名称:panel,代码行数:28,代码来源:ExportImportController.php

示例2: getMsg

 public function getMsg(Lang $lang = null)
 {
     if (!$lang) {
         return implode('|', $this->args);
     }
     return $lang->getPhraseByArray($this->args);
 }
开发者ID:jackblackjack,项目名称:sociochat,代码行数:7,代码来源:MsgToken.php

示例3: lang

 /**
  * @param $field
  * @param null|string $lang
  * @return string
  */
 public static function lang($field, $lang = 'ru')
 {
     if (isset($_GET['lang'])) {
         $lang = $_GET['lang'];
     }
     if (self::$langObj === null) {
         self::$langObj = new Lang($lang);
     }
     return self::$langObj->getField($field);
 }
开发者ID:stanislavdev1993,项目名称:task,代码行数:15,代码来源:Helper.php

示例4: getComments

 /**
  * Return the comments for a strip
  *
  * @param Strip $strip The strip for which we want obtain the comments
  * @param Lang $lang The language object is use when the connection with forum isn't ok
  * @access public
  * @static
  * @return string The comments for the strip or an error message if the connection with forum isn't ok
  */
 public static function getComments(Strip $strip, Lang $lang)
 {
     $url = Config::getFluxbbForum() . '/extern.php?action=topic&ttitle=' . urlencode($strip->getTitle()) . '&max_subject_length=' . Config::getFluxbbMaxLength();
     $text = file_get_contents($url);
     if ($text === false) {
         $text = $lang->getForumError();
     } else {
         $text = utf8_encode($text);
     }
     return $text;
 }
开发者ID:nojhan,项目名称:stripit,代码行数:20,代码来源:forum.class.php

示例5: get_id_langue_defaut

 /**
  * Retourne l'ID de la langue par défaut. Pour améliorer les perfs, on cache cet ID
  * dans une variable statique.
  */
 public function get_id_langue_defaut()
 {
     if ($this->id_langue_defaut === false) {
         $lang = new Lang();
         if ($lang->charger_defaut()) {
             $this->id_langue_defaut = $lang->id;
         } else {
             $this->id_langue_defaut = 1;
         }
     }
     return $this->id_langue_defaut;
 }
开发者ID:anti-conformiste,项目名称:thelia1,代码行数:16,代码来源:ActionsLang.class.php

示例6: actionIndex

 public function actionIndex()
 {
     $this->hasPrivilege(Acl::ACTION_VIEW);
     $this->pageTitle = Lang::t(Common::pluralize($this->resourceLabel));
     $searchModel = Dept::model()->searchModel(array(), $this->settings[Constants::KEY_PAGINATION], 'name');
     $this->render('default/index', array('model' => $searchModel));
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:7,代码来源:DeptController.php

示例7: render

 /**
  * Generate macro output
  *
  * @return     string
  */
 public function render()
 {
     // check if we can render
     if (!parent::canRender()) {
         return \Lang::txt('[This macro is designed for Groups only]');
     }
     // get args
     $args = $this->getArgs();
     //array of filters
     $filters = array('limit' => count($args) == 1 && is_numeric($args[0]) ? $args[0] : 12);
     // get members
     $members = $this->getGroupMembers($this->group, $filters);
     //are we a group member
     $isMember = in_array(\User::get('id'), $this->group->get('members')) ? true : false;
     //get the members plugin access for this group
     $memberAccess = \Hubzero\User\Group\Helper::getPluginAccess($this->group, 'members');
     // make sure we can actually display for the current user
     if ($memberAccess == 'anyone' || $memberAccess == 'registered' && !\User::isGuest() || $memberAccess == 'members' && $isMember) {
         $html = $this->renderMembers($this->group, $members);
     } else {
         $html = '';
     }
     //return rendered events
     return $html;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:30,代码来源:members.php

示例8: prepareDocument

 /**
  * Prepares the document.
  *
  * @since	1.6
  */
 protected function prepareDocument()
 {
     $menus = \App::get('menu');
     $title = null;
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     } else {
         $this->params->def('page_heading', Lang::txt('COM_USERS_RESET'));
     }
     $title = $this->params->get('page_title', '');
     if (empty($title)) {
         $title = Config::get('sitename');
     } elseif (Config::get('sitename_pagetitles', 0) == 1) {
         $title = Lang::txt('JPAGETITLE', Config::get('sitename'), $title);
     } elseif (Config::get('sitename_pagetitles', 0) == 2) {
         $title = Lang::txt('JPAGETITLE', $title, Config::get('sitename'));
     }
     $this->document->setTitle($title);
     if ($this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     }
     if ($this->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
     }
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:36,代码来源:view.html.php

示例9: exportIt

 public function exportIt($return)
 {
     return parent::exportIt($return);
     $filename = $return['classname'] . "_" . date('Ymd');
     $xls = new Excel($filename);
     //$filename = $return['classname'] . "_" . date('Ymd') . ".xls";
     //header("Content-Disposition: attachment; filename=\"$filename\"");
     //header("Content-Type: application/vnd.ms-excel");
     //$flag = false;
     $xls->home();
     foreach ($return['objs'] as $key => $obj) {
         foreach ($obj as $name => $value) {
             $xls->label(Lang::t($name));
             $xls->right();
         }
         break;
     }
     $xls->down();
     //print("\n");
     foreach ($return['objs'] as $key => $obj) {
         $xls->home();
         foreach ($obj as $name => $value) {
             $xls->label($value);
             $xls->right();
         }
         $xls->down();
     }
     $xls->send();
     exit;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:30,代码来源:Model.php

示例10: read

 /**
  * {@inheritdoc}
  */
 public function read($path)
 {
     if ($this->isFile($path)) {
         return file_get_contents($path);
     }
     throw new FileNotFoundException(\Lang::txt('File does not exist at path %s', $path));
 }
开发者ID:kevinwojo,项目名称:framework,代码行数:10,代码来源:Local.php

示例11: __invoke

 /**
  * Output the autocompleter
  *
  * @param   string  $what   The component to call
  * @param   string  $name   Name of the input field
  * @param   string  $value  The value of the input field
  * @param   string  $id     ID of the input field
  * @param   string  $class  CSS class(es) for the input field
  * @param   string  $size   The size of the input field
  * @param   string  $wsel   AC autopopulates a select list based on choice?
  * @param   string  $type   Allow single or multiple entries
  * @param   string  $dsabl  Readonly input
  * @return  string
  * @throws  \InvalidArgumentException  If wrong type passed
  */
 public function __invoke($what = null, $name = null, $value = null, $id = null, $class = null, $size = null, $wsel = false, $type = 'multi', $dsabl = false)
 {
     if (!in_array($what, array('tags', 'members', 'groups'))) {
         throw new \InvalidArgumentException(__METHOD__ . '(); ' . \Lang::txt('Autocompleter for "%s" not supported.', $what));
     }
     $id = $id ?: str_replace(array('[', ']'), '', $name);
     switch ($type) {
         case 'multi':
             $event = 'onGetMultiEntry';
             break;
         case 'single':
             $event = 'onGetSingleEntry';
             if ($wsel) {
                 $event = 'onGetSingleEntryWithSelect';
             }
             break;
         default:
             throw new \InvalidArgumentException(__METHOD__ . '(); ' . \Lang::txt('Autocompleter type "%s" not supported.', $type));
             break;
     }
     $results = \Event::trigger('hubzero.' . $event, array(array($what, $name, $id, $class, $value, $size, $wsel, $type, $dsabl)));
     if (count($results) > 0) {
         $results = implode("\n", $results);
     } else {
         $results = '<input type="text" name="' . $name . '" id="' . $id . '" value="' . $value . '" />';
     }
     return $results;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:43,代码来源:Autocompleter.php

示例12: 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

示例13: fetchElement

 public function fetchElement($name, $value, &$node, $control_name)
 {
     require_once dirname(__DIR__) . DS . 'models' . DS . 'poll.php';
     $options = \Components\Poll\Models\Poll::all()->whereEquals('published', 1)->rows()->raw();
     array_unshift($options, \Html::select('option', '0', '- ' . \Lang::txt('Select Poll') . ' -', 'id', 'title'));
     return \Html::select('genericlist', $options, $control_name . '[' . $name . ']', 'class="inputbox"', 'id', 'title', $value, $control_name . $name);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:7,代码来源:poll.php

示例14: lang

 public static function lang($string)
 {
     if (static::isLaravel()) {
         return \Lang::get($string);
     }
     return $string;
 }
开发者ID:neondigital,项目名称:forma,代码行数:7,代码来源:Helpers.php

示例15: get

 public static function get()
 {
     $response = new XMLElement('response');
     foreach (self::$_sections as $section) {
         $section_xml = new XMLElement('section');
         $meta = $section->get();
         foreach ($meta as $key => $value) {
             $section_xml->setAttribute(Lang::createHandle($key), $value);
         }
         $fields = $section->fetchFields();
         foreach ($fields as $field) {
             $meta = $field->get();
             unset($meta['field_id']);
             $field_xml = new XMLElement($meta['element_name'], null);
             foreach (self::$_field_attributes as $attr) {
                 $field_xml->setAttribute(Lang::createHandle($attr), $meta[$attr]);
             }
             foreach ($meta as $key => $value) {
                 if (in_array($key, self::$_field_attributes)) {
                     continue;
                 }
                 $value = General::sanitize($value);
                 if ($value != '') {
                     $field_xml->appendChild(new XMLElement(Lang::createHandle($key), General::sanitize($value)));
                 }
             }
             $section_xml->appendChild($field_xml);
         }
         $response->appendChild($section_xml);
     }
     REST_API::sendOutput($response);
 }
开发者ID:MST-SymphonyCMS,项目名称:rest_api,代码行数:32,代码来源:rest.sections.php


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