本文整理汇总了PHP中MyOOS_CoreApi::requireOnce方法的典型用法代码示例。如果您正苦于以下问题:PHP MyOOS_CoreApi::requireOnce方法的具体用法?PHP MyOOS_CoreApi::requireOnce怎么用?PHP MyOOS_CoreApi::requireOnce使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyOOS_CoreApi
的用法示例。
在下文中一共展示了MyOOS_CoreApi::requireOnce方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_oos_address_label
/**
* Smarty {oos_address_label} function plugin
*
* Type: function
* Name: oos_address_label
* Version: 1.0
* -------------------------------------------------------------
*/
function smarty_function_oos_address_label($params, &$smarty)
{
$customers_id = '';
$address_id = 1;
$html = true;
$boln = '';
$eoln = '<br>';
MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
MyOOS_CoreApi::requireOnce('lib/smarty-plugins/myoos/function.oos_address_format.php');
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$address_result = $dbconn->Execute("SELECT entry_firstname AS firstname, entry_lastname AS lastname, entry_company AS company, entry_street_address AS street_address, entry_suburb AS suburb, entry_city AS city, entry_postcode AS postcode, entry_state AS state, entry_zone_id AS zone_id, entry_country_id AS country_id FROM " . $oostable['address_book'] . " WHERE customers_id = '" . (int)$customers_id . "' AND address_book_id = '" . (int)$address_id . "'");
$address = $address_result->fields;
$format_id = oos_get_address_format_id($address['country_id']);
return smarty_function_oos_address_format(array('address_format_id' => $format_id,
'address' => $address,
'html' => $html),
$smarty);
}
示例2: smarty_core_smarty_include_php
function smarty_core_smarty_include_php($params, &$smarty)
{
$_params = array('resource_name' => $params['smarty_file']);
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.get_php_resource.php');
smarty_core_get_php_resource($_params, $smarty);
$_smarty_resource_type = $_params['resource_type'];
$_smarty_php_resource = $_params['php_resource'];
if (!empty($params['smarty_assign'])) {
ob_start();
if ($_smarty_resource_type == 'file') {
$smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']);
} else {
$smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']);
}
$smarty->assign($params['smarty_assign'], ob_get_contents());
ob_end_clean();
} else {
if ($_smarty_resource_type == 'file') {
$smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']);
} else {
$smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']);
}
}
}
示例3: smarty_function_html_get_link
/**
* Smarty {html_get_link} function plugin
*
* Type: function
* Name: html_get_link
* @Version: $Revision: 1.3 $ - changed by $Author: r23 $ on $Date: 2009/10/23 15:56:54 $
* -------------------------------------------------------------
*/
function smarty_function_html_get_link($params, &$smarty)
{
MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
$connection = 'NONSSL';
foreach($params as $_key => $_val) {
switch($_key) {
case 'connection':
$$_key = (string)$_val;
break;
default:
break;
}
}
if ($connection == 'NONSSL') {
$link = OOS_HTTP_SERVER . OOS_SHOP;
} elseif ($connection == 'SSL') {
if (ENABLE_SSL == '1') {
$link = OOS_HTTPS_SERVER . OOS_SHOP;
} else {
$link = OOS_HTTP_SERVER . OOS_SHOP;
}
} else {
$smarty->trigger_error("html_get_link: Unable to determine the page link!", E_USER_NOTICE);
}
$link .= 'index.php';
return $link;
}
示例4: smarty_prefilter_improvetypo
function smarty_prefilter_improvetypo($content, &$smarty)
{
MyOOS_CoreApi::requireOnce('lib/smarty-plugins/myoos/shared.improvetypo.php');
return smarty_improvetypo($content);
}
示例5: smarty_function_html_js_inputbox
/**
* Smarty {html_js_inputbox} function plugin
*
* File: function.html_js_inputbox.php<br>
* Type: function<br>
* Name: js_inputbox<br>
* Date: 06.Oct.2005<br>
* Purpose: Prints out a list of text input types<br>
* Examples:
* <pre>
* {html_js_inputbox values=$ids}
* {html_js_inputbox class='inputbox' name='searchword' value=$lang.text }
* </pre>
* @author r23 <info@r23.de>
* @version 1.0
* @param array
* @param Smarty
* @return string
* @uses smarty_function_escape_special_chars()
*/
function smarty_function_html_js_inputbox($params, &$smarty)
{
MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
$class = 'inputbox';
$name = 'keywords';
$size = '20';
$maxlength = '40';
$value = 'search...';
$extra = '';
foreach ($params as $_key => $_val) {
switch ($_key) {
case 'class':
case 'name':
case 'value':
${$_key} = (string) $_val;
break;
case 'size':
case 'maxlength':
${$_key} = intval($_val);
break;
default:
if (!is_array($_val)) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
$smarty->trigger_error("html_js_inputbox: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
}
break;
}
}
return '<input class="' . $class . '" type="text" name="' . $name . '" size="' . $size . '" maxlength="' . $maxlength . '" value="' . $value . '" onblur="if(this.value==\'\') this.value=\'' . $value . '\';" onfocus="if(this.value==\'' . $value . '\') this.value=\'\';" />';
}
示例6: smarty_core_write_file
/**
* write out a file to disk
*
* @param string $filename
* @param string $contents
* @param boolean $create_dirs
* @return boolean
*/
function smarty_core_write_file($params, &$smarty)
{
$_dirname = dirname($params['filename']);
if ($params['create_dirs']) {
$_params = array('dir' => $_dirname);
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.create_dir_structure.php');
smarty_core_create_dir_structure($_params, $smarty);
}
// write to tmp file, then rename it to avoid file locking race condition
$_tmp_file = tempnam($_dirname, 'wrt');
if (!($fd = @fopen($_tmp_file, 'wb'))) {
$_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('wrt');
if (!($fd = @fopen($_tmp_file, 'wb'))) {
$smarty->trigger_error("problem writing temporary file '$_tmp_file'");
return false;
}
}
fwrite($fd, $params['contents']);
fclose($fd);
if (DIRECTORY_SEPARATOR == '\\' || !@rename($_tmp_file, $params['filename'])) {
// On platforms and filesystems that cannot overwrite with rename()
// delete the file before renaming it -- because windows always suffers
// this, it is short-circuited to avoid the initial rename() attempt
@unlink($params['filename']);
@rename($_tmp_file, $params['filename']);
}
@chmod($params['filename'], $smarty->_file_perms);
return true;
}
示例7: smarty_core_get_php_resource
/**
* Retrieves PHP script resource
*
* sets $php_resource to the returned resource
* @param string $resource
* @param string $resource_type
* @param $php_resource
* @return boolean
*/
function smarty_core_get_php_resource(&$params, &$smarty)
{
$params['resource_base_path'] = $smarty->trusted_dir;
$smarty->_parse_resource_name($params, $smarty);
/*
* Find out if the resource exists.
*/
if ($params['resource_type'] == 'file') {
$_readable = false;
if(file_exists($params['resource_name']) && is_readable($params['resource_name'])) {
$_readable = true;
} else {
// test for file in include_path
$_params = array('file_path' => $params['resource_name']);
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.get_include_path.php');
if(smarty_core_get_include_path($_params, $smarty)) {
$_include_path = $_params['new_file_path'];
$_readable = true;
}
}
} elseif ($params['resource_type'] != 'file') {
$_template_source = null;
$_readable = is_callable($smarty->_plugins['resource'][$params['resource_type']][0][0])
&& call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][0],
array($params['resource_name'], &$_template_source, &$smarty));
}
/*
* Set the error function, depending on which class calls us.
*/
if (method_exists($smarty, '_syntax_error')) {
$_error_funcc = '_syntax_error';
} else {
$_error_funcc = 'trigger_error';
}
if ($_readable) {
if ($smarty->security) {
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.is_trusted.php');
if (!smarty_core_is_trusted($params, $smarty)) {
$smarty->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted');
return false;
}
}
} else {
$smarty->$_error_funcc($params['resource_type'] . ':' . $params['resource_name'] . ' is not readable');
return false;
}
if ($params['resource_type'] == 'file') {
$params['php_resource'] = $params['resource_name'];
} else {
$params['php_resource'] = $_template_source;
}
return true;
}
示例8: create_plugin_instance
function create_plugin_instance()
{
MyOOS_CoreApi::requireOnce('functions/function_banner.php');
// auto activate and expire banners
oos_activate_banners();
oos_expire_banners();
return true;
}
示例9: smarty_function_debug
/**
* Smarty {debug} function plugin
*
* Type: function<br>
* Name: debug<br>
* Date: July 1, 2002<br>
* Purpose: popup debug window
* @link http://smarty.php.net/manual/en/language.function.debug.php {debug}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @param array
* @param Smarty
* @return string output from {@link Smarty::_generate_debug_output()}
*/
function smarty_function_debug($params, &$smarty)
{
if (isset($params['output'])) {
$smarty->assign('_smarty_debug_output', $params['output']);
}
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.display_debug_console.php');
return smarty_core_display_debug_console(null, $smarty);
}
示例10: smarty_outputfilter_highlight
function smarty_outputfilter_highlight($source, &$smarty)
{
$highlight = $_REQUEST['highlight'];
if (isset($_GET['keywords'])) {
$highlight .= oos_var_prep_for_os($_GET['keywords']);
}
$highlight = strip_tags($highlight);
$sStrSize = strlen($highlight);
if ($sStrSize <= 5) {
return $source;
}
if (eregi(oos_server_get_var('HTTP_HOST'), oos_server_get_var('HTTP_REFERER'))) {
if (!isset($highlight) || empty($highlight)) {
return $source;
}
} else {
MyOOS_CoreApi::requireOnce('classes/class_referrer.php');
$referrer = new referrer();
$highlight .= $referrer->getKeywords();
}
$words = $highlight;
if (!isset($highlight) || empty($highlight)) {
return $source;
}
// Pull out the script blocks
preg_match_all("!<script[^>]+>.*?</script>!is", $source, $match);
$_script_blocks = $match[0];
$source = preg_replace("!<script[^>]+>.*?</script>!is", '@@@=====@@@', $source);
preg_match_all("!<a onmouseo[^>]+>.*!is", $source, $match);
$_onmouse_block = $match[0];
$source = preg_replace("!<a onmouseo[^>]+>.*!is", '@@@#=====#@@@', $source);
// pull out all html tags
preg_match_all("'<[\\/\\!]*?[^<>]*'si", $source, $match);
$_tag_blocks = $match[0];
$source = preg_replace("'<[\\/\\!]*?[^<>]*'si", '@@@:=====:@@@', $source);
// This array is used to choose colors for supplied highlight terms
$colorArr = array('#ffff66', '#ff9999', '#A0FFFF', '#ff66ff', '#99ff99');
// Wrap all the highlight words with tags bolding them and changing
// their background colors
$wordArr = split(" ", addslashes($words));
$i = 0;
foreach ($wordArr as $word) {
$word = preg_quote($word);
$source = preg_replace('~(' . $word . ')~si', '<span style="color:black;background-color:' . $colorArr[$i] . ';">$1</span>', $source);
$i++;
}
// replace script blocks
foreach ($_script_blocks as $curr_block) {
$source = preg_replace("!@@@=====@@@!", $curr_block, $source, 1);
}
foreach ($_onmouse_block as $curr_block) {
$source = preg_replace("!@@@#=====#@@@!", $curr_block, $source, 1);
}
foreach ($_tag_blocks as $curr_block) {
$source = preg_replace("!@@@:=====:@@@!", $curr_block, $source, 1);
}
return $source;
}
示例11: smarty_core_process_cached_inserts
/**
* Replace cached inserts with the actual results
*
* @param string $results
* @return string
*/
function smarty_core_process_cached_inserts($params, &$smarty)
{
preg_match_all('!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis',
$params['results'], $match);
list($cached_inserts, $insert_args) = $match;
for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
if ($smarty->debugging) {
$_params = array();
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.get_microtime.php');
$debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
$args = unserialize($insert_args[$i]);
$name = $args['name'];
if (isset($args['script'])) {
$_params = array('resource_name' => $smarty->_dequote($args['script']));
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.get_php_resource.php');
if(!smarty_core_get_php_resource($_params, $smarty)) {
return false;
}
$resource_type = $_params['resource_type'];
$php_resource = $_params['php_resource'];
if ($resource_type == 'file') {
$smarty->_include($php_resource, true);
} else {
$smarty->_eval($php_resource);
}
}
$function_name = $smarty->_plugins['insert'][$name][0];
if (empty($args['assign'])) {
$replace = $function_name($args, $smarty);
} else {
$smarty->assign($args['assign'], $function_name($args, $smarty));
$replace = '';
}
$params['results'] = substr_replace($params['results'], $replace, strpos($params['results'], $cached_inserts[$i]), strlen($cached_inserts[$i]));
if ($smarty->debugging) {
$_params = array();
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.get_microtime.php');
$smarty->_smarty_debug_info[] = array('type' => 'insert',
'filename' => 'insert_'.$name,
'depth' => $smarty->_inclusion_depth,
'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time);
}
}
return $params['results'];
}
示例12: smarty_core_run_insert_handler
/**
* Handle insert tags
*
* @param array $args
* @return string
*/
function smarty_core_run_insert_handler($params, &$smarty)
{
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.get_microtime.php');
if ($smarty->debugging) {
$_params = array();
$_debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
if ($smarty->caching) {
$_arg_string = serialize($params['args']);
$_name = $params['args']['name'];
if (!isset($smarty->_cache_info['insert_tags'][$_name])) {
$smarty->_cache_info['insert_tags'][$_name] = array('insert',
$_name,
$smarty->_plugins['insert'][$_name][1],
$smarty->_plugins['insert'][$_name][2],
!empty($params['args']['script']) ? true : false);
}
return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5;
} else {
if (isset($params['args']['script'])) {
$_params = array('resource_name' => $smarty->_dequote($params['args']['script']));
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.get_php_resource.php');
if(!smarty_core_get_php_resource($_params, $smarty)) {
return false;
}
if ($_params['resource_type'] == 'file') {
$smarty->_include($_params['php_resource'], true);
} else {
$smarty->_eval($_params['php_resource']);
}
unset($params['args']['script']);
}
$_funcname = $smarty->_plugins['insert'][$params['args']['name']][0];
$_content = $_funcname($params['args'], $smarty);
if ($smarty->debugging) {
$_params = array();
MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.get_microtime.php');
$smarty->_smarty_debug_info[] = array('type' => 'insert',
'filename' => 'insert_'.$params['args']['name'],
'depth' => $smarty->_inclusion_depth,
'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
}
if (!empty($params['args']["assign"])) {
$smarty->assign($params['args']["assign"], $_content);
} else {
return $_content;
}
}
}
示例13: smarty_function_oos_cost
function smarty_function_oos_cost($params, &$smarty)
{
global $oCurrencies;
MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
$price = '';
$tax = '';
foreach ($params as $_key => $_val) {
${$_key} = smarty_function_escape_special_chars($_val);
}
print $oCurrencies->format(oos_add_tax($price, $tax));
}
示例14: smarty_function_css_back_button
/**
* Smarty {css_back_button} function plugin
*
* Type: function
* Name: css_back_button
* @Version: $Revision: 1.1 $ - changed by $Author: r23 $ on $Date: 2008/01/09 22:03:20 $
*/
function smarty_function_css_back_button($params, &$smarty)
{
global $oEvent, $spider_kill_sid;
MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
$title = '';
$color = 'btnR green';
foreach($params as $_key => $_val) {
switch($_key) {
case 'title':
$$_key = (string)$_val;
break;
case 'color':
$$_key = (string)$_val;
break;
default:
break;
}
}
$aPages = oos_get_pages();
if (count($_SESSION['navigation']->path)-2 > 0) {
$back = count($_SESSION['navigation']->path)-2;
$link = oos_href_link($_SESSION['navigation']->path[$back]['page'], $_SESSION['navigation']->path[$back]['get'].'&history_back=true', $_SESSION['navigation']->path[$back]['mode']);
} else {
if (strstr(HTTP_SERVER, $_SERVER['HTTP_REFERER'])) {
$link = $_SERVER['HTTP_REFERER'];
} else {
$link = oos_href_link($aPages['main']);
}
}
while ( (substr($link, -5) == '&') || (substr($link, -1) == '?') ) {
if (substr($link, -1) == '?') {
$link = substr($link, 0, -1);
} else {
$link = substr($link, 0, -5);
}
}
$title = decode($title);
return '<a href="' . $link . '" title="' . $title . '" class="' . $color . '">' . $title . '</a>';
}
示例15: 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)
* @author Monte Ohrt <monte at ohrt dot com>
* @param array
* @param Smarty
* @return string
* @uses smarty_function_escape_special_chars()
*/
function smarty_function_html_options($params, &$smarty)
{
MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
$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 'values':
case 'output':
${$_key} = array_values((array) $_val);
break;
case 'selected':
${$_key} = array_map('strval', 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 (isset($options)) {
foreach ($options as $_key => $_val) {
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
}
} else {
foreach ($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;
}