本文整理汇总了PHP中Gdn_Validation::resultsAsText方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Validation::resultsAsText方法的具体用法?PHP Gdn_Validation::resultsAsText怎么用?PHP Gdn_Validation::resultsAsText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Validation
的用法示例。
在下文中一共展示了Gdn_Validation::resultsAsText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderData
/**
* Render the data array.
*
* @param null $Data
* @return bool
* @throws Exception
*/
public function renderData($Data = null)
{
if ($Data === null) {
$Data = array();
// Remove standard and "protected" data from the top level.
foreach ($this->Data as $Key => $Value) {
if ($Key && in_array($Key, array('Title', 'Breadcrumbs'))) {
continue;
}
if (isset($Key[0]) && $Key[0] === '_') {
continue;
// protected
}
$Data[$Key] = $Value;
}
unset($this->Data);
}
// Massage the data for better rendering.
foreach ($Data as $Key => $Value) {
if (is_a($Value, 'Gdn_DataSet')) {
$Data[$Key] = $Value->resultArray();
}
}
$CleanOutut = c('Api.Clean', true);
if ($CleanOutut) {
// Remove values that should not be transmitted via api
$Remove = array('Password', 'HashMethod', 'TransientKey', 'Permissions', 'Attributes', 'AccessToken');
// Remove PersonalInfo values for unprivileged requests.
if (!Gdn::session()->checkPermission('Garden.Moderation.Manage')) {
$Remove[] = 'InsertIPAddress';
$Remove[] = 'UpdateIPAddress';
$Remove[] = 'LastIPAddress';
$Remove[] = 'AllIPAddresses';
$Remove[] = 'Fingerprint';
if (C('Api.Clean.Email', true)) {
$Remove[] = 'Email';
}
$Remove[] = 'DateOfBirth';
$Remove[] = 'Preferences';
$Remove[] = 'Banned';
$Remove[] = 'Admin';
$Remove[] = 'Confirmed';
$Remove[] = 'Verified';
$Remove[] = 'DiscoveryText';
$Remove[] = 'InviteUserID';
$Remove[] = 'DateSetInvitations';
$Remove[] = 'CountInvitations';
$Remove[] = 'CountNotifications';
$Remove[] = 'CountBookmarks';
$Remove[] = 'CountDrafts';
$Remove[] = 'HourOffset';
$Remove[] = 'Gender';
$Remove[] = 'Punished';
$Remove[] = 'Troll';
}
$Data = removeKeysFromNestedArray($Data, $Remove);
}
if (debug() && ($Trace = trace())) {
// Clear passwords from the trace.
array_walk_recursive($Trace, function (&$Value, $Key) {
if (in_array(strtolower($Key), array('password'))) {
$Value = '***';
}
});
$Data['Trace'] = $Trace;
}
// Make sure the database connection is closed before exiting.
$this->EventArguments['Data'] =& $Data;
$this->finalize();
// Add error information from the form.
if (isset($this->Form) && sizeof($this->Form->validationResults())) {
$this->statusCode(400);
$Data['Code'] = 400;
$Data['Exception'] = Gdn_Validation::resultsAsText($this->Form->validationResults());
}
$this->sendHeaders();
// Check for a special view.
$ViewLocation = $this->fetchViewLocation(($this->View ? $this->View : $this->RequestMethod) . '_' . strtolower($this->deliveryMethod()), false, false, false);
if (file_exists($ViewLocation)) {
include $ViewLocation;
return;
}
// Add schemes to to urls.
if (!c('Garden.AllowSSL') || c('Garden.ForceSSL')) {
$r = array_walk_recursive($Data, array('Gdn_Controller', '_FixUrlScheme'), Gdn::request()->scheme());
}
if (ob_get_level()) {
ob_clean();
}
switch ($this->deliveryMethod()) {
case DELIVERY_METHOD_XML:
safeHeader('Content-Type: text/xml', true);
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
//.........这里部分代码省略.........