PluginProbe ʕ •ᴥ•ʔ
FAPI Member / trunk
FAPI Member vtrunk
2.2.33 2.2.32 trunk 1.9.47 2.1.18 2.2.24 2.2.25 2.2.26 2.2.28 2.2.29 2.2.30 2.2.31
fapi-member / src / Utils / functions.php
fapi-member / src / Utils Last commit date
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