| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
/** |
| 6 |
* The admin settings of the plugin. |
| 7 |
* @since 1.0.0 |
| 8 |
*/ |
| 9 |
$wpmtk_is_active = in_array( 'wpmastertoolkit/wp-mastertoolkit.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ); |
| 10 |
?> |
| 11 |
<h1><?php _e( "QuickWebp Settings", QUICKWEBP_TEXT_DOMAIN ); ?></h1> |
| 12 |
|
| 13 |
<div class="notice notice-info"> |
| 14 |
<p> |
| 15 |
<?php _e( "QuickWebP is now part of the WPMasterToolKit plugin. You can download it for free on the WordPress repository.", QUICKWEBP_TEXT_DOMAIN ); ?> |
| 16 |
</p> |
| 17 |
<!-- <img src="<?php echo esc_url( QUICKWEBP_PLUGIN_URL . 'public/assets/img/wpmastertoolkit.gif' ); ?>" alt="WPMasterToolKit" style="max-width: 100%;"> --> |
| 18 |
<video autoplay loop muted controls style="max-width: 600px;"> |
| 19 |
<source src="<?php echo esc_url( QUICKWEBP_PLUGIN_URL . 'public/assets/video/wpmastertoolkit.mp4' ); ?>" type="video/mp4"> |
| 20 |
Your browser does not support the video tag. |
| 21 |
</video> |
| 22 |
<?php if ( $wpmtk_is_active ) : ?> |
| 23 |
<p> |
| 24 |
<?php esc_html_e( "You can now deactivate QuickWebP and finish the migration.", QUICKWEBP_TEXT_DOMAIN ); ?> |
| 25 |
</p> |
| 26 |
<?php else : ?> |
| 27 |
<p> |
| 28 |
<a href="<?php echo esc_url( admin_url( 'plugin-install.php?s=wpmastertoolkit&tab=search&type=term' ) ); ?>" class="button button-primary" target="_blank"><?php esc_html_e( "Download WPMasterToolKit", QUICKWEBP_TEXT_DOMAIN ); ?></a> |
| 29 |
<a href="https://wordpress.org/plugins/wpmastertoolkit/" class="button button-secondary" target="_blank"><?php esc_html_e( "Download WPMasterToolKit from wordpress.org", QUICKWEBP_TEXT_DOMAIN ); ?></a> |
| 30 |
</p> |
| 31 |
<?php endif; ?> |
| 32 |
</div> |
| 33 |
|
| 34 |
<form action="" method="post"> |
| 35 |
|
| 36 |
<table class="form-table"> |
| 37 |
|
| 38 |
<?php $this->render_component( array( |
| 39 |
'type' => 'toggle', |
| 40 |
'name' => 'quickwebp_settings_conversion', |
| 41 |
'label' => __( "Enable/disable image conversion to WEBP format", QUICKWEBP_TEXT_DOMAIN ), |
| 42 |
'default' => quickwebp_settings_default('quickwebp_settings_conversion'), |
| 43 |
'classes' => 'toggle-with-children', |
| 44 |
)); ?> |
| 45 |
|
| 46 |
<tbody class="form-table children"> |
| 47 |
|
| 48 |
<?php $this->render_component( array( |
| 49 |
'type' => 'range-slider', |
| 50 |
'min' => 0, |
| 51 |
'max' => 100, |
| 52 |
'step' => 1, |
| 53 |
'unit' => '%', |
| 54 |
'name' => 'quickwebp_settings_conversion_quality', |
| 55 |
'label' => __( 'Quality', QUICKWEBP_TEXT_DOMAIN ), |
| 56 |
'default' => quickwebp_settings_default('quickwebp_settings_conversion_quality') |
| 57 |
)); ?> |
| 58 |
|
| 59 |
<?php $this->render_component( array( |
| 60 |
'type' => 'range-slider', |
| 61 |
'min' => 0, |
| 62 |
'max' => 100, |
| 63 |
'step' => 1, |
| 64 |
'unit' => '%', |
| 65 |
'name' => 'quickwebp_settings_conversion_sharpen', |
| 66 |
'label' => __( 'Sharpen', QUICKWEBP_TEXT_DOMAIN ), |
| 67 |
'default' => quickwebp_settings_default('quickwebp_settings_conversion_sharpen') |
| 68 |
)); ?> |
| 69 |
|
| 70 |
<?php $this->render_component( array( |
| 71 |
'type' => 'checkbox', |
| 72 |
'name' => 'quickwebp_settings_conversion_ignore_webp', |
| 73 |
'label' => __( "Do not compress images already in WebP", QUICKWEBP_TEXT_DOMAIN ), |
| 74 |
'default' => quickwebp_settings_default('quickwebp_settings_conversion_ignore_webp'), |
| 75 |
'options' => array( |
| 76 |
array( |
| 77 |
'label' => '', |
| 78 |
'value' => 'checked' |
| 79 |
) |
| 80 |
) |
| 81 |
)); ?> |
| 82 |
|
| 83 |
<?php $this->render_component( array( |
| 84 |
'type' => 'checkbox', |
| 85 |
'name' => 'quickwebp_settings_conversion_save_original', |
| 86 |
'label' => __( "Save original images", QUICKWEBP_TEXT_DOMAIN ), |
| 87 |
'default' => quickwebp_settings_default('quickwebp_settings_conversion_save_original'), |
| 88 |
'options' => array( |
| 89 |
array( |
| 90 |
'label' => '', |
| 91 |
'value' => 'checked' |
| 92 |
) |
| 93 |
) |
| 94 |
)); ?> |
| 95 |
|
| 96 |
<tr> |
| 97 |
<th> |
| 98 |
<label><?php _e( 'Before saving, test your configuration with preview mode.', QUICKWEBP_TEXT_DOMAIN ); ?></label> |
| 99 |
</th> |
| 100 |
<td> |
| 101 |
<?php include QUICKWEBP_PLUGIN_PATH . 'admin/templates/popup-settings-preview.php'; ?> |
| 102 |
</td> |
| 103 |
</tr> |
| 104 |
|
| 105 |
<?php |
| 106 |
$description_for_nginx = $is_nginx ? __("If you choose to use rewrite rules, the file conf/quickwebp.conf will be created and must be included into the server's configuration file (then restart the server).", QUICKWEBP_TEXT_DOMAIN) : ''; |
| 107 |
|
| 108 |
$this->render_component( array( |
| 109 |
'type' => 'radio', |
| 110 |
'name' => 'quickwebp_settings_conversion_display_webp_mode', |
| 111 |
'label' => __( "Display images in WebP format on the site", QUICKWEBP_TEXT_DOMAIN ), |
| 112 |
'description' => sprintf( __('If activated, this option allows to deliver optimized images in bulk via QuickWebP in WebP format (useless for images converted to import). %s', QUICKWEBP_TEXT_DOMAIN), $description_for_nginx ), |
| 113 |
'default' => quickwebp_settings_default('quickwebp_settings_conversion_display_webp_mode'), |
| 114 |
'options' => array( |
| 115 |
array( |
| 116 |
'label' => __( 'Deactivate', QUICKWEBP_TEXT_DOMAIN ), |
| 117 |
'value' => 'disabled' |
| 118 |
), |
| 119 |
array( |
| 120 |
'label' => __( 'Use <picture> tags', QUICKWEBP_TEXT_DOMAIN ), |
| 121 |
'value' => 'picture' |
| 122 |
), |
| 123 |
array( |
| 124 |
'label' => sprintf( __( 'Use rewrite rules %s', QUICKWEBP_TEXT_DOMAIN ), $is_nginx ? '(beta)' : '' ), |
| 125 |
'value' => 'rewrite' |
| 126 |
) |
| 127 |
) |
| 128 |
)); |
| 129 |
?> |
| 130 |
|
| 131 |
<tr> |
| 132 |
<th> |
| 133 |
<label><?php _e( 'Bulk optimization', QUICKWEBP_TEXT_DOMAIN ); ?></label> |
| 134 |
</th> |
| 135 |
<td> |
| 136 |
<?php include QUICKWEBP_PLUGIN_PATH . 'admin/templates/bulk-optimization.php'; ?> |
| 137 |
</td> |
| 138 |
</tr> |
| 139 |
|
| 140 |
</tbody> |
| 141 |
|
| 142 |
</table> |
| 143 |
|
| 144 |
<hr> |
| 145 |
|
| 146 |
<table class="form-table"> |
| 147 |
|
| 148 |
<?php $this->render_component( array( |
| 149 |
'type' => 'toggle', |
| 150 |
'name' => 'quickwebp_settings_resize', |
| 151 |
'label' => __( "Enable/disable image resizing", QUICKWEBP_TEXT_DOMAIN ), |
| 152 |
'default' => quickwebp_settings_default('quickwebp_settings_resize'), |
| 153 |
'classes' => 'toggle-with-children', |
| 154 |
'description' => __( "By default, WordPress limits the maximum width of uploaded images to 2560 pixels.", QUICKWEBP_TEXT_DOMAIN ), |
| 155 |
)); ?> |
| 156 |
|
| 157 |
<tbody class="form-table children"> |
| 158 |
|
| 159 |
<?php $this->render_component( array( |
| 160 |
'type' => 'number', |
| 161 |
'name' => 'quickwebp_settings_resize_value', |
| 162 |
'label' => __( 'Max size', QUICKWEBP_TEXT_DOMAIN ), |
| 163 |
'default' => quickwebp_settings_default('quickwebp_settings_resize_value') |
| 164 |
)); ?> |
| 165 |
|
| 166 |
</tbody> |
| 167 |
|
| 168 |
</table> |
| 169 |
|
| 170 |
<hr> |
| 171 |
|
| 172 |
<table class="form-table"> |
| 173 |
|
| 174 |
<?php $this->render_component( array( |
| 175 |
'type' => 'toggle', |
| 176 |
'name' => 'quickwebp_settings_completion', |
| 177 |
'label' => __( "Enable/disable smart media completion for SEO", QUICKWEBP_TEXT_DOMAIN ), |
| 178 |
'default' => quickwebp_settings_default('quickwebp_settings_completion'), |
| 179 |
'classes' => 'toggle-with-children', |
| 180 |
'description' => __( "This feature will automatically complete the media information (title, caption, alt text, description) from the image name.", QUICKWEBP_TEXT_DOMAIN ), |
| 181 |
)); ?> |
| 182 |
|
| 183 |
<tbody class="form-table children"> |
| 184 |
|
| 185 |
<?php $this->render_component( array( |
| 186 |
'type' => 'checkbox', |
| 187 |
'name' => 'quickwebp_settings_completion_options', |
| 188 |
'default' => quickwebp_settings_default('quickwebp_settings_completion_options'), |
| 189 |
'options' => array( |
| 190 |
array( |
| 191 |
'label' => __( 'Title completion from image name', QUICKWEBP_TEXT_DOMAIN ), |
| 192 |
'value' => 'title', |
| 193 |
), |
| 194 |
array( |
| 195 |
'label' => __( 'Caption completion from image name.', QUICKWEBP_TEXT_DOMAIN ), |
| 196 |
'value' => 'caption', |
| 197 |
), |
| 198 |
array( |
| 199 |
'label' => __( 'Alt text completion from image name.', QUICKWEBP_TEXT_DOMAIN ), |
| 200 |
'value' => 'alt', |
| 201 |
), |
| 202 |
array( |
| 203 |
'label' => __( 'Description completion from image name.', QUICKWEBP_TEXT_DOMAIN ), |
| 204 |
'value' => 'description', |
| 205 |
) |
| 206 |
) |
| 207 |
)); ?> |
| 208 |
|
| 209 |
</tbody> |
| 210 |
|
| 211 |
</table> |
| 212 |
|
| 213 |
<hr> |
| 214 |
|
| 215 |
<table class="form-table"> |
| 216 |
|
| 217 |
<?php $this->render_component( array( |
| 218 |
'type' => 'toggle', |
| 219 |
'name' => 'quickwebp_settings_cleanup', |
| 220 |
'label' => __( "Enable/disable file name cleanup", QUICKWEBP_TEXT_DOMAIN ), |
| 221 |
'default' => quickwebp_settings_default('quickwebp_settings_cleanup'), |
| 222 |
'description' => __( "Remove special characters from file names.", QUICKWEBP_TEXT_DOMAIN ), |
| 223 |
)); ?> |
| 224 |
|
| 225 |
</table> |
| 226 |
|
| 227 |
<hr> |
| 228 |
|
| 229 |
<table class="form-table"> |
| 230 |
|
| 231 |
<?php $this->render_component( array( |
| 232 |
'type' => 'toggle', |
| 233 |
'name' => 'quickwebp_settings_paste_image', |
| 234 |
'label' => __( "Enable/disable paste picture directly (beta)", QUICKWEBP_TEXT_DOMAIN ), |
| 235 |
'default' => quickwebp_settings_default('quickwebp_settings_paste_image'), |
| 236 |
'description' => __( "With this feature you can paste directly your picture in WordPress media.", QUICKWEBP_TEXT_DOMAIN ), |
| 237 |
)); ?> |
| 238 |
|
| 239 |
</table> |
| 240 |
|
| 241 |
<hr> |
| 242 |
|
| 243 |
<table class="form-table"> |
| 244 |
|
| 245 |
<?php $this->render_component( array( |
| 246 |
'type' => 'select', |
| 247 |
'options' => array( |
| 248 |
array( |
| 249 |
'value' => 'gd', |
| 250 |
'label' => 'GD' |
| 251 |
), |
| 252 |
array( |
| 253 |
'value' => 'imagick', |
| 254 |
'label' => 'Imagick' |
| 255 |
) |
| 256 |
), |
| 257 |
'name' => 'quickwebp_settings_library', |
| 258 |
'label' => __( "Library to use", QUICKWEBP_TEXT_DOMAIN ), |
| 259 |
'default' => quickwebp_settings_default('quickwebp_settings_library'), |
| 260 |
'description' => __( "We use the GD library as the default option. However, if the GD library is not available, we will use Imagick instead.", QUICKWEBP_TEXT_DOMAIN ) |
| 261 |
)); ?> |
| 262 |
|
| 263 |
</table> |
| 264 |
|
| 265 |
<hr> |
| 266 |
|
| 267 |
<h2> |
| 268 |
<?php _e( "Credits", QUICKWEBP_TEXT_DOMAIN ); ?> |
| 269 |
</h2> |
| 270 |
<p> |
| 271 |
<?php _e( "This plugin is developed by", QUICKWEBP_TEXT_DOMAIN ); ?> |
| 272 |
<a href="https://webdeclic.com/" target="_blank">Webdeclic</a>. |
| 273 |
<?php _e( "You can support this project here:", QUICKWEBP_TEXT_DOMAIN ); ?> |
| 274 |
</p> |
| 275 |
<p> |
| 276 |
<a class="buymeacoffee" href="https://www.buymeacoffee.com/ludwig" target="_blank"><img style="height: 60px;" src="<?php echo esc_url( QUICKWEBP_PLUGIN_URL . 'public/assets/img/buy-me-a-coffee.webp' ); ?>" alt="Buy Me A Coffee"></a> |
| 277 |
</p> |
| 278 |
<p> |
| 279 |
<?php _e( "You can show all Webdeclic's plugins on ", QUICKWEBP_TEXT_DOMAIN ); ?> |
| 280 |
<a href="https://wordpress.org/plugins/search/webdeclic/" target="_blank"><?php _e( "wordpress.org", QUICKWEBP_TEXT_DOMAIN ); ?></a>. |
| 281 |
</p> |
| 282 |
|
| 283 |
<hr> |
| 284 |
|
| 285 |
<?php submit_button(); ?> |
| 286 |
</form> |