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.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.4.10 4.4.11 4.4.12 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 5.10 5.10.1 5.10.2 5.11 5.11.1 5.11.2 5.11.3 5.11.4 5.12 5.12.1 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.6.10 5.6.2 5.6.3 5.6.4 5.6.5 5.6.6 5.6.7 5.6.8 5.6.9 5.7.0 5.7.1 5.7.10 5.7.12 5.7.13 5.7.2 5.7.3 5.7.4 5.7.5 5.7.6 5.7.7 5.7.8 5.7.9 5.8.0 5.8.1 5.8.10 5.8.11 5.8.12 5.8.13 5.8.14 5.8.2 5.8.3 5.8.4
advanced-custom-fields / includes / third-party.php
advanced-custom-fields / includes Last commit date
admin 2 years ago ajax 2 years ago api 2 years ago fields 2 years ago forms 2 years ago legacy 2 years ago locations 2 years ago post-types 2 years ago rest-api 2 years ago walkers 2 years ago acf-bidirectional-functions.php 2 years ago acf-field-functions.php 2 years ago acf-field-group-functions.php 2 years ago acf-form-functions.php 2 years ago acf-helper-functions.php 2 years ago acf-hook-functions.php 2 years ago acf-input-functions.php 2 years ago acf-internal-post-type-functions.php 2 years ago acf-meta-functions.php 2 years ago acf-post-functions.php 4 years ago acf-post-type-functions.php 2 years ago acf-taxonomy-functions.php 2 years ago acf-user-functions.php 2 years ago acf-utility-functions.php 2 years ago acf-value-functions.php 2 years ago acf-wp-functions.php 2 years ago assets.php 2 years ago class-acf-data.php 2 years ago class-acf-internal-post-type.php 2 years ago compatibility.php 2 years ago deprecated.php 2 years ago fields.php 2 years ago l10n.php 2 years ago local-fields.php 2 years ago local-json.php 2 years ago local-meta.php 2 years ago locations.php 2 years ago loop.php 2 years ago media.php 2 years ago rest-api.php 4 years ago revisions.php 2 years ago third-party.php 2 years ago upgrades.php 2 years ago validation.php 2 years ago wpml.php 2 years ago
third-party.php
152 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 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 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 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 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: ' . $field_group['title'];
102
103 // add meta box
104 add_meta_box( $id, acf_esc_html( $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 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 5.7.3
144 */
145 public function doing_dark_mode() {
146 wp_enqueue_style( 'acf-dark', acf_get_url( 'assets/css/acf-dark.css' ), array(), ACF_VERSION );
147 }
148 }
149
150 new acf_third_party();
151 endif;
152