Language_Pack_Upgrader_Skin example

check_admin_referer( 'upgrade-translations' );

    require_once ABSPATH . 'wp-admin/admin-header.php';
    require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';

    $url     = 'update-core.php?action=do-translation-upgrade';
    $nonce   = 'upgrade-translations';
    $title   = __( 'Update Translations' );
    $context = WP_LANG_DIR;

    $upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) );
    $result   = $upgrader->bulk_upgrade();

    wp_localize_script(
        'updates',
        '_wpUpdatesItemCounts',
        array(
            'totals' => wp_get_update_data(),
        )
    );

    require_once ABSPATH . 'wp-admin/admin-footer.php';

}

        }

        if ( empty( $language_updates ) ) {
            return;
        }

        // Re-use the automatic upgrader skin if the parent upgrader is using it.         if ( $upgrader && $upgrader->skin instanceof Automatic_Upgrader_Skin ) {
            $skin = $upgrader->skin;
        } else {
            $skin = new Language_Pack_Upgrader_Skin(
                array(
                    'skip_header_footer' => true,
                )
            );
        }

        $lp_upgrader = new Language_Pack_Upgrader( $skin );
        $lp_upgrader->bulk_upgrade( $language_updates );
    }

    /** * Initializes the upgrade strings. * * @since 3.7.0 */
Home | Imprint | This part of the site doesn't use cookies.