PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.6.0
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.6.0
3.6.0 3.5.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 3 days ago form-migrator 2 months ago plugin-updates 8 years ago settings 1 week ago views 3 days ago class-evf-admin-addons.php 5 months ago class-evf-admin-assets.php 3 days ago class-evf-admin-builder.php 3 months ago class-evf-admin-dashboard.php 2 months ago class-evf-admin-editor.php 4 years ago class-evf-admin-embed-wizard.php 2 years ago class-evf-admin-entries-table-list.php 1 week ago class-evf-admin-entries.php 1 week ago class-evf-admin-form-templates.php 3 days ago class-evf-admin-forms-table-list.php 5 months ago class-evf-admin-forms.php 5 months ago class-evf-admin-import-export.php 2 months ago class-evf-admin-menus.php 1 week ago class-evf-admin-notices.php 5 months ago class-evf-admin-preview-confirmation.php 1 year ago class-evf-admin-settings.php 2 months ago class-evf-admin-tools.php 3 months ago class-evf-admin-welcome.php 2 years ago class-evf-admin.php 3 months ago class-evf-base-list-table.php 5 months ago evf-admin-functions.php 2 months ago
class-evf-admin-form-templates.php
119 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.q
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 $template_data = get_transient( 'evf_template_section_list' );
40
41 $template_url = 'https://assets.wpeverest.com/everestforms/forms/';
42
43 if ( false === $template_data ) {
44
45 $template_json_url = $template_url . 'templates1.json';
46 try {
47 $content = wp_remote_get( $template_json_url );
48 $content_json = wp_remote_retrieve_body( $content );
49
50 $template_data = json_decode( $content_json );
51 } catch ( Exception $e ) {
52
53 }
54
55 // Removing directory so the templates can be reinitialized.
56 $folder_path = untrailingslashit( plugin_dir_path( EVF_PLUGIN_FILE ) . '/assets/images/templates' );
57 if ( isset( $template_data->templates[0]->templates ) ) {
58
59 foreach ( $template_data->templates[0]->templates as $template_tuple ) {
60
61 $image_url = isset( $template_tuple->image ) ? $template_tuple->image : ( $template_url . 'images/' . $template_tuple->slug . '.png' );
62
63 $template_tuple->image = $image_url;
64
65 $temp_name = explode( '/', $image_url );
66 $relative_path = $folder_path . '/' . end( $temp_name );
67 $exists = file_exists( $relative_path );
68
69 // If it exists, utilize this file instead of remote file.
70 if ( $exists ) {
71 $template_tuple->image = untrailingslashit( plugin_dir_url( EVF_PLUGIN_FILE ) ) . '/assets/images/templates/' . untrailingslashit( $template_tuple->slug ) . '.png';
72 }
73 }
74
75 set_transient( 'evf_template_section_list', $template_data, WEEK_IN_SECONDS );
76 }
77 }
78
79 return isset( $template_data->templates ) ? apply_filters( 'everest_forms_template_section_data', $template_data->templates ) : self::get_default_template();
80 }
81
82 /**
83 * Load the template view.
84 *
85 * @since 1.0.0
86 */
87 public static function load_template_view() {
88 $use_react_header = apply_filters( 'everest_forms_use_react_header', true, 'forms' );
89 if ( $use_react_header ) {
90 include __DIR__ . '/views/html-admin-header-skeleton.php';
91 }
92
93 $templates_js_path = evf()->plugin_path() . '/dist/templates.min.js';
94 $templates_js_ver = file_exists( $templates_js_path ) ? filemtime( $templates_js_path ) : EVF_VERSION;
95 wp_register_script( 'evf-templates', plugins_url( 'dist/templates.min.js', EVF_PLUGIN_FILE ), array( 'wp-element', 'react', 'react-dom', 'wp-api-fetch', 'wp-i18n', 'wp-blocks' ), $templates_js_ver, true );
96 wp_localize_script(
97 'evf-templates',
98 'evf_templates_script',
99 array(
100 'security' => wp_create_nonce( 'wp_rest' ),
101 'restURL' => rest_url(),
102 // Base URL for the AI preview iframe — form_id isn't known until generation,
103 // so the full ?form_id=&evf_preview=true URL is assembled client-side.
104 'homeUrl' => home_url( '/' ),
105 // ThemeGrill AI Cloud (Python gateway) — used by the Create with AI flow.
106 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
107 'aiNonce' => wp_create_nonce( 'evf_ai_nonce' ),
108 'aiRegistered' => class_exists( 'EVF_AI_Registration' ) ? EVF_AI_Registration::is_registered() : false,
109 'aiTier' => class_exists( 'EVF_AI_Registration' ) ? EVF_AI_Registration::get_tier() : 'free',
110 // Create with AI is disabled on local / development sites (gateway cannot verify ownership).
111 'aiEnabled' => class_exists( 'EVF_AI_Registration' ) && ! EVF_AI_Registration::is_local_site(),
112 )
113 );
114 wp_enqueue_script( 'evf-templates' );
115 echo '<div id="evf-templates"></div>';
116 }
117
118 }
119