Файловый менеджер - Редактировать - /home/tuudkjt/globeasy/wp-includes/ID3/Shortcodes.tar
Назад
Products/ReviewListFormShortcode.php 0000777 00000013157 15251221530 0013666 0 ustar 00 <?php namespace Rvx\Shortcodes\Products; use Rvx\Utilities\Helper; use Rvx\Form\ReviewFormHelper; use Rvx\Utilities\Auth\Client; use Rvx\WPDrill\Contracts\ShortcodeContract; use Rvx\WPDrill\Facades\View; class ReviewListFormShortcode implements ShortcodeContract { protected ReviewFormHelper $reviewFormHelper; public function render(array $attrs, ?string $content = null) : string { $attrs = shortcode_atts(['title' => null, 'post_id' => null, 'product_id' => null, 'graph' => 'off', 'filter' => 'off', 'list' => 'off', 'form' => 'on', 'designer_id' => null], $attrs); // Validate attributes (early exit on errors) if ($error = $this->validateAttributes($attrs)) { return $error; } $this->reviewFormHelper = new ReviewFormHelper(); $data = $this->attributesData($attrs); if (!$data['postTypeEnabled']) { return $this->error('This post type isn\'t enabled in ReviewX.'); } if (empty($data['product'])) { return $this->error('Unable to determine the `post type` and `id`. Please provide one parameter `post_id` or `product_id`.'); } $attributes = $this->sanitizeAttributes($attrs); $title = $this->resolveTitle($attrs['title'], $data['product']['postTitle']); $formData = $this->reviewFormHelper->builderCustomizedFormTextsData(); return View::render('storefront/shortcode/reviewListForm', ['title' => $title, 'data' => wp_json_encode($data), 'attributes' => $attributes, 'formLevelData' => $formData, 'wooVerificationRequired' => 'yes' === \get_option('woocommerce_review_rating_verification_required'), 'isVerifiedCustomer' => $data['userInfo']['isVerified'], 'requireSignIn' => (bool) \get_option('comment_registration'), 'user_is_logged_in' => $data['userInfo']['isLoggedIn'], 'login_url' => wp_login_url(esc_url(add_query_arg([], wp_unslash($_SERVER['REQUEST_URI'])))), 'register_url' => wp_registration_url(), 'registration_enabled' => (bool) \get_option('users_can_register')]); } private function error(string $message) : string { return '<div class="warning notice notice-error"><b>Error:</b> ' . esc_html($message) . '</div>'; } private function validateAttributes(array $attrs) : ?string { if (!Client::getSync()) { return $this->error('Please complete the synchronization process of ReviewX.'); } if ($attrs['graph'] === 'off' && $attrs['list'] === 'off' && $attrs['form'] === 'off') { return $this->error('Please provide one parameter (graph, list, form) value as `on` in the shortcode.'); } if (!empty($attrs['post_id']) && !empty($attrs['product_id'])) { return $this->error('Please provide either `post_id` or `product_id`. Both are not supported.'); } return null; } private function sanitizeAttributes(array $attrs) : array { $attributes = []; foreach (['graph', 'filter', 'list', 'form'] as $toggle) { $attributes[$toggle] = !empty($attrs[$toggle]) ? esc_attr($attrs[$toggle]) : 'off'; } $attributes['designer_id'] = $attrs['designer_id'] ? esc_attr($attrs['designer_id']) : null; return $attributes; } private function resolveTitle(?string $attrTitle, string $postTitle) : string { if ($attrTitle === 'false') { return 'false'; } if ($attrTitle === 'true' || empty($attrTitle)) { return $postTitle; } return esc_html($attrTitle); } private function attributesData(array $attrs) : array { global $post; $type = []; // Case 1: If shortcode explicitly provides post_id or product_id if (!empty($attrs['post_id']) || !empty($attrs['product_id'])) { $id = !empty($attrs['post_id']) ? (int) $attrs['post_id'] : (int) $attrs['product_id']; $postObj = get_post($id); $type = ['id' => $id, 'postType' => $postObj ? \strtolower($postObj->post_type) : 'rvx_no_post_type', 'postTitle' => $postObj ? esc_html(get_the_title($postObj)) : '']; } // Case 2: If no ID provided, use current singular post if (is_singular() && empty($attrs['post_id']) && empty($attrs['product_id'])) { $type = ['id' => $post ? (int) $post->ID : 0, 'postType' => $post && $post->post_type ? \strtolower($post->post_type) : 'rvx_no_post_type', 'postTitle' => $post && $post->post_title ? esc_html($post->post_title) : '']; } // Validate if post type is enabled in ReviewX $enabledPostTypes = $this->reviewFormHelper->rvxEnabledPostTypes(); $currentPostType = $type['postType'] ?? null; $postTypeEnabled = isset($currentPostType, $enabledPostTypes[$currentPostType]) && \strtolower($enabledPostTypes[$currentPostType]) === $currentPostType; // User info $userId = get_current_user_id(); $wpCurrentUser = Helper::getWpCurrentUser(); $isVerifiedCustomer = 0; if (\class_exists('WooCommerce') && is_singular('product') && 'product' === get_post_type()) { $isVerifiedCustomer = Helper::verifiedCustomer($userId); } return ['postTypeEnabled' => $postTypeEnabled, 'product' => $type, 'userInfo' => ['isLoggedIn' => Helper::loggedIn(), 'id' => $wpCurrentUser ? (int) $wpCurrentUser->ID : 0, 'name' => $wpCurrentUser && $wpCurrentUser->display_name ? $wpCurrentUser->display_name : '', 'email' => $wpCurrentUser && $wpCurrentUser->user_email ? $wpCurrentUser->user_email : '', 'isVerified' => $isVerifiedCustomer], 'domain' => ['baseDomain' => Helper::domainSupport(), 'baseRestUrl' => Helper::getRestAPIurl()]]; } } Products/ReviewShowWIthIdsShortcode.php 0000777 00000003345 15251221530 0014301 0 ustar 00 <?php namespace Rvx\Shortcodes\Products; use Rvx\Utilities\Auth\Client; use Rvx\Utilities\Helper; use Rvx\WPDrill\Contracts\ShortcodeContract; use Rvx\WPDrill\Facades\View; class ReviewShowWIthIdsShortcode implements ShortcodeContract { public function render(array $attrs, ?string $content = null) : string { $attrs = shortcode_atts(['title' => 'false', 'review_ids' => null], $attrs); // Check if both product_id and post_id are provided. if (!Client::getSync()) { return '<div class="warning">Error: Please complete the synchronization process of ReviewX.</div>'; } // If review_ids is not provided, return an error. if (empty($attrs['review_ids'])) { return '<div class="warning">Error: Please provide "review_ids" in the shortcode.</div>'; } $reviewsIds = $attrs['review_ids']; $productIdArray = []; // If review_ids is not null, process it if ($reviewsIds) { // Split review_ids by commas and trim whitespace $productIdArray = \array_map('trim', \explode(',', $reviewsIds)); // Send multiple product IDs to the JavaScript variable $data = $this->reviewsWiseReviewShow($productIdArray); // Return the view (empty or simplified, as no review data is required) return View::render('storefront/shortcode/reviewShowWIthIds', ['title' => $attrs['title'], 'data' => \json_encode($data)]); } return ''; } public function reviewsWiseReviewShow($reviewsIds) : array { $attributes = ['ids' => $reviewsIds, 'domain' => ['baseDomain' => Helper::domainSupport(), 'baseRestUrl' => Helper::getRestAPIurl()]]; return $attributes; } } Products/ReviewGraphShortcode.php 0000777 00000003657 15251221530 0013174 0 ustar 00 <?php namespace Rvx\Shortcodes\Products; use Rvx\Utilities\Auth\Client; use Rvx\Utilities\Helper; use Rvx\WPDrill\Contracts\ShortcodeContract; use Rvx\WPDrill\Facades\View; class ReviewGraphShortcode implements ShortcodeContract { public function render(array $attrs, ?string $content = null) : string { $attrs = shortcode_atts(['title' => null, 'product_id' => null, 'post_id' => null], $attrs); // Check if both product_id and post_id are provided. if (!Client::getSync()) { return '<div class="warning">Error: Please complete the synchronization process of ReviewX.</div>'; } // Check if both product_id and post_id are provided. if (!empty($attrs['product_id']) && !empty($attrs['post_id'])) { return '<div class="warning">Error: Please use only one of "product_id" or "post_id" in the shortcode.</div>'; } // Determine whether we're dealing with a product or a post. $isProduct = !empty($attrs['product_id']); $id = $isProduct ? (int) $attrs['product_id'] : (int) $attrs['post_id']; $data = $this->productWiseReviewShow($id, $isProduct); // Title handling if ($attrs['title'] === 'false') { $title = 'false'; } elseif ($attrs['title'] === 'true' || empty($attrs['title'])) { $title = $data['postTitle']; } else { $title = esc_html($attrs['title']); } return View::render('storefront/shortcode/reviewGraph', ['title' => $title, 'data' => \json_encode($data)]); } public function productWiseReviewShow($id, bool $isProduct) : array { $post = get_post($id); $attributes = ['product' => ['id' => $id], 'postTitle' => $post ? $post->post_title : \false, 'postType' => $post ? $post->post_type : '', 'domain' => ['baseDomain' => Helper::domainSupport(), 'baseRestUrl' => Helper::getRestAPIurl()]]; return $attributes; } } Products/ReviewSummaryShortcode.php 0000777 00000004253 15251221530 0013561 0 ustar 00 <?php namespace Rvx\Shortcodes\Products; use Rvx\Utilities\Auth\Client; use Rvx\Utilities\Helper; use Rvx\WPDrill\Contracts\ShortcodeContract; use Rvx\WPDrill\Facades\View; class ReviewSummaryShortcode implements ShortcodeContract { public function render(array $attrs, ?string $content = null) : string { // Define default attributes to accept both product_id and post_id. $attrs = shortcode_atts(['title' => null, 'product_id' => null, 'post_id' => null], $attrs); // Check if both product_id and post_id are provided. if (!Client::getSync()) { return '<div class="warning">Error: Please complete the synchronization process of ReviewX.</div>'; } // If both IDs are provided, return an error. if (!empty($attrs['product_id']) && !empty($attrs['post_id'])) { return '<div class="warning">Error: Please use only one of "product_id" or "post_id" in the shortcode.</div>'; } // Determine the type and set the ID. $isProduct = !empty($attrs['product_id']); $id = $isProduct ? (int) $attrs['product_id'] : (int) $attrs['post_id']; // Prepare the data. $data = $this->productWiseReviewShow($id, $isProduct); // Title handling if ($attrs['title'] === 'false') { $title = 'false'; } elseif ($attrs['title'] === 'true' || empty($attrs['title'])) { $title = $data['postTitle']; } else { $title = esc_html($attrs['title']); } return View::render('storefront/shortcode/reviewSummary', ['title' => $title, 'data' => \json_encode($data)]); } /** * Build the data structure for the review summary. * * @param int $id * @param bool $isProduct * @return string JSON encoded attributes. */ public function productWiseReviewShow($id, $isProduct) : array { $post = get_post($id); $attributes = ['product' => ['id' => $id], 'postTitle' => $post ? $post->post_title : \false, 'postType' => $post ? $post->post_type : '', 'domain' => ['baseDomain' => Helper::domainSupport(), 'baseRestUrl' => Helper::getRestAPIurl()]]; return $attributes; } } Products/WooReviewsFormShortcode.php 0000777 00000003241 15251221530 0013673 0 ustar 00 <?php namespace Rvx\Shortcodes\Products; use Rvx\Utilities\Auth\Client; use Rvx\WPDrill\Contracts\ShortcodeContract; class WooReviewsFormShortcode implements ShortcodeContract { public function render(array $attrs, ?string $content = null) : string { $attrs = shortcode_atts(['title' => null, 'post_id' => null, 'product_id' => null, 'graph' => 'on', 'filter' => 'on', 'list' => 'on', 'form' => 'on'], $attrs); // Check if both product_id and post_id are provided. if (!Client::getSync()) { return '<div class="warning">Error: Please complete the synchronization process of ReviewX.</div>'; } if ($attrs['graph'] == 'off' && $attrs['list'] == 'off' && $attrs['form'] == 'off') { return '<div class="warning notice notice-error"><b>Error:</b> Please provide one parameter (graph, list, form) value as `on` in the shortcode.</div>'; } if (!empty($attrs['post_id']) && !empty($attrs['product_id'])) { return '<div class="warning notice notice-error"><b>Error:</b> Please provide one parameter `post_id` or `product_id`. Both in the same shortcode isn\'t supported.</div>'; } $title = esc_attr($attrs['title']) ?: 'false'; $type_name = !empty($attrs['product_id']) ? ' product_id="' . esc_attr($attrs['product_id']) . '"' : (!empty($attrs['post_id']) ? ' post_id="' . esc_attr($attrs['post_id']) . '"' : ''); return do_shortcode('[rvx-review-form title="' . $title . '" filter="' . esc_attr($attrs['filter']) . '" ' . $type_name . ' graph="' . esc_attr($attrs['graph']) . '" list="' . esc_attr($attrs['list']) . '" form="' . esc_attr($attrs['form']) . '"]'); } } Products/ReviewStatshortcode.php 0000777 00000004624 15251221530 0013101 0 ustar 00 <?php namespace Rvx\Shortcodes\Products; use Rvx\Utilities\Auth\Client; use Rvx\Utilities\Helper; use Rvx\WPDrill\Contracts\ShortcodeContract; use Rvx\WPDrill\Facades\View; class ReviewStatshortcode implements ShortcodeContract { public function render(array $attrs, ?string $content = null) : string { // Set default attributes to include both product_id and post_id. $attrs = shortcode_atts(['title' => null, 'product_id' => null, 'post_id' => null], $attrs); // Check if both product_id and post_id are provided. if (!Client::getSync()) { return '<div class="warning">Error: Please complete the synchronization process of ReviewX.</div>'; } // If both product_id and post_id are provided, return an error. if (!empty($attrs['product_id']) && !empty($attrs['post_id'])) { return '<div class="warning">Error: Please use only one of "product_id" or "post_id" in the shortcode.</div>'; } // Determine whether this is for a product or a post. $isProduct = !empty($attrs['product_id']); $id = $isProduct ? (int) $attrs['product_id'] : (int) $attrs['post_id']; // Retrieve data related to review stats. $data = $this->getReviewStatsData($id, $isProduct); // Title handling if ($attrs['title'] === 'false') { $title = 'false'; } elseif ($attrs['title'] === 'true' || empty($attrs['title'])) { $title = $data['postTitle']; } else { $title = esc_html($attrs['title']); } // If no title is provided, use the post title from the data. return View::render('storefront/shortcode/reviewStats', ['title' => $title, 'postType' => !empty($data['postType']) ? $data['postType'] : '', 'data' => \json_encode($data)]); } /** * Retrieve review stats data based on an ID and its type (product or post). * * @param int $id * @param bool $isProduct * * @return array */ public function getReviewStatsData(int $id, bool $isProduct) : array { // Retrieve the post object. $post = get_post($id); $defaultData = ['product' => ['id' => $id], 'postTitle' => $post ? $post->post_title : \false, 'postType' => $post ? $post->post_type : '', 'domain' => ['baseDomain' => Helper::domainSupport(), 'baseRestUrl' => Helper::getRestAPIurl()]]; return $defaultData; } } Products/ReviewListShortcode.php 0000777 00000007447 15251221530 0013047 0 ustar 00 <?php namespace Rvx\Shortcodes\Products; use Rvx\WPDrill\Contracts\ShortcodeContract; use Rvx\Utilities\Helper; use Rvx\Form\ReviewFormHelper; use Rvx\Utilities\Auth\Client; use Rvx\WPDrill\Facades\View; class ReviewListShortcode implements ShortcodeContract { protected $reviewFormHelper; public function render(array $attrs, ?string $content = null) : string { $attrs = shortcode_atts(['title' => null, 'post_type' => null, 'post_id' => null, 'product_id' => null, 'sort_by' => null, 'attachment' => null, 'rating' => null, 'filter' => 'on'], $attrs); // Check if both product_id and post_id are provided. if (!Client::getSync()) { return '<div class="warning">Error: Please complete the synchronization process of ReviewX.</div>'; } // If both product_id and post_id are provided, return an error. if (!empty($attrs['product_id']) && !empty($attrs['post_id'])) { return '<div class="warning notice notice-error"><b>Error:</b> Please use only one of `product_id` or `post_id` in the shortcode.</div>'; } // If post_type provided with product_id and/or post_id, return an error if (!empty($attrs['post_type']) && (!empty($attrs['product_id']) || !empty($attrs['post_id']))) { return '<div class="warning notice notice-error"><b>Error:</b> Post type can\'t be used with `product_id` and/or `post_id` in the shortcode.</div>'; } if (!empty($attrs['product_id']) || !empty($attrs['post_id'])) { $title = esc_attr($attrs['title']) ?: 'true'; $type_name_id = !empty($attrs['product_id']) ? ' product_id="' . esc_attr($attrs['product_id']) . '"' : (!empty($attrs['post_id']) ? ' post_id="' . esc_attr($attrs['post_id']) . '"' : ''); return do_shortcode('[rvx-review-form title="' . $title . '" filter="' . esc_attr($attrs['filter']) . '" ' . $type_name_id . ' graph="off" list="on" form="off"]'); } if (!empty($attrs['post_type']) || empty($attrs['product_id']) && empty($attrs['post_id'])) { $this->reviewFormHelper = new ReviewFormHelper(); $data = $this->attributesData($attrs); if ($data['post_type_enabled'] == \false && !empty(esc_attr($attrs['post_type']))) { return '<div class="warning notice notice-error"><b>Error:</b> This post type isn\'t enabled in ReviewX.</div>'; } $title = !isset($attrs['title']) || $attrs['title'] === 'false' ? 'false' : esc_html($attrs['title']); return View::render('storefront/shortcode/reviewList', ['title' => $title, 'data' => $data]); } return '<div class="warning notice notice-error"><b>Error:</b> Please, make sure you have provided necessary parameter\'(s) in the shortcode. Please, follow documentation.</div>'; } public function attributesData(array $attrs) : array { $postTypeEnable = 0; $postType = null; if (!empty($attrs['post_type'])) { $enabled_post_types = $this->reviewFormHelper->rvxEnabledPostTypes(); $currentPostType = esc_attr($attrs['post_type']) ?: 'rvx_no_post_type'; $postType = esc_attr($attrs['post_type']) ?: null; if (isset($enabled_post_types[$currentPostType]) && \strtolower($enabled_post_types[$currentPostType]) == $currentPostType) { $postTypeEnable = 1; } } $attributes = ['post_type_enabled' => $postTypeEnable, 'filter' => esc_attr($attrs['filter']) ?: 'off', 'params' => ['post_type' => $postType, 'sort_by' => esc_attr($attrs['sort_by']) ?: '', 'attachment' => esc_attr($attrs['attachment']) ?: '', 'rating' => esc_attr($attrs['rating']) ?: ''], 'domain' => ['baseDomain' => Helper::domainSupport(), 'baseRestUrl' => Helper::getRestAPIurl()]]; return $attributes; } } Products/ReviewStarCountShortcode.php 0000777 00000007075 15251221530 0014053 0 ustar 00 <?php namespace Rvx\Shortcodes\Products; use Rvx\Form\ReviewFormHelper; use Rvx\Utilities\Auth\Client; use Rvx\Utilities\Helper; use Rvx\WPDrill\Contracts\ShortcodeContract; use Rvx\WPDrill\Facades\View; class ReviewStarCountShortcode implements ShortcodeContract { public function render(array $attrs, ?string $content = null) : string { $attrs = shortcode_atts(['title' => 'false', 'product_id' => null, 'post_id' => null, 'info' => 'default'], $attrs); // Ensure ReviewX sync is complete if (!Client::getSync()) { return '<div class="warning">Error: Please complete the synchronization process of ReviewX.</div>'; } $productId = !empty($attrs['product_id']) ? (int) $attrs['product_id'] : 0; $postId = !empty($attrs['post_id']) ? (int) $attrs['post_id'] : 0; // Prevent both IDs at once if ($productId && $postId) { return '<div class="warning">Error: Please use only one of "product_id" or "post_id" in the shortcode.</div>'; } // Determine the final ID to use $id = $productId ?: $postId; // Auto-detect from global post if neither ID provided if (!$productId && !$postId) { global $post; } else { $post = get_post($id); } if (!$post) { return '<div class="warning">No post or product found!</div>'; } $data = $this->getReviewsData($post); if (!$data['post_type_enabled']) { return '<div class="warning notice notice-error"><b>Error:</b> This post type isn\'t enabled in ReviewX.</div>'; } // Title handling if ($attrs['title'] === 'false') { $title = 'false'; } elseif ($attrs['title'] === 'true' || empty($attrs['title'])) { $title = $data['postTitle']; } else { $title = esc_html($attrs['title']); } return View::render('storefront/shortcode/reviewsStarCount', ['title' => $title, 'data' => $data, 'info' => $attrs['info'] ?: 'default', 'postType' => $data['postType']]); } private function getReviewsData($post) : array { $id = $post->ID ?? 0; // Check enabled post types even if $post is null $enabledPostTypes = (new ReviewFormHelper())->rvxEnabledPostTypes(); $postTypeEnabled = 0; if ($post) { $postTypeEnabled = isset($enabledPostTypes[\strtolower($post->post_type)]) ? 1 : 0; } // Default data $defaultData = ['product' => ['id' => $id, 'post' => $id], 'starCount' => 0.0, 'reviewsCount' => 0, 'post_type_enabled' => $postTypeEnabled, 'postTitle' => $post->post_title ?? '', 'postType' => $post->post_type ?? '', 'domain' => ['baseDomain' => Helper::domainSupport(), 'baseRestUrl' => Helper::getRestAPIurl()]]; if (!$post) { return $defaultData; } // Get actual star/review counts if ($post->post_type === 'product') { $defaultData['starCount'] = (float) \get_post_meta($id, '_wc_average_rating', \true); $defaultData['reviewsCount'] = (int) \get_post_meta($id, '_wc_review_count', \true); } else { $defaultData['starCount'] = (float) \get_post_meta($id, 'rvx_avg_rating', \true); $defaultData['reviewsCount'] = (int) \get_post_meta($id, 'rvx_total_reviews', \true); // Fallback to comment_count if meta is not set yet if (!$defaultData['reviewsCount']) { $defaultData['reviewsCount'] = (int) $post->comment_count; } } return $defaultData; } } GoogleReviewLIst.php 0000777 00000006456 15251221530 0010465 0 ustar 00 <?php namespace Rvx\Shortcodes; use Rvx\Api\GoogleReviewApi; use Rvx\Utilities\Auth\Client; use Rvx\WPDrill\Contracts\ShortcodeContract; use Rvx\WPDrill\Facades\View; use Rvx\Services\GoogleReviewService; class GoogleReviewLIst implements ShortcodeContract { protected $googleReview; protected $googleReviewService; public function __construct() { $this->googleReview = new GoogleReviewApi(); $this->googleReviewService = new GoogleReviewService(); } public function render(array $attrs, ?string $content = null) : string { $attrs = shortcode_atts(['title' => null, 'id' => null, 'truncate' => '300', 'limit' => '3', 'loadmore' => 'false', 'cache' => null], $attrs); // Check if both product_id and post_id are provided. if (!Client::getSync()) { return '<div class="warning">Error: Please complete the synchronization process of ReviewX.</div>'; } // Fetch cached/validated API credentials $credentials = $this->getGoogleApiCredentials(); // Bail out early if invalid if (empty($credentials['google_api_key']) || empty($credentials['google_place_id_or_url'])) { return '<div class="warning">Error: Please configure your Google API Key and Place ID/URL in ReviewX.</div>'; } // Fetch reviews $reviews = $this->reviews($attrs['cache'], $credentials); $title = isset($attrs['title']) && $attrs['title'] === 'false' ? 'false' : ($attrs['title'] === 'true' || empty($attrs['title']) ? 'Google Reviews' : esc_html($attrs['title'])); return View::render('storefront/shortcode/googleReviewList', ['title' => $title, 'content' => $reviews, 'reviewLimit' => (int) $attrs['limit'] ?: 3, 'loadMore' => !empty($attrs['loadmore']) ? $attrs['loadmore'] : \true, 'truncateLimit' => !empty($attrs['truncate']) ? $attrs['truncate'] : 300]); } protected function reviews($cache_time, array $credentials) { $place_id = $credentials['google_place_id_or_url']; $cache_key = 'rvx_google_reviews_cache_' . \md5($place_id); $cached_reviews = \get_transient($cache_key); if ($cached_reviews !== \false) { return $cached_reviews; } $reviews = $this->googleReview->googleReviewGet(); $reviews = \json_decode($reviews, \true); $cache_duration = (int) $cache_time ?: DAY_IN_SECONDS; \set_transient($cache_key, $reviews['data'], $cache_duration); if (empty($reviews['data']['reviews'])) { return []; } return $reviews['data']; } /** * Get and cache Google API credentials for 1 hour. * * @return array */ protected function getGoogleApiCredentials() : array { $cached = \get_transient('rvx_google_api_settings'); if ($cached !== \false) { return $cached; } // Already returns array $response = $this->googleReviewService->googleReviewPlaceApi(); $response = \json_decode($response, \true); $response = $response['data']['creadential']['google_place']; \set_transient('rvx_google_api_settings', $response, HOUR_IN_SECONDS); if (empty($response['google_api_key']) || empty($response['google_place_id_or_url'])) { return []; } return $response; } }
| ver. 1.6 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка