本文整理汇总了PHP中e107::getCoreTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getCoreTemplate方法的具体用法?PHP e107::getCoreTemplate怎么用?PHP e107::getCoreTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getCoreTemplate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionForbidden
public function actionForbidden()
{
$this->getResponse()->setRenderMod('error403')->addHeader('HTTP/1.0 403 Forbidden');
$this->addTitle(LAN_ERROR_7);
$template = e107::getCoreTemplate('error', 403);
$vars = new e_vars(array('siteUrl' => SITEURL));
$body = e107::getParser()->parseTemplate($template['start'] . $template['body'] . $template['end'], true, null, $vars);
$this->addBody($body);
}
示例2: navigation_shortcode
function navigation_shortcode($parm = '')
{
$types = array('main' => 1, 'side' => 2, 'footer' => 3, 'alt' => 4, 'alt5' => 5, 'alt6' => 6);
$category = varset($types[$parm], 1);
$tmpl = vartrue($parm, 'main');
$nav = e107::getNav();
$template = e107::getCoreTemplate('navigation', $tmpl);
$data = $nav->initData($category);
// $data = $nav->collection($category);
return $nav->render($data, $template);
}
示例3: sc_page_navigation
/**
* Page Navigation
* @example {PAGE_NAVIGATION: template=navdoc&auto=1} in your Theme template.
*/
function sc_page_navigation($parm = '')
{
// $parm = eHelper::scParams($parm);
$tmpl = e107::getCoreTemplate('chapter', vartrue($parm['template'], 'nav'), true, true);
// always merge
$template = $tmpl['showPage'];
$request = $this->request;
if ($request && is_array($request)) {
switch ($request['action']) {
case 'listBooks':
$parm['cbook'] = 'all';
$template = $tmpl['listBooks'];
if (e107::getPref('listBooks', false) == false) {
return false;
}
break;
case 'listChapters':
$parm['cbook'] = $request['id'];
$template = $tmpl['listChapters'];
break;
case 'listPages':
$parm['cchapter'] = $request['id'];
$template = $tmpl['listPages'];
break;
case 'showPage':
$parm['cpage'] = $request['id'];
break;
}
}
if ($parm) {
$parm = http_build_query($parm, null, '&');
} else {
$parm = '';
}
$links = e107::getAddon('page', 'e_sitelink');
$data = $links->pageNav($parm);
if (isset($data['title']) && !vartrue($template['noAutoTitle'])) {
// use chapter title
$template['caption'] = $data['title'];
$data = $data['body'];
}
if (empty($data)) {
return;
}
return e107::getNav()->render($data, $template);
}
示例4: __construct
function __construct()
{
$this->search_prefs = e107::getConfig('search')->getPref();
$this->search_info = $this->searchConfig();
if (deftrue('BOOTSTRAP')) {
$tmp = e107::getCoreTemplate('search', 'form');
$SEARCH_TOP_TABLE = $tmp['start'];
$SEARCH_BOT_TABLE = $tmp['end'];
$SEARCH_CATS = $tmp['category'];
$SEARCH_TYPE = $tmp['type'];
$SEARCH_ADV = $tmp['advanced'];
$SEARCH_ENHANCED = $tmp['enhanced'];
$SEARCH_ADV_COMBO = $tmp['advanced-combo'];
$this->template = $tmp;
unset($tmp);
} else {
if (file_exists(THEME . "search_template.php")) {
require THEME . "search_template.php";
} else {
require e_CORE . "templates/search_template.php";
}
$SEARCH_TOP_TABLE .= "{SEARCH_ENHANCED}";
$tmp = array();
$tmp['start'] = $SEARCH_TOP_TABLE;
$tmp['end'] = $SEARCH_BOT_TABLE;
$tmp['category'] = $SEARCH_CATS;
$tmp['type'] = $SEARCH_TYPE;
$tmp['advanced'] = $SEARCH_ADV;
$tmp['enhanced'] = $SEARCH_ENHANCED;
$tmp['advanced-combo'] = $SEARCH_ADV_COMBO;
$this->template = $tmp;
}
if (e_AJAX_REQUEST) {
if (vartrue($_POST['t'])) {
echo $this->sc_search_advanced_block($_POST['t']);
}
exit;
}
}
示例5: renderEmail
/**
* Render user email.
* Additional user fields:
* 'mail_subject' -> required when type is not signup
* 'mail_body' -> required when type is not signup
* 'mail_copy_to' -> optional, carbon copy, used when type is not signup
* 'mail_bcopy_to' -> optional, blind carbon copy, used when type is not signup
* 'mail_attach' -> optional, attach files, available for all types, additionally it overrides $SIGNUPEMAIL_ATTACHMENTS when type is signup
* 'mail_options' -> optional, available for all types, any additional valid mailer option as described in e107Email::sendEmail() phpDoc help (options above can override them)
* All standard user fields from the DB (user_name, user_loginname, etc.)
*
* @param string $type signup|notify|email|quickadd
* @param array $userInfo
* @return array
*/
public function renderEmail($type, $userInfo)
{
$pref = e107::getPref();
$ret = array();
$tp = e107::getParser();
$mes = e107::getMessage();
// mailer options
if (isset($userInfo['mail_options']) && is_array($userInfo['mail_options'])) {
$ret = $userInfo['mail_options'];
}
// required for signup and quickadd email type
e107::coreLan('signup');
$EMAIL_TEMPLATE = e107::getCoreTemplate('email');
if (!is_array($EMAIL_TEMPLATE)) {
// load from old location. (root of theme folder if it exists)
if (file_exists(THEME . 'email_template.php')) {
include THEME . 'email_template.php';
} else {
// include core default.
include e107::coreTemplatePath('email');
}
// BC Fixes.
$EMAIL_TEMPLATE['signup']['subject'] = $SIGNUPEMAIL_SUBJECT;
$EMAIL_TEMPLATE['signup']['cc'] = $SIGNUPEMAIL_CC;
$EMAIL_TEMPLATE['signup']['bcc'] = $SIGNUPEMAIL_BCC;
$EMAIL_TEMPLATE['signup']['attachments'] = $SIGNUPEMAIL_ATTACHMENTS;
$EMAIL_TEMPLATE['signup']['body'] = $SIGNUPEMAIL_TEMPLATE;
$EMAIL_TEMPLATE['quickadduser']['body'] = $QUICKADDUSER_TEMPLATE['email_body'];
$EMAIL_TEMPLATE['notify']['body'] = $NOTIFY_TEMPLATE['email_body'];
}
$template = '';
switch ($type) {
case 'signup':
$template = vartrue($SIGNUPPROVIDEREMAIL_TEMPLATE) ? $SIGNUPPROVIDEREMAIL_TEMPLATE : $EMAIL_TEMPLATE['signup']['body'];
$ret['template'] = 'signup';
// // false Don't allow additional headers (mailer) ??
break;
case 'quickadd':
$template = $EMAIL_TEMPLATE['quickadduser']['body'];
$ret['template'] = 'quickadduser';
// Don't allow additional headers (mailer)
break;
case 'notify':
if (vartrue($userInfo['mail_body'])) {
$template = $userInfo['mail_body'];
}
//$NOTIFY_HEADER.$userInfo['mail_body'].$NOTIFY_FOOTER;
$ret['template'] = 'notify';
break;
case 'email':
case 'default':
if (vartrue($userInfo['mail_body'])) {
$template = $userInfo['mail_body'];
}
//$EMAIL_HEADER.$userInfo['mail_body'].$EMAIL_FOOTER;
$ret['template'] = 'default';
break;
}
if (!$template) {
$mes->addDebug('$template is empty in user_model.php line 1171.');
// Debug only, do not translate.
return array();
}
$pass_show = varset($userInfo['user_password']);
// signup email only
if ($type == 'signup') {
$HEAD = '';
$FOOT = '';
$ret['e107_header'] = $userInfo['user_id'];
if (vartrue($EMAIL_TEMPLATE['signup']['cc'])) {
$ret['email_copy_to'] = $EMAIL_TEMPLATE['signup']['cc'];
}
if (vartrue($EMAIL_TEMPLATE['signup']['bcc'])) {
$ret['email_bcopy_to'] = $EMAIL_TEMPLATE['signup']['bcc'];
}
if (vartrue($userInfo['email_attach'])) {
$ret['email_attach'] = $userInfo['mail_attach'];
} elseif (vartrue($EMAIL_TEMPLATE['signup']['attachments'])) {
$ret['email_attach'] = $EMAIL_TEMPLATE['signup']['attachments'];
}
$style = vartrue($SIGNUPEMAIL_LINKSTYLE) ? "style='{$SIGNUPEMAIL_LINKSTYLE}'" : "";
if (empty($userInfo['activation_url']) && !empty($userInfo['user_sess']) && !empty($userInfo['user_id'])) {
$userInfo['activation_url'] = SITEURL . "signup.php?activate." . $userInfo['user_id'] . "." . $userInfo['user_sess'];
}
$sc = array();
//.........这里部分代码省略.........
示例6: define
$error = '';
$text = ' ';
$password1 = '';
$password2 = '';
$email = '';
// Used in shortcodes
$loginname = '';
$realname = '';
$image = '';
$avatar_upload = '';
$photo_upload = '';
$_POST['ue'] = '';
$signature = '';
}
if (!empty($pref['membersonly_enabled'])) {
$template = e107::getCoreTemplate('membersonly', 'signup');
define('e_IFRAME', true);
define('e_IFRAME_HEADER', $template['header']);
define('e_IFRAME_FOOTER', $template['footer']);
unset($template);
}
/*
if($signup_imagecode)
{
// require_once(e_HANDLER."secure_img_handler.php");
// $sec_img = new secure_image;
}
*/
if ((USER || intval($pref['user_reg']) !== 1 || vartrue($pref['auth_method'], 'e107') != 'e107') && !getperms('0')) {
header('location: ' . e_HTTP . 'index.php');
}
示例7: sc_user_addons
function sc_user_addons($parm = '')
{
$template = e107::getCoreTemplate('user', 'addon');
$tp = e107::getParser();
$data = e107::getAddonConfig('e_user', null, 'profile', $this->var);
if (empty($data)) {
return;
}
$text = '';
foreach ($data as $plugin => $val) {
foreach ($val as $v) {
$value = vartrue($v['url']) ? "<a href=\"" . $v['url'] . "\">" . $v['text'] . "</a>" : $v['text'];
$array = array('USER_ADDON_LABEL' => $v['label'], 'USER_ADDON_TEXT' => $value);
$text .= $tp->parseTemplate($template, true, $array);
}
}
return $text;
}
示例8: vartrue
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Purpose: Display a Menu item (panel) for each 'chapter' of a specific book. ie. the chapter-equivalent of {CMENU} .
* @example in theme.php: {MENU: path=page/chapter&book=1} to render all chapters in book 1.
*/
if (!defined('e107_INIT')) {
exit;
}
$sql = e107::getDb();
$ns = e107::getRender();
$tp = e107::getParser();
$parm = eHelper::scParams($parm);
$template = e107::getCoreTemplate('chapter', 'panel');
$insert = vartrue($parm['book']) ? "AND chapter_parent = " . intval($parm['book']) : '';
//TODO Limits and cache etc.
$data = $sql->retrieve("SELECT * FROM #page_chapters WHERE chapter_visibility IN (" . USERCLASS_LIST . ") AND chapter_template = 'panel' " . $insert . " LIMIT 24", true);
$sc = e107::getScBatch('page', null, 'cpage');
$body = $template['listChapters']['start'];
foreach ($data as $row) {
$sc->setVars($row);
$sc->setChapter($row['chapter_id']);
$title = $tp->toHtml($row['chapter_name'], false, 'TITLE');
// Used when tablerender style includes the caption.
$body .= $tp->parseTemplate($template['listChapters']['item'], true, $sc);
// check for $mode == 'page-menu' in tablestyle() if you need a simple 'echo' without rendering styles.
}
$body .= $template['listChapters']['end'];
$caption = $tp->parseTemplate($template['listChapters']['caption'], true, $sc);
示例9:
<?php
if (!defined('e107_INIT')) {
exit;
}
e107::lan('core', 'contact');
$head = '<form id="contact-menu" action="' . e_HTTP . 'contact.php" method="post" >';
//XXX Template must conform to Bootstrap specs: http://twitter.github.com/bootstrap/base-css.html#forms
//TODO Security Image.
$foot = '</form>';
$template = e107::getCoreTemplate('contact', 'menu');
$contact_shortcodes = e107::getScBatch('contact');
$text = $tp->parseTemplate($head . $template . $foot, true, $contact_shortcodes);
$ns->tablerender("Contact Us", $text, 'contact-menu');
示例10: explode
$tmp = explode(".", e_QUERY);
if ($tmp[0] == "self") {
$tmp[1] = USERID;
}
if (USERID == $tmp[1] || ADMIN && getperms("4")) {
$sql->select("user", "user_sess", "user_id='" . USERID . "'");
$row = $sql->db_Fetch();
@unlink(e_AVATAR_UPLOAD . $row['user_sess']);
$sql->update("user", "user_sess='' WHERE user_id=" . intval($tmp[1]));
header("location:" . e_SELF . "?id." . $tmp[1]);
exit;
}
}
$qs = explode(".", e_QUERY);
$self_page = $qs[0] == 'id' && intval($qs[1]) == USERID;
$USER_TEMPLATE = e107::getCoreTemplate('user');
e107::scStyle($sc_style);
if (empty($USER_TEMPLATE)) {
e107::getMessage()->addDebug("Using v1.x user template");
include_once e107::coreTemplatePath('user');
//correct way to load a core template.
} else {
$USER_FULL_TEMPLATE = $USER_TEMPLATE['view'];
$USER_SHORT_TEMPLATE_START = $USER_TEMPLATE['list']['start'];
$USER_SHORT_TEMPLATE = $USER_TEMPLATE['list']['item'];
$USER_SHORT_TEMPLATE_END = $USER_TEMPLATE['list']['end'];
}
$TEMPLATE = str_replace('{USER_EMBED_USERPROFILE}', '{USER_ADDONS}', $TEMPLATE);
// BC Fix
$user_shortcodes = e107::getScBatch('user');
$user_shortcodes->wrapper('user/view');
示例11: setIconArray
function setIconArray()
{
if (!defined('E_32_MAIN')) {
e107::getCoreTemplate('admin_icons');
}
$this->iconArray = array('main' => E_32_MAIN, 'admin' => E_32_ADMIN, 'admin_pass' => E_32_ADPASS, 'banlist' => E_32_BANLIST, 'cache' => E_32_CACHE, 'comment' => E_32_COMMENT, 'credits' => E_32_CREDITS, 'cron' => E_32_CRON, 'custom' => E_32_CUST, 'database' => E_32_DATAB, 'docs' => E_32_DOCS, 'emoticon' => E_32_EMOTE, 'filemanage' => E_32_FILE, 'fileinspector' => E_32_INSPECT, 'frontpage' => E_32_FRONT, 'image' => E_32_IMAGES, 'language' => E_32_LANGUAGE, 'links' => E_32_LINKS, 'mail' => E_32_MAIL, 'maintain' => E_32_MAINTAIN, 'menus' => E_32_MENUS, 'meta' => E_32_META, 'newsfeed' => E_32_NEWSFEED, 'news' => E_32_NEWS, 'notify' => E_32_NOTIFY, 'phpinfo' => E_32_PHP, 'plug_manage' => E_32_PLUGMANAGER, 'poll' => E_32_POLLS, 'prefs' => E_32_PREFS, 'search' => E_32_SEARCH, 'syslogs' => E_32_ADMINLOG, 'theme_manage' => E_32_THEMEMANAGER, 'upload' => E_32_UPLOADS, 'eurl' => E_32_EURL, 'userclass' => E_32_USERCLASS, 'user_extended' => E_32_USER_EXTENDED, 'users' => E_32_USER, 'wmessage' => E_32_WELCOME);
}
示例12: arraySet
/**
* Sets one or more parameters from an array. See @see{sendEmail()} for list of parameters
* Where parameter not present, doesn't change it - so can repeatedly call this function for bulk mailing, or to build up the list
* (Note that there is no requirement to use this method for everything; parameters can be set by mixing this method with individual setting)
*
* @param array $eml - list of parameters to set/change. Key is parameter name. @see{sendEmail()} for list of parameters
*
* @return int zero if no errors detected
*/
public function arraySet($eml)
{
$tp = e107::getParser();
$tmpl = null;
// Cleanup legacy key names. ie. remove 'email_' prefix.
foreach ($eml as $k => $v) {
if (substr($k, 0, 6) == 'email_') {
$nkey = substr($k, 6);
$eml[$nkey] = $v;
unset($eml[$k]);
}
}
if (vartrue($eml['template'])) {
if ($tmpl = e107::getCoreTemplate('email', $eml['template'], 'front', true)) {
$eml['shortcodes'] = $this->processShortcodes($eml);
// print_a($eml);
$emailBody = $tmpl['header'] . $tmpl['body'] . $tmpl['footer'];
$eml['body'] = $tp->parseTemplate($emailBody, true, $eml['shortcodes']);
// $eml['body'] = ($tp->toEmail($tmpl['header']). str_replace('{BODY}', $eml['body'], $tmpl['body']). $tp->toEmail($tmpl['footer']));
if ($this->debug) {
// echo "<h4>e107Email::arraySet() - line ".__LINE__."</h4>";
// print_a($tmpl);
}
unset($eml['add_html_header']);
// disable other headers when template is used.
$this->Subject = $tp->parseTemplate($tmpl['subject'], true, varset($eml['shortcodes'], null));
} else {
if ($this->debug) {
echo "<h4>Couldn't find email template: " . $eml['template'] . "</h4>";
}
// $emailBody = $eml['body'];
if (vartrue($eml['subject'])) {
$this->Subject = $tp->parseTemplate($eml['subject'], true, varset($eml['shortcodes'], null));
}
e107::getMessage()->addDebug("Couldn't find email template: " . $eml['template']);
}
} else {
if (vartrue($eml['subject'])) {
$this->Subject = $tp->parseTemplate($eml['subject'], true, varset($eml['shortcodes'], null));
}
// $eml['body'] = ($tp->toEmail($tmpl['header']). str_replace('{BODY}', $eml['body'], $tmpl['body']). $tp->toEmail($tmpl['footer']));
}
$this->Subject = str_replace("'", "'", $this->Subject);
// Perform Override from template.
foreach ($this->overrides as $k => $v) {
if (!empty($tmpl[$v])) {
$eml[$v] = $tmpl[$v];
}
}
$identifier = deftrue('MAIL_IDENTIFIER', 'X-e107-id');
if (isset($eml['SMTPDebug'])) {
$this->SMTPDebug = $eml['SMTPDebug'];
}
// 'FALSE' is a valid value!
if (!empty($eml['sender_email'])) {
$this->From = $eml['sender_email'];
}
if (!empty($eml['sender_name'])) {
$this->FromName = $eml['sender_name'];
}
if (!empty($eml['replyto'])) {
$this->AddAddressList('replyto', $eml['replyto'], vartrue($eml['replytonames'], ''));
}
if (isset($eml['html'])) {
$this->allow_html = $eml['html'];
}
// 'FALSE' is a valid value!
if (isset($eml['html_header'])) {
$this->add_HTML_header = $eml['html_header'];
}
// 'FALSE' is a valid value!
if (!empty($eml['body'])) {
$this->makeBody($eml['body'], $this->allow_html, $this->add_HTML_header);
}
if (!empty($eml['attachment'])) {
$this->attach($eml['attachment']);
}
if (!empty($eml['cc'])) {
$this->AddAddressList('cc', $eml['cc'], vartrue($eml['cc_names'], ''));
}
if (!empty($eml['bcc'])) {
$this->AddAddressList('bcc', $eml['bcc'], vartrue($eml['bcc_names'], ''));
}
if (!empty($eml['returnreceipt'])) {
$this->ConfirmReadingTo = $eml['returnreceipt'];
}
if (!empty($eml['inline_images'])) {
$this->addInlineImages($eml['inline_images']);
}
if (!empty($eml['priority'])) {
$this->Priority = $eml['priority'];
//.........这里部分代码省略.........
示例13: sc_userextended_field
function sc_userextended_field($parm = '')
{
global $usersettings_shortcodes, $extended_showed, $ue, $USEREXTENDED_FIELD, $REQUIRED_FIELD;
if (deftrue('BOOTSTRAP') === 3) {
$USEREXTENDED_FIELD = e107::getCoreTemplate('usersettings', 'extended-field');
}
if (isset($extended_showed['field'][$parm])) {
return "";
}
$sql = e107::getDb();
$tp = e107::getParser();
$ret = "";
$fInfo = getcachedvars("extendeddata_{$parm}");
if (!$fInfo) {
$qry = "\n\t\t\tSELECT * FROM #user_extended_struct\n\t\t\tWHERE user_extended_struct_applicable IN (" . $tp->toDB($this->var['userclass_list'], true) . ")\n\t\t\tAND user_extended_struct_write IN (" . USERCLASS_LIST . ")\n\t\t\tAND user_extended_struct_name = '" . $tp->toDB($parm, true) . "'\n\t\t\t";
if ($sql->gen($qry)) {
$fInfo = $sql->fetch();
}
}
if ($fInfo) {
$fname = $fInfo['user_extended_struct_text'];
if (defined($fname)) {
$fname = constant($fname);
}
$fname = $tp->toHTML($fname, "", "emotes_off, defs");
if ($fInfo['user_extended_struct_required'] == 1 && !deftrue('BOOTSTRAP')) {
$fname = str_replace("{FIELDNAME}", $fname, $REQUIRED_FIELD);
}
$parms = explode("^,^", $fInfo['user_extended_struct_parms']);
$fhide = "";
if ($parms[3]) {
$chk = strpos($this->var['user_hidden_fields'], "^user_" . $parm . "^") === FALSE ? FALSE : TRUE;
if (isset($_POST['updatesettings'])) {
$chk = isset($_POST['hide']['user_' . $parm]);
}
$fhide = $ue->user_extended_hide($fInfo, $chk);
}
$uVal = str_replace(chr(1), "", $this->var['user_' . $parm]);
$fval = $ue->user_extended_edit($fInfo, $uVal);
$ret = $USEREXTENDED_FIELD;
$ret = str_replace("{FIELDNAME}", $fname, $ret);
$ret = str_replace("{FIELDVAL}", $fval, $ret);
$ret = str_replace("{HIDEFIELD}", $fhide, $ret);
}
$extended_showed['field'][$parm] = 1;
return $ret;
}
示例14: processViewPage
function processViewPage()
{
if ($this->checkCache()) {
return;
}
$sql = e107::getDb();
$query = "SELECT p.*, u.user_id, u.user_name, user_login FROM #page AS p\n\t\tLEFT JOIN #user AS u ON p.page_author = u.user_id\n\t\tWHERE p.page_id=" . intval($this->pageID);
// REMOVED AND p.page_class IN (".USERCLASS_LIST.") - permission check is done later
if (!$sql->db_Select_gen($query)) {
$ret['title'] = LAN_PAGE_12;
// ***** CHANGED
$ret['sub_title'] = '';
$ret['text'] = LAN_PAGE_3;
$ret['comments'] = '';
$ret['rating'] = '';
$ret['np'] = '';
$ret['err'] = TRUE;
$ret['cachecontrol'] = false;
$this->authorized = 'nf';
$this->template = e107::getCoreTemplate('page', 'default');
$this->batch = e107::getScBatch('page')->setVars(new e_vars($ret))->setScVar('page', array());
define("e_PAGETITLE", $ret['title']);
return;
}
$this->page = $sql->db_Fetch();
$this->template = e107::getCoreTemplate('page', vartrue($this->page['page_template'], 'default'));
if (empty($this->template)) {
$this->template = e107::getCoreTemplate('page', 'default');
}
$this->batch = e107::getScBatch('page');
$this->pageText = $this->page['page_text'];
$this->pageCheckPerms($this->page['page_class'], $this->page['page_password'], $this->page['page_title']);
if ($this->debug) {
echo "<b>pageText</b> " . $this->pageText . " <br />";
}
$this->parsePage();
$pagenav = $rating = $comments = '';
if ($this->authorized === true) {
$pagenav = $this->pageIndex();
$rating = $this->pageRating($this->page['page_rating_flag']);
$comments = $this->pageComment($this->page['page_comment_flag']);
}
$ret['title'] = $this->page['page_title'];
$ret['sub_title'] = $this->title;
$ret['text'] = $this->pageToRender;
$ret['np'] = $pagenav;
$ret['rating'] = $rating;
$ret['comments'] = $comments;
$ret['err'] = FALSE;
$ret['cachecontrol'] = isset($this->page['page_password']) && !$this->page['page_password'] && $this->authorized === true;
// Don't cache password protected pages
$this->batch->setVars(new e_vars($ret))->setScVar('page', $this->page);
define('e_PAGETITLE', eHelper::formatMetaTitle($ret['title']));
define('META_DESCRIPTION', $this->page['page_metadscr']);
define('META_KEYWORDS', $this->page['page_metakeys']);
//return $ret;
}
示例15: renderMenu
/**
* Render menu
*
* @param string $mpath menu path
* @param string $mname menu name
* @param string $parm menu parameters
* @param boolean $return
* return string if required
*/
public function renderMenu($mpath, $mname = '', $parm = '', $return = false)
{
// global $sql; // required at the moment.
global $sc_style, $e107_debug;
$sql = e107::getDb();
$ns = e107::getRender();
$tp = e107::getParser();
if ($tmp = e107::unserialize($parm)) {
$parm = $tmp;
unset($tmp);
}
$this->_current_parms = $parm;
$this->_current_menu = $mname;
if ($return) {
ob_start();
}
if (e_DEBUG === true) {
echo "\n<!-- Menu Start: " . $mname . " -->\n";
}
e107::getDB()->db_Mark_Time($mname);
if (is_numeric($mpath) || $mname === false) {
$query = $mname === false ? "menu_name = '" . $mpath . "' " : "page_id=" . intval($mpath) . " ";
// load by ID or load by menu-name (menu_name)
$sql->select("page", "*", $query);
$page = $sql->fetch();
if (!empty($page['menu_class']) && !check_class($page['menu_class'])) {
echo "\n<!-- Menu not rendered due to userclass settings -->\n";
return;
}
$caption = vartrue($page['menu_icon']) ? $tp->toIcon($page['menu_icon']) : '';
$caption .= $tp->toHTML($page['menu_title'], true, 'parse_sc, constants');
if (vartrue($page['menu_template'])) {
$template = e107::getCoreTemplate('menu', $page['menu_template'], true, true);
// override and merge required. ie. when menu template is not in the theme, but only in the core.
$page_shortcodes = e107::getScBatch('page', null, 'cpage');
$page_shortcodes->setVars($page);
$head = $tp->parseTemplate($template['start'], true);
$foot = $tp->parseTemplate($template['end'], true);
// print_a($template['body']);
$text = $head . $tp->parseTemplate($template['body'], true, $page_shortcodes) . $template['end'];
// echo "TEMPLATE= ($mpath)".$page['menu_template'];
// if($template['noTableRender'] !==true) // XXX Deprecated - causes confusion while themeing. use {SETSTYLE=none} instead.
// {
$ns->tablerender($caption, $text, 'cmenu-' . $page['menu_template']);
// }
// else
// {
// echo $text;
// }
} else {
$text = $tp->toHTML($page['menu_text'], true, 'parse_sc, constants');
$ns->tablerender($caption, $text, 'cmenu');
}
} else {
// not sure what would break this, but it's good idea to go away
e107::loadLanFiles($mpath);
//include once is not an option anymore
//e107_include will break many old menus (evil globals), so we'll wait for a while...
//e107_include(e_PLUGIN.$mpath."/".$mname.".php");
//if(substr($mpath,-1)!='/')
//{
// $mpath .= '/';
//}
$mpath = trim($mpath, '/') . '/';
// faster...
$e107_debug ? include e_PLUGIN . $mpath . $mname . '.php' : @(include e_PLUGIN . $mpath . $mname . '.php');
}
e107::getDB()->db_Mark_Time("(After " . $mname . ")");
if ($error_handler->debug == true) {
echo "\n<!-- Menu End: " . $mname . " -->\n";
}
if ($return) {
$ret = ob_get_contents();
ob_end_clean();
return $ret;
}
}