@@ -395,8 +395,8 @@ |
||
| 395 | 395 | |
| 396 | 396 | |
| 397 | 397 | |
| 398 | - // save data |
|
| 399 | - if( acf_validate_save_post(true) ) { |
|
| 398 | + // save data |
|
| 399 | + if( acf_validate_save_post(true) ) { |
|
| 400 | 400 | |
| 401 | 401 | acf_save_post("{$taxonomy}_{$term_id}"); |
| 402 | 402 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @subpackage Forms |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if( ! class_exists('acf_form_taxonomy') ) : |
|
| 13 | +if ( ! class_exists('acf_form_taxonomy')) : |
|
| 14 | 14 | |
| 15 | 15 | class acf_form_taxonomy { |
| 16 | 16 | |
@@ -33,16 +33,16 @@ discard block |
||
| 33 | 33 | function __construct() { |
| 34 | 34 | |
| 35 | 35 | // actions |
| 36 | - add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
| 36 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | // save |
| 40 | - add_action('create_term', array($this, 'save_term'), 10, 3); |
|
| 41 | - add_action('edit_term', array($this, 'save_term'), 10, 3); |
|
| 40 | + add_action('create_term', array($this, 'save_term'), 10, 3); |
|
| 41 | + add_action('edit_term', array($this, 'save_term'), 10, 3); |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | // delete |
| 45 | - add_action('delete_term', array($this, 'delete_term'), 10, 4); |
|
| 45 | + add_action('delete_term', array($this, 'delete_term'), 10, 4); |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | // validate page |
| 70 | - if( $pagenow == 'edit-tags.php' ) { |
|
| 70 | + if ($pagenow == 'edit-tags.php') { |
|
| 71 | 71 | |
| 72 | 72 | return true; |
| 73 | 73 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | function admin_enqueue_scripts() { |
| 97 | 97 | |
| 98 | 98 | // validate page |
| 99 | - if( !$this->validate_page() ) { |
|
| 99 | + if ( ! $this->validate_page()) { |
|
| 100 | 100 | |
| 101 | 101 | return; |
| 102 | 102 | |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | // actions |
| 116 | - add_action('admin_footer', array($this, 'admin_footer'), 10, 1); |
|
| 117 | - add_action("{$taxonomy}_add_form_fields", array($this, 'add_term'), 10, 1); |
|
| 118 | - add_action("{$taxonomy}_edit_form", array($this, 'edit_term'), 10, 2); |
|
| 116 | + add_action('admin_footer', array($this, 'admin_footer'), 10, 1); |
|
| 117 | + add_action("{$taxonomy}_add_form_fields", array($this, 'add_term'), 10, 1); |
|
| 118 | + add_action("{$taxonomy}_edit_form", array($this, 'edit_term'), 10, 2); |
|
| 119 | 119 | |
| 120 | 120 | } |
| 121 | 121 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * @return $post_id (int) |
| 134 | 134 | */ |
| 135 | 135 | |
| 136 | - function add_term( $taxonomy ) { |
|
| 136 | + function add_term($taxonomy) { |
|
| 137 | 137 | |
| 138 | 138 | // vars |
| 139 | 139 | $post_id = "{$taxonomy}_0"; |
@@ -147,22 +147,22 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | // get field groups |
| 150 | - $field_groups = acf_get_field_groups( $args ); |
|
| 150 | + $field_groups = acf_get_field_groups($args); |
|
| 151 | 151 | |
| 152 | 152 | |
| 153 | 153 | // render |
| 154 | - if( !empty($field_groups) ) { |
|
| 154 | + if ( ! empty($field_groups)) { |
|
| 155 | 155 | |
| 156 | 156 | acf_form_data(array( |
| 157 | 157 | 'post_id' => $post_id, |
| 158 | 158 | 'nonce' => 'taxonomy', |
| 159 | 159 | )); |
| 160 | 160 | |
| 161 | - foreach( $field_groups as $field_group ) { |
|
| 161 | + foreach ($field_groups as $field_group) { |
|
| 162 | 162 | |
| 163 | - $fields = acf_get_fields( $field_group ); |
|
| 163 | + $fields = acf_get_fields($field_group); |
|
| 164 | 164 | |
| 165 | - acf_render_fields( $post_id, $fields, 'div', 'field' ); |
|
| 165 | + acf_render_fields($post_id, $fields, 'div', 'field'); |
|
| 166 | 166 | |
| 167 | 167 | } |
| 168 | 168 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @return $post_id (int) |
| 185 | 185 | */ |
| 186 | 186 | |
| 187 | - function edit_term( $term, $taxonomy ) { |
|
| 187 | + function edit_term($term, $taxonomy) { |
|
| 188 | 188 | |
| 189 | 189 | // vars |
| 190 | 190 | $post_id = "{$taxonomy}_{$term->term_id}"; |
@@ -198,28 +198,28 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | |
| 200 | 200 | // get field groups |
| 201 | - $field_groups = acf_get_field_groups( $args ); |
|
| 201 | + $field_groups = acf_get_field_groups($args); |
|
| 202 | 202 | |
| 203 | 203 | |
| 204 | 204 | // render |
| 205 | - if( !empty($field_groups) ) { |
|
| 205 | + if ( ! empty($field_groups)) { |
|
| 206 | 206 | |
| 207 | 207 | acf_form_data(array( |
| 208 | 208 | 'post_id' => $post_id, |
| 209 | 209 | 'nonce' => 'taxonomy' |
| 210 | 210 | )); |
| 211 | 211 | |
| 212 | - foreach( $field_groups as $field_group ) { |
|
| 212 | + foreach ($field_groups as $field_group) { |
|
| 213 | 213 | |
| 214 | - $fields = acf_get_fields( $field_group ); |
|
| 214 | + $fields = acf_get_fields($field_group); |
|
| 215 | 215 | |
| 216 | 216 | ?> |
| 217 | - <?php if( $field_group['style'] == 'default' ): ?> |
|
| 217 | + <?php if ($field_group['style'] == 'default'): ?> |
|
| 218 | 218 | <h3><?php echo $field_group['title']; ?></h3> |
| 219 | 219 | <?php endif; ?> |
| 220 | 220 | <table class="form-table"> |
| 221 | 221 | <tbody> |
| 222 | - <?php acf_render_fields( $post_id, $fields, 'tr', 'field' ); ?> |
|
| 222 | + <?php acf_render_fields($post_id, $fields, 'tr', 'field'); ?> |
|
| 223 | 223 | </tbody> |
| 224 | 224 | </table> |
| 225 | 225 | <?php |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | acf.validation.error_class = 'form-invalid'; |
| 272 | 272 | |
| 273 | 273 | |
| 274 | -<?php if( $this->form == '#addtag' ): ?> |
|
| 274 | +<?php if ($this->form == '#addtag'): ?> |
|
| 275 | 275 | |
| 276 | 276 | // store origional HTML |
| 277 | 277 | var $orig = $('#addtag').children('.acf-field').clone(); |
@@ -384,10 +384,10 @@ discard block |
||
| 384 | 384 | * @return $post_id (int) |
| 385 | 385 | */ |
| 386 | 386 | |
| 387 | - function save_term( $term_id, $tt_id, $taxonomy ) { |
|
| 387 | + function save_term($term_id, $tt_id, $taxonomy) { |
|
| 388 | 388 | |
| 389 | 389 | // verify and remove nonce |
| 390 | - if( ! acf_verify_nonce('taxonomy') ) { |
|
| 390 | + if ( ! acf_verify_nonce('taxonomy')) { |
|
| 391 | 391 | |
| 392 | 392 | return $term_id; |
| 393 | 393 | |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | |
| 397 | 397 | |
| 398 | 398 | // save data |
| 399 | - if( acf_validate_save_post(true) ) { |
|
| 399 | + if (acf_validate_save_post(true)) { |
|
| 400 | 400 | |
| 401 | 401 | acf_save_post("{$taxonomy}_{$term_id}"); |
| 402 | 402 | |
@@ -418,13 +418,13 @@ discard block |
||
| 418 | 418 | * @return $post_id (int) |
| 419 | 419 | */ |
| 420 | 420 | |
| 421 | - function delete_term( $term, $tt_id, $taxonomy, $deleted_term ) { |
|
| 421 | + function delete_term($term, $tt_id, $taxonomy, $deleted_term) { |
|
| 422 | 422 | |
| 423 | 423 | global $wpdb; |
| 424 | 424 | |
| 425 | 425 | $values = $wpdb->query($wpdb->prepare( |
| 426 | 426 | "DELETE FROM $wpdb->options WHERE option_name LIKE %s", |
| 427 | - '%' . $taxonomy . '_' . $term . '%' |
|
| 427 | + '%'.$taxonomy.'_'.$term.'%' |
|
| 428 | 428 | )); |
| 429 | 429 | |
| 430 | 430 | } |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | $id = acf_maybe_get($_POST, 'widget-id'); |
| 182 | 182 | |
| 183 | 183 | |
| 184 | - // save data |
|
| 185 | - if( $id && acf_validate_save_post() ) { |
|
| 184 | + // save data |
|
| 185 | + if( $id && acf_validate_save_post() ) { |
|
| 186 | 186 | |
| 187 | 187 | acf_save_post( "widget_{$id}" ); |
| 188 | 188 | |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | |
| 221 | - // save |
|
| 222 | - if( acf_validate_save_post() ) { |
|
| 221 | + // save |
|
| 222 | + if( acf_validate_save_post() ) { |
|
| 223 | 223 | |
| 224 | 224 | acf_save_post( "widget_{$widget->id}" ); |
| 225 | 225 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @subpackage Forms |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if( ! class_exists('acf_form_widget') ) : |
|
| 13 | +if ( ! class_exists('acf_form_widget')) : |
|
| 14 | 14 | |
| 15 | 15 | class acf_form_widget { |
| 16 | 16 | |
@@ -31,16 +31,16 @@ discard block |
||
| 31 | 31 | function __construct() { |
| 32 | 32 | |
| 33 | 33 | // actions |
| 34 | - add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
| 35 | - add_action('in_widget_form', array($this, 'edit_widget'), 10, 3); |
|
| 34 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
| 35 | + add_action('in_widget_form', array($this, 'edit_widget'), 10, 3); |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | // filters |
| 39 | - add_filter('widget_update_callback', array($this, 'widget_update_callback'), 10, 4); |
|
| 39 | + add_filter('widget_update_callback', array($this, 'widget_update_callback'), 10, 4); |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | // ajax |
| 43 | - add_action('wp_ajax_update-widget', array($this, 'ajax_update_widget'), 0, 1); |
|
| 43 | + add_action('wp_ajax_update-widget', array($this, 'ajax_update_widget'), 0, 1); |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | function admin_enqueue_scripts() { |
| 63 | 63 | |
| 64 | 64 | // validate screen |
| 65 | - if( acf_is_screen('widgets') || acf_is_screen('customize') ) { |
|
| 65 | + if (acf_is_screen('widgets') || acf_is_screen('customize')) { |
|
| 66 | 66 | |
| 67 | 67 | // valid |
| 68 | 68 | |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | * @param $instance (object) |
| 98 | 98 | * @return $post_id (int) |
| 99 | 99 | */ |
| 100 | - function edit_widget( $widget, $return, $instance ) { |
|
| 100 | + function edit_widget($widget, $return, $instance) { |
|
| 101 | 101 | |
| 102 | 102 | // vars |
| 103 | 103 | $post_id = 0; |
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | // get id |
| 107 | - if( $widget->number !== '__i__' ) { |
|
| 107 | + if ($widget->number !== '__i__') { |
|
| 108 | 108 | |
| 109 | 109 | $post_id = "widget_{$widget->id}"; |
| 110 | 110 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | // render |
| 121 | - if( !empty($field_groups) ) { |
|
| 121 | + if ( ! empty($field_groups)) { |
|
| 122 | 122 | |
| 123 | 123 | // render post data |
| 124 | 124 | acf_form_data(array( |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | )); |
| 128 | 128 | |
| 129 | 129 | |
| 130 | - foreach( $field_groups as $field_group ) { |
|
| 130 | + foreach ($field_groups as $field_group) { |
|
| 131 | 131 | |
| 132 | - $fields = acf_get_fields( $field_group ); |
|
| 132 | + $fields = acf_get_fields($field_group); |
|
| 133 | 133 | |
| 134 | - acf_render_fields( $post_id, $fields, 'div', 'field' ); |
|
| 134 | + acf_render_fields($post_id, $fields, 'div', 'field'); |
|
| 135 | 135 | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if( $widget->updated ): ?> |
|
| 138 | + if ($widget->updated): ?> |
|
| 139 | 139 | <script type="text/javascript"> |
| 140 | 140 | (function($) { |
| 141 | 141 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | |
| 172 | 172 | // bail early if no nonce |
| 173 | - if( !acf_verify_nonce('widget') ) { |
|
| 173 | + if ( ! acf_verify_nonce('widget')) { |
|
| 174 | 174 | |
| 175 | 175 | return; |
| 176 | 176 | |
@@ -182,9 +182,9 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | |
| 184 | 184 | // save data |
| 185 | - if( $id && acf_validate_save_post() ) { |
|
| 185 | + if ($id && acf_validate_save_post()) { |
|
| 186 | 186 | |
| 187 | - acf_save_post( "widget_{$id}" ); |
|
| 187 | + acf_save_post("widget_{$id}"); |
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
@@ -208,10 +208,10 @@ discard block |
||
| 208 | 208 | * @return $instance |
| 209 | 209 | */ |
| 210 | 210 | |
| 211 | - function widget_update_callback( $instance, $new_instance, $old_instance, $widget ) { |
|
| 211 | + function widget_update_callback($instance, $new_instance, $old_instance, $widget) { |
|
| 212 | 212 | |
| 213 | 213 | // bail early if no nonce |
| 214 | - if( !acf_verify_nonce('widget') ) { |
|
| 214 | + if ( ! acf_verify_nonce('widget')) { |
|
| 215 | 215 | |
| 216 | 216 | return $instance; |
| 217 | 217 | |
@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | |
| 221 | 221 | // save |
| 222 | - if( acf_validate_save_post() ) { |
|
| 222 | + if (acf_validate_save_post()) { |
|
| 223 | 223 | |
| 224 | - acf_save_post( "widget_{$widget->id}" ); |
|
| 224 | + acf_save_post("widget_{$widget->id}"); |
|
| 225 | 225 | |
| 226 | 226 | } |
| 227 | 227 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | }); |
| 351 | 351 | |
| 352 | - <?php if( acf_is_screen('customize') ): ?> |
|
| 352 | + <?php if (acf_is_screen('customize')): ?> |
|
| 353 | 353 | |
| 354 | 354 | // customizer saves widget on any input change, so unload is not needed |
| 355 | 355 | acf.unload.active = 0; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if( !class_exists('acf_pro') ): |
|
| 3 | +if ( ! class_exists('acf_pro')): |
|
| 4 | 4 | |
| 5 | 5 | class acf_pro { |
| 6 | 6 | |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | function __construct() { |
| 21 | 21 | |
| 22 | 22 | // update setting |
| 23 | - acf_update_setting( 'pro', true ); |
|
| 24 | - acf_update_setting( 'name', __('Advanced Custom Fields PRO', 'acf') ); |
|
| 23 | + acf_update_setting('pro', true); |
|
| 24 | + acf_update_setting('name', __('Advanced Custom Fields PRO', 'acf')); |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | // api |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | // admin |
| 37 | - if( is_admin() ) { |
|
| 37 | + if (is_admin()) { |
|
| 38 | 38 | |
| 39 | 39 | // options page |
| 40 | 40 | acf_include('pro/admin/options-page.php'); |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | // actions |
| 49 | - add_action('init', array($this, 'register_assets')); |
|
| 50 | - add_action('acf/include_field_types', array($this, 'include_field_types'), 5); |
|
| 51 | - add_action('acf/input/admin_enqueue_scripts', array($this, 'input_admin_enqueue_scripts')); |
|
| 52 | - add_action('acf/field_group/admin_enqueue_scripts', array($this, 'field_group_admin_enqueue_scripts')); |
|
| 53 | - add_action('acf/field_group/admin_l10n', array($this, 'field_group_admin_l10n')); |
|
| 49 | + add_action('init', array($this, 'register_assets')); |
|
| 50 | + add_action('acf/include_field_types', array($this, 'include_field_types'), 5); |
|
| 51 | + add_action('acf/input/admin_enqueue_scripts', array($this, 'input_admin_enqueue_scripts')); |
|
| 52 | + add_action('acf/field_group/admin_enqueue_scripts', array($this, 'field_group_admin_enqueue_scripts')); |
|
| 53 | + add_action('acf/field_group/admin_l10n', array($this, 'field_group_admin_l10n')); |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | // filters |
| 57 | - add_filter('acf/get_valid_field', array($this, 'get_valid_field'), 11, 1); |
|
| 58 | - add_filter('acf/prepare_field_for_export', array($this, 'prepare_field_for_export')); |
|
| 59 | - add_filter('acf/prepare_field_for_import', array($this, 'prepare_field_for_import')); |
|
| 57 | + add_filter('acf/get_valid_field', array($this, 'get_valid_field'), 11, 1); |
|
| 58 | + add_filter('acf/prepare_field_for_export', array($this, 'prepare_field_for_export')); |
|
| 59 | + add_filter('acf/prepare_field_for_import', array($this, 'prepare_field_for_import')); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | * @return $field |
| 97 | 97 | */ |
| 98 | 98 | |
| 99 | - function get_valid_field( $field ) { |
|
| 99 | + function get_valid_field($field) { |
|
| 100 | 100 | |
| 101 | 101 | // extract old width |
| 102 | - $width = acf_extract_var( $field, 'column_width' ); |
|
| 102 | + $width = acf_extract_var($field, 'column_width'); |
|
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | // if old width, update the new width |
| 106 | - if( $width ) { |
|
| 106 | + if ($width) { |
|
| 107 | 107 | |
| 108 | 108 | $field['wrapper']['width'] = $width; |
| 109 | 109 | } |
@@ -131,17 +131,17 @@ discard block |
||
| 131 | 131 | function register_assets() { |
| 132 | 132 | |
| 133 | 133 | // min |
| 134 | - $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
| 134 | + $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | // register scripts |
| 138 | - wp_register_script( 'acf-pro-input', acf_get_dir( "pro/assets/js/acf-pro-input{$min}.js" ), false, acf_get_setting('version') ); |
|
| 139 | - wp_register_script( 'acf-pro-field-group', acf_get_dir( "pro/assets/js/acf-pro-field-group{$min}.js" ), false, acf_get_setting('version') ); |
|
| 138 | + wp_register_script('acf-pro-input', acf_get_dir("pro/assets/js/acf-pro-input{$min}.js"), false, acf_get_setting('version')); |
|
| 139 | + wp_register_script('acf-pro-field-group', acf_get_dir("pro/assets/js/acf-pro-field-group{$min}.js"), false, acf_get_setting('version')); |
|
| 140 | 140 | |
| 141 | 141 | |
| 142 | 142 | // register styles |
| 143 | - wp_register_style( 'acf-pro-input', acf_get_dir( 'pro/assets/css/acf-pro-input.css' ), false, acf_get_setting('version') ); |
|
| 144 | - wp_register_style( 'acf-pro-field-group', acf_get_dir( 'pro/assets/css/acf-pro-field-group.css' ), false, acf_get_setting('version') ); |
|
| 143 | + wp_register_style('acf-pro-input', acf_get_dir('pro/assets/css/acf-pro-input.css'), false, acf_get_setting('version')); |
|
| 144 | + wp_register_style('acf-pro-field-group', acf_get_dir('pro/assets/css/acf-pro-field-group.css'), false, acf_get_setting('version')); |
|
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | |
@@ -184,11 +184,11 @@ discard block |
||
| 184 | 184 | * @return $post_id (int) |
| 185 | 185 | */ |
| 186 | 186 | |
| 187 | - function field_group_admin_l10n( $l10n ) { |
|
| 187 | + function field_group_admin_l10n($l10n) { |
|
| 188 | 188 | |
| 189 | 189 | // append |
| 190 | 190 | $l10n['flexible_content'] = array( |
| 191 | - 'layout_warning' => __('Flexible Content requires at least 1 layout','acf') |
|
| 191 | + 'layout_warning' => __('Flexible Content requires at least 1 layout', 'acf') |
|
| 192 | 192 | ); |
| 193 | 193 | |
| 194 | 194 | |
@@ -236,23 +236,23 @@ discard block |
||
| 236 | 236 | * @return $post_id (int) |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - function prepare_field_for_export( $field ) { |
|
| 239 | + function prepare_field_for_export($field) { |
|
| 240 | 240 | |
| 241 | 241 | // sub field (parent_layout) |
| 242 | - acf_extract_var( $field, 'parent_layout'); |
|
| 242 | + acf_extract_var($field, 'parent_layout'); |
|
| 243 | 243 | |
| 244 | 244 | |
| 245 | 245 | // repeater |
| 246 | - if( $field['type'] == 'repeater' ) { |
|
| 246 | + if ($field['type'] == 'repeater') { |
|
| 247 | 247 | |
| 248 | - $field['sub_fields'] = acf_prepare_fields_for_export( $field['sub_fields'] ); |
|
| 248 | + $field['sub_fields'] = acf_prepare_fields_for_export($field['sub_fields']); |
|
| 249 | 249 | |
| 250 | 250 | // flexible content |
| 251 | - } elseif( $field['type'] == 'flexible_content' ) { |
|
| 251 | + } elseif ($field['type'] == 'flexible_content') { |
|
| 252 | 252 | |
| 253 | - foreach( $field['layouts'] as $l => $layout ) { |
|
| 253 | + foreach ($field['layouts'] as $l => $layout) { |
|
| 254 | 254 | |
| 255 | - $field['layouts'][ $l ]['sub_fields'] = acf_prepare_fields_for_export( $layout['sub_fields'] ); |
|
| 255 | + $field['layouts'][$l]['sub_fields'] = acf_prepare_fields_for_export($layout['sub_fields']); |
|
| 256 | 256 | |
| 257 | 257 | } |
| 258 | 258 | |
@@ -278,29 +278,29 @@ discard block |
||
| 278 | 278 | * @return $post_id (int) |
| 279 | 279 | */ |
| 280 | 280 | |
| 281 | - function prepare_field_for_import( $field ) { |
|
| 281 | + function prepare_field_for_import($field) { |
|
| 282 | 282 | |
| 283 | 283 | // var |
| 284 | 284 | $extra = array(); |
| 285 | 285 | |
| 286 | 286 | |
| 287 | 287 | // sub fields |
| 288 | - if( $field['type'] == 'repeater' ) { |
|
| 288 | + if ($field['type'] == 'repeater') { |
|
| 289 | 289 | |
| 290 | 290 | // extract sub fields |
| 291 | - $sub_fields = acf_extract_var( $field, 'sub_fields'); |
|
| 291 | + $sub_fields = acf_extract_var($field, 'sub_fields'); |
|
| 292 | 292 | |
| 293 | 293 | |
| 294 | 294 | // reset field setting |
| 295 | 295 | $field['sub_fields'] = array(); |
| 296 | 296 | |
| 297 | 297 | |
| 298 | - if( !empty($sub_fields) ) { |
|
| 298 | + if ( ! empty($sub_fields)) { |
|
| 299 | 299 | |
| 300 | - foreach( array_keys($sub_fields) as $i ) { |
|
| 300 | + foreach (array_keys($sub_fields) as $i) { |
|
| 301 | 301 | |
| 302 | 302 | // extract sub field |
| 303 | - $sub_field = acf_extract_var( $sub_fields, $i ); |
|
| 303 | + $sub_field = acf_extract_var($sub_fields, $i); |
|
| 304 | 304 | |
| 305 | 305 | |
| 306 | 306 | // attributes |
@@ -314,10 +314,10 @@ discard block |
||
| 314 | 314 | |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - } elseif( $field['type'] == 'flexible_content' ) { |
|
| 317 | + } elseif ($field['type'] == 'flexible_content') { |
|
| 318 | 318 | |
| 319 | 319 | // extract layouts |
| 320 | - $layouts = acf_extract_var( $field, 'layouts'); |
|
| 320 | + $layouts = acf_extract_var($field, 'layouts'); |
|
| 321 | 321 | |
| 322 | 322 | |
| 323 | 323 | // reset field setting |
@@ -325,17 +325,17 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | |
| 327 | 327 | // validate layouts |
| 328 | - if( !empty($layouts) ) { |
|
| 328 | + if ( ! empty($layouts)) { |
|
| 329 | 329 | |
| 330 | 330 | // loop over layouts |
| 331 | - foreach( array_keys($layouts) as $i ) { |
|
| 331 | + foreach (array_keys($layouts) as $i) { |
|
| 332 | 332 | |
| 333 | 333 | // extract layout |
| 334 | - $layout = acf_extract_var( $layouts, $i ); |
|
| 334 | + $layout = acf_extract_var($layouts, $i); |
|
| 335 | 335 | |
| 336 | 336 | |
| 337 | 337 | // get valid layout (fixes ACF4 export code bug undefined index 'key') |
| 338 | - if( empty($layout['key']) ) { |
|
| 338 | + if (empty($layout['key'])) { |
|
| 339 | 339 | |
| 340 | 340 | $layout['key'] = uniqid(); |
| 341 | 341 | |
@@ -343,17 +343,17 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | |
| 345 | 345 | // extract sub fields |
| 346 | - $sub_fields = acf_extract_var( $layout, 'sub_fields'); |
|
| 346 | + $sub_fields = acf_extract_var($layout, 'sub_fields'); |
|
| 347 | 347 | |
| 348 | 348 | |
| 349 | 349 | // validate sub fields |
| 350 | - if( !empty($sub_fields) ) { |
|
| 350 | + if ( ! empty($sub_fields)) { |
|
| 351 | 351 | |
| 352 | 352 | // loop over sub fields |
| 353 | - foreach( array_keys($sub_fields) as $j ) { |
|
| 353 | + foreach (array_keys($sub_fields) as $j) { |
|
| 354 | 354 | |
| 355 | 355 | // extract sub field |
| 356 | - $sub_field = acf_extract_var( $sub_fields, $j ); |
|
| 356 | + $sub_field = acf_extract_var($sub_fields, $j); |
|
| 357 | 357 | |
| 358 | 358 | |
| 359 | 359 | // attributes |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | |
| 382 | 382 | // extra |
| 383 | - if( !empty($extra) ) { |
|
| 383 | + if ( ! empty($extra)) { |
|
| 384 | 384 | |
| 385 | 385 | array_unshift($extra, $field); |
| 386 | 386 | |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | function rule_types( $choices ) { |
| 47 | 47 | |
| 48 | - $choices[ __("Forms",'acf') ]['options_page'] = __("Options Page",'acf'); |
|
| 48 | + $choices[ __("Forms",'acf') ]['options_page'] = __("Options Page",'acf'); |
|
| 49 | 49 | |
| 50 | - return $choices; |
|
| 50 | + return $choices; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | // return |
| 89 | - return $choices; |
|
| 89 | + return $choices; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
@@ -129,19 +129,19 @@ discard block |
||
| 129 | 129 | // match |
| 130 | 130 | if( $rule['operator'] == "==" ) { |
| 131 | 131 | |
| 132 | - $match = ( $options_page === $rule['value'] ); |
|
| 132 | + $match = ( $options_page === $rule['value'] ); |
|
| 133 | 133 | |
| 134 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 134 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 135 | 135 | |
| 136 | - $match = ( $options_page !== $rule['value'] ); |
|
| 136 | + $match = ( $options_page !== $rule['value'] ); |
|
| 137 | 137 | |
| 138 | - } |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | 140 | |
| 141 | - // return |
|
| 142 | - return $match; |
|
| 141 | + // return |
|
| 142 | + return $match; |
|
| 143 | 143 | |
| 144 | - } |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | /* |
@@ -216,17 +216,17 @@ discard block |
||
| 216 | 216 | if( acf_verify_nonce('options') ) { |
| 217 | 217 | |
| 218 | 218 | // save data |
| 219 | - if( acf_validate_save_post(true) ) { |
|
| 219 | + if( acf_validate_save_post(true) ) { |
|
| 220 | 220 | |
| 221 | - // get post_id (allow lang modification) |
|
| 222 | - $post_id = acf_get_valid_post_id($this->page['post_id']); |
|
| 221 | + // get post_id (allow lang modification) |
|
| 222 | + $post_id = acf_get_valid_post_id($this->page['post_id']); |
|
| 223 | 223 | |
| 224 | 224 | |
| 225 | - // set autoload |
|
| 226 | - acf_update_setting('autoload', $this->page['autoload']); |
|
| 225 | + // set autoload |
|
| 226 | + acf_update_setting('autoload', $this->page['autoload']); |
|
| 227 | 227 | |
| 228 | 228 | |
| 229 | - // save |
|
| 229 | + // save |
|
| 230 | 230 | acf_save_post( $post_id ); |
| 231 | 231 | |
| 232 | 232 | |
@@ -21,13 +21,13 @@ discard block |
||
| 21 | 21 | function __construct() { |
| 22 | 22 | |
| 23 | 23 | // actions |
| 24 | - add_action('admin_menu', array($this,'admin_menu'), 99, 0); |
|
| 24 | + add_action('admin_menu', array($this, 'admin_menu'), 99, 0); |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | // filters |
| 28 | - add_filter( 'acf/location/rule_types', array($this, 'rule_types'), 10, 1 ); |
|
| 29 | - add_filter( 'acf/location/rule_values/options_page', array($this, 'rule_values'), 10, 1 ); |
|
| 30 | - add_filter( 'acf/location/rule_match/options_page', array($this, 'rule_match'), 10, 3 ); |
|
| 28 | + add_filter('acf/location/rule_types', array($this, 'rule_types'), 10, 1); |
|
| 29 | + add_filter('acf/location/rule_values/options_page', array($this, 'rule_values'), 10, 1); |
|
| 30 | + add_filter('acf/location/rule_match/options_page', array($this, 'rule_match'), 10, 3); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | * @return {array} $choices |
| 44 | 44 | */ |
| 45 | 45 | |
| 46 | - function rule_types( $choices ) { |
|
| 46 | + function rule_types($choices) { |
|
| 47 | 47 | |
| 48 | - $choices[ __("Forms",'acf') ]['options_page'] = __("Options Page",'acf'); |
|
| 48 | + $choices[__("Forms", 'acf')]['options_page'] = __("Options Page", 'acf'); |
|
| 49 | 49 | |
| 50 | 50 | return $choices; |
| 51 | 51 | } |
@@ -63,18 +63,18 @@ discard block |
||
| 63 | 63 | * @return {array} $choices |
| 64 | 64 | */ |
| 65 | 65 | |
| 66 | - function rule_values( $choices ) { |
|
| 66 | + function rule_values($choices) { |
|
| 67 | 67 | |
| 68 | 68 | // vars |
| 69 | 69 | $pages = acf_get_options_pages(); |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | // populate |
| 73 | - if( !empty($pages) ) { |
|
| 73 | + if ( ! empty($pages)) { |
|
| 74 | 74 | |
| 75 | - foreach( $pages as $page ) { |
|
| 75 | + foreach ($pages as $page) { |
|
| 76 | 76 | |
| 77 | - $choices[ $page['menu_slug'] ] = $page['menu_title']; |
|
| 77 | + $choices[$page['menu_slug']] = $page['menu_title']; |
|
| 78 | 78 | |
| 79 | 79 | } |
| 80 | 80 | |
@@ -103,21 +103,21 @@ discard block |
||
| 103 | 103 | * @return $post_id (int) |
| 104 | 104 | */ |
| 105 | 105 | |
| 106 | - function rule_match( $match, $rule, $options ) { |
|
| 106 | + function rule_match($match, $rule, $options) { |
|
| 107 | 107 | |
| 108 | 108 | // vars |
| 109 | 109 | $options_page = false; |
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | // $options does not contain a default for "options_page" |
| 113 | - if( isset($options['options_page']) ) { |
|
| 113 | + if (isset($options['options_page'])) { |
|
| 114 | 114 | |
| 115 | 115 | $options_page = $options['options_page']; |
| 116 | 116 | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
| 120 | - if( !$options_page ) { |
|
| 120 | + if ( ! $options_page) { |
|
| 121 | 121 | |
| 122 | 122 | global $plugin_page; |
| 123 | 123 | |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | |
| 129 | 129 | // match |
| 130 | - if( $rule['operator'] == "==" ) { |
|
| 130 | + if ($rule['operator'] == "==") { |
|
| 131 | 131 | |
| 132 | - $match = ( $options_page === $rule['value'] ); |
|
| 132 | + $match = ($options_page === $rule['value']); |
|
| 133 | 133 | |
| 134 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 134 | + } elseif ($rule['operator'] == "!=") { |
|
| 135 | 135 | |
| 136 | - $match = ( $options_page !== $rule['value'] ); |
|
| 136 | + $match = ($options_page !== $rule['value']); |
|
| 137 | 137 | |
| 138 | 138 | } |
| 139 | 139 | |
@@ -164,29 +164,29 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | // create pages |
| 167 | - if( !empty($pages) ) { |
|
| 167 | + if ( ! empty($pages)) { |
|
| 168 | 168 | |
| 169 | - foreach( $pages as $page ) { |
|
| 169 | + foreach ($pages as $page) { |
|
| 170 | 170 | |
| 171 | 171 | // vars |
| 172 | 172 | $slug = ''; |
| 173 | 173 | |
| 174 | 174 | |
| 175 | - if( empty($page['parent_slug']) ) { |
|
| 175 | + if (empty($page['parent_slug'])) { |
|
| 176 | 176 | |
| 177 | 177 | // add page |
| 178 | - $slug = add_menu_page( $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], array($this, 'html'), $page['icon_url'], $page['position'] ); |
|
| 178 | + $slug = add_menu_page($page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], array($this, 'html'), $page['icon_url'], $page['position']); |
|
| 179 | 179 | |
| 180 | 180 | } else { |
| 181 | 181 | |
| 182 | 182 | // add page |
| 183 | - $slug = add_submenu_page( $page['parent_slug'], $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], array($this, 'html') ); |
|
| 183 | + $slug = add_submenu_page($page['parent_slug'], $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], array($this, 'html')); |
|
| 184 | 184 | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | // actions |
| 189 | - add_action("load-{$slug}", array($this,'admin_load')); |
|
| 189 | + add_action("load-{$slug}", array($this, 'admin_load')); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | } |
@@ -213,10 +213,10 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | |
| 215 | 215 | // verify and remove nonce |
| 216 | - if( acf_verify_nonce('options') ) { |
|
| 216 | + if (acf_verify_nonce('options')) { |
|
| 217 | 217 | |
| 218 | 218 | // save data |
| 219 | - if( acf_validate_save_post(true) ) { |
|
| 219 | + if (acf_validate_save_post(true)) { |
|
| 220 | 220 | |
| 221 | 221 | // get post_id (allow lang modification) |
| 222 | 222 | $post_id = acf_get_valid_post_id($this->page['post_id']); |
@@ -227,11 +227,11 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | |
| 229 | 229 | // save |
| 230 | - acf_save_post( $post_id ); |
|
| 230 | + acf_save_post($post_id); |
|
| 231 | 231 | |
| 232 | 232 | |
| 233 | 233 | // redirect |
| 234 | - wp_redirect( admin_url("admin.php?page={$plugin_page}&message=1") ); |
|
| 234 | + wp_redirect(admin_url("admin.php?page={$plugin_page}&message=1")); |
|
| 235 | 235 | exit; |
| 236 | 236 | |
| 237 | 237 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | |
| 246 | 246 | // actions |
| 247 | - add_action( 'acf/input/admin_head', array($this,'admin_head') ); |
|
| 247 | + add_action('acf/input/admin_head', array($this, 'admin_head')); |
|
| 248 | 248 | |
| 249 | 249 | } |
| 250 | 250 | |
@@ -271,34 +271,34 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | |
| 273 | 273 | // notices |
| 274 | - if( !empty($_GET['message']) && $_GET['message'] == '1' ) { |
|
| 274 | + if ( ! empty($_GET['message']) && $_GET['message'] == '1') { |
|
| 275 | 275 | |
| 276 | - acf_add_admin_notice( __("Options Updated",'acf') ); |
|
| 276 | + acf_add_admin_notice(__("Options Updated", 'acf')); |
|
| 277 | 277 | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if( empty($field_groups) ) { |
|
| 280 | + if (empty($field_groups)) { |
|
| 281 | 281 | |
| 282 | - acf_add_admin_notice(__("No Custom Field Groups found for this options page",'acf') . '. <a href="' . admin_url() . 'post-new.php?post_type=acf-field-group">' . __("Create a Custom Field Group",'acf') . '</a>', 'error'); |
|
| 282 | + acf_add_admin_notice(__("No Custom Field Groups found for this options page", 'acf').'. <a href="'.admin_url().'post-new.php?post_type=acf-field-group">'.__("Create a Custom Field Group", 'acf').'</a>', 'error'); |
|
| 283 | 283 | |
| 284 | 284 | } else { |
| 285 | 285 | |
| 286 | - foreach( $field_groups as $i => $field_group ) { |
|
| 286 | + foreach ($field_groups as $i => $field_group) { |
|
| 287 | 287 | |
| 288 | 288 | // vars |
| 289 | 289 | $id = "acf-{$field_group['key']}"; |
| 290 | 290 | $title = $field_group['title']; |
| 291 | 291 | $context = $field_group['position']; |
| 292 | 292 | $priority = 'high'; |
| 293 | - $args = array( 'field_group' => $field_group ); |
|
| 293 | + $args = array('field_group' => $field_group); |
|
| 294 | 294 | |
| 295 | 295 | |
| 296 | 296 | // tweaks to vars |
| 297 | - if( $context == 'acf_after_title' ) { |
|
| 297 | + if ($context == 'acf_after_title') { |
|
| 298 | 298 | |
| 299 | 299 | $context = 'normal'; |
| 300 | 300 | |
| 301 | - } elseif( $context == 'side' ) { |
|
| 301 | + } elseif ($context == 'side') { |
|
| 302 | 302 | |
| 303 | 303 | $priority = 'core'; |
| 304 | 304 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | |
| 312 | 312 | // add meta box |
| 313 | - add_meta_box( $id, $title, array($this, 'render_meta_box'), 'acf_options_page', $context, $priority, $args ); |
|
| 313 | + add_meta_box($id, $title, array($this, 'render_meta_box'), 'acf_options_page', $context, $priority, $args); |
|
| 314 | 314 | |
| 315 | 315 | |
| 316 | 316 | } |
@@ -335,11 +335,11 @@ discard block |
||
| 335 | 335 | * @return $post_id (int) |
| 336 | 336 | */ |
| 337 | 337 | |
| 338 | - function render_meta_box( $post, $args ) { |
|
| 338 | + function render_meta_box($post, $args) { |
|
| 339 | 339 | |
| 340 | 340 | // extract args |
| 341 | - extract( $args ); // all variables from the add_meta_box function |
|
| 342 | - extract( $args ); // all variables from the args argument |
|
| 341 | + extract($args); // all variables from the add_meta_box function |
|
| 342 | + extract($args); // all variables from the args argument |
|
| 343 | 343 | |
| 344 | 344 | |
| 345 | 345 | // vars |
@@ -360,19 +360,19 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | |
| 362 | 362 | // edit_url |
| 363 | - if( $field_group['ID'] && acf_current_user_can_admin() ) { |
|
| 363 | + if ($field_group['ID'] && acf_current_user_can_admin()) { |
|
| 364 | 364 | |
| 365 | - $o['edit_url'] = admin_url('post.php?post=' . $field_group['ID'] . '&action=edit'); |
|
| 365 | + $o['edit_url'] = admin_url('post.php?post='.$field_group['ID'].'&action=edit'); |
|
| 366 | 366 | |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | |
| 370 | 370 | // load fields |
| 371 | - $fields = acf_get_fields( $field_group ); |
|
| 371 | + $fields = acf_get_fields($field_group); |
|
| 372 | 372 | |
| 373 | 373 | |
| 374 | 374 | // render |
| 375 | - acf_render_fields( $post_id, $fields, 'div', $field_group['instruction_placement'] ); |
|
| 375 | + acf_render_fields($post_id, $fields, 'div', $field_group['instruction_placement']); |
|
| 376 | 376 | |
| 377 | 377 | |
| 378 | 378 | |
@@ -132,77 +132,77 @@ |
||
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | // validate |
| 135 | - if( empty($info) ) { |
|
| 135 | + if( empty($info) ) { |
|
| 136 | 136 | |
| 137 | - acf_add_admin_notice( __('<b>Error</b>. Could not connect to update server', 'acf'), 'error'); |
|
| 138 | - return; |
|
| 137 | + acf_add_admin_notice( __('<b>Error</b>. Could not connect to update server', 'acf'), 'error'); |
|
| 138 | + return; |
|
| 139 | 139 | |
| 140 | - } |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | 142 | |
| 143 | - // add info to view |
|
| 144 | - $this->view['remote_version'] = $info['version']; |
|
| 143 | + // add info to view |
|
| 144 | + $this->view['remote_version'] = $info['version']; |
|
| 145 | 145 | |
| 146 | 146 | |
| 147 | - // add changelog if the remote version is '>' than the current version |
|
| 147 | + // add changelog if the remote version is '>' than the current version |
|
| 148 | 148 | if( acf_pro_is_update_available() ) |
| 149 | - { |
|
| 150 | - $this->view['update_available'] = true; |
|
| 149 | + { |
|
| 150 | + $this->view['update_available'] = true; |
|
| 151 | 151 | |
| 152 | 152 | |
| 153 | - // changelog |
|
| 154 | - $changelogs = explode('<h4>', $info['changelog']); |
|
| 153 | + // changelog |
|
| 154 | + $changelogs = explode('<h4>', $info['changelog']); |
|
| 155 | 155 | |
| 156 | - foreach( $changelogs as $changelog ) |
|
| 157 | - { |
|
| 158 | - // validate (first segment is always empty due to explode) |
|
| 159 | - if( empty($changelog) ) |
|
| 160 | - { |
|
| 161 | - continue; |
|
| 162 | - } |
|
| 156 | + foreach( $changelogs as $changelog ) |
|
| 157 | + { |
|
| 158 | + // validate (first segment is always empty due to explode) |
|
| 159 | + if( empty($changelog) ) |
|
| 160 | + { |
|
| 161 | + continue; |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | 164 | |
| 165 | - // explode |
|
| 166 | - $changelog = explode('</h4>', $changelog); |
|
| 167 | - $changelog_version = trim($changelog[0]); |
|
| 168 | - $changelog_text = trim($changelog[1]); |
|
| 169 | - $changelog_text = str_replace('<ul>', '<ul class="ul-disc">', $changelog_text); |
|
| 165 | + // explode |
|
| 166 | + $changelog = explode('</h4>', $changelog); |
|
| 167 | + $changelog_version = trim($changelog[0]); |
|
| 168 | + $changelog_text = trim($changelog[1]); |
|
| 169 | + $changelog_text = str_replace('<ul>', '<ul class="ul-disc">', $changelog_text); |
|
| 170 | 170 | |
| 171 | - if( version_compare($this->view['remote_version'], $changelog_version, '==') ) |
|
| 172 | - { |
|
| 173 | - $this->view['changelog'] = $changelog_text; |
|
| 174 | - break; |
|
| 175 | - } |
|
| 171 | + if( version_compare($this->view['remote_version'], $changelog_version, '==') ) |
|
| 172 | + { |
|
| 173 | + $this->view['changelog'] = $changelog_text; |
|
| 174 | + break; |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - } |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | 179 | |
| 180 | - // upgrade_notice |
|
| 181 | - $upgrade_notices = explode('<h4>', $info['upgrade_notice']); |
|
| 180 | + // upgrade_notice |
|
| 181 | + $upgrade_notices = explode('<h4>', $info['upgrade_notice']); |
|
| 182 | 182 | |
| 183 | - foreach( $upgrade_notices as $upgrade_notice ) |
|
| 184 | - { |
|
| 185 | - // validate (first segment is always empty due to explode) |
|
| 186 | - if( empty($upgrade_notice) ) |
|
| 187 | - { |
|
| 188 | - continue; |
|
| 189 | - } |
|
| 183 | + foreach( $upgrade_notices as $upgrade_notice ) |
|
| 184 | + { |
|
| 185 | + // validate (first segment is always empty due to explode) |
|
| 186 | + if( empty($upgrade_notice) ) |
|
| 187 | + { |
|
| 188 | + continue; |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | 191 | |
| 192 | - // explode |
|
| 193 | - $upgrade_notice = explode('</h4>', $upgrade_notice); |
|
| 194 | - $upgrade_version = trim($upgrade_notice[0]); |
|
| 195 | - $upgrade_text = trim($upgrade_notice[1]); |
|
| 196 | - $upgrade_text = str_replace('<ul>', '<ul class="ul-disc">', $upgrade_text); |
|
| 192 | + // explode |
|
| 193 | + $upgrade_notice = explode('</h4>', $upgrade_notice); |
|
| 194 | + $upgrade_version = trim($upgrade_notice[0]); |
|
| 195 | + $upgrade_text = trim($upgrade_notice[1]); |
|
| 196 | + $upgrade_text = str_replace('<ul>', '<ul class="ul-disc">', $upgrade_text); |
|
| 197 | 197 | |
| 198 | - if( version_compare($this->view['current_version'], $upgrade_version, '<') ) |
|
| 199 | - { |
|
| 200 | - $this->view['upgrade_notice'] = $upgrade_text; |
|
| 201 | - break; |
|
| 202 | - } |
|
| 198 | + if( version_compare($this->view['current_version'], $upgrade_version, '<') ) |
|
| 199 | + { |
|
| 200 | + $this->view['upgrade_notice'] = $upgrade_text; |
|
| 201 | + break; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - } |
|
| 205 | - } |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | 207 | |
| 208 | 208 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | function __construct() { |
| 22 | 22 | |
| 23 | 23 | // actions |
| 24 | - add_action('admin_menu', array($this, 'admin_menu'), 20 ); |
|
| 24 | + add_action('admin_menu', array($this, 'admin_menu'), 20); |
|
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | // bail early if no show_admin |
| 49 | - if( !acf_get_setting('show_admin') ) { |
|
| 49 | + if ( ! acf_get_setting('show_admin')) { |
|
| 50 | 50 | |
| 51 | 51 | return; |
| 52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | // bail early if no show_updates |
| 57 | - if( !acf_get_setting('show_updates') ) { |
|
| 57 | + if ( ! acf_get_setting('show_updates')) { |
|
| 58 | 58 | |
| 59 | 59 | return; |
| 60 | 60 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | // bail early if not a plugin (included in theme) |
| 65 | - if( !is_plugin_active($basename) ) { |
|
| 65 | + if ( ! is_plugin_active($basename)) { |
|
| 66 | 66 | |
| 67 | 67 | return; |
| 68 | 68 | |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | // add page |
| 73 | - $page = add_submenu_page('edit.php?post_type=acf-field-group', __('Updates','acf'), __('Updates','acf'), acf_get_setting('capability'),'acf-settings-updates', array($this,'html') ); |
|
| 73 | + $page = add_submenu_page('edit.php?post_type=acf-field-group', __('Updates', 'acf'), __('Updates', 'acf'), acf_get_setting('capability'), 'acf-settings-updates', array($this, 'html')); |
|
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | // actions |
| 77 | - add_action('load-' . $page, array($this,'load')); |
|
| 77 | + add_action('load-'.$page, array($this, 'load')); |
|
| 78 | 78 | |
| 79 | 79 | } |
| 80 | 80 | |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | function load() { |
| 96 | 96 | |
| 97 | 97 | // $_POST |
| 98 | - if( acf_verify_nonce('activate_pro_licence') ) { |
|
| 98 | + if (acf_verify_nonce('activate_pro_licence')) { |
|
| 99 | 99 | |
| 100 | 100 | $this->activate_pro_licence(); |
| 101 | 101 | |
| 102 | - } elseif( acf_verify_nonce('deactivate_pro_licence') ) { |
|
| 102 | + } elseif (acf_verify_nonce('deactivate_pro_licence')) { |
|
| 103 | 103 | |
| 104 | 104 | $this->deactivate_pro_licence(); |
| 105 | 105 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | // license |
| 122 | - if( acf_pro_is_license_active() ) { |
|
| 122 | + if (acf_pro_is_license_active()) { |
|
| 123 | 123 | |
| 124 | 124 | $this->view['license'] = acf_pro_get_license(); |
| 125 | 125 | $this->view['active'] = 1; |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | // validate |
| 135 | - if( empty($info) ) { |
|
| 135 | + if (empty($info)) { |
|
| 136 | 136 | |
| 137 | - acf_add_admin_notice( __('<b>Error</b>. Could not connect to update server', 'acf'), 'error'); |
|
| 137 | + acf_add_admin_notice(__('<b>Error</b>. Could not connect to update server', 'acf'), 'error'); |
|
| 138 | 138 | return; |
| 139 | 139 | |
| 140 | 140 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | // add changelog if the remote version is '>' than the current version |
| 148 | - if( acf_pro_is_update_available() ) |
|
| 148 | + if (acf_pro_is_update_available()) |
|
| 149 | 149 | { |
| 150 | 150 | $this->view['update_available'] = true; |
| 151 | 151 | |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | // changelog |
| 154 | 154 | $changelogs = explode('<h4>', $info['changelog']); |
| 155 | 155 | |
| 156 | - foreach( $changelogs as $changelog ) |
|
| 156 | + foreach ($changelogs as $changelog) |
|
| 157 | 157 | { |
| 158 | 158 | // validate (first segment is always empty due to explode) |
| 159 | - if( empty($changelog) ) |
|
| 159 | + if (empty($changelog)) |
|
| 160 | 160 | { |
| 161 | 161 | continue; |
| 162 | 162 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $changelog_text = trim($changelog[1]); |
| 169 | 169 | $changelog_text = str_replace('<ul>', '<ul class="ul-disc">', $changelog_text); |
| 170 | 170 | |
| 171 | - if( version_compare($this->view['remote_version'], $changelog_version, '==') ) |
|
| 171 | + if (version_compare($this->view['remote_version'], $changelog_version, '==')) |
|
| 172 | 172 | { |
| 173 | 173 | $this->view['changelog'] = $changelog_text; |
| 174 | 174 | break; |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | // upgrade_notice |
| 181 | 181 | $upgrade_notices = explode('<h4>', $info['upgrade_notice']); |
| 182 | 182 | |
| 183 | - foreach( $upgrade_notices as $upgrade_notice ) |
|
| 183 | + foreach ($upgrade_notices as $upgrade_notice) |
|
| 184 | 184 | { |
| 185 | 185 | // validate (first segment is always empty due to explode) |
| 186 | - if( empty($upgrade_notice) ) |
|
| 186 | + if (empty($upgrade_notice)) |
|
| 187 | 187 | { |
| 188 | 188 | continue; |
| 189 | 189 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $upgrade_text = trim($upgrade_notice[1]); |
| 196 | 196 | $upgrade_text = str_replace('<ul>', '<ul class="ul-disc">', $upgrade_text); |
| 197 | 197 | |
| 198 | - if( version_compare($this->view['current_version'], $upgrade_version, '<') ) |
|
| 198 | + if (version_compare($this->view['current_version'], $upgrade_version, '<')) |
|
| 199 | 199 | { |
| 200 | 200 | $this->view['upgrade_notice'] = $upgrade_text; |
| 201 | 201 | break; |
@@ -258,13 +258,13 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | // connect |
| 261 | - $response = acf_pro_get_remote_response( 'activate-license', $args ); |
|
| 261 | + $response = acf_pro_get_remote_response('activate-license', $args); |
|
| 262 | 262 | |
| 263 | 263 | |
| 264 | 264 | // validate |
| 265 | - if( empty($response) ) { |
|
| 265 | + if (empty($response)) { |
|
| 266 | 266 | |
| 267 | - acf_add_admin_notice( __('<b>Connection Error</b>. Sorry, please try again', 'acf'), 'error'); |
|
| 267 | + acf_add_admin_notice(__('<b>Connection Error</b>. Sorry, please try again', 'acf'), 'error'); |
|
| 268 | 268 | return; |
| 269 | 269 | |
| 270 | 270 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | |
| 278 | 278 | // action |
| 279 | - if( $response['status'] == 1 ) { |
|
| 279 | + if ($response['status'] == 1) { |
|
| 280 | 280 | |
| 281 | 281 | acf_pro_update_license($response['license']); |
| 282 | 282 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | |
| 289 | 289 | |
| 290 | 290 | // show message |
| 291 | - if( $response['message'] ) { |
|
| 291 | + if ($response['message']) { |
|
| 292 | 292 | |
| 293 | 293 | acf_add_admin_notice($response['message'], $class); |
| 294 | 294 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | function deactivate_pro_licence() { |
| 314 | 314 | |
| 315 | 315 | // validate |
| 316 | - if( !acf_pro_is_license_active() ) { |
|
| 316 | + if ( ! acf_pro_is_license_active()) { |
|
| 317 | 317 | |
| 318 | 318 | return; |
| 319 | 319 | |
@@ -329,11 +329,11 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | |
| 331 | 331 | // connect |
| 332 | - $response = acf_pro_get_remote_response( 'deactivate-license', $args ); |
|
| 332 | + $response = acf_pro_get_remote_response('deactivate-license', $args); |
|
| 333 | 333 | |
| 334 | 334 | |
| 335 | 335 | // validate |
| 336 | - if( empty($response) ) { |
|
| 336 | + if (empty($response)) { |
|
| 337 | 337 | |
| 338 | 338 | acf_add_admin_notice(__('<b>Connection Error</b>. Sorry, please try again', 'acf'), 'error'); |
| 339 | 339 | return; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | |
| 353 | 353 | // action |
| 354 | - if( $response['status'] == 1 ) { |
|
| 354 | + if ($response['status'] == 1) { |
|
| 355 | 355 | |
| 356 | 356 | |
| 357 | 357 | |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | |
| 364 | 364 | |
| 365 | 365 | // show message |
| 366 | - if( $response['message'] ) { |
|
| 366 | + if ($response['message']) { |
|
| 367 | 367 | |
| 368 | 368 | acf_add_admin_notice($response['message'], $class); |
| 369 | 369 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | 'nonce' => 'options', |
| 19 | 19 | )); |
| 20 | 20 | |
| 21 | - wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
|
| 21 | + wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
|
| 22 | 22 | |
| 23 | 23 | ?> |
| 24 | 24 | |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | <!-- Update --> |
| 46 | 46 | <div id="submitdiv" class="postbox"> |
| 47 | 47 | |
| 48 | - <h3 class="hndle" style="border-bottom:none;"><span><?php _e("Publish",'acf'); ?></span></h3> |
|
| 48 | + <h3 class="hndle" style="border-bottom:none;"><span><?php _e("Publish", 'acf'); ?></span></h3> |
|
| 49 | 49 | |
| 50 | 50 | <div id="major-publishing-actions"> |
| 51 | 51 | |
| 52 | 52 | <div id="publishing-action"> |
| 53 | 53 | <span class="spinner"></span> |
| 54 | - <input type="submit" accesskey="p" value="<?php _e("Save Options",'acf'); ?>" class="button button-primary button-large" id="publish" name="publish"> |
|
| 54 | + <input type="submit" accesskey="p" value="<?php _e("Save Options", 'acf'); ?>" class="button button-primary button-large" id="publish" name="publish"> |
|
| 55 | 55 | </div> |
| 56 | 56 | |
| 57 | 57 | <div class="clear"></div> |
@@ -18,13 +18,13 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | <div class="acf-box"> |
| 20 | 20 | <div class="title"> |
| 21 | - <h3><?php echo acf_get_setting('name'); ?> <?php _e('License','acf') ?></h3> |
|
| 21 | + <h3><?php echo acf_get_setting('name'); ?> <?php _e('License', 'acf') ?></h3> |
|
| 22 | 22 | </div> |
| 23 | 23 | <div class="inner"> |
| 24 | - <p><?php _e("To unlock updates, please enter your license key below. If you don't have a licence key, please see",'acf'); ?> <a href="http://www.advancedcustomfields.com/pro" target="_blank"><?php _e('details & pricing', 'acf'); ?></a></p> |
|
| 24 | + <p><?php _e("To unlock updates, please enter your license key below. If you don't have a licence key, please see", 'acf'); ?> <a href="http://www.advancedcustomfields.com/pro" target="_blank"><?php _e('details & pricing', 'acf'); ?></a></p> |
|
| 25 | 25 | <form action="" method="post"> |
| 26 | 26 | <div class="acf-hidden"> |
| 27 | - <input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce( $nonce ); ?>" /> |
|
| 27 | + <input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce($nonce); ?>" /> |
|
| 28 | 28 | </div> |
| 29 | 29 | <table class="form-table"> |
| 30 | 30 | <tbody> |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | <label><?php _e('Update Available', 'acf'); ?></label> |
| 89 | 89 | </th> |
| 90 | 90 | <td> |
| 91 | - <?php if( $update_available ): ?> |
|
| 91 | + <?php if ($update_available): ?> |
|
| 92 | 92 | |
| 93 | 93 | <span style="margin-right: 5px;"><?php _e('Yes', 'acf'); ?></span> |
| 94 | 94 | |
| 95 | - <?php if( $active ): ?> |
|
| 95 | + <?php if ($active): ?> |
|
| 96 | 96 | <a class="acf-button blue" href="<?php echo admin_url('plugins.php?s=Advanced+Custom+Fields+Pro'); ?>"><?php _e('Update Plugin', 'acf'); ?></a> |
| 97 | 97 | <?php else: ?> |
| 98 | 98 | <a class="acf-button" disabled="disabled" href="#"><?php _e('Please enter your license key above to unlock updates', 'acf'); ?></a> |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | <?php endif; ?> |
| 106 | 106 | </td> |
| 107 | 107 | </tr> |
| 108 | - <?php if( $changelog ): ?> |
|
| 108 | + <?php if ($changelog): ?> |
|
| 109 | 109 | <tr> |
| 110 | 110 | <th> |
| 111 | 111 | <label><?php _e('Changelog', 'acf'); ?></label> |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | </td> |
| 116 | 116 | </tr> |
| 117 | 117 | <?php endif; ?> |
| 118 | - <?php if( $upgrade_notice ): ?> |
|
| 118 | + <?php if ($upgrade_notice): ?> |
|
| 119 | 119 | <tr> |
| 120 | 120 | <th> |
| 121 | 121 | <label><?php _e('Upgrade Notice', 'acf'); ?></label> |
@@ -94,13 +94,19 @@ |
||
| 94 | 94 | |
| 95 | 95 | <?php if( $active ): ?> |
| 96 | 96 | <a class="acf-button blue" href="<?php echo admin_url('plugins.php?s=Advanced+Custom+Fields+Pro'); ?>"><?php _e('Update Plugin', 'acf'); ?></a> |
| 97 | - <?php else: ?> |
|
| 98 | - <a class="acf-button" disabled="disabled" href="#"><?php _e('Please enter your license key above to unlock updates', 'acf'); ?></a> |
|
| 97 | + <?php else { |
|
| 98 | + : ?> |
|
| 99 | + <a class="acf-button" disabled="disabled" href="#"><?php _e('Please enter your license key above to unlock updates', 'acf'); |
|
| 100 | +} |
|
| 101 | +?></a> |
|
| 99 | 102 | <?php endif; ?> |
| 100 | 103 | |
| 101 | - <?php else: ?> |
|
| 104 | + <?php else { |
|
| 105 | + : ?> |
|
| 102 | 106 | |
| 103 | - <span style="margin-right: 5px;"><?php _e('No', 'acf'); ?></span> |
|
| 107 | + <span style="margin-right: 5px;"><?php _e('No', 'acf'); |
|
| 108 | +} |
|
| 109 | +?></span> |
|
| 104 | 110 | <a class="acf-button" href="<?php echo add_query_arg('force-check', 1); ?>"><?php _e('Check Again', 'acf'); ?></a> |
| 105 | 111 | <?php endif; ?> |
| 106 | 112 | </td> |
@@ -13,18 +13,18 @@ discard block |
||
| 13 | 13 | * @return $post_id (int) |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -function acf_get_valid_options_page( $page = '' ) { |
|
| 16 | +function acf_get_valid_options_page($page = '') { |
|
| 17 | 17 | |
| 18 | 18 | // allow for string |
| 19 | - if( empty($page) ) { |
|
| 19 | + if (empty($page)) { |
|
| 20 | 20 | |
| 21 | 21 | $page = array( |
| 22 | - 'page_title' => __('Options','acf'), |
|
| 23 | - 'menu_title' => __('Options','acf'), |
|
| 22 | + 'page_title' => __('Options', 'acf'), |
|
| 23 | + 'menu_title' => __('Options', 'acf'), |
|
| 24 | 24 | 'menu_slug' => 'acf-options', |
| 25 | 25 | ); |
| 26 | 26 | |
| 27 | - } elseif( is_string($page) ) { |
|
| 27 | + } elseif (is_string($page)) { |
|
| 28 | 28 | |
| 29 | 29 | $page_title = $page; |
| 30 | 30 | |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | 'parent' => 'parent_slug' |
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | - foreach( $migrate as $old => $new ) { |
|
| 61 | + foreach ($migrate as $old => $new) { |
|
| 62 | 62 | |
| 63 | - if( !empty($page[ $old ]) ) { |
|
| 63 | + if ( ! empty($page[$old])) { |
|
| 64 | 64 | |
| 65 | - $page[ $new ] = acf_extract_var( $page, $old ); |
|
| 65 | + $page[$new] = acf_extract_var($page, $old); |
|
| 66 | 66 | |
| 67 | 67 | } |
| 68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | // page_title (allows user to define page with just page_title or title) |
| 73 | - if( empty($page['menu_title']) ) { |
|
| 73 | + if (empty($page['menu_title'])) { |
|
| 74 | 74 | |
| 75 | 75 | $page['menu_title'] = $page['page_title']; |
| 76 | 76 | |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | // menu_slug |
| 81 | - if( empty($page['menu_slug']) ) { |
|
| 81 | + if (empty($page['menu_slug'])) { |
|
| 82 | 82 | |
| 83 | - $page['menu_slug'] = 'acf-options-' . sanitize_title( $page['menu_title'] ); |
|
| 83 | + $page['menu_slug'] = 'acf-options-'.sanitize_title($page['menu_title']); |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | * @return $post_id (int) |
| 105 | 105 | */ |
| 106 | 106 | |
| 107 | -function acf_get_options_page( $slug ) { |
|
| 107 | +function acf_get_options_page($slug) { |
|
| 108 | 108 | |
| 109 | 109 | // bail early if page doens't exist |
| 110 | - if( empty($GLOBALS['acf_options_pages'][ $slug ]) ) { |
|
| 110 | + if (empty($GLOBALS['acf_options_pages'][$slug])) { |
|
| 111 | 111 | |
| 112 | 112 | return false; |
| 113 | 113 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | // vars |
| 118 | - $page = $GLOBALS['acf_options_pages'][ $slug ]; |
|
| 118 | + $page = $GLOBALS['acf_options_pages'][$slug]; |
|
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | // filter for 3rd party customization |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | |
| 150 | 150 | // bail early if empty |
| 151 | - if( empty($GLOBALS['acf_options_pages']) ) { |
|
| 151 | + if (empty($GLOBALS['acf_options_pages'])) { |
|
| 152 | 152 | |
| 153 | 153 | return false; |
| 154 | 154 | |
@@ -162,18 +162,18 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | |
| 164 | 164 | // get pages |
| 165 | - foreach( $slugs as $slug ) { |
|
| 165 | + foreach ($slugs as $slug) { |
|
| 166 | 166 | |
| 167 | 167 | // append |
| 168 | - $pages[] = acf_get_options_page( $slug ); |
|
| 168 | + $pages[] = acf_get_options_page($slug); |
|
| 169 | 169 | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
| 173 | - foreach( $pages as $i => $page ) { |
|
| 173 | + foreach ($pages as $i => $page) { |
|
| 174 | 174 | |
| 175 | 175 | // bail early if is child |
| 176 | - if( !empty($page['parent_slug']) ) { |
|
| 176 | + if ( ! empty($page['parent_slug'])) { |
|
| 177 | 177 | |
| 178 | 178 | continue; |
| 179 | 179 | |
@@ -181,17 +181,17 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | // add missing position |
| 184 | - if( !$page['position']) { |
|
| 184 | + if ( ! $page['position']) { |
|
| 185 | 185 | |
| 186 | 186 | $_wp_last_utility_menu++; |
| 187 | 187 | |
| 188 | - $pages[ $i ]['position'] = $_wp_last_utility_menu; |
|
| 188 | + $pages[$i]['position'] = $_wp_last_utility_menu; |
|
| 189 | 189 | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | // bail early if no redirect |
| 194 | - if( empty($page['redirect']) ) { |
|
| 194 | + if (empty($page['redirect'])) { |
|
| 195 | 195 | |
| 196 | 196 | continue; |
| 197 | 197 | |
@@ -204,10 +204,10 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | // update children |
| 207 | - foreach( $pages as $j => $sub_page ) { |
|
| 207 | + foreach ($pages as $j => $sub_page) { |
|
| 208 | 208 | |
| 209 | 209 | // bail early if not child |
| 210 | - if( $sub_page['parent_slug'] !== $parent ) { |
|
| 210 | + if ($sub_page['parent_slug'] !== $parent) { |
|
| 211 | 211 | |
| 212 | 212 | continue; |
| 213 | 213 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | // update $child if empt |
| 218 | - if( empty($child) ) { |
|
| 218 | + if (empty($child)) { |
|
| 219 | 219 | |
| 220 | 220 | $child = $sub_page['menu_slug']; |
| 221 | 221 | |
@@ -223,15 +223,15 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | |
| 225 | 225 | // update parent_slug |
| 226 | - $pages[ $j ]['parent_slug'] = $child; |
|
| 226 | + $pages[$j]['parent_slug'] = $child; |
|
| 227 | 227 | |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | |
| 231 | 231 | // finally update parent menu_slug |
| 232 | - if( $child ) { |
|
| 232 | + if ($child) { |
|
| 233 | 233 | |
| 234 | - $pages[ $i ]['menu_slug'] = $child; |
|
| 234 | + $pages[$i]['menu_slug'] = $child; |
|
| 235 | 235 | |
| 236 | 236 | } |
| 237 | 237 | |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | * @return $post_id (int) |
| 258 | 258 | */ |
| 259 | 259 | |
| 260 | -function acf_update_options_page( $data ) { |
|
| 260 | +function acf_update_options_page($data) { |
|
| 261 | 261 | |
| 262 | 262 | // bail early if no menu_slug |
| 263 | - if( empty($data['menu_slug']) ) { |
|
| 263 | + if (empty($data['menu_slug'])) { |
|
| 264 | 264 | |
| 265 | 265 | return false; |
| 266 | 266 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | |
| 273 | 273 | // bail early if no page found |
| 274 | - if( empty($GLOBALS['acf_options_pages'][ $slug ]) ) { |
|
| 274 | + if (empty($GLOBALS['acf_options_pages'][$slug])) { |
|
| 275 | 275 | |
| 276 | 276 | return false; |
| 277 | 277 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | |
| 281 | 281 | // vars |
| 282 | - $page = $GLOBALS['acf_options_pages'][ $slug ]; |
|
| 282 | + $page = $GLOBALS['acf_options_pages'][$slug]; |
|
| 283 | 283 | |
| 284 | 284 | |
| 285 | 285 | // merge in data |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | |
| 289 | 289 | // update |
| 290 | - $GLOBALS['acf_options_pages'][ $slug ] = $page; |
|
| 290 | + $GLOBALS['acf_options_pages'][$slug] = $page; |
|
| 291 | 291 | |
| 292 | 292 | |
| 293 | 293 | // return |
@@ -309,16 +309,16 @@ discard block |
||
| 309 | 309 | * @return $post_id (int) |
| 310 | 310 | */ |
| 311 | 311 | |
| 312 | -if( ! function_exists('acf_add_options_page') ): |
|
| 312 | +if ( ! function_exists('acf_add_options_page')): |
|
| 313 | 313 | |
| 314 | -function acf_add_options_page( $page = '' ) { |
|
| 314 | +function acf_add_options_page($page = '') { |
|
| 315 | 315 | |
| 316 | 316 | // validate |
| 317 | - $page = acf_get_valid_options_page( $page ); |
|
| 317 | + $page = acf_get_valid_options_page($page); |
|
| 318 | 318 | |
| 319 | 319 | |
| 320 | 320 | // instantiate globals |
| 321 | - if( empty($GLOBALS['acf_options_pages']) ) { |
|
| 321 | + if (empty($GLOBALS['acf_options_pages'])) { |
|
| 322 | 322 | |
| 323 | 323 | $GLOBALS['acf_options_pages'] = array(); |
| 324 | 324 | |
@@ -326,15 +326,15 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | |
| 328 | 328 | // update if already exists |
| 329 | - if( acf_get_options_page($page['menu_slug']) ) { |
|
| 329 | + if (acf_get_options_page($page['menu_slug'])) { |
|
| 330 | 330 | |
| 331 | - return acf_update_options_page( $page ); |
|
| 331 | + return acf_update_options_page($page); |
|
| 332 | 332 | |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | |
| 336 | 336 | // append |
| 337 | - $GLOBALS['acf_options_pages'][ $page['menu_slug'] ] = $page; |
|
| 337 | + $GLOBALS['acf_options_pages'][$page['menu_slug']] = $page; |
|
| 338 | 338 | |
| 339 | 339 | |
| 340 | 340 | // return |
@@ -358,16 +358,16 @@ discard block |
||
| 358 | 358 | * @return $post_id (int) |
| 359 | 359 | */ |
| 360 | 360 | |
| 361 | -if( ! function_exists('acf_add_options_sub_page') ): |
|
| 361 | +if ( ! function_exists('acf_add_options_sub_page')): |
|
| 362 | 362 | |
| 363 | -function acf_add_options_sub_page( $page = '' ) { |
|
| 363 | +function acf_add_options_sub_page($page = '') { |
|
| 364 | 364 | |
| 365 | 365 | // validate |
| 366 | - $page = acf_get_valid_options_page( $page ); |
|
| 366 | + $page = acf_get_valid_options_page($page); |
|
| 367 | 367 | |
| 368 | 368 | |
| 369 | 369 | // parent |
| 370 | - if( !$page['parent_slug'] ) { |
|
| 370 | + if ( ! $page['parent_slug']) { |
|
| 371 | 371 | |
| 372 | 372 | // set parent slug |
| 373 | 373 | $page['parent_slug'] = 'acf-options'; |
@@ -376,9 +376,9 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | |
| 378 | 378 | // create default parent if not yet exists |
| 379 | - if( $page['parent_slug'] === 'acf-options' ) { |
|
| 379 | + if ($page['parent_slug'] === 'acf-options') { |
|
| 380 | 380 | |
| 381 | - if( !acf_get_options_page('acf-options') ) { |
|
| 381 | + if ( ! acf_get_options_page('acf-options')) { |
|
| 382 | 382 | |
| 383 | 383 | acf_add_options_page(); |
| 384 | 384 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | |
| 390 | 390 | // return |
| 391 | - return acf_add_options_page( $page ); |
|
| 391 | + return acf_add_options_page($page); |
|
| 392 | 392 | |
| 393 | 393 | } |
| 394 | 394 | |
@@ -408,9 +408,9 @@ discard block |
||
| 408 | 408 | * @return n/a |
| 409 | 409 | */ |
| 410 | 410 | |
| 411 | -if( ! function_exists('acf_set_options_page_title') ): |
|
| 411 | +if ( ! function_exists('acf_set_options_page_title')): |
|
| 412 | 412 | |
| 413 | -function acf_set_options_page_title( $title = 'Options' ) { |
|
| 413 | +function acf_set_options_page_title($title = 'Options') { |
|
| 414 | 414 | |
| 415 | 415 | acf_update_options_page(array( |
| 416 | 416 | 'menu_slug' => 'acf-options', |
@@ -436,9 +436,9 @@ discard block |
||
| 436 | 436 | * @return n/a |
| 437 | 437 | */ |
| 438 | 438 | |
| 439 | -if( ! function_exists('acf_set_options_page_menu') ): |
|
| 439 | +if ( ! function_exists('acf_set_options_page_menu')): |
|
| 440 | 440 | |
| 441 | -function acf_set_options_page_menu( $title = 'Options' ) { |
|
| 441 | +function acf_set_options_page_menu($title = 'Options') { |
|
| 442 | 442 | |
| 443 | 443 | acf_update_options_page(array( |
| 444 | 444 | 'menu_slug' => 'acf-options', |
@@ -463,9 +463,9 @@ discard block |
||
| 463 | 463 | * @return n/a |
| 464 | 464 | */ |
| 465 | 465 | |
| 466 | -if( ! function_exists('acf_set_options_page_capability') ): |
|
| 466 | +if ( ! function_exists('acf_set_options_page_capability')): |
|
| 467 | 467 | |
| 468 | -function acf_set_options_page_capability( $capability = 'edit_posts' ) { |
|
| 468 | +function acf_set_options_page_capability($capability = 'edit_posts') { |
|
| 469 | 469 | |
| 470 | 470 | acf_update_options_page(array( |
| 471 | 471 | 'menu_slug' => 'acf-options', |
@@ -490,11 +490,11 @@ discard block |
||
| 490 | 490 | * @return N/A |
| 491 | 491 | */ |
| 492 | 492 | |
| 493 | -if( ! function_exists('register_options_page') ): |
|
| 493 | +if ( ! function_exists('register_options_page')): |
|
| 494 | 494 | |
| 495 | -function register_options_page( $title = false ) { |
|
| 495 | +function register_options_page($title = false) { |
|
| 496 | 496 | |
| 497 | - acf_add_options_sub_page( $title ); |
|
| 497 | + acf_add_options_sub_page($title); |
|
| 498 | 498 | |
| 499 | 499 | } |
| 500 | 500 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | // append plugin information |
| 26 | 26 | // Note: is_admin() was used previously, however this prevents jetpack manage & ManageWP from working |
| 27 | - add_filter('plugins_api', array($this, 'inject_info'), 20, 3); |
|
| 27 | + add_filter('plugins_api', array($this, 'inject_info'), 20, 3); |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | // append update information |
@@ -59,33 +59,33 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | // validate |
| 62 | - if( isset($args->slug) && $args->slug == $slug ) { |
|
| 62 | + if( isset($args->slug) && $args->slug == $slug ) { |
|
| 63 | 63 | |
| 64 | - $info = acf_pro_get_remote_info(); |
|
| 65 | - $sections = acf_extract_vars($info, array( |
|
| 66 | - 'description', |
|
| 67 | - 'installation', |
|
| 68 | - 'changelog', |
|
| 69 | - 'upgrade_notice', |
|
| 70 | - )); |
|
| 64 | + $info = acf_pro_get_remote_info(); |
|
| 65 | + $sections = acf_extract_vars($info, array( |
|
| 66 | + 'description', |
|
| 67 | + 'installation', |
|
| 68 | + 'changelog', |
|
| 69 | + 'upgrade_notice', |
|
| 70 | + )); |
|
| 71 | 71 | |
| 72 | - $obj = new stdClass(); |
|
| 72 | + $obj = new stdClass(); |
|
| 73 | 73 | |
| 74 | - foreach( $info as $k => $v ) { |
|
| 74 | + foreach( $info as $k => $v ) { |
|
| 75 | 75 | |
| 76 | - $obj->$k = $v; |
|
| 76 | + $obj->$k = $v; |
|
| 77 | 77 | |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - $obj->sections = $sections; |
|
| 80 | + $obj->sections = $sections; |
|
| 81 | 81 | |
| 82 | - return $obj; |
|
| 82 | + return $obj; |
|
| 83 | 83 | |
| 84 | - } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | 86 | |
| 87 | - // return |
|
| 88 | - return $result; |
|
| 87 | + // return |
|
| 88 | + return $result; |
|
| 89 | 89 | |
| 90 | 90 | } |
| 91 | 91 | |
@@ -133,22 +133,22 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
| 136 | - // vars |
|
| 136 | + // vars |
|
| 137 | 137 | $info = acf_pro_get_remote_info(); |
| 138 | 138 | $basename = acf_get_setting('basename'); |
| 139 | 139 | $slug = acf_get_setting('slug'); |
| 140 | 140 | |
| 141 | 141 | |
| 142 | - // create new object for update |
|
| 143 | - $obj = new stdClass(); |
|
| 144 | - $obj->slug = $slug; |
|
| 145 | - $obj->plugin = $basename; |
|
| 146 | - $obj->new_version = $info['version']; |
|
| 147 | - $obj->url = $info['homepage']; |
|
| 148 | - $obj->package = ''; |
|
| 142 | + // create new object for update |
|
| 143 | + $obj = new stdClass(); |
|
| 144 | + $obj->slug = $slug; |
|
| 145 | + $obj->plugin = $basename; |
|
| 146 | + $obj->new_version = $info['version']; |
|
| 147 | + $obj->url = $info['homepage']; |
|
| 148 | + $obj->package = ''; |
|
| 149 | 149 | |
| 150 | 150 | |
| 151 | - // license |
|
| 151 | + // license |
|
| 152 | 152 | if( acf_pro_is_license_active() ) { |
| 153 | 153 | |
| 154 | 154 | $obj->package = acf_pro_get_remote_url('download', array( |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
| 164 | - // add to transient |
|
| 165 | - $transient->response[ $basename ] = $obj; |
|
| 164 | + // add to transient |
|
| 165 | + $transient->response[ $basename ] = $obj; |
|
| 166 | 166 | |
| 167 | 167 | |
| 168 | 168 | // return |
| 169 | - return $transient; |
|
| 169 | + return $transient; |
|
| 170 | 170 | |
| 171 | 171 | } |
| 172 | 172 | |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 3 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
| 4 | 4 | |
| 5 | -if( ! class_exists('acf_pro_updates') ) : |
|
| 5 | +if ( ! class_exists('acf_pro_updates')) : |
|
| 6 | 6 | |
| 7 | 7 | class acf_pro_updates { |
| 8 | 8 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | // add custom message when PRO not activated but update available |
| 35 | - add_action('in_plugin_update_message-' . acf_get_setting('basename'), array($this, 'in_plugin_update_message'), 10, 2 ); |
|
| 35 | + add_action('in_plugin_update_message-'.acf_get_setting('basename'), array($this, 'in_plugin_update_message'), 10, 2); |
|
| 36 | 36 | |
| 37 | 37 | } |
| 38 | 38 | |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | * @return $result |
| 53 | 53 | */ |
| 54 | 54 | |
| 55 | - function inject_info( $result, $action = null, $args = null ) { |
|
| 55 | + function inject_info($result, $action = null, $args = null) { |
|
| 56 | 56 | |
| 57 | 57 | // vars |
| 58 | 58 | $slug = acf_get_setting('slug'); |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | // validate |
| 62 | - if( isset($args->slug) && $args->slug == $slug ) { |
|
| 62 | + if (isset($args->slug) && $args->slug == $slug) { |
|
| 63 | 63 | |
| 64 | 64 | $info = acf_pro_get_remote_info(); |
| 65 | 65 | $sections = acf_extract_vars($info, array( |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $obj = new stdClass(); |
| 73 | 73 | |
| 74 | - foreach( $info as $k => $v ) { |
|
| 74 | + foreach ($info as $k => $v) { |
|
| 75 | 75 | |
| 76 | 76 | $obj->$k = $v; |
| 77 | 77 | |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | * @return $transient |
| 104 | 104 | */ |
| 105 | 105 | |
| 106 | - function inject_update( $transient ) { |
|
| 106 | + function inject_update($transient) { |
|
| 107 | 107 | |
| 108 | 108 | // vars |
| 109 | 109 | $basename = acf_get_setting('basename'); |
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | // bail early if no show_updates |
| 113 | - if( !acf_get_setting('show_updates') ) { |
|
| 113 | + if ( ! acf_get_setting('show_updates')) { |
|
| 114 | 114 | |
| 115 | 115 | return $transient; |
| 116 | 116 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | // bail early if not a plugin (included in theme) |
| 121 | - if( !is_plugin_active($basename) ) { |
|
| 121 | + if ( ! is_plugin_active($basename)) { |
|
| 122 | 122 | |
| 123 | 123 | return; |
| 124 | 124 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | // bail early if no update available |
| 129 | - if( !acf_pro_is_update_available() ) { |
|
| 129 | + if ( ! acf_pro_is_update_available()) { |
|
| 130 | 130 | |
| 131 | 131 | return $transient; |
| 132 | 132 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | // license |
| 152 | - if( acf_pro_is_license_active() ) { |
|
| 152 | + if (acf_pro_is_license_active()) { |
|
| 153 | 153 | |
| 154 | 154 | $obj->package = acf_pro_get_remote_url('download', array( |
| 155 | 155 | 'k' => acf_pro_get_license(), |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | |
| 164 | 164 | // add to transient |
| 165 | - $transient->response[ $basename ] = $obj; |
|
| 165 | + $transient->response[$basename] = $obj; |
|
| 166 | 166 | |
| 167 | 167 | |
| 168 | 168 | // return |
@@ -184,10 +184,10 @@ discard block |
||
| 184 | 184 | * @param {object} $r |
| 185 | 185 | */ |
| 186 | 186 | |
| 187 | - function in_plugin_update_message( $plugin_data, $r ) { |
|
| 187 | + function in_plugin_update_message($plugin_data, $r) { |
|
| 188 | 188 | |
| 189 | 189 | // validate |
| 190 | - if( acf_pro_is_license_active() ) { |
|
| 190 | + if (acf_pro_is_license_active()) { |
|
| 191 | 191 | |
| 192 | 192 | return; |
| 193 | 193 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | |
| 201 | 201 | // show message |
| 202 | - echo '<br />' . sprintf( $m, admin_url('edit.php?post_type=acf-field-group&page=acf-settings-updates'), 'http://www.advancedcustomfields.com/pro'); |
|
| 202 | + echo '<br />'.sprintf($m, admin_url('edit.php?post_type=acf-field-group&page=acf-settings-updates'), 'http://www.advancedcustomfields.com/pro'); |
|
| 203 | 203 | |
| 204 | 204 | } |
| 205 | 205 | |
@@ -1,6 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 3 | +if( ! defined( 'ABSPATH' ) ) { |
|
| 4 | + exit; |
|
| 5 | +} |
|
| 6 | +// Exit if accessed directly |
|
| 4 | 7 | |
| 5 | 8 | if( ! class_exists('acf_pro_updates') ) : |
| 6 | 9 | |