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


PHP Gdn_Validation::ResultsAsText方法代码示例

本文整理汇总了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

 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');
         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';
         }
         $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());
     }
     @ob_clean();
     switch ($this->DeliveryMethod()) {
         case DELIVERY_METHOD_XML:
             safeHeader('Content-Type: text/xml', TRUE);
             echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
             $this->_RenderXml($Data);
             return TRUE;
             break;
         case DELIVERY_METHOD_PLAIN:
             return TRUE;
             break;
         case DELIVERY_METHOD_JSON:
         default:
             if (($Callback = $this->Request->Get('callback', FALSE)) && $this->AllowJSONP()) {
                 safeHeader('Content-Type: application/javascript', TRUE);
                 // This is a jsonp request.
                 echo $Callback . '(' . json_encode($Data) . ');';
                 return TRUE;
             } else {
                 safeHeader('Content-Type: application/json', TRUE);
                 // This is a regular json request.
                 echo json_encode($Data);
                 return TRUE;
             }
             break;
     }
     return FALSE;
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:97,代码来源:class.controller.php


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