• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Preferences类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Preferences的典型用法代码示例。如果您正苦于以下问题:PHP Preferences类的具体用法?PHP Preferences怎么用?PHP Preferences使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Preferences类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: setPreference

 public function setPreference($user_id, $key, $value)
 {
     $result = Doctrine_Query::create()->from('Preferences p')->andwhere('p.user_ref = ?', $user_id)->andWhere('p.pref_key = ?', $key)->fetchOne();
     if (!$result) {
         $result = new Preferences();
         $result->fromArray(array('user_ref' => $user_id, 'pref_key' => $key));
     }
     $result->setPrefValue($value);
     $result->save();
     return true;
 }
开发者ID:naturalsciences,项目名称:Darwin,代码行数:11,代码来源:PreferencesTable.class.php


示例2: save_prefs

 /**
  * Saves user preferences
  */
 function save_prefs($username, Preferences $prefs)
 {
     $data = array('options' => $prefs->to_json());
     log_message('DEBUG', 'Storing user prefs [' . $prefs->to_json() . ']' . ' for user ' . $username);
     $query = $this->db->get_where('prefs', array('username' => $username));
     if ($query->num_rows() == 1) {
         $this->db->update('prefs', $data, array('username' => $username));
     } else {
         $data['username'] = $username;
         $this->db->insert('prefs', $data);
     }
 }
开发者ID:julien2512,项目名称:agendav,代码行数:15,代码来源:userpref.php


示例3: read

 function read($sessId)
 {
     $prefs = new Preferences();
     $idle = $prefs->idleTime();
     $expiry = time() - $idle;
     $query = "SELECT data FROM Sessions WHERE sessId='{$sessId}' AND lastAccess >= {$expiry}";
     $data = parent::query($query);
     if (isset($data[0])) {
         return $data[0]['data'];
     } else {
         return '';
     }
 }
开发者ID:nateirwin,项目名称:custom-historic,代码行数:13,代码来源:StoreSessionDB.php


示例4: getInstance

 /**
  * @return Preferences
  */
 public static function getInstance()
 {
     if (!self::$_instance) {
         self::$_instance = new Preferences();
     }
     return self::$_instance;
 }
开发者ID:Codealist,项目名称:patterns,代码行数:10,代码来源:Preferences.php


示例5: dataField

 function dataField($sessId)
 {
     $prefs = new Preferences();
     $idle = $prefs->idleTime();
     $expiry = time() - $idle;
     $query = "SELECT data FROM Sessions WHERE sessId='{$sessId}' AND lastAccess >= {$expiry}";
     $session = parent::query($query);
     $validData = parent::validateIndexes($session, 0, 'data');
     $vars = preg_split('/([a-z,A-Z]+)\\|/', $validData, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
     if (isset($vars[1])) {
         $validData = unserialize($vars[1]);
         return $validData;
     } else {
         return null;
     }
 }
开发者ID:nateirwin,项目名称:custom-historic,代码行数:16,代码来源:Sessions.php


示例6: get_login

 public function get_login()
 {
     $userDB = UserDB::getInstance();
     if (!is_object($userDB)) {
         return NULL;
     }
     $prefs = Preferences::getInstance();
     $config = $prefs->get('AuthMethod', 'Auto');
     if (array_key_exists('login', $_POST) && array_key_exists('uselogin', $config) && $config['uselogin'] == '1') {
         $this->login = $_POST['login'];
     } else {
         $this->login = 'u' . gen_unique_string();
     }
     $u = new User();
     $u->setAttribute('login', $this->login);
     $u->setAttribute('password', $u->getAttribute('login'));
     $u->setAttribute('displayname', 'user ' . $u->getAttribute('login'));
     if ($userDB->add($u)) {
         $user = $userDB->import($u->getAttribute('login'));
     } else {
         Logger::error('main', 'AuthMethod::Auto::get_login failed to add user ' . $u->getAttribute('login'));
         return NULL;
     }
     if (!is_object($user)) {
         return NULL;
     }
     $this->login = $user->getAttribute('login');
     return $this->login;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:29,代码来源:Auto.php


示例7: getInstance

 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = self::$mockmode ? new PreferencesMock() : new PreferencesImpl();
     }
     return self::$instance;
 }
开发者ID:jabouzi,项目名称:projet,代码行数:7,代码来源:listing9.05.fragment.php


示例8: execute

 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->disallowUserJs();
     # Prevent hijacked user scripts from sniffing passwords etc.
     $user = $this->getUser();
     if ($user->isAnon()) {
         $out->showErrorPage('prefsnologin', 'prefsnologintext', array($this->getTitle()->getPrefixedDBkey()));
         return;
     }
     $this->checkReadOnly();
     if ($par == 'reset') {
         $this->showResetForm();
         return;
     }
     $out->addModules('mediawiki.special.preferences');
     if ($this->getRequest()->getCheck('success')) {
         $out->wrapWikiMsg("<div class=\"successbox\"><strong>\n\$1\n</strong></div><div id=\"mw-pref-clear\"></div>", 'savedprefs');
     }
     $htmlForm = Preferences::getFormObject($user, $this->getContext());
     $htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
     $htmlForm->show();
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:25,代码来源:SpecialPreferences.php


示例9: execute

 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->disallowUserJs();
     # Prevent hijacked user scripts from sniffing passwords etc.
     $this->requireLogin('prefsnologintext2');
     $this->checkReadOnly();
     if ($par == 'reset') {
         $this->showResetForm();
         return;
     }
     $out->addModules('mediawiki.special.preferences');
     $out->addModuleStyles('mediawiki.special.preferences.styles');
     if ($this->getRequest()->getCheck('success')) {
         $out->wrapWikiMsg(Html::rawElement('div', array('class' => 'mw-preferences-messagebox successbox', 'id' => 'mw-preferences-success'), Html::element('p', array(), '$1')), 'savedprefs');
     }
     $this->addHelpLink('Help:Preferences');
     // Load the user from the master to reduce CAS errors on double post (T95839)
     $user = $this->getUser()->getInstanceForUpdate() ?: $this->getUser();
     $htmlForm = Preferences::getFormObject($user, $this->getContext());
     $htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
     $sectionTitles = $htmlForm->getPreferenceSections();
     $prefTabs = '';
     foreach ($sectionTitles as $key) {
         $prefTabs .= Html::rawElement('li', array('role' => 'presentation', 'class' => $key === 'personal' ? 'selected' : null), Html::rawElement('a', array('id' => 'preftab-' . $key, 'role' => 'tab', 'href' => '#mw-prefsection-' . $key, 'aria-controls' => 'mw-prefsection-' . $key, 'aria-selected' => $key === 'personal' ? 'true' : 'false', 'tabIndex' => $key === 'personal' ? 0 : -1), $htmlForm->getLegend($key)));
     }
     $out->addHTML(Html::rawElement('ul', array('id' => 'preftoc', 'role' => 'tablist'), $prefTabs));
     $htmlForm->show();
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:31,代码来源:SpecialPreferences.php


示例10: getPreferencesForm

 /**
  * @param {String} $key valid key as specified in validTabs
  * @return {HtmlForm}
  */
 public function getPreferencesForm($key)
 {
     $prefs = array();
     $user = $this->getUser();
     $ctx = $this->getContext();
     switch ($key) {
         case 'personal':
             Preferences::profilePreferences($user, $ctx, $prefs);
             break;
         case 'skin':
             Preferences::skinPreferences($user, $ctx, $prefs);
             break;
         case 'dateformat':
             Preferences::datetimePreferences($user, $ctx, $prefs);
             break;
         case 'files':
             Preferences::filesPreferences($user, $ctx, $prefs);
             break;
         case 'rc':
             Preferences::rcPreferences($user, $ctx, $prefs);
             break;
     }
     Preferences::loadPreferenceValues($user, $ctx, $prefs);
     $htmlForm = new PreferencesForm($prefs, $ctx, 'prefs');
     $htmlForm->suppressReset();
     $htmlForm->setModifiedUser($user);
     $htmlForm->setId('mw-prefs-form');
     $htmlForm->setSubmitText($ctx->msg('saveprefs')->text());
     $htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
     $htmlForm->setAction(SpecialPage::getTitleFor($this->getName(), $key)->getLocalUrl());
     return $htmlForm;
 }
开发者ID:negati-ve,项目名称:openshift-mediawiki,代码行数:36,代码来源:SpecialMobilePreferences.php


示例11: execute

 function execute($par)
 {
     global $wgOut, $wgUser, $wgRequest;
     $this->setHeaders();
     $this->outputHeader();
     $wgOut->disallowUserJs();
     # Prevent hijacked user scripts from sniffing passwords etc.
     if ($wgUser->isAnon()) {
         $wgOut->showErrorPage('prefsnologin', 'prefsnologintext', array($this->getTitle()->getPrefixedDBkey()));
         return;
     }
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     if ($par == 'reset') {
         $this->showResetForm();
         return;
     }
     $wgOut->addModules('mediawiki.legacy.prefs');
     $wgOut->addModules('mediawiki.special.preferences');
     if ($wgRequest->getCheck('success')) {
         $wgOut->wrapWikiMsg("<div class=\"successbox\"><strong>\n\$1\n</strong></div><div id=\"mw-pref-clear\"></div>", 'savedprefs');
     }
     if ($wgRequest->getCheck('eauth')) {
         $wgOut->wrapWikiMsg("<div class='error' style='clear: both;'>\n\$1\n</div>", 'eauthentsent', $wgUser->getName());
     }
     $htmlForm = Preferences::getFormObject($wgUser);
     $htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
     $htmlForm->show();
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:31,代码来源:SpecialPreferences.php


示例12: __construct

 public function __construct()
 {
     parent::__construct();
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $a_pref = $prefs->get('UserGroupDB', 'activedirectory');
     if (is_array($a_pref)) {
         foreach ($a_pref as $k => $v) {
             $this->preferences[$k] = $v;
         }
     }
     // Generate parent (ldap) settings
     $this->preferences['filter'] = '(objectClass=group)';
     $this->preferences['match'] = array('name' => 'name', 'description' => 'description');
     $this->preferences['group_match_user'] = array('user_field', 'group_field');
     $this->preferences['user_field'] = 'memberOf';
     $this->preferences['user_field_type'] = 'group_dn';
     $this->preferences['group_field'] = 'member';
     $this->preferences['group_field_type'] = 'user_dn';
     $this->preferences['ou'] = '';
     if (array_key_exists('use_child_group', $this->preferences)) {
         if (in_array($this->preferences['use_child_group'], array(1, '1'))) {
             $this->preferences['user_field'] .= ':1.2.840.113556.1.4.1941:';
             $this->preferences['group_field'] .= ':1.2.840.113556.1.4.1941:';
         }
     }
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:29,代码来源:activedirectory.php


示例13: execute

 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->disallowUserJs();
     # Prevent hijacked user scripts from sniffing passwords etc.
     $user = $this->getUser();
     if ($user->isAnon()) {
         $out->showErrorPage('prefsnologin', 'prefsnologintext', array($this->getTitle()->getPrefixedDBkey()));
         return;
     }
     $this->checkReadOnly();
     if ($par == 'reset') {
         $this->showResetForm();
         return;
     }
     $out->addModules('mediawiki.special.preferences');
     /* Wikia change begin - @author: macbre */
     /* Enable custom notifications handling */
     wfRunHooks('SpecialPreferencesOnRender', array(&$this));
     /* Wikia change end */
     if ($this->getRequest()->getCheck('success')) {
         $out->wrapWikiMsg("<div class=\"successbox\"><strong>\n\$1\n</strong></div><div id=\"mw-pref-clear\"></div>", 'savedprefs');
     }
     if ($this->getRequest()->getCheck('eauth')) {
         $out->wrapWikiMsg("<div class='error' style='clear: both;'>\n\$1</div>", 'eauthentsent', $user->getName());
     }
     $htmlForm = Preferences::getFormObject($user, $this->getContext());
     $htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
     $htmlForm->show();
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:32,代码来源:SpecialPreferences.php


示例14: singleton

 public static function singleton($options = array())
 {
     if (!isset(self::$instance)) {
         self::$instance = new Preferences($options);
     }
     return self::$instance;
 }
开发者ID:julien2512,项目名称:agendav,代码行数:7,代码来源:Preferences.php


示例15: callMethod

 public static function callMethod($method_name_, $type_, $element_ = NULL, $group_ = NULL)
 {
     Logger::debug('main', "Abstract_Liaison::callMethod ('{$method_name_}', '{$type_}', '{$element_}', '{$group_}')");
     if ($type_ != 'UsersGroup') {
         $method_to_call = array('Abstract_Liaison_sql', $method_name_);
         $class_to_use = 'Abstract_Liaison_sql';
     } else {
         $prefs = Preferences::getInstance();
         if (!$prefs) {
             Logger::error('main', 'Abstract_Liaison::load get Preferences failed');
             return NULL;
         }
         $mods_enable = $prefs->get('general', 'module_enable');
         if (!in_array('UserGroupDB', $mods_enable)) {
             Logger::error('main', 'Abstract_Liaison::load UserGroupDB module must be enabled');
             return NULL;
         }
         $mod_usergroup_name = 'UserGroupDB_' . $prefs->get('UserGroupDB', 'enable');
         $liaison_type = call_user_func(array($mod_usergroup_name, 'liaisonType'));
         $method_to_call = array('Abstract_Liaison_' . $liaison_type, $method_name_);
         $class_to_use = 'Abstract_Liaison_' . $liaison_type;
     }
     if (!method_exists($class_to_use, $method_name_)) {
         Logger::error('main', "Abstract_Liaison::callMethod method '{$method_to_call}' does not exist");
         return NULL;
     }
     return call_user_func($method_to_call, $type_, $element_, $group_);
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:28,代码来源:Abstract_Liaison.class.php


示例16: getInstance

 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new Preferences();
     }
     return self::$instance;
 }
开发者ID:captaim,项目名称:designMode,代码行数:7,代码来源:index1.php


示例17: __construct

 function __construct()
 {
     parent::__construct();
     $this->prefs = Preferences::singleton($this->session->userdata('prefs'));
     $this->load->library('caldav');
     $this->output->set_content_type('application/json');
 }
开发者ID:julien2512,项目名称:agendav,代码行数:7,代码来源:caldav2json.php


示例18: __construct

 function __construct()
 {
     parent::__construct();
     // Force authentication
     $this->auth->force_auth();
     // Preferences
     $this->prefs = Preferences::singleton($this->session->userdata('prefs'));
 }
开发者ID:julien2512,项目名称:agendav,代码行数:8,代码来源:prefs.php


示例19: __construct

 public function __construct()
 {
     $prefs = Preferences::getInstance();
     $sql_conf = $prefs->get('general', 'sql');
     if (is_array($sql_conf)) {
         $this->table = $sql_conf['prefix'] . 'user';
     }
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:8,代码来源:sql.php


示例20: __construct

 public function __construct()
 {
     $this->prefs = Preferences::getInstance();
     if (!$this->prefs) {
         Logger::critical('main', 'SessionManagement::__construct - get Preferences failed');
         throw_response(INTERNAL_ERROR);
     }
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:8,代码来源:SessionManagement.php



注:本文中的Preferences类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Prefs类代码示例发布时间:2022-05-23
下一篇:
PHP Preference类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap