diff --git a/plugins/block.textformat.php b/plugins/block.textformat.php deleted file mode 100644 index eab2b7d9..00000000 --- a/plugins/block.textformat.php +++ /dev/null @@ -1,71 +0,0 @@ - 0) { - $paragraph = str_repeat($indent_char,$indent_first) . $paragraph; - } - // wordwrap sentences - $paragraph = wordwrap($paragraph, $wrap - $indent, $wrap_char, $wrap_cut); - // indent lines - if($indent > 0) { - $paragraph = preg_replace('!^!m',str_repeat($indent_char,$indent),$paragraph); - } - $output .= $paragraph . $wrap_char . $wrap_char; - } - - if($assign != null) { - $this->assign($assign,$output); - } else { - echo $output; - } - //echo $content; -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.assign.php b/plugins/function.assign.php deleted file mode 100644 index 0eb29602..00000000 --- a/plugins/function.assign.php +++ /dev/null @@ -1,30 +0,0 @@ -trigger_error("assign: missing 'var' parameter"); - return; - } - - if (!in_array('value', array_keys($params))) { - $smarty->trigger_error("assign: missing 'value' parameter"); - return; - } - - $smarty->assign($var, $value); -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.assign_debug_info.php b/plugins/function.assign_debug_info.php deleted file mode 100644 index 8bc9a897..00000000 --- a/plugins/function.assign_debug_info.php +++ /dev/null @@ -1,32 +0,0 @@ -_tpl_vars; - ksort($assigned_vars); - if (@is_array($smarty->_config[0])) { - $config_vars = $smarty->_config[0]; - ksort($config_vars); - $smarty->assign("_debug_config_keys", array_keys($config_vars)); - $smarty->assign("_debug_config_vals", array_values($config_vars)); - } - - $included_templates = $smarty->_smarty_debug_info; - - $smarty->assign("_debug_keys", array_keys($assigned_vars)); - $smarty->assign("_debug_vals", array_values($assigned_vars)); - - $smarty->assign("_debug_tpls", $included_templates); -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.counter.php b/plugins/function.counter.php deleted file mode 100644 index dc46771e..00000000 --- a/plugins/function.counter.php +++ /dev/null @@ -1,72 +0,0 @@ -assign($assign, $count[$name]); - } - - if ($printval[$name]) { - $retval = $count[$name]; - } else { - $retval = null; - } - - if (isset($skip)) - $skipval[$name] = $skip; - else if (empty($skipval[$name])) - $skipval[$name] = 1; - - if (isset($direction)) - $dir[$name] = $direction; - else if (!isset($dir[$name])) - $dir[$name] = "up"; - - if ($dir[$name] == "down") - $count[$name] -= $skipval[$name]; - else - $count[$name] += $skipval[$name]; - - return $retval; - -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.cycle.php b/plugins/function.cycle.php deleted file mode 100644 index f4e9dc42..00000000 --- a/plugins/function.cycle.php +++ /dev/null @@ -1,107 +0,0 @@ - - * Credits: Mark Priatel - * Gerard - * Jason Sweat - * Purpose: cycle through given values - * Input: name = name of cycle (optional) - * values = comma separated list of values to cycle, - * or an array of values to cycle - * (this can be left out for subsequent calls) - * - * reset = boolean - resets given var to true - * print = boolean - print var or not. default is true - * advance = boolean - whether or not to advance the cycle - * delimiter = the value delimiter, default is "," - * assign = boolean, assigns to template var instead of - * printed. - * - * Examples: {cycle values="#eeeeee,#d0d0d0d"} - * {cycle name=row values="one,two,three" reset=true} - * {cycle name=row} - * ------------------------------------------------------------- - */ -function smarty_function_cycle($params, &$smarty) -{ - static $cycle_vars; - - extract($params); - - if (empty($name)) { - $name = 'default'; - } - - if (!isset($print)) { - $print = true; - } - - if (!isset($advance)) { - $advance = true; - } - - if (!isset($reset)) { - $reset = false; - } - - if (!in_array('values', array_keys($params))) { - if(!isset($cycle_vars[$name]['values'])) { - $smarty->trigger_error("cycle: missing 'values' parameter"); - return; - } - } else { - if(isset($cycle_vars[$name]['values']) - && $cycle_vars[$name]['values'] != $values ) { - $cycle_vars[$name]['index'] = 0; - } - $cycle_vars[$name]['values'] = $values; - } - - if (isset($delimiter)) { - $cycle_vars[$name]['delimiter'] = $delimiter; - } elseif (!isset($cycle_vars[$name]['delimiter'])) { - $cycle_vars[$name]['delimiter'] = ','; - } - - if(!is_array($cycle_vars[$name]['values'])) { - $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']); - } else { - $cycle_array = $cycle_vars[$name]['values']; - } - - if(!isset($cycle_vars[$name]['index']) || $reset ) { - $cycle_vars[$name]['index'] = 0; - } - - if (isset($assign)) { - $print = false; - $smarty->assign($assign, $cycle_array[$cycle_vars[$name]['index']]); - } - - if($print) { - $retval = $cycle_array[$cycle_vars[$name]['index']]; - } else { - $retval = null; - } - - if($advance) { - if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) { - $cycle_vars[$name]['index'] = 0; - } else { - $cycle_vars[$name]['index']++; - } - } - - return $retval; -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.debug.php b/plugins/function.debug.php deleted file mode 100644 index d059a42f..00000000 --- a/plugins/function.debug.php +++ /dev/null @@ -1,24 +0,0 @@ - - * Purpose: popup debug window - * ------------------------------------------------------------- - */ -function smarty_function_debug($params, &$smarty) -{ - if($params['output']) { - $smarty->assign('_smarty_debug_output',$params['output']); - } - return $smarty->_generate_debug_output(); -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.eval.php b/plugins/function.eval.php deleted file mode 100644 index 662d2c78..00000000 --- a/plugins/function.eval.php +++ /dev/null @@ -1,39 +0,0 @@ -trigger_error("eval: missing 'var' parameter"); - return; - } - if($var == '') { - return; - } - - $this->_compile_template("evaluated template", $var, $source); - - ob_start(); - eval('?>' . $source); - $contents = ob_get_contents(); - ob_end_clean(); - - if (!empty($assign)) { - $this->assign($assign, $contents); - } else { - return $contents; - } -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.fetch.php b/plugins/function.fetch.php deleted file mode 100644 index d1d14742..00000000 --- a/plugins/function.fetch.php +++ /dev/null @@ -1,211 +0,0 @@ -_trigger_fatal_error("[plugin] parameter 'file' cannot be empty"); - return; - } - - if ($smarty->security && !preg_match('!^(http|ftp)://!i', $file)) { - // fetching file, make sure it comes from secure directory - foreach ($smarty->secure_dir as $curr_dir) { - if (substr(realpath($file), 0, strlen(realpath($curr_dir))) == realpath($curr_dir)) { - $resource_is_secure = true; - break; - } - } - if (!$resource_is_secure) { - $smarty->_trigger_fatal_error("[plugin] (secure mode) fetch '$file' is not allowed"); - return; - } - // fetch the file - if($fp = @fopen($file,'r')) { - while(!feof($fp)) { - $content .= fgets ($fp,4096); - } - fclose($fp); - } else { - $smarty->_trigger_fatal_error("[plugin] fetch cannot read file '$file'"); - return; - } - } else { - // not a local file - if(preg_match('!^http://!i',$file)) { - // http fetch - if($uri_parts = parse_url($file)) { - // set defaults - $host = $server_name = $uri_parts['host']; - $timeout = 30; - $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; - $agent = "Smarty Template Engine ".$smarty->_version; - $referer = ""; - $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/'; - $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : ''; - $_is_proxy = false; - if(empty($uri_parts['port'])) { - $port = 80; - } else { - $port = $uri_parts['port']; - } - if(empty($uri_parts['user'])) { - $user = $uri_parts['user']; - } - // loop through parameters, setup headers - foreach($params as $param_key => $param_value) { - switch($param_key) { - case "file": - case "assign": - case "assign_headers": - break; - case "user": - if(!empty($param_value)) { - $user = $param_value; - } - break; - case "pass": - if(!empty($param_value)) { - $pass = $param_value; - } - break; - case "accept": - if(!empty($param_value)) { - $accept = $param_value; - } - break; - case "header": - if(!empty($param_value)) { - if(!preg_match('![\w\d-]+: .+!',$param_value)) { - $smarty->_trigger_fatal_error("[plugin] invalid header format '".$param_value."'"); - return; - } else { - $extra_headers[] = $param_value; - } - } - break; - case "proxy_host": - if(!empty($param_value)) { - $proxy_host = $param_value; - } - break; - case "proxy_port": - if(!preg_match('!\D!', $param_value)) { - $proxy_port = (int) $param_value; - } else { - $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'"); - return; - } - break; - case "agent": - if(!empty($param_value)) { - $agent = $param_value; - } - break; - case "referer": - if(!empty($param_value)) { - $referer = $param_value; - } - break; - case "timeout": - if(!preg_match('!\D!', $param_value)) { - $timeout = (int) $param_value; - } else { - $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'"); - return; - } - break; - default: - $smarty->_trigger_fatal_error("[plugin] unrecognized attribute '".$param_key."'"); - return; - } - } - if(!empty($proxy_host) && !empty($proxy_port)) { - $_is_proxy = true; - $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout); - } else { - $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout); - } - - if(!$fp) { - $smarty->_trigger_fatal_error("[plugin] unable to fetch: $errstr ($errno)"); - return; - } else { - if($_is_proxy) { - fputs($fp, "GET $file HTTP/1.0\r\n"); - } else { - fputs($fp, "GET $uri HTTP/1.0\r\n"); - } - if(!empty($host)) { - fputs($fp, "Host: $host\r\n"); - } - if(!empty($accept)) { - fputs($fp, "Accept: $accept\r\n"); - } - if(!empty($agent)) { - fputs($fp, "User-Agent: $agent\r\n"); - } - if(!empty($referer)) { - fputs($fp, "Referer: $referer\r\n"); - } - if(is_array($extra_headers)) { - foreach($extra_headers as $curr_header) { - fputs($fp, $curr_header."\r\n"); - } - } - if(!empty($user) && !empty($pass)) { - fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n"); - } - - fputs($fp, "\r\n"); - while(!feof($fp)) { - $content .= fgets($fp,4096); - } - fclose($fp); - $csplit = split("\r\n\r\n",$content,2); - - $content = $csplit[1]; - - if(!empty($params['assign_headers'])) { - $smarty->assign($params['assign_headers'],split("\r\n",$csplit[0])); - } - } - } else { - $smarty->_trigger_fatal_error("[plugin] unable to parse URL, check syntax"); - return; - } - } else { - // ftp fetch - if($fp = @fopen($file,'r')) { - while(!feof($fp)) { - $content .= fgets ($fp,4096); - } - fclose($fp); - } else { - $smarty->_trigger_fatal_error("[plugin] fetch cannot read file '$file'"); - return; - } - } - - } - - - if (!empty($params['assign'])) { - $smarty->assign($params['assign'],$content); - } else { - return $content; - } -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.html_options.php b/plugins/function.html_options.php deleted file mode 100644 index 068164a0..00000000 --- a/plugins/function.html_options.php +++ /dev/null @@ -1,71 +0,0 @@ - tags generated from - * the passed parameters - * ------------------------------------------------------------- - */ -function smarty_function_html_options($params, &$smarty) -{ - extract($params); - - $html_result = ''; - - settype($selected, 'array'); - if (isset($options)) { - settype($options, 'array'); - foreach ($options as $key => $value) { - $html_result .= smarty_function_html_options_optoutput($key, $value, $selected); - } - } else { - settype($output, 'array'); - settype($values, 'array'); - for ($i = 0, $for_max = count($output); $i < $for_max; $i++) { - if ($i < count($values)) { - $html_result .= smarty_function_html_options_optoutput($values[$i], $output[$i], $selected); - } else { - $html_result .= smarty_function_html_options_optoutput($output[$i], $output[$i], $selected); - } - } - } - - return $html_result; -} - -function smarty_function_html_options_optoutput($key, $value, $selected) { - if(!is_array($value)) { - $html_result = '' . "\n"; - foreach ($values as $key => $value) { - $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected); - } - $optgroup_html .= "\n"; - return $optgroup_html; -} - -function smarty_function_html_options_htmlspecialchars($text) { - // do not escape already escaped entities (& {) - $text = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $text); - $text = htmlspecialchars($text); - $text = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $text); - return $text; -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.html_select_date.php b/plugins/function.html_select_date.php deleted file mode 100644 index c50083bd..00000000 --- a/plugins/function.html_select_date.php +++ /dev/null @@ -1,232 +0,0 @@ -_get_plugin_filepath('shared','make_timestamp'); -require_once $this->_get_plugin_filepath('function','html_options'); -function smarty_function_html_select_date($params, &$smarty) -{ - /* Default values. */ - $prefix = "Date_"; - $start_year = strftime("%Y"); - $end_year = $start_year; - $display_days = true; - $display_months = true; - $display_years = true; - $month_format = "%B"; - /* Write months as numbers by default GL */ - $month_value_format = "%m"; - $day_format = "%02d"; - /* Write day values using this format MB */ - $day_value_format = "%d"; - $year_as_text = false; - /* Display years in reverse order? Ie. 2000,1999,.... */ - $reverse_years = false; - /* Should the select boxes be part of an array when returned from PHP? - e.g. setting it to "birthday", would create "birthday[Day]", - "birthday[Month]" & "birthday[Year]". Can be combined with prefix */ - $field_array = null; - /* tags. - If not set, uses default dropdown. */ - $day_size = null; - $month_size = null; - $year_size = null; - /* Unparsed attributes common to *ALL* the tags. - An example might be in the template: all_extra ='class ="foo"'. */ - $all_extra = null; - /* Separate attributes for the tags. */ - $day_extra = null; - $month_extra = null; - $year_extra = null; - /* Order in which to display the fields. - "D" -> day, "M" -> month, "Y" -> year. */ - $field_order = 'MDY'; - /* String printed between the different fields. */ - $field_separator = "\n"; - $time = time(); - - - extract($params); - - // If $time is not in format yyyy-mm-dd - if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $time)) { - // then $time is empty or unix timestamp or mysql timestamp - // using smarty_make_timestamp to get an unix timestamp and - // strftime to make yyyy-mm-dd - $time = strftime('%Y-%m-%d', smarty_make_timestamp($time)); - } - // Now split this in pieces, which later can be used to set the select - $time = explode("-", $time); - - // make syntax "+N" or "-N" work with start_year and end_year - if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) { - if ($match[1] == '+') { - $end_year = strftime('%Y') + $match[2]; - } else { - $end_year = strftime('%Y') - $match[2]; - } - } - if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) { - if ($match[1] == '+') { - $start_year = strftime('%Y') + $match[2]; - } else { - $start_year = strftime('%Y') - $match[2]; - } - } - - $field_order = strtoupper($field_order); - - $html_result = $month_result = $day_result = $year_result = ""; - - if ($display_months) { - $month_names = array(); - $month_values = array(); - - for ($i = 1; $i <= 12; $i++) { - $month_names[] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000)); - $month_values[] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000)); - } - - $month_result .= ''; - } - - if ($display_days) { - $days = array(); - for ($i = 1; $i <= 31; $i++) { - $days[] = sprintf($day_format, $i); - $day_values[] = sprintf($day_value_format, $i); - } - - $day_result .= ''; - } - - if ($display_years) { - if (null !== $field_array){ - $year_name = $field_array . '[' . $prefix . 'Year]'; - } else { - $year_name = $prefix . 'Year'; - } - if ($year_as_text) { - $year_result .= ' $years, - 'values' => $years, - 'selected' => $time[0], - 'print_result' => false), - $smarty); - $year_result .= ''; - } - } - - // Loop thru the field_order field - for ($i = 0; $i <= 2; $i++){ - $c = substr($field_order, $i, 1); - switch ($c){ - case 'D': - $html_result .= $day_result; - break; - - case 'M': - $html_result .= $month_result; - break; - - case 'Y': - $html_result .= $year_result; - break; - } - // Add the field seperator - if($i != 2) { - $html_result .= $field_separator; - } - } - - return $html_result; -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.html_select_time.php b/plugins/function.html_select_time.php deleted file mode 100644 index 06bd7787..00000000 --- a/plugins/function.html_select_time.php +++ /dev/null @@ -1,152 +0,0 @@ -_get_plugin_filepath('shared','make_timestamp'); -require_once $this->_get_plugin_filepath('function','html_options'); -function smarty_function_html_select_time($params, &$smarty) -{ - /* Default values. */ - $prefix = "Time_"; - $time = time(); - $display_hours = true; - $display_minutes = true; - $display_seconds = true; - $display_meridian = true; - $use_24_hours = true; - $minute_interval = 1; - $second_interval = 1; - /* Should the select boxes be part of an array when returned from PHP? - e.g. setting it to "birthday", would create "birthday[Hour]", - "birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]". - Can be combined with prefix. */ - $field_array = null; - $all_extra = null; - $hour_extra = null; - $minute_extra = null; - $second_extra = null; - $meridian_extra = null; - - extract($params); - - $time = smarty_make_timestamp($time); - - $html_result = ''; - - if ($display_hours) { - $hours = $use_24_hours ? range(0, 23) : range(1, 12); - $hour_fmt = $use_24_hours ? '%H' : '%I'; - for ($i = 0, $for_max = count($hours); $i < $for_max; $i++) - $hours[$i] = sprintf('%02d', $hours[$i]); - $html_result .= '\n"; - } - - if ($display_minutes) { - $all_minutes = range(0, 59); - for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i+= $minute_interval) - $minutes[] = sprintf('%02d', $all_minutes[$i]); - $selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval); - $html_result .= '\n"; - } - - if ($display_seconds) { - $all_seconds = range(0, 59); - for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i+= $second_interval) - $seconds[] = sprintf('%02d', $all_seconds[$i]); - $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval); - $html_result .= '\n"; - } - - if ($display_meridian && !$use_24_hours) { - $html_result .= '\n"; - } - - return $html_result; -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.html_table.php b/plugins/function.html_table.php deleted file mode 100644 index b24da486..00000000 --- a/plugins/function.html_table.php +++ /dev/null @@ -1,85 +0,0 @@ - - * Purpose: make an html table from an array of data - * Input: loop = array to loop through - * cols = number of columns - * table_attr = table attributes - * tr_attr = table row attributes (arrays are cycled) - * td_attr = table cell attributes (arrays are cycled) - * cellpad = value to pad trailing cells with - * - * Examples: {table loop=$data} - * {$table loop=$data cols=4 tr_attr='"bgcolor=red"'} - * {$table loop=$data cols=4 tr_attr=$colors} - * ------------------------------------------------------------- - */ -function smarty_function_html_table($params, &$smarty) -{ - $table_attr = 'border=1'; - $tr_attr = ''; - $td_attr = ''; - $cols = 3; - $cellpad = ' '; - - extract($params); - - if (!isset($loop)) { - $smarty->trigger_error("table: missing 'loop' parameter"); - return; - } - - $output = "\n"; - $output .= "\n"; - - for($x = 0, $y = count($loop); $x < $y; $x++) { - $output .= "\n"; - if((!(($x+1) % $cols)) && $x < $y-1) { - // go to next row - $output .= "\n\n"; - } - if($x == $y-1) { - // last row, pad remaining cells - $cells = $cols - $y % $cols; - if($cells != $cols) { - for($padloop = 0; $padloop < $cells; $padloop++) { - $output .= "\n"; - } - } - $output .= "\n"; - } - } - - $output .= "
" . $loop[$x] . "
$cellpad
\n"; - - return $output; -} - -function smarty_function_html_table_cycle($name, $var) { - static $names = array(); - - if(!is_array($var)) { - return $var; - } - - if(!isset($names[$name]) || $names[$name] == count($var)-1) { - $names[$name] = 0; - return $var[0]; - } - - $names[$name]++; - return $var[$names[$name]]; - -} - - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.mailto.php b/plugins/function.mailto.php deleted file mode 100644 index 9091bf42..00000000 --- a/plugins/function.mailto.php +++ /dev/null @@ -1,124 +0,0 @@ - - * Credits: Jason Sweat (added cc, bcc and subject functionality) - * Purpose: automate mailto address link creation, and optionally - * encode them. - * Input: address = e-mail address - * text = (optional) text to display, default is address - * encode = (optional) can be one of: - * none : no encoding (default) - * javascript : encode with javascript - * hex : encode with hexidecimal (no javascript) - * cc = (optional) address(es) to carbon copy - * bcc = (optional) address(es) to blind carbon copy - * subject = (optional) e-mail subject - * newsgroups = (optional) newsgroup(s) to post to - * followupto = (optional) address(es) to follow up to - * extra = (optional) extra tags for the href link - * - * Examples: {mailto address="me@domain.com"} - * {mailto address="me@domain.com" encode="javascript"} - * {mailto address="me@domain.com" encode="hex"} - * {mailto address="me@domain.com" subject="Hello to you!"} - * {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"} - * {mailto address="me@domain.com" extra='class="mailto"'} - * ------------------------------------------------------------- - */ -function smarty_function_mailto($params, &$smarty) -{ - extract($params); - - if (empty($address)) { - $smarty->trigger_error("mailto: missing 'address' parameter"); - return; - } - - if (empty($text)) { - $text = $address; - } - - // netscape and mozilla do not decode %40 (@) in BCC field (bug?) - // so, don't encode it. - - $mail_parms = array(); - if (!empty($cc)) { - $mail_parms[] = 'cc='.str_replace('%40','@',rawurlencode($cc)); - } - - if (!empty($bcc)) { - $mail_parms[] = 'bcc='.str_replace('%40','@',rawurlencode($bcc)); - } - - if (!empty($subject)) { - $mail_parms[] = 'subject='.rawurlencode($subject); - } - - if (!empty($newsgroups)) { - $mail_parms[] = 'newsgroups='.rawurlencode($newsgroups); - } - - if (!empty($followupto)) { - $mail_parms[] = 'followupto='.str_replace('%40','@',rawurlencode($followupto)); - } - - for ($i=0; $itrigger_error("mailto: 'encode' parameter must be none, javascript or hex"); - return; - } - - if ($encode == 'javascript' ) { - $string = 'document.write(\''.$text.'\');'; - - for ($x=0; $x < strlen($string); $x++) { - $js_encode .= '%' . bin2hex($string[$x]); - } - - return ''; - - } elseif ($encode == 'hex') { - - preg_match('!^(.*)(\?.*)$!',$address,$match); - if(!empty($match[2])) { - $smarty->trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript."); - return; - } - for ($x=0; $x < strlen($address); $x++) { - if(preg_match('!\w!',$address[$x])) { - $address_encode .= '%' . bin2hex($address[$x]); - } else { - $address_encode .= $address[$x]; - } - } - for ($x=0; $x < strlen($text); $x++) { - $text_encode .= '&#x' . bin2hex($text[$x]).';'; - } - - return ''.$text_encode.''; - - } else { - // no encoding - return ''.$text.''; - - } - -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.math.php b/plugins/function.math.php deleted file mode 100644 index 3e6d2c06..00000000 --- a/plugins/function.math.php +++ /dev/null @@ -1,73 +0,0 @@ -trigger_error("math: missing equation parameter"); - return; - } - - $equation = $params['equation']; - - // make sure parenthesis are balanced - if (substr_count($equation,"(") != substr_count($equation,")")) { - $smarty->trigger_error("math: unbalanced parenthesis"); - return; - } - - // match all vars in equation, make sure all are passed - preg_match_all("![a-zA-Z][a-zA-Z0-9]*!",$equation, $match); - $allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10', - 'max','min','pi','pow','rand','round','sin','sqrt','srand','tan'); - - foreach($match[0] as $curr_var) { - if (!in_array($curr_var,array_keys($params)) && !in_array($curr_var, $allowed_funcs)) { - $smarty->trigger_error("math: parameter $curr_var not passed as argument"); - return; - } - } - - foreach($params as $key => $val) { - if ($key != "equation" && $key != "format" && $key != "assign") { - // make sure value is not empty - if (strlen($val)==0) { - $smarty->trigger_error("math: parameter $key is empty"); - return; - } - if (!is_numeric($val)) { - $smarty->trigger_error("math: parameter $key: is not numeric"); - return; - } - $equation = preg_replace("/\b$key\b/",$val, $equation); - } - } - - eval("\$smarty_math_result = ".$equation.";"); - - if (empty($params['format'])) { - if (empty($params['assign'])) { - return $smarty_math_result; - } else { - $smarty->assign($params['assign'],$smarty_math_result); - } - } else { - if (empty($params['assign'])){ - printf($params['format'],$smarty_math_result); - } else { - $smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result)); - } - } -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.popup.php b/plugins/function.popup.php deleted file mode 100644 index 74804a72..00000000 --- a/plugins/function.popup.php +++ /dev/null @@ -1,77 +0,0 @@ -trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required"); - return false; - } - - if (empty($trigger)) { $trigger = "onMouseOver"; } - - $retval .= $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; - if ($sticky) { $retval .= ",STICKY"; } - if (!empty($caption)) { $retval .= ",CAPTION,'".str_replace("'","\'",$caption)."'"; } - if (!empty($fgcolor)) { $retval .= ",FGCOLOR,'$fgcolor'"; } - if (!empty($bgcolor)) { $retval .= ",BGCOLOR,'$bgcolor'"; } - if (!empty($textcolor)) { $retval .= ",TEXTCOLOR,'$textcolor'"; } - if (!empty($capcolor)) { $retval .= ",CAPCOLOR,'$capcolor'"; } - if (!empty($closecolor)) { $retval .= ",CLOSECOLOR,'$closecolor'"; } - if (!empty($textfont)) { $retval .= ",TEXTFONT,'$textfont'"; } - if (!empty($captionfont)) { $retval .= ",CAPTIONFONT,'$captionfont'"; } - if (!empty($closefont)) { $retval .= ",CLOSEFONT,'$closefont'"; } - if (!empty($textsize)) { $retval .= ",TEXTSIZE,$textsize"; } - if (!empty($captionsize)) { $retval .= ",CAPTIONSIZE,$captionsize"; } - if (!empty($closesize)) { $retval .= ",CLOSESIZE,$closesize"; } - if (!empty($width)) { $retval .= ",WIDTH,$width"; } - if (!empty($height)) { $retval .= ",HEIGHT,$height"; } - if (!empty($left)) { $retval .= ",LEFT"; } - if (!empty($right)) { $retval .= ",RIGHT"; } - if (!empty($center)) { $retval .= ",CENTER"; } - if (!empty($above)) { $retval .= ",ABOVE"; } - if (!empty($below)) { $retval .= ",BELOW"; } - if (isset($border)) { $retval .= ",BORDER,$border"; } - if (isset($offsetx)) { $retval .= ",OFFSETX,$offsetx"; } - if (isset($offsety)) { $retval .= ",OFFSETY,$offsety"; } - if (!empty($fgbackground)) { $retval .= ",FGBACKGROUND,'$fgbackground'"; } - if (!empty($bgbackground)) { $retval .= ",BGBACKGROUND,'$bgbackground'"; } - if (!empty($closetext)) { $retval .= ",CLOSETEXT,'".str_replace("'","\'",$closetext)."'"; } - if (!empty($noclose)) { $retval .= ",NOCLOSE"; } - if (!empty($status)) { $retval .= ",STATUS,'".str_replace("'","\'",$status)."'"; } - if (!empty($autostatus)) { $retval .= ",AUTOSTATUS"; } - if (!empty($autostatuscap)) { $retval .= ",AUTOSTATUSCAP"; } - if (isset($inarray)) { $retval .= ",INARRAY,'$inarray'"; } - if (isset($caparray)) { $retval .= ",CAPARRAY,'$caparray'"; } - if (!empty($capicon)) { $retval .= ",CAPICON,'$capicon'"; } - if (!empty($snapx)) { $retval .= ",SNAPX,$snapx"; } - if (!empty($snapy)) { $retval .= ",SNAPY,$snapy"; } - if (isset($fixx)) { $retval .= ",FIXX,$fixx"; } - if (isset($fixy)) { $retval .= ",FIXY,$fixy"; } - if (!empty($background)) { $retval .= ",BACKGROUND,'$background'"; } - if (!empty($padx)) { $retval .= ",PADX,$padx"; } - if (!empty($pady)) { $retval .= ",PADY,$pady"; } - if (!empty($fullhtml)) { $retval .= ",FULLHTML"; } - if (!empty($frame)) { $retval .= ",FRAME,'$frame'"; } - if (isset($timeout)) { $retval .= ",TIMEOUT,$timeout"; } - if (!empty($function)) { $retval .= ",FUNCTION,'$function'"; } - if (isset($delay)) { $retval .= ",DELAY,$delay"; } - if (!empty($hauto)) { $retval .= ",HAUTO"; } - if (!empty($vauto)) { $retval .= ",VAUTO"; } - $retval .= ');" onMouseOut="nd();"'; - - return $retval; -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/function.popup_init.php b/plugins/function.popup_init.php deleted file mode 100644 index eca76ee8..00000000 --- a/plugins/function.popup_init.php +++ /dev/null @@ -1,29 +0,0 @@ -' . "\n" - . '' . "\n"; - } else { - $smarty->trigger_error("popup_init: missing src parameter"); - } -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/modifier.capitalize.php b/plugins/modifier.capitalize.php deleted file mode 100644 index a24ac278..00000000 --- a/plugins/modifier.capitalize.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/plugins/modifier.count_characters.php b/plugins/modifier.count_characters.php deleted file mode 100644 index 8449c13d..00000000 --- a/plugins/modifier.count_characters.php +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/plugins/modifier.count_paragraphs.php b/plugins/modifier.count_paragraphs.php deleted file mode 100644 index 90d32e77..00000000 --- a/plugins/modifier.count_paragraphs.php +++ /dev/null @@ -1,19 +0,0 @@ - diff --git a/plugins/modifier.count_sentences.php b/plugins/modifier.count_sentences.php deleted file mode 100644 index 8342f4a5..00000000 --- a/plugins/modifier.count_sentences.php +++ /dev/null @@ -1,19 +0,0 @@ - diff --git a/plugins/modifier.count_words.php b/plugins/modifier.count_words.php deleted file mode 100644 index b2f79e6c..00000000 --- a/plugins/modifier.count_words.php +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/plugins/modifier.date_format.php b/plugins/modifier.date_format.php deleted file mode 100644 index aa288b60..00000000 --- a/plugins/modifier.date_format.php +++ /dev/null @@ -1,28 +0,0 @@ -_get_plugin_filepath('shared','make_timestamp'); -function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null) -{ - if($string != '') { - return strftime($format, smarty_make_timestamp($string)); - } elseif (isset($default_date) && $default_date != '') { - return strftime($format, smarty_make_timestamp($default_date)); - } else { - return; - } -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/modifier.debug_print_var.php b/plugins/modifier.debug_print_var.php deleted file mode 100644 index 0d92ae27..00000000 --- a/plugins/modifier.debug_print_var.php +++ /dev/null @@ -1,45 +0,0 @@ -Array (".count($var).")"; - foreach ($var as $curr_key => $curr_val) { - $return = smarty_modifier_debug_print_var($curr_val, $depth+1); - $results .= '
\r'.str_repeat(' ', $depth*2)."$curr_key => $return"; - } - return $results; - } else if (is_object($var)) { - $object_vars = get_object_vars($var); - $results = "".get_class($var)." Object (".count($object_vars).")"; - foreach ($object_vars as $curr_key => $curr_val) { - $return = smarty_modifier_debug_print_var($curr_val, $depth+1); - $results .= '
\r'.str_repeat(' ', $depth*2)."$curr_key => $return"; - } - return $results; - } else { - if (empty($var) && $var != "0") { - return 'empty'; - } - if (strlen($var) > $length ) { - $results = substr($var, 0, $length-3).'...'; - } else { - $results = $var; - } - $results = preg_replace("![\r\t\n]!", " ", $results); - $results = htmlspecialchars($results); - return $results; - } -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/modifier.default.php b/plugins/modifier.default.php deleted file mode 100644 index ad4e842d..00000000 --- a/plugins/modifier.default.php +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/plugins/modifier.escape.php b/plugins/modifier.escape.php deleted file mode 100644 index 1882c1a6..00000000 --- a/plugins/modifier.escape.php +++ /dev/null @@ -1,53 +0,0 @@ - diff --git a/plugins/modifier.indent.php b/plugins/modifier.indent.php deleted file mode 100644 index dc551a37..00000000 --- a/plugins/modifier.indent.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/plugins/modifier.lower.php b/plugins/modifier.lower.php deleted file mode 100644 index 46acdc0a..00000000 --- a/plugins/modifier.lower.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/plugins/modifier.regex_replace.php b/plugins/modifier.regex_replace.php deleted file mode 100644 index 7a83764d..00000000 --- a/plugins/modifier.regex_replace.php +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/plugins/modifier.replace.php b/plugins/modifier.replace.php deleted file mode 100644 index 39c53f24..00000000 --- a/plugins/modifier.replace.php +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/plugins/modifier.spacify.php b/plugins/modifier.spacify.php deleted file mode 100644 index 7fc6837b..00000000 --- a/plugins/modifier.spacify.php +++ /dev/null @@ -1,19 +0,0 @@ - diff --git a/plugins/modifier.string_format.php b/plugins/modifier.string_format.php deleted file mode 100644 index 3cb55da7..00000000 --- a/plugins/modifier.string_format.php +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/plugins/modifier.strip.php b/plugins/modifier.strip.php deleted file mode 100644 index 8182f833..00000000 --- a/plugins/modifier.strip.php +++ /dev/null @@ -1,23 +0,0 @@ - - * Version: 1.0 - * Date: September 25th, 2002 - * ------------------------------------------------------------- - */ -function smarty_modifier_strip($text, $replace = ' ') -{ - return preg_replace('!\s+!', $replace, $text); -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/modifier.strip_tags.php b/plugins/modifier.strip_tags.php deleted file mode 100644 index 46a3d384..00000000 --- a/plugins/modifier.strip_tags.php +++ /dev/null @@ -1,21 +0,0 @@ -]*?>!', ' ', $string); - else - return strip_tags($string); -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/modifier.truncate.php b/plugins/modifier.truncate.php deleted file mode 100644 index 7d10c5ff..00000000 --- a/plugins/modifier.truncate.php +++ /dev/null @@ -1,33 +0,0 @@ - $length) { - $length -= strlen($etc); - $fragment = substr($string, 0, $length+1); - if ($break_words) - $fragment = substr($fragment, 0, -1); - else - $fragment = preg_replace('/\s+(\S+)?$/', '', $fragment); - return $fragment.$etc; - } else - return $string; -} - -/* vim: set expandtab: */ - -?> diff --git a/plugins/modifier.upper.php b/plugins/modifier.upper.php deleted file mode 100644 index f24d75b9..00000000 --- a/plugins/modifier.upper.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/plugins/modifier.wordwrap.php b/plugins/modifier.wordwrap.php deleted file mode 100644 index 1cc85a17..00000000 --- a/plugins/modifier.wordwrap.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/plugins/outputfilter.trimwhitespace.php b/plugins/outputfilter.trimwhitespace.php deleted file mode 100644 index 262567a2..00000000 --- a/plugins/outputfilter.trimwhitespace.php +++ /dev/null @@ -1,60 +0,0 @@ - and blocks. - * Install: Drop into the plugin directory, call - * $smarty->load_filter('output','trimwhitespace'); - * from application. - * Author: Monte Ohrt - * Contribs: Lars Noschinski - * ------------------------------------------------------------- - */ - function smarty_outputfilter_trimwhitespace($source, &$smarty) - { - // Pull out the script blocks - preg_match_all("!]+>.*?!is", $source, $match); - $_script_blocks = $match[0]; - $source = preg_replace("!]+>.*?!is", - '@@@SMARTY:TRIM:SCRIPT@@@', $source); - - // Pull out the pre blocks - preg_match_all("!
.*?
!is", $source, $match); - $_pre_blocks = $match[0]; - $source = preg_replace("!
.*?
!is", - '@@@SMARTY:TRIM:PRE@@@', $source); - - // Pull out the textarea blocks - preg_match_all("!]+>.*?!is", $source, $match); - $_textarea_blocks = $match[0]; - $source = preg_replace("!]+>.*?!is", - '@@@SMARTY:TRIM:TEXTAREA@@@', $source); - - // remove all leading spaces, tabs and carriage returns NOT - // preceeded by a php close tag. - $source = trim(preg_replace('/((?)\n)[\s]+/m', '\1', $source)); - - // replace script blocks - foreach($_script_blocks as $curr_block) { - $source = preg_replace("!@@@SMARTY:TRIM:SCRIPT@@@!",$curr_block,$source,1); - } - // replace pre blocks - foreach($_pre_blocks as $curr_block) { - $source = preg_replace("!@@@SMARTY:TRIM:PRE@@@!",$curr_block,$source,1); - } - // replace textarea blocks - foreach($_textarea_blocks as $curr_block) { - $source = preg_replace("!@@@SMARTY:TRIM:TEXTAREA@@@!",$curr_block,$source,1); - } - - return $source; - } -?> diff --git a/plugins/shared.make_timestamp.php b/plugins/shared.make_timestamp.php deleted file mode 100644 index 2154b772..00000000 --- a/plugins/shared.make_timestamp.php +++ /dev/null @@ -1,35 +0,0 @@ - 0) - return $time; - else - return time(); -} - -/* vim: set expandtab: */ - -?>