has_cap( 'manage_ai1ec_options' ) ||
(
defined( 'DOING_AJAX' ) &&
DOING_AJAX
)
) {
return;
}
global $plugin_page;
$settings = $this->_registry->get( 'model.settings' );
$notification = $this->_registry->get( 'notification.admin' );
$notifications = array();
// check if is set calendar page
if ( ! $settings->get( 'calendar_page_id' ) ) {
$msg = Ai1ec_I18n::__(
'Select an option in the Calendar page dropdown list.'
);
$notifications[] = $msg;
}
if (
$plugin_page !== AI1EC_PLUGIN_NAME . '-settings' &&
! empty( $notifications )
) {
if (
$current_user->has_cap( 'manage_ai1ec_options' )
) {
$msg = sprintf(
Ai1ec_I18n::__( 'The plugin is installed, but has not been configured. Click here to set it up now »' ),
admin_url( AI1EC_SETTINGS_BASE_URL )
);
$notification->store(
$msg,
'updated',
2,
array( Ai1ec_Notification_Admin::RCPT_ADMIN )
);
} else {
$msg = Ai1ec_I18n::__(
'The plugin is installed, but has not been configured. Please log in as an Administrator to set it up.'
);
$notification->store(
$msg,
'updated',
2,
array( Ai1ec_Notification_Admin::RCPT_ALL )
);
}
return;
}
foreach ( $notifications as $msg ) {
$notification->store(
$msg,
'updated',
2,
array( Ai1ec_Notification_Admin::RCPT_ADMIN )
);
}
global $wp_rewrite;
$option = $this->_registry->get( 'model.option' );
$rewrite = $option->get( 'ai1ec_force_flush_rewrite_rules' );
if (
! $rewrite ||
! is_object( $wp_rewrite ) ||
! isset( $wp_rewrite->rules ) ||
0 === count( $wp_rewrite->rules )
) {
return;
}
$this->_registry->get( 'rewrite.helper' )->flush_rewrite_rules();
$option->set( 'ai1ec_force_flush_rewrite_rules', false );
}
}