本文整理汇总了PHP中get_preference函数的典型用法代码示例。如果您正苦于以下问题:PHP get_preference函数的具体用法?PHP get_preference怎么用?PHP get_preference使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_preference函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PrePopulateAdminForm
function PrePopulateAdminForm($formDescriptor)
{
$mod = $this->form_ptr->module_ptr;
$main = array(array($mod->Lang('title_text'), $mod->CreateTextArea(get_preference(get_userid(), 'use_wysiwyg') == '1', $formDescriptor, $this->GetOption('text', ''), 'fbrp_opt_text', 'pageheadtags')));
$adv = array(array($mod->Lang('title_smarty_eval'), $mod->CreateInputCheckbox($formDescriptor, 'fbrp_opt_smarty_eval', '1', $this->GetOption('smarty_eval', '0'))));
return array('main' => $main, 'adv' => $adv);
}
示例2: smarty_modifier_cms_date_format
function smarty_modifier_cms_date_format($string, $format = '', $default_date = '')
{
$gCms = cmsms();
if ($format == '') {
$format = get_site_preference('defaultdateformat');
if ($format == '') {
$format = '%b %e, %Y';
}
if (!isset($gCms->variables['page_id'])) {
$uid = get_userid(false);
if ($uid) {
$tmp = get_preference($uid, 'date_format_string');
if ($tmp != '') {
$format = $tmp;
}
}
}
}
$config = $gCms->GetConfig();
$fn = cms_join_path($config['root_path'], 'lib', 'smarty', 'plugins', 'modifier.date_format.php');
if (!file_exists($fn)) {
die;
}
require_once $fn;
return smarty_modifier_date_format($string, $format, $default_date);
}
示例3: getUserFormat
public function getUserFormat($fmt = '')
{
$config = cmsms()->GetConfig();
$stz = new DateTimeZone($config['timezone']);
$utz = new DateTimeZone($config['user_timezone']);
// this calls the cms_date_format stuff.
if (empty($fmt)) {
$fmt = get_site_preference('defaultdateformat', '%b %e, %Y');
global $gCms;
if (!isset($gCms->variables['page_id'])) {
$uid = get_userid(FALSE);
if ($uid) {
$fmt = get_preference($uid, 'date_format_string', $fmt);
}
}
}
$this->setTimeZone($utz);
$when = $this->format('U');
$this->setTimeZone($stz);
return strftime($fmt, $when);
}
示例4: smarty_cms_modifier_cms_date_format
/**
* Smarty date_format modifier plugin
*
* Type: modifier<br>
* Name: cms_date_format<br>
* Purpose: format datestamps via strftime<br>
* Input:<br>
* - string: input date string
* - format: strftime format for output
* - default_date: default date if $string is empty
*
* @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string $string input date string
* @param string $format strftime format for output
* @param string $default_date default date if $string is empty
* @param string $formatter either 'strftime' or 'auto'
* @return string |void
* @uses smarty_make_timestamp()
*
* Modified by Tapio Löytty <stikki@cmsmadesimple.org>
*/
function smarty_cms_modifier_cms_date_format($string, $format = '', $default_date = '')
{
if ($format == '') {
$format = get_site_preference('defaultdateformat');
if ($format == '') {
$format = '%b %e, %Y';
}
if (!cmsms()->is_frontend_request()) {
if ($uid = get_userid(false)) {
$tmp = get_preference($uid, 'date_format_string');
if ($tmp != '') {
$format = $tmp;
}
}
}
}
$fn = cms_join_path(SMARTY_PLUGINS_DIR, 'modifier.date_format.php');
if (!file_exists($fn)) {
die;
}
require_once $fn;
return smarty_modifier_date_format($string, $format, $default_date);
}
示例5: cmsms
$gCms = cmsms();
$config = $gCms->GetConfig();
$userid = get_userid();
if (isset($USE_THEME) && $USE_THEME == false) {
//echo '<!-- admin theme disabled -->';
} else {
debug_buffer('before theme load');
$themeObject = cms_utils::get_theme_object();
debug_buffer('after theme load');
if (isset($headtext) && $headtext != '') {
$themeObject->set_value('headertext', $headtext);
}
// Display notification stuff from modules
// should be controlled by preferences or something
$ignoredmodules = explode(',', get_preference($userid, 'ignoredmodules'));
if (get_site_preference('enablenotifications', 1) && get_preference($userid, 'enablenotifications', 1)) {
debug_buffer('before notifications');
if ($data = get_site_preference('__NOTIFICATIONS__')) {
$data = unserialize($data);
if (is_array($data) && count($data)) {
foreach ($data as $item) {
$old = $item->html;
$regex = '/' . CMS_SECURE_PARAM_NAME . '\\=[0-9a-z]{8}/';
$to = CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY];
$new = preg_replace($regex, $to, $old);
$themeObject->AddNotification($item->priority, $item->name, $item->html);
}
}
}
// if the install directory still existsx
// add a priority 1 dashboard item
示例6: display_content_list
function display_content_list($themeObject = null)
{
$gCms = cmsms();
global $thisurl;
global $urlext;
check_login();
$userid = get_userid();
// setup which columns to display.
$mypages = author_pages($userid);
$columnstodisplay = array();
$columnstodisplay['expand'] = 1;
$columnstodisplay['hier'] = 1;
$columnstodisplay['page'] = 1;
$columnstodisplay['alias'] = get_site_preference('listcontent_showalias', 1);
$columnstodisplay['url'] = get_site_preference('listcontent_showurl', 1);
$columnstodisplay['template'] = 1;
$columnstodisplay['friendlyname'] = 1;
$columnstodisplay['owner'] = 1;
$columnstodisplay['active'] = check_permission($userid, 'Manage All Content');
$columnstodisplay['default'] = check_permission($userid, 'Manage All Content');
$columnstodisplay['move'] = check_permission($userid, 'Manage All Content') || check_permission($userid, 'Reorder Content');
$columnstodisplay['view'] = 1;
$columnstodisplay['copy'] = check_permission($userid, 'Add Pages') || check_permission($userid, 'Manage All Content');
$columnstodisplay['edit'] = 1;
$columnstodisplay['delete'] = check_permission($userid, 'Remove Pages') || check_permission($userid, 'Manage All Content');
$columnstodisplay['multiselect'] = check_permission($userid, 'Remove Pages') || check_permission($userid, 'Manage All Content');
$page = 1;
if (isset($_GET['page'])) {
$page = $_GET['page'];
}
//$limit = get_preference($userid, 'paging', 0);
$limit = 0;
//Took out pagination
$thelist = '';
$count = 0;
$currow = "row1";
if ($themeObject == null) {
$themeObject = AdminTheme::GetThemeObject();
}
// construct true/false button images
$image_true = $themeObject->DisplayImage('icons/system/true.gif', lang('true'), '', '', 'systemicon');
$image_set_false = $themeObject->DisplayImage('icons/system/true.gif', lang('setfalse'), '', '', 'systemicon');
$image_set_true = $themeObject->DisplayImage('icons/system/false.gif', lang('settrue'), '', '', 'systemicon');
$expandImg = $themeObject->DisplayImage('icons/system/expand.gif', lang('expand'), '', '', 'systemicon');
$contractImg = $themeObject->DisplayImage('icons/system/contract.gif', lang('contract'), '', '', 'systemicon');
$downImg = $themeObject->DisplayImage('icons/system/arrow-d.gif', lang('down'), '', '', 'systemicon');
$upImg = $themeObject->DisplayImage('icons/system/arrow-u.gif', lang('up'), '', '', 'systemicon');
$viewImg = $themeObject->DisplayImage('icons/system/view.gif', lang('view'), '', '', 'systemicon');
$editImg = $themeObject->DisplayImage('icons/system/edit.gif', lang('edit'), '', '', 'systemicon');
$copyImg = $themeObject->DisplayImage('icons/system/copy.gif', lang('copy'), '', '', 'systemicon');
$deleteImg = $themeObject->DisplayImage('icons/system/delete.gif', lang('delete'), '', '', 'systemicon');
#Setup array so we don't load more templates than we need to
$templateops = TemplateOperations::get_instance()->LoadTemplates();
#Ditto with users
$users = array();
$menupos = array();
$openedArray = array();
if (get_preference($userid, 'collapse', '') != '') {
$tmp = explode('.', get_preference($userid, 'collapse'));
foreach ($tmp as $thisCol) {
$colind = substr($thisCol, 0, strpos($thisCol, '='));
if ($colind != "") {
$openedArray[] = $colind;
}
}
}
debug_buffer('At Start of Display Content List');
$hierarchy = $gCms->GetHierarchyManager();
$rowcount = 0;
if ($hierarchy->hasChildren()) {
$pagelist = array();
$children = $hierarchy->getChildren(false, true);
$author_allpages = check_permission($userid, 'Reorder Content') && check_peer_authorship($userid, $children[0]->getId());
foreach ($children as $child) {
display_hierarchy($child, $userid, check_modify_all($userid), $users, $menupos, $openedArray, $pagelist, $image_true, $image_set_false, $image_set_true, $upImg, $downImg, $viewImg, $editImg, $copyImg, $deleteImg, $expandImg, $contractImg, $mypages, $page, $columnstodisplay, $author_allpages);
}
$rowcount += count($pagelist);
foreach ($pagelist as $item) {
$thelist .= $item;
}
$thelist .= '</tbody>';
$thelist .= "</table>\n";
}
$headoflist = '';
$headoflist .= '<div class="pageoverflow"><p class="pageoptions">';
if (check_permission($userid, 'Add Pages') || check_permission($userid, 'Manage All Content')) {
$headoflist .= '<a href="addcontent.php' . $urlext . '" class="pageoptions">';
$headoflist .= $themeObject->DisplayImage('icons/system/newobject.gif', lang('addcontent'), '', '', 'systemicon') . '</a>';
$headoflist .= ' <a class="pageoptions" href="addcontent.php' . $urlext . '">' . lang("addcontent") . '</a>';
}
$headoflist .= '<a style="margin-left: 10px;" href="' . $thisurl . '&expandall=1" onclick="xajax_content_expandall(); return false;">';
$headoflist .= $themeObject->DisplayImage('icons/system/expandall.gif', lang('expandall'), '', '', 'systemicon') . '</a>';
$headoflist .= ' <a class="pageoptions" href="' . $thisurl . '&expandall=1" onclick="xajax_content_expandall(); return false;">' . lang("expandall") . '</a> ';
$headoflist .= ' <a href="' . $thisurl . '&collapseall=1" onclick="xajax_content_collapseall(); return false;">';
$headoflist .= $themeObject->DisplayImage('icons/system/contractall.gif', lang('contractall'), '', '', 'systemicon') . '</a>';
$headoflist .= ' <a class="pageoptions" href="' . $thisurl . '&collapseall=1" onclick="xajax_content_collapseall(); return false;">' . lang("contractall") . '</a>';
if (check_permission($userid, 'Manage All Content')) {
$reorderurl = "ordercontent.php?" . CMS_SECURE_PARAM_NAME . "=" . $_SESSION[CMS_USER_KEY];
$headoflist .= ' <a href="' . $reorderurl . '">';
$headoflist .= $themeObject->DisplayImage('icons/system/reorder.gif', lang('reorderpages'), '', '', 'systemicon') . '</a>';
//.........这里部分代码省略.........
示例7: get_userid
}
?>
<div class="pagecontainer">
<div class="pageoverflow">
<?php
$userid = get_userid();
$gcbops = cmsms()->GetGlobalContentOperations();
$modifyall = check_permission($userid, 'Modify Global Content Blocks');
$htmlbloblist = $gcbops->LoadHtmlBlobs();
$myblobs = $gcbops->AuthorBlobs($userid);
$page = 1;
if (isset($_GET['page'])) {
$page = $_GET['page'];
}
$limit = get_preference($userid, 'listgcbs_pagelimit', 20);
echo "<p class=\"pageshowrows\">" . pagination($page, count($htmlbloblist), $limit) . "</p>";
echo $themeObject->ShowHeader('htmlblobs') . '</div>';
if ($htmlbloblist && count($htmlbloblist) > 0) {
echo "<table cellspacing=\"0\" class=\"pagetable\">\n";
echo "<thead>";
echo "<tr>\n";
echo "<th>" . lang('name') . "</th>\n";
echo "<th>" . lang('tagtousegcb') . "</th>\n";
echo "<th>" . lang('description') . "</th>\n";
echo "<th class=\"pageicon\"> </th>\n";
echo "<th class=\"pageicon\"> </th>\n";
echo "</tr>\n";
echo "</thead>";
echo "<tbody>";
$currow = "row1";
示例8: get_preference
/**
* A function to retrieve the global admin theme object.
* This method will create the admin theme object if has not yet been created. It will read the cms preferences and cross reference with available themes.
*
* @param String optional theme name.
* @return object Reference to the initialized admin theme.
*/
public static function &GetThemeObject($name = '')
{
if (is_object(self::$_instance)) {
return self::$_instance;
}
if (!$name) {
$name = get_preference(get_userid(FALSE), 'admintheme', self::GetDefaultTheme());
}
if (class_exists($name)) {
self::$_instance = new $name();
} else {
$gCms = cmsms();
$config = $gCms->GetConfig();
$themeObjName = $name . "Theme";
$fn = $config['admin_path'] . "/themes/{$name}/{$themeObjName}.php";
if (file_exists($fn)) {
include_once $fn;
self::$_instance = new $themeObjName($gCms, get_userid(FALSE), $name);
} else {
// theme not found... use default
$name = self::GetDefaultTheme();
$themeObjName = $name . "Theme";
$fn = $config['admin_path'] . "/themes/{$name}/{$themeObjName}.php";
if (file_exists($fn)) {
include_once $fn;
self::$_instance = new $themeObjName($gCms, get_userid(FALSE), $name);
} else {
// still not found
$res = null;
return $res;
}
}
}
return self::$_instance;
}
示例9: do_header
public function do_header()
{
$this->DisplayDocType();
$this->DisplayHTMLStartTag();
$headtext = $this->get_value('headertext');
$this->DisplayHTMLHeader(false, $headtext);
$this->DisplayBodyTag();
$this->DisplayTopMenu();
$this->DisplayMainDivStart();
$this->DisplayNotifications(3);
// todo, a preference.
$marks = get_preference(get_userid(), 'bookmarks');
if ($marks) {
$this->StartRighthandColumn();
if ($marks) {
$this->DoBookmarks();
}
$this->EndRighthandColumn();
}
}
示例10: elseif
} elseif (isset($_REQUEST['mact'])) {
$ary = explode(',', cms_htmlentities($_REQUEST['mact']), 4);
$module = isset($ary[0]) ? $ary[0] : '';
$id = isset($ary[1]) ? $ary[1] : 'm1_';
$action = isset($ary[2]) ? $ary[2] : '';
}
if (!$module) {
trigger_error('Module action specified, but could not determine the module.');
redirect("index.php" . $urlext);
}
$modinst = ModuleOperations::get_instance()->get_module_instance($module);
if (!$modinst) {
trigger_error('Module ' . $module . ' not found in memory. This could indicate that the module is in need of upgrade or that there are other problems');
redirect("index.php" . $urlext);
}
if (get_preference($userid, 'use_wysiwyg') == '1' && $modinst->IsWYSIWYG()) {
$htmlarea_flag = "true";
$htmlarea_replaceall = true;
}
$USE_THEME = true;
if (isset($_REQUEST[$id . 'disable_buffer']) || isset($_REQUEST['disable_buffer'])) {
$USE_THEME = false;
} else {
if (isset($_REQUEST[$id . 'disable_theme']) || isset($_REQUEST['disable_theme'])) {
$USE_THEME = false;
}
}
if (isset($_REQUEST['showtemplate']) && $_REQUEST['showtemplate'] == 'false') {
// for simplicity and compatibility with the frontend.
$USE_THEME = false;
}
示例11: get_preference
$wysiwyg = get_preference($userid, 'wysiwyg');
$syntaxhighlighter = get_preference($userid, 'syntaxhighlighter');
$default_cms_language = get_preference($userid, 'default_cms_language');
$old_default_cms_lang = $default_cms_language;
$admintheme = get_preference($userid, 'admintheme', CmsAdminThemeBase::GetDefaultTheme());
$bookmarks = get_preference($userid, 'bookmarks', 0);
$indent = get_preference($userid, 'indent', true);
$enablenotifications = get_preference($userid, 'enablenotifications', 1);
$paging = get_preference($userid, 'paging', 0);
$date_format_string = get_preference($userid, 'date_format_string', '%x %X');
$default_parent = get_preference($userid, 'default_parent', -2);
$listtemplates_pagelimit = get_preference($userid, 'listtemplates_pagelimit', 20);
$liststylesheets_pagelimit = get_preference($userid, 'liststylesheets_pagelimit', 20);
$listgcbs_pagelimit = get_preference($userid, 'listgcbs_pagelimit', 20);
$hide_help_links = get_preference($userid, 'hide_help_links', 0);
$homepage = get_preference($userid, 'homepage');
/**
* Cancel
*/
if (isset($_POST["cancel"])) {
redirect("index.php" . $urlext);
return;
}
/**
* Check tab
*/
$tab = '';
if (isset($_POST['active_tab'])) {
$tab = trim($_POST['active_tab']);
}
/**
示例12: make_no_projects_greeting
// You are in no active projects, active or expired
make_no_projects_greeting($user, true);
} else {
if (count($project_objects) == 0) {
// You are in no active projects
make_no_projects_greeting($user, false);
print "<script type='text/javascript'>";
print "\$(document).ready(function(){";
print 'update_selector($("#projectfilterswitch"), "-EXPIRED-PROJECTS-");';
print 'switch_to_card("#projects");';
print 'update_projects();';
print "});";
print "</script>";
}
make_navigation_tabs();
if (get_preference($user->urn(), "homepage_view") == "cards") {
// Get the user's unexpired slices
$unexpired_slices = array();
foreach ($slice_objects as $slice) {
$slice_id = $slice[SA_SLICE_TABLE_FIELDNAME::SLICE_ID];
$expired = $slice[SA_SLICE_TABLE_FIELDNAME::EXPIRED];
if (!convert_boolean($expired)) {
$unexpired_slices[$slice_id] = $slice;
}
}
$slice_objects = $unexpired_slices;
// Get all of the slice owner names
$slice_owner_names = array();
if (count($slice_objects) > 0) {
$slice_owner_names = lookup_member_names_for_rows($ma_url, $user, $slice_objects, SA_SLICE_TABLE_FIELDNAME::OWNER_ID);
}
示例13: get_preference
if (isset($_GET['setactive'])) {
$thetemplate->active = 1;
$thetemplate->Save();
}
if (isset($_GET['setinactive'])) {
$thetemplate->active = 0;
$thetemplate->Save();
}
}
}
$templatelist = $templateops->LoadTemplates();
$page = 1;
if (isset($_GET['page'])) {
$page = $_GET['page'];
}
$limit = get_preference($userid, 'listtemplates_pagelimit', 20);
if (count($templatelist) > $limit) {
echo "<p class=\"pageshowrows\">" . pagination($page, count($templatelist), $limit) . "</p>";
}
echo $themeObject->ShowHeader('currenttemplates') . '</div>';
if ($templatelist && count($templatelist) > 0) {
echo '<table cellspacing="0" class="pagetable">';
echo '<thead>';
echo "<tr>\n";
echo '<th class="pagew50">' . lang('template') . '</th>';
echo "<th class=\"pagepos\">" . lang('default') . "</th>\n";
echo "<th class=\"pagepos\">" . lang('active') . "</th>\n";
if ($edit) {
echo "<th class=\"pagepos\"> </th>\n";
}
echo "<th class=\"pageicon\"> </th>\n";
示例14: postprocess
public function postprocess($html)
{
$smarty = cmsms()->GetSmarty();
$otd = $smarty->template_dir;
$smarty->template_dir = dirname(__FILE__) . '/templates';
$module_help_type = $this->get_value('module_help_type');
// get a page title
$title = $this->get_value('pagetitle');
$alias = $this->get_value('pagetitle');
if ($title) {
if (!$module_help_type) {
// if not doing module help, translate the string.
$extra = $this->get_value('extra_lang_params');
if (!$extra) {
$extra = array();
}
$title = lang($title, $extra);
}
} else {
// no title, get one from the breadcrumbs.
$bc = $this->get_breadcrumbs();
if (is_array($bc) && count($bc)) {
$title = $bc[count($bc) - 1]['title'];
}
}
// page title and alias
$smarty->assign('pagetitle', $title);
$smarty->assign('pagealias', munge_string_to_url($alias));
// module name?
if ($module_name = $this->get_value('module_name')) {
$smarty->assign('module_name', $module_name);
}
// module icon?
if ($module_icon_url = $this->get_value('module_icon_url')) {
$smarty->assign('module_icon_url', $module_icon_url);
}
// module_help_url
if (!get_preference(get_userid(), 'hide_help_links', 0)) {
if ($module_help_url = $this->get_value('module_help_url')) {
$smarty->assign('module_help_url', $module_help_url);
}
}
// if bookmarks
if (get_preference(get_userid(), 'bookmarks')) {
$marks = $this->get_bookmarks();
$smarty->assign('marks', $marks);
}
$headtext = $this->get_value('headertext');
$smarty->assign('headertext', $headtext);
// and some other common variables,.
$smarty->assign('content', str_replace('</body></html>', '', $html));
$smarty->assign('config', cmsms()->GetConfig());
$smarty->assign('theme', $this);
$smarty->assign('secureparam', CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]);
$userops = cmsms()->GetUserOperations();
$smarty->assign('user', $userops->LoadUserByID(get_userid()));
// get user selected language
$smarty->assign('lang', get_preference(get_userid(), 'default_cms_language'));
// get language direction
$lang = CmsNlsOperations::get_current_language();
$info = CmsNlsOperations::get_language_info($lang);
$smarty->assign('lang_dir', $info->direction());
if (is_array($this->_errors) && count($this->_errors)) {
$smarty->assign('errors', $this->_errors);
}
if (is_array($this->_messages) && count($this->_messages)) {
$smarty->assign('messages', $this->_messages);
}
$_contents = $smarty->fetch('pagetemplate.tpl');
$smarty->template_dir = $otd;
return $_contents;
}
示例15: trim
}
if (isset($_POST['use_wysiwyg'])) {
$use_wysiwyg = (int) $_POST['use_wysiwyg'];
}
if (isset($_POST['description'])) {
$description = trim($_POST['description']);
}
if (isset($_POST['owner_id'])) {
$owner_id = $_POST['owner_id'];
}
if (isset($_POST['ajax']) && $_POST['ajax']) {
$ajax = true;
}
$gcb_wysiwyg = get_site_preference('nogcbwysiwyg', '0') == '0' ? 1 : 0;
if ($gcb_wysiwyg) {
$gcb_wysiwyg = get_preference($userid, 'gcb_wysiwyg', 1);
}
if ($access) {
if (isset($_POST["submit2"]) || $ajax) {
$validinfo = true;
if ($htmlblob == "") {
$error .= "<li>" . lang('nofieldgiven', array(lang('name'))) . "</li>";
$validinfo = false;
} else {
if ($htmlblob != $oldhtmlblob && $gcbops->CheckExistingHtmlBlobName($htmlblob, $htmlblob_id)) {
$error .= "<li>" . lang('blobexists') . "</li>";
$validinfo = false;
} else {
if ($content == "") {
$error .= '<li>' . lang('nofieldgiven', array('content')) . '</li>';
$validinfo = false;