id : ''; $own = false !== strpos( $id, 'bdbe' ) || false !== strpos( $id, 'gridsmith' ); return (bool) apply_filters( 'bdbe_is_own_screen', $own, $screen ); } /** * Free package: slim "Go Pro" bar at the top of the plugin's own screens. * Shown only on this plugin's pages, never elsewhere in wp-admin. */ public static function upgrade_bar() { if ( ! current_user_can( 'manage_options' ) || ! self::is_own_screen() ) { return; } $features = array(); foreach ( array_slice( (array) apply_filters( 'bdbe_pro_features', array() ), 0, 3 ) as $feature ) { $features[] = trim( (string) strtok( (string) $feature, ':(' ) ); } ?>
'wp-plugin', 'utm_medium' => sanitize_key( $source ), 'utm_campaign' => 'gridsmith', ), 'https://coodecraft.com/market/product/woo-bulk-edit' ); } /** * Free 7-day Pro trial sign-up on the product page. * * @param string $source Where the link is shown. * @return string */ public static function trial_url( $source = 'plugin' ) { return self::upgrade_url( $source ) . '#trial'; } /** * Admin screen that holds the licence form. * * @return string */ public static function license_url() { return admin_url( 'admin.php?page=woo-bulk-edit-license' ); } /** * Small "Pro" badge for locked controls. * * @return string Escaped HTML. */ public static function badge() { return '' . esc_html__( 'PRO', 'gridsmith' ) . ''; } /** * Notice shown in place of a Pro-only setting. * * @param string $feature Feature name. */ public static function locked_notice( $feature ) { if ( self::has_pro_code() ) { $text = sprintf( /* translators: %s: feature name. */ __( '%s needs an active licence. Activate your key to unlock it.', 'gridsmith' ), $feature ); $url = self::license_url(); $label = __( 'Activate licence', 'gridsmith' ); } else { $text = sprintf( /* translators: %s: feature name. */ __( '%s is part of the Pro version.', 'gridsmith' ), $feature ); $url = self::upgrade_url( 'locked-' . sanitize_title( $feature ) ); $label = __( 'Get Pro', 'gridsmith' ); } printf( '

%1$s %2$s %5$s

', self::badge(), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped in badge(). esc_html( $text ), esc_url( $url ), self::has_pro_code() ? '' : 'target="_blank" rel="noopener noreferrer"', esc_html( $label ) ); } /** * Links on the Plugins screen. * * @param array $links Links. * @return array */ public static function action_links( $links ) { $extra = array( '' . esc_html__( 'Settings', 'gridsmith' ) . '', ); if ( ! self::has_pro_code() ) { $extra[] = '' . esc_html__( 'Get Pro', 'gridsmith' ) . ''; } elseif ( ! self::is_pro() ) { $extra[] = '' . esc_html__( 'Activate licence', 'gridsmith' ) . ''; } return array_merge( $extra, $links ); } /** * Clean up scheduled events on deactivation. */ public static function on_deactivate() { wp_clear_scheduled_hook( 'bdbe_license_check' ); wp_clear_scheduled_hook( 'bdbe_license_recheck' ); do_action( 'bdbe_deactivate' ); } }