diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/function.parse_service.php | 26 | ||||
-rw-r--r-- | plugins/modifier.contact_info.php | 12 | ||||
-rw-r--r-- | plugins/modifier.count.php | 8 | ||||
-rw-r--r-- | plugins/modifier.group_by.php | 23 | ||||
-rw-r--r-- | plugins/modifier.key_not_exists.php | 15 | ||||
-rw-r--r-- | plugins/prefilter.whitespace_control.php | 63 | ||||
-rw-r--r-- | plugins/resource.dokuwiki.php | 33 |
7 files changed, 0 insertions, 180 deletions
diff --git a/plugins/function.parse_service.php b/plugins/function.parse_service.php deleted file mode 100644 index aa9983d..0000000 --- a/plugins/function.parse_service.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -function smarty_function_parse_service($params, Smarty_Internal_Template $template) -{ - if (empty($params['var'])) { - trigger_error("assign: missing 'var' parameter"); - return; - } - - if (!in_array('value', array_keys($params))) { - trigger_error("assign: missing 'value' parameter"); - return; - } - - $name = $params['value']; - $port = null; - - if (is_array($params['value'])) { - $name = array_keys($params['value'])[0]; - $port = array_values($params['value'])[0]; - } - - $template->assign($params['var'], array('name' => $name, 'port' => $port)); -} - -?> diff --git a/plugins/modifier.contact_info.php b/plugins/modifier.contact_info.php deleted file mode 100644 index 6537b7a..0000000 --- a/plugins/modifier.contact_info.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -function smarty_modifier_contact_info($value) -{ - if (is_array($value)) { - return '[[' . array_values($value)[0] . '|' . array_keys($value)[0] . ']]'; - } - - return '[[' . $value . '@spline.inf.fu-berlin.de' . '|' . $value . ']]'; -} - -?> diff --git a/plugins/modifier.count.php b/plugins/modifier.count.php deleted file mode 100644 index c077c11..0000000 --- a/plugins/modifier.count.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -function smarty_modifier_count($value) -{ - return count($value); -} - -?> diff --git a/plugins/modifier.group_by.php b/plugins/modifier.group_by.php deleted file mode 100644 index 74bf045..0000000 --- a/plugins/modifier.group_by.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -function smarty_modifier_group_by($value, $key) -{ - $array = array(); - - foreach ($value as $k => $v) { - if (array_key_exists($key, $v)) { - if (is_array($v[$key])) { - foreach ($v[$key] as $key_part) { - $array[$key_part][$k] = $v; - } - } - else { - $array[$v[$key]][$k] = $v; - } - } - } - - return $array; -} - -?> diff --git a/plugins/modifier.key_not_exists.php b/plugins/modifier.key_not_exists.php deleted file mode 100644 index f29e077..0000000 --- a/plugins/modifier.key_not_exists.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -function smarty_modifier_key_not_exists($value, $key) -{ - if (!is_array($value)) { - return array(); - } - - return array_filter($value, - function($v) use ($key) { - return !array_key_exists($key, $v); - }); -} - -?> diff --git a/plugins/prefilter.whitespace_control.php b/plugins/prefilter.whitespace_control.php deleted file mode 100644 index fa6b854..0000000 --- a/plugins/prefilter.whitespace_control.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -/** - * Smarty Whitespace Control - * - * {-tag} remove white space infront of tag up to the previous non-whitespace character or beginning of the line - * "text \n\n\t {-tag}" -> "text \n\n{tag}" - * "text \n\n\t text\t {-tag}" -> "text \n\n\t text{tag}" - * {--tag} remove white space infront of tag up to the previous non-whitespace character - * "text \n\n\t {--tag}" -> "text{tag}" - * "text \n\n\t text\t {--tag}" -> "text \n\n\t text{tag}" - * {+-tag} - * {-+tag} replace white space infront of tag up to the previous non-whitespace character by a single line-break - * "text \n\n\t {-+tag}" -> "text\n{tag}" - * "text \n\n\t text\t {-+tag}" -> "text \n\n\t text\n{tag}" - * - * {tag-} remove white space after tag up to the next non-whitespace character or end of the line - * "{tag-} \n\n\t text" -> "{tag}\n\n\t text" - * "{tag-} text \n\n\t text" -> "{tag}text \n\n\t text" - * {tag--} remove white space after tag up to the next non-whitespace character - * "{tag--} \n\n\t text" -> "{tag}text" - * "{tag--} text \n\n\t text" -> "{tag}text \n\n\t text" - * {tag+-} - * {tag-+} replace white space after tag up to the next non-whitespace character by a single line-break - * "{tag-+} \n\n\t text" -> "{tag}\n\ntext" - * "{tag-+} text \n\n\t text" -> "{tag}\n\ntext \n\n\t text" - * - * {tag+} replace white space after tag up to the end of the line with an additional line-break - * "{tag+} \n\t text" -> "{tag}\n\n\t text" - * "{tag+} text \n\n\t text" -> "{tag}\n\ntext \n\n\t text" - * - * Any combination of the above, say {--tag+} is possible. Any + modifiers are executed before - modifiers, so - * "{tag+-}{--tag}" will lead to "{tag}{tag}" - * - * NOTE: {tag+} and {tag-+} cause two trailing \n. This is done because PHP itself throws away the first \n. - * So \n\n in the template will lead to \n in the output - * - * @param string $string raw template source - * @param Smarty_Internal_Template $template Template instance - * @return string raw template source after whitespace control was applied - * @author Rodney Rehm - */ -function smarty_prefilter_whitespace_control($string, Smarty_Internal_Template $template) { - $ldelim = $template->smarty->left_delimiter; - $rdelim = $template->smarty->right_delimiter; - $_ldelim = preg_quote($ldelim); - $_rdelim = preg_quote($rdelim); - - // remove preceeding whitepsace preserving a single line-break - $string = preg_replace('#\s*'. $_ldelim .'(?:-\+|\+-)#', "\n" . $ldelim, $string); - // remove trailing whitespace preserving s single line-break - $string = preg_replace('#(?:\+-|-\+)'. $_rdelim .'\s*#', $rdelim . "\n\n", $string); - - // remove preceeding whitepsace - $string = preg_replace('#\s*'. $_ldelim .'--|[^\S\r\n]*'. $_ldelim .'-#', $ldelim, $string); - // remove trailing whitespace - $string = preg_replace('#--'. $_rdelim .'\s*|-'. $_rdelim .'[^\S\r\n]*#', $rdelim, $string); - - // force trailing line-break - $string = preg_replace('#\+'. $_rdelim .'(?:\s*[\r\n]|[^\S\r\n]*)#', $rdelim . "\n\n", $string); - - return $string; -} diff --git a/plugins/resource.dokuwiki.php b/plugins/resource.dokuwiki.php deleted file mode 100644 index 4842524..0000000 --- a/plugins/resource.dokuwiki.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -class Smarty_Resource_Dokuwiki extends Smarty_Resource_Custom { - - private function build_pagename($name) { - return 'hostinfo:templates:' . cleanID($name); - } - - protected function fetch($name, &$source, &$mtime) - { - $page = $this->build_pagename($name); - if (page_exists($page)) { - $source = rawWiki($page); - $mtime = p_get_metadata($page, 'last_change date'); - } - else { - $source = null; - $mtime = null; - } - } - - protected function fetchTimestamp($name) { - $page = $this->build_pagename($name); - if (page_exists($page)) { - return p_get_metadata($page, 'last_change date'); - } - else { - return null; - } - } -} - -?> |