[wp-trac] Re: [WordPress Trac] #5384: wp_flag api

WordPress Trac wp-trac at lists.automattic.com
Sat Nov 24 07:18:27 GMT 2007


#5384: wp_flag api
-------------------------+--------------------------------------------------
 Reporter:  tellyworth   |        Owner:  anonymous
     Type:  enhancement  |       Status:  new      
 Priority:  normal       |    Milestone:  2.5      
Component:  General      |      Version:           
 Severity:  normal       |   Resolution:           
 Keywords:               |  
-------------------------+--------------------------------------------------
Comment (by darkdragon):

 {{{
 class WP_Registry
 {
     var $_data = array();

     function set($name, $value) {
         $this->_data[$name] = $value;
     }

     function get($name) {
         if( isset($this->_data[$name]) )
             return $this->_data[$name];

         return null;
     }
 }

 function &_wp_flag() {
     static $objRegistry;

     if($objRegistry == null)
         $objRegistry = new WP_Registry();

     return $objRegistry;
 }

 function wp_flag_set($name, $value=true) {
     $registry = _wp_flag();
     $registry->set($name, $value);
 }

 function wp_flag_get($name) {
     $registry = _wp_flag();
     return $registry->get($name);
 }

 function &wp_registry() {
     return _wp_flag();
 }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5384#comment:6>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list