------------------------------------------------------------
revno: 866
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Wed 2011-06-22 23:36:01 +0200
message:
  Improvments and corrections in widgets
modified:
  src/libs/url.php
  src/libs/widgets.php


--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk

Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to 
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'src/libs/url.php'
--- src/libs/url.php	2011-06-22 20:18:28 +0000
+++ src/libs/url.php	2011-06-22 21:36:01 +0000
@@ -114,22 +114,36 @@
 		if ( $displayString ) {	
 			
 			foreach ( explode("|",$displayString) as $displayUrl) {
+				
 				if (!$displayUrl) {
 					continue;
 				}			
 				
+				// easy option
 				if ( $displayUrl=="*" 
 					 || ( $this->pretty =='' && $displayUrl=='homepage')
 					 || strpos($this->pretty,$displayUrl)===0 ){
 					return true;
-				} elseif ( strpos( $displayUrl, "*")!==false){
-					// now the hard work user/details/1 must match user/details/*	
-					if ( preg_match ('/^#.+#[Uims]*$/', $displayUrl)) {						
-						return preg_match ( $displayUrl, $this->pretty);
+				}
+				
+				//regular expression?
+				if ( strpos( $displayUrl, "#")===0 &&
+						preg_match ('/^#.+#[Uims]*$/', $displayUrl) ) {
+					//it's a regex, so or match or continue.		
+					if ( preg_match ( $displayUrl, $this->pretty) ) {						
+						return true;
 					} else {						
-						$temp= str_replace("*","[^/]*", $displayUrl );					
-						return preg_match ( "#^". $temp. '$#ui', $this->pretty);
-					}				    
+						continue;
+					}							
+				}	
+				
+				// can be /foo/bar/*..
+				if ( strpos( $displayUrl, "*")!==false){
+					// now the hard work user/details/1 must match user/details/*				
+					$temp= str_replace("*","[^/]*", $displayUrl );	
+					if ( preg_match ( "#^". $temp. '$#ui', $this->pretty) ) {
+						return true;
+					}						
 				}				
 			}	
 		}	

=== modified file 'src/libs/widgets.php'
--- src/libs/widgets.php	2011-06-22 20:18:28 +0000
+++ src/libs/widgets.php	2011-06-22 21:36:01 +0000
@@ -225,7 +225,7 @@
 					$son_widget_group = array();
 
 					foreach ( $son_widgets as $son_widget ){
-						if ( $url->match($son_widget->display_urls) or true ) {
+						if ( $url->match($son_widget->display_urls) && !$url->match($son_widget->kill_urls) ) {
 							$son_widget_group[] = $son_widget->id;
 						}
 

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to