admin()->get_user_validation_message();
// Re-check images notice.
$this->get_recheck_message();
// Check and show missing directory smush table error only on main site.
if ( Dir::should_continue() ) {
$this->show_table_error();
}
// Check for any stored API message and show it.
$this->show_api_message();
$this->settings_updated();
do_action( 'wp_smush_header_notices' );
}
/**
* Get re-check notice after settings update.
*/
private function get_recheck_message() {
// Return if not multisite, or on network settings page, Netowrkwide settings is disabled.
if ( ! is_multisite() || is_network_admin() || ! Settings::can_access( 'bulk' ) ) {
return;
}
// Check the last settings stored in db.
$run_recheck = $this->settings->get_setting( WP_SMUSH_PREFIX . 'run_recheck', false );
// If not same, display notice.
if ( ! $run_recheck ) {
return;
}
?>
id && 'toplevel_page_smush-network' !== $current_screen->id ) {
return $notice;
}
if ( ! Dir::table_exist() ) {
// Display a notice.
?>
settings->get_setting( WP_SMUSH_PREFIX . 'settings_updated' ) ) {
return;
}
$core = WP_Smush::get_instance()->core();
// Default message.
$message = esc_html__( 'Your settings have been updated!', 'wp-smushit' );
// Notice class.
$message_class = ' sui-notice-success';
if ( 'cdn' === $this->get_current_tab() ) {
$cdn = $this->settings->get_setting( WP_SMUSH_PREFIX . 'cdn_status' );
if ( isset( $cdn->cdn_enabling ) && $cdn->cdn_enabling ) {
$message = esc_html__( 'Your settings have been saved and changes are now propagating to the CDN. Changes can take up to 30 minutes to take effect but your images will continue to be served in the mean time, please be patient.', 'wp-smushit' );
}
}
// Additional message if we got work to do!
$resmush_count = is_array( $core->resmush_ids ) && count( $core->resmush_ids ) > 0;
$smush_count = is_array( $core->remaining_count ) && $core->remaining_count > 0;
if ( $smush_count || $resmush_count ) {
$message_class = ' sui-notice-warning';
// Show link to bulk smush tab from other tabs.
$bulk_smush_link = 'bulk' === $this->get_current_tab() ? '' : '';
$message .= ' ' . sprintf( esc_html__( 'You have images that need smushing. %1$sBulk smush now!%2$s', 'wp-smushit' ), $bulk_smush_link, '' );
}
?>
settings->delete_setting( WP_SMUSH_PREFIX . 'settings_updated' );
}
/**
* Add more pages to builtin wpmudev branding.
*
* @since 3.0
*
* @param array $plugin_pages Nextgen pages is not introduced in built in wpmudev branding.
*
* @return array
*/
public function builtin_wpmudev_branding( $plugin_pages ) {
$plugin_pages['gallery_page_wp-smush-nextgen-bulk'] = array(
'wpmudev_whitelabel_sui_plugins_branding',
'wpmudev_whitelabel_sui_plugins_footer',
'wpmudev_whitelabel_sui_plugins_doc_links',
);
return $plugin_pages;
}
/**
* Flag to hide wpmudev branding image.
*
* @since 3.0
*
* @return bool
*/
public function hide_wpmudev_branding() {
return apply_filters( 'wpmudev_branding_hide_branding', false );
}
/**
* Flag to hide wpmudev doc link.
*
* @since 3.0
*
* @return bool
*/
public function hide_wpmudev_doc_link() {
return apply_filters( 'wpmudev_branding_hide_doc_link', false );
}
/**
* Check if the page should be rendered.
*
* @since 3.2.2
*
* @return bool
*/
public function should_render() {
// Render all pages on single site installs.
if ( ! is_multisite() ) {
return true;
}
$access = get_site_option( WP_SMUSH_PREFIX . 'networkwide' );
if ( ! $access ) {
return is_network_admin() ? true : false;
}
if ( '1' === $access ) {
return is_network_admin() ? false : true;
}
if ( is_array( $access ) ) {
if ( is_network_admin() && ! in_array( $this->get_current_tab(), $access, true ) ) {
return true;
}
if ( ! is_network_admin() && in_array( $this->get_current_tab(), $access, true ) ) {
return true;
}
}
return false;
}
}