コード例 #1
0
ファイル: network.php プロジェクト: KevinFairbanks/ymbeseo
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);
    }
}
/* Set up selectbox dropdowns for smaller networks (usability) */
$use_dropdown = true;
if (get_blog_count() > 100) {
    $use_dropdown = false;
} else {
    $sites = wp_get_sites(array('deleted' => 0));
    if (is_array($sites) && $sites !== array()) {
        $dropdown_input = array('-' => __('None', 'ymbeseo'));