Completed
Pull Request — master (#208)
by Devin
20:05
created
includes/admin/class-gmb-admin.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
 
36 36
 		parent::__construct();
37 37
 
38
-		add_action( 'cmb2_render_google_maps_preview', array( $this, 'cmb2_render_google_maps_preview' ), 10, 2 );
38
+		add_action('cmb2_render_google_maps_preview', array($this, 'cmb2_render_google_maps_preview'), 10, 2);
39 39
 		// Load admin style sheet and JavaScript.
40
-		add_action( 'wp_ajax_hide_welcome', array( $this, 'hide_welcome_callback' ) );
40
+		add_action('wp_ajax_hide_welcome', array($this, 'hide_welcome_callback'));
41 41
 
42 42
 		//Add links/information to plugin row meta
43
-		add_filter( 'cmb2_get_metabox_form_format', array( $this, 'gmb_modify_cmb2_form_output' ), 10, 3 );
43
+		add_filter('cmb2_get_metabox_form_format', array($this, 'gmb_modify_cmb2_form_output'), 10, 3);
44 44
 
45 45
 		//Widget upsell
46
-		add_action( 'gmb_after_widget_form', array( $this, 'widget_upsell' ) );
46
+		add_action('gmb_after_widget_form', array($this, 'widget_upsell'));
47 47
 
48 48
 		//Useful class for free-only styling
49
-		add_filter( 'admin_body_class', array( $this, 'admin_body_classes' ) );
49
+		add_filter('admin_body_class', array($this, 'admin_body_classes'));
50 50
 
51 51
 	}
52 52
 
@@ -55,32 +55,32 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @since  1.0.0
57 57
 	 */
58
-	function cmb2_render_google_maps_preview( $field, $meta ) {
58
+	function cmb2_render_google_maps_preview($field, $meta) {
59 59
 
60 60
 		/* @var $post */
61 61
 		global $post;
62 62
 
63
-		$meta            = wp_parse_args( $meta, array() );
64
-		$wh_value        = get_post_meta( $post->ID, 'gmb_width_height', true );
65
-		$lat_lng         = get_post_meta( $post->ID, 'gmb_lat_lng', true );
63
+		$meta            = wp_parse_args($meta, array());
64
+		$wh_value        = get_post_meta($post->ID, 'gmb_width_height', true);
65
+		$lat_lng         = get_post_meta($post->ID, 'gmb_lat_lng', true);
66 66
 		$default_options = $this->get_default_map_options();
67 67
 
68
-		$output = '<div class="places-loading wpgp-loading">' . __( 'Loading Places', $this->plugin_slug ) . '</div><div id="google-map-wrap">';
68
+		$output = '<div class="places-loading wpgp-loading">'.__('Loading Places', $this->plugin_slug).'</div><div id="google-map-wrap">';
69 69
 		$output .= '<div id="map" style="height:600px; width:100%;"></div>';
70 70
 
71
-		$output .= '<div class="map-modal-upsell"><p class="upsell-intro">' . __( 'Want more?', $this->plugin_slug ) . '</p><a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=MODAL&utm_campaign=MBF%20Modal" class="button button-small upsell-button" target="_blank">' . __( 'Go Pro!', $this->plugin_slug ) . '</a></div>';
71
+		$output .= '<div class="map-modal-upsell"><p class="upsell-intro">'.__('Want more?', $this->plugin_slug).'</p><a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=MODAL&utm_campaign=MBF%20Modal" class="button button-small upsell-button" target="_blank">'.__('Go Pro!', $this->plugin_slug).'</a></div>';
72 72
 
73 73
 		//Toolbar
74 74
 		$output .= '<div id="map-toolbar">';
75
-		$output .= '<button class="add-location button button-small gmb-magnific-inline" data-target="cmb2-id-gmb-geocoder" data-auto-focus="true"><span class="dashicons dashicons-pressthis"></span>' . __( 'Add Location', $this->plugin_slug ) . '</button>';
76
-		$output .= '<button class="drop-marker button button-small"><span class="dashicons dashicons-location"></span>' . __( 'Drop a Marker', $this->plugin_slug ) . '</button>';
77
-		$output .= '<button class="goto-location button button-small gmb-magnific-inline" data-target="map-autocomplete-wrap" data-auto-focus="true"><span class="dashicons dashicons-admin-site"></span>' . __( 'Goto Location', $this->plugin_slug ) . '</button>';
78
-		$output .= '<button class="edit-title button  button-small gmb-magnific-inline" data-target="map-title-wrap" data-auto-focus="true"><span class="dashicons dashicons-edit"></span>' . __( 'Edit Map Title', $this->plugin_slug ) . '</button>';
75
+		$output .= '<button class="add-location button button-small gmb-magnific-inline" data-target="cmb2-id-gmb-geocoder" data-auto-focus="true"><span class="dashicons dashicons-pressthis"></span>'.__('Add Location', $this->plugin_slug).'</button>';
76
+		$output .= '<button class="drop-marker button button-small"><span class="dashicons dashicons-location"></span>'.__('Drop a Marker', $this->plugin_slug).'</button>';
77
+		$output .= '<button class="goto-location button button-small gmb-magnific-inline" data-target="map-autocomplete-wrap" data-auto-focus="true"><span class="dashicons dashicons-admin-site"></span>'.__('Goto Location', $this->plugin_slug).'</button>';
78
+		$output .= '<button class="edit-title button  button-small gmb-magnific-inline" data-target="map-title-wrap" data-auto-focus="true"><span class="dashicons dashicons-edit"></span>'.__('Edit Map Title', $this->plugin_slug).'</button>';
79 79
 
80 80
 		$output .= '<div class="live-lat-lng-wrap clearfix">';
81
-		$output .= '<button disabled class="update-lat-lng button button-small">' . __( 'Set Lat/Lng', $this->plugin_slug ) . '</button>';
82
-		$output .= '<div class="live-latitude-wrap"><span class="live-latitude-label">' . __( 'Lat:', $this->plugin_slug ) . '</span><span class="live-latitude">' . ( isset( $lat_lng['latitude'] ) ? $lat_lng['latitude'] : '' ) . '</span></div>';
83
-		$output .= '<div class="live-longitude-wrap"><span class="live-longitude-label">' . __( 'Lng:', $this->plugin_slug ) . '</span><span class="live-longitude">' . ( isset( $lat_lng['longitude'] ) ? $lat_lng['longitude'] : '' ) . '</span></div>';
81
+		$output .= '<button disabled class="update-lat-lng button button-small">'.__('Set Lat/Lng', $this->plugin_slug).'</button>';
82
+		$output .= '<div class="live-latitude-wrap"><span class="live-latitude-label">'.__('Lat:', $this->plugin_slug).'</span><span class="live-latitude">'.(isset($lat_lng['latitude']) ? $lat_lng['latitude'] : '').'</span></div>';
83
+		$output .= '<div class="live-longitude-wrap"><span class="live-longitude-label">'.__('Lng:', $this->plugin_slug).'</span><span class="live-longitude">'.(isset($lat_lng['longitude']) ? $lat_lng['longitude'] : '').'</span></div>';
84 84
 		$output .= '</div>'; //End .live-lat-lng-wrap
85 85
 		$output .= '</div>'; //End #map-toolbar
86 86
 		$output .= '</div>'; //End #map
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 		$output .= '<div class="inner-modal-wrap">';
92 92
 		$output .= '<div class="inner-modal-container">';
93 93
 		$output .= '<div class="inner-modal clearfix">';
94
-		$output .= '<label for="post_title" class="map-title">' . __( 'Map Title', $this->plugin_slug ) . '</label>';
95
-		$output .= '<p class="cmb2-metabox-description">' . __( 'Give your Map a descriptive title', $this->plugin_slug ) . '</p>';
96
-		$output .= '<button type="button" class="gmb-modal-close">&times;</button><input type="text" name="model_post_title" size="30" value="' . get_the_title() . '" id="modal_title" spellcheck="true" autocomplete="off" placeholder="' . __( 'Enter map title', $this->plugin_slug ) . '">';
94
+		$output .= '<label for="post_title" class="map-title">'.__('Map Title', $this->plugin_slug).'</label>';
95
+		$output .= '<p class="cmb2-metabox-description">'.__('Give your Map a descriptive title', $this->plugin_slug).'</p>';
96
+		$output .= '<button type="button" class="gmb-modal-close">&times;</button><input type="text" name="model_post_title" size="30" value="'.get_the_title().'" id="modal_title" spellcheck="true" autocomplete="off" placeholder="'.__('Enter map title', $this->plugin_slug).'">';
97 97
 		$output .= '</div>';
98 98
 		$output .= '</div>';
99 99
 		$output .= '</div>';
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 		$output .= '<div class="inner-modal-wrap">';
104 104
 		$output .= '<div class="inner-modal-container">';
105 105
 		$output .= '<div class="inner-modal clearfix">';
106
-		$output .= '<label for="map-location-autocomplete" class="map-title">' . __( 'Enter a Location', $this->plugin_slug ) . '</label>';
107
-		$output .= '<p class="cmb2-metabox-description">' . __( 'Type your point of interest below and the map will be re-centered over that location', $this->plugin_slug ) . '</p>';
106
+		$output .= '<label for="map-location-autocomplete" class="map-title">'.__('Enter a Location', $this->plugin_slug).'</label>';
107
+		$output .= '<p class="cmb2-metabox-description">'.__('Type your point of interest below and the map will be re-centered over that location', $this->plugin_slug).'</p>';
108 108
 		$output .= '<button type="button" class="gmb-modal-close">&times;</button>';
109 109
 		$output .= '<input type="text" name="" size="30" id="map-location-autocomplete">';
110 110
 		$output .= '</div>';
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 		$output .= '<div class="warning-message wpgp-message"></div>';
116 116
 
117 117
 		//Markers Modal
118
-		gmb_include_view( 'admin/views/markers.php', false, $this->view_data() );
118
+		gmb_include_view('admin/views/markers.php', false, $this->view_data());
119 119
 
120
-		echo apply_filters( 'google_maps_preview', $output );
120
+		echo apply_filters('google_maps_preview', $output);
121 121
 
122 122
 	}
123 123
 
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @return string
136 136
 	 */
137
-	function gmb_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
137
+	function gmb_modify_cmb2_form_output($form_format, $object_id, $cmb) {
138 138
 
139 139
 		//only modify the give settings form
140
-		if ( 'gmb_settings' == $object_id && 'plugin_options' == $cmb->cmb_id ) {
140
+		if ('gmb_settings' == $object_id && 'plugin_options' == $cmb->cmb_id) {
141 141
 
142
-			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="gmb-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>';
142
+			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="gmb-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div></form>';
143 143
 		}
144 144
 
145 145
 		return $form_format;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		<div class="gmb-widget-upgrade clear">
160 160
 			<span class="powered-by"></span>
161 161
 			<a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=WIDGET&utm_campaign=MBF%20Widgets" target="_blank" class="button button-small">
162
-				<?php _e( 'Upgrade to Pro', $this->plugin_slug ); ?>
162
+				<?php _e('Upgrade to Pro', $this->plugin_slug); ?>
163 163
 				<span class="new-window"></span>
164 164
 			</a>
165 165
 		</div>
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @return String          Altered body classes.
177 177
 	 */
178
-	function admin_body_classes( $classes ) {
178
+	function admin_body_classes($classes) {
179 179
 
180 180
 		global $post;
181 181
 
182
-		if ( isset( $post->post_type ) && $post->post_type == 'google_maps' ) {
182
+		if (isset($post->post_type) && $post->post_type == 'google_maps') {
183 183
 			$classes .= 'maps-builder-free';
184 184
 		}
185 185
 
Please login to merge, or discard this patch.
includes/admin/class-gmb-shortcode-generator.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	public function __construct() {
16 16
 		parent::__construct();
17
-		add_action( 'gmb_after_shortcode_form', array( $this, 'form_upsell') );
18
-		add_action( 'gmb_shortcode_iframe_style', array( $this, 'upsell_css' ) );
17
+		add_action('gmb_after_shortcode_form', array($this, 'form_upsell'));
18
+		add_action('gmb_shortcode_iframe_style', array($this, 'upsell_css'));
19 19
 	}
20 20
 
21 21
 	
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @return string
31 31
 	 */
32
-	public static function select( $args = array() ) {
32
+	public static function select($args = array()) {
33 33
 
34 34
 		$defaults = array(
35 35
 			'options'          => array(),
@@ -40,59 +40,59 @@  discard block
 block discarded – undo
40 40
 			'chosen'           => false,
41 41
 			'placeholder'      => null,
42 42
 			'multiple'         => false,
43
-			'show_option_all'  => _x( 'All', 'all dropdown items', 'google-maps-builder' ),
44
-			'show_option_none' => _x( 'None', 'no dropdown items', 'google-maps-builder' )
43
+			'show_option_all'  => _x('All', 'all dropdown items', 'google-maps-builder'),
44
+			'show_option_none' => _x('None', 'no dropdown items', 'google-maps-builder')
45 45
 		);
46 46
 
47
-		$args = wp_parse_args( $args, $defaults );
47
+		$args = wp_parse_args($args, $defaults);
48 48
 
49
-		if ( $args['multiple'] ) {
49
+		if ($args['multiple']) {
50 50
 			$multiple = ' MULTIPLE';
51 51
 		} else {
52 52
 			$multiple = '';
53 53
 		}
54 54
 
55
-		if ( $args['chosen'] ) {
55
+		if ($args['chosen']) {
56 56
 			$args['class'] .= 'gmb-select-chosen';
57 57
 		}
58 58
 
59
-		if ( $args['placeholder'] ) {
59
+		if ($args['placeholder']) {
60 60
 			$placeholder = $args['placeholder'];
61 61
 		} else {
62 62
 			$placeholder = '';
63 63
 		}
64 64
 
65
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="gmb-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' data-placeholder="' . $placeholder . '">';
65
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="gmb-select '.esc_attr($args['class']).'"'.$multiple.' data-placeholder="'.$placeholder.'">';
66 66
 
67
-		if ( $args['show_option_all'] ) {
68
-			if ( $args['multiple'] ) {
69
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
67
+		if ($args['show_option_all']) {
68
+			if ($args['multiple']) {
69
+				$selected = selected(true, in_array(0, $args['selected']), false);
70 70
 			} else {
71
-				$selected = selected( $args['selected'], 0, false );
71
+				$selected = selected($args['selected'], 0, false);
72 72
 			}
73
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
73
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
74 74
 		}
75 75
 
76
-		if ( ! empty( $args['options'] ) ) {
76
+		if ( ! empty($args['options'])) {
77 77
 
78
-			if ( $args['show_option_none'] ) {
79
-				if ( $args['multiple'] ) {
80
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
78
+			if ($args['show_option_none']) {
79
+				if ($args['multiple']) {
80
+					$selected = selected(true, in_array( - 1, $args['selected'] ), false);
81 81
 				} else {
82
-					$selected = selected( $args['selected'], - 1, false );
82
+					$selected = selected($args['selected'], - 1, false);
83 83
 				}
84
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
84
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
85 85
 			}
86 86
 
87
-			foreach ( $args['options'] as $key => $option ) {
87
+			foreach ($args['options'] as $key => $option) {
88 88
 
89
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
90
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
89
+				if ($args['multiple'] && is_array($args['selected'])) {
90
+					$selected = selected(true, in_array($key, $args['selected']), false);
91 91
 				} else {
92
-					$selected = selected( $args['selected'], $key, false );
92
+					$selected = selected($args['selected'], $key, false);
93 93
 				}
94 94
 
95
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
95
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
96 96
 			}
97 97
 		}
98 98
 
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @uses "gmb_after_shortcode_form"
110 110
 	 */
111
-	public function form_upsell(){?>
111
+	public function form_upsell() {?>
112 112
 		<a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=SHORTCODE&utm_campaign=MBF%20Shortcode" class="button button-small shortcode-upsell" target="_blank">
113
-			<?php _e( 'Go Pro', 'google-maps-builder' ); ?>
113
+			<?php _e('Go Pro', 'google-maps-builder'); ?>
114 114
 			<span class="dashicons dashicons-external"></span>
115 115
 		</a>
116 116
 	<?php
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @uses "gmb_shortcode_iframe_style" action
126 126
 	 */
127
-	public function upsell_css(){ ?>
127
+	public function upsell_css() { ?>
128 128
 		.shortcode-upsell {
129 129
 			position: absolute;
130 130
 			bottom: 10px;
Please login to merge, or discard this patch.