------------------------------------------------------------
revno: 1117
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Fri 2012-03-02 15:35:05 +0100
message:
  added [url] and url->get
modified:
  libs/aiki.php
  libs/url.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 'libs/aiki.php'
--- libs/aiki.php	2012-02-12 22:40:29 +0000
+++ libs/aiki.php	2012-03-02 14:35:05 +0000
@@ -298,7 +298,7 @@
         $delim= "";
         
 		$temp ="";
-		if ( preg_match ('/\(([a-z_]+)\(/U', $string, $temp)  ){
+		if ( preg_match ('/\(([a-z_]*)\(/U', $string, $temp)  ){
 			$delim      = $temp[1];
 			$startDelim ="($delim(";
 			$endDelim   =")$delim)";
@@ -313,12 +313,13 @@
         }
 
 		$end = $initial;
-		$nested = $initial;
+		$nested = $initial;		
         
         do {
 
             $nested = strpos($string, $startDelim, $nested+1);
             $end    = strpos($string, $endDelim, $end+1);
+            
             if ( $end === false )
                 return false;
             if ( $nested === false || $nested > $end ){
@@ -445,6 +446,7 @@
 				'[site_prefix]'   => $prefix ,
 				'[view_prefix]'   => $view_prefix ,
 				'[route]'		 => $trimedUrl.  "/". $paths,
+				'[url]'           => $aiki->url->get(),
 				'[route-local]'	 => $paths );
 									
 			// substitute all [POST[key]] and [GET[key]]

=== modified file 'libs/url.php'
--- libs/url.php	2012-01-07 10:28:04 +0000
+++ libs/url.php	2012-03-02 14:35:05 +0000
@@ -96,6 +96,19 @@
 		$this->url_count = count($this->url);
 	}
 
+    public function get($language=false){
+		
+		if ( isset($this->url[0]) && $this->url[0]=="homepage"){
+			return ( $language!== false ? $language : "");
+		} 
+			
+		$ret= implode("/", $this->url);		
+		if ( $language!== false ){
+			$ret = implode("/", array($language, $ret ));
+		}
+		return $ret;					
+	}
+
 
 	/**
 	 * Apply a url on a query.
@@ -140,7 +153,7 @@
 	public function match($displayString) {
 		if ($displayString) {
 			
-			// a regular expression can containe a | character, that must be 
+			// a regular expression can contains a | character, that must be 
 			// escaped, so in this case use preg_split.
 			if ( strpos($displayString,"#") !== false ) {
 				$displayUrls= preg_split('#(?<!\\\)\|#', $displayString);			
@@ -202,4 +215,4 @@
 
 } // end of url class
 
-?>
\ No newline at end of file
+?>

_______________________________________________
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