@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @subpackage Core |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if( ! class_exists('acf_third_party') ) : |
|
| 13 | +if ( ! class_exists('acf_third_party')) : |
|
| 14 | 14 | |
| 15 | 15 | class acf_third_party { |
| 16 | 16 | |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | function admin_head_tabify() { |
| 57 | 57 | |
| 58 | 58 | // remove ACF from the tabs |
| 59 | - add_filter('tabify_posttypes', array($this, 'tabify_posttypes')); |
|
| 59 | + add_filter('tabify_posttypes', array($this, 'tabify_posttypes')); |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | // add acf metaboxes to list |
| 63 | - add_action('tabify_add_meta_boxes', array($this, 'tabify_add_meta_boxes')); |
|
| 63 | + add_action('tabify_add_meta_boxes', array($this, 'tabify_add_meta_boxes')); |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | * @return $post_id (int) |
| 79 | 79 | */ |
| 80 | 80 | |
| 81 | - function tabify_posttypes( $posttypes ) { |
|
| 81 | + function tabify_posttypes($posttypes) { |
|
| 82 | 82 | |
| 83 | 83 | // unset |
| 84 | - unset( $posttypes['acf-field-group'] ); |
|
| 85 | - unset( $posttypes['acf-field'] ); |
|
| 84 | + unset($posttypes['acf-field-group']); |
|
| 85 | + unset($posttypes['acf-field']); |
|
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | // return |
@@ -103,24 +103,24 @@ discard block |
||
| 103 | 103 | * @return n/a |
| 104 | 104 | */ |
| 105 | 105 | |
| 106 | - function tabify_add_meta_boxes( $post_type ) { |
|
| 106 | + function tabify_add_meta_boxes($post_type) { |
|
| 107 | 107 | |
| 108 | 108 | // get field groups |
| 109 | 109 | $field_groups = acf_get_field_groups(); |
| 110 | 110 | |
| 111 | 111 | |
| 112 | - if( !empty($field_groups) ) { |
|
| 112 | + if ( ! empty($field_groups)) { |
|
| 113 | 113 | |
| 114 | - foreach( $field_groups as $field_group ) { |
|
| 114 | + foreach ($field_groups as $field_group) { |
|
| 115 | 115 | |
| 116 | 116 | // vars |
| 117 | 117 | $id = "acf-{$field_group['key']}"; |
| 118 | - $title = 'ACF: ' . $field_group['title']; |
|
| 118 | + $title = 'ACF: '.$field_group['title']; |
|
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | // add meta box |
| 123 | - add_meta_box( $id, $title, '__return_true', $post_type ); |
|
| 123 | + add_meta_box($id, $title, '__return_true', $post_type); |
|
| 124 | 124 | |
| 125 | 125 | } |
| 126 | 126 | |
@@ -142,26 +142,26 @@ discard block |
||
| 142 | 142 | * @return $pages |
| 143 | 143 | */ |
| 144 | 144 | |
| 145 | - function pts_allowed_pages( $pages ) { |
|
| 145 | + function pts_allowed_pages($pages) { |
|
| 146 | 146 | |
| 147 | 147 | // vars |
| 148 | 148 | $post_type = ''; |
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | // check $_GET becuase it is too early to use functions / global vars |
| 152 | - if( !empty($_GET['post_type']) ) { |
|
| 152 | + if ( ! empty($_GET['post_type'])) { |
|
| 153 | 153 | |
| 154 | 154 | $post_type = $_GET['post_type']; |
| 155 | 155 | |
| 156 | - } elseif( !empty($_GET['post']) ) { |
|
| 156 | + } elseif ( ! empty($_GET['post'])) { |
|
| 157 | 157 | |
| 158 | - $post_type = get_post_type( $_GET['post'] ); |
|
| 158 | + $post_type = get_post_type($_GET['post']); |
|
| 159 | 159 | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
| 163 | 163 | // check post type |
| 164 | - if( $post_type == 'acf-field-group' ) { |
|
| 164 | + if ($post_type == 'acf-field-group') { |
|
| 165 | 165 | |
| 166 | 166 | $pages = array(); |
| 167 | 167 | |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | // actions |
| 37 | - add_action('acf/verify_ajax', array($this, 'verify_ajax')); |
|
| 38 | - add_action('acf/field_group/admin_head', array($this, 'admin_head')); |
|
| 39 | - add_action('acf/input/admin_head', array($this, 'admin_head')); |
|
| 37 | + add_action('acf/verify_ajax', array($this, 'verify_ajax')); |
|
| 38 | + add_action('acf/field_group/admin_head', array($this, 'admin_head')); |
|
| 39 | + add_action('acf/input/admin_head', array($this, 'admin_head')); |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | // bail early if not transaltable |
| 43 | - if( !$this->is_translatable() ) { |
|
| 43 | + if ( ! $this->is_translatable()) { |
|
| 44 | 44 | |
| 45 | 45 | return; |
| 46 | 46 | |
@@ -48,15 +48,15 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | // actions |
| 51 | - add_action('acf/upgrade_start/5.0.0', array($this, 'upgrade_start_5')); |
|
| 52 | - add_action('acf/upgrade_finish/5.0.0', array($this, 'upgrade_finish_5')); |
|
| 53 | - add_action('acf/update_field_group', array($this, 'update_field_group'), 2, 1); |
|
| 54 | - add_action('icl_make_duplicate', array($this, 'icl_make_duplicate'), 10, 4); |
|
| 51 | + add_action('acf/upgrade_start/5.0.0', array($this, 'upgrade_start_5')); |
|
| 52 | + add_action('acf/upgrade_finish/5.0.0', array($this, 'upgrade_finish_5')); |
|
| 53 | + add_action('acf/update_field_group', array($this, 'update_field_group'), 2, 1); |
|
| 54 | + add_action('icl_make_duplicate', array($this, 'icl_make_duplicate'), 10, 4); |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | // filters |
| 58 | - add_filter('acf/settings/save_json', array($this, 'settings_save_json')); |
|
| 59 | - add_filter('acf/settings/load_json', array($this, 'settings_load_json')); |
|
| 58 | + add_filter('acf/settings/save_json', array($this, 'settings_save_json')); |
|
| 59 | + add_filter('acf/settings/load_json', array($this, 'settings_load_json')); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | // return true if acf-field-group is translatable |
| 88 | - if( !empty($post_types['acf-field-group']) ) { |
|
| 88 | + if ( ! empty($post_types['acf-field-group'])) { |
|
| 89 | 89 | |
| 90 | 90 | return true; |
| 91 | 91 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | // return true if acf is translatable, and acf-field-group does not yet exist |
| 96 | - if( !empty($post_types['acf']) && !isset($post_types['acf-field-group']) ) { |
|
| 96 | + if ( ! empty($post_types['acf']) && ! isset($post_types['acf-field-group'])) { |
|
| 97 | 97 | |
| 98 | 98 | return true; |
| 99 | 99 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | // post type has changed from 'acf' to 'acf-field-group' |
| 138 | - if( !empty($post_types['acf']) ) { |
|
| 138 | + if ( ! empty($post_types['acf'])) { |
|
| 139 | 139 | |
| 140 | 140 | $post_types['acf-field-group'] = 1; |
| 141 | 141 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | // save |
| 150 | - $sitepress->save_settings( $icl_settings ); |
|
| 150 | + $sitepress->save_settings($icl_settings); |
|
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | |
@@ -186,14 +186,14 @@ discard block |
||
| 186 | 186 | * @return n/a |
| 187 | 187 | */ |
| 188 | 188 | |
| 189 | - function update_field_group_5( $field_group ) { |
|
| 189 | + function update_field_group_5($field_group) { |
|
| 190 | 190 | |
| 191 | 191 | // global |
| 192 | 192 | global $wpdb, $sitepress; |
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | // bail early if no old_ID (added to $field_group by upgrade 5.0.0) |
| 196 | - if( empty($field_group['old_ID']) ) { |
|
| 196 | + if (empty($field_group['old_ID'])) { |
|
| 197 | 197 | |
| 198 | 198 | return; |
| 199 | 199 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | |
| 215 | 215 | // bail ealry if no rows |
| 216 | - if( !$old_row || !$new_row ) { |
|
| 216 | + if ( ! $old_row || ! $new_row) { |
|
| 217 | 217 | |
| 218 | 218 | return; |
| 219 | 219 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | // create reference of old trid to new trid |
| 224 | 224 | // trid is a simple int used to find associated objects |
| 225 | - if( empty($this->trid_ref) ) { |
|
| 225 | + if (empty($this->trid_ref)) { |
|
| 226 | 226 | |
| 227 | 227 | $this->trid_ref = array(); |
| 228 | 228 | |
@@ -230,15 +230,15 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | // update trid |
| 233 | - if( isset($this->trid_ref[ $old_row['trid'] ]) ) { |
|
| 233 | + if (isset($this->trid_ref[$old_row['trid']])) { |
|
| 234 | 234 | |
| 235 | 235 | // this field group is a translation of another, update it's trid to match the previously inserted group |
| 236 | - $new_row['trid'] = $this->trid_ref[ $old_row['trid'] ]; |
|
| 236 | + $new_row['trid'] = $this->trid_ref[$old_row['trid']]; |
|
| 237 | 237 | |
| 238 | 238 | } else { |
| 239 | 239 | |
| 240 | 240 | // this field group is the first of it's translations, update the reference for future groups |
| 241 | - $this->trid_ref[ $old_row['trid'] ] = $new_row['trid']; |
|
| 241 | + $this->trid_ref[$old_row['trid']] = $new_row['trid']; |
|
| 242 | 242 | |
| 243 | 243 | } |
| 244 | 244 | |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | // update icl_translations |
| 247 | 247 | // Row is created by WPML, and much easier to tweak it here due to the very complicated and nonsensical WPML logic |
| 248 | 248 | $table = "{$wpdb->prefix}icl_translations"; |
| 249 | - $data = array( 'trid' => $new_row['trid'], 'language_code' => $old_row['language_code'] ); |
|
| 250 | - $where = array( 'translation_id' => $new_row['translation_id'] ); |
|
| 251 | - $data_format = array( '%d', '%s' ); |
|
| 252 | - $where_format = array( '%d' ); |
|
| 249 | + $data = array('trid' => $new_row['trid'], 'language_code' => $old_row['language_code']); |
|
| 250 | + $where = array('translation_id' => $new_row['translation_id']); |
|
| 251 | + $data_format = array('%d', '%s'); |
|
| 252 | + $where_format = array('%d'); |
|
| 253 | 253 | |
| 254 | 254 | |
| 255 | 255 | // allow source_language_code to equal NULL |
| 256 | - if( $old_row['source_language_code'] ) { |
|
| 256 | + if ($old_row['source_language_code']) { |
|
| 257 | 257 | |
| 258 | 258 | $data['source_language_code'] = $old_row['source_language_code']; |
| 259 | 259 | $data_format[] = '%s'; |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | |
| 264 | 264 | // update wpdb |
| 265 | - $result = $wpdb->update( $table, $data, $where, $data_format, $where_format ); |
|
| 265 | + $result = $wpdb->update($table, $data, $where, $data_format, $where_format); |
|
| 266 | 266 | |
| 267 | 267 | } |
| 268 | 268 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | * @return n/a |
| 281 | 281 | */ |
| 282 | 282 | |
| 283 | - function update_field_group( $field_group ) { |
|
| 283 | + function update_field_group($field_group) { |
|
| 284 | 284 | |
| 285 | 285 | global $sitepress; |
| 286 | 286 | |
@@ -302,10 +302,10 @@ discard block |
||
| 302 | 302 | * @return $post_id (int) |
| 303 | 303 | */ |
| 304 | 304 | |
| 305 | - function settings_save_json( $path ) { |
|
| 305 | + function settings_save_json($path) { |
|
| 306 | 306 | |
| 307 | 307 | // bail early if dir does not exist |
| 308 | - if( !is_writable($path) ) { |
|
| 308 | + if ( ! is_writable($path)) { |
|
| 309 | 309 | |
| 310 | 310 | return $path; |
| 311 | 311 | |
@@ -313,15 +313,15 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | |
| 315 | 315 | // remove trailing slash |
| 316 | - $path = untrailingslashit( $path ); |
|
| 316 | + $path = untrailingslashit($path); |
|
| 317 | 317 | |
| 318 | 318 | |
| 319 | 319 | // ammend |
| 320 | - $path = $path . '/' . $this->lang; |
|
| 320 | + $path = $path.'/'.$this->lang; |
|
| 321 | 321 | |
| 322 | 322 | |
| 323 | 323 | // make dir if does not exist |
| 324 | - if( !file_exists($path) ) { |
|
| 324 | + if ( ! file_exists($path)) { |
|
| 325 | 325 | |
| 326 | 326 | mkdir($path, 0777, true); |
| 327 | 327 | |
@@ -347,18 +347,18 @@ discard block |
||
| 347 | 347 | * @return $post_id (int) |
| 348 | 348 | */ |
| 349 | 349 | |
| 350 | - function settings_load_json( $paths ) { |
|
| 350 | + function settings_load_json($paths) { |
|
| 351 | 351 | |
| 352 | - if( !empty($paths) ) { |
|
| 352 | + if ( ! empty($paths)) { |
|
| 353 | 353 | |
| 354 | - foreach( $paths as $i => $path ) { |
|
| 354 | + foreach ($paths as $i => $path) { |
|
| 355 | 355 | |
| 356 | 356 | // remove trailing slash |
| 357 | - $path = untrailingslashit( $path ); |
|
| 357 | + $path = untrailingslashit($path); |
|
| 358 | 358 | |
| 359 | 359 | |
| 360 | 360 | // ammend |
| 361 | - $paths[ $i ] = $path . '/' . $this->lang; |
|
| 361 | + $paths[$i] = $path.'/'.$this->lang; |
|
| 362 | 362 | |
| 363 | 363 | } |
| 364 | 364 | } |
@@ -384,10 +384,10 @@ discard block |
||
| 384 | 384 | * @return $post_id (int) |
| 385 | 385 | */ |
| 386 | 386 | |
| 387 | - function icl_make_duplicate( $master_post_id, $lang, $postarr, $id ) { |
|
| 387 | + function icl_make_duplicate($master_post_id, $lang, $postarr, $id) { |
|
| 388 | 388 | |
| 389 | 389 | // validate |
| 390 | - if( $postarr['post_type'] != 'acf-field-group' ) { |
|
| 390 | + if ($postarr['post_type'] != 'acf-field-group') { |
|
| 391 | 391 | |
| 392 | 392 | return; |
| 393 | 393 | |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | |
| 396 | 396 | |
| 397 | 397 | // duplicate field group |
| 398 | - acf_duplicate_field_group( $master_post_id, $id ); |
|
| 398 | + acf_duplicate_field_group($master_post_id, $id); |
|
| 399 | 399 | |
| 400 | 400 | |
| 401 | 401 | // always translate independately to avoid many many bugs! |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | // - local json creates new files due to changed key |
| 404 | 404 | global $iclTranslationManagement; |
| 405 | 405 | |
| 406 | - $iclTranslationManagement->reset_duplicate_flag( $id ); |
|
| 406 | + $iclTranslationManagement->reset_duplicate_flag($id); |
|
| 407 | 407 | |
| 408 | 408 | } |
| 409 | 409 | |
@@ -464,18 +464,18 @@ discard block |
||
| 464 | 464 | |
| 465 | 465 | |
| 466 | 466 | // switch lang |
| 467 | - if( isset($_REQUEST['lang']) ) { |
|
| 467 | + if (isset($_REQUEST['lang'])) { |
|
| 468 | 468 | |
| 469 | - $sitepress->switch_lang( $_REQUEST['lang'] ); |
|
| 469 | + $sitepress->switch_lang($_REQUEST['lang']); |
|
| 470 | 470 | |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | |
| 474 | 474 | // remove post_id |
| 475 | 475 | // WPML is getting confused when this is not a numeric value ('options') |
| 476 | - if( isset($_REQUEST['post_id']) && !is_numeric($_REQUEST['post_id']) ) { |
|
| 476 | + if (isset($_REQUEST['post_id']) && ! is_numeric($_REQUEST['post_id'])) { |
|
| 477 | 477 | |
| 478 | - unset( $_REQUEST['post_id'] ); |
|
| 478 | + unset($_REQUEST['post_id']); |
|
| 479 | 479 | |
| 480 | 480 | } |
| 481 | 481 | |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | // do not delete! |
| 47 | - parent::__construct(); |
|
| 47 | + parent::__construct(); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @subpackage Fields |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if( ! class_exists('acf_field_checkbox') ) : |
|
| 14 | +if ( ! class_exists('acf_field_checkbox')) : |
|
| 15 | 15 | |
| 16 | 16 | class acf_field_checkbox extends acf_field { |
| 17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // vars |
| 35 | 35 | $this->name = 'checkbox'; |
| 36 | - $this->label = __("Checkbox",'acf'); |
|
| 36 | + $this->label = __("Checkbox", 'acf'); |
|
| 37 | 37 | $this->category = 'choice'; |
| 38 | 38 | $this->defaults = array( |
| 39 | 39 | 'layout' => 'vertical', |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @return n/a |
| 64 | 64 | */ |
| 65 | 65 | |
| 66 | - function render_field( $field ) { |
|
| 66 | + function render_field($field) { |
|
| 67 | 67 | |
| 68 | 68 | // decode value (convert to array) |
| 69 | 69 | $field['value'] = acf_get_array($field['value'], false); |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | // foreach choices |
| 90 | - if( !empty($field['choices']) ) { |
|
| 90 | + if ( ! empty($field['choices'])) { |
|
| 91 | 91 | |
| 92 | - foreach( $field['choices'] as $value => $label ) { |
|
| 92 | + foreach ($field['choices'] as $value => $label) { |
|
| 93 | 93 | |
| 94 | 94 | // increase counter |
| 95 | 95 | $i++; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | // is choice selected? |
| 108 | - if( in_array($value, $field['value']) ) { |
|
| 108 | + if (in_array($value, $field['value'])) { |
|
| 109 | 109 | |
| 110 | 110 | $atts['checked'] = 'checked'; |
| 111 | 111 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
| 119 | - if( isset($field['disabled']) && acf_in_array($value, $field['disabled']) ) { |
|
| 119 | + if (isset($field['disabled']) && acf_in_array($value, $field['disabled'])) { |
|
| 120 | 120 | |
| 121 | 121 | $atts['disabled'] = 'disabled'; |
| 122 | 122 | |
@@ -124,21 +124,21 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | // each input ID is generated with the $key, however, the first input must not use $key so that it matches the field's label for attribute |
| 127 | - if( $i > 1 ) { |
|
| 127 | + if ($i > 1) { |
|
| 128 | 128 | |
| 129 | - $atts['id'] .= '-' . $value; |
|
| 129 | + $atts['id'] .= '-'.$value; |
|
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | // append HTML |
| 135 | - $li .= '<li><label><input ' . acf_esc_attr( $atts ) . '/>' . $label . '</label></li>'; |
|
| 135 | + $li .= '<li><label><input '.acf_esc_attr($atts).'/>'.$label.'</label></li>'; |
|
| 136 | 136 | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | // toggle all |
| 141 | - if( $field['toggle'] ) { |
|
| 141 | + if ($field['toggle']) { |
|
| 142 | 142 | |
| 143 | 143 | // vars |
| 144 | 144 | $label = __("Toggle All", 'acf'); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | // custom label |
| 152 | - if( is_string($field['toggle']) ) { |
|
| 152 | + if (is_string($field['toggle'])) { |
|
| 153 | 153 | |
| 154 | 154 | $label = $field['toggle']; |
| 155 | 155 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | // checked |
| 160 | - if( $all_checked ) { |
|
| 160 | + if ($all_checked) { |
|
| 161 | 161 | |
| 162 | 162 | $atts['checked'] = 'checked'; |
| 163 | 163 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | |
| 167 | 167 | // append HTML |
| 168 | - $li = '<li><label><input ' . acf_esc_attr( $atts ) . '/>' . $label . '</label></li>' . $li; |
|
| 168 | + $li = '<li><label><input '.acf_esc_attr($atts).'/>'.$label.'</label></li>'.$li; |
|
| 169 | 169 | |
| 170 | 170 | } |
| 171 | 171 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | |
| 180 | 180 | // return |
| 181 | - echo '<ul ' . acf_esc_attr(array( 'class' => $field['class'] )) . '>' . $li . '</ul>'; |
|
| 181 | + echo '<ul '.acf_esc_attr(array('class' => $field['class'])).'>'.$li.'</ul>'; |
|
| 182 | 182 | |
| 183 | 183 | } |
| 184 | 184 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param $field - an array holding all the field's data |
| 197 | 197 | */ |
| 198 | 198 | |
| 199 | - function render_field_settings( $field ) { |
|
| 199 | + function render_field_settings($field) { |
|
| 200 | 200 | |
| 201 | 201 | // encode choices (convert from array) |
| 202 | 202 | $field['choices'] = acf_encode_choices($field['choices']); |
@@ -204,47 +204,47 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | // choices |
| 207 | - acf_render_field_setting( $field, array( |
|
| 208 | - 'label' => __('Choices','acf'), |
|
| 209 | - 'instructions' => __('Enter each choice on a new line.','acf') . '<br /><br />' . __('For more control, you may specify both a value and label like this:','acf'). '<br /><br />' . __('red : Red','acf'), |
|
| 207 | + acf_render_field_setting($field, array( |
|
| 208 | + 'label' => __('Choices', 'acf'), |
|
| 209 | + 'instructions' => __('Enter each choice on a new line.', 'acf').'<br /><br />'.__('For more control, you may specify both a value and label like this:', 'acf').'<br /><br />'.__('red : Red', 'acf'), |
|
| 210 | 210 | 'type' => 'textarea', |
| 211 | 211 | 'name' => 'choices', |
| 212 | 212 | )); |
| 213 | 213 | |
| 214 | 214 | |
| 215 | 215 | // default_value |
| 216 | - acf_render_field_setting( $field, array( |
|
| 217 | - 'label' => __('Default Value','acf'), |
|
| 218 | - 'instructions' => __('Enter each default value on a new line','acf'), |
|
| 216 | + acf_render_field_setting($field, array( |
|
| 217 | + 'label' => __('Default Value', 'acf'), |
|
| 218 | + 'instructions' => __('Enter each default value on a new line', 'acf'), |
|
| 219 | 219 | 'type' => 'textarea', |
| 220 | 220 | 'name' => 'default_value', |
| 221 | 221 | )); |
| 222 | 222 | |
| 223 | 223 | |
| 224 | 224 | // layout |
| 225 | - acf_render_field_setting( $field, array( |
|
| 226 | - 'label' => __('Layout','acf'), |
|
| 225 | + acf_render_field_setting($field, array( |
|
| 226 | + 'label' => __('Layout', 'acf'), |
|
| 227 | 227 | 'instructions' => '', |
| 228 | 228 | 'type' => 'radio', |
| 229 | 229 | 'name' => 'layout', |
| 230 | 230 | 'layout' => 'horizontal', |
| 231 | 231 | 'choices' => array( |
| 232 | - 'vertical' => __("Vertical",'acf'), |
|
| 233 | - 'horizontal' => __("Horizontal",'acf') |
|
| 232 | + 'vertical' => __("Vertical", 'acf'), |
|
| 233 | + 'horizontal' => __("Horizontal", 'acf') |
|
| 234 | 234 | ) |
| 235 | 235 | )); |
| 236 | 236 | |
| 237 | 237 | |
| 238 | 238 | // layout |
| 239 | - acf_render_field_setting( $field, array( |
|
| 240 | - 'label' => __('Toggle','acf'), |
|
| 241 | - 'instructions' => __('Prepend an extra checkbox to toggle all choices','acf'), |
|
| 239 | + acf_render_field_setting($field, array( |
|
| 240 | + 'label' => __('Toggle', 'acf'), |
|
| 241 | + 'instructions' => __('Prepend an extra checkbox to toggle all choices', 'acf'), |
|
| 242 | 242 | 'type' => 'radio', |
| 243 | 243 | 'name' => 'toggle', |
| 244 | 244 | 'layout' => 'horizontal', |
| 245 | 245 | 'choices' => array( |
| 246 | - 1 => __("Yes",'acf'), |
|
| 247 | - 0 => __("No",'acf'), |
|
| 246 | + 1 => __("Yes", 'acf'), |
|
| 247 | + 0 => __("No", 'acf'), |
|
| 248 | 248 | ) |
| 249 | 249 | )); |
| 250 | 250 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * @return $field - the modified field |
| 268 | 268 | */ |
| 269 | 269 | |
| 270 | - function update_field( $field ) { |
|
| 270 | + function update_field($field) { |
|
| 271 | 271 | |
| 272 | 272 | // decode choices (convert to array) |
| 273 | 273 | $field['choices'] = acf_decode_choices($field['choices']); |
@@ -295,10 +295,10 @@ discard block |
||
| 295 | 295 | * @return $value - the modified value |
| 296 | 296 | */ |
| 297 | 297 | |
| 298 | - function update_value( $value, $post_id, $field ) { |
|
| 298 | + function update_value($value, $post_id, $field) { |
|
| 299 | 299 | |
| 300 | 300 | // validate |
| 301 | - if( empty($value) ) { |
|
| 301 | + if (empty($value)) { |
|
| 302 | 302 | |
| 303 | 303 | return $value; |
| 304 | 304 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | |
| 308 | 308 | // array |
| 309 | - if( is_array($value) ) { |
|
| 309 | + if (is_array($value)) { |
|
| 310 | 310 | |
| 311 | 311 | // save value as strings, so we can clearly search for them in SQL LIKE statements |
| 312 | 312 | $value = array_map('strval', $value); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | // do not delete! |
| 44 | - parent::__construct(); |
|
| 44 | + parent::__construct(); |
|
| 45 | 45 | |
| 46 | 46 | } |
| 47 | 47 | |
@@ -79,19 +79,19 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | // localize |
| 82 | - wp_localize_script('wp-color-picker', 'wpColorPickerL10n', array( |
|
| 83 | - 'clear' => __('Clear', 'acf' ), |
|
| 84 | - 'defaultString' => __('Default', 'acf' ), |
|
| 85 | - 'pick' => __('Select Color', 'acf' ), |
|
| 86 | - 'current' => __('Current Color', 'acf' ) |
|
| 87 | - )); |
|
| 82 | + wp_localize_script('wp-color-picker', 'wpColorPickerL10n', array( |
|
| 83 | + 'clear' => __('Clear', 'acf' ), |
|
| 84 | + 'defaultString' => __('Default', 'acf' ), |
|
| 85 | + 'pick' => __('Select Color', 'acf' ), |
|
| 86 | + 'current' => __('Current Color', 'acf' ) |
|
| 87 | + )); |
|
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | // enqueue |
| 93 | 93 | wp_enqueue_style('wp-color-picker'); |
| 94 | - wp_enqueue_script('wp-color-picker'); |
|
| 94 | + wp_enqueue_script('wp-color-picker'); |
|
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @subpackage Fields |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if( ! class_exists('acf_field_color_picker') ) : |
|
| 14 | +if ( ! class_exists('acf_field_color_picker')) : |
|
| 15 | 15 | |
| 16 | 16 | class acf_field_color_picker extends acf_field { |
| 17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // vars |
| 35 | 35 | $this->name = 'color_picker'; |
| 36 | - $this->label = __("Color Picker",'acf'); |
|
| 36 | + $this->label = __("Color Picker", 'acf'); |
|
| 37 | 37 | $this->category = 'jquery'; |
| 38 | 38 | $this->defaults = array( |
| 39 | 39 | 'default_value' => '', |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | // register if not already (on front end) |
| 69 | 69 | // http://wordpress.stackexchange.com/questions/82718/how-do-i-implement-the-wordpress-iris-picker-into-my-plugin-on-the-front-end |
| 70 | - if( !isset($wp_scripts->registered['iris']) ) { |
|
| 70 | + if ( ! isset($wp_scripts->registered['iris'])) { |
|
| 71 | 71 | |
| 72 | 72 | // styles |
| 73 | 73 | wp_register_style('wp-color-picker', admin_url('css/color-picker.css'), array(), '', true); |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | // localize |
| 82 | 82 | wp_localize_script('wp-color-picker', 'wpColorPickerL10n', array( |
| 83 | - 'clear' => __('Clear', 'acf' ), |
|
| 84 | - 'defaultString' => __('Default', 'acf' ), |
|
| 85 | - 'pick' => __('Select Color', 'acf' ), |
|
| 86 | - 'current' => __('Current Color', 'acf' ) |
|
| 83 | + 'clear' => __('Clear', 'acf'), |
|
| 84 | + 'defaultString' => __('Default', 'acf'), |
|
| 85 | + 'pick' => __('Select Color', 'acf'), |
|
| 86 | + 'current' => __('Current Color', 'acf') |
|
| 87 | 87 | )); |
| 88 | 88 | |
| 89 | 89 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @date 23/01/13 |
| 110 | 110 | */ |
| 111 | 111 | |
| 112 | - function render_field( $field ) { |
|
| 112 | + function render_field($field) { |
|
| 113 | 113 | |
| 114 | 114 | // vars |
| 115 | 115 | $atts = array(); |
@@ -117,16 +117,16 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | // populate atts |
| 120 | - foreach( array( 'id', 'class', 'name', 'value' ) as $k ) { |
|
| 120 | + foreach (array('id', 'class', 'name', 'value') as $k) { |
|
| 121 | 121 | |
| 122 | - $atts[ $k ] = $field[ $k ]; |
|
| 122 | + $atts[$k] = $field[$k]; |
|
| 123 | 123 | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | // render |
| 128 | 128 | $e .= '<div class="acf-color_picker">'; |
| 129 | - $e .= '<input type="text" ' . acf_esc_attr($atts) . ' />'; |
|
| 129 | + $e .= '<input type="text" '.acf_esc_attr($atts).' />'; |
|
| 130 | 130 | $e .= '</div>'; |
| 131 | 131 | |
| 132 | 132 | |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | * @param $field - an array holding all the field's data |
| 149 | 149 | */ |
| 150 | 150 | |
| 151 | - function render_field_settings( $field ) { |
|
| 151 | + function render_field_settings($field) { |
|
| 152 | 152 | |
| 153 | 153 | // display_format |
| 154 | - acf_render_field_setting( $field, array( |
|
| 155 | - 'label' => __('Default Value','acf'), |
|
| 154 | + acf_render_field_setting($field, array( |
|
| 155 | + 'label' => __('Default Value', 'acf'), |
|
| 156 | 156 | 'instructions' => '', |
| 157 | 157 | 'type' => 'text', |
| 158 | 158 | 'name' => 'default_value', |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | // do not delete! |
| 50 | - parent::__construct(); |
|
| 50 | + parent::__construct(); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $this->l10n = array( |
| 72 | 72 | 'closeText' => __( 'Done', 'acf' ), |
| 73 | - 'currentText' => __( 'Today', 'acf' ), |
|
| 74 | - 'monthNames' => array_values( $wp_locale->month ), |
|
| 75 | - 'monthNamesShort' => array_values( $wp_locale->month_abbrev ), |
|
| 76 | - 'monthStatus' => __( 'Show a different month', 'acf' ), |
|
| 77 | - 'dayNames' => array_values( $wp_locale->weekday ), |
|
| 78 | - 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ), |
|
| 79 | - 'dayNamesMin' => array_values( $wp_locale->weekday_initial ), |
|
| 80 | - 'isRTL' => isset($wp_locale->is_rtl) ? $wp_locale->is_rtl : false, |
|
| 73 | + 'currentText' => __( 'Today', 'acf' ), |
|
| 74 | + 'monthNames' => array_values( $wp_locale->month ), |
|
| 75 | + 'monthNamesShort' => array_values( $wp_locale->month_abbrev ), |
|
| 76 | + 'monthStatus' => __( 'Show a different month', 'acf' ), |
|
| 77 | + 'dayNames' => array_values( $wp_locale->weekday ), |
|
| 78 | + 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ), |
|
| 79 | + 'dayNamesMin' => array_values( $wp_locale->weekday_initial ), |
|
| 80 | + 'isRTL' => isset($wp_locale->is_rtl) ? $wp_locale->is_rtl : false, |
|
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | 83 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @subpackage Fields |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if( ! class_exists('acf_field_date_picker') ) : |
|
| 14 | +if ( ! class_exists('acf_field_date_picker')) : |
|
| 15 | 15 | |
| 16 | 16 | class acf_field_date_picker extends acf_field { |
| 17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // vars |
| 35 | 35 | $this->name = 'date_picker'; |
| 36 | - $this->label = __("Date Picker",'acf'); |
|
| 36 | + $this->label = __("Date Picker", 'acf'); |
|
| 37 | 37 | $this->category = 'jquery'; |
| 38 | 38 | $this->defaults = array( |
| 39 | 39 | 'display_format' => 'd/m/Y', |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | global $wp_locale; |
| 70 | 70 | |
| 71 | 71 | $this->l10n = array( |
| 72 | - 'closeText' => __( 'Done', 'acf' ), |
|
| 73 | - 'currentText' => __( 'Today', 'acf' ), |
|
| 74 | - 'monthNames' => array_values( $wp_locale->month ), |
|
| 75 | - 'monthNamesShort' => array_values( $wp_locale->month_abbrev ), |
|
| 76 | - 'monthStatus' => __( 'Show a different month', 'acf' ), |
|
| 77 | - 'dayNames' => array_values( $wp_locale->weekday ), |
|
| 78 | - 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ), |
|
| 79 | - 'dayNamesMin' => array_values( $wp_locale->weekday_initial ), |
|
| 72 | + 'closeText' => __('Done', 'acf'), |
|
| 73 | + 'currentText' => __('Today', 'acf'), |
|
| 74 | + 'monthNames' => array_values($wp_locale->month), |
|
| 75 | + 'monthNamesShort' => array_values($wp_locale->month_abbrev), |
|
| 76 | + 'monthStatus' => __('Show a different month', 'acf'), |
|
| 77 | + 'dayNames' => array_values($wp_locale->weekday), |
|
| 78 | + 'dayNamesShort' => array_values($wp_locale->weekday_abbrev), |
|
| 79 | + 'dayNamesMin' => array_values($wp_locale->weekday_initial), |
|
| 80 | 80 | 'isRTL' => isset($wp_locale->is_rtl) ? $wp_locale->is_rtl : false, |
| 81 | 81 | ); |
| 82 | 82 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | // style |
| 106 | - wp_enqueue_style('acf-datepicker', acf_get_dir('assets/inc/datepicker/jquery-ui-1.10.4.custom.min.css'), '', '1.10.4' ); |
|
| 106 | + wp_enqueue_style('acf-datepicker', acf_get_dir('assets/inc/datepicker/jquery-ui-1.10.4.custom.min.css'), '', '1.10.4'); |
|
| 107 | 107 | |
| 108 | 108 | } |
| 109 | 109 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @date 23/01/13 |
| 121 | 121 | */ |
| 122 | 122 | |
| 123 | - function render_field( $field ) { |
|
| 123 | + function render_field($field) { |
|
| 124 | 124 | |
| 125 | 125 | // vars |
| 126 | 126 | $e = ''; |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | // html |
| 142 | - $e .= '<div ' . acf_esc_attr($div) . '>'; |
|
| 143 | - $e .= '<input ' . acf_esc_attr($input). '/>'; |
|
| 142 | + $e .= '<div '.acf_esc_attr($div).'>'; |
|
| 143 | + $e .= '<input '.acf_esc_attr($input).'/>'; |
|
| 144 | 144 | $e .= '<input type="text" value="" class="input" />'; |
| 145 | 145 | $e .= '</div>'; |
| 146 | 146 | |
@@ -163,16 +163,16 @@ discard block |
||
| 163 | 163 | * @param $field - an array holding all the field's data |
| 164 | 164 | */ |
| 165 | 165 | |
| 166 | - function render_field_settings( $field ) { |
|
| 166 | + function render_field_settings($field) { |
|
| 167 | 167 | |
| 168 | 168 | // global |
| 169 | 169 | global $wp_locale; |
| 170 | 170 | |
| 171 | 171 | |
| 172 | 172 | // display_format |
| 173 | - acf_render_field_setting( $field, array( |
|
| 174 | - 'label' => __('Display format','acf'), |
|
| 175 | - 'instructions' => __('The format displayed when editing a post','acf'), |
|
| 173 | + acf_render_field_setting($field, array( |
|
| 174 | + 'label' => __('Display format', 'acf'), |
|
| 175 | + 'instructions' => __('The format displayed when editing a post', 'acf'), |
|
| 176 | 176 | 'type' => 'radio', |
| 177 | 177 | 'name' => 'display_format', |
| 178 | 178 | 'other_choice' => 1, |
@@ -185,9 +185,9 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | |
| 187 | 187 | // return_format |
| 188 | - acf_render_field_setting( $field, array( |
|
| 189 | - 'label' => __('Return format','acf'), |
|
| 190 | - 'instructions' => __('The format returned via template functions','acf'), |
|
| 188 | + acf_render_field_setting($field, array( |
|
| 189 | + 'label' => __('Return format', 'acf'), |
|
| 190 | + 'instructions' => __('The format returned via template functions', 'acf'), |
|
| 191 | 191 | 'type' => 'radio', |
| 192 | 192 | 'name' => 'return_format', |
| 193 | 193 | 'other_choice' => 1, |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | |
| 203 | 203 | // first_day |
| 204 | - acf_render_field_setting( $field, array( |
|
| 205 | - 'label' => __('Week Starts On','acf'), |
|
| 204 | + acf_render_field_setting($field, array( |
|
| 205 | + 'label' => __('Week Starts On', 'acf'), |
|
| 206 | 206 | 'instructions' => '', |
| 207 | 207 | 'type' => 'select', |
| 208 | 208 | 'name' => 'first_day', |
| 209 | - 'choices' => array_values( $wp_locale->weekday ) |
|
| 209 | + 'choices' => array_values($wp_locale->weekday) |
|
| 210 | 210 | )); |
| 211 | 211 | |
| 212 | 212 | } |
@@ -228,10 +228,10 @@ discard block |
||
| 228 | 228 | * @return $value (mixed) the modified value |
| 229 | 229 | */ |
| 230 | 230 | |
| 231 | - function format_value( $value, $post_id, $field ) { |
|
| 231 | + function format_value($value, $post_id, $field) { |
|
| 232 | 232 | |
| 233 | 233 | // bail early if no value |
| 234 | - if( empty($value) ) { |
|
| 234 | + if (empty($value)) { |
|
| 235 | 235 | |
| 236 | 236 | return $value; |
| 237 | 237 | |
@@ -239,11 +239,11 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | |
| 241 | 241 | // get time |
| 242 | - $unixtimestamp = strtotime( $value ); |
|
| 242 | + $unixtimestamp = strtotime($value); |
|
| 243 | 243 | |
| 244 | 244 | |
| 245 | 245 | // bail early if timestamp is not correct |
| 246 | - if( !$unixtimestamp ) { |
|
| 246 | + if ( ! $unixtimestamp) { |
|
| 247 | 247 | |
| 248 | 248 | return $value; |
| 249 | 249 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | // do not delete! |
| 46 | - parent::__construct(); |
|
| 46 | + parent::__construct(); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @subpackage Fields |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if( ! class_exists('acf_field_email') ) : |
|
| 14 | +if ( ! class_exists('acf_field_email')) : |
|
| 15 | 15 | |
| 16 | 16 | class acf_field_email extends acf_field { |
| 17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // vars |
| 35 | 35 | $this->name = 'email'; |
| 36 | - $this->label = __("Email",'acf'); |
|
| 36 | + $this->label = __("Email", 'acf'); |
|
| 37 | 37 | $this->defaults = array( |
| 38 | 38 | 'default_value' => '', |
| 39 | 39 | 'placeholder' => '', |
@@ -59,43 +59,43 @@ discard block |
||
| 59 | 59 | * @date 23/01/13 |
| 60 | 60 | */ |
| 61 | 61 | |
| 62 | - function render_field( $field ) { |
|
| 62 | + function render_field($field) { |
|
| 63 | 63 | |
| 64 | 64 | // vars |
| 65 | - $o = array( 'type', 'id', 'class', 'name', 'value', 'placeholder' ); |
|
| 65 | + $o = array('type', 'id', 'class', 'name', 'value', 'placeholder'); |
|
| 66 | 66 | $e = ''; |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | // prepend |
| 70 | - if( $field['prepend'] !== "" ) { |
|
| 70 | + if ($field['prepend'] !== "") { |
|
| 71 | 71 | |
| 72 | 72 | $field['class'] .= ' acf-is-prepended'; |
| 73 | - $e .= '<div class="acf-input-prepend">' . $field['prepend'] . '</div>'; |
|
| 73 | + $e .= '<div class="acf-input-prepend">'.$field['prepend'].'</div>'; |
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | // append |
| 79 | - if( $field['append'] !== "" ) { |
|
| 79 | + if ($field['append'] !== "") { |
|
| 80 | 80 | |
| 81 | 81 | $field['class'] .= ' acf-is-appended'; |
| 82 | - $e .= '<div class="acf-input-append">' . $field['append'] . '</div>'; |
|
| 82 | + $e .= '<div class="acf-input-append">'.$field['append'].'</div>'; |
|
| 83 | 83 | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | // populate atts |
| 88 | 88 | $atts = array(); |
| 89 | - foreach( $o as $k ) { |
|
| 89 | + foreach ($o as $k) { |
|
| 90 | 90 | |
| 91 | - $atts[ $k ] = $field[ $k ]; |
|
| 91 | + $atts[$k] = $field[$k]; |
|
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | // render |
| 97 | 97 | $e .= '<div class="acf-input-wrap">'; |
| 98 | - $e .= '<input ' . acf_esc_attr( $atts ) . ' />'; |
|
| 98 | + $e .= '<input '.acf_esc_attr($atts).' />'; |
|
| 99 | 99 | $e .= '</div>'; |
| 100 | 100 | |
| 101 | 101 | |
@@ -117,39 +117,39 @@ discard block |
||
| 117 | 117 | * @param $field - an array holding all the field's data |
| 118 | 118 | */ |
| 119 | 119 | |
| 120 | - function render_field_settings( $field ) { |
|
| 120 | + function render_field_settings($field) { |
|
| 121 | 121 | |
| 122 | 122 | // default_value |
| 123 | - acf_render_field_setting( $field, array( |
|
| 124 | - 'label' => __('Default Value','acf'), |
|
| 125 | - 'instructions' => __('Appears when creating a new post','acf'), |
|
| 123 | + acf_render_field_setting($field, array( |
|
| 124 | + 'label' => __('Default Value', 'acf'), |
|
| 125 | + 'instructions' => __('Appears when creating a new post', 'acf'), |
|
| 126 | 126 | 'type' => 'text', |
| 127 | 127 | 'name' => 'default_value', |
| 128 | 128 | )); |
| 129 | 129 | |
| 130 | 130 | |
| 131 | 131 | // placeholder |
| 132 | - acf_render_field_setting( $field, array( |
|
| 133 | - 'label' => __('Placeholder Text','acf'), |
|
| 134 | - 'instructions' => __('Appears within the input','acf'), |
|
| 132 | + acf_render_field_setting($field, array( |
|
| 133 | + 'label' => __('Placeholder Text', 'acf'), |
|
| 134 | + 'instructions' => __('Appears within the input', 'acf'), |
|
| 135 | 135 | 'type' => 'text', |
| 136 | 136 | 'name' => 'placeholder', |
| 137 | 137 | )); |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | // prepend |
| 141 | - acf_render_field_setting( $field, array( |
|
| 142 | - 'label' => __('Prepend','acf'), |
|
| 143 | - 'instructions' => __('Appears before the input','acf'), |
|
| 141 | + acf_render_field_setting($field, array( |
|
| 142 | + 'label' => __('Prepend', 'acf'), |
|
| 143 | + 'instructions' => __('Appears before the input', 'acf'), |
|
| 144 | 144 | 'type' => 'text', |
| 145 | 145 | 'name' => 'prepend', |
| 146 | 146 | )); |
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | // append |
| 150 | - acf_render_field_setting( $field, array( |
|
| 151 | - 'label' => __('Append','acf'), |
|
| 152 | - 'instructions' => __('Appears after the input','acf'), |
|
| 150 | + acf_render_field_setting($field, array( |
|
| 151 | + 'label' => __('Append', 'acf'), |
|
| 152 | + 'instructions' => __('Appears after the input', 'acf'), |
|
| 153 | 153 | 'type' => 'text', |
| 154 | 154 | 'name' => 'append', |
| 155 | 155 | )); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | // do not delete! |
| 59 | - parent::__construct(); |
|
| 59 | + parent::__construct(); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -340,8 +340,8 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | function get_media_item_args( $vars ) { |
| 342 | 342 | |
| 343 | - $vars['send'] = true; |
|
| 344 | - return($vars); |
|
| 343 | + $vars['send'] = true; |
|
| 344 | + return($vars); |
|
| 345 | 345 | |
| 346 | 346 | } |
| 347 | 347 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @subpackage Fields |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if( ! class_exists('acf_field_file') ) : |
|
| 14 | +if ( ! class_exists('acf_field_file')) : |
|
| 15 | 15 | |
| 16 | 16 | class acf_field_file extends acf_field { |
| 17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // vars |
| 35 | 35 | $this->name = 'file'; |
| 36 | - $this->label = __("File",'acf'); |
|
| 36 | + $this->label = __("File", 'acf'); |
|
| 37 | 37 | $this->category = 'content'; |
| 38 | 38 | $this->defaults = array( |
| 39 | 39 | 'return_format' => 'array', |
@@ -43,16 +43,16 @@ discard block |
||
| 43 | 43 | 'mime_types' => '' |
| 44 | 44 | ); |
| 45 | 45 | $this->l10n = array( |
| 46 | - 'select' => __("Select File",'acf'), |
|
| 47 | - 'edit' => __("Edit File",'acf'), |
|
| 48 | - 'update' => __("Update File",'acf'), |
|
| 49 | - 'uploadedTo' => __("uploaded to this post",'acf'), |
|
| 46 | + 'select' => __("Select File", 'acf'), |
|
| 47 | + 'edit' => __("Edit File", 'acf'), |
|
| 48 | + 'update' => __("Update File", 'acf'), |
|
| 49 | + 'uploadedTo' => __("uploaded to this post", 'acf'), |
|
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | // filters |
| 54 | - add_filter('get_media_item_args', array($this, 'get_media_item_args')); |
|
| 55 | - add_filter('wp_prepare_attachment_for_js', array($this, 'wp_prepare_attachment_for_js'), 10, 3); |
|
| 54 | + add_filter('get_media_item_args', array($this, 'get_media_item_args')); |
|
| 55 | + add_filter('wp_prepare_attachment_for_js', array($this, 'wp_prepare_attachment_for_js'), 10, 3); |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | // do not delete! |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | * @date 23/01/13 |
| 74 | 74 | */ |
| 75 | 75 | |
| 76 | - function render_field( $field ) { |
|
| 76 | + function render_field($field) { |
|
| 77 | 77 | |
| 78 | 78 | // vars |
| 79 | 79 | $uploader = acf_get_setting('uploader'); |
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | // enqueue |
| 83 | - if( $uploader == 'wp' ) { |
|
| 83 | + if ($uploader == 'wp') { |
|
| 84 | 84 | |
| 85 | 85 | acf_enqueue_uploader(); |
| 86 | 86 | |
@@ -105,21 +105,21 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | // has value |
| 108 | - if( $field['value'] && is_numeric($field['value']) ) { |
|
| 108 | + if ($field['value'] && is_numeric($field['value'])) { |
|
| 109 | 109 | |
| 110 | - $file = get_post( $field['value'] ); |
|
| 110 | + $file = get_post($field['value']); |
|
| 111 | 111 | |
| 112 | - if( $file ) { |
|
| 112 | + if ($file) { |
|
| 113 | 113 | |
| 114 | 114 | $div['class'] .= ' has-value'; |
| 115 | 115 | |
| 116 | - $o['icon'] = wp_mime_type_icon( $file->ID ); |
|
| 117 | - $o['title'] = $file->post_title; |
|
| 118 | - $o['size'] = @size_format(filesize( get_attached_file( $file->ID ) )); |
|
| 119 | - $o['url'] = wp_get_attachment_url( $file->ID ); |
|
| 116 | + $o['icon'] = wp_mime_type_icon($file->ID); |
|
| 117 | + $o['title'] = $file->post_title; |
|
| 118 | + $o['size'] = @size_format(filesize(get_attached_file($file->ID))); |
|
| 119 | + $o['url'] = wp_get_attachment_url($file->ID); |
|
| 120 | 120 | |
| 121 | 121 | $explode = explode('/', $o['url']); |
| 122 | - $o['name'] = end( $explode ); |
|
| 122 | + $o['name'] = end($explode); |
|
| 123 | 123 | |
| 124 | 124 | } |
| 125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | ?> |
| 129 | 129 | <div <?php acf_esc_attr_e($div); ?>> |
| 130 | 130 | <div class="acf-hidden"> |
| 131 | - <?php acf_hidden_input(array( 'name' => $field['name'], 'value' => $field['value'], 'data-name' => 'id' )); ?> |
|
| 131 | + <?php acf_hidden_input(array('name' => $field['name'], 'value' => $field['value'], 'data-name' => 'id')); ?> |
|
| 132 | 132 | </div> |
| 133 | 133 | <div class="show-if-value file-wrap acf-soh"> |
| 134 | 134 | <div class="file-icon"> |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | </p> |
| 149 | 149 | |
| 150 | 150 | <ul class="acf-hl acf-soh-target"> |
| 151 | - <?php if( $uploader != 'basic' ): ?> |
|
| 151 | + <?php if ($uploader != 'basic'): ?> |
|
| 152 | 152 | <li><a class="acf-icon -pencil dark" data-name="edit" href="#"></a></li> |
| 153 | 153 | <?php endif; ?> |
| 154 | 154 | <li><a class="acf-icon -cancel dark" data-name="remove" href="#"></a></li> |
@@ -156,9 +156,9 @@ discard block |
||
| 156 | 156 | </div> |
| 157 | 157 | </div> |
| 158 | 158 | <div class="hide-if-value"> |
| 159 | - <?php if( $uploader == 'basic' ): ?> |
|
| 159 | + <?php if ($uploader == 'basic'): ?> |
|
| 160 | 160 | |
| 161 | - <?php if( $field['value'] && !is_numeric($field['value']) ): ?> |
|
| 161 | + <?php if ($field['value'] && ! is_numeric($field['value'])): ?> |
|
| 162 | 162 | <div class="acf-error-message"><p><?php echo $field['value']; ?></p></div> |
| 163 | 163 | <?php endif; ?> |
| 164 | 164 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | <?php else: ?> |
| 168 | 168 | |
| 169 | - <p style="margin:0;"><?php _e('No File selected','acf'); ?> <a data-name="add" class="acf-button" href="#"><?php _e('Add File','acf'); ?></a></p> |
|
| 169 | + <p style="margin:0;"><?php _e('No File selected', 'acf'); ?> <a data-name="add" class="acf-button" href="#"><?php _e('Add File', 'acf'); ?></a></p> |
|
| 170 | 170 | |
| 171 | 171 | <?php endif; ?> |
| 172 | 172 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @param $field - an array holding all the field's data |
| 191 | 191 | */ |
| 192 | 192 | |
| 193 | - function render_field_settings( $field ) { |
|
| 193 | + function render_field_settings($field) { |
|
| 194 | 194 | |
| 195 | 195 | // clear numeric settings |
| 196 | 196 | $clear = array( |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | 'max_size' |
| 199 | 199 | ); |
| 200 | 200 | |
| 201 | - foreach( $clear as $k ) { |
|
| 201 | + foreach ($clear as $k) { |
|
| 202 | 202 | |
| 203 | - if( empty($field[$k]) ) { |
|
| 203 | + if (empty($field[$k])) { |
|
| 204 | 204 | |
| 205 | 205 | $field[$k] = ''; |
| 206 | 206 | |
@@ -210,24 +210,24 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | |
| 212 | 212 | // return_format |
| 213 | - acf_render_field_setting( $field, array( |
|
| 214 | - 'label' => __('Return Value','acf'), |
|
| 215 | - 'instructions' => __('Specify the returned value on front end','acf'), |
|
| 213 | + acf_render_field_setting($field, array( |
|
| 214 | + 'label' => __('Return Value', 'acf'), |
|
| 215 | + 'instructions' => __('Specify the returned value on front end', 'acf'), |
|
| 216 | 216 | 'type' => 'radio', |
| 217 | 217 | 'name' => 'return_format', |
| 218 | 218 | 'layout' => 'horizontal', |
| 219 | 219 | 'choices' => array( |
| 220 | - 'array' => __("File Array",'acf'), |
|
| 221 | - 'url' => __("File URL",'acf'), |
|
| 222 | - 'id' => __("File ID",'acf') |
|
| 220 | + 'array' => __("File Array", 'acf'), |
|
| 221 | + 'url' => __("File URL", 'acf'), |
|
| 222 | + 'id' => __("File ID", 'acf') |
|
| 223 | 223 | ) |
| 224 | 224 | )); |
| 225 | 225 | |
| 226 | 226 | |
| 227 | 227 | // library |
| 228 | - acf_render_field_setting( $field, array( |
|
| 229 | - 'label' => __('Library','acf'), |
|
| 230 | - 'instructions' => __('Limit the media library choice','acf'), |
|
| 228 | + acf_render_field_setting($field, array( |
|
| 229 | + 'label' => __('Library', 'acf'), |
|
| 230 | + 'instructions' => __('Limit the media library choice', 'acf'), |
|
| 231 | 231 | 'type' => 'radio', |
| 232 | 232 | 'name' => 'library', |
| 233 | 233 | 'layout' => 'horizontal', |
@@ -239,9 +239,9 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | |
| 241 | 241 | // min |
| 242 | - acf_render_field_setting( $field, array( |
|
| 243 | - 'label' => __('Minimum','acf'), |
|
| 244 | - 'instructions' => __('Restrict which files can be uploaded','acf'), |
|
| 242 | + acf_render_field_setting($field, array( |
|
| 243 | + 'label' => __('Minimum', 'acf'), |
|
| 244 | + 'instructions' => __('Restrict which files can be uploaded', 'acf'), |
|
| 245 | 245 | 'type' => 'text', |
| 246 | 246 | 'name' => 'min_size', |
| 247 | 247 | 'prepend' => __('File size', 'acf'), |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | |
| 252 | 252 | // max |
| 253 | - acf_render_field_setting( $field, array( |
|
| 254 | - 'label' => __('Maximum','acf'), |
|
| 255 | - 'instructions' => __('Restrict which files can be uploaded','acf'), |
|
| 253 | + acf_render_field_setting($field, array( |
|
| 254 | + 'label' => __('Maximum', 'acf'), |
|
| 255 | + 'instructions' => __('Restrict which files can be uploaded', 'acf'), |
|
| 256 | 256 | 'type' => 'text', |
| 257 | 257 | 'name' => 'max_size', |
| 258 | 258 | 'prepend' => __('File size', 'acf'), |
@@ -261,9 +261,9 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | |
| 263 | 263 | // allowed type |
| 264 | - acf_render_field_setting( $field, array( |
|
| 265 | - 'label' => __('Allowed file types','acf'), |
|
| 266 | - 'instructions' => __('Comma separated list. Leave blank for all types','acf'), |
|
| 264 | + acf_render_field_setting($field, array( |
|
| 265 | + 'label' => __('Allowed file types', 'acf'), |
|
| 266 | + 'instructions' => __('Comma separated list. Leave blank for all types', 'acf'), |
|
| 267 | 267 | 'type' => 'text', |
| 268 | 268 | 'name' => 'mime_types', |
| 269 | 269 | )); |
@@ -287,10 +287,10 @@ discard block |
||
| 287 | 287 | * @return $value (mixed) the modified value |
| 288 | 288 | */ |
| 289 | 289 | |
| 290 | - function format_value( $value, $post_id, $field ) { |
|
| 290 | + function format_value($value, $post_id, $field) { |
|
| 291 | 291 | |
| 292 | 292 | // bail early if no value |
| 293 | - if( empty($value) ) { |
|
| 293 | + if (empty($value)) { |
|
| 294 | 294 | |
| 295 | 295 | return false; |
| 296 | 296 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | |
| 300 | 300 | // bail early if not numeric (error message) |
| 301 | - if( !is_numeric($value) ) { |
|
| 301 | + if ( ! is_numeric($value)) { |
|
| 302 | 302 | |
| 303 | 303 | return false; |
| 304 | 304 | |
@@ -310,13 +310,13 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | |
| 312 | 312 | // format |
| 313 | - if( $field['return_format'] == 'url' ) { |
|
| 313 | + if ($field['return_format'] == 'url') { |
|
| 314 | 314 | |
| 315 | 315 | return wp_get_attachment_url($value); |
| 316 | 316 | |
| 317 | - } elseif( $field['return_format'] == 'array' ) { |
|
| 317 | + } elseif ($field['return_format'] == 'array') { |
|
| 318 | 318 | |
| 319 | - return acf_get_attachment( $value ); |
|
| 319 | + return acf_get_attachment($value); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * @return $vars |
| 339 | 339 | */ |
| 340 | 340 | |
| 341 | - function get_media_item_args( $vars ) { |
|
| 341 | + function get_media_item_args($vars) { |
|
| 342 | 342 | |
| 343 | 343 | $vars['send'] = true; |
| 344 | 344 | return($vars); |
@@ -362,10 +362,10 @@ discard block |
||
| 362 | 362 | * @return $value - the modified value |
| 363 | 363 | */ |
| 364 | 364 | |
| 365 | - function update_value( $value, $post_id, $field ) { |
|
| 365 | + function update_value($value, $post_id, $field) { |
|
| 366 | 366 | |
| 367 | 367 | // array? |
| 368 | - if( is_array($value) && isset($value['ID']) ) { |
|
| 368 | + if (is_array($value) && isset($value['ID'])) { |
|
| 369 | 369 | |
| 370 | 370 | return $value['ID']; |
| 371 | 371 | |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | |
| 375 | 375 | // object? |
| 376 | - if( is_object($value) && isset($value->ID) ) { |
|
| 376 | + if (is_object($value) && isset($value->ID)) { |
|
| 377 | 377 | |
| 378 | 378 | return $value->ID; |
| 379 | 379 | |
@@ -397,16 +397,16 @@ discard block |
||
| 397 | 397 | * @return {int} $post_id |
| 398 | 398 | */ |
| 399 | 399 | |
| 400 | - function wp_prepare_attachment_for_js( $response, $attachment, $meta ) { |
|
| 400 | + function wp_prepare_attachment_for_js($response, $attachment, $meta) { |
|
| 401 | 401 | |
| 402 | 402 | // default |
| 403 | 403 | $fs = '0 kb'; |
| 404 | 404 | |
| 405 | 405 | |
| 406 | 406 | // supress PHP warnings caused by corrupt images |
| 407 | - if( $i = @filesize( get_attached_file( $attachment->ID ) ) ) { |
|
| 407 | + if ($i = @filesize(get_attached_file($attachment->ID))) { |
|
| 408 | 408 | |
| 409 | - $fs = size_format( $i ); |
|
| 409 | + $fs = size_format($i); |
|
| 410 | 410 | |
| 411 | 411 | } |
| 412 | 412 | |
@@ -164,9 +164,12 @@ |
||
| 164 | 164 | |
| 165 | 165 | <input type="file" name="<?php echo $field['name']; ?>" id="<?php echo $field['id']; ?>" /> |
| 166 | 166 | |
| 167 | - <?php else: ?> |
|
| 167 | + <?php else { |
|
| 168 | + : ?> |
|
| 168 | 169 | |
| 169 | - <p style="margin:0;"><?php _e('No File selected','acf'); ?> <a data-name="add" class="acf-button" href="#"><?php _e('Add File','acf'); ?></a></p> |
|
| 170 | + <p style="margin:0;"><?php _e('No File selected','acf'); |
|
| 171 | +} |
|
| 172 | +?> <a data-name="add" class="acf-button" href="#"><?php _e('Add File','acf'); ?></a></p> |
|
| 170 | 173 | |
| 171 | 174 | <?php endif; ?> |
| 172 | 175 | |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | // do not delete! |
| 57 | - parent::__construct(); |
|
| 57 | + parent::__construct(); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @subpackage Fields |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if( ! class_exists('acf_field_google_map') ) : |
|
| 14 | +if ( ! class_exists('acf_field_google_map')) : |
|
| 15 | 15 | |
| 16 | 16 | class acf_field_google_map extends acf_field { |
| 17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // vars |
| 35 | 35 | $this->name = 'google_map'; |
| 36 | - $this->label = __("Google Map",'acf'); |
|
| 36 | + $this->label = __("Google Map", 'acf'); |
|
| 37 | 37 | $this->category = 'jquery'; |
| 38 | 38 | $this->defaults = array( |
| 39 | 39 | 'height' => '', |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | 'zoom' => '14' |
| 49 | 49 | ); |
| 50 | 50 | $this->l10n = array( |
| 51 | - 'locating' => __("Locating",'acf'), |
|
| 52 | - 'browser_support' => __("Sorry, this browser does not support geolocation",'acf'), |
|
| 51 | + 'locating' => __("Locating", 'acf'), |
|
| 52 | + 'browser_support' => __("Sorry, this browser does not support geolocation", 'acf'), |
|
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | 55 | |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | * @date 23/01/13 |
| 71 | 71 | */ |
| 72 | 72 | |
| 73 | - function render_field( $field ) { |
|
| 73 | + function render_field($field) { |
|
| 74 | 74 | |
| 75 | 75 | // validate value |
| 76 | - if( empty($field['value']) ) { |
|
| 76 | + if (empty($field['value'])) { |
|
| 77 | 77 | |
| 78 | 78 | $field['value'] = array(); |
| 79 | 79 | |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | // default options |
| 92 | - foreach( $this->default_values as $k => $v ) { |
|
| 92 | + foreach ($this->default_values as $k => $v) { |
|
| 93 | 93 | |
| 94 | - if( empty($field[ $k ]) ) { |
|
| 94 | + if (empty($field[$k])) { |
|
| 95 | 95 | |
| 96 | - $field[ $k ] = $v; |
|
| 96 | + $field[$k] = $v; |
|
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $atts = array( |
| 105 | 105 | 'id' => $field['id'], |
| 106 | 106 | 'class' => "acf-google-map {$field['class']}", |
| 107 | - 'data-id' => $field['id'] . '-' . uniqid(), |
|
| 107 | + 'data-id' => $field['id'].'-'.uniqid(), |
|
| 108 | 108 | 'data-lat' => $field['center_lat'], |
| 109 | 109 | 'data-lng' => $field['center_lng'], |
| 110 | 110 | 'data-zoom' => $field['zoom'], |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | // has value |
| 115 | - if( $field['value']['address'] ) { |
|
| 115 | + if ($field['value']['address']) { |
|
| 116 | 116 | |
| 117 | 117 | $atts['class'] .= ' -value'; |
| 118 | 118 | |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | <div <?php acf_esc_attr_e($atts); ?>> |
| 123 | 123 | |
| 124 | 124 | <div class="acf-hidden"> |
| 125 | - <?php foreach( $field['value'] as $k => $v ): ?> |
|
| 126 | - <input type="hidden" class="input-<?php echo $k; ?>" name="<?php echo esc_attr($field['name']); ?>[<?php echo $k; ?>]" value="<?php echo esc_attr( $v ); ?>" /> |
|
| 125 | + <?php foreach ($field['value'] as $k => $v): ?> |
|
| 126 | + <input type="hidden" class="input-<?php echo $k; ?>" name="<?php echo esc_attr($field['name']); ?>[<?php echo $k; ?>]" value="<?php echo esc_attr($v); ?>" /> |
|
| 127 | 127 | <?php endforeach; ?> |
| 128 | 128 | </div> |
| 129 | 129 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | <a href="#" data-name="locate" class="acf-icon -location grey" title="<?php _e("Find current location", 'acf'); ?>"></a> |
| 136 | 136 | </div> |
| 137 | 137 | |
| 138 | - <input class="search" type="text" placeholder="<?php _e("Search for address...",'acf'); ?>" value="<?php echo $field['value']['address']; ?>" /> |
|
| 138 | + <input class="search" type="text" placeholder="<?php _e("Search for address...", 'acf'); ?>" value="<?php echo $field['value']['address']; ?>" /> |
|
| 139 | 139 | <i class="acf-loading"></i> |
| 140 | 140 | |
| 141 | 141 | </div> |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | * @param $field - an array holding all the field's data |
| 162 | 162 | */ |
| 163 | 163 | |
| 164 | - function render_field_settings( $field ) { |
|
| 164 | + function render_field_settings($field) { |
|
| 165 | 165 | |
| 166 | 166 | // center_lat |
| 167 | - acf_render_field_setting( $field, array( |
|
| 168 | - 'label' => __('Center','acf'), |
|
| 169 | - 'instructions' => __('Center the initial map','acf'), |
|
| 167 | + acf_render_field_setting($field, array( |
|
| 168 | + 'label' => __('Center', 'acf'), |
|
| 169 | + 'instructions' => __('Center the initial map', 'acf'), |
|
| 170 | 170 | 'type' => 'text', |
| 171 | 171 | 'name' => 'center_lat', |
| 172 | 172 | 'prepend' => 'lat', |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | |
| 177 | 177 | // center_lng |
| 178 | - acf_render_field_setting( $field, array( |
|
| 179 | - 'label' => __('Center','acf'), |
|
| 180 | - 'instructions' => __('Center the initial map','acf'), |
|
| 178 | + acf_render_field_setting($field, array( |
|
| 179 | + 'label' => __('Center', 'acf'), |
|
| 180 | + 'instructions' => __('Center the initial map', 'acf'), |
|
| 181 | 181 | 'type' => 'text', |
| 182 | 182 | 'name' => 'center_lng', |
| 183 | 183 | 'prepend' => 'lng', |
@@ -189,9 +189,9 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | |
| 191 | 191 | // zoom |
| 192 | - acf_render_field_setting( $field, array( |
|
| 193 | - 'label' => __('Zoom','acf'), |
|
| 194 | - 'instructions' => __('Set the initial zoom level','acf'), |
|
| 192 | + acf_render_field_setting($field, array( |
|
| 193 | + 'label' => __('Zoom', 'acf'), |
|
| 194 | + 'instructions' => __('Set the initial zoom level', 'acf'), |
|
| 195 | 195 | 'type' => 'text', |
| 196 | 196 | 'name' => 'zoom', |
| 197 | 197 | 'placeholder' => $this->default_values['zoom'] |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | |
| 201 | 201 | // allow_null |
| 202 | - acf_render_field_setting( $field, array( |
|
| 203 | - 'label' => __('Height','acf'), |
|
| 204 | - 'instructions' => __('Customise the map height','acf'), |
|
| 202 | + acf_render_field_setting($field, array( |
|
| 203 | + 'label' => __('Height', 'acf'), |
|
| 204 | + 'instructions' => __('Customise the map height', 'acf'), |
|
| 205 | 205 | 'type' => 'text', |
| 206 | 206 | 'name' => 'height', |
| 207 | 207 | 'append' => 'px', |
@@ -224,17 +224,17 @@ discard block |
||
| 224 | 224 | * @return $post_id (int) |
| 225 | 225 | */ |
| 226 | 226 | |
| 227 | - function validate_value( $valid, $value, $field, $input ){ |
|
| 227 | + function validate_value($valid, $value, $field, $input) { |
|
| 228 | 228 | |
| 229 | 229 | // bail early if not required |
| 230 | - if( ! $field['required'] ) { |
|
| 230 | + if ( ! $field['required']) { |
|
| 231 | 231 | |
| 232 | 232 | return $valid; |
| 233 | 233 | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | |
| 237 | - if( empty($value) || empty($value['lat']) || empty($value['lng']) ) { |
|
| 237 | + if (empty($value) || empty($value['lat']) || empty($value['lng'])) { |
|
| 238 | 238 | |
| 239 | 239 | return false; |
| 240 | 240 | |
@@ -263,9 +263,9 @@ discard block |
||
| 263 | 263 | * @return $value - the modified value |
| 264 | 264 | */ |
| 265 | 265 | |
| 266 | - function update_value( $value, $post_id, $field ) { |
|
| 266 | + function update_value($value, $post_id, $field) { |
|
| 267 | 267 | |
| 268 | - if( empty($value) || empty($value['lat']) || empty($value['lng']) ) { |
|
| 268 | + if (empty($value) || empty($value['lat']) || empty($value['lng'])) { |
|
| 269 | 269 | |
| 270 | 270 | return false; |
| 271 | 271 | |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | // do not delete! |
| 65 | - parent::__construct(); |
|
| 65 | + parent::__construct(); |
|
| 66 | 66 | |
| 67 | - } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | /* |
@@ -377,8 +377,8 @@ discard block |
||
| 377 | 377 | |
| 378 | 378 | function get_media_item_args( $vars ) { |
| 379 | 379 | |
| 380 | - $vars['send'] = true; |
|
| 381 | - return($vars); |
|
| 380 | + $vars['send'] = true; |
|
| 381 | + return($vars); |
|
| 382 | 382 | |
| 383 | 383 | } |
| 384 | 384 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @subpackage Fields |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if( ! class_exists('acf_field_image') ) : |
|
| 14 | +if ( ! class_exists('acf_field_image')) : |
|
| 15 | 15 | |
| 16 | 16 | class acf_field_image extends acf_field { |
| 17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // vars |
| 35 | 35 | $this->name = 'image'; |
| 36 | - $this->label = __("Image",'acf'); |
|
| 36 | + $this->label = __("Image", 'acf'); |
|
| 37 | 37 | $this->category = 'content'; |
| 38 | 38 | $this->defaults = array( |
| 39 | 39 | 'return_format' => 'array', |
@@ -48,17 +48,17 @@ discard block |
||
| 48 | 48 | 'mime_types' => '' |
| 49 | 49 | ); |
| 50 | 50 | $this->l10n = array( |
| 51 | - 'select' => __("Select Image",'acf'), |
|
| 52 | - 'edit' => __("Edit Image",'acf'), |
|
| 53 | - 'update' => __("Update Image",'acf'), |
|
| 54 | - 'uploadedTo' => __("Uploaded to this post",'acf'), |
|
| 55 | - 'all' => __("All images",'acf'), |
|
| 51 | + 'select' => __("Select Image", 'acf'), |
|
| 52 | + 'edit' => __("Edit Image", 'acf'), |
|
| 53 | + 'update' => __("Update Image", 'acf'), |
|
| 54 | + 'uploadedTo' => __("Uploaded to this post", 'acf'), |
|
| 55 | + 'all' => __("All images", 'acf'), |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | // filters |
| 60 | - add_filter('get_media_item_args', array($this, 'get_media_item_args')); |
|
| 61 | - add_filter('wp_prepare_attachment_for_js', array($this, 'wp_prepare_attachment_for_js'), 10, 3); |
|
| 60 | + add_filter('get_media_item_args', array($this, 'get_media_item_args')); |
|
| 61 | + add_filter('wp_prepare_attachment_for_js', array($this, 'wp_prepare_attachment_for_js'), 10, 3); |
|
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | // do not delete! |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | * @date 23/01/13 |
| 80 | 80 | */ |
| 81 | 81 | |
| 82 | - function render_field( $field ) { |
|
| 82 | + function render_field($field) { |
|
| 83 | 83 | |
| 84 | 84 | // vars |
| 85 | 85 | $uploader = acf_get_setting('uploader'); |
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | // enqueue |
| 89 | - if( $uploader == 'wp' ) { |
|
| 89 | + if ($uploader == 'wp') { |
|
| 90 | 90 | |
| 91 | 91 | acf_enqueue_uploader(); |
| 92 | 92 | |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | // has value? |
| 108 | - if( $field['value'] && is_numeric($field['value']) ) { |
|
| 108 | + if ($field['value'] && is_numeric($field['value'])) { |
|
| 109 | 109 | |
| 110 | 110 | $url = wp_get_attachment_image_src($field['value'], $field['preview_size']); |
| 111 | 111 | |
| 112 | - if( $url ) { |
|
| 112 | + if ($url) { |
|
| 113 | 113 | |
| 114 | 114 | $url = $url[0]; |
| 115 | 115 | |
@@ -120,23 +120,23 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | ?> |
| 123 | -<div <?php acf_esc_attr_e( $div ); ?>> |
|
| 123 | +<div <?php acf_esc_attr_e($div); ?>> |
|
| 124 | 124 | <div class="acf-hidden"> |
| 125 | - <?php acf_hidden_input(array( 'name' => $field['name'], 'value' => $field['value'], 'data-name' => 'id' )); ?> |
|
| 125 | + <?php acf_hidden_input(array('name' => $field['name'], 'value' => $field['value'], 'data-name' => 'id')); ?> |
|
| 126 | 126 | </div> |
| 127 | 127 | <div class="view show-if-value acf-soh"> |
| 128 | 128 | <img data-name="image" src="<?php echo $url; ?>" alt=""/> |
| 129 | 129 | <ul class="acf-hl acf-soh-target"> |
| 130 | - <?php if( $uploader != 'basic' ): ?> |
|
| 130 | + <?php if ($uploader != 'basic'): ?> |
|
| 131 | 131 | <li><a class="acf-icon -pencil dark" data-name="edit" href="#"></a></li> |
| 132 | 132 | <?php endif; ?> |
| 133 | 133 | <li><a class="acf-icon -cancel dark" data-name="remove" href="#"></a></li> |
| 134 | 134 | </ul> |
| 135 | 135 | </div> |
| 136 | 136 | <div class="view hide-if-value"> |
| 137 | - <?php if( $uploader == 'basic' ): ?> |
|
| 137 | + <?php if ($uploader == 'basic'): ?> |
|
| 138 | 138 | |
| 139 | - <?php if( $field['value'] && !is_numeric($field['value']) ): ?> |
|
| 139 | + <?php if ($field['value'] && ! is_numeric($field['value'])): ?> |
|
| 140 | 140 | <div class="acf-error-message"><p><?php echo $field['value']; ?></p></div> |
| 141 | 141 | <?php endif; ?> |
| 142 | 142 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | <?php else: ?> |
| 146 | 146 | |
| 147 | - <p style="margin:0;"><?php _e('No image selected','acf'); ?> <a data-name="add" class="acf-button" href="#"><?php _e('Add Image','acf'); ?></a></p> |
|
| 147 | + <p style="margin:0;"><?php _e('No image selected', 'acf'); ?> <a data-name="add" class="acf-button" href="#"><?php _e('Add Image', 'acf'); ?></a></p> |
|
| 148 | 148 | |
| 149 | 149 | <?php endif; ?> |
| 150 | 150 | </div> |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @param $field - an array holding all the field's data |
| 168 | 168 | */ |
| 169 | 169 | |
| 170 | - function render_field_settings( $field ) { |
|
| 170 | + function render_field_settings($field) { |
|
| 171 | 171 | |
| 172 | 172 | // clear numeric settings |
| 173 | 173 | $clear = array( |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | 'max_size' |
| 180 | 180 | ); |
| 181 | 181 | |
| 182 | - foreach( $clear as $k ) { |
|
| 182 | + foreach ($clear as $k) { |
|
| 183 | 183 | |
| 184 | - if( empty($field[$k]) ) { |
|
| 184 | + if (empty($field[$k])) { |
|
| 185 | 185 | |
| 186 | 186 | $field[$k] = ''; |
| 187 | 187 | |
@@ -191,24 +191,24 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | // return_format |
| 194 | - acf_render_field_setting( $field, array( |
|
| 195 | - 'label' => __('Return Value','acf'), |
|
| 196 | - 'instructions' => __('Specify the returned value on front end','acf'), |
|
| 194 | + acf_render_field_setting($field, array( |
|
| 195 | + 'label' => __('Return Value', 'acf'), |
|
| 196 | + 'instructions' => __('Specify the returned value on front end', 'acf'), |
|
| 197 | 197 | 'type' => 'radio', |
| 198 | 198 | 'name' => 'return_format', |
| 199 | 199 | 'layout' => 'horizontal', |
| 200 | 200 | 'choices' => array( |
| 201 | - 'array' => __("Image Array",'acf'), |
|
| 202 | - 'url' => __("Image URL",'acf'), |
|
| 203 | - 'id' => __("Image ID",'acf') |
|
| 201 | + 'array' => __("Image Array", 'acf'), |
|
| 202 | + 'url' => __("Image URL", 'acf'), |
|
| 203 | + 'id' => __("Image ID", 'acf') |
|
| 204 | 204 | ) |
| 205 | 205 | )); |
| 206 | 206 | |
| 207 | 207 | |
| 208 | 208 | // preview_size |
| 209 | - acf_render_field_setting( $field, array( |
|
| 210 | - 'label' => __('Preview Size','acf'), |
|
| 211 | - 'instructions' => __('Shown when entering data','acf'), |
|
| 209 | + acf_render_field_setting($field, array( |
|
| 210 | + 'label' => __('Preview Size', 'acf'), |
|
| 211 | + 'instructions' => __('Shown when entering data', 'acf'), |
|
| 212 | 212 | 'type' => 'select', |
| 213 | 213 | 'name' => 'preview_size', |
| 214 | 214 | 'choices' => acf_get_image_sizes() |
@@ -216,9 +216,9 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | |
| 218 | 218 | // library |
| 219 | - acf_render_field_setting( $field, array( |
|
| 220 | - 'label' => __('Library','acf'), |
|
| 221 | - 'instructions' => __('Limit the media library choice','acf'), |
|
| 219 | + acf_render_field_setting($field, array( |
|
| 220 | + 'label' => __('Library', 'acf'), |
|
| 221 | + 'instructions' => __('Limit the media library choice', 'acf'), |
|
| 222 | 222 | 'type' => 'radio', |
| 223 | 223 | 'name' => 'library', |
| 224 | 224 | 'layout' => 'horizontal', |
@@ -230,16 +230,16 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | // min |
| 233 | - acf_render_field_setting( $field, array( |
|
| 234 | - 'label' => __('Minimum','acf'), |
|
| 235 | - 'instructions' => __('Restrict which images can be uploaded','acf'), |
|
| 233 | + acf_render_field_setting($field, array( |
|
| 234 | + 'label' => __('Minimum', 'acf'), |
|
| 235 | + 'instructions' => __('Restrict which images can be uploaded', 'acf'), |
|
| 236 | 236 | 'type' => 'text', |
| 237 | 237 | 'name' => 'min_width', |
| 238 | 238 | 'prepend' => __('Width', 'acf'), |
| 239 | 239 | 'append' => 'px', |
| 240 | 240 | )); |
| 241 | 241 | |
| 242 | - acf_render_field_setting( $field, array( |
|
| 242 | + acf_render_field_setting($field, array( |
|
| 243 | 243 | 'label' => '', |
| 244 | 244 | 'type' => 'text', |
| 245 | 245 | 'name' => 'min_height', |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | ) |
| 251 | 251 | )); |
| 252 | 252 | |
| 253 | - acf_render_field_setting( $field, array( |
|
| 253 | + acf_render_field_setting($field, array( |
|
| 254 | 254 | 'label' => '', |
| 255 | 255 | 'type' => 'text', |
| 256 | 256 | 'name' => 'min_size', |
@@ -263,16 +263,16 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | |
| 265 | 265 | // max |
| 266 | - acf_render_field_setting( $field, array( |
|
| 267 | - 'label' => __('Maximum','acf'), |
|
| 268 | - 'instructions' => __('Restrict which images can be uploaded','acf'), |
|
| 266 | + acf_render_field_setting($field, array( |
|
| 267 | + 'label' => __('Maximum', 'acf'), |
|
| 268 | + 'instructions' => __('Restrict which images can be uploaded', 'acf'), |
|
| 269 | 269 | 'type' => 'text', |
| 270 | 270 | 'name' => 'max_width', |
| 271 | 271 | 'prepend' => __('Width', 'acf'), |
| 272 | 272 | 'append' => 'px', |
| 273 | 273 | )); |
| 274 | 274 | |
| 275 | - acf_render_field_setting( $field, array( |
|
| 275 | + acf_render_field_setting($field, array( |
|
| 276 | 276 | 'label' => '', |
| 277 | 277 | 'type' => 'text', |
| 278 | 278 | 'name' => 'max_height', |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | ) |
| 284 | 284 | )); |
| 285 | 285 | |
| 286 | - acf_render_field_setting( $field, array( |
|
| 286 | + acf_render_field_setting($field, array( |
|
| 287 | 287 | 'label' => '', |
| 288 | 288 | 'type' => 'text', |
| 289 | 289 | 'name' => 'max_size', |
@@ -296,9 +296,9 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | |
| 298 | 298 | // allowed type |
| 299 | - acf_render_field_setting( $field, array( |
|
| 300 | - 'label' => __('Allowed file types','acf'), |
|
| 301 | - 'instructions' => __('Comma separated list. Leave blank for all types','acf'), |
|
| 299 | + acf_render_field_setting($field, array( |
|
| 300 | + 'label' => __('Allowed file types', 'acf'), |
|
| 301 | + 'instructions' => __('Comma separated list. Leave blank for all types', 'acf'), |
|
| 302 | 302 | 'type' => 'text', |
| 303 | 303 | 'name' => 'mime_types', |
| 304 | 304 | )); |
@@ -322,10 +322,10 @@ discard block |
||
| 322 | 322 | * @return $value (mixed) the modified value |
| 323 | 323 | */ |
| 324 | 324 | |
| 325 | - function format_value( $value, $post_id, $field ) { |
|
| 325 | + function format_value($value, $post_id, $field) { |
|
| 326 | 326 | |
| 327 | 327 | // bail early if no value |
| 328 | - if( empty($value) ) { |
|
| 328 | + if (empty($value)) { |
|
| 329 | 329 | |
| 330 | 330 | return false; |
| 331 | 331 | |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | |
| 335 | 335 | // bail early if not numeric (error message) |
| 336 | - if( !is_numeric($value) ) { |
|
| 336 | + if ( ! is_numeric($value)) { |
|
| 337 | 337 | |
| 338 | 338 | return false; |
| 339 | 339 | |
@@ -345,13 +345,13 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | |
| 347 | 347 | // format |
| 348 | - if( $field['return_format'] == 'url' ) { |
|
| 348 | + if ($field['return_format'] == 'url') { |
|
| 349 | 349 | |
| 350 | - return wp_get_attachment_url( $value ); |
|
| 350 | + return wp_get_attachment_url($value); |
|
| 351 | 351 | |
| 352 | - } elseif( $field['return_format'] == 'array' ) { |
|
| 352 | + } elseif ($field['return_format'] == 'array') { |
|
| 353 | 353 | |
| 354 | - return acf_get_attachment( $value ); |
|
| 354 | + return acf_get_attachment($value); |
|
| 355 | 355 | |
| 356 | 356 | } |
| 357 | 357 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | * @return $vars |
| 376 | 376 | */ |
| 377 | 377 | |
| 378 | - function get_media_item_args( $vars ) { |
|
| 378 | + function get_media_item_args($vars) { |
|
| 379 | 379 | |
| 380 | 380 | $vars['send'] = true; |
| 381 | 381 | return($vars); |
@@ -431,10 +431,10 @@ discard block |
||
| 431 | 431 | * @return {int} $post_id |
| 432 | 432 | */ |
| 433 | 433 | |
| 434 | - function wp_prepare_attachment_for_js( $response, $attachment, $meta ) { |
|
| 434 | + function wp_prepare_attachment_for_js($response, $attachment, $meta) { |
|
| 435 | 435 | |
| 436 | 436 | // only for image |
| 437 | - if( $response['type'] != 'image' ) { |
|
| 437 | + if ($response['type'] != 'image') { |
|
| 438 | 438 | |
| 439 | 439 | return $response; |
| 440 | 440 | |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | |
| 443 | 443 | |
| 444 | 444 | // make sure sizes exist. Perhaps they dont? |
| 445 | - if( !isset($meta['sizes']) ) { |
|
| 445 | + if ( ! isset($meta['sizes'])) { |
|
| 446 | 446 | |
| 447 | 447 | return $response; |
| 448 | 448 | |
@@ -450,18 +450,18 @@ discard block |
||
| 450 | 450 | |
| 451 | 451 | |
| 452 | 452 | $attachment_url = $response['url']; |
| 453 | - $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url ); |
|
| 453 | + $base_url = str_replace(wp_basename($attachment_url), '', $attachment_url); |
|
| 454 | 454 | |
| 455 | - if( isset($meta['sizes']) && is_array($meta['sizes']) ) { |
|
| 455 | + if (isset($meta['sizes']) && is_array($meta['sizes'])) { |
|
| 456 | 456 | |
| 457 | - foreach( $meta['sizes'] as $k => $v ) { |
|
| 457 | + foreach ($meta['sizes'] as $k => $v) { |
|
| 458 | 458 | |
| 459 | - if( !isset($response['sizes'][ $k ]) ) { |
|
| 459 | + if ( ! isset($response['sizes'][$k])) { |
|
| 460 | 460 | |
| 461 | - $response['sizes'][ $k ] = array( |
|
| 461 | + $response['sizes'][$k] = array( |
|
| 462 | 462 | 'height' => $v['height'], |
| 463 | 463 | 'width' => $v['width'], |
| 464 | - 'url' => $base_url . $v['file'], |
|
| 464 | + 'url' => $base_url.$v['file'], |
|
| 465 | 465 | 'orientation' => $v['height'] > $v['width'] ? 'portrait' : 'landscape', |
| 466 | 466 | ); |
| 467 | 467 | } |
@@ -490,10 +490,10 @@ discard block |
||
| 490 | 490 | * @return $value - the modified value |
| 491 | 491 | */ |
| 492 | 492 | |
| 493 | - function update_value( $value, $post_id, $field ) { |
|
| 493 | + function update_value($value, $post_id, $field) { |
|
| 494 | 494 | |
| 495 | 495 | // array? |
| 496 | - if( is_array($value) && isset($value['ID']) ) { |
|
| 496 | + if (is_array($value) && isset($value['ID'])) { |
|
| 497 | 497 | |
| 498 | 498 | return $value['ID']; |
| 499 | 499 | |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | |
| 502 | 502 | |
| 503 | 503 | // object? |
| 504 | - if( is_object($value) && isset($value->ID) ) { |
|
| 504 | + if (is_object($value) && isset($value->ID)) { |
|
| 505 | 505 | |
| 506 | 506 | return $value->ID; |
| 507 | 507 | |
@@ -142,9 +142,12 @@ |
||
| 142 | 142 | |
| 143 | 143 | <input type="file" name="<?php echo $field['name']; ?>" id="<?php echo $field['id']; ?>" /> |
| 144 | 144 | |
| 145 | - <?php else: ?> |
|
| 145 | + <?php else { |
|
| 146 | + : ?> |
|
| 146 | 147 | |
| 147 | - <p style="margin:0;"><?php _e('No image selected','acf'); ?> <a data-name="add" class="acf-button" href="#"><?php _e('Add Image','acf'); ?></a></p> |
|
| 148 | + <p style="margin:0;"><?php _e('No image selected','acf'); |
|
| 149 | +} |
|
| 150 | +?> <a data-name="add" class="acf-button" href="#"><?php _e('Add Image','acf'); ?></a></p> |
|
| 148 | 151 | |
| 149 | 152 | <?php endif; ?> |
| 150 | 153 | </div> |