changeNameInput() public static method

Change the nameinput magicfields[type][id gruop index][id field index] => magicfields_{type}_{id group index}_{if field index}
public static changeNameInput ( $inputName )
    public static function MediaPhotoInterface($customField, $inputName, $groupCounter, $fieldCounter)
    {
        global $mf_domain, $post;
        $idField = RCCWP_WritePostPage::changeNameInput($inputName);
        if (!empty($_GET['post'])) {
            $hidValue = RCCWP_CustomField::GetCustomFieldValues(true, $_GET['post'], $customField->name, $groupCounter, $fieldCounter);
        } else {
            $hidValue = '';
        }
        $filepath = $inputName . '_filepath';
        //The Image is required?
        $requiredClass = "";
        if ($customField->required_field) {
            $requiredClass = "field_required";
        }
        $imageThumbID = "img_thumb_" . $idField;
        $value = "<img src='" . MF_URI . "images/noimage.jpg' id='{$imageThumbID}'/>";
        if (!empty($hidValue)) {
            $path = PHPTHUMB . "?src=";
            $info = wp_get_attachment_image_src($hidValue, 'original');
            $path_image_media = $info[0];
            $value = $path . $path_image_media . "&w=150&h=120&zc=1";
            $value = "<img src='{$value}' id='{$imageThumbID}'/>";
        }
        ?>
  		<p 	class="error_msg_txt" id="upload_progress_<?php 
        echo $idField;
        ?>
" style="visibility:hidden;height:0px">
  		</p>	
  		<div id="image_photo" style="width:150px; float: left">
  			<?php 
        echo $value;
        ?>
  		<div id="photo_edit_link_<?php 
        echo $idField;
        ?>
" class="photo_edit_link"> 
  			<?php 
        if ($hidValue) {
            echo "&nbsp;<strong><a href='#remove' class='remove_media' id='remove-{$idField}'>" . __("Remove Image", $mf_domain) . "</a></strong>";
        }
        ?>
  		</div>
  		</div>
  		<div id="image_input" style="padding-left: 170px;">
  	<?php 
        if (empty($requiredClass)) {
            $requiredClass = '';
        }
        ?>
		
  			<div class="mf_custom_field">
  			<input tabindex="3" 
  				id="<?php 
        echo $idField;
        ?>
" 
  				name="<?php 
        echo $inputName;
        ?>
" 
  				type="hidden" 
  				class="<?php 
        echo $requiredClass;
        ?>
"
  				size="46"
  				value="<?php 
        echo $hidValue;
        ?>
"
  				<?php 
        if ($customField->required_field) {
            echo 'validate="required:true"';
        }
        ?>
  				/>
  				<?php 
        $thumb_class = 'thickbox1';
        if (is_wp30()) {
            $thumb_class = 'thickbox';
        }
        ?>

  			<a class="<?php 
        echo $thumb_class;
        ?>
 update_field_media_upload" id="thumb_<?php 
        echo $idField;
        ?>
" href="media-upload.php?post_id=<?php 
        echo $post->ID;
        ?>
&#038;type=image&#038;TB_iframe=1" ><?php 
        _e('Set Image', $mf_domain);
        ?>
</a>
  			</div>
  			<?php 
        if (!is_wp30()) {
            ?>
  			<script>
  			jQuery(document).ready(function(){
        	tb_init('a#thumb_<?php 
            echo $idField;
            ?>
');
        	jQuery('a#thumb_<?php 
            echo $idField;
            ?>
').click( function(){
        	  window.mf_field_id = jQuery(this).attr('id');
        	});
        });
  			</script>
  			<?php 
        }
        ?>
  		</div>

  		<div style="clear: both; height: 1px;"> </div>
  			<?php 
        if ($customField->required_field) {
            ?>
  				<div class="mf_message_error"><label for="<?php 
            echo $inputName;
            ?>
" class="error_magicfields error"><?php 
            _e("This field is required", $mf_domain);
            ?>
</label></div>
  			<?php 
        }
        ?>

  		<?php 
    }
Beispiel #2
0
    function Body($inputName, $fileType, $isCanvas = 0, $urlInputSize = false)
    {
        global $mf_domain;
        include_once 'RCCWP_Options.php';
        $idField = RCCWP_WritePostPage::changeNameInput($inputName);
        if (!$urlInputSize) {
            $urlInputSize = 20;
        }
        if ($isCanvas == 0) {
            $iframeInputSize = $urlInputSize;
            $iframeWidth = 380;
            $iframeHeight = 40;
            $inputSizeParam = '';
        } else {
            $isCanvas = 1;
            $iframeWidth = 150;
            $iframeHeight = 60;
            $iframeInputSize = 3;
            $inputSizeParam = "&inputSize={$iframeInputSize}";
        }
        $iframePath = MF_URI . "RCCWP_upload.php?input_name=" . urlencode($inputName) . "&type={$fileType}&imageThumbID=img_thumb_{$idField}&canvas={$isCanvas}" . $inputSizeParam;
        ?>
      <?php 
        if (RCCWP_Options::Get('use-standard-uploader')) {
            ?>
			<div id='upload_iframe_<?php 
            echo $idField;
            ?>
' class="iframeload { iframe: { id: 'upload_internal_iframe_<?php 
            echo $idField;
            ?>
', src: '<?php 
            echo $iframePath;
            ?>
', height: <?php 
            echo $iframeHeight;
            ?>
, width: <?php 
            echo $iframeWidth;
            ?>
 } }">
			</div>
      <?php 
        } else {
            ?>
			<div id='upload_ajax_<?php 
            echo $idField;
            ?>
' class="ajaxupload { lang: { upload_error: '<?php 
            echo __("Upload Failed", $mf_domain);
            ?>
', upload_success: '<?php 
            echo __("Successful Upload", $mf_domain);
            ?>
', upload: '<?php 
            echo __("Choose File...", $mf_domain);
            ?>
', replace: '<?php 
            echo __("Replace File...", $mf_domain);
            ?>
', drop: '<?php 
            echo __("drop file here to upload", $mf_domain);
            ?>
' }}">
      </div>
      <?php 
        }
        ?>
			<table border="0">
				<tr >
					<td style="border-bottom-width: 0px; padding: 0"><label for="upload_url"><?php 
        _e('Or URL', $mf_domain);
        ?>
:</label></td>
					<td style="border-bottom-width: 0px; padding-left: 4px;">
						<input id="upload_url_<?php 
        echo $idField;
        ?>
"
							name="upload_url_<?php 
        echo $inputName;
        ?>
"
							type="text"
							size="<?php 
        echo $urlInputSize;
        ?>
"
							class="mf-upload-url" />
                                                        <input type="button" onclick="uploadurl('<?php 
        echo $idField;
        ?>
','<?php 
        echo $fileType;
        ?>
','<?php 
        echo wp_create_nonce("nonce_url_file");
        ?>
')" value="Upload" class="button" style="width:70px"/>
					</td>
				</tr>
			</table>
		<?php 
    }