本文整理汇总了PHP中e107::getPref方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getPref方法的具体用法?PHP e107::getPref怎么用?PHP e107::getPref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getPref方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_avatar_shortcode
function user_avatar_shortcode($parm = '')
{
global $loop_uid;
$height = e107::getPref("im_height");
$width = e107::getPref("im_width");
$tp = e107::getParser();
if (intval($loop_uid) > 0 && trim($parm) == "") {
$parm = $loop_uid;
}
if (is_numeric($parm)) {
if ($parm == USERID) {
$image = USERIMAGE;
} else {
$row = get_user_data(intval($parm));
$image = $row['user_image'];
}
} elseif ($parm) {
$image = $parm;
} elseif (USERIMAGE) {
$image = USERIMAGE;
} else {
$image = "";
}
if (vartrue($image)) {
$img = strpos($image, "://") !== false ? $image : $tp->thumbUrl(e_MEDIA . "avatars/" . $image, "aw=" . $width . "&ah=" . $height);
$text = "<img class='user-avatar e-tip' src='" . $img . "' alt='' style='width:" . $width . "px; height:" . $height . "px' />\n\t\t";
} else {
$img = $tp->thumbUrl(e_IMAGE . "generic/blank_avatar.jpg", "aw=" . $width . "&ah=" . $height);
$text = "<img class='user-avatar' src='" . $img . "' alt='' />";
}
return $text;
}
示例2: __construct
/**
* Setup
*/
function __construct()
{
$ns = e107::getRender();
$pref = e107::getPref();
$mes = e107::getMessage();
$frm = e107::getForm();
$this->backUrl = e_SELF;
$core_data = file_get_contents(e_CORE . 'sql/core_sql.php');
$this->tables['core'] = $this->getTables($core_data);
$this->sqlLanguageTables = $this->getSqlLanguages();
if (varset($pref['e_sql_list'])) {
foreach ($pref['e_sql_list'] as $path => $file) {
$filename = e_PLUGIN . $path . '/' . $file . '.php';
if (is_readable($filename)) {
$id = str_replace('_sql', '', $file);
$data = file_get_contents($filename);
$this->tables[$id] = $this->getTables($data);
unset($data);
} else {
$message = str_replace("[x]", $filename, DBVLAN_22);
$mes->add($message, E_MESSAGE_WARNING);
}
}
}
}
示例3: sendEmail
function sendEmail()
{
$adminEmail = e107::getPref('siteadminemail');
$adminName = e107::getPref('siteadmin');
require_once e_HANDLER . "mail.php";
$message = "Your Cron Job worked correctly. Sent at " . date("r") . ".";
sendemail($adminEmail, "e107 - Crong Test Email", $message, $adminName, $adminEmail, $adminName);
}
示例4: languagelinks_shortcode
/**
* Example usage:
* <code>
* <?php
* $SOME_TEMPLATE = '{LANGUAGELINKS}'; // render default (available) lan list, include current query string
* </code>
*
* <code>
* <?php
* $SOME_TEMPLATE = '{LANGUAGELINKS=English,Bulgarian}'; // render custom lan list, include current query string
* </code>
*
* <code>
* <?php
* $SOME_TEMPLATE = '{LANGUAGELINKS=English,Bulgarian|noquery}'; // render custom lan list, exclude query
* </code>
*
* <code>
* <?php
* $SOME_TEMPLATE = '{LANGUAGELINKS=|home}'; // render default (available) lan list, point always to site index
* </code>
*
* @param string $parm
*/
function languagelinks_shortcode($parm = '')
{
if (!defined('LANGLINKS_SEPARATOR')) {
define('LANGLINKS_SEPARATOR', ' | ');
}
$tmp = explode('|', $parm, 2);
$parm = $tmp[0];
$parms = array();
if (isset($tmp[1])) {
parse_str($tmp[1], $parms);
}
// ignore Query string if required by parms or external code, false by default
if (!defined('LANGLINKS_NOQUERY')) {
define('LANGLINKS_NOQUERY', isset($parms['noquery']));
}
if (!defined('LANGLINKS_HOME')) {
define('LANGLINKS_HOME', isset($parms['home']));
}
/*require_once(e_HANDLER.'language_class.php');
$slng = new language;*/
$slng = e107::getLanguage();
if (!empty($parm)) {
$languageList = explode(',', $parm);
} else {
$languageList = $slng->installed();
sort($languageList);
}
if (count($languageList) < 2) {
return;
}
foreach ($languageList as $languageFolder) {
$code = $slng->convert($languageFolder);
$name = $slng->toNative($languageFolder);
//$subdom = (isset($cursub[2])) ? $cursub[0] : '';
if (e107::getPref('multilanguage_subdomain')) {
$code = $languageFolder == e107::getPref('sitelanguage') ? 'www' : $code;
if (LANGLINKS_HOME) {
$link = str_replace($_SERVER['HTTP_HOST'], $code . '.' . e_DOMAIN, SITEURL);
} else {
$link = !LANGLINKS_NOQUERY ? str_replace($_SERVER['HTTP_HOST'], $code . '.' . e_DOMAIN, e_REQUEST_URL) : str_replace($_SERVER['HTTP_HOST'], $code . '.' . e_DOMAIN, e_REQUEST_SELF);
// excludes query string
}
} else {
// TODO - switch to elan=Language query when possible (now it'll break the old DOT query string format)
if (LANGLINKS_HOME) {
$link = SITEURL . '?elan=' . $code;
} else {
$e_QUERY = str_replace('[' . e_MENU . ']', "", e_QUERY);
$link = !LANGLINKS_NOQUERY ? e_REQUEST_SELF . '?[' . $code . ']' . $e_QUERY : e_REQUEST_SELF . '?elan=' . $code;
}
}
$class = $languageFolder == e_LANGUAGE ? 'languagelink_active' : 'languagelink';
$ret[] = "\n<a class='{$class}' href='{$link}'>{$name}</a>";
}
return implode(LANGLINKS_SEPARATOR, $ret);
}
示例5: sc_cm_comment
function sc_cm_comment($parm = '')
{
$menu_pref = e107::getConfig('menu')->getPref();
$tp = e107::getParser();
$COMMENT = '';
if ($menu_pref['comment_characters'] > 0) {
$COMMENT = strip_tags($tp->toHTML($this->var['comment_comment'], TRUE, "emotes_off, no_make_clickable", "", e107::getPref('menu_wordwrap')));
if ($tp->ustrlen($COMMENT) > $menu_pref['comment_characters']) {
$COMMENT = $tp->text_truncate($COMMENT, $menu_pref['comment_characters'], '') . ($this->var['comment_url'] ? " <a href='" . $this->var['comment_url'] . "'>" : "") . defset($menu_pref['comment_postfix'], $menu_pref['comment_postfix']) . ($this->var['comment_url'] ? "</a>" : "");
}
}
return $COMMENT;
}
示例6: __construct
function __construct()
{
// DO Not translate - debug info only.
$log = e107::getAdminLog();
if (E107_DEBUG_LEVEL > 0 || e107::getPref('developer')) {
$dep = debug_backtrace(false);
foreach ($dep as $d) {
$log->addDebug("Deprecated ArrayStorage Class called by " . str_replace(e_ROOT, "", $d['file']) . " on line " . $d['line']);
}
$log->save('DEPRECATED', E_LOG_NOTICE, '', false, LOG_TO_ROLLING);
e107::getMessage()->addDebug("Please remove references to <b>arraystorage_class.php</b> and use e107::serialize() and e107::unserialize() instead.");
}
}
示例7: toHTML
/**
* Send output to browser.
*/
function toHTML($code_text, $parm)
{
global $e107cache;
$class = e107::getBB()->getClass('code');
$pref = e107::getPref();
$tp = e107::getParser();
if ($pref['smiley_activate']) {
if (!is_object($tp->e_emote)) {
$tp->e_emote = new e_emoteFilter();
}
$code_text = $tp->e_emote->filterEmotesRev($code_text);
}
$search = array(E_NL, '\', '$', '<');
$replace = array("\r\n", "\\", '$', '<');
$code_text = str_replace($search, $replace, $code_text);
if (isset($pref['useGeshi']) && $pref['useGeshi'] && file_exists(e_PLUGIN . "geshi/geshi.php")) {
$code_md5 = md5($code_text);
if (!($CodeCache = $e107cache->retrieve('GeshiParsed_' . $code_md5))) {
require_once e_PLUGIN . "geshi/geshi.php";
if ($parm) {
$geshi = new GeSHi($code_text, $parm, e_PLUGIN . "geshi/geshi/");
} else {
$geshi = new GeSHi($code_text, $pref['defaultLanGeshi'] ? $pref['defaultLanGeshi'] : 'php', e_PLUGIN . "geshi/geshi/");
}
$geshi->line_style1 = "font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;";
$geshi->set_encoding('utf-8');
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$geshi->set_header_type(GESHI_HEADER_DIV);
$CodeCache = $geshi->parse_code();
$e107cache->set('GeshiParsed_' . $code_md5, $CodeCache);
}
$ret = "<code class='code_highlight code-box {$class}' style='unicode-bidi: embed; direction: ltr'>" . str_replace("&", "&", $CodeCache) . "</code>";
} else {
$code_text = html_entity_decode($code_text, ENT_QUOTES, 'utf-8');
$code_text = trim($code_text);
$code_text = htmlspecialchars($code_text, ENT_QUOTES, 'utf-8');
$srch = array('{', '}');
$repl = array('{', '}');
$code_text = str_replace($srch, $repl, $code_text);
// avoid code getting parsed as templates or shortcodes.
if ($parm == 'inline') {
return "<code style='unicode-bidi: embed; direction: ltr'>" . $code_text . "</code>";
}
// $highlighted_text = highlight_string($code_text, TRUE);
// highlighted_text = str_replace(array("<code>","</code>"),"",$highlighted_text);
$divClass = $parm ? $parm : 'code_highlight';
$ret = "<pre class='prettyprint linenums " . $tp->toAttribute($divClass) . " code-box {$class}' style='unicode-bidi: embed; direction: ltr'>" . $code_text . "</pre>";
}
$ret = str_replace("[", "[", $ret);
return $ret;
}
示例8: sc_cb_message
function sc_cb_message($parm = '')
{
if ($this->var['cb_blocked']) {
return CHATBOX_L6;
}
$pref = e107::getPref();
$emotes_active = $pref['cb_emote'] ? 'USER_BODY, emotes_on' : 'USER_BODY, emotes_off';
list($cb_uid, $cb_nick) = explode(".", $this->var['cb_nick'], 2);
$cb_message = e107::getParser()->toHTML($this->var['cb_message'], false, $emotes_active, $cb_uid, $pref['menu_wordwrap']);
return $cb_message;
/*
$replace[0] = "["; $replace[1] = "]";
$search[0] = "["; $search[1] = "]";
$cb_message = str_replace($search, $replace, $cb_message);
*/
}
示例9: checkIncompatiblePlugins
function checkIncompatiblePlugins()
{
$mes = e107::getMessage();
$installedPlugs = e107::getPref('plug_installed');
$inCompatText = "";
$incompatFolders = array_keys($this->incompat);
foreach ($this->incompat as $folder => $version) {
if (vartrue($installedPlugs[$folder]) && $version == $installedPlugs[$folder]) {
$inCompatText .= "<li>" . $folder . " v" . $installedPlugs[$folder] . "</li>";
}
}
if ($inCompatText) {
$text = "<ul>" . $inCompatText . "</ul>";
$mes->addWarning("The following plugins are not compatible with this version of e107 and should be uninstalled: " . $text . "<a class='btn' href='" . e_ADMIN . "plugin.php'>uninstall</a>");
}
}
示例10: e_emotefilter
function e_emotefilter()
{
$pref = e107::getPref();
if (!$pref['emotepack']) {
$pref['emotepack'] = "default";
save_prefs();
}
$this->emotes = e107::getConfig("emote")->getPref();
if (!vartrue($this->emotes)) {
return;
}
foreach ($this->emotes as $key => $value) {
$value = trim($value);
if ($value) {
// Only 'activate' emote if there's a substitution string set
$key = preg_replace("#!(\\w{3,}?)\$#si", ".\\1", $key);
// Next two probably to sort out legacy issues - may not be required any more
$key = preg_replace("#_(\\w{3})\$#", ".\\1", $key);
$key = str_replace("!", "_", $key);
$filename = e_IMAGE . "emotes/" . $pref['emotepack'] . "/" . $key;
$fileloc = SITEURLBASE . e_IMAGE_ABS . "emotes/" . $pref['emotepack'] . "/" . $key;
if (file_exists($filename)) {
if (strstr($value, " ")) {
$tmp = explode(" ", $value);
foreach ($tmp as $code) {
$this->search[] = " " . $code;
$this->search[] = "\n" . $code;
//TODO CSS class?
$this->replace[] = " <img src='" . $fileloc . "' alt='' style='vertical-align:middle; border:0' /> ";
$this->replace[] = "\n <img src='" . $fileloc . "' alt='' style='vertical-align:middle; border:0' /> ";
}
unset($tmp);
} else {
if ($value) {
$this->search[] = " " . $value;
$this->search[] = "\n" . $value;
//TODO CSS class?
$this->replace[] = " <img src='" . $filename . "' alt='' style='vertical-align:middle; border:0' /> ";
$this->replace[] = "\n <img src='" . $filename . "' alt='' style='vertical-align:middle; border:0' /> ";
}
}
}
} else {
unset($this->emotes[$key]);
}
}
}
示例11: render
function render()
{
$tp = e107::getParser();
$sql = e107::getDb('nfp');
$pref = e107::getPref();
$qry = $this->getQuery();
if ($results = $sql->gen($qry)) {
$text = "<ul>";
while ($row = $sql->fetch()) {
$datestamp = $tp->toDate($row['post_datestamp'], 'relative');
$id = $row['thread_id'];
$topic = $row['thread_datestamp'] == $row['post_datestamp'] ? '' : 'Re:';
$topic .= strip_tags($tp->toHTML($row['thread_name'], true, 'emotes_off, no_make_clickable, parse_bb', '', $pref['menu_wordwrap']));
$row['thread_sef'] = $this->forumObj->getThreadSef($row);
if ($row['post_user_anon']) {
$poster = $row['post_user_anon'];
} else {
if ($row['user_name']) {
$poster = "<a href='" . e107::getUrl()->create('user/profile/view', array('name' => $row['user_name'], 'id' => $row['post_user'])) . "'>{$row['user_name']}</a>";
} else {
$poster = '[deleted]';
}
}
$post = strip_tags($tp->toHTML($row['post_entry'], true, 'emotes_off, no_make_clickable', '', $pref['menu_wordwrap']));
$post = $tp->text_truncate($post, $this->menuPref['characters'], $this->menuPref['postfix']);
// Count previous posts for calculating proper (topic) page number for the current post.
// $postNum = $sql2->count('forum_post', '(*)', "WHERE post_id <= " . $row['post_id'] . " AND post_thread = " . $row['thread_id'] . " ORDER BY post_id ASC");
// $postPage = ceil($postNum / vartrue($this->plugPref['postspage'], 10)); // Calculate (topic) page number for the current post.
// $thread = $sql->retrieve('forum_thread', '*', 'thread_id = ' . $row['thread_id']); // Load thread for passing it to e107::url().
// Create URL for post.
// like: e107_plugins/forum/forum_viewtopic.php?f=post&id=1
$url = e107::url('forum', 'topic', $row, array('query' => array('f' => 'post', 'id' => intval($row['post_id']))));
$text .= "<li>";
if ($this->menuPref['title']) {
$text .= "<a href='{$url}'>{$topic}</a><br />{$post}<br /><small class='text-muted muted'>" . LAN_FORUM_MENU_001 . " {$poster} {$datestamp}</small>";
} else {
$text .= "<a href='{$url}'>" . LAN_FORUM_MENU_001 . "</a> {$poster} <small class='text-muted muted'>{$datestamp}</small><br />{$post}<br />";
}
$text .= "</li>";
}
$text .= "</ul>";
} else {
$text = LAN_FORUM_MENU_002;
}
$caption = varset($this->menuPref['caption'][e_LANGUAGE], $this->menuPref['caption']);
e107::getRender()->tablerender($caption, $text, 'nfp_menu');
}
示例12: 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);
}
示例13: profile
function profile($udata)
{
$pref = e107::getPref();
if (!$pref['cb_user_addon']) {
return array();
}
if (!($chatposts = e107::getRegistry('total_chatposts'))) {
$chatposts = 0;
// In case plugin not installed
if (e107::isInstalled("chatbox_menu")) {
$chatposts = e107::getDb()->count("chatbox");
}
e107::setRegistry('total_chatposts', $chatposts);
}
$perc = $chatposts > 0 ? round($udata['user_chats'] / $chatposts * 100, 2) : 0;
$var = array(0 => array('label' => LAN_PLUGIN_CHATBOX_MENU_POSTS, 'text' => $udata['user_chats'] . " ( " . $perc . "% )"));
return $var;
}
示例14: create_code
function create_code()
{
if ($user_func = e107::getOverride()->check($this, 'create_code')) {
return call_user_func($user_func);
}
$pref = e107::getPref();
$sql = e107::getDb();
mt_srand((double) microtime() * 1000000);
$maxran = 1000000;
$rand_num = mt_rand(0, $maxran);
$datekey = date("r");
$rcode = hexdec(md5($_SERVER['HTTP_USER_AGENT'] . serialize($pref) . $rand_num . $datekey));
$code = substr($rcode, 2, 6);
$recnum = $this->random_number;
$del_time = time() + 1200;
$sql->db_Insert("tmp", "'{$recnum}',{$del_time},'{$code}'");
return $recnum;
}
示例15: init
/**
* Retrieve menus, check visibility against
* current user classes and current page url
*
*/
public function init()
{
global $_E107;
if (vartrue($_E107['cli'])) {
return;
}
$menu_layout_field = THEME_LAYOUT != e107::getPref('sitetheme_deflayout') ? THEME_LAYOUT : "";
e107::getCache()->CachePageMD5 = md5(e_LANGUAGE . $menu_layout_field);
//FIXME add a function to the cache class for this.
// $menu_data = e107::getCache()->retrieve_sys("menus_".USERCLASS_LIST."_".md5(e_LANGUAGE.$menu_layout_field));
$menu_data = e107::getCache()->retrieve_sys("menus_" . USERCLASS_LIST);
$menu_data = e107::getArrayStorage()->ReadArray($menu_data);
$eMenuArea = array();
// $eMenuList = array();
// $eMenuActive = array(); // DEPRECATED
if (!is_array($menu_data)) {
$menu_qry = 'SELECT * FROM #menus WHERE menu_location > 0 AND menu_class IN (' . USERCLASS_LIST . ') AND menu_layout = "' . $menu_layout_field . '" ORDER BY menu_location,menu_order';
if (e107::getDb()->db_Select_gen($menu_qry)) {
while ($row = e107::getDb()->db_Fetch()) {
$eMenuArea[$row['menu_location']][] = $row;
}
}
$menu_data['menu_area'] = $eMenuArea;
$menuData = e107::getArrayStorage()->WriteArray($menu_data, false);
e107::getCache()->set_sys('menus_' . USERCLASS_LIST, $menuData);
// e107::getCache()->set_sys('menus_'.USERCLASS_LIST.'_'.md5(e_LANGUAGE.$menu_layout_field), $menuData);
} else {
$eMenuArea = $menu_data['menu_area'];
}
$total = array();
foreach ($eMenuArea as $area => $val) {
foreach ($val as $row) {
if ($this->isVisible($row)) {
$path = str_replace("/", "", $row['menu_path']);
if (!isset($total[$area])) {
$total[$area] = 0;
}
$this->eMenuActive[$area][] = $row;
$total[$area]++;
}
}
}
e107::getRender()->eMenuTotal = $total;
}