[wp-trac] [WordPress Trac] #49060: wp_die() to accept text_direction = 'ltr'

WordPress Trac noreply at wordpress.org
Sat Dec 21 16:49:51 UTC 2019


#49060: wp_die() to accept text_direction = 'ltr'
--------------------------+------------------------------
 Reporter:  apedog        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  I18N          |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by apedog):

 I see.
 The way I read this the problem is two-fold

 1. {{{_default_wp_die_handler()}}} prefers language_attributes over
 explicitly passed {{{text_direction}}}. ie. the argument is only a
 fallback. This is a design issue and is the main problem IMO.

 2. {{{_default_wp_die_handler()}}} cannot even know if
 {{{text_direction}}} was explicitly set in {{{$args}}} or was implicitly
 set by {{{_wp_die_process_input()}}} in {{{$parsed_args}}}. This is a
 minor technical issue.

 Filtering {{{language_attributes}}} seems like overkill to me.

 The way I see it, explicitly passed argument should be paramount. Followed
 by the current handling.
 in {{{_default_wp_die_handler()}}} it should look something like this:
 {{{
 $text_direction = $parsed_args['text_direction'];
 if ( ! empty( $args['text_direction'] ) && in_array(
 $args['text_direction'], array( 'ltr', 'rtl' ), true ) ){
     $dir_attr = "dir='$text_direction'";
 } else if ( function_exists( 'language_attributes' ) && function_exists(
 'is_rtl' ) ) {
     $dir_attr = get_language_attributes();
 } else {
     $dir_attr = "dir='$text_direction'";
 }
 }}}
 Note: the {{{if}}} condition is tested against {{{$args}}} - not
 {{{$parsed_args}}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49060#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list