本文整理汇总了PHP中e107::setRegistry方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::setRegistry方法的具体用法?PHP e107::setRegistry怎么用?PHP e107::setRegistry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::setRegistry方法的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: sc_newsitem_schook
/**
* Example usage: {NEWSITEM_SCHOOK=mysc_name|my_var1=val1&myvar2=myval2}
* will fire {MYSC_NAME=news_id=1&my_var1=val1&myvar2=myval2}
* Inside your 'MYSC_NAME' shortcode you are also able to access current item data this way
* <code>
* $newsdata = e107::getRegistry('core/news/schook_data');
* //returns array('data' => (array) $current_news_data, 'params' => array() $current_params)
* </code>
*
* @param string $parm
* @return string
*/
function sc_newsitem_schook($parm = '')
{
$parm = explode('|', $parm, 2);
$parm[1] = 'news_id=' . $this->news_item['news_id'] . (varset($parm[1]) ? '&' . $parm[1] : '');
e107::setRegistry('core/news/schook_data', array('data' => $this->news_item, 'params' => $this->param));
return e107::getParser()->parseTemplate('{' . strtoupper($parm[0]) . '=' . $parm[1] . '}');
}
示例3: __construct
/**
* Constructor
* @param e_admin_request $request
* @param e_admin_response $response
* @param array $params [optional]
*/
public function __construct($request, $response, $params = array())
{
$this->setDefaultAction($request->getDefaultAction());
$params['enable_triggers'] = true;
// override
parent::__construct($request, $response, $params);
if (!$this->pluginName) {
$this->pluginName = 'core';
}
$ufieldpref = $this->getUserPref();
if ($ufieldpref) {
$this->fieldpref = $ufieldpref;
}
$this->addTitle($this->pluginTitle, true)->parseAliases();
$this->initAdminAddons();
if ($help = $this->renderHelp()) {
if (!empty($help)) {
e107::setRegistry('core/e107/adminui/help', $help);
}
}
}
示例4: mailout_admin
$text .= $this->renderValue('options', $value, $att, $id);
$text .= "</span>";
return $text;
}
}
new mailout_admin();
$e_sub_cat = 'mail';
$action = $tp->toDB(varset($_GET['mode'], 'makemail'));
$pageMode = varset($_GET['savepage'], $action);
// Sometimes we need to know what brought us here - $action gets changed
$mailId = intval(varset($_GET['m'], 0));
$targetId = intval(varset($_GET['t'], 0));
// Create mail admin object, load all mail handlers
$mailAdmin = new mailoutAdminClass($action);
// This decodes parts of the query using $_GET syntax
e107::setRegistry('_mailout_admin', $mailAdmin);
if ($mailAdmin->loadMailHandlers() == 0) {
// No mail handlers loaded
// echo 'No mail handlers loaded!!';
//exit;
}
require_once e_ADMIN . 'auth.php';
e107::getAdminUI()->runPage();
require_once e_ADMIN . 'footer.php';
$errors = array();
$subAction = '';
$midAction = '';
$fromHold = FALSE;
if (isset($_POST['mailaction'])) {
if (is_array($_POST['mailaction'])) {
foreach ($_POST['mailaction'] as $k => $v) {
示例5: renderListForm
/**
* Generic List Form, used internal by admin UI
* Expected options array format:
* <code>
* <?php
* $form_options['myplugin'] = array(
* 'id' => 'myplugin', // unique string used for building element ids, REQUIRED
* 'pid' => 'primary_id', // primary field name, REQUIRED
* 'url' => '{e_PLUGIN}myplug/admin_config.php', // if not set, e_SELF is used
* 'query' => 'mode=main&action=list', // or e_QUERY if not set
* 'head_query' => 'mode=main&action=list', // without field, asc and from vars, REQUIRED
* 'np_query' => 'mode=main&action=list', // without from var, REQUIRED for next/prev functionality
* 'legend' => 'Fieldset Legend', // hidden by default
* 'form_pre' => '', // markup to be added before opening form element (e.g. Filter form)
* 'form_post' => '', // markup to be added after closing form element
* 'fields' => array(...), // see e_admin_ui::$fields
* 'fieldpref' => array(...), // see e_admin_ui::$fieldpref
* 'table_pre' => '', // markup to be added before opening table element
* 'table_post' => '', // markup to be added after closing table element (e.g. Batch actions)
* 'fieldset_pre' => '', // markup to be added before opening fieldset element
* 'fieldset_post' => '', // markup to be added after closing fieldset element
* 'perPage' => 15, // if 0 - no next/prev navigation
* 'from' => 0, // current page, default 0
* 'field' => 'field_name', //current order field name, default - primary field
* 'asc' => 'desc', //current 'order by' rule, default 'asc'
* );
* $tree_models['myplugin'] = new e_admin_tree_model($data);
* </code>
* TODO - move fieldset & table generation in separate methods, needed for ajax calls
* @param array $form_options
* @param e_admin_tree_model $tree_model
* @param boolean $nocontainer don't enclose form in div container
* @return string
*/
public function renderListForm($form_options, $tree_models, $nocontainer = false)
{
$tp = e107::getParser();
$text = '';
// print_a($form_options);
foreach ($form_options as $fid => $options) {
$tree_model = $tree_models[$fid];
$tree = $tree_model->getTree();
$total = $tree_model->getTotal();
$amount = $options['perPage'];
$from = vartrue($options['from'], 0);
$field = vartrue($options['field'], $options['pid']);
$asc = strtoupper(vartrue($options['asc'], 'asc'));
$elid = $fid;
//$options['id'];
$query = vartrue($options['query'], e_QUERY);
// ? $options['query'] : ;
if (vartrue($_GET['action']) == 'list') {
$query = e_QUERY;
//XXX Quick fix for loss of pagination after 'delete'.
}
$url = isset($options['url']) ? $tp->replaceConstants($options['url'], 'abs') : e_SELF;
$formurl = $url . ($query ? '?' . $query : '');
$fields = $options['fields'];
$current_fields = varset($options['fieldpref']) ? $options['fieldpref'] : array_keys($options['fields']);
$legend_class = vartrue($options['legend_class'], 'e-hideme');
$text .= "\r\n\t\t\t\t<form method='post' action='{$formurl}' id='{$elid}-list-form'>\r\n\t\t\t\t<div>" . $this->token() . "\r\n\t\t\t\t\t" . vartrue($options['fieldset_pre']) . "\r\n\t\t\t\t\t<fieldset id='{$elid}-list'>\r\n\t\t\t\t\t\t<legend class='{$legend_class}'>" . $options['legend'] . "</legend>\r\n\t\t\t\t\t\t" . vartrue($options['table_pre']) . "\r\n\t\t\t\t\t\t<table class='table adminlist table-striped' id='{$elid}-list-table'>\r\n\t\t\t\t\t\t\t" . $this->colGroup($fields, $current_fields) . "\r\n\t\t\t\t\t\t\t" . $this->thead($fields, $current_fields, varset($options['head_query']), varset($options['query'])) . "\r\n\t\t\t\t\t\t\t<tbody id='e-sort'>\r\n\t\t\t";
if (!$tree) {
$text .= "\r\n\t\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t\t</table>";
$text .= "<div id='admin-ui-list-no-records-found' class=' alert alert-block alert-info center middle'>" . LAN_NO_RECORDS_FOUND . "</div>";
// not prone to column-count issues.
} else {
foreach ($tree as $model) {
e107::setRegistry('core/adminUI/currentListModel', $model);
$text .= $this->renderTableRow($fields, $current_fields, $model->getData(), $options['pid']);
}
e107::setRegistry('core/adminUI/currentListModel', null);
$text .= "</tbody>\r\n\t\t\t\t\t\t</table>";
}
$text .= vartrue($options['table_post']);
if ($tree && $amount) {
// New nextprev SC parameters
$parms = 'total=' . $total;
$parms .= '&amount=' . $amount;
$parms .= '¤t=' . $from;
if (ADMIN_AREA) {
$parms .= '&tmpl_prefix=admin';
}
// NOTE - the whole url is double encoded - reason is to not break parms query string
// 'np_query' should be proper (urlencode'd) url query string
$url = rawurlencode($url . '?' . (varset($options['np_query']) ? str_replace(array('&', '&'), array('&', '&'), $options['np_query']) . '&' : '') . 'from=[FROM]');
$parms .= '&url=' . $url;
//$parms = $total.",".$amount.",".$from.",".$url.'?'.($options['np_query'] ? $options['np_query'].'&' : '').'from=[FROM]';
//$text .= $tp->parseTemplate("{NEXTPREV={$parms}}");
$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
if ($nextprev) {
$text .= "<div class='nextprev-bar'>" . $nextprev . "</div>";
}
}
$text .= "\r\n\t\t\t\t\t</fieldset>\r\n\t\t\t\t\t" . vartrue($options['fieldset_post']) . "\r\n\t\t\t\t</div>\r\n\t\t\t\t</form>\r\n\t\t\t";
}
if (!$nocontainer) {
$text = '<div class="e-container">' . $text . '</div>';
}
return vartrue($options['form_pre']) . $text . vartrue($options['form_post']);
}
示例6: replaceRegistry
public function replaceRegistry()
{
e107::setRegistry('core/e107/session/' . $this->_namespace, $this, true);
}
示例7: cachevars
/**
* @deprecated use e107::setRegistry()
* @param $id
* @param $var
*/
function cachevars($id, $var)
{
e107::setRegistry('core/cachedvars/' . $id, $var);
}
示例8: renderCache
require_once HEADERF;
renderCache($newsCachedPage, TRUE);
// This exits if cache used
}
// <-- Cache
if (isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) {
$query = "\n\t \tSELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef,\n\t\tnc.category_icon, nc.category_meta_keywords, nc.category_meta_description\n\t \tFROM #news AS n\n\t\tLEFT JOIN #user AS u ON n.news_author = u.user_id\n\t\tLEFT JOIN #news_category AS nc ON n.news_category = nc.category_id\n\t\tLEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id\n\t\tWHERE n.news_id=" . intval($sub_action) . " AND n.news_class REGEXP '" . e_CLASS_REGEXP . "'\n\t\tAND NOT (n.news_class REGEXP " . $nobody_regexp . ")\n\t\tAND n.news_start < " . time() . " AND (n.news_end=0 || n.news_end>" . time() . ")\n\t\tGROUP by n.news_id";
} else {
$query = "\n\t \tSELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords,\n\t\tnc.category_meta_description\n\t \tFROM #news AS n\n\t\tLEFT JOIN #user AS u ON n.news_author = u.user_id\n\t\tLEFT JOIN #news_category AS nc ON n.news_category = nc.category_id\n\t\tWHERE n.news_class REGEXP '" . e_CLASS_REGEXP . "'\n\t\tAND NOT (n.news_class REGEXP " . $nobody_regexp . ")\n\t\tAND n.news_start < " . time() . "\n\t\tAND (n.news_end=0 || n.news_end>" . time() . ")\n\t\tAND n.news_id=" . intval($sub_action);
}
if ($sql->db_Select_gen($query)) {
$news = $sql->db_Fetch();
$id = $news['news_category'];
// Use category of this news item to generate next/prev links
//***NEW [SecretR] - comments handled inside now
e107::setRegistry('news/page_allow_comments', !$news['news_allow_comments']);
if (!$news['news_allow_comments'] && isset($_POST['commentsubmit'])) {
$pid = intval(varset($_POST['pid'], 0));
// ID of the specific comment being edited (nested comments - replies)
$clean_authorname = $_POST['author_name'];
$clean_comment = $_POST['comment'];
$clean_subject = $_POST['subject'];
e107::getSingleton('comment')->enter_comment($clean_authorname, $clean_comment, 'news', $sub_action, $pid, $clean_subject);
}
//More SEO
setNewsFrontMeta($news);
/*
if($news['news_title'])
{
if($pref['meta_news_summary'] && $news['news_title'])
{
示例9: sc_user_jump_link
function sc_user_jump_link($parm)
{
global $full_perms;
$sql = e107::getDb();
$tp = e107::getParser();
if (!$full_perms) {
return;
}
$url = e107::getUrl();
if (!($userjump = e107::getRegistry('userjump'))) {
// $sql->db_Select("user", "user_id, user_name", "`user_id` > ".intval($this->var['user_id'])." AND `user_ban`=0 ORDER BY user_id ASC LIMIT 1 ");
$sql->gen("SELECT user_id, user_name FROM `#user` FORCE INDEX (PRIMARY) WHERE `user_id` > " . intval($this->var['user_id']) . " AND `user_ban`=0 ORDER BY user_id ASC LIMIT 1 ");
if ($row = $sql->fetch()) {
$userjump['next']['id'] = $row['user_id'];
$userjump['next']['name'] = $row['user_name'];
}
// $sql->db_Select("user", "user_id, user_name", "`user_id` < ".intval($this->var['user_id'])." AND `user_ban`=0 ORDER BY user_id DESC LIMIT 1 ");
$sql->gen("SELECT user_id, user_name FROM `#user` FORCE INDEX (PRIMARY) WHERE `user_id` < " . intval($this->var['user_id']) . " AND `user_ban`=0 ORDER BY user_id DESC LIMIT 1 ");
if ($row = $sql->fetch()) {
$userjump['prev']['id'] = $row['user_id'];
$userjump['prev']['name'] = $row['user_name'];
}
e107::setRegistry('userjump', $userjump);
}
if ($parm == 'prev') {
$icon = deftrue('BOOTSTRAP') ? $tp->toGlyph('chevron-left') : '<<';
return isset($userjump['prev']['id']) ? "<a class='e-tip' href='" . $url->create('user/profile/view', $userjump['prev']) . "' title=\"" . $userjump['prev']['name'] . "\">" . $icon . " " . LAN_USER_40 . "</a>\n" : " ";
// return isset($userjump['prev']['id']) ? "<< ".LAN_USER_40." [ <a href='".$url->create('user/profile/view', $userjump['prev'])."'>".$userjump['prev']['name']."</a> ]" : " ";
} else {
$icon = deftrue('BOOTSTRAP') ? $tp->toGlyph('chevron-right') : '>>';
return isset($userjump['next']['id']) ? "<a class='e-tip' href='" . $url->create('user/profile/view', $userjump['next']) . "' title=\"" . $userjump['next']['name'] . "\">" . LAN_USER_41 . " " . $icon . "</a>\n" : " ";
// return isset($userjump['next']['id']) ? "[ <a href='".$url->create('user/profile/view', $userjump['next'])."'>".$userjump['next']['name']."</a> ] ".LAN_USER_41." >>" : " ";
}
}
示例10: 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);
}
示例11: setListModel
public function setListModel($model)
{
e107::setRegistry('core/adminUI/currentListModel', $model);
return $this;
}
示例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/]#', '', $fname);
} else {
$fname = e_LANGUAGE;
}
$path = $theme . $fname . '.php';
e107::setRegistry($cstring, true);
self::includeLan($path, false);
}
示例13: 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);
}
}
}
}
}
}
示例14: foreach
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu.php,v $
* $Revision$
* $Date$
* $Author$
*/
if (!defined('e107_INIT')) {
exit;
}
require_once e_PLUGIN . "comment_menu/comment_menu_shortcodes.php";
$cobj = e107::getObject('comment');
//require_once (e_HANDLER."comment_class.php");
//$cobj = new comment;
if (file_exists(THEME . "comment_menu_template.php")) {
require_once THEME . "comment_menu_template.php";
} else {
require_once e_PLUGIN . "comment_menu/comment_menu_template.php";
}
$data = $cobj->getCommentData(intval($menu_pref['comment_display']));
$text = '';
// no posts yet ..
if (empty($data) || !is_array($data)) {
$text = CM_L1;
}
foreach ($data as $row) {
e107::setRegistry('plugin/comment_menu/current', $row);
$text .= $tp->parseTemplate($COMMENT_MENU_TEMPLATE, true, $comment_menu_shortcodes);
}
e107::setRegistry('plugin/comment_menu/current', null);
$title = e107::getConfig('menu')->get('comment_caption');
e107::getRender()->tablerender(defset($title, $title), $text, 'comment_menu');
示例15: header
header('location:' . e_SELF);
exit;
}
return true;
}
if (e_QUERY) {
// BC - SO MUCH BAD, never do this at home!!!
if (isset($_GET['action'])) {
$uc_qs = array($_GET['action'], $_GET['id']);
} else {
$uc_qs = explode('.', e_QUERY);
}
}
$action = varset($uc_qs[0]);
$params = varset($uc_qs[1], '');
e107::setRegistry('pageParams', $uc_qs);
//AJAX request check is already made by the API
/*
if(e_AJAX_REQUEST)
{
$class_num = intval($params);
if ($action == 'edit')
{
require_once(e_HANDLER.'js_helper.php');
$jshelper = new e_jshelper();
if(!checkAllowed($class_num, false))
{
//This will raise an error
//'Access denied' is the message which will be thrown
//by the JS AJAX handler
e_jshelper::sendAjaxError('403', 'Access denied. '.UCSLAN_90);