From 0be8e4061c42372a60e0274e7947edcb81625eaa Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Sep 2013 01:57:11 -0700 Subject: testing Comanche --- boot.php | 5 ++--- include/comanche.php | 13 +++++++------ mod/page.php | 5 ++++- version.inc | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/boot.php b/boot.php index 3c340da90..8ab617a97 100755 --- a/boot.php +++ b/boot.php @@ -2452,10 +2452,9 @@ function construct_page(&$a) { foreach($a->layout as $k => $v) { if((strpos($k,'region_') === 0) && strlen($v)) { if(strpos($v,'$region_') !== false) { - $v = preg_replace_callback('/\$region_([a-zA-Z0-9]*?)/ism','comanche_replace_region',$v); - + $v = preg_replace_callback('/\$region_([a-zA-Z0-9]+)/ism','comanche_replace_region',$v); } - $a->data[substr($k,0,7)] = $v; + $a->page[substr($k,7)] = $v; } } } diff --git a/include/comanche.php b/include/comanche.php index bdce0c5e2..3b50a5d85 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -45,15 +45,15 @@ function pdl_selector($uid,$current="") { function comanche_parser(&$a,$s) { - $cnt = preg_match("/\[layout\](.*?)\[\/layout\]/ism", $matches, $s); + $cnt = preg_match("/\[layout\](.*?)\[\/layout\]/ism", $s, $matches); if($cnt) $a->page['template'] = trim($matches[1]); - $cnt = preg_match("/\[theme\](.*?)\[\/theme\]/ism", $matches, $s); + $cnt = preg_match("/\[theme\](.*?)\[\/theme\]/ism", $s, $matches); if($cnt) $a->layout['theme'] = trim($matches[1]); - $cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $matches, $s, PREG_SET_ORDER); + $cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { $a->layout['region_' . $mtch[1]] = comanche_region($a,$mtch[2]); @@ -71,8 +71,9 @@ function comanche_menu($name) { function comanche_replace_region($match) { $a = get_app(); - if(array_key_exists($match[1],$a->page)) + if(array_key_exists($match[1],$a->page)) { return $a->page[$match[1]]; + } } // Widgets will have to get any operational arguments from the session, @@ -90,7 +91,7 @@ function comanche_widget($name,$args = null) { function comanche_region(&$a,$s) { - $cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $matches, $s, PREG_SET_ORDER); + $cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { $s = str_replace($mtch[0],comanche_menu(trim($mtch[1])),$s); @@ -99,7 +100,7 @@ function comanche_region(&$a,$s) { // need to modify this to accept parameters - $cnt = preg_match_all("/\[widget\](.*?)\[\/widget\]/ism", $matches, $s, PREG_SET_ORDER); + $cnt = preg_match_all("/\[widget\](.*?)\[\/widget\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { $s = str_replace($mtch[0],comanche_widget(trim($mtch[1])),$s); diff --git a/mod/page.php b/mod/page.php index b227227bb..d91f8d866 100644 --- a/mod/page.php +++ b/mod/page.php @@ -60,7 +60,7 @@ function page_content(&$a) { notice( t('Item not found.') . EOL); return; } - +dbg(1); if($r[0]['layout_mid']) { $l = q("select body from item where mid = '%s' and uid = %d limit 1", dbesc($r[0]['layout_mid']), @@ -72,6 +72,9 @@ function page_content(&$a) { comanche_parser(get_app(),$l[0]['body']); } } +dbg(0); + +logger('layout: ' . print_r($a->layout,true)); // Use of widgets should be determined by Comanche, but we don't have it yet, so... diff --git a/version.inc b/version.inc index 5a1e9d9a7..a0e566714 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-09-02.424 +2013-09-03.425 -- cgit v1.2.3