Пример #1
0
 * In case of POST the user is on the Yoast SEO import page and in case of the GET the user sees a notice from
 * Yoast SEO that we can import stuff for that plugin.
 */
if (filter_input(INPUT_POST, 'import') || filter_input(INPUT_GET, 'import')) {
    check_admin_referer('wpseo-import');
    $post_wpseo = filter_input(INPUT_POST, 'wpseo', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
    $replace = !empty($post_wpseo['deleteolddata']) && $post_wpseo['deleteolddata'] === 'on';
    if (!empty($post_wpseo['importwoo'])) {
        $import = new WPSEO_Import_WooThemes_SEO($replace);
    }
    if (!empty($post_wpseo['importaioseo']) || filter_input(INPUT_GET, 'importaioseo')) {
        $import = new WPSEO_Import_AIOSEO($replace);
    }
    if (!empty($post_wpseo['importheadspace'])) {
        $import = new WPSEO_Import_External($replace);
        $import->import_headspace();
    }
    if (!empty($post_wpseo['importwpseo']) || filter_input(INPUT_GET, 'importwpseo')) {
        $import = new WPSEO_Import_WPSEO($replace);
    }
    // Allow custom import actions.
    do_action('wpseo_handle_import');
}
if (isset($_FILES['settings_import_file'])) {
    check_admin_referer('wpseo-import-file');
    $import = new WPSEO_Import();
}
if (isset($import)) {
    /**
     * Allow customization of import&export message
     *