CustomFieldInterface() 공개 정적인 메소드

public static CustomFieldInterface ( $customFieldId, $groupCounter = 1, $fieldCounter = 1, $customGroup_id )
예제 #1
0
 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();
 }
예제 #2
0
<?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);
}
예제 #3
0
    /**
     * 
     * @param object $customGroup
     * @param integer $groupCounter
     * @param boolean $fromAjax
     *
     */
    public static function GroupDuplicate($customGroup, $groupCounter, $order, $fromAjax = true)
    {
        global $mf_domain;
        global $CUSTOM_WRITE_PANEL;
        $ex_class = $customGroup->expanded ? "mf-group-expanded" : '';
        if ($customGroup->name == "__default") {
            // for the default group (top level), check the expand flag on the WRITE PANEL instead
            $ex_class = $CUSTOM_WRITE_PANEL->expanded ? "mf-group-expanded" : '';
        }
        $mf_post_id = apply_filters('mf_source_post_data', @$_REQUEST['post']);
        //getting the custom fields
        $customFields = RCCWP_CustomGroup::GetCustomFields($customGroup->id);
        //if don't have fields then finish
        if (count($customFields) == 0) {
            return;
        }
        require_once "RC_Format.php";
        if ($customGroup->duplicate != 0) {
            $add_class_rep = "mf_duplicate_group";
        } else {
            $add_class_rep = "";
        }
        ?>
		<div class="magicfield_group <?php 
        echo $add_class_rep;
        ?>
 <?php 
        echo $ex_class;
        ?>
" id="freshpostdiv_group_<?php 
        echo $customGroup->id . '_' . $groupCounter;
        ?>
">
			<a id="collapse_<?php 
        echo $customGroup->id . "Duplicate" . "_" . $customGroup->id . "_" . $order;
        ?>
" class="collapse_button" href="javascript:void(0);">Collapse</a>

      <div class="mf-group-loading"><?php 
        _e('Loading Data&hellip;', $mf_domain);
        ?>
</div>
      
      <div>
			<div class="inside">
			<div class="mf-fields">
				<?php 
        foreach ($customFields as $field) {
            $customFieldName = $field->name;
            $customFieldTitle = esc_attr($field->description);
            $groupId = $customGroup->id;
            $inputName = $field->id . "_" . $groupCounter . "_1_" . $groupId . "_" . $customFieldName;
            if (isset($mf_post_id)) {
                $fc = RCCWP_CustomField::GetFieldDuplicates($mf_post_id, $field->name, $groupCounter);
                $fields_order = RCCWP_CustomField::GetFieldsOrder($mf_post_id, $field->name, $groupCounter);
                foreach ($fields_order as $element) {
                    RCCWP_WritePostPage::CustomFieldInterface($field->id, $groupCounter, $element, $customGroup->id);
                }
            } else {
                RCCWP_WritePostPage::CustomFieldInterface($field->id, $groupCounter, 1, $customGroup->id);
                $fc = 1;
            }
            if (!empty($fields_order)) {
                $tmp = $fields_order;
                sort($tmp);
                $top = $tmp[count($tmp) - 1];
            } else {
                $top = 1;
            }
            ?>
					<span style="display:none" id="<?php 
            echo "c" . $inputName . "Duplicate";
            ?>
">
						<input type="text" name="c<?php 
            echo $inputName;
            ?>
Counter" id="c<?php 
            echo $inputName;
            ?>
Counter" value='<?php 
            echo $top;
            ?>
' /> 
					</span>
				<?php 
        }
        ?>
      </div>
	    <!-- /.mf-fields -->

			<?php 
        if ($customGroup->duplicate != 0) {
            $sgn = Inflect::singularize($customGroup->name);
            ?>
			
	    
			<div class="mf_toolbox">
				<span class="mf_counter sortable_mf" id="counter_<?php 
            echo $customGroup->id;
            ?>
_<?php 
            echo $groupCounter;
            ?>
"><?php 
            echo $order;
            ?>
</span>
				<span class="hndle sortable_mf row_mf">&nbsp;</span>

				<span class="mf_toolbox_controls">

					<?php 
            if ($groupCounter != 1) {
                ?>
							<a class ="delete_duplicate_button { lang: { confirm: '<?php 
                _e("Are you sure?", $mf_domain);
                ?>
' } }" href="javascript:void(0);" id="delete_duplicate-freshpostdiv_group_<?php 
                echo $customGroup->id . '_' . $groupCounter;
                ?>
"><span><?php 
                _e('Remove', $mf_domain);
                ?>
</span> <?php 
                echo $sgn;
                ?>
</a>
						<?php 
            } else {
                ?>
 
							<a id="add_duplicate_<?php 
                echo $customGroup->id . "Duplicate" . "_" . $customGroup->id . "_" . $order;
                ?>
" class="duplicate_button" href="javascript:void(0);" title="<?php 
                _e('Note: hold down the SHIFT key as you click to collapse this item before the new item is added', $mf_domain);
                ?>
"><span><?php 
                _e('Add Another', $mf_domain);
                ?>
</span> <?php 
                echo $sgn;
                ?>
</a>
					   <?php 
            }
            ?>
 
				</span>
			</div>
			<?php 
        }
        ?>
			</div>
			</div> 
			<input type="hidden" name="order_<?php 
        echo $customGroup->id;
        ?>
_<?php 
        echo $groupCounter;
        ?>
" id="order_<?php 
        echo $customGroup->id;
        ?>
_<?php 
        echo $groupCounter;
        ?>
" value="<?php 
        echo $order;
        ?>
" />
		</div>
		<?php 
    }
예제 #4
0
    /**
     * 
     * @param object $customGroup
     * @param integer $groupCounter
     * @param boolean $fromAjax
     *
     */
    function GroupDuplicate($customGroup, $groupCounter, $order, $fromAjax = true)
    {
        global $mf_domain;
        //getting the custom fields
        $customFields = RCCWP_CustomGroup::GetCustomFields($customGroup->id);
        //if don't have fields then finish
        if (count($customFields) == 0) {
            return;
        }
        require_once "RC_Format.php";
        if ($customGroup->duplicate != 0) {
            $add_class_rep = "mf_duplicate_group";
        } else {
            $add_class_rep = "";
        }
        ?>
		<div class="magicfield_group <?php 
        echo $add_class_rep;
        ?>
" id="freshpostdiv_group_<?php 
        echo $customGroup->id . '_' . $groupCounter;
        ?>
">
			<div>
			<div class="inside">
				<?php 
        foreach ($customFields as $field) {
            $customFieldName = RC_Format::GetInputName(attribute_escape($field->name));
            $customFieldTitle = attribute_escape($field->description);
            $groupId = $customGroup->id;
            $inputName = $field->id . "_" . $groupCounter . "_1_" . $groupId . "_" . $customFieldName;
            if (isset($_REQUEST['post'])) {
                $fc = RCCWP_CustomField::GetFieldDuplicates($_REQUEST['post'], $field->name, $groupCounter);
                $fields_order = RCCWP_CustomField::GetFieldsOrder($_REQUEST['post'], $field->name, $groupCounter);
                foreach ($fields_order as $element) {
                    RCCWP_WritePostPage::CustomFieldInterface($field->id, $groupCounter, $element, $customGroup->id);
                }
            } else {
                RCCWP_WritePostPage::CustomFieldInterface($field->id, $groupCounter, 1, $customGroup->id);
                $fc = 1;
            }
            if (!empty($fields_order)) {
                $tmp = $fields_order;
                sort($tmp);
                $top = $tmp[count($tmp) - 1];
            } else {
                $top = 1;
            }
            ?>
					<span style="display:none" id="<?php 
            echo "c" . $inputName . "Duplicate";
            ?>
">
						<input type="text" name="c<?php 
            echo $inputName;
            ?>
Counter" id="c<?php 
            echo $inputName;
            ?>
Counter" value='<?php 
            echo $top;
            ?>
' /> 
					</span>
				<?php 
        }
        ?>
			<br />
			<?php 
        if ($customGroup->duplicate != 0) {
            ?>
			<div class="mf_toolbox">
				<span class="hndle sortable_mf row_mf">
					<img title="Order" src="<?php 
            echo MF_URI;
            ?>
/images/move.png"/>
				</span>
				<span class="mf_counter" id="counter_<?php 
            echo $customGroup->id;
            ?>
_<?php 
            echo $groupCounter;
            ?>
">
					(<?php 
            echo $order;
            ?>
)
				</span>
				<span class="add_mf">
					<?php 
            if ($groupCounter != 1) {
                ?>
							<a class ="delete_duplicate_button" href="javascript:void(0);" id="delete_duplicate-freshpostdiv_group_<?php 
                echo $customGroup->id . '_' . $groupCounter;
                ?>
"> 
								<img class="duplicate_image"  src="<?php 
                echo MF_URI;
                ?>
images/delete.png" alt="<?php 
                _e('Remove field duplicate', $mf_domain);
                ?>
"/><?php 
                _e('Remove Group', $mf_domain);
                ?>
							</a>
						<?php 
            } else {
                ?>
 
							<a id="add_duplicate_<?php 
                echo $customGroup->id . "Duplicate" . "_" . $customGroup->id . "_" . $order;
                ?>
" class="duplicate_button" href="javascript:void(0);"> 
								<img class="duplicate_image" src="<?php 
                echo MF_URI;
                ?>
images/duplicate.png" alt="<?php 
                _e('Add group duplicate', $mf_domain);
                ?>
" title="Duplicate Field"/>
							</a>
					   <?php 
            }
            ?>
 
				</span>
				<br style="height:2px"/>
			</div>
			<?php 
        }
        ?>
			</div>
			</div> 
			<input type="hidden" name="order_<?php 
        echo $customGroup->id;
        ?>
_<?php 
        echo $groupCounter;
        ?>
" id="order_<?php 
        echo $customGroup->id;
        ?>
_<?php 
        echo $groupCounter;
        ?>
" value="<?php 
        echo $order;
        ?>
" />
		</div>
		<?php 
    }
예제 #5
0
    /**
     * This function is for duplicate  a group  (When is clicked the button "Duplicate Group"
     * @param object   $customGroup 
     * @param integer  $groupCounter
     * @param boolean  $fromAjax
     *
     */
    function GroupDuplicate($customGroup, $groupCounter, $fromAjax = true)
    {
        global $flutter_domain;
        //getting the custom fields
        $customFields = RCCWP_CustomGroup::GetCustomFields($customGroup->id);
        //if don't have any   custom field then finish
        if (count($customFields) == 0) {
            return;
        }
        //if this  group can't be duplicated  and  the group conter is != to 1 then finish
        if ($customGroup->duplicate == 0 && $groupCounter != 1) {
            return;
        }
        //formating
        require_once "RC_Format.php";
        ?>
		
		<div id="freshpostdiv_group_<?php 
        echo $customGroup->id . '_' . $groupCounter;
        ?>
" class="postbox1">
        <div class="postbox">
            <h3 class="hndle sortable_flutter">
			    <span><?php 
        echo $customGroup->name . " ({$groupCounter})";
        ?>
 </span>
		    </h3>
		    <div class="inside">
			    <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
    			    <?php 
        foreach ($customFields as $field) {
            // Render a row for each field in the group
            $customField = RCCWP_CustomField::Get($field->id);
            $customFieldName = RC_Format::GetInputName(attribute_escape($field->name));
            $customFieldTitle = attribute_escape($customField->description);
            $groupId = $customGroup->id;
            $inputName = $field->id . "_" . $groupCounter . "_1_" . $groupId . "_" . $customFieldName;
            RCCWP_WritePostPage::CustomFieldInterface($field->id, $groupCounter, 1, $customGroup->id);
            $fc = 1;
        }
        ?>
	
			        <tr style="display:none" id="<?php 
        echo "c" . $inputName . "Duplicate";
        ?>
">
    			        <th valign="top" scope="row">
        				</th>
	        			<td>
    		    		    <img class="duplicate_image"  src="<?php 
        echo FLUTTER_URI;
        ?>
images/spinner.gif" alt=""/> <?php 
        _e('Loading', $flutter_domain);
        ?>
 ... 
	    		    		<input type="hidden" name="c<?php 
        echo $inputName;
        ?>
Counter" id="c<?php 
        echo $inputName;
        ?>
Counter" value='<?php 
        echo $fc;
        ?>
' /> 
		    		    </td>
    		    	</tr>
                </table>
	    	</div>
    		<br />
	    	<a class ="delete_duplicate_button" href="javascript:void(0);" id="delete_duplicate-freshpostdiv_group_<?php 
        echo $customGroup->id . '_' . $groupCounter;
        ?>
"> 
		        <img class="duplicate_image"  src="<?php 
        echo FLUTTER_URI;
        ?>
images/delete.png" alt="<?php 
        _e('Remove field duplicate', $flutter_domain);
        ?>
"/><?php 
        _e('Remove Group', $flutter_domain);
        ?>
    	    </a>
    		<br style="height:2px"/>
            </div>
            <input type="hidden" name="order_<?php 
        echo $customGroup->id;
        ?>
_<?php 
        echo $groupCounter;
        ?>
" id="order_<?php 
        echo $customGroup->id;
        ?>
_<?php 
        echo $groupCounter;
        ?>
" value="0" />
        </div>
		<?php 
    }