本文整理汇总了PHP中unknown::_get_plugin_filepath方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown::_get_plugin_filepath方法的具体用法?PHP unknown::_get_plugin_filepath怎么用?PHP unknown::_get_plugin_filepath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown
的用法示例。
在下文中一共展示了unknown::_get_plugin_filepath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_html_options
/**
* Smarty {html_options} function plugin
*
* Type: function<br>
* Name: html_options<br>
* Input:<br>
* - name (optional) - string default "select"
* - values (required if no options supplied) - array
* - options (required if no values supplied) - associative array
* - selected (optional) - string default not set
* - output (required if not options supplied) - array
* Purpose: Prints the list of <option> tags generated from
* the passed parameters
*
* @link http://smarty.php.net/manual/en/language.function.html.options.php {html_image}
* (Smarty online manual)
* @param array
* @param Smarty
* @uses smarty_function_escape_special_chars()
* @param unknown $params
* @param unknown $smarty (reference)
* @return string
*/
function smarty_function_html_options($params, &$smarty)
{
require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
$name = null;
$values = null;
$options = null;
$selected = array();
$output = null;
$extra = '';
foreach ($params as $_key => $_val) {
switch ($_key) {
case 'name':
${$_key} = (string) $_val;
break;
case 'options':
${$_key} = (array) $_val;
break;
case 'selected':
case 'values':
case 'output':
${$_key} = array_values((array) $_val);
break;
default:
if (!is_array($_val)) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
$smarty->trigger_error("html_options: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
}
break;
}
}
if (!isset($options) && !isset($values)) {
return '';
}
/* raise error here? */
$_html_result = '';
if (is_array($options)) {
foreach ($options as $_key => $_val) {
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
}
} else {
foreach ((array) $values as $_i => $_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
}
}
if (!empty($name)) {
$_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
}
return $_html_result;
}
示例2: smarty_core_load_resource_plugin
/**
*
*
* @param unknown $params
* @param unknown $smarty (reference)
*/
function smarty_core_load_resource_plugin($params, &$smarty)
{
/*
* Resource plugins are not quite like the other ones, so they are
* handled differently. The first element of plugin info is the array of
* functions provided by the plugin, the second one indicates whether
* all of them exist or not.
*/
$_plugin =& $smarty->_plugins['resource'][$params['type']];
if (isset($_plugin)) {
if (!$_plugin[1] && count($_plugin[0])) {
$_plugin[1] = true;
foreach ($_plugin[0] as $_plugin_func) {
if (!is_callable($_plugin_func)) {
$_plugin[1] = false;
break;
}
}
}
if (!$_plugin[1]) {
$smarty->_trigger_fatal_error("[plugin] resource '" . $params['type'] . "' is not implemented", null, null, __FILE__, __LINE__);
}
return;
}
$_plugin_file = $smarty->_get_plugin_filepath('resource', $params['type']);
$_found = $_plugin_file != false;
if ($_found) {
/*
* If the plugin file is found, it -must- provide the properly named
* plugin functions.
*/
include_once $_plugin_file;
/*
* Locate functions that we require the plugin to provide.
*/
$_resource_ops = array('source', 'timestamp', 'secure', 'trusted');
$_resource_funcs = array();
foreach ($_resource_ops as $_op) {
$_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op;
if (!function_exists($_plugin_func)) {
$smarty->_trigger_fatal_error("[plugin] function {$_plugin_func}() not found in {$_plugin_file}", null, null, __FILE__, __LINE__);
return;
} else {
$_resource_funcs[] = $_plugin_func;
}
}
$smarty->_plugins['resource'][$params['type']] = array($_resource_funcs, true);
}
}
示例3: smarty_function_html_radios
/**
* Smarty {html_radios} function plugin
*
* File: function.html_radios.php<br>
* Type: function<br>
* Name: html_radios<br>
* Date: 24.Feb.2003<br>
* Purpose: Prints out a list of radio input types<br>
* Input:<br>
* - name (optional) - string default "radio"
* - values (required) - array
* - options (optional) - associative array
* - checked (optional) - array default not set
* - separator (optional) - ie <br> or
* - output (optional) - without this one the buttons don't have names
* Examples:
* <pre>
* {html_radios values=$ids output=$names}
* {html_radios values=$ids name='box' separator='<br>' output=$names}
* {html_radios values=$ids checked=$checked separator='<br>' output=$names}
* </pre>
*
* @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
* (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
* @author credits to Monte Ohrt <monte@ispi.net>
* @version 1.0
* @param array
* @param Smarty
* @uses smarty_function_escape_special_chars()
* @param unknown $params
* @param unknown $smarty (reference)
* @return string
*/
function smarty_function_html_radios($params, &$smarty)
{
require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
$name = 'radio';
$values = null;
$options = null;
$selected = null;
$separator = '';
$labels = true;
$output = null;
$extra = '';
foreach ($params as $_key => $_val) {
switch ($_key) {
case 'name':
case 'separator':
${$_key} = (string) $_val;
break;
case 'checked':
case 'selected':
if (is_array($_val)) {
$smarty->trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
} else {
$selected = (string) $_val;
}
break;
case 'labels':
${$_key} = (bool) $_val;
break;
case 'options':
${$_key} = (array) $_val;
break;
case 'values':
case 'output':
${$_key} = array_values((array) $_val);
break;
case 'radios':
$smarty->trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING);
$options = (array) $_val;
break;
default:
if (!is_array($_val)) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
$smarty->trigger_error("html_radios: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
}
break;
}
}
if (!isset($options) && !isset($values)) {
return '';
}
/* raise error here? */
$_html_result = '';
if (isset($options) && is_array($options)) {
foreach ((array) $options as $_key => $_val) {
$_html_result .= smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
}
} else {
foreach ((array) $values as $_i => $_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result .= smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
}
}
return $_html_result;
}
示例4: smarty_function_html_image
/**
* Smarty {html_image} function plugin
*
* Type: function<br>
* Name: html_image<br>
* Date: Feb 24, 2003<br>
* Purpose: format HTML tags for the image<br>
* Input:<br>
* - file = file (and path) of image (required)
* - border = border width (optional, default 0)
* - height = image height (optional, default actual height)
* - image =image width (optional, default actual width)
* - basedir = base directory for absolute paths, default
* is environment variable DOCUMENT_ROOT
*
* Examples: {html_image file="images/masthead.gif"}
* Output: <img src="images/masthead.gif" border=0 width=400 height=23>
*
* @link http://smarty.php.net/manual/en/language.function.html.image.php {html_image}
* (Smarty online manual)
* @author Monte Ohrt <monte@ispi.net>
* @author credits to Duda <duda@big.hu> - wrote first image function
* in repository, helped with lots of functionality
* @version 1.0
* @param array
* @param Smarty
* @uses smarty_function_escape_special_chars()
* @param unknown $params
* @param unknown $smarty (reference)
* @return string
*/
function smarty_function_html_image($params, &$smarty)
{
require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
$alt = '';
$file = '';
$border = 0;
$height = '';
$width = '';
$extra = '';
$prefix = '';
$suffix = '';
$basedir = isset($GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']) ? $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'] : '';
if (strstr($GLOBALS['HTTP_SERVER_VARS']['HTTP_USER_AGENT'], 'Mac')) {
$dpi_default = 72;
} else {
$dpi_default = 96;
}
foreach ($params as $_key => $_val) {
switch ($_key) {
case 'file':
case 'border':
case 'height':
case 'width':
case 'dpi':
case 'basedir':
${$_key} = $_val;
break;
case 'alt':
if (!is_array($_val)) {
${$_key} = smarty_function_escape_special_chars($_val);
} else {
$smarty->trigger_error("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
}
break;
case 'link':
case 'href':
$prefix = '<a href="' . $_val . '">';
$suffix = '</a>';
break;
default:
if (!is_array($_val)) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
$smarty->trigger_error("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
}
break;
}
}
if (empty($file)) {
$smarty->trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE);
return;
}
if (substr($file, 0, 1) == '/') {
$_image_path = $basedir . $file;
} else {
$_image_path = $file;
}
if (!isset($params['width']) || !isset($params['height'])) {
if (!($_image_data = @getimagesize($_image_path))) {
if (!file_exists($_image_path)) {
$smarty->trigger_error("html_image: unable to find '{$_image_path}'", E_USER_NOTICE);
return;
} else {
if (!is_readable($_image_path)) {
$smarty->trigger_error("html_image: unable to read '{$_image_path}'", E_USER_NOTICE);
return;
} else {
$smarty->trigger_error("html_image: '{$_image_path}' is not a valid image file", E_USER_NOTICE);
return;
//.........这里部分代码省略.........
示例5: smarty_function_html_select_time
/**
* Smarty {html_select_time} function plugin
*
* Type: function<br>
* Name: html_select_time<br>
* Purpose: Prints the dropdowns for time selection
*
* @link http://smarty.php.net/manual/en/language.function.html.select.time.php {html_select_time}
* (Smarty online manual)
* @param array
* @param Smarty
* @uses smarty_make_timestamp()
* @param unknown $params
* @param unknown $smarty (reference)
* @return string
*/
function smarty_function_html_select_time($params, &$smarty)
{
require_once $smarty->_get_plugin_filepath('shared', 'make_timestamp');
require_once $smarty->_get_plugin_filepath('function', 'html_options');
/* 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 .= '<select name=';
if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"';
} else {
$html_result .= '"' . $prefix . 'Hour"';
}
if (null !== $hour_extra) {
$html_result .= ' ' . $hour_extra;
}
if (null !== $all_extra) {
$html_result .= ' ' . $all_extra;
}
$html_result .= '>' . "\n";
$html_result .= smarty_function_html_options(array('output' => $hours, 'values' => $hours, 'selected' => strftime($hour_fmt, $time), 'print_result' => false), $smarty);
$html_result .= "</select>\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 .= '<select name=';
if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"';
} else {
$html_result .= '"' . $prefix . 'Minute"';
}
if (null !== $minute_extra) {
$html_result .= ' ' . $minute_extra;
}
if (null !== $all_extra) {
$html_result .= ' ' . $all_extra;
}
$html_result .= '>' . "\n";
$html_result .= smarty_function_html_options(array('output' => $minutes, 'values' => $minutes, 'selected' => $selected, 'print_result' => false), $smarty);
$html_result .= "</select>\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 .= '<select name=';
if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Second]"';
} else {
$html_result .= '"' . $prefix . 'Second"';
}
if (null !== $second_extra) {
//.........这里部分代码省略.........
示例6: smarty_core_load_plugins
/**
*
*
* @param unknown $params
* @param unknown $smarty (reference)
*/
function smarty_core_load_plugins($params, &$smarty)
{
foreach ($params['plugins'] as $_plugin_info) {
list($_type, $_name, $_tpl_file, $_tpl_line, $_delayed_loading) = $_plugin_info;
$_plugin =& $smarty->_plugins[$_type][$_name];
/*
* We do not load plugin more than once for each instance of Smarty.
* The following code checks for that. The plugin can also be
* registered dynamically at runtime, in which case template file
* and line number will be unknown, so we fill them in.
*
* The final element of the info array is a flag that indicates
* whether the dynamically registered plugin function has been
* checked for existence yet or not.
*/
if (isset($_plugin)) {
if (empty($_plugin[3])) {
if (!is_callable($_plugin[0])) {
$smarty->_trigger_fatal_error("[plugin] {$_type} '{$_name}' is not implemented", $_tpl_file, $_tpl_line, __FILE__, __LINE__);
} else {
$_plugin[1] = $_tpl_file;
$_plugin[2] = $_tpl_line;
$_plugin[3] = true;
if (!isset($_plugin[4])) {
$_plugin[4] = true;
}
/* cacheable */
}
}
continue;
} else {
if ($_type == 'insert') {
/*
* For backwards compatibility, we check for insert functions in
* the symbol table before trying to load them as a plugin.
*/
$_plugin_func = 'insert_' . $_name;
if (function_exists($_plugin_func)) {
$_plugin = array($_plugin_func, $_tpl_file, $_tpl_line, true, false);
continue;
}
}
}
$_plugin_file = $smarty->_get_plugin_filepath($_type, $_name);
if (!($_found = $_plugin_file != false)) {
$_message = "could not load plugin file '{$_type}.{$_name}.php'\n";
}
/*
* If plugin file is found, it -must- provide the properly named
* plugin function. In case it doesn't, simply output the error and
* do not fall back on any other method.
*/
if ($_found) {
include_once $_plugin_file;
$_plugin_func = 'smarty_' . $_type . '_' . $_name;
if (!function_exists($_plugin_func)) {
$smarty->_trigger_fatal_error("[plugin] function {$_plugin_func}() not found in {$_plugin_file}", $_tpl_file, $_tpl_line, __FILE__, __LINE__);
continue;
}
} else {
if ($_type == 'insert' && $_delayed_loading) {
$_plugin_func = 'smarty_' . $_type . '_' . $_name;
$_found = true;
}
}
/*
* Plugin specific processing and error checking.
*/
if (!$_found) {
if ($_type == 'modifier') {
/*
* In case modifier falls back on using PHP functions
* directly, we only allow those specified in the security
* context.
*/
if ($smarty->security && !in_array($_name, $smarty->security_settings['MODIFIER_FUNCS'])) {
$_message = "(secure mode) modifier '{$_name}' is not allowed";
} else {
if (!function_exists($_name)) {
$_message = "modifier '{$_name}' is not implemented";
} else {
$_plugin_func = $_name;
$_found = true;
}
}
} else {
if ($_type == 'function') {
/*
* This is a catch-all situation.
*/
$_message = "unknown tag - '{$_name}'";
}
}
}
//.........这里部分代码省略.........
示例7: smarty_function_html_select_date
/**
* Smarty {html_select_date} plugin
*
* Type: function<br>
* Name: html_select_date<br>
* Purpose: Prints the dropdowns for date selection.
*
* ChangeLog:<br>
* - 1.0 initial release
* - 1.1 added support for +/- N syntax for begin
* and end year values. (Monte)
* - 1.2 added support for yyyy-mm-dd syntax for
* time value. (Jan Rosier)
* - 1.3 added support for choosing format for
* month values (Gary Loescher)
* - 1.3.1 added support for choosing format for
* day values (Marcus Bointon)
*
* @link http://smarty.php.net/manual/en/language.function.html.select.date.php {html_select_date}
* (Smarty online manual)
* @version 1.3
* @author Andrei Zmievski
* @param array
* @param Smarty
* @param unknown $params
* @param unknown $smarty (reference)
* @return string
*/
function smarty_function_html_select_date($params, &$smarty)
{
require_once $smarty->_get_plugin_filepath('shared', 'make_timestamp');
require_once $smarty->_get_plugin_filepath('function', 'html_options');
/* 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;
/* <select size>'s of the different <select> tags.
If not set, uses default dropdown. */
$day_size = null;
$month_size = null;
$year_size = null;
/* Unparsed attributes common to *ALL* the <select>/<input> 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();
//.........这里部分代码省略.........