本文整理汇总了PHP中Gdn_Format::Form方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Format::Form方法的具体用法?PHP Gdn_Format::Form怎么用?PHP Gdn_Format::Form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Format
的用法示例。
在下文中一共展示了Gdn_Format::Form方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DefinitionList
/**
* Undocumented method.
*
* @todo Method DefinitionList() needs a description.
*/
public function DefinitionList()
{
$Session = Gdn::Session();
if (!array_key_exists('TransportError', $this->_Definitions)) {
$this->_Definitions['TransportError'] = T('Transport error: %s', 'A fatal error occurred while processing the request.<br />The server returned the following response: %s');
}
if (!array_key_exists('TransientKey', $this->_Definitions)) {
$this->_Definitions['TransientKey'] = $Session->TransientKey();
}
if (!array_key_exists('WebRoot', $this->_Definitions)) {
$this->_Definitions['WebRoot'] = CombinePaths(array(Gdn::Request()->Domain(), Gdn::Request()->WebRoot()), '/');
}
if (!array_key_exists('UrlFormat', $this->_Definitions)) {
$this->_Definitions['UrlFormat'] = Url('{Path}');
}
if (!array_key_exists('Path', $this->_Definitions)) {
$this->_Definitions['Path'] = Gdn::Request()->Path();
}
if (!array_key_exists('SignedIn', $this->_Definitions)) {
if (Gdn::Session()->CheckPermission('Garden.Moderation.Manage')) {
$SignedIn = 2;
} else {
$SignedIn = (int) Gdn::Session()->IsValid();
}
$this->_Definitions['SignedIn'] = $SignedIn;
}
if (!array_key_exists('ConfirmHeading', $this->_Definitions)) {
$this->_Definitions['ConfirmHeading'] = T('Confirm');
}
if (!array_key_exists('ConfirmText', $this->_Definitions)) {
$this->_Definitions['ConfirmText'] = T('Are you sure you want to do that?');
}
if (!array_key_exists('Okay', $this->_Definitions)) {
$this->_Definitions['Okay'] = T('Okay');
}
if (!array_key_exists('Cancel', $this->_Definitions)) {
$this->_Definitions['Cancel'] = T('Cancel');
}
if (!array_key_exists('Search', $this->_Definitions)) {
$this->_Definitions['Search'] = T('Search');
}
$Return = '<!-- Various definitions for Javascript //-->
<div id="Definitions" style="display: none;">
';
foreach ($this->_Definitions as $Term => $Definition) {
$Return .= '<input type="hidden" id="' . $Term . '" value="' . Gdn_Format::Form($Definition) . '" />' . "\n";
}
return $Return . '</div>';
}
示例2: _ValueAttribute
/**
* Creates a VALUE attribute for a form input and returns it in this format: [ value="VALUE"]
*
* @param string $FieldName The name of the field that contains the value in $this->_DataArray.
* @param array $Attributes An associative array of attributes for the input. ie. maxlength, onclick,
* class, etc. If $Attributes contains a 'value' key, it will override the
* one automatically generated by $FieldName.
* @return string
*/
protected function _ValueAttribute($FieldName, $Attributes)
{
// Value from $Attributes overrides the datasource and the postback.
return ' value="' . Gdn_Format::Form(ArrayValueI('value', $Attributes, $this->GetValue($FieldName))) . '"';
}
示例3: DefinitionList
/**
* Undocumented method.
*
* @todo Method DefinitionList() needs a description.
*/
public function DefinitionList()
{
$Session = Gdn::Session();
if (!array_key_exists('TransportError', $this->_Definitions)) {
$this->_Definitions['TransportError'] = T('Transport error: %s', 'A fatal error occurred while processing the request.<br />The server returned the following response: %s');
}
if (!array_key_exists('TransientKey', $this->_Definitions)) {
$this->_Definitions['TransientKey'] = $Session->TransientKey();
}
if (!array_key_exists('WebRoot', $this->_Definitions)) {
$this->_Definitions['WebRoot'] = CombinePaths(array(Gdn::Request()->Domain(), Gdn::Request()->WebRoot()), '/');
}
if (!array_key_exists('UrlFormat', $this->_Definitions)) {
$this->_Definitions['UrlFormat'] = Url('{Path}');
}
if (!array_key_exists('Path', $this->_Definitions)) {
$this->_Definitions['Path'] = Gdn::Request()->Path();
}
if (!array_key_exists('Args', $this->_Definitions)) {
$this->_Definitions['Args'] = http_build_query(Gdn::Request()->Get());
}
if (!array_key_exists('ResolvedPath', $this->_Definitions)) {
$this->_Definitions['ResolvedPath'] = $this->ResolvedPath;
}
if (!array_key_exists('ResolvedArgs', $this->_Definitions)) {
if (sizeof($this->ReflectArgs) && (isset($this->ReflectArgs[0]) && $this->ReflectArgs[0] instanceof Gdn_Pluggable || isset($this->ReflectArgs['Sender']) && $this->ReflectArgs['Sender'] instanceof Gdn_Pluggable || isset($this->ReflectArgs['sender']) && $this->ReflectArgs['sender'] instanceof Gdn_Pluggable)) {
$ReflectArgs = json_encode(array_slice($this->ReflectArgs, 1));
} else {
$ReflectArgs = json_encode($this->ReflectArgs);
}
$this->_Definitions['ResolvedArgs'] = $ReflectArgs;
}
if (!array_key_exists('SignedIn', $this->_Definitions)) {
if (Gdn::Session()->CheckPermission('Garden.Moderation.Manage')) {
$SignedIn = 2;
} else {
$SignedIn = (int) Gdn::Session()->IsValid();
}
$this->_Definitions['SignedIn'] = $SignedIn;
}
if (Gdn::Session()->IsValid()) {
// Tell the client what our hour offset is so it can compare it to the user's real offset.
TouchValue('SetHourOffset', $this->_Definitions, Gdn::Session()->User->HourOffset);
}
if (!array_key_exists('ConfirmHeading', $this->_Definitions)) {
$this->_Definitions['ConfirmHeading'] = T('Confirm');
}
if (!array_key_exists('ConfirmText', $this->_Definitions)) {
$this->_Definitions['ConfirmText'] = T('Are you sure you want to do that?');
}
if (!array_key_exists('Okay', $this->_Definitions)) {
$this->_Definitions['Okay'] = T('Okay');
}
if (!array_key_exists('Cancel', $this->_Definitions)) {
$this->_Definitions['Cancel'] = T('Cancel');
}
if (!array_key_exists('Search', $this->_Definitions)) {
$this->_Definitions['Search'] = T('Search');
}
$Return = '<!-- Various definitions for Javascript //-->
<div id="Definitions" style="display: none;">
';
foreach ($this->_Definitions as $Term => $Definition) {
$Return .= '<input type="hidden" id="' . $Term . '" value="' . Gdn_Format::Form($Definition) . '" />' . "\n";
}
return $Return . '</div>';
}