PluginProbe
GutSlider – All in One Slider and Carousel Blocks for Gutenberg / trunk
GutSlider – All in One Slider and Carousel Blocks for Gutenberg vtrunk
3.1.0 3.0.0 2.13.2 2.13.1 2.13.0 trunk 1.0.0 2.1.0 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.12.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.1 2.5.3 2.5.4 2.5.5 2.6.1 All 56 releases
slider-blocks / admin / views / settings.php

settings.php in GutSlider – All in One Slider and Carousel Blocks for Gutenberg trunk, at admin/views/settings.php

235 lines 10.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Settings screen.
4 *
5 * @package GutSliderBlocks
6 *
7 * @var GutSlider_Admin $admin Admin controller.
8 * @var array<string,mixed> $settings Current settings.
9 * @var string $current Current page slug.
10 * @var bool $has_pro Whether the Pro plugin is active.
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 $gs_upload = wp_upload_dir();
18 $gs_css_dir = trailingslashit( $gs_upload['basedir'] ) . 'gutslider-styles';
19 $gs_files = is_dir( $gs_css_dir ) ? glob( $gs_css_dir . '/*.css' ) : array();
20 $gs_css_size = 0;
21
22 if ( is_array( $gs_files ) ) {
23 foreach ( $gs_files as $gs_file ) {
24 $gs_css_size += (int) filesize( $gs_file );
25 }
26 } else {
27 $gs_files = array();
28 }
29
30 require GUTSLIDER_DIR . '/admin/views/header.php';
31 ?>
32
33 <div class="gs-shell gs-stack" data-gs-settings>
34
35 <div class="gs-page-head">
36 <div>
37 <h1 class="gs-page-title"><?php esc_html_e( 'Settings', 'slider-blocks' ); ?></h1>
38 <p class="gs-page-sub"><?php esc_html_e( 'How GutSlider behaves in the editor and what it loads on the front end.', 'slider-blocks' ); ?></p>
39 </div>
40 </div>
41
42 <div class="gs-settings">
43 <nav class="gs-sidenav" aria-label="<?php esc_attr_e( 'Settings sections', 'slider-blocks' ); ?>">
44 <a class="gs-sidenav__link is-active" href="#gs-performance" data-gs-sidenav>
45 <svg class="gs-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M13 2 4.1 13.4a.6.6 0 0 0 .5 1H11l-1 7.6 8.9-11.4a.6.6 0 0 0-.5-1H12z" /></svg>
46 <?php esc_html_e( 'Performance', 'slider-blocks' ); ?>
47 </a>
48 <a class="gs-sidenav__link" href="#gs-editor" data-gs-sidenav>
49 <svg class="gs-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M12 20h9" /><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z" /></svg>
50 <?php esc_html_e( 'Editor', 'slider-blocks' ); ?>
51 </a>
52 <a class="gs-sidenav__link" href="#gs-typography" data-gs-sidenav>
53 <svg class="gs-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 7V4h16v3M9 20h6M12 4v16" /></svg>
54 <?php esc_html_e( 'Typography', 'slider-blocks' ); ?>
55 </a>
56 <a class="gs-sidenav__link" href="#gs-maintenance" data-gs-sidenav>
57 <svg class="gs-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M14.7 6.3a4 4 0 0 0 5 5L21 12l-9 9-4-4 9-9z" /><path d="m3 21 4-4" /></svg>
58 <?php esc_html_e( 'Maintenance', 'slider-blocks' ); ?>
59 </a>
60 </nav>
61
62 <div class="gs-settings__body">
63
64 <section class="gs-panel" id="gs-performance">
65 <header class="gs-panel__head">
66 <h2 class="gs-panel__title"><?php esc_html_e( 'Performance', 'slider-blocks' ); ?></h2>
67 <p class="gs-panel__sub"><?php esc_html_e( 'Control how the CSS your blocks generate reaches the browser.', 'slider-blocks' ); ?></p>
68 </header>
69
70 <div class="gs-field">
71 <div class="gs-field__label">
72 <span class="gs-field__name"><?php esc_html_e( 'CSS delivery', 'slider-blocks' ); ?></span>
73 <p class="gs-field__help"><?php esc_html_e( 'External files are cacheable and best for most sites. Inline avoids an extra request, which can help pages with very little slider CSS.', 'slider-blocks' ); ?></p>
74 </div>
75 <div class="gs-field__control">
76 <div class="gs-radio-cards" role="radiogroup" aria-label="<?php esc_attr_e( 'CSS delivery', 'slider-blocks' ); ?>">
77 <?php
78 $gs_delivery = array(
79 'file' => array(
80 'title' => __( 'External file', 'slider-blocks' ),
81 'text' => __( 'One cached .css file per page', 'slider-blocks' ),
82 ),
83 'inline' => array(
84 'title' => __( 'Inline', 'slider-blocks' ),
85 'text' => __( 'Printed in a <style> tag', 'slider-blocks' ),
86 ),
87 );
88 ?>
89 <?php foreach ( $gs_delivery as $gs_value => $gs_opt ) : ?>
90 <label class="gs-radio-card<?php echo ( $settings['css_delivery'] === $gs_value ) ? ' is-active' : ''; ?>">
91 <input
92 type="radio"
93 name="css_delivery"
94 value="<?php echo esc_attr( $gs_value ); ?>"
95 data-gs-setting="css_delivery"
96 data-gs-initial="<?php echo esc_attr( $settings['css_delivery'] ); ?>"
97 <?php checked( $settings['css_delivery'], $gs_value ); ?>
98 />
99 <span class="gs-radio-card__body">
100 <span class="gs-radio-card__title"><?php echo esc_html( $gs_opt['title'] ); ?></span>
101 <span class="gs-radio-card__text"><?php echo esc_html( $gs_opt['text'] ); ?></span>
102 </span>
103 <span class="gs-radio-card__mark" aria-hidden="true"></span>
104 </label>
105 <?php endforeach; ?>
106 </div>
107 </div>
108 </div>
109 </section>
110
111 <section class="gs-panel" id="gs-editor">
112 <header class="gs-panel__head">
113 <h2 class="gs-panel__title"><?php esc_html_e( 'Editor', 'slider-blocks' ); ?></h2>
114 <p class="gs-panel__sub"><?php esc_html_e( 'What GutSlider adds to the block editor interface.', 'slider-blocks' ); ?></p>
115 </header>
116
117 <div class="gs-field">
118 <div class="gs-field__label">
119 <label for="gs-pattern-library"><?php esc_html_e( 'Pattern library button', 'slider-blocks' ); ?></label>
120 <p class="gs-field__help"><?php esc_html_e( 'Adds a "Patterns" button to the editor toolbar for inserting ready-made slider layouts. Turn it off for a cleaner toolbar — you can still insert every pattern from the block inserter.', 'slider-blocks' ); ?></p>
121 </div>
122 <div class="gs-field__control">
123 <label class="gs-switch gs-switch--lg" for="gs-pattern-library">
124 <input
125 type="checkbox"
126 id="gs-pattern-library"
127 class="gs-switch__input"
128 data-gs-setting="pattern_library"
129 data-gs-initial="<?php echo $settings['pattern_library'] ? '1' : '0'; ?>"
130 <?php checked( (bool) $settings['pattern_library'] ); ?>
131 />
132 <span class="gs-switch__track" aria-hidden="true"><span class="gs-switch__thumb"></span></span>
133 </label>
134 </div>
135 </div>
136 </section>
137
138 <section class="gs-panel" id="gs-typography">
139 <header class="gs-panel__head">
140 <h2 class="gs-panel__title"><?php esc_html_e( 'Typography', 'slider-blocks' ); ?></h2>
141 <p class="gs-panel__sub"><?php esc_html_e( 'Fonts requested by the typography controls inside your blocks.', 'slider-blocks' ); ?></p>
142 </header>
143
144 <div class="gs-field">
145 <div class="gs-field__label">
146 <label for="gs-google-fonts"><?php esc_html_e( 'Load Google Fonts', 'slider-blocks' ); ?></label>
147 <p class="gs-field__help"><?php esc_html_e( 'Turn this off if your theme already loads the fonts, or if you host them locally for privacy reasons. Blocks keep their font-family; only the request to Google is dropped.', 'slider-blocks' ); ?></p>
148 </div>
149 <div class="gs-field__control">
150 <label class="gs-switch gs-switch--lg" for="gs-google-fonts">
151 <input
152 type="checkbox"
153 id="gs-google-fonts"
154 class="gs-switch__input"
155 data-gs-setting="google_fonts"
156 data-gs-initial="<?php echo $settings['google_fonts'] ? '1' : '0'; ?>"
157 <?php checked( (bool) $settings['google_fonts'] ); ?>
158 />
159 <span class="gs-switch__track" aria-hidden="true"><span class="gs-switch__thumb"></span></span>
160 </label>
161 </div>
162 </div>
163 </section>
164
165 <section class="gs-panel" id="gs-maintenance">
166 <header class="gs-panel__head">
167 <h2 class="gs-panel__title"><?php esc_html_e( 'Maintenance', 'slider-blocks' ); ?></h2>
168 <p class="gs-panel__sub"><?php esc_html_e( 'Housekeeping for generated files and stored data.', 'slider-blocks' ); ?></p>
169 </header>
170
171 <div class="gs-field">
172 <div class="gs-field__label">
173 <span class="gs-field__name"><?php esc_html_e( 'Generated stylesheets', 'slider-blocks' ); ?></span>
174 <p class="gs-field__help">
175 <?php
176 $gs_size_label = $gs_css_size > 0 ? size_format( $gs_css_size, 1 ) : '0 B';
177 printf(
178 /* translators: 1: file count, 2: formatted file size. */
179 esc_html__( '%1$s files · %2$s in your uploads folder. They are rebuilt automatically the next time each page is viewed.', 'slider-blocks' ),
180 esc_html( number_format_i18n( count( $gs_files ) ) ),
181 esc_html( (string) $gs_size_label )
182 );
183 ?>
184 </p>
185 </div>
186 <div class="gs-field__control">
187 <button type="button" class="gs-btn gs-btn--quiet" data-gs-clear-cache>
188 <span class="gs-btn__spinner" aria-hidden="true"></span>
189 <span class="gs-btn__label"><?php esc_html_e( 'Clear style cache', 'slider-blocks' ); ?></span>
190 </button>
191 </div>
192 </div>
193
194 <div class="gs-field gs-field--danger">
195 <div class="gs-field__label">
196 <label for="gs-remove-data"><?php esc_html_e( 'Delete data on uninstall', 'slider-blocks' ); ?></label>
197 <p class="gs-field__help"><?php esc_html_e( 'When enabled, removing the plugin also removes its options and generated stylesheets. Your posts and block content are never touched.', 'slider-blocks' ); ?></p>
198 </div>
199 <div class="gs-field__control">
200 <label class="gs-switch gs-switch--lg gs-switch--danger" for="gs-remove-data">
201 <input
202 type="checkbox"
203 id="gs-remove-data"
204 class="gs-switch__input"
205 data-gs-setting="remove_data"
206 data-gs-initial="<?php echo $settings['remove_data'] ? '1' : '0'; ?>"
207 <?php checked( (bool) $settings['remove_data'] ); ?>
208 />
209 <span class="gs-switch__track" aria-hidden="true"><span class="gs-switch__thumb"></span></span>
210 </label>
211 </div>
212 </div>
213 </section>
214
215 <section class="gs-panel gs-panel--info">
216 <header class="gs-panel__head">
217 <h2 class="gs-panel__title"><?php esc_html_e( 'System', 'slider-blocks' ); ?></h2>
218 </header>
219 <dl class="gs-defs">
220 <div><dt><?php esc_html_e( 'GutSlider', 'slider-blocks' ); ?></dt><dd><?php echo esc_html( GUTSLIDER_VERSION ); ?></dd></div>
221 <div>
222 <dt><?php esc_html_e( 'GutSlider Pro', 'slider-blocks' ); ?></dt>
223 <dd><?php echo $has_pro ? esc_html( GUTSLIDER_PRO_VERSION ) : esc_html__( 'Not installed', 'slider-blocks' ); ?></dd>
224 </div>
225 <div><dt><?php esc_html_e( 'WordPress', 'slider-blocks' ); ?></dt><dd><?php echo esc_html( get_bloginfo( 'version' ) ); ?></dd></div>
226 <div><dt><?php esc_html_e( 'PHP', 'slider-blocks' ); ?></dt><dd><?php echo esc_html( PHP_VERSION ); ?></dd></div>
227 </dl>
228 </section>
229 </div>
230 </div>
231 </div>
232
233 <?php
234 require GUTSLIDER_DIR . '/admin/views/footer.php';
235