File manager - Edit - /home/monara/public_html/test.athavaneng.com/Controllers.tar
Back
FormIntegrationController.php 0000644 00000006057 15073226737 0012454 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use FluentForm\App\Services\Integrations\FormIntegrationService; class FormIntegrationController extends Controller { public function index(FormIntegrationService $integrationService) { try { $formId = (int) $this->request->get('form_id'); return $this->sendSuccess( $integrationService->get($formId) ); } catch (\Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function find(FormIntegrationService $integrationService) { try { $integration = $integrationService->find($this->request->all()); return $this->sendSuccess($integration); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function update(FormIntegrationService $integrationService) { try { $integration = $integrationService->update($this->request->all()); return $this->sendSuccess($integration); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage() ], 422); } } public function delete(FormIntegrationService $integrationService) { try { $id = $this->request->get('integration_id'); $integrationService->delete($id); return $this->sendSuccess([ 'message' => __('Successfully deleted the Integration.', 'fluentform'), ], 200); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function integrationListComponent() { try { $integrationName = $this->request->get('integration_name'); $formId = intval($this->request->get('form_id')); $listId = $this->request->get('list_id'); $merge_fields = false; $merge_fields = apply_filters_deprecated( 'fluentform_get_integration_merge_fields_' . $integrationName, [ $merge_fields, $listId, $formId ], FLUENTFORM_FRAMEWORK_UPGRADE, 'fluentform/get_integration_merge_fields_' . $integrationName, 'Use fluentform/get_integration_merge_fields_' . $integrationName . ' instead of fluentform_get_integration_merge_fields_' . $integrationName ); $merge_fields = apply_filters('fluentform/get_integration_merge_fields_' . $integrationName, $merge_fields, $listId, $formId); return $this->sendSuccess([ 'merge_fields' => $merge_fields, ]); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } } SubmissionLogController.php 0000644 00000001516 15073226737 0012135 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use Exception; use FluentForm\App\Services\Logger\Logger; class SubmissionLogController extends Controller { public function get(Logger $logger, $submissionId) { try { return $this->sendSuccess( $logger->getSubmissionLogs($submissionId, $this->request->all()) ); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } public function remove(Logger $logger) { try { return $this->sendSuccess( $logger->remove($this->request->all()) ); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } } FormSettingsController.php 0000644 00000010222 15073226737 0011756 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use Exception; use FluentForm\App\Services\Settings\Customizer; use FluentForm\App\Services\Settings\SettingsService; use FluentForm\Framework\Validator\ValidationException; use FluentForm\App\Services\Submission\SubmissionService; class FormSettingsController extends Controller { public function index(SettingsService $settingsService) { $result = $settingsService->get($this->request->all()); return $this->sendSuccess($result); } public function general(SettingsService $settingsService, $formId) { $result = $settingsService->general($formId); return $this->sendSuccess($result); } public function saveGeneral(SettingsService $settingsService) { try { $settingsService->saveGeneral($this->request->all()); return $this->sendSuccess([ 'message' => __('Settings has been saved.', 'fluentform'), ]); } catch (ValidationException $exception) { return $this->sendError($exception->errors(), 422); } } public function store(SettingsService $settingsService) { try { [$settingsId, $settings] = $settingsService->store($this->request->all()); return $this->sendSuccess([ 'message' => __('Settings has been saved.', 'fluentform'), 'id' => $settingsId, 'settings' => $settings, ]); } catch (ValidationException $exception) { return $this->sendError($exception->errors(), 422); } } public function remove(SettingsService $settingsService) { $settingsService->remove($this->request->all()); return $this->sendSuccess([]); } public function customizer(Customizer $customizer, $id) { return $this->sendSuccess($customizer->get($id)); } public function storeCustomizer(Customizer $customizer, $id) { try { $customizer->store($this->request->all()); return $this->sendSuccess([ 'message' => __('Custom CSS & JS successfully saved.', 'fluentform'), ]); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 423); } } public function storeEntryColumns(SubmissionService $submissionService, $id) { try { $submissionService->storeColumnSettings($this->request->all()); return $this->sendSuccess([ 'message' => __('The column display order has been saved.', 'fluentform'), ]); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 423); } } public function conversationalDesign(SettingsService $settingsService, $formId) { try { return $this->sendSuccess($settingsService->conversationalDesign($formId)); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 423); } } public function storeConversationalDesign(SettingsService $settingsService, $formId) { try { return $this->sendSuccess($settingsService->storeConversationalDesign($this->request->all(), $formId)); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 423); } } public function getPreset(SettingsService $settingsService, $formId) { try { return $this->sendSuccess($settingsService->getPreset($formId)); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 423); } } public function savePreset(SettingsService $settingsService) { try { return $this->sendSuccess($settingsService->savePreset($this->request->all())); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 423); } } } LogController.php 0000644 00000002427 15073226737 0010063 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use Exception; use FluentForm\App\Services\Logger\Logger; class LogController extends Controller { public function get(Logger $logger) { try { return $this->sendSuccess( $logger->get($this->request->all()) ); } catch (Exception $e) { return $this->sendError([ 'message' => __('Something went wrong, please try again!', 'fluentform'), 'error' => $e->getMessage(), ]); } } public function getFilters(Logger $logger) { try { return $this->sendSuccess( $logger->getFilters($this->request->all()) ); } catch (Exception $e) { return $this->sendError([ 'message' => __('Something went wrong, please try again!', 'fluentform'), 'error' => $e->getMessage(), ]); } } public function remove(Logger $logger) { try { return $this->sendSuccess( $logger->remove($this->request->all()) ); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } } AdminNoticeController.php 0000644 00000007733 15073226737 0011541 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use FluentForm\Framework\Helpers\ArrayHelper; class AdminNoticeController extends Controller { private $notice = false; private $noticeDisabledTime = 60 * 60 * 24 * 15; // 15 days private $noticePrefKey = '_fluentform_notice_pref'; private $pref = false; public function showNotice() { if ($notice = $this->notice) { $this->renderNotice($notice, $notice['name']); } } public function addNotice($notice) { $this->notice = $notice; } public function noticeActions() { $noticeName = sanitize_text_field($this->request->get('notice_name')); $actionType = sanitize_text_field($this->request->get('action_type', 'permanent')); if ($noticeName == 'track_data_notice') { $notificationPref = $this->getNoticePref(); $notificationPref[$noticeName] = [ 'status' => 'no', 'email_subscribed' => 'no', 'timestamp' => time() ]; update_option($this->noticePrefKey, $notificationPref, 'no'); $this->pref = $notificationPref; } elseif ($noticeName == 'review_query') { $this->disableNotice($noticeName, $actionType); return $this->sendSuccess(true); } $this->disableNotice($noticeName, $actionType); return $this->sendSuccess([ 'message' => 'success' ]); die(); } public function renderNotice($notice, $notice_key = false) { if (!$this->hasPermission()) { return; } if ($notice_key) { if (!$this->shouldShowNotice($notice_key)) { return; } } wp_enqueue_style('fluentform_admin_notice', fluentformMix('css/admin_notices.css')); wp_enqueue_script('fluentform_admin_notice', fluentformMix('js/admin_notices.js'), array( 'jquery' ), FLUENTFORM_VERSION); wpFluentForm('view')->render('admin.notices.info', array( 'notice' => $notice, 'show_logo' => false, 'show_hide_nag' => false, 'logo_url' => fluentformMix('img/fluent_icon.png') )); } public function hasNotice() { return ($this->notice) ? true : false; } private function disableNotice($notice_key, $type = 'temp') { $noticePref = $this->getNoticePref(); $noticePref[$notice_key][$type] = time(); update_option($this->noticePrefKey, $noticePref, 'no'); $this->pref = $noticePref; } public function getNoticePref() { if (!$this->pref) { $this->pref = is_array(get_option($this->noticePrefKey)) ? get_option($this->noticePrefKey) : []; } return $this->pref; } public function shouldShowNotice($noticeName) { $notificationPref = $this->getNoticePref(); if (!$notificationPref) { return true; } $maybeHidePermanently = isset($notificationPref[$noticeName]['permanent']); if ($maybeHidePermanently) { return false; } if ($this->haveTempHideNotice($noticeName)) { return false; } return true; } private function haveTempHideNotice($noticeName) { $tempHideNotices = get_option($this->noticePrefKey); if ($tempHideNotices && isset($tempHideNotices[$noticeName]['temp'])) { $tempDisabledTime = $tempHideNotices[$noticeName]['temp']; $difference = time() - intval($tempDisabledTime); if ($difference < $this->noticeDisabledTime) { return true; } return false; } return false; } private function hasPermission() { return current_user_can('fluentform_dashboard_access'); } } FormController.php 0000644 00000011602 15073226737 0010240 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use Exception; use FluentForm\App\Services\Form\FormService; class FormController extends Controller { /** * Get the paginated forms matching search criteria. * * @param \FluentForm\App\Services\Form\FormService $formService * @return \WP_REST_Response */ public function index(FormService $formService) { return $this->sendSuccess( $formService->get($this->request->all()) ); } /** * Create a form from backend/editor * * @param \FluentForm\App\Services\Form\FormService $formService * @return \WP_REST_Response */ public function store(FormService $formService) { try { $form = $formService->store($this->request->all()); return $this->sendSuccess([ 'formId' => $form->id, 'redirect_url' => admin_url( 'admin.php?page=fluent_forms&form_id=' . $form->id . '&route=editor' ), 'message' => __('Successfully created a form.', 'fluentform'), ]); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function duplicate(FormService $formService) { try { $form = $formService->duplicate($this->request->all()); return $this->sendSuccess([ 'message' => __('Form has been successfully duplicated.', 'fluentform'), 'form_id' => $form->id, 'redirect' => admin_url('admin.php?page=fluent_forms&route=editor&form_id=' . $form->id), ], 200); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function find(FormService $formService) { try { $id = $this->request->get('form_id'); $form = $formService->find($id); return $this->sendSuccess($form, 200); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function delete(FormService $formService) { try { $id = $this->request->get('form_id'); $formService->delete($id); return $this->sendSuccess([ 'message' => __('Successfully deleted the form.', 'fluentform'), ], 200); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function update(FormService $formService) { try { $formService->update($this->request->all()); return $this->sendSuccess([ 'message' => __('The form is successfully updated.', 'fluentform'), ], 200); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function convert(FormService $formService) { try { $formService->convert($this->request->get('form_id')); return $this->sendSuccess([ 'message' => __('The form is successfully converted.', 'fluentform'), ], 200); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function templates(FormService $formService) { try { return $this->sendSuccess($formService->templates(), 200); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function resources(FormService $formService, $formId) { $components = $formService->components($formId); $disabledComponents = $formService->getDisabledComponents(); return $this->sendSuccess([ 'components' => $components, 'disabled_components' => $disabledComponents, 'shortcodes' => fluentFormEditorShortCodes(), ]); } public function fields(FormService $formService, $formId) { return $this->sendSuccess($formService->fields($formId)); } public function shortcodes(FormService $formService, $formId) { return $this->sendSuccess($formService->shortcodes($formId)); } public function pages(FormService $formService) { return $this->sendSuccess($formService->pages()); } public function findShortCodePage(FormService $formService, $formId) { return $this->sendSuccess($formService->findShortCodePage($formId)); } public function ping() { return ['message' => 'pong']; } } RolesController.php 0000644 00000001316 15073226737 0010422 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use FluentForm\Framework\Validator\ValidationException; use FluentForm\App\Services\Roles\RolesService; class RolesController extends Controller { public function index(RolesService $rolesService) { $result = $rolesService->getRoles($this->request->all()); return $this->sendSuccess($result); } public function addCapability(RolesService $rolesService) { try { $result = $rolesService->setCapability($this->request->all()); return $this->sendSuccess($result); } catch (ValidationException $exception) { return $this->sendError($exception->errors(), 422); } } } ManagersController.php 0000644 00000002071 15073226737 0011072 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use FluentForm\Framework\Validator\ValidationException; use FluentForm\App\Services\Manager\ManagerService; class ManagersController extends Controller { public function index(ManagerService $managerService) { $result = $managerService->getManagers($this->request->all()); return $this->sendSuccess($result); } public function addManager(ManagerService $managerService) { try { $result = $managerService->addManager($this->request->all()); return $this->sendSuccess($result); } catch (ValidationException $exception) { return $this->sendError($exception->errors(), 422); } } public function removeManager(ManagerService $managerService) { try { $result = $managerService->removeManager($this->request->all()); return $this->sendSuccess($result); } catch (ValidationException $exception) { return $this->sendError($exception->errors(), 422); } } } Controller.php 0000644 00000000254 15073226737 0007415 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use FluentForm\Framework\Http\Controller as BaseController; abstract class Controller extends BaseController { // } SubmissionNoteController.php 0000644 00000001727 15073226737 0012325 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use Exception; use FluentForm\App\Services\Submission\SubmissionService; class SubmissionNoteController extends Controller { public function get(SubmissionService $submissionService, $submissionId) { try { return $this->sendSuccess( $submissionService->getNotes($submissionId, $this->request->all()) ); } catch (Exception $exception) { return $this->sendError([ 'message' => $exception->getMessage(), ]); } } public function store(SubmissionService $submissionService, $submissionId) { try { return $this->sendSuccess( $submissionService->storeNote($submissionId, $this->request->all()) ); } catch (Exception $exception) { return $this->sendError([ 'message' => $exception->getMessage(), ]); } } } SubmissionController.php 0000644 00000011537 15073226737 0011477 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use Exception; use FluentForm\App\Models\Submission; use FluentForm\App\Services\Submission\SubmissionService; class SubmissionController extends Controller { public function index(SubmissionService $submissionService) { try { return $this->sendSuccess( $submissionService->get($this->request->all()) ); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } public function find(SubmissionService $submissionService, $submissionId) { try { return $this->sendSuccess( $submissionService->find($submissionId) ); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } public function resources(SubmissionService $submissionService) { try { return $this->sendSuccess( $submissionService->resources($this->request->all()) ); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } public function updateStatus(SubmissionService $submissionService) { try { $status = $submissionService->updateStatus($this->request->all()); return $this->sendSuccess([ 'message' => __('The submission has been marked as ' . $status, 'fluentform'), 'status' => $status, ]); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } public function toggleIsFavorite(SubmissionService $submissionService) { try { [$message, $isFavourite] = $submissionService->toggleIsFavorite( $this->request->get('entry_id') ); return $this->sendSuccess([ 'message' => $message, 'is_favourite' => $isFavourite, ]); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } public function handleBulkActions(SubmissionService $submissionService) { try { $message = $submissionService->handleBulkActions($this->request->all()); return $this->sendSuccess(['message' => $message]); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } public function remove(Submission $submission, $submissionId) { try { $submission::remove([$submissionId]); return $this->sendSuccess([ 'message' => __('Selected submission successfully deleted Permanently', 'fluentform'), ]); } catch (Exception $e){ return $this->sendError([ 'message' => $e->getMessage(), ]); } } /** * Get user list for submission page * @return \WP_REST_Response */ public function submissionUsers() { $search = sanitize_text_field($this->request->get('search')); $users = get_users([ 'search' => "*{$search}*", 'number' => 50, ]); $formattedUsers = []; foreach ($users as $user) { $formattedUsers[] = [ 'ID' => $user->ID, 'label' => $user->display_name . ' - ' . $user->user_email, ]; } return $this->sendSuccess([ 'users' => $formattedUsers, ]); } /** * Update User of a submission * @param SubmissionService $submissionService * @return \WP_REST_Response */ public function updateSubmissionUser(SubmissionService $submissionService) { try { $userId = intval($this->request->get('user_id')); $submissionId = intval($this->request->get('submission_id')); $response = $submissionService->updateSubmissionUser($userId, $submissionId); return $this->sendSuccess($response); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } /** * Get All Submissions * @param Submission $submission * @return \WP_REST_Response */ public function all(Submission $submission) { try { return $this->sendSuccess( $submission->allSubmissions($this->request->all()) ); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage() ]); } } } GlobalIntegrationController.php 0000644 00000005120 15073226737 0012737 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use FluentForm\App\Services\Integrations\GlobalIntegrationService; use FluentForm\Framework\Helpers\ArrayHelper as Arr; use Exception; class GlobalIntegrationController extends Controller { /** * Request object * * @var \FluentForm\Framework\Request\Request $request */ protected $request; public function index(GlobalIntegrationService $globalIntegrationService) { try { $returnData = $globalIntegrationService->get($this->request->all()); if (Arr::isTrue($returnData, 'status')) { return $this->sendSuccess($returnData); } return $this->sendError($returnData); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function update() { try { $settingsKey = sanitize_text_field($this->request->get('settings_key')); $integration = wp_unslash($this->request->get('integration')); do_action_deprecated( 'fluentform_save_global_integration_settings_' . $settingsKey, [ $integration ], FLUENTFORM_FRAMEWORK_UPGRADE, 'fluentform/save_global_integration_settings_' . $settingsKey, 'Use fluentform/save_global_integration_settings_' . $settingsKey . ' instead of fluentform_save_global_integration_settings_' . $settingsKey ); do_action('fluentform/save_global_integration_settings_' . $settingsKey, $integration); // Someone should catch that above action and send response return $this->sendError([ 'message' => __('Sorry, no Integration found. Please make sure that latest version of Fluent Forms pro installed', 'fluentform'), ]); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } public function updateModuleStatus(GlobalIntegrationService $globalIntegrationService) { try { $globalIntegrationService->updateModuleStatus($this->request->get()); return $this->sendSuccess([ 'message' => __('Status successfully updated', 'fluentform'), ], 200); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ], 422); } } } GlobalSettingsController.php 0000644 00000001412 15073226737 0012254 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use FluentForm\Framework\Validator\ValidationException; use FluentForm\App\Services\GlobalSettings\GlobalSettingsService; class GlobalSettingsController extends Controller { public function index(GlobalSettingsService $globalSettingsService) { $result = $globalSettingsService->get($this->request->all()); return $this->sendSuccess($result); } public function store(GlobalSettingsService $globalSettingsService) { try { $result = $globalSettingsService->store($this->request->all()); return $this->sendSuccess($result); } catch (ValidationException $exception) { return $this->sendError($exception->errors(), 422); } } } SubmissionHandlerController.php 0000644 00000002014 15073226737 0012763 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use FluentForm\App\Services\Form\SubmissionHandlerService; use FluentForm\Framework\Validator\ValidationException; class SubmissionHandlerController extends Controller { /** * Handle form submission */ public function submit() { try { parse_str($this->request->get('data'), $data); // Parse the url encoded data from the request object. $data['_wp_http_referer'] = isset($data['_wp_http_referer']) ? sanitize_url(urldecode($data['_wp_http_referer'])) : ''; $this->request->merge(['data' => $data]); // Merge it back again to the request object. $formId = intval($this->request->get('form_id')); $response = (new SubmissionHandlerService())->handleSubmission($data, $formId); return $this->json($response); } catch (ValidationException $e) { return $this->json($e->errors(), $e->getCode()); } } } IntegrationManagerController.php 0000644 00000021716 15073226737 0013122 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use FluentForm\App\Helpers\IntegrationManagerHelper; use FluentForm\Framework\Foundation\App; use FluentForm\Framework\Helpers\ArrayHelper; abstract class IntegrationManagerController extends IntegrationManagerHelper { protected $app = null; protected $subscriber = null; protected $title = ''; protected $description = ''; protected $integrationKey = ''; protected $optionKey = ''; protected $settingsKey = ''; protected $priority = 11; public $logo = ''; public $hasGlobalMenu = true; public $category = 'crm'; public $disableGlobalSettings = 'no'; public function __construct($app, $title, $integrationKey, $optionKey, $settingsKey, $priority = 11) { if (!$app) { $app = App::getInstance(); } $this->app = $app; $this->title = $title; $this->integrationKey = $integrationKey; $this->optionKey = $optionKey; $this->settingsKey = $settingsKey; $this->priority = $priority; if(isset($_REQUEST['form_id'])) { parent::__construct( $this->settingsKey, $_REQUEST['form_id'], true ); } else { parent::__construct( $this->settingsKey, false, true ); } } public function registerAdminHooks() { $isEnabled = $this->isEnabled(); add_filter('fluentform/global_addons', function ($addons) use ($isEnabled) { $addons[$this->integrationKey] = [ 'title' => $this->title, 'category' => $this->category, 'disable_global_settings' => $this->disableGlobalSettings, 'description' => $this->description, 'config_url' => ('yes' != $this->disableGlobalSettings) ? admin_url('admin.php?page=fluent_forms_settings#general-' . $this->integrationKey . '-settings') : '', 'logo' => $this->logo, 'enabled' => ($isEnabled) ? 'yes' : 'no', ]; return $addons; }, $this->priority, 1); if (!$isEnabled) { return; } $this->registerNotificationHooks(); // Global Settings Here if ($this->hasGlobalMenu) { add_filter('fluentform/global_settings_components', [$this, 'addGlobalMenu']); add_filter('fluentform/global_integration_settings_' . $this->integrationKey, [$this, 'getGlobalSettings'], $this->priority, 1); add_filter('fluentform/global_integration_fields_' . $this->integrationKey, [$this, 'getGlobalFields'], $this->priority, 1); add_action('fluentform/save_global_integration_settings_' . $this->integrationKey, [$this, 'saveGlobalSettings'], $this->priority, 1); } add_filter('fluentform/global_notification_types', [$this, 'addNotificationType'], $this->priority); add_filter('fluentform/get_available_form_integrations', [$this, 'pushIntegration'], $this->priority, 2); add_filter('fluentform/global_notification_feed_' . $this->settingsKey, [$this, 'setFeedAttributes'], 10, 2); add_filter('fluentform/get_integration_defaults_' . $this->integrationKey, [$this, 'getIntegrationDefaults'], 10, 2); add_filter('fluentform/get_integration_settings_fields_' . $this->integrationKey, [$this, 'getSettingsFields'], 10, 2); add_filter('fluentform/get_integration_merge_fields_' . $this->integrationKey, [$this, 'getMergeFields'], 10, 3); add_filter('fluentform/save_integration_settings_' . $this->integrationKey, [$this, 'setMetaKey'], 10, 2); add_filter('fluentform/get_integration_values_' . $this->integrationKey, [$this, 'prepareIntegrationFeed'], 10, 3); } public function registerNotificationHooks() { if ($this->isConfigured()) { add_filter('fluentform/global_notification_active_types', [$this, 'addActiveNotificationType'], $this->priority); add_action('fluentform/integration_notify_' . $this->settingsKey, [$this, 'notify'], $this->priority, 4); } } public function notify($feed, $formData, $entry, $form) { // Each integration have to implement this notify method return; } public function addGlobalMenu($setting) { $setting[$this->integrationKey] = [ 'hash' => 'general-' . $this->integrationKey . '-settings', 'component' => 'general-integration-settings', 'settings_key' => $this->integrationKey, 'title' => $this->title, ]; return $setting; } public function addNotificationType($types) { $types[] = $this->settingsKey; return $types; } public function addActiveNotificationType($types) { $types[$this->settingsKey] = $this->integrationKey; return $types; } public function getGlobalSettings($settings) { return $settings; } public function saveGlobalSettings($settings) { return $settings; } public function getGlobalFields($fields) { return $fields; } public function setMetaKey($data) { $data['meta_key'] = $this->settingsKey; return $data; } public function prepareIntegrationFeed($setting, $feed, $formId) { $defaults = $this->getIntegrationDefaults([], $formId); foreach ($setting as $settingKey => $settingValue) { if ('true' == $settingValue) { $setting[$settingKey] = true; } elseif ('false' == $settingValue) { $setting[$settingKey] = false; } elseif ('conditionals' == $settingKey) { if ('true' == $settingValue['status']) { $settingValue['status'] = true; } elseif ('false' == $settingValue['status']) { $settingValue['status'] = false; } $setting['conditionals'] = $settingValue; } } if (!empty($setting['list_id'])) { $setting['list_id'] = (string)$setting['list_id']; } return wp_parse_args($setting, $defaults); } abstract public function getIntegrationDefaults($settings, $formId); abstract public function pushIntegration($integrations, $formId); abstract public function getSettingsFields($settings, $formId); abstract public function getMergeFields($list, $listId, $formId); public function setFeedAttributes($feed, $formId) { $feed['provider'] = $this->integrationKey; $feed['provider_logo'] = $this->logo; return $feed; } public function isConfigured() { $globalStatus = $this->getApiSettings(); return $globalStatus && $globalStatus['status']; } public function isEnabled() { return (new \FluentForm\App\Services\Integrations\GlobalIntegrationService())->isEnabled($this->integrationKey); } public function getApiSettings() { $settings = get_option($this->optionKey); if (!$settings || empty($settings['status'])) { $settings = [ 'apiKey' => '', 'status' => false, ]; } return $settings; } protected function getSelectedTagIds( $data, $inputData, $simpleKey = 'tag_ids', $routingId = 'tag_ids_selection_type', $routersKey = 'tag_routers' ) { $routing = ArrayHelper::get($data, $routingId, 'simple'); if (!$routing || 'simple' == $routing) { return ArrayHelper::get($data, $simpleKey, []); } $routers = ArrayHelper::get($data, $routersKey); if (empty($routers)) { return []; } return $this->evaluateRoutings($routers, $inputData); } protected function evaluateRoutings($routings, $inputData) { $validInputs = []; foreach ($routings as $routing) { $inputValue = ArrayHelper::get($routing, 'input_value'); if (!$inputValue) { continue; } $condition = [ 'conditionals' => [ 'status' => true, 'is_test' => true, 'type' => 'any', 'conditions' => [ $routing, ], ], ]; if (\FluentForm\App\Services\ConditionAssesor::evaluate($condition, $inputData)) { $validInputs[] = $inputValue; } } return $validInputs; } } GlobalSearchController.php 0000644 00000000750 15073226737 0011665 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use FluentForm\App\Services\GlobalSearchService; class GlobalSearchController extends Controller { /** * Get the search links. * * @param \FluentForm\App\Services\GlobalSearchService $globalSearchService * @return \WP_REST_Response */ public function index(GlobalSearchService $globalSearchService) { return $this->sendSuccess( $globalSearchService->get() ); } } ReportController.php 0000644 00000001646 15073226737 0010617 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use Exception; use FluentForm\App\Services\Report\ReportService; class ReportController extends Controller { public function form(ReportService $reportService) { try { return $this->sendSuccess( $reportService->form($this->request->all()) ); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } /** * Get Submission Report * @return \WP_REST_Response */ public function submissions(ReportService $reportService) { try { return $this->sendSuccess( $reportService->submissions($this->request->all()) ); } catch (Exception $e) { return $this->sendError([ 'message' => $e->getMessage(), ]); } } } AnalyticsController.php 0000644 00000001302 15073226737 0011260 0 ustar 00 <?php namespace FluentForm\App\Http\Controllers; use Exception; use FluentForm\App\Services\Analytics\AnalyticsService; use FluentForm\App\Services\Browser\Browser; use FluentForm\App\Services\Form\FormService; class AnalyticsController extends Controller { public function reset(AnalyticsService $analyticsService,$formId) { try { return $this->sendSuccess( $analyticsService->reset(intval($formId)) ); } catch (\Exception $e) { return $this->sendError([ 'message' => __('Something went wrong, please try again!', 'fluentform'), 'error' => $e->getMessage(), ]); } } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.04 |
proxy
|
phpinfo
|
Settings