This commit is contained in:
2024-05-20 15:37:46 +03:00
commit 00b7dbd0b7
10404 changed files with 3285853 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<?php
/**
* Field displayed in plugin settings form.
*
* @var mixed[] $option Data of field.
* @var string $index Index of field.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<?php if ( $option['info'] ) : ?>
<p><?php echo wp_kses_post( $option['info'] ); ?></p>
<?php endif; ?>
<?php foreach ( $option['values'] as $value => $label ) : ?>
<div class="webpcField">
<input type="checkbox"
name="<?php echo esc_attr( $option['name'] ); ?>[]"
value="<?php echo esc_attr( $value ); ?>"
id="<?php echo esc_attr( $option['name'] . '-' . $value ); ?>"
class="webpcField__input webpcField__input--checkbox"
<?php echo ( in_array( $value, $option['disabled'] ) ) ? 'disabled' : ''; ?>
<?php echo ( in_array( $value, $option['value'] ) ) ? 'checked' : ''; ?>
>
<label for="<?php echo esc_attr( $option['name'] . '-' . $value ); ?>"></label>
<span class="webpcField__label"><?php echo wp_kses_post( $label ); ?></span>
</div>
<?php endforeach; ?>

View File

@ -0,0 +1,61 @@
<?php
/**
* Field displayed in plugin settings form.
*
* @var mixed[] $option Data of field.
* @var string $index Index of field.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="webpcField">
<input type="checkbox"
name="<?php echo esc_attr( $option['name'] ); ?>[0]"
value="yes"
id="<?php echo esc_attr( $option['name'] ); ?>[0]"
class="webpcField__input webpcField__input--checkbox"
data-toggle-trigger="<?php echo esc_attr( $option['name'] ); ?>[0]"
<?php echo ( ( $option['value'][0] ?? '' ) === 'yes' ) ? 'checked' : ''; ?>
<?php echo ( in_array( 'yes', $option['disabled'] ) ) ? 'disabled' : ''; ?>
>
<label for="<?php echo esc_attr( $option['name'] ); ?>[0]"></label>
<span class="webpcField__label"><?php echo wp_kses_post( $option['info'] ); ?></span>
</div>
<div class="webpcField webpcField--center">
<span class="webpcField__label">
<?php echo esc_html( __( 'Max. width:', 'webp-converter-for-media' ) ); ?>
</span>
<div class="webpcInput">
<input type="number" min="0" step="1"
name="<?php echo esc_attr( $option['name'] ); ?>[1]"
value="<?php echo esc_attr( $option['value'][1] ?? '' ); ?>"
id="<?php echo esc_attr( $option['name'] ); ?>[1]"
class="webpcInput__field webpcInput__field--small"
data-toggle-output="<?php echo esc_attr( $option['name'] ); ?>[0]"
data-toggle-output-values="yes"
data-toggle-output-attr="readonly"
<?php echo ( in_array( 'yes', $option['disabled'] ) || ( $option['value'][0] ?? '' ) !== 'yes' ) ? 'readonly' : ''; ?>
>
</div>
<span class="webpcField__label">
<?php echo esc_html( __( 'Max. height:', 'webp-converter-for-media' ) ); ?>
</span>
<div class="webpcInput">
<input type="number" min="0" step="1"
name="<?php echo esc_attr( $option['name'] ); ?>[2]"
value="<?php echo esc_attr( $option['value'][2] ?? '' ); ?>"
id="<?php echo esc_attr( $option['name'] ); ?>[2]"
class="webpcInput__field webpcInput__field--small"
data-toggle-output="<?php echo esc_attr( $option['name'] ); ?>[0]"
data-toggle-output-values="yes"
data-toggle-output-attr="readonly"
<?php echo ( in_array( 'yes', $option['disabled'] ) || ( $option['value'][0] ?? '' ) !== 'yes' ) ? 'readonly' : ''; ?>
>
</div>
</div>

View File

@ -0,0 +1,27 @@
<?php
/**
* Field displayed in plugin settings form.
*
* @var mixed[] $option Data of field.
* @var string $index Index of field.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<?php if ( $option['info'] ) : ?>
<p><?php echo wp_kses_post( $option['info'] ); ?></p>
<?php endif; ?>
<div class="webpcInput">
<input type="text"
name="<?php echo esc_attr( $option['name'] ); ?>"
value="<?php echo esc_attr( $option['value'] ); ?>"
id="<?php echo esc_attr( $option['name'] ); ?>"
placeholder="<?php echo esc_attr( $option['placeholder'] ?: '' ); ?>"
class="webpcInput__field"
>
</div>

View File

@ -0,0 +1,71 @@
<?php
/**
* Field displayed in plugin settings form.
*
* @var mixed[] $option Data of field.
* @var string $index Index of field.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<?php if ( $option['info'] ) : ?>
<p><?php echo wp_kses_post( $option['info'] ); ?></p>
<?php endif; ?>
<div class="webpcQuality">
<div class="webpcQuality__items">
<?php foreach ( $option['values'] as $value => $label ) : ?>
<div class="webpcQuality__item">
<input type="radio"
name="<?php echo esc_attr( $option['name'] ); ?>"
value="<?php echo esc_attr( $value ); ?>"
id="webpc-<?php echo esc_attr( $index ); ?>-<?php echo esc_attr( $value ); ?>"
class="webpcQuality__itemInput"
<?php echo ( $value == $option['value'] ) ? 'checked' : ''; // phpcs:ignore ?>>
<label for="webpc-<?php echo esc_attr( $index ); ?>-<?php echo esc_attr( $value ); ?>"
class="webpcQuality__itemLabel"></label>
</div>
<?php endforeach; ?>
</div>
<div class="webpcQuality__texts">
<div class="webpcQuality__text">
<?php
echo wp_kses_post(
sprintf(
/* translators: %s: level name */
__( '%s - maximum reduction of image size with quality loss', 'webp-converter-for-media' ),
'<strong>' . __( 'Lossy', 'webp-converter-for-media' ) . '</strong>'
)
);
?>
</div>
<div class="webpcQuality__text"></div>
<div class="webpcQuality__text">
<?php
echo wp_kses_post(
sprintf(
/* translators: %s: level name */
__( '%s - reduction of image size without quality loss visible to the eye', 'webp-converter-for-media' ),
'<strong>' . __( 'Optimal', 'webp-converter-for-media' ) . '</strong>'
)
);
?>
</div>
<div class="webpcQuality__text"></div>
<div class="webpcQuality__text">
<?php
echo wp_kses_post(
sprintf(
/* translators: %s: level name */
__( '%s - minimal reduction of image size without quality loss', 'webp-converter-for-media' ),
'<strong>' . __( 'Lossless', 'webp-converter-for-media' ) . '</strong>'
)
);
?>
</div>
</div>
</div>

View File

@ -0,0 +1,32 @@
<?php
/**
* Field displayed in plugin settings form.
*
* @var mixed[] $option Data of field.
* @var string $index Index of field.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<?php if ( $option['info'] ) : ?>
<p><?php echo wp_kses_post( $option['info'] ); ?></p>
<?php endif; ?>
<?php foreach ( $option['values'] as $value => $label ) : ?>
<div class="webpcField">
<input type="radio"
name="<?php echo esc_attr( $option['name'] ); ?>"
value="<?php echo esc_attr( $value ); ?>"
id="<?php echo esc_attr( $option['name'] . '-' . $value ); ?>"
class="webpcField__input webpcField__input--radio"
<?php echo ( in_array( $value, $option['disabled'] ) ) ? 'disabled' : ''; ?>
<?php echo ( $value == $option['value'] ) ? 'checked' : ''; // phpcs:ignore ?>
>
<label for="<?php echo esc_attr( $option['name'] . '-' . $value ); ?>"></label>
<span class="webpcField__label"><?php echo wp_kses_post( $label ); ?></span>
</div>
<?php endforeach; ?>

View File

@ -0,0 +1,26 @@
<?php
/**
* Field displayed in plugin settings form.
*
* @var mixed[] $option Data of field.
* @var string $index Index of field.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="webpcField">
<input type="checkbox"
name="<?php echo esc_attr( $option['name'] ); ?>"
value="yes"
id="<?php echo esc_attr( $option['name'] ); ?>"
class="webpcField__input webpcField__input--toggle"
<?php echo ( ( $option['value'] === 'yes' ) ) ? 'checked' : ''; ?>
>
<label for="<?php echo esc_attr( $option['name'] ); ?>"></label>
<span class="webpcField__label"><?php echo wp_kses_post( $option['info'] ); ?></span>
</div>

View File

@ -0,0 +1,42 @@
<?php
/**
* Field displayed in plugin settings form.
*
* @var bool $token_valid_status Status of access token.
* @var bool $token_active_status Status of PRO version.
* @var mixed[] $option Data of field.
* @var string $index Index of field.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<?php if ( $option['info'] ) : ?>
<p><?php echo wp_kses_post( $option['info'] ); ?></p>
<?php endif; ?>
<div class="webpcInput">
<input type="text"
name="<?php echo esc_attr( ( $token_valid_status ) ? '' : $option['name'] ); ?>"
value="<?php echo esc_attr( ( $token_valid_status ) ? $option['value_public'] : $option['value'] ); ?>"
id="<?php echo esc_attr( $option['name'] ); ?>"
class="webpcInput__field"
<?php echo ( $token_valid_status ) ? 'readonly' : ''; ?>
>
</div>
<?php if ( ! $token_active_status ) : ?>
<p data-plans>
<strong><?php echo esc_html( __( 'Which plan would be the best choice for me?', 'webp-converter-for-media' ) ); ?></strong>
<br>
<a href="https://url.mattplugins.com/converter-field-access-token-plans?webp=0&avif=0" target="_blank"
data-plans-button hidden>
<?php echo esc_html( __( 'Check the plans for you', 'webp-converter-for-media' ) ); ?>
</a>
<span class="webpcContent__loader" data-plans-loader>
<?php echo esc_html( __( 'Loading, please wait', 'webp-converter-for-media' ) ); ?>
</span>
</p>
<?php endif; ?>

View File

@ -0,0 +1,50 @@
<?php
/**
* Notice displayed in admin panel.
*
* @var string $ajax_url URL of admin-ajax.
* @var string $close_action Action using in WP Ajax.
* @var string $service_name .
* @var string[] $steps Instructions to follow.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="notice notice-success is-dismissible"
data-notice="webp-converter-for-media"
data-notice-action="<?php echo esc_attr( $close_action ); ?>"
data-notice-url="<?php echo esc_url( $ajax_url ); ?>"
>
<div class="webpcContent webpcContent--notice">
<p>
<?php
echo esc_html(
sprintf(
/* translators: %1$s: service name */
__( 'You are using %1$s, right? Please, follow the steps below for the plugin to function properly:', 'webp-converter-for-media' ),
$service_name
)
);
?>
</p>
<ul>
<?php foreach ( $steps as $step_index => $step_message ) : ?>
<li>
<?php echo wp_kses_post( ( $step_index + 1 ) . '. ' . $step_message ); ?>
</li>
<?php endforeach; ?>
</ul>
<div class="webpcContent__buttons">
<button type="button" data-permanently
class="webpcContent__button webpcButton webpcButton--blue webpcButton--bg"
>
<?php echo esc_html( __( 'Done', 'webp-converter-for-media' ) ); ?>
</button>
</div>
</div>
</div>

View File

@ -0,0 +1,61 @@
<?php
/**
* Notice displayed in admin panel.
*
* @var string $ajax_url URL of admin-ajax.
* @var string $close_action Action using in WP Ajax.
* @var string $coupon_code .
* @var string $discount_value .
* @var string $button_url .
* @var string $promotion_date .
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="notice notice-success is-dismissible"
data-notice="webp-converter-for-media"
data-notice-action="<?php echo esc_attr( $close_action ); ?>"
data-notice-url="<?php echo esc_url( $ajax_url ); ?>"
>
<div class="webpcContent webpcContent--notice">
<h4>
<?php
echo esc_html(
sprintf(
/* translators: %1$s: discount value, %2$s: plugin name */
__( '%1$s discount on all PRO version plans of the %2$s plugin!', 'webp-converter-for-media' ),
$discount_value,
'Converter for Media'
)
);
?>
</h4>
<p>
<?php
echo wp_kses_post(
sprintf(
/* translators: %1$s: plugin name, %2$s: coupon code, %3$s: discount value, %4$s: date */
__( 'We have prepared a special offer for users of our %1$s plugin. Use the coupon code: %2$s when placing your order and get %3$s discount! This offer is valid until %4$s.', 'webp-converter-for-media' ),
'Converter for Media',
'<code>' . $coupon_code . '</code>',
$discount_value,
wp_date( get_option( 'date_format' ), strtotime( $promotion_date ) ?: 0 )
)
);
?>
</p>
<div class="webpcContent__buttons">
<a href="<?php echo esc_attr( $button_url ); ?>"
target="_blank"
class="webpcContent__button webpcButton webpcButton--blue webpcButton--bg"
>
<?php echo esc_html( __( 'Get it now', 'webp-converter-for-media' ) ); ?>
</a>
</div>
</div>
</div>

View File

@ -0,0 +1,54 @@
<?php
/**
* Notice displayed in admin panel.
*
* @var string $ajax_url URL of admin-ajax.
* @var string $close_action Action using in WP Ajax.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="notice notice-success is-dismissible"
data-notice="webp-converter-for-media"
data-notice-action="<?php echo esc_attr( $close_action ); ?>"
data-notice-url="<?php echo esc_url( $ajax_url ); ?>"
>
<div class="webpcContent webpcContent--notice">
<h4>
<?php
echo esc_html(
sprintf(
/* translators: %s: plugin name */
__( 'Thank you for using our %s plugin!', 'webp-converter-for-media' ),
'Converter for Media'
)
);
?>
</h4>
<p>
<?php
echo wp_kses_post(
__( 'We are glad that you are using our plugin and we hope you are satisfied with it. If you want, you can support us in the development of the plugin by adding a plugin review. This is very important and gives us the opportunity to create even better tools for you. Thank you!', 'webp-converter-for-media' )
);
?>
</p>
<div class="webpcContent__buttons">
<a href="https://url.mattplugins.com/converter-notice-thanks-button-review"
target="_blank"
class="webpcContent__button webpcButton webpcButton--blue webpcButton--bg"
>
<?php echo esc_html( __( 'Add a plugin review', 'webp-converter-for-media' ) ); ?>
</a>
<button type="button" data-permanently
class="webpcContent__button webpcButton webpcButton--gray webpcButton--bg"
>
<?php echo esc_html( __( 'Hide and do not show again', 'webp-converter-for-media' ) ); ?>
</button>
</div>
</div>
</div>

View File

@ -0,0 +1,49 @@
<?php
/**
* Notice displayed in admin panel.
*
* @var string $ajax_url URL of admin-ajax.
* @var string $close_action Action using in WP Ajax.
* @var string $settings_url URL of the plugin settings.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="notice notice-error is-dismissible"
data-notice="webp-converter-for-media"
data-notice-action="<?php echo esc_attr( $close_action ); ?>"
data-notice-url="<?php echo esc_url( $ajax_url ); ?>"
>
<div class="webpcContent webpcContent--notice">
<h4>
<?php
echo esc_html(
sprintf(
/* translators: %s: plugin name */
__( 'Check the status of the %s plugin!', 'webp-converter-for-media' ),
'Converter for Media'
)
);
?>
</h4>
<p>
<?php
echo wp_kses_post(
__( 'It appears that your subscription has expired or you have reached the maximum number of image conversions for your current billing period. To continue using the service, please, check your subscription status.', 'webp-converter-for-media' )
);
?>
</p>
<div class="webpcContent__buttons">
<a href="<?php echo esc_url( $settings_url ); ?>"
class="webpcContent__button webpcButton webpcButton--blue webpcButton--bg"
>
<?php echo esc_html( __( 'Go to the plugin settings', 'webp-converter-for-media' ) ); ?>
</a>
</div>
</div>
</div>

View File

@ -0,0 +1,66 @@
<?php
/**
* Notice displayed in admin panel.
*
* @var string $ajax_url URL of admin-ajax.
* @var string $close_action Action using in WP Ajax.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="notice notice-success is-dismissible"
data-notice="webp-converter-for-media"
data-notice-action="<?php echo esc_attr( $close_action ); ?>"
data-notice-url="<?php echo esc_url( $ajax_url ); ?>"
>
<div class="webpcContent webpcContent--notice">
<h4>
<?php
echo esc_html(
sprintf(
/* translators: %s: plugin name */
__( 'New opportunities in our %s plugin!', 'webp-converter-for-media' ),
'Converter for Media'
)
);
?>
</h4>
<p>
<?php
echo wp_kses_post(
__( 'Did you know that by using the PRO version of our plugin you can speed up your website even more? Find out now what you can gain.', 'webp-converter-for-media' )
);
?>
<?php
echo wp_kses_post(
sprintf(
/* translators: %1$s: open strong tag, %2$s: discount value, %3$s: close strong tag, %4$s: coupon code */
__( '%1$sOnly now you can get %2$s discount%3$s by using the coupon code: %4$s when placing your order.', 'webp-converter-for-media' ),
'<strong>',
'10%',
'</strong>',
'<code>10D4FD7814</code>'
)
);
?>
</p>
<div class="webpcContent__buttons">
<a href="https://url.mattplugins.com/converter-notice-upgrade-button-read"
target="_blank"
class="webpcContent__button webpcButton webpcButton--blue webpcButton--bg"
>
<?php echo esc_html( __( 'Explore the opportunities for yourself', 'webp-converter-for-media' ) ); ?>
</a>
<button type="button" data-permanently
class="webpcContent__button webpcButton webpcButton--gray webpcButton--bg"
>
<?php echo esc_html( __( 'Hide and do not show again', 'webp-converter-for-media' ) ); ?>
</button>
</div>
</div>
</div>

View File

@ -0,0 +1,60 @@
<?php
/**
* Notice displayed in admin panel.
*
* @var string $ajax_url URL of admin-ajax.
* @var string $close_action Action using in WP Ajax.
* @var string $settings_url URL of plugin settings page (default view).
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="notice notice-success is-dismissible"
data-notice="webp-converter-for-media"
data-notice-action="<?php echo esc_attr( $close_action ); ?>"
data-notice-url="<?php echo esc_url( $ajax_url ); ?>"
>
<div class="webpcContent webpcContent--notice">
<h4>
<?php
echo esc_html(
sprintf(
/* translators: %s: plugin name */
__( 'Thank you for installing our %s plugin!', 'webp-converter-for-media' ),
'Converter for Media'
)
);
?>
</h4>
<p>
<?php
echo wp_kses_post(
sprintf(
/* translators: %1$s: button label, %2$s: icon heart */
__( 'Optimize all your images by clicking the "%1$s" button in the plugin settings. It\'s that easy! %2$s', 'webp-converter-for-media' ),
__( 'Start Bulk Optimization', 'webp-converter-for-media' ),
'<span class="dashicons dashicons-heart"></span>'
)
);
?>
</p>
<div class="webpcContent__buttons">
<a href="<?php echo esc_url( $settings_url ); ?>"
class="webpcContent__button webpcButton webpcButton--blue webpcButton--bg"
>
<?php echo esc_html( __( 'Go to the plugin settings', 'webp-converter-for-media' ) ); ?>
</a>
<a href="https://url.mattplugins.com/converter-notice-welcome-button-video" target="_blank"
class="webpcContent__button webpcButton webpcButton--blue"
>
<?php echo esc_html( __( 'Meet the plugin', 'webp-converter-for-media' ) ); ?>
</a>
</div>
<img src="https://mattplugins.com/images/matt-plugins-logo.png" alt="">
</div>
</div>

View File

@ -0,0 +1,96 @@
<?php
/**
* Information about debugging displayed in server configuration widget.
*
* @var string[] $errors_codes List of server configuration errors.
* @var string $size_png_path Size of file.
* @var string $size_png2_path Size of file.
* @var string $size_png_url Size of file.
* @var string $size_png2_url Size of file.
* @var string $size_png_as_webp_url Size of file.
* @var string $size_png2_as_webp_url Size of file.
* @var mixed[] $plugin_settings Option keys with values.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use WebpConverter\Error\Notice\AccessTokenInvalidNotice;
use WebpConverter\Service\FileLoader;
use WebpConverter\Service\OptionsAccessManager;
use WebpConverter\Service\TokenValidator;
?>
<h4>Errors debug</h4>
<table>
<tbody>
<tr>
<td class="e">Size of PNG <em>(by server path)</em></td>
<td class="v">
<?php echo esc_html( $size_png_path ); ?>
</td>
</tr>
<tr>
<td class="e">Size of PNG2 <em>(by server path)</em></td>
<td class="v">
<?php echo esc_html( $size_png2_path ); ?>
</td>
</tr>
<tr>
<td class="e">Size of PNG as WEBP <em>(by URL)</em></td>
<td class="v">
<?php echo esc_html( $size_png_as_webp_url ); ?>
</td>
</tr>
<tr>
<td class="e">Size of PNG as PNG <em>(by URL)</em></td>
<td class="v">
<?php echo esc_html( $size_png_url ); ?>
</td>
</tr>
<tr>
<td class="e">Size of PNG2 as WEBP <em>(by URL)</em></td>
<td class="v">
<?php echo esc_html( $size_png2_as_webp_url ); ?>
</td>
</tr>
<tr>
<td class="e">Size of PNG2 as PNG2 <em>(by URL)</em></td>
<td class="v">
<?php echo esc_html( $size_png2_url ); ?>
</td>
</tr>
<tr>
<td class="e">Plugin settings</td>
<td class="v">
<?php echo esc_html( json_encode( $plugin_settings ) ?: '-' ); ?>
</td>
</tr>
<tr>
<td class="e">Error codes</td>
<td class="v">
<?php echo esc_html( json_encode( $errors_codes ) ?: '-' ); ?>
</td>
</tr>
<?php if ( in_array( AccessTokenInvalidNotice::ERROR_KEY, $errors_codes ) ) : ?>
<tr>
<td class="e">Token validation request</td>
<td class="v">
<?php echo esc_html( json_encode( OptionsAccessManager::get_option( TokenValidator::REQUEST_INFO_OPTION ) ) ?: '-' ); ?>
</td>
</tr>
<?php endif; ?>
</tbody>
<tr>
<td class="e">Error detection logs</td>
<td class="v">
<?php foreach ( $GLOBALS[ FileLoader::GLOBAL_LOGS_VARIABLE ] ?? [] as $log_data ) : ?>
<?php echo esc_html( json_encode( $log_data ) ?: '-' ); ?>
<br>
<?php endforeach; ?>
</td>
</tr>
</table>

View File

@ -0,0 +1,79 @@
<?php
/**
* Information about using filters displayed in server configuration widget.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use WebpConverter\Service\PathsGenerator;
?>
<h4>Filters</h4>
<table>
<tbody>
<tr>
<td class="e">webpc_site_url</td>
<td class="v">
<?php echo esc_html( apply_filters( 'webpc_site_url', ( defined( 'WP_HOME' ) ) ? WP_HOME : get_site_url() ) ); ?>
</td>
</tr>
<tr>
<td class="e">webpc_site_root</td>
<td class="v">
<?php echo esc_html( PathsGenerator::get_wordpress_root_path() ); ?>
</td>
</tr>
<tr>
<td class="e">webpc_dir_path <em>(plugins)</em></td>
<td class="v">
<?php echo esc_html( apply_filters( 'webpc_dir_path', '', 'plugins' ) ); ?>
</td>
</tr>
<tr>
<td class="e">webpc_dir_path <em>(themes)</em></td>
<td class="v">
<?php echo esc_html( apply_filters( 'webpc_dir_path', '', 'themes' ) ); ?>
</td>
</tr>
<tr>
<td class="e">webpc_dir_path <em>(uploads)</em></td>
<td class="v">
<?php echo esc_html( apply_filters( 'webpc_dir_path', '', 'uploads' ) ); ?>
</td>
</tr>
<tr>
<td class="e">webpc_dir_path <em>(webp)</em></td>
<td class="v">
<?php echo esc_html( apply_filters( 'webpc_dir_path', '', 'webp' ) ); ?>
</td>
</tr>
<tr>
<td class="e">webpc_source_directories</td>
<td class="v">
<?php echo esc_html( json_encode( apply_filters( 'webpc_source_directories', [] ) ) ?: '-' ); ?>
</td>
</tr>
<tr>
<td class="e">webpc_htaccess_rewrite_root</td>
<td class="v">
<?php echo esc_html( PathsGenerator::get_rewrite_root() ); ?>
</td>
</tr>
<tr>
<td class="e">webpc_htaccess_rewrite_path</td>
<td class="v">
<?php echo esc_html( PathsGenerator::get_rewrite_path() ); ?>
</td>
</tr>
<tr>
<td class="e">webpc_htaccess_rewrite_output</td>
<td class="v">
<?php echo esc_html( apply_filters( 'webpc_htaccess_rewrite_output', PathsGenerator::get_rewrite_path(), PathsGenerator::get_rewrite_root() ) ); ?>
</td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,18 @@
<?php
/**
* Information about GD library displayed in server configuration widget.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<h4>gd</h4>
<?php if ( ! extension_loaded( 'gd' ) ) : ?>
<p>-</p>
<?php else : ?>
<?php ( new \ReflectionExtension( 'gd' ) )->info(); ?>
<?php endif; ?>

View File

@ -0,0 +1,18 @@
<?php
/**
* Information about Imagick library displayed in server configuration widget.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<h4>imagick</h4>
<?php if ( ! extension_loaded( 'imagick' ) ) : ?>
<p>-</p>
<?php else : ?>
<?php ( new \ReflectionExtension( 'imagick' ) )->info(); ?>
<?php endif; ?>

View File

@ -0,0 +1,122 @@
<?php
/**
* Information about plugin options displayed in server configuration widget.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use WebpConverter\Conversion\Cron\CronStatusManager;
use WebpConverter\Notice\CloudflareNotice;
use WebpConverter\Notice\ThanksNotice;
use WebpConverter\Notice\UpgradeNotice;
use WebpConverter\Notice\WelcomeNotice;
use WebpConverter\Service\CloudflareConfigurator;
use WebpConverter\Service\OptionsAccessManager;
use WebpConverter\Service\StatsManager;
?>
<h4>Options</h4>
<table>
<tbody>
<tr>
<td class="e"><?php echo esc_html( WelcomeNotice::NOTICE_OPTION ); ?></td>
<td class="v">
<?php echo esc_html( OptionsAccessManager::get_option( WelcomeNotice::NOTICE_OPTION, '-' ) ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( ThanksNotice::NOTICE_OPTION ); ?></td>
<td class="v">
<?php echo esc_html( OptionsAccessManager::get_option( ThanksNotice::NOTICE_OPTION, '-' ) ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( CloudflareNotice::NOTICE_OPTION ); ?></td>
<td class="v">
<?php echo esc_html( OptionsAccessManager::get_option( CloudflareNotice::NOTICE_OPTION, '-' ) ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( UpgradeNotice::NOTICE_OPTION ); ?></td>
<td class="v">
<?php echo esc_html( OptionsAccessManager::get_option( UpgradeNotice::NOTICE_OPTION, '-' ) ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( CronStatusManager::CRON_PATHS_TRANSIENT ); ?></td>
<td class="v">
<?php echo count( get_site_transient( CronStatusManager::CRON_PATHS_TRANSIENT ) ?: [] ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( CronStatusManager::CRON_PATHS_SKIPPED_TRANSIENT ); ?></td>
<td class="v">
<?php echo esc_html( get_site_transient( CronStatusManager::CRON_PATHS_SKIPPED_TRANSIENT ) ?: '-' ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( CronStatusManager::CRON_STATUS_LOCKED_TRANSIENT ); ?></td>
<td class="v">
<?php echo esc_html( get_site_transient( CronStatusManager::CRON_STATUS_LOCKED_TRANSIENT ) ?: '-' ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( CronStatusManager::CRON_REQUEST_ID_TRANSIENT ); ?></td>
<td class="v">
<?php echo esc_html( get_site_transient( CronStatusManager::CRON_REQUEST_ID_TRANSIENT ) ?: '-' ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( CronStatusManager::CRON_REQUEST_RESPONSE_TRANSIENT ); ?></td>
<td class="v">
<?php echo esc_html( json_encode( get_site_transient( CronStatusManager::CRON_REQUEST_RESPONSE_TRANSIENT ) ) ?: '' ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( CloudflareConfigurator::REQUEST_CACHE_CONFIG_OPTION ); ?></td>
<td class="v">
<?php echo esc_html( OptionsAccessManager::get_option( CloudflareConfigurator::REQUEST_CACHE_CONFIG_OPTION, '-' ) ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( CloudflareConfigurator::REQUEST_CACHE_PURGE_OPTION ); ?></td>
<td class="v">
<?php echo esc_html( OptionsAccessManager::get_option( CloudflareConfigurator::REQUEST_CACHE_PURGE_OPTION, '-' ) ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( StatsManager::STATS_REGENERATION_IMAGES_OPTION ); ?></td>
<td class="v">
<?php echo esc_html( OptionsAccessManager::get_option( StatsManager::STATS_REGENERATION_IMAGES_OPTION, '-' ) ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( StatsManager::STATS_IMAGES_WEBP_ALL_OPTION ); ?></td>
<td class="v">
<?php echo esc_html( OptionsAccessManager::get_option( StatsManager::STATS_IMAGES_WEBP_ALL_OPTION, '-' ) ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( StatsManager::STATS_IMAGES_WEBP_UNCONVERTED_OPTION ); ?></td>
<td class="v">
<?php echo esc_html( OptionsAccessManager::get_option( StatsManager::STATS_IMAGES_WEBP_UNCONVERTED_OPTION, '-' ) ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( StatsManager::STATS_IMAGES_AVIF_ALL_OPTION ); ?></td>
<td class="v">
<?php echo esc_html( OptionsAccessManager::get_option( StatsManager::STATS_IMAGES_AVIF_ALL_OPTION, '-' ) ); ?>
</td>
</tr>
<tr>
<td class="e"><?php echo esc_html( StatsManager::STATS_IMAGES_AVIF_UNCONVERTED_OPTION ); ?></td>
<td class="v">
<?php echo esc_html( OptionsAccessManager::get_option( StatsManager::STATS_IMAGES_AVIF_UNCONVERTED_OPTION, '-' ) ); ?>
</td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,47 @@
<?php
/**
* Information about PHP configuration displayed in server configuration widget.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<h4>PHP</h4>
<table>
<tbody>
<tr>
<td class="e">Version</td>
<td class="v">
<?php echo esc_html( phpversion() ?: '-' ); ?>
</td>
</tr>
<tr>
<td class="e">memory_limit</td>
<td class="v">
<?php echo esc_html( ini_get( 'memory_limit' ) ?: '-' ); ?>
</td>
</tr>
<tr>
<td class="e">max_execution_time</td>
<td class="v">
<?php echo esc_html( ini_get( 'max_execution_time' ) ?: '-' ); ?>
</td>
</tr>
<tr>
<td class="e">disable_functions</td>
<td class="v">
<?php echo esc_html( ini_get( 'disable_functions' ) ?: '-' ); ?>
</td>
</tr>
<tr>
<td class="e">SERVER_SOFTWARE</td>
<td class="v">
<?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ?? '-' ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput ?>
</td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,34 @@
<?php
/**
* Information about registered image sub-sizes.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$image_sizes = ( function_exists( 'wp_get_registered_image_subsizes' ) )
? wp_get_registered_image_subsizes()
: wp_get_additional_image_sizes();
?>
<h4>
<?php
echo esc_html(
__( 'Registered image sub-sizes for generating images in additional sizes by WordPress', 'webp-converter-for-media' )
);
?>
</h4>
<table>
<tbody>
<?php foreach ( $image_sizes as $size_name => $size_data ) : ?>
<tr>
<td class="e"><?php echo esc_html( $size_name ); ?></td>
<td class="v">
<?php echo esc_html( json_encode( $size_data ) ?: '-' ); ?>
</td>
</tr>
<?php endforeach; ?>
</table>

View File

@ -0,0 +1,65 @@
<?php
/**
* Information about WordPress config displayed in server configuration widget.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<h4>WordPress</h4>
<table>
<tbody>
<tr>
<td class="e">ABSPATH</td>
<td class="v">
<?php echo esc_html( ABSPATH ); ?>
</td>
</tr>
<tr>
<td class="e">DOCUMENT_ROOT</td>
<td class="v">
<?php echo esc_html( $_SERVER['DOCUMENT_ROOT'] ?? '-' ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput ?>
</td>
</tr>
<tr>
<td class="e">DOCUMENT_ROOT <em>(realpath)</em></td>
<td class="v">
<?php echo esc_html( realpath( $_SERVER['DOCUMENT_ROOT'] ?? '-' ) ?: '' ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput ?>
</td>
</tr>
<tr>
<td class="e">WP_CONTENT_DIR</td>
<td class="v">
<?php echo esc_html( WP_CONTENT_DIR ); ?>
</td>
</tr>
<tr>
<td class="e">UPLOADS</td>
<td class="v">
<?php echo esc_html( defined( 'UPLOADS' ) ? UPLOADS : '-' ); ?>
</td>
</tr>
<tr>
<td class="e">wp_upload_dir <em>(basedir)</em></td>
<td class="v">
<?php echo esc_html( wp_upload_dir()['basedir'] ); ?>
</td>
</tr>
<tr>
<td class="e">home_url</td>
<td class="v">
<?php echo esc_html( get_home_url() ); ?>
</td>
</tr>
<tr>
<td class="e">site_url</td>
<td class="v">
<?php echo esc_html( get_site_url() ); ?>
</td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,41 @@
<?php
/**
* Widget displayed on plugin settings page.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="webpcPage__widget">
<h3 class="webpcPage__widgetTitle">
<?php echo esc_html( __( 'How does the plugin work?', 'webp-converter-for-media' ) ); ?>
</h3>
<div class="webpcContent">
<p>
<?php
echo wp_kses_post(
__( 'When a browser tries to download an image file, the plugin checks if it supports the AVIF format (if enabled in the plugin settings). If so, the browser will receive the equivalent of the original image in the AVIF format. If it does not support AVIF, but supports the WebP format, the browser will receive the equivalent of the original image in WebP format. In case the browser does not support either WebP or AVIF, the original image is loaded. This means full support for all browsers.', 'webp-converter-for-media' )
);
?>
</p>
<p>
<?php
echo wp_kses_post(
__( 'The plugin in default loading mode (via .htaccess) does not change file URLs, so there are no problems with saving the page to the cache and the page generation time does not increase.', 'webp-converter-for-media' )
);
?>
</p>
<p class="center">
<a href="https://url.mattplugins.com/converter-widget-about-button-instruction"
target="_blank"
class="webpcButton webpcButton--blue"
>
<?php echo esc_html( __( 'Find out more', 'webp-converter-for-media' ) ); ?>
</a>
</p>
</div>
</div>

View File

@ -0,0 +1,46 @@
<?php
/**
* Widget displayed on plugin settings page.
*
* @var string[][] $errors_messages Arrays with array of paragraphs.
* @var string[] $errors_codes List of server configuration errors.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<?php if ( $errors_messages ) : ?>
<div class="webpcPage__widget" id="server-error-notice">
<h3 class="webpcPage__widgetTitle webpcPage__widgetTitle--error">
<?php echo esc_html( __( 'Server configuration error', 'webp-converter-for-media' ) ); ?>
</h3>
<div class="webpcContent webpcContent--wide webpcContent--quotes">
<?php foreach ( $errors_messages as $error_index => $error_lines ) : ?>
<?php if ( $error_index > 0 ) : ?>
<p>---</p>
<?php endif; ?>
<?php foreach ( $error_lines as $error_line ) : ?>
<p><?php echo wp_kses_post( $error_line ); ?></p>
<?php endforeach; ?>
<?php endforeach; ?>
<p>---</p>
<p>
<?php
echo wp_kses_post(
sprintf(
/* translators: %1$s: open strong tag, %2$s: close strong tag, %3$s: errors codes */
__( '%1$sError codes:%2$s %3$s', 'webp-converter-for-media' ),
'<strong>',
'</strong>',
implode( ', ', $errors_codes )
)
);
?>
</p>
</div>
</div>
<?php endif; ?>

View File

@ -0,0 +1,30 @@
<?php
/**
* Widget displayed on plugin settings page.
*
* @var mixed[][] $menu_items Tabs on plugin settings page.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="webpcMenu">
<div class="webpcMenu__wrapper">
<div class="webpcMenu__items">
<?php foreach ( $menu_items as $menu_item ) : ?>
<?php if ( $menu_item['url'] !== null ) : ?>
<div class="webpcMenu__item">
<a href="<?php echo esc_attr( $menu_item['url'] ); ?>"
class="webpcMenu__itemLink <?php echo ( $menu_item['is_active'] ) ? 'webpcMenu__itemLink--active' : ''; ?>">
<?php echo esc_attr( $menu_item['title'] ); ?>
</a>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
</div>

View File

@ -0,0 +1,62 @@
<?php
/**
* Widget displayed in sidebar on plugin settings page.
*
* @var mixed[] $form_sidebar_options Settings options in sidebar.
* @var string $form_input_name Name of hidden field with form ID.
* @var string $form_sidebar_input_value ID of settings form.
* @var string $nonce_input_name Name of hidden field with WordPress Nonce value.
* @var string $nonce_input_value WordPress Nonce value.
* @var bool $token_valid_status Status of PRO version.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="webpcPage__widget webpcPage__widget--border">
<h3 class="webpcPage__widgetTitle webpcPage__widgetTitle--logo">
<?php echo esc_html( __( 'PRO version', 'webp-converter-for-media' ) ); ?>
</h3>
<form method="post" action="" class="webpcContent">
<input type="hidden" name="<?php echo esc_attr( $form_input_name ); ?>"
value="<?php echo esc_attr( $form_sidebar_input_value ); ?>">
<input type="hidden" name="<?php echo esc_attr( $nonce_input_name ); ?>"
value="<?php echo esc_attr( $nonce_input_value ); ?>">
<?php foreach ( $form_sidebar_options as $index => $option ) : ?>
<div class="webpcPage__widgetRow">
<ul class="webpcPage__widgetColumns">
<li class="webpcPage__widgetColumn">
<?php if ( $option['label'] ) : ?>
<h4><?php echo esc_html( $option['label'] ); ?></h4>
<?php endif; ?>
<?php include dirname( __DIR__ ) . '/fields/' . $option['type'] . '.php'; ?>
</li>
<?php if ( $option['notice_lines'] ) : ?>
<li class="webpcPage__widgetColumn">
<div class="webpcPage__widgetNotice">
<?php foreach ( $option['notice_lines'] as $line ) : ?>
<p><?php echo wp_kses_post( $line ); ?></p>
<?php endforeach; ?>
</div>
</li>
<?php endif; ?>
</ul>
</div>
<?php endforeach; ?>
<div class="webpcPage__widgetRow">
<?php if ( ! $token_valid_status ) : ?>
<button type="submit" class="webpcButton webpcButton--blue webpcButton--bg">
<?php echo esc_html( __( 'Activate Token', 'webp-converter-for-media' ) ); ?>
</button>
<?php else : ?>
<button type="submit" class="webpcButton webpcButton--red">
<?php echo esc_html( __( 'Deactivate Token', 'webp-converter-for-media' ) ); ?>
</button>
<?php endif; ?>
</div>
</form>
</div>

View File

@ -0,0 +1,54 @@
<?php
/**
* Widget displayed in main container on plugin settings page.
*
* @var mixed[] $form_options Settings options in main container.
* @var string $form_input_name Name of hidden field with form ID.
* @var string $form_input_value ID of settings form in main container.
* @var string $nonce_input_name Name of hidden field with WordPress Nonce value.
* @var string $nonce_input_value WordPress Nonce value.
* @var bool $token_valid_status Status of access token.
* @var bool $token_active_status Status of PRO version.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="webpcPage__widget">
<form method="post" action="" class="webpcContent">
<input type="hidden" name="<?php echo esc_attr( $form_input_name ); ?>"
value="<?php echo esc_attr( $form_input_value ); ?>">
<input type="hidden" name="<?php echo esc_attr( $nonce_input_name ); ?>"
value="<?php echo esc_attr( $nonce_input_value ); ?>">
<?php foreach ( $form_options as $index => $option ) : ?>
<div class="webpcPage__widgetRow webpcPage__widgetRow--option <?php echo ( ! $option['label'] ) ? 'webpcPage__widgetRow--noBorder' : ''; ?>">
<ul class="webpcPage__widgetColumns">
<li class="webpcPage__widgetColumn">
<?php if ( $option['label'] ) : ?>
<h4><?php echo esc_html( $option['label'] ); ?></h4>
<?php endif; ?>
<?php include dirname( __DIR__ ) . '/fields/' . $option['type'] . '.php'; ?>
</li>
<?php if ( $option['notice_lines'] ) : ?>
<li class="webpcPage__widgetColumn">
<div class="webpcPage__widgetNotice">
<?php foreach ( $option['notice_lines'] as $line ) : ?>
<p><?php echo wp_kses_post( $line ); ?></p>
<?php endforeach; ?>
</div>
</li>
<?php endif; ?>
</ul>
</div>
<?php endforeach; ?>
<div class="webpcPage__widgetRow">
<button type="submit" class="webpcButton webpcButton--blue webpcButton--bg">
<?php echo esc_html( __( 'Save Changes', 'webp-converter-for-media' ) ); ?>
</button>
</div>
</form>
</div>

View File

@ -0,0 +1,53 @@
<?php
/**
* Pop-up displayed on plugin settings page.
*
* @var string $author_image_url Avatar of plugin author.
* @var bool $token_active_status Status of PRO version.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<?php if ( ! $token_active_status ) : ?>
<div class="webpcPopup" hidden data-popup="regeneration">
<div class="webpcPopup__wrapper">
<div class="webpcPopup__inner" data-popup-content>
<button type="button" class="webpcPopup__close dashicons dashicons-no"
data-popup-close></button>
<div class="webpcPopup__sidebar">
<div class="webpcPopup__sidebarInner">
<img src="<?php echo esc_attr( $author_image_url ); ?>" alt="" class="webpcPopup__sidebarImage">
<div class="webpcPopup__sidebarCover" style="background-image: url(https://mattplugins.com/images/matt-plugins-author-logo.png);"></div>
</div>
</div>
<div class="webpcPopup__content">
<div class="webpcPopup__contentText">
<?php
echo esc_html(
sprintf(
/* translators: %1$s: author name, %2$s: format name, %3$s: percent value, %4$s: format name */
__( 'Hi - I am %1$s, the author of this plugin. Did you know that by converting your images to the %2$s format as well, you can reduce the weight of your images by an additional about %3$s compared to using only the %4$s format?', 'webp-converter-for-media' ),
'Mateusz',
'AVIF',
'50%',
'WebP'
)
);
?>
</div>
<div class="webpcPopup__contentButton">
<a href="https://url.mattplugins.com/converter-regeneration-popup-avif" target="_blank"
class="webpcButton webpcButton--blue webpcButton--bg">
<?php echo esc_html( __( 'Explore the opportunities for yourself', 'webp-converter-for-media' ) ); ?>
</a>
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>

View File

@ -0,0 +1,233 @@
<?php
/**
* Widget displayed on plugin settings page.
*
* @var string $api_paths_url URL of REST API endpoint.
* @var string $api_paths_nonce Authorization code of REST API endpoint.
* @var string $api_regenerate_url URL of REST API endpoint.
* @var string $api_regenerate_nonce Authorization code of REST API endpoint.
* @var string[][] $output_formats Data about output formats for regeneration.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="webpcPage__widget">
<h3 class="webpcPage__widgetTitle">
<?php echo esc_html( __( 'Bulk Optimization of Images', 'webp-converter-for-media' ) ); ?>
</h3>
<div class="webpcLoader webpcContent"
data-api-paths="<?php echo esc_url( $api_paths_url ); ?>|<?php echo esc_attr( $api_paths_nonce ); ?>"
data-api-regenerate="<?php echo esc_url( $api_regenerate_url ); ?>|<?php echo esc_attr( $api_regenerate_nonce ); ?>"
data-api-error-message="<?php echo esc_html( __( 'An error occurred while connecting to the REST API. Please, try again.', 'webp-converter-for-media' ) ); ?>"
>
<div class="webpcPage__widgetRow">
<p>
<?php
echo wp_kses_post( __( 'Optimize all your images with just one click!', 'webp-converter-for-media' ) );
echo ' ';
echo wp_kses_post(
sprintf(
/* translators: %1$s: open anchor tag, %2$s: close anchor tag */
__( '%1$sClick here%2$s to learn more about how our plugin works.', 'webp-converter-for-media' ),
'<a href="https://url.mattplugins.com/converter-regeneration-widget-tutorial-link" target="_blank">',
'</a>'
)
);
?>
</p>
</div>
<div class="webpcPage__widgetRow">
<div class="webpcTree">
<p class="webpcTree__headline">
<span class="webpcTree__headlineTitle">
<?php echo wp_kses_post( __( 'The list of files that can be optimized:', 'webp-converter-for-media' ) ); ?>
</span>
<a href="#" class="webpcTree__headlineButton" data-tree-toggle-button hidden>
<?php echo esc_attr( __( 'Expand/collapse all', 'webp-converter-for-media' ) ); ?>
</a>
</p>
<div class="webpcTree__output"
data-tree
data-tree-files-count="<?php /* translators: %s: files count */ echo esc_attr( __( '+%s other files', 'webp-converter-for-media' ) ); ?>"
data-tree-input-tooltip="<?php echo esc_attr( __( 'Click to expand/collapse', 'webp-converter-for-media' ) ); ?>">
<p class="webpcContent__loader" data-tree-loader>
<?php echo wp_kses_post( sprintf( __( 'Loading, please wait', 'webp-converter-for-media' ) ) ); ?>
</p>
<div class="webpcTree__error" data-api-stats-error hidden></div>
</div>
</div>
</div>
<div class="webpcPage__widgetRow">
<div class="webpcPage__widgetNotice">
<p>
<?php
echo wp_kses_post(
sprintf(
/* translators: %1$s: open strong tag, %2$s: close strong tag */
__( 'Converting images to WebP and AVIF simultaneously guarantees the lowest weight of your images and compatibility with all browsers. By using the AVIF format you will reduce the weight of your images even more compared to WebP.', 'webp-converter-for-media' ),
'<strong>',
'</strong>'
)
);
?>
</p>
</div>
</div>
<div class="webpcPage__widgetRow">
<div class="webpcLoader__columns">
<?php foreach ( $output_formats as $format_key => $format_data ) : ?>
<div class="webpcLoader__column"
data-counter="<?php echo esc_attr( $format_key ); ?>">
<div class="webpcLoader__columnInner">
<svg class="webpcLoader__columnCircle" viewBox="0 0 200 200"
preserveAspectRatio="xMinYMin meet">
<g>
<circle cx="50%" cy="50%" r="95" />
</g>
</svg>
<div class="webpcLoader__columnOverlay">
<div class="webpcLoader__columnOverlayTitle">
<?php
echo sprintf(
/* translators: %1$s: percent value, %2$s: output format */
esc_html( __( '%1$s converted to %2$s', 'webp-converter-for-media' ) ),
'<strong><span data-counter-percent>0</span>%</strong>',
esc_html( $format_data['label'] )
);
?>
</div>
<div class="webpcLoader__columnOverlayDesc webpcLoader__columnOverlayDesc--active">
<?php
echo sprintf(
/* translators: %s: images count */
esc_html( __( '%s images remaining', 'webp-converter-for-media' ) ),
'<span data-counter-left>0</span>'
);
?>
</div>
<div class="webpcLoader__columnOverlayDesc webpcLoader__columnOverlayDesc--loading"
data-counter-loader>
<?php
echo sprintf(
/* translators: %s: break line tag */
esc_html( __( 'Calculating, %splease wait', 'webp-converter-for-media' ) ),
'<br>'
);
?>
</div>
</div>
</div>
<?php if ( $format_data['desc'] ) : ?>
<div class="webpcLoader__columnDesc">
<?php echo wp_kses_post( $format_data['desc'] ); ?>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
</div>
<?php if ( ! apply_filters( 'webpc_server_errors', [], true ) ) : ?>
<div class="webpcPage__widgetRow">
<div class="webpcField">
<input type="checkbox"
name="regenerate_force"
value="1"
id="webpc-regenerate-force"
class="webpcField__input webpcField__input--toggle">
<label for="webpc-regenerate-force"></label>
<span class="webpcField__label">
<?php echo esc_html( __( 'Force the conversion of all images again', 'webp-converter-for-media' ) ); ?>
<span class="webpcField__labelChecked">
<?php echo esc_html( __( 'If you want to optimize only unconverted images, leave this option unchecked. Use only when needed.', 'webp-converter-for-media' ) ); ?>
</span>
</span>
</div>
<button type="button" class="webpcLoader__button webpcButton webpcButton--blue webpcButton--bg" data-submit>
<?php echo esc_html( __( 'Start Bulk Optimization', 'webp-converter-for-media' ) ); ?>
</button>
<div class="webpcLoader__status" data-status hidden>
<div class="webpcLoader__statusContent webpcLoader__statusContent--small">
<?php echo wp_kses_post( __( 'This is a process that can take from a few minutes to many hours, depending on the number of files. During this process, please, do not close your browser window.', 'webp-converter-for-media' ) ); ?>
</div>
<div class="webpcLoader__statusProgress" data-status-progress data-percent="0">
<div class="webpcLoader__statusProgressCount"></div>
</div>
<div class="webpcLoader__statusContent">
<?php
echo sprintf(
/* translators: %s progress value */
wp_kses_post( __( 'Saving the weight of your images: %s', 'webp-converter-for-media' ) ),
'<strong data-status-count-size>0 kB</strong>'
);
?>
<br>
<?php
echo sprintf(
/* translators: %s images count */
wp_kses_post( __( 'Successfully converted files: %s', 'webp-converter-for-media' ) ),
'<strong data-status-count-success>0</strong>'
);
?>
<br>
<?php
echo sprintf(
/* translators: %s images count */
wp_kses_post( __( 'Failed or skipped file conversion attempts: %s', 'webp-converter-for-media' ) ),
'<strong data-status-count-error>0</strong>'
);
?>
</div>
</div>
<div class="webpcLoader__success" data-success hidden>
<div class="webpcLoader__successInner">
<div class="webpcLoader__successContent">
<?php echo wp_kses_post( __( 'The process was completed successfully. Your images have been converted!', 'webp-converter-for-media' ) ); ?>
<br>
<?php
echo wp_kses_post(
sprintf(
/* translators: %1$s: open anchor tag, %2$s: close anchor tag */
__( 'Do you want to know how the plugin works and how to check if it is working properly? Please, read %1$sour manual%2$s.', 'webp-converter-for-media' ),
'<a href="https://url.mattplugins.com/converter-regeneration-success-message-instruction" target="_blank">',
'</a>'
)
);
?>
</div>
</div>
</div>
<div class="webpcLoader__errors" data-errors hidden>
<div class="webpcLoader__errorsInner">
<div class="webpcLoader__errorsTitle">
<?php echo esc_html( __( 'Additional information about the process:', 'webp-converter-for-media' ) ); ?>
</div>
<div class="webpcLoader__errorsContent" data-errors-output></div>
</div>
</div>
</div>
<?php else : ?>
<div class="webpcPage__widgetRow">
<button type="button" class="webpcLoader__button webpcButton webpcButton--blue webpcButton--bg" disabled>
<?php echo esc_html( __( 'Start Bulk Optimization', 'webp-converter-for-media' ) ); ?>
</button>
<p>
<?php
echo wp_kses_post(
sprintf(
/* translators: %1$s: open anchor tag, %2$s: close anchor tag */
__( 'To start the process, please %1$sresolve the server configuration issue%2$s.', 'webp-converter-for-media' ),
'<a href="#server-error-notice">',
'</a>'
)
);
?>
</p>
</div>
<?php endif; ?>
</div>
</div>

View File

@ -0,0 +1,64 @@
<?php
/**
* Widget displayed on plugin settings page.
*
* @var string[] $errors_codes List of server configuration errors.
* @var string $size_png_path Size of file.
* @var string $size_png2_path Size of file.
* @var string $size_png_url Size of file.
* @var string $size_png2_url Size of file.
* @var string $size_png_as_webp_url Size of file.
* @var string $size_png2_as_webp_url Size of file.
* @var mixed[] $plugin_settings Option keys with values.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="webpcPage__widget">
<div class="webpcContent">
<div class="webpcPage__widgetRow">
<p>
<?php
echo wp_kses_post(
sprintf(
/* translators: %1$s: open anchor tag, %2$s: close anchor tag, %3$s: open anchor tag, %4$s: close anchor tag */
__( 'Please, %1$scheck our FAQ%2$s before adding a thread with a technical problem. If you do not find help there, %3$scheck the support forum%4$s for similar problems. If you do not find a solution, please, %5$scontact us%6$s.', 'webp-converter-for-media' ),
'<a href="https://url.mattplugins.com/converter-tab-server-message-faq" target="_blank">',
'</a>',
'<a href="https://url.mattplugins.com/converter-tab-server-message-support" target="_blank">',
'</a>',
'<a href="https://url.mattplugins.com/converter-tab-server-message-contact" target="_blank">',
'</a>'
)
);
?>
</p>
<p>
<?php
echo wp_kses_post(
__( 'Please attach to your message the configuration of your server (which is available below), e.g. as a screenshot.', 'webp-converter-for-media' )
);
?>
</p>
</div>
<div class="webpcPage__widgetRow">
<div class="webpcServerInfo">
<?php
require_once dirname( __DIR__ ) . '/server/debug.php';
require_once dirname( __DIR__ ) . '/server/filters.php';
require_once dirname( __DIR__ ) . '/server/wordpress.php';
require_once dirname( __DIR__ ) . '/server/sub-sizes.php';
require_once dirname( __DIR__ ) . '/server/options.php';
require_once dirname( __DIR__ ) . '/server/php.php';
require_once dirname( __DIR__ ) . '/server/gd.php';
require_once dirname( __DIR__ ) . '/server/imagick.php';
?>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,35 @@
<?php
/**
* Widget displayed on plugin settings page.
*
* @var string $url_debug_page URL of debug tag in settings page.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="webpcPage__widget">
<h3 class="webpcPage__widgetTitle">
<?php echo esc_html( __( 'We are waiting for your message', 'webp-converter-for-media' ) ); ?>
</h3>
<div class="webpcContent">
<p>
<?php
echo esc_html(
__( 'Do you have any technical problems or an idea for a new feature? Feel free to contact us.', 'webp-converter-for-media' )
);
?>
</p>
<p class="center">
<a href="<?php echo esc_attr( $url_debug_page ); ?>"
class="webpcButton webpcButton--blue"
>
<?php echo esc_html( __( 'Help Center', 'webp-converter-for-media' ) ); ?>
</a>
</p>
</div>
</div>

View File

@ -0,0 +1,67 @@
<?php
/**
* Debug tab of plugin settings page.
*
* @var string $logo_url Plugin logo.
* @var string[][] $menu_items Tabs on plugin settings page.
* @var string[][] $errors_messages Arrays with array of paragraphs.
* @var string[] $errors_codes List of server configuration errors.
* @var string $size_png_path Size of file.
* @var string $size_png2_path Size of file.
* @var string $size_png_url Size of file.
* @var string $size_png2_url Size of file.
* @var string $size_png_as_webp_url Size of file.
* @var string $size_png2_as_webp_url Size of file.
* @var mixed[] $plugin_settings Option keys with values.
* @var string $url_debug_page URL of debug tag in settings page.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="wrap">
<hr class="wp-header-end">
<div class="webpcPage">
<div class="webpcPage__headline">
<img src="<?php echo esc_attr( $logo_url ); ?>" alt="<?php echo esc_attr( 'Converter for Media' ); ?>">
</div>
<div class="webpcPage__inner">
<ul class="webpcPage__columns">
<li class="webpcPage__column webpcPage__column--large">
<?php
require_once dirname( __DIR__ ) . '/components/widgets/errors.php';
require_once dirname( __DIR__ ) . '/components/widgets/menu.php';
require_once dirname( __DIR__ ) . '/components/widgets/server.php';
?>
</li>
<li class="webpcPage__column webpcPage__column--small">
<?php
require_once dirname( __DIR__ ) . '/components/widgets/about.php';
?>
</li>
</ul>
</div>
<div class="webpcPage__footer">
<div class="webpcPage__footerLogo"></div>
<div class="webpcPage__footerContent">
<?php
echo wp_kses_post(
sprintf(
/* translators: %1$s: icon heart, %2$s: author name, %3$s: open anchor tag, %4$s: stars icons, %5$s: close anchor tag */
__( 'Created with %1$s by %2$s - if you like our plugin, please, %3$srate one%4$s%5$s', 'webp-converter-for-media' ),
'<span class="webpcPage__footerIcon webpcPage__footerIcon--heart"></span>',
'<a href="https://url.mattplugins.com/converter-settings-footer-author-website" target="_blank">matt plugins</a>',
'<a href="https://url.mattplugins.com/converter-settings-footer-plugin-review" target="_blank">',
' <span class="webpcPage__footerIcon webpcPage__footerIcon--stars"></span>',
'</a>'
)
);
?>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,98 @@
<?php
/**
* Main tab of plugin settings page.
*
* @var string $logo_url Plugin logo.
* @var string $author_image_url Avatar of plugin author.
* @var string[][] $menu_items Tabs on plugin settings page.
* @var string[][] $errors_messages Arrays with array of paragraphs.
* @var string[] $errors_codes List of server configuration errors.
* @var mixed[]|null $form_options Settings options in main container.
* @var mixed[] $form_sidebar_options Settings options in sidebar.
* @var string $form_input_name Name of hidden field with form ID.
* @var string|null $form_input_value ID of settings form in main container.
* @var string $form_sidebar_input_value ID of settings form in sidebar.
* @var string $nonce_input_name Name of hidden field with WordPress Nonce value.
* @var string $nonce_input_value WordPress Nonce value.
* @var bool $token_valid_status Status of access token.
* @var bool $token_active_status Status of PRO version.
* @var string|null $api_paths_url URL of REST API endpoint.
* @var string|null $api_paths_nonce Authorization code of REST API endpoint.
* @var string|null $api_regenerate_url URL of REST API endpoint.
* @var string|null $api_regenerate_nonce Authorization code of REST API endpoint.
* @var string $api_stats_url URL of REST API endpoint.
* @var string $api_stats_nonce Authorization code of REST API endpoint.
* @var string $url_debug_page URL of debug tag in settings page.
* @var string[][] $output_formats Data about output formats for regeneration.
*
* @package Converter for Media
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="wrap">
<hr class="wp-header-end">
<div class="webpcPage" data-api-stats="<?php echo esc_url( $api_stats_url ); ?>|<?php echo esc_attr( $api_stats_nonce ); ?>">
<div class="webpcPage__headline">
<img src="<?php echo esc_attr( $logo_url ); ?>" alt="<?php echo esc_attr( 'Converter for Media' ); ?>">
</div>
<div class="webpcPage__inner">
<ul class="webpcPage__columns">
<li class="webpcPage__column webpcPage__column--large">
<?php if ( ( ( $_POST[ $form_input_name ] ?? '' ) === $form_sidebar_input_value ) && $token_valid_status ) : // phpcs:ignore ?>
<div class="webpcPage__alert">
<?php echo esc_html( __( 'The access token has been activated!', 'webp-converter-for-media' ) ); ?>
</div>
<?php elseif ( isset( $_POST[ $form_input_name ] ) ) : // phpcs:ignore ?>
<div class="webpcPage__alert">
<?php echo esc_html( __( 'Changes were successfully saved!', 'webp-converter-for-media' ) ); ?>
</div>
<?php endif; ?>
<?php
require_once dirname( __DIR__ ) . '/components/widgets/errors.php';
require_once dirname( __DIR__ ) . '/components/widgets/menu.php';
if ( ( $form_options !== null ) && ( $form_input_value !== null ) ) {
require_once dirname( __DIR__ ) . '/components/widgets/options.php';
}
if ( ( $api_paths_url !== null ) && ( $api_regenerate_url !== null ) ) {
require_once dirname( __DIR__ ) . '/components/widgets/regenerate.php';
}
?>
</li>
<li class="webpcPage__column webpcPage__column--small">
<?php
require_once dirname( __DIR__ ) . '/components/widgets/options-sidebar.php';
require_once dirname( __DIR__ ) . '/components/widgets/about.php';
require_once dirname( __DIR__ ) . '/components/widgets/support.php';
?>
</li>
</ul>
</div>
<div class="webpcPage__footer">
<div class="webpcPage__footerLogo"></div>
<div class="webpcPage__footerContent">
<?php
echo wp_kses_post(
sprintf(
/* translators: %1$s: icon heart, %2$s: author name, %3$s: open anchor tag, %4$s: stars icons, %5$s: close anchor tag */
__( 'Created with %1$s by %2$s - if you like our plugin, please, %3$srate one%4$s%5$s', 'webp-converter-for-media' ),
'<span class="webpcPage__footerIcon webpcPage__footerIcon--heart"></span>',
'<a href="https://url.mattplugins.com/converter-settings-footer-author-website" target="_blank">matt plugins</a>',
'<a href="https://url.mattplugins.com/converter-settings-footer-plugin-review" target="_blank">',
' <span class="webpcPage__footerIcon webpcPage__footerIcon--stars"></span>',
'</a>'
)
);
?>
</div>
</div>
<?php
if ( ( $api_paths_url !== null ) && ( $api_regenerate_url !== null ) ) {
require_once dirname( __DIR__ ) . '/components/widgets/regenerate-popup.php';
}
?>
</div>
</div>