Plugin Directory

Changeset 3384881


Ignore:
Timestamp:
10/26/2025 11:23:47 PM (5 months ago)
Author:
ircary
Message:

2025.03

*Release Date - 26 October 2025*

  • Removed:
    • lct_acf_get_field_types()
    • lct_acf_get_field_label()
    • lct_acf_get_field_label_no_required()
    • lct_acf_get_field_group_of_field()
    • lct_acf_get_repeater_array()
    • lct_acf_get_repeater_array_keys()
    • lct_acf_get_repeater_array_key()
    • lct_acf_get_repeater_array_values()
    • lct_acf_get_repeater_array_value()
    • lct_acf_get_repeater_array_value_by_slug()
    • lct_acf_get_repeater()
    • lct_acf_get_imploded_repeater()
    • lct_acf_is_field_repeater()
    • lct_acf_is_field_clone()
    • lct_acf_is_field_seamless_clone()
    • lct_acf_is_repeater_subfield()
    • lct_get_dollar()
    • lct_get_un_dollar()
    • lct_get_dollar_wo_symbol()
    • lct_get_negative_number()
    • lct_get_negative_dollar()
    • lct_acf_public{}
Location:
lct-useful-shortcodes-functions/trunk
Files:
1 deleted
23 edited

Legend:

Unmodified
Added
Removed
  • lct-useful-shortcodes-functions/trunk/code/__init.php

    r3337494 r3384881  
    5656         * Globalized Classes
    5757         */
    58         /**
    59          * @var lct_acf_public
    60          * @since LCT 7.42
    61          */
    62         public $acf_public;
    6358        /**
    6459         * @var lct_acf_public_choices
  • lct-useful-shortcodes-functions/trunk/code/admin/taxonomies.php

    r3337494 r3384881  
    183183
    184184            $labels = [
    185                 'name'                       => $capitals,
    186                 'singular_name'              => $capital,
    187                 'menu_name'                  => $capitals,
    188                 'all_items'                  => "All {$capitals}",
    189                 'edit_item'                  => "Edit {$capital}",
    190                 'view_item'                  => "View {$capital}",
    191                 'update_item'                => "Update {$capital}",
    192                 'add_new_item'               => "Add New {$capital}",
    193                 'new_item_name'              => "New {$capital} Name",
    194                 'parent_item'                => "Parent {$capital}",
    195                 'parent_item_colon'          => "Parent {$capitals}:",
    196                 'search_items'               => "Search {$capitals}",
    197                 'popular_items'              => "Popular {$capitals}",
    198                 'separate_items_with_commas' => "Separate {$lowercases} with commas",
    199                 'add_or_remove_items'        => "Add or remove {$lowercases}",
    200                 'choose_from_most_used'      => "Choose from the most used {$lowercases}",
    201                 'not_found'                  => "No {$lowercases} found."
     185                    'name'                       => $capitals,
     186                    'singular_name'              => $capital,
     187                    'menu_name'                  => $capitals,
     188                    'all_items'                  => "All {$capitals}",
     189                    'edit_item'                  => "Edit {$capital}",
     190                    'view_item'                  => "View {$capital}",
     191                    'update_item'                => "Update {$capital}",
     192                    'add_new_item'               => "Add New {$capital}",
     193                    'new_item_name'              => "New {$capital} Name",
     194                    'parent_item'                => "Parent {$capital}",
     195                    'parent_item_colon'          => "Parent {$capitals}:",
     196                    'search_items'               => "Search {$capitals}",
     197                    'popular_items'              => "Popular {$capitals}",
     198                    'separate_items_with_commas' => "Separate {$lowercases} with commas",
     199                    'add_or_remove_items'        => "Add or remove {$lowercases}",
     200                    'choose_from_most_used'      => "Choose from the most used {$lowercases}",
     201                    'not_found'                  => "No {$lowercases} found."
    202202            ];
    203203
     
    273273         * @unused   param $class
    274274         * @since    0.0
    275          * @verified 2025.04.02
     275         * @verified 2025.09.06
    276276         */
    277277        function register_post_status( $taxonomy, $post_types )
    278278        {
    279279            if (
    280                 empty( $post_types )
    281                 || //If a post_type(s) is not set
    282                 ! lct_plugin_active( 'acf' )
    283                 || //If ACF is not installed
    284                 ! lct_is_status_taxonomy( $taxonomy ) //If the taxonomy is not a status taxonomy
     280                    empty( $post_types ) //If a post_type(s) is not set
     281                    || ! lct_plugin_active( 'acf' ) //If ACF is not installed
     282                    || ! lct_is_status_taxonomy( $taxonomy ) //If the taxonomy is not a status taxonomy
    285283            ) {
    286284                return;
     
    289287
    290288            $cache_key    = function_exists( 'afwp_cache_key' )
    291                 ? afwp_cache_key( afwp_cache_vars( $taxonomy ) ) : lct_cache_key( compact( 'taxonomy' ) );
     289                    ? afwp_cache_key( afwp_cache_vars( $taxonomy ) ) : lct_cache_key( compact( 'taxonomy' ) );
    292290            $update_terms = false;
    293291
    294292
    295293            if ( ( $terms_to_register = get_transient( $cache_key ) ) === false ) {
    296                 $tax_args = [
    297                     'taxonomy'          => $taxonomy,
    298                     'hide_empty'        => false,
    299                     'hierarchical'      => true,
    300                     'lct:::tax_disable' => true,
     294                $terms_to_register = [];
     295                $tax_args          = [
     296                        'taxonomy'          => $taxonomy,
     297                        'hide_empty'        => false,
     298                        'hierarchical'      => true,
     299                        'lct:::tax_disable' => true,
    301300                ];
    302                 $terms    = get_terms( $tax_args );
     301                $terms             = get_terms( $tax_args );
    303302
    304303
     
    363362
    364363                    $terms_to_register[] = [
    365                         'slug'       => $slug,
    366                         'args'       => $args,
    367                         'post_types' => $post_types,
     364                            'slug'       => $slug,
     365                            'args'       => $args,
     366                            'post_types' => $post_types,
    368367                    ];
    369368                }
     
    398397
    399398            if (
    400                 lct_wp_admin_non_ajax()
    401                 && in_array( $pagenow, [ 'post.php', 'post-new.php' ] )
    402                 && lct_get_setting( 'post_types_w_statuses', [] )
     399                    lct_wp_admin_non_ajax()
     400                    && in_array( $pagenow, [ 'post.php', 'post-new.php' ] )
     401                    && lct_get_setting( 'post_types_w_statuses', [] )
    403402            ) {
    404403                add_action( "admin_footer-{$pagenow}", [ $this, 'extend_submitdiv_post_status' ] );
     
    407406
    408407            if (
    409                 lct_wp_admin_non_ajax()
    410                 && $pagenow === 'edit.php'
    411                 && ! empty( $_GET['post_type'] )
    412                 && ( $post_types_w_statuses = lct_get_setting( 'post_types_w_statuses', [] ) )
    413                 && in_array( $_GET['post_type'], $post_types_w_statuses )
     408                    lct_wp_admin_non_ajax()
     409                    && $pagenow === 'edit.php'
     410                    && ! empty( $_GET['post_type'] )
     411                    && ( $post_types_w_statuses = lct_get_setting( 'post_types_w_statuses', [] ) )
     412                    && in_array( $_GET['post_type'], $post_types_w_statuses )
    414413            ) {
    415414                add_action( "admin_footer-{$pagenow}", [ $this, 'extend_quick_edit_post_status' ] );
     
    432431            //Abort if we're on the wrong post type, but only if we have a restriction
    433432            if (
    434                 empty( $post_type )
    435                 || (
    436                     ( $post_types_w_statuses = lct_get_setting( 'post_types_w_statuses', [] ) )
    437                     && ! in_array( $post_type, $post_types_w_statuses )
    438                 )
     433                    empty( $post_type )
     434                    || (
     435                            ( $post_types_w_statuses = lct_get_setting( 'post_types_w_statuses', [] ) )
     436                            && ! in_array( $post_type, $post_types_w_statuses )
     437                    )
    439438            ) {
    440439                return;
     
    450449            foreach ( $wp_post_statuses as $status ) {
    451450                if (
    452                     ! $status->_builtin
    453                     && isset( $status->post_types )
    454                     && in_array( $post_type, $status->post_types )
     451                        ! $status->_builtin
     452                        && isset( $status->post_types )
     453                        && in_array( $post_type, $status->post_types )
    455454                ) {
    456455                    //Match against the current posts status
     
    516515            foreach ( $wp_post_statuses as $status ) {
    517516                if (
    518                     ! $status->_builtin
    519                     && isset( $status->post_types )
    520                     && in_array( $post_type, $status->post_types )
     517                        ! $status->_builtin
     518                        && isset( $status->post_types )
     519                        && in_array( $post_type, $status->post_types )
    521520                ) {
    522521                    //Match against the current posts status
     
    551550
    552551            if (
    553                 ! lct_plugin_active( 'afwp' )
    554                 && lct_is_status_taxonomy( $current_screen->taxonomy )
     552                    ! lct_plugin_active( 'afwp' )
     553                    && lct_is_status_taxonomy( $current_screen->taxonomy )
    555554            ) { //If the taxonomy is a status taxonomy ?>
    556555                <style>
     
    590589
    591590            if (
    592                 ! lct_plugin_active( 'afwp' )
    593                 && lct_is_status_taxonomy( $current_screen->taxonomy )
     591                    ! lct_plugin_active( 'afwp' )
     592                    && lct_is_status_taxonomy( $current_screen->taxonomy )
    594593            ) { //If the taxonomy is a status taxonomy ?>
    595594                <style>
     
    624623        {
    625624            if (
    626                 ( $bt = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 5 ) )
    627                 && isset( $bt[4]['function'] )
    628                 && in_array( $bt[4]['function'], [ 'acf_get_post_title', 'register_and_do_post_meta_boxes' ] )
     625                    ( $bt = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 5 ) )
     626                    && isset( $bt[4]['function'] )
     627                    && in_array( $bt[4]['function'], [ 'acf_get_post_title', 'register_and_do_post_meta_boxes' ] )
    629628            ) {
    630629                switch ( $bt[4]['function'] ) {
    631630                    case 'acf_get_post_title':
    632631                        if (
    633                             function_exists( 'afwp_cache_key' )
    634                             && ( $cache_key = afwp_cache_key( afwp_cache_vars( 'replace_func', 'lct_taxonomies::register_post_status', $post->post_type . '_status' ) ) )
    635                             && ( $terms_to_register = get_transient( $cache_key ) )
    636                             && ( $terms_to_register = array_column( $terms_to_register, 'slug' ) )
    637                             && in_array( $post_status, $terms_to_register )
     632                                function_exists( 'afwp_cache_key' )
     633                                && ( $cache_key = afwp_cache_key( afwp_cache_vars( 'replace_func', 'lct_taxonomies::register_post_status', $post->post_type . '_status' ) ) )
     634                                && ( $terms_to_register = get_transient( $cache_key ) )
     635                                && ( $terms_to_register = array_column( $terms_to_register, 'slug' ) )
     636                                && in_array( $post_status, $terms_to_register )
    638637                        ) {
    639638                            $post_status = 'publish';
  • lct-useful-shortcodes-functions/trunk/code/api/_helpers.php

    r3337494 r3384881  
    945945 * @return array
    946946 * @since    LCT 7.3
    947  * @verified 2020.07.02
     947 * @verified 2025.07.31
    948948 */
    949949function lct_pder_get_email_template( $post_id, $template )
     
    969969            'slug'         => $template,
    970970        ];
    971     } else {
    972         if (
    973             ( $selector = zxzacf( 'email-reminder_templates' ) )
    974             && ( $repeater = lct_acf_get_repeater_array( $selector, $post_id ) )
    975             && ! empty( $repeater[ $template ] )
    976             && ( $r = $repeater[ $template ] )
    977         ) {
    978             if ( ! empty( $r['users_to'] ) ) {
    979                 $r['users_to_users'] = $r['users_to'];
    980                 $r['users_to']       = [];
    981 
    982 
    983                 foreach ( $r['users_to_users'] as $user ) {
    984                     $r['users_to'][] = $user->user_email;
    985                 }
    986 
    987 
    988                 $r['users_to_str'] = implode( ',', $r['users_to'] );
     971    } elseif ( $r = afwp_acf_repeater_array_row( 'lct:::email-reminder_templates', $post_id, $template, 'slug' ) ) {
     972        if ( ! empty( $r['users_to'] ) ) {
     973            $r['users_to_users'] = $r['users_to'];
     974            $r['users_to']       = [];
     975
     976
     977            foreach ( $r['users_to_users'] as $user ) {
     978                $r['users_to'][] = $user->user_email;
    989979            }
    990980
    991981
    992             $r['queue_delay'] = (float) $r['queue_delay'];
    993         }
     982            $r['users_to_str'] = implode( ',', $r['users_to'] );
     983        }
     984
     985
     986        $r['queue_delay'] = (float) $r['queue_delay'];
    994987    }
    995988
  • lct-useful-shortcodes-functions/trunk/code/api/class.php

    r3337494 r3384881  
    595595        global $wpdb;
    596596
    597         $fields = lct_acf_get_field_groups_fields( [ 'options_page' => true ] );
     597        $fields = afwp_acf_get_fields_of_groups( [ 'options_page' => true ] );
    598598
    599599
  • lct-useful-shortcodes-functions/trunk/code/api/deprecated_functions.php

    r3337494 r3384881  
    662662
    663663
    664         $fields = lct_acf_get_field_groups_fields( $args );
     664        $fields = afwp_acf_get_fields_of_groups( $args );
    665665
    666666
     
    766766
    767767    if ( ! $success ) {
    768         $fields = lct_acf_get_field_groups_fields( [ 'taxonomy' => $taxonomy ] );
     768        $fields = afwp_acf_get_fields_of_groups( [ 'taxonomy' => $taxonomy ] );
    769769
    770770
     
    804804
    805805    if ( $user_id ) {
    806         $fields = lct_acf_get_field_groups_fields( [ 'user_id' => $user_id ] );
     806        $fields = afwp_acf_get_fields_of_groups( [ 'user_id' => $user_id ] );
    807807
    808808
  • lct-useful-shortcodes-functions/trunk/code/api/get.php

    r3337494 r3384881  
    205205{
    206206    return 'options';
    207 }
    208 
    209 
    210 /**
    211  * Turn a value into a dollar amount
    212  *
    213  * @param float|string|int $value
    214  * @param bool             $format_value
    215  *
    216  * @return string|float
    217  * @since    7.63
    218  * @verified 2024.04.24
    219  */
    220 function lct_get_dollar( $value, $format_value = true )
    221 {
    222     $amount = lct_get_un_dollar( $value );
    223 
    224 
    225     if ( $format_value ) {
    226         $amount = number_format( $amount, 2 );
    227         if ( $amount < 0 ) {
    228             $amount = '- $' . str_replace( '-', '', $amount );
    229         } else {
    230             $amount = '$' . $amount;
    231         }
    232     }
    233 
    234 
    235     return $amount;
    236 }
    237 
    238 
    239 /**
    240  * Turn a dollar value into a float amount
    241  *
    242  * @param float|string|int $value
    243  *
    244  * @return float
    245  * @since    7.63
    246  * @verified 2024.04.24
    247  */
    248 function lct_get_un_dollar( $value )
    249 {
    250     $value = str_replace( [ '$', ',', ' ', '%' ], '', $value );
    251     is_numeric( $value ) ? : $value = 0.0;
    252 
    253 
    254     $amount = (float) $value;
    255 
    256 
    257     return round( $amount, 2 );
    258 }
    259 
    260 
    261 /**
    262  * Turn a value into a dollar amount
    263  *
    264  * @param $value
    265  *
    266  * @return string
    267  * @since    2019.1
    268  * @verified 2024.04.24
    269  */
    270 function lct_get_dollar_wo_symbol( $value )
    271 {
    272     return lct_get_dollar( $value, false );
    273 }
    274 
    275 
    276 /**
    277  * Turn a number into a negative one, or positive if it is already negative
    278  *
    279  * @param $value
    280  *
    281  * @return float
    282  * @since    2018.11
    283  * @verified 2018.02.08
    284  */
    285 function lct_get_negative_number( $value )
    286 {
    287     $value = lct_get_un_dollar( $value );
    288 
    289 
    290     if ( $value ) {
    291         $value = $value * - 1;
    292     }
    293 
    294 
    295     return (float) $value;
    296 }
    297 
    298 
    299 /**
    300  * Turn a dollar amount into a negative one, or positive if it is already negative
    301  *
    302  * @param $value
    303  *
    304  * @return string
    305  * @since    2018.11
    306  * @verified 2018.02.08
    307  */
    308 function lct_get_negative_dollar( $value )
    309 {
    310     $value = lct_get_negative_number( $value );
    311 
    312 
    313     return lct_get_dollar( $value );
    314207}
    315208
  • lct-useful-shortcodes-functions/trunk/code/features/access.php

    r3337494 r3384881  
    14671467         * Vars
    14681468         */
    1469         $viewonly          = zxzu( 'viewonly' );
     1469        $viewonly          = 'lct_viewonly';
    14701470        $already_processed = lct_get_later( 'acf_render_field_viewonly_fields', '', [] );
    14711471
     
    14891489
    14901490        if (
    1491             $field['type'] === 'repeater'
     1491            afwp_acf_field_element( $field, $viewonly )
     1492            && afwp_acf_is_field_repeater( $field )
    14921493            && ! empty( $field[ $viewonly ] )
    14931494        ) {
     
    15431544            } elseif (
    15441545                ! empty( $field['type'] )
    1545                 && $field['type'] !== 'repeater'
     1546                && ! afwp_acf_is_field_repeater( $field )
    15461547            ) {
    15471548                echo '<script>jQuery( \'' . $js_selector . '\').attr( \'disabled\', true );</script>';
  • lct-useful-shortcodes-functions/trunk/code/features/shortcodes/file_processor.php

    r2894473 r3384881  
    8585     * @return bool|string
    8686     */
    87     function processor(
    88         $a,
    89         /** @noinspection PhpUnusedParameterInspection */
    90         $content = null,
    91         $shortcode
    92     ) {
     87    function processor( $a, $content = null, $shortcode = null )
     88    {
    9389        if ( empty( $a['file'] ) ) {
    9490            return false;
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/_loaded.php

    r3337494 r3384881  
    134134     * @date     2023.05.17
    135135     * @since    2023.02
    136      * @verified 2025.03.31
     136     * @verified 2025.10.13
    137137     */
    138138    function prepare_fields_for_import_store()
    139139    {
    140         if ( ! get_transient( 'afwp_acf_loaded_references' ) ) {
     140        if (
     141            ! ( $tmp = get_transient( 'afwp_acf_loaded_references' ) )
     142            || (
     143                ! empty( $tmp['count_key'] )
     144                && ! empty( $this->references['count_key'] )
     145                && count( $tmp['count_key'] ) < count( $this->references['count_key'] )
     146            )
     147        ) {
    141148            set_transient( 'afwp_acf_loaded_references', $this->references, MONTH_IN_SECONDS );
    142149        }
     
    450457    function load_references()
    451458    {
    452         if ( ! isset( $this->references['keys'] ) ) {
    453             $this->references = get_transient( 'afwp_acf_loaded_references' );
     459        if (
     460            ! isset( $this->references['keys'] )
     461            && ( $tmp = get_transient( 'afwp_acf_loaded_references' ) )
     462        ) {
     463            $this->references = $tmp;
    454464        }
    455465
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/api/_helpers.php

    r3337494 r3384881  
    357357
    358358/**
    359  * Get an LCT field type list
    360  *
    361  * @param null $list
    362  * @param null $field
    363  * @param null $array_key
    364  *
    365  * @return array
    366  * @since    2017.83
    367  * @verified 2018.02.20
    368  */
    369 function lct_acf_get_field_types( $list = null, $field = null, $array_key = null )
    370 {
    371     if ( $list ) {
    372         $r = lct_get_setting( 'field_types_' . $list, [] );
    373     } else {
    374         $r = lct_get_setting( 'field_types', [] );
    375     }
    376 
    377 
    378     if (
    379         ! empty( $r )
    380         && $field
    381     ) {
    382         /**
    383          * Return early if cache is found
    384          */
    385         $cache_key = lct_cache_key( compact( 'list', 'field', 'array_key' ) );
    386         if ( lct_isset_cache( $cache_key ) ) {
    387             return lct_get_cache( $cache_key );
    388         }
    389 
    390 
    391         foreach ( $r as $k => $v ) {
    392             if ( $array_key ) {
    393                 $r[ $k ] = $v->$field[ $array_key ];
    394             } else {
    395                 $r[ $k ] = $v->$field;
    396             }
    397         }
    398 
    399 
    400         /**
    401          * Save the value to the cache
    402          */
    403         lct_set_cache( $cache_key, $r );
    404     }
    405 
    406 
    407     return $r;
    408 }
    409 
    410 
    411 /**
    412  * Get the ACF label of a selector
    413  *
    414  * @param string $selector
    415  * @param int    $post_id
    416  *
    417  * @return string
    418  * @since        2018.11
    419  * @verified     2018.10.08
    420  */
    421 function lct_acf_get_field_label( $selector, $post_id )
    422 {
    423     $r = '';
    424 
    425 
    426     if ( $obj = get_field_object( $selector, $post_id, false, false ) ) {
    427         $r = acf_get_field_label( $obj );
    428     }
    429 
    430 
    431     return $r;
    432 }
    433 
    434 
    435 /**
    436  * Get a label of a selector, don't include any required suffix
    437  *
    438  * @param string $selector
    439  * @param int    $post_id
    440  *
    441  * @return string
    442  * @since    2018.11
    443  * @verified 2018.02.07
    444  */
    445 function lct_acf_get_field_label_no_required( $selector, $post_id = false )
    446 {
    447     $r   = '';
    448     $obj = get_field_object( $selector, $post_id, false, false );
    449 
    450 
    451     if ( $obj ) {
    452         $obj['required'] = false;
    453 
    454 
    455         $r = acf_get_field_label( $obj );
    456     }
    457 
    458 
    459     return $r;
    460 }
    461 
    462 
    463 /**
    464359 * Get the post_id for a field
    465360 *
     
    934829function lct_acf_validate_subfield_parent( $field, $allowed_parents, $post_id = false )
    935830{
    936     if ( ! lct_acf_is_repeater_subfield( $field ) ) {
     831    if ( ! afwp_acf_is_repeater_subfield( $field ) ) {
    937832        return false;
    938833    }
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/api/form.php

    r3337494 r3384881  
    959959    $post_id = $field['post_id'] = lct_get_field_post_id( $field, $post_id );
    960960    if (
    961         $field['type'] === 'repeater'
     961        afwp_acf_is_field_repeater( $field )
    962962        && ! isset( $raw_value[0] )
    963963    ) {
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/api/get.php

    r3337494 r3384881  
    187187
    188188/**
    189  * Returns an array of all sub_fields of an ACF Repeater field array
    190  * You can set the key of each element to a desired $sub_field_key of the ACF Repeater, otherwise it will be the first
    191  *
    192  * @param string $selector
    193  * @param int    $post_id
    194  * @param string $sub_field_key
    195  * @param int    $max_count
    196  *
    197  * @return array
    198  * @since    2017.58
    199  * @verified 2019.01.16
    200  */
    201 function lct_acf_get_repeater_array( $selector, $post_id, $sub_field_key = null, $max_count = 0 )
    202 {
    203     /**
    204      * Return early if cache is found
    205      */
    206     $cache_key = lct_cache_key( compact( 'selector', 'post_id', 'sub_field_key', 'max_count' ) );
    207     if ( lct_isset_cache( $cache_key ) ) {
    208         return lct_get_cache( $cache_key );
    209     }
    210 
    211 
    212     $r   = [];
    213     $row = 1;
    214 
    215 
    216     if (
    217         ( $repeater = get_field( $selector, $post_id ) )
    218         && ! empty( $repeater )
    219     ) {
    220         /**
    221          * Set the key to the first repeater field if it is not set
    222          */
    223         if ( ! $sub_field_key ) {
    224             $sub_field_key = key( $repeater[0] );
    225         }
    226 
    227 
    228         /**
    229          * Build the array
    230          */
    231         foreach ( $repeater as $row_data ) {
    232             $return_key = null;
    233 
    234             if ( isset( $row_data[ $sub_field_key ] ) ) {
    235                 $return_key = $row_data[ $sub_field_key ];
    236             }
    237 
    238 
    239             foreach ( $row_data as $data_key => $data ) {
    240                 /**
    241                  * Term Objects
    242                  */
    243                 if ( lct_is_a( $data, 'WP_Term' ) ) {
    244                     if ( $data_key === 'status' ) //We have to have this for some old compatibility
    245                     {
    246                         $row_data[ $data_key . lct_pre_us( 'term_id' ) ] = $data->term_id;
    247                     }
    248                     $row_data['term_id'] = $data->term_id;
    249 
    250 
    251                     if ( is_object( $row_data[ $sub_field_key ] ) ) {
    252                         $return_key = $data->term_id;
    253                     }
    254 
    255 
    256                     /**
    257                      * Post Objects
    258                      */
    259                 } elseif ( lct_is_a( $data, 'WP_Post' ) ) {
    260                     $row_data['ID'] = $data->ID;
    261 
    262 
    263                     if ( is_object( $row_data[ $sub_field_key ] ) ) {
    264                         $return_key = $data->ID;
    265                     }
    266                 }
    267             }
    268 
    269 
    270             if (
    271                 $return_key === null
    272                 && isset( $row_data[ $sub_field_key ] )
    273             ) {
    274                 $return_key = $row_data[ $sub_field_key ];
    275             }
    276 
    277 
    278             $r[ $return_key ] = $row_data;
    279 
    280 
    281             /**
    282              * Stop if we reach max_count
    283              */
    284             if (
    285                 $max_count
    286                 && $row >= $max_count
    287             ) {
    288                 break;
    289             }
    290 
    291 
    292             $row ++;
    293         }
    294     }
    295 
    296 
    297     /**
    298      * Save the value to the cache
    299      */
    300     lct_set_cache( $cache_key, $r );
    301 
    302 
    303     return $r;
    304 }
    305 
    306 
    307 /**
    308  * Returns the keys of each element of an ACF Repeater field array
    309  * You can set the $sub_field_key of the ACF Repeater you would like returned, otherwise it will return the first
    310  *
    311  * @param string $selector
    312  * @param int    $post_id
    313  * @param string $sub_field_key
    314  * @param int    $max_count
    315  *
    316  * @return array
    317  * @since    2017.83
    318  * @verified 2019.01.10
    319  */
    320 function lct_acf_get_repeater_array_keys( $selector, $post_id, $sub_field_key = null, $max_count = 0 )
    321 {
    322     if (
    323         ( $r = lct_acf_get_repeater_array( $selector, $post_id, $sub_field_key, $max_count ) )
    324         && ! empty( $r )
    325     ) {
    326         $r = array_keys( $r );
    327     }
    328 
    329 
    330     return $r;
    331 }
    332 
    333 
    334 /**
    335  * Returns the key of a specific ($sub_field_index) indexed element of an ACF Repeater field array
    336  * You can set the $sub_field_key of the ACF Repeater you would like returned, otherwise it will return the first
    337  *
    338  * @param string $selector
    339  * @param int    $post_id
    340  * @param string $sub_field_key
    341  * @param int    $sub_field_index
    342  *
    343  * @return string|mixed
    344  * @since    2018.59
    345  * @verified 2019.01.10
    346  */
    347 function lct_acf_get_repeater_array_key( $selector, $post_id, $sub_field_key = null, $sub_field_index = 0 )
    348 {
    349     $r = null;
    350 
    351 
    352     if (
    353         ( $keys = lct_acf_get_repeater_array_keys( $selector, $post_id, $sub_field_key ) )
    354         && ! empty( $keys[ $sub_field_index ] )
    355     ) {
    356         $r = $keys[ $sub_field_index ];
    357     }
    358 
    359 
    360     return $r;
    361 }
    362 
    363 
    364 /**
    365  * Returns the values of each element of an ACF Repeater field array
    366  * You can set the $sub_field_key of the ACF Repeater you would like returned, otherwise it will return the first
    367  *
    368  * @param string $selector
    369  * @param int    $post_id
    370  * @param string $sub_field
    371  * @param string $sub_field_key
    372  * @param int    $max_count
    373  *
    374  * @return array
    375  * @since    2019.1
    376  * @verified 2019.04.09
    377  */
    378 function lct_acf_get_repeater_array_values( $selector, $post_id, $sub_field, $sub_field_key = null, $max_count = 0 )
    379 {
    380     $r = [];
    381 
    382 
    383     if (
    384         ( $arr = lct_acf_get_repeater_array( $selector, $post_id, $sub_field_key, $max_count ) )
    385         && ! empty( $arr )
    386     ) {
    387         foreach ( $arr as $k => $v ) {
    388             if ( isset( $v[ $sub_field ] ) ) {
    389                 $r[ $k ] = $v[ $sub_field ];
    390             }
    391         }
    392     }
    393 
    394 
    395     return $r;
    396 }
    397 
    398 
    399 /**
    400  * Returns the value of a specific ($sub_field_index) indexed element of an ACF Repeater field array
    401  * You can set the $sub_field_key of the ACF Repeater you would like returned, otherwise it will return the first
    402  *
    403  * @param string $selector
    404  * @param int    $post_id
    405  * @param string $sub_field
    406  * @param string $sub_field_key
    407  * @param int    $sub_field_index
    408  *
    409  * @return string|mixed
    410  * @since    2019.1
    411  * @verified 2019.01.10
    412  */
    413 function lct_acf_get_repeater_array_value( $selector, $post_id, $sub_field, $sub_field_key = null, $sub_field_index = 0 )
    414 {
    415     $r = null;
    416 
    417 
    418     if (
    419         ( $values = lct_acf_get_repeater_array_values( $selector, $post_id, $sub_field, $sub_field_key ) )
    420         && ! empty( $values )
    421     ) {
    422         if (
    423             ! $sub_field_key
    424             && is_int( $sub_field_index )
    425         ) {
    426             $values = array_values( $values );
    427         }
    428 
    429 
    430         if ( ! empty( $values[ $sub_field_index ] ) ) {
    431             $r = $values[ $sub_field_index ];
    432         }
    433     }
    434 
    435 
    436     return $r;
    437 }
    438 
    439 
    440 /**
    441  * Returns the value of a specific ($sub_field_index) indexed element of an ACF Repeater field array
    442  *
    443  * @param string $selector
    444  * @param int    $post_id
    445  * @param string $sub_field
    446  * @param int    $sub_field_index
    447  *
    448  * @return string|mixed
    449  * @since    2019.1
    450  * @verified 2019.01.10
    451  */
    452 function lct_acf_get_repeater_array_value_by_slug( $selector, $post_id, $sub_field, $sub_field_index = 0 )
    453 {
    454     $r = null;
    455 
    456 
    457     if (
    458         ( $value = lct_acf_get_repeater_array_value( $selector, $post_id, $sub_field, null, $sub_field_index ) )
    459         && ! empty( $value )
    460     ) {
    461         $r = $value;
    462     }
    463 
    464 
    465     return $r;
    466 }
    467 
    468 
    469 /**
    470  * Returns an imploded version of an ACF repeater
    471  *
    472  * @param        $selector
    473  * @param        $post_id
    474  * @param array  $order
    475  * @param string $glue
    476  * @param int    $max_count
    477  *
    478  * @return array
    479  * @since    7.12
    480  * @verified 2017.09.11
    481  */
    482 function lct_acf_get_repeater( $selector, $post_id, $order = [], $glue = ',', $max_count = 0 )
    483 {
    484     $r        = [];
    485     $row      = 1;
    486     $repeater = get_field( $selector, $post_id );
    487 
    488 
    489     if (
    490         ! empty( $repeater )
    491         && is_array( $repeater )
    492     ) {
    493         foreach ( $repeater as $row_data ) {
    494             $this_row = [];
    495 
    496 
    497             if ( ! empty( $row_data ) ) {
    498                 if ( ! empty( $order ) ) {
    499                     $order_count = 0;
    500 
    501                     foreach ( $order as $data ) {
    502                         if (
    503                             isset( $row_data[ $data ] )
    504                             && ( $value = $row_data[ $data ] )
    505                         ) {
    506                             if (
    507                                 is_object( $value )
    508                                 && lct_is_a( $value, 'WP_Term' )
    509                             ) {
    510                                 $value = $value->name;
    511                             }
    512 
    513 
    514                             if ( $glue ) {
    515                                 if (
    516                                     is_array( $glue )
    517                                     && (
    518                                         (
    519 
    520                                             isset( $glue[ $order_count - 1 ] )
    521                                             && $glue[ $order_count - 1 ]
    522                                         )
    523                                         || (
    524                                             isset( $glue[ $order_count ]['pre'] )
    525                                             && isset( $glue[ $order_count ] )
    526                                             && $glue[ $order_count ]
    527                                         )
    528                                     )
    529                                 ) {
    530                                     if ( isset( $glue[ $order_count ]['callback'] ) ) {
    531                                         $value = call_user_func( $glue[ $order_count ]['callback'], $value );
    532                                     }
    533 
    534 
    535                                     if ( isset( $glue[ $order_count ]['pre'] ) ) {
    536                                         $this_row[] = $glue[ $order_count ]['pre'];
    537                                         $this_row[] = $value;
    538                                         $this_row[] = $glue[ $order_count ]['post'];
    539                                     } else {
    540                                         $this_row[] = $glue[ $order_count - 1 ];
    541                                     }
    542                                 } elseif ( ! is_array( $glue ) ) {
    543                                     $this_row[] = $glue;
    544                                 }
    545                             }
    546 
    547                             if ( ! isset( $glue[ $order_count ]['pre'] ) ) {
    548                                 $this_row[] = $value;
    549                             }
    550                         }
    551 
    552                         $order_count ++;
    553                     }
    554 
    555                     $r[] = lct_return( $this_row );
    556                 } else {
    557                     foreach ( $row_data as $data ) {
    558                         if ( $data ) {
    559                             $this_row[] = $data;
    560                         }
    561                     }
    562 
    563                     $r[] = lct_return( $this_row, $glue );
    564                 }
    565             }
    566 
    567 
    568             if (
    569                 $max_count
    570                 && $row >= $max_count
    571             ) {
    572                 break;
    573             }
    574 
    575             $row ++;
    576         }
    577 
    578 
    579         reset_rows();
    580     }
    581 
    582 
    583     return $r;
    584 }
    585 
    586 
    587 /**
    588  * Returns an imploded version of one sub_field of an ACF repeater
    589  * Similar: repeater_items_shortcode()
    590  *
    591  * @param        $selector
    592  * @param        $post_id
    593  * @param        $sub_field
    594  * @param int    $max_count
    595  * @param string $glue
    596  *
    597  * @return string
    598  * @since    7.3
    599  * @verified 2016.09.29
    600  */
    601 function lct_acf_get_imploded_repeater( $selector, $post_id, $sub_field, $max_count = 0, $glue = ',' )
    602 {
    603     $r   = [];
    604     $row = 1;
    605 
    606 
    607     if ( have_rows( $selector, $post_id ) ) {
    608         while( have_rows( $selector, $post_id ) ) {
    609             the_row();
    610 
    611             $sub_field_value = get_sub_field( $sub_field );
    612 
    613             if ( $sub_field_value ) {
    614                 $r[] = $sub_field_value;
    615             }
    616 
    617             if (
    618                 $max_count
    619                 && $row >= $max_count
    620             ) {
    621                 break;
    622             }
    623 
    624             $row ++;
    625         }
    626 
    627 
    628         reset_rows();
    629     }
    630 
    631 
    632     return lct_return( $r, $glue );
    633 }
    634 
    635 
    636 /**
    637  * Get the ACF group of a field
    638  * Don't use this
    639  *
    640  * @param string|array $field_parent
    641  *
    642  * @return array
    643  * @since    2019.25
    644  * @verified 2019.11.01
    645  */
    646 function lct_acf_get_field_group_of_field( $field_parent )
    647 {
    648     $r = false;
    649 
    650 
    651     if ( is_array( $field_parent ) ) {
    652         $field_parent = $field_parent['parent'];
    653     }
    654 
    655 
    656     if (
    657         ( $group = acf_get_field_group( $field_parent ) )
    658         && acf_is_field_group( $group )
    659     ) {
    660         $r = $group;
    661     } elseif (
    662         acf_is_field_key( $field_parent )
    663         && ( $field = get_field_object( $field_parent, false, false, false ) )
    664         && ( $group = lct_acf_get_field_group_of_field( $field['parent'] ) )
    665         && acf_is_field_group( $group )
    666     ) {
    667         $r = $group;
    668     }
    669 
    670 
    671     return $r;
    672 }
    673 
    674 
    675 /**
    676189 * Get an array of fields from groups
    677190 * //TODO: cs - Need to improve the speed of this - 6/12/2017 9:31 PM
     
    1193706
    1194707
    1195         if ( lct_acf_is_field_repeater( $selector ) ) {
     708        if ( afwp_acf_is_field_repeater( $selector ) ) {
    1196709            $r = lct_acf_get_POST_values_w_selector_key( $r, false, true );
    1197710        } elseif (
     
    1326839            if (
    1327840                $special_process !== true
    1328                 && ( $repeater_key = substr( $special_process, 9 ) ) //remove repeater_
     841                && ( $repeat_key = substr( $special_process, 9 ) ) //remove repeater_
    1329842                && is_array( $v )
    1330                 && $k !== $repeater_key
     843                && $k !== $repeat_key
    1331844            ) {
    1332845                $has_clones = false;
     
    1354867                            count( $explode_k ) >= 3
    1355868                            && ( $tmp = 'field_' . rtrim( $explode_k[1], '_' ) )
    1356                             && lct_acf_is_field_clone( $tmp )
     869                            && afwp_acf_is_field_clone( $tmp )
    1357870                        ) {
    1358871                            $clone_parent_k = $tmp;
     
    1361874
    1362875                        if (
    1363                             ! lct_acf_is_field_clone( $tmp )
     876                            ! afwp_acf_is_field_clone( $tmp )
    1364877                            || count( $explode_k ) < 3
    1365878                        ) {
     
    1456969             * Loop thru a repeater
    1457970             */
    1458             if ( lct_acf_is_field_repeater( $key ) ) {
     971            if ( afwp_acf_is_field_repeater( $key ) ) {
    1459972                $v = lct_acf_get_POST_values_w_selector_key( $v, $return_field, 'repeater_' . $key );
    1460973            }
     
    1464977             * Loop thru clones
    1465978             */
    1466             if ( lct_acf_is_field_clone( $key ) ) {
     979            if ( afwp_acf_is_field_clone( $key ) ) {
    1467980                $v = lct_acf_get_POST_values_w_selector_key( $v, $return_field, 'clone_' . $key );
    1468981            }
     
    15011014             */
    15021015            if (
    1503                 lct_acf_is_field_seamless_clone( $key )
     1016                afwp_acf_is_field_seamless_clone( $key )
    15041017                && $special_process !== 'maintain_seamless_clones'
    15051018                && ! empty( $r[ $selector ] )
     
    16301143             * Loop thru a repeater
    16311144             */
    1632             if ( lct_acf_is_field_repeater( $key ) ) {
     1145            if ( afwp_acf_is_field_repeater( $key ) ) {
    16331146                $selector = [ $selector => lct_acf_get_POST_key_selector_map( $v, true ) ];
    16341147            }
     
    16381151             * Loop thru clones
    16391152             */
    1640             if ( lct_acf_is_field_clone( $key ) ) {
     1153            if ( afwp_acf_is_field_clone( $key ) ) {
    16411154                $selector = lct_acf_get_POST_key_selector_map( $v, 'clone_' . $key );
    16421155            }
     
    16531166             */
    16541167            if (
    1655                 lct_acf_is_field_seamless_clone( $key )
     1168                afwp_acf_is_field_seamless_clone( $key )
    16561169                && $special_process !== 'maintain_seamless_clones'
    16571170                && ! empty( $r[ $key ] )
     
    17671280
    17681281    return $selector;
    1769 }
    1770 
    1771 
    1772 /**
    1773  * Check if the field is a repeater type field
    1774  *
    1775  * @param string $key //Should be a key, You can use a selector as well, but you may get the wrong field returned
    1776  *
    1777  * @return bool
    1778  * @date     2022.10.20
    1779  * @since    2022.10
    1780  * @verified 2022.10.24
    1781  */
    1782 function lct_acf_is_field_repeater( $key )
    1783 {
    1784     /**
    1785      * Check the type
    1786      */
    1787     if (
    1788         ( $answer = acf_get_field( $key ) )
    1789         && $answer['type'] === 'repeater'
    1790     ) {
    1791         return true;
    1792     }
    1793 
    1794 
    1795     return false;
    1796 }
    1797 
    1798 
    1799 /**
    1800  * Check if the field is a clone type field
    1801  *
    1802  * @param string $key //Should be a key, You can use a selector as well, but you may get the wrong field returned
    1803  *
    1804  * @return bool
    1805  * @date     2022.10.20
    1806  * @since    2022.10
    1807  * @verified 2022.10.24
    1808  */
    1809 function lct_acf_is_field_clone( $key )
    1810 {
    1811     /**
    1812      * Check the type
    1813      */
    1814     if (
    1815         ( $answer = acf_get_field( $key ) )
    1816         && $answer['type'] === 'clone'
    1817     ) {
    1818         return true;
    1819     }
    1820 
    1821 
    1822     return false;
    1823 }
    1824 
    1825 
    1826 /**
    1827  * Check if the field is a seamless clone type field
    1828  *
    1829  * @param string $key //Should be a key, You can use a selector as well, but you may get the wrong field returned
    1830  *
    1831  * @return bool
    1832  * @date     2022.10.20
    1833  * @since    2022.10
    1834  * @verified 2022.10.20
    1835  */
    1836 function lct_acf_is_field_seamless_clone( $key )
    1837 {
    1838     /**
    1839      * Check the display
    1840      */
    1841     if (
    1842         lct_acf_is_field_clone( $key )
    1843         && ( $answer = acf_get_field( $key ) )
    1844         && ! empty( $answer['display'] )
    1845         && $answer['display'] === 'seamless'
    1846     ) {
    1847         return true;
    1848     }
    1849 
    1850 
    1851     return false;
    18521282}
    18531283
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/api/is.php

    r3017144 r3384881  
    118118
    119119/**
    120  * lct_acf_is_repeater_subfield
    121  * Returns true if the field is considered a subfield of a repeater
    122  *
    123  * @param array $field
    124  * @param mixed $post_id
    125  *
    126  * @return    bool
    127  * @date         2020.10.05
    128  * @since        2020.13
    129  * @verified     2020.10.05
    130  * @noinspection PhpMissingParamTypeInspection
    131  */
    132 function lct_acf_is_repeater_subfield( $field, $post_id = false )
    133 {
    134     $r = false;
    135 
    136 
    137     if (
    138         acf_is_field_key( $field['parent'] )
    139         && ( $parent_obj = get_field_object( $field['parent'], $post_id ) )
    140         && $parent_obj['type'] === 'repeater'
    141     ) {
    142         $r = true;
    143     }
    144 
    145 
    146     return $r;
    147 }
    148 
    149 
    150 /**
    151120 * Check if the request you are running is allowed
    152121 *
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/dev_checks.php

    r3263018 r3384881  
    731731             */
    732732        } else {
    733             echo 'Please set the date in the <strong>"' . afwp_acf_get_field_label( 'lct:::modified_posts_last_check', lct_o() ) . '"</strong> field above.';
     733            echo 'Please set the date in the <strong>"' . afwp_acf_field_label( 'lct:::modified_posts_last_check', lct_o() ) . '"</strong> field above.';
    734734        }
    735735    }
     
    11871187         */
    11881188        if (
    1189             ( $option_groups_fields = lct_acf_get_field_groups_fields( [ 'options_page' => true ] ) )
     1189            ( $option_groups_fields = afwp_acf_get_fields_of_groups( [ 'options_page' => true ] ) )
    11901190            && ! empty( $option_groups_fields )
    11911191        ) {
     
    12521252         */
    12531253        if (
    1254             ( $option_groups_fields = lct_acf_get_field_groups_fields( [ 'options_page' => true ] ) )
     1254            ( $option_groups_fields = afwp_acf_get_fields_of_groups( [ 'options_page' => true ] ) )
    12551255            && ! empty( $option_groups_fields )
    12561256        ) {
     
    12581258                if (
    12591259                    empty( $field['_name'] )
    1260                     || empty( $field['type'] )
    12611260                    || empty( $field['sub_fields'] )
    1262                     || ! in_array( $field['type'], [ 'repeater' ] )
    1263                     || ! ( $repeater_count = acf_get_value( lct_o(), $field ) )
     1261                    || ! afwp_acf_is_field_repeater( $field )
     1262                    || ! ( $repeat_count = acf_get_value( lct_o(), $field ) )
    12641263                ) {
    12651264                    continue;
     
    12681267
    12691268                foreach ( $field['sub_fields'] as $sub_field ) {
    1270                     foreach ( $repeater_count as $k => $data ) {
     1269                    foreach ( $repeat_count as $k => $data ) {
    12711270                        $option = 'options_' . $field['_name'] . '_' . $k . '_' . $sub_field['_name'];
    12721271
     
    14311430         */
    14321431        foreach ( get_post_types() as $post_type ) {
    1433             if ( $group = lct_acf_get_field_groups_fields( [ 'post_type' => $post_type ] ) ) {
     1432            if ( $group = afwp_acf_get_fields_of_groups( [ 'post_type' => $post_type ] ) ) {
    14341433                $groups_fields = array_merge( $groups_fields, $group );
    14351434            }
     
    14981497         */
    14991498        foreach ( get_post_types() as $post_type ) {
    1500             if ( $group = lct_acf_get_field_groups_fields( [ 'post_type' => $post_type ] ) ) {
     1499            if ( $group = afwp_acf_get_fields_of_groups( [ 'post_type' => $post_type ] ) ) {
    15011500                $groups_fields = array_merge( $groups_fields, $group );
    15021501            }
     
    15081507                if (
    15091508                    empty( $field['_name'] )
    1510                     || empty( $field['type'] )
    15111509                    || empty( $field['sub_fields'] )
    1512                     || ! in_array( $field['type'], [ 'repeater' ] )
    1513                     || ! ( $repeater_count = acf_get_value( lct_o(), $field ) )
     1510                    || ! afwp_acf_is_field_repeater( $field )
     1511                    || ! ( $repeat_count = acf_get_value( lct_o(), $field ) )
    15141512                ) {
    15151513                    continue;
     
    15181516
    15191517                foreach ( $field['sub_fields'] as $sub_field ) {
    1520                     foreach ( $repeater_count as $k => $data ) {
     1518                    foreach ( $repeat_count as $k => $data ) {
    15211519                        $option = $field['_name'] . '_' . $k . '_' . $sub_field['_name'];
    15221520
     
    16661664         */
    16671665        foreach ( get_post_types() as $post_type ) {
    1668             if ( $group = lct_acf_get_field_groups_fields( [ 'post_type' => $post_type ] ) ) {
     1666            if ( $group = afwp_acf_get_fields_of_groups( [ 'post_type' => $post_type ] ) ) {
    16691667                $groups_fields = array_merge( $groups_fields, $group );
    16701668            }
     
    17301728         */
    17311729        foreach ( get_post_types() as $post_type ) {
    1732             if ( $group = lct_acf_get_field_groups_fields( [ 'post_type' => $post_type ] ) ) {
     1730            if ( $group = afwp_acf_get_fields_of_groups( [ 'post_type' => $post_type ] ) ) {
    17331731                $groups_fields = array_merge( $groups_fields, $group );
    17341732            }
     
    17401738                if (
    17411739                    empty( $field['_name'] )
    1742                     || empty( $field['type'] )
    17431740                    || empty( $field['sub_fields'] )
    1744                     || ! in_array( $field['type'], [ 'repeater' ] )
    1745                     || ! ( $repeater_count = acf_get_value( lct_o(), $field ) )
     1741                    || ! afwp_acf_is_field_repeater( $field )
     1742                    || ! ( $repeat_count = acf_get_value( lct_o(), $field ) )
    17461743                ) {
    17471744                    continue;
     
    17501747
    17511748                foreach ( $field['sub_fields'] as $sub_field ) {
    1752                     foreach ( $repeater_count as $k => $data ) {
     1749                    foreach ( $repeat_count as $k => $data ) {
    17531750                        $option = $field['_name'] . '_' . $k . '_' . $sub_field['_name'];
    17541751
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/field-types/send_password/class-v5.php

    r3150229 r3384881  
    134134
    135135                if ( strpos( $field['name'], '][' ) !== false ) {
    136                     $repeater = explode( '][', $field['name'] );
    137                     $name     = '_' . $repeater[1];
     136                    $repeat = explode( '][', $field['name'] );
     137                    $name   = '_' . $repeat[1];
    138138                }
    139139
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/filters_load_field.php

    r3017144 r3384881  
    5858        add_filter( 'acf/load_field/name=' . zxzacf( 'js_files' ), [ $this, 'js_files' ] );
    5959
    60         add_filter( 'acf/load_field', [ $this, 'process_shortcodes' ] );
     60        add_filter( 'acf/prepare_field', [ $this, 'process_shortcodes' ] );
    6161    }
    6262
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/instant_save.php

    r3337494 r3384881  
    239239
    240240                if (
    241                     lct_acf_is_repeater_subfield( $field, $this->vars['post_id'] )
     241                    afwp_acf_is_repeater_subfield( $field, $this->vars['post_id'] )
    242242                    && $updated !== 'dont_update'
    243243                    && $this->vars[ $this->meta->value ] === ''
     
    291291
    292292                    if (
    293                         lct_acf_is_repeater_subfield( $field, $this->vars['post_id'] )
     293                        afwp_acf_is_repeater_subfield( $field, $this->vars['post_id'] )
    294294                        && isset( $this->vars['info_id'] )
    295295                    ) {
    296296                        if (
    297297                            ! empty( $_POST[ $this->meta->acf_form ]['acf'] )
    298                             && ( $repeater_value = $_POST[ $this->meta->acf_form ]['acf'] )
    299                             && ( $repeater_value = lct_clean_acf_repeater( $repeater_value ) )
    300                             && ( $parent_field = lct_find_repeater_field( $repeater_value, $this->vars[ $this->meta->field_key ] ) )
    301                             && isset( $repeater_value[ $parent_field ] )
     298                            && ( $repeat_value = $_POST[ $this->meta->acf_form ]['acf'] )
     299                            && ( $repeat_value = lct_clean_acf_repeater( $repeat_value ) )
     300                            && ( $parent_field = lct_find_repeater_field( $repeat_value, $this->vars[ $this->meta->field_key ] ) )
     301                            && isset( $repeat_value[ $parent_field ] )
    302302                        ) {
    303                             $first_key = array_key_first( $repeater_value[ $parent_field ] );
    304 
    305                             if ( ! isset( $repeater_value[ $parent_field ][ $first_key ][ $this->vars[ $this->meta->field_key ] ] ) ) {
    306                                 $repeater_value[ $parent_field ][ $first_key ][ $this->vars[ $this->meta->field_key ] ] = $this->vars[ $this->meta->value ];
     303                            $first_key = array_key_first( $repeat_value[ $parent_field ] );
     304
     305                            if ( ! isset( $repeat_value[ $parent_field ][ $first_key ][ $this->vars[ $this->meta->field_key ] ] ) ) {
     306                                $repeat_value[ $parent_field ][ $first_key ][ $this->vars[ $this->meta->field_key ] ] = $this->vars[ $this->meta->value ];
    307307                            }
    308308
    309309
    310                             update_field( $parent_field, $repeater_value[ $parent_field ], $this->vars['post_id'] );
     310                            update_field( $parent_field, $repeat_value[ $parent_field ], $this->vars['post_id'] );
    311311
    312312
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/op_main_fixes_cleanups.php

    r3150229 r3384881  
    17651765        if ( ! empty( $objects ) ) {
    17661766            foreach ( $objects as $object ) {
    1767                 $fields = lct_acf_get_field_groups_fields( [ 'user_id' => $object->ID ] );
     1767                $fields = afwp_acf_get_fields_of_groups( [ 'user_id' => $object->ID ] );
    17681768
    17691769
     
    17991799                         * Update repeaters
    18001800                         */
    1801                         if ( $field['type'] == 'repeater' ) {
     1801                        if ( afwp_acf_is_field_repeater( $field ) ) {
    18021802                            $report = $this->repair_acf_repeater_metadata( $report, 'user', $current_value, $object, $field );
    18031803
     
    19871987                             * Update repeaters
    19881988                             */
    1989                             if ( $field['type'] == 'repeater' ) {
     1989                            if ( afwp_acf_is_field_repeater( $field ) ) {
    19901990                                $report = $this->repair_acf_repeater_metadata( $report, 'post', $current_value, $object, $field );
    19911991
     
    21172117        if ( ! empty( $objects ) ) {
    21182118            foreach ( $objects as $object ) {
    2119                 $fields = lct_acf_get_field_groups_fields( [ 'taxonomy' => $object->taxonomy ] );
     2119                $fields = afwp_acf_get_fields_of_groups( [ 'taxonomy' => $object->taxonomy ] );
    21202120
    21212121
     
    21512151                         * Update repeaters
    21522152                         */
    2153                         if ( $field['type'] == 'repeater' ) {
     2153                        if ( afwp_acf_is_field_repeater( $field ) ) {
    21542154                            $report = $this->repair_acf_repeater_metadata( $report, 'term', $current_value, $object, $field );
    21552155
     
    23062306                     */
    23072307                    if (
    2308                         $field['type'] == 'repeater'
     2308                        afwp_acf_is_field_repeater( $field )
    23092309                        || empty( $field['name'] )
    23102310                        || empty( $key_exists )
  • lct-useful-shortcodes-functions/trunk/code/public/class.php

    r2894473 r3384881  
    6666
    6767        if ( lct_plugin_active( $plugin ) ) {
    68             lct_load_class( 'plugins/' . $plugin . '/public.php', 'public', [ 'plugin' => $plugin, 'globalize' => true ] );
    69 
    7068            lct_load_class( 'plugins/' . $plugin . '/public_choices.php', 'public_choices', [ 'plugin' => $plugin, 'globalize' => true ] );
    7169        }
  • lct-useful-shortcodes-functions/trunk/code/wp-admin/admin/loader.php

    r2894473 r3384881  
    128128
    129129                if ( in_array( $this->vars['plugin_page'], $acf_keys ) ) {
    130                     lct_update_setting( 'acf_is_options_page', true );
    131 
    132130                    add_action( 'admin_enqueue_scripts', [ lct_instances()->wp_admin_admin_admin, 'sticky_admin_sidebar' ] );
    133131                }
  • lct-useful-shortcodes-functions/trunk/code/wp-admin/admin/onetime.php

    r3150229 r3384881  
    15071507
    15081508
    1509                         if ( $fields = lct_acf_get_field_groups_fields( [ 'post_type' => $post_type ] ) ) {
     1509                        if ( $fields = afwp_acf_get_fields_of_groups( [ 'post_type' => $post_type ] ) ) {
    15101510                            $acf_fields = array_merge( $acf_fields, $fields );
    15111511                        }
     
    15281528
    15291529                    if (
    1530                         isset( $field['type'] )
    1531                         && $field['type'] === 'repeater'
     1530                        afwp_acf_is_field_repeater( $field )
    15321531                        && ! empty( $field['sub_fields'] )
    15331532                    ) {
  • lct-useful-shortcodes-functions/trunk/lct-useful-shortcodes-functions.php

    r3337494 r3384881  
    44 * Plugin URI: https://www.simplesmithmedia.com
    55 * Description: Shortcodes & Functions that will help make your life easier.
    6  * Version: 2025.02
     6 * Version: 2025.03
    77 * Author: SimpleSmithMedia
    88 * Author URI: https://www.simplesmithmedia.com
  • lct-useful-shortcodes-functions/trunk/readme.txt

    r3337494 r3384881  
    3333
    3434== Changelog ==
     35= 2025.03 =
     36*Release Date - 26 October 2025*
     37
     38* Removed:
     39    * lct_acf_get_field_types()
     40    * lct_acf_get_field_label()
     41    * lct_acf_get_field_label_no_required()
     42    * lct_acf_get_field_group_of_field()
     43    * lct_acf_get_repeater_array()
     44    * lct_acf_get_repeater_array_keys()
     45    * lct_acf_get_repeater_array_key()
     46    * lct_acf_get_repeater_array_values()
     47    * lct_acf_get_repeater_array_value()
     48    * lct_acf_get_repeater_array_value_by_slug()
     49    * lct_acf_get_repeater()
     50    * lct_acf_get_imploded_repeater()
     51    * lct_acf_is_field_repeater()
     52    * lct_acf_is_field_clone()
     53    * lct_acf_is_field_seamless_clone()
     54    * lct_acf_is_repeater_subfield()
     55    * lct_get_dollar()
     56    * lct_get_un_dollar()
     57    * lct_get_dollar_wo_symbol()
     58    * lct_get_negative_number()
     59    * lct_get_negative_dollar()
     60    * lct_acf_public{}
     61
    3562= 2025.02 =
    3663*Release Date - 31 July 2025*
Note: See TracChangeset for help on using the changeset viewer.