Inheritance: extends lithium\core\Object
コード例 #1
0
ファイル: Cldr.php プロジェクト: unionofrad/li3_cldr
 /**
  * Initializer.  Checks if the configured path exists.
  *
  * @return void
  * @throws \Exception
  */
 protected function _init()
 {
     parent::_init();
     if (!is_dir($this->_config['path'])) {
         throw new Exception("Cldr directory does not exist at `{$this->_config['path']}`");
     }
 }
コード例 #2
0
ファイル: Php.php プロジェクト: newmight2015/Blockchain-2
 /**
  * Initializer.  Checks if the configured path exists.
  *
  * @return void
  * @throws \Exception
  */
 protected function _init()
 {
     parent::_init();
     if (!is_dir($this->_config['path'])) {
         $message = "Php directory does not exist at path `{$this->_config['path']}`.";
         throw new ConfigException($message);
     }
 }
コード例 #3
0
ファイル: Gettext.php プロジェクト: newmight2015/Blockchain-2
 /**
  * Merges an item into given data and unescapes fields.
  *
  * Please note that items with an id containing exclusively whitespace characters
  * or are empty are **not** being merged. Whitespace characters are space, tab, vertical
  * tab, line feed, carriage return and form feed.
  *
  * @see lithium\g11n\catalog\Adapter::_merge()
  * @param array $data Data to merge item into.
  * @param array $item Item to merge into $data.
  * @return array The merged data.
  */
 protected function _merge(array $data, array $item)
 {
     $filter = function ($value) use(&$filter) {
         if (is_array($value)) {
             return array_map($filter, $value);
         }
         return stripcslashes($value);
     };
     $fields = array('id', 'ids', 'translated');
     foreach ($fields as $field) {
         if (isset($item[$field])) {
             $item[$field] = $filter($item[$field]);
         }
     }
     if (isset($item['ids']['singular'])) {
         $item['id'] = $item['ids']['singular'];
     }
     if (empty($item['id']) || ctype_space($item['id'])) {
         return $data;
     }
     return parent::_merge($data, $item);
 }
コード例 #4
0
ファイル: Code.php プロジェクト: fedeisas/lithium
 /**
  * Merges an item into given data and removes quotation marks
  * from the beginning and end of message strings.
  *
  * @see lithium\g11n\catalog\Adapter::_merge()
  * @param array $data Data to merge item into.
  * @param array $item Item to merge into $data.
  * @return array The merged data.
  */
 protected function _merge(array $data, array $item)
 {
     $filter = function ($value) use(&$filter) {
         if (is_array($value)) {
             return array_map($filter, $value);
         }
         return substr($value, 1, -1);
     };
     $fields = array('id', 'ids', 'translated', 'context');
     foreach ($fields as $field) {
         if (isset($item[$field])) {
             $item[$field] = $filter($item[$field]);
         }
     }
     return parent::_merge($data, $item);
 }
コード例 #5
0
ファイル: Docs.php プロジェクト: rmarscher/li3_docs
 /**
  * Cleans and merges a message item into given data.
  *
  * The implementation of the `$cleanup` closure should correspond to the one
  * used in the templates.
  *
  * @see lithium\g11n\catalog\adapter\Base::_merge()
  * @param array $data Data to merge item into.
  * @param array $item Item to merge into $data.
  *
  * @return void
  */
 protected function _merge(array $data, array $item)
 {
     $cleanup = function ($text) {
         return preg_replace('/\\n\\s+-\\s/msi', "\n\n - ", $text);
     };
     if (isset($item['id'])) {
         $item['id'] = $cleanup($item['id']);
     }
     return parent::_merge($data, $item);
 }