| @@ -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 | |
| @@ -215,13 +188,11 @@ | ||
| 215 | 188 | return array(); |
| 216 | 189 | } |
| 217 | 190 | |
| 218 | 191 | $purchase_url = $this->is_available_for_purchase(); |
| 219 | - | |
| 220 | 192 | if ( false !== $purchase_url ) { |
| 221 | 193 | $application['forPurchase'] = true; |
| 222 | 194 | } |
| 223 | - | |
| 224 | 195 | $application['upgradeUrl'] = $this->get_admin_upgrade_link(); |
| 225 | 196 | $application['link'] = $application['upgradeUrl']; |
| 226 | 197 | } |
| 227 | 198 | |
| @@ -227,9 +198,8 @@ | ||
| 227 | 198 | |
| 228 | 199 | $application['isNew'] = $this->is_new(); |
| 229 | 200 | |
| 230 | 201 | $application['usedAddons'] = array(); |
| 231 | - | |
| 232 | 202 | if ( isset( $application['used_addons'] ) ) { |
| 233 | 203 | // Change key to camel case. |
| 234 | 204 | $application['usedAddons'] = $application['used_addons']; |
| 235 | 205 | unset( $application['used_addons'] ); |
| @@ -254,9 +224,8 @@ | ||
| 254 | 224 | return false; |
| 255 | 225 | } |
| 256 | 226 | |
| 257 | 227 | $pro = $addons[93790]; |
| 258 | - | |
| 259 | 228 | if ( ! array_key_exists( 'type', $pro ) ) { |
| 260 | 229 | return false; |
| 261 | 230 | } |
| 262 | 231 | |
| @@ -264,9 +233,13 @@ | ||
| 264 | 233 | $args = array( |
| 265 | 234 | 'license_type' => $license_type, |
| 266 | 235 | 'plan_required' => $this->get_required_license(), |
| 267 | 236 | ); |
| 268 | - return FrmFormsHelper::plan_is_allowed( $args ); | |
| 237 | + if ( ! FrmFormsHelper::plan_is_allowed( $args ) ) { | |
| 238 | + return false; | |
| 239 | + } | |
| 240 | + | |
| 241 | + return true; | |
| 269 | 242 | } |
| 270 | 243 | |
| 271 | 244 | /** |
| 272 | 245 | * Check if an application template is new. If it is, we include a "NEW" pill beside the title. |
| @@ -283,9 +256,12 @@ | ||
| 283 | 256 | * @return string |
| 284 | 257 | */ |
| 285 | 258 | private function get_required_license() { |
| 286 | 259 | $required_license = strtolower( $this->api_data['min_plan'] ); |
| 287 | - return 'plus' === $required_license ? 'personal' : $required_license; | |
| 260 | + if ( 'plus' === $required_license ) { | |
| 261 | + $required_license = 'personal'; | |
| 262 | + } | |
| 263 | + return $required_license; | |
| 288 | 264 | } |
| 289 | 265 | |
| 290 | 266 | /** |
| 291 | 267 | * @return string |