other options
This commit is contained in:
parent
33358a4ec2
commit
e2c5b30173
@ -62,6 +62,23 @@ class WhatDidTheySayAdmin {
|
|||||||
$this->_update_options('allowed_users', $allowed_users);
|
$this->_update_options('allowed_users', $allowed_users);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handle_update_options($requested_options) {
|
||||||
|
$updated_options = array(
|
||||||
|
'only_allowed_users' => false
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($requested_options as $option => $value) {
|
||||||
|
switch ($option) {
|
||||||
|
case 'only_allowed_users':
|
||||||
|
$updated_options['only_allowed_users'] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = array_merge(get_option('what-did-they-say-options'), $updated_options);
|
||||||
|
update_option('what-did-they-say-options', $options);
|
||||||
|
}
|
||||||
|
|
||||||
function read_language_file() {
|
function read_language_file() {
|
||||||
if (file_exists($this->language_file)) {
|
if (file_exists($this->language_file)) {
|
||||||
foreach (file($this->language_file, FILE_IGNORE_NEW_LINES) as $language) {
|
foreach (file($this->language_file, FILE_IGNORE_NEW_LINES) as $language) {
|
||||||
|
@ -38,6 +38,20 @@ class WhatDidTheySayAdminTest extends PHPUnit_Framework_TestCase {
|
|||||||
$options = get_option('what-did-they-say-options');
|
$options = get_option('what-did-they-say-options');
|
||||||
$this->assertEquals(array(1), $options['allowed_users']);
|
$this->assertEquals(array(1), $options['allowed_users']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testHandleUpdateOptions() {
|
||||||
|
$admin = new WhatDidTheySayAdmin();
|
||||||
|
|
||||||
|
update_option('what-did-they-say-options', array('only_allowed_users' => false));
|
||||||
|
|
||||||
|
$admin->handle_update_options(array(
|
||||||
|
'only_allowed_users' => 'yes'
|
||||||
|
));
|
||||||
|
|
||||||
|
$options = get_option('what-did-they-say-options');
|
||||||
|
$this->assertTrue($options['only_allowed_users']);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user