| @@ -4,8 +4,9 @@ | ||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | use WPCoder\Dashboard\DashboardInitializer; |
| 7 | 7 | use WPCoder\Dashboard\Field; |
| 8 | +use WPCoder\Dashboard\Link; | |
| 8 | 9 | use WPCoder\Dashboard\Settings; |
| 9 | 10 | use WPCoder\WPCoder; |
| 10 | 11 | |
| 11 | 12 | defined( 'ABSPATH' ) || exit; |
| @@ -11,65 +12,90 @@ | ||
| 11 | 12 | defined( 'ABSPATH' ) || exit; |
| 12 | 13 | |
| 13 | 14 | $default = Field::getDefault(); |
| 14 | 15 | |
| 16 | + | |
| 15 | 17 | $action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ''; |
| 16 | 18 | $item_id = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : ''; |
| 17 | -$item_title = __( 'Add new code', 'wpcoder' ); | |
| 19 | +$item_title = __( 'Add new code', 'wp-coder' ); | |
| 18 | 20 | if ( $action === 'update' && ! empty( $item_id ) ) { |
| 19 | - $item_title = __( 'Update code', 'wpcoder' ) . ' ID: ' . $item_id; | |
| 21 | + $item_title = __( 'Update code', 'wp-coder' ) . ' ID: ' . $item_id; | |
| 20 | 22 | } elseif ( $action === 'duplicate' && ! empty( $item_id ) ) { |
| 21 | - $item_title = __( 'Duplicate the code from', 'wpcoder' ) . ' ID: ' . $item_id; | |
| 23 | + $item_title = __( 'Duplicate the code from', 'wp-coder' ) . ' ID: ' . $item_id; | |
| 22 | 24 | } |
| 23 | -$license_page = add_query_arg( ['page' => WPCoder::SLUG . '-license' ], admin_url( 'admin.php' ) ) | |
| 25 | +$license_page = add_query_arg( [ 'page' => WPCoder::SLUG . '-license' ], admin_url( 'admin.php' ) ); | |
| 26 | +$add_url = add_query_arg( [ | |
| 27 | + 'page' => WPCoder::SLUG . '-settings', | |
| 28 | + 'action' => 'new' | |
| 29 | +], admin_url( 'admin.php' ) ); | |
| 30 | + | |
| 31 | +$duplicate_url = add_query_arg( [ | |
| 32 | + 'page' => WPCoder::SLUG . '-settings', | |
| 33 | + 'action' => 'duplicate', | |
| 34 | + 'id' => $item_id, | |
| 35 | +], admin_url( 'admin.php' ) ); | |
| 36 | + | |
| 24 | 37 | ?> |
| 25 | 38 | |
| 26 | - <div class="wowp-header-wrapper"> | |
| 39 | + <div class="wowp"> | |
| 40 | + | |
| 27 | 41 | <?php DashboardInitializer::header(); ?> |
| 28 | 42 | |
| 29 | - <div class="wowp-header-title"> | |
| 30 | - <h2><?php echo esc_html( $item_title ); ?></h2> | |
| 43 | + <div class="wowp-page-header"> | |
| 44 | + <h2 class="wowp-page-header__title"> | |
| 45 | + <?php echo esc_html( $item_title ); ?> | |
| 46 | + </h2> | |
| 31 | 47 | |
| 32 | - </div> | |
| 33 | - </div> | |
| 48 | + <a href="<?php echo esc_url( Link::all_codes() ); ?>" class="button button-secondary button-small"> | |
| 49 | + ⇐ <?php esc_html_e( 'Back to Codes', 'wp-coder' ); ?> | |
| 50 | + </a> | |
| 34 | 51 | |
| 52 | + <a href="<?php echo esc_url( $add_url ); ?>" class="button button-primary button-small"> | |
| 53 | + + <?php esc_html_e( 'Add New', 'wp-coder' ); ?> | |
| 54 | + </a> | |
| 35 | 55 | |
| 36 | - <form action="" id="wowp-settings" class="wowp-settings wowp-wrap" method="post"> | |
| 56 | + <?php if ( ! empty( $item_id ) ) : ?> | |
| 57 | + <a href="<?php echo esc_url( $duplicate_url ); ?>" class="button button-secondary button-small"> | |
| 58 | + <span class="icon icon-copy"></span> <?php esc_html_e( 'Duplicate', 'wp-coder' ); ?> | |
| 59 | + </a> | |
| 60 | + <?php endif; ?> | |
| 61 | + </div> | |
| 37 | 62 | |
| 38 | - <div id="poststuff"> | |
| 39 | - <div id="post-body" class="metabox-holder columns-2"> | |
| 40 | - <div id="post-body-content"> | |
| 63 | + <form action="" id="wowp-settings" method="post" > | |
| 41 | 64 | |
| 42 | - <div id="titlediv"> | |
| 65 | + <?php require_once plugin_dir_path( __FILE__ ) . 'sidebar.php'; ?> | |
| 43 | 66 | |
| 44 | - <div id="titlewrap"> | |
| 45 | - <label class="screen-reader-text" id="title-prompt-text" | |
| 46 | - for="title"><?php esc_html_e( 'Enter title here', 'wpcoder' ); ?> | |
| 47 | - </label> | |
| 48 | - <?php Field::text( 'title' ); ?> | |
| 67 | + <div class="wowp-preview is-hidden"> | |
| 68 | + <h3 class="wowp-preview__title">Live Preview</h3> | |
| 69 | + <p class="wowp-preview__subtitle">This area shows a live rendering of your HTML and CSS code. JavaScript and shortcodes are not supported.</p> | |
| 70 | + <div class="wowp-preview__iframe"> | |
| 71 | + <div class="wowp-preview__top"> | |
| 72 | + <label for="checkbox_preview" class="wowp-preview__dot is-close"> | |
| 73 | + <span class="dashicons dashicons-no"></span> | |
| 74 | + </label> | |
| 75 | + <div class="wowp-preview__dot is-toggle"> | |
| 76 | + <span class="dashicons dashicons-minus"></span> | |
| 77 | + <span class="dashicons dashicons-plus is-hidden"></span> | |
| 49 | 78 | </div> |
| 50 | - | |
| 79 | + <div class="wowp-preview__dot is-reset"> | |
| 80 | + <span class="dashicons dashicons-image-rotate"></span> | |
| 81 | + </div> | |
| 82 | + <div class="wowp-preview__size"></div> | |
| 51 | 83 | </div> |
| 84 | + <iframe id="wowp-preview" sandbox></iframe> | |
| 52 | 85 | </div> |
| 86 | + </div> | |
| 53 | 87 | |
| 54 | - <!-- Sidebar with the setting--> | |
| 55 | - <div id="postbox-container-1" class="postbox-container"> | |
| 56 | - <?php require_once plugin_dir_path( __FILE__ ) . 'sidebar.php'; ?> | |
| 57 | - </div> | |
| 58 | - | |
| 59 | - <div id="postoptions"> | |
| 60 | - <div id="postbox-container-2" class="postbox-container wowp-settings-wrapper"> | |
| 61 | - <?php Settings::init(); ?> | |
| 62 | - </div> | |
| 63 | - </div> | |
| 88 | + <div class="wowp-settings"> | |
| 89 | + <?php Settings::init(); ?> | |
| 64 | 90 | </div> |
| 65 | 91 | |
| 66 | - </div> | |
| 92 | + <input type="hidden" name="tool_id" value="<?php echo absint( $default['id'] ); ?>" id="tool_id"/> | |
| 93 | + <input type="hidden" name="param[time]" value="<?php echo esc_attr( time() ); ?>"/> | |
| 94 | + <?php wp_nonce_field( WPCoder::PREFIX . '_nonce', WPCoder::PREFIX . '_settings' ); ?> | |
| 67 | 95 | |
| 68 | - <input type="hidden" name="tool_id" value="<?php echo absint( $default['id'] ); ?>" id="tool_id"/> | |
| 69 | - <input type="hidden" name="param[time]" value="<?php echo esc_attr( time() ); ?>"/> | |
| 70 | - <?php wp_nonce_field( WPCoder::PREFIX . '_nonce', WPCoder::PREFIX . '_settings' ); ?> | |
| 96 | + </form> | |
| 71 | 97 | |
| 72 | - </form> | |
| 73 | 98 | |
| 99 | + </div> | |
| 74 | 100 | |
| 75 | 101 | <?php |