PluginProbe
Polylang / trunk
Polylang vtrunk
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / src / integrations / custom-field-template / cft.php

cft.php in Polylang trunk, at src/integrations/custom-field-template/cft.php

36 lines 787 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Polylang
4 */
5
6 /**
7 * Manages the compatibility with Custom Field Template.
8 *
9 * @since 2.8
10 */
11 class PLL_Cft {
12 /**
13 * Setups actions.
14 *
15 * @since 2.8
16 */
17 public function init() {
18 add_action( 'add_meta_boxes', array( $this, 'cft_copy' ), 10, 2 );
19 }
20
21 /**
22 * Custom field template does check $_REQUEST['post'] to populate the custom fields values.
23 *
24 * @since 1.0.2
25 *
26 * @param string $post_type Unused.
27 * @param WP_Post $post Current post object.
28 */
29 public function cft_copy( $post_type, $post ) {
30 global $custom_field_template;
31 if ( isset( $custom_field_template, $_REQUEST['from_post'], $_REQUEST['new_lang'] ) && ! empty( $post ) ) { // phpcs:ignore WordPress.Security.NonceVerification
32 $_REQUEST['post'] = $post->ID;
33 }
34 }
35 }
36