@@ -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 | |
@@ -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 | )); |
@@ -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 | |
@@ -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 | |
@@ -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 | |
@@ -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 | |
@@ -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> |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @subpackage Fields |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if( ! class_exists('acf_field_message') ) : |
|
| 14 | +if ( ! class_exists('acf_field_message')) : |
|
| 15 | 15 | |
| 16 | 16 | class acf_field_message extends acf_field { |
| 17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // vars |
| 35 | 35 | $this->name = 'message'; |
| 36 | - $this->label = __("Message",'acf'); |
|
| 36 | + $this->label = __("Message", 'acf'); |
|
| 37 | 37 | $this->category = 'layout'; |
| 38 | 38 | $this->defaults = array( |
| 39 | 39 | 'value' => false, // prevents acf_render_fields() from attempting to load value |
@@ -60,30 +60,30 @@ discard block |
||
| 60 | 60 | * @date 23/01/13 |
| 61 | 61 | */ |
| 62 | 62 | |
| 63 | - function render_field( $field ) { |
|
| 63 | + function render_field($field) { |
|
| 64 | 64 | |
| 65 | 65 | // vars |
| 66 | 66 | $m = $field['message']; |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | // wptexturize (improves "quotes") |
| 70 | - $m = wptexturize( $m ); |
|
| 70 | + $m = wptexturize($m); |
|
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | // esc_html |
| 74 | - if( $field['esc_html'] ) { |
|
| 74 | + if ($field['esc_html']) { |
|
| 75 | 75 | |
| 76 | - $m = esc_html( $m ); |
|
| 76 | + $m = esc_html($m); |
|
| 77 | 77 | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | // new lines |
| 82 | - if( $field['new_lines'] == 'wpautop' ) { |
|
| 82 | + if ($field['new_lines'] == 'wpautop') { |
|
| 83 | 83 | |
| 84 | 84 | $m = wpautop($m); |
| 85 | 85 | |
| 86 | - } elseif( $field['new_lines'] == 'br' ) { |
|
| 86 | + } elseif ($field['new_lines'] == 'br') { |
|
| 87 | 87 | |
| 88 | 88 | $m = nl2br($m); |
| 89 | 89 | |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | * @date 23/01/13 |
| 110 | 110 | */ |
| 111 | 111 | |
| 112 | - function render_field_settings( $field ) { |
|
| 112 | + function render_field_settings($field) { |
|
| 113 | 113 | |
| 114 | 114 | // default_value |
| 115 | - acf_render_field_setting( $field, array( |
|
| 116 | - 'label' => __('Message','acf'), |
|
| 115 | + acf_render_field_setting($field, array( |
|
| 116 | + 'label' => __('Message', 'acf'), |
|
| 117 | 117 | 'instructions' => '', |
| 118 | 118 | 'type' => 'textarea', |
| 119 | 119 | 'name' => 'message', |
@@ -121,28 +121,28 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | // formatting |
| 124 | - acf_render_field_setting( $field, array( |
|
| 125 | - 'label' => __('New Lines','acf'), |
|
| 126 | - 'instructions' => __('Controls how new lines are rendered','acf'), |
|
| 124 | + acf_render_field_setting($field, array( |
|
| 125 | + 'label' => __('New Lines', 'acf'), |
|
| 126 | + 'instructions' => __('Controls how new lines are rendered', 'acf'), |
|
| 127 | 127 | 'type' => 'select', |
| 128 | 128 | 'name' => 'new_lines', |
| 129 | 129 | 'choices' => array( |
| 130 | - 'wpautop' => __("Automatically add paragraphs",'acf'), |
|
| 131 | - 'br' => __("Automatically add <br>",'acf'), |
|
| 132 | - '' => __("No Formatting",'acf') |
|
| 130 | + 'wpautop' => __("Automatically add paragraphs", 'acf'), |
|
| 131 | + 'br' => __("Automatically add <br>", 'acf'), |
|
| 132 | + '' => __("No Formatting", 'acf') |
|
| 133 | 133 | ) |
| 134 | 134 | )); |
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | // HTML |
| 138 | - acf_render_field_setting( $field, array( |
|
| 139 | - 'label' => __('Escape HTML','acf'), |
|
| 140 | - 'instructions' => __('Allow HTML markup to display as visible text instead of rendering','acf'), |
|
| 138 | + acf_render_field_setting($field, array( |
|
| 139 | + 'label' => __('Escape HTML', 'acf'), |
|
| 140 | + 'instructions' => __('Allow HTML markup to display as visible text instead of rendering', 'acf'), |
|
| 141 | 141 | 'type' => 'radio', |
| 142 | 142 | 'name' => 'esc_html', |
| 143 | 143 | 'choices' => array( |
| 144 | - 1 => __("Yes",'acf'), |
|
| 145 | - 0 => __("No",'acf'), |
|
| 144 | + 1 => __("Yes", 'acf'), |
|
| 145 | + 0 => __("No", 'acf'), |
|
| 146 | 146 | ), |
| 147 | 147 | 'layout' => 'horizontal', |
| 148 | 148 | )); |
@@ -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_number') ) : |
|
| 14 | +if ( ! class_exists('acf_field_number')) : |
|
| 15 | 15 | |
| 16 | 16 | class acf_field_number extends acf_field { |
| 17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // vars |
| 35 | 35 | $this->name = 'number'; |
| 36 | - $this->label = __("Number",'acf'); |
|
| 36 | + $this->label = __("Number", 'acf'); |
|
| 37 | 37 | $this->defaults = array( |
| 38 | 38 | 'default_value' => '', |
| 39 | 39 | 'min' => '', |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | * @date 23/01/13 |
| 65 | 65 | */ |
| 66 | 66 | |
| 67 | - function render_field( $field ) { |
|
| 67 | + function render_field($field) { |
|
| 68 | 68 | |
| 69 | 69 | // vars |
| 70 | - $o = array( 'type', 'id', 'class', 'min', 'max', 'step', 'name', 'value', 'placeholder' ); |
|
| 70 | + $o = array('type', 'id', 'class', 'min', 'max', 'step', 'name', 'value', 'placeholder'); |
|
| 71 | 71 | $e = ''; |
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | // step |
| 75 | - if( !$field['step'] ) { |
|
| 75 | + if ( ! $field['step']) { |
|
| 76 | 76 | |
| 77 | 77 | $field['step'] = 'any'; |
| 78 | 78 | |
@@ -80,38 +80,38 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | // prepend |
| 83 | - if( $field['prepend'] !== "" ) { |
|
| 83 | + if ($field['prepend'] !== "") { |
|
| 84 | 84 | |
| 85 | 85 | $field['class'] .= ' acf-is-prepended'; |
| 86 | - $e .= '<div class="acf-input-prepend">' . $field['prepend'] . '</div>'; |
|
| 86 | + $e .= '<div class="acf-input-prepend">'.$field['prepend'].'</div>'; |
|
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | // append |
| 92 | - if( $field['append'] !== "" ) { |
|
| 92 | + if ($field['append'] !== "") { |
|
| 93 | 93 | |
| 94 | 94 | $field['class'] .= ' acf-is-appended'; |
| 95 | - $e .= '<div class="acf-input-append">' . $field['append'] . '</div>'; |
|
| 95 | + $e .= '<div class="acf-input-append">'.$field['append'].'</div>'; |
|
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | // populate atts |
| 101 | 101 | $atts = array(); |
| 102 | - foreach( $o as $k ) { |
|
| 102 | + foreach ($o as $k) { |
|
| 103 | 103 | |
| 104 | - $atts[ $k ] = $field[ $k ]; |
|
| 104 | + $atts[$k] = $field[$k]; |
|
| 105 | 105 | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | // special atts |
| 110 | - foreach( array( 'readonly', 'disabled' ) as $k ) { |
|
| 110 | + foreach (array('readonly', 'disabled') as $k) { |
|
| 111 | 111 | |
| 112 | - if( $field[ $k ] ) { |
|
| 112 | + if ($field[$k]) { |
|
| 113 | 113 | |
| 114 | - $atts[ $k ] = $k; |
|
| 114 | + $atts[$k] = $k; |
|
| 115 | 115 | |
| 116 | 116 | } |
| 117 | 117 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | // render |
| 122 | 122 | $e .= '<div class="acf-input-wrap">'; |
| 123 | - $e .= '<input ' . acf_esc_attr( $atts ) . ' />'; |
|
| 123 | + $e .= '<input '.acf_esc_attr($atts).' />'; |
|
| 124 | 124 | $e .= '</div>'; |
| 125 | 125 | |
| 126 | 126 | |
@@ -143,47 +143,47 @@ discard block |
||
| 143 | 143 | * @param $field - an array holding all the field's data |
| 144 | 144 | */ |
| 145 | 145 | |
| 146 | - function render_field_settings( $field ) { |
|
| 146 | + function render_field_settings($field) { |
|
| 147 | 147 | |
| 148 | 148 | // default_value |
| 149 | - acf_render_field_setting( $field, array( |
|
| 150 | - 'label' => __('Default Value','acf'), |
|
| 151 | - 'instructions' => __('Appears when creating a new post','acf'), |
|
| 149 | + acf_render_field_setting($field, array( |
|
| 150 | + 'label' => __('Default Value', 'acf'), |
|
| 151 | + 'instructions' => __('Appears when creating a new post', 'acf'), |
|
| 152 | 152 | 'type' => 'text', |
| 153 | 153 | 'name' => 'default_value', |
| 154 | 154 | )); |
| 155 | 155 | |
| 156 | 156 | |
| 157 | 157 | // placeholder |
| 158 | - acf_render_field_setting( $field, array( |
|
| 159 | - 'label' => __('Placeholder Text','acf'), |
|
| 160 | - 'instructions' => __('Appears within the input','acf'), |
|
| 158 | + acf_render_field_setting($field, array( |
|
| 159 | + 'label' => __('Placeholder Text', 'acf'), |
|
| 160 | + 'instructions' => __('Appears within the input', 'acf'), |
|
| 161 | 161 | 'type' => 'text', |
| 162 | 162 | 'name' => 'placeholder', |
| 163 | 163 | )); |
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | // prepend |
| 167 | - acf_render_field_setting( $field, array( |
|
| 168 | - 'label' => __('Prepend','acf'), |
|
| 169 | - 'instructions' => __('Appears before the input','acf'), |
|
| 167 | + acf_render_field_setting($field, array( |
|
| 168 | + 'label' => __('Prepend', 'acf'), |
|
| 169 | + 'instructions' => __('Appears before the input', 'acf'), |
|
| 170 | 170 | 'type' => 'text', |
| 171 | 171 | 'name' => 'prepend', |
| 172 | 172 | )); |
| 173 | 173 | |
| 174 | 174 | |
| 175 | 175 | // append |
| 176 | - acf_render_field_setting( $field, array( |
|
| 177 | - 'label' => __('Append','acf'), |
|
| 178 | - 'instructions' => __('Appears after the input','acf'), |
|
| 176 | + acf_render_field_setting($field, array( |
|
| 177 | + 'label' => __('Append', 'acf'), |
|
| 178 | + 'instructions' => __('Appears after the input', 'acf'), |
|
| 179 | 179 | 'type' => 'text', |
| 180 | 180 | 'name' => 'append', |
| 181 | 181 | )); |
| 182 | 182 | |
| 183 | 183 | |
| 184 | 184 | // min |
| 185 | - acf_render_field_setting( $field, array( |
|
| 186 | - 'label' => __('Minimum Value','acf'), |
|
| 185 | + acf_render_field_setting($field, array( |
|
| 186 | + 'label' => __('Minimum Value', 'acf'), |
|
| 187 | 187 | 'instructions' => '', |
| 188 | 188 | 'type' => 'number', |
| 189 | 189 | 'name' => 'min', |
@@ -191,8 +191,8 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | // max |
| 194 | - acf_render_field_setting( $field, array( |
|
| 195 | - 'label' => __('Maximum Value','acf'), |
|
| 194 | + acf_render_field_setting($field, array( |
|
| 195 | + 'label' => __('Maximum Value', 'acf'), |
|
| 196 | 196 | 'instructions' => '', |
| 197 | 197 | 'type' => 'number', |
| 198 | 198 | 'name' => 'max', |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | |
| 202 | 202 | // max |
| 203 | - acf_render_field_setting( $field, array( |
|
| 204 | - 'label' => __('Step Size','acf'), |
|
| 203 | + acf_render_field_setting($field, array( |
|
| 204 | + 'label' => __('Step Size', 'acf'), |
|
| 205 | 205 | 'instructions' => '', |
| 206 | 206 | 'type' => 'number', |
| 207 | 207 | 'name' => 'step', |
@@ -223,10 +223,10 @@ discard block |
||
| 223 | 223 | * @return $post_id (int) |
| 224 | 224 | */ |
| 225 | 225 | |
| 226 | - function validate_value( $valid, $value, $field, $input ){ |
|
| 226 | + function validate_value($valid, $value, $field, $input) { |
|
| 227 | 227 | |
| 228 | 228 | // remove ',' |
| 229 | - if( acf_str_exists(',', $value) ) { |
|
| 229 | + if (acf_str_exists(',', $value)) { |
|
| 230 | 230 | |
| 231 | 231 | $value = str_replace(',', '', $value); |
| 232 | 232 | |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | |
| 236 | 236 | // if value is not numeric... |
| 237 | - if( !is_numeric($value) ) { |
|
| 237 | + if ( ! is_numeric($value)) { |
|
| 238 | 238 | |
| 239 | 239 | // allow blank to be saved |
| 240 | - if( !empty($value) ) { |
|
| 240 | + if ( ! empty($value)) { |
|
| 241 | 241 | |
| 242 | 242 | $valid = __('Value must be a number', 'acf'); |
| 243 | 243 | |
@@ -255,17 +255,17 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | |
| 257 | 257 | // min |
| 258 | - if( is_numeric($field['min']) && $value < floatval($field['min'])) { |
|
| 258 | + if (is_numeric($field['min']) && $value < floatval($field['min'])) { |
|
| 259 | 259 | |
| 260 | - $valid = sprintf(__('Value must be equal to or higher than %d', 'acf'), $field['min'] ); |
|
| 260 | + $valid = sprintf(__('Value must be equal to or higher than %d', 'acf'), $field['min']); |
|
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
| 265 | 265 | // max |
| 266 | - if( is_numeric($field['max']) && $value > floatval($field['max']) ) { |
|
| 266 | + if (is_numeric($field['max']) && $value > floatval($field['max'])) { |
|
| 267 | 267 | |
| 268 | - $valid = sprintf(__('Value must be equal to or lower than %d', 'acf'), $field['max'] ); |
|
| 268 | + $valid = sprintf(__('Value must be equal to or lower than %d', 'acf'), $field['max']); |
|
| 269 | 269 | |
| 270 | 270 | } |
| 271 | 271 | |
@@ -292,10 +292,10 @@ discard block |
||
| 292 | 292 | * @return $value - the modified value |
| 293 | 293 | */ |
| 294 | 294 | |
| 295 | - function update_value( $value, $post_id, $field ) { |
|
| 295 | + function update_value($value, $post_id, $field) { |
|
| 296 | 296 | |
| 297 | 297 | // no formatting needed for empty value |
| 298 | - if( empty($value) ) { |
|
| 298 | + if (empty($value)) { |
|
| 299 | 299 | |
| 300 | 300 | return $value; |
| 301 | 301 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | |
| 305 | 305 | // remove ',' |
| 306 | - if( acf_str_exists(',', $value) ) { |
|
| 306 | + if (acf_str_exists(',', $value)) { |
|
| 307 | 307 | |
| 308 | 308 | $value = str_replace(',', '', $value); |
| 309 | 309 | |
@@ -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_oembed') ) : |
|
| 14 | +if ( ! class_exists('acf_field_oembed')) : |
|
| 15 | 15 | |
| 16 | 16 | class acf_field_oembed extends acf_field { |
| 17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // vars |
| 35 | 35 | $this->name = 'oembed'; |
| 36 | - $this->label = __("oEmbed",'acf'); |
|
| 36 | + $this->label = __("oEmbed", 'acf'); |
|
| 37 | 37 | $this->category = 'content'; |
| 38 | 38 | $this->defaults = array( |
| 39 | 39 | 'width' => '', |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | // extra |
| 49 | - add_action('wp_ajax_acf/fields/oembed/search', array($this, 'ajax_search')); |
|
| 50 | - add_action('wp_ajax_nopriv_acf/fields/oembed/search', array($this, 'ajax_search')); |
|
| 49 | + add_action('wp_ajax_acf/fields/oembed/search', array($this, 'ajax_search')); |
|
| 50 | + add_action('wp_ajax_nopriv_acf/fields/oembed/search', array($this, 'ajax_search')); |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | // do not delete! |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @return $post_id (int) |
| 70 | 70 | */ |
| 71 | 71 | |
| 72 | - function wp_oembed_get( $url = '', $width = 0, $height = 0 ) { |
|
| 72 | + function wp_oembed_get($url = '', $width = 0, $height = 0) { |
|
| 73 | 73 | |
| 74 | 74 | // vars |
| 75 | 75 | $embed = ''; |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | // get emebed |
| 83 | - $embed = @wp_oembed_get( $url, $res ); |
|
| 83 | + $embed = @wp_oembed_get($url, $res); |
|
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | // try shortcode |
| 87 | - if( !$embed ) { |
|
| 87 | + if ( ! $embed) { |
|
| 88 | 88 | |
| 89 | 89 | // global |
| 90 | 90 | global $wp_embed; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | function ajax_search() { |
| 118 | 118 | |
| 119 | 119 | // options |
| 120 | - $args = acf_parse_args( $_POST, array( |
|
| 120 | + $args = acf_parse_args($_POST, array( |
|
| 121 | 121 | 's' => '', |
| 122 | 122 | 'nonce' => '', |
| 123 | 123 | 'width' => 0, |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | // width and height |
| 129 | - if( !$args['width'] ) { |
|
| 129 | + if ( ! $args['width']) { |
|
| 130 | 130 | |
| 131 | 131 | $args['width'] = $this->default_values['width']; |
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if( !$args['height'] ) { |
|
| 135 | + if ( ! $args['height']) { |
|
| 136 | 136 | |
| 137 | 137 | $args['height'] = $this->default_values['height']; |
| 138 | 138 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | |
| 142 | 142 | // validate |
| 143 | - if( ! wp_verify_nonce($args['nonce'], 'acf_nonce') ) { |
|
| 143 | + if ( ! wp_verify_nonce($args['nonce'], 'acf_nonce')) { |
|
| 144 | 144 | |
| 145 | 145 | die(); |
| 146 | 146 | |
@@ -169,14 +169,14 @@ discard block |
||
| 169 | 169 | * @date 23/01/13 |
| 170 | 170 | */ |
| 171 | 171 | |
| 172 | - function render_field( $field ) { |
|
| 172 | + function render_field($field) { |
|
| 173 | 173 | |
| 174 | 174 | // default options |
| 175 | - foreach( $this->default_values as $k => $v ) { |
|
| 175 | + foreach ($this->default_values as $k => $v) { |
|
| 176 | 176 | |
| 177 | - if( empty($field[ $k ]) ) { |
|
| 177 | + if (empty($field[$k])) { |
|
| 178 | 178 | |
| 179 | - $field[ $k ] = $v; |
|
| 179 | + $field[$k] = $v; |
|
| 180 | 180 | |
| 181 | 181 | } |
| 182 | 182 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | 'data-height' => $field['height'] |
| 191 | 191 | ); |
| 192 | 192 | |
| 193 | - if( $field['value'] ) { |
|
| 193 | + if ($field['value']) { |
|
| 194 | 194 | |
| 195 | 195 | $atts['class'] .= ' has-value'; |
| 196 | 196 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | </div> |
| 227 | 227 | |
| 228 | 228 | <div class="canvas-media" data-name="value-embed"> |
| 229 | - <?php if( !empty( $field['value'] ) ): ?> |
|
| 229 | + <?php if ( ! empty($field['value'])): ?> |
|
| 230 | 230 | <?php echo $this->wp_oembed_get($field['value'], $field['width'], $field['height']); ?> |
| 231 | 231 | <?php endif; ?> |
| 232 | 232 | </div> |
@@ -254,11 +254,11 @@ discard block |
||
| 254 | 254 | * @date 23/01/13 |
| 255 | 255 | */ |
| 256 | 256 | |
| 257 | - function render_field_settings( $field ) { |
|
| 257 | + function render_field_settings($field) { |
|
| 258 | 258 | |
| 259 | 259 | // width |
| 260 | - acf_render_field_setting( $field, array( |
|
| 261 | - 'label' => __('Embed Size','acf'), |
|
| 260 | + acf_render_field_setting($field, array( |
|
| 261 | + 'label' => __('Embed Size', 'acf'), |
|
| 262 | 262 | 'type' => 'text', |
| 263 | 263 | 'name' => 'width', |
| 264 | 264 | 'prepend' => __('Width', 'acf'), |
@@ -268,8 +268,8 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | |
| 270 | 270 | // height |
| 271 | - acf_render_field_setting( $field, array( |
|
| 272 | - 'label' => __('Embed Size','acf'), |
|
| 271 | + acf_render_field_setting($field, array( |
|
| 272 | + 'label' => __('Embed Size', 'acf'), |
|
| 273 | 273 | 'type' => 'text', |
| 274 | 274 | 'name' => 'height', |
| 275 | 275 | 'prepend' => __('Height', 'acf'), |
@@ -299,10 +299,10 @@ discard block |
||
| 299 | 299 | * @return $value (mixed) the modified value |
| 300 | 300 | */ |
| 301 | 301 | |
| 302 | - function format_value( $value, $post_id, $field ) { |
|
| 302 | + function format_value($value, $post_id, $field) { |
|
| 303 | 303 | |
| 304 | 304 | // bail early if no value |
| 305 | - if( empty($value) ) { |
|
| 305 | + if (empty($value)) { |
|
| 306 | 306 | |
| 307 | 307 | return $value; |
| 308 | 308 | |
@@ -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_page_link') ) : |
|
| 14 | +if ( ! class_exists('acf_field_page_link')) : |
|
| 15 | 15 | |
| 16 | 16 | class acf_field_page_link extends acf_field { |
| 17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // vars |
| 35 | 35 | $this->name = 'page_link'; |
| 36 | - $this->label = __("Page Link",'acf'); |
|
| 36 | + $this->label = __("Page Link", 'acf'); |
|
| 37 | 37 | $this->category = 'relational'; |
| 38 | 38 | $this->defaults = array( |
| 39 | 39 | 'post_type' => array(), |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | // extra |
| 47 | - add_action('wp_ajax_acf/fields/page_link/query', array($this, 'ajax_query')); |
|
| 48 | - add_action('wp_ajax_nopriv_acf/fields/page_link/query', array($this, 'ajax_query')); |
|
| 47 | + add_action('wp_ajax_acf/fields/page_link/query', array($this, 'ajax_query')); |
|
| 48 | + add_action('wp_ajax_nopriv_acf/fields/page_link/query', array($this, 'ajax_query')); |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | // do not delete! |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @return (array) |
| 68 | 68 | */ |
| 69 | 69 | |
| 70 | - function get_choices( $options = array() ) { |
|
| 70 | + function get_choices($options = array()) { |
|
| 71 | 71 | |
| 72 | 72 | // defaults |
| 73 | 73 | $options = acf_parse_args($options, array( |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | // load field |
| 93 | - $field = acf_get_field( $options['field_key'] ); |
|
| 93 | + $field = acf_get_field($options['field_key']); |
|
| 94 | 94 | |
| 95 | - if( !$field ) { |
|
| 95 | + if ( ! $field) { |
|
| 96 | 96 | |
| 97 | 97 | return false; |
| 98 | 98 | |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | // update $args |
| 103 | - if( !empty($field['post_type']) ) { |
|
| 103 | + if ( ! empty($field['post_type'])) { |
|
| 104 | 104 | |
| 105 | - $args['post_type'] = acf_get_array( $field['post_type'] ); |
|
| 105 | + $args['post_type'] = acf_get_array($field['post_type']); |
|
| 106 | 106 | |
| 107 | 107 | } else { |
| 108 | 108 | |
@@ -111,18 +111,18 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // create tax queries |
| 114 | - if( !empty($field['taxonomy']) ) { |
|
| 114 | + if ( ! empty($field['taxonomy'])) { |
|
| 115 | 115 | |
| 116 | 116 | // append to $args |
| 117 | 117 | $args['tax_query'] = array(); |
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | // decode terms |
| 121 | - $taxonomies = acf_decode_taxonomy_terms( $field['taxonomy'] ); |
|
| 121 | + $taxonomies = acf_decode_taxonomy_terms($field['taxonomy']); |
|
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | // now create the tax queries |
| 125 | - foreach( $taxonomies as $taxonomy => $terms ) { |
|
| 125 | + foreach ($taxonomies as $taxonomy => $terms) { |
|
| 126 | 126 | |
| 127 | 127 | $args['tax_query'][] = array( |
| 128 | 128 | 'taxonomy' => $taxonomy, |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | // search |
| 138 | - if( $options['s'] ) { |
|
| 138 | + if ($options['s']) { |
|
| 139 | 139 | |
| 140 | 140 | $args['s'] = $options['s']; |
| 141 | 141 | |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | // filters |
| 146 | 146 | $args = apply_filters('acf/fields/page_link/query', $args, $field, $options['post_id']); |
| 147 | - $args = apply_filters('acf/fields/page_link/query/name=' . $field['name'], $args, $field, $options['post_id'] ); |
|
| 148 | - $args = apply_filters('acf/fields/page_link/query/key=' . $field['key'], $args, $field, $options['post_id'] ); |
|
| 147 | + $args = apply_filters('acf/fields/page_link/query/name='.$field['name'], $args, $field, $options['post_id']); |
|
| 148 | + $args = apply_filters('acf/fields/page_link/query/key='.$field['key'], $args, $field, $options['post_id']); |
|
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | // add archives to $r |
| 152 | - if( $args['paged'] == 1 ) { |
|
| 152 | + if ($args['paged'] == 1) { |
|
| 153 | 153 | |
| 154 | 154 | $archives = array(); |
| 155 | 155 | $archives[] = array( |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | 'text' => home_url() |
| 158 | 158 | ); |
| 159 | 159 | |
| 160 | - foreach( $args['post_type'] as $post_type ) { |
|
| 160 | + foreach ($args['post_type'] as $post_type) { |
|
| 161 | 161 | |
| 162 | - $archive_link = get_post_type_archive_link( $post_type ); |
|
| 162 | + $archive_link = get_post_type_archive_link($post_type); |
|
| 163 | 163 | |
| 164 | - if( $archive_link ) { |
|
| 164 | + if ($archive_link) { |
|
| 165 | 165 | |
| 166 | 166 | $archives[] = array( |
| 167 | 167 | 'id' => $archive_link, |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | // search |
| 177 | - if( !empty($args['s']) ) { |
|
| 177 | + if ( ! empty($args['s'])) { |
|
| 178 | 178 | |
| 179 | - foreach( array_keys($archives) as $i ) { |
|
| 179 | + foreach (array_keys($archives) as $i) { |
|
| 180 | 180 | |
| 181 | - if( strpos( $archives[$i]['text'], $args['s'] ) === false ) { |
|
| 181 | + if (strpos($archives[$i]['text'], $args['s']) === false) { |
|
| 182 | 182 | |
| 183 | 183 | unset($archives[$i]); |
| 184 | 184 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
| 194 | - if( !empty($archives) ) { |
|
| 194 | + if ( ! empty($archives)) { |
|
| 195 | 195 | |
| 196 | 196 | $r[] = array( |
| 197 | 197 | 'text' => __('Archives', 'acf'), |
@@ -204,14 +204,14 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | // get posts grouped by post type |
| 207 | - $groups = acf_get_grouped_posts( $args ); |
|
| 207 | + $groups = acf_get_grouped_posts($args); |
|
| 208 | 208 | |
| 209 | - if( !empty($groups) ) { |
|
| 209 | + if ( ! empty($groups)) { |
|
| 210 | 210 | |
| 211 | - foreach( array_keys($groups) as $group_title ) { |
|
| 211 | + foreach (array_keys($groups) as $group_title) { |
|
| 212 | 212 | |
| 213 | 213 | // vars |
| 214 | - $posts = acf_extract_var( $groups, $group_title ); |
|
| 214 | + $posts = acf_extract_var($groups, $group_title); |
|
| 215 | 215 | $titles = array(); |
| 216 | 216 | |
| 217 | 217 | |
@@ -222,28 +222,28 @@ discard block |
||
| 222 | 222 | ); |
| 223 | 223 | |
| 224 | 224 | |
| 225 | - foreach( array_keys($posts) as $post_id ) { |
|
| 225 | + foreach (array_keys($posts) as $post_id) { |
|
| 226 | 226 | |
| 227 | 227 | // override data |
| 228 | - $posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'] ); |
|
| 228 | + $posts[$post_id] = $this->get_post_title($posts[$post_id], $field, $options['post_id']); |
|
| 229 | 229 | |
| 230 | 230 | }; |
| 231 | 231 | |
| 232 | 232 | |
| 233 | 233 | // order by search |
| 234 | - if( !empty($args['s']) ) { |
|
| 234 | + if ( ! empty($args['s'])) { |
|
| 235 | 235 | |
| 236 | - $posts = acf_order_by_search( $posts, $args['s'] ); |
|
| 236 | + $posts = acf_order_by_search($posts, $args['s']); |
|
| 237 | 237 | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | |
| 241 | 241 | // append to $data |
| 242 | - foreach( array_keys($posts) as $post_id ) { |
|
| 242 | + foreach (array_keys($posts) as $post_id) { |
|
| 243 | 243 | |
| 244 | 244 | $data['children'][] = array( |
| 245 | 245 | 'id' => $post_id, |
| 246 | - 'text' => $posts[ $post_id ] |
|
| 246 | + 'text' => $posts[$post_id] |
|
| 247 | 247 | ); |
| 248 | 248 | |
| 249 | 249 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | function ajax_query() { |
| 280 | 280 | |
| 281 | 281 | // validate |
| 282 | - if( !acf_verify_ajax() ) { |
|
| 282 | + if ( ! acf_verify_ajax()) { |
|
| 283 | 283 | |
| 284 | 284 | die(); |
| 285 | 285 | |
@@ -287,11 +287,11 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | |
| 289 | 289 | // get choices |
| 290 | - $choices = $this->get_choices( $_POST ); |
|
| 290 | + $choices = $this->get_choices($_POST); |
|
| 291 | 291 | |
| 292 | 292 | |
| 293 | 293 | // validate |
| 294 | - if( !$choices ) { |
|
| 294 | + if ( ! $choices) { |
|
| 295 | 295 | |
| 296 | 296 | die(); |
| 297 | 297 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | |
| 300 | 300 | |
| 301 | 301 | // return JSON |
| 302 | - echo json_encode( $choices ); |
|
| 302 | + echo json_encode($choices); |
|
| 303 | 303 | die(); |
| 304 | 304 | |
| 305 | 305 | } |
@@ -320,14 +320,14 @@ discard block |
||
| 320 | 320 | * @return (string) |
| 321 | 321 | */ |
| 322 | 322 | |
| 323 | - function get_post_title( $post, $field, $post_id = 0 ) { |
|
| 323 | + function get_post_title($post, $field, $post_id = 0) { |
|
| 324 | 324 | |
| 325 | 325 | // get post_id |
| 326 | - if( !$post_id ) { |
|
| 326 | + if ( ! $post_id) { |
|
| 327 | 327 | |
| 328 | 328 | $form_data = acf_get_setting('form_data'); |
| 329 | 329 | |
| 330 | - if( !empty($form_data['post_id']) ) { |
|
| 330 | + if ( ! empty($form_data['post_id'])) { |
|
| 331 | 331 | |
| 332 | 332 | $post_id = $form_data['post_id']; |
| 333 | 333 | |
@@ -341,13 +341,13 @@ discard block |
||
| 341 | 341 | |
| 342 | 342 | |
| 343 | 343 | // vars |
| 344 | - $title = acf_get_post_title( $post ); |
|
| 344 | + $title = acf_get_post_title($post); |
|
| 345 | 345 | |
| 346 | 346 | |
| 347 | 347 | // filters |
| 348 | 348 | $title = apply_filters('acf/fields/page_link/result', $title, $post, $field, $post_id); |
| 349 | - $title = apply_filters('acf/fields/page_link/result/name=' . $field['_name'], $title, $post, $field, $post_id); |
|
| 350 | - $title = apply_filters('acf/fields/page_link/result/key=' . $field['key'], $title, $post, $field, $post_id); |
|
| 349 | + $title = apply_filters('acf/fields/page_link/result/name='.$field['_name'], $title, $post, $field, $post_id); |
|
| 350 | + $title = apply_filters('acf/fields/page_link/result/key='.$field['key'], $title, $post, $field, $post_id); |
|
| 351 | 351 | |
| 352 | 352 | |
| 353 | 353 | // return |
@@ -368,18 +368,18 @@ discard block |
||
| 368 | 368 | * @return $value |
| 369 | 369 | */ |
| 370 | 370 | |
| 371 | - function get_posts( $value, $field ) { |
|
| 371 | + function get_posts($value, $field) { |
|
| 372 | 372 | |
| 373 | 373 | // force value to array |
| 374 | - $value = acf_get_array( $value ); |
|
| 374 | + $value = acf_get_array($value); |
|
| 375 | 375 | |
| 376 | 376 | |
| 377 | 377 | // get selected post ID's |
| 378 | 378 | $post__in = array(); |
| 379 | 379 | |
| 380 | - foreach( $value as $k => $v ) { |
|
| 380 | + foreach ($value as $k => $v) { |
|
| 381 | 381 | |
| 382 | - if( is_numeric($v) ) { |
|
| 382 | + if (is_numeric($v)) { |
|
| 383 | 383 | |
| 384 | 384 | // append to $post__in |
| 385 | 385 | $post__in[] = (int) $v; |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | |
| 392 | 392 | // bail early if no posts |
| 393 | - if( empty($post__in) ) { |
|
| 393 | + if (empty($post__in)) { |
|
| 394 | 394 | |
| 395 | 395 | return $value; |
| 396 | 396 | |
@@ -409,16 +409,16 @@ discard block |
||
| 409 | 409 | |
| 410 | 410 | |
| 411 | 411 | // append to $return |
| 412 | - foreach( $value as $k => $v ) { |
|
| 412 | + foreach ($value as $k => $v) { |
|
| 413 | 413 | |
| 414 | - if( is_numeric($v) ) { |
|
| 414 | + if (is_numeric($v)) { |
|
| 415 | 415 | |
| 416 | 416 | // extract first post |
| 417 | - $post = array_shift( $posts ); |
|
| 417 | + $post = array_shift($posts); |
|
| 418 | 418 | |
| 419 | 419 | |
| 420 | 420 | // append |
| 421 | - if( $post ) { |
|
| 421 | + if ($post) { |
|
| 422 | 422 | |
| 423 | 423 | $return[] = $post; |
| 424 | 424 | |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | * @date 23/01/13 |
| 452 | 452 | */ |
| 453 | 453 | |
| 454 | - function render_field( $field ){ |
|
| 454 | + function render_field($field) { |
|
| 455 | 455 | |
| 456 | 456 | // Change Field into a select |
| 457 | 457 | $field['type'] = 'select'; |
@@ -461,30 +461,30 @@ discard block |
||
| 461 | 461 | |
| 462 | 462 | |
| 463 | 463 | // populate choices if value exists |
| 464 | - if( !empty($field['value']) ) { |
|
| 464 | + if ( ! empty($field['value'])) { |
|
| 465 | 465 | |
| 466 | 466 | // get posts |
| 467 | - $posts = $this->get_posts( $field['value'], $field ); |
|
| 467 | + $posts = $this->get_posts($field['value'], $field); |
|
| 468 | 468 | |
| 469 | 469 | |
| 470 | 470 | // set choices |
| 471 | - if( !empty($posts) ) { |
|
| 471 | + if ( ! empty($posts)) { |
|
| 472 | 472 | |
| 473 | - foreach( array_keys($posts) as $i ) { |
|
| 473 | + foreach (array_keys($posts) as $i) { |
|
| 474 | 474 | |
| 475 | 475 | // vars |
| 476 | - $post = acf_extract_var( $posts, $i ); |
|
| 476 | + $post = acf_extract_var($posts, $i); |
|
| 477 | 477 | |
| 478 | 478 | |
| 479 | - if( is_object($post) ) { |
|
| 479 | + if (is_object($post)) { |
|
| 480 | 480 | |
| 481 | 481 | // append to choices |
| 482 | - $field['choices'][ $post->ID ] = $this->get_post_title( $post, $field ); |
|
| 482 | + $field['choices'][$post->ID] = $this->get_post_title($post, $field); |
|
| 483 | 483 | |
| 484 | 484 | } else { |
| 485 | 485 | |
| 486 | 486 | // append to choices |
| 487 | - $field['choices'][ $post ] = $post; |
|
| 487 | + $field['choices'][$post] = $post; |
|
| 488 | 488 | |
| 489 | 489 | } |
| 490 | 490 | |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | |
| 497 | 497 | |
| 498 | 498 | // render |
| 499 | - acf_render_field( $field ); |
|
| 499 | + acf_render_field($field); |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | |
@@ -513,11 +513,11 @@ discard block |
||
| 513 | 513 | * @param $field - an array holding all the field's data |
| 514 | 514 | */ |
| 515 | 515 | |
| 516 | - function render_field_settings( $field ) { |
|
| 516 | + function render_field_settings($field) { |
|
| 517 | 517 | |
| 518 | 518 | // post_type |
| 519 | - acf_render_field_setting( $field, array( |
|
| 520 | - 'label' => __('Filter by Post Type','acf'), |
|
| 519 | + acf_render_field_setting($field, array( |
|
| 520 | + 'label' => __('Filter by Post Type', 'acf'), |
|
| 521 | 521 | 'instructions' => '', |
| 522 | 522 | 'type' => 'select', |
| 523 | 523 | 'name' => 'post_type', |
@@ -525,13 +525,13 @@ discard block |
||
| 525 | 525 | 'multiple' => 1, |
| 526 | 526 | 'ui' => 1, |
| 527 | 527 | 'allow_null' => 1, |
| 528 | - 'placeholder' => __("All post types",'acf'), |
|
| 528 | + 'placeholder' => __("All post types", 'acf'), |
|
| 529 | 529 | )); |
| 530 | 530 | |
| 531 | 531 | |
| 532 | 532 | // taxonomy |
| 533 | - acf_render_field_setting( $field, array( |
|
| 534 | - 'label' => __('Filter by Taxonomy','acf'), |
|
| 533 | + acf_render_field_setting($field, array( |
|
| 534 | + 'label' => __('Filter by Taxonomy', 'acf'), |
|
| 535 | 535 | 'instructions' => '', |
| 536 | 536 | 'type' => 'select', |
| 537 | 537 | 'name' => 'taxonomy', |
@@ -539,33 +539,33 @@ discard block |
||
| 539 | 539 | 'multiple' => 1, |
| 540 | 540 | 'ui' => 1, |
| 541 | 541 | 'allow_null' => 1, |
| 542 | - 'placeholder' => __("All taxonomies",'acf'), |
|
| 542 | + 'placeholder' => __("All taxonomies", 'acf'), |
|
| 543 | 543 | )); |
| 544 | 544 | |
| 545 | 545 | |
| 546 | 546 | // allow_null |
| 547 | - acf_render_field_setting( $field, array( |
|
| 548 | - 'label' => __('Allow Null?','acf'), |
|
| 547 | + acf_render_field_setting($field, array( |
|
| 548 | + 'label' => __('Allow Null?', 'acf'), |
|
| 549 | 549 | 'instructions' => '', |
| 550 | 550 | 'type' => 'radio', |
| 551 | 551 | 'name' => 'allow_null', |
| 552 | 552 | 'choices' => array( |
| 553 | - 1 => __("Yes",'acf'), |
|
| 554 | - 0 => __("No",'acf'), |
|
| 553 | + 1 => __("Yes", 'acf'), |
|
| 554 | + 0 => __("No", 'acf'), |
|
| 555 | 555 | ), |
| 556 | 556 | 'layout' => 'horizontal', |
| 557 | 557 | )); |
| 558 | 558 | |
| 559 | 559 | |
| 560 | 560 | // multiple |
| 561 | - acf_render_field_setting( $field, array( |
|
| 562 | - 'label' => __('Select multiple values?','acf'), |
|
| 561 | + acf_render_field_setting($field, array( |
|
| 562 | + 'label' => __('Select multiple values?', 'acf'), |
|
| 563 | 563 | 'instructions' => '', |
| 564 | 564 | 'type' => 'radio', |
| 565 | 565 | 'name' => 'multiple', |
| 566 | 566 | 'choices' => array( |
| 567 | - 1 => __("Yes",'acf'), |
|
| 568 | - 0 => __("No",'acf'), |
|
| 567 | + 1 => __("Yes", 'acf'), |
|
| 568 | + 0 => __("No", 'acf'), |
|
| 569 | 569 | ), |
| 570 | 570 | 'layout' => 'horizontal', |
| 571 | 571 | )); |
@@ -589,10 +589,10 @@ discard block |
||
| 589 | 589 | * @return $value (mixed) the modified value |
| 590 | 590 | */ |
| 591 | 591 | |
| 592 | - function format_value( $value, $post_id, $field ) { |
|
| 592 | + function format_value($value, $post_id, $field) { |
|
| 593 | 593 | |
| 594 | 594 | // ACF4 null |
| 595 | - if( $value === 'null' ) { |
|
| 595 | + if ($value === 'null') { |
|
| 596 | 596 | |
| 597 | 597 | return false; |
| 598 | 598 | |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | |
| 601 | 601 | |
| 602 | 602 | // bail early if no value |
| 603 | - if( empty($value) ) { |
|
| 603 | + if (empty($value)) { |
|
| 604 | 604 | |
| 605 | 605 | return $value; |
| 606 | 606 | |
@@ -608,32 +608,32 @@ discard block |
||
| 608 | 608 | |
| 609 | 609 | |
| 610 | 610 | // get posts |
| 611 | - $value = $this->get_posts( $value, $field ); |
|
| 611 | + $value = $this->get_posts($value, $field); |
|
| 612 | 612 | |
| 613 | 613 | |
| 614 | 614 | // set choices |
| 615 | - foreach( array_keys($value) as $i ) { |
|
| 615 | + foreach (array_keys($value) as $i) { |
|
| 616 | 616 | |
| 617 | 617 | // vars |
| 618 | - $post = acf_extract_var( $value, $i ); |
|
| 618 | + $post = acf_extract_var($value, $i); |
|
| 619 | 619 | |
| 620 | 620 | |
| 621 | 621 | // convert $post to permalink |
| 622 | - if( is_object($post) ) { |
|
| 622 | + if (is_object($post)) { |
|
| 623 | 623 | |
| 624 | - $post = get_permalink( $post ); |
|
| 624 | + $post = get_permalink($post); |
|
| 625 | 625 | |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | |
| 629 | 629 | // append back to $value |
| 630 | - $value[ $i ] = $post; |
|
| 630 | + $value[$i] = $post; |
|
| 631 | 631 | |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | |
| 635 | 635 | // convert back from array if neccessary |
| 636 | - if( !$field['multiple'] ) { |
|
| 636 | + if ( ! $field['multiple']) { |
|
| 637 | 637 | |
| 638 | 638 | $value = array_shift($value); |
| 639 | 639 | |
@@ -662,10 +662,10 @@ discard block |
||
| 662 | 662 | * @return $value - the modified value |
| 663 | 663 | */ |
| 664 | 664 | |
| 665 | - function update_value( $value, $post_id, $field ) { |
|
| 665 | + function update_value($value, $post_id, $field) { |
|
| 666 | 666 | |
| 667 | 667 | // validate |
| 668 | - if( empty($value) ) { |
|
| 668 | + if (empty($value)) { |
|
| 669 | 669 | |
| 670 | 670 | return $value; |
| 671 | 671 | |
@@ -673,15 +673,15 @@ discard block |
||
| 673 | 673 | |
| 674 | 674 | |
| 675 | 675 | // format |
| 676 | - if( is_array($value) ) { |
|
| 676 | + if (is_array($value)) { |
|
| 677 | 677 | |
| 678 | 678 | // array |
| 679 | - foreach( $value as $k => $v ){ |
|
| 679 | + foreach ($value as $k => $v) { |
|
| 680 | 680 | |
| 681 | 681 | // object? |
| 682 | - if( is_object($v) && isset($v->ID) ) |
|
| 682 | + if (is_object($v) && isset($v->ID)) |
|
| 683 | 683 | { |
| 684 | - $value[ $k ] = $v->ID; |
|
| 684 | + $value[$k] = $v->ID; |
|
| 685 | 685 | } |
| 686 | 686 | } |
| 687 | 687 | |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | // save value as strings, so we can clearly search for them in SQL LIKE statements |
| 690 | 690 | $value = array_map('strval', $value); |
| 691 | 691 | |
| 692 | - } elseif( is_object($value) && isset($value->ID) ) { |
|
| 692 | + } elseif (is_object($value) && isset($value->ID)) { |
|
| 693 | 693 | |
| 694 | 694 | // object |
| 695 | 695 | $value = $value->ID; |
@@ -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 | |