forked from hunk/Magic-Fields
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MF_GetDuplicate.php
45 lines (35 loc) · 1.15 KB
/
MF_GetDuplicate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
class MF_GetDuplicate {
public function __construct() {
add_action( 'wp_ajax_mf_get_duplicate', array( $this, 'resolve' ) );
}
function resolve() {
global $mf_domain;
check_ajax_referer( 'nonce_ajax_duplicate', 'nonce_ajax_duplicate');
if ( !(is_user_logged_in() && (current_user_can('edit_posts') || current_user_can('edit_published_pages'))) ) {
echo __("Athentication failed",$mf_domain);
wp_die();
}
if( isset($_POST['flag']) && $_POST['flag'] == "group" ) {
$customGroup = RCCWP_CustomGroup::Get( $_POST['groupId'] ) ;
RCCWP_WritePostPage::GroupDuplicate(
$customGroup,
$_POST['groupCounter'],
$_POST['order']
);
}else{
$customFieldId = (int)$_POST['customFieldId'];
$groupCounter = (int)$_POST['groupCounter'];
$fieldCounter = (int)$_POST['fieldCounter'];
$groupId = (int)$_POST['groupId'];
RCCWP_WritePostPage::CustomFieldInterface(
$customFieldId,
$groupCounter,
$fieldCounter,
$groupId
);
}
wp_die();
}
}
$mf_get_duplicate = new MF_GetDuplicate();