PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.3.1
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.3.1
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 2.3.1, at views/page-settings.php

210 lines 8.7 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 <div class="imagify-col imagify-main">
21
22 <?php $this->print_template( 'part-settings-header' ); ?>
23 <div class="imagify-main-content">
24 <form action="<?php echo esc_url( $settings->get_form_action() ); ?>" id="imagify-settings" method="post">
25
26 <div class="imagify-settings-main-content<?php echo Imagify_Requirements::is_api_key_valid() ? '' : ' imagify-no-api-key'; ?>">
27
28 <?php settings_fields( $settings->get_settings_group() ); ?>
29 <?php wp_nonce_field( 'imagify-signup', 'imagifysignupnonce', false ); ?>
30 <?php wp_nonce_field( 'imagify-check-api-key', 'imagifycheckapikeynonce', false ); ?>
31
32 <?php
33 if ( ! Imagify_Requirements::is_api_key_valid() ) {
34 $this->print_template( 'part-settings-account' );
35 $this->print_template( 'part-settings-footer' );
36 }
37 ?>
38
39 <div class="imagify-col imagify-shared-with-account-col<?php echo esc_attr( $hidden_class ); ?>">
40 <div class="imagify-settings-section">
41
42 <h2 class="imagify-options-title"><?php esc_html_e( 'General Settings', 'imagify' ); ?></h2>
43
44 <p class="imagify-setting-line">
45 <?php
46 $settings->field_checkbox(
47 [
48 'option_name' => 'auto_optimize',
49 'label' => __( 'Auto-Optimize images on upload', 'imagify' ),
50 'info' => __( 'Automatically optimize every image you upload to WordPress.', 'imagify' ),
51 ]
52 );
53 ?>
54 </p>
55
56 <p class="imagify-setting-line">
57 <?php
58 $settings->field_checkbox(
59 [
60 'option_name' => 'backup',
61 'label' => __( 'Backup original images', 'imagify' ),
62 'info' => __( 'Keep your original images in a separate folder before optimization process.', 'imagify' ),
63 ]
64 );
65
66 $backup_error_class = $options->get( 'backup' ) && ! Imagify_Requirements::attachments_backup_dir_is_writable() ? '' : ' hidden';
67 ?>
68 <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' ) ); ?>">
69 <?php
70 $backup_path = $this->filesystem->make_path_relative( get_imagify_backup_dir_path( true ) );
71 /* translators: %s is a file path. */
72 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
73 ?>
74 </strong>
75 </p>
76
77 <p class="imagify-setting-line">
78 <?php
79 $settings->field_checkbox(
80 [
81 'option_name' => 'lossless',
82 'label' => __( 'Lossless compression', 'imagify' ),
83 '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' ),
84 ]
85 );
86 ?>
87 </p>
88 <?php do_action( 'imagify_settings_after_lossless' ); ?>
89 </div>
90 </div>
91
92 <?php if ( Imagify_Requirements::is_api_key_valid() ) { ?>
93 <div class="imagify-col imagify-account-info-col">
94 <?php $this->print_template( 'part-settings-account' ); ?>
95 </div>
96 <?php } ?>
97 </div>
98
99 <div class="imagify-settings-main-content<?php echo esc_attr( $hidden_class ); ?>">
100
101 <div class="imagify-settings-section imagify-clear">
102 <h2 class="imagify-options-title"><?php esc_html_e( 'Optimization', 'imagify' ); ?></h2>
103 <?php
104 $this->print_template( 'part-settings-webp' );
105 $this->print_template( 'part-settings-library' );
106 $this->print_template( 'part-settings-custom-folders' );
107 ?>
108 </div>
109 </div>
110
111 <div class="imagify-settings-main-content imagify-pb0<?php echo esc_attr( $hidden_class ); ?>">
112 <?php if ( ! $data['hide_plugin_family'] ) : ?>
113 <div class="imagify-settings-section imagify-clear imagify-plugin-family-section">
114 <div>
115 <h2 class="imagify-options-title"><?php esc_html_e( 'Our Plugins', 'imagify' ); ?></h2>
116 <p class="imagify-options-subtitle"><?php esc_html_e( 'Build better, faster, safer', 'imagify' ); ?></p>
117 <p class="">
118 <?php
119 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' );
120 ?>
121 </p>
122 <div class="imagify-plugin-family-cards">
123 <?php foreach ( $data['plugin_family'] as $plugin_name => $plugin_data ) : ?>
124 <div class="imagify-plugin-family-col">
125 <div class="imagify-card">
126 <div class="imagify-card-header">
127 <div class="imagify-card-logo">
128 <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'] ); ?>">
129 </div>
130 <h4><?php echo esc_html( $plugin_data['title'] ); ?></h4>
131 </div>
132 <div class="imagify-card-body">
133 <p>
134 <?php echo esc_html( $plugin_data['desc'] ); ?>
135 </p>
136 </div>
137 <div class="imagify-card-footer">
138 <?php if ( '#' === $plugin_data['cta']['url'] ) : ?>
139 <span><?php echo esc_html( $plugin_data['cta']['text'] ); ?></span><span class="dashicons dashicons-yes"></span>
140 <?php else : ?>
141 <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>
142 <a href="<?php echo esc_url( $plugin_data['link'] ); ?>" target="_blank" rel="noopener"><?php echo esc_html( 'Learn more' ); ?></a>
143 <?php endif; ?>
144 </div>
145 </div>
146 </div>
147 <?php
148 endforeach;
149 ?>
150 </div>
151 <?php
152 /**
153 * List of partners affected by this option.
154 * For internal use only.
155 *
156 * @since 1.8.2
157 * @author Grégory Viguier
158 *
159 * @param array $partners An array of partner names.
160 * @return array
161 */
162 $partners = apply_filters( 'imagify_deactivatable_partners', [] );
163
164 if ( $partners ) {
165 ?>
166 <h2 class="imagify-options-title"><?php esc_html_e( 'Partners', 'imagify' ); ?></h2>
167 <p class="imagify-options-subtitle" id="imagify-partners-label">
168 <span class="imagify-info">
169 <span class="dashicons dashicons-info"></span>
170 <a href="#imagify-partners-info" class="imagify-modal-trigger"><?php esc_html_e( 'More info?', 'imagify' ); ?></a>
171 </span>
172 </p>
173
174 <p>
175 <?php
176 $settings->field_checkbox(
177 [
178 'option_name' => 'partner_links',
179 'label' => __( 'Display Partner Links', 'imagify' ),
180 ]
181 );
182 ?>
183 </p>
184 <?php
185 }
186 ?>
187 </div>
188 </div>
189 <?php endif; ?>
190 <?php
191 if ( Imagify_Requirements::is_api_key_valid() ) {
192 $this->print_template( 'part-settings-tools' );
193 $this->print_template( 'part-settings-footer' );
194 }
195 ?>
196 </div>
197 </form>
198 </div>
199 </div>
200
201 <?php
202 $this->print_template( 'part-rocket-ad' );
203 $this->print_template( 'modal-settings-infos' );
204 $this->print_template( 'modal-settings-partners-infos' );
205 $this->print_template( 'modal-settings-visual-comparison' );
206 ?>
207
208 </div>
209
210