| @@ -43,52 +43,16 @@ | ||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function get( $name, $wantArray = false ) |
| 46 | 46 | { |
| 47 | - static $repo = null; | |
| 48 | - if( null === $repo ){ | |
| 49 | - $repo = wp_load_alloptions(); | |
| 50 | - } | |
| 51 | - | |
| 52 | 47 | $ret = null; |
| 53 | 48 | |
| 54 | 49 | if( array_key_exists($name, $this->loaded) ){ |
| 55 | - $ret = $this->loaded[ $name ]; | |
| 56 | - } | |
| 57 | - else { | |
| 58 | - $default = array_key_exists( $name, $this->defaults ) ? $this->defaults[$name] : null; | |
| 59 | - | |
| 60 | - $prefixedName = $this->prefix . $name; | |
| 61 | - $ret = array_key_exists( $prefixedName, $repo ) ? $repo[ $prefixedName ] : $default; | |
| 62 | - $ret = maybe_unserialize( $ret ); | |
| 63 | - | |
| 64 | - if( null !== $ret ){ | |
| 65 | - $this->loaded[ $name ] = $ret; | |
| 66 | - } | |
| 67 | - } | |
| 68 | - | |
| 69 | - if( $wantArray && (! is_array($ret)) ){ | |
| 70 | - $ret = ( null === $ret ) ? array() : array($ret); | |
| 71 | - } | |
| 72 | - | |
| 73 | - if( (! $wantArray) && is_array($ret) ){ | |
| 74 | - $ret = array_shift( $ret ); | |
| 75 | - } | |
| 76 | - | |
| 77 | - return $ret; | |
| 78 | - } | |
| 79 | - | |
| 80 | - public function get_( $name, $wantArray = false ) | |
| 81 | - { | |
| 82 | - $ret = null; | |
| 83 | - | |
| 84 | - if( array_key_exists($name, $this->loaded) ){ | |
| 85 | 50 | $ret = $this->loaded[$name]; |
| 86 | 51 | } |
| 87 | 52 | else { |
| 88 | 53 | $default = array_key_exists($name, $this->defaults) ? $this->defaults[$name] : NULL; |
| 89 | 54 | $ret = get_option( $this->prefix . $name, $default ); |
| 90 | - | |
| 91 | 55 | if( NULL !== $ret ){ |
| 92 | 56 | $this->loaded[$name] = $ret; |
| 93 | 57 | } |
| 94 | 58 | } |