Plugin Directory

Changeset 3062279


Ignore:
Timestamp:
04/01/2024 09:47:21 PM (2 years ago)
Author:
ircary
Message:

2024.03

*Release Date - 01 April 2024*

  • Removed:
    • add_filter( 'register_post_type_args', [ $this, 'prevent_bad_permalinks' ], 10, 2 );
    • lct_update_status_taxonomy_term_count()
    • add_filter( 'acf/get_fields', [ $this, 'acf_get_fields' ], 10, 2 );
    • add_filter( 'lct/post_types/prevent_bad_permalinks', [ $this, 'prevent_bad_permalinks' ], 10, 3 );
Location:
lct-useful-shortcodes-functions/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • lct-useful-shortcodes-functions/trunk/code/admin/old/display/OLD_options.php

    r2894473 r3062279  
    443443 *
    444444 * @return array
     445 * @verified 2024.04.01
    445446 */
    446447function lct_select_options_lct_standard_year(
     
    451452) {
    452453    $time = current_time( 'timestamp', 1 );
    453     $v['date_start'] ? $start = $v['date_start'] : $start = date( "Y", $time ) - 3;
    454     $v['date_end'] ? $end = $v['date_end'] : $end = date( "Y", $time ) + 3;
     454    $v['date_start'] ? $start = $v['date_start'] : $start = 2014;
     455    $v['date_end'] ? $end = $v['date_end'] : $end = date( "Y", $time ) + 1;
    455456
    456457    $select_options = [];
  • lct-useful-shortcodes-functions/trunk/code/admin/post_types.php

    r2894473 r3062279  
    6666
    6767
    68         /**
    69          * filters
    70          */
    71         add_filter( 'register_post_type_args', [ $this, 'prevent_bad_permalinks' ], 10, 2 );
    72 
    73 
    7468        if ( lct_frontend() ) {
    7569            add_filter( 'wp_get_nav_menu_items', [ $this, 'archive_menu_filter' ], 10, 3 );
     
    7771
    7872
    79         //if ( lct_wp_admin_all() ) {}
    80 
    81 
    8273        if ( lct_wp_admin_non_ajax() ) {
    8374            add_action( 'admin_head-nav-menus.php', [ $this, 'inject_archives_menu_meta_box' ] );
    8475        }
    85 
    86 
    87         //if ( lct_ajax_only() ) {}
    8876    }
    8977
     
    174162            $this->create_testimony();
    175163        }
    176     }
    177 
    178 
    179     /**
    180      * Prevent bad permalink issues
    181      *
    182      * @param $args
    183      * @param $post_type
    184      *
    185      * @return mixed
    186      * @since    2017.81
    187      * @verified 2017.09.25
    188      */
    189     function prevent_bad_permalinks( $args, $post_type )
    190     {
    191         if (
    192             ( $permalink = get_option( 'permalink_structure' ) )
    193             && strpos( $permalink, '/blog/' ) === 0
    194             && ( $post_types = apply_filters( 'lct/post_types/prevent_bad_permalinks', [], $post_type, $args ) )
    195             && in_array( $post_type, $post_types )
    196             && (
    197                 ! isset( $args['rewrite']['with_front'] )
    198                 || $args['rewrite']['with_front'] !== false
    199             )
    200         ) {
    201             $args['rewrite']['with_front'] = false;
    202         }
    203 
    204 
    205         return $args;
    206164    }
    207165
  • lct-useful-shortcodes-functions/trunk/code/admin/taxonomies.php

    r3030238 r3062279  
    246246         * @return array
    247247         * @since    0.0
    248          * @verified 2021.04.30
     248         * @verified 2024.03.13
    249249         */
    250250        function default_args( $custom_args = [], $slug = null, $labels = null )
     
    265265                'show_admin_column'   => false,
    266266                'description'         => '',
    267                 'hierarchical'        => true,
     267                'hierarchical'        => false,
    268268                //'update_count_callback' => null,
    269269                //'query_var' => true,
     
    303303         * @unused   param $class
    304304         * @since    0.0
    305          * @verified 2024.01.10
     305         * @verified 2024.03.13
    306306         */
    307307        function register_post_status( $taxonomy, $post_types )
     
    323323            if ( ! ( $terms_to_register = lct_get_option( $this->cache_key( $taxonomy ), [] ) ) ) {
    324324                $tax_args = [
    325                     'taxonomy'                      => $taxonomy,
    326                     'hide_empty'                    => false,
    327                     'hierarchical'                  => true,
    328                     get_cnst( 'a_c_f_tax_disable' ) => true,
     325                    'taxonomy'          => $taxonomy,
     326                    'hide_empty'        => false,
     327                    'hierarchical'      => true,
     328                    'lct:::tax_disable' => true,
    329329                ];
    330330                $terms    = get_terms( $tax_args );
  • lct-useful-shortcodes-functions/trunk/code/api/_helpers.php

    r2991310 r3062279  
    27932793
    27942794    return $r;
    2795 }
    2796 
    2797 
    2798 /**
    2799  * We need to handle the counting of status taxonomies
    2800  * Will update term count based on object types of the current taxonomy.
    2801  *
    2802  * @based_on     _update_post_term_count()
    2803  *
    2804  * @param array  $terms    List of Term taxonomy IDs.
    2805  * @param object $taxonomy Current taxonomy object of terms.
    2806  *
    2807  * @global wpdb  $wpdb     WordPress database abstraction object.
    2808  * @since        2017.96
    2809  * @verified     2020.06.13
    2810  * @noinspection PhpMissingParamTypeInspection
    2811  */
    2812 function lct_update_status_taxonomy_term_count( $terms, $taxonomy )
    2813 {
    2814     global $wpdb;
    2815 
    2816     $object_types = (array) $taxonomy->object_type;
    2817 
    2818     foreach ( $object_types as $k => $object_type ) {
    2819         if ( strpos( $object_type, ':' ) !== false ) {
    2820             $object_types[ $k ] = explode( ':', $object_type );
    2821         }
    2822     }
    2823 
    2824     $object_types = array_unique( $object_types );
    2825 
    2826 
    2827     if ( false !== ( $check_attachments = array_search( 'attachment', $object_types ) ) ) {
    2828         unset( $object_types[ $check_attachments ] );
    2829         $check_attachments = true;
    2830     }
    2831 
    2832 
    2833     if ( $object_types ) {
    2834         $object_types = esc_sql( array_filter( $object_types, 'post_type_exists' ) );
    2835     }
    2836 
    2837 
    2838     foreach ( $terms as $term ) {
    2839         $count = 0;
    2840 
    2841 
    2842         // Attachments can be 'inherit' status, we need to base count off the parent's status if so.
    2843         if ( $check_attachments ) {
    2844             $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts p1 WHERE p1.ID = $wpdb->term_relationships.object_id AND ( post_status = 'publish' OR ( post_status = 'inherit' AND post_parent > 0 AND ( SELECT post_status FROM $wpdb->posts WHERE ID = p1.post_parent ) = 'publish' ) ) AND post_type = 'attachment' AND term_taxonomy_id = %d", $term ) );
    2845         }
    2846 
    2847         if ( $object_types ) {
    2848             $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_type IN ('" . implode( "', '", $object_types ) . "') AND term_taxonomy_id = %d", $term ) );
    2849         }
    2850 
    2851 
    2852         /**
    2853          * This action is documented in wp-includes/taxonomy.php
    2854          *
    2855          * @date     0.0
    2856          * @since    0.0
    2857          * @verified 2021.08.27
    2858          */
    2859         do_action( 'edit_term_taxonomy', $term, $taxonomy->name );
    2860         $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), [ 'term_taxonomy_id' => $term ] );
    2861 
    2862 
    2863         /**
    2864          * This action is documented in wp-includes/taxonomy.php
    2865          *
    2866          * @date     0.0
    2867          * @since    0.0
    2868          * @verified 2021.08.27
    2869          */
    2870         do_action( 'edited_term_taxonomy', $term, $taxonomy->name );
    2871     }
    28722795}
    28732796
  • lct-useful-shortcodes-functions/trunk/code/api/class.php

    r2894473 r3062279  
    226226            add_action( 'acf/include_fields', [ $this, 'acf_actions_n_filters_pre' ], 9999 );
    227227
     228
    228229            add_action( 'acf/init', [ $this, 'acf_actions_n_filters' ], 999 );
    229230
     
    234235            add_filter( 'acf/settings/autoload', '__return_true' );
    235236
    236             //I disabled in 2019.3 to test if this is really needed anymore. I think it is too expensive now.
    237             //add_filter( 'acf/get_fields', [ $this, 'acf_get_fields' ], 10, 2 );
    238237
    239238            add_filter( 'register_post_type_args', [ $this, 'acf_post_type_args' ], 10, 2 );
     
    596595
    597596    /**
    598      * Saves us from running unnecessary queries for conditionally hidden sub_fields
    599      *
    600      * @param $fields
    601      * @param $parent
    602      *
    603      * @return mixed
    604      * @since    LCT 2017.42
    605      * @verified 2018.10.08
    606      */
    607     function acf_get_fields( $fields, $parent )
    608     {
    609         if (
    610             ! empty( $fields )
    611             && ! empty( $parent['type'] )
    612             && ! empty( $parent['name'] )
    613             && $parent['type'] === 'repeater'
    614             && acf_get_setting( 'autoload' )
    615             && ! lct_get_setting( 'acf_is_options_page' )
    616             && ! lct_get_setting( 'single_version_db_updates' )
    617         ) {
    618             $all_options = wp_load_alloptions();
    619             $check       = 'options_' . $parent['name'];
    620 
    621 
    622             if ( array_key_exists( $check, $all_options ) ) {
    623                 if ( $all_options[ $check ] ) {
    624                     for ( $i = 0; $i <= $all_options[ $check ]; $i ++ ) {
    625                         foreach ( $fields as $field ) {
    626                             $check_nest_1 = 'options_' . $parent['name'] . '_' . $i . '_' . $field['name'];
    627 
    628 
    629                             if ( ! array_key_exists( $check_nest_1, $all_options ) ) {
    630                                 add_filter( 'pre_option_' . $check_nest_1, '__return_null' );
    631                             }
    632                         }
    633                     }
    634                 }
    635             } else {
    636                 add_filter( 'pre_option_' . $check, '__return_null' );
    637             }
    638         }
    639 
    640 
    641         return $fields;
    642     }
    643 
    644 
    645     /**
    646597     * Allow revisions for ACF fields
    647598     *
  • lct-useful-shortcodes-functions/trunk/code/plugins/Avada/_loaded.php

    r2894473 r3062279  
    5959        add_action( 'widgets_init', [ $this, 'disable_blog_sidebar' ], 11 );
    6060
     61
    6162        add_action( 'after_setup_theme', [ $this, 'remove_image_size' ], 11 );
    6263
     64
    6365        add_action( 'after_setup_theme', [ $this, 'remove_theme_supports' ], 11 );
    6466
     67
    6568        add_action( 'plugins_loaded', [ $this, 'disable_fusion_builder_activate' ] );
    6669
     70
    6771        add_action( 'init', [ $this, 'remove_post_types' ], 9 );
    68 
    69 
    70         /**
    71          * filters
    72          */
    73         add_filter( 'lct/post_types/prevent_bad_permalinks', [ $this, 'prevent_bad_permalinks' ], 10, 3 );
    74 
    75 
    76         //if ( lct_frontend() ) {}
    77 
    78 
    79         //if ( lct_wp_admin_all() ) {}
    8072
    8173
    8274        if ( lct_wp_admin_non_ajax() ) {
    8375            add_action( 'lct/op_main/init', [ $this, 'add_op_main_Avada' ] );
     76
     77
     78            add_action( 'plugins_loaded', [ $this, 'disable_admin_hooks_by_removal' ] );
     79
    8480
    8581            if ( ! empty( $_GET['post'] ) ) {
    8682                add_filter( 'gettext', [ $this, 'avada_admin_language' ], 99, 3 );
    8783            }
    88 
    89 
    90             add_action( 'plugins_loaded', [ $this, 'disable_admin_hooks_by_removal' ] );
    91         }
    92 
    93 
    94         //if ( lct_ajax_only() ) {}
     84        }
    9585    }
    9686
     
    213203
    214204    /**
    215      * Add Avada post_types to the bad permalink protection list
    216      *
    217      * @param $post_types
    218      *
    219      * @unused   param $post_type
    220      * @unused   param $args
    221      * @return array
    222      * @since    2017.81
    223      * @verified 2017.09.25
    224      */
    225     function prevent_bad_permalinks( $post_types )
    226     {
    227         $post_types[] = 'avada_portfolio';
    228         $post_types[] = 'avada_faq';
    229         $post_types[] = 'themefusion_elastic';
    230 
    231 
    232         return $post_types;
    233     }
    234 
    235 
    236     /**
    237205     * Replace Some language with our own
    238206     *
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/_shortcodes.php

    r2948966 r3062279  
    20492049     * @return string
    20502050     * @since    2017.42
    2051      * @verified 2022.08.24
     2051     * @verified 2024.03.22
    20522052     */
    20532053    function acf( $a )
     
    21092109
    21102110                case 'user':
    2111                     $aa                 = $a;
    2112                     $aa['format_value'] = false;
    2113 
    2114 
    2115                     $shortcode = acf_shortcode( $aa );
     2111                    $shortcode = get_field_object( $a['field'], $a['post_id'], false );
    21162112
    21172113
    21182114                    if (
    2119                         $shortcode
    2120                         && $a['format_value']
     2115                        ! empty( $shortcode['value'] )
     2116                        && ( $user_obj = get_userdata( $shortcode['value'] ) )
    21212117                    ) {
    2122                         $shortcode = acf_format_value( $shortcode, $a['post_id'], $field );
    2123 
    2124 
    2125                         if ( is_array( $shortcode ) ) {
    2126                             if ( $shortcode['display_name'] ) {
    2127                                 $shortcode = $shortcode['display_name'];
    2128                             } else {
    2129                                 $shortcode = $shortcode['user_firstname'] . ' ' . $shortcode['user_lastname'];
    2130                             }
    2131                         }
     2118                        $shortcode = $user_obj->display_name;
    21322119                    }
    21332120                    break;
  • lct-useful-shortcodes-functions/trunk/lct-useful-shortcodes-functions.php

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

    r3050689 r3062279  
    3333
    3434== Changelog ==
     35= 2024.03 =
     36*Release Date - 01 April 2024*
     37
     38* Removed:
     39    * add_filter( 'register_post_type_args', [ $this, 'prevent_bad_permalinks' ], 10, 2 );
     40    * lct_update_status_taxonomy_term_count()
     41    * add_filter( 'acf/get_fields', [ $this, 'acf_get_fields' ], 10, 2 );
     42    * add_filter( 'lct/post_types/prevent_bad_permalinks', [ $this, 'prevent_bad_permalinks' ], 10, 3 );
     43
    3544= 2024.02 =
    3645*Release Date - 13 March 2024*
Note: See TracChangeset for help on using the changeset viewer.