WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#4626 closed defect (bug) (fixed)

balanceTags() should not be option dependent

Reported by: mdawaffe Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.2.1
Component: Administration Keywords:
Focuses: Cc:

Description

As a formatting function, balanceTags() should do just that - balance the tags. It's behavior should not depend on the use_balanceTags option. Whether the function is *called* should depend on the option.

Attached:

  1. makes balanceTags() option agnostic
  2. deprecates force_balance_tags()
  3. creates wp_balance_tags() which calls balanceTags() depending on the use_balanceTags option.

#2650 suggested the same and offered a patch that maintained backward compatibility. This patch is cleaner but breaks backward compatibility for some plugins. The older ticket was rejected, but I think the idea should be reconsidered (hence this ticket).

Attachments (2)

4626.diff (2.9 KB) - added by mdawaffe 10 years ago.
4626b.diff (1.1 KB) - added by mdawaffe 10 years ago.
backward compatibility method

Download all attachments as: .zip

Change History (4)

@mdawaffe
10 years ago

#1 @mdawaffe
10 years ago

To be backward compatible, we could do essentially what #2650 suggested:

function balanceTags( $text, $force = false ) {
    if ( !$force && get_option('use_balanceTags') == 0 )
        return $text;
    return force_balance_tags( $text );
}

function force_balance_tags( $text ) {
    // old balanceTags code without option check
}

@mdawaffe
10 years ago

backward compatibility method

#2 @ryan
10 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [5805]) Make balanceTags() option independent. Props mdawaffe. fixes #4626

Note: See TracTickets for help on using tickets.