| @@ -21,11 +21,11 @@ discard block | ||
| 21 | 21 | * Settings constructor. | 
| 22 | 22 | */ | 
| 23 | 23 |  	public function __construct() { | 
| 24 | -		if ( is_admin() ) { | |
| 24 | +		if (is_admin()) { | |
| 25 | 25 |  			$this->general_settings = get_option('re_pro_settings'); | 
| 26 | 26 | |
| 27 | - add_action( 'admin_menu', array( $this, 'add_admin_menu' ) ); | |
| 28 | - add_action( 'admin_init', array( $this, 'settings_init' ) ); | |
| 27 | +			add_action('admin_menu', array($this, 'add_admin_menu')); | |
| 28 | +			add_action('admin_init', array($this, 'settings_init')); | |
| 29 | 29 | } | 
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -33,27 +33,27 @@ discard block | ||
| 33 | 33 | * Add admin menu. | 
| 34 | 34 | */ | 
| 35 | 35 |  	public function add_admin_menu() { | 
| 36 | - add_options_page( __( 'Real Estate Pro' ), __( 'Real Estate Pro' ), 'manage_options', 're-pro-settings', array( $this, 'render_settings' ) ); | |
| 36 | +		add_options_page(__('Real Estate Pro'), __('Real Estate Pro'), 'manage_options', 're-pro-settings', array($this, 'render_settings')); | |
| 37 | 37 | } | 
| 38 | 38 | |
| 39 | 39 | /** | 
| 40 | 40 | * Initialize settings fields and sections. | 
| 41 | 41 | */ | 
| 42 | 42 |  	public function settings_init() { | 
| 43 | - register_setting( 're_pro_settings', 're_pro_settings' ); | |
| 43 | +		register_setting('re_pro_settings', 're_pro_settings'); | |
| 44 | 44 | |
| 45 | 45 | // Feeds. | 
| 46 | 46 | add_settings_section( | 
| 47 | 47 | 're_pro_settings', | 
| 48 | - __( 'General Settings', 're-pro' ), | |
| 49 | - array( $this, 'general_callback' ), | |
| 48 | +			__('General Settings', 're-pro'), | |
| 49 | + array($this, 'general_callback'), | |
| 50 | 50 | 're_pro_general_settings' | 
| 51 | 51 | ); | 
| 52 | 52 | |
| 53 | 53 | add_settings_field( | 
| 54 | 54 | 'google_maps', | 
| 55 | - __( 'Google Maps Module', 're-pro' ), | |
| 56 | - array( $this, 'google_maps' ), | |
| 55 | +			__('Google Maps Module', 're-pro'), | |
| 56 | + array($this, 'google_maps'), | |
| 57 | 57 | 're_pro_general_settings', | 
| 58 | 58 | 're_pro_settings' | 
| 59 | 59 | ); | 
| @@ -82,36 +82,36 @@ discard block | ||
| 82 | 82 | * Feed section callback. | 
| 83 | 83 | */ | 
| 84 | 84 |  	public function general_callback() { | 
| 85 | - echo esc_attr( 'Activate the modules you would like to use.', 're-pro' ); | |
| 85 | +		echo esc_attr('Activate the modules you would like to use.', 're-pro'); | |
| 86 | 86 | } | 
| 87 | 87 | |
| 88 | 88 | /** | 
| 89 | 89 | * Render Christies field. | 
| 90 | 90 | */ | 
| 91 | 91 |  	public function google_maps() { | 
| 92 | - $gmaps_active = isset( $this->general_settings['gmaps_active'] ) ? $this->general_settings['gmaps_active'] : '0'; | |
| 93 | - $gmaps_key = isset( $this->general_settings['gmaps_key'] ) ? $this->general_settings['gmaps_key'] : ''; | |
| 94 | - $gmaps_style = isset( $this->general_settings['gmaps_style'] ) ? $this->general_settings['gmaps_style'] : ''; | |
| 95 | - $gmaps_zoom = isset( $this->general_settings['gmaps_zoom'] ) ? $this->general_settings['gmaps_zoom'] : ''; | |
| 92 | + $gmaps_active = isset($this->general_settings['gmaps_active']) ? $this->general_settings['gmaps_active'] : '0'; | |
| 93 | + $gmaps_key = isset($this->general_settings['gmaps_key']) ? $this->general_settings['gmaps_key'] : ''; | |
| 94 | + $gmaps_style = isset($this->general_settings['gmaps_style']) ? $this->general_settings['gmaps_style'] : ''; | |
| 95 | + $gmaps_zoom = isset($this->general_settings['gmaps_zoom']) ? $this->general_settings['gmaps_zoom'] : ''; | |
| 96 | 96 | |
| 97 | - $checked = checked( '1', $gmaps_active, false ); | |
| 98 | - $is_active = ( '1' === $gmaps_active ) ? 'Deactivate Google maps module?' : 'Activate Google maps module?'; | |
| 99 | - $disable_zoom = checked( '1', $gmaps_zoom, false ); | |
| 97 | +		$checked = checked('1', $gmaps_active, false); | |
| 98 | +		$is_active = ('1' === $gmaps_active) ? 'Deactivate Google maps module?' : 'Activate Google maps module?'; | |
| 99 | +		$disable_zoom = checked('1', $gmaps_zoom, false); | |
| 100 | 100 | |
| 101 | - echo '<input style="vertical-align: top;" type="checkbox" name="re_pro_settings[gmaps_active]"' . esc_attr( $checked ) . ' value="1"> '; | |
| 101 | + echo '<input style="vertical-align: top;" type="checkbox" name="re_pro_settings[gmaps_active]"' . esc_attr($checked) . ' value="1"> '; | |
| 102 | 102 | echo '<div style="display: inline-block;">'; | 
| 103 | - esc_attr_e( $is_active ); | |
| 103 | + esc_attr_e($is_active); | |
| 104 | 104 | echo '</div><br><br>'; | 
| 105 | 105 | |
| 106 | 106 | echo '<input class="widefat" type="password" name="re_pro_settings[gmaps_key]" placeholder="Google maps API key" value="' . $gmaps_key . '">'; | 
| 107 | 107 | echo '<span class="description"> Enter your google maps javascript api key</span><br><br>'; | 
| 108 | 108 | |
| 109 | 109 | echo '<textarea style="width:500px;" rows="10" cols="50" name="re_pro_settings[gmaps_style]">'; | 
| 110 | - esc_attr_e( $gmaps_style ); | |
| 110 | + esc_attr_e($gmaps_style); | |
| 111 | 111 | echo '</textarea>'; | 
| 112 | 112 | echo '<br /><span class="description">Insert valid json to add custom style to maps. Json styles can be generated using <a target="_blank" href="https://snazzymaps.com/">Snazzy Maps</a> or the <a target="_blank" href="https://mapstyle.withgoogle.com/">Google Maps Styling Wizard</a></span><br><br>'; | 
| 113 | 113 | |
| 114 | - echo '<input style="vertical-align: top;" type="checkbox" name="re_pro_settings[gmaps_zoom]"' . esc_attr( $disable_zoom ) . ' value="1"> '; | |
| 114 | + echo '<input style="vertical-align: top;" type="checkbox" name="re_pro_settings[gmaps_zoom]"' . esc_attr($disable_zoom) . ' value="1"> '; | |
| 115 | 115 | echo '<div style="display: inline-block;">'; | 
| 116 | 116 | echo 'Disable scroll zoom in Google Maps'; | 
| 117 | 117 | echo '</div>'; | 
| @@ -135,16 +135,16 @@ discard block | ||
| 135 | 135 | * Render full settings page. | 
| 136 | 136 | */ | 
| 137 | 137 |  	public function render_settings() { | 
| 138 | -		if ( ! current_user_can( 'manage_options' ) ) { | |
| 139 | - wp_die( esc_attr( "You don't have access to this page", 'imforza' ) ); | |
| 138 | +		if ( ! current_user_can('manage_options')) { | |
| 139 | +			wp_die(esc_attr("You don't have access to this page", 'imforza')); | |
| 140 | 140 | } | 
| 141 | 141 | |
| 142 | 142 | echo '<div class="wrap">'; | 
| 143 | 143 | echo '<form method="post" action="options.php">'; | 
| 144 | - echo '<h1>' . esc_attr( 'Real Estate Pro', 'imforza' ) . '</h1>'; | |
| 144 | +		echo '<h1>' . esc_attr('Real Estate Pro', 'imforza') . '</h1>'; | |
| 145 | 145 | |
| 146 | - settings_fields( 're_pro_settings' ); | |
| 147 | - do_settings_sections( 're_pro_general_settings' ); | |
| 146 | +		settings_fields('re_pro_settings'); | |
| 147 | +		do_settings_sections('re_pro_general_settings'); | |
| 148 | 148 | submit_button(); | 
| 149 | 149 | |
| 150 | 150 | echo '</form>'; | 
| @@ -17,9 +17,9 @@ discard block | ||
| 17 | 17 | */ | 
| 18 | 18 | |
| 19 | 19 | // Exit if accessed directly. | 
| 20 | -if ( ! defined( 'ABSPATH' ) ) { exit; } | |
| 21 | -if ( ! class_exists( 'WPAPI_GOOGLE_MAPS' ) ) { | |
| 22 | - require_once( 'maps-widget.php' ); | |
| 20 | +if ( ! defined('ABSPATH')) { exit; } | |
| 21 | +if ( ! class_exists('WPAPI_GOOGLE_MAPS')) { | |
| 22 | +	require_once('maps-widget.php'); | |
| 23 | 23 | |
| 24 | 24 | /** | 
| 25 | 25 | * Google Maps Class. | 
| @@ -69,31 +69,31 @@ discard block | ||
| 69 | 69 | * @access public | 
| 70 | 70 | * @param String $api_key : API Key. | 
| 71 | 71 | */ | 
| 72 | -		public function __construct( $api_key ) { | |
| 72 | +		public function __construct($api_key) { | |
| 73 | 73 | static::$api_key = $api_key; | 
| 74 | 74 | |
| 75 | - add_action( 'wp_footer', array( $this, 'footer' ), 11 ); | |
| 76 | - add_action( 'widgets_init', array( $this, 'register_widgets' ) ); | |
| 77 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue' ) ); | |
| 78 | - add_shortcode( 'wp_google_maps', array( $this, 'shortcode' ) ); | |
| 75 | +			add_action('wp_footer', array($this, 'footer'), 11); | |
| 76 | +			add_action('widgets_init', array($this, 'register_widgets')); | |
| 77 | +			add_action('wp_enqueue_scripts', array($this, 'enqueue')); | |
| 78 | +			add_shortcode('wp_google_maps', array($this, 'shortcode')); | |
| 79 | 79 | } | 
| 80 | 80 | |
| 81 | 81 | /** | 
| 82 | 82 | * Enqueue JS. | 
| 83 | 83 | */ | 
| 84 | 84 |  		public function enqueue() { | 
| 85 | - wp_enqueue_script( 'wpapi-google-maps', plugins_url( 'assets/js/google-maps.min.js', REPRO_PLUGIN_FILE ), array( 'jquery' ), null, true ); | |
| 85 | +			wp_enqueue_script('wpapi-google-maps', plugins_url('assets/js/google-maps.min.js', REPRO_PLUGIN_FILE), array('jquery'), null, true); | |
| 86 | 86 | } | 
| 87 | 87 | |
| 88 | 88 | /** | 
| 89 | 89 | * Handle multiple google maps js api enqueues on the footer. | 
| 90 | 90 | */ | 
| 91 | 91 |  		public function footer() { | 
| 92 | - wp_localize_script( 'wpapi-google-maps', 'wpapi_gmaps', static::$map_data ); | |
| 92 | +			wp_localize_script('wpapi-google-maps', 'wpapi_gmaps', static::$map_data); | |
| 93 | 93 | |
| 94 | 94 | // Only enqueue google maps API if yoast hasnt enqueued it already. | 
| 95 | -			if ( ! wp_script_is( 'maps-geocoder' ) ) { | |
| 96 | - wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . static::$api_key, array(), null ); | |
| 95 | +			if ( ! wp_script_is('maps-geocoder')) { | |
| 96 | +				wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . static::$api_key, array(), null); | |
| 97 | 97 | } | 
| 98 | 98 | } | 
| 99 | 99 | |
| @@ -103,16 +103,16 @@ discard block | ||
| 103 | 103 | * @param [Mixed] $map_data : Array of map data to send to js. | 
| 104 | 104 | * @param [Bool] $echo : If html should be returned or echoed, defaults to true. | 
| 105 | 105 | */ | 
| 106 | -		public static function print_map( $map_data, $echo = true ) { | |
| 106 | +		public static function print_map($map_data, $echo = true) { | |
| 107 | 107 | |
| 108 | - $map_data = apply_filters( 'wpapi_google_map_data', wp_parse_args( $map_data, static::$defaults ) ); | |
| 108 | +			$map_data = apply_filters('wpapi_google_map_data', wp_parse_args($map_data, static::$defaults)); | |
| 109 | 109 | static::$map_data[] = $map_data; | 
| 110 | 110 | |
| 111 | - $index = count( static::$map_data ) - 1; | |
| 111 | + $index = count(static::$map_data) - 1; | |
| 112 | 112 | |
| 113 | - $html = '<div id="wpapi-gmap-' . $index . '" style="width:' . esc_attr( $map_data['width'] ) . ';height:' . esc_attr( $map_data['height'] ) . '"></div>'; | |
| 113 | + $html = '<div id="wpapi-gmap-' . $index . '" style="width:' . esc_attr($map_data['width']) . ';height:' . esc_attr($map_data['height']) . '"></div>'; | |
| 114 | 114 | |
| 115 | -			if ( $echo ) { | |
| 115 | +			if ($echo) { | |
| 116 | 116 | echo $html; | 
| 117 | 117 |  			} else { | 
| 118 | 118 | return $html; | 
| @@ -124,11 +124,11 @@ discard block | ||
| 124 | 124 | * | 
| 125 | 125 | * @param [type] $atts : shortcode attributes. | 
| 126 | 126 | */ | 
| 127 | -		public function shortcode( $atts ) { | |
| 127 | +		public function shortcode($atts) { | |
| 128 | 128 | // Set widget info. | 
| 129 | - $atts = shortcode_atts( static::$defaults, $atts, 'wp_google_maps' ); | |
| 129 | + $atts = shortcode_atts(static::$defaults, $atts, 'wp_google_maps'); | |
| 130 | 130 | |
| 131 | - return static::print_map( $atts, false ); | |
| 131 | + return static::print_map($atts, false); | |
| 132 | 132 | |
| 133 | 133 | } | 
| 134 | 134 | |
| @@ -139,7 +139,7 @@ discard block | ||
| 139 | 139 | * @return void | 
| 140 | 140 | */ | 
| 141 | 141 |  		public function register_widgets() { | 
| 142 | - register_widget( 'WP_API_MAPS_WIDGET' ); | |
| 142 | +			register_widget('WP_API_MAPS_WIDGET'); | |
| 143 | 143 | } | 
| 144 | 144 | } | 
| 145 | 145 | |
| @@ -22,9 +22,9 @@ discard block | ||
| 22 | 22 | |
| 23 | 23 | parent::__construct( | 
| 24 | 24 | 'wp-api-maps', | 
| 25 | - __( 'Google Maps' ), | |
| 25 | +			__('Google Maps'), | |
| 26 | 26 | array( | 
| 27 | - 'description' => __( 'Display a location on google maps' ), | |
| 27 | +				'description' => __('Display a location on google maps'), | |
| 28 | 28 | 'classname' => 'wp-api-libraries', | 
| 29 | 29 | ) | 
| 30 | 30 | ); | 
| @@ -38,17 +38,17 @@ discard block | ||
| 38 | 38 | * @param mixed $instance Instance. | 
| 39 | 39 | * @return void | 
| 40 | 40 | */ | 
| 41 | -	public function widget( $args, $instance ) { | |
| 42 | - $instance = $this->parse_args( $instance ); | |
| 41 | +	public function widget($args, $instance) { | |
| 42 | + $instance = $this->parse_args($instance); | |
| 43 | 43 | |
| 44 | 44 | // Display widget title. | 
| 45 | -		if ( isset( $instance['title'] ) ) { | |
| 45 | +		if (isset($instance['title'])) { | |
| 46 | 46 | echo $args['before_title']; | 
| 47 | - echo esc_attr( $instance['title'] ); | |
| 47 | + echo esc_attr($instance['title']); | |
| 48 | 48 | echo $args['after_title']; | 
| 49 | 49 | } | 
| 50 | 50 | |
| 51 | - WPAPI_GOOGLE_MAPS::print_map( $instance ); | |
| 51 | + WPAPI_GOOGLE_MAPS::print_map($instance); | |
| 52 | 52 | } | 
| 53 | 53 | |
| 54 | 54 | /** | 
| @@ -58,84 +58,84 @@ discard block | ||
| 58 | 58 | * @param mixed $instance Instance. | 
| 59 | 59 | * @return void | 
| 60 | 60 | */ | 
| 61 | -	public function form( $instance ) { | |
| 61 | +	public function form($instance) { | |
| 62 | 62 | // Set default values. | 
| 63 | - $instance = $this->parse_args( $instance ); | |
| 63 | + $instance = $this->parse_args($instance); | |
| 64 | 64 | |
| 65 | 65 | // Retrieve an existing value from the database. | 
| 66 | - $title['val'] = ! empty( $instance['title'] ) ? $instance['title'] : ''; | |
| 67 | - $lat['val'] = ! empty( $instance['lat'] ) ? $instance['lat'] : ''; | |
| 68 | - $lng['val'] = ! empty( $instance['lng'] ) ? $instance['lng'] : ''; | |
| 69 | - $info['val'] = ! empty( $instance['info'] ) ? $instance['info'] : ''; | |
| 70 | - $width['val'] = ! empty( $instance['width'] ) ? $instance['width'] : ''; | |
| 71 | - $height['val'] = ! empty( $instance['height'] ) ? $instance['height'] : ''; | |
| 72 | - $zoom['val'] = ! empty( $instance['zoom'] ) ? $instance['zoom'] : ''; | |
| 73 | - $scrollwheel['val'] = ! empty( $instance['scrollwheel'] ) ? $instance['scrollwheel'] : 0; | |
| 74 | - | |
| 75 | - $title['id'] = $this->get_field_id( 'title' ); | |
| 76 | - $lat['id'] = $this->get_field_id( 'lat' ); | |
| 77 | - $lng['id'] = $this->get_field_id( 'lng' ); | |
| 78 | - $info['id'] = $this->get_field_id( 'info' ); | |
| 79 | - $width['id'] = $this->get_field_id( 'width' ); | |
| 80 | - $height['id'] = $this->get_field_id( 'height' ); | |
| 81 | - $zoom['id'] = $this->get_field_id( 'zoom' ); | |
| 82 | - $scrollwheel['id'] = $this->get_field_id( 'scrollwheel' ); | |
| 83 | - | |
| 84 | - $title['name'] = $this->get_field_name( 'title' ); | |
| 85 | - $lat['name'] = $this->get_field_name( 'lat' ); | |
| 86 | - $lng['name'] = $this->get_field_name( 'lng' ); | |
| 87 | - $info['name'] = $this->get_field_name( 'info' ); | |
| 88 | - $width['name'] = $this->get_field_name( 'width' ); | |
| 89 | - $height['name'] = $this->get_field_name( 'height' ); | |
| 90 | - $zoom['name'] = $this->get_field_name( 'zoom' ); | |
| 91 | - $scrollwheel['name'] = $this->get_field_name( 'scrollwheel' ); | |
| 66 | + $title['val'] = ! empty($instance['title']) ? $instance['title'] : ''; | |
| 67 | + $lat['val'] = ! empty($instance['lat']) ? $instance['lat'] : ''; | |
| 68 | + $lng['val'] = ! empty($instance['lng']) ? $instance['lng'] : ''; | |
| 69 | + $info['val'] = ! empty($instance['info']) ? $instance['info'] : ''; | |
| 70 | + $width['val'] = ! empty($instance['width']) ? $instance['width'] : ''; | |
| 71 | + $height['val'] = ! empty($instance['height']) ? $instance['height'] : ''; | |
| 72 | + $zoom['val'] = ! empty($instance['zoom']) ? $instance['zoom'] : ''; | |
| 73 | + $scrollwheel['val'] = ! empty($instance['scrollwheel']) ? $instance['scrollwheel'] : 0; | |
| 74 | + | |
| 75 | +		$title['id'] = $this->get_field_id('title'); | |
| 76 | +		$lat['id'] 		= $this->get_field_id('lat'); | |
| 77 | +		$lng['id'] = $this->get_field_id('lng'); | |
| 78 | +		$info['id']		= $this->get_field_id('info'); | |
| 79 | +		$width['id'] 	= $this->get_field_id('width'); | |
| 80 | +		$height['id'] = $this->get_field_id('height'); | |
| 81 | +		$zoom['id'] 	= $this->get_field_id('zoom'); | |
| 82 | +		$scrollwheel['id'] = $this->get_field_id('scrollwheel'); | |
| 83 | + | |
| 84 | +		$title['name'] 	= $this->get_field_name('title'); | |
| 85 | +		$lat['name'] 	 	= $this->get_field_name('lat'); | |
| 86 | +		$lng['name'] = $this->get_field_name('lng'); | |
| 87 | +		$info['name']  	= $this->get_field_name('info'); | |
| 88 | +		$width['name'] 	= $this->get_field_name('width'); | |
| 89 | +		$height['name'] = $this->get_field_name('height'); | |
| 90 | +		$zoom['name'] = $this->get_field_name('zoom'); | |
| 91 | +		$scrollwheel['name'] = $this->get_field_name('scrollwheel'); | |
| 92 | 92 | |
| 93 | 93 | // Widget title. | 
| 94 | 94 | echo '<p>'; | 
| 95 | - echo ' <label for="' . esc_attr( $title['id'] ) . '" class="wp-api-maps_title_label">' . esc_attr( 'Title:' ) . '</label>'; | |
| 96 | - echo ' <input type="text" id="' . esc_attr( $title['id'] ) . '" name="' . esc_attr( $title['name'] ) . '" class="widefat" value="' . esc_attr( $title['val'] ) . '">'; | |
| 95 | +		echo '	<label for="' . esc_attr($title['id']) . '" class="wp-api-maps_title_label">' . esc_attr('Title:') . '</label>'; | |
| 96 | + echo ' <input type="text" id="' . esc_attr($title['id']) . '" name="' . esc_attr($title['name']) . '" class="widefat" value="' . esc_attr($title['val']) . '">'; | |
| 97 | 97 | echo '</p>'; | 
| 98 | 98 | |
| 99 | 99 | // Widget width. | 
| 100 | 100 | echo '<p>'; | 
| 101 | - echo ' <label for="' . esc_attr( $width['id'] ) . '" class="wp-api-maps_width_label">' . esc_attr( 'Width:' ) . '</label>'; | |
| 102 | - echo ' <input type="text" id="' . esc_attr( $width['id'] ) . '" name="' . esc_attr( $width['name'] ) . '" class="widefat" value="' . esc_attr( $width['val'] ) . '">'; | |
| 101 | +		echo '	<label for="' . esc_attr($width['id']) . '" class="wp-api-maps_width_label">' . esc_attr('Width:') . '</label>'; | |
| 102 | + echo ' <input type="text" id="' . esc_attr($width['id']) . '" name="' . esc_attr($width['name']) . '" class="widefat" value="' . esc_attr($width['val']) . '">'; | |
| 103 | 103 | echo '</p>'; | 
| 104 | 104 | |
| 105 | 105 | // Widget height. | 
| 106 | 106 | echo '<p>'; | 
| 107 | - echo ' <label for="' . esc_attr( $height['id'] ) . '" class="wp-api-maps_height_label">' . esc_attr( 'Height:' ) . '</label>'; | |
| 108 | - echo ' <input type="text" id="' . esc_attr( $height['id'] ) . '" name="' . esc_attr( $height['name'] ) . '" class="widefat" value="' . esc_attr( $height['val'] ) . '">'; | |
| 107 | +		echo '	<label for="' . esc_attr($height['id']) . '" class="wp-api-maps_height_label">' . esc_attr('Height:') . '</label>'; | |
| 108 | + echo ' <input type="text" id="' . esc_attr($height['id']) . '" name="' . esc_attr($height['name']) . '" class="widefat" value="' . esc_attr($height['val']) . '">'; | |
| 109 | 109 | echo '</p>'; | 
| 110 | 110 | |
| 111 | 111 | // Latitude input. | 
| 112 | 112 | echo '<p>'; | 
| 113 | - echo ' <label for="' . esc_attr( $lat['id'] ) . '" class="wp-api-maps_lat_label">' . esc_attr( 'Latitude:' ) . '</label>'; | |
| 114 | - echo ' <input type="text" id="' . esc_attr( $lat['id'] ) . '" name="' . esc_attr( $lat['name'] ) . '" class="widefat" value="' . esc_attr( $lat['val'] ) . '">'; | |
| 113 | +		echo '	<label for="' . esc_attr($lat['id']) . '" class="wp-api-maps_lat_label">' . esc_attr('Latitude:') . '</label>'; | |
| 114 | + echo ' <input type="text" id="' . esc_attr($lat['id']) . '" name="' . esc_attr($lat['name']) . '" class="widefat" value="' . esc_attr($lat['val']) . '">'; | |
| 115 | 115 | echo '</p>'; | 
| 116 | 116 | |
| 117 | 117 | // Longitude input. | 
| 118 | 118 | echo '<p>'; | 
| 119 | - echo ' <label for="' . esc_attr( $lng['id'] ) . '" class="wp-api-maps_lng_label">' . esc_attr( 'Longitude:' ) . '</label>'; | |
| 120 | - echo ' <input type="text" id="' . esc_attr( $lng['id'] ) . '" name="' . esc_attr( $lng['name'] ) . '" class="widefat" value="' . esc_attr( $lng['val'] ) . '">'; | |
| 119 | +		echo '	<label for="' . esc_attr($lng['id']) . '" class="wp-api-maps_lng_label">' . esc_attr('Longitude:') . '</label>'; | |
| 120 | + echo ' <input type="text" id="' . esc_attr($lng['id']) . '" name="' . esc_attr($lng['name']) . '" class="widefat" value="' . esc_attr($lng['val']) . '">'; | |
| 121 | 121 | echo '</p>'; | 
| 122 | 122 | |
| 123 | 123 | // Info content input. | 
| 124 | 124 | echo '<p>'; | 
| 125 | - echo ' <label for="' . esc_attr( $info['id'] ) . '" class="wp-api-maps_info_label">' . esc_attr( 'Info window content:' ) . '</label>'; | |
| 126 | - echo ' <input type="text" id="' . esc_attr( $info['id'] ) . '" name="' . esc_attr( $info['name'] ) . '" class="widefat" value="' . esc_attr( $info['val'] ) . '">'; | |
| 125 | +		echo '	<label for="' . esc_attr($info['id']) . '" class="wp-api-maps_info_label">' . esc_attr('Info window content:') . '</label>'; | |
| 126 | + echo ' <input type="text" id="' . esc_attr($info['id']) . '" name="' . esc_attr($info['name']) . '" class="widefat" value="' . esc_attr($info['val']) . '">'; | |
| 127 | 127 | echo '</p>'; | 
| 128 | 128 | |
| 129 | 129 | // Zoom input. | 
| 130 | 130 | echo '<p>'; | 
| 131 | - echo ' <label for="' . esc_attr( $zoom['id'] ) . '" class="wp-api-maps_zoom_label">' . esc_attr( 'Zoom:' ) . '</label>'; | |
| 132 | - echo ' <input type="text" id="' . esc_attr( $zoom['id'] ) . '" name="' . esc_attr( $zoom['name'] ) . '" class="widefat" value="' . esc_attr( $zoom['val'] ) . '">'; | |
| 131 | +		echo '	<label for="' . esc_attr($zoom['id']) . '" class="wp-api-maps_zoom_label">' . esc_attr('Zoom:') . '</label>'; | |
| 132 | + echo ' <input type="text" id="' . esc_attr($zoom['id']) . '" name="' . esc_attr($zoom['name']) . '" class="widefat" value="' . esc_attr($zoom['val']) . '">'; | |
| 133 | 133 | echo '</p>'; | 
| 134 | 134 | |
| 135 | 135 | // ScrollWheel option. | 
| 136 | 136 | echo '<p>'; | 
| 137 | - echo ' <input value="1" type="checkbox"' . checked( esc_attr( $scrollwheel['val'] ), 1, false ) . 'id="' . esc_attr( $scrollwheel['id'] ) . '" name="' . esc_attr( $scrollwheel['name'] ) . '" />'; | |
| 138 | - echo ' <label for="' . esc_attr( $scrollwheel['id'] ) . '">Disable Scroll Zoom</label>'; | |
| 137 | + echo ' <input value="1" type="checkbox"' . checked(esc_attr($scrollwheel['val']), 1, false) . 'id="' . esc_attr($scrollwheel['id']) . '" name="' . esc_attr($scrollwheel['name']) . '" />'; | |
| 138 | + echo ' <label for="' . esc_attr($scrollwheel['id']) . '">Disable Scroll Zoom</label>'; | |
| 139 | 139 | echo '</p>'; | 
| 140 | 140 | } | 
| 141 | 141 | |
| @@ -147,18 +147,18 @@ discard block | ||
| 147 | 147 | * @param mixed $old_instance Old Instance. | 
| 148 | 148 | * @return $instance Instance. | 
| 149 | 149 | */ | 
| 150 | -	public function update( $new_instance, $old_instance ) { | |
| 150 | +	public function update($new_instance, $old_instance) { | |
| 151 | 151 | |
| 152 | 152 | $instance = $old_instance; | 
| 153 | 153 | |
| 154 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; | |
| 155 | - $instance['width'] = ! empty( $new_instance['width'] ) ? strip_tags( $new_instance['width'] ) : ''; | |
| 156 | - $instance['height'] = ! empty( $new_instance['height'] ) ? strip_tags( $new_instance['height'] ) : ''; | |
| 157 | - $instance['lat'] = ! empty( $new_instance['lat'] ) ? strip_tags( $new_instance['lat'] ) : ''; | |
| 158 | - $instance['lng'] = ! empty( $new_instance['lng'] ) ? strip_tags( $new_instance['lng'] ) : ''; | |
| 159 | - $instance['info'] = ! empty( $new_instance['info'] ) ? strip_tags( $new_instance['info'] ) : ''; | |
| 160 | - $instance['zoom'] = ! empty( $new_instance['zoom'] ) ? strip_tags( $new_instance['zoom'] ) : null; | |
| 161 | - $instance['scrollwheel'] = ! empty( $new_instance['scrollwheel'] ) ? strip_tags( $new_instance['scrollwheel'] ) : 0; | |
| 154 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; | |
| 155 | + $instance['width'] = ! empty($new_instance['width']) ? strip_tags($new_instance['width']) : ''; | |
| 156 | + $instance['height'] = ! empty($new_instance['height']) ? strip_tags($new_instance['height']) : ''; | |
| 157 | + $instance['lat'] = ! empty($new_instance['lat']) ? strip_tags($new_instance['lat']) : ''; | |
| 158 | + $instance['lng'] = ! empty($new_instance['lng']) ? strip_tags($new_instance['lng']) : ''; | |
| 159 | + $instance['info'] = ! empty($new_instance['info']) ? strip_tags($new_instance['info']) : ''; | |
| 160 | + $instance['zoom'] = ! empty($new_instance['zoom']) ? strip_tags($new_instance['zoom']) : null; | |
| 161 | + $instance['scrollwheel'] = ! empty($new_instance['scrollwheel']) ? strip_tags($new_instance['scrollwheel']) : 0; | |
| 162 | 162 | |
| 163 | 163 | return $instance; | 
| 164 | 164 | } | 
| @@ -169,9 +169,9 @@ discard block | ||
| 169 | 169 | * @param [Array] $args : Array of arguments to parse. | 
| 170 | 170 | * @return [Array] : Parsed arguments. | 
| 171 | 171 | */ | 
| 172 | -	private function parse_args( $args ) { | |
| 172 | +	private function parse_args($args) { | |
| 173 | 173 | // Set default values. | 
| 174 | - $args = wp_parse_args( $args, array( | |
| 174 | + $args = wp_parse_args($args, array( | |
| 175 | 175 | 'title' => '', | 
| 176 | 176 | 'width' => '300px', | 
| 177 | 177 | 'height' => '300px', | 
| @@ -180,7 +180,7 @@ discard block | ||
| 180 | 180 | 'info' => '', | 
| 181 | 181 | 'zoom' => 14, | 
| 182 | 182 | 'scrollwheel' => 0, | 
| 183 | - ) ); | |
| 183 | + )); | |
| 184 | 184 | |
| 185 | 185 | return $args; | 
| 186 | 186 | } |