HEX
Server: Apache
System: Linux p3plzcpnl503801.prod.phx3.secureserver.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User: aqo14e2iyyd9 (9667755)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/aqo14e2iyyd9/public_html/wp-content/plugins/wpforms-geolocation/src/Map.php
<?php

namespace WPFormsGeolocation;

/**
 * Class Map.
 *
 * @since 2.0.0
 */
class Map {

	/**
	 * Print map container.
	 *
	 * @since 2.0.0
	 *
	 * @param string $size Map size.
	 */
	public function print_map( $size ) {

		echo $this->get_map( $size ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
	}


	/**
	 * Get map container.
	 *
	 * @since 2.0.0
	 *
	 * @param string $size Map size. 'medium' by default.
	 *
	 * @return string
	 */
	public function get_map( $size ) {

		return sprintf(
			'<div class="wpforms-field-row %s wpforms-geolocation-map"></div>',
			esc_attr( 'wpforms-field-' . $size )
		);
	}

	/**
	 * Get default latitude and longitude.
	 *
	 * @since 2.0.0
	 *
	 * @return array
	 */
	private function get_default_location() {

		return (array) apply_filters(
			'wpforms_geolocation_map_default_location',
			[
				'lat' => 40.7831,
				'lng' => -73.9712,
			]
		);
	}

	/**
	 * Get default zoom.
	 *
	 * @since 2.0.0
	 *
	 * @return int
	 */
	private function get_zoom() {

		return absint( apply_filters( 'wpforms_geolocation_map_zoom', 9, 'field' ) );
	}

	/**
	 * Get map settings.
	 *
	 * @since 2.0.0
	 *
	 * @return array
	 */
	public function get_settings() {

		return [
			'zoom'   => $this->get_zoom(),
			'center' => $this->get_default_location(),
		];
	}
}