diff options
author | Paolo T <tuscanhobbit@users.noreply.github.com> | 2013-10-25 00:09:42 -0700 |
---|---|---|
committer | Paolo T <tuscanhobbit@users.noreply.github.com> | 2013-10-25 00:09:42 -0700 |
commit | b23f3fc03b6bc751aab67fe2258a21f7c65bab8e (patch) | |
tree | 84c997aa781afa566536ca5f66eb8f90ef468476 /include/comanche.php | |
parent | d30f718e0836a031e43d5403480aa049561e736e (diff) | |
parent | 0b0bd3c20765d267ec6d7cc261c7713917a22582 (diff) | |
download | volse-hubzilla-b23f3fc03b6bc751aab67fe2258a21f7c65bab8e.tar.gz volse-hubzilla-b23f3fc03b6bc751aab67fe2258a21f7c65bab8e.tar.bz2 volse-hubzilla-b23f3fc03b6bc751aab67fe2258a21f7c65bab8e.zip |
Merge pull request #3 from friendica/master
Align to main project HEAD
Diffstat (limited to 'include/comanche.php')
-rw-r--r-- | include/comanche.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/include/comanche.php b/include/comanche.php index f1dd0e521..4c6ea2f54 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -2,6 +2,7 @@ require_once('include/security.php'); require_once('include/menu.php'); + // When editing a webpage - a dropdown is needed to select a page layout // On submit, the pdl_select value (which is the mid of an item with item_restrict = ITEM_PDL) is stored in // the webpage's resource_id, with resource_type 'pdl'. @@ -126,11 +127,19 @@ function comanche_webpage(&$a,$s) { // the global app environment, or config storage until we implement argument passing -function comanche_widget($name,$args = null) { +function comanche_widget($name,$text) { $a = get_app(); + $vars = array(); + $cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $text, $matches, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $vars[$mtch[1]] = $mtch[2]; + } + } + $func = 'widget_' . trim($name); if(function_exists($func)) - return $func($args); + return $func($vars); } @@ -152,10 +161,10 @@ function comanche_region(&$a,$s) { // need to modify this to accept parameters - $cnt = preg_match_all("/\[widget\](.*?)\[\/widget\]/ism", $s, $matches, 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); + $s = str_replace($mtch[0],comanche_widget(trim($mtch[1]),$mtch[2]),$s); } } |