@@ -270,11 +270,13 @@ |
||
270 | 270 | |
271 | 271 | $data = array_merge( $this->api_data, $_data ); |
272 | 272 | |
273 | - if ( $data['slug'] != $this->slug ) |
|
274 | - return; |
|
273 | + if ( $data['slug'] != $this->slug ) { |
|
274 | + return; |
|
275 | + } |
|
275 | 276 | |
276 | - if ( empty( $data['license'] ) ) |
|
277 | - return; |
|
277 | + if ( empty( $data['license'] ) ) { |
|
278 | + return; |
|
279 | + } |
|
278 | 280 | |
279 | 281 | if ( $this->api_url == home_url() ) { |
280 | 282 | return false; // Don't allow a plugin to ping itself |
@@ -106,8 +106,10 @@ discard block |
||
106 | 106 | if ( isset( $_POST['edd_license_activate'] ) ) { |
107 | 107 | |
108 | 108 | // run a quick security check |
109 | - if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) |
|
110 | - return; // get out if we didn't click the Activate button |
|
109 | + if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) { |
|
110 | + return; |
|
111 | + } |
|
112 | + // get out if we didn't click the Activate button |
|
111 | 113 | |
112 | 114 | // retrieve the license from the database |
113 | 115 | $license = trim( get_option( 'lasso_license_key' ) ); |
@@ -124,8 +126,9 @@ discard block |
||
124 | 126 | $response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) ); |
125 | 127 | |
126 | 128 | // make sure the response came back okay |
127 | - if ( is_wp_error( $response ) ) |
|
128 | - return false; |
|
129 | + if ( is_wp_error( $response ) ) { |
|
130 | + return false; |
|
131 | + } |
|
129 | 132 | |
130 | 133 | // decode the license data |
131 | 134 | $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
@@ -143,8 +146,10 @@ discard block |
||
143 | 146 | if ( isset( $_POST['edd_license_deactivate'] ) ) { |
144 | 147 | |
145 | 148 | // run a quick security check |
146 | - if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) |
|
147 | - return; // get out if we didn't click the Activate button |
|
149 | + if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) { |
|
150 | + return; |
|
151 | + } |
|
152 | + // get out if we didn't click the Activate button |
|
148 | 153 | |
149 | 154 | // retrieve the license from the database |
150 | 155 | $license = trim( get_option( 'lasso_license_key' ) ); |
@@ -162,15 +167,17 @@ discard block |
||
162 | 167 | $response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) ); |
163 | 168 | |
164 | 169 | // make sure the response came back okay |
165 | - if ( is_wp_error( $response ) ) |
|
166 | - return false; |
|
170 | + if ( is_wp_error( $response ) ) { |
|
171 | + return false; |
|
172 | + } |
|
167 | 173 | |
168 | 174 | // decode the license data |
169 | 175 | $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
170 | 176 | |
171 | 177 | // $license_data->license will be either "deactivated" or "failed" |
172 | - if ( $license_data->license == 'deactivated' ) |
|
173 | - delete_option( 'lasso_license_status' ); |
|
178 | + if ( $license_data->license == 'deactivated' ) { |
|
179 | + delete_option( 'lasso_license_status' ); |
|
180 | + } |
|
174 | 181 | |
175 | 182 | } |
176 | 183 | } |
@@ -192,8 +199,9 @@ discard block |
||
192 | 199 | // Call the custom API. |
193 | 200 | $response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) ); |
194 | 201 | |
195 | - if ( is_wp_error( $response ) ) |
|
196 | - return false; |
|
202 | + if ( is_wp_error( $response ) ) { |
|
203 | + return false; |
|
204 | + } |
|
197 | 205 | |
198 | 206 | $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
199 | 207 |
@@ -30,8 +30,9 @@ |
||
30 | 30 | $postid = isset( $data['postid'] ) ? $data['postid'] : false; |
31 | 31 | |
32 | 32 | // bail out if teh current user can't publish posts |
33 | - if ( !lasso_user_can( 'delete_post', $postid ) ) |
|
34 | - return; |
|
33 | + if ( !lasso_user_can( 'delete_post', $postid ) ) { |
|
34 | + return; |
|
35 | + } |
|
35 | 36 | |
36 | 37 | $args = array( |
37 | 38 | 'ID' => (int) $postid, |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | $gallery_ids = isset( $data['gallery_ids'] ) ? $data['gallery_ids'] : false; |
120 | 120 | if ( ! empty( $data ) && $data[ 'gallery_type' ] ) { |
121 | 121 | $type = $data[ 'gallery_type' ]; |
122 | - }elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) { |
|
122 | + } elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) { |
|
123 | 123 | $type = $options[ 'galleryType' ]; |
124 | - }else{ |
|
124 | + } else{ |
|
125 | 125 | $type = false; |
126 | 126 | } |
127 | 127 | |
@@ -173,8 +173,9 @@ discard block |
||
173 | 173 | */ |
174 | 174 | private function get_the_images( $image_ids = '' ) { |
175 | 175 | |
176 | - if ( empty( $image_ids ) ) |
|
177 | - return; |
|
176 | + if ( empty( $image_ids ) ) { |
|
177 | + return; |
|
178 | + } |
|
178 | 179 | |
179 | 180 | $image_ids = array_map( 'intval', explode( ',', $image_ids ) ); |
180 | 181 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $args = array(); |
32 | 32 | if ( isset( $data[ 'limit' ] ) ) { |
33 | 33 | $args[ 'posts_per_page' ] = $data[ 'limit' ]; |
34 | - }else{ |
|
34 | + } else{ |
|
35 | 35 | $args[ 'posts_per_page' ] = 6; // we start at revision 0 |
36 | 36 | } |
37 | 37 |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | $defaults[ 'type' ] = $params; |
48 | 48 | |
49 | 49 | $params = $defaults; |
50 | - } |
|
51 | - else { |
|
50 | + } else { |
|
52 | 51 | $params = array_merge( $defaults, (array) $params ); |
53 | 52 | } |
54 | 53 | |
@@ -63,24 +62,21 @@ discard block |
||
63 | 62 | } |
64 | 63 | |
65 | 64 | $output = (object) $output; |
66 | - } |
|
67 | - elseif ( is_array( $input ) ) { |
|
65 | + } elseif ( is_array( $input ) ) { |
|
68 | 66 | $n_params = $params; |
69 | 67 | $n_params[ 'nested' ] = true; |
70 | 68 | |
71 | 69 | foreach ( $input as $key => $val ) { |
72 | 70 | $output[ self::do_sanitize( $key ) ] = self::do_sanitize( $val, $n_params ); |
73 | 71 | } |
74 | - } |
|
75 | - elseif ( !empty( $params[ 'type' ] ) && false !== strpos( $params[ 'type' ], '%' ) ) { |
|
72 | + } elseif ( !empty( $params[ 'type' ] ) && false !== strpos( $params[ 'type' ], '%' ) ) { |
|
76 | 73 | /** |
77 | 74 | * @var $wpdb wpdb |
78 | 75 | */ |
79 | 76 | global $wpdb; |
80 | 77 | |
81 | 78 | $output = $wpdb->prepare( $params[ 'type' ], $output ); |
82 | - } |
|
83 | - else { |
|
79 | + } else { |
|
84 | 80 | $output = wp_slash( $input ); |
85 | 81 | } |
86 | 82 | |
@@ -115,20 +111,17 @@ discard block |
||
115 | 111 | } |
116 | 112 | |
117 | 113 | $output = (object) $output; |
118 | - } |
|
119 | - elseif ( is_array( $input ) ) { |
|
114 | + } elseif ( is_array( $input ) ) { |
|
120 | 115 | foreach ( $input as $key => $val ) { |
121 | 116 | $output[ $key ] = self::sanitize_like( $val ); |
122 | 117 | } |
123 | - } |
|
124 | - else { |
|
118 | + } else { |
|
125 | 119 | global $wpdb; |
126 | 120 | |
127 | 121 | //backwords-compat check for pre WP4.0 |
128 | 122 | if ( method_exists( 'wpdb', 'esc_like' ) ) { |
129 | 123 | $output = $wpdb->esc_like( self::do_sanitize( $input ) ); |
130 | - } |
|
131 | - else { |
|
124 | + } else { |
|
132 | 125 | // like_escape is deprecated in WordPress 4.0 |
133 | 126 | $output = like_escape( self::do_sanitize( $input ) ); |
134 | 127 | } |
@@ -160,8 +153,7 @@ discard block |
||
160 | 153 | |
161 | 154 | if ( empty( $input ) ) { |
162 | 155 | $output = $input; |
163 | - } |
|
164 | - elseif ( is_object( $input ) ) { |
|
156 | + } elseif ( is_object( $input ) ) { |
|
165 | 157 | $input = get_object_vars( $input ); |
166 | 158 | |
167 | 159 | foreach ( $input as $key => $val ) { |
@@ -169,13 +161,11 @@ discard block |
||
169 | 161 | } |
170 | 162 | |
171 | 163 | $output = (object) $output; |
172 | - } |
|
173 | - elseif ( is_array( $input ) ) { |
|
164 | + } elseif ( is_array( $input ) ) { |
|
174 | 165 | foreach ( $input as $key => $val ) { |
175 | 166 | $output[ $key ] = self::unslash( $val ); |
176 | 167 | } |
177 | - } |
|
178 | - else { |
|
168 | + } else { |
|
179 | 169 | $output = wp_unslash( $input ); |
180 | 170 | |
181 | 171 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function __construct( $action, $callback_class) { |
56 | 56 | if ( ! is_object( $callback_class ) ) { |
57 | 57 | $this->callback_instance = new $callback_class; |
58 | - }else{ |
|
58 | + } else{ |
|
59 | 59 | $this->callback_instance = $callback_class; |
60 | 60 | } |
61 | 61 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | protected function check_nonce() { |
150 | 150 | if ( isset( $this->callback_instance->nonce_action ) ) { |
151 | 151 | $nonce = $this->callback_instance->nonce_action; |
152 | - }else{ |
|
152 | + } else{ |
|
153 | 153 | $nonce = 'lasso_editor'; |
154 | 154 | } |
155 | 155 |
@@ -70,7 +70,7 @@ |
||
70 | 70 | foreach( $callback as $cb ) { |
71 | 71 | $_data = $this->sanitize( $key, $cb ); |
72 | 72 | } |
73 | - }else{ |
|
73 | + } else{ |
|
74 | 74 | $_data = $this->sanitize( $key, $callback ); |
75 | 75 | } |
76 | 76 |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | $callback = self::find_callback( strip_tags( $action ) ); |
37 | 37 | if ( is_int( $callback ) ) { |
38 | 38 | $code = $callback; |
39 | - }elseif( ! class_exists( $callback['class'] ) ) { |
|
39 | + } elseif( ! class_exists( $callback['class'] ) ) { |
|
40 | 40 | $code = 415; |
41 | - }else { |
|
41 | + } else { |
|
42 | 42 | $action = str_replace( '-', '_', $action ); |
43 | 43 | $callback_instance = new $callback['class']; |
44 | 44 | $auth = self::auth( $action, $callback_instance, $callback['method'] ); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | } |
63 | 63 | |
64 | - }else{ |
|
64 | + } else{ |
|
65 | 65 | $code = 401; |
66 | 66 | $response = __( 'Nonce not set.', 'lasso' ); |
67 | 67 | } |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | |
168 | 168 | if ( is_string( $response ) ) { |
169 | 169 | $data[] = $response; |
170 | - }elseif( is_array( $response ) ) { |
|
170 | + } elseif( is_array( $response ) ) { |
|
171 | 171 | $data = $response; |
172 | - }else{ |
|
172 | + } else{ |
|
173 | 173 | $data[] = $code; |
174 | 174 | } |
175 | 175 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | nocache_headers(); |
178 | 178 | if ( 200 == $code ) { |
179 | 179 | wp_send_json_success( $data ); |
180 | - }else{ |
|
180 | + } else{ |
|
181 | 181 | wp_send_json_error( $data ); |
182 | 182 | } |
183 | 183 |