Completed
Pull Request — master (#2)
by Jimmy
1216:52 queued 1185:43
created
core/wpeo_model/controller/post_ctr.01.php 2 patches
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 
4 4
 /**
@@ -18,31 +18,31 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 		/**	Ajout des routes personnalisées pour les éléments de type "post" / Add specific routes for "post" elements' type	*/
21
-		add_filter( 'json_endpoints', array( &$this, 'callback_register_route' ) );
21
+		add_filter('json_endpoints', array(&$this, 'callback_register_route'));
22 22
 	}
23 23
 
24
-	public function update( $data ) {
24
+	public function update($data) {
25 25
 		$object = $data;
26 26
 
27
-		if( is_array( $data ) ) {
28
-			$object = new $this->model_name( $data, $this->meta_key );
27
+		if (is_array($data)) {
28
+			$object = new $this->model_name($data, $this->meta_key);
29 29
 		}
30 30
 
31
-		wp_update_post( $object->do_wp_object() );
31
+		wp_update_post($object->do_wp_object());
32 32
 
33 33
 		/** On insert ou on met à jour les meta */
34
-		if( !empty( $object->option ) ) {
35
-			$object->save_meta_data( $object, 'update_post_meta', $this->meta_key );
34
+		if (!empty($object->option)) {
35
+			$object->save_meta_data($object, 'update_post_meta', $this->meta_key);
36 36
 		}
37 37
 
38 38
 		/** On insert les terms */
39
-		if ( !empty( $object->taxonomy ) ) {
40
-			foreach( $object->taxonomy as $taxonomy => $array_value ) {
41
-				if( !empty( $taxonomy ) && !empty( $array_value ) ) {
42
-					wp_set_object_terms( $object->id, $array_value, $taxonomy );
39
+		if (!empty($object->taxonomy)) {
40
+			foreach ($object->taxonomy as $taxonomy => $array_value) {
41
+				if (!empty($taxonomy) && !empty($array_value)) {
42
+					wp_set_object_terms($object->id, $array_value, $taxonomy);
43 43
 				}
44
-				else if( !empty( $taxonomy ) && empty( $array_value ) ) {
45
-					wp_set_object_terms( $object->id, '', $taxonomy );
44
+				else if (!empty($taxonomy) && empty($array_value)) {
45
+					wp_set_object_terms($object->id, '', $taxonomy);
46 46
 				}
47 47
 			}
48 48
 		}
@@ -50,24 +50,24 @@  discard block
 block discarded – undo
50 50
 		return $object;
51 51
 	}
52 52
 
53
-	public function create( $data ) {
53
+	public function create($data) {
54 54
 		$object = $data;
55 55
 
56
-		if( is_array( $data ) ) {
57
-			$object = new $this->model_name( $data, $this->meta_key );
56
+		if (is_array($data)) {
57
+			$object = new $this->model_name($data, $this->meta_key);
58 58
 			$object->type = $this->post_type;
59 59
 		}
60
-		$object->id = wp_insert_post( $object->do_wp_object() );
60
+		$object->id = wp_insert_post($object->do_wp_object());
61 61
 		/** On insert ou on met à jour les meta */
62
-		if( !empty( $object->option ) ) {
63
-			$object->save_meta_data( $object, 'update_post_meta', $this->meta_key );
62
+		if (!empty($object->option)) {
63
+			$object->save_meta_data($object, 'update_post_meta', $this->meta_key);
64 64
 		}
65 65
 
66 66
 		/** On insert les terms */
67
-		if ( !empty( $object->taxonomy ) ) {
68
-			foreach( $object->taxonomy as $taxonomy => $array_value ) {
69
-				if( !empty( $taxonomy ) && !empty( $array_value ) ) {
70
-					wp_set_object_terms( $object->id, $array_value, $taxonomy );
67
+		if (!empty($object->taxonomy)) {
68
+			foreach ($object->taxonomy as $taxonomy => $array_value) {
69
+				if (!empty($taxonomy) && !empty($array_value)) {
70
+					wp_set_object_terms($object->id, $array_value, $taxonomy);
71 71
 				}
72 72
 			}
73 73
 		}
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return Object L'objet construit selon le modèle définit / Builded object by model structure
92 92
 	 */
93
-	public function show( $id, $cropped = false ) {
93
+	public function show($id, $cropped = false) {
94 94
 
95
- 		$post = get_post( $id );
96
-		$post = new $this->model_name( $post, $this->meta_key, $cropped );
95
+ 		$post = get_post($id);
96
+		$post = new $this->model_name($post, $this->meta_key, $cropped);
97 97
 
98 98
 		return $post;
99 99
 	}
100 100
 
101
-	public function index( $args_where = array( 'post_parent' => 0 ), $cropped = false ) {
101
+	public function index($args_where = array('post_parent' => 0), $cropped = false) {
102 102
 		$array_model = array();
103 103
 
104 104
 		$args = array(
@@ -107,32 +107,32 @@  discard block
 block discarded – undo
107 107
 			'posts_per_page' 	=> -1,
108 108
 		);
109 109
 
110
-		$args = array_merge( $args, $args_where );
111
-		$array_post = get_posts( $args );
110
+		$args = array_merge($args, $args_where);
111
+		$array_post = get_posts($args);
112 112
 
113
-		if( !empty( $array_post ) ) {
114
-			foreach( $array_post as $key => $post ) {
115
-				$array_model[$key] = new $this->model_name( $post, $this->meta_key, $cropped );
113
+		if (!empty($array_post)) {
114
+			foreach ($array_post as $key => $post) {
115
+				$array_model[$key] = new $this->model_name($post, $this->meta_key, $cropped);
116 116
 			}
117 117
 		}
118 118
 
119 119
 		return $array_model;
120 120
 	}
121 121
 
122
-	public function search( $search, $array ) {
122
+	public function search($search, $array) {
123 123
 			global $wpdb;
124 124
 
125
-			if( empty( $array ) || !is_array( $array ) )
125
+			if (empty($array) || !is_array($array))
126 126
 				return array();
127 127
 
128 128
 			$where = ' AND ( ';
129 129
 
130
-			if ( !empty( $array ) ) {
131
-			  foreach ( $array as $key => $element ) {
132
-					if( is_array( $element ) ) {
133
-						foreach( $element as $sub_element ) {
130
+			if (!empty($array)) {
131
+			  foreach ($array as $key => $element) {
132
+					if (is_array($element)) {
133
+						foreach ($element as $sub_element) {
134 134
 							$where .= $where == ' AND ( ' ? '' : ' OR ';
135
-							$where .= ' (PM.meta_key="' . $sub_element . '" AND PM.meta_value LIKE "%'. $search . '%") ';
135
+							$where .= ' (PM.meta_key="' . $sub_element . '" AND PM.meta_value LIKE "%' . $search . '%") ';
136 136
 						}
137 137
 					}
138 138
 					else {
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 			$where .= ' ) ';
146 146
 
147 147
 
148
-			$list_group = $wpdb->get_results( "SELECT DISTINCT P.ID FROM {$wpdb->posts} as P JOIN {$wpdb->postmeta} AS PM ON PM.post_id=P.ID WHERE P.post_type='".$this->get_post_type()."'" . $where );
148
+			$list_group = $wpdb->get_results("SELECT DISTINCT P.ID FROM {$wpdb->posts} as P JOIN {$wpdb->postmeta} AS PM ON PM.post_id=P.ID WHERE P.post_type='" . $this->get_post_type() . "'" . $where);
149 149
 
150 150
 			$list_model = array();
151 151
 
152
-			if ( !empty( $list_group ) ) {
153
-			  foreach ( $list_group as $element ) {
154
-					$list_model[] = $this->show( $element->ID );
152
+			if (!empty($list_group)) {
153
+			  foreach ($list_group as $element) {
154
+					$list_model[] = $this->show($element->ID);
155 155
 			  }
156 156
 			}
157 157
 
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
 	 * @param mixed $object
165 165
 	 * @return array|WP_Error Array of term_id
166 166
 	 */
167
-	public static function eo_get_object_terms( $object ) {
168
-		$list_term 		= array();
169
-		$array_model 	= $object->get_model();
167
+	public static function eo_get_object_terms($object) {
168
+		$list_term = array();
169
+		$array_model = $object->get_model();
170 170
 
171
-		if( !empty( $array_model ) && !empty( $array_model['taxonomy'] ) ) {
172
-			foreach( $array_model['taxonomy'] as $key => $value ) {
173
-				$list_term[$key] = wp_get_object_terms( $object->id, $key, array( 'fields' => 'ids' ) );
171
+		if (!empty($array_model) && !empty($array_model['taxonomy'])) {
172
+			foreach ($array_model['taxonomy'] as $key => $value) {
173
+				$list_term[$key] = wp_get_object_terms($object->id, $key, array('fields' => 'ids'));
174 174
 			}
175 175
 		}
176 176
 
@@ -193,25 +193,25 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @return array La liste des routes personnalisées ajoutées aux routes existantes / The personnalized routes added to existing
195 195
 	 */
196
-	public function callback_register_route( $array_route ) {
196
+	public function callback_register_route($array_route) {
197 197
 		/** Récupération de la liste complète des éléments / Get all existing elements */
198
-		$array_route['/' . $this->version . '/get/' . $this->base ] = array(
199
-				array( array( $this, 'index' ), WP_JSON_Server::READABLE | WP_JSON_Server::ACCEPT_JSON )
198
+		$array_route['/' . $this->version . '/get/' . $this->base] = array(
199
+				array(array($this, 'index'), WP_JSON_Server::READABLE | WP_JSON_Server::ACCEPT_JSON)
200 200
 		);
201 201
 
202 202
 		/** Récupération d'un élément donné / Get a given element */
203 203
 		$array_route['/' . $this->version . '/get/' . $this->base . '/(?P<id>\d+)'] = array(
204
-				array( array( $this, 'show' ), WP_JSON_Server::READABLE |  WP_JSON_Server::ACCEPT_JSON )
204
+				array(array($this, 'show'), WP_JSON_Server::READABLE | WP_JSON_Server::ACCEPT_JSON)
205 205
 		);
206 206
 
207 207
 		/** Mise à jour d'un élément / Update an element */
208 208
 		$array_route['/' . $this->version . '/post/' . $this->base . ''] = array(
209
-				array( array( $this, 'update' ), WP_JSON_Server::CREATABLE | WP_JSON_Server::ACCEPT_JSON ),
209
+				array(array($this, 'update'), WP_JSON_Server::CREATABLE | WP_JSON_Server::ACCEPT_JSON),
210 210
 		);
211 211
 
212 212
 		/** Suppression d'un élément / Delete an element */
213 213
 		$array_route['/' . $this->version . '/delete/' . $this->base . '/(?P<id>\d+)'] = array(
214
-				array( array( $this, 'delete' ), WP_JSON_Server::DELETABLE | WP_JSON_Server::ACCEPT_JSON ),
214
+				array(array($this, 'delete'), WP_JSON_Server::DELETABLE | WP_JSON_Server::ACCEPT_JSON),
215 215
 		);
216 216
 
217 217
 		return $array_route;
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return boolean|string Le titre du post si il est trouvé, false dans le cas contraire / The post title in case it is founded, false in other case
226 226
 	 */
227
-	public function get_title_by_id( $post_id ) {
228
-		if (  true !== is_int( ( int )$post_id ) )
227
+	public function get_title_by_id($post_id) {
228
+		if (true !== is_int((int)$post_id))
229 229
 			return false;
230 230
 
231
-		$post_title = get_post_field( 'post_title', $post_id );
231
+		$post_title = get_post_field('post_title', $post_id);
232 232
 
233 233
 		return $post_title;
234 234
 	}
Please login to merge, or discard this patch.
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 
4 6
 /**
@@ -40,8 +42,7 @@  discard block
 block discarded – undo
40 42
 			foreach( $object->taxonomy as $taxonomy => $array_value ) {
41 43
 				if( !empty( $taxonomy ) && !empty( $array_value ) ) {
42 44
 					wp_set_object_terms( $object->id, $array_value, $taxonomy );
43
-				}
44
-				else if( !empty( $taxonomy ) && empty( $array_value ) ) {
45
+				} else if( !empty( $taxonomy ) && empty( $array_value ) ) {
45 46
 					wp_set_object_terms( $object->id, '', $taxonomy );
46 47
 				}
47 48
 			}
@@ -122,8 +123,9 @@  discard block
 block discarded – undo
122 123
 	public function search( $search, $array ) {
123 124
 			global $wpdb;
124 125
 
125
-			if( empty( $array ) || !is_array( $array ) )
126
-				return array();
126
+			if( empty( $array ) || !is_array( $array ) ) {
127
+							return array();
128
+			}
127 129
 
128 130
 			$where = ' AND ( ';
129 131
 
@@ -134,8 +136,7 @@  discard block
 block discarded – undo
134 136
 							$where .= $where == ' AND ( ' ? '' : ' OR ';
135 137
 							$where .= ' (PM.meta_key="' . $sub_element . '" AND PM.meta_value LIKE "%'. $search . '%") ';
136 138
 						}
137
-					}
138
-					else {
139
+					} else {
139 140
 						$where .= $where == ' AND ( ' ? '' : ' OR ';
140 141
 						$where .= ' P.' . $element . ' LIKE "%' . $search . '%" ';
141 142
 					}
@@ -225,8 +226,9 @@  discard block
 block discarded – undo
225 226
 	 * @return boolean|string Le titre du post si il est trouvé, false dans le cas contraire / The post title in case it is founded, false in other case
226 227
 	 */
227 228
 	public function get_title_by_id( $post_id ) {
228
-		if (  true !== is_int( ( int )$post_id ) )
229
-			return false;
229
+		if (  true !== is_int( ( int )$post_id ) ) {
230
+					return false;
231
+		}
230 232
 
231 233
 		$post_title = get_post_field( 'post_title', $post_id );
232 234
 
Please login to merge, or discard this patch.
core/wpeo_model/model/user_mdl.01.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 /**
3 3
  * Fichier de définition du modèle des utilisateurs / File for user model definition
4 4
  *
@@ -173,24 +173,24 @@  discard block
 block discarded – undo
173 173
 	 * @param string $meta_key Le nom de la "meta" contenant la définition complète de l'object sous forme json / The "meta" name containing the complete definition of object under json format
174 174
 	 * @param boolean $cropped Permet de choisir si on construit le modèle complet ou uniquement les champs principaux / Allows to choose if the entire model have to be build or only main model
175 175
 	 */
176
-	public function __construct( $object, $meta_key, $cropped = false ) {
176
+	public function __construct($object, $meta_key, $cropped = false) {
177 177
 		/**	Instanciation du constructeur de modèle principal / Instanciate the main model constructor	*/
178
-		parent::__construct( $object );
178
+		parent::__construct($object);
179 179
 
180 180
 		/** If cropped don't get meta */
181
-		if ( !$cropped ) {
182
-			$user_meta = get_user_meta( $this->id );
181
+		if (!$cropped) {
182
+			$user_meta = get_user_meta($this->id);
183 183
 
184
-			if ( !empty( $user_meta ) )
185
-				$user_meta = array_merge( $user_meta, get_user_meta( $this->id, $meta_key ) );
184
+			if (!empty($user_meta))
185
+				$user_meta = array_merge($user_meta, get_user_meta($this->id, $meta_key));
186 186
 			else
187
-				$user_meta = get_user_meta( $this->id, $meta_key );
187
+				$user_meta = get_user_meta($this->id, $meta_key);
188 188
 
189
-			$internal_meta = !empty( $user_meta ) && !empty( $user_meta[ $meta_key ] ) && !empty( $user_meta[ $meta_key ][ 0 ] ) ? json_decode( $user_meta[ $meta_key ][ 0 ], true ) : null;
189
+			$internal_meta = !empty($user_meta) && !empty($user_meta[$meta_key]) && !empty($user_meta[$meta_key][0]) ? json_decode($user_meta[$meta_key][0], true) : null;
190 190
 
191
-			if ( !empty( $this->array_option ) ) {
192
-				foreach( $this->array_option as $key => $array ) {
193
-					$this->option[ $key ] = $this->fill_value( $object, $user_meta, $key, $array, $internal_meta );
191
+			if (!empty($this->array_option)) {
192
+				foreach ($this->array_option as $key => $array) {
193
+					$this->option[$key] = $this->fill_value($object, $user_meta, $key, $array, $internal_meta);
194 194
 				}
195 195
 			}
196 196
 		}
@@ -203,19 +203,19 @@  discard block
 block discarded – undo
203 203
 	 *
204 204
 	 * @return string Les initiales de l'utilisateur courant / Current user initial
205 205
 	 */
206
-	public static function build_user_initial( $user ){
206
+	public static function build_user_initial($user) {
207 207
 		$initial = '';
208 208
 
209
-		if ( !empty( $user->option['user_info']['firstname'] ) ) {
210
-			$initial .= substr( $user->option['user_info']['firstname'], 0, 1 );
209
+		if (!empty($user->option['user_info']['firstname'])) {
210
+			$initial .= substr($user->option['user_info']['firstname'], 0, 1);
211 211
 		}
212
-		if ( !empty( $user->option['user_info']['lastname'] ) ) {
213
-			$initial .= substr( $user->option['user_info']['lastname'], 0, 1 );
212
+		if (!empty($user->option['user_info']['lastname'])) {
213
+			$initial .= substr($user->option['user_info']['lastname'], 0, 1);
214 214
 		}
215 215
 
216
-		if ( empty( $initial ) ) {
217
-			if ( !empty( $user->login ) ) {
218
-				$initial .= substr( $user->login, 0, 1 );
216
+		if (empty($initial)) {
217
+			if (!empty($user->login)) {
218
+				$initial .= substr($user->login, 0, 1);
219 219
 			}
220 220
 		}
221 221
 
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @return string L'adresse url du gravatar de l'utilisateur / The url address of current user gravatar
234 234
 	 */
235
-	public static function build_user_avatar_url( $user ) {
236
-		if ( empty( $user ) || empty( $user->user_email ) )
235
+	public static function build_user_avatar_url($user) {
236
+		if (empty($user) || empty($user->user_email))
237 237
 			return self::$gravatar_url . '00000000000000000000000000000000?d=blank';
238 238
 
239
-		return self::$gravatar_url . md5( $user->user_email );
239
+		return self::$gravatar_url . md5($user->user_email);
240 240
 	}
241 241
 
242 242
 }
Please login to merge, or discard this patch.
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 /**
3 5
  * Fichier de définition du modèle des utilisateurs / File for user model definition
4 6
  *
@@ -181,10 +183,11 @@  discard block
 block discarded – undo
181 183
 		if ( !$cropped ) {
182 184
 			$user_meta = get_user_meta( $this->id );
183 185
 
184
-			if ( !empty( $user_meta ) )
185
-				$user_meta = array_merge( $user_meta, get_user_meta( $this->id, $meta_key ) );
186
-			else
187
-				$user_meta = get_user_meta( $this->id, $meta_key );
186
+			if ( !empty( $user_meta ) ) {
187
+							$user_meta = array_merge( $user_meta, get_user_meta( $this->id, $meta_key ) );
188
+			} else {
189
+							$user_meta = get_user_meta( $this->id, $meta_key );
190
+			}
188 191
 
189 192
 			$internal_meta = !empty( $user_meta ) && !empty( $user_meta[ $meta_key ] ) && !empty( $user_meta[ $meta_key ][ 0 ] ) ? json_decode( $user_meta[ $meta_key ][ 0 ], true ) : null;
190 193
 
@@ -233,8 +236,9 @@  discard block
 block discarded – undo
233 236
 	 * @return string L'adresse url du gravatar de l'utilisateur / The url address of current user gravatar
234 237
 	 */
235 238
 	public static function build_user_avatar_url( $user ) {
236
-		if ( empty( $user ) || empty( $user->user_email ) )
237
-			return self::$gravatar_url . '00000000000000000000000000000000?d=blank';
239
+		if ( empty( $user ) || empty( $user->user_email ) ) {
240
+					return self::$gravatar_url . '00000000000000000000000000000000?d=blank';
241
+		}
238 242
 
239 243
 		return self::$gravatar_url . md5( $user->user_email );
240 244
 	}
Please login to merge, or discard this patch.
core/wpeo_model/model/comment_mdl.01.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 /**
3 3
  * Fichier de définition du modèle des commentaires / File for comment model definition
4 4
  *
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
 	 * @param string $meta_key Le nom de la "meta" contenant la définition complète de l'object sous forme json / The "meta" name containing the complete definition of object under json format
110 110
 	 * @param boolean $cropped Permet de choisir si on construit le modèle complet ou uniquement les champs principaux / Allows to choose if the entire model have to be build or only main model
111 111
 	 */
112
-	public function __construct( $object, $meta_key, $cropped ) {
113
-		parent::__construct( $object );
112
+	public function __construct($object, $meta_key, $cropped) {
113
+		parent::__construct($object);
114 114
 
115 115
 		/** If cropped, don't get meta */
116
-		if(!$cropped) {
116
+		if (!$cropped) {
117 117
 			/** Meta */
118
-			$comment_meta = get_comment_meta( $this->id );
119
-			$internal_meta = !empty( $comment_meta ) && !empty( $comment_meta[ $meta_key ] ) && !empty( $comment_meta[ $meta_key ][ 0 ] ) ? json_decode( $comment_meta[ $meta_key ][ 0 ], true ) : null;
118
+			$comment_meta = get_comment_meta($this->id);
119
+			$internal_meta = !empty($comment_meta) && !empty($comment_meta[$meta_key]) && !empty($comment_meta[$meta_key][0]) ? json_decode($comment_meta[$meta_key][0], true) : null;
120 120
 
121
-			if( !empty( $this->array_option ) ) {
122
-				foreach( $this->array_option as $key => $array ) {
123
-					$this->option[ $key ] = $this->fill_value( $object, $comment_meta, $key, $array, $internal_meta );
121
+			if (!empty($this->array_option)) {
122
+				foreach ($this->array_option as $key => $array) {
123
+					$this->option[$key] = $this->fill_value($object, $comment_meta, $key, $array, $internal_meta);
124 124
 				}
125 125
 			}
126 126
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 /**
3 5
  * Fichier de définition du modèle des taxinomies / File for term model definition
4 6
  *
Please login to merge, or discard this patch.
core/wpeo_model/model/post_mdl.01.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 /**
3 3
  * Fichier de définition du modèle des éléments "custom post type" / File for "custom post types" element model definition
4 4
  *
@@ -127,19 +127,19 @@  discard block
 block discarded – undo
127 127
 	 * @param string $meta_key Le nom de la "meta" contenant la définition complète de l'object sous forme json / The "meta" name containing the complete definition of object under json format
128 128
 	 * @param boolean $cropped Permet de choisir si on construit le modèle complet ou uniquement les champs principaux / Allows to choose if the entire model have to be build or only main model
129 129
 	 */
130
-	public function __construct( $object, $meta_key, $cropped ) {
130
+	public function __construct($object, $meta_key, $cropped) {
131 131
 		/**	Instanciation du constructeur de modèle principal / Instanciate the main model constructor	*/
132
-		parent::__construct( $object );
132
+		parent::__construct($object);
133 133
 
134 134
 		/** If cropped don't get meta */
135
-		if(!$cropped) {
135
+		if (!$cropped) {
136 136
 
137 137
 			/** Meta */
138
-			$post_meta = get_post_meta( $this->id );
139
-			$internal_meta = !empty( $post_meta ) && !empty( $post_meta[ $meta_key ] ) && !empty( $post_meta[ $meta_key ][ 0 ] ) ? json_decode( $post_meta[ $meta_key ][ 0 ], true ) : null;
140
-			if( !empty( $this->array_option ) ) {
141
-				foreach( $this->array_option as $key => $array ) {
142
-					$this->option[ $key ] = $this->fill_value( $object, $post_meta, $key, $array, $internal_meta );
138
+			$post_meta = get_post_meta($this->id);
139
+			$internal_meta = !empty($post_meta) && !empty($post_meta[$meta_key]) && !empty($post_meta[$meta_key][0]) ? json_decode($post_meta[$meta_key][0], true) : null;
140
+			if (!empty($this->array_option)) {
141
+				foreach ($this->array_option as $key => $array) {
142
+					$this->option[$key] = $this->fill_value($object, $post_meta, $key, $array, $internal_meta);
143 143
 				}
144 144
 			}
145 145
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 /**
3 5
  * Fichier de définition du modèle des taxinomies / File for term model definition
4 6
  *
Please login to merge, or discard this patch.
core/wpeo_model/model/term_mdl.01.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 /**
3 3
  * Fichier de définition du modèle des taxinomies / File for term model definition
4 4
  *
@@ -103,19 +103,19 @@  discard block
 block discarded – undo
103 103
 	 * @param string $meta_key Le nom de la "meta" contenant la définition complète de l'object sous forme json / The "meta" name containing the complete definition of object under json format
104 104
 	 * @param boolean $cropped Permet de choisir si on construit le modèle complet ou uniquement les champs principaux / Allows to choose if the entire model have to be build or only main model
105 105
 	 */
106
-	public function __construct( $object, $meta_key, $cropped ) {
106
+	public function __construct($object, $meta_key, $cropped) {
107 107
 		/**	Instanciation du constructeur de modèle principal / Instanciate the main model constructor	*/
108
-		parent::__construct( $object );
108
+		parent::__construct($object);
109 109
 
110 110
 		/** If cropped don't get meta */
111
-		if( !$cropped ) {
111
+		if (!$cropped) {
112 112
 			/** Lecture des "metas" pour la taxinomie / Read taxonomy "meta" */
113
-			$meta = get_term_meta( $this->id );
114
-			$internal_meta = !empty( $meta ) && !empty( $meta[ $meta_key ] ) && !empty( $meta[ $meta_key ][ 0 ] ) ? json_decode( $meta[ $meta_key ][ 0 ], true ) : null;
113
+			$meta = get_term_meta($this->id);
114
+			$internal_meta = !empty($meta) && !empty($meta[$meta_key]) && !empty($meta[$meta_key][0]) ? json_decode($meta[$meta_key][0], true) : null;
115 115
 
116
-			if( !empty( $this->array_option ) ) {
117
-				foreach( $this->array_option as $key => $array ) {
118
-					$this->option[ $key ] = $this->fill_value( $object, $meta, $key, $array, $internal_meta );
116
+			if (!empty($this->array_option)) {
117
+				foreach ($this->array_option as $key => $array) {
118
+					$this->option[$key] = $this->fill_value($object, $meta, $key, $array, $internal_meta);
119 119
 				}
120 120
 			}
121 121
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 /**
3 5
  * Fichier de définition du modèle des taxinomies / File for term model definition
4 6
  *
Please login to merge, or discard this patch.
includes/modules/wps_barcode/controller/wps_barcode_ajax.ctr.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -248,7 +248,7 @@
 block discarded – undo
248 248
 
249 249
 	/**
250 250
 	 * Generate barcode image
251
-	 * @param object $barcode Instance of wps_barcodegen
251
+	 * @param wps_barcodegen $barcode Instance of wps_barcodegen
252 252
 	 * @param string $meta Numerical code of barcode
253 253
 	 * @param string $type Texte for complete message
254 254
 	 * @param string $price Price of product
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 class wps_barcode_ajax {
4 4
 	public function __construct() {
5
-		add_action( 'wp_ajax_barcode_img_product', array($this, 'imgProduct') );
6
-		add_action( 'wp_ajax_barcode_img_coupons', array($this, 'imgCoupons') );
5
+		add_action('wp_ajax_barcode_img_product', array($this, 'imgProduct'));
6
+		add_action('wp_ajax_barcode_img_coupons', array($this, 'imgCoupons'));
7 7
 	}
8 8
 
9 9
 	// @TODO : NONCE
10 10
 	public function imgProduct() {
11
-		$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
11
+		$_wpnonce = !empty($_POST['_wpnonce']) ? sanitize_text_field($_POST['_wpnonce']) : '';
12 12
 
13
-		if ( !wp_verify_nonce( $_wpnonce, 'imgProduct' ) )
13
+		if (!wp_verify_nonce($_wpnonce, 'imgProduct'))
14 14
 			wp_die();
15 15
 
16 16
 		global $meta, $barcode, $post_ID, $wpdb, $table_prefix, $gg;
@@ -24,17 +24,17 @@  discard block
 block discarded – undo
24 24
 
25 25
 		/*Select value of barcode*/
26 26
 		$result = $wpdb->get_results(
27
-				'SELECT value FROM '.WPSHOP_DBT_ATTRIBUTE_VALUES_VARCHAR.
28
-				' WHERE attribute_id=(SELECT id FROM '.WPSHOP_DBT_ATTRIBUTE.
29
-				' WHERE code = "barcode") AND entity_id="'.$post_ID.'"', ARRAY_A);
27
+				'SELECT value FROM ' . WPSHOP_DBT_ATTRIBUTE_VALUES_VARCHAR .
28
+				' WHERE attribute_id=(SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE .
29
+				' WHERE code = "barcode") AND entity_id="' . $post_ID . '"', ARRAY_A);
30 30
 		$meta = !empty($result) ? $result[0]['value'] : '';
31 31
 
32 32
 		/*Get price of product*/
33
-		$result = $wpdb->get_results('SELECT value FROM '.WPSHOP_DBT_ATTRIBUTE_VALUES_DECIMAL.
34
-				' WHERE attribute_id=(SELECT id FROM '.WPSHOP_DBT_ATTRIBUTE.
35
-				' WHERE code="'.WPSHOP_PRODUCT_PRICE_TTC.'") AND entity_id='.$post_ID, ARRAY_A);
33
+		$result = $wpdb->get_results('SELECT value FROM ' . WPSHOP_DBT_ATTRIBUTE_VALUES_DECIMAL .
34
+				' WHERE attribute_id=(SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE .
35
+				' WHERE code="' . WPSHOP_PRODUCT_PRICE_TTC . '") AND entity_id=' . $post_ID, ARRAY_A);
36 36
 
37
-		if ( !empty($result) && $result[0]['value'] >= 0) {
37
+		if (!empty($result) && $result[0]['value'] >= 0) {
38 38
 			$price = $result[0]['value'];
39 39
 
40 40
 			$post = get_post($post_ID, ARRAY_A);
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	}
49 49
 
50 50
 	public function imgCoupons() {
51
-		$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
51
+		$_wpnonce = !empty($_POST['_wpnonce']) ? sanitize_text_field($_POST['_wpnonce']) : '';
52 52
 
53
-		if ( !wp_verify_nonce( $_wpnonce, 'imgProduct' ) )
53
+		if (!wp_verify_nonce($_wpnonce, 'imgProduct'))
54 54
 			wp_die();
55 55
 
56 56
 		global $meta, $barcode, $post_ID, $wpdb, $table_prefix;
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 		$country = '000';
67 67
 		$result = get_post_meta($post_ID);
68 68
 
69
-		if ( !empty($result) ) {
70
-			if ( empty($result['wpshop_coupon_barcode']) ) {
69
+		if (!empty($result)) {
70
+			if (empty($result['wpshop_coupon_barcode'])) {
71 71
 				$conf = get_option('wps_barcode');
72 72
 				if ($conf['type'] === 'internal') {
73 73
 					$type = $conf['internal_coupons'];
74 74
 
75
-					$query = $wpdb->get_results('SELECT post_date FROM '.
76
-							$table_prefix.'posts WHERE ID='.$post_ID, ARRAY_A);
75
+					$query = $wpdb->get_results('SELECT post_date FROM ' .
76
+							$table_prefix . 'posts WHERE ID=' . $post_ID, ARRAY_A);
77 77
 
78 78
 					$pDate = new DateTime($query[0]['post_date']);
79 79
 					$date = $pDate->format('my');
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 
82 82
 				$len = strlen($post_ID);
83 83
 				$ref = '';
84
-				if ( $len < 5 ) {
85
-					for ($i=0; $i <= $len; $i++) {
84
+				if ($len < 5) {
85
+					for ($i = 0; $i <= $len; $i++) {
86 86
 						$ref .= '0';
87 87
 					}
88 88
 				}
89
-				$id = $ref.$post_ID;
90
-				$code = $type.$date.$id;
89
+				$id = $ref . $post_ID;
90
+				$code = $type . $date . $id;
91 91
 				$meta = $barcode->checksum($code);
92 92
 				add_post_meta($post_ID, 'wpshop_coupon_barcode', $meta);
93 93
 			}
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 				$meta = $result['wpshop_coupon_barcode'][0];
96 96
 			}
97 97
 
98
-			$query = $wpdb->get_results('SELECT post_title FROM '.
99
-					$table_prefix.'posts WHERE ID='.$post_ID, ARRAY_A);
98
+			$query = $wpdb->get_results('SELECT post_title FROM ' .
99
+					$table_prefix . 'posts WHERE ID=' . $post_ID, ARRAY_A);
100 100
 
101 101
 			$post = get_post($post_ID, ARRAY_A);
102 102
 
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 			wp_die();
108 108
 		}
109 109
 		else {
110
-			echo '<p>'.__('None bardcode generated as coupon has not created.',
111
-					'wps_barcode').'</p>';
110
+			echo '<p>' . __('None bardcode generated as coupon has not created.',
111
+					'wps_barcode') . '</p>';
112 112
 			wp_die();
113 113
 		}
114 114
 	}
@@ -122,41 +122,41 @@  discard block
 block discarded – undo
122 122
 	 * @param string $title Title of product
123 123
 	 */
124 124
 	public function generate_image(&$barcode, $meta, $type, $price, $title, $post_ID = 0) {
125
-		if ( !empty($meta) ) {
125
+		if (!empty($meta)) {
126 126
 			$barcode->setGenerateCode($meta);
127 127
 			$binCode = $barcode->getBinCode();
128 128
 
129 129
 			$px = 3.779528;
130
-			$x = round(66*$px); //249.449 px
131
-			$y = round(50*$px); //188.976 px
132
-			$bar_size = round(63.393/72); //0.880 px
130
+			$x = round(66 * $px); //249.449 px
131
+			$y = round(50 * $px); //188.976 px
132
+			$bar_size = round(63.393 / 72); //0.880 px
133 133
 
134 134
 			$len = 0;
135 135
 			$test = '';
136 136
 
137
-			while ($len !== strlen($binCode) ) {
138
-				$test .= substr($binCode, $len, 7).' ';
139
-				$len = $len+7;
137
+			while ($len !== strlen($binCode)) {
138
+				$test .= substr($binCode, $len, 7) . ' ';
139
+				$len = $len + 7;
140 140
 			}
141 141
 
142 142
 			$im = imagecreate($x, $y);
143 143
 			$background_color = imagecolorallocate($im, 255, 255, 255);
144
-			$start = round(5.79*$px); //21.883
144
+			$start = round(5.79 * $px); //21.883
145 145
 
146 146
 			/*Write First left guard*/
147
-			$this->imgNormalGuard($im, $start, $start+$bar_size,
147
+			$this->imgNormalGuard($im, $start, $start + $bar_size,
148 148
 					imagecolorallocate($im, 0, 0, 0));
149
-			$this->imgNormalGuard($im, $start+($bar_size*2),
150
-					$start+($bar_size*3), imagecolorallocate($im, 255, 255, 255));
151
-			$this->imgNormalGuard($im, $start+($bar_size*4),
152
-					$start+($bar_size*5), imagecolorallocate($im, 0, 0, 0));
149
+			$this->imgNormalGuard($im, $start + ($bar_size * 2),
150
+					$start + ($bar_size * 3), imagecolorallocate($im, 255, 255, 255));
151
+			$this->imgNormalGuard($im, $start + ($bar_size * 4),
152
+					$start + ($bar_size * 5), imagecolorallocate($im, 0, 0, 0));
153 153
 
154
-			$pos = $start+($bar_size*7);
155
-			$newPos = $pos+$bar_size;
154
+			$pos = $start + ($bar_size * 7);
155
+			$newPos = $pos + $bar_size;
156 156
 
157 157
 			/*Write left barcode*/
158
-			for ($i=0; $i<42 ; $i++) {
159
-				if( substr($binCode, $i, 1) === '0' ) {
158
+			for ($i = 0; $i < 42; $i++) {
159
+				if (substr($binCode, $i, 1) === '0') {
160 160
 					$color = imagecolorallocate($im, 255, 255, 255);
161 161
 				}
162 162
 				else {
@@ -164,108 +164,108 @@  discard block
 block discarded – undo
164 164
 				}
165 165
 
166 166
 				$this->imgSymbole($im, $pos, $newPos, $color);
167
-				$newPos = $pos+$bar_size;
168
-				$pos = $newPos+$bar_size;
167
+				$newPos = $pos + $bar_size;
168
+				$pos = $newPos + $bar_size;
169 169
 			}
170 170
 
171 171
 			/*Writer center guard*/
172 172
 			$pos = $newPos;
173
-			$this->imgNormalGuard($im, $pos, $newPos+$bar_size,
173
+			$this->imgNormalGuard($im, $pos, $newPos + $bar_size,
174 174
 					imagecolorallocate($im, 255, 255, 255));
175
-			$this->imgNormalGuard($im, $pos+($bar_size*2),
176
-					$newPos+($bar_size*3), imagecolorallocate($im, 0, 0, 0));
177
-			$this->imgNormalGuard($im, $pos+($bar_size*4),
178
-					$newPos+($bar_size*5), imagecolorallocate($im, 255, 255, 255));
179
-			$this->imgNormalGuard($im, $pos+($bar_size*6),
180
-					$newPos+($bar_size*7), imagecolorallocate($im, 0, 0, 0));
181
-			$this->imgNormalGuard($im, $pos+($bar_size*8),
182
-					$newPos+($bar_size*9), imagecolorallocate($im, 255, 255, 255));
175
+			$this->imgNormalGuard($im, $pos + ($bar_size * 2),
176
+					$newPos + ($bar_size * 3), imagecolorallocate($im, 0, 0, 0));
177
+			$this->imgNormalGuard($im, $pos + ($bar_size * 4),
178
+					$newPos + ($bar_size * 5), imagecolorallocate($im, 255, 255, 255));
179
+			$this->imgNormalGuard($im, $pos + ($bar_size * 6),
180
+					$newPos + ($bar_size * 7), imagecolorallocate($im, 0, 0, 0));
181
+			$this->imgNormalGuard($im, $pos + ($bar_size * 8),
182
+					$newPos + ($bar_size * 9), imagecolorallocate($im, 255, 255, 255));
183 183
 
184
-			$pos = $newPos+($bar_size*10);
184
+			$pos = $newPos + ($bar_size * 10);
185 185
 
186 186
 			/*Write right barcode*/
187
-			for ($i=42; $i<84 ; $i++) {
188
-				if( substr($binCode, $i, 1) === '0' ) {
187
+			for ($i = 42; $i < 84; $i++) {
188
+				if (substr($binCode, $i, 1) === '0') {
189 189
 					$color = imagecolorallocate($im, 255, 255, 255);
190 190
 				}
191 191
 				else {
192 192
 					$color = imagecolorallocate($im, 0, 0, 0);
193 193
 				}
194 194
 
195
-				$newPos = $pos+$bar_size;
195
+				$newPos = $pos + $bar_size;
196 196
 
197 197
 				$this->imgSymbole($im, $pos, $newPos, $color);
198
-				$pos = $newPos+$bar_size;
198
+				$pos = $newPos + $bar_size;
199 199
 			}
200 200
 
201 201
 			/*Write right guard*/
202
-			$pos = $newPos+$bar_size;
203
-			$this->imgNormalGuard($im, $pos, $pos+$bar_size,
202
+			$pos = $newPos + $bar_size;
203
+			$this->imgNormalGuard($im, $pos, $pos + $bar_size,
204 204
 					imagecolorallocate($im, 0, 0, 0));
205
-			$this->imgNormalGuard($im, $pos+($bar_size*2),
206
-					$pos+($bar_size*3), imagecolorallocate($im, 255, 255, 255));
207
-			$this->imgNormalGuard($im, $pos+($bar_size*4),
208
-					$pos+($bar_size*5), imagecolorallocate($im, 0, 0, 0));
205
+			$this->imgNormalGuard($im, $pos + ($bar_size * 2),
206
+					$pos + ($bar_size * 3), imagecolorallocate($im, 255, 255, 255));
207
+			$this->imgNormalGuard($im, $pos + ($bar_size * 4),
208
+					$pos + ($bar_size * 5), imagecolorallocate($im, 0, 0, 0));
209 209
 
210 210
 			$textSize = 16;
211
-			$font = WPS_BARCODE_FONTS.'/arialbd.ttf';
212
-			imagettftext($im, $textSize, 0, 8, $y-$start-5,
211
+			$font = WPS_BARCODE_FONTS . '/arialbd.ttf';
212
+			imagettftext($im, $textSize, 0, 8, $y - $start - 5,
213 213
 			imagecolorallocate($im, 0, 0, 0), $font, substr($meta, 0, 1));
214 214
 
215 215
 			$continue = true;
216 216
 			$i = 28; $j = 0;
217 217
 
218 218
 			/*Write left number code*/
219
-			while ($j<5) {
220
-				$j=$j+1;
221
-				imagettftext($im, $textSize, 0, $i, $y-$start-5,
219
+			while ($j < 5) {
220
+				$j = $j + 1;
221
+				imagettftext($im, $textSize, 0, $i, $y - $start - 5,
222 222
 				imagecolorallocate($im, 0, 0, 0), $font, substr($meta, $j, 1));
223
-				$i = $i+14;
223
+				$i = $i + 14;
224 224
 			}
225 225
 
226 226
 			/*Write right number code*/
227
-			while ($j<11) {
228
-				$j=$j+1;
229
-				imagettftext($im, $textSize, 0, $i+6, $y-$start-5,
227
+			while ($j < 11) {
228
+				$j = $j + 1;
229
+				imagettftext($im, $textSize, 0, $i + 6, $y - $start - 5,
230 230
 					imagecolorallocate($im, 0, 0, 0), $font, substr($meta, $j, 1));
231
-				$i = $i+15;
231
+				$i = $i + 15;
232 232
 			}
233
-			imagettftext($im, $textSize, 0, $i+4, $y-$start-5,
234
-				imagecolorallocate($im, 0, 0, 0), $font, substr($meta, $j+1, 1));
233
+			imagettftext($im, $textSize, 0, $i + 4, $y - $start - 5,
234
+				imagecolorallocate($im, 0, 0, 0), $font, substr($meta, $j + 1, 1));
235 235
 
236 236
 			/*Write ref product and price*/
237 237
 			$textSize = 12;
238 238
 			$currency = (wpshop_tools::wpshop_get_currency() === '&euro;') ? "€" : wpshop_tools::wpshop_get_currency();
239 239
 
240
-			if ( $type === __('coupon', 'wps_barcode') ) {
240
+			if ($type === __('coupon', 'wps_barcode')) {
241 241
 				$coupon_postmeta = get_post_meta($post_ID, 'wpshop_coupon_discount_type');
242
-				if ( $coupon_postmeta[0] === 'percent' ) {
243
-					$price = $price.' %';
242
+				if ($coupon_postmeta[0] === 'percent') {
243
+					$price = $price . ' %';
244 244
 				}
245 245
 				else {
246
-					$price = sprintf( number_format( $price, 2 ). ' '.$currency);
246
+					$price = sprintf(number_format($price, 2) . ' ' . $currency);
247 247
 				}
248 248
 			}
249 249
 			else {
250
-				$price = sprintf( number_format( $price, 2 ). ' '.$currency);
250
+				$price = sprintf(number_format($price, 2) . ' ' . $currency);
251 251
 			}
252 252
 
253
-			imagettftext($im, $textSize, 0, 20, round(6*$px),
253
+			imagettftext($im, $textSize, 0, 20, round(6 * $px),
254 254
 				imagecolorallocate($im, 0, 0, 0), $font, $title);
255
-			imagettftext($im, $textSize, 0, ($x/2)+40, round(6*$px),
255
+			imagettftext($im, $textSize, 0, ($x / 2) + 40, round(6 * $px),
256 256
 				imagecolorallocate($im, 0, 0, 0), $font, $price);
257 257
 
258 258
 			ob_start();
259 259
 			imagepng($im);
260 260
 			$img = ob_get_clean();
261 261
 
262
-			return '<p><img src="data:image/png;base64,'.base64_encode($img).
263
-			'" id="barcode" width="160" height="90" /></p>'.
262
+			return '<p><img src="data:image/png;base64,' . base64_encode($img) .
263
+			'" id="barcode" width="160" height="90" /></p>' .
264 264
 
265
-			'<p style="text-align: right"><button class="button '.
266
-					'button-primary button-large" type="button"'.
267
-					'id="print_barcode">'.
268
-					__('Print', 'wps_barcode').'</button></p>';
265
+			'<p style="text-align: right"><button class="button ' .
266
+					'button-primary button-large" type="button"' .
267
+					'id="print_barcode">' .
268
+					__('Print', 'wps_barcode') . '</button></p>';
269 269
 
270 270
 					/*wp_mkdir_p( WPS_BARCODE_UPLOAD );
271 271
 
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 					}*/
285 285
 		}
286 286
 		else {
287
-			return '<p>'.sprintf( __('None bardcode generated as you did create %s.',
288
-					'wps_barcode'), $type).'</p>';
287
+			return '<p>' . sprintf(__('None bardcode generated as you did create %s.',
288
+					'wps_barcode'), $type) . '</p>';
289 289
 		}
290 290
 	}
291 291
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @param integer $color Color of rectangle
298 298
 	 */
299 299
 	private function imgNormalGuard(&$image, $pos, $size, $color) {
300
-		imagefilledrectangle($image, $pos, 180*0.25,$size, 180-10, $color );
300
+		imagefilledrectangle($image, $pos, 180 * 0.25, $size, 180 - 10, $color);
301 301
 	}
302 302
 
303 303
 	/**
@@ -308,6 +308,6 @@  discard block
 block discarded – undo
308 308
 	 * @param integer $color Color of rectangle
309 309
 	 */
310 310
 	private function imgSymbole(&$image, $pos, $size, $color) {
311
-		imagefilledrectangle($image, $pos, 180*0.25,$size, 180-40, $color );
311
+		imagefilledrectangle($image, $pos, 180 * 0.25, $size, 180 - 40, $color);
312 312
 	}
313 313
 }
Please login to merge, or discard this patch.
Braces   +16 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 class wps_barcode_ajax {
4 6
 	public function __construct() {
@@ -10,8 +12,9 @@  discard block
 block discarded – undo
10 12
 	public function imgProduct() {
11 13
 		$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
12 14
 
13
-		if ( !wp_verify_nonce( $_wpnonce, 'imgProduct' ) )
14
-			wp_die();
15
+		if ( !wp_verify_nonce( $_wpnonce, 'imgProduct' ) ) {
16
+					wp_die();
17
+		}
15 18
 
16 19
 		global $meta, $barcode, $post_ID, $wpdb, $table_prefix, $gg;
17 20
 		require_once('wps_barcodegen.ctr.php');
@@ -50,8 +53,9 @@  discard block
 block discarded – undo
50 53
 	public function imgCoupons() {
51 54
 		$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
52 55
 
53
-		if ( !wp_verify_nonce( $_wpnonce, 'imgProduct' ) )
54
-			wp_die();
56
+		if ( !wp_verify_nonce( $_wpnonce, 'imgProduct' ) ) {
57
+					wp_die();
58
+		}
55 59
 
56 60
 		global $meta, $barcode, $post_ID, $wpdb, $table_prefix;
57 61
 
@@ -90,8 +94,7 @@  discard block
 block discarded – undo
90 94
 				$code = $type.$date.$id;
91 95
 				$meta = $barcode->checksum($code);
92 96
 				add_post_meta($post_ID, 'wpshop_coupon_barcode', $meta);
93
-			}
94
-			else {
97
+			} else {
95 98
 				$meta = $result['wpshop_coupon_barcode'][0];
96 99
 			}
97 100
 
@@ -105,8 +108,7 @@  discard block
 block discarded – undo
105 108
 			$array = array('img' => $barcode);
106 109
 			echo json_encode($array);
107 110
 			wp_die();
108
-		}
109
-		else {
111
+		} else {
110 112
 			echo '<p>'.__('None bardcode generated as coupon has not created.',
111 113
 					'wps_barcode').'</p>';
112 114
 			wp_die();
@@ -158,8 +160,7 @@  discard block
 block discarded – undo
158 160
 			for ($i=0; $i<42 ; $i++) {
159 161
 				if( substr($binCode, $i, 1) === '0' ) {
160 162
 					$color = imagecolorallocate($im, 255, 255, 255);
161
-				}
162
-				else {
163
+				} else {
163 164
 					$color = imagecolorallocate($im, 0, 0, 0);
164 165
 				}
165 166
 
@@ -187,8 +188,7 @@  discard block
 block discarded – undo
187 188
 			for ($i=42; $i<84 ; $i++) {
188 189
 				if( substr($binCode, $i, 1) === '0' ) {
189 190
 					$color = imagecolorallocate($im, 255, 255, 255);
190
-				}
191
-				else {
191
+				} else {
192 192
 					$color = imagecolorallocate($im, 0, 0, 0);
193 193
 				}
194 194
 
@@ -241,12 +241,10 @@  discard block
 block discarded – undo
241 241
 				$coupon_postmeta = get_post_meta($post_ID, 'wpshop_coupon_discount_type');
242 242
 				if ( $coupon_postmeta[0] === 'percent' ) {
243 243
 					$price = $price.' %';
244
-				}
245
-				else {
244
+				} else {
246 245
 					$price = sprintf( number_format( $price, 2 ). ' '.$currency);
247 246
 				}
248
-			}
249
-			else {
247
+			} else {
250 248
 				$price = sprintf( number_format( $price, 2 ). ' '.$currency);
251 249
 			}
252 250
 
@@ -282,8 +280,7 @@  discard block
 block discarded – undo
282 280
 					} catch (Exception $e) {
283 281
 						echo __('Generation problem', 'wps_barcode');
284 282
 					}*/
285
-		}
286
-		else {
283
+		} else {
287 284
 			return '<p>'.sprintf( __('None bardcode generated as you did create %s.',
288 285
 					'wps_barcode'), $type).'</p>';
289 286
 		}
Please login to merge, or discard this patch.
includes/librairies/purchase/list_countries.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 /**
3 3
 * Plugin database options
4 4
 *
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 /**
3 5
  * Fichier de définition du modèle des taxinomies / File for term model definition
4 6
  *
Please login to merge, or discard this patch.
includes/librairies/notices.class.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 /**
3 5
  * Fichier de définition du modèle des taxinomies / File for term model definition
4 6
  *
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 /*	Check if file is include. No direct access possible with file url	*/
3
-if ( !defined( 'WPSHOP_VERSION' ) ) {
4
-	die( __('Access is not allowed by this way', 'wpshop') );
3
+if (!defined('WPSHOP_VERSION')) {
4
+	die(__('Access is not allowed by this way', 'wpshop'));
5 5
 }
6 6
 
7 7
 /**
@@ -19,59 +19,59 @@  discard block
 block discarded – undo
19 19
 * @package wpshop
20 20
 * @subpackage librairies
21 21
 */
22
-class wpshop_notices{
22
+class wpshop_notices {
23 23
 
24 24
 	/** Notice the user to install the plugin */
25 25
 	public static function sale_shop_notice() {
26
-		$plug_version = substr( WPSHOP_VERSION, 0, 5 );
26
+		$plug_version = substr(WPSHOP_VERSION, 0, 5);
27 27
 
28 28
 
29
-		$notice_display_user_option = get_user_meta( get_current_user_id(), '_wps_hide_notice_messages_indicator', true);
29
+		$notice_display_user_option = get_user_meta(get_current_user_id(), '_wps_hide_notice_messages_indicator', true);
30 30
 
31 31
 		$notice = '';
32 32
 		$messages_to_hide = '';
33 33
 		/* Check that the user has already choose a payment method */
34
-		$paymentMethod = get_option( 'wps_payment_mode' );
34
+		$paymentMethod = get_option('wps_payment_mode');
35 35
 		$no_payment_mode_configurated = true;
36
-		if ( !empty($paymentMethod ) && !empty($paymentMethod['mode']) ) {
37
-			foreach( $paymentMethod['mode'] as $k => $pm ) {
38
-				if ( !empty($pm['active'] ) ) {
36
+		if (!empty($paymentMethod) && !empty($paymentMethod['mode'])) {
37
+			foreach ($paymentMethod['mode'] as $k => $pm) {
38
+				if (!empty($pm['active'])) {
39 39
 					$no_payment_mode_configurated = false;
40 40
 				}
41 41
 			}
42 42
 		}
43 43
 
44
-		if( $no_payment_mode_configurated ) {
45
-			$notice .= '<li>' . __('Payment method are missing', 'wpshop') . '&nbsp;<a href="' . admin_url('options-general.php?page='.WPSHOP_URL_SLUG_OPTION.'#wpshop_payments_option') . '" class="button-primary wpshop_missing_parameters_button" >' . __('Choose a payment method', 'wpshop') . '</a></li>';
44
+		if ($no_payment_mode_configurated) {
45
+			$notice .= '<li>' . __('Payment method are missing', 'wpshop') . '&nbsp;<a href="' . admin_url('options-general.php?page=' . WPSHOP_URL_SLUG_OPTION . '#wpshop_payments_option') . '" class="button-primary wpshop_missing_parameters_button" >' . __('Choose a payment method', 'wpshop') . '</a></li>';
46 46
 		}
47 47
 
48 48
 		/* Check that the user has already choose a payment method */
49 49
 		$emails = get_option('wpshop_emails', array());
50
-		if(empty($emails)) {
51
-			$notice .= '<li>' . __('Shop emails are misssing', 'wpshop') . '&nbsp;<a href="' . admin_url('options-general.php?page='.WPSHOP_URL_SLUG_OPTION.'#wpshop_emails_option') . '" class="button-primary wpshop_missing_parameters_button" >' . __('Configure shop emails', 'wpshop') . '</a></li>';
50
+		if (empty($emails)) {
51
+			$notice .= '<li>' . __('Shop emails are misssing', 'wpshop') . '&nbsp;<a href="' . admin_url('options-general.php?page=' . WPSHOP_URL_SLUG_OPTION . '#wpshop_emails_option') . '" class="button-primary wpshop_missing_parameters_button" >' . __('Configure shop emails', 'wpshop') . '</a></li>';
52 52
 		}
53 53
 
54 54
 
55
-		$current_theme_option = get_option( 'current_theme' );
56
-		if ( !empty($cuurent_theme_option) && $cuurent_theme_option == 'SlickShop mini' && ( empty($notice_display_user_option) || !array_key_exists('SLICKSHOP', $notice_display_user_option) ) )  {
57
-			$notice .= '<li>' .__('Some changes on templates files have been made on WPSHOP 1.3.6.3. You must download Slickshop on <a href="http://www.wpshop.fr/myaccount/">your account on WPSHOP.FR</a>', 'wpshop').'</li>';
55
+		$current_theme_option = get_option('current_theme');
56
+		if (!empty($cuurent_theme_option) && $cuurent_theme_option == 'SlickShop mini' && (empty($notice_display_user_option) || !array_key_exists('SLICKSHOP', $notice_display_user_option))) {
57
+			$notice .= '<li>' . __('Some changes on templates files have been made on WPSHOP 1.3.6.3. You must download Slickshop on <a href="http://www.wpshop.fr/myaccount/">your account on WPSHOP.FR</a>', 'wpshop') . '</li>';
58 58
 			$messages_to_hide .= 'SLICKSHOP,';
59 59
 		}
60 60
 
61
-		$install = !empty( $_GET[ 'install' ] ) ? sanitize_text_field( $_GET[ 'install' ] ) : '';
61
+		$install = !empty($_GET['install']) ? sanitize_text_field($_GET['install']) : '';
62 62
 
63
-		if(!empty($notice) && ( empty( $install ) ) ) {
64
-			$notice='<p>'.__('You configure your shop to be a sale shop. But some configuration are missing for this type of shop using', 'wpshop').'</p><ul>'.$notice.'</ul>';
65
-			if ( !empty($messages_to_hide) ) {
66
-				$notice .= '<button class="wps_hide_notice_message button-secondary" id="wps_hide_notice_message">' .__('Hide this message', 'wpshop'). '</button>';
67
-				$notice .= '<input type="hidden" id="hide_messages_indicator" value="' .$messages_to_hide. '"/>';
63
+		if (!empty($notice) && (empty($install))) {
64
+			$notice = '<p>' . __('You configure your shop to be a sale shop. But some configuration are missing for this type of shop using', 'wpshop') . '</p><ul>' . $notice . '</ul>';
65
+			if (!empty($messages_to_hide)) {
66
+				$notice .= '<button class="wps_hide_notice_message button-secondary" id="wps_hide_notice_message">' . __('Hide this message', 'wpshop') . '</button>';
67
+				$notice .= '<input type="hidden" id="hide_messages_indicator" value="' . $messages_to_hide . '"/>';
68 68
 			}
69 69
 			self::admin_notice_container($notice, 'wpshop_shop_sale_type_notice');
70 70
 		}
71 71
 	}
72 72
 
73 73
 	/**		*/
74
-	public static function admin_notice_container($message, $container_class = ''){
74
+	public static function admin_notice_container($message, $container_class = '') {
75 75
 		?>
76 76
 		<div class="updated wpshop_admin_notice <?php echo $container_class; ?>" id="<?php echo $container_class; ?>" >
77 77
 			<h3><?php _e('Configure my shop', 'wpshop') ?></h3>
Please login to merge, or discard this patch.
includes/librairies/HTML2PDF/_tcpdf_5.0.002/config/lang/ger.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 /**
3 3
 * Plugin database options
4 4
 *
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 /**
3 5
  * Fichier de définition du modèle des taxinomies / File for term model definition
4 6
  *
Please login to merge, or discard this patch.