PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.16
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.16
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/models/FrmApplicationTemplate.php +15 -52 6.356.16 View file →
@@ -38,9 +38,9 @@
38 38 * @param array $keys
39 39 */
40 40 self::$keys = apply_filters(
41 41 'frm_application_data_keys',
42 - array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms', 'used_addons' )
42 + array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms' )
43 43 );
44 44 self::$keys_with_images = array_merge(
45 45 self::get_template_keys_with_local_png_images(),
46 46 self::get_template_keys_with_local_webp_images()
@@ -82,35 +82,13 @@
82 82 'team-directory',
83 83 'product-review',
84 84 'real-estate-listings',
85 85 'business-directory',
86 - 'artist-gallery',
87 - 'classifieds',
88 - 'community-event-calendar',
89 - 'company-timeline',
90 - 'crowdfunding',
91 - 'job-board',
92 - 'logo-cloud',
93 - 'multi-property-booking-system',
94 - 'wedding-venue-booking',
95 - 'permission-slip',
96 - 'property-directory',
97 - 'radio-station',
98 - 'recipe',
99 - 'rsvp-invite',
100 - 'searchable-directory',
101 - 'shopping-cart',
102 - 'sports-league-calendar',
103 - 'staff-directory',
104 - 'tiered-pricing',
105 - 'trip-itinerary',
106 - 'twitterx',
107 86 );
108 87 }
109 88
110 89 /**
111 90 * @param array $api_data
112 - *
113 91 * @return void
114 92 */
115 93 public function __construct( $api_data ) {
116 94 $this->api_data = $api_data;
@@ -121,9 +99,8 @@
121 99 }
122 100
123 101 /**
124 102 * @param array<string> $categories
125 - *
126 103 * @return void
127 104 */
128 105 private static function populate_category_information( $categories ) {
129 106 foreach ( $categories as $category ) {
@@ -129,9 +106,8 @@
129 106 foreach ( $categories as $category ) {
130 107 if ( self::category_matches_a_license_type( $category ) ) {
131 108 continue;
132 109 }
133 -
134 110 if ( in_array( $category, self::$categories, true ) ) {
135 111 continue;
136 112 }
137 113 self::$categories[] = $category;
@@ -141,13 +117,12 @@
141 117 /**
142 118 * @since 5.5.2
143 119 *
144 120 * @param string $category
145 - *
146 121 * @return bool
147 122 */
148 123 private static function category_matches_a_license_type( $category ) {
149 - if ( str_contains( $category, '+Views' ) ) {
124 + if ( false !== strpos( $category, '+Views' ) ) {
150 125 return true;
151 126 }
152 127 return in_array( $category, FrmFormsHelper::get_license_types(), true );
153 128 }
@@ -155,9 +130,9 @@
155 130 /**
156 131 * @return array<string>
157 132 */
158 133 public static function get_categories() {
159 - return self::$categories ?? array();
134 + return isset( self::$categories ) ? self::$categories : array();
160 135 }
161 136
162 137 /**
163 138 * @return array
@@ -167,9 +142,8 @@
167 142 return array();
168 143 }
169 144
170 145 $application = array();
171 -
172 146 foreach ( self::$keys as $key ) {
173 147 if ( ! isset( $this->api_data[ $key ] ) ) {
174 148 continue;
175 149 }
@@ -183,9 +157,9 @@
183 157 $application[ $key ] = array_values(
184 158 array_filter(
185 159 $value,
186 160 function ( $category ) {
187 - return ! str_contains( $category, '+Views' );
161 + return false === strpos( $category, '+Views' );
188 162 }
189 163 )
190 164 );
191 165 } else {
@@ -194,13 +168,12 @@
194 168 } elseif ( 'forms' === $key ) {
195 169 $key = 'formCount';
196 170 }
197 171
198 - if ( 'name' === $key && str_ends_with( $value, ' Template' ) ) {
172 + if ( 'name' === $key && ' Template' === substr( $value, -9 ) ) {
199 173 // Strip off the " Template" text at the end of the name as it takes up space.
200 174 $value = substr( $value, 0, -9 );
201 175 }
202 -
203 176 $application[ $key ] = $value;
204 177 }//end if
205 178 }//end foreach
206 179
@@ -207,35 +180,19 @@
207 180 $application['hasLiteThumbnail'] = in_array( $application['key'], self::$keys_with_images, true );
208 181 $application['isWebp'] = in_array( $application['key'], self::get_template_keys_with_local_webp_images(), true );
209 182
210 183 if ( ! array_key_exists( 'url', $application ) ) {
211 - $application['requires'] = FrmFormsHelper::get_plan_required( $application );
212 -
213 - if ( false === $application['requires'] ) {
214 - // Application is invalid if the URL is unavailable and there is no plan required.
215 - return array();
216 - }
217 -
218 184 $purchase_url = $this->is_available_for_purchase();
219 -
220 185 if ( false !== $purchase_url ) {
221 186 $application['forPurchase'] = true;
222 187 }
223 -
224 188 $application['upgradeUrl'] = $this->get_admin_upgrade_link();
189 + $application['requires'] = FrmFormsHelper::get_plan_required( $application );
225 190 $application['link'] = $application['upgradeUrl'];
226 191 }
227 192
228 193 $application['isNew'] = $this->is_new();
229 194
230 - $application['usedAddons'] = array();
231 -
232 - if ( isset( $application['used_addons'] ) ) {
233 - // Change key to camel case.
234 - $application['usedAddons'] = $application['used_addons'];
235 - unset( $application['used_addons'] );
236 - }
237 -
238 195 return $application;
239 196 }
240 197
241 198 /**
@@ -254,9 +211,8 @@
254 211 return false;
255 212 }
256 213
257 214 $pro = $addons[93790];
258 -
259 215 if ( ! array_key_exists( 'type', $pro ) ) {
260 216 return false;
261 217 }
262 218
@@ -264,9 +220,13 @@
264 220 $args = array(
265 221 'license_type' => $license_type,
266 222 'plan_required' => $this->get_required_license(),
267 223 );
268 - return FrmFormsHelper::plan_is_allowed( $args );
224 + if ( ! FrmFormsHelper::plan_is_allowed( $args ) ) {
225 + return false;
226 + }
227 +
228 + return true;
269 229 }
270 230
271 231 /**
272 232 * Check if an application template is new. If it is, we include a "NEW" pill beside the title.
@@ -283,9 +243,12 @@
283 243 * @return string
284 244 */
285 245 private function get_required_license() {
286 246 $required_license = strtolower( $this->api_data['min_plan'] );
287 - return 'plus' === $required_license ? 'personal' : $required_license;
247 + if ( 'plus' === $required_license ) {
248 + $required_license = 'personal';
249 + }
250 + return $required_license;
288 251 }
289 252
290 253 /**
291 254 * @return string