PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 2.0.3
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v2.0.3
3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / includes / admin / class-evf-admin-form-templates.php
everest-forms / includes / admin Last commit date
builder 2 years ago plugin-updates 8 years ago settings 2 years ago views 2 years ago class-evf-admin-addons.php 4 years ago class-evf-admin-assets.php 2 years ago class-evf-admin-builder.php 7 years ago class-evf-admin-deactivation-feedback.php 3 years ago class-evf-admin-editor.php 4 years ago class-evf-admin-entries-table-list.php 3 years ago class-evf-admin-entries.php 4 years ago class-evf-admin-form-templates.php 3 years ago class-evf-admin-forms-table-list.php 3 years ago class-evf-admin-forms.php 3 years ago class-evf-admin-import-export.php 4 years ago class-evf-admin-menus.php 2 years ago class-evf-admin-notices.php 3 years ago class-evf-admin-settings.php 2 years ago class-evf-admin-tools.php 4 years ago class-evf-admin-welcome.php 2 years ago class-evf-admin.php 2 years ago evf-admin-functions.php 3 years ago
class-evf-admin-form-templates.php
109 lines
1 <?php
2 /**
3 * EverestForms Form Templates
4 *
5 * @package EverestForms /Admin/Form Templates
6 * @version 1.0.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12 /**
13 * EVF_Admin_Form_Templates class
14 */
15 class EVF_Admin_Form_Templates {
16
17 /**
18 * Get default template.
19 *
20 * @return array
21 */
22 private static function get_default_template() {
23 $template = new stdClass();
24 $template->title = __( 'Start From Scratch', 'everest-forms' );
25 $template->slug = 'blank';
26 $template->image = untrailingslashit( plugin_dir_url( EVF_PLUGIN_FILE ) ) . '/assets/images/templates/blank.png';
27 $template->plan = array( 'free', 'premium' );
28
29 return array( $template );
30 }
31
32 /**
33 * Get section content for the template screen.
34 *
35 * @return array
36 */
37 public static function get_template_data() {
38 $template_data = get_transient( 'evf_template_section_list' );
39
40 $template_url = 'https://d3m99fsxk070py.cloudfront.net/';
41
42 if ( false === $template_data ) {
43
44 $template_json_url = $template_url . 'templates.json';
45 try {
46 $content = wp_remote_get( $template_json_url );
47 $content_json = wp_remote_retrieve_body( $content );
48
49 $template_data = json_decode( $content_json );
50 } catch ( Exception $e ) {
51
52 }
53
54 // Removing directory so the templates can be reinitialized.
55 $folder_path = untrailingslashit( plugin_dir_path( EVF_PLUGIN_FILE ) . '/assets/images/templates' );
56 if ( isset( $template_data->templates ) ) {
57
58 foreach ( $template_data->templates as $template_tuple ) {
59
60 $image_url = isset( $template_tuple->image ) ? $template_tuple->image : ( $template_url . 'images/' . $template_tuple->slug . '.png' );
61
62 $template_tuple->image = $image_url;
63
64 $temp_name = explode( '/', $image_url );
65 $relative_path = $folder_path . '/' . end( $temp_name );
66 $exists = file_exists( $relative_path );
67
68 // If it exists, utilize this file instead of remote file.
69 if ( $exists ) {
70 $template_tuple->image = untrailingslashit( plugin_dir_url( EVF_PLUGIN_FILE ) ) . '/assets/images/templates/' . untrailingslashit( $template_tuple->slug ) . '.png';
71 }
72 }
73
74 set_transient( 'evf_template_section_list', $template_data, WEEK_IN_SECONDS );
75 }
76 }
77
78 return isset( $template_data->templates ) ? apply_filters( 'everest_forms_template_section_data', $template_data->templates ) : self::get_default_template();
79 }
80
81 /**
82 * Load the template view.
83 *
84 * @since 1.0.0
85 */
86 public static function load_template_view() {
87
88 $templates = array();
89 $refresh_url = add_query_arg(
90 array(
91 'page' => 'evf-builder&create-form=1',
92 'action' => 'evf-template-refresh',
93 'evf-template-nonce' => wp_create_nonce( 'refresh' ),
94 ),
95 admin_url( 'admin.php' )
96 );
97 $license_plan = evf_get_license_plan();
98 $current_section = isset( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : '_all'; // phpcs:ignore WordPress.Security.NonceVerification
99
100 if ( '_featured' !== $current_section ) {
101 $category = isset( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : 'free'; // phpcs:ignore WordPress.Security.NonceVerification
102 $templates = self::get_template_data( $category );
103 }
104
105 // Forms template area.
106 include_once dirname( __FILE__ ) . '/views/html-admin-page-form-templates.php';
107 }
108 }
109