Completed
Pull Request — develop (#900)
by William
04:03
created
src/admin/WL_Metabox/WL_Metabox_Field_coordinates.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 
4 4
 class WL_Metabox_Field_coordinates extends WL_Metabox_Field {
5 5
 
6
-	public function __construct( $args ) {
6
+	public function __construct($args) {
7 7
 
8 8
 		// Just set up the necessary info without calling the parent constructor.
9 9
 		// TODO: write a parent class for grouped properties
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 	public function get_data() {
17 17
 		$entity_id  = get_the_ID();
18
-		$this->data = wl_get_coordinates( $entity_id );
18
+		$this->data = wl_get_coordinates($entity_id);
19 19
 	}
20 20
 
21 21
 	public function html() {
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 		$data        = $this->data;
34 34
 		// TODO: We temporary use here 0,0 as default coordinates for the marker, but if no coordinates are given we
35 35
 		// want to use the current user location for the marker.
36
-		$coordinates = ( ! empty( $data['latitude'] ) && ! empty( $data['longitude'] ) ? sprintf( '[%f,%f]', $data['latitude'], $data['longitude'] ) : '[0,0]' );
36
+		$coordinates = ( ! empty($data['latitude']) && ! empty($data['longitude']) ? sprintf('[%f,%f]', $data['latitude'], $data['longitude']) : '[0,0]');
37 37
 		$map_init    = '[0,0]' === $coordinates
38 38
 			? 'locate( {setView: true, maxZoom: 16} )'
39
-			: sprintf( "setView( [%f,%f], 9 )", $data['latitude'], $data['longitude'] );
39
+			: sprintf("setView( [%f,%f], 9 )", $data['latitude'], $data['longitude']);
40 40
 
41 41
 		// Print input fields
42
-		$html .= '<label for="wl_place_lat">' . __( 'Latitude', 'wordlift' ) . '</label>';
43
-		$html .= '<input type="text" id="wl_place_lat" name="wl_metaboxes[coordinates][]" value="' . $data['latitude'] . '" style="width:100%" />';
42
+		$html .= '<label for="wl_place_lat">'.__('Latitude', 'wordlift').'</label>';
43
+		$html .= '<input type="text" id="wl_place_lat" name="wl_metaboxes[coordinates][]" value="'.$data['latitude'].'" style="width:100%" />';
44 44
 
45
-		$html .= '<label for="wl_place_lon">' . __( 'Longitude', 'wordlift' ) . '</label>';
46
-		$html .= '<input type="text" id="wl_place_lon" name="wl_metaboxes[coordinates][]" value="' . $data['longitude'] . '" style="width:100%" />';
45
+		$html .= '<label for="wl_place_lon">'.__('Longitude', 'wordlift').'</label>';
46
+		$html .= '<input type="text" id="wl_place_lon" name="wl_metaboxes[coordinates][]" value="'.$data['longitude'].'" style="width:100%" />';
47 47
 
48 48
 		// Show Leaflet map to pick coordinates
49
-		$element_id = uniqid( 'wl-gep-map-' );
49
+		$element_id = uniqid('wl-gep-map-');
50 50
 		$html .= <<<EOF
51 51
 
52 52
 <div id="$element_id"></div>
@@ -84,23 +84,23 @@  discard block
 block discarded – undo
84 84
 		return $html;
85 85
 	}
86 86
 
87
-	public function save_data( $coords ) {
87
+	public function save_data($coords) {
88 88
 
89
-		$this->sanitize_data( $coords );
89
+		$this->sanitize_data($coords);
90 90
 
91 91
 		$entity_id = get_the_ID();
92 92
 
93 93
 		// Take away old values
94
-		delete_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE );
95
-		delete_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE );
94
+		delete_post_meta($entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE);
95
+		delete_post_meta($entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE);
96 96
 
97 97
 		$latitude  = $this->data[0];
98 98
 		$longitude = $this->data[1];
99 99
 
100 100
 		// insert new coordinate values
101
-		if ( ! empty( $latitude ) && ! empty( $longitude ) ) {
102
-			add_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE, $latitude, true );
103
-			add_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, $longitude, true );
101
+		if ( ! empty($latitude) && ! empty($longitude)) {
102
+			add_post_meta($entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE, $latitude, true);
103
+			add_post_meta($entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, $longitude, true);
104 104
 		}
105 105
 
106 106
 	}
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	/**
109 109
 	 * Only accept float numbers
110 110
 	 */
111
-	public function sanitize_data_filter( $value ) {
111
+	public function sanitize_data_filter($value) {
112 112
 
113 113
 		// DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe:
114 114
 		// "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
115
-		if ( ! is_numeric( $value ) ) {
115
+		if ( ! is_numeric($value)) {
116 116
 			return '';
117 117
 		}
118 118
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-i18n.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		load_plugin_textdomain(
46 46
 			$this->domain,
47 47
 			false,
48
-			dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
48
+			dirname(dirname(plugin_basename(__FILE__))).'/languages/'
49 49
 		);
50 50
 
51 51
 	}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @since    1.0.0
57 57
 	 * @param    string    $domain    The domain that represents the locale of this plugin.
58 58
 	 */
59
-	public function set_domain( $domain ) {
59
+	public function set_domain($domain) {
60 60
 		$this->domain = $domain;
61 61
 	}
62 62
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-loader.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 * @param    int                  $priority         Optional. he priority at which the function should be fired. Default is 10.
64 64
 	 * @param    int                  $accepted_args    Optional. The number of arguments that should be passed to the $callback. Default is 1.
65 65
 	 */
66
-	public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
67
-		$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
66
+	public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) {
67
+		$this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args);
68 68
 	}
69 69
 
70 70
 	/**
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param    int                  $priority         Optional. he priority at which the function should be fired. Default is 10.
78 78
 	 * @param    int                  $accepted_args    Optional. The number of arguments that should be passed to the $callback. Default is 1
79 79
 	 */
80
-	public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
81
-		$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
80
+	public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) {
81
+		$this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args);
82 82
 	}
83 83
 
84 84
 	/**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @param    int                  $accepted_args    The number of arguments that should be passed to the $callback.
96 96
 	 * @return   array                                  The collection of actions and filters registered with WordPress.
97 97
 	 */
98
-	private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
98
+	private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) {
99 99
 
100 100
 		$hooks[] = array(
101 101
 			'hook'          => $hook,
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function run() {
118 118
 
119
-		foreach ( $this->filters as $hook ) {
120
-			add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
119
+		foreach ($this->filters as $hook) {
120
+			add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']);
121 121
 		}
122 122
 
123
-		foreach ( $this->actions as $hook ) {
124
-			add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
123
+		foreach ($this->actions as $hook) {
124
+			add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']);
125 125
 		}
126 126
 
127 127
 	}
Please login to merge, or discard this patch.
src/shortcodes/wordlift_shortcode_field.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
  * @param array $atts An array of shortcode attributes.
10 10
  * @return string A dom element with requested property value(s).
11 11
  */
12
-function wl_shortcode_field( $atts ) {
12
+function wl_shortcode_field($atts) {
13 13
 	
14 14
     // Extract attributes and set default values.
15
-    $field_atts = shortcode_atts( array(
15
+    $field_atts = shortcode_atts(array(
16 16
         'id'    => null,
17 17
         'name'  => null
18
-    ), $atts );
18
+    ), $atts);
19 19
     
20 20
     // Get id of the post
21 21
     $entity_id = $field_atts['id'];
22
-    if( is_null( $field_atts['id'] ) || !is_numeric( $field_atts['id'] ) ) {
22
+    if (is_null($field_atts['id']) || ! is_numeric($field_atts['id'])) {
23 23
         $entity_id = get_the_ID();
24 24
     }
25 25
 
26 26
     $property_name = $field_atts['name'];
27
-    if( !is_null( $property_name ) ) {
28
-        $values = wl_schema_get_value( $entity_id, $property_name );
27
+    if ( ! is_null($property_name)) {
28
+        $values = wl_schema_get_value($entity_id, $property_name);
29 29
     }
30 30
     
31 31
     // Return
32
-    if( is_array( $values ) ) {
33
-        return implode( ', ', $values );
32
+    if (is_array($values)) {
33
+        return implode(', ', $values);
34 34
     } else {
35 35
         return null;
36 36
     }
@@ -40,5 +40,5 @@  discard block
 block discarded – undo
40 40
     add_shortcode('wl_field', 'wl_shortcode_field');
41 41
 }
42 42
 
43
-add_action( 'init', 'wl_register_shortcode_field');
43
+add_action('init', 'wl_register_shortcode_field');
44 44
 
Please login to merge, or discard this patch.
src/widgets/wordlift_widget_geo.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
      * @param array $args
28 28
      * @param array $instance
29 29
      */
30
-    public function widget( $args, $instance )
30
+    public function widget($args, $instance)
31 31
     {
32 32
         // Get the widget's title.
33 33
         $title = apply_filters('widget_title', $instance['title']);
34 34
 
35 35
         // Print the HTML output.
36 36
         echo $args['before_widget'];
37
-        if (!empty($title)) {
38
-            echo $args['before_title'] . $title . $args['after_title'];
37
+        if ( ! empty($title)) {
38
+            echo $args['before_title'].$title.$args['after_title'];
39 39
         }
40 40
 
41 41
         // Print the geomap shortcode
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     {
82 82
 
83 83
         $instance = array();
84
-        $instance['title'] = (!empty($new_instance['title'])) ? strip_tags($new_instance['title']) : '';
84
+        $instance['title'] = ( ! empty($new_instance['title'])) ? strip_tags($new_instance['title']) : '';
85 85
 
86 86
         return $instance;
87 87
     }
Please login to merge, or discard this patch.
src/includes/class-wordlift-ui-service.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @return string The button HTML code.
33 33
 	 */
34
-	public function get_button_html( $element_id, $label ) {
34
+	public function get_button_html($element_id, $label) {
35 35
 
36
-		return sprintf( self::BUTTON_HTML, $element_id, esc_html( $label ) );
36
+		return sprintf(self::BUTTON_HTML, $element_id, esc_html($label));
37 37
 	}
38 38
 
39 39
 	/**
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @return string The button HTML code.
48 48
 	 */
49
-	public function print_button( $element_id, $label ) {
49
+	public function print_button($element_id, $label) {
50 50
 
51
-		echo( $this->get_button_html( $element_id, $label ) );
51
+		echo($this->get_button_html($element_id, $label));
52 52
 
53 53
 	}
54 54
 
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string The HTML code.
64 64
 	 */
65
-	public function get_template_html( $element_id, $body ) {
65
+	public function get_template_html($element_id, $body) {
66 66
 
67
-		return sprintf( self::TEMPLATE_HTML, $element_id, $body );
67
+		return sprintf(self::TEMPLATE_HTML, $element_id, $body);
68 68
 	}
69 69
 
70 70
 	/**
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @return string The HTML code.
79 79
 	 */
80
-	public function print_template( $element_id, $body ) {
80
+	public function print_template($element_id, $body) {
81 81
 
82
-		echo( $this->get_template_html( $element_id, $body ) );
82
+		echo($this->get_template_html($element_id, $body));
83 83
 
84 84
 	}
85 85
 
Please login to merge, or discard this patch.
src/admin/class-wordlift-primashop-adapter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 		// Tell WP (and PrimaShop) that we support the *prima-layout-settings*. This will display the Content Settings
18 18
 		// in the entity edit page.
19
-		add_post_type_support( Wordlift_Entity_Service::TYPE_NAME, 'prima-layout-settings' );
19
+		add_post_type_support(Wordlift_Entity_Service::TYPE_NAME, 'prima-layout-settings');
20 20
 
21 21
 	}
22 22
 
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @return array A meta array.
33 33
 	 */
34
-	function prima_metabox_entity_header_args( $meta, $ype ) {
34
+	function prima_metabox_entity_header_args($meta, $ype) {
35 35
 
36
-		return apply_filters( "prima_metabox_post_header_args", $meta, 'post' );
36
+		return apply_filters("prima_metabox_post_header_args", $meta, 'post');
37 37
 	}
38 38
 
39 39
 }
Please login to merge, or discard this patch.
src/admin/class-wordlift-notice-service.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	public function __construct() {
70 70
 
71 71
 		// Hook to be called when to display notices.
72
-		add_action( 'admin_notices', array( $this, 'admin_notices' ) );
72
+		add_action('admin_notices', array($this, 'admin_notices'));
73 73
 
74 74
 		self::$instance = $this;
75 75
 
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 	 * @param string $class The css class.
95 95
 	 * @param string $message The message.
96 96
 	 */
97
-	public function add( $class, $message ) {
97
+	public function add($class, $message) {
98 98
 
99
-		$this->notices[] = sprintf( self::TEMPLATE, $class, $this->transform( $message ) );
99
+		$this->notices[] = sprintf(self::TEMPLATE, $class, $this->transform($message));
100 100
 
101 101
 	}
102 102
 
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @param string $message The message to display.
109 109
 	 */
110
-	public function add_update( $message ) {
110
+	public function add_update($message) {
111 111
 
112
-		$this->add( self::UPDATE, $message );
112
+		$this->add(self::UPDATE, $message);
113 113
 
114 114
 	}
115 115
 
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @param string $message The message to display.
122 122
 	 */
123
-	public function add_update_nag( $message ) {
123
+	public function add_update_nag($message) {
124 124
 
125
-		$this->add( self::UPDATE_NAG, $message );
125
+		$this->add(self::UPDATE_NAG, $message);
126 126
 
127 127
 	}
128 128
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @param string $message The message to display.
135 135
 	 */
136
-	public function add_error( $message ) {
136
+	public function add_error($message) {
137 137
 
138
-		$this->add( self::ERROR, $message );
138
+		$this->add(self::ERROR, $message);
139 139
 
140 140
 	}
141 141
 
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @param string $message The message to display.
148 148
 	 */
149
-	public function add_suggestion( $message ) {
149
+	public function add_suggestion($message) {
150 150
 
151
-		$this->add( self::SUGGESTION, $message );
151
+		$this->add(self::SUGGESTION, $message);
152 152
 
153 153
 	}
154 154
 
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function admin_notices() {
161 161
 
162
-		foreach ( $this->notices as $notice ) {
163
-			echo( $notice );
162
+		foreach ($this->notices as $notice) {
163
+			echo($notice);
164 164
 		}
165 165
 
166 166
 	}
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @param string $message The message.
174 174
 	 */
175
-	private function transform( $message ) {
175
+	private function transform($message) {
176 176
 
177
-		switch (  gettype( $message ) ) {
177
+		switch (gettype($message)) {
178 178
 			case 'array':
179
-				return implode( $message, '<br />' );
179
+				return implode($message, '<br />');
180 180
 			default:
181 181
        			return $message;
182 182
 		}
Please login to merge, or discard this patch.
src/wordlift_manual_translations.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@
 block discarded – undo
3 3
 // File created to manage some dynamic translation used in the code
4 4
 // See http://keithdevon.com/using-variables-wordpress-translation-functions/
5 5
 
6
-__( 'There are no related posts for the current entity.', 'wordlift' );
7
-__( 'This entity has not description.', 'wordlift' );
8
-__( 'There are no related entities for the current entity.', 'wordlift' );
9
-__( 'This entity is not published. It will not appear within analysis results.', 'wordlift' );
10
-__( 'This entity has no featured image yet.', 'wordlift' );
11
-__( 'There are no sameAs configured for this entity.', 'wordlift' );
12
-__( 'Schema.org metadata for this entity are not completed.', 'wordlift' );
6
+__('There are no related posts for the current entity.', 'wordlift');
7
+__('This entity has not description.', 'wordlift');
8
+__('There are no related entities for the current entity.', 'wordlift');
9
+__('This entity is not published. It will not appear within analysis results.', 'wordlift');
10
+__('This entity has no featured image yet.', 'wordlift');
11
+__('There are no sameAs configured for this entity.', 'wordlift');
12
+__('Schema.org metadata for this entity are not completed.', 'wordlift');
13 13
 
Please login to merge, or discard this patch.