function show_download_setting_area() { global $fields_download_setting_area, $post; // Use nonce for verification echo '<input type="hidden" name="show_custom_meta_box_extra_product_tab_nonce" value="' . wp_create_nonce(basename(__FILE__)) . '" />'; // Begin the field table and loop echo '<table class="form-table">'; foreach ($fields_download_setting_area as $field) { // get value of this field if it exists for this post $meta = get_post_meta($post->ID, $field['id'], true); // begin a table row with echo '<tr> <th><label for="' . $field['id'] . '">' . $field['label'] . '</label></th> <td>'; switch ($field['type']) { case 'repeatable_download': echo '<a class="custom-repeatable-add-download button" href="#"><i class="fa fa-plus-square" ></i></a> <ul id="' . $field['id'] . '-repeatable" class="custom_repeatable">'; $i = 0; if ($meta) { foreach ($meta as $row) { echo '<li>'; echo ' <div> <span class="sort hndle sort-line"><i class="fa fa-arrows" ></i></span> <a class="repeatable-remove-download button" href="#"><i class="fa fa-minus-square" ></i></a> <br /> <p class="form-field" style="margin-top:10px;"> <label><abbr class="custom_download_name">' . (isset($row['file']) ? '<i class=\'fa fa-check\'></i>' . __('File Uploaded', EXTRA_WOO_TABS_TEXTDOMAN) . '</label>' : '<i class=\'fa fa-times\'></i>' . __('No File Uploaded', EXTRA_WOO_TABS_TEXTDOMAN) . '</label>') . '</abbr></label> <input name="' . $field['id'] . '[' . $i . '][file]" id="' . $field['id'] . '_file" type="hidden" class="custom_upload_download" value="' . (isset($row['file']) ? $row['file'] : '') . '"/> <input name="btn_' . $field['id'] . '[' . $i . ']" class="custom_upload_button_download_new button" type="button" value="' . __('Choose File', EXTRA_WOO_TABS_TEXTDOMAN) . '" style="width: auto" /> <button type="button" class="remove_button_download button">' . __('Remove File', EXTRA_WOO_TABS_TEXTDOMAN) . '</button> </p> </div>'; echo ' <div> <p class="form-field "> <label><abbr title="Download Link">' . __('Download Link', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> <input name="' . $field['id'] . '[' . $i . '][link]" id="' . $field['id'] . 'tab_posts_link" type="text" class="custom_upload_link" size="45" value="' . (isset($row['link']) ? $row['link'] : '') . '" /> </p> </div> <div> <p class="form-field "> <label><abbr title="Download Link">' . __('<-OR->', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> <br /> <label><abbr title="Link Title">' . __('Link Title', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> <input type="text" name="' . $field['id'] . '[' . $i . '][title]" id="' . $field['id'] . 'tab_posts_title" size="45" class="width_170" value="' . (isset($row['title']) ? $row['title'] : '') . '"/> </p> </div> <div> <p class="form-field "> <label><abbr title="Link Title">' . __('Download Description', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> </p> </div>'; /*$editor_id =$field['id'].'_editor'; $settings = array( 'textarea_name' => $field['id'].'['.$i.'][editor]', 'editor_class' => $field['id'].'_editor', ); wp_editor( $meta, $editor_id, $settings );*/ echo '<hr>'; echo hc_tinymce(array('id' => $field['id'] . '_' . rand(0, 100), 'name' => $field['id'] . '[' . $i . '][description]', 'value' => isset($row['description']) ? $row['description'] : '', 'rows' => 15, 'class' => 'product_download_tab_description')); echo '<hr></li>'; $i++; } } else { echo '<li>'; echo ' <div> <span class="sort hndle sort-line"><i class="fa fa-arrows" ></i></span> <a class="repeatable-remove-download button" href="#"><i class="fa fa-minus-square" ></i></a> <br /> <p class="form-field" style="margin-top:10px;"> <label><abbr class="custom_download_name"><i class=\'fa fa-times\'></i>' . __('No File Uploaded', EXTRA_WOO_TABS_TEXTDOMAN) . '</label></abbr></label> <input name="' . $field['id'] . '[' . $i . '][file]" id="' . $field['id'] . '_file" type="hidden" class="custom_upload_download" /> <input name="btn_' . $field['id'] . '[' . $i . ']" class="custom_upload_button_download_new button" type="button" value="' . __('Choose File', EXTRA_WOO_TABS_TEXTDOMAN) . '" style="width: auto" /> <button type="button" class="remove_button_download button">' . __('Remove File', EXTRA_WOO_TABS_TEXTDOMAN) . '</button> </p> </div>'; echo ' <div> <p class="form-field "> <label><abbr title="Download Link">' . __('Download Link', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> <input name="' . $field['id'] . '[' . $i . '][link]" id="' . $field['id'] . 'tab_posts_link" type="text" class="custom_upload_link" size="45" /> </p> </div> <div> <p class="form-field "> <label><abbr title="Download Link">' . __('<-OR->', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> <br /> <label><abbr title="Link Title">' . __('Link Title', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> <input type="text" name="' . $field['id'] . '[' . $i . '][title]" id="' . $field['id'] . 'tab_posts_title" size="45" class="width_170" /> </p> </div> <div> <p class="form-field "> <label><abbr title="Link Title">' . __('Download Description', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> </p> </div>'; echo '<hr>'; echo hc_tinymce(array('id' => $field['id'] . '_' . rand(0, 100), 'name' => $field['id'] . '[' . $i . '][description]', 'value' => '', 'rows' => 15, 'class' => 'product_download_tab_description')); echo '<hr></li>'; $image = ''; } echo '</ul>'; break; } //end switch echo '</td></tr>'; } // end foreach echo '</table>'; // end table }
} } else { echo '<li>'; echo ' <div> <span class="sort hndle sort-line"><i class="fa fa-arrows" ></i></span><br /> <p class="form-field "> <label><abbr title="' . __('Question', EXTRA_WOO_TABS_TEXTDOMAN) . '">' . __('Question', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> <input type="text" name="' . $public_perfix . 'tab_posts[' . $i . '][question]" id="' . $public_perfix . 'tab_posts_question" size="30" class="width_170" /> <a class="repeatable-remove-faq button" href="#"><i class="fa fa-minus-square" ></i></a> </p> </div> <div> <p class="form-field "> <label><abbr title="' . __('Answer', EXTRA_WOO_TABS_TEXTDOMAN) . '">' . __('Answer', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label>'; echo hc_tinymce(array('id' => $public_perfix . 'tab_posts_' . rand(0, 100), 'name' => $public_perfix . 'tab_posts[' . $i . '][answer]', 'value' => '', 'rows' => 15, 'class' => 'product_faq_tab_answer')); echo '</p> </div>'; echo '<hr> </li>'; $image = ''; } ?> </ul> </div> </p> </div> </div> </div> </div>
<label><abbr title="' . __('Download Link', EXTRA_WOO_TABS_TEXTDOMAN) . '">' . __('<-OR->', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> <br /> <label><abbr title="' . __('Download Link', EXTRA_WOO_TABS_TEXTDOMAN) . '">' . __('Download Link', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> <input name="' . $public_perfix . 'tab_posts[' . $i . '][link]" id="' . $public_perfix . 'tab_posts_link" type="text" class="custom_upload_link" size="45" value="' . (isset($row['link']) ? $row['link'] : '') . '" /> </p> </div> <div> <p class="form-field "> <label><abbr title="' . __('Link Title', EXTRA_WOO_TABS_TEXTDOMAN) . '">' . __('Link Title', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label> <input type="text" name="' . $public_perfix . 'tab_posts[' . $i . '][title]" id="' . $public_perfix . 'tab_posts_title" size="45" class="width_170"/> </p> </div> <div> <p class="form-field "> <label><abbr title="' . __('Link Title', EXTRA_WOO_TABS_TEXTDOMAN) . '">' . __('Download Description', EXTRA_WOO_TABS_TEXTDOMAN) . '</abbr></label>'; echo hc_tinymce(array('id' => $public_perfix . 'tab_posts_' . rand(0, 100), 'name' => $public_perfix . 'tab_posts[' . $i . '][description]', 'value' => '', 'rows' => 15, 'class' => 'product_download_tab_description')); echo '</p> </div>'; echo '<hr> </li>'; $image = ''; } ?> </ul> </div> </p> </div> </div> </div> </div>
function insert_tinymce() { hc_tinymce(array('id' => $_POST['id'], 'name' => $_POST['name'], 'value' => '', 'rows' => 15, 'class' => $_POST['class'])); exit; }