/** * Delete a group given id * * @param integer $customGroupId */ public static function Delete($customGroupId = null) { include_once 'RCCWP_CustomField.php'; if (isset($customGroupId)) { global $wpdb; $customFields = RCCWP_CustomGroup::GetCustomFields($customGroupId); foreach ($customFields as $field) { RCCWP_CustomField::Delete($field->id); } $wpdb->delete(MF_TABLE_PANEL_GROUPS, array('id' => $customGroupId), array('%d')); } }
/** * Delete a group given id * * @param integer $customGroupId */ function Delete($customGroupId = null) { include_once 'RCCWP_CustomField.php'; if (isset($customGroupId)) { global $wpdb; $customFields = RCCWP_CustomGroup::GetCustomFields($customGroupId); foreach ($customFields as $field) { RCCWP_CustomField::Delete($field->id); } $sql = sprintf("DELETE FROM " . RC_CWP_TABLE_PANEL_GROUPS . " WHERE id = %d", $customGroupId); $wpdb->query($sql); } }
function Edit() { global $mf_domain; $customGroup = RCCWP_CustomGroup::Get((int) $_REQUEST['custom-group-id']); ?> <div class="wrap"> <h2><?php _e('Edit Group', $mf_domain); ?> - <?php echo $customGroup->name; ?> </h2> <form action="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('submit-edit-custom-group') . "&custom-group-id={$customGroup->id}"; ?> " method="post" id="edit-custom-group-form"> <?php RCCWP_CustomGroupPage::Content($customGroup); ?> <p class="submit" > <a style="color:black" href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('cancel-edit-custom-group'); ?> " class="button"><?php _e('Cancel', $mf_domain); ?> </a> <input type="submit" id="submit-edit-custom-group" value="<?php _e('Update', $mf_domain); ?> " /> </p> </form> </div> <br /> <?php }
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 CheckFieldName($fieldName, $panelID) { global $wpdb; $sql = "SELECT id, group_id FROM " . MF_TABLE_GROUP_FIELDS . " WHERE name='{$fieldName}' "; $results = $wpdb->get_results($sql); foreach ($results as $result) { $fieldGroup = RCCWP_CustomGroup::Get($result->group_id); if ($panelID == $fieldGroup->panel_id) { return true; } } return false; }
function Edit() { global $FIELD_TYPES; global $mf_domain; $custom_field = RCCWP_CustomField::Get((int) $_GET['custom-field-id']); $customGroupID = $custom_field->group_id; if (isset($customGroupID)) { $group = RCCWP_CustomGroup::Get($customGroupID); ?> <script type="text/javascript"> var mf_create_field = false; var mf_group_info = { 'name' : '<?php echo stripslashes($group->name); ?> ', 'safe_name' : '<?php echo sanitize_title_with_dashes($group->name); ?> ', 'singular_safe_name' : '<?php echo sanitize_title_with_dashes(Inflect::singularize($group->name)); ?> ' }; </script> <?php } if (in_array($custom_field->type, array('Image'))) { $cssVlaue = $custom_field->CSS; } ?> <div class="wrap"> <h2><?php _e('Edit Custom Field', $mf_domain); ?> - <em><?php echo $custom_field->description; ?> </em> <?php if ($group && $group->name != "__default") { _e("In Group", $mf_domain); echo " <em>" . $group->name . "</em>"; } ?> </h2> <br class="clear" /> <?php if (isset($_GET['err_msg'])) { switch ($_GET['err_msg']) { case -1: ?> <div class="error"><p> <?php _e('A field with the same name already exists in this write panel. Please choose a different name.', $mf_domain); ?> </p></div> <?php } } ?> <form action="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('submit-edit-custom-field') . "&custom-group-id={$customGroupID}"; ?> " method="post" id="edit-custom-field-form" onsubmit="return checkEmpty();"> <input type="hidden" name="custom-field-id" value="<?php echo $custom_field->id; ?> "> <table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6"> <tbody> <tr valign="top"> <th scope="row"><?php _e('Label', $mf_domain); ?> :</th> <td><input name="custom-field-description" id="custom-field-description" size="40" type="text" value="<?php echo htmlspecialchars($custom_field->description); ?> " /></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Name', $mf_domain); ?> :</th> <td><input name="custom-field-name" id="custom-field-name" size="40" type="text" value="<?php echo htmlspecialchars($custom_field->name); ?> " /><button id="bt-custom-field-name-suggest" class="button">Suggest</button></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Help text', $mf_domain); ?> :</th> <td><input name="custom-field-helptext" id="custom-field-helptext" size="40" type="text" value="<?php echo htmlspecialchars($custom_field->help_text); ?> " /><br/><small><?php _e('If set, this will be displayed in a tooltip next to the field label', $mf_domain); ?> </small></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Can be duplicated', $mf_domain); ?> :</th> <td><input name="custom-field-duplicate" id="custom-field-duplicate" type="checkbox" value="1" <?php echo $custom_field->duplicate == 0 ? "" : "checked"; ?> /></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Order', $mf_domain); ?> :</th> <td> <input name="custom-field-order" id="custom-field-order" size="2" type="text" value="<?php echo $custom_field->display_order; ?> " /> </td> </tr> <?php if (in_array($custom_field->type_id, array($FIELD_TYPES['textbox'], $FIELD_TYPES['multiline_textbox'], $FIELD_TYPES['checkbox'], $FIELD_TYPES['checkbox_list'], $FIELD_TYPES['radiobutton_list'], $FIELD_TYPES['dropdown_list'], $FIELD_TYPES['listbox'], $FIELD_TYPES['file'], $FIELD_TYPES['image'], $FIELD_TYPES['audio'], $FIELD_TYPES['related_type'], $FIELD_TYPES['Image (Upload Media)'], $FIELD_TYPES['markdown_textbox']))) { ?> <tr valign="top"> <th scope="row"><?php _e('Required', $mf_domain); ?> :</th> <td> <select name="custom-field-required" id="custom-field-required"> <option value="0" <?php echo $custom_field->required_field == 0 ? 'selected="selected"' : ''; ?> ><?php _e('Not Required - can be empty', $mf_domain); ?> </option> <option value="1" <?php echo $custom_field->required_field == 1 ? 'selected="selected"' : ''; ?> ><?php _e('Required - can not be empty', $mf_domain); ?> </option> </select> </td> </tr> <?php } ?> <?php if (in_array($custom_field->type, array('Textbox', 'Listbox'))) { ?> <tr valign="top"> <th scope="row"><?php _e('Size', $mf_domain); ?> :</th> <td><input type="text" name="custom-field-size" id="custom-field-size" size="2" value="<?php echo $custom_field->properties['size']; ?> " /></td> </tr> <?php } ?> <?php if (in_array($custom_field->type, array('Multiline Textbox'))) { ?> <tr valign="top"> <th scope="row"><?php _e('Height', $mf_domain); ?> :</th> <td><input type="text" name="custom-field-height" id="custom-field-height" size="2" value="<?php echo $custom_field->properties['height']; ?> " /></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Width', $mf_domain); ?> :</th> <td><input type="text" name="custom-field-width" id="custom-field-width" size="2" value="<?php echo $custom_field->properties['width']; ?> " /></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Hide Visual Editor for this field', $mf_domain); ?> :</th> <td><input name="hide-visual-editor" id="hide-visual-editor" value="1" type="checkbox" <?php echo $custom_field->properties['hide-visual-editor'] == 0 ? "" : "checked"; ?> ></td> </tr> <?php } ?> <?php if (in_array($custom_field->type_id, array($FIELD_TYPES['textbox'], $FIELD_TYPES['multiline_textbox']))) { ?> <tr valign="top"> <th scope="row"><?php _e('Evaluate Max Length', $mf_domain); ?> :</th> <td><input name="strict-max-length" id="strict-max-length" value="1" type="checkbox" <?php echo $custom_field->properties['strict-max-length'] == 0 ? "" : "checked"; ?> ><br/><small><?php _e('If set, Hide Visual Editor for this field', $mf_domain); ?> </small></td> </tr> <?php } ?> <?php if (in_array($custom_field->type, array('Date'))) { ?> <tr valign="top"> <th scope="row"><?php _e('Format', $mf_domain); ?> :</th> <td> <select name="custom-field-date-format" id="custom-field-date-format"> <option value="m/d/Y" <?php if ($custom_field->properties['format'] == "m/d/Y") { echo " selected "; } ?> >4/20/2008</option> <option value="l, F d, Y" <?php if ($custom_field->properties['format'] == "l, F d, Y") { echo " selected "; } ?> >Sunday, April 20, 2008</option> <option value="F d, Y" <?php if ($custom_field->properties['format'] == "F d, Y") { echo " selected "; } ?> >April 20, 2008</option> <option value="m/d/y" <?php if ($custom_field->properties['format'] == "m/d/y") { echo " selected "; } ?> >4/20/08</option> <option value="Y-m-d" <?php if ($custom_field->properties['format'] == "Y-m-d") { echo " selected "; } ?> >2008-04-20</option> <option value="d-M-y" <?php if ($custom_field->properties['format'] == "d-M-y") { echo " selected "; } ?> >20-Apr-08</option> <option value="m.d.Y" <?php if ($custom_field->properties['format'] == "m.d.Y") { echo " selected "; } ?> >4.20.2008</option> <option value="m.d.y" <?php if ($custom_field->properties['format'] == "m.d.y") { echo " selected "; } ?> >4.20.08</option> </select> </td> </tr> <?php } ?> <?php if (in_array($custom_field->type, array('Slider'))) { ?> <tr valign="top"> <th scope="row"><?php echo _e('Value min', $mf_domain); ?> :</th> <td><input type="text" name="custom-field-slider-min" id="custom-field-slider-min" size="2" value="<?php echo $custom_field->properties['min']; ?> " /></td> </tr> <tr valign="top"> <th scope="row"><?php echo _e('Value max', $mf_domain); ?> :</th> <td><input type="text" name="custom-field-slider-max" id="custom-field-slider-max" size="2" value="<?php echo $custom_field->properties['max']; ?> " /></td> </tr> <tr valign="top"> <th scope="row"><?php echo _e('Stepping', $mf_domain); ?> :</th> <td><input type="text" name="custom-field-slider-step" id="custom-field-slider-step" size="2" value="<?php echo $custom_field->properties['step']; ?> " /></td> </tr> <?php } ?> <?php //eeble if (in_array($custom_field->type, array('Related Type'))) { $customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels(); ?> <tr valign="top"> <th scope="row"><?php _e('Related Type Panel', $mf_domain); ?> :</th> <td><select name="custom-field-related-type-panel-id" id="custom-field-related-type-panel-id"> <option value="-7" <?php if ($custom_field->properties['panel_id'] == -7) { echo 'selected'; } ?> >All Categories</option> <option value="-6" <?php if ($custom_field->properties['panel_id'] == -6) { echo 'selected'; } ?> >All Posts and Pages</option> <option value="-5" <?php if ($custom_field->properties['panel_id'] == -5) { echo 'selected'; } ?> >All Posts and Pages with Write Panel</option> <option value="-4" <?php if ($custom_field->properties['panel_id'] == -4) { echo 'selected'; } ?> >All Post</option> <option value="-3" <?php if ($custom_field->properties['panel_id'] == -3) { echo 'selected'; } ?> >All Page</option> <option value="-2" <?php if ($custom_field->properties['panel_id'] == -2) { echo 'selected'; } ?> >All Post with Write Panel</option> <option value="-1" <?php if ($custom_field->properties['panel_id'] == -1) { echo 'selected'; } ?> >All Page with Write Panel</option> <?php foreach ($customWritePanels as $panel) { ?> <option value="<?php echo $panel->id; ?> " <?php if ($custom_field->properties['panel_id'] == $panel->id) { echo 'selected'; } ?> ><?php echo $panel->name; ?> </option> <?php } ?> </select></td> </tr> <?php } ?> <?php if ($custom_field->has_options == "true") { $options = implode("\n", (array) $custom_field->options); ?> <tr valign="top"> <th scope="row"><?php _e('Options', $mf_domain); ?> :</th> <td> <textarea name="custom-field-options" id="custom-field-options" rows="2" cols="38"><?php echo htmlspecialchars($options); ?> </textarea><br /> <em><?php _e('Separate each option with a newline.', $mf_domain); ?> </em> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Default Value', $mf_domain); ?> :</th> <td> <?php $default_value = implode("\n", (array) $custom_field->default_value); if ($custom_field->allow_multiple_values == "true") { ?> <textarea name="custom-field-default-value" id="custom-field-default-value" rows="2" cols="38"><?php echo htmlspecialchars($default_value); ?> </textarea><br /> <em><?php _e('Separate each value with a newline.', $mf_domain); ?> </em> <?php } else { ?> <input type="text" name="custom-field-default-value" id="custom-field-default-value" size="25" value="<?php echo htmlspecialchars($default_value); ?> " /> <?php } ?> </td> </tr> <?php } ?> <tr valign="top"> <th scope="row"><?php _e('Type', $mf_domain); ?> :</th> <td> <!-- START :: Javascript for Image/Photo' Css Class --> <script type="text/javascript" language="javascript"> submitForm = false; function fun(name) { if(name == "Image") { document.getElementById('divCSS').style.display = 'inline'; document.getElementById('divLbl').style.display = 'inline'; document.getElementById('lblHeight').style.display = 'inline'; document.getElementById('txtHeight').style.display = 'inline'; document.getElementById('lblWidth').style.display = 'inline'; document.getElementById('txtWidth').style.display = 'inline'; } else { document.getElementById('divCSS').style.display = 'none'; document.getElementById('divLbl').style.display = 'none'; document.getElementById('lblHeight').style.display = 'none'; document.getElementById('txtHeight').style.display = 'none'; document.getElementById('lblWidth').style.display = 'none'; document.getElementById('txtWidth').style.display = 'none'; } } function checkEmpty() { if (submitForm && (document.getElementById('custom-field-name').value == "" || document.getElementById('custom-field-description').value == "")){ alert("<?php _e('Please fill in the name and the label of the field', $mf_domain); ?> "); return false; } return true; } </script> <!-- END :: Javascript for Image/Photo' Css Class --> <?php $field_types = RCCWP_CustomField::GetCustomFieldTypes(); foreach ($field_types as $field) { $checked = $field->name == $custom_field->type ? 'checked="checked"' : ''; ?> <label><input name="custom-field-type" value="<?php echo $field->id; ?> " type="radio" <?php echo $checked; ?> onclick='fun("<?php echo $field->name; ?> ");'/> <?php echo $field->name; ?> </label><br /> <?php } ?> </td> </tr> <!-- START :: For Image/Photo' Css --> <?php if ($custom_field->type == "Image" || $custom_field->type == "Image (Upload Media)") { $h = $w = $c = NULL; if ($custom_field->type == "Image") { $isDisplay = $custom_field->type == "Image" ? 'display:inline;' : 'display:none;'; } if ($custom_field->type == "Image (Upload Media)") { $isDisplay = $custom_field->type == "Image (Upload Media)" ? 'display:inline;' : 'display:none;'; } if (isset($custom_field->properties['params'])) { preg_match('/w\\=[0-9]+/', $custom_field->properties['params'], $match_w); if ($match_w) { $w = str_replace("w=", '', $match_w[0]); $custom_field->properties['params'] = str_replace("&" . $match_w[0], "", $custom_field->properties['params']); } preg_match('/h\\=[0-9]+/', $custom_field->properties['params'], $match_h); if ($match_h) { $h = str_replace("h=", '', $match_h[0]); $custom_field->properties['params'] = str_replace("&" . $match_h[0], "", $custom_field->properties['params']); } if ($custom_field->properties['params']) { if (substr($custom_field->properties['params'], 0, 1) == "&") { $c = substr($custom_field->properties['params'], 1); } } } $cssVlaue = $custom_field->CSS; ?> <tr valign="top"> <th scope="row"><span id="lblHeight" style="<?php echo $isDisplay; ?> "><?php _e('Max Height', $mf_domain); ?> :</span></th> <td><span id="txtHeight" style="<?php echo $isDisplay; ?> "><input type="text" name="custom-field-photo-height" id="custom-field-photo-height" size="3" value="<?php echo $h; ?> " /></span></td> </tr> <tr valign="top"> <th scope="row"><span id="lblWidth" style="<?php echo $isDisplay; ?> "><?php _e('Max Width', $mf_domain); ?> :</span></th> <td><span id="txtWidth" style="<?php echo $isDisplay; ?> "><input type="text" name="custom-field-photo-width" id="custom-field-photo-width" size="3" value="<?php echo $w; ?> " /></span></td> </tr> <tr valign="top"> <th scope="row"><span id="lblWidth" style="<?php echo $isDisplay; ?> "><?php _e('Custom', $mf_domain); ?> :</span></th> <td><span id="txtWidth" style="<?php echo $isDisplay; ?> "><input type="text" name="custom-field-custom-params" id="custom-field-custom-params" value="<?php echo $c; ?> " /></span> </td> </tr> <tr valign="top"> <th scope="row"><div id="divLbl" style="<?php echo $isDisplay; ?> "><?php _e('Css Class', $mf_domain); ?> :</div></th> <td> <div id="divCSS" style="<?php echo $isDisplay; ?> "> <input name="custom-field-css" id="custom-field-css" size="40" type="text" value="<?php echo $cssVlaue; ?> " /> </div> </td> </tr> <?php } ?> <!-- END :: For Image/Photo' Css --> </tbody> </table> <input name="mf_action" type="hidden" value="submit-edit-custom-field" /> <p class="submit" > <a style="color:black" href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('cancel-create-custom-field') . "&custom-group-id={$customGroupID}"; ?> " class="button"><?php _e('Cancel', $mf_domain); ?> </a> <input type="submit" id="submit-edit-custom-field" value="<?php _e('Update', $mf_domain); ?> " onclick="submitForm=true;" /> </p> </form> </div> <?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 } }
function PrepareModulesPanelsMenuItems() { $sub_menu_is_modules = false; if (empty($_REQUEST['mf_action'])) { $currentAction = ""; } else { $currentAction = $_REQUEST['mf_action']; } switch ($currentAction) { // ------------ Custom Fields case 'create-custom-field': $page_group = 'RCCWP_CreateCustomFieldPage'; $page_type = 'Main'; break; case 'continue-create-custom-field': if (isset($_REQUEST['custom-group-id']) && !empty($_REQUEST['custom-group-id'])) { $customGroupId = (int) $_REQUEST['custom-group-id']; } $customGroup = RCCWP_CustomGroup::Get($customGroupId); $current_field = RCCWP_CustomField::GetCustomFieldTypes((int) $_REQUEST['custom-field-type']); if ($current_field->has_options == "true" || $current_field->has_properties == "true") { $page_group = 'RCCWP_CreateCustomFieldPage'; $page_type = 'SetOptions'; } else { if ($current_field->has_options == "false") { $default = array('custom-group-id' => '', 'custom-field-name' => '', 'custom-field-description' => '', 'custom-field-order' => '', 'custom-field-required' => '', 'custom-field-type' => '', 'custom-field-options' => '', 'custom-field-duplicate' => '', 'custom-field-helptext' => ''); $save = array_merge($default, $_POST); RCCWP_CustomField::Create($save['custom-group-id'], $save['custom-field-name'], $save['custom-field-description'], $save['custom-field-order'], $save['custom-field-required'], $save['custom-field-type'], $save['custom-field-options'], null, null, $save['custom-field-duplicate'], $save['custom-field-helptext']); $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; } } break; case 'delete-custom-field': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'finish-create-custom-field': case 'cancel-edit-custom-field': case 'cancel-create-custom-field': case 'submit-edit-custom-field': case 'copy-custom-field': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'edit-custom-field': $page_group = 'RCCWP_CustomFieldPage'; $page_type = 'Edit'; break; // ------------ Groups // ------------ Groups case 'create-custom-group': $page_group = 'RCCWP_CreateCustomGroupPage'; $page_type = 'Main'; break; case 'view-custom-group': $page_group = 'RCCWP_CustomGroupPage'; $page_type = 'View'; break; case 'cancel-edit-custom-group': case 'cancel-create-custom-group': case 'delete-custom-group': case 'submit-edit-custom-group': case 'finish-create-custom-group': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'edit-custom-group': $page_group = 'RCCWP_CustomGroupPage'; $page_type = 'Edit'; break; // ------------ Custom Write Panels // ------------ Custom Write Panels case 'view-custom-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'create-custom-write-panel': $page_group = 'RCCWP_CreateCustomWritePanelPage'; $page_type = 'Main'; break; case 'finish-create-custom-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'edit-custom-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'Edit'; break; case 'cancel-edit-custom-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'submit-edit-custom-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'import-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'Import'; break; default: if (isset($_REQUEST['assign-custom-write-panel'])) { $page_group = 'RCCWP_ManagementPage'; $page_type = 'AssignCustomWritePanel'; $sub_menu_is_modules = false; } else { if (isset($_REQUEST['cancel-edit-custom-group'])) { $page_group = 'RCCWP_CustomGroupPage'; $page_type = 'View'; } else { if (isset($_REQUEST['view-groups'])) { $page_group = 'RCCWP_ManagementPage'; $page_type = 'ViewGroups'; } else { $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'ViewWritePanels'; $sub_menu_is_modules = false; } } } } if ($sub_menu_is_modules) { $result->panelsMenuFunction = array('RCCWP_CustomWritePanelPage', 'ViewWritePanels'); $result->modulesMenuFunction = array($page_group, $page_type); } else { $result->panelsMenuFunction = array($page_group, $page_type); $result->modulesMenuFunction = array('RCCWP_ManagementPage', 'ViewModules'); } return $result; }
<?php require dirname(__FILE__) . '/../../../wp-config.php'; if (!is_user_logged_in()) { die("Athentication failed!"); } if (isset($_GET['getFieldsByLetters']) && isset($_GET['letters'])) { $letters = $_GET['letters']; $letters = preg_replace("/[^a-z0-9 ]/si", "", $letters); // Search for similar fields global $wpdb; global $flutter_domain; require_once "RCCWP_CustomField.php"; $sql = "SELECT id, group_id FROM " . RC_CWP_TABLE_GROUP_FIELDS . " WHERE name like '%{$letters}%' "; $results = $wpdb->get_results($sql); foreach ($results as $result) { $fieldGroup = RCCWP_CustomGroup::Get($result->group_id); if ($_GET['panel_id'] != $fieldGroup->panel_id) { $currentField = RCCWP_CustomField::Get($result->id); $fieldDescription = "<b>{$currentField->description}</b> <br /> ("; $fieldDescription .= __("Type", $flutter_domain) . ":"; $fieldDescription .= " {$currentField->type}, "; $fieldDescription .= __("Name", $flutter_domain) . ":"; $fieldDescription .= " {$currentField->name})"; echo $result->id . "###" . $fieldDescription . "|"; } } }
<?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 PrepareModulesPanelsMenuItems() { $sub_menu_is_modules = false; if (empty($_REQUEST['mf_action'])) { $currentAction = ""; } else { $currentAction = $_REQUEST['mf_action']; } switch ($currentAction) { // ------------ Custom Fields case 'create-custom-field': $page_group = 'RCCWP_CreateCustomFieldPage'; $page_type = 'Main'; break; case 'continue-create-custom-field': if (isset($_REQUEST['custom-group-id']) && !empty($_REQUEST['custom-group-id'])) { $customGroupId = (int) $_REQUEST['custom-group-id']; } $customGroup = RCCWP_CustomGroup::Get($customGroupId); $current_field = RCCWP_CustomField::GetCustomFieldTypes((int) $_REQUEST['custom-field-type']); if ($current_field->has_options == "true" || $current_field->has_properties == "true") { $page_group = 'RCCWP_CreateCustomFieldPage'; $page_type = 'SetOptions'; } else { if ($current_field->has_options == "false") { $default = array('custom-group-id' => '', 'custom-field-name' => '', 'custom-field-description' => '', 'custom-field-order' => '', 'custom-field-required' => '', 'custom-field-type' => '', 'custom-field-options' => '', 'custom-field-duplicate' => '', 'custom-field-helptext' => ''); $save = array_merge($default, $_POST); RCCWP_CustomField::Create($save['custom-group-id'], $save['custom-field-name'], $save['custom-field-description'], $save['custom-field-order'], $save['custom-field-required'], $save['custom-field-type'], $save['custom-field-options'], null, null, $save['custom-field-duplicate'], $save['custom-field-helptext']); $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; } } break; case 'delete-custom-field': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'finish-create-custom-field': case 'cancel-edit-custom-field': case 'cancel-create-custom-field': case 'submit-edit-custom-field': case 'copy-custom-field': /* * Adding JS for sorting the order of the fields * using a drag and drop feature */ wp_enqueue_script('magic_set_categories', MF_URI . 'js/sorting_fields.js', array('jquery', 'jquery-ui-sortable')); $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'edit-custom-field': $page_group = 'RCCWP_CustomFieldPage'; $page_type = 'Edit'; break; // ------------ Groups // ------------ Groups case 'create-custom-group': $page_group = 'RCCWP_CreateCustomGroupPage'; $page_type = 'Main'; break; case 'view-custom-group': $page_group = 'RCCWP_CustomGroupPage'; $page_type = 'View'; break; case 'cancel-edit-custom-group': case 'cancel-create-custom-group': case 'delete-custom-group': case 'submit-edit-custom-group': case 'finish-create-custom-group': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'edit-custom-group': $page_group = 'RCCWP_CustomGroupPage'; $page_type = 'Edit'; break; // ------------ Custom Write Panels // ------------ Custom Write Panels case 'view-custom-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; /* * Adding JS for sorting the order of the fields * using a drag and drop feature */ wp_enqueue_script('magic_set_categories', MF_URI . 'js/sorting_fields.js', array('jquery', 'jquery-ui-sortable')); break; case 'create-custom-write-panel': $page_group = 'RCCWP_CreateCustomWritePanelPage'; $page_type = 'Main'; break; case 'finish-create-custom-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'edit-custom-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'Edit'; break; case 'cancel-edit-custom-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'submit-edit-custom-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'View'; break; case 'import-write-panel': $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'Import'; break; default: if (isset($_REQUEST['assign-custom-write-panel'])) { $page_group = 'RCCWP_ManagementPage'; $page_type = 'AssignCustomWritePanel'; $sub_menu_is_modules = false; } else { if (isset($_REQUEST['cancel-edit-custom-group'])) { $page_group = 'RCCWP_CustomGroupPage'; $page_type = 'View'; } else { if (isset($_REQUEST['view-groups'])) { $page_group = 'RCCWP_ManagementPage'; $page_type = 'ViewGroups'; } else { $page_group = 'RCCWP_CustomWritePanelPage'; $page_type = 'ViewWritePanels'; $sub_menu_is_modules = false; } } } } $result = null; if (!is_object($result)) { $result = new StdClass(); } if ($sub_menu_is_modules) { $result->panelsMenuFunction = array('RCCWP_CustomWritePanelPage', 'ViewWritePanels'); $result->modulesMenuFunction = array($page_group, $page_type); } else { $result->panelsMenuFunction = array($page_group, $page_type); $result->modulesMenuFunction = array('RCCWP_ManagementPage', 'ViewModules'); } return $result; }
function DisplayGroupFields($customGroupId, $intended = false) { global $mf_domain; $custom_fields = RCCWP_CustomGroup::GetCustomFields($customGroupId); foreach ($custom_fields as $field) { ?> <tr> <td><a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-field') . "&custom-field-id={$field->id}"; ?> " ><?php if ($intended) { ?> <img align="top" src="<?php echo MF_URI; ?> images/arrow_right.gif" alt=""/> <?php } echo $field->description; ?> </a></td> <td><?php echo $field->type; ?> </td> <td><a onclick="return confirmBeforeDelete();" href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('delete-custom-field') . "&custom-field-id={$field->id}"; ?> " >X <?php _e('Delete', $mf_domain); ?> </a></td> </tr> <?php } }
function DisplayGroupFields($customGroupId, $intended = false) { global $mf_domain; $custom_fields = RCCWP_CustomGroup::GetCustomFields($customGroupId); foreach ($custom_fields as $field) { if (isset($field->properties['strict-max-length']) && $field->properties['strict-max-length'] == 1) { if ($field->type == 'Multiline Textbox') { $maxlength = ' <sup class="help_text strict">[max:' . $field->properties['width'] * $field->properties['height'] . ']</sup>'; } else { $maxlength = ' <sup class="help_text strict">[max:' . $field->properties['size'] . ']</sup>'; } } else { $maxlength = ''; } ?> <tr> <td> <a id="field_<?php echo $field->id; ?> " class="handler" href="javascript:void();"><img src="<?php echo MF_URI; ?> /images/mf_arrows.png"></a> <input type="hidden" name="mf_order[<?php print $customGroupId; ?> ][]" value="<?php echo $field->id; ?> " /> </td> <td><a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-field') . "&custom-field-id={$field->id}"; ?> " ><?php if ($intended) { ?> <img align="top" src="<?php echo MF_URI; ?> images/arrow_right.gif" alt=""/> <?php } echo $field->description . $maxlength; ?> </a><?php if ($field->required_field == 1) { echo ' <span class="required">*</span>'; } ?> </td> <td><tt><?php echo $field->name . ' <span style="color: #999;">(' . $field->display_order . ')</span>'; ?> </tt><?php if ($field->type == 'Textbox' && isset($field->properties['size'])) { echo ' <sup class="help_text">[' . $field->properties['size'] . ']</sup>'; } if ($field->type == 'Multiline Textbox' && isset($field->properties['height']) && isset($field->properties['width'])) { echo ' <sup class="help_text">[' . $field->properties['height'] . '×' . $field->properties['width'] . ']</sup>'; } ?> </td> <td><?php echo $field->type; if ($field->type == 'Multiline Textbox' && isset($field->properties['hide-visual-editor']) && $field->properties['hide-visual-editor'] == 1) { echo ' <sup class="help_text">[simple]</sup>'; } ?> </td> <td><a onclick="return confirmBeforeDelete();" href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('delete-custom-field') . "&custom-field-id={$field->id}"; ?> " >× <?php _e('Delete', $mf_domain); ?> </a></td> </tr> <?php } }
public static function Main() { global $FIELD_TYPES, $mf_domain; $customGroupID = $_REQUEST['custom-group-id']; if (isset($customGroupID)) { $group = RCCWP_CustomGroup::Get($customGroupID); ?> <script type="text/javascript"> var mf_create_field = true; var mf_group_info = { 'name' : '<?php echo stripslashes($group->name); ?> ', 'safe_name' : '<?php echo sanitize_title_with_dashes($group->name); ?> ', 'singular_safe_name' : '<?php echo sanitize_title_with_dashes(Inflect::singularize($group->name)); ?> ' }; </script> <?php } ?> <div class="wrap"> <h2><?php _e("Create Custom Field", $mf_domain); ?> <?php if ($group && $group->name != "__default") { _e("In Group", $mf_domain); echo " <em>" . $group->name . "</em>"; } ?> </h2> <br class="clear" /> <?php if (isset($_GET['err_msg'])) { switch ($_GET['err_msg']) { case -1: ?> <div class="error"><p> <?php _e('A field with the same name already exists in this write panel. Please choose a different name.', $mf_domain); ?> </p></div> <?php } } ?> <form action="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('continue-create-custom-field'); ?> " method="post" name="create_custom_field_form" id="create-custom-field-form" onsubmit="return checkEmpty();" autocomplete="off"> <?php wp_nonce_field('continue-create-custom-field'); ?> <?php if (isset($_GET['custom-group-id']) && !empty($_GET['custom-group-id'])) { ?> <input type="hidden" name="custom-group-id" value="<?php echo $_GET['custom-group-id']; ?> "> <?php } ?> <?php if (isset($_POST['custom-group-id']) && !empty($_POST['custom-group-id'])) { ?> <input type="hidden" name="custom-group-id" value="<?php echo $_POST['custom-group-id']; ?> "> <?php } ?> <table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6"> <tbody> <tr valign="top"> <th scope="row"><?php _e("Label", $mf_domain); ?> :</th> <td> <input name="custom-field-description" id="custom-field-description" size="40" type="text" /> <p> <?php _e('Type a label for the field. The label of the field is displayed beside the field in Write Panel page.', $mf_domain); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e("Name", $mf_domain); ?> :</th> <td> <input name="custom-field-name" id="custom-field-name" size="40" type="text" /> <input type="hidden" id="custom-field-name_hidden" name="custom-field-name_hidden" onchange="copyField();" /> <p> <?php _e('Type a unique name for the field, the name must be unique among all fields in this panel. The name of the field is the key by which you can retrieve the field value later.', $mf_domain); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Help text', $mf_domain); ?> :</th> <td> <input name="custom-field-helptext" id="custom-field-helptext" size="40" type="text" /><br/><small><?php _e('If set, this will be displayed in a tooltip next to the field label', $mf_domain); ?> </small></td> </tr> <tr valign="top"> <th scope="row"><?php _e("Can be duplicated", $mf_domain); ?> :</th> <td><input name="custom-field-duplicate" id="custom-field-duplicate" type="checkbox" value="1" /></td> </tr> <tr valign="top"> <th scope="row"><?php _e("Order", $mf_domain); ?> :</th> <td><input type="text" name="custom-field-order" id="custom-field-order" size="2" value="0" /></td> </tr> <tr valign="top"> <th scope="row"><?php _e("Required", $mf_domain); ?> :</th> <td> <select name="custom-field-required" id="custom-field-required"> <option value="0" selected="selected"><?php _e('Not Required - can be empty', $mf_domain); ?> </option> <option value="1"><?php _e('Required - can not be empty', $mf_domain); ?> </option> </select> </td> </tr> <tr valign="top"> <th scope="row"><?php _e("Type", $mf_domain); ?> :</th> <td> <!-- START :: Javascript for Image/Photo' Css Class and for check --> <script type="text/javascript" language="javascript"> submitForm = false; function fun(name) { if(name == "Image" || name == 'Image (Upload Media)') { document.getElementById('divLbl').style.display = 'inline'; document.getElementById('divCSS').style.display = 'inline'; } else { document.getElementById('divLbl').style.display = 'none'; document.getElementById('divCSS').style.display = 'none'; } } function checkEmpty() { if (submitForm && (document.getElementById('custom-field-name').value == "" || document.getElementById('custom-field-description').value == "")){ alert("<?php _e('Please fill in the name and the label of the field', $mf_domain); ?> "); return false; } return true; } </script> <!-- END :: Javascript for Image/Photo' Css Class --> <?php $field_types = RCCWP_CustomField::GetCustomFieldTypes(); foreach ($field_types as $field) { $checked = $field->name == "Textbox" ? 'checked="checked"' : ''; ?> <label><input name="custom-field-type" value="<?php echo $field->id; ?> " type="radio" <?php echo $checked; ?> onclick='fun("<?php echo $field->name; ?> ");' /> <!-- Calling Javascript Function --> <?php echo $field->name; ?> </label><br /> <?php } ?> </td> </tr> <!-- START :: For Image/Photo' Css --> <tr valign="top"> <th scope="row"><div id="divLbl" style="display:none"><?php _e('Css Class', $mf_domain); ?> :</div></th> <td> <div id="divCSS" style="display:none"> <input name="custom-field-css" id="custom-field-css" size="40" type="text" value="magicfields" /> </div> </td> </tr> <!-- END :: For Image/Photo' Css --> </tbody> </table> <p class="submit" > <a style="color:black" href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('cancel-create-custom-field') . "&custom-group-id={$customGroupID}"; ?> " class="button"><?php _e('Cancel', $mf_domain); ?> </a> <input type="submit" id="continue-create-custom-field" value='<?php _e("Continue", $mf_domain); ?> ' onclick="submitForm=true;"/> </p> </form> </div> <?php }
/** * Export a write panel to file * * @param integer $panelID * @param string $exportedFilename the full path of the file to which the panel will be exported */ function Export($panelID) { include_once 'RCCWP_CustomGroup.php'; include_once 'RCCWP_CustomField.php'; $exported_data = array(); $writePanel = RCCWP_CustomWritePanel::Get($panelID); $writePanel->standardFieldsIDs = RCCWP_CustomWritePanel::GetStandardFields($panelID); $writePanel->assignedCategories = array(); $writePanel->theme = RCCWP_CustomWritePanel::GetThemePage($writePanel->name); $writePanel->parent_page = RCCWP_CustomWritePanel::GetParentPage($writePanel->name); $assignedCategories = RCCWP_CustomWritePanel::GetAssignedCategories($panelID); foreach ($assignedCategories as $assignedCategory) { $writePanel->assignedCategories[] = $assignedCategory->cat_id; } $moduleGroups = RCCWP_CustomWritePanel::GetCustomGroups($panelID); foreach ($moduleGroups as $moduleGroup) { $fields = RCCWP_CustomGroup::GetCustomFields($moduleGroup->id); foreach ($fields as $field) { if ($field->type == "Related Type") { $tmp = RCCWP_CustomWritePanel::Get($field->properties["panel_id"]); $field->properties["panel_name"] = $tmp->name; unset($field->properties["panel_id"]); } } $groupFields[$moduleGroup->name]->fields = $fields; $groupFields[$moduleGroup->name]->duplicate = $moduleGroup->duplicate; $groupFields[$moduleGroup->name]->at_right = $moduleGroup->at_right; } $exported_data['panel'] = $writePanel; $exported_data['fields'] = $groupFields; return serialize($exported_data); }
/** * Export a write panel to file * * @param integer $panelID * @param string $exportedFilename the full path of the file to which the panel will be exported */ function Export($panelID, $exportedFilename) { include_once 'RCCWP_CustomGroup.php'; include_once 'RCCWP_CustomField.php'; $exported_data = array(); $writePanel = RCCWP_CustomWritePanel::Get($panelID); $writePanel->standardFieldsIDs = RCCWP_CustomWritePanel::GetStandardFields($panelID); $writePanel->assignedCategories = array(); $writePanel->theme = RCCWP_CustomWritePanel::GetThemePage($writePanel->name); $writePanel->parent_page = RCCWP_CustomWritePanel::GetParentPage($writePanel->name); $assignedCategories = RCCWP_CustomWritePanel::GetAssignedCategories($panelID); foreach ($assignedCategories as $assignedCategory) { $writePanel->assignedCategories[] = $assignedCategory->cat_name; } $moduleGroups = RCCWP_CustomWritePanel::GetCustomGroups($panelID); foreach ($moduleGroups as $moduleGroup) { $groupFields[$moduleGroup->name]->fields = RCCWP_CustomGroup::GetCustomFields($moduleGroup->id); $groupFields[$moduleGroup->name]->duplicate = $moduleGroup->duplicate; $groupFields[$moduleGroup->name]->at_right = $moduleGroup->at_right; } $exported_data['panel'] = $writePanel; $exported_data['fields'] = $groupFields; $handle = fopen($exportedFilename, "w"); $result = fwrite($handle, serialize($exported_data)); @fclose($handle); }
/** * Audio field */ function AudioInterface($customField, $inputName, $groupCounter, $fieldCounter) { global $mf_domain; $customFieldId = ''; $freshPageFolderName = dirname(plugin_basename(__FILE__)); if ($customField->required_field) { $requiredClass = "field_required"; } if (isset($_REQUEST['post'])) { $customFieldId = $customField->id; $valueOriginal = RCCWP_CustomField::GetCustomFieldValues(true, $_REQUEST['post'], $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-{$inputName}' 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" id="upload_progress_<?php echo $inputName; ?> " style="visibility:hidden;height:0px"></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]; file = jQuery('#'+id).val(); jQuery.get('<?php echo MF_URI; ?> RCCWP_removeFiles.php',{'action':'delete','file':file}, function(message){ //if(message =="true"){ jQuery('#obj-'+id).empty(); jQuery('#actions-'+id).empty(); jQuery('#'+id).val(""); //} }); } } jQuery(document).ready(function(){ jQuery("#remove-<?php echo $inputName; ?> ").click(remove_audio); }); </script> <?php if (!empty(${$valueOriginalRelative})) { echo $value; echo "<div id='actions-{$inputName}'><a href='javascript:void(0);' id='remove-{$inputName}'>" . __("Delete", $mf_domain) . "</a></div>"; } if (empty($valueOriginalRelative)) { $valueOriginalRelative = ''; } ?> <div class="mf_custom_field"> <input tabindex="3" id="<?php echo $inputName; ?> " 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">This field is required.audio</label></div> <?php } }