|
1
|
|
|
<?php |
|
2
|
|
|
add_action( 'admin_menu', 'wp_syndicate_admin_menu' ); |
|
3
|
|
|
function wp_syndicate_admin_menu() { |
|
4
|
|
|
add_options_page( 'WP Syndicate', 'WP Syndicate', 'manage_options', 'wp_syndicate', 'wp_syndicate_options_page' ); |
|
5
|
|
|
} |
|
6
|
|
|
|
|
7
|
|
|
function wp_syndicate_options_page() { |
|
8
|
|
|
?> |
|
9
|
|
|
<div class="wrap"> |
|
10
|
|
|
|
|
11
|
|
|
<h2>WP Syndicate</h2> |
|
12
|
|
|
|
|
13
|
|
|
<form action="options.php" method="post"> |
|
14
|
|
|
<?php settings_fields( 'wp_syndicate_options' ); ?> |
|
15
|
|
|
<?php do_settings_sections( 'wp_syndicate' ); ?> |
|
16
|
|
|
|
|
17
|
|
|
<p class="submit"><input name="Submit" type="submit" value="<?php esc_attr_e( 'save' ); ?>" class="button-primary" /></p> |
|
18
|
|
|
</form> |
|
19
|
|
|
|
|
20
|
|
|
</div> |
|
21
|
|
|
<?php |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
add_action( 'admin_init', 'wp_syndicate_admin_init' ); |
|
25
|
|
|
function wp_syndicate_admin_init() { |
|
26
|
|
|
register_setting( 'wp_syndicate_options', 'wp_syndicate_options', 'wp_syndicate_options_validate' ); |
|
27
|
|
|
|
|
28
|
|
|
add_settings_section( 'wp_syndicate_main', __( 'configuration', WPSYND_DOMAIN ), 'wp_syndicate_section_text', 'wp_syndicate' ); |
|
29
|
|
|
|
|
30
|
|
|
add_settings_field( 'wp_syndicate_error_mail', __( 'error mail recipient', WPSYND_DOMAIN ), 'wp_syndicate_setting_error_mail', |
|
31
|
|
|
'wp_syndicate', 'wp_syndicate_main' ); |
|
32
|
|
|
add_settings_field( 'wp_syndicate_delete_log_term', __( 'feed log delete term', WPSYND_DOMAIN ), 'wp_syndicate_setting_delete_log_term', |
|
33
|
|
|
'wp_syndicate', 'wp_syndicate_main' ); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
function wp_syndicate_section_text() { |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
function wp_syndicate_setting_error_mail() { |
|
40
|
|
|
$options = get_option( 'wp_syndicate_options' ); |
|
41
|
|
|
|
|
42
|
|
|
echo '<input id="wp_syndicate_error_mail" name="wp_syndicate_options[error_mail]" size="40" type="text" value="' . esc_attr( $options['error_mail'] ) . '" />'; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
function wp_syndicate_setting_delete_log_term() { |
|
46
|
|
|
$options = get_option( 'wp_syndicate_options' ); |
|
47
|
|
|
|
|
48
|
|
|
echo '<input id="wp_syndicate_delete_log_term" name="wp_syndicate_options[delete_log_term]" size="5" type="text" value="' . esc_attr( $options['delete_log_term'] ) . '" /> ' . esc_html( __( 'day', WPSYND_DOMAIN ) ); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
function wp_syndicate_options_validate( $input ) { |
|
52
|
|
|
$newinput = array(); |
|
53
|
|
|
$newinput['error_mail'] = trim( $input['error_mail'] ); |
|
54
|
|
|
$newinput['delete_log_term'] = absint( $input['delete_log_term'] ); |
|
55
|
|
|
return $newinput; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
?> |
|
59
|
|
|
|