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