Esempio n. 1
0
function wpa_ziparc($zip, $dir, $base)
{
    $new_folder = str_replace($base, '', $dir);
    $zip->addEmptyDir($new_folder);
    foreach (glob($dir . '/*') as $file) {
        if (is_dir($file)) {
            wpa_ziparc($zip, $file, $base);
        } else {
            $new_file = str_replace($base, '', $file);
            $zip->addFile($file, $new_file);
        }
    }
}
/**
 * just a simple function to increase PHP limits.
 * @since 2.0.6
 */
function wpa_bump_limits()
{
    $time = isset($_POST['maxexec']) && '' != $_POST['maxexec'] ? $_POST['maxexec'] : 300;
    /*300 seconds = 5 minutes*/
    $mem = isset($_POST['maxmem']) && '' != $_POST['maxmem'] ? $_POST['maxmem'] . 'M' : '512M';
    @ini_set('memory_limit', $mem);
    @ini_set('max_execution_time', $time);
}
/**
 * @since 2.0.6
 */
function wpa_wpfs_init()
{
    if (!empty($_REQUEST['del'])) {
Esempio n. 2
0
function wpa_wpc_ajax_search_n_replace()
{
    check_ajax_referer('wpclone-ajax-submit', 'nonce');
    global $wpdb;
    $search = isset($_POST['search']) ? $_POST['search'] : '';
    $replace = isset($_POST['replace']) ? $_POST['replace'] : '';
    if (empty($search) || empty($replace)) {
        echo '<p class="error">Search and Replace values cannot be empty.</p>';
        wp_die();
    }
    wpa_bump_limits();
    $report = wpa_safe_replace_wrapper($search, $replace, $wpdb->prefix);
    echo wpa_wpc_search_n_replace_report($report);
    wp_die();
}