Skip to:
Content

bbPress.org


Ignore:
Timestamp:
09/05/2018 06:55:06 PM (10 months ago)
Author:
johnjamesjacoby
Message:

Theme Compat: introduce bbp_locate_enqueueable() and bbp_urlize_enqueueable().

These functions are used to help make locating enqueueable assets easier, and use bbp_locate_template() interntally, now accepting an array of files.

In addition, bbp_locate_enqueueable() also internally juggles minimized file variations, and stacks them according to the SCRIPT_DEBUG constant. This ensures that both minimized and unminimized file variants are in the array in the preferred order.

This fixes a regression between bbPress 2.5 and 2.6 caused by the bundling of minimized assets in theme compatibility, and ensures that sites with their own bbpress.css files in their own locations will continue to get loaded, regardless of the SCRIPT_DEBUG setting.

Fixes #3218.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/templates/default/bbpress-functions.php

    r6795 r6862  
    4141     *
    4242     * @since 2.1.0 bbPress (r3732)
    43      *
    4443     */
    4544    public function __construct( $properties = array() ) {
     
    6261     *
    6362     * @access private
    64      *
    6563     */
    6664    private function setup_actions() {
     
    118116     *
    119117     * @since 2.1.0 bbPress (r3732)
    120      *
    121118     */
    122119    public function enqueue_styles() {
     
    124121        // RTL and/or minified
    125122        $suffix  = is_rtl() ? '-rtl' : '';
    126         $suffix .= defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    127123
    128124        // Get and filter the bbp-default style
    129125        $styles = apply_filters( 'bbp_default_styles', array(
    130126            'bbp-default' => array(
    131                 'file'         => 'css/bbpress' . $suffix . '.css',
     127                'file'         => 'css/bbpress.css',
    132128                'dependencies' => array()
    133129            )
     
    144140     *
    145141     * @since 2.1.0 bbPress (r3732)
    146      *
    147142     */
    148143    public function enqueue_scripts() {
     
    150145        // Setup scripts array
    151146        $scripts = array();
    152 
    153         // Minified
    154         $suffix  = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    155147
    156148        // Editor scripts
     
    158150        if ( bbp_use_wp_editor() && is_bbpress() ) {
    159151            $scripts['bbpress-editor'] = array(
    160                 'file'         => 'js/editor' . $suffix . '.js',
     152                'file'         => 'js/editor.js',
    161153                'dependencies' => array( 'jquery' )
    162154            );
     
    166158        if ( bbp_is_single_forum() ) {
    167159            $scripts['bbpress-engagements'] = array(
    168                 'file'         => 'js/engagements' . $suffix . '.js',
     160                'file'         => 'js/engagements.js',
    169161                'dependencies' => array( 'jquery' )
    170162            );
     
    176168            // Engagements
    177169            $scripts['bbpress-engagements'] = array(
    178                 'file'         => 'js/engagements' . $suffix . '.js',
     170                'file'         => 'js/engagements.js',
    179171                'dependencies' => array( 'jquery' )
    180172            );
     
    183175            if ( bbp_thread_replies() ) {
    184176                $scripts['bbpress-reply'] = array(
    185                     'file'         => 'js/reply' . $suffix . '.js',
     177                    'file'         => 'js/reply.js',
    186178                    'dependencies' => array( 'jquery' )
    187179                );
     
    209201     *
    210202     * @since 2.1.0 bbPress (r3732)
    211      *
    212203     */
    213204    public function localize_topic_script() {
     
    227218     *
    228219     * @since 2.1.0 bbPress (r3732)
    229      *
    230220     */
    231221    public function ajax_favorite() {
     
    291281     *
    292282     * @since 2.1.0 bbPress (r3732)
    293      *
    294283     */
    295284    public function ajax_subscription() {
Note: See TracChangeset for help on using the changeset viewer.