예제 #1
0
wp_enqueue_script('tagsinput', get_template_directory_uri() . '/js/bootstrap-tagsinput.min.js');
wp_enqueue_script('tagsinput-angular', get_template_directory_uri() . '/js/bootstrap-tagsinput-angular.min.js');
wp_enqueue_style('tagsinput', get_template_directory_uri() . '/css/bootstrap-tagsinput.css');
wp_enqueue_style('app', get_template_directory_uri() . '/css/app.css');
wp_enqueue_style('croppiecss', get_template_directory_uri() . '/css/croppie.css');
$updated = false;
$error = false;
$not_found = false;
$message = "";
//if we have a $building (id), we can update it
$building_id = intval(htmlspecialchars(get_query_var('buildingid', 0)));
$user_id = get_current_user_id();
//form data is present
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (isset($_POST['image_upload_nonce']) && wp_verify_nonce($_POST['image_upload_nonce'], 'image_upload')) {
        $result = Idp_Main::storeImages($building_id, $user_id);
        if ($result == $building_id) {
            $updated = true;
            $message = __('Image(s) stored successfully.', 'idp-theme');
        } else {
            if ($result == -1) {
                $message = __('There was an error saving one of the images.', 'idp-theme');
            } else {
                if ($result == -2) {
                    $message = __('At least one of the images was of the wrong filetype and/or exceeded the file size limit.', 'idp-theme');
                }
            }
            $error = true;
        }
    } else {
        if (isset($_POST['set_main_image_nonce']) && wp_verify_nonce($_POST['set_main_image_nonce'], 'set_main_image')) {