diff options
author | Thomas Willingham <founder@kakste.com> | 2012-12-18 16:59:08 +0000 |
---|---|---|
committer | Thomas Willingham <founder@kakste.com> | 2012-12-18 16:59:08 +0000 |
commit | d9194fdb5a6709eba8f47795dd5367d79ad0e367 (patch) | |
tree | 86a91ec7a556310400c2eb26d45bbeb108486b36 /include | |
parent | 2cb2896916ce98f16b891634fddcbd403c55d95f (diff) | |
parent | e9b5b0f0b424930b87708080c4e6ce671016177b (diff) | |
download | volse-hubzilla-d9194fdb5a6709eba8f47795dd5367d79ad0e367.tar.gz volse-hubzilla-d9194fdb5a6709eba8f47795dd5367d79ad0e367.tar.bz2 volse-hubzilla-d9194fdb5a6709eba8f47795dd5367d79ad0e367.zip |
Merge remote-tracking branch 'upstream/master'
Conflicts:
view/theme/redbasic/css/style.css
Diffstat (limited to 'include')
-rw-r--r-- | include/ItemObject.php | 2 | ||||
-rw-r--r-- | include/conversation.php | 1 | ||||
-rw-r--r-- | include/iquery.php | 4 | ||||
-rw-r--r-- | include/template_processor.php | 51 |
4 files changed, 48 insertions, 10 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php index 09f5d1298..45ea6860a 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -209,7 +209,7 @@ class Item extends BaseObject { 'type' => implode("",array_slice(explode("/",$item['verb']),-1)), 'tags' => $tags, - 'body' => template_escape($body), + 'body' => $body, 'text' => strip_tags(template_escape($body)), 'id' => $this->get_id(), 'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])), diff --git a/include/conversation.php b/include/conversation.php index f910801ba..ea2f84cbf 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -703,6 +703,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { '$mode' => $mode, '$user' => $a->user, '$threads' => $threads, + '$wait' => t('Loading...'), '$dropping' => ($page_dropping?t('Delete Selected Items'):False), )); diff --git a/include/iquery.php b/include/iquery.php index 03264de28..0d51134a4 100644 --- a/include/iquery.php +++ b/include/iquery.php @@ -9,8 +9,8 @@ function network_query($a,$arr) { $ordering = (($arr['order'] === 'post') ? "`created`" : "`commented`") . " DESC "; - $itemspage = get_pconfig($arr['uid'],'system','itemspage_network'); - $a->set_pager_itemspage(((intval($itemspage_network)) ? $itemspage_network : 40)); + $itemspage = get_pconfig($arr['uid'],'system','itemspage'); + $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 40)); $pager_sql = ((intval($arr['update'])) ? '' : sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']))); diff --git a/include/template_processor.php b/include/template_processor.php index 89f03dfe0..61526e570 100644 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -46,7 +46,7 @@ foreach($keys as $k) { $val = (isset($val[$k]) ? $val[$k] : null); } - return $val; + return template_escape($val); } /** @@ -196,12 +196,49 @@ * (subgrup 1), match close bracket */ if (preg_match_all('/\$(\[)?([a-zA-Z0-9-_]+\.?)+(?(1)\])/', $s,$m)){ - - foreach($m[0] as $var){ - $varn = str_replace(array("[","]"), array("",""), $var); - $val = $this->_get_var($varn, true); - if ($val!=KEY_NOT_EXISTS) - $s = str_replace($var, $val, $s); + foreach($m[0] as $var){ + + $exp = str_replace(array("[", "]"), array("", ""), $var); + $exptks = explode("|", $exp); + + $varn = $exptks[0]; + unset($exptks[0]); + $val = $this->_get_var($varn, true); + if ($val != KEY_NOT_EXISTS) { + /* run filters */ + /* + * Filter are in form of: + * filtername:arg:arg:arg + * + * "filtername" is function name + * "arg"s are optional, var value is appended to the end + * if one "arg"==='x' , is replaced with var value + * + * examples: + * $item.body|htmlspecialchars // escape html chars + * $item.body|htmlspecialchars|strtoupper // escape html and uppercase result + * $item.created|date:%Y %M %j // format date (created is a timestamp) + * $item.body|str_replace:cat:dog // replace all "cat" with "dog" + * $item.body|str_replace:cat:dog:x:1 // replace one "cat" with "dog" + + */ + foreach ($exptks as $filterstr) { + $filter = explode(":", $filterstr); + $filtername = $filter[0]; + unset($filter[0]); + $valkey = array_search("x", $filter); + if ($valkey === false) { + $filter[] = $val; + } else { + $filter[$valkey] = $val; + } + if (function_exists($filtername)) { + $val = call_user_func_array($filtername, $filter); + } + } + $s = str_replace($var, $val, $s); + + } } } |