| 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 object $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 |
|