diff options
author | friendica <info@friendica.com> | 2015-03-03 15:56:19 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2015-03-03 15:56:19 -0800 |
commit | c551ca430bd935db860f88910a42aaf63680a12e (patch) | |
tree | bbb7e1108982fe6e08e8bfba0f7695fbe205b974 /include/comanche.php | |
parent | 99e4d2362c3e02f7ef593208a365d81254c25156 (diff) | |
parent | 958a140f641a81f3214f3db06baaaa1055183716 (diff) | |
download | volse-hubzilla-c551ca430bd935db860f88910a42aaf63680a12e.tar.gz volse-hubzilla-c551ca430bd935db860f88910a42aaf63680a12e.tar.bz2 volse-hubzilla-c551ca430bd935db860f88910a42aaf63680a12e.zip |
Merge https://github.com/friendica/red into pending_merge
Diffstat (limited to 'include/comanche.php')
-rw-r--r-- | include/comanche.php | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/include/comanche.php b/include/comanche.php index b181d415a..9db375c38 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -15,23 +15,22 @@ require_once('include/widgets.php'); // page layout from the given description -function pdl_selector($uid,$current="") { - +function pdl_selector($uid, $current="") { $o = ''; - $sql_extra = item_permissions_sql($uid); + //$sql_extra = item_permissions_sql($uid); $r = q("select item_id.*, mid from item_id left join item on iid = item.id where item_id.uid = %d and item_id.uid = item.uid and service = 'PDL' order by sid asc", - intval($owner) + intval($uid) ); $arr = array('channel_id' => $uid, 'current' => $current, 'entries' => $r); call_hooks('pdl_selector',$arr); $entries = $arr['entries']; - $current = $arr['current']; - - $o .= "<select name=\"pdl_select\" id=\"pdl_select\" size=\"1\" >"; + $current = $arr['current']; + + $o .= '<select name="pdl_select" id="pdl_select" size="1">'; $entries[] = array('title' => t('Default'), 'mid' => ''); foreach($entries as $selection) { $selected = (($selection == $current) ? ' selected="selected" ' : ''); @@ -40,16 +39,17 @@ function pdl_selector($uid,$current="") { $o .= '</select>'; return $o; -} +} -function comanche_parser(&$a,$s) { +function comanche_parser(&$a, $s) { + $matches = array(); $cnt = preg_match_all("/\[comment\](.*?)\[\/comment\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { - $s = str_replace($mtch[0],'',$s); + $s = str_replace($mtch[0], '', $s); } } @@ -99,14 +99,14 @@ function comanche_parser(&$a,$s) { function comanche_menu($name,$class = '') { $channel_id = comanche_get_channel_id(); if($channel_id) { - $m = menu_fetch($name,$channel_id,get_observer_hash()); - return menu_render($m,$class); + $m = menu_fetch($name,$channel_id, get_observer_hash()); + return menu_render($m, $class); } } 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]]; } } @@ -121,15 +121,15 @@ function comanche_get_channel_id() { $channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0); if((! $channel_id) && (local_channel())) $channel_id = local_channel(); + return $channel_id; } function comanche_block($name) { - + $o = ''; $channel_id = comanche_get_channel_id(); - + if($channel_id) { - $o = ''; $r = q("select * from item inner join item_id on iid = item.id and item_id.uid = item.uid and item.uid = %d and service = 'BUILDBLOCK' and sid = '%s' limit 1", intval($channel_id), dbesc($name) @@ -138,11 +138,12 @@ function comanche_block($name) { $o = '<div class="widget bblock">'; if($r[0]['title']) $o .= '<h3>' . $r[0]['title'] . '</h3>'; - $o .= prepare_text($r[0]['body'],$r[0]['mimetype']); - $o .= '</div>'; + $o .= prepare_text($r[0]['body'], $r[0]['mimetype']); + $o .= '</div>'; } } + return $o; } @@ -154,8 +155,9 @@ function comanche_block($name) { // of what template and webpage options we might desire. function comanche_webpage(&$a,$s) { - $ret = array(); + $matches = array(); + $cnt = preg_match_all("/\[authored\](.*?)\[\/authored\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { @@ -170,9 +172,10 @@ function comanche_webpage(&$a,$s) { // the global app environment, or config storage until we implement argument passing -function comanche_widget($name,$text) { - $a = get_app(); +function comanche_widget($name, $text) { $vars = array(); + $matches = array(); + $cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $text, $matches, PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { @@ -186,12 +189,13 @@ function comanche_widget($name,$text) { } -function comanche_region(&$a,$s) { +function comanche_region(&$a, $s) { + $matches = array(); $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); + $s = str_replace($mtch[0], comanche_menu(trim($mtch[1])), $s); } } @@ -244,7 +248,3 @@ function register_page_template($arr) { get_app()->page_layouts[$arr['template']] = array($arr['variant']); return; } - - - - |