本文整理汇总了PHP中Gdn_Format::DefaultFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Format::DefaultFormat方法的具体用法?PHP Gdn_Format::DefaultFormat怎么用?PHP Gdn_Format::DefaultFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Format
的用法示例。
在下文中一共展示了Gdn_Format::DefaultFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: controller_index
public function controller_index($Sender)
{
$Sender->Permission(array('Garden.Profiles.Edit'));
$Args = $Sender->RequestArgs;
if (sizeof($Args) < 2) {
$Args = array_merge($Args, array(0, 0));
} elseif (sizeof($Args) > 2) {
$Args = array_slice($Args, 0, 2);
}
list($UserReference, $Username) = $Args;
$canEditSignatures = CheckPermission('Plugins.Signatures.Edit');
// Normalize no image config setting
if (C('Plugins.Signatures.MaxNumberImages') === 0 || C('Plugins.Signatures.MaxNumberImages') === '0') {
SaveToConfig('Plugins.Signatures.MaxNumberImages', 'None');
}
$Sender->GetUserInfo($UserReference, $Username);
$UserPrefs = Gdn_Format::Unserialize($Sender->User->Preferences);
if (!is_array($UserPrefs)) {
$UserPrefs = array();
}
$Validation = new Gdn_Validation();
$ConfigurationModel = new Gdn_ConfigurationModel($Validation);
$ConfigArray = array('Plugin.Signatures.Sig' => NULL, 'Plugin.Signatures.HideAll' => NULL, 'Plugin.Signatures.HideImages' => NULL, 'Plugin.Signatures.HideMobile' => NULL, 'Plugin.Signatures.Format' => NULL);
$SigUserID = $ViewingUserID = Gdn::Session()->UserID;
if ($Sender->User->UserID != $ViewingUserID) {
$Sender->Permission(array('Garden.Users.Edit', 'Moderation.Signatures.Edit'), FALSE);
$SigUserID = $Sender->User->UserID;
$canEditSignatures = true;
}
$Sender->SetData('CanEdit', $canEditSignatures);
$Sender->SetData('Plugin-Signatures-ForceEditing', $SigUserID == Gdn::Session()->UserID ? FALSE : $Sender->User->Name);
$UserMeta = $this->GetUserMeta($SigUserID, '%');
if ($Sender->Form->AuthenticatedPostBack() === FALSE && is_array($UserMeta)) {
$ConfigArray = array_merge($ConfigArray, $UserMeta);
}
$ConfigurationModel->SetField($ConfigArray);
// Set the model on the form.
$Sender->Form->SetModel($ConfigurationModel);
$Data = $ConfigurationModel->Data;
$Sender->SetData('Signature', $Data);
$this->SetSignatureRules($Sender);
// Form submission handling.
if ($Sender->Form->AuthenticatedPostBack()) {
$Values = $Sender->Form->FormValues();
if ($canEditSignatures) {
$Values['Plugin.Signatures.Sig'] = GetValue('Body', $Values, NULL);
$Values['Plugin.Signatures.Format'] = GetValue('Format', $Values, NULL);
}
//$this->StripLineBreaks($Values['Plugin.Signatures.Sig']);
$FrmValues = array_intersect_key($Values, $ConfigArray);
if (sizeof($FrmValues)) {
if (!GetValue($this->MakeMetaKey('Sig'), $FrmValues)) {
// Delete the signature.
$FrmValues[$this->MakeMetaKey('Sig')] = NULL;
$FrmValues[$this->MakeMetaKey('Format')] = NULL;
}
$this->CrossCheckSignature($Values, $Sender);
if ($Sender->Form->ErrorCount() == 0) {
foreach ($FrmValues as $UserMetaKey => $UserMetaValue) {
$Key = $this->TrimMetaKey($UserMetaKey);
switch ($Key) {
case 'Format':
if (strcasecmp($UserMetaValue, 'Raw') == 0) {
$UserMetaValue = NULL;
}
// don't allow raw signatures.
break;
}
$this->SetUserMeta($SigUserID, $Key, $UserMetaValue);
}
$Sender->InformMessage(T("Your changes have been saved."));
}
}
} else {
// Load form data.
$Data['Body'] = GetValue('Plugin.Signatures.Sig', $Data);
$Data['Format'] = GetValue('Plugin.Signatures.Format', $Data) ?: Gdn_Format::DefaultFormat();
// Apply the config settings to the form.
$Sender->Form->SetData($Data);
}
$Sender->Render('signature', '', 'plugins/Signatures');
}
示例2: BodyBox
/**
* A special text box for formattable text.
*
* Formatting plugins like ButtonBar will auto-attach to this element.
*
* @param string $Column
* @param array $Attributes
* @since 2.1
* @return string HTML element.
*/
public function BodyBox($Column = 'Body', $Attributes = array())
{
TouchValue('MultiLine', $Attributes, TRUE);
TouchValue('format', $Attributes, $this->GetValue('Format', Gdn_Format::DefaultFormat()));
TouchValue('Wrap', $Attributes, TRUE);
TouchValue('class', $Attributes, '');
$Attributes['class'] .= ' TextBox BodyBox';
$Attributes['format'] = htmlspecialchars($Attributes['format']);
$this->SetValue('Format', $Attributes['format']);
$this->EventArguments['Table'] = GetValue('Table', $Attributes);
$this->EventArguments['Column'] = $Column;
$this->EventArguments['Attributes'] = $Attributes;
$Result = '<div class="bodybox-wrap">';
$this->EventArguments['BodyBox'] =& $Result;
$this->FireEvent('BeforeBodyBox');
$Result .= $this->TextBox($Column, $Attributes) . $this->Hidden('Format') . '</div>';
return $Result;
}