<?php

/** Sets up the WordPress Environment. */
require( dirname(__FILE__) . '/../../../../../wp-load.php' );

check_admin_referer('theme_template_export');

include_once('filesHelper.php');
include_once('themeHelper.php');

$archive_file = theme_get_theme_archive();

if (is_readable($archive_file)) {
    $archive_name = 'designer_theme.zip';

    header("Content-Type: application/zip");
    header("Content-Disposition: attachment; filename=$archive_name");
    header("Content-Length: " . filesize($archive_file));

    readfile($archive_file);
    exit;
}

die('1');