| @@ -38,44 +38,20 @@ | ||
| 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 | - self::$keys_with_images = array_merge( | |
| 45 | - self::get_template_keys_with_local_png_images(), | |
| 46 | - self::get_template_keys_with_local_webp_images() | |
| 47 | - ); | |
| 44 | + self::$keys_with_images = self::get_template_keys_with_local_images(); | |
| 48 | 45 | self::$categories = array(); |
| 49 | 46 | } |
| 50 | 47 | |
| 51 | 48 | /** |
| 52 | - * Newer templates now use .webp files instead of .png. | |
| 53 | - * | |
| 54 | - * @since 6.16 | |
| 55 | - * | |
| 56 | - * @return array<string> | |
| 57 | - */ | |
| 58 | - private static function get_template_keys_with_local_webp_images() { | |
| 59 | - return array( | |
| 60 | - 'member-directory', | |
| 61 | - 'link-in-bio-instagram', | |
| 62 | - 'letter-of-recommendation', | |
| 63 | - 'invoice-pdf', | |
| 64 | - 'freelance-invoice-generator', | |
| 65 | - 'contract-agreement', | |
| 66 | - 'charity-tracker', | |
| 67 | - 'certificate', | |
| 68 | - 'testimonials', | |
| 69 | - ); | |
| 70 | - } | |
| 71 | - | |
| 72 | - /** | |
| 73 | 49 | * Return the template keys that have embedded images. Otherwise, we want to avoid trying to load the URL and use the placeholder instead. |
| 74 | 50 | * |
| 75 | 51 | * @return array<string> |
| 76 | 52 | */ |
| 77 | - private static function get_template_keys_with_local_png_images() { | |
| 53 | + private static function get_template_keys_with_local_images() { | |
| 78 | 54 | return array( |
| 79 | 55 | 'business-hours', |
| 80 | 56 | 'faq-template-wordpress', |
| 81 | 57 | 'restaurant-menu', |
| @@ -81,30 +57,8 @@ | ||
| 81 | 57 | 'restaurant-menu', |
| 82 | 58 | 'team-directory', |
| 83 | 59 | 'product-review', |
| 84 | 60 | 'real-estate-listings', |
| 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 | 61 | ); |
| 108 | 62 | } |
| 109 | 63 | |
| 110 | 64 | /** |
| @@ -144,9 +98,9 @@ | ||
| 144 | 98 | private static function category_matches_a_license_type( $category ) { |
| 145 | 99 | if ( false !== strpos( $category, '+Views' ) ) { |
| 146 | 100 | return true; |
| 147 | 101 | } |
| 148 | - return in_array( $category, FrmFormsHelper::get_license_types(), true ); | |
| 102 | + return in_array( $category, FrmFormsHelper::ignore_template_categories(), true ); | |
| 149 | 103 | } |
| 150 | 104 | |
| 151 | 105 | /** |
| 152 | 106 | * @return array<string> |
| @@ -151,9 +105,9 @@ | ||
| 151 | 105 | /** |
| 152 | 106 | * @return array<string> |
| 153 | 107 | */ |
| 154 | 108 | public static function get_categories() { |
| 155 | - return self::$categories ?? array(); | |
| 109 | + return isset( self::$categories ) ? self::$categories : array(); | |
| 156 | 110 | } |
| 157 | 111 | |
| 158 | 112 | /** |
| 159 | 113 | * @return array |
| @@ -198,35 +152,21 @@ | ||
| 198 | 152 | }//end if |
| 199 | 153 | }//end foreach |
| 200 | 154 | |
| 201 | 155 | $application['hasLiteThumbnail'] = in_array( $application['key'], self::$keys_with_images, true ); |
| 202 | - $application['isWebp'] = in_array( $application['key'], self::get_template_keys_with_local_webp_images(), true ); | |
| 203 | 156 | |
| 204 | 157 | if ( ! array_key_exists( 'url', $application ) ) { |
| 205 | - $application['requires'] = FrmFormsHelper::get_plan_required( $application ); | |
| 206 | - | |
| 207 | - if ( false === $application['requires'] ) { | |
| 208 | - // Application is invalid if the URL is unavailable and there is no plan required. | |
| 209 | - return array(); | |
| 210 | - } | |
| 211 | - | |
| 212 | 158 | $purchase_url = $this->is_available_for_purchase(); |
| 213 | 159 | if ( false !== $purchase_url ) { |
| 214 | 160 | $application['forPurchase'] = true; |
| 215 | 161 | } |
| 216 | 162 | $application['upgradeUrl'] = $this->get_admin_upgrade_link(); |
| 163 | + $application['requires'] = FrmFormsHelper::get_plan_required( $application ); | |
| 217 | 164 | $application['link'] = $application['upgradeUrl']; |
| 218 | 165 | } |
| 219 | 166 | |
| 220 | 167 | $application['isNew'] = $this->is_new(); |
| 221 | 168 | |
| 222 | - $application['usedAddons'] = array(); | |
| 223 | - if ( isset( $application['used_addons'] ) ) { | |
| 224 | - // Change key to camel case. | |
| 225 | - $application['usedAddons'] = $application['used_addons']; | |
| 226 | - unset( $application['used_addons'] ); | |
| 227 | - } | |
| 228 | - | |
| 229 | 169 | return $application; |
| 230 | 170 | } |
| 231 | 171 | |
| 232 | 172 | /** |
| @@ -292,8 +232,8 @@ | ||
| 292 | 232 | array( |
| 293 | 233 | 'content' => 'upgrade', |
| 294 | 234 | 'medium' => 'applications', |
| 295 | 235 | ), |
| 296 | - 'view-templates/' . $this->api_data['slug'] | |
| 236 | + '/view-templates/' . $this->api_data['slug'] | |
| 297 | 237 | ); |
| 298 | 238 | } |
| 299 | 239 | } |