• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Lang类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = ModulesHelper::getActions();
     Toolbar::title(Lang::txt('COM_MODULES_MANAGER_MODULES'), 'module.png');
     if ($canDo->get('core.create')) {
         //Toolbar::addNew('module.add');
         Toolbar::appendButton('Popup', 'new', 'JTOOLBAR_NEW', 'index.php?option=com_modules&amp;view=select&amp;tmpl=component', 850, 400);
     }
     if ($canDo->get('core.edit')) {
         Toolbar::editList('module.edit');
     }
     if ($canDo->get('core.create')) {
         Toolbar::custom('modules.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true);
     }
     if ($canDo->get('core.edit.state')) {
         Toolbar::divider();
         Toolbar::publish('modules.publish', 'JTOOLBAR_PUBLISH', true);
         Toolbar::unpublish('modules.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         Toolbar::divider();
         Toolbar::checkin('modules.checkin');
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         Toolbar::deleteList('', 'modules.delete', 'JTOOLBAR_EMPTY_TRASH');
         Toolbar::divider();
     } elseif ($canDo->get('core.edit.state')) {
         Toolbar::trash('modules.trash');
         Toolbar::divider();
     }
     if ($canDo->get('core.admin')) {
         Toolbar::preferences('com_modules');
         Toolbar::divider();
     }
     Toolbar::help('modules');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:40,代码来源:view.html.php


示例17: postLogin

 public function postLogin()
 {
     if (Request::ajax()) {
         $userdata = array('usuario' => Input::get('usuario'), 'password' => Input::get('password'));
         if (Auth::attempt($userdata, Input::get('remember', 0))) {
             //buscar los permisos de este usuario y guardarlos en sesion
             $query = "SELECT m.nombre as modulo, s.nombre as submodulo,\n                        su.agregar, su.editar, su.eliminar,\n                        CONCAT(m.path,'.', s.path) as path, m.icon\n                        FROM modulos m \n                        JOIN submodulos s ON m.id=s.modulo_id\n                        JOIN submodulo_usuario su ON s.id=su.submodulo_id\n                        WHERE su.estado = 1 AND m.estado = 1 AND s.estado = 1\n                        and su.usuario_id = ?\n                        ORDER BY m.nombre, s.nombre ";
             $res = DB::select($query, array(Auth::id()));
             $menu = array();
             $accesos = array();
             foreach ($res as $data) {
                 $modulo = $data->modulo;
                 //$accesos[] = $data->path;
                 array_push($accesos, $data->path);
                 if (isset($menu[$modulo])) {
                     $menu[$modulo][] = $data;
                 } else {
                     $menu[$modulo] = array($data);
                 }
             }
             $usuario = Usuario::find(Auth::id());
             Session::set('language', 'Español');
             Session::set('language_id', 'es');
             Session::set('menu', $menu);
             Session::set('accesos', $accesos);
             Session::set('perfilId', $usuario['perfil_id']);
             Session::set("s_token", md5(uniqid(mt_rand(), true)));
             Lang::setLocale(Session::get('language_id'));
             return Response::json(array('rst' => '1', 'estado' => Auth::user()->estado));
         } else {
             $m = '<strong>Usuario</strong> y/o la <strong>contraseña</strong>';
             return Response::json(array('rst' => '2', 'msj' => 'El' . $m . 'son incorrectos.'));
         }
     }
 }
开发者ID:lcalderonc,项目名称:hdc2016,代码行数:35,代码来源:LoginController.php


示例18: translate

 /**
  * Translates the given string.
  * @param  string	translation string
  * @param  int		count (positive number)
  * @return string
  */
 public function translate($message, $count = 1)
 {
     $message = (string) $message;
     //		if (!empty($message) && isset($this->dictionary[$message])) {
     //			$word = $this->dictionary[$message];
     //			if ($count === NULL) $count = 1;
     //
     //			$s = preg_replace('/([a-z]+)/', '$$1', "n=$count;" . $this->meta['Plural-Forms']);
     //			eval($s);
     //			$message = $word->translate($plural);
     //		}
     if (!isset($this->translate[$message]) or $this->translate[$message] == '') {
         $message = $message;
         //			echo $message;exit;
         if (!dibi::fetchSingle("SELECT 1 FROM [lang_translate] WHERE [key] LIKE %s", $message, "AND [id_lang] = %i", $this->id_lang)) {
             //				echo dibi::$sql;
             Lang::insertTranslateKey($message, $this->id_lang);
         }
         $this->translate[$message] = $message;
         Lang::invalidateCache();
     } else {
         $message = $this->translate[$message];
     }
     //
     //		$args = func_get_args();
     //		if (count($args) > 1) {
     //			array_shift($args);
     //			$message = vsprintf($message, $args);
     //		}
     //
     //
     return $message;
 }
开发者ID:oaki,项目名称:demoshop,代码行数:39,代码来源:MyTranslator.php


示例19: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = ContentHelper::getActions($this->state->get('filter.category_id'));
     Toolbar::title(Lang::txt('COM_CONTENT_FEATURED_TITLE'), 'featured.png');
     if ($canDo->get('core.create')) {
         Toolbar::addNew('article.add');
     }
     if ($canDo->get('core.edit')) {
         Toolbar::editList('article.edit');
     }
     if ($canDo->get('core.edit.state')) {
         Toolbar::divider();
         Toolbar::publish('articles.publish', 'JTOOLBAR_PUBLISH', true);
         Toolbar::unpublish('articles.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         Toolbar::divider();
         Toolbar::archiveList('articles.archive');
         Toolbar::checkin('articles.checkin');
         Toolbar::custom('featured.delete', 'remove.png', 'remove_f2.png', 'JTOOLBAR_REMOVE', true);
     }
     if ($state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         Toolbar::deleteList('', 'articles.delete', 'JTOOLBAR_EMPTY_TRASH');
         Toolbar::divider();
     } elseif ($canDo->get('core.edit.state')) {
         Toolbar::divider();
         Toolbar::trash('articles.trash');
     }
     if ($canDo->get('core.admin')) {
         Toolbar::preferences('com_content');
         Toolbar::divider();
     }
     Toolbar::help('featured');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:38,代码来源:view.html.php


示例20: 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();
     // get details
     $type = $this->_getType($args, 'all');
     $limit = $this->_getLimit($args, 5);
     $class = $this->_getClass($args);
     //get resources
     $groupResources = $this->_getResources($type, $limit);
     $html = '<div class="resources ' . $class . '">';
     foreach ($groupResources as $resource) {
         $area = strtolower(preg_replace("/[^a-zA-Z0-9]/", '', $resource->area));
         $resourceLink = \Route::url('index.php?option=com_resources&id=' . $resource->id);
         $resourceTypeLink = \Route::url('index.php?option=com_groups&cn=' . $this->group->get('cn') . '&active=resources&area=' . $area);
         $html .= '<a href="' . $resourceLink . '"><strong>' . $resource->title . '</strong></a>';
         $html .= '<p class="category"> in: <a href="' . $resourceTypeLink . '">' . $resource->area . '</a></p>';
         $html .= '<p>' . \Hubzero\Utility\String::truncate($resource->itext) . '</p>';
     }
     $html .= '</div>';
     return $html;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:31,代码来源:resources.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP LangLoader类代码示例发布时间:2022-05-23
下一篇:
PHP LabelUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap