PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.5.3
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.5.3
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-embed-wizard.php
everest-forms / includes / admin Last commit date
builder 1 week ago form-migrator 2 months ago plugin-updates 8 years ago settings 1 week ago views 1 week ago class-evf-admin-addons.php 5 months ago class-evf-admin-assets.php 1 week 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 2 months 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-embed-wizard.php
100 lines
1 <?php
2 /**
3 * Embed Wizard.
4 *
5 * @package EverestForms/Admin
6 * @version 2.0.8
7 */
8
9 defined( 'ABSPATH' ) || exit;
10
11 /**
12 * Embed Wizard Class.
13 *
14 * @since 2.0.8
15 */
16 class EVF_Admin_Embed_Wizard {
17
18 /**
19 * Initialize class.
20 *
21 * @since 2.0.8
22 */
23 public static function init() {
24 add_filter( 'default_title', array( __CLASS__, 'set_embed_page_title' ), 10, 2 );
25 add_filter( 'default_content', array( __CLASS__, 'set_embed_page_content' ), 10, 2 );
26 }
27
28 /**
29 * Set default title for newly created pages.
30 *
31 * @since 2.0.8
32 *
33 * @param string $post_title Default post title.
34 * @param \WP_Post $post Post object.
35 */
36 public static function set_embed_page_title( $post_title, $post ) {
37
38 $meta = self::get_meta();
39
40 self::delete_meta();
41
42 return empty( $meta['embed_page_title'] ) ? $post_title : $meta['embed_page_title'];
43 }
44
45 /**
46 * Insert the form into the new page.
47 *
48 * @since 2.0.8
49 * @param string $post_content Default post content.
50 * @param \WP_Post $post Post object.
51 */
52 public static function set_embed_page_content( $post_content, $post ) {
53 $meta = self::get_meta();
54
55 $form_id = ! empty( $meta['form_id'] ) ? $meta['form_id'] : 0;
56 $page_id = ! empty( $meta['embed_page'] ) ? $meta['embed_page'] : 0;
57
58 if ( ! empty( $page_id ) || empty( $form_id ) ) {
59 return $post_content;
60 }
61 $pattern = '[everest_form id="%d"]';
62
63 return sprintf( $pattern, absint( $form_id ) );
64 }
65
66
67 /**
68 * Set user's embed meta data for Everest Forms.
69 *
70 * @since 2.0.8
71 * @param array $data Data array to set as embed meta data.
72 */
73 public static function set_meta( $data ) {
74 update_user_meta( get_current_user_id(), 'everest_forms_form_embed', $data );
75 }
76
77
78 /**
79 * Get user's embed meta data for Everest Forms.
80 *
81 * @since 2.0.8
82 * @return array User's embed meta data for Everest Forms.
83 */
84 public static function get_meta() {
85
86 return get_user_meta( get_current_user_id(), 'everest_forms_form_embed', true );
87 }
88
89 /**
90 * Delete user's embed meta data for Everest Forms.
91 *
92 * @since 2.0.8
93 */
94 public static function delete_meta() {
95
96 delete_user_meta( get_current_user_id(), 'everest_forms_form_embed' );
97 }
98 }
99 EVF_Admin_Embed_Wizard::init();
100