public function delete_layout_record_callback()
 {
     // Clear any errors that may have been rendered that we don't have control of.
     if (ob_get_length()) {
         ob_clean();
     }
     global $wpddlayout;
     if (user_can_delete_layouts() === false) {
         die(WPDD_Utils::ajax_caps_fail(__METHOD__));
     }
     if ($_POST && wp_verify_nonce($_POST['layout-delete-layout-nonce'], 'layout-delete-layout-nonce')) {
         $layout_id = $_POST['layout_id'];
         $current_page_status = isset($_POST['current_page_status']) ? $_POST['current_page_status'] : 'trash';
         if (!is_array($layout_id)) {
             $layout_id = array($layout_id);
         }
         $message = array();
         foreach ($layout_id as $id) {
             $res = wp_delete_post($id, true);
             // if deleted clean from options
             if ($res !== false) {
                 $wpddlayout->post_types_manager->clean_layout_post_type_option($id);
                 $message[] = $res->ID;
             }
         }
         $send = $this->get_send($current_page_status, false, $layout_id, $message, $_POST);
     } else {
         $send = wp_json_encode(array('error' => __(sprintf('Nonce problem: apparently we do not know where the request comes from. %s', __METHOD__), 'ddl-layouts')));
     }
     die($send);
 }
 function preload_scripts()
 {
     global $wpddlayout;
     //speed up ajax calls sensibly
     wp_deregister_script('heartbeat');
     wp_register_script('heartbeat', false);
     $wpddlayout->enqueue_scripts(array('jquery-ui-cell-sortable', 'jquery-ui-custom-sortable', 'jquery-ui-resizable', 'jquery-ui-tabs', 'wp-pointer', 'backbone', 'select2', 'toolset-utils', 'wp-pointer', 'wp-mediaelement', 'ddl-sanitize-html', 'ddl-sanitize-helper', 'ddl-post-types', 'ddl-editor-main', 'media_uploader_js', 'icl_media-manager-js'));
     $wpddlayout->localize_script('ddl-editor-main', 'icl_media_manager', array('only_img_allowed_here' => __("You can only use an image file here", 'ddl-layouts')));
     $wpddlayout->localize_script('ddl-editor-main', 'DDLayout_settings', array('DDL_JS' => array('available_cell_types' => $wpddlayout->get_cell_types(), 'res_path' => WPDDL_RES_RELPATH, 'lib_path' => WPDDL_RES_RELPATH . '/js/external_libraries/', 'editor_lib_path' => WPDDL_GUI_RELPATH . "editor/js/", 'common_rel_path' => WPDDL_TOOLSET_COMMON_RELPATH, 'dialogs_lib_path' => WPDDL_GUI_RELPATH . "dialogs/js/", 'layout_id' => $this->layout_id, 'create_layout_nonce' => wp_create_nonce('create_layout_nonce'), 'save_layout_nonce' => wp_create_nonce('save_layout_nonce'), 'ddl-view-layout-nonce' => wp_create_nonce('ddl-view-layout-nonce'), 'ddl_show_all_posts_nonce' => wp_create_nonce('ddl_show_all_posts_nonce'), 'edit_layout_slug_nonce' => wp_create_nonce('edit_layout_slug_nonce'), 'compact_display_nonce' => wp_create_nonce('compact_display_nonce'), 'compact_display_mode' => $wpddlayout->get_option('compact_display'), 'DEBUG' => WPDDL_DEBUG, 'strings' => $this->get_editor_js_strings(), 'has_theme_sections' => $wpddlayout->has_theme_sections(), 'AMOUNT_OF_POSTS_TO_SHOW' => self::AMOUNT_OF_POSTS_TO_SHOW, 'is_css_enabled' => $wpddlayout->css_manager->is_css_possible(), 'current_framework' => $wpddlayout->frameworks_options_manager->get_current_framework(), 'cred_layout_css_text' => __('Layouts cell styling', 'ddl-layouts'), 'removed_cells' => $this->removed_cells, 'user_can_delete' => user_can_delete_layouts(), 'user_can_assign' => user_can_assign_layouts(), 'user_can_edit' => user_can_edit_layouts(), 'user_can_create' => user_can_create_layouts()), 'DDL_OPN' => WPDD_LayoutsListing::change_layout_dialog_options_name()));
     $wpddlayout->enqueue_cell_scripts();
 }