WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #22325, comment 20


Ignore:
Timestamp:
11/02/2012 09:36:13 PM (9 years ago)
Author:
MikeSchinkel
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22325, comment 20

    initial v1  
    7272> // vs:
    7373> if ( _check( _get( 'myVar' ), 'default value' ) )
     74> }}}
    7475
    7576This adds even more surface area to WordPress.  There's a cost in terms of runtime overhead, and learning; everyone will need to learn what `_check()` does. People who are familiar with PHP don't have to learn this:
     
    8586In the case of the proposed `_GET()`, we'd already be are adding it so we can kill three (3) birds with one stone; #2: Be graceful when $_GET['foo'] doesn't exist, and #3: Allow us to add a default value when we need one.
    8687
     88> {{{
    8789> // vs:
    8890> if ( _GET( 'myVar', 'default value' ) != 'default value' )
     
    9496
    9597{{{
    96 > if ( _GET( 'myVar' ) != 'default value' )
     98if ( _GET( 'myVar' ) != 'default value' )
    9799}}}
    98100
    99101> And finally to output the value:
    100102>
     103> {{{
    101104> // vs:
    102105> echo _default( _get( 'myVar'), 'default value' );