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

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