当前位置: 首页>>代码示例>>PHP>>正文


PHP Preferences::getSaveBlacklist方法代码示例

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


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

示例1: getOptionKinds

 /**
  * Return an associative array mapping preferences keys to the kind of a preference they're
  * used for. Different kinds are handled differently when setting or reading preferences.
  *
  * See User::listOptionKinds for the list of valid option types that can be provided.
  *
  * @see User::listOptionKinds
  * @param IContextSource $context
  * @param array $options Assoc. array with options keys to check as keys.
  *   Defaults to $this->mOptions.
  * @return array The key => kind mapping data
  */
 public function getOptionKinds(IContextSource $context, $options = null)
 {
     $this->loadOptions();
     if ($options === null) {
         $options = $this->mOptions;
     }
     $prefs = Preferences::getPreferences($this, $context);
     $mapping = array();
     // Pull out the "special" options, so they don't get converted as
     // multiselect or checkmatrix.
     $specialOptions = array_fill_keys(Preferences::getSaveBlacklist(), true);
     foreach ($specialOptions as $name => $value) {
         unset($prefs[$name]);
     }
     // Multiselect and checkmatrix options are stored in the database with
     // one key per option, each having a boolean value. Extract those keys.
     $multiselectOptions = array();
     foreach ($prefs as $name => $info) {
         if (isset($info['type']) && $info['type'] == 'multiselect' || isset($info['class']) && $info['class'] == 'HTMLMultiSelectField') {
             $opts = HTMLFormField::flattenOptions($info['options']);
             $prefix = isset($info['prefix']) ? $info['prefix'] : $name;
             foreach ($opts as $value) {
                 $multiselectOptions["{$prefix}{$value}"] = true;
             }
             unset($prefs[$name]);
         }
     }
     $checkmatrixOptions = array();
     foreach ($prefs as $name => $info) {
         if (isset($info['type']) && $info['type'] == 'checkmatrix' || isset($info['class']) && $info['class'] == 'HTMLCheckMatrix') {
             $columns = HTMLFormField::flattenOptions($info['columns']);
             $rows = HTMLFormField::flattenOptions($info['rows']);
             $prefix = isset($info['prefix']) ? $info['prefix'] : $name;
             foreach ($columns as $column) {
                 foreach ($rows as $row) {
                     $checkmatrixOptions["{$prefix}{$column}-{$row}"] = true;
                 }
             }
             unset($prefs[$name]);
         }
     }
     // $value is ignored
     foreach ($options as $key => $value) {
         if (isset($prefs[$key])) {
             $mapping[$key] = 'registered';
         } elseif (isset($multiselectOptions[$key])) {
             $mapping[$key] = 'registered-multiselect';
         } elseif (isset($checkmatrixOptions[$key])) {
             $mapping[$key] = 'registered-checkmatrix';
         } elseif (isset($specialOptions[$key])) {
             $mapping[$key] = 'special';
         } elseif (substr($key, 0, 7) === 'userjs-') {
             $mapping[$key] = 'userjs';
         } else {
             $mapping[$key] = 'unused';
         }
     }
     return $mapping;
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:71,代码来源:User.php


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