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


PHP ocp_tempcode::from_assembly_executed方法代码示例

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


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

示例1: do_template

/**
 * Get a tempcoded version of a normal XHTML template. It is perhaps the most common ocPortal function to load up templates using do_template, and then attach them together either as parameters to each other, or via the tempcode attach method.
 *
 * @param  ID_TEXT			The codename of the template being loaded
 * @param  ?array				A map of parameters for the template (key to value) (NULL: no parameters)
 * @param  ?LANGUAGE_NAME 	The language to load the template in (templates can embed language references) (NULL: users own language)
 * @param  boolean			Whether to not produce a stack dump if the template is missing
 * @param  ?ID_TEXT			Alternate template to use if the primary one does not exist (NULL: none)
 * @param  string				File type suffix of template file (e.g. .tpl)
 * @param  string				Subdirectory type to look in
 * @set    templates css
 * @param  ?ID_TEXT			Theme to use (NULL: current theme)
 * @return tempcode			The tempcode for this template
 */
function do_template($codename, $parameters = NULL, $lang = NULL, $light_error = false, $fallback = NULL, $suffix = '.tpl', $type = 'templates', $theme = NULL)
{
    if (!isset($lang) || $lang == '') {
        global $USER_LANG_CACHED;
        $lang = isset($USER_LANG_CACHED) ? $USER_LANG_CACHED : (function_exists('user_lang') ? user_lang() : 'EN');
    }
    if ($GLOBALS['SEMI_DEBUG_MODE']) {
        if ($codename == strtolower($codename) && $type != 'css' && $codename != 'tempcode_test' && $codename != 'handle_conflict_resolution') {
            fatal_exit('Template names should be in upper case, and the files should be stored in upper case.');
        }
        if (substr($codename, -7) == '_SCREEN' || substr($codename, -8) == '_OVERLAY' || $codename == 'POOR_XHTML_WRAPPER' || $codename == 'OCF_WRAPPER') {
            $GLOBALS['SCREEN_TEMPLATE_CALLED'] = $codename;
        }
    }
    global $TEMPLATE_PREVIEW_OP, $RECORD_TEMPLATES_USED, $RECORDED_TEMPLATES_USED, $FILE_ARRAY, $MEM_CACHE, $KEEP_MARKERS, $SHOW_EDIT_LINKS, $XHTML_SPIT_OUT, $CACHE_TEMPLATES, $FORUM_DRIVER, $POSSIBLY_IN_SAFE_MODE, $CACHED_THEME, $CACHED_FOUND, $LOADED_TPL_CACHE;
    $special_treatment = ($KEEP_MARKERS || $SHOW_EDIT_LINKS) && is_null($XHTML_SPIT_OUT);
    if ($RECORD_TEMPLATES_USED) {
        $RECORDED_TEMPLATES_USED[] = $codename;
    }
    // Variables we'll need
    if (!isset($theme)) {
        $theme = isset($CACHED_THEME) ? $CACHED_THEME : (isset($FORUM_DRIVER) && is_object($FORUM_DRIVER) && method_exists($FORUM_DRIVER, 'get_theme') ? filter_naughty($FORUM_DRIVER->get_theme()) : 'default');
    }
    $prefix_default = get_file_base() . '/themes/';
    $prefix = $theme == 'default' ? $prefix_default : get_custom_file_base() . '/themes/';
    // Is it structurally cached on disk yet?
    if (!isset($CACHED_FOUND[$codename][$lang][$theme][$suffix][$type])) {
        $loaded_this_once = false;
    } else {
        $loaded_this_once = true;
    }
    $_data = false;
    if ($CACHE_TEMPLATES && !$TEMPLATE_PREVIEW_OP && (!$POSSIBLY_IN_SAFE_MODE || !in_safe_mode())) {
        $tcp_path = $prefix . $theme . '/templates_cached/' . $lang . '/' . $codename . $suffix . '.tcp';
        if ($loaded_this_once) {
            if (isset($LOADED_TPL_CACHE[$codename][$theme])) {
                $_data = $LOADED_TPL_CACHE[$codename][$theme];
            } else {
                $_data = new ocp_tempcode();
                $test = $_data->from_assembly_executed($tcp_path, array($codename, $codename, $lang, $theme, $suffix, $type, $fallback));
                if (!$test) {
                    $_data = false;
                }
                // failed
            }
        } else {
            global $SITE_INFO;
            $support_smart_decaching = !isset($SITE_INFO['disable_smart_decaching']) || $SITE_INFO['disable_smart_decaching'] == '0';
            if ($support_smart_decaching) {
                if (!isset($CACHED_FOUND[$codename][$lang][$theme][$suffix][$type])) {
                    $found = find_template_place($codename, $lang, $theme, $suffix, $type);
                    $CACHED_FOUND[$codename][$lang][$theme][$suffix][$type] = $found;
                } else {
                    $found = $CACHED_FOUND[$codename][$lang][$theme][$suffix][$type];
                }
                if (!is_null($found)) {
                    if (isset($GLOBALS['CURRENT_SHARE_USER'])) {
                        $file_path = get_custom_file_base() . '/themes/' . $found[0] . $found[1] . $codename . $suffix;
                        if (!is_file($file_path)) {
                            $file_path = get_file_base() . '/themes/' . $found[0] . $found[1] . $codename . $suffix;
                        }
                    } else {
                        $file_path = ($theme == 'default' && $suffix != '.css' ? get_file_base() : get_custom_file_base()) . '/themes/' . $found[0] . $found[1] . $codename . $suffix;
                    }
                    $tcp_time = @filemtime($tcp_path);
                } else {
                    $tcp_time = false;
                }
            }
            if (!$support_smart_decaching || $tcp_time !== false && is_file($file_path) && $found !== NULL) {
                if (!$support_smart_decaching || filemtime($file_path) < $tcp_time) {
                    $_data = new ocp_tempcode();
                    $test = $_data->from_assembly_executed($tcp_path, array($codename, $codename, $lang, $theme, $suffix, $type, $fallback));
                    if (!$test) {
                        $_data = false;
                    }
                    // failed
                }
            }
        }
    }
    if ($_data === false) {
        if (!isset($CACHED_FOUND[$codename][$lang][$theme][$suffix][$type])) {
            $found = find_template_place($codename, $lang, $theme, $suffix, $type);
            $CACHED_FOUND[$codename][$lang][$theme][$suffix][$type] = $found;
        } else {
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:tempcode.php


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