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

PHP HTMLFormField类代码示例

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

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



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

示例1: getInputHTML

 function getInputHTML($value)
 {
     $valInSelect = false;
     if ($value !== false) {
         $value = strval($value);
         $valInSelect = in_array($value, HTMLFormField::flattenOptions($this->getOptions()), true);
     }
     $selected = $valInSelect ? $value : 'other';
     $select = new XmlSelect($this->mName, $this->mID, $selected);
     $select->addOptions($this->getOptions());
     $select->setAttribute('class', 'mw-htmlform-select-or-other');
     $tbAttribs = array('id' => $this->mID . '-other', 'size' => $this->getSize());
     if (!empty($this->mParams['disabled'])) {
         $select->setAttribute('disabled', 'disabled');
         $tbAttribs['disabled'] = 'disabled';
     }
     if (isset($this->mParams['tabindex'])) {
         $select->setAttribute('tabindex', $this->mParams['tabindex']);
         $tbAttribs['tabindex'] = $this->mParams['tabindex'];
     }
     $select = $select->getHTML();
     if (isset($this->mParams['maxlength'])) {
         $tbAttribs['maxlength'] = $this->mParams['maxlength'];
     }
     if ($this->mClass !== '') {
         $tbAttribs['class'] = $this->mClass;
     }
     $textbox = Html::input($this->mName . '-other', $valInSelect ? '' : $value, 'text', $tbAttribs);
     return "{$select}<br />\n{$textbox}";
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:30,代码来源:HTMLSelectOrOtherField.php


示例2: filterDataForSubmit

 function filterDataForSubmit($data)
 {
     $options = HTMLFormField::flattenOptions($this->getOptions());
     $res = array();
     foreach ($options as $opt) {
         $res["{$opt}"] = in_array($opt, $data);
     }
     return $res;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:9,代码来源:HTMLMultiSelectField.php


示例3: validate

 function validate($value, $alldata)
 {
     $p = parent::validate($value, $alldata);
     if ($p !== true) {
         return $p;
     }
     $validOptions = HTMLFormField::flattenOptions($this->getOptions());
     if (in_array(strval($value), $validOptions, true)) {
         return true;
     } else {
         return $this->msg('htmlform-select-badoption')->parse();
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:13,代码来源:HTMLSelectField.php


示例4: datetimePreferences

	/**
	 * @param $user User
	 * @param $context IContextSource
	 * @param $defaultPreferences
	 * @return void
	 */
	static function datetimePreferences( $user, IContextSource $context, &$defaultPreferences ) {
		## Date and time #####################################
		$dateOptions = self::getDateOptions( $context );
		if ( $dateOptions ) {
			$defaultPreferences['date'] = array(
				'type' => 'radio',
				'options' => $dateOptions,
				'label' => '&#160;',
				'section' => 'datetime/dateformat',
			);
		}

		// Info
		$now = wfTimestampNow();
		$lang = $context->getLanguage();
		$nowlocal = Xml::element( 'span', array( 'id' => 'wpLocalTime' ),
			$lang->time( $now, true ) );
		$nowserver = $lang->time( $now, false ) .
			Html::hidden( 'wpServerTime', (int)substr( $now, 8, 2 ) * 60 + (int)substr( $now, 10, 2 ) );

		$defaultPreferences['nowserver'] = array(
			'type' => 'info',
			'raw' => 1,
			'label-message' => 'servertime',
			'default' => $nowserver,
			'section' => 'datetime/timeoffset',
		);

		$defaultPreferences['nowlocal'] = array(
			'type' => 'info',
			'raw' => 1,
			'label-message' => 'localtime',
			'default' => $nowlocal,
			'section' => 'datetime/timeoffset',
		);

		// Grab existing pref.
		$tzOffset = $user->getOption( 'timecorrection' );
		$tz = explode( '|', $tzOffset, 3 );

		$tzOptions = self::getTimezoneOptions( $context );

		$tzSetting = $tzOffset;
		if ( count( $tz ) > 1 && $tz[0] == 'Offset' ) {
			$minDiff = $tz[1];
			$tzSetting = sprintf( '%+03d:%02d', floor( $minDiff / 60 ), abs( $minDiff ) % 60 );
		} elseif ( count( $tz ) > 1 && $tz[0] == 'ZoneInfo' &&
			!in_array( $tzOffset, HTMLFormField::flattenOptions( $tzOptions ) ) )
		{
			# Timezone offset can vary with DST
			$userTZ = timezone_open( $tz[2] );
			if ( $userTZ !== false ) {
				$minDiff = floor( timezone_offset_get( $userTZ, date_create( 'now' ) ) / 60 );
				$tzSetting = "ZoneInfo|$minDiff|{$tz[2]}";
			}
		}

		$defaultPreferences['timecorrection'] = array(
			'class' => 'HTMLSelectOrOtherField',
			'label-message' => 'timezonelegend',
			'options' => $tzOptions,
			'default' => $tzSetting,
			'size' => 20,
			'section' => 'datetime/timeoffset',
		);
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:72,代码来源:Preferences.php


示例5: 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 $context IContextSource
	 * @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();

		// 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 ( substr( $key, 0, 7 ) === 'userjs-' ) {
				$mapping[$key] = 'userjs';
			} else {
				$mapping[$key] = 'unused';
			}
		}

		return $mapping;
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:71,代码来源:User.php


示例6: validate

 protected function validate(HTMLFormField $field, $submitted)
 {
     return $field->validate($submitted, [self::$defaultOptions['fieldname'] => $submitted]);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:4,代码来源:HTMLCheckMatrixTest.php


示例7: validate

 /**
  * HTMLMultiSelectField throws validation errors if we get input data
  * that doesn't match the data set in the form setup. This causes
  * problems if something gets removed from the watchlist while the
  * form is open (bug 32126), but we know that invalid items will
  * be harmless so we can override it here.
  *
  * @param $value String the value the field was submitted with
  * @param $alldata Array the data collected from the form
  * @return Mixed Bool true on success, or String error to display.
  */
 function validate($value, $alldata)
 {
     // Need to call into grandparent to be a good citizen. :)
     return HTMLFormField::validate($value, $alldata);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:16,代码来源:SpecialEditWatchlist.php


示例8: filterDataForSubmit

 function filterDataForSubmit($data)
 {
     $data = HTMLFormField::forceToStringRecursive($data);
     $options = HTMLFormField::flattenOptions($this->getOptions());
     $res = [];
     foreach ($options as $opt) {
         $res["{$opt}"] = in_array($opt, $data, true);
     }
     return $res;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:10,代码来源:HTMLMultiSelectField.php


示例9: 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


示例10: filterDataForSubmit

 function filterDataForSubmit($data)
 {
     $columns = HTMLFormField::flattenOptions($this->mParams['columns']);
     $rows = HTMLFormField::flattenOptions($this->mParams['rows']);
     $res = [];
     foreach ($columns as $column) {
         foreach ($rows as $row) {
             // Make sure option hasn't been forced
             $thisTag = "{$column}-{$row}";
             if ($this->isTagForcedOff($thisTag)) {
                 $res[$thisTag] = false;
             } elseif ($this->isTagForcedOn($thisTag)) {
                 $res[$thisTag] = true;
             } else {
                 $res[$thisTag] = in_array($thisTag, $data);
             }
         }
     }
     return $res;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:20,代码来源:HTMLCheckMatrix.php


示例11: getInputHTML

 function getInputHTML($value)
 {
     $oldClass = $this->mClass;
     $this->mClass = (array) $this->mClass;
     $valInSelect = false;
     $ret = '';
     if ($this->getOptions()) {
         if ($value !== false) {
             $value = strval($value);
             $valInSelect = in_array($value, HTMLFormField::flattenOptions($this->getOptions()), true);
         }
         $selected = $valInSelect ? $value : 'other';
         $select = new XmlSelect($this->mName . '-select', $this->mID . '-select', $selected);
         $select->addOptions($this->getOptions());
         $select->setAttribute('class', 'mw-htmlform-select-or-other');
         if (!empty($this->mParams['disabled'])) {
             $select->setAttribute('disabled', 'disabled');
         }
         if (isset($this->mParams['tabindex'])) {
             $select->setAttribute('tabindex', $this->mParams['tabindex']);
         }
         $ret = $select->getHTML() . "<br />\n";
         $this->mClass[] = 'mw-htmlform-hide-if';
     }
     if ($valInSelect) {
         $value = '';
     } else {
         $key = array_search(strval($value), $this->autocomplete, true);
         if ($key !== false) {
             $value = $key;
         }
     }
     $this->mClass[] = 'mw-htmlform-autocomplete';
     $ret .= parent::getInputHTML($valInSelect ? '' : $value);
     $this->mClass = $oldClass;
     return $ret;
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:37,代码来源:HTMLAutoCompleteSelectField.php


示例12: filterDataForSubmit

 /**
  * @param $data array
  * @return array
  */
 function filterDataForSubmit($data)
 {
     // Support for separating MultiSelect preferences into multiple preferences
     // Due to lack of array support.
     foreach ($this->mFlatFields as $fieldname => $field) {
         $info = $field->mParams;
         if ($field instanceof HTMLMultiSelectField) {
             $options = HTMLFormField::flattenOptions($info['options']);
             $prefix = isset($info['prefix']) ? $info['prefix'] : $fieldname;
             foreach ($options as $opt) {
                 $data["{$prefix}{$opt}"] = in_array($opt, $data[$fieldname]);
             }
             unset($data[$fieldname]);
         }
     }
     return $data;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:21,代码来源:Preferences.php


示例13: getRaw

 /**
  * @param string $value
  * @return string
  * @since 1.20
  */
 public function getRaw($value)
 {
     if (!empty($this->mParams['rawrow'])) {
         return $value;
     }
     return parent::getRaw($value);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:12,代码来源:HTMLInfoField.php


示例14: __construct

 /**
  * @param array $params
  */
 public function __construct($params)
 {
     parent::__construct($params);
     $this->msg = empty($params['licenses']) ? wfMessage('licenses')->inContentLanguage()->plain() : $params['licenses'];
     $this->selected = null;
     $this->makeLicenses();
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:10,代码来源:Licenses.php


示例15: __construct

 public function __construct($info)
 {
     $info['nodata'] = true;
     if (isset($info['flags'])) {
         $this->mFlags = $info['flags'];
     }
     # Generate the label from a message, if possible
     if (isset($info['buttonlabel-message'])) {
         $msgInfo = $info['buttonlabel-message'];
         if (is_array($msgInfo)) {
             $msg = array_shift($msgInfo);
         } else {
             $msg = $msgInfo;
             $msgInfo = array();
         }
         $this->buttonLabel = $this->msg($msg, $msgInfo)->parse();
     } elseif (isset($info['buttonlabel'])) {
         if ($info['buttonlabel'] === '&#160;') {
             // Apparently some things set &nbsp directly and in an odd format
             $this->buttonLabel = '&#160;';
         } else {
             $this->buttonLabel = htmlspecialchars($info['buttonlabel']);
         }
     } elseif (isset($info['buttonlabel-raw'])) {
         $this->buttonLabel = $info['buttonlabel-raw'];
     }
     parent::__construct($info);
 }
开发者ID:Kaph-Noir,项目名称:mediawiki,代码行数:28,代码来源:HTMLButtonField.php


示例16: __construct

 public function __construct($params)
 {
     parent::__construct($params);
     # Per HTML5 spec, hidden fields cannot be 'required'
     # http://www.w3.org/TR/html5/forms.html#hidden-state-%28type=hidden%29
     unset($this->mParams['required']);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:7,代码来源:HTMLHiddenField.php


示例17: __construct

 public function __construct($params)
 {
     parent::__construct($params);
     # Per HTML5 spec, hidden fields cannot be 'required'
     # http://dev.w3.org/html5/spec/states-of-the-type-attribute.html#hidden-state
     unset($this->mParams['required']);
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:7,代码来源:HTMLHiddenField.php


示例18: __construct

 /**
  * Constructor
  *
  * @param $params array
  */
 public function __construct($params)
 {
     parent::__construct($params);
     $this->msg = empty($params['licenses']) ? wfMsg('licenses') : $params['licenses'];
     $this->selected = null;
     $this->makeLicenses();
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:12,代码来源:Licenses.php


示例19: __construct

 public function __construct($params)
 {
     parent::__construct($params);
     // For differentiating the type of form, mainly
     if (isset($params['prefix'])) {
         $this->prefix = $params['prefix'];
     }
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:8,代码来源:HTMLCaptchaField.php


示例20: getDiv

 function getDiv($value)
 {
     $this->tagFilter = ChangeTags::buildTagFilterSelector($value);
     if ($this->tagFilter) {
         return parent::getDiv($value);
     }
     return '';
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:8,代码来源:HTMLTagFilter.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP HTMLPage类代码示例发布时间:2022-05-23
下一篇:
PHP HTMLForm类代码示例发布时间: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