예제 #1
0
 * @package YMBESEO\Admin
 */
if (!defined('YMBESEO_VERSION')) {
    header('Status: 403 Forbidden');
    header('HTTP/1.1 403 Forbidden');
    exit;
}
$yform = Yoast_Form::get_instance();
$options = get_site_option('YMBESEO_ms');
if (isset($_POST['YMBESEO_submit'])) {
    check_admin_referer('wpseo-network-settings');
    foreach (array('access', 'defaultblog') as $opt) {
        $options[$opt] = $_POST['YMBESEO_ms'][$opt];
    }
    unset($opt);
    YMBESEO_Options::update_site_option('YMBESEO_ms', $options);
    add_settings_error('YMBESEO_ms', 'settings_updated', __('Settings Updated.', 'ymbeseo'), 'updated');
}
if (isset($_POST['YMBESEO_restore_blog'])) {
    check_admin_referer('wpseo-network-restore');
    if (isset($_POST['YMBESEO_ms']['restoreblog']) && is_numeric($_POST['YMBESEO_ms']['restoreblog'])) {
        $restoreblog = (int) YMBESEO_Utils::validate_int($_POST['YMBESEO_ms']['restoreblog']);
        $blog = get_blog_details($restoreblog);
        if ($blog) {
            YMBESEO_Options::reset_ms_blog($restoreblog);
            add_settings_error('YMBESEO_ms', 'settings_updated', sprintf(__('%s restored to default SEO settings.', 'ymbeseo'), esc_html($blog->blogname)), 'updated');
        } else {
            add_settings_error('YMBESEO_ms', 'settings_updated', sprintf(__('Blog %s not found.', 'ymbeseo'), esc_html($restoreblog)), 'error');
        }
        unset($restoreblog, $blog);
    }