Esempio n. 1
0
 /**
  * Merges an item into given data and unescapes fields.
  *
  * Please note that items with an id containing exclusively whitespace characters
  * are **not** being merged. Whitespace characters are space, tab, vertical tab,
  * line feed, carriage return and form feed.
  *
  * @param array $data Data to merge item into.
  * @param array $item Item to merge into $data.
  * @return array The merged data.
  * @see lithium\g11n\catalog\adapter\Base::_merge()
  */
 protected function _merge($data, $item)
 {
     $filter = function ($value) use(&$filter) {
         if (is_array($value)) {
             return array_map($filter, $value);
         }
         $value = stripcslashes($value);
         $value = ctype_space($value) ? null : $value;
         return $value;
     };
     $fields = array('id', 'ids', 'translated');
     foreach ($fields as $field) {
         if (isset($item[$field])) {
             $item[$field] = $filter($item[$field]);
         }
     }
     return parent::_merge($data, $item);
 }
Esempio n. 2
0
 /**
  * Merges an item into given data and removes quotation marks
  * from the beginning and end of message strings.
  *
  * @param array $data Data to merge item into.
  * @param array $item Item to merge into $data.
  * @return array The merged data.
  * @see lithium\g11n\catalog\adapter\Base::_merge()
  */
 protected function _merge($data, $item)
 {
     array_walk($item['ids'], function (&$value) {
         $value = substr($value, 1, -1);
     });
     return parent::_merge($data, $item);
 }