Esempio n. 1
0
 public function run($dotted = 0)
 {
     $this->_dotted = $dotted;
     if (isset($this->_cfg['content'], $this->_cfg['summary']) && $this->_cfg['summary'] != '' && $this->_cfg['content'] != '') {
         $param = explode(",", $this->_cfg['summary']);
         $this->_cfg['content'] = $this->beforeCut($this->_cfg['content'], $this->getCut());
         foreach ($param as $doing) {
             $process = explode(":", $doing);
             switch ($process[0]) {
                 case 'notags':
                     $this->_cfg['content'] = strip_tags($this->_cfg['content']);
                     break;
                 case 'noparser':
                     $this->_cfg['content'] = APIhelpers::sanitarTag($this->_cfg['content']);
                     break;
                 case 'chars':
                     if (!(isset($process[1]) && $process[1] > 0)) {
                         $process[1] = 200;
                     }
                     $this->_cfg['content'] = APIhelpers::mb_trim_word($this->_cfg['content'], $process[1]);
                     break;
                 case 'len':
                     if (!(isset($process[1]) && $process[1] > 0)) {
                         $process[1] = 200;
                     }
                     $this->_cfg['content'] = $this->summary($this->_cfg['content'], $process[1], 50, true, $this->getCut());
                     break;
             }
         }
     }
     return $this->dotted($dotted);
 }
Esempio n. 2
0
 public function sanitarTag($data)
 {
     return \APIhelpers::sanitarTag($data);
 }
Esempio n. 3
0
 /**
  * Редирект
  */
 public function moveTo($params)
 {
     $id = (int) APIHelpers::getkey($params, 'id', 0);
     $uri = APIHelpers::getkey($params, 'url', '');
     if (empty($uri) && !empty($id) || !is_string($uri)) {
         $uri = $this->makeUrl($id);
     }
     $code = (int) APIHelpers::getkey($params, 'code', 0);
     $addUrl = APIHelpers::getkey($params, 'addUrl', '');
     if (is_scalar($addUrl) && $addUrl != '') {
         $uri .= "?" . $addUrl;
     }
     if (APIHelpers::getkey($params, 'validate', false)) {
         if (isset($this->modx->snippetCache['getPageID'])) {
             $out = $this->modx->runSnippet('getPageID', compact('uri'));
             if (empty($out)) {
                 $uri = '';
             }
         } else {
             $uri = APIhelpers::sanitarTag($uri);
         }
     } else {
         //$modx->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.1 307 Temporary Redirect');
         header("Location: " . $uri, true, $code > 0 ? $code : 307);
     }
     return $uri;
 }
Esempio n. 4
0
 protected final function sanitarTag($data)
 {
     return parent::sanitarTag($this->modx->stripTags($data));
 }