PluginProbe
WP Coder – Insert & Manage Code Snippets / 4.3
WP Coder – Insert & Manage Code Snippets v4.3
4.5.1 1.1 2.3.1 2.3.2 2.4.1 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 3.2 3.2.1 3.3 3.4 3.5 3.5.1 All 39 releases
← All changes | includes/pages/2.settings.php +72 -25 3.04.3 View file →
@@ -2,53 +2,100 @@
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 +
17 +$action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : '';
18 +$item_id = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : '';
19 +$item_title = __( 'Add new code', 'wp-coder' );
20 +if ( $action === 'update' && ! empty( $item_id ) ) {
21 + $item_title = __( 'Update code', 'wp-coder' ) . ' ID: ' . $item_id;
22 +} elseif ( $action === 'duplicate' && ! empty( $item_id ) ) {
23 + $item_title = __( 'Duplicate the code from', 'wp-coder' ) . ' ID: ' . $item_id;
24 +}
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 +
14 37 ?>
15 38
16 - <form action="" id="wowp-settings" class="wowp-settings" method="post">
39 + <div class="wowp">
17 40
18 - <div id="poststuff">
19 - <div id="post-body" class="metabox-holder columns-2">
20 - <div id="post-body-content">
41 + <?php DashboardInitializer::header(); ?>
21 42
22 - <div id="titlediv">
43 + <div class="wowp-page-header">
44 + <h2 class="wowp-page-header__title">
45 + <?php echo esc_html( $item_title ); ?>
46 + </h2>
23 47
24 - <div id="titlewrap">
25 - <label class="screen-reader-text" id="title-prompt-text"
26 - for="title"><?php esc_html_e( 'Enter title here', 'wpcoder' ); ?></label>
27 - <?php Field::text( 'title' ); ?>
28 - </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>
29 51
30 - </div>
31 - </div>
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>
32 55
33 - <!-- Sidebar with the setting-->
34 - <div id="postbox-container-1" class="postbox-container">
35 - <?php require_once plugin_dir_path(__FILE__) . 'sidebar.php';?>
36 - </div>
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="postoptions">
39 - <div id="postbox-container-2" class="postbox-container wowp-settings-wrapper">
40 - <?php Settings::init(); ?>
63 + <form action="" id="wowp-settings" method="post" >
64 +
65 + <?php require_once plugin_dir_path( __FILE__ ) . 'sidebar.php'; ?>
66 +
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>
78 + </div>
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>
41 83 </div>
84 + <iframe id="wowp-preview" sandbox></iframe>
42 85 </div>
43 86 </div>
44 87
45 - </div>
88 + <div class="wowp-settings">
89 + <?php Settings::init(); ?>
90 + </div>
46 91
47 - <input type="hidden" name="tool_id" value="<?php echo absint( $default['id'] ); ?>" id="tool_id"/>
48 - <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' ); ?>
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' ); ?>
50 95
51 - </form>
96 + </form>
52 97
98 +
99 + </div>
53 100
54 101 <?php