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


PHP serendipity_loadThemeOptions函数代码示例

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


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

示例1: glob

    }
    return true;
}
if ($serendipity['GET']['adminModule'] == 'templates' || $serendipity['POST']['adminModule'] == 'templates' || $serendipity['GET']['adminAction'] == 'cattemplate') {
    $css_files = glob(dirname(__FILE__) . '/*_style.css');
    foreach ($css_files as $css_file) {
        $css_file = str_replace('_style.css', '', basename($css_file));
        if (!isset($colorsets[$css_file])) {
            $colorsets[$css_file] = $css_file;
        }
    }
}
$template_config_groups = array(THEME_COLORSET => array('colorset', 'layouttype', 'jscolumns'), THEME_HEADER => array('custheader', 'headerimage', 'headertype'));
$template_config = array(array('var' => 'infobp', 'name' => 'infobp', 'type' => 'custom', 'custom' => USER_STYLESHEET), array('var' => 'colorset', 'name' => THEME_COLORSET, 'type' => 'select', 'default' => 'default', 'select_values' => $colorsets), array('var' => 'layouttype', 'name' => LAYOUT_TYPE, 'type' => 'select', 'default' => '3sbs', 'select_values' => array('3sbs' => LAYOUT_SBS, '3bss' => LAYOUT_BSS, '3ssb' => LAYOUT_SSB, '2sb' => LAYOUT_SB, '2bs' => LAYOUT_BS, '1col' => LAYOUT_SC, '2sbf' => LAYOUT_SBF, '2bsf' => LAYOUT_BSF)), array('var' => 'jscolumns', 'name' => JAVASCRIPT_COLUMNS, 'type' => 'boolean', 'default' => 'false'), array('var' => 'custheader', 'name' => BP_CUSTOM_HEADER, 'type' => 'boolean', 'default' => 'false'), array('var' => 'headerimage', 'name' => BP_HEADER_IMAGE, 'type' => 'media', 'default' => serendipity_getTemplateFile('header.png')), array('var' => 'headertype', 'name' => BP_HEADER_TYPE, 'type' => 'select', 'default' => 'banner', 'select_values' => array('banner' => BP_HEADER_BANNER, 'htiled' => BP_HEADER_HTILED, 'vtiled' => BP_HEADER_VTILED, 'btiled' => BP_HEADER_BTILED)), array('var' => 'headerposhor', 'name' => BP_HEADER_POSHOR, 'type' => 'select', 'default' => 'left', 'select_values' => array('left' => LEFT, 'center' => BP_CENTER, 'right' => RIGHT)), array('var' => 'headerposver', 'name' => BP_HEADER_POSVER, 'type' => 'select', 'default' => 'top', 'select_values' => array('top' => BP_TOP, 'center' => BP_CENTER, 'bottom' => BP_BOTTOM)), array('var' => 'firbtitle', 'name' => FIR_BTITLE, 'type' => 'boolean', 'default' => 'true'), array('var' => 'firbdescr', 'name' => FIR_BDESCR, 'type' => 'boolean', 'default' => 'true'), array('var' => 'date_format', 'name' => GENERAL_PLUGIN_DATEFORMAT . " (http://php.net/strftime)", 'type' => 'select', 'default' => DATE_FORMAT_ENTRY, 'select_values' => array(DATE_FORMAT_ENTRY => DATE_FORMAT_ENTRY, '%a, %e. %B %Y' => '%a, %e. %B %Y', '%d-%m-%y' => '%d-%m-%y', '%m-%d-%y' => '%m-%d-%y', '%a %d-%m-%y' => '%a %d-%m-%y', '%a %m-%d-%y' => '%a %m-%d-%y', '%b %d' => '%b %d', "%b %d '%y" => "%b %d '%y")), array('var' => 'entryfooterpos', 'name' => ENTRY_FOOTER_POS, 'type' => 'select', 'default' => 'belowentry', 'select_values' => array('belowentry' => BELOW_ENTRY, 'belowtitle' => BELOW_TITLE, 'splitfoot' => SPLIT_FOOTER)), array('var' => 'footerauthor', 'name' => FOOTER_AUTHOR, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footercategories', 'name' => FOOTER_CATEGORIES, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footertimestamp', 'name' => FOOTER_TIMESTAMP, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footercomments', 'name' => FOOTER_COMMENTS, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footertrackbacks', 'name' => FOOTER_TRACKBACKS, 'type' => 'boolean', 'default' => 'true'), array('var' => 'altcommtrack', 'name' => ALT_COMMTRACK, 'type' => 'boolean', 'default' => 'false'), array('var' => 'addthiswidget', 'name' => SHOW_ADDTHIS_WIDGET, 'type' => 'boolean', 'default' => 'false'), array('var' => 'addthisaccount', 'name' => ADDTHIS_ACCOUNT, 'type' => 'string', 'default' => ''), array('var' => 'show_sticky_entry_footer', 'name' => SHOW_STICKY_ENTRY_FOOTER, 'type' => 'boolean', 'default' => 'true'), array('var' => 'show_sticky_entry_heading', 'name' => SHOW_STICKY_ENTRY_HEADING, 'type' => 'boolean', 'default' => 'true'), array('var' => 'cocommentactive', 'name' => COCOMMENT_ACTIVE, 'type' => 'boolean', 'default' => 'false'), array('var' => 'prev_next_style', 'name' => PREV_NEXT_STYLE, 'type' => 'select', 'default' => 'text', 'select_values' => array('text' => PREV_NEXT_TEXT, 'texticon' => PREV_NEXT_TEXT_ICON, 'icon' => PREV_NEXT_ICON, 'none' => NONE)), array('var' => 'show_pagination', 'name' => SHOW_PAGINATION, 'type' => 'boolean', 'default' => 'false'), array('var' => 'counter_code', 'name' => COUNTER_CODE, 'type' => 'text', 'default' => ''), array('var' => 'counter_code_toggle', 'name' => USE_COUNTER, 'type' => 'boolean', 'default' => 'false'), array('var' => 'footer_text', 'name' => FOOTER_TEXT, 'type' => 'text', 'default' => ''), array('var' => 'footer_text_toggle', 'name' => USE_FOOTER_TEXT, 'type' => 'boolean', 'default' => 'false'), array('var' => 'sitenavpos', 'name' => SITENAV_POSITION, 'type' => 'select', 'default' => 'none', 'select_values' => array('none' => SITENAV_NONE, 'above' => SITENAV_ABOVE, 'below' => SITENAV_BELOW, 'left' => SITENAV_LEFT, 'right' => SITENAV_RIGHT)), array('var' => 'sitenav_footer', 'name' => SITENAV_FOOTER, 'type' => 'boolean', 'default' => 'true'), array('var' => 'sitenav_quicksearch', 'name' => SITENAV_QUICKSEARCH, 'type' => 'boolean', 'default' => 'true'), array('var' => 'sitenav_sidebar_title', 'name' => SITENAV_TITLE, 'type' => 'string', 'default' => SITENAV_TITLE_TEXT));
$template_global_config = array('navigation' => true);
$template_loaded_config = serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option']);
serendipity_loadGlobalThemeOptions($template_config, $template_loaded_config, $template_global_config);
if ($template_loaded_config['headerimage'] != '' && is_dir($_SERVER['DOCUMENT_ROOT'] . '/' . $template_loaded_config['headerimage'])) {
    $files = array();
    if ($d = opendir($_SERVER['DOCUMENT_ROOT'] . '/' . $template_loaded_config['headerimage'])) {
        while (($file = readdir($d)) !== false) {
            if (preg_match('@(\\.jpe?g|\\.png|\\.gif)$@i', $file) && !preg_match('@' . preg_quote($serendipity['thumbSuffix']) . '@i', $file)) {
                $files[] = $file;
            }
        }
    }
    if (count($files) > 0) {
        shuffle($files);
        $serendipity['smarty']->assign('random_headerimage', $template_loaded_config['headerimage'] . '/' . $files[0]);
    }
}
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:31,代码来源:config.inc.php

示例2: printf

    ?>
    <tr>
        <td colspan="2" align="right"><?php 
    printf(PLUGIN_AVAILABLE_COUNT, count($pluginstack));
    ?>
</td>
    </tr>
</table>

<?php 
} else {
    /* show general plugin list */
    /* get sidebar locations */
    serendipity_smarty_init();
    if (is_array($template_config)) {
        $template_vars =& serendipity_loadThemeOptions($template_config);
    }
    $col_assoc = array('event_col' => 'event', 'eventh_col' => 'eventh');
    if (isset($template_vars['sidebars'])) {
        $sidebars = explode(',', $template_vars['sidebars']);
    } elseif (isset($serendipity['sidebars'])) {
        $sidebars = $serendipity['sidebars'];
    } else {
        $sidebars = array('left', 'hide', 'right');
    }
    foreach ($sidebars as $sidebar) {
        $col_assoc[$sidebar . '_col'] = $sidebar;
    }
    /* preparse Javascript-generated input */
    if (isset($_POST['SAVE']) && !empty($_POST['serendipity']['pluginorder'])) {
        $parts = explode(':', $_POST['serendipity']['pluginorder']);
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:31,代码来源:plugins.inc.php

示例3: template_options

 function template_options($template, $catid)
 {
     global $serendipity, $template_config;
     if (!serendipity_checkPermission('adminTemplates')) {
         return;
     }
     $template = str_replace('.', '', urldecode($template));
     $catid = (int) $catid;
     $tpl_path = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $template;
     if (!is_dir($tpl_path)) {
         return false;
     }
     $serendipity['GET']['adminModule'] == 'templates';
     $serendipity['smarty_vars']['template_option'] = $template . '_' . $catid;
     echo '<h3>' . STYLE_OPTIONS . '</h3>';
     if (file_exists($tpl_path . '/config.inc.php')) {
         serendipity_smarty_init();
         include_once $tpl_path . '/config.inc.php';
     }
     if (is_array($template_config)) {
         serendipity_plugin_api::hook_event('backend_templates_configuration_top', $template_config);
         if ($serendipity['POST']['adminSubAction'] == 'configure') {
             foreach ($serendipity['POST']['template'] as $option => $value) {
                 categorytemplate_option::set_config($option, $value, $serendipity['smarty_vars']['template_option']);
             }
             echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . DONE . ': ' . sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')) . '</div>';
         }
         echo '<form method="post" action="serendipity_admin.php">';
         echo '<input type="hidden" name="serendipity[adminModule]" value="templates" />';
         echo '<input type="hidden" name="serendipity[adminSubAction]" value="configure" />';
         echo '<input type="hidden" name="serendipity[adminAction]" value="cattemplate" />';
         echo '<input type="hidden" name="serendipity[adminModule]" value="event_display" />';
         echo '<input type="hidden" name="serendipity[catid]" value="' . $catid . '" />';
         echo '<input type="hidden" name="serendipity[cat_template]" value="' . urlencode($template) . '" />';
         include S9Y_INCLUDE_PATH . 'include/functions_plugins_admin.inc.php';
         $template_vars =& serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option']);
         $template_options = new categorytemplate_option();
         $template_options->import($template_config);
         $template_options->values =& $template_vars;
         serendipity_plugin_config($template_options, $template_vars, $serendipity['template'], $serendipity['template'], $template_options->keys, true, true, true, true, 'template');
         echo '</form><br />';
         serendipity_plugin_api::hook_event('backend_templates_configuration_bottom', $template_config);
     } else {
         echo '<p>' . STYLE_OPTIONS_NONE . '</p>';
         serendipity_plugin_api::hook_event('backend_templates_configuration_none', $template_config);
     }
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:47,代码来源:serendipity_event_categorytemplates.php

示例4: serendipity_smarty_init


//.........这里部分代码省略.........
        if (!isset($serendipity['smarty_file'])) {
            $serendipity['smarty_file'] = 'index.tpl';
        }
        $category = false;
        $category_info = array();
        if (isset($serendipity['GET']['category'])) {
            $category = (int) $serendipity['GET']['category'];
            if (isset($GLOBALS['cInfo'])) {
                $category_info = $GLOBALS['cInfo'];
            } else {
                $category_info = serendipity_fetchCategoryInfo($category);
            }
        }
        if (!isset($serendipity['smarty_vars']['head_link_stylesheet'])) {
            $serendipity['smarty_vars']['head_link_stylesheet_frontend'] = serendipity_rewriteURL('serendipity.css');
            if (IN_serendipity_admin === true) {
                $serendipity['smarty_vars']['head_link_stylesheet'] = serendipity_rewriteURL('serendipity_admin.css');
            } else {
                $serendipity['smarty_vars']['head_link_stylesheet'] = serendipity_rewriteURL('serendipity.css');
            }
            // When templates are switched, append a specific version string to make sure the browser does not cache the CSS
            if (strstr($serendipity['smarty_vars']['head_link_stylesheet'], '?')) {
                $serendipity['smarty_vars']['head_link_stylesheet'] .= '&amp;v=' . $serendipity['last_template_change'];
                $serendipity['smarty_vars']['head_link_stylesheet_frontend'] .= '&amp;v=' . $serendipity['last_template_change'];
            } else {
                $serendipity['smarty_vars']['head_link_stylesheet'] .= '?v=' . $serendipity['last_template_change'];
                $serendipity['smarty_vars']['head_link_stylesheet_frontend'] .= '?v=' . $serendipity['last_template_change'];
            }
        }
        if (!isset($serendipity['smarty_vars']['head_link_script'])) {
            if (IN_serendipity_admin === true) {
                $serendipity['smarty_vars']['head_link_script'] = serendipity_rewriteURL('serendipity_admin.js');
            } else {
                $serendipity['smarty_vars']['head_link_script'] = serendipity_rewriteURL('serendipity.js');
            }
            if (strstr($serendipity['smarty_vars']['head_link_script'], '?')) {
                $serendipity['smarty_vars']['head_link_script'] .= '&amp;v=' . $serendipity['last_template_change'];
            } else {
                $serendipity['smarty_vars']['head_link_script'] .= '?v=' . $serendipity['last_template_change'];
            }
        }
        $wysiwyg_customPlugin = $wysiwyg_customConfig = null;
        if (defined('IN_serendipity_admin') && $serendipity['wysiwyg']) {
            // check force internal toolbar config file
            if (strpos($serendipity['wysiwygToolbar'], 'NOCC-') !== false) {
                $serendipity['wysiwygToolbar'] = substr($serendipity['wysiwygToolbar'], 5);
                $force_internal_toolbar = true;
            }
            // check ckeditor custom plugin file
            $ccp = serendipity_getTemplateFile('admin/ckeditor_custom_plugin.js', 'serendipityHTTPPath', true);
            $wysiwyg_customPlugin = !empty($ccp) && !$force_internal_toolbar ? $ccp : $serendipity['serendipityHTTPPath'] . 'htmlarea/ckeditor_s9y_plugin.js';
            // check ckeditor custom config file
            $ccc = serendipity_getTemplateFile('admin/ckeditor_custom_config.js', 'serendipityHTTPPath', true);
            $wysiwyg_customConfig = !empty($ccc) && !$force_internal_toolbar ? $ccc : $serendipity['serendipityHTTPPath'] . 'htmlarea/ckeditor_s9y_config.js';
        }
        $_force_backendpopups = explode(',', $serendipity['enableBackendPopupGranular']);
        $force_backendpopups = array();
        foreach ($_force_backendpopups as $fbp_key => $fbp_val) {
            $fbp_val = trim($fbp_val);
            if (empty($fbp_val)) {
                continue;
            }
            $force_backendpopups[$fbp_val] = $fbp_val;
        }
        $serendipity['smarty']->assign(array('head_charset' => LANG_CHARSET, 'head_version' => $serendipity['version'], 'head_title' => $serendipity['head_title'], 'head_subtitle' => $serendipity['head_subtitle'], 'head_link_stylesheet' => $serendipity['smarty_vars']['head_link_stylesheet'], 'head_link_script' => $serendipity['smarty_vars']['head_link_script'], 'head_link_stylesheet_frontend' => $serendipity['smarty_vars']['head_link_stylesheet_frontend'], 'is_xhtml' => true, 'use_popups' => $serendipity['enablePopup'], 'use_backendpopups' => $serendipity['enableBackendPopup'], 'force_backendpopups' => $force_backendpopups, 'is_embedded' => !$serendipity['embed'] || $serendipity['embed'] === 'false' || $serendipity['embed'] === false ? false : true, 'is_raw_mode' => $serendipity['smarty_raw_mode'], 'is_logged_in' => serendipity_userLoggedIn(), 'entry_id' => isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id']) ? $serendipity['GET']['id'] : false, 'is_single_entry' => isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id']), 'blogTitle' => $serendipity['blogTitle'], 'blogSubTitle' => !empty($serendipity['blogSubTitle']) ? $serendipity['blogSubTitle'] : '', 'blogDescription' => $serendipity['blogDescription'], 'serendipityHTTPPath' => $serendipity['serendipityHTTPPath'], 'serendipityDefaultBaseURL' => $serendipity['defaultBaseURL'], 'serendipityBaseURL' => $serendipity['baseURL'], 'serendipityRewritePrefix' => $serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '', 'serendipityIndexFile' => $serendipity['indexFile'], 'serendipityVersion' => $serendipity['expose_s9y'] ? $serendipity['version'] : '', 'lang' => $serendipity['lang'], 'category' => $category, 'category_info' => $category_info, 'template' => $serendipity['template'], 'template_backend' => $serendipity['template_backend'], 'wysiwygToolbar' => $serendipity['wysiwygToolbar'], 'wysiwyg_customPlugin' => $wysiwyg_customPlugin, 'wysiwyg_customConfig' => $wysiwyg_customConfig, 'use_autosave' => serendipity_db_bool($serendipity['use_autosave']) ? 'true' : 'false', 'dateRange' => !empty($serendipity['range']) ? $serendipity['range'] : array()));
        if (count($vars) > 0) {
            $serendipity['smarty']->assign($vars);
        }
        // For advanced usage, we allow template authors to create a file 'config.inc.php' where they can
        // setup custom smarty variables, modifiers etc. to use in their templates.
        // If a template engine is defined we need that config.inc.php file as well. The template's actual file is loaded after that to be able to overwrite config.
        if (isset($serendipity['template_engine']) && $serendipity['template_engine'] != null) {
            $p = explode(',', $serendipity['template_engine']);
            foreach ($p as $te) {
                $config = $serendipity['serendipityPath'] . $serendipity['templatePath'] . trim($te) . '/config.inc.php';
                if (file_exists($config)) {
                    include_once $config;
                }
            }
        }
        // FIRST: Load config of the currently configured FRONTEND template. We might actually need this in the backend (sidebar configuration, IPTC options, some others).
        // SECOND: Load config of the currently set template, which can also be the BACKEND template, or be the same as before. include_once takes care of only including the file once.
        $config = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'] . '/config.inc.php';
        if (file_exists($config)) {
            include_once $config;
        }
        $config = $serendipity['smarty']->getConfigDir(0) . '/config.inc.php';
        if (file_exists($config)) {
            include_once $config;
        }
        if (is_array($template_loaded_config)) {
            $template_vars =& $template_loaded_config;
            $serendipity['smarty']->assignByRef('template_option', $template_vars);
        } elseif (is_array($template_config)) {
            $template_vars =& serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option']);
            $serendipity['smarty']->assignByRef('template_option', $template_vars);
        }
    }
    return true;
}
开发者ID:REAP720801,项目名称:Serendipity,代码行数:101,代码来源:functions_smarty.inc.php

示例5: serendipity_smarty_init


//.........这里部分代码省略.........
            // If this file exists, a custom template engine will be loaded.
            // Beware: Smarty is used in the Admin backend, despite of this.
            include $template_dir . '/template.inc.php';
        } else {
            // Set a session variable if Smarty fails:
            $prev_smarty = $_SESSION['no_smarty'];
            $_SESSION['no_smarty'] = true;
            // Default Smarty Engine will be used
            @define('SMARTY_DIR', S9Y_PEAR_PATH . 'Smarty/libs/');
            if (!class_exists('Smarty')) {
                include SMARTY_DIR . 'Smarty.class.php';
            }
            if (!class_exists('Smarty')) {
                return false;
            }
            // Load serendipity smarty class loading class
            if (!class_exists('Serendipity_Smarty')) {
                include 'serendipity_smarty_class.inc.php';
            }
            if (!class_exists('Serendipity_Smarty')) {
                return false;
            }
            // set smarty instance
            #$serendipity['smarty'] = new Serendipity_Smarty;
            // initialize smarty object by instance
            $serendipity['smarty'] = Serendipity_Smarty::getInstance();
            // debug moved to class
            // Hooray for Smarty:
            $_SESSION['no_smarty'] = $prev_smarty;
            // enable security policy by instance of the Smarty_Security class
            $serendipity['smarty']->enableSecurity('Serendipity_Smarty_Security_Policy');
            // debugging...
            #echo '<pre>';print_r($serendipity['smarty']);echo '</pre>';#exit;
            #$serendipity['smarty']->testInstall();exit;
            /** 
             * prüfe auf eventuelle API Änderungen in 3.2 [smarty_modifier_foobar, --> [smarty_modifier_foobar, smarty_function_foobar, smarty_block_foobar] (siehe class) ] 
             * smarty_modifier_foobar(Smarty $smarty, $string, …) vs. smarty_modifier_foobar($string, …)
             **/
            $serendipity['smarty']->registerPlugin('modifier', 'makeFilename', 'serendipity_makeFilename');
            $serendipity['smarty']->registerPlugin('modifier', 'xhtml_target', 'serendipity_xhtml_target');
            $serendipity['smarty']->registerPlugin('modifier', 'emptyPrefix', 'serendipity_emptyPrefix');
            $serendipity['smarty']->registerPlugin('modifier', 'formatTime', 'serendipity_smarty_formatTime');
            $serendipity['smarty']->registerPlugin('modifier', 'serendipity_utf8_encode', 'serendipity_utf8_encode');
            $serendipity['smarty']->registerPlugin('modifier', 'ifRemember', 'serendipity_ifRemember');
            $serendipity['smarty']->registerPlugin('modifier', 'checkPermission', 'serendipity_checkPermission');
            $serendipity['smarty']->registerPlugin('modifier', 'serendipity_refhookPlugin', 'serendipity_smarty_refhookPlugin');
            $serendipity['smarty']->registerPlugin('function', 'serendipity_printSidebar', 'serendipity_smarty_printSidebar');
            $serendipity['smarty']->registerPlugin('function', 'serendipity_hookPlugin', 'serendipity_smarty_hookPlugin');
            $serendipity['smarty']->registerPlugin('function', 'serendipity_showPlugin', 'serendipity_smarty_showPlugin');
            $serendipity['smarty']->registerPlugin('function', 'serendipity_getFile', 'serendipity_smarty_getFile');
            $serendipity['smarty']->registerPlugin('function', 'serendipity_printComments', 'serendipity_smarty_printComments');
            $serendipity['smarty']->registerPlugin('function', 'serendipity_printTrackbacks', 'serendipity_smarty_printTrackbacks');
            $serendipity['smarty']->registerPlugin('function', 'serendipity_rss_getguid', 'serendipity_smarty_rss_getguid');
            $serendipity['smarty']->registerPlugin('function', 'serendipity_fetchPrintEntries', 'serendipity_smarty_fetchPrintEntries');
            $serendipity['smarty']->registerPlugin('function', 'serendipity_getTotalCount', 'serendipity_smarty_getTotalCount');
            $serendipity['smarty']->registerPlugin('function', 'pickKey', 'serendipity_smarty_pickKey');
            $serendipity['smarty']->registerPlugin('function', 'serendipity_showCommentForm', 'serendipity_smarty_showCommentForm');
            $serendipity['smarty']->registerPlugin('function', 'serendipity_getImageSize', 'serendipity_smarty_getImageSize');
            $serendipity['smarty']->registerFilter('pre', 'serendipity_replaceSmartyVars');
        }
        if (!isset($serendipity['smarty_raw_mode'])) {
            if (file_exists($serendipity['smarty']->getConfigDir(0) . '/layout.php') && $serendipity['template'] != 'default') {
                $serendipity['smarty_raw_mode'] = true;
            } else {
                $serendipity['smarty_raw_mode'] = false;
            }
        }
        if (!isset($serendipity['smarty_file'])) {
            $serendipity['smarty_file'] = 'index.tpl';
        }
        $category = false;
        $category_info = array();
        if (isset($serendipity['GET']['category'])) {
            $category = (int) $serendipity['GET']['category'];
            if (isset($GLOBALS['cInfo'])) {
                $category_info = $GLOBALS['cInfo'];
            } else {
                $category_info = serendipity_fetchCategoryInfo($category);
            }
        }
        if (!isset($serendipity['smarty_vars']['head_link_stylesheet'])) {
            $serendipity['smarty_vars']['head_link_stylesheet'] = serendipity_rewriteURL('serendipity.css');
        }
        $serendipity['smarty']->assign(array('head_charset' => LANG_CHARSET, 'head_version' => $serendipity['version'], 'head_title' => $serendipity['head_title'], 'head_subtitle' => $serendipity['head_subtitle'], 'head_link_stylesheet' => $serendipity['smarty_vars']['head_link_stylesheet'], 'is_xhtml' => true, 'use_popups' => $serendipity['enablePopup'], 'is_embedded' => !$serendipity['embed'] || $serendipity['embed'] === 'false' || $serendipity['embed'] === false ? false : true, 'is_raw_mode' => $serendipity['smarty_raw_mode'], 'is_logged_in' => serendipity_userLoggedIn(), 'entry_id' => isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id']) ? $serendipity['GET']['id'] : false, 'is_single_entry' => isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id']), 'blogTitle' => $serendipity['blogTitle'], 'blogSubTitle' => !empty($serendipity['blogSubTitle']) ? $serendipity['blogSubTitle'] : '', 'blogDescription' => $serendipity['blogDescription'], 'serendipityHTTPPath' => $serendipity['serendipityHTTPPath'], 'serendipityDefaultBaseURL' => $serendipity['defaultBaseURL'], 'serendipityBaseURL' => $serendipity['baseURL'], 'serendipityRewritePrefix' => $serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '', 'serendipityIndexFile' => $serendipity['indexFile'], 'serendipityVersion' => $serendipity['expose_s9y'] ? $serendipity['version'] : '', 'lang' => $serendipity['lang'], 'category' => $category, 'category_info' => $category_info, 'template' => $serendipity['template'], 'dateRange' => !empty($serendipity['range']) ? $serendipity['range'] : array()));
        if (count($vars) > 0) {
            $serendipity['smarty']->assign($vars);
        }
        // For advanced usage, we allow template authors to create a file 'config.inc.php' where they can
        // setup custom smarty variables, modifiers etc. to use in their templates.
        @(include_once $serendipity['smarty']->getConfigDir(0) . '/config.inc.php');
        if (is_array($template_loaded_config)) {
            $template_vars =& $template_loaded_config;
            $serendipity['smarty']->assignByRef('template_option', $template_vars);
        } elseif (is_array($template_config)) {
            $template_vars =& serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option']);
            $serendipity['smarty']->assignByRef('template_option', $template_vars);
        }
    }
    return true;
}
开发者ID:rustyx,项目名称:Serendipity,代码行数:101,代码来源:functions_smarty.inc.php

示例6: serendipity_smarty_init


//.........这里部分代码省略.........
        } else {
            // Set a session variable if Smarty fails:
            $prev_smarty = $_SESSION['no_smarty'];
            $_SESSION['no_smarty'] = true;
            // Default Smarty Engine will be used
            @define('SMARTY_DIR', S9Y_PEAR_PATH . 'Smarty/libs/');
            if (!class_exists('Smarty')) {
                include SMARTY_DIR . 'Smarty.class.php';
            }
            if (!class_exists('Smarty')) {
                return false;
            }
            $serendipity['smarty'] = new Smarty();
            if ($serendipity['production'] === 'debug') {
                $serendipity['smarty']->force_compile = true;
                $serendipity['smarty']->debugging = true;
            }
            $serendipity['smarty']->template_dir = array($template_dir);
            $p = explode(',', $serendipity['template_engine']);
            foreach ($p as $te) {
                $serendipity['smarty']->template_dir[] = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $te;
            }
            $serendipity['smarty']->template_dir[] = $serendipity['serendipityPath'] . $serendipity['templatePath'] . 'default';
            $serendipity['smarty']->compile_dir = $serendipity['serendipityPath'] . PATH_SMARTY_COMPILE;
            if (!is_dir($serendipity['smarty']->compile_dir) || !is_writable($serendipity['smarty']->compile_dir)) {
                printf(DIRECTORY_WRITE_ERROR, $serendipity['smarty']->compile_dir);
                return false;
            }
            // Hooray for Smarty:
            $_SESSION['no_smarty'] = $prev_smarty;
            $serendipity['smarty']->config_dir = $template_dir;
            $serendipity['smarty']->secure_dir = array($serendipity['serendipityPath'] . $serendipity['templatePath']);
            $serendipity['smarty']->security_settings['MODIFIER_FUNCS'] = array('sprintf', 'sizeof', 'count', 'rand', 'print_r', 'str_repeat');
            $serendipity['smarty']->security_settings['ALLOW_CONSTANTS'] = true;
            $serendipity['smarty']->security = true;
            $serendipity['smarty']->use_sub_dirs = false;
            $serendipity['smarty']->compile_check = true;
            $serendipity['smarty']->compile_id =& $serendipity['template'];
            $serendipity['smarty']->register_modifier('makeFilename', 'serendipity_makeFilename');
            $serendipity['smarty']->register_modifier('xhtml_target', 'serendipity_xhtml_target');
            $serendipity['smarty']->register_modifier('emptyPrefix', 'serendipity_emptyPrefix');
            $serendipity['smarty']->register_modifier('formatTime', 'serendipity_smarty_formatTime');
            $serendipity['smarty']->register_modifier('serendipity_utf8_encode', 'serendipity_utf8_encode');
            $serendipity['smarty']->register_modifier('ifRemember', 'serendipity_ifRemember');
            $serendipity['smarty']->register_modifier('checkPermission', 'serendipity_checkPermission');
            $serendipity['smarty']->register_modifier('serendipity_refhookPlugin', 'serendipity_smarty_refhookPlugin');
            $serendipity['smarty']->register_function('serendipity_printSidebar', 'serendipity_smarty_printSidebar');
            $serendipity['smarty']->register_function('serendipity_hookPlugin', 'serendipity_smarty_hookPlugin');
            $serendipity['smarty']->register_function('serendipity_showPlugin', 'serendipity_smarty_showPlugin');
            $serendipity['smarty']->register_function('serendipity_getFile', 'serendipity_smarty_getFile');
            $serendipity['smarty']->register_function('serendipity_printComments', 'serendipity_smarty_printComments');
            $serendipity['smarty']->register_function('serendipity_printTrackbacks', 'serendipity_smarty_printTrackbacks');
            $serendipity['smarty']->register_function('serendipity_rss_getguid', 'serendipity_smarty_rss_getguid');
            $serendipity['smarty']->register_function('serendipity_fetchPrintEntries', 'serendipity_smarty_fetchPrintEntries');
            $serendipity['smarty']->register_function('serendipity_getTotalCount', 'serendipity_smarty_getTotalCount');
            $serendipity['smarty']->register_function('pickKey', 'serendipity_smarty_pickKey');
            $serendipity['smarty']->register_function('serendipity_showCommentForm', 'serendipity_smarty_showCommentForm');
            $serendipity['smarty']->register_function('serendipity_getImageSize', 'serendipity_smarty_getImageSize');
            $serendipity['smarty']->register_prefilter('serendipity_replaceSmartyVars');
        }
        if (!isset($serendipity['smarty_raw_mode'])) {
            if (file_exists($serendipity['smarty']->config_dir . '/layout.php') && $serendipity['template'] != 'default') {
                $serendipity['smarty_raw_mode'] = true;
            } else {
                $serendipity['smarty_raw_mode'] = false;
            }
        }
        if (!isset($serendipity['smarty_file'])) {
            $serendipity['smarty_file'] = 'index.tpl';
        }
        $category = false;
        $category_info = array();
        if (isset($serendipity['GET']['category'])) {
            $category = (int) $serendipity['GET']['category'];
            if (isset($GLOBALS['cInfo'])) {
                $category_info = $GLOBALS['cInfo'];
            } else {
                $category_info = serendipity_fetchCategoryInfo($category);
            }
        }
        if (!isset($serendipity['smarty_vars']['head_link_stylesheet'])) {
            $serendipity['smarty_vars']['head_link_stylesheet'] = serendipity_rewriteURL('serendipity.css');
        }
        $serendipity['smarty']->assign(array('head_charset' => LANG_CHARSET, 'head_version' => $serendipity['version'], 'head_title' => $serendipity['head_title'], 'head_subtitle' => $serendipity['head_subtitle'], 'head_link_stylesheet' => $serendipity['smarty_vars']['head_link_stylesheet'], 'is_xhtml' => true, 'use_popups' => $serendipity['enablePopup'], 'is_embedded' => !$serendipity['embed'] || $serendipity['embed'] === 'false' || $serendipity['embed'] === false ? false : true, 'is_raw_mode' => $serendipity['smarty_raw_mode'], 'is_logged_in' => serendipity_userLoggedIn(), 'entry_id' => isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id']) ? $serendipity['GET']['id'] : false, 'is_single_entry' => isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id']), 'blogTitle' => $serendipity['blogTitle'], 'blogSubTitle' => !empty($serendipity['blogSubTitle']) ? $serendipity['blogSubTitle'] : '', 'blogDescription' => $serendipity['blogDescription'], 'serendipityHTTPPath' => $serendipity['serendipityHTTPPath'], 'serendipityBaseURL' => $serendipity['baseURL'], 'serendipityRewritePrefix' => $serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '', 'serendipityIndexFile' => $serendipity['indexFile'], 'serendipityVersion' => $serendipity['expose_s9y'] ? $serendipity['version'] : '', 'lang' => $serendipity['lang'], 'category' => $category, 'category_info' => $category_info, 'template' => $serendipity['template'], 'dateRange' => !empty($serendipity['range']) ? $serendipity['range'] : array()));
        if (count($vars) > 0) {
            $serendipity['smarty']->assign($vars);
        }
        // For advanced usage, we allow template authors to create a file 'config.inc.php' where they can
        // setup custom smarty variables, modifiers etc. to use in their templates.
        @(include_once $serendipity['smarty']->config_dir . '/config.inc.php');
        if (is_array($template_loaded_config)) {
            $template_vars =& $template_loaded_config;
            $serendipity['smarty']->assign_by_ref('template_option', $template_vars);
        } elseif (is_array($template_config)) {
            $template_vars =& serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option']);
            $serendipity['smarty']->assign_by_ref('template_option', $template_vars);
        }
    }
    return true;
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:101,代码来源:functions_smarty.inc.php


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