@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $dir = wp_upload_dir(); |
31 | 31 | |
32 | 32 | // Is URL in uploads directory? |
33 | - if ( false === strpos( $img_url, $dir['baseurl'] . '/' ) ) { |
|
33 | + if ( false === strpos( $img_url, $dir[ 'baseurl' ] . '/' ) ) { |
|
34 | 34 | return false; |
35 | 35 | } |
36 | 36 | |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | |
56 | 56 | foreach ( $query->posts as $post_id ) { |
57 | 57 | $meta = wp_get_attachment_metadata( $post_id ); |
58 | - $original_file = basename( $meta['file'] ); |
|
59 | - $cropped_image_files = isset( $meta['sizes'] ) ? wp_list_pluck( $meta['sizes'], 'file' ) : array(); |
|
58 | + $original_file = basename( $meta[ 'file' ] ); |
|
59 | + $cropped_image_files = isset( $meta[ 'sizes' ] ) ? wp_list_pluck( $meta[ 'sizes' ], 'file' ) : array(); |
|
60 | 60 | if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) { |
61 | 61 | $attachment_id = $post_id; |
62 | 62 | break; |
@@ -135,8 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | return $this->is_valid_time_stamp( $string ) |
138 | - ? (int) $string : |
|
139 | - strtotime( (string) $string ); |
|
138 | + ? (int) $string : strtotime( (string) $string ); |
|
140 | 139 | } |
141 | 140 | |
142 | 141 | /** |
@@ -241,24 +240,24 @@ discard block |
||
241 | 240 | |
242 | 241 | // order is relevant here, since the replacement will be done sequentially. |
243 | 242 | $supported_options = array( |
244 | - 'd' => 'dd', // Day, leading 0 |
|
245 | - 'j' => 'd', // Day, no 0 |
|
246 | - 'z' => 'o', // Day of the year, no leading zeroes, |
|
243 | + 'd' => 'dd', // Day, leading 0 |
|
244 | + 'j' => 'd', // Day, no 0 |
|
245 | + 'z' => 'o', // Day of the year, no leading zeroes, |
|
247 | 246 | // 'D' => 'D', // Day name short, not sure how it'll work with translations |
248 | 247 | // 'l' => 'DD', // Day name full, idem before |
249 | - 'm' => 'mm', // Month of the year, leading 0 |
|
250 | - 'n' => 'm', // Month of the year, no leading 0 |
|
248 | + 'm' => 'mm', // Month of the year, leading 0 |
|
249 | + 'n' => 'm', // Month of the year, no leading 0 |
|
251 | 250 | // 'M' => 'M', // Month, Short name |
252 | 251 | // 'F' => 'MM', // Month, full name, |
253 | - 'y' => 'y', // Year, two digit |
|
254 | - 'Y' => 'yy', // Year, full |
|
255 | - 'H' => 'HH', // Hour with leading 0 (24 hour) |
|
256 | - 'G' => 'H', // Hour with no leading 0 (24 hour) |
|
257 | - 'h' => 'hh', // Hour with leading 0 (12 hour) |
|
258 | - 'g' => 'h', // Hour with no leading 0 (12 hour), |
|
259 | - 'i' => 'mm', // Minute with leading 0, |
|
260 | - 's' => 'ss', // Second with leading 0, |
|
261 | - 'a' => 'tt', // am/pm |
|
252 | + 'y' => 'y', // Year, two digit |
|
253 | + 'Y' => 'yy', // Year, full |
|
254 | + 'H' => 'HH', // Hour with leading 0 (24 hour) |
|
255 | + 'G' => 'H', // Hour with no leading 0 (24 hour) |
|
256 | + 'h' => 'hh', // Hour with leading 0 (12 hour) |
|
257 | + 'g' => 'h', // Hour with no leading 0 (12 hour), |
|
258 | + 'i' => 'mm', // Minute with leading 0, |
|
259 | + 's' => 'ss', // Second with leading 0, |
|
260 | + 'a' => 'tt', // am/pm |
|
262 | 261 | 'A' => 'TT' // AM/PM |
263 | 262 | ); |
264 | 263 | |
@@ -279,7 +278,7 @@ discard block |
||
279 | 278 | * @return string Modified value |
280 | 279 | */ |
281 | 280 | public function wrap_escaped_chars( $value ) { |
282 | - return "'" . str_replace( '\\', '', $value[0] ) . "'"; |
|
281 | + return "'" . str_replace( '\\', '', $value[ 0 ] ) . "'"; |
|
283 | 282 | } |
284 | 283 | |
285 | 284 | /** |
@@ -110,7 +110,8 @@ |
||
110 | 110 | $current_offset = get_option( 'gmt_offset' ); |
111 | 111 | $tzstring = get_option( 'timezone_string' ); |
112 | 112 | |
113 | - if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists |
|
113 | + if ( empty( $tzstring ) ) { |
|
114 | +// Create a UTC+- zone if no timezone string exists |
|
114 | 115 | if ( 0 == $current_offset ) { |
115 | 116 | $tzstring = 'UTC+0'; |
116 | 117 | } elseif ( $current_offset < 0 ) { |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $cmb = CMB2_Boxes::get( $meta_box ); |
179 | 179 | } else { |
180 | 180 | // See if we already have an instance of this metabox |
181 | - $cmb = CMB2_Boxes::get( $meta_box['id'] ); |
|
181 | + $cmb = CMB2_Boxes::get( $meta_box[ 'id' ] ); |
|
182 | 182 | // If not, we'll initate a new metabox |
183 | 183 | $cmb = $cmb ? $cmb : new CMB2( $meta_box, $object_id ); |
184 | 184 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | ) ); |
255 | 255 | |
256 | 256 | // Set object type explicitly (rather than trying to guess from context) |
257 | - $cmb->object_type( $args['object_type'] ); |
|
257 | + $cmb->object_type( $args[ 'object_type' ] ); |
|
258 | 258 | |
259 | 259 | // Save the metabox if it's been submitted |
260 | 260 | // check permissions |
@@ -262,32 +262,32 @@ discard block |
||
262 | 262 | if ( |
263 | 263 | $cmb->prop( 'save_fields' ) |
264 | 264 | // check nonce |
265 | - && isset( $_POST['submit-cmb'], $_POST['object_id'], $_POST[ $cmb->nonce() ] ) |
|
265 | + && isset( $_POST[ 'submit-cmb' ], $_POST[ 'object_id' ], $_POST[ $cmb->nonce() ] ) |
|
266 | 266 | && wp_verify_nonce( $_POST[ $cmb->nonce() ], $cmb->nonce() ) |
267 | - && $object_id && $_POST['object_id'] == $object_id |
|
267 | + && $object_id && $_POST[ 'object_id' ] == $object_id |
|
268 | 268 | ) { |
269 | 269 | $cmb->save_fields( $object_id, $cmb->object_type(), $_POST ); |
270 | 270 | } |
271 | 271 | |
272 | 272 | // Enqueue JS/CSS |
273 | - if ( $args['cmb_styles'] ) { |
|
273 | + if ( $args[ 'cmb_styles' ] ) { |
|
274 | 274 | CMB2_hookup::enqueue_cmb_css(); |
275 | 275 | } |
276 | 276 | |
277 | - if ( $args['enqueue_js'] ) { |
|
277 | + if ( $args[ 'enqueue_js' ] ) { |
|
278 | 278 | CMB2_hookup::enqueue_cmb_js(); |
279 | 279 | } |
280 | 280 | |
281 | - $form_format = apply_filters( 'cmb2_get_metabox_form_format', $args['form_format'], $object_id, $cmb ); |
|
281 | + $form_format = apply_filters( 'cmb2_get_metabox_form_format', $args[ 'form_format' ], $object_id, $cmb ); |
|
282 | 282 | |
283 | 283 | $format_parts = explode( '%3$s', $form_format ); |
284 | 284 | |
285 | 285 | // Show cmb form |
286 | - printf( $format_parts[0], $cmb->cmb_id, $object_id ); |
|
286 | + printf( $format_parts[ 0 ], $cmb->cmb_id, $object_id ); |
|
287 | 287 | $cmb->show_form(); |
288 | 288 | |
289 | - if ( isset( $format_parts[1] ) && $format_parts[1] ) { |
|
290 | - printf( str_ireplace( '%4$s', '%1$s', $format_parts[1] ), $args['save_button'] ); |
|
289 | + if ( isset( $format_parts[ 1 ] ) && $format_parts[ 1 ] ) { |
|
290 | + printf( str_ireplace( '%4$s', '%1$s', $format_parts[ 1 ] ), $args[ 'save_button' ] ); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param array $args Optional arguments array |
301 | 301 | */ |
302 | 302 | function cmb2_metabox_form( $meta_box, $object_id = 0, $args = array() ) { |
303 | - if ( ! isset( $args['echo'] ) || $args['echo'] ) { |
|
303 | + if ( ! isset( $args[ 'echo' ] ) || $args[ 'echo' ] ) { |
|
304 | 304 | cmb2_print_metabox_form( $meta_box, $object_id, $args ); |
305 | 305 | } else { |
306 | 306 | return cmb2_get_metabox_form( $meta_box, $object_id, $args ); |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | |
323 | 323 | $schedule_format = str_replace( |
324 | 324 | array( 'M', 'Y', 'm', 'd', 'H', 'i', 'a' ), |
325 | - array('%b', '%Y', '%m', '%d', '%H', '%M', '%p' ), |
|
325 | + array( '%b', '%Y', '%m', '%d', '%H', '%M', '%p' ), |
|
326 | 326 | $date_format |
327 | 327 | ); |
328 | 328 | |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | * 4 or 2 characters, as needed |
340 | 340 | */ |
341 | 341 | '%04d-%02d-%02d %02d:%02d:%02d', |
342 | - $parsed_time['tm_year'] + 1900, // This will be "111", so we need to add 1900. |
|
343 | - $parsed_time['tm_mon'] + 1, // This will be the month minus one, so we add one. |
|
344 | - $parsed_time['tm_mday'], |
|
345 | - $parsed_time['tm_hour'], |
|
346 | - $parsed_time['tm_min'], |
|
347 | - $parsed_time['tm_sec'] |
|
342 | + $parsed_time[ 'tm_year' ] + 1900, // This will be "111", so we need to add 1900. |
|
343 | + $parsed_time[ 'tm_mon' ] + 1, // This will be the month minus one, so we add one. |
|
344 | + $parsed_time[ 'tm_mday' ], |
|
345 | + $parsed_time[ 'tm_hour' ], |
|
346 | + $parsed_time[ 'tm_min' ], |
|
347 | + $parsed_time[ 'tm_sec' ] |
|
348 | 348 | ); |
349 | 349 | |
350 | - return new DateTime($ymd); |
|
350 | + return new DateTime( $ymd ); |
|
351 | 351 | } |
352 | 352 | } |
@@ -1,46 +1,46 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @category WordPress_Plugin |
|
4 | - * @package CMB2 |
|
5 | - * @author WebDevStudios |
|
6 | - * @license GPL-2.0+ |
|
7 | - * @link http://webdevstudios.com |
|
8 | - * |
|
9 | - * Plugin Name: CMB2 |
|
10 | - * Plugin URI: https://github.com/WebDevStudios/CMB2 |
|
11 | - * Description: CMB2 will create metaboxes and forms with custom fields that will blow your mind. |
|
12 | - * Author: WebDevStudios |
|
13 | - * Author URI: http://webdevstudios.com |
|
14 | - * Contributors: WebDevStudios (@webdevstudios / webdevstudios.com) |
|
15 | - * Justin Sternberg (@jtsternberg / dsgnwrks.pro) |
|
16 | - * Jared Atchison (@jaredatch / jaredatchison.com) |
|
17 | - * Bill Erickson (@billerickson / billerickson.net) |
|
18 | - * Andrew Norcross (@norcross / andrewnorcross.com) |
|
19 | - * |
|
20 | - * Version: 2.1.2 |
|
21 | - * |
|
22 | - * Text Domain: cmb2 |
|
23 | - * Domain Path: languages |
|
24 | - * |
|
25 | - * |
|
26 | - * Released under the GPL license |
|
27 | - * http://www.opensource.org/licenses/gpl-license.php |
|
28 | - * |
|
29 | - * This is an add-on for WordPress |
|
30 | - * http://wordpress.org/ |
|
31 | - * |
|
32 | - * ********************************************************************** |
|
33 | - * This program is free software; you can redistribute it and/or modify |
|
34 | - * it under the terms of the GNU General Public License as published by |
|
35 | - * the Free Software Foundation; either version 2 of the License, or |
|
36 | - * (at your option) any later version. |
|
37 | - * |
|
38 | - * This program is distributed in the hope that it will be useful, |
|
39 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
40 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
41 | - * GNU General Public License for more details. |
|
42 | - * ********************************************************************** |
|
43 | - */ |
|
3 | + * @category WordPress_Plugin |
|
4 | + * @package CMB2 |
|
5 | + * @author WebDevStudios |
|
6 | + * @license GPL-2.0+ |
|
7 | + * @link http://webdevstudios.com |
|
8 | + * |
|
9 | + * Plugin Name: CMB2 |
|
10 | + * Plugin URI: https://github.com/WebDevStudios/CMB2 |
|
11 | + * Description: CMB2 will create metaboxes and forms with custom fields that will blow your mind. |
|
12 | + * Author: WebDevStudios |
|
13 | + * Author URI: http://webdevstudios.com |
|
14 | + * Contributors: WebDevStudios (@webdevstudios / webdevstudios.com) |
|
15 | + * Justin Sternberg (@jtsternberg / dsgnwrks.pro) |
|
16 | + * Jared Atchison (@jaredatch / jaredatchison.com) |
|
17 | + * Bill Erickson (@billerickson / billerickson.net) |
|
18 | + * Andrew Norcross (@norcross / andrewnorcross.com) |
|
19 | + * |
|
20 | + * Version: 2.1.2 |
|
21 | + * |
|
22 | + * Text Domain: cmb2 |
|
23 | + * Domain Path: languages |
|
24 | + * |
|
25 | + * |
|
26 | + * Released under the GPL license |
|
27 | + * http://www.opensource.org/licenses/gpl-license.php |
|
28 | + * |
|
29 | + * This is an add-on for WordPress |
|
30 | + * http://wordpress.org/ |
|
31 | + * |
|
32 | + * ********************************************************************** |
|
33 | + * This program is free software; you can redistribute it and/or modify |
|
34 | + * it under the terms of the GNU General Public License as published by |
|
35 | + * the Free Software Foundation; either version 2 of the License, or |
|
36 | + * (at your option) any later version. |
|
37 | + * |
|
38 | + * This program is distributed in the hope that it will be useful, |
|
39 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
40 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
41 | + * GNU General Public License for more details. |
|
42 | + * ********************************************************************** |
|
43 | + */ |
|
44 | 44 | |
45 | 45 | /************************************************************************ |
46 | 46 | You should not edit the code below |