本文整理汇总了PHP中e107::getRegistry方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getRegistry方法的具体用法?PHP e107::getRegistry怎么用?PHP e107::getRegistry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getRegistry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: profile
function profile($udata)
{
$sql = e107::getDb();
if (!($total_forumposts = e107::getRegistry('total_forumposts'))) {
$total_forumposts = intval($sql->count("forum_post"));
e107::setRegistry('total_forumposts', $total_forumposts);
}
$count = $sql->retrieve('user_extended', 'user_plugin_forum_posts', 'user_extended_id = ' . $udata['user_id']);
$perc = $total_forumposts > 0 && $count ? round($count / $total_forumposts * 100, 2) : 0;
$url = $count > 0 ? e_HTTP . "userposts.php?0.forums." . $udata['user_id'] : null;
$var = array(0 => array('label' => LAN_PLUGIN_FORUM_POSTS, 'text' => intval($count) . " ( " . $perc . "% )", 'url' => $url));
return $var;
}
示例2: __construct
function __construct()
{
$this->request = e107::getRegistry('core/pages/request');
$action = varset($this->request['action']);
if (($action == 'listPages' || $action == 'listChapters') && vartrue($this->request['id'])) {
$this->var = e107::getDb()->retrieve('page_chapters', 'chapter_name, chapter_meta_description, chapter_sef', 'chapter_id = ' . intval($this->request['id']) . ' LIMIT 1');
}
if ($action == 'showPage' && vartrue($this->request['id'])) {
$query = "SELECT p.page_id,c.chapter_name,c.chapter_meta_description FROM #page AS p LEFT JOIN #page_chapters AS c ON p.page_chapter = c.chapter_id WHERE p.page_id = " . intval($this->request['id']) . " LIMIT 1 ";
$rows = e107::getDb()->retrieve($query, true);
$this->var = $rows[0];
}
}
示例3: triggerAdminEvent
function triggerAdminEvent($type, $parms = array())
{
global $pref;
if (!is_array($parms)) {
$_tmp = parse_str($parms, $parms);
}
if (isset($pref['e_admin_events_list']) && is_array($pref['e_admin_events_list'])) {
// $called = getcachedvars('admin_events_called');
$called = e107::getRegistry('core/cachedvars/admin_events_called', false);
if (!is_array($called)) {
$called = array();
}
foreach ($pref['e_admin_events_list'] as $plugin) {
if (e107::isInstalled($plugin)) {
$func = 'plugin_' . $plugin . '_admin_events';
if (!function_exists($func)) {
$fname = e_PLUGIN . $plugin . '/e_admin_events.php';
if (is_readable($fname)) {
include_once $fname;
}
}
if (function_exists($func)) {
$event_func = call_user_func($func, $type, $parms);
if ($event_func && function_exists($event_func) && !in_array($event_func, $called)) {
$called[] = $event_func;
// cachevars('admin_events_called', $called);
e107::setRegistry('core/cachedvars/admin_events_called', $called);
call_user_func($event_func);
}
}
}
}
}
}
示例4: getListModel
/**
* Get currently parsed model while in list mode
* Model instance is registered by e_form::renderListForm()
*
* @return e_admin_model
*/
public function getListModel()
{
return e107::getRegistry('core/adminUI/currentListModel');
}
示例5: headerjs
function headerjs()
{
$text = "\n\t<script type='text/javascript'>\n\t\t\n\tfunction disp(type) \n\t{\n\t\tif(type == 'smtp')\n\t\t{\n\t\t\tdocument.getElementById('smtp').style.display = '';\n\t\t\tdocument.getElementById('sendmail').style.display = 'none';\n\t\t\treturn;\n\t\t}\n\n\t\tif(type =='sendmail')\n\t\t{\n document.getElementById('smtp').style.display = 'none';\n\t\t\tdocument.getElementById('sendmail').style.display = '';\n\t\t\treturn;\n\t\t}\n\n\t\tdocument.getElementById('smtp').style.display = 'none';\n\t\tdocument.getElementById('sendmail').style.display = 'none';\n\t}\n\n\tfunction bouncedisp(type)\n\t{\n\t\tif(type == 'auto')\n\t\t{\n\t\t\tdocument.getElementById('mail_bounce_auto').style.display = '';\n\t\t\tdocument.getElementById('mail_bounce_mail').style.display = 'none';\n\t\t\treturn;\n\t\t}\n\n\t\tif(type =='mail')\n\t\t{\n document.getElementById('mail_bounce_auto').style.display = 'none';\n\t\t\tdocument.getElementById('mail_bounce_mail').style.display = '';\n\t\t\treturn;\n\t\t}\n\n\t\tdocument.getElementById('mail_bounce_auto').style.display = 'none';\n\t\tdocument.getElementById('mail_bounce_mail').style.display = 'none';\n\t}\n\t</script>";
$mailAdmin = e107::getRegistry('_mailout_admin');
// $text .= $mailAdmin->_cal->load_files();
return $text;
}
示例6: mediaUrl
/**
* Internal Function used by imagepicker and filepicker
*/
private function mediaUrl($category = '', $label = '', $tagid = '', $extras = null)
{
$cat = $category ? '&for=' . $category : "";
if (!$label) {
$label = ' Upload an image or file';
}
if ($tagid) {
$cat .= '&tagid=' . $tagid;
}
if (is_string($extras)) {
parse_str($extras, $extras);
}
if (vartrue($extras['bbcode'])) {
$cat .= '&bbcode=1';
}
$mode = vartrue($extras['mode'], 'main');
$action = vartrue($extras['action'], 'dialog');
// $tabs // TODO - option to choose which tabs to display.
//TODO Parse selection data back to parent form.
$url = e_ADMIN_ABS . "image.php?mode={$mode}&action={$action}" . $cat;
$url .= "&iframe=1";
if (vartrue($extras['w'])) {
$url .= "&w=" . $extras['w'];
}
if (vartrue($extras['glyphs'])) {
$url .= "&glyphs=1";
}
if (vartrue($extras['video'])) {
$url .= "&video=1";
}
$title = "Media Manager : " . $category;
// $ret = "<a title=\"{$title}\" rel='external' class='e-dialog' href='".$url."'>".$label."</a>"; // using colorXXXbox.
$ret = "<a title=\"{$title}\" class='e-modal' data-modal-caption='Media Manager' data-cache='false' data-target='#uiModal' href='" . $url . "'>" . $label . "</a>";
// using bootstrap.
// $footer = "<div style=\'padding:5px;text-align:center\' <a href=\'#\' >Save</a></div>";
$footer = '';
if (!e107::getRegistry('core/form/mediaurl')) {
/*
e107::js('core','core/admin.js','prototype');
e107::js('core','core/dialog.js','prototype');
e107::js('core','core/draggable.js','prototype');
e107::css('core','core/dialog/dialog.css','prototype');
e107::css('core','core/dialog/e107/e107.css','prototype');
e107::js('footer-inline','
$$("a.e-dialog").invoke("observe", "click", function(ev) {
var element = ev.findElement("a");
ev.stop();
new e107Widgets.URLDialog(element.href, {
id: element["id"] || "e-dialog",
width: 890,
height: 680
}).center().setHeader("Media Manager : '.$category.'").setFooter('.$footer.').activate().show();
});
','prototype');
*/
e107::setRegistry('core/form/mediaurl', true);
}
return $ret;
}
示例7: sc_adminui_help
function sc_adminui_help()
{
if (!ADMIN) {
return '';
}
if ($tmp = e107::getRegistry('core/e107/adminui/help')) {
return e107::getRender()->tablerender($tmp['caption'], $tmp['text'], 'e_help', true);
}
}
示例8:
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Comment menu shortcodes
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu_shortcodes.php,v $
* $Revision$
* $Date$
* $Author$
*/
if (!defined('e107_INIT')) {
exit;
}
global $tp;
$comment_menu_shortcodes = $tp->e_sc->parse_scbatch(__FILE__);
e107::getRegistry('plugin/comment_menu/current');
/*
SC_BEGIN CM_ICON
//TODO review bullet
$bullet = '';
if(defined('BULLET'))
{
$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" class="icon" />';
}
elseif(file_exists(THEME.'images/bullet2.gif'))
{
$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" class="icon" />';
}
return $bullet;
SC_END
SC_BEGIN CM_DATESTAMP
示例9: showSelect
/**
* Called to show current selection criteria, and optionally allow edit
*
* @param $allow_edit is TRUE to allow user to change the selection; FALSE to just display current settings
* @param $selectVals is the current selection information - in the same format as returned by returnSelectors()
*
* @return Returns HTML which is displayed in a table cell. Typically we return a complete table
*/
public function showSelect($allow_edit = FALSE, $selectVals = FALSE)
{
$frm = e107::getForm();
$sql = e107::getDb();
$admin = e107::getRegistry('_mailout_admin');
$var = array();
$var[0]['caption'] = LAN_MAILOUT_03;
// User class select
if ($allow_edit) {
$u_array = array('user_name' => LAN_MAILOUT_43, 'user_login' => LAN_MAILOUT_44, 'user_email' => LAN_MAILOUT_45);
$var[0]['html'] = $admin->userClassesTotals('email_to', varset($selectVals['email_to'], ''));
$var[1]['html'] = $frm->selectbox('user_search_name', $u_array, varset($selectVals['user_search_name'], ''), '', TRUE) . " " . LAN_MAILOUT_47 . " " . $frm->text('user_search_value', varset($selectVals['user_search_value'], ''));
$var[2]['html'] = $admin->comparisonSelect('last_visit_match', varset($selectVals['last_visit_match'], '')) . " " . $frm->text('last_visit_date', varset($selectVals['last_visit_date'], 0));
// FIXME: Should include date selector
$var[3]['html'] = $admin->ret_extended_field_list('extended_1_name', varset($selectVals['extended_1_name'], ''), TRUE) . LAN_MAILOUT_48 . " " . $frm->text('extended_1_value', varset($selectVals['extended_1_value'], ''));
$var[4]['html'] = $admin->ret_extended_field_list('extended_2_name', varset($selectVals['extended_2_name'], ''), TRUE) . LAN_MAILOUT_48 . " " . $frm->text('extended_2_value', varset($selectVals['extended_2_value'], ''));
$var[1]['caption'] = LAN_MAILOUT_46;
// User Search Field.
$var[2]['caption'] = LAN_MAILOUT_56;
// User last visit
$var[3]['caption'] = LAN_MAILOUT_46;
// Extended user field
$var[4]['caption'] = LAN_MAILOUT_46;
// Extended user field
} else {
if (!vartrue($selectVals['email_to'])) {
return;
}
if (is_numeric($selectVals['email_to'])) {
$_to = LAN_MAILOUT_23 . e107::getUserClass()->uc_get_classname(intval($selectVals['email_to']));
} else {
$_to = $selectVals['email_to'];
}
$var_0 = $_to . ' ';
if ($selectVals['email_to'] == 'self') {
$var_0 .= '<' . USEREMAIL . '>';
}
$var[0]['html'] = $var_0;
if (vartrue($selectVals['user_search_name']) && vartrue($selectVals['user_search_value'])) {
$var[1]['html'] = $selectVals['user_search_name'] . ' ' . $selectVals['user_search_value'];
$var[1]['caption'] = LAN_MAILOUT_46;
// User Search Field.
}
if (vartrue($selectVals['last_visit_match']) && vartrue($selectVals['last_visit_date'])) {
$var[2]['html'] = $selectVals['last_visit_match'] . ' ' . gmstrftime("%D-%M-%Y", $selectVals['last_visit_date']);
//FIXME use e107 date function.
$var[2]['caption'] = LAN_MAILOUT_56;
// User last visit
}
if (vartrue($selectVals['extended_1_name']) && vartrue($selectVals['extended_1_value'])) {
$var[3]['html'] = $selectVals['extended_1_name'] . ' ' . $selectVals['extended_1_value'];
$var[3]['caption'] = LAN_MAILOUT_46;
// Extended user field
}
if (vartrue($selectVals['extended_2_name']) && vartrue($selectVals['extended_2_value'])) {
$var[4]['html'] = $selectVals['extended_2_name'] . ' ' . $selectVals['extended_2_value'];
$var[4]['caption'] = LAN_MAILOUT_46;
// Extended user field
}
}
return $var;
}
示例10: mediaUrl
/**
* Internal Function used by imagepicker and filepicker
*/
private function mediaUrl($category = '', $label = '', $tagid = '', $extras = '')
{
$cat = $category ? '&for=' . $category : "";
if (!$label) {
$label = ' Upload an image or file';
}
if ($tagid) {
$cat .= '&tagid=' . $tagid;
}
parse_str($extras);
if ($bbcode) {
$cat .= '&bbcode=1';
}
if (!$mode) {
$mode = 'main';
}
if (!$action) {
$action = 'dialog';
}
// $tabs // TODO - option to choose which tabs to display.
//TODO Parse selection data back to parent form.
$url = e_ADMIN_ABS . "image.php?mode={$mode}&action={$action}" . $cat;
$url .= "&iframe=1";
$title = "Media Manager : " . $category;
$ret = "<a title=\"{$title}\" rel='external' class='e-dialog' href='" . $url . "'>" . $label . "</a>";
// $footer = "<div style=\'padding:5px;text-align:center\' <a href=\'#\' >Save</a></div>";
$footer = '';
if (!e107::getRegistry('core/form/mediaurl')) {
e107::js('core', 'core/admin.js', 'prototype');
e107::js('core', 'core/dialog.js', 'prototype');
e107::js('core', 'core/draggable.js', 'prototype');
e107::css('core', 'core/dialog/dialog.css', 'prototype');
e107::css('core', 'core/dialog/e107/e107.css', 'prototype');
e107::js('footer-inline', '
$$("a.e-dialog").invoke("observe", "click", function(ev) {
var element = ev.findElement("a");
ev.stop();
new e107Widgets.URLDialog(element.href, {
id: element["id"] || "e-dialog",
width: 890,
height: 680
}).center().setHeader("Media Manager : ' . $category . '").setFooter(' . $footer . ').activate().show();
});
', 'prototype');
e107::setRegistry('core/form/mediaurl', true);
}
return $ret;
}
示例11: headerjs
function headerjs()
{
$params = e107::getRegistry('pageParams');
/*
* e107Ajax.fillForm demonstration
* Open Firebug console for Ajax transaction details
*
*/
$script_js = "<script type=\"text/javascript\">\n\t\t//<![CDATA[\n\t";
// Edit mode only
if ($params[0] == 'edit') {
$script_js .= "\n\t\t\t\te107.runOnLoad( function() {\n\t\t document.observe('click', (function(event){\n\t\t var target = event.findElement('a.userclass_edit');\n\t\t if (target) {\n\t\t event.stop();\n\n\t\t // non-editable user class\n\t\t if('#' == target.readAttribute('href')) return;\n\n\t\t //If link is clicked use it's href as a target\n\t\t \t\t\t\t\$('classForm').fillForm(\$(document.body), { handler: target.readAttribute('href') });\n\t\t \t\t\t\tnew Effect.ScrollTo('classForm');\n\t\t }\n\t\t }));\n\t });\n\t \t\t//Observe fillForm errors\n\t \t\te107Event.register('ajax_fillForm_error', function(transport) {\n\t \t\t\t//memo.error object contains the error message\n\t \t\t\t//error handling will be extended in the near future\n\t\t\t\t\talert(transport.memo.error.message);\n\t \t\t});\n\n\t\t\t\t/*//Click observer\n\t document.observe('click', (function(event){\n\t var target = (event.findElement('a.userclass_edit') || event.findElement('input#edit'));\n\t if (target) {\n\t event.stop();\n\n\t //show cancel button in edit mod only\n\t \$('updatecancel').show();\n\n\t //If link is clicked use it's href as a target\n\t \t\t\t\t\$('classForm').fillForm(\$(document.body), { handler: target.readAttribute('href') });\n\t }\n\t }));\n\n\t //run on e107 init finished (dom is loaded)\n\t \t\te107.runOnLoad( function() {\n\t\t\t\t\t\$('updatecancel').hide(); //hide cancel button onload\n\t\t\t\t});\n\n\t \t\t//Observe fillForm errors\n\t \t\te107Event.register('ajax_fillForm_error', function(transport) {\n\t \t\t\t//memo.error object contains the error message\n\t \t\t\t//error handling will be extended in the near future\n\t\t\t\t\talert(transport.memo.error.message);\n\t \t\t});*/\n\t\t";
}
//XXX FIXME Rewrite using jQuery selectors.
$script_js .= "\nfunction setGroupStatus(dropdown)\n{\n\tvar temp1 = document.getElementById('userclass_type_standard');\n\tvar temp2 = document.getElementById('userclass_type_groups');\n\tif (!temp1 || !temp2) return;\n\tif (dropdown.value == 0)\n\t{\n\t\ttemp1.style.display = '';\n\t\ttemp2.style.display = 'none';\n\t}\n\telse\n\t{\n\t\ttemp2.style.display = '';\n\t\ttemp1.style.display = 'none';\n\t}\n}\n\n\t//]]>\n\t</script>\n";
if ($params[0] != 'membs') {
return $script_js;
}
// We only want this JS on the class membership selection page
// XXX memebs action is deprecated now, remove this script?
$script_js .= "<script type=\"text/javascript\">\n\t\t//<![CDATA[\n// Inspiration (and some of the code) from a script by Sean Geraty - Web Site: http://www.freewebs.com/sean_geraty/\n// Script from: The JavaScript Source!! http://javascript.internet.com\n\n// Control flags for list selection and sort sequence\n// Sequence is on option value (first 2 chars - can be stripped off in form processing)\n// It is assumed that the select list is in sort sequence initially\n\nvar singleSelect = true; // Allows an item to be selected once only (i.e. in only one list at a time)\nvar sortSelect = true; // Only effective if above flag set to true\nvar sortPick = true; // Will order the picklist in sort sequence\n\n\n// Initialise - invoked on load\nfunction initIt()\n{\n var selectList = document.getElementById(\"assignclass1\");\n var pickList = document.getElementById(\"assignclass2\");\n var pickOptions = pickList.options;\n pickOptions[0] = null; // Remove initial entry from picklist (was only used to set default width)\n selectList.focus(); // Set focus on the selectlist\n}\n\n\n\n// Adds a selected item into the picklist\n\nfunction addIt()\n{\n var selectList = document.getElementById(\"assignclass1\");\n var selectIndex = selectList.selectedIndex;\n var selectOptions = selectList.options;\n\n var pickList = document.getElementById(\"assignclass2\");\n var pickOptions = pickList.options;\n var pickOLength = pickOptions.length;\n\n // An item must be selected\n if (selectIndex > -1)\n {\n pickOptions[pickOLength] = new Option(selectList[selectIndex].text);\n pickOptions[pickOLength].value = selectList[selectIndex].value;\n // If single selection, remove the item from the select list\n if (singleSelect)\n\t{\n selectOptions[selectIndex] = null;\n }\n\n if (sortPick)\n\t{\n var tempText;\n var tempValue;\n // Sort the pick list\n// while (pickOLength > 0 && pickOptions[pickOLength].text < pickOptions[pickOLength-1].text)\n while (pickOLength > 0 && pickOptions[pickOLength].text.toLowerCase() < pickOptions[pickOLength-1].text.toLowerCase())\n\t {\n tempText = pickOptions[pickOLength-1].text;\n tempValue = pickOptions[pickOLength-1].value;\n pickOptions[pickOLength-1].text = pickOptions[pickOLength].text;\n pickOptions[pickOLength-1].value = pickOptions[pickOLength].value;\n pickOptions[pickOLength].text = tempText;\n pickOptions[pickOLength].value = tempValue;\n pickOLength = pickOLength - 1;\n }\n }\n }\n}\n\n\n\n// Deletes an item from the picklist\n\nfunction delIt()\n{\n var selectList = document.getElementById(\"assignclass1\");\n var selectOptions = selectList.options;\n var selectOLength = selectOptions.length;\n\n var pickList = document.getElementById(\"assignclass2\");\n var pickIndex = pickList.selectedIndex;\n var pickOptions = pickList.options;\n\n if (pickIndex > -1)\n {\n // If single selection, replace the item in the select list\n if (singleSelect)\n\t{\n selectOptions[selectOLength] = new Option(pickList[pickIndex].text);\n selectOptions[selectOLength].value = pickList[pickIndex].value;\n }\n pickOptions[pickIndex] = null;\n if (singleSelect && sortSelect)\n\t{\n var tempText;\n var tempValue;\n // Re-sort the select list - start from the bottom, swapping pairs, until the moved element is in the right place\n// Commented out line sorts upper case first, then lower case. 'Active' line does case-insensitive sort\n// while (selectOLength > 0 && selectOptions[selectOLength].text < selectOptions[selectOLength-1].text)\n while (selectOLength > 0 && selectOptions[selectOLength].text.toLowerCase() < selectOptions[selectOLength-1].text.toLowerCase())\n\t {\n tempText = selectOptions[selectOLength-1].text;\n tempValue = selectOptions[selectOLength-1].value;\n selectOptions[selectOLength-1].text = selectOptions[selectOLength].text;\n selectOptions[selectOLength-1].value = selectOptions[selectOLength].value;\n selectOptions[selectOLength].text = tempText;\n selectOptions[selectOLength].value = tempValue;\n selectOLength = selectOLength - 1;\n }\n }\n }\n}\n\nfunction clearMe(clid)\n{\n location.href = document.location + \".clear.\" + clid;\n}\n\n\nfunction saveMe(clid)\n{\n var strValues = \"\";\n var boxLength = document.getElementById('assignclass2').length;\n var count = 0;\n if (boxLength != 0)\n {\n\tfor (i = 0; i < boxLength; i++)\n\t{\n\t if (count == 0)\n\t {\n\t\tstrValues = document.getElementById('assignclass2').options[i].value;\n\t }\n\t else\n\t {\n\t\tstrValues = strValues + \",\" + document.getElementById('assignclass2').options[i].value;\n\t }\n\t count++;\n\t}\n }\n if (strValues.length == 0)\n {\n\t//alert(\"You have not made any selections\");\n }\n else\n {\n\tlocation.href = document.location + \".\" + clid + \"-\" + strValues;\n }\n}\n\n\t//]]>\n\t</script>\n";
return $script_js;
}
示例12: themeLan
/**
* Simplify importing of theme Language files (following e107 plugin structure standards).
* All inputs are sanitized.
*
* Examples:
* <code><?php
* // import defeinitions from /e107_themes/[CurrentTheme]/languages/[CurrentLanguage]/lan.php
* e107::themeLan('lan');
*
* // import defeinitions from /e107_themes/[currentTheme]/languages/[CurrentLanguage].php
* e107::themeLan();
*
* // import defeinitions from /e107_themes/[currentTheme]/languages/[CurrentLanguage]_lan.php
* e107::themeLan('lan', null, true);
*
* // import defeinitions from /e107_themes/[currentTheme]/languages/[CurrentLanguage]/admin/lan.php
* e107::themeLan('admin/lan');
*
* // import defeinitions from /e107_themes/some_theme/languages/[CurrentLanguage].php
* e107::themeLan('', 'some_theme');
* </code>
*
* @param string $fname filename without the extension part (e.g. 'common' for common.php)
* @param string $theme theme name, if null current theme will be used
* @param boolean $flat false (default, preferred) Language folder structure; true - prepend Language to file name
* @return void
*/
public static function themeLan($fname = '', $theme = null, $flat = false)
{
if (null === $theme) {
$theme = THEME . '/languages/';
} else {
$theme = e_THEME . preg_replace('#[^\\w/]#', '', $theme) . '/languages/';
}
$cstring = 'themelan/' . $theme . $fname . ($flat ? '_1' : '_0');
if (e107::getRegistry($cstring)) {
return;
}
if ($fname) {
$fname = e_LANGUAGE . ($flat ? '_' : '/') . preg_replace('#[^\\w/]#', '', trim($fname, '/'));
} else {
$fname = e_LANGUAGE;
}
$path = $theme . $fname . '.php';
if (E107_DBG_INCLUDES) {
e107::getMessage()->addDebug("Attempting to Load: " . $path);
}
e107::setRegistry($cstring, true);
self::includeLan($path, false);
}
示例13: themeLan
/**
* Simplify importing of theme Language files (following e107 plugin structure standards).
* All inputs are sanitized.
*
* Examples:
* <code><?php
* // import defeinitions from /e107_themes/[CurrentTheme]/languages/[CurrentLanguage]/lan.php
* e107::themeLan('lan');
*
* // import defeinitions from /e107_themes/[currentTheme]/languages/[CurrentLanguage].php
* e107::themeLan();
*
* // import defeinitions from /e107_themes/[currentTheme]/languages/[CurrentLanguage]_lan.php
* e107::themeLan('lan', null, true);
*
* // import defeinitions from /e107_themes/[currentTheme]/languages/[CurrentLanguage]/admin/lan.php
* e107::themeLan('admin/lan');
*
* // import defeinitions from /e107_themes/some_theme/languages/[CurrentLanguage].php
* e107::themeLan('', 'some_theme');
* </code>
*
* @param string $fname filename without the extension part (e.g. 'common' for common.php)
* @param string $theme theme name, if null current theme will be used
* @param boolean $flat false (default, preferred) Language folder structure; true - prepend Language to file name
* @return void
*/
public static function themeLan($fname = '', $theme = null, $flat = false)
{
if (null === $theme) {
$theme = THEME . '/languages/';
} else {
$theme = e_THEME . preg_replace('#[^\\w/]#', '', $theme) . '/languages/';
}
$cstring = 'themelan/' . $theme . $fname . ($flat ? '_1' : '_0');
if (e107::getRegistry($cstring)) {
return;
}
if ($fname) {
$fname = e_LANGUAGE . ($flat ? '_' : '/') . preg_replace('#[^\\w/]#', '', $fname);
} else {
$fname = e_LANGUAGE;
}
$path = $theme . $fname . '.php';
e107::setRegistry($cstring, true);
self::includeLan($path, false);
}
示例14: getcachedvars
/**
* @deprecated use e107::getRegistry()
* @param $id
* @return mixed
*/
function getcachedvars($id)
{
return e107::getRegistry('core/cachedvars/' . $id, false);
}
示例15: switch
* e107 website system
*
* 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)
*
*/
if (!defined('e107_INIT')) {
exit;
}
//FIXME XXX - This menu should call the {PAGE_NAVIGATION} shortcode instead of duplicating its code and automatically display all links.
$parm = eHelper::scParams($parm);
$tmpl = e107::getCoreTemplate('chapter', 'nav', true, true);
// always merge and allow override
$template = $tmpl['showPage'];
$request = e107::getRegistry('core/pages/request');
if ($request && is_array($request)) {
switch ($request['action']) {
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;
}
}