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


PHP AjaxResponse::printText方法代码示例

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


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

示例1: performAction

 function performAction()
 {
     global $wgAjaxExportList, $wgOut;
     if (empty($this->mode)) {
         return;
     }
     wfProfileIn('AjaxDispatcher::performAction');
     if (!in_array($this->func_name, $wgAjaxExportList)) {
         header('Status: 400 Bad Request', true, 400);
         print "unknown function " . htmlspecialchars((string) $this->func_name);
     } else {
         try {
             $result = call_user_func_array($this->func_name, $this->args);
             if ($result === false || $result === NULL) {
                 header('Status: 500 Internal Error', true, 500);
                 echo "{$this->func_name} returned no data";
             } else {
                 if (is_string($result)) {
                     $result = new AjaxResponse($result);
                 }
                 $result->sendHeaders();
                 $result->printText();
             }
         } catch (Exception $e) {
             if (!headers_sent()) {
                 header('Status: 500 Internal Error', true, 500);
                 print $e->getMessage();
             } else {
                 print $e->getMessage();
             }
         }
     }
     wfProfileOut('AjaxDispatcher::performAction');
     $wgOut = null;
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:35,代码来源:AjaxDispatcher.php

示例2: performAction

 function performAction()
 {
     global $wgAjaxExportList, $wgOut;
     if (empty($this->mode)) {
         return;
     }
     wfProfileIn(__METHOD__);
     if (!in_array($this->func_name, $wgAjaxExportList)) {
         wfHttpError(400, 'Bad Request', "unknown function " . (string) $this->func_name);
     } else {
         try {
             $result = call_user_func_array($this->func_name, $this->args);
             if ($result === false || $result === NULL) {
                 wfHttpError(500, 'Internal Error', "{$this->func_name} returned no data");
             } else {
                 if (is_string($result)) {
                     $result = new AjaxResponse($result);
                 }
                 $result->sendHeaders();
                 $result->printText();
             }
         } catch (Exception $e) {
             if (!headers_sent()) {
                 wfHttpError(500, 'Internal Error', $e->getMessage());
             } else {
                 print $e->getMessage();
             }
         }
     }
     wfProfileOut(__METHOD__);
     $wgOut = null;
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:32,代码来源:AjaxDispatcher.php

示例3: performAction

 /** Pass the request to our internal function.
  * BEWARE! Data are passed as they have been supplied by the user,
  * they should be carefully handled in the function processing the
  * request.
  */
 function performAction()
 {
     global $wgAjaxExportList, $wgOut, $wgUser;
     if (empty($this->mode)) {
         return;
     }
     /*
      * Wikia Change - begin
      */
     Transaction::setEntryPoint(Transaction::ENTRY_POINT_AJAX);
     Transaction::setAttribute(Transaction::PARAM_FUNCTION, $this->func_name);
     if (function_exists('newrelic_disable_autorum')) {
         newrelic_disable_autorum();
     }
     /*
      * Wikia Change - end
      */
     wfProfileIn(__METHOD__);
     if (!in_array($this->func_name, $wgAjaxExportList)) {
         wfDebug(__METHOD__ . ' Bad Request for unknown function ' . $this->func_name . "\n");
         wfHttpError(400, 'Bad Request', "unknown function " . (string) $this->func_name);
     } elseif (!in_array('read', User::getGroupPermissions(array('*')), true) && !$wgUser->isAllowed('read')) {
         wfHttpError(403, 'Forbidden', 'You must log in to view pages.');
     } else {
         wfDebug(__METHOD__ . ' dispatching ' . $this->func_name . "\n");
         if (strpos($this->func_name, '::') !== false) {
             $func = explode('::', $this->func_name, 2);
         } else {
             $func = $this->func_name;
         }
         try {
             $result = call_user_func_array($func, $this->args);
             if ($result === false || $result === null) {
                 wfDebug(__METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export($this->args, true) . "): " . "no data returned\n");
                 /* Wikia changes start */
                 //let's avoid falling back to Iowa (500, 503) in this case,
                 //probably someone is asking for a non-existing dynamic method name
                 wfHttpError(501, 'Not Implemented', "{$this->func_name} returned no data");
             } else {
                 if (is_string($result)) {
                     $result = new AjaxResponse($result);
                 }
                 $result->sendHeaders();
                 $result->printText();
                 wfDebug(__METHOD__ . ' dispatch complete for ' . $this->func_name . "\n");
             }
         } catch (Exception $e) {
             wfDebug(__METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export($this->args, true) . "): " . get_class($e) . ": " . $e->getMessage() . "\n");
             if (!headers_sent()) {
                 wfHttpError(500, 'Internal Error', $e->getMessage());
             } else {
                 print $e->getMessage();
             }
         }
     }
     $wgOut = null;
     wfProfileOut(__METHOD__);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:63,代码来源:AjaxDispatcher.php

示例4: performAction

 /** Pass the request to our internal function.
  * BEWARE! Data are passed as they have been supplied by the user,
  * they should be carefully handled in the function processing the
  * request.
  */
 function performAction()
 {
     global $wgAjaxExportList, $wgOut;
     if (empty($this->mode)) {
         return;
     }
     wfProfileIn(__METHOD__);
     if (!in_array($this->func_name, $wgAjaxExportList)) {
         wfDebug(__METHOD__ . ' Bad Request for unknown function ' . $this->func_name . "\n");
         wfHttpError(400, 'Bad Request', "unknown function " . (string) $this->func_name);
     } else {
         wfDebug(__METHOD__ . ' dispatching ' . $this->func_name . "\n");
         if (strpos($this->func_name, '::') !== false) {
             $func = explode('::', $this->func_name, 2);
         } else {
             $func = $this->func_name;
         }
         try {
             $result = call_user_func_array($func, $this->args);
             if ($result === false || $result === NULL) {
                 wfDebug(__METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export($this->args, true) . "): " . "no data returned\n");
                 wfHttpError(500, 'Internal Error', "{$this->func_name} returned no data");
             } else {
                 if (is_string($result)) {
                     $result = new AjaxResponse($result);
                 }
                 $result->sendHeaders();
                 $result->printText();
                 wfDebug(__METHOD__ . ' dispatch complete for ' . $this->func_name . "\n");
             }
         } catch (Exception $e) {
             wfDebug(__METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export($this->args, true) . "): " . get_class($e) . ": " . $e->getMessage() . "\n");
             if (!headers_sent()) {
                 wfHttpError(500, 'Internal Error', $e->getMessage());
             } else {
                 print $e->getMessage();
             }
         }
     }
     wfProfileOut(__METHOD__);
     $wgOut = null;
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:47,代码来源:AjaxDispatcher.php

示例5: performAction

 /** Pass the request to our internal function.
  * BEWARE! Data are passed as they have been supplied by the user,
  * they should be carefully handled in the function processing the
  * request.
  */
 function performAction()
 {
     global $wgAjaxExportList;
     if (empty($this->mode)) {
         return;
     }
     if (!in_array($this->func_name, $wgAjaxExportList)) {
         header("HTTP/1.0 400 Bad Request");
         header("Status: 400 Bad Request");
         header('Content-type: text/html; charset=utf-8');
         print "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">" . "<html><head><title>" . htmlspecialchars("Bad Request") . "</title></head><body><h1>" . htmlspecialchars("Bad Request") . "</h1><p>" . nl2br(htmlspecialchars("unknown function " . (string) $this->func_name)) . "</p></body></html>\n";
     } else {
         if (strpos($this->func_name, '::') !== false) {
             $func = explode('::', $this->func_name, 2);
         } else {
             $func = $this->func_name;
         }
         try {
             $result = call_user_func_array($func, $this->args);
             if ($result === false || $result === NULL) {
             } else {
                 if (is_string($result)) {
                     $result = new AjaxResponse($result);
                 }
                 if ($this->contentType) {
                     $result->setContentType($this->contentType);
                 }
                 $result->sendHeaders($this->expire, $this->contentType);
                 $result->printText();
             }
         } catch (Exception $e) {
             wfDebug(__METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export($this->args, true) . "): " . get_class($e) . ": " . $e->getMessage() . "\n");
             if (!headers_sent()) {
                 wfHttpError(500, 'Internal Error', $e->getMessage());
             } else {
                 print $e->getMessage();
             }
         }
     }
 }
开发者ID:nomaan-alkurn,项目名称:thooth,代码行数:45,代码来源:AjaxDispatcher.php

示例6: performAction

 /**
  * Pass the request to our internal function.
  * BEWARE! Data are passed as they have been supplied by the user,
  * they should be carefully handled in the function processing the
  * request.
  *
  * @param User $user
  */
 function performAction(User $user)
 {
     if (empty($this->mode)) {
         return;
     }
     if (!in_array($this->func_name, $this->config->get('AjaxExportList'))) {
         wfDebug(__METHOD__ . ' Bad Request for unknown function ' . $this->func_name . "\n");
         wfHttpError(400, 'Bad Request', "unknown function " . $this->func_name);
     } elseif (!User::isEveryoneAllowed('read') && !$user->isAllowed('read')) {
         wfHttpError(403, 'Forbidden', 'You are not allowed to view pages.');
     } else {
         wfDebug(__METHOD__ . ' dispatching ' . $this->func_name . "\n");
         try {
             $result = call_user_func_array($this->func_name, $this->args);
             if ($result === false || $result === null) {
                 wfDebug(__METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export($this->args, true) . "): " . "no data returned\n");
                 wfHttpError(500, 'Internal Error', "{$this->func_name} returned no data");
             } else {
                 if (is_string($result)) {
                     $result = new AjaxResponse($result);
                 }
                 // Make sure DB commit succeeds before sending a response
                 wfGetLBFactory()->commitMasterChanges(__METHOD__);
                 $result->sendHeaders();
                 $result->printText();
                 wfDebug(__METHOD__ . ' dispatch complete for ' . $this->func_name . "\n");
             }
         } catch (Exception $e) {
             wfDebug(__METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export($this->args, true) . "): " . get_class($e) . ": " . $e->getMessage() . "\n");
             if (!headers_sent()) {
                 wfHttpError(500, 'Internal Error', $e->getMessage());
             } else {
                 print $e->getMessage();
             }
         }
     }
 }
开发者ID:guochangjiang,项目名称:mediawiki,代码行数:45,代码来源:AjaxDispatcher.php

示例7: performAction

 /**
  * Pass the request to our internal function.
  * BEWARE! Data are passed as they have been supplied by the user,
  * they should be carefully handled in the function processing the
  * request.
  */
 function performAction()
 {
     global $wgAjaxExportList, $wgUser;
     if (empty($this->mode)) {
         return;
     }
     wfProfileIn(__METHOD__);
     if (!in_array($this->func_name, $wgAjaxExportList)) {
         wfDebug(__METHOD__ . ' Bad Request for unknown function ' . $this->func_name . "\n");
         wfHttpError(400, 'Bad Request', "unknown function " . (string) $this->func_name);
     } elseif (!in_array('read', User::getGroupPermissions(array('*')), true) && !$wgUser->isAllowed('read')) {
         wfHttpError(403, 'Forbidden', 'You must log in to view pages.');
     } else {
         wfDebug(__METHOD__ . ' dispatching ' . $this->func_name . "\n");
         try {
             $result = call_user_func_array($this->func_name, $this->args);
             if ($result === false || $result === null) {
                 wfDebug(__METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export($this->args, true) . "): " . "no data returned\n");
                 wfHttpError(500, 'Internal Error', "{$this->func_name} returned no data");
             } else {
                 if (is_string($result)) {
                     $result = new AjaxResponse($result);
                 }
                 $result->sendHeaders();
                 $result->printText();
                 wfDebug(__METHOD__ . ' dispatch complete for ' . $this->func_name . "\n");
             }
         } catch (Exception $e) {
             wfDebug(__METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export($this->args, true) . "): " . get_class($e) . ": " . $e->getMessage() . "\n");
             if (!headers_sent()) {
                 wfHttpError(500, 'Internal Error', $e->getMessage());
             } else {
                 print $e->getMessage();
             }
         }
     }
     wfProfileOut(__METHOD__);
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:44,代码来源:AjaxDispatcher.php


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