echo esc_attr(IG_PAGEBUILDER_USER_LAYOUT); ?> " /> <!-- Elements --> <?php // Get only the templates which saved by user. $user_templates = isset($data['files']) && isset($data['files'][IG_PAGEBUILDER_USER_LAYOUT]) ? $data['files'][IG_PAGEBUILDER_USER_LAYOUT] : array(); if (!count($user_templates)) { echo '<p class="jsn-bglabel">You did not save any page yet.</p>'; } else { $items = array(); $items[] = '<ul class="jsn-items-list " style="height: auto;">'; foreach ($user_templates as $name => $path) { $layout_name = IG_Pb_Helper_Layout::extract_layout_data($path, 'name'); $layout_name = empty($layout_name) ? __('— Untitled —') : $layout_name; $content = IG_Pb_Helper_Layout::extract_layout_data($path, 'content'); $items[] = '<li data-type="element" data-value="user_layout" data-id="' . $name . '" class="jsn-item premade-layout-item" style="display: list-item;"> ' . $layout_name . ' <i class="icon-trash delete-item"></i> <textarea style="display:none">' . $content . '</textarea> </li>'; } $items[] = '</ul>'; echo balanceTags(implode("\n", $items)); } ?> </div> </div> </div>
/** * Delete layout * * @return int */ function delete_layout() { if (!isset($_POST[IGNONCE]) || !wp_verify_nonce($_POST[IGNONCE], IGNONCE)) { return; } $group = sanitize_key($_POST['group']); $layout = urlencode($_POST['layout']); $delete = IG_Pb_Helper_Layout::remove_layout($group, $layout); echo esc_html($delete ? 1 : 0); exit; }