Файловый менеджер - Редактировать - /home/tuudkjt/globeasy/wp-includes/ID3/Api.tar
Назад
DashboardApi.php 0000777 00000001244 15251225702 0007607 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; use Exception; class DashboardApi extends \Rvx\Api\BaseApi { /** * @return Response * @throws Exception */ public function insightReviews() : Response { return $this->get('dashboard/insight'); } /** * @return Response * @throws Exception */ public function requestEmail() : Response { return $this->get('dashboard/review-request-email'); } /** * @param $time * @return Response * @throws Exception */ public function chart($time) : Response { return $this->get('dashboard/chart?view=' . $time); } } ProductApi.php 0000777 00000003552 15251225702 0007344 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; use Exception; class ProductApi extends \Rvx\Api\BaseApi { /** * @return Response * @throws Exception */ public function getProductSelect($id) : Response { if (!empty($id['search'])) { return $this->get('products/selectable?search=' . $id['search']); } return $this->get('products/selectable'); } /** * @return Response * @throws Exception */ public function getProducts() : Response { return $this->get('products'); } /** * @return Response * @throws Exception */ public function getProductInsights() : Response { return $this->get('products/insights'); } /** * @param array $data * @return Response * @throws Exception */ public function create(array $data) : Response { return $this->withJson($data)->post('products/store'); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function update(array $data, $uid) : Response { return $this->withJson($data)->put('products/' . $uid . '/update'); } /** * @param $uid * @param $status * @return Response * @throws Exception */ public function status($uid, $status) : Response { return $this->put('products/' . $uid . '/status?status=' . $status); } /** * @param $id * @return mixed * @throws Exception */ public function remove($id) { $link = 'products/' . $id; return $this->delete($link); } /** * @param $id * @return mixed * @throws Exception */ public function trashToRestoreWpProduct($id) { $link = 'products/' . $id . '/restore'; return $this->put($link); } } UserApi.php 0000777 00000002160 15251225702 0006634 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; class UserApi extends \Rvx\Api\BaseApi { /** * @return Response * @throws \Exception */ public function getUser() : Response { return $this->get('customers'); } /** * @param array $data * @return Response * @throws Exception */ public function create(array $data) : Response { return $this->withJson($data)->post('customer'); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function update(array $data, $uid) : Response { return $this->withJson($data)->put('customer/' . $uid . '/update'); } public function editAccountUpdate(array $data, $uid) : Response { return $this->withJson($data)->put('customer/' . $uid . '/update'); } /** * @param $id * @return Response * @throws Exception */ public function remove($id) : Response { $tt = 'customer/' . $id; \error_log("Delete " . $tt); return $this->delete('customer/' . $id); } } CategoryApi.php 0000777 00000002100 15251225702 0007465 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; class CategoryApi extends \Rvx\Api\BaseApi { /** * @param $id * @return Response * @throws \Exception */ public function selectable() : Response { return $this->get('category/selectable'); } public function getCategory() : Response { return $this->get('categories'); } public function create(array $data) { return $this->withJson($data)->post('category'); } /** * @param $id * @return mixed * @throws \Exception */ public function remove($id) { \error_log("delete uid " . $id); return $this->delete('category/' . $id); } /** * @param array $data * @param $uid * @return Response * @throws \Exception */ public function update(array $data, $uid) : Response { return $this->withJson($data)->put('category/' . $uid . '/update'); } public function dataSync(array $data) { return $this->withJson($data)->post('sync/categories'); } } GoogleReviewApi.php 0000777 00000002433 15251225702 0010317 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; use Exception; class GoogleReviewApi extends \Rvx\Api\BaseApi { /** * @return Response * @throws Exception */ public function googleReviewGet() : Response { return $this->get('reviews/google'); } /** * @return Response * @throws Exception */ public function googleReviewPlaceApi() : Response { return $this->get('settings/google-place-api/get'); } /** * @param array $data * @return Response * @throws Exception */ public function googleReviewKey(array $data) : Response { if ($data['disconnect'] == \true) { return $this->withJson($data)->post('settings/google-place-api/save?disconnect=' . $data['disconnect']); } return $this->withJson($data)->post('settings/google-place-api/save'); } /** * @param array $data * @return Response * @throws Exception */ public function googleReviewSetting(array $data) : Response { if ($data['is_default'] == \true) { return $this->withJson($data)->post('settings/google-widget/save?is_default=' . $data['is_default']); } return $this->withJson($data)->post('settings/google-widget/save'); } } OrderApi.php 0000777 00000002415 15251225702 0006774 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; use Exception; class OrderApi extends \Rvx\Api\BaseApi { /** * @param array $data * @return Response * @throws Exception */ public function create(array $data) : Response { return $this->withJson($data)->post('orders/store'); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function update(array $data, $uid) : Response { return $this->withJson($data)->put('orders/' . $uid . '/update'); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function changeStatus(array $data, $uid) : Response { return $this->withJson($data)->put('orders/' . $uid . '/change/status'); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function changeBulkStatus(array $data) : Response { return $this->withJson($data)->post('orders/bulk/change/status'); } /** * @param $uid * @return Response * @throws Exception */ public function delete($uid) : Response { return $this->delete('orders/' . $uid); } } WpApi.php 0000777 00000005167 15251225702 0006316 0 ustar 00 <?php namespace Rvx\Api; use Rvx\GuzzleHttp\Client; use Rvx\GuzzleHttp\Exception\RequestException; use Rvx\Utilities\Helper; class WpApi { protected string $baseUrl; protected ?string $token = null; protected Client $client; public function __construct($token = null) { // Use get_rest_url instead of hardcoding wp-json $this->baseUrl = Helper::getRestAPIurl() . '/api/v1'; $this->token = Helper::getAuthToken(); $this->client = new Client(['base_uri' => $this->baseUrl, 'timeout' => 10.0]); } /** * Make a GET request. * * @param string $route * @return mixed */ public function get(string $route) { $url = $this->prepareRoute($route); $headers = $this->prepareHeaders(); try { $response = $this->client->request('GET', $url, ['headers' => $headers]); return \json_decode((string) $response->getBody(), \true); } catch (RequestException $e) { return $e->getMessage(); } } /** * Make a POST request. * * @param string $route * @param array $payload * @return mixed */ public function post(string $route, array $payload) { $url = $this->prepareRoute($route); $headers = $this->prepareHeaders(); try { $response = $this->client->request('POST', $url, ['headers' => $headers, 'json' => $payload]); return \json_decode((string) $response->getBody(), \true); } catch (RequestException $e) { return $e->getMessage(); } } /** * Prepare the full route URL. * * @param string $route * @return string */ public function prepareRoute(string $route) : string { return \rtrim($this->baseUrl, '/') . '/' . \ltrim($route, '/'); } /** * Prepare the authorization headers. * * @return array */ protected function prepareHeaders() : array { $headers = ['Content-Type' => 'application/json']; if ($this->token) { $headers['Authorization'] = 'Bearer ' . $this->token; $headers['X-url'] = home_url(); } return $headers; } /** * Set the authorization token for the API. * * @param string $token * @return void */ public function setToken(string $token) : void { $this->token = $token; } /** * Set the base URL for the API. * * @param string $baseUrl * @return void */ public function setBaseUrl(string $baseUrl) : void { $this->baseUrl = \rtrim($baseUrl, '/'); } } ReviewsApi.php 0000777 00000027720 15251225702 0007353 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; use Exception; use Rvx\Models\Post; use Rvx\Utilities\Auth\Client; class ReviewsApi extends \Rvx\Api\BaseApi { public function getReviews($data) : Response { if (!empty($data)) { \parse_str($data, $query_params); if (isset($query_params['product']) && \is_numeric($query_params['product'])) { $query_params['product'] = Client::getUid() . '-' . $query_params['product']; } return $this->get('reviews?' . \http_build_query($query_params)); } return $this->get('reviews'); } public function reviewList($data) : Response { if (!empty($data)) { \parse_str($data, $query_params); if (isset($query_params['product']) && \is_numeric($query_params['product'])) { $query_params['product'] = Client::getUid() . '-' . $query_params['product']; } return $this->get('reviews/list?' . \http_build_query($query_params)); } return $this->get('reviews/list'); } /** * @param $id * @return Response * @throws Exception */ public function getReview($wpUniqueId) : Response { return $this->get('reviews/' . $wpUniqueId); } /** * @param array $data * @return Response * @throws Exception */ public function create(array $data) : Response { return $this->withJson($data)->post('reviews/create/manual'); } /** * @param array $data * @param $wpUniqueId * @return Response * @throws Exception */ public function updateReviewData(array $data, $wpUniqueId) : Response { return $this->withJson($data)->put('reviews/' . $wpUniqueId . '/update'); } public function updateWooReviewData(array $data, $wpUniqueId) : Response { return $this->withJson($data)->put('reviews/' . $wpUniqueId . '/update?woocommerce_update=true'); } /** * @param $uid * @return Response * @throws Exception */ public function deleteReviewData($wpUniqueId) : Response { return $this->delete('reviews/' . $wpUniqueId . '/delete'); } /** * @param $uid * @return Response * @throws Exception */ public function restoreReview($wpUniqueId, $status = null) : Response { $route = 'reviews/' . $wpUniqueId . '/restore'; if ($status) { $route .= '?status=' . $status; } return $this->put($route); } /** * @param $data * @param $wpUniqueId * @return Response * @throws Exception */ public function verifyReview($data, $wpUniqueId) : Response { return $this->put('reviews/' . $wpUniqueId . '/verify?status=' . $data); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function visibilityReviewData(array $data, $wpUniqueId) : Response { if ($data['status']) { return $this->put('reviews/' . $wpUniqueId . '/visibility?status=' . $data['status']); } return $this->put('reviews/' . $wpUniqueId . '/visibility'); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function sendUpdateReviewRequestEmail(array $data, $wpUniqueId) : Response { return $this->withJson($data)->put('reviews/' . $wpUniqueId . '/send/update/request-email'); } /** * @return Response * @throws Exception */ public function reviewAggregation() : Response { return $this->get('reviews/get-aggregation'); } /** * @return Response * @throws Exception */ public function getSpecificReviewItem($uid, $data) : Response { return $this->withJson($data)->post('storefront/' . $uid . '/widgets/short/code/reviews'); } /** * @param array $data * @return Response * @throws Exception */ public function bulkStatusUpdateReviewData(array $data) : Response { return $this->withJson($data)->put('reviews/bulk/status/update'); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function replayCommentReviewData(array $data, $uid) : Response { return $this->withJson($data)->post('reviews/{$uid}/comments'); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function updateReplayCommentReviewData(array $data, $uid) : Response { return $this->withJson($data)->post('reviews/{$uid}/update/comments'); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function deleteReplayCommentReviewData(array $data, $uid) : Response { return $this->withJson($data)->post('reviews/{$uid}/delete/{$id}/comments'); } //replies /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function commentReply(array $data, $wpUniqueId) : Response { return $this->withJson($data)->post('reviews/' . $wpUniqueId . '/replies'); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function updateCommentReply(array $data, $uid) : Response { return $this->withJson($data)->put('reviews/' . $uid . '/update/replies'); } /** * @param $uid * @return Response * @throws Exception */ public function deleteCommentReply($wpUniqueId) : Response { return $this->delete('reviews/' . $wpUniqueId . '/delete/reply'); } /** * @param array $data * @return Response * @throws Exception */ public function aiReview(array $data) : Response { return $this->withJson($data)->post('reviews/create/ai'); } /** * @param array $data * @return Response * @throws Exception */ public function aiReviewCount() : Response { return $this->get('reviews/ai/count'); } /** * @param $request * @return Response * @throws Exception */ public function getWidgetReviewsForProductApi($request) : Response { $query_string = \http_build_query($request->get_params()); \parse_str($query_string, $query_params); unset($query_params['product_id']); $productId = $request->get_param('product_id'); $siteUid = Client::getUid(); $post = Post::find($productId); $productWpUniqueId = $siteUid . '-' . $post->ID; $new_query_string = \http_build_query($query_params); $callableRoute = "/storefront/{$siteUid}/widgets/products/{$productWpUniqueId}/reviews"; if (!empty($new_query_string)) { $callableRoute .= '?' . $new_query_string; } return $this->get($callableRoute); } /** * @param $request * @return Response * @throws Exception */ public function getWidgetAllReviewsForSiteApi($request, $site_id) : Response { $query_params = $request->get_params(); unset($query_params['site_id']); $callableRoute = "/storefront/{$site_id}/all/reviews/shortcode"; $query_string = \http_build_query($query_params); if ($query_string) { $callableRoute .= '?' . $query_string; } return $this->get($callableRoute); } /** * @param $request * @return Response * @throws Exception */ public function getWidgetReviewsListShortcodeApi($request) : Response { $query_params = $request->get_params(); unset($query_params['product_id']); $productId = $request->get_param('product_id'); $siteUid = Client::getUid(); $post = Post::find($productId); $productWpUniqueId = $siteUid . '-' . $post->ID; $query_string = \http_build_query($query_params); $callableRoute = "/storefront/{$siteUid}/widgets/products/{$productWpUniqueId}/reviews/shortcode"; if ($query_string) { $callableRoute .= '?' . $query_string; } return $this->get($callableRoute); } public function getSingleProductAllReviews($productId) : Response { $siteUid = Client::getUid(); $post = Post::find($productId); $productWpUniqueId = $siteUid . '-' . $post->ID; $callableRoute = "/storefront/{$siteUid}/widgets/products/{$productWpUniqueId}/reviews"; return $this->get($callableRoute); } /** * @param $request * @return Response * @throws Exception */ public function getWidgetInsight($request) : Response { $query_string = \http_build_query($request->get_params()); \parse_str($query_string, $query_params); unset($query_params['product_id']); $productId = $request->get_param('product_id'); $siteUid = Client::getUid(); $post = Post::find($productId); $productWpUniqueId = $siteUid . '-' . $post->ID; $new_query_string = \http_build_query($query_params); $callableRoute = "/storefront/{$siteUid}/widgets/products/{$productWpUniqueId}/insight"; if (!empty($new_query_string)) { $callableRoute .= '?' . $new_query_string; } return $this->get($callableRoute); } public function reviewBulkUpdate($data) { return $this->withJson($data)->post('/reviews/bulk/status/update'); } public function restoreTrashItem($data) { return $this->withJson($data)->post('reviews/bulk/restore/trash'); } public function reviewBulkTrash($data) { return $this->withJson($data)->post('/reviews/bulk/trash'); } public function reviewEmptyTrash() { return $this->delete('reviews/empty/trash'); } /** * @param $request * @return Response * @throws Exception */ public function saveWidgetReviewsForProductApi($data) : Response { $callableRoute = "/storefront/reviews"; return $this->withJson($data)->post($callableRoute); } /** * @param $request * @return Response * @throws Exception */ public function reviewMoveToTrash($data) : Response { $callableRoute = "reviews/" . $data['WpUniqueId'] . "/trash"; return $this->put($callableRoute); } /** * @param $request * @return Response * @throws Exception */ public function likeDIslikePreference($data) : Response { $callableRoute = 'storefront/reviews/' . $data['uniq_id'] . '/preference'; return $this->withJson($data)->post($callableRoute); } /** * @param $request * @return Response * @throws Exception */ public function reviewListMultiCriteria() : Response { return $this->get('reviews/list/multi-criteria'); } /** * @param $request * @return Response * @throws Exception */ public function getProductReviewFormId($data) : Response { if ($data['product'] != null) { $siteUid = Client::getUid(); $post = Post::find($data['product']); $productWpUniqueId = $siteUid . '-' . $post->ID; $callableRoute = "/storefront/{$siteUid}/widgets/products/{$productWpUniqueId}/reviews"; return $this->get($callableRoute); } return $this->get('reviews'); } /** * @param $request * @return Response * @throws Exception */ public function highlight($data) : Response { $callableRoute = 'reviews/' . $data['wpUniqueId'] . '/highlight'; return $this->withJson($data)->put($callableRoute); } /** * @param array $data * @return Response * @throws Exception */ public function reviewRequestStoreItem(array $data, $uid) : Response { return $this->withJson($data)->post('storefront/request-review/email/' . $uid . '/store/items'); } } AuthApi.php 0000777 00000002721 15251225702 0006622 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; use Exception; class AuthApi extends \Rvx\Api\BaseApi { /** * @param array $data * @return Response * @throws Exception */ public function login(array $data) : Response { return $this->withJson($data)->post('login'); } /** * @param array $data * @return Response * @throws Exception */ public function register(array $data) : Response { if ($data['domain'] === 'localhost') { $ip = (new \Rvx\Api\BaseApi())->getIp(); $data['url'] = $ip; } return $this->withJson($data)->post('register'); } /** * @param array $data * @return Response * @throws Exception */ public function licenseLogin(array $data) : Response { return $this->withJson($data)->post('/login/key'); } /** * @param array $data * @return Response * @throws Exception */ public function forgetPassword(array $data) : Response { return $this->withJson($data)->post('forget-password'); } /** * @param array $data * @return Response * @throws Exception */ public function resetPassword(array $data) : Response { return $this->withJson($data)->post('reset-password'); } public function changePluginStatus(array $data) : Response { return $this->withJson($data)->post('/plugin/change-status'); } } ReviewImportAndExportApi.php 0000777 00000004510 15251225702 0012200 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; use Exception; use Rvx\Utilities\Auth\Client; class ReviewImportAndExportApi extends \Rvx\Api\BaseApi { /** * @param array $data * @return Response * @throws Exception */ public function importSupportedAppStore(array $data) : Response { return $this->withJson($data)->post('admin/import/supported/app/store'); } /** * @param array $data * @param array $files * @return Response * @throws Exception */ public function importStore(array $data, array $files) : Response { $file = $files['file']['tmp_name']; $res = $this->withFormData($data)->withFile('file', $file, $files['file']['name'])->post('/reviews/import/store'); return $res; } /** * @param array $data * @return Response * @throws Exception */ public function exportCsv(array $data) : Response { $new_product_ids = []; foreach ($data['product_ids'] as $product_id) { $new_product_ids[] = Client::getUid() . '-' . $product_id; } unset($data['product_ids']); $data['product_wp_unique_ids'] = $new_product_ids; return $this->withJson($data)->post('reviews/exports/generate/csv'); } /** * @return Response * @throws Exception */ public function exportHistory() : Response { return $this->get('reviews/exports/history'); } /** * @return Response * @throws Exception */ public function importHistory() : Response { return $this->get('reviews/import/history'); } /** * @param array $data * @return Response * @throws Exception */ public function importRollback(array $data) : Response { return $this->delete('reviews/import/rollback/' . $data['uid']); } /** * @param array $data * @return Response * @throws Exception */ public function importRestore(array $data) : Response { return $this->withJson($data)->put('admin/import/restore/7kAN-uGTkdlmo-4BAP'); } /** * @param array $data * @return Response * @throws Exception */ public function logImportHistory(array $data) : Response { return $this->withJson($data)->post('reviews/import/log-history'); } } EmailApi.php 0000777 00000011074 15251225702 0006751 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; use Exception; class EmailApi extends \Rvx\Api\BaseApi { /** * @return Response * @throws Exception */ public function index() : Response { return $this->get('email-templates'); } /** * @return Response * @throws Exception */ public function show($id) : Response { return $this->get('email-templates' . $id); } /** * @param array $data * @return Response * @throws Exception */ public function create(array $data) : Response { return $this->withJson($data)->post('email-templates'); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function update(array $data, $uid) : Response { return $this->withJson($data)->put('email-templates/' . $uid); } /** * @param $uid * @return Response * @throws Exception */ public function remove($uid) : Response { return $this->delete('email-templates/' . $uid); } /** * @param $uid * @return Response * @throws Exception */ public function reviewRequest($uid) : Response { return $this->get('review/request/emails' . $uid); } /** * @param $uid * @return Response * @throws Exception */ public function mailRequest($data) : Response { if (!empty($data)) { $callableRoute = 'review/request/emails'; $callableRoute .= '?' . $data; return $this->get($callableRoute); } return $this->get('review/request/emails'); } /** * @return Response * @throws Exception */ public function content() : Response { return $this->get('review/email/contents'); } /** * @param array $data * @return Response * @throws Exception */ public function saveEmailRequest(array $data) : Response { return $this->withJson($data)->post('review/email/request/contents'); } /** * @param array $data * @return Response * @throws Exception */ public function followup(array $data) : Response { return $this->withJson($data)->post('review/email/followup/contents'); } /** * @param array $data * @return Response * @throws Exception */ public function photoReview(array $data) : Response { return $this->withJson($data)->post('review/email/photo/contents'); } /** * @param array $data * @return Response * @throws Exception */ public function testMail(array $data) : Response { return $this->withJson($data)->post('review/email/send-test'); } /** * @param string $uid * @return Response * @throws Exception */ public function emailCancel($uid) : Response { return $this->withJson()->put('/review-request/email/cancel/' . $uid); } /** * @param string $uid * @return Response * @throws Exception */ public function requestEmailSend($data) : Response { $callableRoute = '/review-request/email/send/' . $data['uid']; return $this->withJson($data)->put($callableRoute); } /** * @param string $uid * @return Response * @throws Exception */ public function requestEmailResend($data) : Response { $callableRoute = 'review-request/email/resend/' . $data['uid']; return $this->withJson($data)->put($callableRoute); } /** * @param string $uid * @return Response * @throws Exception */ public function requestEmailUnsubscribe() : Response { return $this->withJson()->put('review-request/unsubscribe/'); } /** * @param string $uid * @return Response * @throws Exception */ public function markAsComplete($uid) : Response { return $this->withJson()->put('/review-request/email/mark-as-done/' . $uid); } /** * @return Response * @throws Exception */ public function reviewRequestSettings() : Response { return $this->get('review/request/settings'); } /** * @param array $data * @return Response * @throws Exception */ public function allReminderSettings(array $data) : Response { if ($data['is_default'] == \true) { return $this->withJson($data)->post('review/request/settings/?' . $data['is_default']); } return $this->withJson($data)->post('review/request/settings'); } } DataSyncApi.php 0000777 00000001214 15251225702 0007423 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; class DataSyncApi extends \Rvx\Api\BaseApi { /** * @param array $files * @param string $from * @param int $total_objects * @return Response * @throws \Exception */ public function dataSync(array $files, string $from = 'register', int $total_objects = 0) : Response { $fileName = $files['tmp_name']; return $this->withFile('file', $fileName, $files['full_path'])->post('sync?from=' . $from . '&total_objects=' . $total_objects); } public function syncStatus() : Response { return $this->get('/get/sync/status'); } } DiscountApi.php 0000777 00000002167 15251225702 0007515 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; class DiscountApi extends \Rvx\Api\BaseApi { /** * @return Response * @throws \Exception */ public function getDiscount() : Response { return $this->get('discount'); } /** * @return Response * @throws \Exception */ public function discountSetting() : Response { return $this->get('discount/settings'); } /** * @return Response * @throws \Exception */ public function discountSettingsSave($data) : Response { return $this->withJson($data)->post('discount/settings'); } public function saveDiscount($data) : Response { return $this->withJson($data)->post('discount'); } public function discountTemplateGet() : Response { return $this->get('discount/template'); } public function discountTemplatePost($data) : Response { return $this->withJson($data)->post('discount/template'); } public function discountMessage($data) : Response { return $this->withJson($data)->post('discount/message'); } } BaseApi.php 0000777 00000002367 15251225702 0006601 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\AbstractApi; use Rvx\Utilities\Auth\Client; use Rvx\Utilities\Helper; class BaseApi extends AbstractApi { protected $response = \Rvx\Api\ApiResponse::class; protected array $config = ['http_errors' => \false]; /** * @return string */ public function getBaseUrl() : string { if (Helper::plugin()->isProduction()) { return "https://api.reviewx.io"; } return "https://api-dev.reviewx.io"; } public function getIp() : string { return '192.168.68.119:10013'; } /** * @return string */ public function getPrefix() : string { return '/admin/api/v1'; } /** * @return array */ public function getDefaultHeaders() : array { return ['Accept' => 'application/json', 'Authorization' => 'Bearer ' . Helper::getAuthToken(), 'X-url' => home_url(), 'X-Domain' => Helper::getWpDomainNameOnly(), 'X-Theme' => wp_get_theme()->get('Name'), 'X-Site-Locale' => get_locale(), 'X-Request-Id' => \sha1(\time() . Client::getUid()), 'X-Wp-Version' => get_bloginfo("version"), 'X-Reviewx-Version' => RVX_VERSION, 'X-Environment' => Helper::plugin()->isProduction() ? 'production' : 'development']; } } SettingApi.php 0000777 00000003627 15251225702 0007344 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; use Rvx\Utilities\Auth\Client; class SettingApi extends \Rvx\Api\BaseApi { public function getApiReviewSettings($data) : Response { $url = 'reviews/settings/get'; if (isset($data['cpt_type'])) { return $this->get($url . '?cpt_type=' . $data['cpt_type']); } return $this->get($url); } public function getApiWidgetSettings() : Response { return $this->get('settings/widget/get'); } public function userCurrentPlan() : Response { return $this->get('user/current/plan'); } public function getLocalSettings($post_type = null) : Response { $uid = Client::getUid(); if ($post_type === null) { $post_type = 'product'; } return $this->get('storefront/' . $uid . '/widgets/settings?cpt_type=' . $post_type); } public function getApiGeneralSettings() : Response { return $this->get('settings/general/get'); } public function saveApiGeneralSettings($data) : Response { $url = 'settings/general/save'; if (isset($data['is_default'])) { return $this->withJson($data)->post($url . '?is_default=' . $data['is_default']); } return $this->withJson($data)->post($url); } public function saveApiReviewSettings($data) { $url = 'reviews/settings/save'; if (isset($data['is_default'])) { return $this->withJson($data)->post($url . '?is_default=' . $data['is_default']); } return $this->withJson($data)->post($url); } public function saveApiWidgetSettings($data) : Response { $url = 'settings/widget/save'; if (isset($data['is_default'])) { return $this->withJson($data)->post($url . '?is_default=' . $data['is_default']); } return $this->withJson($data)->post($url); } } CptApi.php 0000777 00000002423 15251225702 0006446 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; use Exception; class CptApi extends \Rvx\Api\BaseApi { /** * @param $id * @return Response * @throws Exception */ public function cptGet() : Response { return $this->get('custom-post-type'); } /** * @param array $data * @return Response * @throws Exception */ public function cptStore(array $data) : Response { return $this->withJson($data)->post('custom-post-type/store'); } /** * @param $id * @return mixed * @throws Exception */ public function cptDelete($id) { return $this->delete('custom-post-type/' . $id['uid']); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function cptUpdate(array $data, $uid) : Response { $url = 'custom-post-type/' . $uid . '/update'; return $this->withJson($data)->put($url); } /** * @param array $data * @param $uid * @return Response * @throws Exception */ public function cptStatusChange(array $data, $uid) : Response { $url = 'custom-post-type/' . $uid . '/status-change'; return $this->withJson($data)->put($url); } } WebhookRequestApi.php 0000777 00000000501 15251225702 0010662 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; class WebhookRequestApi extends \Rvx\Api\BaseApi { /** * @param array $data * @return Response */ public function finishedWebhook(array $data) : Response { return $this->withJson($data)->post('webhooks/datasync/finished'); } } ApiResponse.php 0000777 00000000534 15251225702 0007517 0 ustar 00 <?php namespace Rvx\Api; use Rvx\Apiz\Http\Response; class ApiResponse extends Response { /** * @return array */ public function getApiData() : array { $response = $this->autoParse(); return $response['data'] ?? []; } public function statusCode() { return $this->getStatusCode(); } }
| ver. 1.6 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка