�PNG  IHDR22?�� pHYs  �� OiCCPPhotoshop ICC profilexڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q, � ��!���������{�kּ������>���� �H3Q5� �B�������.@� $p�d!s�#�~<<+"��x� �M��0���B�\���t�8K�@z�B�@F���&S�`�cb�P-`'������{[�!�� e�Dh;��V�EX0fK�9�-0IWfH���� � 0Q��){`�##x��F�W<�+��*x��<�$9E�[-qWW.(�I+6aa�@.�y�2�4���������x����6��_-��"bb���ϫp@�t~��,/��;�m��%�h^ �u��f�@����W�p�~<�5�j>{�-�]c�K'Xt����o��(�h���w��?�G�%�fI�q^D$.Tʳ?�D��*�A��,���� �`6�B$��BB d�r`)��B(�Ͱ*`/�@4�Qh��p.�U�=p�a��(�� A�a!ڈb�X#����!�H�$ ɈQ"K�5H1R�T UH�=r9�\F��;�2����G1���Q=� �C��7�F� �dt1�����r�=�6��Ыhڏ>C�0��3�l0.��B�8, �c˱"� ���V����cϱw�E� 6wB aAHXLXN�H� $4� 7 �Q�'"��K�&���b21�XH,#��/{�C�7$�C2'��I��T��F�nR#�,��4H#���dk�9�, +ȅ����3��!�[ �b@q��S�(R�jJ��4�e�2AU��Rݨ�T5�ZB���R�Q��4u�9̓IK�����hh�i��t�ݕN��W���G���w ��Ljg(�gw��L�Ӌ�T071���oUX*�*|�� �J�&�*/T����ު U�U�T��^S}�FU3S� Ԗ�U��P�SSg�;���g�oT?�~Y��Y�L�OC�Q��_�� c�x,!k ��u�5�&���|v*�����=���9C3J3W�R�f?�q��tN �(���~���)�)�4L�1e\k����X�H�Q�G�6������E�Y��A�J'\'Gg����S�Sݧ �M=:��.�k���Dw�n��^��Lo��y���}/�T�m���G X� $� �<�5qo</���QC]�@C�a�a�ᄑ��<��F�F�i�\�$�m�mƣ&&!&KM�M�RM��)�;L;L���͢�֙5�=1�2��כ߷`ZxZ,����eI��Z�Yn�Z9Y�XUZ]�F���%ֻ�����N�N���gð�ɶ�����ۮ�m�}agbg�Ů��}�}��= ���Z~s�r:V:ޚΜ�?}����/gX���3��)�i�S��Ggg�s�󈋉K��.�>.���Ƚ�Jt�q]�z���������ۯ�6�i�ܟ�4�)�Y3s���C�Q��? ��0k߬~OCO�g��#/c/�W�װ��w��a�>�>r��>�<7�2�Y_�7��ȷ�O�o�_��C#�d�z����%g��A�[��z|!��?:�e����A���AA�������!h�쐭!��Α�i�P~���a�a��~ '���W�?�p�X�1�5w��Cs�D�D�Dޛg1O9�-J5*>�.j<�7�4�?�.fY��X�XIlK9.*�6nl������� �{�/�]py�����.,:�@L�N8��A*��%�w%� y��g"/�6ш�C\*N�H*Mz�쑼5y$�3�,幄'���L Lݛ:��v m2=:�1����qB�!M��g�g�fvˬe����n��/��k���Y- �B��TZ(�*�geWf�͉�9���+��̳�ې7�����ᒶ��KW-X潬j9�������(�x��oʿ�ܔ���Ĺd�f�f���-�[����n �ڴ �V����E�/��(ۻ��C���<��e����;?T�T�T�T6��ݵa��n��{��4���[���>ɾ�UUM�f�e�I���?�������m]�Nmq����#�׹���=TR��+�G�����w- 6 U����#pDy��� �� :�v�{���vg/jB��F�S��[b[�O�>����z�G��499�?r����C�d�&����ˮ/~�����јѡ�򗓿m|������������x31^�V���w�w��O�| (�h���SЧ��������c3-� cHRMz%������u0�`:�o�_�F5IDATx��ytUս�?�;���fN$$��@B�!�k��� -*�gE���j�O�kQ�ʠ`U�B_ �AÐ0%�Ȕ�@r3ޛ;߳��$�@��v����^�s����������$��ߢ !�W��5�̱'-٘������4�>�Rƫ$�G��0U�H}�_ _� #��k�MJ/=�9Du *ڲ�k�PQ;0��j|�*�$�^컂脛y���>�z×� B��� ��(�:$�ʔ_�6��C!B����MVx��a��ζyY����j��ƋY2�9�F�{r��r�딟F��Q��hY6��� x��[l��RC��������nt@��;P��3��� F�w��7��:�P���ɋ'���mj���Bƪ�$�Q�L��y��߷g��\���z����v5�p�v$�v櫻�`6~K �Y�X����,�:��"�o�e0II"(��,������l_�C���/4�+f�E�!q��:����u����c��樼.UE�@� �]K�W���$-�h]�JG���Dz)�`��.�A/ ���mᏣc�3jK� �!�>���$�Q�!�_�? \�C2(E �M$Z I{�U���s�ǣ���=��@Բe ޻��W�����@ �w����}�9v,)��.}*|"�s��di���,���G�]W�AC�������|<����[��ߕ������K�*�G nߴ!��‹��J�!��6(L�a)��Am��������;adf��:�xm��nh�;֦I��(���o�C~ډa?�=��s����h��E������xp����)���_���t��W�����´;8���`dz=(��@@�+,�;�`�fhl��XȌ�3,uI�~z(J����� �ZX�A����H'�À�㜦�82|��a�n�z2��I���� ���EY�h�ε<�0�q�{��C��v�˅��?"@��χ�x�WS+��N�~�KQ�J�8ل�� _.W��� !TU{�����,��"�� �;�������HI S� ��))�o�1�H�D� ���� (� ;����"Ҕ��,���� �F=���O��&�Ph>�`���y��߲ &S��P�<��'��1s�1cĂ�N����2)����@�u��tv��<�+�-&�����h��[!FSG���' � z z0��<����8d&�����E0�,��<��"!P�b4��� �{S�����X����.�囤���T��hEF��X�q0"-<����h���]�Py*����F⩍��@v�˂�Y08�� .q��a��s����(!<̫1�3�L�H��7sYW�`��qtu�\7��?�@�Y�� %Ka�x�GZ�*W�P��y�����N0r9��Z�c�%���q,��k�����!!,��>���IB��� �x1�Xu�Y���v-���ֺ��N������JP��a�2`�e5��w��u;�6�i���̃��(K���ťa��(l51��JL��O'%���]���ٖ뿉!��{*�p+f ���i8��D�ȑ���ܩ�M��V��ӟz��x�7Z�1i}�^͜���6e����x��)u�d�ˏ�V�eG�\�X1�����=n�U'�~Y����L�\,�(d!x ,�:�TW8� M`r���@��r+v�Q0��>^;˴�VbF��('����� �*O��i��j�Ӆ����^�S3&� ���{������.ی�� N;��NU%d0�Ce\r"�C�b��&t7N�7��� �ȪD�[%l�۪�$��'m?�A9tI�9>��NVL ��� 6v~M�����ъ�B���0����9$&=ώm��W�0���L���&��E���f�f��'+�9��hv��7,���M��6�D�&�^� �����8 D֮�����o��k^z��O��hP�8q�5d*��YVq3�{��������#LX4�?��jP=3�~�؅c�ݰ�̱�ұ��8̲��2�G�����j��έ�9��w7���U�X�w�85C��?!I&���o&����L���I#�^�eV�,�^t5�k� �xs˛\��U�8��."���{���ǵ�l4��ݼ�;��r"���G�/~���gJV�N糦��ZZ^k+NN�D��I$�=OE�z����|*�*{��%k���G��>�`9��b;�s���8,�qs��c��.b��q�%�>r��n�R�Ƨ�%�,�A��le#�8���}; 21�0�b�&�QX�f���q�00����$>�h�N�'�a3��A���/�r ��L5�8�GԲ'�����w;��c#�q1���h$*��V^�k��QĽ�b:i������� ����H F#�_���,��]g����Ը����`RUU���� ��"�qD���>-��ϤI�~��3�̴�����NZ[[555�eeek7�m����YF#[��Đ��R��i��L�H�r ��@��J-�Pŝ��_|�-��6y��ks�V�U~��6���w.����(��0A� 4��f��� /���C�xŊ�ٳ����z=6�����rg���mKo��o�/����a�g���?'9%9��P��斓��~���L{�� �H��{AW��B��$����v�1b�&Mb�ر��ر#�0`�`xMBp! )Z�Nmo�mZ�g�}�eذaWTVV ���'99��C5��&�&+5�bT>|8��PUUETT����&���t��~TE%��'������b�tEGG;RSS�S�N�v��ѯ��t����u1@�ޚ"f��͈���r'L�Ph��m��ƌ�74o��`�x�q�P���NRSS�X,�����l&&&��MFFA!-��`��ҷ�n��Yuu�����x<I�LB%����KԒ50�!�3�bz�����ʸKL���;---�l6[��`��������Ȏ;�����egg4��!D�T��jWujyZ��������K����%����p�^���X,6��sV=�ܖ����6�3�X ���4ҿ��A2�&����_k�;d�� �VfOIEND�B`�
Warning: session_start(): Session cannot be started after headers have already been sent in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 124

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 131

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 132

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 133

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 134

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 135
0x0x
PHP 8.2.31
Preview: contact-info.php Size: 17.95 KB
/home/mciraet/www/wp-content/plugins/jetpack/modules/widgets/contact-info.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName

// phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files.

use Automattic\Jetpack\Assets;
use Automattic\Jetpack\Redirect;

if ( ! defined( 'ABSPATH' ) ) {
	exit( 0 );
}

if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {

	/**
	 * Register Contact_Info_Widget widget
	 */
	function jetpack_contact_info_widget_init() {
		register_widget( 'Jetpack_Contact_Info_Widget' );
	}

	add_action( 'widgets_init', 'jetpack_contact_info_widget_init' );

	/**
	 * Makes a custom Widget for displaying Restaurant Location/Map, Hours, and Contact Info available.
	 *
	 * @package WordPress
	 */
	class Jetpack_Contact_Info_Widget extends WP_Widget {

		/**
		 * Constructor
		 */
		public function __construct() {
			global $pagenow;

			$widget_ops = array(
				'classname'                   => 'widget_contact_info',
				'description'                 => __( 'Display a map with your location, hours, and contact information.', 'jetpack' ),
				'customize_selective_refresh' => true,
				'show_instance_in_rest'       => true,
			);
			parent::__construct(
				'widget_contact_info',
				/** This filter is documented in modules/widgets/facebook-likebox.php */
				apply_filters( 'jetpack_widget_name', __( 'Contact Info & Map', 'jetpack' ) ),
				$widget_ops
			);
			$this->alt_option_name = 'widget_contact_info';

			if ( is_customize_preview() ) {
				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
			} elseif ( 'widgets.php' === $pagenow ) {
				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
			}

			add_action( 'wp_ajax_customize-contact-info-api-key', array( $this, 'ajax_check_api_key' ) );
			add_filter( 'widget_types_to_hide_from_legacy_widget_block', array( $this, 'hide_widget_in_block_editor' ) );
		}

		/**
		 * Remove the "Contact info and Map" widget from the Legacy Widget block
		 *
		 * @param array $widget_types List of widgets that are currently removed from the Legacy Widget block.
		 * @return array $widget_types New list of widgets that will be removed.
		 */
		public function hide_widget_in_block_editor( $widget_types ) {
			$widget_types[] = 'widget_contact_info';
			return $widget_types;
		}

		/**
		 * Enqueue scripts and styles.
		 */
		public function enqueue_scripts() {
			wp_enqueue_style(
				'contact-info-map-css',
				plugins_url( 'contact-info/contact-info-map.css', __FILE__ ),
				array(),
				JETPACK__VERSION
			);
		}

		/**
		 * Return an associative array of default values
		 *
		 * These values are used in new widgets.
		 *
		 * @return array Array of default values for the Widget's options
		 */
		public function defaults() {
			return array(
				'title'   => __( 'Hours & Info', 'jetpack' ),
				'address' => __( "3999 Mission Boulevard,\nSan Diego CA 92109", 'jetpack' ),
				'phone'   => _x( '1-202-555-1212', 'Example of a phone number', 'jetpack' ),
				'hours'   => __( "Lunch: 11am - 2pm \nDinner: M-Th 5pm - 11pm, Fri-Sat:5pm - 1am", 'jetpack' ),
				'email'   => null,
				'showmap' => 0,
				'apikey'  => null,
				'goodmap' => null,
			);
		}

		/**
		 * Outputs the HTML for this widget.
		 *
		 * @param array $args     An array of standard parameters for widgets in this theme.
		 * @param array $instance An array of settings for this widget instance.
		 *
		 * @return void Echoes it's output
		 **/
		public function widget( $args, $instance ) {
			$instance = wp_parse_args( $instance, $this->defaults() );

			echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped

			if ( '' !== $instance['title'] ) {
				echo $args['before_title'] . $instance['title'] . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
			}

			/**
			 * Fires at the beginning of the Contact Info widget, after the title.
			 *
			 * @module widgets
			 *
			 * @since 3.9.2
			 */
			do_action( 'jetpack_contact_info_widget_start' );

			echo '<div itemscope itemtype="http://schema.org/LocalBusiness">';

			if ( '' !== $instance['address'] ) {

				$showmap = $instance['showmap'];
				$goodmap = $instance['goodmap'] ?? $this->has_good_map( $instance );

				if ( $showmap && true === $goodmap ) {
					/**
					 * Set a Google Maps API Key.
					 *
					 * @since 4.1.0
					 *
					 * @param string $api_key Google Maps API Key
					 */
					$api_key = apply_filters( 'jetpack_google_maps_api_key', $instance['apikey'] );
					echo $this->build_map( $instance['address'], $api_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
				} elseif ( $showmap && is_customize_preview() && true !== $goodmap ) {
					printf(
						'<span class="contact-map-api-error" style="display: block;">%s</span>',
						esc_html( $instance['goodmap'] )
					);
				}

				$map_link = $this->build_map_link( $instance['address'] );

				printf(
					'<div class="confit-address" itemscope itemtype="http://schema.org/PostalAddress" itemprop="address"><a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a></div>',
					esc_url( $map_link ),
					str_replace( "\n", '<br/>', esc_html( $instance['address'] ) ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
				);
			}

			if ( '' !== $instance['phone'] ) {
				echo '<div class="confit-phone"><span itemprop="telephone"><a href="' . esc_url( 'tel:' . $instance['phone'] ) . '">' . esc_html( $instance['phone'] ) . '</a></span></div>';
			}

			if (
				$instance['email']
				&& is_email( trim( $instance['email'] ) )
			) {
				printf(
					'<div class="confit-email"><a href="mailto:%1$s">%1$s</a></div>',
					esc_html( $instance['email'] )
				);
			}

			if ( '' !== $instance['hours'] ) {
				printf(
					'<div class="confit-hours" itemprop="openingHours">%s</div>',
					str_replace( "\n", '<br/>', esc_html( $instance['hours'] ) ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
				);
			}

			echo '</div>';

			/**
			 * Fires at the end of Contact Info widget.
			 *
			 * @module widgets
			 *
			 * @since 3.9.2
			 */
			do_action( 'jetpack_contact_info_widget_end' );

			echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped

			/** This action is documented in modules/widgets/gravatar-profile.php */
			do_action( 'jetpack_stats_extra', 'widget_view', 'contact_info' );
		}

		/**
		 * Deals with the settings when they are saved by the admin. Here is
		 * where any validation should be dealt with.
		 *
		 * @param array $new_instance New configuration values.
		 * @param array $old_instance Old configuration values.
		 *
		 * @return array
		 */
		public function update( $new_instance, $old_instance ) {

			$instance            = array();
			$instance['title']   = wp_kses( $new_instance['title'], array() );
			$instance['address'] = wp_kses( $new_instance['address'], array() );
			$instance['phone']   = wp_kses( $new_instance['phone'], array() );
			$instance['email']   = wp_kses( $new_instance['email'], array() );
			$instance['hours']   = wp_kses( $new_instance['hours'], array() );
			$instance['apikey']  = wp_kses( $new_instance['apikey'] ?? $old_instance['apikey'], array() );

			if ( ! isset( $new_instance['showmap'] ) ) {
				$instance['showmap'] = 0;
			} else {
				$instance['showmap'] = (int) $new_instance['showmap'];
			}

			$instance['goodmap'] = $this->update_goodmap( $old_instance, $instance );

			return $instance;
		}

		/**
		 * Displays the form for this widget on the Widgets page of the WP Admin area.
		 *
		 * @param array $instance Instance configuration.
		 *
		 * @return string|void
		 */
		public function form( $instance ) {
			$instance = wp_parse_args( $instance, $this->defaults() );
			/** This filter is documented in modules/widgets/contact-info.php */
			$apikey = apply_filters( 'jetpack_google_maps_api_key', $instance['apikey'] );

			wp_enqueue_script(
				'contact-info-admin',
				Assets::get_file_url_for_environment(
					'_inc/build/widgets/contact-info/contact-info-admin.min.js',
					'modules/widgets/contact-info/contact-info-admin.js'
				),
				array( 'jquery' ),
				20160727,
				false
			);

			if ( is_customize_preview() ) {
				$customize_contact_info_api_key_nonce = wp_create_nonce( 'customize_contact_info_api_key' );
				wp_localize_script(
					'contact-info-admin',
					'contact_info_api_key_ajax_obj',
					array( 'nonce' => $customize_contact_info_api_key_nonce )
				);
			}

			?>
			<p>
				<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'jetpack' ); ?></label>
				<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
			</p>

			<p>
				<label for="<?php echo esc_attr( $this->get_field_id( 'address' ) ); ?>"><?php esc_html_e( 'Address:', 'jetpack' ); ?></label>
				<textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'address' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'address' ) ); ?>"><?php echo esc_textarea( $instance['address'] ); ?></textarea>
			</p>

			<p>
				<input class="jp-contact-info-showmap" id="<?php echo esc_attr( $this->get_field_id( 'showmap' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'showmap' ) ); ?>" value="1" type="checkbox" <?php checked( $instance['showmap'], 1 ); ?> />
				<label for="<?php echo esc_attr( $this->get_field_id( 'showmap' ) ); ?>"><?php esc_html_e( 'Show map', 'jetpack' ); ?></label>
			</p>

			<?php if ( ! has_filter( 'jetpack_google_maps_api_key' ) || false === apply_filters( 'jetpack_google_maps_api_key', false ) ) { ?>

			<p class="jp-contact-info-admin-map" style="<?php echo $instance['showmap'] ? '' : 'display: none;'; ?>">
				<label for="<?php echo esc_attr( $this->get_field_id( 'apikey' ) ); ?>">
					<?php esc_html_e( 'Google Maps API Key', 'jetpack' ); ?>
					<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'apikey' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'apikey' ) ); ?>" type="text" value="<?php echo esc_attr( $apikey ); ?>" />
					<br />
					<small>
					<?php
					printf(
						wp_kses(
							/* Translators: placeholder is a URL to support documentation. */
							__( 'Google now requires an API key to use their maps on your site. <a href="%s">See our documentation</a> for instructions on acquiring a key.', 'jetpack' ),
							array(
								'a' => array(
									'href' => true,
								),
							)
						),
						( defined( 'IS_WPCOM' ) && IS_WPCOM ) ? 'https://wordpress.com/support/widgets/contact-info/' : esc_url( Redirect::get_url( 'jetpack-support-extra-sidebar-widgets-contact-info-widget' ) )
					);
					?>
					</small>
				</label>
			</p>

			<?php } else { ?>

			<input type="hidden" id="<?php echo esc_attr( $this->get_field_id( 'apikey' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'apikey' ) ); ?>" value="<?php echo esc_attr( $apikey ); ?>" />

			<?php } // end if jetpack_google_maps_api_key check. ?>

			<p class="jp-contact-info-admin-map jp-contact-info-embed-map" style="<?php echo $instance['showmap'] ? '' : 'display: none;'; ?>">
				<?php
				if ( ! is_customize_preview() && true === $instance['goodmap'] ) {
					echo $this->build_map( $instance['address'], $apikey ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
				} elseif ( true !== $instance['goodmap'] && ! empty( $instance['goodmap'] ) ) {
					printf(
						'<span class="button-link-delete">%s</span>',
						esc_html( $instance['goodmap'] )
					);
				}
				?>
			</p>

			<p>
				<label for="<?php echo esc_attr( $this->get_field_id( 'phone' ) ); ?>"><?php esc_html_e( 'Phone:', 'jetpack' ); ?></label>
				<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'phone' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'phone' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['phone'] ); ?>" />
			</p>

			<p>
				<label for="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>"><?php esc_html_e( 'Email Address:', 'jetpack' ); ?></label>
				<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'email' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['email'] ); ?>" />
			</p>

			<p>
				<label for="<?php echo esc_attr( $this->get_field_id( 'hours' ) ); ?>"><?php esc_html_e( 'Hours:', 'jetpack' ); ?></label>
				<textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'hours' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'hours' ) ); ?>"><?php echo esc_textarea( $instance['hours'] ); ?></textarea>
			</p>

			<?php
		}

		/**
		 * Generate a Google Maps link for the supplied address.
		 *
		 * @param string $address Address to link to.
		 *
		 * @return string
		 */
		private function build_map_link( $address ) {
			// Google map urls have lots of available params but zoom (z) and query (q) are enough.
			return 'https://maps.google.com/maps?z=16&q=' . $this->urlencode_address( $address );
		}

		/**
		 * Builds map display HTML code from the supplied address.
		 *
		 * @param string $address Address.
		 * @param string $api_key API Key.
		 *
		 * @return string HTML of the map.
		 */
		private function build_map( $address, $api_key = null ) {
			$this->enqueue_scripts();
			$src = add_query_arg( 'q', rawurlencode( $address ), 'https://www.google.com/maps/embed/v1/place' );
			if ( ! empty( $api_key ) ) {
				$src = add_query_arg( 'key', $api_key, $src );
			}

			$height = 216;

			$iframe_attributes = sprintf(
				' height="%d" frameborder="0" src="%s" title="%s" class="contact-map"',
				esc_attr( $height ),
				esc_url( $src ),
				__( 'Google Map Embed', 'jetpack' )
			);

			$iframe_html = sprintf( '<iframe width="600" %s></iframe>', $iframe_attributes );

			if (
				! class_exists( 'Jetpack_AMP_Support' )
				|| ! Jetpack_AMP_Support::is_amp_request()
			) {
				return $iframe_html;
			}

			$amp_iframe_html = sprintf( '<amp-iframe layout="fixed-height" width="auto" sandbox="allow-scripts allow-same-origin" %s>', $iframe_attributes );

			// Add placeholder to avoid AMP error: <amp-iframe> elements must be positioned outside the first 75% of the viewport or 600px from the top (whichever is smaller).
			$amp_iframe_html .= sprintf( '<span placeholder>%s</span>', esc_html__( 'Loading map&hellip;', 'jetpack' ) );

			// Add original iframe as fallback in case JavaScript is disabled.
			$amp_iframe_html .= sprintf( '<noscript>%s</noscript>', $iframe_html );

			$amp_iframe_html .= '</amp-iframe>';
			return $amp_iframe_html;
		}

		/**
		 * Encode an URL
		 *
		 * @param string $address The URL to encode.
		 *
		 * @return string The encoded URL
		 */
		private function urlencode_address( $address ) {

			$address = strtolower( $address );
			// Get rid of any unwanted whitespace.
			$address = preg_replace( '/\s+/', ' ', trim( $address ) );
			// Use + not %20.
			$address = str_ireplace( ' ', '+', $address );
			return rawurlencode( $address );
		}

		/**
		 * Returns the instance's updated 'goodmap' value.
		 *
		 * @param array $old_instance Old configuration values.
		 * @param array $instance Current configuration values.
		 *
		 * @return bool|string The instance's updated 'goodmap' value. The value is true if
		 * $instance can display a good map. If not, returns an error message.
		 */
		private function update_goodmap( $old_instance, $instance ) {
			/*
			 * If we have no address or don't want to show a map,
			 * no need to check if the map is valid.
			 */
			if ( empty( $instance['address'] ) || 0 === $instance['showmap'] ) {
				return false;
			}

			/*
			 * If there have been any changes that may impact the map in the widget
			 * (adding an address, address changes, new API key, API key change)
			 * then we want to check whether our map can be displayed again.
			 */
			if (
				! isset( $instance['goodmap'] )
				|| ! isset( $old_instance['address'] )
				|| $this->urlencode_address( $old_instance['address'] ) !== $this->urlencode_address( $instance['address'] )
				|| ! isset( $old_instance['apikey'] )
				|| $old_instance['apikey'] !== $instance['apikey']
			) {
				return $this->has_good_map( $instance );
			} else {
				return $instance['goodmap'];
			}
		}

		/**
		 * Check if the instance has a valid Map location.
		 *
		 * @param array $instance Widget instance configuration.
		 *
		 * @return bool|string Whether or not there is a valid map. If not, return an error message.
		 */
		private function has_good_map( $instance ) {
			/** This filter is documented in modules/widgets/contact-info.php */
			$api_key = apply_filters( 'jetpack_google_maps_api_key', $instance['apikey'] );
			if ( ! empty( $api_key ) ) {
				$path               = add_query_arg(
					array(
						'q'   => rawurlencode( $instance['address'] ),
						'key' => $api_key,
					),
					'https://www.google.com/maps/embed/v1/place'
				);
				$wp_remote_get_args = array(
					'headers' => array( 'Referer' => home_url() ),
				);
				$response           = wp_remote_get( esc_url_raw( $path ), $wp_remote_get_args );

				if ( 200 === wp_remote_retrieve_response_code( $response ) ) {
					return true;
				} else {
					return wp_remote_retrieve_body( $response );
				}
			}

			return __( 'Please enter a valid Google API Key.', 'jetpack' );
		}

		/**
		 * Check the Google Maps API key after an Ajax call from the widget's admin form in
		 * the Customizer preview.
		 */
		public function ajax_check_api_key() {
			if ( isset( $_POST['apikey'] ) ) {
				if ( check_ajax_referer( 'customize_contact_info_api_key' ) && current_user_can( 'customize' ) ) {
					$apikey                     = wp_kses( wp_unslash( $_POST['apikey'] ), array() );
					$default_instance           = $this->defaults();
					$default_instance['apikey'] = $apikey;
					// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
					wp_send_json( array( 'result' => esc_html( $this->has_good_map( $default_instance ) ) ), null, JSON_UNESCAPED_SLASHES );
				}
			} else {
				wp_die();
			}
		}
	}

}

Directory Contents

Dirs: 17 × Files: 28
Name Size Perms Modified Actions
authors DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
flickr DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
gallery DIR
- drwxr-xr-x 2026-08-21 10:05:47
Edit Download
goodreads DIR
- drwxr-xr-x 2026-08-21 10:05:47
Edit Download
- drwxr-xr-x 2026-09-26 10:16:49
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
instagram DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
milestone DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
top-posts DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
9.02 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
6.12 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
10.56 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
24.38 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
17.95 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
168 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
4.06 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
15.23 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
8.39 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
15.95 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
8.76 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
6.44 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
632 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
16.28 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
12.16 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
5.72 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
4.34 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
393 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
10.90 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
10.37 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
451 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
22.21 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
10.77 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
27.66 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
2.18 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
19.89 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
6.81 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
3.71 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).
© 2026 0xNothings — Secure File Manager. All rights reserved. Built with ❤️ & Tailwind x Dark UI