当前位置: 首页>>代码示例>>PHP>>正文


PHP MyOOS_CoreApi类代码示例

本文整理汇总了PHP中MyOOS_CoreApi的典型用法代码示例。如果您正苦于以下问题:PHP MyOOS_CoreApi类的具体用法?PHP MyOOS_CoreApi怎么用?PHP MyOOS_CoreApi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MyOOS_CoreApi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:43,代码来源:core.write_file.php

示例2: 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=\'\';" />';
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:51,代码来源:function.html_js_inputbox.php

示例3: 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);


}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:41,代码来源:function.oos_address_label.php

示例4: 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;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:43,代码来源:function.html_get_link.php

示例5: smarty_prefilter_improvetypo

function smarty_prefilter_improvetypo($content, &$smarty)
{
    MyOOS_CoreApi::requireOnce('lib/smarty-plugins/myoos/shared.improvetypo.php');

	return smarty_improvetypo($content);

}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:7,代码来源:prefilter.improvetypo.php

示例6: 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']);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:25,代码来源:core.smarty_include_php.php

示例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;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:69,代码来源:core.get_php_resource.php

示例8: 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);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:23,代码来源:function.debug.php

示例9: create_plugin_instance

 function create_plugin_instance()
 {
     $aPages = oos_get_pages();
     if (isset($_GET['page']) && $_GET['page'] != $aPages['info_down_for_maintenance']) {
         MyOOS_CoreApi::redirect(oos_href_link($aPages['info_down_for_maintenance'], '', 'NONSSL', true, false));
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:8,代码来源:oos_event_down_for_maintenance.php

示例10: 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;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:8,代码来源:oos_event_banner.php

示例11: 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;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:58,代码来源:outputfilter.highlight.php

示例12: create_plugin_instance

 function create_plugin_instance()
 {
     $aFilename = oos_get_filename();
     $aModules = oos_get_modules();
     if ($_GET['file'] != $aFilename['info_down_for_maintenance']) {
         MyOOS_CoreApi::redirect(oos_href_link($aModules['info'], $aFilename['info_down_for_maintenance'], '', 'NONSSL', true, false));
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:9,代码来源:oos_event_down_for_maintenance.php

示例13: 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'].'&amp;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) == '&amp;') || (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>';


  }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:62,代码来源:function.css_back_button.php

示例14: 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));
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:11,代码来源:function.oos_shipping_cost.php

示例15: 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'];
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:60,代码来源:core.process_cached_inserts.php


注:本文中的MyOOS_CoreApi类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。