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


PHP Lang::save方法代码示例

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


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

示例1: post_terms

 /**
  * An editor view for the fuel lang entries
  */
 public function post_terms()
 {
     $terms = \Input::post('terms', array());
     try {
         foreach ($terms as $lang => $phrases) {
             \Lang::save('common.db', $phrases, $lang);
         }
     } catch (\Exception $e) {
         // Nothing
     }
     \Session::set_flash('main_alert', array('attributes' => array('class' => 'alert-success'), 'msg' => \Lang::get('admin.messages.translations_save_success')));
     $referrer = \Input::referrer('/admin');
     return \Response::redirect($referrer);
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:17,代码来源:lang.php

示例2: createComponent

 function createComponent($name)
 {
     switch ($name) {
         case 'translateTabella':
             $datasource = Lang::getDatasourceGroupByKey();
             $grid = new Tabella($datasource, array('sorting' => 'desc', 'order' => 'key', "onSubmit" => function ($post) {
                 Lang::save(@$post['key'], @$post);
                 Lang::invalidateCache();
             }));
             $grid->addColumn("Klúč", "key", array("width" => 50, 'editable' => true));
             foreach (Lang::getAll() as $l) {
                 $grid->addColumn($l['iso'], $l['iso'], array("width" => 50, 'editable' => true));
             }
             $this->addComponent($grid, $name);
             break;
         default:
             return parent::createComponent($name);
             break;
     }
 }
开发者ID:oaki,项目名称:demoshop,代码行数:20,代码来源:Admin_TranslatePresenter.php

示例3: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      ConnectionInterface $con
  * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws PropelException
  * @see save()
  */
 protected function doSave(ConnectionInterface $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aCategory !== null) {
             if ($this->aCategory->isModified() || $this->aCategory->isNew()) {
                 $affectedRows += $this->aCategory->save($con);
             }
             $this->setCategory($this->aCategory);
         }
         if ($this->aLang !== null) {
             if ($this->aLang->isModified() || $this->aLang->isNew()) {
                 $affectedRows += $this->aLang->save($con);
             }
             $this->setLang($this->aLang);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:Mertiozys,项目名称:GoogleShopping,代码行数:47,代码来源:GoogleshoppingTaxonomy.php

示例4: onSaveTerms

 /**
  * Auto translate common terms
  */
 public function onSaveTerms($file, $lang, $language)
 {
     // Try and find child languages
     $childLanguages = \CMF\Model\Language::select('item')->where('update_from IS NOT NULL')->andWhere('update_from.code = :code')->andWhere('item.visible = true')->leftJoin('item.update_from', 'update_from')->setParameter('code', $language)->getQuery()->getResult();
     // Run if child languages are found
     if (!count($childLanguages)) {
         return;
     }
     foreach ($childLanguages as $childLanguage) {
         // Translate the terms for each language
         $terms = $this->translateArray($lang, $language, $childLanguage->code);
         if (is_array($terms)) {
             try {
                 \Lang::save($file, $terms, $childLanguage->code);
             } catch (\Exception $e) {
             }
         }
     }
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:22,代码来源:TranslatorListener.php

示例5: action_edit

 /**
  * Register new language
  *
  * @param sting $lang vi|en|...
  *
  * @access public
  * @author Dao Anh Minh
  */
 public function action_edit($lang = '')
 {
     $lang_path = APPPATH . "lang/{$lang}";
     if (is_null($lang) or !is_dir($lang_path)) {
         Session::set_flash('error', 'Ngôn ngữ không tồn tại');
         Response::redirect('admin/language');
     }
     $view = View::forge('admin/language/edit');
     $view->data = array('shortname' => $lang, 'new_langs' => Lang::load('language.php', null, $lang), 'default_langs' => Lang::load('language.php', null, 'vi'));
     $view->err = array();
     // validate input data
     $val = Validation::forge();
     // Prepare data to display in view and validate
     foreach ($view->data['default_langs'] as $parent_key => $langs) {
         foreach (array_keys($langs) as $lang_key) {
             // Add field to validate
             $val->add_field("{$parent_key}.{$lang_key}", 'Nội dung', 'required');
         }
     }
     if (Input::method() == 'POST') {
         if ($val->run(Input::post('langs'))) {
             Lang::save('language.php', Input::post('langs'), $lang);
             Session::set_flash('success', 'Chỉnh sửa thành công');
             Response::redirect('admin/language');
         } else {
             Session::set_flash('error', 'Có lỗi nhập liệu');
             $view->data['shortname'] = $lang;
             $view->data['new_langs'] = Input::post('langs');
             $view->err = $val->error_message();
         }
     }
     $this->template->title = 'Chỉnh sửa ngôn ngữ';
     $this->template->content = $view;
 }
开发者ID:aminh047,项目名称:pepperyou,代码行数:42,代码来源:language.php


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