PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.5.2
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.5.2
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 / class-evf-post-types.php
everest-forms / includes Last commit date
Helpers 11 months ago Integrations 2 weeks ago RestApi 4 days ago abilities 3 weeks ago abstracts 4 days ago admin 4 days ago blocks 1 year ago elementor 2 years ago export 2 months ago fields 3 weeks ago interfaces 8 years ago libraries 2 years ago log-handlers 1 year ago shortcodes 3 weeks ago stats 5 months ago templates 3 months ago traits 3 weeks ago class-everest-forms.php 4 days ago class-evf-addon-upsell.php 3 weeks ago class-evf-ajax.php 3 weeks ago class-evf-autoloader.php 7 years ago class-evf-background-process-import-entries.php 2 years ago class-evf-background-updater.php 7 years ago class-evf-cache-helper.php 2 months ago class-evf-cron.php 2 years ago class-evf-deprecated-action-hooks.php 6 years ago class-evf-deprecated-filter-hooks.php 5 years ago class-evf-email-entries-report.php 3 months ago class-evf-emails.php 3 weeks ago class-evf-fields.php 3 weeks ago class-evf-form-handler.php 3 weeks ago class-evf-form-task.php 3 weeks ago class-evf-forms-features.php 3 weeks ago class-evf-frontend-scripts.php 3 weeks ago class-evf-install.php 2 months ago class-evf-integrations.php 3 months ago class-evf-log-levels.php 8 years ago class-evf-logger.php 5 years ago class-evf-post-types.php 1 year ago class-evf-privacy.php 6 years ago class-evf-report-cron.php 2 months ago class-evf-reporting.php 2 months ago class-evf-session-handler.php 7 years ago class-evf-shortcodes.php 1 year ago class-evf-smart-tags.php 9 months ago class-evf-template-loader.php 1 year ago class-evf-validation.php 6 years ago evf-conditional-functions.php 6 years ago evf-core-functions.php 3 weeks ago evf-deprecated-functions.php 6 years ago evf-entry-functions.php 4 months ago evf-formatting-functions.php 4 years ago evf-notice-functions.php 4 years ago evf-template-functions.php 4 years ago evf-template-hooks.php 7 years ago evf-update-functions.php 5 years ago
class-evf-post-types.php
175 lines
1 <?php
2 /**
3 * Post Types
4 *
5 * Registers post types and taxonomies.
6 *
7 * @package EverestForms\Classes
8 * @version 1.0.0
9 */
10
11 defined( 'ABSPATH' ) || exit;
12
13 /**
14 * Post types Class.
15 */
16 class EVF_Post_Types {
17
18 /**
19 * Tags taxonomy.
20 *
21 * @since 3.2.0
22 */
23 const TAGS_TAXONOMY = 'evf_form_tags';
24
25 /**
26 * Hook in methods.
27 */
28 public static function init() {
29 add_action( 'init', array( __CLASS__, 'register_taxonomy' ) );
30 add_action( 'init', array( __CLASS__, 'register_post_types' ), 5 );
31 add_action( 'admin_bar_menu', array( __CLASS__, 'admin_bar_menus' ), 100 );
32 add_action( 'everest_forms_after_register_post_type', array( __CLASS__, 'maybe_flush_rewrite_rules' ) );
33 add_action( 'everest_forms_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) );
34 }
35
36 /**
37 * Register core post types.
38 */
39 public static function register_post_types() {
40 if ( ! is_blog_installed() || post_type_exists( 'everest_form' ) ) {
41 return;
42 }
43
44 do_action( 'everest_forms_register_post_type' );
45
46 register_post_type(
47 'everest_form',
48 apply_filters(
49 'everest_forms_register_post_type_product',
50 array(
51 'labels' => array(
52 'name' => __( 'Everest Forms', 'everest-forms' ),
53 'singular_name' => __( 'Form', 'everest-forms' ),
54 'all_items' => __( 'All Forms', 'everest-forms' ),
55 'menu_name' => _x( 'Forms', 'Admin menu name', 'everest-forms' ),
56 'add_new' => __( 'Add New', 'everest-forms' ),
57 'add_new_item' => __( 'Add new form', 'everest-forms' ),
58 'edit' => __( 'Edit', 'everest-forms' ),
59 'edit_item' => __( 'Edit form', 'everest-forms' ),
60 'new_item' => __( 'New form', 'everest-forms' ),
61 'view_item' => __( 'View form', 'everest-forms' ),
62 'search_items' => __( 'Search forms', 'everest-forms' ),
63 'not_found' => __( 'No forms found', 'everest-forms' ),
64 'not_found_in_trash' => __( 'No forms found in trash', 'everest-forms' ),
65 'parent' => __( 'Parent forms', 'everest-forms' ),
66 'featured_image' => __( 'Form image', 'everest-forms' ),
67 'set_featured_image' => __( 'Set form image', 'everest-forms' ),
68 'remove_featured_image' => __( 'Remove form image', 'everest-forms' ),
69 'use_featured_image' => __( 'Use as form image', 'everest-forms' ),
70 'insert_into_item' => __( 'Insert into form', 'everest-forms' ),
71 'uploaded_to_this_item' => __( 'Uploaded to this form', 'everest-forms' ),
72 'filter_items_list' => __( 'Filter forms', 'everest-forms' ),
73 'items_list_navigation' => __( 'Forms navigation', 'everest-forms' ),
74 'items_list' => __( 'Forms list', 'everest-forms' ),
75 ),
76 'public' => false,
77 'show_ui' => true,
78 'description' => __( 'This is where you can add new forms.', 'everest-forms' ),
79 'capability_type' => 'post',
80 'publicly_queryable' => false,
81 'exclude_from_search' => true,
82 'show_in_rest' => true,
83 'show_in_menu' => false,
84 'hierarchical' => false,
85 'rewrite' => false,
86 'query_var' => false,
87 'supports' => false,
88 'show_in_nav_menus' => false,
89 'show_in_admin_bar' => false,
90 )
91 )
92 );
93
94 do_action( 'everest_forms_after_register_post_type' );
95 }
96
97 /**
98 * Add "Everest Forms" link in admin bar main menu.
99 *
100 * @since 1.2.0
101 * @param WP_Admin_Bar $wp_admin_bar Admin bar instance.
102 */
103 public static function admin_bar_menus( $wp_admin_bar ) {
104 if ( ! is_admin_bar_showing() || ! current_user_can( 'manage_everest_forms' ) ) {
105 return;
106 }
107
108 // Show only when the user is a member of this site, or they're a super admin.
109 if ( ! is_user_member_of_blog() && ! is_super_admin() ) {
110 return;
111 }
112
113 // Add an option to create new form.
114 if ( apply_filters( 'everest_forms_show_admin_bar_menus', true ) ) {
115 $wp_admin_bar->add_node(
116 array(
117 'parent' => 'new-content',
118 'id' => 'everest-forms',
119 'title' => __( 'Everest Forms', 'everest-forms' ),
120 'href' => admin_url( 'admin.php?page=evf-builder&create-form=1' ),
121 )
122 );
123 }
124 }
125
126 /**
127 * Flush rules if the event is queued.
128 *
129 * @since 1.2.0
130 */
131 public static function maybe_flush_rewrite_rules() {
132 if ( 'yes' === get_option( 'everest_forms_queue_flush_rewrite_rules' ) ) {
133 update_option( 'everest_forms_queue_flush_rewrite_rules', 'no' );
134 self::flush_rewrite_rules();
135 }
136 }
137
138 /**
139 * Flush rewrite rules.
140 */
141 public static function flush_rewrite_rules() {
142 flush_rewrite_rules();
143 }
144
145
146 /**
147 * Register the new taxonomy for tags.
148 *
149 * @since 3.2.0
150 */
151 public static function register_taxonomy() {
152
153 /**
154 * Filters Tags taxonomy arguments.
155 *
156 * @since 3.2.0
157 *
158 * @param array $args Arguments.
159 */
160 $args = apply_filters(
161 'evf_form_handler_register_taxonomy_args',
162 array(
163 'hierarchical' => false,
164 'rewrite' => false,
165 'public' => false,
166 )
167 );
168
169 register_taxonomy( self::TAGS_TAXONOMY, 'everest_form', $args );
170 }
171
172 }
173
174 EVF_Post_Types::init();
175