Settings.php
1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Tz\WordPress\Tools\Twitter\Settings;
use Tz\WordPress\Tools, Tz\WordPress\Tools\Auth, Tz\WordPress\Tools\Auth\Twitter;
const OPTION_SECTION = 'twit_creds';
call_user_func(function() {
Tools\add_actions(__NAMESPACE__ . '\Actions');
});
function dipslayPage() {
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'settings_view.php');
}
function validate($data) {
return $data;
}
class Actions {
public static function admin_init() {
register_setting(Auth\Settings\OPTION_GROUP, Twitter\OPTION_NAME, __NAMESPACE__ . '\validate');
add_settings_section(OPTION_SECTION, 'Twitter Credentials', function() {}, Auth\Settings\ADMIN_PAGE);
Tools\add_settings_fields(__NAMESPACE__ . '\Fields', Auth\Settings\ADMIN_PAGE, OPTION_SECTION);
}
}
class Fields {
public static function api_key() {
echo '<input type="text" id="' . __FUNCTION__ . '" name="' . Twitter\OPTION_NAME . '[' . __FUNCTION__ . ']" value="' . Twitter\Vars::$options[__FUNCTION__] . '" size="30" />';
}
public static function secret() {
echo '<input type="text" id="' . __FUNCTION__ . '" name="' . Twitter\OPTION_NAME . '[' . __FUNCTION__ . ']" value="' . Twitter\Vars::$options[__FUNCTION__] . '" size="45" />';
}
}
?>