GroupDuplicate() public static méthode

public static GroupDuplicate ( object $customGroup, integer $groupCounter, $order, boolean $fromAjax = true )
$customGroup object
$groupCounter integer
$fromAjax boolean
 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 = $_POST['customFieldId'];
         $groupCounter = $_POST['groupCounter'];
         $fieldCounter = $_POST['fieldCounter'];
         $groupId = $_POST['groupId'];
         RCCWP_WritePostPage::CustomFieldInterface($customFieldId, $groupCounter, $fieldCounter, $groupId);
     }
     wp_die();
 }
    function metaboxContent($temp, $group)
    {
        global $mf_domain;
        global $wpdb;
        global $post;
        global $CUSTOM_WRITE_PANEL;
        //we are passing the group_id in the args of the add_meta_box
        $group = $group['args'];
        //render the elements
        $customFields = RCCWP_CustomGroup::GetCustomFields($group->id);
        //when will be edit the  Post
        if (isset($_REQUEST['post']) && count($customFields) > 0) {
            //using the first field name we can know
            //the order  of the groups
            $firstFieldName = $customFields[0]->name;
            $order = RCCWP_CustomField::GetOrderDuplicates($_REQUEST['post'], $firstFieldName);
            ?>
 
				<div class="write_panel_wrapper"  id="write_panel_wrap_<?php 
            echo $group->id;
            ?>
"><?php 
            //build the group duplicates
            foreach ($order as $key => $element) {
                RCCWP_WritePostPage::GroupDuplicate($group, $element, $key, false);
            }
            //knowing what is the biggest duplicate group
            if (!empty($order)) {
                $tmp = $order;
                sort($tmp);
                $top = $tmp[count($tmp) - 1];
            } else {
                $top = 0;
            }
            ?>
				<input type='hidden' name='g<?php 
            echo $group->id;
            ?>
counter' id='g<?php 
            echo $group->id;
            ?>
counter' value='<?php 
            echo $top;
            ?>
' />
				<input type="hidden" name="rc-custom-write-panel-verify-key" id="rc-custom-write-panel-verify-key" value="<?php 
            echo wp_create_nonce('rc-custom-write-panel');
            ?>
" />
				<input type="hidden" name="rc-cwp-custom-write-panel-id" value="<?php 
            echo $CUSTOM_WRITE_PANEL->id;
            ?>
" />
				</div>
			<?php 
        } else {
            ?>
				<div class="write_panel_wrapper" id="write_panel_wrap_<?php 
            echo $group->id;
            ?>
">
				<?php 
            RCCWP_WritePostPage::GroupDuplicate($group, 1, 1, false);
            $gc = 1;
            ?>
				<input type='hidden' name='g<?php 
            echo $group->id;
            ?>
counter' id='g<?php 
            echo $group->id;
            ?>
counter' value='<?php 
            echo $gc;
            ?>
' />
		   		<input type='hidden' name="rc-custom-write-panel-verify-key" id="rc-custom-write-panel-verify-key" value="<?php 
            echo wp_create_nonce('rc-custom-write-panel');
            ?>
" />
				<input type='hidden' name="rc-cwp-custom-write-panel-id" value="<?php 
            echo $CUSTOM_WRITE_PANEL->id;
            ?>
" />
				</div>
			<?php 
        }
    }
<?php

require dirname(__FILE__) . '/../../../wp-load.php';
global $mf_domain;
if (!(is_user_logged_in() && (current_user_can('edit_posts') || current_user_can('edit_published_pages')))) {
    die(__("Athentication failed!", $mf_domain));
}
require_once "RCCWP_WritePostPage.php";
require_once "RCCWP_CustomGroup.php";
require_once 'RCCWP_Options.php';
if (isset($_POST['flag']) && $_POST['flag'] == "group") {
    $customGroup = RCCWP_CustomGroup::Get($_POST['groupId']);
    RCCWP_WritePostPage::GroupDuplicate($customGroup, $_POST['groupCounter'], $_POST['order']);
} else {
    $customFieldId = $_POST['customFieldId'];
    $groupCounter = $_POST['groupCounter'];
    $fieldCounter = $_POST['fieldCounter'];
    $groupId = $_POST['groupId'];
    RCCWP_WritePostPage::CustomFieldInterface($customFieldId, $groupCounter, $fieldCounter, $groupId);
}
    public static function metaboxContent($temp, $group)
    {
        global $mf_domain;
        global $wpdb;
        global $post;
        global $CUSTOM_WRITE_PANEL;
        $mf_post_id = apply_filters('mf_source_post_data', @$_REQUEST['post']);
        //we are passing the group_id in the args of the add_meta_box
        $group = $group['args'];
        //render the elements
        $customFields = RCCWP_CustomGroup::GetCustomFields($group->id);
        //when will be edit the  Post
        if (isset($mf_post_id) && count($customFields) > 0) {
            //using the first field name we can know
            //the order  of the groups
            $firstFieldName = $customFields[0]->name;
            $order = RCCWP_CustomField::GetOrderDuplicates($mf_post_id, $firstFieldName);
            ?>
 
				<div class="write_panel_wrapper"  id="write_panel_wrap_<?php 
            echo $group->id;
            ?>
">
				
				<?php 
            if ($group->duplicate) {
                ?>
				
        <div class="mf-group-controls">
          <div class="mf-group-count"></div>
          <div class="buttons">
            <a href="#" class="mf-expand-all-button"><?php 
                _e('Expand All', $mf_domain);
                ?>
</a>
            <a href="#" class="mf-collapse-all-button"><?php 
                _e('Collapse All', $mf_domain);
                ?>
</a>
          </div>
        
        </div>
        
        <?php 
            }
            ?>
        
        <div class="mf-group-save-warning"><?php 
            _e("Note: to save your changes you must also <strong>Publish</strong> or <strong>Update</strong>", $mf_domain);
            //echo $post->post_type;
            ?>
.</div> 

        
				<?php 
            //build the group duplicates
            foreach ($order as $key => $element) {
                RCCWP_WritePostPage::GroupDuplicate($group, $element, $key, false);
            }
            //knowing what is the biggest duplicate group
            if (!empty($order)) {
                $tmp = $order;
                sort($tmp);
                $top = $tmp[count($tmp) - 1];
            } else {
                $top = 0;
            }
            ?>
				<input type='hidden' name='g<?php 
            echo $group->id;
            ?>
counter' id='g<?php 
            echo $group->id;
            ?>
counter' value='<?php 
            echo $top;
            ?>
' />
				</div>
			<?php 
        } else {
            ?>
				<div class="write_panel_wrapper" id="write_panel_wrap_<?php 
            echo $group->id;
            ?>
">

      <?php 
            if ($group->duplicate) {
                ?>
				
        <div class="mf-group-controls">
          <div class="mf-group-count"></div>
          <div class="buttons">
            <a href="#" class="mf-expand-all-button">Expand All</a>
            <a href="#" class="mf-collapse-all-button">Collapse All</a>
          </div>
        
        </div>
        
        <?php 
            }
            ?>
        
        <div class="mf-group-save-warning"><?php 
            _e("Note: to save your changes you must also <strong>Publish</strong> or <strong>Update</strong>", $mf_domain);
            //echo $post->post_type;
            ?>
.</div> 


				<?php 
            RCCWP_WritePostPage::GroupDuplicate($group, 1, 1, false);
            $gc = 1;
            ?>
				<input type='hidden' name='g<?php 
            echo $group->id;
            ?>
counter' id='g<?php 
            echo $group->id;
            ?>
counter' value='<?php 
            echo $gc;
            ?>
' />
				</div>
			<?php 
        }
    }