diff options
Diffstat (limited to 'www/wiki/skins/chameleon/src/PermissionsHelper.php')
-rw-r--r-- | www/wiki/skins/chameleon/src/PermissionsHelper.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/www/wiki/skins/chameleon/src/PermissionsHelper.php b/www/wiki/skins/chameleon/src/PermissionsHelper.php index 5d5e9edc..3d895c98 100644 --- a/www/wiki/skins/chameleon/src/PermissionsHelper.php +++ b/www/wiki/skins/chameleon/src/PermissionsHelper.php @@ -147,6 +147,39 @@ class PermissionsHelper { } /** + * @since 1.1 + * + * AGREGADO PARA REEVO! + * + * @param string $attributeNameInDomElement + * + * @return bool + */ + public function pageHasCategory( $attributeNameInDomElement ) { + + if ( !$this->hasAttribute( $attributeNameInDomElement ) ) { + return $this->default; + } + + $expectedCategories = $this->getValueListFromAttribute( $attributeNameInDomElement ); + + $pagename = $this->skin->getTitle(); + $cats = $this->skin->getSkin()->getCategoryLinks(); + preg_match_all('/<\s*a[^>]*>(.*?)<\s*\/\s*a>/', $cats, $output_array); + $pageCategory = $output_array[1]; + $match = array_intersect($pageCategory,$expectedCategories); + $final = reset($match); + if ($match) { + // error_log('Se encontro una categoria en la página '.$pagename.' que aplica una regla de Modification en Chamaleon'); + $pageCategory = $final; + } + + return in_array( $pageCategory, $expectedCategories ); + } + + + + /** * @param null|string $value * * @return int |