@@ -17,17 +17,17 @@ discard block |
||
| 17 | 17 | if (!is_string($html)) { |
| 18 | 18 | throw new \InvalidArgumentException(sprintf('Waiting string, %s given', gettype($html))); |
| 19 | 19 | } |
| 20 | - $html=is_file($html)?file_get_contents($html):$html; |
|
| 20 | + $html=is_file($html) ?file_get_contents($html) : $html; |
|
| 21 | 21 | $this->setMainTags($html); |
| 22 | 22 | |
| 23 | 23 | $html='<div>'.str_replace( |
| 24 | - array($this->doctype,$this->html_tag,'</html>',$this->head,'</head>',$this->body,'</body>'), |
|
| 25 | - array('<doctypetag '.substr($this->doctype, 10),'<htmltag '.substr($this->html_tag, 5),'</htmltag>','<headtag '.substr($this->head, 5),'</headtag>','<bodytag '.substr($this->body, 5),'</bodytag>'), |
|
| 24 | + array($this->doctype, $this->html_tag, '</html>', $this->head, '</head>', $this->body, '</body>'), |
|
| 25 | + array('<doctypetag '.substr($this->doctype, 10), '<htmltag '.substr($this->html_tag, 5), '</htmltag>', '<headtag '.substr($this->head, 5), '</headtag>', '<bodytag '.substr($this->body, 5), '</bodytag>'), |
|
| 26 | 26 | $html |
| 27 | 27 | ).'</doctypetag></div>'; |
| 28 | 28 | $preprocessed=token_get_all($html); |
| 29 | 29 | |
| 30 | - $HTML=array_filter($preprocessed, function ($v) { |
|
| 30 | + $HTML=array_filter($preprocessed, function($v) { |
|
| 31 | 31 | return is_array($v)&&$v[0]===T_INLINE_HTML; |
| 32 | 32 | }); |
| 33 | 33 | $PHP=array_diff_key($preprocessed, $HTML); |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | protected function init(&$HTML, &$PHP, &$html) |
| 61 | 61 | { |
| 62 | - list($is_h, $is_p)=array((bool)$HTML,(bool)$PHP); |
|
| 63 | - list($this->is_html, $this->is_php, $this->multi, $this->content, $this->html, $this->php)=array($is_h,$is_p,$is_h&&$is_p,$html,$is_p?$HTML:array(),$is_p?$PHP:array()); |
|
| 62 | + list($is_h, $is_p)=array((bool)$HTML, (bool)$PHP); |
|
| 63 | + list($this->is_html, $this->is_php, $this->multi, $this->content, $this->html, $this->php)=array($is_h, $is_p, $is_h&&$is_p, $html, $is_p ? $HTML : array(), $is_p ? $PHP : array()); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function mustLoadMulti() |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | namespace EZAMA{ |
| 3 | 3 | class prepareStrip |
| 4 | 4 | { |
| 5 | - protected $state ; |
|
| 5 | + protected $state; |
|
| 6 | 6 | protected $preprocessed; |
| 7 | 7 | public function __construct(beforeStrip $prepocessed) |
| 8 | 8 | { |
@@ -19,21 +19,21 @@ discard block |
||
| 19 | 19 | if ($this->state==='single') { |
| 20 | 20 | return $this->prepocessed->getContent(); |
| 21 | 21 | } |
| 22 | - $prepared=$this->preparePhp() + $this->prepareHtml(); |
|
| 22 | + $prepared=$this->preparePhp()+$this->prepareHtml(); |
|
| 23 | 23 | ksort($prepared); |
| 24 | 24 | return join('', $prepared); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function prepareHtml() |
| 28 | 28 | { |
| 29 | - return array_map(function ($v) { |
|
| 30 | - return is_array($v)?$v[1]:$v; |
|
| 29 | + return array_map(function($v) { |
|
| 30 | + return is_array($v) ? $v[1] : $v; |
|
| 31 | 31 | }, $this->prepocessed->getHTML()); |
| 32 | 32 | } |
| 33 | 33 | public function preparePhp() |
| 34 | 34 | { |
| 35 | - return array_map(function ($v) { |
|
| 36 | - return is_array($v)&&($v[0]===T_OPEN_TAG||$v[0]===T_CLOSE_TAG)?($v[0]===T_OPEN_TAG?'<php>':'</php>'):(is_array($v)?$v[1]:$v); |
|
| 35 | + return array_map(function($v) { |
|
| 36 | + return is_array($v)&&($v[0]===T_OPEN_TAG||$v[0]===T_CLOSE_TAG) ? ($v[0]===T_OPEN_TAG ? '<php>' : '</php>') : (is_array($v) ? $v[1] : $v); |
|
| 37 | 37 | }, $this->prepocessed->getPHP()); |
| 38 | 38 | } |
| 39 | 39 | } |