' . esc_url( $cdn_source['url'] ) . '',
'' . esc_html( $cdn_source['name'] ) . ''
);
} elseif ( ! empty( $cdn_source['name'] ) ) {
printf(
/* translators: 1 is an URL, 2 is a plugin name. */
esc_html__( 'Your CDN URL is set to %1$s by %2$s.', 'imagify' ),
'' . esc_url( $cdn_source['url'] ) . '',
'' . esc_html( $cdn_source['name'] ) . ''
);
} else {
printf(
/* translators: %s is an URL. */
esc_html__( 'Your CDN URL is set to %1$s by filter.', 'imagify' ),
'' . esc_url( $cdn_source['url'] ) . ''
);
}
$settings->field_hidden(
[
'option_name' => 'cdn_url',
'current_value' => $cdn_source['url'],
]
);
} else {
$settings->field_text_box(
[
'option_name' => 'cdn_url',
'label' => __( 'If you use a CDN, specify the URL:', 'imagify' ),
'attributes' => [
'size' => 30,
'placeholder' => __( 'https://cdn.example.com', 'imagify' ),
],
]
);
}
?>
get_file_path( true );
if ( $conf_file_path ) {
printf(
/* translators: 1 is a file name, 2 is a tag opening, 3 is the tag closing. */
esc_html__( 'The first option adds rewrite rules to your site’s configuration file (%1$s) and does not alter your pages code. %2$sThis does not work with CDN though.%3$s', 'imagify' ),
'' . esc_html( $conf_file_path ) . '',
'',
''
);
echo ' ';
}
printf(
/* translators: 1 and 2 are HTML tag names, 3 is a tag opening, 4 is the tag closing. */
esc_html__( 'The second option replaces the %1$s tags with %2$s tags. %3$sThis is the preferred solution but some themes may break%4$s, so make sure to verify that everything seems fine.', 'imagify' ),
'<img>',
'<picture>',
'',
''
);
echo ' ';
/**
* Add more information about WebP.
*
* @since 1.9
* @author Grégory Viguier
*/
do_action( 'imagify_settings_webp_info' );
?>
get_cached_stat();
if ( $count ) {
?>
print_template( 'part-settings-webp-missing-message', [ 'count' => $count ] ); ?>
get_stat();
$total = get_transient( 'imagify_missing_next_gen_total' );
$progress = 0;
$aria = ' aria-hidden="true"';
$class = 'hidden';
$style = '';
if (
false !== $total
&&
$total > 0
) {
$aria = '';
$class = '';
/*
* `$total` is a snapshot taken when the run started, while `$remaining` is
* recounted on every page load. Anything growing the workload mid-run (new
* uploads, or switching the Next-Gen format so every media is missing one)
* pushes `$remaining` above `$total`, and `$total - $remaining` goes negative.
* Report against the largest workload seen instead. Mirrors getProgress() in
* assets/js/options.js.
*/
$remaining = max( (int) $remaining, 0 );
$effective_total = max( (int) $total, $remaining );
$processed = $effective_total - $remaining;
$progress = $processed . '/' . $effective_total;
$percent = $effective_total > 0 ? floor( $processed / $effective_total * 100 ) : 0;
$style = 'style="width:' . $percent . '%;"';
}
?>