the Autopmize Extra settings.
$_ao_imgopt_plug_notice = sprintf( esc_html__( 'Did you know that Autoptimize offers on-the-fly image optimization (with support for WebP and AVIF) and CDN via ShortPixel? Check out the %1$sAutoptimize Image settings%2$s to enable this option.', 'autoptimize' ), '', '' );
$_ao_imgopt_plug_notice = apply_filters( 'autoptimize_filter_main_imgopt_plug_notice', $_ao_imgopt_plug_notice );
$_ao_imgopt_launch_ok = autoptimizeImages::launch_ok_wrapper();
$_ao_imgopt_plug_dismissible = 'ao-img-opt-plug-123';
$_ao_imgopt_active = autoptimizeImages::imgopt_active();
$_is_ao_settings_page = autoptimizeUtils::is_ao_settings();
if ( current_user_can( 'manage_options' ) && ! defined( 'AO_PRO_VERSION' ) && $_is_ao_settings_page && '' !== $_ao_imgopt_plug_notice && ! $_ao_imgopt_active && $_ao_imgopt_launch_ok && PAnD::is_admin_notice_active( $_ao_imgopt_plug_dismissible ) ) {
echo '
';
echo $_ao_imgopt_plug_notice;
echo '
';
}
}
public static function notice_imgopt_issue()
{
// Translators: the URL added points to the Autopmize Extra settings.
$_ao_imgopt_issue_notice = sprintf( esc_html__( 'Shortpixel reports it cannot always reach your site, which might mean some images are not optimized. You can %1$sread more about why this happens and how you can fix that problem here%2$s.', 'autoptimize' ), '', '' );
$_ao_imgopt_issue_notice = apply_filters( 'autoptimize_filter_main_imgopt_issue_notice', $_ao_imgopt_issue_notice );
$_ao_imgopt_issue_dismissible = 'ao-img-opt-issue-14';
$_ao_imgopt_active = autoptimizeImages::imgopt_active();
$_ao_imgopt_status = autoptimizeOptionWrapper::get_option( 'autoptimize_imgopt_provider_stat', '' );
if ( is_array( $_ao_imgopt_status ) && array_key_exists( 'TemporaryRedirectOrigin', $_ao_imgopt_status ) && ( $_ao_imgopt_status['TemporaryRedirectOrigin'] === "true" || $_ao_imgopt_status['TemporaryRedirectOrigin'] === true ) ) {
$_ao_imgopt_status_redirect_warning = true;
} else {
$_ao_imgopt_status_redirect_warning = false;
}
if ( current_user_can( 'manage_options' ) && $_ao_imgopt_active && $_ao_imgopt_status_redirect_warning && '' !== $_ao_imgopt_issue_notice && PAnD::is_admin_notice_active( $_ao_imgopt_issue_dismissible ) ) {
echo '';
echo $_ao_imgopt_issue_notice;
echo '
';
}
}
public static function notice_nopagecache()
{
/*
* Autoptimize does not do page caching (yet) but not everyone knows, so below logic tries to find out if page caching is available and if not show a notice on the AO Settings pages.
*
* uses helper function in autoptimizeUtils.php
*/
// translators: strong tags and a break.
$_ao_nopagecache_notice = sprintf( esc_html__( 'It looks like your site might not have %1$spage caching%2$s which is a %1$smust-have for performance%2$s. If you are sure you have a page cache, you can close this notice.%3$sWhen in doubt check with your host if they offer this or install a free page caching plugin like for example KeyCDN Cache Enabler', 'autoptimize' ), '', '', '
' );
// translators: strong tags.
$_ao_nopagecache_notice .= ' ' . esc_html__('or consider ', 'autoptimize') . 'Autoptimize Pro' . sprintf( esc_html__( ' which not only has page caching but also image optimization, critical CSS and advanced booster options %1$sto make your site significantly faster%2$s!', 'autoptimize' ), '', '' );
$_ao_nopagecache_dismissible = 'ao-nopagecache-forever'; // the notice is only shown once and will not re-appear when dismissed.
$_is_ao_settings_page = autoptimizeUtils::is_ao_settings();
if ( current_user_can( 'manage_options' ) && $_is_ao_settings_page && PAnD::is_admin_notice_active( $_ao_nopagecache_dismissible ) && true === apply_filters( 'autoptimize_filter_main_show_pagecache_notice', true ) ) {
if ( false === autoptimizeUtils::find_pagecache() ) {
echo '';
echo $_ao_nopagecache_notice;
echo '
';
}
}
}
public static function notice_potential_conflict()
{
/*
* Using other plugins to do CSS/ JS optimization can cause unexpected and hard to troubleshoot issues, warn users who seem to be in that situation.
*/
// Translators: some strong tags + the sentence will be finished with the name of the offending plugin and a final stop.
$_ao_potential_conflict_notice = sprintf( esc_html__( 'It looks like you have %1$sanother plugin also doing CSS and/ or JS optimization%2$s, which can result in hard to troubleshoot %1$sconflicts%2$s. For this reason it is recommended to disable this functionality in', 'autoptimize' ), '', '' ) . ' ';
$_ao_potential_conflict_dismissible = 'ao-potential-conflict-forever'; // the notice is only shown once and will not re-appear when dismissed.
$_is_ao_settings_page = autoptimizeUtils::is_ao_settings();
if ( current_user_can( 'manage_options' ) && $_is_ao_settings_page && PAnD::is_admin_notice_active( $_ao_potential_conflict_dismissible ) && true === apply_filters( 'autoptimize_filter_main_show_potential_conclict_notice', true ) ) {
$_potential_conflicts = autoptimizeUtils::find_potential_conflicts();
if ( false !== $_potential_conflicts ) {
$_ao_potential_conflict_notice .= '' . $_potential_conflicts . '.';
echo '';
echo $_ao_potential_conflict_notice;
echo '
';
}
}
}
}