public static 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 }
/** * Audio field */ public static function AudioInterface($customField, $inputName, $groupCounter, $fieldCounter) { global $mf_domain; $idField = RCCWP_WritePostPage::changeNameInput($inputName); $customFieldId = ''; $freshPageFolderName = dirname(plugin_basename(__FILE__)); $requiredClass = ""; $mf_post_id = apply_filters('mf_source_post_data', @$_REQUEST['post']); if ($customField->required_field) { $requiredClass = "field_required"; } if (isset($mf_post_id)) { $customFieldId = $customField->id; $valueOriginal = RCCWP_CustomField::GetCustomFieldValues(true, $mf_post_id, $customField->name, $groupCounter, $fieldCounter); $path = MF_FILES_URI; if (empty($valueOriginal)) { $valueOriginal = ''; } if (empty($valueOriginalRelative)) { $valueOriginalRelative = ''; } ${$valueOriginalRelative} = $valueOriginal; $valueOriginal = $path . $valueOriginal; if (!empty($valueOriginal)) { $value = stripslashes(trim("\\<div id='obj-{$idField}' style=\\'width:260px;padding-top:3px;\\'\\>\\<object classid=\\'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\\' codebase='\\http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\\' width=\\'95%\\' height=\\'20\\' wmode=\\'transparent\\' \\>\\<param name=\\'movie\\' value=\\'" . MF_URI . "js/singlemp3player.swf?file=" . urlencode($valueOriginal) . "\\' wmode=\\'transparent\\' /\\>\\<param name=\\'quality\\' value=\\'high\\' wmode=\\'transparent\\' /\\>\\<embed src=\\'" . MF_URI . "js/singlemp3player.swf?file=" . urlencode($valueOriginal) . "' width=\\'100\\%\\' height=\\'20\\' quality=\\'high\\' pluginspage=\\'http://www.macromedia.com/go/getflashplayer\\' type=\\'application/x-shockwave-flash\\' wmode=\\'transparent\\' \\>\\</embed\\>\\</object\\>\\</div\\><br />")); } } // If the field is at right, set a constant width to the text box $field_group = RCCWP_CustomGroup::Get($customField->group_id); $urlInputSize = false; $is_canvas = 0; if ($field_group->at_right) { $urlInputSize = 5; $is_canvas = 1; } ?> <p class="error_msg_txt upload-msg" id="upload_progress_<?php echo $idField; ?> " style="display:none;"></p> <script type="text/javascript"> //this script is for remove the audio file using ajax remove_audio = function(){ if(confirm("<?php _e('Are you sure?', $mf_domain); ?> ")){ //get the name to the image //id = jQuery(this).attr('id').split("-")[1]; pattern = /remove\-([a-z0-9\-\_]+)/i; id = jQuery(this).attr("id"); id = pattern.exec(id); id = id[1]; file = jQuery('#'+id).val(); delete_field = jQuery('#magicfields_remove_files').val(); if(delete_field != ''){ jQuery('#magicfields_remove_files').val(delete_field+"|||"+file); }else{ jQuery('#magicfields_remove_files').val(file); } // set the value to empty jQuery('#obj-'+id).empty(); jQuery('#actions-'+id).empty(); jQuery('#remove-'+id).empty(); jQuery('#'+id).val(""); jQuery('#'+id).closest(".mf-field").find(".ajax-upload-list").html(''); } } jQuery(document).ready(function(){ jQuery("#remove-<?php echo $idField; ?> ").click(remove_audio); }); </script> <div class="mf-audio-value-actions"> <?php if (!empty(${$valueOriginalRelative})) { echo '<div class="mf-audio-value">' . $value . '</div>'; echo "<div id='actions-{$idField}' class='actions-audio'><a href='javascript:void(0);' id='remove-{$idField}' class='remove-audio'>" . __("Delete", $mf_domain) . "</a></div>"; } else { echo '<div class="mf-audio-value"></div>'; echo "<div id='actions-{$idField}' class='actions-audio' style='display: none'><a href='javascript:void(0);' id='remove-{$idField}' class='remove-audio'>" . __("Delete", $mf_domain) . "</a></div>"; } if (empty($valueOriginalRelative)) { $valueOriginalRelative = ''; } ?> </div> <!-- /.mf-audio-value-actions --> <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 ${$valueOriginalRelative}; ?> " <?php if ($customField->required_field) { echo 'validate="required:true"'; } ?> /> <?php // adding the SWF upload include_once "RCCWP_SWFUpload.php"; RCCWP_SWFUpload::Body($inputName, 2, $is_canvas, $urlInputSize); ?> </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); ?> .audio</label></div> <?php } }