PluginProbe
WP Coder – Insert & Manage Code Snippets / trunk
WP Coder – Insert & Manage Code Snippets vtrunk
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
wp-coder / includes / pages / 2.settings.php

2.settings.php in WP Coder – Insert & Manage Code Snippets trunk, at includes/pages/2.settings.php

102 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Page Name: Add New
4 */
5
6 use WPCoder\Dashboard\DashboardInitializer;
7 use WPCoder\Dashboard\Field;
8 use WPCoder\Dashboard\Link;
9 use WPCoder\Dashboard\Settings;
10 use WPCoder\WPCoder;
11
12 defined( 'ABSPATH' ) || exit;
13
14 $default = Field::getDefault();
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
37 ?>
38
39 <div class="wowp">
40
41 <?php DashboardInitializer::header(); ?>
42
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' ); ?>
50 </a>
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>
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; ?>
61 </div>
62
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>
83 </div>
84 <iframe id="wowp-preview" sandbox></iframe>
85 </div>
86 </div>
87
88 <div class="wowp-settings">
89 <?php Settings::init(); ?>
90 </div>
91
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' ); ?>
95
96 </form>
97
98
99 </div>
100
101 <?php
102