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

208 lines 8.6 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 </div>
89 </div>
90
91 <?php if ( Imagify_Requirements::is_api_key_valid() ) { ?>
92 <div class="imagify-col imagify-account-info-col">
93 <?php $this->print_template( 'part-settings-account' ); ?>
94 </div>
95 <?php } ?>
96 </div>
97
98 <div class="imagify-settings-main-content<?php echo esc_attr( $hidden_class ); ?>">
99
100 <div class="imagify-settings-section imagify-clear">
101 <h2 class="imagify-options-title"><?php esc_html_e( 'Optimization', 'imagify' ); ?></h2>
102 <?php
103 $this->print_template( 'part-settings-webp' );
104 $this->print_template( 'part-settings-library' );
105 $this->print_template( 'part-settings-custom-folders' );
106 ?>
107 </div>
108 </div>
109
110 <div class="imagify-settings-main-content imagify-pb0<?php echo esc_attr( $hidden_class ); ?>">
111 <?php if ( ! $data['hide_plugin_family'] ) : ?>
112 <div class="imagify-settings-section imagify-clear imagify-plugin-family-section">
113 <div>
114 <h2 class="imagify-options-title"><?php esc_html_e( 'Our Plugins', 'imagify' ); ?></h2>
115 <p class="imagify-options-subtitle"><?php esc_html_e( 'Build better, faster, safer', 'imagify' ); ?></p>
116 <p class="">
117 <?php
118 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' );
119 ?>
120 </p>
121 <div class="imagify-plugin-family-cards">
122 <?php foreach ( $data['plugin_family'] as $plugin_name => $plugin_data ) : ?>
123 <div class="imagify-plugin-family-col">
124 <div class="imagify-card">
125 <div class="imagify-card-header">
126 <div class="imagify-card-logo">
127 <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'] ); ?>">
128 </div>
129 <h4><?php echo esc_html( $plugin_data['title'] ); ?></h4>
130 </div>
131 <div class="imagify-card-body">
132 <p>
133 <?php echo esc_html( $plugin_data['desc'] ); ?>
134 </p>
135 </div>
136 <div class="imagify-card-footer">
137 <?php if ( '#' === $plugin_data['cta']['url'] ) : ?>
138 <span><?php echo esc_html( $plugin_data['cta']['text'] ); ?></span><span class="dashicons dashicons-yes"></span>
139 <?php else : ?>
140 <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>
141 <a href="<?php echo esc_url( $plugin_data['link'] ); ?>" target="_blank" rel="noopener"><?php echo esc_html( 'Learn more' ); ?></a>
142 <?php endif; ?>
143 </div>
144 </div>
145 </div>
146 <?php
147 endforeach;
148 ?>
149 </div>
150 <?php
151 /**
152 * List of partners affected by this option.
153 * For internal use only.
154 *
155 * @since 1.8.2
156 * @author Grégory Viguier
157 *
158 * @param array $partners An array of partner names.
159 * @return array
160 */
161 $partners = apply_filters( 'imagify_deactivatable_partners', [] );
162
163 if ( $partners ) {
164 ?>
165 <h2 class="imagify-options-title"><?php esc_html_e( 'Partners', 'imagify' ); ?></h2>
166 <p class="imagify-options-subtitle" id="imagify-partners-label">
167 <span class="imagify-info">
168 <span class="dashicons dashicons-info"></span>
169 <a href="#imagify-partners-info" class="imagify-modal-trigger"><?php esc_html_e( 'More info?', 'imagify' ); ?></a>
170 </span>
171 </p>
172
173 <p>
174 <?php
175 $settings->field_checkbox(
176 [
177 'option_name' => 'partner_links',
178 'label' => __( 'Display Partner Links', 'imagify' ),
179 ]
180 );
181 ?>
182 </p>
183 <?php
184 }
185 ?>
186 </div>
187 </div>
188 <?php endif; ?>
189 <?php
190 if ( Imagify_Requirements::is_api_key_valid() ) {
191 $this->print_template( 'part-settings-footer' );
192 }
193 ?>
194 </div>
195 </form>
196 </div>
197 </div>
198
199 <?php
200 $this->print_template( 'part-rocket-ad' );
201 $this->print_template( 'modal-settings-infos' );
202 $this->print_template( 'modal-settings-partners-infos' );
203 $this->print_template( 'modal-settings-visual-comparison' );
204 ?>
205
206 </div>
207
208