@@ -794,16 +794,16 @@ |
||
794 | 794 | } |
795 | 795 | |
796 | 796 | /** |
797 | - * Set use of inline link block |
|
798 | - * If this is enabled the class will use the links reference in the HTML. |
|
799 | - * |
|
800 | - * @return void |
|
801 | - * @param bool [optional] $on Should we process link styles? |
|
802 | - */ |
|
797 | + * Set use of inline link block |
|
798 | + * If this is enabled the class will use the links reference in the HTML. |
|
799 | + * |
|
800 | + * @return void |
|
801 | + * @param bool [optional] $on Should we process link styles? |
|
802 | + */ |
|
803 | 803 | public function setLoadCSSFromHTML($on = true) |
804 | - { |
|
805 | - $this->loadCSSFromHTML = (bool) $on; |
|
806 | - } |
|
804 | + { |
|
805 | + $this->loadCSSFromHTML = (bool) $on; |
|
806 | + } |
|
807 | 807 | |
808 | 808 | /** |
809 | 809 | * Set strip original style tags |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | public function setHTML($html) |
145 | 145 | { |
146 | 146 | // strip style definitions, if we use css-class "cleanup" on a style-element |
147 | - $this->html = (string)preg_replace('/<style[^>]+class="cleanup"[^>]*>.*<\/style>/Usi', ' ', $html); |
|
147 | + $this->html = (string) preg_replace('/<style[^>]+class="cleanup"[^>]*>.*<\/style>/Usi', ' ', $html); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function setCSS($css) |
156 | 156 | { |
157 | - $this->css = (string)$css; |
|
157 | + $this->css = (string) $css; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | public function convert($outputXHTML = false, $libXMLOptions = 0, $path = false) |
196 | 196 | { |
197 | 197 | // redefine |
198 | - $outputXHTML = (bool)$outputXHTML; |
|
198 | + $outputXHTML = (bool) $outputXHTML; |
|
199 | 199 | |
200 | 200 | // validate |
201 | 201 | if (!$this->html) { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | // check if there is some link css reference |
212 | 212 | if ($this->loadCSSFromHTML) { |
213 | 213 | foreach ($document->getElementsByTagName('link') as $node) { |
214 | - $file = ($path ? $path : __DIR__) . '/' . $node->getAttribute('href'); |
|
214 | + $file = ($path ? $path : __DIR__) . '/' . $node->getAttribute('href'); |
|
215 | 215 | |
216 | 216 | if (file_exists($file)) { |
217 | 217 | $css .= file_get_contents($file); |
@@ -304,12 +304,12 @@ discard block |
||
304 | 304 | $cssRules = array(); |
305 | 305 | |
306 | 306 | // init vars |
307 | - $css = (string)$css; |
|
307 | + $css = (string) $css; |
|
308 | 308 | |
309 | 309 | $css = $this->doCleanup($css); |
310 | 310 | |
311 | 311 | // rules are splitted by } |
312 | - $rules = (array)explode('}', $css); |
|
312 | + $rules = (array) explode('}', $css); |
|
313 | 313 | |
314 | 314 | // init var |
315 | 315 | $i = 1; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $cssProperties = trim($chunks[1]); |
332 | 332 | |
333 | 333 | // split multiple selectors |
334 | - $selectors = (array)explode(',', $selectors); |
|
334 | + $selectors = (array) explode(',', $selectors); |
|
335 | 335 | |
336 | 336 | // loop selectors |
337 | 337 | foreach ($selectors as $selector) { |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $css = $this->stripeMediaQueries($css); |
401 | 401 | } |
402 | 402 | |
403 | - return (string)$css; |
|
403 | + return (string) $css; |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | /** |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | // remove comments previously to matching media queries |
416 | 416 | $css = preg_replace(self::$styleCommentRegEx, '', $css); |
417 | 417 | |
418 | - return (string)preg_replace(self::$cssMediaQueriesRegEx, '', $css); |
|
418 | + return (string) preg_replace(self::$cssMediaQueriesRegEx, '', $css); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | /** |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | */ |
428 | 428 | private function stripeCharsetInCss($css) |
429 | 429 | { |
430 | - return (string)preg_replace(self::$cssCharsetRegEx, '', $css); |
|
430 | + return (string) preg_replace(self::$cssCharsetRegEx, '', $css); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | /** |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | // loop properties |
449 | 449 | foreach ($properties as $property) { |
450 | 450 | // split into chunks |
451 | - $chunks = (array)explode(':', $property, 2); |
|
451 | + $chunks = (array) explode(':', $property, 2); |
|
452 | 452 | |
453 | 453 | // validate |
454 | 454 | if (!isset($chunks[1])) { |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | */ |
487 | 487 | private function splitIntoProperties($styles) |
488 | 488 | { |
489 | - $properties = (array)explode(';', $styles); |
|
489 | + $properties = (array) explode(';', $styles); |
|
490 | 490 | $propertiesCount = count($properties); |
491 | 491 | |
492 | 492 | for ($i = 0; $i < $propertiesCount; $i++) { |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | // any styles defined before? |
682 | 682 | if (null !== $stylesAttribute) { |
683 | 683 | // get value for the styles attribute |
684 | - $definedStyles = (string)$stylesAttribute->value; |
|
684 | + $definedStyles = (string) $stylesAttribute->value; |
|
685 | 685 | |
686 | 686 | // split into properties |
687 | 687 | $definedProperties = $this->splitIntoProperties($definedStyles); |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | || |
699 | 699 | false === stripos($properties[$key], '!important') |
700 | 700 | || |
701 | - false !== stripos(implode('', (array)$value), '!important') |
|
701 | + false !== stripos(implode('', (array) $value), '!important') |
|
702 | 702 | ) { |
703 | 703 | $properties[$key] = $value; |
704 | 704 | } |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | // build chunks |
711 | 711 | foreach ($properties as $key => $values) { |
712 | - foreach ((array)$values as $value) { |
|
712 | + foreach ((array) $values as $value) { |
|
713 | 713 | $propertyChunks[] = $key . ': ' . $value . ';'; |
714 | 714 | } |
715 | 715 | } |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | } |
740 | 740 | |
741 | 741 | // split into chunks |
742 | - $chunks = (array)explode(':', trim($property), 2); |
|
742 | + $chunks = (array) explode(':', trim($property), 2); |
|
743 | 743 | |
744 | 744 | // validate |
745 | 745 | if (!isset($chunks[1])) { |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | */ |
806 | 806 | public function setCleanup($on = true) |
807 | 807 | { |
808 | - $this->cleanup = (bool)$on; |
|
808 | + $this->cleanup = (bool) $on; |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | /** |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | */ |
818 | 818 | public function setEncoding($encoding) |
819 | 819 | { |
820 | - $this->encoding = (string)$encoding; |
|
820 | + $this->encoding = (string) $encoding; |
|
821 | 821 | } |
822 | 822 | |
823 | 823 | /** |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | */ |
829 | 829 | public function setUseInlineStylesBlock($on = true) |
830 | 830 | { |
831 | - $this->useInlineStylesBlock = (bool)$on; |
|
831 | + $this->useInlineStylesBlock = (bool) $on; |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | /** |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | */ |
852 | 852 | public function setStripOriginalStyleTags($on = true) |
853 | 853 | { |
854 | - $this->stripOriginalStyleTags = (bool)$on; |
|
854 | + $this->stripOriginalStyleTags = (bool) $on; |
|
855 | 855 | } |
856 | 856 | |
857 | 857 | /** |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | */ |
866 | 866 | public function setExcludeMediaQueries($on = true) |
867 | 867 | { |
868 | - $this->excludeMediaQueries = (bool)$on; |
|
868 | + $this->excludeMediaQueries = (bool) $on; |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | /** |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | */ |
876 | 876 | public function setExcludeCssCharset($on = true) |
877 | 877 | { |
878 | - $this->excludeCssCharset = (bool)$on; |
|
878 | + $this->excludeCssCharset = (bool) $on; |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | /** |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | */ |
886 | 886 | public function setExcludeConditionalInlineStylesBlock($on = true) |
887 | 887 | { |
888 | - $this->excludeConditionalInlineStylesBlock = (bool)$on; |
|
888 | + $this->excludeConditionalInlineStylesBlock = (bool) $on; |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | } |