is_conflicting_pro_version() ) {
add_action( 'all_admin_notices', [ $this, 'pro_version_warning' ] );
add_filter( 'advanced-sidebar-menu/scripts/js-config/error', [ $this, 'get_pro_version_warning_message' ] );
}
}
/**
* Is PRO active but an unsupported version?
*
* @return bool
*/
public function is_conflicting_pro_version() {
return null !== $this->get_pro_version() && version_compare( ADVANCED_SIDEBAR_MENU_REQUIRED_PRO_VERSION, $this->get_pro_version(), '>' );
}
/**
* Is the PRO version installed?
*
* @since 9.7.0
*
* @return ?string
*/
public function get_pro_version(): ?string {
return \defined( 'ADVANCED_SIDEBAR_MENU_PRO_VERSION' ) ? ADVANCED_SIDEBAR_MENU_PRO_VERSION : null;
}
/**
* Display a warning if we don't have the required PRO version installed.
*
* @param bool $no_banner - Display as a "message" banner.
*/
public function pro_version_warning( $no_banner = false ) {
?>
get_pro_version_warning_message(); //phpcs:ignore ?>
]{%2$s}[] */
return \sprintf( esc_html_x( 'Advanced Sidebar Menu requires %1$sAdvanced Sidebar Menu PRO%2$s version %3$s+. Please update or deactivate the PRO version.', '{}{}', 'advanced-sidebar-menu' ), '', '', esc_attr( ADVANCED_SIDEBAR_MENU_REQUIRED_PRO_VERSION ) );
}
/**
* Notify widget users about the PRO options
*
* @phpstan-param PAGE_SETTINGS|CATEGORY_SETTINGS $_
*
* @param array $_ - widget instance.
* @param \WP_Widget $widget - widget class.
*
* @return void
*/
public function info_panel( array $_, \WP_Widget $widget ) {
if ( $this->is_conflicting_pro_version() ) {
?>
pro_version_warning( true ); ?>
get_pro_version() ) {
return;
}
/**
* On clicking of the element add an "open" class to the parent
* div element.
*/
?>
$widget - Widget class.
*/
public function preview( array $instance, \WP_Widget $widget ) {
if ( null !== $this->get_pro_version() ) {
return;
}
$src = 'pages-widget-min.webp?version=' . ADVANCED_SIDEBAR_MENU_BASIC_VERSION;
if ( Category::NAME === $widget->id_base ) {
$src = 'category-widget-min.webp?version=' . ADVANCED_SIDEBAR_MENU_BASIC_VERSION;
}
?>
get_pro_version() ) {
$actions['go-pro'] = \sprintf( '%2$s', 'https://onpointplugins.com/product/advanced-sidebar-menu-pro/?utm_source=wp-plugins&utm_campaign=gopro&utm_medium=wp-dash', __( 'Go PRO', 'advanced-sidebar-menu' ) );
}
return $actions;
}
/**
* Get a list of PRO plugin features for display in
* the info panel for widgets and blocks.
*
* @return array
*/
public function get_features() {
return [
__( 'Styling options including borders, bullets, colors, backgrounds, font size and weight.', 'advanced-sidebar-menu' ),
__( 'Accordion menus.', 'advanced-sidebar-menu' ),
__( 'Support for custom navigation menus from Appearance -> Menus.', 'advanced-sidebar-menu' ),
__( 'Select and display custom post types and taxonomies.', 'advanced-sidebar-menu' ),
__( 'Priority support with access to members only support area.', 'advanced-sidebar-menu' ),
];
}
}