PluginProbe ʕ •ᴥ•ʔ
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN / 3.9.9
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN v3.9.9
4.1.0 4.0.3 4.0.2 2.8.1 2.9.1 3.0.0 3.0.1 3.0.2 3.1.1 3.10.1 3.10.2 3.10.3 3.11.1 3.12.3 3.12.4 3.12.5 3.12.6 3.13.0 3.13.1 3.13.2 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.15.2 3.15.3 3.15.4 3.15.5 3.16.2 3.16.4 3.16.5 3.16.6 3.17.0 3.17.1 3.18.0 3.18.1 3.2.0.1 3.2.1 3.2.2.1 3.2.4 3.20.0 3.21.1 3.22.1 3.22.3 3.23.0 3.23.1 3.23.2 3.23.3 3.23.4 3.24.0 3.24.0-beta.2 3.3.0 3.3.1 3.3.2 3.4.1 3.4.2 3.6.1 3.6.3 3.7.0 3.7.1 3.7.2 3.7.3 3.8.2 3.8.3 3.8.4 3.8.5 3.8.7 3.8.8 3.9.0 3.9.1 3.9.11 3.9.2 3.9.4 3.9.5 3.9.8 3.9.9 trunk 1.0.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.2 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.5.1 1.6.5.2 1.6.5.3 1.6.5.4 1.7 1.7.1 1.7.1.1 2.0 2.0.1 2.0.3 2.0.4 2.0.5 2.0.6 2.0.6.2 2.0.6.3 2.0.6.5 2.0.7 2.0.7.1 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.2 2.3 2.3.1 2.4 2.4.2 2.4.3 2.4.4 2.4.5 2.5.2 2.5.3 2.6.1 2.6.2 2.6.3 2.7 2.7.1 2.7.4 2.7.4.1 2.7.5 2.7.6 2.7.8 2.7.8.1 2.7.9.1 2.8.0 2.8.0.1
wp-smushit / app / pages / class-settings.php
wp-smushit / app / pages Last commit date
class-bulk.php 4 years ago class-cdn.php 4 years ago class-dashboard.php 4 years ago class-directory.php 4 years ago class-integrations.php 4 years ago class-lazy.php 4 years ago class-nextgen.php 4 years ago class-settings.php 4 years ago class-tools.php 4 years ago class-tutorials.php 4 years ago class-upgrade.php 4 years ago class-webp.php 4 years ago
class-settings.php
198 lines
1 <?php
2 /**
3 * Settings page.
4 *
5 * @package Smush\App\Pages
6 */
7
8 namespace Smush\App\Pages;
9
10 use Smush\App\Abstract_Page;
11 use Smush\App\Interface_Page;
12 use WP_Smush;
13
14 if ( ! defined( 'WPINC' ) ) {
15 die;
16 }
17
18 /**
19 * Class Settings
20 */
21 class Settings extends Abstract_Page implements Interface_Page {
22 /**
23 * Function triggered when the page is loaded before render any content.
24 */
25 public function on_load() {
26 // Init the tabs.
27 $this->tabs = apply_filters(
28 'smush_setting_tabs',
29 array(
30 'general' => __( 'General', 'wp-smushit' ),
31 'configs' => __( 'Configs', 'wp-smushit' ),
32 'permissions' => __( 'Permissions', 'wp-smushit' ),
33 'data' => __( 'Data & Settings', 'wp-smushit' ),
34 'accessibility' => __( 'Accessibility', 'wp-smushit' ),
35 )
36 );
37
38 // Disabled on all subsites.
39 if ( ! is_multisite() || ! is_network_admin() ) {
40 unset( $this->tabs['permissions'] );
41 }
42
43 add_action( 'smush_setting_column_right_inside', array( $this, 'usage_settings' ), 25, 2 );
44 }
45
46 /**
47 * Enqueue scripts.
48 *
49 * @since 3.9.0
50 *
51 * @param string $hook Hook from where the call is made.
52 */
53 public function enqueue_scripts( $hook ) {
54 // Scripts for Configs.
55 $this->enqueue_configs_scripts();
56 }
57
58 /**
59 * Register meta boxes.
60 */
61 public function register_meta_boxes() {
62 $this->add_meta_box(
63 'settings/general',
64 __( 'General', 'wp-smushit' ),
65 array( $this, 'general_meta_box' ),
66 null,
67 array( $this, 'common_meta_box_footer' ),
68 'general'
69 );
70
71 if ( is_multisite() && is_network_admin() ) {
72 $this->add_meta_box(
73 'settings/permissions',
74 __( 'Permissions', 'wp-smushit' ),
75 array( $this, 'permissions_meta_box' ),
76 null,
77 array( $this, 'common_meta_box_footer' ),
78 'permissions'
79 );
80 }
81
82 $this->add_meta_box(
83 'settings/data',
84 __( 'Data & Settings', 'wp-smushit' ),
85 array( $this, 'data_meta_box' ),
86 null,
87 array( $this, 'common_meta_box_footer' ),
88 'data'
89 );
90
91 $this->add_meta_box(
92 'settings/accessibility',
93 __( 'Accessibility', 'wp-smushit' ),
94 array( $this, 'accessibility_meta_box' ),
95 null,
96 array( $this, 'common_meta_box_footer' ),
97 'accessibility'
98 );
99
100 if ( 'data' === $this->get_current_tab() ) {
101 $this->modals['reset-settings'] = array();
102 }
103 }
104
105 /**
106 * Display a description in Settings - Usage Tracking.
107 *
108 * @since 3.1.0
109 *
110 * @param string $name Setting name.
111 */
112 public function usage_settings( $name ) {
113 // Add only to full size settings.
114 if ( 'usage' !== $name ) {
115 return;
116 }
117 ?>
118
119 <span class="sui-description sui-toggle-description">
120 <?php
121 esc_html_e( 'Note: Usage tracking is completely anonymous. We are only tracking what features you are/aren’t using to make our feature decisions more informed.', 'wp-smushit' );
122 ?>
123 </span>
124 <?php
125 }
126
127 /**
128 * Common footer meta box.
129 *
130 * @since 3.2.0
131 */
132 public function common_meta_box_footer() {
133 $this->view( 'meta-box-footer', array(), 'common' );
134 }
135
136 /**
137 * General settings meta box.
138 */
139 public function general_meta_box() {
140 $link = WP_Smush::is_pro() ? 'https://wpmudev.com/translate/projects/wp-smushit/' : 'https://translate.wordpress.org/projects/wp-plugins/wp-smushit';
141
142 $site_locale = get_locale();
143
144 if ( 'en' === $site_locale || 'en_US' === $site_locale ) {
145 $site_language = 'English';
146 } else {
147 require_once ABSPATH . 'wp-admin/includes/translation-install.php';
148 $translations = wp_get_available_translations();
149 $site_language = isset( $translations[ $site_locale ] ) ? $translations[ $site_locale ]['native_name'] : __( 'Error detecting language', 'wp-smushit' );
150 }
151
152 $this->view(
153 'settings/general-meta-box',
154 array(
155 'site_language' => $site_language,
156 'tracking' => (bool) $this->settings->get( 'usage' ),
157 'translation_link' => $link,
158 )
159 );
160 }
161
162 /**
163 * Permissions meta box.
164 */
165 public function permissions_meta_box() {
166 $this->view(
167 'settings/permissions-meta-box',
168 array(
169 'networkwide' => get_site_option( 'wp-smush-networkwide' ),
170 )
171 );
172 }
173
174 /**
175 * Data & Settings meta box.
176 */
177 public function data_meta_box() {
178 $this->view(
179 'settings/data-meta-box',
180 array(
181 'keep_data' => (bool) $this->settings->get( 'keep_data' ),
182 )
183 );
184 }
185
186 /**
187 * Accessibility meta box.
188 */
189 public function accessibility_meta_box() {
190 $this->view(
191 'settings/accessibility-meta-box',
192 array(
193 'accessible_colors' => (bool) $this->settings->get( 'accessible_colors' ),
194 )
195 );
196 }
197 }
198