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
← All changes | classes/Dashboard/Settings.php +75 -14 3.2trunk View file →
@@ -10,34 +10,95 @@
10 10
11 11 public static function init(): void {
12 12 $pages = DashboardHelper::get_files( 'settings' );
13 13
14 + $default = Field::getDefault();
15 +
14 16 $i = 0;
15 - echo '<h3 class="nav-tab-wrapper wowp-tab" id="settings-tab">';
17 + echo '<div class="wowp-settins__tabs" id="wowp-settings-tabs">';
16 18 foreach ( $pages as $key => $page ) {
17 - $current = ( $i === 0 ) ? 'nav-tab nav-tab-active' : 'nav-tab';
18 - echo '<a class="' . esc_attr( $current ) . '" data-tab="' . esc_attr( $page['file'] ) . '">' . esc_html( $page['name'] ) . '</a>';
19 + $tab = ! empty( $default['param']['tab'] ) ? $default['param']['tab'] : 'html-code';
20 +
21 + echo '<input type="radio" class="wowp-settins__tabs-radio" name="param[tab]" value="' . esc_attr( $page['file'] ) . '" id="wowp-tab-' . esc_attr( $page['file'] ) . '" ' . checked( $tab, $page['file'], false ) . '>';
22 + echo '<label class="wowp-settins__tabs-tab" for="wowp-tab-' . esc_attr( $page['file'] ) . '">' . esc_html( $page['name'] ) . '</label>';
23 +
19 24 $i ++;
20 25 }
21 - echo '</h3>';
26 + ?>
22 27
28 + <div class="popover-container">
29 + <button id="popover-toggle" class="wowp-button button button-secondary">Hide Tabs</button>
30 +
31 + <div class="popover" id="popover-box">
32 + <div class="wowp-field has-checkbox is-reverse">
33 + <span class="label">
34 + <?php esc_html_e( 'HTML', 'wp-coder' ); ?>
35 + </span>
36 + <label class="switch">
37 + <?php Field::checkbox( '[hide_html]' ); ?>
38 + <span class="slider"></span>
39 + </label>
40 + </div>
41 + <div class="wowp-field has-checkbox is-reverse">
42 + <span class="label">
43 + <?php esc_html_e( 'CSS', 'wp-coder' ); ?>
44 + </span>
45 + <label class="switch">
46 + <?php Field::checkbox( '[hide_css]' ); ?>
47 + <span class="slider"></span>
48 + </label>
49 + </div>
50 + <div class="wowp-field has-checkbox is-reverse">
51 + <span class="label">
52 + <?php esc_html_e( 'JS', 'wp-coder' ); ?>
53 + </span>
54 + <label class="switch">
55 + <?php Field::checkbox( '[hide_js]' ); ?>
56 + <span class="slider"></span>
57 + </label>
58 + </div>
59 + <div class="wowp-field has-checkbox is-reverse">
60 + <span class="label">
61 + <?php esc_html_e( 'PHP', 'wp-coder' ); ?>
62 + </span>
63 + <label class="switch">
64 + <?php Field::checkbox( '[hide_php]' ); ?>
65 + <span class="slider"></span>
66 + </label>
67 + </div>
68 +
69 + <div class="wowp-field has-checkbox is-reverse">
70 + <span class="label">
71 + <?php esc_html_e( 'Scripts & Styles', 'wp-coder' ); ?>
72 + </span>
73 + <label class="switch">
74 + <?php Field::checkbox( '[hide_include]' ); ?>
75 + <span class="slider"></span>
76 + </label>
77 + </div>
78 + </div>
79 + </div>
80 +
81 + <?php
82 +
23 83 $i = 0;
24 -
25 - echo '<div class="tab-content-wrapper wowp-tab-content" id="settings-content">';
26 84 foreach ( $pages as $key => $page ) {
27 - $current = ( $i === 0 ) ? 'tab-content tab-content-active' : 'tab-content';
28 - $file = DashboardHelper::get_folder_path( 'settings' ) . '/' . $key . '.' . $page['file'] . '.php';
85 + $file = DashboardHelper::get_folder_path( 'settings' ) . '/' . $key . '.' . $page['file'] . '.php';
29 86
30 87 if ( file_exists( $file ) ) {
31 - echo '<div class="' . esc_attr( $current ) . '" data-content="' . esc_attr( $page['file'] ) . '">';
88 +
89 + echo '<div class="wowp-settins__tabs-content" data-content="wowp-tab-' . esc_attr( $page['file'] ) . '">';
90 +
32 91 require_once $file;
92 +
93 + echo '<input type="submit" name="submit_settings" class="wowp-button button button-dark button-hero m-top" value="' . esc_attr__( 'Save', 'wp-coder' ) . '">';
33 94 echo '</div>';
34 95 }
35 96 $i ++;
36 97 }
37 98 echo '</div>';
99 + }
38 100
39 - }
40 101
41 102 public static function save_item() {
42 103
43 104 if ( empty( $_POST['submit_settings'] ) ) {
@@ -63,9 +124,9 @@
63 124 exit;
64 125
65 126 }
66 127
67 - public static function deactivate_item($id = 0): void {
128 + public static function deactivate_item( $id = 0 ): void {
68 129 $id = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : $id;
69 130
70 131 if ( ! empty( $id ) ) {
71 132 DBManager::update( [ 'status' => '1' ], [ 'ID' => $id ], [ '%d' ] );
@@ -72,9 +133,9 @@
72 133 }
73 134
74 135 }
75 136
76 - public static function activate_item($id = 0): void {
137 + public static function activate_item( $id = 0 ): void {
77 138 $id = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : $id;
78 139
79 140 if ( ! empty( $id ) ) {
80 141 DBManager::update( [ 'status' => '' ], [ 'ID' => $id ], [ '%d' ] );
@@ -81,9 +142,9 @@
81 142 }
82 143
83 144 }
84 145
85 - public static function deactivate_mode($id = 0): void {
146 + public static function deactivate_mode( $id = 0 ): void {
86 147 $id = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : $id;
87 148
88 149 if ( ! empty( $id ) ) {
89 150 DBManager::update( [ 'mode' => '' ], [ 'ID' => $id ], [ '%d' ] );
@@ -90,9 +151,9 @@
90 151 }
91 152
92 153 }
93 154
94 - public static function activate_mode($id = 0): void {
155 + public static function activate_mode( $id = 0 ): void {
95 156 $id = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : $id;
96 157
97 158 if ( ! empty( $id ) ) {
98 159 DBManager::update( [ 'mode' => '1' ], [ 'ID' => $id ], [ '%d' ] );