LLMS_Access_Plan::get_access_period_name( string $period = null, int $length = null )

Get the translated and pluralized name of the plan’s access period


Description Description


Parameters Parameters

$period

(string) (Optional) (optional) untranslated access period, if not supplied uses stored value for the plan.

Default value: null

$length

(int) (Optional) (optional) access length (for pluralization), if not supplied uses stored value for the plan.

Default value: null


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/models/model.llms.access.plan.php

	public function get_access_period_name( $period = null, $length = null ) {

		$period = $period ? $period : $this->get( 'access_period' );
		$length = $length ? $length : $this->get( 'access_length' );

		switch ( $period ) {

			case 'year':
				$period = _nx( 'year', 'years', $length, 'Access plan period', 'lifterlms' );
				break;

			case 'month':
				$period = _nx( 'month', 'months', $length, 'Access plan period', 'lifterlms' );
				break;

			case 'week':
				$period = _nx( 'week', 'weeks', $length, 'Access plan period', 'lifterlms' );
				break;

			case 'day':
				$period = _nx( 'day', 'days', $length, 'Access plan period', 'lifterlms' );
				break;

		}

		/**
		 * Filter the translated name of an access plan's billing period.
		 *
	     * @since 3.4.6
	     * @version 3.4.6
	     *
	     * @param string $period Translated period name.
	     * @param int $length Access length, used for pluralization.
	     * @param LLMS_Access_Plan $this Access plan instance.
		 */
		return apply_filters( 'llms_plan_get_access_period_name', $period, $length, $this );

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.4.6 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.





Permalink: