• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Helper\InputHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: saveEntity

 /**
  * {@inheritdoc}
  *
  * @param       $entity
  * @param       $unlock
  * @return mixed
  */
 public function saveEntity($entity, $unlock = true)
 {
     $alias = $entity->getAlias();
     if (empty($alias)) {
         $alias = strtolower(InputHelper::alphanum($entity->getTitle(), false, '-'));
     } else {
         $alias = strtolower(InputHelper::alphanum($alias, false, '-'));
     }
     //make sure alias is not already taken
     $repo = $this->getRepository();
     $testAlias = $alias;
     $bundle = $entity->getBundle();
     $count = $repo->checkUniqueCategoryAlias($bundle, $testAlias, $entity);
     $aliasTag = $count;
     while ($count) {
         $testAlias = $alias . $aliasTag;
         $count = $repo->checkUniqueCategoryAlias($bundle, $testAlias, $entity);
         $aliasTag++;
     }
     if ($testAlias != $alias) {
         $alias = $testAlias;
     }
     $entity->setAlias($alias);
     parent::saveEntity($entity, $unlock);
 }
开发者ID:woakes070048,项目名称:mautic,代码行数:32,代码来源:CategoryModel.php


示例2: preSubmitData

 /**
  * @param FormEvent $event
  */
 public function preSubmitData(FormEvent $event)
 {
     $data = $event->getData();
     //clean the data
     $data = InputHelper::_($data, $this->masks);
     $event->setData($data);
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:10,代码来源:CleanFormSubscriber.php


示例3: getAbTestForm

 /**
  * @param Request $request
  * @param         $modelName
  * @param         $abSettingsFormName
  * @param         $parentFormName
  * @param         $abFormTemplate
  * @param array   $formThemes
  *
  * @return mixed
  */
 private function getAbTestForm(Request $request, $modelName, $abSettingsFormName, $parentFormName, $abFormTemplate, $formThemes = [])
 {
     $dataArray = ['success' => 0, 'html' => ''];
     $type = InputHelper::clean($request->request->get('abKey'));
     $id = InputHelper::int($request->request->get('id'));
     if (!empty($type)) {
         //get the HTML for the form
         $model = $this->getModel($modelName);
         $entity = $model->getEntity($id);
         $abTestComponents = $model->getBuilderComponents($entity, 'abTestWinnerCriteria');
         $abTestSettings = $abTestComponents['criteria'];
         if (isset($abTestSettings[$type])) {
             $html = '';
             $formType = !empty($abTestSettings[$type]['formType']) ? $abTestSettings[$type]['formType'] : '';
             if (!empty($formType)) {
                 $formOptions = !empty($abTestSettings[$type]['formTypeOptions']) ? $abTestSettings[$type]['formTypeOptions'] : [];
                 $form = $this->get('form.factory')->create($abSettingsFormName, [], ['formType' => $formType, 'formTypeOptions' => $formOptions]);
                 $html = $this->renderView($abFormTemplate, ['form' => $this->setFormTheme($form, $formThemes)]);
             }
             $html = str_replace(["{$abSettingsFormName}[", "{$abSettingsFormName}_", $abSettingsFormName], ["{$parentFormName}[variantSettings][", "{$parentFormName}_variantSettings_", $parentFormName], $html);
             $dataArray['html'] = $html;
             $dataArray['success'] = 1;
         }
     }
     return $this->sendJsonResponse($dataArray);
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:36,代码来源:VariantAjaxControllerTrait.php


示例4: getActionFormAction

 /**
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function getActionFormAction(Request $request)
 {
     $dataArray = ['success' => 0, 'html' => ''];
     $type = InputHelper::clean($request->request->get('actionType'));
     if (!empty($type)) {
         //get the HTML for the form
         /** @var \Mautic\PointBundle\Model\PointModel $model */
         $model = $this->getModel('point');
         $actions = $model->getPointActions();
         if (isset($actions['actions'][$type])) {
             $themes = ['MauticPointBundle:FormTheme\\Action'];
             if (!empty($actions['actions'][$type]['formTheme'])) {
                 $themes[] = $actions['actions'][$type]['formTheme'];
             }
             $formType = !empty($actions['actions'][$type]['formType']) ? $actions['actions'][$type]['formType'] : 'genericpoint_settings';
             $formTypeOptions = !empty($actions['actions'][$type]['formTypeOptions']) ? $actions['actions'][$type]['formTypeOptions'] : [];
             $form = $this->get('form.factory')->create('pointaction', [], ['formType' => $formType, 'formTypeOptions' => $formTypeOptions]);
             $html = $this->renderView('MauticPointBundle:Point:actionform.html.php', ['form' => $this->setFormTheme($form, 'MauticPointBundle:Point:actionform.html.php', $themes)]);
             //replace pointaction with point
             $html = str_replace('pointaction', 'point', $html);
             $dataArray['html'] = $html;
             $dataArray['success'] = 1;
         }
     }
     return $this->sendJsonResponse($dataArray);
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:31,代码来源:AjaxController.php


示例5: setBuilderContentAction

 /**
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function setBuilderContentAction(Request $request)
 {
     $dataArray = array('success' => 0);
     $entityId = InputHelper::clean($request->request->get('entity'));
     $session = $this->factory->getSession();
     if (!empty($entityId)) {
         $sessionVar = 'mautic.pagebuilder.' . $entityId . '.content';
         // Check for an array of slots
         $slots = InputHelper::_($request->request->get('slots', array(), true), 'html');
         $content = $session->get($sessionVar, array());
         if (!is_array($content)) {
             $content = array();
         }
         if (!empty($slots)) {
             // Builder was closed so save each content
             foreach ($slots as $slot => $newContent) {
                 $content[$slot] = $newContent;
             }
             $session->set($sessionVar, $content);
             $dataArray['success'] = 1;
         } else {
             // Check for a single slot
             $newContent = InputHelper::html($request->request->get('content'));
             $slot = InputHelper::clean($request->request->get('slot'));
             if (!empty($slot)) {
                 $content[$slot] = $newContent;
                 $session->set($sessionVar, $content);
                 $dataArray['success'] = 1;
             }
         }
     }
     return $this->sendJsonResponse($dataArray);
 }
开发者ID:Yame-,项目名称:mautic,代码行数:38,代码来源:AjaxController.php


示例6: saveEntity

 /**
  * {@inheritdoc}
  *
  * @param      $entity
  * @param bool $unlock
  * @return mixed|void
  */
 public function saveEntity($entity, $unlock = true)
 {
     $isNew = $entity->getId() ? false : true;
     //set some defaults
     $this->setTimestamps($entity, $isNew, $unlock);
     $alias = $entity->getAlias();
     if (empty($alias)) {
         $alias = strtolower(InputHelper::alphanum($entity->getName(), false, '-'));
     } else {
         $alias = strtolower(InputHelper::alphanum($alias, false, '-'));
     }
     //make sure alias is not already taken
     $repo = $this->getRepository();
     $testAlias = $alias;
     $user = $this->factory->getUser();
     $existing = $repo->getLists($user, $testAlias, $entity->getId());
     $count = count($existing);
     $aliasTag = $count;
     while ($count) {
         $testAlias = $alias . $aliasTag;
         $existing = $repo->getLists($user, $testAlias, $entity->getId());
         $count = count($existing);
         $aliasTag++;
     }
     if ($testAlias != $alias) {
         $alias = $testAlias;
     }
     $entity->setAlias($alias);
     $event = $this->dispatchEvent("pre_save", $entity, $isNew);
     $repo->saveEntity($entity);
     $this->dispatchEvent("post_save", $entity, $isNew, $event);
 }
开发者ID:woakes070048,项目名称:mautic,代码行数:39,代码来源:ListModel.php


示例7: saveApiKeyAction

 /**
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function saveApiKeyAction(Request $request)
 {
     $apiKey = InputHelper::clean($request->request->get('apiKey'));
     $dataArray = ['success' => 0];
     /** @var \Mautic\InstallBundle\Configurator\Configurator $configurator */
     $configurator = $this->get('mautic.configurator');
     if ($configurator->isFileWritable()) {
         try {
             $cronfigConfig = array('api_key' => $apiKey);
             // Ensure the config has a secret key
             $params = $configurator->getParameters();
             if (!isset($params['cronfig']) || empty($params['cronfig']['secret_key'])) {
                 $cronfigConfig['secret_key'] = EncryptionHelper::generateKey();
                 $dataArray['secret_key'] = $cronfigConfig['secret_key'];
             }
             // Save the API key only if it doesn't exist or has changed
             if (!isset($params['cronfig']['api_key']) || !isset($params['cronfig']['secret_key']) || isset($params['cronfig']['api_key']) && $params['cronfig']['api_key'] == $apiKey || isset($params['cronfig']['secret_key']) && $params['cronfig']['secret_key'] == $apiKey) {
                 $configurator->mergeParameters(array('cronfig' => $cronfigConfig));
                 $configurator->write();
                 $dataArray['success'] = 1;
                 // We must clear the application cache for the updated values to take effect
                 /** @var \Mautic\CoreBundle\Helper\CacheHelper $cacheHelper */
                 $cacheHelper = $this->factory->getHelper('cache');
                 $cacheHelper->clearContainerFile();
             }
         } catch (\RuntimeException $exception) {
             $this->addFlash('mautic.config.config.error.not.updated', ['%exception%' => $exception->getMessage()], 'error');
         }
     } else {
         $form->addError(new FormError($this->factory->getTranslator()->trans('mautic.config.notwritable')));
     }
     return $this->sendJsonResponse($dataArray);
 }
开发者ID:cronfig,项目名称:mautic-cronfig,代码行数:37,代码来源:AjaxController.php


示例8: 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


示例9: setIntegrationFilterAction

 /**
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function setIntegrationFilterAction(Request $request)
 {
     $session = $this->factory->getSession();
     $pluginFilter = InputHelper::int($this->request->get('plugin'));
     $session->set('mautic.integrations.filter', $pluginFilter);
     return $this->sendJsonResponse(array('success' => 1));
 }
开发者ID:spdaly,项目名称:mautic,代码行数:12,代码来源:AjaxController.php


示例10: getAbTestFormAction

 /**
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function getAbTestFormAction(Request $request)
 {
     $dataArray = array('success' => 0, 'html' => '');
     $type = InputHelper::clean($request->request->get('abKey'));
     $emailId = InputHelper::int($request->request->get('emailId'));
     if (!empty($type)) {
         //get the HTML for the form
         /** @var \Mautic\EmailBundle\Model\EmailModel $model */
         $model = $this->factory->getModel('email');
         $email = $model->getEntity($emailId);
         $abTestComponents = $model->getBuilderComponents($email, 'abTestWinnerCriteria');
         $abTestSettings = $abTestComponents['criteria'];
         if (isset($abTestSettings[$type])) {
             $html = '';
             $formType = !empty($abTestSettings[$type]['formType']) ? $abTestSettings[$type]['formType'] : '';
             if (!empty($formType)) {
                 $formOptions = !empty($abTestSettings[$type]['formTypeOptions']) ? $abTestSettings[$type]['formTypeOptions'] : array();
                 $form = $this->get('form.factory')->create('email_abtest_settings', array(), array('formType' => $formType, 'formTypeOptions' => $formOptions));
                 $html = $this->renderView('MauticEmailBundle:AbTest:form.html.php', array('form' => $this->setFormTheme($form, 'MauticEmailBundle:AbTest:form.html.php', 'MauticEmailBundle:FormTheme\\Email')));
             }
             $html = str_replace(array('email_abtest_settings[', 'email_abtest_settings_', 'email_abtest_settings'), array('emailform[variantSettings][', 'emailform_variantSettings_', 'emailform'), $html);
             $dataArray['html'] = $html;
             $dataArray['success'] = 1;
         }
     }
     return $this->sendJsonResponse($dataArray);
 }
开发者ID:HomeRefill,项目名称:mautic,代码行数:32,代码来源:AjaxController.php


示例11: indexAction

 /**
  * @return JsonResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function indexAction()
 {
     //set some permissions
     $permissions = $this->factory->getSecurity()->isGranted(['core:themes:view', 'core:themes:create', 'core:themes:edit', 'core:themes:delete'], "RETURN_ARRAY");
     if (!$permissions['core:themes:view']) {
         return $this->accessDenied();
     }
     $themeHelper = $this->container->get('mautic.helper.theme');
     $dir = $this->factory->getSystemPath('themes', true);
     $action = $this->generateUrl('mautic_themes_index');
     $form = $this->get('form.factory')->create('theme_upload', [], ['action' => $action]);
     if ($this->request->getMethod() == 'POST') {
         if (isset($form) && !($cancelled = $this->isFormCancelled($form))) {
             if ($this->isFormValid($form)) {
                 $fileData = $form['file']->getData();
                 $fileName = InputHelper::filename($fileData->getClientOriginalName());
                 $themeName = basename($fileName, '.zip');
                 if (in_array($themeName, $this->defaultThemes)) {
                     $form->addError(new FormError($this->factory->getTranslator()->trans('mautic.core.theme.default.cannot.overwrite', ['%name%' => $themeName], 'validators')));
                 } elseif (!empty($fileData)) {
                     try {
                         $fileData->move($dir, $fileName);
                         $themeHelper->install($dir . '/' . $fileName);
                         $this->addFlash('mautic.core.theme.installed', ['%name%' => $themeName]);
                     } catch (\Exception $e) {
                         $form->addError(new FormError($this->factory->getTranslator()->trans($e->getMessage(), [], 'validators')));
                     }
                 } else {
                     $form->addError(new FormError($this->factory->getTranslator()->trans('mautic.dashboard.upload.filenotfound', [], 'validators')));
                 }
             }
         }
     }
     return $this->delegateView(['viewParameters' => ['items' => $themeHelper->getInstalledThemes('all', true, true), 'defaultThemes' => $this->defaultThemes, 'form' => $form->createView(), 'permissions' => $permissions, 'security' => $this->factory->getSecurity()], 'contentTemplate' => 'MauticCoreBundle:Theme:list.html.php', 'passthroughVars' => ['activeLink' => '#mautic_themes_index', 'mauticContent' => 'theme', 'route' => $this->generateUrl('mautic_themes_index')]]);
 }
开发者ID:Yame-,项目名称:mautic,代码行数:38,代码来源:ThemeController.php


示例12: saveEntity

 /**
  * {@inheritdoc}
  */
 public function saveEntity($entity, $unlock = true)
 {
     if (empty($this->inConversion)) {
         $alias = $entity->getAlias();
         if (empty($alias)) {
             $alias = strtolower(InputHelper::alphanum($entity->getTitle(), false, '-'));
         } else {
             $alias = strtolower(InputHelper::alphanum($alias, false, '-'));
         }
         //make sure alias is not already taken
         $repo = $this->getRepository();
         $testAlias = $alias;
         $count = $repo->checkUniqueAlias($testAlias, $entity);
         $aliasTag = $count;
         while ($count) {
             $testAlias = $alias . $aliasTag;
             $count = $repo->checkUniqueAlias($testAlias, $entity);
             $aliasTag++;
         }
         if ($testAlias != $alias) {
             $alias = $testAlias;
         }
         $entity->setAlias($alias);
     }
     //set the author for new asset
     if (!$entity->isNew()) {
         //increase the revision
         $revision = $entity->getRevision();
         $revision++;
         $entity->setRevision($revision);
     }
     parent::saveEntity($entity, $unlock);
 }
开发者ID:smotalima,项目名称:mautic,代码行数:36,代码来源:AssetModel.php


示例13: getActionFormAction

 /**
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function getActionFormAction(Request $request)
 {
     $dataArray = array('success' => 0, 'html' => '');
     $type = InputHelper::clean($request->request->get('actionType'));
     if (!empty($type)) {
         //get the HTML for the form
         /** @var \Mautic\StageBundle\Model\StageModel $model */
         $model = $this->getModel('stage');
         $actions = $model->getStageActions();
         if (isset($actions['actions'][$type])) {
             $themes = array('MauticStageBundle:FormTheme\\Action');
             if (!empty($actions['actions'][$type]['formTheme'])) {
                 $themes[] = $actions['actions'][$type]['formTheme'];
             }
             $formType = !empty($actions['actions'][$type]['formType']) ? $actions['actions'][$type]['formType'] : 'genericstage_settings';
             $formTypeOptions = !empty($actions['actions'][$type]['formTypeOptions']) ? $actions['actions'][$type]['formTypeOptions'] : array();
             $form = $this->get('form.factory')->create('stageaction', array(), array('formType' => $formType, 'formTypeOptions' => $formTypeOptions));
             $html = $this->renderView('MauticStageBundle:Stage:actionform.html.php', array('form' => $this->setFormTheme($form, 'MauticStageBundle:Stage:actionform.html.php', $themes)));
             $html = str_replace('stageaction', 'stage', $html);
             $dataArray['html'] = $html;
             $dataArray['success'] = 1;
         }
     }
     return $this->sendJsonResponse($dataArray);
 }
开发者ID:Yame-,项目名称:mautic,代码行数:30,代码来源:AjaxController.php


示例14: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     foreach ($options['integration_fields'] as $field => $details) {
         $label = is_array($details) ? $details['label'] : $details;
         $field = InputHelper::alphanum($field, false, '_');
         $builder->add($field, 'choice', array('choices' => $options['lead_fields'], 'label' => $label, 'required' => is_array($details) && isset($details['required']) ? $details['required'] : false, 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-placeholder' => ' ')));
     }
 }
开发者ID:spdaly,项目名称:mautic,代码行数:12,代码来源:FieldsType.php


示例15: getDataAction

 /**
  * Obtains a list of available widget types.
  *
  * @param string $type of the widget
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function getDataAction($type)
 {
     $start = microtime(true);
     $timezone = InputHelper::clean($this->request->get('timezone', null));
     $from = InputHelper::clean($this->request->get('dateFrom', null));
     $to = InputHelper::clean($this->request->get('dateTo', null));
     $dataFormat = InputHelper::clean($this->request->get('dataFormat', null));
     $response = ['success' => 0];
     if ($timezone) {
         $fromDate = new \DateTime($from, new \DateTimeZone($timezone));
         $toDate = new \DateTime($to, new \DateTimeZone($timezone));
     } else {
         $fromDate = new \DateTime($from);
         $toDate = new \DateTime($to);
     }
     $params = ['timeUnit' => InputHelper::clean($this->request->get('timeUnit', 'Y')), 'dateFormat' => InputHelper::clean($this->request->get('dateFormat', null)), 'dateFrom' => $fromDate, 'dateTo' => $toDate, 'limit' => InputHelper::int($this->request->get('limit', null)), 'filter' => $this->request->get('filter', [])];
     $cacheTimeout = InputHelper::int($this->request->get('cacheTimeout', null));
     $widgetHeight = InputHelper::int($this->request->get('height', 300));
     $widget = new Widget();
     $widget->setParams($params);
     $widget->setType($type);
     $widget->setHeight($widgetHeight);
     if ($cacheTimeout === null) {
         $widget->setCacheTimeout($cacheTimeout);
     }
     $this->model->populateWidgetContent($widget);
     $data = $widget->getTemplateData();
     if (!$data) {
         return $this->notFound();
     }
     if ($dataFormat == 'raw') {
         if (isset($data['chartData']['labels']) && isset($data['chartData']['datasets'])) {
             $rawData = [];
             foreach ($data['chartData']['datasets'] as $dataset) {
                 $rawData[$dataset['label']] = [];
                 foreach ($dataset['data'] as $key => $value) {
                     $rawData[$dataset['label']][$data['chartData']['labels'][$key]] = $value;
                 }
             }
             $data = $rawData;
         } elseif (isset($data['raw'])) {
             $data = $data['raw'];
         }
     } else {
         if (isset($data['raw'])) {
             unset($data['raw']);
         }
     }
     $response['cached'] = $widget->isCached();
     $response['execution_time'] = microtime(true) - $start;
     $response['success'] = 1;
     $response['data'] = $data;
     $view = $this->view($response, Codes::HTTP_OK);
     return $this->handleView($view);
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:62,代码来源:WidgetApiController.php


示例16: categoryListAction

 /**
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function categoryListAction(Request $request)
 {
     $bundle = InputHelper::clean($request->query->get('bundle'));
     $filter = InputHelper::clean($request->query->get('filter'));
     $results = $this->factory->getModel('category')->getLookupResults($bundle, $filter, 10);
     $dataArray = array();
     foreach ($results as $r) {
         $dataArray[] = array("label" => $r['title'] . " ({$r['id']})", "value" => $r['id']);
     }
     return $this->sendJsonResponse($dataArray);
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:15,代码来源:AjaxController.php


示例17: updateSubmissionChartAction

 /**
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function updateSubmissionChartAction(Request $request)
 {
     $formId = InputHelper::int($request->request->get('formId'));
     $amount = InputHelper::int($request->request->get('amount'));
     $unit = InputHelper::clean($request->request->get('unit'));
     $dataArray = array('success' => 0);
     // Download stats per time period
     $dataArray['stats'] = $this->factory->getEntityManager()->getRepository('MauticFormBundle:Submission')->getSubmissionsSince($formId, $amount, $unit);
     $dataArray['success'] = 1;
     return $this->sendJsonResponse($dataArray);
 }
开发者ID:woakes070048,项目名称:mautic,代码行数:15,代码来源:AjaxController.php


示例18: _

 /**
  * Format a string
  *
  * @param $val
  * @param $type
  */
 public function _($val, $type, $textOnly = false, $round = 1)
 {
     if (empty($val)) {
         return $val;
     }
     switch ($type) {
         case 'array':
             if (!is_array($val)) {
                 //assume that it's serialized
                 $unserialized = unserialize($val);
                 if ($unserialized) {
                     $val = $unserialized;
                 }
             }
             $stringParts = array();
             foreach ($val as $k => $v) {
                 if (is_array($v)) {
                     $stringParts = $this->_($v, 'array', $textOnly, $round + 1);
                 } else {
                     $stringParts[] = $v;
                 }
             }
             if ($round === 1) {
                 $string = implode('; ', $stringParts);
             } else {
                 $string = implode(', ', $stringParts);
             }
             break;
         case 'datetime':
             $string = $this->dateHelper->toFull($val, 'utc');
             break;
         case 'time':
             $string = $this->dateHelper->toTime($val, 'utc');
             break;
         case 'date':
             $string = $this->dateHelper->toDate($val, 'utc');
             break;
         case 'url':
             $string = $textOnly ? $val : '<a href="' . $val . '" target="_new">' . $val . '</a>';
             break;
         case 'email':
             $string = $textOnly ? $val : '<a href="mailto:' . $val . '">' . $val . '</a>';
             break;
         case 'int':
             $string = (int) $val;
             break;
         default:
             $string = InputHelper::clean($val);
             break;
     }
     return $string;
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:58,代码来源:FormatterHelper.php


示例19: updateConnectionsAction

 /**
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function updateConnectionsAction(Request $request)
 {
     $session = $this->factory->getSession();
     $campaignId = InputHelper::clean($request->query->get('campaignId'));
     $canvasSettings = $this->request->request->get('canvasSettings', array(), true);
     if (empty($campaignId)) {
         $dataArray = array('success' => 0);
     } else {
         $session->set('mautic.campaign.' . $campaignId . '.events.canvassettings', $canvasSettings);
         $dataArray = array('success' => 1);
     }
     return $this->sendJsonResponse($dataArray);
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:18,代码来源:AjaxController.php


示例20: updateGraphAction

 /**
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function updateGraphAction(Request $request)
 {
     $reportId = InputHelper::int($request->request->get('reportId'));
     $options = InputHelper::clean($request->request->all());
     $dataArray = array('success' => 0);
     /* @type \Mautic\ReportBundle\Model\ReportModel $model */
     $model = $this->factory->getModel('report');
     $report = $model->getEntity($reportId);
     $options['ignoreTableData'] = true;
     $reportData = $model->getReportData($report, $this->container->get('form.factory'), $options);
     $dataArray['graph'] = $reportData['graphs'][$options['graphName']]['data'];
     $dataArray['success'] = 1;
     return $this->sendJsonResponse($dataArray);
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:18,代码来源:AjaxController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Model\FormModel类代码示例发布时间:2022-05-23
下一篇:
PHP Helper\DateTimeHelper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap