function load_settings_page() { // Triggered on settings save if ($_POST["ilc-settings-submit"] == 'Y') { check_admin_referer("ilc-settings-page"); save_theme_settings(); $url_parameters = isset($_GET['tab']) ? 'updated=true&tab=' . $_GET['tab'] : 'updated=true'; wp_redirect(admin_url('themes.php?page=theme-settings&' . $url_parameters)); exit; } }
add_theme_page('MyMinyxLITE 设置', 'MyMinyxLITE 设置', 'edit_themes', 'theme-settings.php', 'theme_settings'); } if (isset($_REQUEST['page']) && $_REQUEST['page'] == basename(__FILE__)) { global $themename, $shortname, $options; global $GOOGLE_ANALYTICS_ID_PARA, $GOOGLE_CSE_ID_PARA, $ENABLE_LAZY_LOAD_PARA, $ENABLE_FACEBOX_PARA, $PERSONAL_INFO_PARA, $JQUERY_SOURCE, $ENABLE_COMMENTS_MAIL_NOTIFY, $COMMENTS_EMAIL_FROM, $ENABLE_ADMIN_COMMENTS_MAIL_NOTIFY, $THEME_OPTIONS_PREFIX, $ENABLE_MAKEITUP_COMMENT; if (isset($_POST['save'])) { save_theme_settings($GOOGLE_ANALYTICS_ID_PARA, filterUserInput($_REQUEST[$GOOGLE_ANALYTICS_ID_PARA])); save_theme_settings($GOOGLE_CSE_ID_PARA, filterUserInput($_REQUEST[$GOOGLE_CSE_ID_PARA])); save_theme_settings($ENABLE_LAZY_LOAD_PARA, filterUserInput($_REQUEST[$ENABLE_LAZY_LOAD_PARA])); save_theme_settings($ENABLE_FACEBOX_PARA, filterUserInput($_REQUEST[$ENABLE_FACEBOX_PARA])); save_theme_settings($ENABLE_MAKEITUP_COMMENT, filterUserInput($_REQUEST[$ENABLE_MAKEITUP_COMMENT])); save_theme_settings($PERSONAL_INFO_PARA, filterUserInput($_REQUEST[$PERSONAL_INFO_PARA])); save_theme_settings($JQUERY_SOURCE, filterUserInput($_REQUEST[$JQUERY_SOURCE])); save_theme_settings($ENABLE_COMMENTS_MAIL_NOTIFY, filterUserInput($_REQUEST[$ENABLE_COMMENTS_MAIL_NOTIFY])); save_theme_settings($COMMENTS_EMAIL_FROM, filterUserInput($_REQUEST[$COMMENTS_EMAIL_FROM])); save_theme_settings($ENABLE_ADMIN_COMMENTS_MAIL_NOTIFY, filterUserInput($_REQUEST[$ENABLE_ADMIN_COMMENTS_MAIL_NOTIFY])); wp_redirect(admin_url('themes.php?page=theme-settings.php&event=saveComplete')); die; } else { if (isset($_POST['reset'])) { delete_option($THEME_OPTIONS_PREFIX . $GOOGLE_ANALYTICS_ID_PARA); delete_option($THEME_OPTIONS_PREFIX . $GOOGLE_CSE_ID_PARA); delete_option($THEME_OPTIONS_PREFIX . $ENABLE_LAZY_LOAD_PARA); delete_option($THEME_OPTIONS_PREFIX . $ENABLE_FACEBOX_PARA); delete_option($THEME_OPTIONS_PREFIX . $ENABLE_MAKEITUP_COMMENT); delete_option($THEME_OPTIONS_PREFIX . $PERSONAL_INFO_PARA); delete_option($THEME_OPTIONS_PREFIX . $JQUERY_SOURCE); delete_option($THEME_OPTIONS_PREFIX . $COMMENTS_EMAIL_FROM); delete_option($THEME_OPTIONS_PREFIX . $ENABLE_COMMENTS_MAIL_NOTIFY); delete_option($THEME_OPTIONS_PREFIX . $ENABLE_ADMIN_COMMENTS_MAIL_NOTIFY); wp_redirect(admin_url('themes.php?page=theme-settings.php&event=resetComplete'));