Skip to:
Content

BuddyPress.org

Changeset 13994


Ignore:
Timestamp:
08/07/2024 01:46:38 AM (3 months ago)
Author:
espellcaste
Message:

Move some BP_User_Query::populate_extras() properties to custom action hooks.

The action of populating class properties were moved from the populate_extras method into action hooks, allowing developers to remove any of them, if needed.

Props r-a-y and imath.

Fixes #9205

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-user-query.php

    r13896 r13994  
    677677     *
    678678     * @since 1.7.0
    679      *
    680      * @global wpdb $wpdb WordPress database object.
     679     * @since 15.0.0 Some properties were moved into action hooks.
    681680     */
    682681    public function populate_extras() {
    683         global $wpdb;
    684682
    685683        // Bail if no users.
     
    708706         * avoid running multiple queries per user in the loop.
    709707         *
    710          * Two BuddyPress components currently do this:
     708         * Three BuddyPress components currently do this:
    711709         * - XProfile: To override display names.
    712          * - Friends:  To set whether or not a user is the current users friend.
     710         * - Friends:  To set whether a user is the current users friend.
     711         * - Members:  To set last activity, total friend count, last update,
     712         *             and meta_key/meta_value if passed to the query.
    713713         *
    714714         * @see bp_xprofile_filter_user_query_populate_extras()
    715715         * @see bp_friends_filter_user_query_populate_extras()
     716         * @see bp_members_filter_user_query_populate_extras_last_activity()
     717         * @see bp_members_filter_user_query_populate_extras_friend_count_latest_update()
     718         * @see bp_members_filter_user_query_populate_extras_meta()
    716719         *
    717720         * @since 1.7.0
     
    721724         */
    722725        do_action_ref_array( 'bp_user_query_populate_extras', array( $this, $user_ids_sql ) );
    723 
    724         // Fetch last_active data from the activity table.
    725         $last_activities = BP_Core_User::get_last_activity( $this->user_ids );
    726 
    727         // Set a last_activity value for each user, even if it's empty.
    728         foreach ( $this->results as $user_id => $user ) {
    729             $user_last_activity                       = isset( $last_activities[ $user_id ]['date_recorded'] ) ? $last_activities[ $user_id ]['date_recorded'] : '';
    730             $this->results[ $user_id ]->last_activity = $user_last_activity;
    731         }
    732 
    733         // Fetch usermeta data
    734         // We want the three following pieces of info from usermeta:
    735         // - friend count
    736         // - latest update.
    737         $total_friend_count_key = bp_get_user_meta_key( 'total_friend_count' );
    738         $bp_latest_update_key   = bp_get_user_meta_key( 'bp_latest_update' );
    739 
    740         // Total_friend_count must be set for each user, even if its
    741         // value is 0.
    742         foreach ( $this->results as $uindex => $user ) {
    743             $this->results[ $uindex ]->total_friend_count = 0;
    744         }
    745 
    746         // Create, prepare, and run the separate usermeta query.
    747         $user_metas = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, meta_key, meta_value FROM {$wpdb->usermeta} WHERE meta_key IN (%s,%s) AND user_id IN ({$user_ids_sql})", $total_friend_count_key, $bp_latest_update_key ) );
    748 
    749         // The $members_template global expects the index key to be different
    750         // from the meta_key in some cases, so we rejig things here.
    751         foreach ( $user_metas as $user_meta ) {
    752             switch ( $user_meta->meta_key ) {
    753                 case $total_friend_count_key:
    754                     $key = 'total_friend_count';
    755                     break;
    756 
    757                 case $bp_latest_update_key:
    758                     $key = 'latest_update';
    759                     break;
    760             }
    761 
    762             if ( isset( $this->results[ $user_meta->user_id ] ) ) {
    763                 $this->results[ $user_meta->user_id ]->{$key} = $user_meta->meta_value;
    764             }
    765         }
    766 
    767         // When meta_key or meta_value have been passed to the query,
    768         // fetch the resulting values for use in the template functions.
    769         if ( ! empty( $this->query_vars['meta_key'] ) ) {
    770             $meta_sql = array(
    771                 'select' => 'SELECT user_id, meta_key, meta_value',
    772                 'from'   => "FROM $wpdb->usermeta",
    773                 'where'  => $wpdb->prepare( 'WHERE meta_key = %s', $this->query_vars['meta_key'] ),
    774             );
    775 
    776             if ( false !== $this->query_vars['meta_value'] ) {
    777                 $meta_sql['where'] .= $wpdb->prepare( ' AND meta_value = %s', $this->query_vars['meta_value'] );
    778             }
    779 
    780             $metas = $wpdb->get_results( "{$meta_sql['select']} {$meta_sql['from']} {$meta_sql['where']}" );
    781 
    782             if ( ! empty( $metas ) ) {
    783                 foreach ( $metas as $meta ) {
    784                     if ( isset( $this->results[ $meta->user_id ] ) ) {
    785                         $this->results[ $meta->user_id ]->meta_key = $meta->meta_key;
    786 
    787                         if ( ! empty( $meta->meta_value ) ) {
    788                             $this->results[ $meta->user_id ]->meta_value = $meta->meta_value;
    789                         }
    790                     }
    791                 }
    792             }
    793         }
    794726    }
    795727
  • trunk/src/bp-friends/bp-friends-filters.php

    r13092 r13994  
    4848    }
    4949}
    50 add_filter( 'bp_user_query_populate_extras', 'bp_friends_filter_user_query_populate_extras', 4, 2 );
     50add_action( 'bp_user_query_populate_extras', 'bp_friends_filter_user_query_populate_extras', 4, 2 );
    5151
    5252/**
  • trunk/src/bp-members/bp-members-filters.php

    r13878 r13994  
    3535
    3636    // Filters on sign-up fields.
    37     $fields = array (
     37    $fields = array(
    3838        'bp_get_signup_username_value',
    3939        'bp_get_signup_email_value',
     
    4747    // Add the filters to each field.
    4848    foreach ( $fields as $filter ) {
    49         add_filter( $filter, 'esc_html',       1 );
     49        add_filter( $filter, 'esc_html', 1 );
    5050        add_filter( $filter, 'wp_filter_kses', 2 );
    51         add_filter( $filter, 'stripslashes',   3 );
     51        add_filter( $filter, 'stripslashes', 3 );
    5252    }
    5353
     
    7676
    7777    if ( is_network_admin() && isset( $_POST['blog'] ) ) {
    78         $blog = $_POST['blog'];
     78        $blog   = $_POST['blog'];
    7979        $domain = '';
    8080
     
    8686            $illegal_names[] = $domain;
    8787        }
    88 
    8988    } else {
    9089        $illegal_names[] = buddypress()->signup->username;
     
    131130}
    132131add_filter( 'edit_profile_url', 'bp_members_edit_profile_url', 10, 3 );
     132
     133/**
     134 * Filter BP_User_Query::populate_extras to add last activity.
     135 *
     136 * @since 15.0.0
     137 *
     138 * @param BP_User_Query $user_query The BP_User_Query object.
     139 */
     140function bp_members_filter_user_query_populate_extras_last_activity( $user_query ) {
     141    $last_activities = BP_Core_User::get_last_activity( $user_query->user_ids );
     142
     143    // Set a last_activity value for each user, even if it's empty.
     144    foreach ( $user_query->results as $user_id => $user ) {
     145        $user_last_activity = isset( $last_activities[ $user_id ]['date_recorded'] )
     146            ? $last_activities[ $user_id ]['date_recorded']
     147            : '';
     148
     149        $user_query->results[ $user_id ]->last_activity = $user_last_activity;
     150    }
     151}
     152add_action( 'bp_user_query_populate_extras', 'bp_members_filter_user_query_populate_extras_last_activity' );
     153
     154/**
     155 * Filter BP_User_Query::populate_extras to add friend count & latest update.
     156 *
     157 * @since 15.0.0
     158 *
     159 * @global wpdb $wpdb WordPress database object.
     160 *
     161 * @param BP_User_Query $user_query   The BP_User_Query object.
     162 * @param string        $user_ids_sql Comma-separated list of user IDs to fetch extra
     163 *                                    data for, as determined by BP_User_Query.
     164 */
     165function bp_members_filter_user_query_populate_extras_friend_count_latest_update( $user_query, $user_ids_sql ) {
     166    global $wpdb;
     167
     168    $total_friend_count_key = bp_get_user_meta_key( 'total_friend_count' );
     169    $bp_latest_update_key   = bp_get_user_meta_key( 'bp_latest_update' );
     170
     171    // Total_friend_count must be set for each user, even if its
     172    // value is 0.
     173    foreach ( $user_query->results as $uindex => $user ) {
     174        $user_query->results[ $uindex ]->total_friend_count = 0;
     175    }
     176
     177    // Create, prepare, and run the separate usermeta query.
     178    $user_metas = $wpdb->get_results(
     179        $wpdb->prepare(
     180            "SELECT user_id, meta_key, meta_value FROM {$wpdb->usermeta} WHERE meta_key IN (%s,%s) AND user_id IN ({$user_ids_sql})",
     181            $total_friend_count_key,
     182            $bp_latest_update_key
     183        )
     184    );
     185
     186    // The $members_template global expects the index key to be different
     187    // from the meta_key in some cases, so we rejig things here.
     188    foreach ( $user_metas as $user_meta ) {
     189        switch ( $user_meta->meta_key ) {
     190            case $total_friend_count_key:
     191                $key = 'total_friend_count';
     192                break;
     193
     194            case $bp_latest_update_key:
     195                $key = 'latest_update';
     196                break;
     197        }
     198
     199        if ( isset( $user_query->results[ $user_meta->user_id ] ) ) {
     200            $user_query->results[ $user_meta->user_id ]->{$key} = $user_meta->meta_value;
     201        }
     202    }
     203}
     204add_action( 'bp_user_query_populate_extras', 'bp_members_filter_user_query_populate_extras_friend_count_latest_update', 10, 2 );
     205
     206/**
     207 * Filter BP_User_Query::populate_extras to add meta key / value.
     208 *
     209 * Only added if 'meta_key' or 'meta_value' is passed to the user query.
     210 *
     211 * @since 15.0.0
     212 *
     213 * @global wpdb $wpdb WordPress database object.
     214 *
     215 * @param BP_User_Query $user_query The BP_User_Query object.
     216 */
     217function bp_members_filter_user_query_populate_extras_meta( $user_query ) {
     218    global $wpdb;
     219
     220    if ( empty( $user_query->query_vars['meta_key'] ) ) {
     221        return;
     222    }
     223
     224    $meta_sql = array(
     225        'select' => 'SELECT user_id, meta_key, meta_value',
     226        'from'   => "FROM $wpdb->usermeta",
     227        'where'  => $wpdb->prepare( 'WHERE meta_key = %s', $user_query->query_vars['meta_key'] ),
     228    );
     229
     230    if ( false !== $user_query->query_vars['meta_value'] ) {
     231        $meta_sql['where'] .= $wpdb->prepare( ' AND meta_value = %s', $user_query->query_vars['meta_value'] );
     232    }
     233
     234    $metas = $wpdb->get_results( "{$meta_sql['select']} {$meta_sql['from']} {$meta_sql['where']}" );
     235
     236    if ( empty( $metas ) || ! is_array( $metas ) ) {
     237        return;
     238    }
     239
     240    foreach ( $metas as $meta ) {
     241        if ( isset( $user_query->results[ $meta->user_id ] ) ) {
     242            $user_query->results[ $meta->user_id ]->meta_key = $meta->meta_key;
     243
     244            if ( ! empty( $meta->meta_value ) ) {
     245                $user_query->results[ $meta->user_id ]->meta_value = $meta->meta_value;
     246            }
     247        }
     248    }
     249}
     250add_action( 'bp_user_query_populate_extras', 'bp_members_filter_user_query_populate_extras_meta' );
    133251
    134252/**
     
    241359        );
    242360
    243     // This user can register!
     361        // This user can register!
    244362    } else {
    245363
     
    302420
    303421            $message = implode( ' ', $message_parts );
    304         } else if ( 'nouveau' === bp_get_theme_package_id() ) {
     422        } elseif ( 'nouveau' === bp_get_theme_package_id() ) {
    305423            $message = sprintf(
    306424                /* translators: 1: The log in link `<a href="login_url">log in</a>`. 2: The lost password link `<a href="lost_password_url">log in</a>` */
  • trunk/src/bp-xprofile/bp-xprofile-filters.php

    r13878 r13994  
    1313defined( 'ABSPATH' ) || exit;
    1414
    15 add_filter( 'bp_get_the_profile_group_name',        'wp_filter_kses', 1 );
     15add_filter( 'bp_get_the_profile_group_name', 'wp_filter_kses', 1 );
    1616add_filter( 'bp_get_the_profile_group_description', 'wp_filter_kses', 1 );
    17 add_filter( 'bp_get_the_profile_field_name',        'wp_filter_kses', 1 );
    18 add_filter( 'bp_get_the_profile_field_edit_value',  'xprofile_sanitize_data_value_before_display', 1, 3 );
     17add_filter( 'bp_get_the_profile_field_name', 'wp_filter_kses', 1 );
     18add_filter( 'bp_get_the_profile_field_edit_value', 'xprofile_sanitize_data_value_before_display', 1, 3 );
    1919add_filter( 'bp_get_the_profile_field_description', 'wp_filter_kses', 1 );
    20 add_filter( 'bp_get_the_profile_field_value',       'xprofile_sanitize_data_value_before_display', 1, 3 );
    21 
    22 add_filter( 'bp_get_the_profile_field_value',           'wptexturize'        );
    23 add_filter( 'bp_get_the_profile_field_value',           'convert_chars'      );
    24 add_filter( 'bp_get_the_profile_field_value',           'wpautop'            );
    25 add_filter( 'bp_get_the_profile_field_value',           'force_balance_tags' );
    26 add_filter( 'bp_get_the_profile_field_value',           'make_clickable'    );
    27 add_filter( 'bp_get_the_profile_field_value',           'bp_xprofile_escape_field_data', 8, 3 );
    28 add_filter( 'bp_get_the_profile_field_value',           'convert_smilies', 9 );
    29 add_filter( 'bp_get_the_profile_field_value',           'xprofile_filter_format_field_value',        1, 2 );
    30 add_filter( 'bp_get_the_profile_field_value',           'xprofile_filter_format_field_value_by_type', 8, 3 );
    31 add_filter( 'bp_get_the_profile_field_value',           'xprofile_filter_link_profile_data',          9, 3 );
    32 
    33 add_filter( 'bp_get_the_profile_field_edit_value',      'force_balance_tags' );
    34 add_filter( 'bp_get_the_profile_field_edit_value',      'bp_xprofile_escape_field_data', 10, 3 );
    35 
    36 add_filter( 'bp_get_the_profile_group_name',            'stripslashes' );
    37 add_filter( 'bp_get_the_profile_group_description',     'stripslashes' );
    38 add_filter( 'bp_get_the_profile_field_value',           'stripslashes' );
    39 add_filter( 'bp_get_the_profile_field_edit_value',      'stripslashes' );
    40 add_filter( 'bp_get_the_profile_field_name',            'stripslashes' );
    41 add_filter( 'bp_get_the_profile_field_description',     'stripslashes' );
    42 
    43 add_filter( 'xprofile_get_field_data',                  'xprofile_sanitize_data_value_before_display_from_get_field_data', 1, 2 );
    44 add_filter( 'xprofile_field_name_before_save',          'wp_filter_kses', 1 );
    45 add_filter( 'xprofile_field_description_before_save',   'wp_filter_kses', 1 );
    46 
    47 add_filter( 'xprofile_get_field_data',                  'force_balance_tags' );
    48 add_filter( 'xprofile_field_name_before_save',          'force_balance_tags' );
    49 add_filter( 'xprofile_field_description_before_save',   'force_balance_tags' );
    50 
    51 add_filter( 'xprofile_get_field_data',                  'stripslashes' );
    52 add_filter( 'xprofile_get_field_data',                  'xprofile_filter_format_field_value_by_field_id', 5, 2 );
    53 
    54 add_filter( 'bp_xprofile_set_field_data_pre_validate',  'xprofile_filter_pre_validate_value_by_field_type', 10, 3 );
    55 add_filter( 'xprofile_data_value_before_save',          'xprofile_sanitize_data_value_before_save', 1, 4 );
     20add_filter( 'bp_get_the_profile_field_value', 'xprofile_sanitize_data_value_before_display', 1, 3 );
     21
     22add_filter( 'bp_get_the_profile_field_value', 'wptexturize' );
     23add_filter( 'bp_get_the_profile_field_value', 'convert_chars' );
     24add_filter( 'bp_get_the_profile_field_value', 'wpautop' );
     25add_filter( 'bp_get_the_profile_field_value', 'force_balance_tags' );
     26add_filter( 'bp_get_the_profile_field_value', 'make_clickable' );
     27add_filter( 'bp_get_the_profile_field_value', 'bp_xprofile_escape_field_data', 8, 3 );
     28add_filter( 'bp_get_the_profile_field_value', 'convert_smilies', 9 );
     29add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_format_field_value', 1, 2 );
     30add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_format_field_value_by_type', 8, 3 );
     31add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 3 );
     32
     33add_filter( 'bp_get_the_profile_field_edit_value', 'force_balance_tags' );
     34add_filter( 'bp_get_the_profile_field_edit_value', 'bp_xprofile_escape_field_data', 10, 3 );
     35
     36add_filter( 'bp_get_the_profile_group_name', 'stripslashes' );
     37add_filter( 'bp_get_the_profile_group_description', 'stripslashes' );
     38add_filter( 'bp_get_the_profile_field_value', 'stripslashes' );
     39add_filter( 'bp_get_the_profile_field_edit_value', 'stripslashes' );
     40add_filter( 'bp_get_the_profile_field_name', 'stripslashes' );
     41add_filter( 'bp_get_the_profile_field_description', 'stripslashes' );
     42
     43add_filter( 'xprofile_get_field_data', 'xprofile_sanitize_data_value_before_display_from_get_field_data', 1, 2 );
     44add_filter( 'xprofile_field_name_before_save', 'wp_filter_kses', 1 );
     45add_filter( 'xprofile_field_description_before_save', 'wp_filter_kses', 1 );
     46
     47add_filter( 'xprofile_get_field_data', 'force_balance_tags' );
     48add_filter( 'xprofile_field_name_before_save', 'force_balance_tags' );
     49add_filter( 'xprofile_field_description_before_save', 'force_balance_tags' );
     50
     51add_filter( 'xprofile_get_field_data', 'stripslashes' );
     52add_filter( 'xprofile_get_field_data', 'xprofile_filter_format_field_value_by_field_id', 5, 2 );
     53
     54add_filter( 'bp_xprofile_set_field_data_pre_validate', 'xprofile_filter_pre_validate_value_by_field_type', 10, 3 );
     55add_filter( 'xprofile_data_value_before_save', 'xprofile_sanitize_data_value_before_save', 1, 4 );
    5656add_filter( 'xprofile_filtered_data_value_before_save', 'trim', 2 );
    5757
    5858// Save field groups.
    59 add_filter( 'xprofile_group_name_before_save',        'wp_filter_kses' );
     59add_filter( 'xprofile_group_name_before_save', 'wp_filter_kses' );
    6060add_filter( 'xprofile_group_description_before_save', 'wp_filter_kses' );
    6161
    62 add_filter( 'xprofile_group_name_before_save',         'stripslashes' );
    63 add_filter( 'xprofile_group_description_before_save',  'stripslashes' );
     62add_filter( 'xprofile_group_name_before_save', 'stripslashes' );
     63add_filter( 'xprofile_group_description_before_save', 'stripslashes' );
    6464
    6565// Save fields.
    66 add_filter( 'xprofile_field_name_before_save',         'wp_filter_kses' );
    67 add_filter( 'xprofile_field_type_before_save',         'wp_filter_kses' );
    68 add_filter( 'xprofile_field_description_before_save',  'wp_filter_kses' );
    69 add_filter( 'xprofile_field_order_by_before_save',     'wp_filter_kses' );
    70 
    71 add_filter( 'xprofile_field_is_required_before_save',  'absint' );
    72 add_filter( 'xprofile_field_field_order_before_save',  'absint' );
     66add_filter( 'xprofile_field_name_before_save', 'wp_filter_kses' );
     67add_filter( 'xprofile_field_type_before_save', 'wp_filter_kses' );
     68add_filter( 'xprofile_field_description_before_save', 'wp_filter_kses' );
     69add_filter( 'xprofile_field_order_by_before_save', 'wp_filter_kses' );
     70
     71add_filter( 'xprofile_field_is_required_before_save', 'absint' );
     72add_filter( 'xprofile_field_field_order_before_save', 'absint' );
    7373add_filter( 'xprofile_field_option_order_before_save', 'absint' );
    74 add_filter( 'xprofile_field_can_delete_before_save',   'absint' );
     74add_filter( 'xprofile_field_can_delete_before_save', 'absint' );
    7575
    7676// Save field options.
     
    138138    if ( $field_id && bp_xprofile_is_richtext_enabled_for_field( $field_id ) ) {
    139139        $richtext_tags = array(
    140             'img'  => array( 'src' => 1, 'alt' => 1, 'width' => 1, 'height' => 1 ),
     140            'img'  => array(
     141                'src'    => 1,
     142                'alt'    => 1,
     143                'width'  => 1,
     144                'height' => 1,
     145            ),
    141146            'ul'   => array(),
    142147            'ol'   => array(),
     
    237242        $filtered_field_value = apply_filters( 'xprofile_filtered_data_value_before_save', $filtered_field_value, $field_value, $data_obj );
    238243
    239     // Sanitize multiple individual option values.
     244        // Sanitize multiple individual option values.
    240245    } else {
    241246        $filtered_values = array();
     
    426431        $values      = explode( ';', $field_value );
    427432
    428         array_walk( $values, function ( &$value, $key ) use ( $field_type, $field ) {
    429             $value = bp_xprofile_escape_field_data( $value, $field_type, $field->id );
    430         } );
     433        array_walk(
     434            $values,
     435            function ( &$value, $key ) use ( $field_type, $field ) {
     436                $value = bp_xprofile_escape_field_data( $value, $field_type, $field->id );
     437            }
     438        );
    431439    }
    432440
     
    439447                $new_values[] = make_clickable( $value );
    440448
    441             // Is not clickable.
     449                // Is not clickable.
    442450            } else {
    443451
     
    446454                    $new_values[] = $value;
    447455
    448                 // Less than 5 spaces.
     456                    // Less than 5 spaces.
    449457                } else {
    450458                    $query_arg    = bp_core_get_component_search_query_arg( 'members' );
     
    516524 * @since 1.7.0
    517525 *
    518  * @param BP_User_Query $user_query   User query to filter.
    519  * @param string        $user_ids_sql SQL statement to use.
    520  */
    521 function bp_xprofile_filter_user_query_populate_extras( BP_User_Query $user_query, $user_ids_sql = '' ) {
     526 * @param BP_User_Query $user_query The BP_User_Query object.
     527 */
     528function bp_xprofile_filter_user_query_populate_extras( $user_query ) {
    522529
    523530    if ( ! bp_is_active( 'xprofile' ) ) {
     
    534541    }
    535542}
    536 add_filter( 'bp_user_query_populate_extras', 'bp_xprofile_filter_user_query_populate_extras', 2, 2 );
     543add_action( 'bp_user_query_populate_extras', 'bp_xprofile_filter_user_query_populate_extras', 2 );
    537544
    538545/**
     
    541548 * @since 2.2.0
    542549 *
    543  * @param BP_User_Query $q User query object.
    544  */
    545 function bp_xprofile_add_xprofile_query_to_user_query( BP_User_Query $q ) {
     550 * @param BP_User_Query $q The BP_User_Query object.
     551 */
     552function bp_xprofile_add_xprofile_query_to_user_query( $q ) {
    546553
    547554    // Bail if no `xprofile_query` clause.
     
    555562    if ( ! empty( $sql['join'] ) ) {
    556563        $q->uid_clauses['select'] .= $sql['join'];
    557         $q->uid_clauses['where'] .= $sql['where'];
     564        $q->uid_clauses['where']  .= $sql['where'];
    558565    }
    559566}
     
    609616         * - append the 'object type' WHERE clause
    610617         */
    611         case 'SELECT' :
     618        case 'SELECT':
    612619            $q = str_replace(
    613620                array(
     
    630637         * - append the 'object type' WHERE clause
    631638         */
    632         case 'UPDATE' :
    633         case 'DELETE' :
     639        case 'UPDATE':
     640        case 'DELETE':
    634641            $q = str_replace(
    635642                array(
     
    650657         * - ensure that the object_type field gets filled in
    651658         */
    652         case 'INSERT' :
     659        case 'INSERT':
    653660            $q = str_replace(
    654661                array(
     
    658665                array(
    659666                    '`object_type`,`object_id`',
    660                     $wpdb->prepare( "VALUES (%s,", $matches[1] ),
     667                    $wpdb->prepare( 'VALUES (%s,', $matches[1] ),
    661668                ),
    662669                $q
     
    669676        for ( $i = 0; $i < count( $quoted_matches[0] ); $i++ ) {
    670677            $quote_pos = strpos( $q, '__QUOTE__' );
    671             $q = substr_replace( $q, $quoted_matches[0][ $i ], $quote_pos, 9 );
     678            $q         = substr_replace( $q, $quoted_matches[0][ $i ], $quote_pos, 9 );
    672679        }
    673680    }
Note: See TracChangeset for help on using the changeset viewer.