Файловый менеджер - Редактировать - /home/avadvi5/public_html/fcolliver.com/wp-content/plugins/wpforms-geolocation/src/PlacesProviders/GooglePlaces.php
Ðазад
<?php namespace WPFormsGeolocation\PlacesProviders; use WPFormsGeolocation\Admin\Settings\Settings; use WPFormsGeolocation\Admin\Settings\GooglePlaces as SettingsGooglePlaces; /** * Class GooglePlaces. * * @since 2.0.0 */ class GooglePlaces implements IPlacesProvider { /** * Init Google Places provider. * * @since 2.0.0 */ public function init() { if ( ! $this->is_active() ) { return; } add_action( 'wpforms_frontend_css', [ $this, 'enqueue_styles' ] ); add_action( 'wpforms_frontend_js', [ $this, 'enqueue_scripts' ] ); } /** * Enqueue styles. * * @since 2.0.0 * * @param array $forms List of forms. */ public function enqueue_styles( $forms ) { $min = wpforms_get_min_suffix(); wp_enqueue_style( 'wpforms-geolocation-google-places', WPFORMS_GEOLOCATION_URL . "assets/css/wpforms-geolocation-google{$min}.css", [], WPFORMS_GEOLOCATION_VERSION ); } /** * Enqueue scripts. * * @since 2.0.0 * * @param array $forms List of forms. */ public function enqueue_scripts( $forms ) { $min = wpforms_get_min_suffix(); wp_enqueue_script( 'wpforms-geolocation-google-places', WPFORMS_GEOLOCATION_URL . "assets/js/wpforms-geolocation-google-api{$min}.js", [], WPFORMS_GEOLOCATION_VERSION, false ); wp_localize_script( 'wpforms-geolocation-google-places', 'wpforms_geolocation_google_places', [ 'l10n' => [ 'apiError' => $this->get_api_error_message(), ], ] ); /** * Allow developers to filter query args when enqueuing Google Geolocation script. * * @since 2.2.0 * * @param array $query_args Query arguments. */ $query_args = (array) apply_filters( 'wpforms_geolocation_places_providers_google_places_query_args', [ 'key' => wpforms_setting( Settings::SLUG . '-' . SettingsGooglePlaces::SLUG . '-api-key' ), 'libraries' => 'places', 'callback' => 'WPFormsGeolocationInitGooglePlacesAPI', 'loading' => 'async', ] ); // phpcs:disable WordPress.WP.EnqueuedResourceParameters.MissingVersion wp_enqueue_script( 'google-geolocation-api', add_query_arg( $query_args, 'https://maps.googleapis.com/maps/api/js' ), [ 'wpforms-geolocation-google-places' ], null, true ); // phpcs:enable WordPress.WP.EnqueuedResourceParameters.MissingVersion } /** * Determine whether the Google Places provider is active. * * @since 2.0.0 * * @return bool */ public function is_active() { return (bool) wpforms_setting( Settings::SLUG . '-' . SettingsGooglePlaces::SLUG . '-api-key' ); } /** * Get an API error message. * * @since 2.12.0 * * @return string */ private function get_api_error_message(): string { return sprintf( /* translators: %1$s - Google Cloud Console link. */ esc_html__( 'This API key is not authorized to use this service or API. Please check the API restrictions settings of your API key in the %1$s to ensure that all of the APIs and services you need to use are correctly specified in the list of enabled APIs.', 'wpforms-geolocation' ), '<a href="https://console.cloud.google.com/" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Google Cloud Console', 'wpforms-geolocation' ) . '</a>' ); } }
| ver. 1.1 | |
.
| PHP 8.3.30 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка