PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/helpers/FrmApiHelper.php +16 -5 6.25 → trunk View file →
@@ -13,8 +13,9 @@
13 13 *
14 14 * @since 6.17
15 15 *
16 16 * @param array $item Inbox or Sale item.
17 + *
17 18 * @return bool
18 19 */
19 20 public static function is_for_user( $item ) {
20 21 if ( ! isset( $item['who'] ) || $item['who'] === 'all' ) {
@@ -19,25 +20,28 @@
19 20 public static function is_for_user( $item ) {
20 21 if ( ! isset( $item['who'] ) || $item['who'] === 'all' ) {
21 22 return true;
22 23 }
24 +
23 25 $who = (array) $item['who'];
26 +
24 27 if ( self::is_for_everyone( $who ) ) {
25 28 return true;
26 29 }
30 +
27 31 if ( self::is_user_type( $who ) ) {
28 32 return true;
29 33 }
34 +
30 35 if ( in_array( 'free_first_30', $who, true ) && self::is_free_first_30() ) {
31 36 return true;
32 37 }
38 +
33 39 if ( in_array( 'free_not_first_30', $who, true ) && self::is_free_not_first_30() ) {
34 40 return true;
35 41 }
36 - if ( self::check_free_segments( $who ) ) {
37 - return true;
38 - }
39 - return false;
42 +
43 + return self::check_free_segments( $who );
40 44 }
41 45
42 46 /**
43 47 * @since 6.17
@@ -42,8 +46,9 @@
42 46 /**
43 47 * @since 6.17
44 48 *
45 49 * @param array $who
50 + *
46 51 * @return bool
47 52 */
48 53 private static function is_for_everyone( $who ) {
49 54 return in_array( 'all', $who, true );
@@ -52,8 +57,9 @@
52 57 /**
53 58 * @since 6.17
54 59 *
55 60 * @param array $who
61 + *
56 62 * @return bool
57 63 */
58 64 private static function is_user_type( $who ) {
59 65 return in_array( self::get_user_type(), $who, true );
@@ -90,13 +96,15 @@
90 96 * @return bool
91 97 */
92 98 private static function is_first_30() {
93 99 $activation_timestamp = get_option( 'frm_first_activation' );
100 +
94 101 if ( false === $activation_timestamp ) {
95 102 // If the option does not exist, assume that it is
96 - // because the user was active before this option was introduced.
103 + // Because the user was active before this option was introduced.
97 104 return false;
98 105 }
106 +
99 107 $cutoff = strtotime( '-30 days' );
100 108 return $activation_timestamp > $cutoff;
101 109 }
102 110
@@ -123,8 +131,9 @@
123 131 /**
124 132 * @since 6.18
125 133 *
126 134 * @param array $who
135 + *
127 136 * @return bool
128 137 */
129 138 private static function check_free_segments( $who ) {
130 139 $segments = array(
@@ -160,13 +169,15 @@
160 169 * @since 6.18
161 170 *
162 171 * @param string $key
163 172 * @param int $activation_timestamp
173 + *
164 174 * @return bool
165 175 */
166 176 private static function matches_segment( $key, $activation_timestamp ) {
167 177 $range_part = str_replace( 'free_first_', '', $key );
168 178 $range_parts = explode( '_', $range_part );
179 +
169 180 if ( ! $range_parts ) {
170 181 return false;
171 182 }
172 183