| @@ -12,78 +12,90 @@ | ||
| 12 | 12 | defined( 'ABSPATH' ) || exit; |
| 13 | 13 | |
| 14 | 14 | $default = Field::getDefault(); |
| 15 | 15 | |
| 16 | + | |
| 16 | 17 | $action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ''; |
| 17 | 18 | $item_id = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : ''; |
| 18 | -$item_title = __( 'Add new code', 'wpcoder' ); | |
| 19 | +$item_title = __( 'Add new code', 'wp-coder' ); | |
| 19 | 20 | if ( $action === 'update' && ! empty( $item_id ) ) { |
| 20 | - $item_title = __( 'Update code', 'wpcoder' ) . ' ID: ' . $item_id; | |
| 21 | + $item_title = __( 'Update code', 'wp-coder' ) . ' ID: ' . $item_id; | |
| 21 | 22 | } elseif ( $action === 'duplicate' && ! empty( $item_id ) ) { |
| 22 | - $item_title = __( 'Duplicate the code from', 'wpcoder' ) . ' ID: ' . $item_id; | |
| 23 | + $item_title = __( 'Duplicate the code from', 'wp-coder' ) . ' ID: ' . $item_id; | |
| 23 | 24 | } |
| 24 | -$license_page = add_query_arg( ['page' => WPCoder::SLUG . '-license' ], admin_url( 'admin.php' ) ); | |
| 25 | -$add_url = add_query_arg( [ | |
| 25 | +$license_page = add_query_arg( [ 'page' => WPCoder::SLUG . '-license' ], admin_url( 'admin.php' ) ); | |
| 26 | +$add_url = add_query_arg( [ | |
| 26 | 27 | 'page' => WPCoder::SLUG . '-settings', |
| 27 | 28 | 'action' => 'new' |
| 28 | 29 | ], admin_url( 'admin.php' ) ); |
| 29 | 30 | |
| 31 | +$duplicate_url = add_query_arg( [ | |
| 32 | + 'page' => WPCoder::SLUG . '-settings', | |
| 33 | + 'action' => 'duplicate', | |
| 34 | + 'id' => $item_id, | |
| 35 | +], admin_url( 'admin.php' ) ); | |
| 30 | 36 | |
| 31 | 37 | ?> |
| 32 | 38 | |
| 33 | - <div class="wowp-header-wrapper"> | |
| 39 | + <div class="wowp"> | |
| 40 | + | |
| 34 | 41 | <?php DashboardInitializer::header(); ?> |
| 35 | 42 | |
| 36 | - <div class="wowp-header-title"> | |
| 37 | - <h2><?php echo esc_html( $item_title ); ?></h2> | |
| 38 | - <a href="<?php echo esc_url( $add_url ); ?>" class="button button-primary button-large"> | |
| 39 | - + <?php esc_html_e( 'Add New', 'wpcoder' ); ?> | |
| 43 | + <div class="wowp-page-header"> | |
| 44 | + <h2 class="wowp-page-header__title"> | |
| 45 | + <?php echo esc_html( $item_title ); ?> | |
| 46 | + </h2> | |
| 47 | + | |
| 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' ); ?> | |
| 40 | 50 | </a> |
| 41 | 51 | |
| 42 | - <a href="<?php echo esc_url( Link::all_codes() ); ?>" class="button button-secondary button-large"> | |
| 43 | - ⇐ <?php esc_html_e( 'Back to Codes', 'wpcoder' ); ?> | |
| 52 | + <a href="<?php echo esc_url( $add_url ); ?>" class="button button-primary button-small"> | |
| 53 | + + <?php esc_html_e( 'Add New', 'wp-coder' ); ?> | |
| 44 | 54 | </a> |
| 45 | 55 | |
| 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; ?> | |
| 46 | 61 | </div> |
| 47 | - </div> | |
| 48 | 62 | |
| 63 | + <form action="" id="wowp-settings" method="post" > | |
| 49 | 64 | |
| 50 | - <form action="" id="wowp-settings" class="wowp-settings wowp-wrap" method="post"> | |
| 65 | + <?php require_once plugin_dir_path( __FILE__ ) . 'sidebar.php'; ?> | |
| 51 | 66 | |
| 52 | - <div id="poststuff"> | |
| 53 | - <div id="post-body" class="metabox-holder columns-2"> | |
| 54 | - <div id="post-body-content"> | |
| 55 | - | |
| 56 | - <div id="titlediv"> | |
| 57 | - | |
| 58 | - <div id="titlewrap"> | |
| 59 | - <label class="screen-reader-text" id="title-prompt-text" | |
| 60 | - for="title"><?php esc_html_e( 'Enter title here', 'wpcoder' ); ?> | |
| 61 | - </label> | |
| 62 | - <?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> | |
| 63 | 78 | </div> |
| 64 | - | |
| 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> | |
| 65 | 83 | </div> |
| 84 | + <iframe id="wowp-preview" sandbox></iframe> | |
| 66 | 85 | </div> |
| 86 | + </div> | |
| 67 | 87 | |
| 68 | - <!-- Sidebar with the setting--> | |
| 69 | - <div id="postbox-container-1" class="postbox-container"> | |
| 70 | - <?php require_once plugin_dir_path( __FILE__ ) . 'sidebar.php'; ?> | |
| 71 | - </div> | |
| 72 | - | |
| 73 | - <div id="postoptions"> | |
| 74 | - <div id="postbox-container-2" class="postbox-container wowp-settings-wrapper"> | |
| 75 | - <?php Settings::init(); ?> | |
| 76 | - </div> | |
| 77 | - </div> | |
| 88 | + <div class="wowp-settings"> | |
| 89 | + <?php Settings::init(); ?> | |
| 78 | 90 | </div> |
| 79 | 91 | |
| 80 | - </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' ); ?> | |
| 81 | 95 | |
| 82 | - <input type="hidden" name="tool_id" value="<?php echo absint( $default['id'] ); ?>" id="tool_id"/> | |
| 83 | - <input type="hidden" name="param[time]" value="<?php echo esc_attr( time() ); ?>"/> | |
| 84 | - <?php wp_nonce_field( WPCoder::PREFIX . '_nonce', WPCoder::PREFIX . '_settings' ); ?> | |
| 96 | + </form> | |
| 85 | 97 | |
| 86 | - </form> | |
| 87 | 98 | |
| 99 | + </div> | |
| 88 | 100 | |
| 89 | 101 | <?php |