AlertProvider.php
1 year ago
ApiClient.php
1 day ago
DateTimeHelper.php
1 year ago
DateTimes.php
2 years ago
DateTimesImmutable.php
2 years ago
Debugger.php
1 year ago
DisplayHelper.php
1 year ago
EmailHelper.php
1 year ago
PostTypeHelper.php
2 years ago
Random.php
4 years ago
SecurityValidator.php
2 years ago
ShortcodeSubstitutor.php
2 months ago
TemplateProvider.php
2 years ago
functions.php
3 years ago
functions.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | namespace FapiMember\Utils; |
| 4 | |
| 5 | /** |
| 6 | * @param int|array<int> $sectionOrLevel Section or level ID or list of IDs |
| 7 | * @return bool Return TRUE if user is in provided section |
| 8 | */ |
| 9 | function isInSection( $sectionOrLevel ) { |
| 10 | if ( ! is_array( $sectionOrLevel ) ) { |
| 11 | $sectionOrLevel = array( $sectionOrLevel ); |
| 12 | } |
| 13 | |
| 14 | return DisplayHelper::shouldContentBeRendered( '1', $sectionOrLevel ); |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * @param int|array<int> $sectionOrLevel Section or level ID or list of IDs |
| 19 | * @return bool Return TRUE if user is NOT in provided section |
| 20 | */ |
| 21 | function isNotInSection( $sectionOrLevel ) { |
| 22 | if ( ! is_array( $sectionOrLevel ) ) { |
| 23 | $sectionOrLevel = array( $sectionOrLevel ); |
| 24 | } |
| 25 | |
| 26 | return DisplayHelper::shouldContentBeRendered( '0', $sectionOrLevel ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * @param string $hasSectionOrLevel Allowed values '1' | '0' . '1' - return TRUE if user is in provided section or level. '0' - return TRUE if user is NOT in provided section or level. '' or any value - return TRUE. |
| 31 | * @param string|array<mixed> $fapiSectionAndLevels List of section or level user is being in or must not be in. |
| 32 | * @return bool |
| 33 | */ |
| 34 | function shouldContentBeRendered( $hasSectionOrLevel, $fapiSectionAndLevels ) { |
| 35 | return DisplayHelper::shouldContentBeRendered( $hasSectionOrLevel, $fapiSectionAndLevels ); |
| 36 | } |
| 37 |