From e60b66abdf9324e05c29a006aa43cdcf32e509b4 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Thu, 28 Jun 2012 12:35:54 -0700 Subject: [PATCH 1/4] Default to non mb functions and adding selector --- CSSParser.php | 2 +- lib/CSSList.php | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CSSParser.php b/CSSParser.php index c6585c2d..7a86c5a1 100644 --- a/CSSParser.php +++ b/CSSParser.php @@ -20,7 +20,7 @@ class CSSParser { * * @var bool */ - private $bUseMbFunctions = TRUE; + private $bUseMbFunctions = FALSE; public function __construct($sText, $sDefaultCharset = 'utf-8') { $this->sText = $sText; diff --git a/lib/CSSList.php b/lib/CSSList.php index b2a4b23f..a563a8e5 100644 --- a/lib/CSSList.php +++ b/lib/CSSList.php @@ -106,6 +106,28 @@ protected function allValues($oElement, &$aResult, $sSearchString = null, $bSear } } + /** + * Retrieve a selector by id or name. + * + * @param $selector + * @return bool + */ + public function getRuleBySelector($selector) + { + foreach($this->getAllDeclarationBlocks() as $oBlock) + { + foreach($oBlock->getSelectors() as $oSelector) + { + if($oSelector->getSelector() == $selector) + { + return $oBlock; + } + } + } + + return FALSE; + } + protected function allSelectors(&$aResult, $sSpecificitySearch = null) { foreach($this->getAllDeclarationBlocks() as $oBlock) { foreach($oBlock->getSelectors() as $oSelector) { From 4dd2a1cea074f14cdd8e62a5e21301ecde117b1a Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Thu, 28 Jun 2012 17:55:03 -0700 Subject: [PATCH 2/4] Doc update --- lib/CSSList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/CSSList.php b/lib/CSSList.php index a563a8e5..ac07caee 100644 --- a/lib/CSSList.php +++ b/lib/CSSList.php @@ -110,7 +110,7 @@ protected function allValues($oElement, &$aResult, $sSearchString = null, $bSear * Retrieve a selector by id or name. * * @param $selector - * @return bool + * @return CSSList */ public function getRuleBySelector($selector) { From 277a0d30ee7881f2b4ec1b5d10e8a9a1ecd10dbd Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Fri, 29 Jun 2012 10:27:53 -0700 Subject: [PATCH 3/4] Adding ability to retrieve type for @rules --- lib/CSSRuleSet.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/CSSRuleSet.php b/lib/CSSRuleSet.php index 2788f2ff..b1b5b1f4 100644 --- a/lib/CSSRuleSet.php +++ b/lib/CSSRuleSet.php @@ -77,7 +77,11 @@ public function __construct($sType) { parent::__construct(); $this->sType = $sType; } - + + public function getType() { + return $this->sType; + } + public function __toString() { $sResult = "@{$this->sType} {"; $sResult .= parent::__toString(); From dce353b32224bb5878e987f4303b77ba72e150ed Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Fri, 29 Jun 2012 10:32:21 -0700 Subject: [PATCH 4/4] removing unwatned merge func --- CSSParser.php | 2 +- lib/CSSList.php | 22 ---------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/CSSParser.php b/CSSParser.php index 7a86c5a1..c6585c2d 100644 --- a/CSSParser.php +++ b/CSSParser.php @@ -20,7 +20,7 @@ class CSSParser { * * @var bool */ - private $bUseMbFunctions = FALSE; + private $bUseMbFunctions = TRUE; public function __construct($sText, $sDefaultCharset = 'utf-8') { $this->sText = $sText; diff --git a/lib/CSSList.php b/lib/CSSList.php index ac07caee..b2a4b23f 100644 --- a/lib/CSSList.php +++ b/lib/CSSList.php @@ -106,28 +106,6 @@ protected function allValues($oElement, &$aResult, $sSearchString = null, $bSear } } - /** - * Retrieve a selector by id or name. - * - * @param $selector - * @return CSSList - */ - public function getRuleBySelector($selector) - { - foreach($this->getAllDeclarationBlocks() as $oBlock) - { - foreach($oBlock->getSelectors() as $oSelector) - { - if($oSelector->getSelector() == $selector) - { - return $oBlock; - } - } - } - - return FALSE; - } - protected function allSelectors(&$aResult, $sSpecificitySearch = null) { foreach($this->getAllDeclarationBlocks() as $oBlock) { foreach($oBlock->getSelectors() as $oSelector) {