Example #1
0
File: HTML.php Project: techart/tao
 public function assign_to_object($form, $object, $name, $data)
 {
     parent::assign_to_object($form, $object, $name, $data);
     $value = $object[$name];
     if (!empty($value)) {
         if (!isset($this->data['htmlpurifier']) || $this->data['htmlpurifier']) {
             $object[$name] = Text_Process::process($value, 'htmlpurifier');
         } else {
             $object[$name] = $value;
         }
     }
 }
Example #2
0
File: HTTP.php Project: techart/tao
 /**
  * Возвращает значение свойства
  *
  * @param string $property
  *
  * @return mixed
  */
 public function __get($property)
 {
     switch ($property) {
         case 'scheme':
         case 'host':
         case 'path':
         case 'port':
         case 'user':
         case 'pass':
             return $this->uri[$property];
         case 'query':
             return $this->urlencode($this->query);
         case 'headers':
         case 'session':
         case 'meta':
         case 'body':
             return $this->{$property};
         case 'content':
             return $this->{$property} ? $this->{$property} : ($this->{$property} = @file_get_contents('php://input'));
         case 'parameters':
             return Core_Arrays::merge($this->query, $this->parameters);
         case 'post_data':
             return $this->urlencode($this->parameters);
         case 'url':
             return $this->compose_url();
         case 'uri':
             return $this->compose_uri();
         case 'urn':
             return $this->compose_urn();
         case 'method_name':
         case 'method':
             return Net_HTTP::method_name_for($this->method);
         case 'method_code':
             return $this->method;
         case 'id':
             if ($this->id) {
                 return $this->id;
             }
             Core::load('Text.Process');
             $id = Text_Process::process($this->path, 'translit');
             $id = trim(preg_replace('{[^a-zA-Z0-9]+}ui', '_', $id), '_');
             return $this->id = $id;
         default:
             return parent::__get($property);
     }
 }
Example #3
0
File: Text.php Project: techart/tao
 public static function process($source, $process = array())
 {
     Core::load('Text.Process');
     return Text_Process::process($source, $process);
 }
Example #4
0
 public function clear_value($value, $format = 'html')
 {
     if ($format == 'html') {
         return Text_Process::process($value, 'htmlpurifier');
     }
     return $value;
 }
Example #5
0
 public function clean_value()
 {
     $value = $this->value();
     $spliter = $this->get_spliter();
     if ($this->has_spliter()) {
         $find = preg_quote($spliter);
         $value = preg_replace("!(<br/?>)?{$find}(<br/?>)?!", '', $value);
         $value = $this->nl2br($value);
     } else {
         $value = $this->nl2br($value);
     }
     if ($this->is_htmlpurifier()) {
         $value = Text_Process::process($value, 'htmlpurifier');
     }
     return $value;
 }