PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / trunk
Secure Custom Fields vtrunk
6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / includes / third-party.php
secure-custom-fields / includes Last commit date
Blocks 1 week ago Datastore 1 month ago Meta 1 year ago abilities 1 week ago admin 1 week ago ajax 1 month ago api 2 hours ago fields 2 hours ago forms 2 hours ago legacy 1 year ago locations 1 year ago post-types 2 months ago rest-api 1 week ago walkers 1 year ago acf-bidirectional-functions.php 1 year ago acf-field-functions.php 2 months ago acf-field-group-functions.php 7 months ago acf-form-functions.php 1 year ago acf-helper-functions.php 1 year ago acf-hook-functions.php 1 year ago acf-input-functions.php 7 months ago acf-internal-post-type-functions.php 7 months ago acf-meta-functions.php 2 weeks ago acf-post-functions.php 1 year ago acf-post-type-functions.php 1 year ago acf-taxonomy-functions.php 1 year ago acf-user-functions.php 1 week ago acf-utility-functions.php 1 year ago acf-value-functions.php 1 year ago acf-wp-functions.php 2 hours ago assets.php 1 week ago blocks-auto-inline-editing.php 2 months ago blocks.php 2 weeks ago class-acf-data.php 10 months ago class-acf-internal-post-type.php 1 week ago class-acf-options-page.php 1 year ago class-acf-site-health.php 3 months ago class-scf-json-schema-validator.php 6 months ago class-scf-schema-builder.php 2 months ago compatibility.php 1 year ago datastore.php 1 month ago deprecated.php 1 year ago fields.php 10 months ago index.php 1 year ago l10n.php 1 year ago local-fields.php 1 year ago local-json.php 1 month ago local-meta.php 1 year ago locations.php 1 year ago loop.php 10 months ago media.php 1 year ago rest-api.php 10 months ago revisions.php 1 month ago scf-ui-options-page-functions.php 1 year ago third-party.php 7 months ago upgrades.php 2 weeks ago validation.php 10 months ago wpml.php 1 year ago
third-party.php
153 lines
1 <?php
2 /**
3 * ACF 3rd Party Compatibility Class
4 *
5 * All the logic for 3rd party functionality
6 *
7 * @package ACF
8 * @subpackage Core
9 */
10
11 if ( ! class_exists( 'acf_third_party' ) ) :
12
13 /**
14 * ACF 3rd Party Compatibility Class
15 */
16 class acf_third_party {
17
18 /**
19 * This function will setup the class functionality
20 *
21 * @since ACF 5.0.0
22 */
23 public function __construct() {
24 // Tabify Edit Screen - http://wordpress.org/extend/plugins/tabify-edit-screen/
25 if ( class_exists( 'Tabify_Edit_Screen' ) ) {
26 add_filter( 'tabify_posttypes', array( $this, 'tabify_posttypes' ) );
27 add_action( 'tabify_add_meta_boxes', array( $this, 'tabify_add_meta_boxes' ) );
28 }
29
30 // Post Type Switcher - http://wordpress.org/extend/plugins/post-type-switcher/
31 if ( class_exists( 'Post_Type_Switcher' ) ) {
32 add_filter( 'pts_allowed_pages', array( $this, 'pts_allowed_pages' ) );
33 }
34
35 // Event Espresso - https://wordpress.org/plugins/event-espresso-decaf/
36 if ( function_exists( 'espresso_version' ) ) {
37 add_filter( 'acf/get_post_types', array( $this, 'ee_get_post_types' ), 10, 2 );
38 }
39
40 // Dark Mode
41 if ( class_exists( 'Dark_Mode' ) ) {
42 add_action( 'doing_dark_mode', array( $this, 'doing_dark_mode' ) );
43 }
44 }
45
46 /**
47 * Event Espresso post types do not use the native post.php edit page, but instead render their own.
48 * Show the EE post types in lists where 'show_ui' is used.
49 *
50 * @date 24/2/18
51 * @since ACF 5.6.9
52 *
53 * @param array $post_types Post types array.
54 * @param array $args Other arguments array.
55 * @return array
56 */
57 public function ee_get_post_types( $post_types, $args ) {
58 if ( ! empty( $args['show_ui'] ) ) {
59 $ee_post_types = get_post_types( array( 'show_ee_ui' => 1 ) );
60 $ee_post_types = array_keys( $ee_post_types );
61 $post_types = array_merge( $post_types, $ee_post_types );
62 $post_types = array_unique( $post_types );
63 }
64
65 return $post_types;
66 }
67
68 /**
69 * This function removes ACF post types from the tabify edit screen (post type selection sidebar)
70 *
71 * @since ACF 3.5.1
72 *
73 * @param array $posttypes An array of post types supported by tabify.
74 * @return array
75 */
76 public function tabify_posttypes( $posttypes ) {
77 // unset ACF post types
78 unset( $posttypes['acf-field-group'] );
79 unset( $posttypes['acf-field'] );
80
81 return $posttypes;
82 }
83
84
85 /**
86 * This function creates dummy metaboxes on the tabify edit screen page
87 *
88 * @since ACF 3.5.1
89 *
90 * @param string $post_type The name of the displayed post type.
91 */
92 public function tabify_add_meta_boxes( $post_type ) {
93 // get field groups
94 $field_groups = acf_get_field_groups();
95
96 if ( ! empty( $field_groups ) ) {
97 foreach ( $field_groups as $field_group ) {
98
99 // vars
100 $id = "acf-{$field_group['key']}";
101 $title = 'ACF: ' . acf_esc_html( acf_get_field_group_title( $field_group ) );
102
103 // add meta box
104 add_meta_box( $id, $title, '__return_true', $post_type );
105 }
106 }
107 }
108
109
110 /**
111 * This filter will prevent PTS from running on the field group page
112 *
113 * @since ACF 5.0.0
114 *
115 * @param array $pages An array of pages PTS should run on.
116 * @return array
117 */
118 public function pts_allowed_pages( $pages ) {
119
120 // vars
121 $post_type = '';
122
123 // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Verified elsewhere.
124 // check $_GET because it is too early to use functions / global vars.
125 if ( ! empty( $_GET['post_type'] ) ) {
126 $post_type = sanitize_text_field( $_GET['post_type'] );
127 } elseif ( ! empty( $_GET['post'] ) ) {
128 $post_type = get_post_type( $_GET['post'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized when get_post_type() calls get_post().
129 }
130 // phpcs:enable WordPress.Security.NonceVerification.Recommended
131 // check post type
132 if ( $post_type == 'acf-field-group' ) {
133 $pages = array();
134 }
135
136 // return
137 return $pages;
138 }
139
140 /**
141 * Runs during 'admin_enqueue_scripts' if dark mode is enabled
142 *
143 * @since ACF 5.7.3
144 */
145 public function doing_dark_mode() {
146 $min = defined( 'SCF_DEVELOPMENT_MODE' ) && SCF_DEVELOPMENT_MODE ? '' : '.min';
147 wp_enqueue_style( 'acf-dark', acf_get_url( 'assets/css/acf-dark' . $min . '.css' ), array(), ACF_VERSION );
148 }
149 }
150
151 new acf_third_party();
152 endif;
153