PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / views / page-settings.php

page-settings.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF trunk, at views/page-settings.php

222 lines 9.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || exit;
3
4 $settings = Imagify_Settings::get_instance();
5 $options = Imagify_Options::get_instance();
6 $option_name = $options->get_option_name();
7 $hidden_class = Imagify_Requirements::is_api_key_valid() ? '' : ' hidden';
8 $lang = imagify_get_current_lang_in( [ 'de', 'es', 'fr', 'it' ] );
9
10 /* Ads notice */
11 $plugins_list = get_plugins();
12 $notice = 'wp-rocket';
13 $user_id = get_current_user_id();
14 $notices = get_user_meta( $user_id, '_imagify_ignore_ads', true );
15 $notices = $notices && is_array( $notices ) ? array_flip( $notices ) : [];
16 $wrapper_class = isset( $notices[ $notice ] ) || isset( $plugins_list['wp-rocket/wp-rocket.php'] ) ? 'imagify-have-rocket' : 'imagify-dont-have-rocket';
17 ?>
18 <div class="wrap imagify-settings <?php echo esc_attr( $wrapper_class ); ?> imagify-clearfix">
19
20 <?php
21 /**
22 * Core only requires `options-head.php` (which calls `settings_errors()`) when the page
23 * parent is `options-general.php`. That is the case when Imagify is registered with
24 * `add_options_page()`, but not when it is network-activated and registered with
25 * `add_menu_page()`/`add_submenu_page()`. Print the notices ourselves in that case.
26 */
27 if ( 'options-general.php' !== ( isset( $GLOBALS['parent_file'] ) ? $GLOBALS['parent_file'] : '' ) ) {
28 settings_errors();
29 }
30 ?>
31
32 <div class="imagify-col imagify-main">
33
34 <?php $this->print_template( 'part-settings-header' ); ?>
35 <div class="imagify-main-content">
36 <form action="<?php echo esc_url( $settings->get_form_action() ); ?>" id="imagify-settings" method="post">
37
38 <div class="imagify-settings-main-content<?php echo Imagify_Requirements::is_api_key_valid() ? '' : ' imagify-no-api-key'; ?>">
39
40 <?php settings_fields( $settings->get_settings_group() ); ?>
41 <?php wp_nonce_field( 'imagify-signup', 'imagifysignupnonce', false ); ?>
42 <?php wp_nonce_field( 'imagify-check-api-key', 'imagifycheckapikeynonce', false ); ?>
43
44 <?php
45 if ( ! Imagify_Requirements::is_api_key_valid() ) {
46 $this->print_template( 'part-settings-account' );
47 $this->print_template( 'part-settings-footer' );
48 }
49 ?>
50
51 <div class="imagify-col imagify-shared-with-account-col<?php echo esc_attr( $hidden_class ); ?>">
52 <div class="imagify-settings-section">
53
54 <h2 class="imagify-options-title"><?php esc_html_e( 'General Settings', 'imagify' ); ?></h2>
55
56 <p class="imagify-setting-line">
57 <?php
58 $settings->field_checkbox(
59 [
60 'option_name' => 'auto_optimize',
61 'label' => __( 'Auto-Optimize images on upload', 'imagify' ),
62 'info' => __( 'Automatically optimize every image you upload to WordPress.', 'imagify' ),
63 ]
64 );
65 ?>
66 </p>
67
68 <p class="imagify-setting-line">
69 <?php
70 $settings->field_checkbox(
71 [
72 'option_name' => 'backup',
73 'label' => __( 'Backup original images', 'imagify' ),
74 'info' => __( 'Keep your original images in a separate folder before optimization process.', 'imagify' ),
75 ]
76 );
77
78 $backup_error_class = $options->get( 'backup' ) && ! Imagify_Requirements::attachments_backup_dir_is_writable() ? '' : ' hidden';
79 ?>
80 <br/><strong id="backup-dir-is-writable" class="imagify-error<?php echo esc_attr( $backup_error_class ); ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'imagify_check_backup_dir_is_writable' ) ); ?>">
81 <?php
82 $backup_path = $this->filesystem->make_path_relative( get_imagify_backup_dir_path( true ) );
83 /* translators: %s is a file path. */
84 printf( esc_html__( 'The backup folder %s cannot be created or is not writable by the server, original images cannot be saved!', 'imagify' ), "<code>$backup_path</code>" ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
85 ?>
86 </strong>
87 </p>
88
89 <p class="imagify-setting-line">
90 <?php
91 $settings->field_checkbox(
92 [
93 'option_name' => 'lossless',
94 'label' => __( 'Lossless compression', 'imagify' ),
95 'info' => __( 'By default, Imagify optimizes your images by using a smart compression to get the best compression rate with an optimal quality.', 'imagify' ) . '<br><br>' . __( 'If you are a photographer or focus on the quality of your images rather than the performance, you may be interested in this option to make sure not a single pixel looks different in the optimized image compared with the original.', 'imagify' ),
96 ]
97 );
98 ?>
99 </p>
100 <?php do_action( 'imagify_settings_after_lossless' ); ?>
101 </div>
102 </div>
103
104 <?php if ( Imagify_Requirements::is_api_key_valid() ) { ?>
105 <div class="imagify-col imagify-account-info-col">
106 <?php $this->print_template( 'part-settings-account' ); ?>
107 </div>
108 <?php } ?>
109 </div>
110
111 <div class="imagify-settings-main-content<?php echo esc_attr( $hidden_class ); ?>">
112
113 <div class="imagify-settings-section imagify-clear">
114 <h2 class="imagify-options-title"><?php esc_html_e( 'Optimization', 'imagify' ); ?></h2>
115 <?php
116 $this->print_template( 'part-settings-webp' );
117 $this->print_template( 'part-settings-library' );
118 $this->print_template( 'part-settings-custom-folders' );
119 ?>
120 </div>
121 </div>
122
123 <div class="imagify-settings-main-content imagify-pb0<?php echo esc_attr( $hidden_class ); ?>">
124 <?php if ( ! $data['hide_plugin_family'] ) : ?>
125 <div class="imagify-settings-section imagify-clear imagify-plugin-family-section">
126 <div>
127 <h2 class="imagify-options-title"><?php esc_html_e( 'Our Plugins', 'imagify' ); ?></h2>
128 <p class="imagify-options-subtitle"><?php esc_html_e( 'Build better, faster, safer', 'imagify' ); ?></p>
129 <p class="">
130 <?php
131 esc_html_e( 'Beyond Imagify, there\'s a whole family of plugins designed to help you build better, faster, and safer websites. Each one is crafted with our unique blend of expertise, simplicity, and outstanding support. Combine our plugins below to build incredible WordPress websites!', 'imagify' );
132 ?>
133 </p>
134 <div class="imagify-plugin-family-cards">
135 <?php foreach ( $data['plugin_family'] as $plugin_name => $plugin_data ) : ?>
136 <div class="imagify-plugin-family-col">
137 <div class="imagify-card">
138 <div class="imagify-card-header">
139 <div class="imagify-card-logo">
140 <img src="<?php echo esc_url( IMAGIFY_ASSETS_IMG_URL . $plugin_data['logo']['file'] ); ?>" loading="lazy" style="width: <?php echo esc_attr( $plugin_data['logo']['width'] ); ?>">
141 </div>
142 <h4><?php echo esc_html( $plugin_data['title'] ); ?></h4>
143 </div>
144 <div class="imagify-card-body">
145 <p>
146 <?php echo esc_html( $plugin_data['desc'] ); ?>
147 </p>
148 </div>
149 <div class="imagify-card-footer">
150 <?php if ( '#' === $plugin_data['cta']['url'] ) : ?>
151 <span><?php echo esc_html( $plugin_data['cta']['text'] ); ?></span><span class="dashicons dashicons-yes"></span>
152 <?php else : ?>
153 <a href="<?php echo esc_url( $plugin_data['cta']['url'] ); ?>" class="imagify-card-btn imagify-btn-cta" <?php echo 'Get it Now' === $plugin_data['cta']['text'] ? 'target="_blank"' : ''; ?> rel="noopener"><?php echo esc_html( $plugin_data['cta']['text'] ); ?></a>
154 <a href="<?php echo esc_url( $plugin_data['link'] ); ?>" target="_blank" rel="noopener"><?php echo esc_html( 'Learn more' ); ?></a>
155 <?php endif; ?>
156 </div>
157 </div>
158 </div>
159 <?php
160 endforeach;
161 ?>
162 </div>
163 <?php
164 /**
165 * List of partners affected by this option.
166 * For internal use only.
167 *
168 * @since 1.8.2
169 * @author Grégory Viguier
170 *
171 * @param array $partners An array of partner names.
172 * @return array
173 */
174 $partners = apply_filters( 'imagify_deactivatable_partners', [] );
175
176 if ( $partners ) {
177 ?>
178 <h2 class="imagify-options-title"><?php esc_html_e( 'Partners', 'imagify' ); ?></h2>
179 <p class="imagify-options-subtitle" id="imagify-partners-label">
180 <span class="imagify-info">
181 <span class="dashicons dashicons-info"></span>
182 <a href="#imagify-partners-info" class="imagify-modal-trigger"><?php esc_html_e( 'More info?', 'imagify' ); ?></a>
183 </span>
184 </p>
185
186 <p>
187 <?php
188 $settings->field_checkbox(
189 [
190 'option_name' => 'partner_links',
191 'label' => __( 'Display Partner Links', 'imagify' ),
192 ]
193 );
194 ?>
195 </p>
196 <?php
197 }
198 ?>
199 </div>
200 </div>
201 <?php endif; ?>
202 <?php
203 if ( Imagify_Requirements::is_api_key_valid() ) {
204 $this->print_template( 'part-settings-tools' );
205 $this->print_template( 'part-settings-footer' );
206 }
207 ?>
208 </div>
209 </form>
210 </div>
211 </div>
212
213 <?php
214 $this->print_template( 'part-rocket-ad' );
215 $this->print_template( 'modal-settings-infos' );
216 $this->print_template( 'modal-settings-partners-infos' );
217 $this->print_template( 'modal-settings-visual-comparison' );
218 ?>
219
220 </div>
221
222