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

226 lines 8.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
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( array( 'de', 'es', 'fr', 'it' ) );
9
10 /* Ads notice */
11 $notice = 'wp-rocket';
12 $user_id = get_current_user_id();
13 $notices = get_user_meta( $user_id, '_imagify_ignore_ads', true );
14 $notices = $notices && is_array( $notices ) ? array_flip( $notices ) : array();
15 $wrapper_class = isset( $notices[ $notice ] ) || defined( 'WP_ROCKET_VERSION' ) ? 'imagify-have-rocket' : 'imagify-dont-have-rocket';
16 ?>
17 <div class="wrap imagify-settings <?php echo $wrapper_class; ?> imagify-clearfix">
18
19 <div class="imagify-col imagify-main">
20
21 <?php $this->print_template( 'part-settings-header' ); ?>
22
23 <form action="<?php echo esc_url( $settings->get_form_action() ); ?>" id="imagify-settings" method="post">
24
25 <div class="imagify-settings-main-content<?php echo Imagify_Requirements::is_api_key_valid() ? '' : ' imagify-no-api-key'; ?>">
26
27 <?php settings_fields( $settings->get_settings_group() ); ?>
28 <?php wp_nonce_field( 'imagify-signup', 'imagifysignupnonce', false ); ?>
29 <?php wp_nonce_field( 'imagify-check-api-key', 'imagifycheckapikeynonce', false ); ?>
30
31 <?php
32 if ( ! Imagify_Requirements::is_api_key_valid() ) {
33 $this->print_template( 'part-settings-account' );
34 $this->print_template( 'part-settings-footer' );
35 }
36 ?>
37
38 <div class="imagify-col imagify-shared-with-account-col<?php echo $hidden_class; ?>">
39 <div class="imagify-settings-section">
40
41 <h2 class="imagify-options-title"><?php _e( 'General Settings', 'imagify' ); ?></h2>
42
43 <p class="imagify-options-subtitle" id="imagify-optimization-level-label">
44 <?php _e( 'Optimization Level', 'imagify' ); ?>
45
46 <span class="imagify-info">
47 <span class="dashicons dashicons-info"></span>
48 <a href="#imagify-more-info" class="imagify-modal-trigger"><?php _e( 'More info?', 'imagify' ); ?></a>
49 </span>
50 </p>
51
52 <div class="imagify-setting-optim-level">
53 <p class="imagify-inline-options">
54 <input type="radio" id="imagify-optimization_level_normal" name="<?php echo $option_name; ?>[optimization_level]" value="0" <?php checked( $options->get( 'optimization_level' ), 0 ); ?> aria-describedby="imagify-optimization-level-label">
55 <label for="imagify-optimization_level_normal">
56 <?php _e( 'Normal', 'imagify' ); ?>
57 </label>
58
59 <input type="radio" id="imagify-optimization_level_aggro" name="<?php echo $option_name; ?>[optimization_level]" value="1" <?php checked( $options->get( 'optimization_level' ), 1 ); ?> aria-describedby="imagify-optimization-level-label">
60 <label for="imagify-optimization_level_aggro">
61 <?php _e( 'Aggressive', 'imagify' ); ?>
62 </label>
63
64 <input type="radio" id="imagify-optimization_level_ultra" name="<?php echo $option_name; ?>[optimization_level]" value="2" <?php checked( $options->get( 'optimization_level' ), 2 ); ?> aria-describedby="imagify-optimization-level-label">
65 <label for="imagify-optimization_level_ultra">
66 <?php _e( 'Ultra', 'imagify' ); ?>
67 </label>
68 </p>
69
70 <p class="imagify-visual-comparison-text">
71 <?php
72 printf(
73 /* translators: 1 is a button tag start, 2 is the button tag end. */
74 __( 'Need help to choose? %1$sTry the Visual Comparison%2$s', 'imagify' ),
75 '<button type="button" class="button button-primary button-mini-flat imagify-visual-comparison-btn imagify-modal-trigger" data-target="#imagify-visual-comparison">',
76 '</button>'
77 );
78 ?>
79 </p>
80 </div>
81
82 <p class="imagify-setting-line">
83 <?php
84 $settings->field_checkbox( array(
85 'option_name' => 'auto_optimize',
86 'label' => __( 'Auto-Optimize images on upload', 'imagify' ),
87 'info' => __( 'Automatically optimize every image you upload to WordPress.', 'imagify' ),
88 ) );
89 ?>
90 </p>
91
92 <p class="imagify-setting-line">
93 <?php
94 $settings->field_checkbox( array(
95 'option_name' => 'backup',
96 'label' => __( 'Backup original images', 'imagify' ),
97 'info' => __( 'Keep your original images in a separate folder before optimization process.', 'imagify' ),
98 ) );
99
100 $backup_error_class = $options->get( 'backup' ) && ! Imagify_Requirements::attachments_backup_dir_is_writable() ? '' : ' hidden';
101 ?>
102 <br/><strong id="backup-dir-is-writable" class="imagify-error<?php echo $backup_error_class; ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'imagify_check_backup_dir_is_writable' ) ); ?>">
103 <?php
104 $backup_path = $this->filesystem->make_path_relative( get_imagify_backup_dir_path( true ) );
105 /* translators: %s is a file path. */
106 printf( __( 'The backup folder %s cannot be created or is not writable by the server, original images cannot be saved!', 'imagify' ), "<code>$backup_path</code>" );
107 ?>
108 </strong>
109 </p>
110
111 <p class="imagify-setting-line">
112 <?php
113 $info = __( 'EXIF data is information stored in your pictures like shutter speed, exposure compensation, ISO, etc...', 'imagify' );
114 $info .= ' <a href="' . esc_url( imagify_get_external_url( 'exif' ) ) . '" target="_blank">' . __( 'Learn more', 'imagify' ) . '</a><br/><br/>';
115 $info .= __( 'If you are a photographer, you may be interested in this option if you are displaying info like the model of your camera on your pages. Also, keeping EXIF data can fix some colorimetric problems.', 'imagify' );
116
117 $settings->field_checkbox( array(
118 'option_name' => 'exif',
119 'label' => __( 'Keep all EXIF data from your images', 'imagify' ),
120 'info' => $info,
121 ) );
122 ?>
123 </p>
124 </div>
125 </div>
126
127 <?php if ( Imagify_Requirements::is_api_key_valid() ) { ?>
128 <div class="imagify-col imagify-account-info-col">
129 <?php $this->print_template( 'part-settings-account' ); ?>
130 </div>
131 <?php } ?>
132 </div>
133
134 <div class="imagify-settings-main-content<?php echo $hidden_class; ?>">
135
136 <div class="imagify-settings-section imagify-clear">
137 <h2 class="imagify-options-title"><?php _e( 'Optimization', 'imagify' ); ?></h2>
138 <?php
139 $this->print_template( 'part-settings-webp' );
140 $this->print_template( 'part-settings-library' );
141 $this->print_template( 'part-settings-custom-folders' );
142 ?>
143 </div>
144 </div>
145
146 <div class="imagify-settings-main-content imagify-pb0<?php echo $hidden_class; ?>">
147 <div class="imagify-settings-section imagify-clear">
148 <div class="imagify-col">
149 <h2 class="imagify-options-title"><?php _e( 'Display Options', 'imagify' ); ?></h2>
150
151 <p class="imagify-options-subtitle"><?php _e( 'Show Toolbar Menu', 'imagify' ); ?></p>
152
153 <div class="imagify-col">
154 <p>
155 <?php
156 $settings->field_checkbox( array(
157 'option_name' => 'admin_bar_menu',
158 'label' => __( 'I want this awesome quick access menu on my Toolbar.', 'imagify' ),
159 ) );
160 ?>
161 </p>
162 </div>
163 <div class="imagify-col">
164 <p>
165 <img class="imagify-menu-bar-img" src="<?php echo esc_url( IMAGIFY_ASSETS_IMG_URL . 'imagify-menu-bar-' . $lang . '.jpg' ); ?>" width="273" height="239" alt="">
166 </p>
167 </div>
168
169 <?php
170 /**
171 * List of partners affected by this option.
172 * For internal use only.
173 *
174 * @since 1.8.2
175 * @author Grégory Viguier
176 *
177 * @param array $partners An array of partner names.
178 * @return array
179 */
180 $partners = apply_filters( 'imagify_deactivatable_partners', array() );
181
182 if ( $partners ) {
183 ?>
184 <p class="imagify-options-subtitle" id="imagify-partners-label">
185 <?php esc_html_e( 'Partners', 'imagify' ); ?>
186
187 <span class="imagify-info">
188 <span class="dashicons dashicons-info"></span>
189 <a href="#imagify-partners-info" class="imagify-modal-trigger"><?php _e( 'More info?', 'imagify' ); ?></a>
190 </span>
191 </p>
192
193 <p>
194 <?php
195 $settings->field_checkbox( array(
196 'option_name' => 'partner_links',
197 'label' => __( 'Display Partner Links', 'imagify' ),
198 ) );
199 ?>
200 </p>
201 <?php
202 }
203 ?>
204 </div>
205 </div>
206
207 <?php
208 if ( Imagify_Requirements::is_api_key_valid() ) {
209 $this->print_template( 'part-settings-footer' );
210 }
211 ?>
212 </div>
213 </form>
214 </div>
215
216 <?php
217 $this->print_template( 'part-rocket-ad' );
218 $this->print_template( 'modal-settings-infos' );
219 $this->print_template( 'modal-settings-partners-infos' );
220 $this->print_template( 'modal-settings-visual-comparison' );
221 $this->print_template( 'modal-payment' );
222 ?>
223
224 </div>
225 <?php
226