__( 'Availability', 'abogo-booking' ), 'features' => array( __( 'Bookings per date', 'abogo-booking' ) => __( 'Never sell the same dates twice: set how many customers can book the same date.', 'abogo-booking' ), __( 'Departure day', 'abogo-booking' ) => __( 'Free the departure day of a stay for the next arrival.', 'abogo-booking' ), __( 'Closed dates', 'abogo-booking' ) => __( 'Close a day of the week, a date or a period, once or every year.', 'abogo-booking' ), ), ); $locked['prices'] = array( 'title' => __( 'Prices', 'abogo-booking' ), 'features' => array( __( 'Prices by date', 'abogo-booking' ) => __( 'Charge a weekend rate or a season, or raise or lower the price on some days.', 'abogo-booking' ), __( 'Prices by length of stay', 'abogo-booking' ) => __( 'Give a discount or add a surcharge for stays of a given length.', 'abogo-booking' ), ), ); $locked['filter'] = array( 'title' => __( 'Shop filter', 'abogo-booking' ), 'features' => array( __( 'Date filter', 'abogo-booking' ) => __( 'Customers pick their dates on the shop and see only the products free on them.', 'abogo-booking' ), ), ); return $locked; } /** * Print the paid buttons of the bookings screen, locked. * * @since 1.1.0 */ public function bookings_actions() { $actions = array( __( 'Add booking', 'abogo-booking' ) => __( 'Enter a booking taken by telephone or on another platform.', 'abogo-booking' ), __( 'Import', 'abogo-booking' ) => __( 'Load bookings from a CSV file.', 'abogo-booking' ), __( 'Export CSV', 'abogo-booking' ) => __( 'Download the bookings the list shows, as a CSV file.', 'abogo-booking' ), ); foreach ( $actions as $label => $line ) { printf( '%s %s', esc_url( self::url() ), esc_attr( $line ), esc_html( $label ), self::badge() // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static markup. ); } } /** * Print the paid rules of a product, locked, at the end of its Booking tab. * * @since 1.1.0 */ public function product_panel() { echo '
'; echo '

' . esc_html__( 'Bookings per date, closed dates, prices by date and by length of stay', 'abogo-booking' ) . ' ' . self::badge() . '

'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static markup. echo '

' . esc_html__( 'Give this product its own limits, closed dates and prices.', 'abogo-booking' ) . '

'; self::button(); echo '
'; } /** * The small Pro badge. * * @since 1.1.0 * @return string */ public static function badge() { return '' . esc_html__( 'Pro', 'abogo-booking' ) . ''; } /** * Print the button that starts the trial, or opens the plans once the trial was used. * * @since 1.1.0 */ public static function button() { $label = '' === self::trial_url() ? __( 'Upgrade to Pro', 'abogo-booking' ) : __( 'Start the 14-day free trial', 'abogo-booking' ); printf( '%s', esc_url( self::url() ), esc_html( $label ) ); } /** * Where the trial starts, or the plans when it was already used. * * @since 1.1.0 * @return string */ public static function url() { $trial = self::trial_url(); if ( '' !== $trial ) { return $trial; } return self::can_open_plans_page() ? \abfw_fs()->get_upgrade_url() : self::CHECKOUT_URL; } /** * Where the free trial starts, or nothing once it was used or Pro is active. * * @since 1.1.0 * @return string */ public static function trial_url() { $licensing = function_exists( 'abfw_fs' ) ? \abfw_fs() : null; if ( ! $licensing || is_premium() || $licensing->is_trial_utilized() ) { return ''; } return self::can_open_plans_page() ? $licensing->get_trial_url() : add_query_arg( 'trial', 'free', self::CHECKOUT_URL ); } /** * The offer shown wherever the trial is proposed. * * @since 1.1.0 * @return string */ public static function trial_offer() { return __( 'Try Pro free for 14 days, no card needed', 'abogo-booking' ); } /** * Before the store answers the data-sharing question, and for shop managers, * the plans page inside the admin is refused, so the online checkout is used. * * @since 1.1.0 * @return bool */ private static function can_open_plans_page() { return function_exists( 'abfw_fs' ) && \abfw_fs() && current_user_can( 'manage_options' ) && ! \abfw_fs()->is_activation_mode(); } }