| @@ -2,20 +2,54 @@ | ||
| 2 | 2 | /* |
| 3 | 3 | * Page Name: Add New |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | +use WPCoder\Dashboard\DashboardInitializer; | |
| 6 | 7 | use WPCoder\Dashboard\Field; |
| 8 | +use WPCoder\Dashboard\Link; | |
| 7 | 9 | use WPCoder\Dashboard\Settings; |
| 8 | -use WPCoder\WOW_Plugin; | |
| 10 | +use WPCoder\WPCoder; | |
| 9 | 11 | |
| 10 | 12 | defined( 'ABSPATH' ) || exit; |
| 11 | 13 | |
| 12 | 14 | $default = Field::getDefault(); |
| 13 | 15 | |
| 16 | +$action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ''; | |
| 17 | +$item_id = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : ''; | |
| 18 | +$item_title = __( 'Add new code', 'wpcoder' ); | |
| 19 | +if ( $action === 'update' && ! empty( $item_id ) ) { | |
| 20 | + $item_title = __( 'Update code', 'wpcoder' ) . ' ID: ' . $item_id; | |
| 21 | +} elseif ( $action === 'duplicate' && ! empty( $item_id ) ) { | |
| 22 | + $item_title = __( 'Duplicate the code from', 'wpcoder' ) . ' ID: ' . $item_id; | |
| 23 | +} | |
| 24 | +$license_page = add_query_arg( ['page' => WPCoder::SLUG . '-license' ], admin_url( 'admin.php' ) ); | |
| 25 | +$add_url = add_query_arg( [ | |
| 26 | + 'page' => WPCoder::SLUG . '-settings', | |
| 27 | + 'action' => 'new' | |
| 28 | +], admin_url( 'admin.php' ) ); | |
| 29 | + | |
| 30 | + | |
| 14 | 31 | ?> |
| 15 | 32 | |
| 16 | - <form action="" id="wowp-settings" class="wowp-settings" method="post"> | |
| 33 | + <div class="wowp-header-wrapper"> | |
| 34 | + <?php DashboardInitializer::header(); ?> | |
| 17 | 35 | |
| 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' ); ?> | |
| 40 | + </a> | |
| 41 | + | |
| 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' ); ?> | |
| 44 | + </a> | |
| 45 | + | |
| 46 | + </div> | |
| 47 | + </div> | |
| 48 | + | |
| 49 | + | |
| 50 | + <form action="" id="wowp-settings" class="wowp-settings wowp-wrap" method="post"> | |
| 51 | + | |
| 18 | 52 | <div id="poststuff"> |
| 19 | 53 | <div id="post-body" class="metabox-holder columns-2"> |
| 20 | 54 | <div id="post-body-content"> |
| 21 | 55 | |
| @@ -22,9 +56,10 @@ | ||
| 22 | 56 | <div id="titlediv"> |
| 23 | 57 | |
| 24 | 58 | <div id="titlewrap"> |
| 25 | 59 | <label class="screen-reader-text" id="title-prompt-text" |
| 26 | - for="title"><?php esc_html_e( 'Enter title here', 'wpcoder' ); ?></label> | |
| 60 | + for="title"><?php esc_html_e( 'Enter title here', 'wpcoder' ); ?> | |
| 61 | + </label> | |
| 27 | 62 | <?php Field::text( 'title' ); ?> |
| 28 | 63 | </div> |
| 29 | 64 | |
| 30 | 65 | </div> |
| @@ -31,9 +66,9 @@ | ||
| 31 | 66 | </div> |
| 32 | 67 | |
| 33 | 68 | <!-- Sidebar with the setting--> |
| 34 | 69 | <div id="postbox-container-1" class="postbox-container"> |
| 35 | - <?php require_once plugin_dir_path(__FILE__) . 'sidebar.php';?> | |
| 70 | + <?php require_once plugin_dir_path( __FILE__ ) . 'sidebar.php'; ?> | |
| 36 | 71 | </div> |
| 37 | 72 | |
| 38 | 73 | <div id="postoptions"> |
| 39 | 74 | <div id="postbox-container-2" class="postbox-container wowp-settings-wrapper"> |
| @@ -45,9 +80,9 @@ | ||
| 45 | 80 | </div> |
| 46 | 81 | |
| 47 | 82 | <input type="hidden" name="tool_id" value="<?php echo absint( $default['id'] ); ?>" id="tool_id"/> |
| 48 | 83 | <input type="hidden" name="param[time]" value="<?php echo esc_attr( time() ); ?>"/> |
| 49 | - <?php wp_nonce_field( WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_settings' ); ?> | |
| 84 | + <?php wp_nonce_field( WPCoder::PREFIX . '_nonce', WPCoder::PREFIX . '_settings' ); ?> | |
| 50 | 85 | |
| 51 | 86 | </form> |
| 52 | 87 | |
| 53 | 88 | |