Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
3b5668b0
authored
2009-07-20 14:01:43 +0000
by
Chris Boden
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added defaults option
1 parent
53f8033a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletions
WP_Option.php
WP_Option.php
View file @
3b5668b
<?php
/*
* I made a boo boo
* This only works with Array variables
*/
class
WP_Option
implements
ArrayAccess
,
Countable
{
private
$_ns
;
private
$_data
=
Array
();
public
function
__construct
(
$ns
)
{
public
function
__construct
(
$ns
,
$defaults
=
null
)
{
$this
->
_ns
=
$ns
;
$this
->
_data
=
get_option
(
$ns
);
if
(
!
is_null
(
$defaults
)
&&
is_array
(
$defaults
))
{
foreach
(
$this
->
_data
as
$key
=>
$val
)
{
$defaults
[
$key
]
=
$val
;
}
if
(
$this
->
_data
!=
$defaults
)
{
$this
->
_data
=
$defaults
;
$this
->
save
();
}
}
}
public
function
offsetExists
(
$var
)
{
...
...
Please
register
or
sign in
to post a comment