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


PHP InputHelper::cleanArray方法代码示例

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


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

示例1: sendHookTestAction

 protected function sendHookTestAction(Request $request)
 {
     $url = InputHelper::url($request->request->get('url'));
     // validate the URL
     if ($url == '' || !$url) {
         // default to an error message
         $dataArray = array('success' => 1, 'html' => '<div class="has-error"><span class="help-block">' . $this->factory->getTranslator()->trans('mautic.webhook.label.no.url') . '</span></div>');
         return $this->sendJsonResponse($dataArray);
     }
     // get the selected types
     $selectedTypes = InputHelper::cleanArray($request->request->get('types'));
     $payloadPaths = $this->getPayloadPaths($selectedTypes);
     $payloads = $this->loadPayloads($payloadPaths);
     $now = new \DateTime();
     $payloads['timestamp'] = $now->format('c');
     // Set up custom headers
     $headers = ['Content-Type' => 'application/json'];
     // instantiate new http class
     $http = new Http();
     // set the response
     $response = $http->post($url, json_encode($payloads), $headers);
     // default to an error message
     $dataArray = array('success' => 1, 'html' => '<div class="has-error"><span class="help-block">' . $this->factory->getTranslator()->trans('mautic.webhook.label.warning') . '</span></div>');
     // if we get a 200 response convert to success message
     if ($response->code == 200) {
         $dataArray['html'] = '<div class="has-success"><span class="help-block">' . $this->factory->getTranslator()->trans('mautic.webhook.label.success') . '</span></div>';
     }
     return $this->sendJsonResponse($dataArray);
 }
开发者ID:Yame-,项目名称:mautic,代码行数:29,代码来源:AjaxController.php


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