Move lessc and Emogrifier classes to RainLoopVendor namespace

This commit is contained in:
RainLoop Team 2016-06-09 20:09:34 +03:00
parent 253a19987f
commit d0ec3320c8
4 changed files with 16 additions and 10 deletions

View file

@ -9970,15 +9970,15 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$fAdditionalDomReader = null; $fAdditionalDomReader = null;
if (0 < \strlen($sHtml) && $this->Config()->Get('labs', 'emogrifier', false)) if (0 < \strlen($sHtml) && $this->Config()->Get('labs', 'emogrifier', false))
{ {
if (!\class_exists('Pelago\Emogrifier', false)) if (!\class_exists('RainLoopVendor\Pelago\Emogrifier', false))
{ {
include_once APP_VERSION_ROOT_PATH.'app/libraries/emogrifier/Emogrifier.php'; include_once APP_VERSION_ROOT_PATH.'app/libraries/emogrifier/Emogrifier.php';
} }
if (\class_exists('Pelago\Emogrifier', false)) if (\class_exists('RainLoopVendor\Pelago\Emogrifier', false))
{ {
$fAdditionalDomReader = function ($oDom) { $fAdditionalDomReader = function ($oDom) {
$oEmogrifier = new \Pelago\Emogrifier(); $oEmogrifier = new \RainLoopVendor\Pelago\Emogrifier();
$oEmogrifier->preserveEncoding = false; $oEmogrifier->preserveEncoding = false;
return $oEmogrifier->emogrify($oDom); return $oEmogrifier->emogrify($oDom);
}; };

View file

@ -731,7 +731,7 @@ class ServiceActions
include_once APP_VERSION_ROOT_PATH.'app/libraries/lessphp/ctype.php'; include_once APP_VERSION_ROOT_PATH.'app/libraries/lessphp/ctype.php';
include_once APP_VERSION_ROOT_PATH.'app/libraries/lessphp/lessc.inc.php'; include_once APP_VERSION_ROOT_PATH.'app/libraries/lessphp/lessc.inc.php';
$oLess = new \lessc(); $oLess = new \RainLoopVendor\lessc();
$oLess->setFormatter('compressed'); $oLess->setFormatter('compressed');
$aResult = array(); $aResult = array();

View file

@ -1,5 +1,5 @@
<?php <?php
namespace Pelago; namespace RainLoopVendor\Pelago;
/** /**
* This class provides functions for converting CSS styles into inline style attributes in your HTML code. * This class provides functions for converting CSS styles into inline style attributes in your HTML code.

View file

@ -1,5 +1,10 @@
<?php <?php
namespace RainLoopVendor;
class stdClass extends \stdClass {};
class Exception extends \Exception {};
/** /**
* lessphp v0.3.9 * lessphp v0.3.9
* http://leafo.net/lessphp * http://leafo.net/lessphp
@ -1814,6 +1819,7 @@ class lessc {
$className = "lessc_formatter_$this->formatterName"; $className = "lessc_formatter_$this->formatterName";
} }
$className = 'RainLoopVendor\\'.$className;
return new $className; return new $className;
} }
@ -2093,7 +2099,7 @@ class lessc_parser {
if (!self::$operatorString) { if (!self::$operatorString) {
self::$operatorString = self::$operatorString =
'('.implode('|', array_map(array('lessc', 'preg_quote'), '('.implode('|', array_map(array('RainLoopVendor\\lessc', 'preg_quote'),
array_keys(self::$precedence))).')'; array_keys(self::$precedence))).')';
$commentSingle = lessc::preg_quote(self::$commentSingle); $commentSingle = lessc::preg_quote(self::$commentSingle);
@ -2322,8 +2328,8 @@ class lessc_parser {
protected function isDirective($dirname, $directives) { protected function isDirective($dirname, $directives) {
// TODO: cache pattern in parser // TODO: cache pattern in parser
$pattern = implode("|", $pattern = implode('|',
array_map(array("lessc", "preg_quote"), $directives)); array_map(array('RainLoopVendor\\lessc', 'preg_quote'), $directives));
$pattern = '/^(-[a-z-]+-)?(' . $pattern . ')$/i'; $pattern = '/^(-[a-z-]+-)?(' . $pattern . ')$/i';
return preg_match($pattern, $dirname); return preg_match($pattern, $dirname);
@ -2611,7 +2617,7 @@ class lessc_parser {
$this->eatWhiteDefault = false; $this->eatWhiteDefault = false;
$stop = array("'", '"', "@{", $end); $stop = array("'", '"', "@{", $end);
$stop = array_map(array("lessc", "preg_quote"), $stop); $stop = array_map(array('RainLoopVendor\\lessc', 'preg_quote'), $stop);
// $stop[] = self::$commentMulti; // $stop[] = self::$commentMulti;
if (!is_null($rejectStrs)) { if (!is_null($rejectStrs)) {