PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.20
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.20
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
formidable / classes / controllers / FrmFormTemplatesController.php

FrmFormTemplatesController.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.20, at classes/controllers/FrmFormTemplatesController.php

846 lines 22.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Form Templates Controller class.
4 *
5 * @package Formidable
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 die( 'You are not allowed to call this page directly.' );
10 }
11
12 /**
13 * Class FrmFormTemplatesController.
14 * Handles the Form Templates page in the admin area.
15 *
16 * @since 6.7
17 */
18 class FrmFormTemplatesController {
19
20 /**
21 * The slug of the Form Templates page.
22 *
23 * @var string PAGE_SLUG Unique identifier for the "Form Templates" page.
24 */
25 const PAGE_SLUG = 'formidable-form-templates';
26
27 /**
28 * The script handle.
29 *
30 * @var string SCRIPT_HANDLE Unique handle for the admin script.
31 */
32 const SCRIPT_HANDLE = 'frm-form-templates';
33
34 /**
35 * The required user capability to view form templates.
36 *
37 * @var string REQUIRED_CAPABILITY Required capability to access the view form templates.
38 */
39 const REQUIRED_CAPABILITY = 'frm_view_forms';
40
41 /**
42 * The keys of the featured templates.
43 *
44 * Contains the unique keys for the templates that are considered "featured":
45 * "Contact Us", "Stripe Payment", "User Registration", "Create WordPress Post", "Survey", and "Quiz".
46 *
47 * @var array FEATURED_TEMPLATES_KEYS Unique keys for the featured templates.
48 */
49 const FEATURED_TEMPLATES_KEYS = array( 20872734, 28223640, 20874748, 20882522, 20908981, 28109851 );
50
51 /**
52 * Option name to store favorite templates.
53 *
54 * @var string FAVORITE_TEMPLATES_OPTION Unique identifier for storing favorite templates.
55 */
56 const FAVORITE_TEMPLATES_OPTION = 'frm_favorite_templates';
57
58 /**
59 * Instance of the Form Template API handler.
60 *
61 * @var FrmFormTemplateApi Form Template API handler.
62 */
63 private static $form_template_api;
64
65 /**
66 * Templates fetched from the API.
67 *
68 * @var array Templates information from API.
69 */
70 private static $templates = array();
71
72 /**
73 * Featured templates.
74 *
75 * @var array Associative array with the featured templates' information.
76 */
77 private static $featured_templates = array();
78
79 /**
80 * List of user favorite templates.
81 *
82 * @var array List of templates that the user has marked as favorites.
83 */
84 private static $favorite_templates = array();
85
86 /**
87 * Templates fetched from the published form by user.
88 *
89 * @var array Templates information from published form.
90 */
91 private static $custom_templates = array();
92
93 /**
94 * Categories for organizing templates.
95 *
96 * @var array Categories for organizing templates.
97 */
98 private static $categories = array();
99
100 /**
101 * Status of API request, true if expired.
102 *
103 * @var bool Whether the API request is expired or not.
104 */
105 private static $is_expired = false;
106
107 /**
108 * The type of license received from the API.
109 *
110 * @var string License type received from the API.
111 */
112 private static $license_type = '';
113
114 /**
115 * Path to views.
116 *
117 * @var string Path to form templates views.
118 */
119 private static $view_path = '';
120
121 /**
122 * Upgrade URL.
123 *
124 * @var string URL for upgrading accounts.
125 */
126 private static $upgrade_link = '';
127
128 /**
129 * Renew URL.
130 *
131 * @var string URL for renewing accounts.
132 */
133 private static $renew_link = '';
134
135 /**
136 * Initialize hooks for template page only.
137 *
138 * @since 6.7
139 */
140 public static function load_admin_hooks() {
141 self::init_template_resources();
142
143 // Use the same priority as Applications so Form Templates appear directly under Applications.
144 add_action( 'admin_menu', __CLASS__ . '::menu', 14 );
145 add_action( 'admin_footer', __CLASS__ . '::render_modal' );
146 add_filter( 'frm_form_nav_list', __CLASS__ . '::append_new_template_to_nav', 10, 2 );
147
148 if ( self::is_templates_page() ) {
149 add_action( 'admin_init', __CLASS__ . '::set_form_templates_data' );
150 add_action( 'admin_enqueue_scripts', __CLASS__ . '::enqueue_assets', 15 );
151 add_filter( 'frm_show_footer_links', '__return_false' );
152 }
153 }
154
155 /**
156 * Add Form Templates menu item to sidebar and define index page.
157 *
158 * @since 6.7
159 *
160 * @return void
161 */
162 public static function menu() {
163 $label = __( 'Form Templates', 'formidable' );
164
165 add_submenu_page(
166 'formidable',
167 'Formidable | ' . $label,
168 $label,
169 self::REQUIRED_CAPABILITY,
170 self::PAGE_SLUG,
171 array( __CLASS__, 'render' )
172 );
173 }
174
175 /**
176 * Renders the Form Templates page in the WordPress admin area.
177 *
178 * Sets up template data, fetches relevant information, determines which blocks to render,
179 * and includes the view file for displaying the Form Templates page.
180 *
181 * @since 6.7
182 *
183 * @return void
184 */
185 public static function render() {
186 // Include SVG images for icons.
187 FrmAppHelper::include_svg();
188
189 $view_path = self::get_view_path();
190 $upgrade_link = self::get_upgrade_link();
191 $renew_link = self::get_renew_link();
192 $license_type = self::get_license_type();
193 $pricing = FrmAppHelper::admin_upgrade_link( 'form-templates' );
194 $expired = self::is_expired();
195
196 // Get various template types and categories.
197 $templates = self::get_templates();
198 $favorite_templates = self::get_favorite_templates();
199 $featured_templates = self::get_featured_templates();
200 $custom_templates = self::get_custom_templates();
201 $categories = self::get_categories();
202
203 include $view_path . 'index.php';
204 }
205
206 /**
207 * Renders a modal component in the WordPress admin area.
208 *
209 * @since 6.7
210 *
211 * @return void
212 */
213 public static function render_modal() {
214 $view_path = self::$view_path;
215 $view_parts = array();
216
217 // Check if the current page is the form templates page.
218 if ( self::is_templates_page() ) {
219 // User and license-related variables.
220 $user = wp_get_current_user();
221 $expired = self::is_expired();
222 $upgrade_link = self::get_upgrade_link();
223 $renew_link = self::get_renew_link();
224 $published_forms = self::get_published_forms();
225
226 // Add `create-template` modal view.
227 $view_parts[] = 'modals/create-template-modal.php';
228
229 // Add 'upgrade' modal view for non-elite users.
230 if ( 'elite' !== FrmAddonsController::license_type() ) {
231 $view_parts[] = 'modals/upgrade-modal.php';
232 }
233
234 // Add 'renew-account' modal view for expired users.
235 if ( $expired ) {
236 $view_parts[] = 'modals/renew-account-modal.php';
237 }
238 }//end if
239
240 // Check if the current page is the form builder page.
241 if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
242 $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
243
244 if ( 'edit' === $action || 'settings' === $action ) {
245 $view_parts[] = 'modals/name-your-form-modal.php';
246 }
247 }
248
249 include $view_path . 'modal.php';
250 }
251
252 /**
253 * Initializes and organizes form template data by performing the following actions:
254 * - Instantiates the Form Template API class
255 * - Retrieves and sets templates, including featured ones
256 * - Organizes and categorizes templates
257 * - Formats custom templates
258 * - Updates global variables to reflect the current state
259 *
260 * @since 6.7
261 *
262 * @return void
263 */
264 public static function set_form_templates_data() {
265 self::$form_template_api = new FrmFormTemplateApi();
266
267 self::init_favorite_templates();
268 self::fetch_and_format_custom_templates();
269 self::retrieve_and_set_templates();
270 self::organize_and_set_categories();
271 self::assign_featured_templates();
272 }
273
274 /**
275 * Initialize favorite templates from WordPress options.
276 *
277 * @since 6.7
278 *
279 * @return void
280 */
281 private static function init_favorite_templates() {
282 $default_option_structure = array(
283 'default' => array(),
284 'custom' => array(),
285 );
286
287 $favorites = get_option( self::FAVORITE_TEMPLATES_OPTION, $default_option_structure );
288 $favorites = wp_parse_args( $favorites, $default_option_structure );
289
290 // Set the favorite templates property and remove empty values.
291 self::$favorite_templates = array(
292 'default' => array_filter( (array) $favorites['default'] ),
293 'custom' => array_filter( (array) $favorites['custom'] ),
294 );
295 }
296
297 /**
298 * Handle AJAX request to add or remove favorite templates.
299 *
300 * Manages the $favorite_templates by using WordPress options to
301 * add or remove templates from the favorites list.
302 *
303 * @since 6.7
304 *
305 * @return void
306 */
307 public static function ajax_add_or_remove_favorite() {
308 // Check permission and nonce.
309 FrmAppHelper::permission_check( self::REQUIRED_CAPABILITY );
310 check_ajax_referer( 'frm_ajax', 'nonce' );
311
312 // Set up form templates environment, ensuring data is ready for processing.
313 self::set_form_templates_data();
314
315 // Get posted data.
316 $template_id = FrmAppHelper::get_post_param( 'template_id', '', 'absint' );
317 $operation = FrmAppHelper::get_post_param( 'operation', '', 'sanitize_text_field' );
318 $is_custom_template = FrmAppHelper::get_post_param( 'is_custom_template', '', 'rest_sanitize_boolean' );
319
320 // Determine the key based on whether it's a custom template or not.
321 $key = $is_custom_template ? 'custom' : 'default';
322
323 // Perform add or remove operation.
324 if ( 'add' === $operation ) {
325 self::$favorite_templates[ $key ][] = $template_id;
326 } elseif ( 'remove' === $operation ) {
327 $position = array_search( $template_id, self::$favorite_templates[ $key ], true );
328 if ( $position !== false ) {
329 unset( self::$favorite_templates[ $key ][ $position ] );
330 }
331 }
332
333 // Update the favorite templates option.
334 update_option( self::FAVORITE_TEMPLATES_OPTION, self::$favorite_templates );
335
336 // Return the updated list of favorite templates.
337 wp_send_json_success( self::$favorite_templates );
338 }
339
340 /**
341 * Create a custom template from a form.
342 *
343 * @since 6.7
344 *
345 * @return void
346 */
347 public static function ajax_create_template() {
348 // Check permission and nonce.
349 FrmAppHelper::permission_check( self::REQUIRED_CAPABILITY );
350 check_ajax_referer( 'frm_ajax', 'nonce' );
351
352 // Set up form templates environment, ensuring data is ready for processing.
353 self::set_form_templates_data();
354
355 // Get posted data.
356 $form_id = FrmAppHelper::get_param( 'xml', '', 'post', 'absint' );
357 $new_form_id = FrmForm::duplicate( $form_id, 1, true );
358
359 if ( ! $new_form_id ) {
360 // Send an error response if form duplication fails.
361 $response = array(
362 'message' => __( 'There was an error creating a template.', 'formidable' ),
363 );
364 } else {
365 FrmForm::update( $new_form_id, FrmFormsController::get_modal_values() );
366
367 // Send a success response with redirect URL.
368 $response = array(
369 'redirect' => admin_url( 'admin.php?page=formidable&frm_action=duplicate&id=' . $new_form_id ) . '&_wpnonce=' . wp_create_nonce(),
370 );
371 }
372
373 // Send response.
374 echo wp_json_encode( $response );
375 wp_die();
376 }
377
378 /**
379 * Fetch and format custom templates.
380 *
381 * Retrieves the custom templates, formats them, and assigns them to the class property.
382 *
383 * @since 6.7
384 *
385 * @return void
386 */
387 private static function fetch_and_format_custom_templates() {
388 // Get all custom templates that are not default templates.
389 $custom_templates = FrmForm::getAll(
390 array(
391 'is_template' => 1,
392 'default_template' => 0,
393 'status' => array( null, '', 'published' ),
394 ),
395 'name'
396 );
397
398 // Extract IDs from the custom templates for matching with favorite templates.
399 $custom_templates_ids = wp_list_pluck( $custom_templates, 'id' );
400
401 // Refine the list of favorite templates to include only those present in custom templates.
402 self::$favorite_templates['custom'] = array_intersect( self::$favorite_templates['custom'], $custom_templates_ids );
403
404 foreach ( $custom_templates as $template ) {
405 $template = array(
406 'id' => absint( $template->id ),
407 'name' => $template->name,
408 'key' => $template->form_key,
409 'description' => $template->description,
410 'link' => FrmForm::get_edit_link( absint( $template->id ) ),
411 'url' => wp_nonce_url( admin_url( 'admin.php?page=formidable&frm_action=duplicate&new_template=true&id=' . absint( $template->id ) ) ),
412 'released' => $template->created_at,
413 'installed' => 1,
414 'is_custom' => true,
415 'created_at' => $template->created_at,
416 );
417
418 // Mark the template as favorite if it's in the favorite templates list.
419 $template['is_favorite'] = in_array( $template['id'], self::$favorite_templates['custom'], true );
420
421 // Add the formatted template to the custom templates list.
422 array_unshift( self::$custom_templates, $template );
423 }
424 }
425
426 /**
427 * Retrieve and set templates.
428 *
429 * Gets the templates from the API and assigns them to the class property.
430 * Also handles any errors returned from the API.
431 *
432 * @since 6.7
433 *
434 * @return void
435 */
436 private static function retrieve_and_set_templates() {
437 self::$templates = self::$form_template_api->get_api_info();
438
439 self::$is_expired = FrmAddonsController::is_license_expired();
440 self::$license_type = FrmAddonsController::license_type();
441 }
442
443 /**
444 * Organize and set categories.
445 *
446 * Iterates through templates to organize categories, performs filtering, sorting,
447 * and adds special categories.
448 *
449 * @since 6.7
450 *
451 * @return void
452 */
453 private static function organize_and_set_categories() {
454 // Iterate through templates to assign categories.
455 foreach ( self::$templates as $key => &$template ) {
456 // Skip the template if the categories are not set.
457 if ( ! isset( $template['categories'] ) || ! isset( $template['id'] ) ) {
458 unset( self::$templates[ $key ] );
459 continue;
460 }
461
462 // Add a new key for category slugs.
463 $template['category_slugs'] = array();
464
465 // Increment the count for each category.
466 foreach ( $template['categories'] as $category ) {
467 $category_slug = sanitize_title( $category );
468
469 // Add the slug to the new array.
470 $template['category_slugs'][] = $category_slug;
471
472 if ( ! isset( self::$categories[ $category_slug ] ) ) {
473 self::$categories[ $category_slug ] = array(
474 'name' => $category,
475 'count' => 0,
476 );
477 }
478
479 ++self::$categories[ $category_slug ]['count'];
480 }
481
482 // Mark the template as favorite if it's in the favorite templates list.
483 $template['is_favorite'] = in_array( $template['id'], self::$favorite_templates['default'], true );
484 }//end foreach
485
486 // Unset the reference `$template` variable.
487 unset( $template );
488
489 // Filter out certain and redundant categories.
490 // 'PayPal', 'Stripe', and 'Twilio' are included elsewhere and should be ignored in this context.
491 $redundant_cats = array_merge( array( 'PayPal', 'Stripe', 'Twilio' ), FrmFormsHelper::get_license_types() );
492 foreach ( $redundant_cats as $redundant_cat ) {
493 $category_slug = sanitize_title( $redundant_cat );
494 unset( self::$categories[ $category_slug ] );
495 }
496
497 // Sort the categories by keys alphabetically.
498 ksort( self::$categories );
499
500 // Add special categories.
501 $special_categories = array(
502 'favorites' => array(
503 'name' => __( 'Favorites', 'formidable' ),
504 'count' => self::get_favorite_templates_count(),
505 ),
506 'custom' => array(
507 'name' => __( 'Custom', 'formidable' ),
508 'count' => count( self::$custom_templates ),
509 ),
510 );
511 // Add the 'Available Templates' category for non-elite users.
512 if ( 'elite' !== FrmAddonsController::license_type() ) {
513 $special_categories['available-templates'] = array(
514 'name' => __( 'Available Templates', 'formidable' ),
515 // Assigned via JavaScript.
516 'count' => 0,
517 );
518 }
519 $special_categories['all-items'] = array(
520 'name' => __( 'All Templates', 'formidable' ),
521 'count' => self::get_template_count(),
522 );
523
524 self::$categories = array_merge(
525 $special_categories,
526 self::$categories
527 );
528 }
529
530 /**
531 * Assign featured templates.
532 *
533 * Iterates through FEATURED_TEMPLATES_KEYS and adds matching templates to
534 * the `featured_templates` class property.
535 *
536 * @since 6.7
537 *
538 * @return void
539 */
540 private static function assign_featured_templates() {
541 foreach ( self::FEATURED_TEMPLATES_KEYS as $key ) {
542 if ( isset( self::$templates[ $key ] ) ) {
543 self::$templates[ $key ]['is_featured'] = true;
544 self::$featured_templates[] = self::$templates[ $key ];
545 }
546 }
547 }
548
549 /**
550 * Get the total count of favorite templates.
551 *
552 * @since 6.7
553 *
554 * @return int
555 */
556 public static function get_favorite_templates_count() {
557 $custom_count = count( self::$favorite_templates['custom'] );
558 $default_count = count( self::$favorite_templates['default'] );
559
560 return $custom_count + $default_count;
561 }
562
563 /**
564 * Initializes essential resources.
565 *
566 * @since 6.7
567 *
568 * @return void
569 */
570 private static function init_template_resources() {
571 self::$view_path = FrmAppHelper::plugin_path() . '/classes/views/form-templates/';
572
573 self::$upgrade_link = FrmAppHelper::admin_upgrade_link(
574 array(
575 'medium' => 'form-templates',
576 'content' => 'upgrade',
577 )
578 );
579
580 self::$renew_link = FrmAppHelper::admin_upgrade_link(
581 array(
582 'medium' => 'form-templates',
583 'content' => 'renew',
584 )
585 );
586 }
587
588 /**
589 * Adds a Cancel button to the header of the Form Templates page.
590 *
591 * It's hidden by default and will show when the user clicks on 'Create Form' from
592 * another place in Formidable Forms.
593 *
594 * @since 6.7
595 *
596 * @return void
597 */
598 public static function get_header_cancel_button() {
599 echo '
600 <a class="button frm-button-secondary frm_hidden" href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '" role="button">
601 ' . esc_html__( 'Cancel', 'formidable' ) . '
602 </a>';
603 }
604
605 /**
606 * Append 'new_template' query parameter to navigation links if it exists in the URL.
607 *
608 * @since 6.7
609 *
610 * @param array $nav_items Navigation items.
611 * @param array $nav_args Additional navigation arguments.
612 * @return array Modified navigation items with 'new_template' query parameter.
613 */
614 public static function append_new_template_to_nav( $nav_items, $nav_args ) {
615 $is_new_template = FrmAppHelper::simple_get( 'new_template' );
616
617 // Append 'new_template=true' to each nav item's link if 'new_template' exists in the URL.
618 if ( $is_new_template ) {
619 foreach ( $nav_items as &$item ) {
620 $item['link'] .= '&new_template=true';
621 }
622 }
623
624 return $nav_items;
625 }
626
627 /**
628 * Enqueues "Form Templates" scripts and styles.
629 *
630 * @since 6.7
631 *
632 * @return void
633 */
634 public static function enqueue_assets() {
635 $plugin_url = FrmAppHelper::plugin_url();
636 $version = FrmAppHelper::plugin_version();
637 $js_dependencies = array(
638 'wp-i18n',
639 // This prevents a console error "wp.hooks is undefined" in WP versions older than 5.7.
640 'wp-hooks',
641 'formidable_dom',
642 );
643
644 // Enqueue styles that needed.
645 wp_enqueue_style( 'formidable-admin' );
646 wp_enqueue_style( 'formidable-animations' );
647 wp_enqueue_style( 'formidable-grids' );
648
649 // Register and enqueue "Form Templates" style.
650 wp_register_style( self::SCRIPT_HANDLE, $plugin_url . '/css/admin/form-templates.css', array(), $version );
651 wp_enqueue_style( self::SCRIPT_HANDLE );
652
653 // Register and enqueue "Form Templates" script.
654 wp_register_script( self::SCRIPT_HANDLE, $plugin_url . '/js/form-templates.js', $js_dependencies, $version, true );
655 wp_localize_script( self::SCRIPT_HANDLE, 'frmFormTemplatesVars', self::get_js_variables() );
656 wp_enqueue_script( self::SCRIPT_HANDLE );
657
658 /**
659 * Fires after "Form Templates" enqueue assets.
660 *
661 * @since 6.7
662 */
663 do_action( 'frm_form_templates_enqueue_assets' );
664
665 FrmAppHelper::dequeue_extra_global_scripts();
666 }
667
668 /**
669 * Get "Form Templates" JS variables as an array.
670 *
671 * @since 6.7
672 *
673 * @return array
674 */
675 private static function get_js_variables() {
676 $js_variables = array(
677 'FEATURED_TEMPLATES_KEYS' => self::FEATURED_TEMPLATES_KEYS,
678 'templatesCount' => self::get_template_count(),
679 'favoritesCount' => array(
680 'total' => self::get_favorite_templates_count(),
681 'default' => count( self::$favorite_templates['default'] ),
682 'custom' => count( self::$favorite_templates['custom'] ),
683 ),
684 'customCount' => count( self::$custom_templates ),
685 'upgradeLink' => self::$upgrade_link,
686 );
687
688 /**
689 * Filters `js_variables` passed to the "Form Templates".
690 *
691 * @since 6.7
692 *
693 * @param array $js_variables Array of js_variables passed to "Form Templates".
694 */
695 return apply_filters( 'frm_form_templates_js_variables', $js_variables );
696 }
697
698 /**
699 * Check if the current page is the form templates page.
700 *
701 * @since 6.7
702 *
703 * @return bool True if the current page is the form templates page, false otherwise.
704 */
705 public static function is_templates_page() {
706 return FrmAppHelper::is_admin_page( self::PAGE_SLUG );
707 }
708
709 /**
710 * Get the list of templates.
711 *
712 * @since 6.7
713 *
714 * @return array A list of templates.
715 */
716 public static function get_templates() {
717 return self::$templates;
718 }
719
720 /**
721 * Get the total number of templates.
722 *
723 * @since 6.8
724 *
725 * @return int
726 */
727 public static function get_template_count() {
728 if ( empty( self::$templates ) ) {
729 self::$form_template_api = new FrmFormTemplateApi();
730 self::retrieve_and_set_templates();
731 }
732 return count( self::$templates );
733 }
734
735 /**
736 * Get the published forms based on applied filters.
737 *
738 * @since 6.7
739 *
740 * @return array An array of published forms.
741 */
742 public static function get_published_forms() {
743 $where = apply_filters( 'frm_forms_dropdown', array(), '' );
744 return FrmForm::get_published_forms( $where );
745 }
746
747 /**
748 * Get the list of featured templates.
749 *
750 * @since 6.7
751 *
752 * @return array A list of featured templates.
753 */
754 public static function get_featured_templates() {
755 return self::$featured_templates;
756 }
757
758 /**
759 * Get the list of categories.
760 *
761 * @since 6.7
762 *
763 * @return array A list of categories.
764 */
765 public static function get_categories() {
766 return self::$categories;
767 }
768
769 /**
770 * Get the user's favorite form templates.
771 *
772 * @since 6.7
773 *
774 * @return array The IDs of the user's favorite form templates.
775 */
776 public static function get_favorite_templates() {
777 return self::$favorite_templates;
778 }
779
780 /**
781 * Get the list of custom templates.
782 *
783 * @since 6.7
784 *
785 * @return array A list of custom templates.
786 */
787 public static function get_custom_templates() {
788 return self::$custom_templates;
789 }
790
791 /**
792 * Get the license type.
793 *
794 * @since 6.7
795 *
796 * @return string The license type.
797 */
798 public static function get_license_type() {
799 return self::$license_type;
800 }
801
802 /**
803 * Checks if the API request was expired.
804 *
805 * @since 6.7
806 *
807 * @return bool True if the API request was expired, false otherwise.
808 */
809 public static function is_expired() {
810 return self::$is_expired;
811 }
812
813 /**
814 * Get the path to form templates views.
815 *
816 * @since 6.7
817 *
818 * @return string Path to views.
819 */
820 public static function get_view_path() {
821 return self::$view_path;
822 }
823
824 /**
825 * Get the upgrade link.
826 *
827 * @since 6.7
828 *
829 * @return string URL for upgrading accounts.
830 */
831 public static function get_upgrade_link() {
832 return self::$upgrade_link;
833 }
834
835 /**
836 * Get the renewal link.
837 *
838 * @since 6.7
839 *
840 * @return string URL for renewing accounts.
841 */
842 public static function get_renew_link() {
843 return self::$renew_link;
844 }
845 }
846