/** * Outputs the add listing form HTML content. * * Other things are needed to output a working add listing form, you should use the add listing shortcode if needed. * * @since 1.0.0 * @package GeoDirectory * @global object $current_user Current user object. * @global object $post The current post object. * @global object $post_images Image objects of current post if available. */ function geodir_action_add_listing_form() { global $cat_display, $post_cat, $current_user; $page_id = get_the_ID(); $post = ''; $title = ''; $desc = ''; $kw_tags = ''; $required_msg = ''; $submit_button = ''; if (isset($_REQUEST['ajax_action'])) { $ajax_action = $_REQUEST['ajax_action']; } else { $ajax_action = 'add'; } $thumb_img_arr = array(); $curImages = ''; if (isset($_REQUEST['backandedit'])) { global $post; $post = (object) unserialize($_SESSION['listing']); $listing_type = $post->listing_type; $title = $post->post_title; $desc = $post->post_desc; /*if(is_array($post->post_category) && !empty($post->post_category)) $post_cat = $post->post_category; else*/ $post_cat = $post->post_category; $kw_tags = $post->post_tags; $curImages = isset($post->post_images) ? $post->post_images : ''; } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { global $post, $post_images; /*query_posts(array('p'=>$_REQUEST['pid'])); if ( have_posts() ) while ( have_posts() ) the_post(); global $post,$post_images;*/ $post = geodir_get_post_info($_REQUEST['pid']); $thumb_img_arr = geodir_get_images($post->ID); if ($thumb_img_arr) { foreach ($thumb_img_arr as $post_img) { $curImages .= $post_img->src . ','; } } $listing_type = $post->post_type; $title = $post->post_title; $desc = $post->post_content; //$post_cat = $post->categories; $kw_tags = $post->post_tags; $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names'))); } else { $listing_type = $_REQUEST['listing_type']; } if ($current_user->ID != '0') { $user_login = true; } ?> <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?> " method="post" enctype="multipart/form-data"> <input type="hidden" name="preview" value="<?php echo $listing_type; ?> "/> <input type="hidden" name="listing_type" value="<?php echo $listing_type; ?> "/> <?php if ($page_id) { ?> <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?> " /><?php } ?> <?php if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?> <input type="hidden" name="pid" value="<?php echo $_REQUEST['pid']; ?> "/> <?php } ?> <?php if (isset($_REQUEST['backandedit'])) { ?> <input type="hidden" name="backandedit" value="<?php echo $_REQUEST['backandedit']; ?> "/> <?php } ?> <?php /** * Called at the very top of the add listing page form for frontend. * * This is called just before the "Enter Listing Details" text. * * @since 1.0.0 */ do_action('geodir_before_detail_fields'); ?> <h5><?php echo LISTING_DETAILS_TEXT; ?> </h5> <?php /** * Called at the top of the add listing page form for frontend. * * This is called after the "Enter Listing Details" text. * * @since 1.0.0 */ do_action('geodir_before_main_form_fields'); ?> <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix"> <label><?php echo PLACE_TITLE_TEXT; ?> <span>*</span> </label> <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield" value="<?php echo esc_attr(stripslashes($title)); ?> "/> <span class="geodir_message_error"><?php _e($required_msg, GEODIRECTORY_TEXTDOMAIN); ?> </span> </div> <?php $show_editor = get_option('geodir_tiny_editor_on_add_listing'); $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc)); $desc_limit = ''; /** * Filter the add listing description field character limit number. * * @since 1.0.0 * @param int $desc_limit The amount of characters to limit the description to. */ $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit); /** * Filter the add listing description field text. * * @since 1.0.0 * @param string $desc The text for the description field. * @param int $desc_limit The character limit numer if any. */ $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit); $desc_limit_msg = ''; /** * Filter the add listing description limit message. * * This is the message shown if there is a limit applied to the amount of characters the description can use. * * @since 1.0.0 * @param string $desc_limit_msg The limit message string if any. * @param int $desc_limit The character limit numer if any. */ $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit); ?> <?php /** * Called on the add listing page form for frontend just before the description field. * * @since 1.0.0 */ do_action('geodir_before_description_field'); ?> <div id="geodir_post_desc_row" class="<?php if ($desc_limit != '0') { echo 'required_field'; } ?> geodir_form_row clearfix"> <label><?php echo PLACE_DESC_TEXT; ?> <span><?php if ($desc_limit != '0') { echo '*'; } ?> </span> </label> <?php if (!empty($show_editor) && in_array($listing_type, $show_editor)) { $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?> <div class="editor" field_id="post_desc" field_type="editor"> <?php wp_editor($desc, "post_desc", $editor_settings); ?> </div> <?php if ($desc_limit != '') { ?> <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?> ");</script> <?php } ?> <?php } else { ?> <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?> "><?php echo $desc; ?> </textarea> <?php } ?> <?php if ($desc_limit_msg != '') { ?> <span class="geodir_message_note"><?php echo $desc_limit_msg; ?> </span> <?php } ?> <span class="geodir_message_error"><?php echo _e($required_msg, GEODIRECTORY_TEXTDOMAIN); ?> </span> </div> <?php /** * Called on the add listing page form for frontend just after the description field. * * @since 1.0.0 */ do_action('geodir_after_description_field'); ?> <?php $kw_tags = esc_attr(stripslashes($kw_tags)); $kw_tags_count = TAGKW_TEXT_COUNT; $kw_tags_msg = TAGKW_MSG; /** * Filter the add listing tags character limit. * * @since 1.0.0 * @param int $kw_tags_count The character count limit if any. */ $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count); /** * Filter the add listing tags field value. * * You can use the $_REQUEST values to check if this is a go back and edit value etc. * * @since 1.0.0 * @param string $kw_tags The tag field value, usually a comma separated list of tags. * @param int $kw_tags_count The character count limit if any. */ $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count); /** * Filter the add listing tags field message text. * * @since 1.0.0 * @param string $kw_tags_msg The message shown under the field. * @param int $kw_tags_count The character count limit if any. */ $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count); ?> <?php /** * Called on the add listing page form for frontend just before the tags field. * * @since 1.0.0 */ do_action('geodir_before_listing_tags_field'); ?> <div id="geodir_post_tags_row" class="geodir_form_row clearfix"> <label><?php echo TAGKW_TEXT; ?> </label> <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?> " type="text" class="geodir_textfield" maxlength="<?php echo $kw_tags_count; ?> "/> <span class="geodir_message_note"><?php echo $kw_tags_msg; ?> </span> </div> <?php /** * Called on the add listing page form for frontend just after the tags field. * * @since 1.0.0 */ do_action('geodir_after_listing_tags_field'); ?> <?php $package_info = array(); $package_info = geodir_post_package_info($package_info, $post); geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type); ?> <?php // adjust values here $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls $multiple = true; // allow multiple files upload $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) $thumb_img_arr = array(); $totImg = 0; if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) { $post = (object) unserialize($_SESSION['listing']); if (isset($post->post_images)) { $curImages = trim($post->post_images, ","); } if ($curImages != '') { $curImages_array = explode(',', $curImages); $totImg = count($curImages_array); } $listing_type = $post->listing_type; } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { $post = geodir_get_post_info($_REQUEST['pid']); $listing_type = $post->post_type; $thumb_img_arr = geodir_get_images($_REQUEST['pid']); } else { $listing_type = $_REQUEST['listing_type']; } if (!empty($thumb_img_arr)) { foreach ($thumb_img_arr as $img) { //$curImages = $img->src.","; } $totImg = count((array) $thumb_img_arr); } if ($curImages != '') { $svalue = $curImages; } else { $svalue = ''; } $image_limit = $package_info->image_limit; $show_image_input_box = $image_limit != '0'; /** * Filter to be able to show/hide the image upload section of the add listing form. * * @since 1.0.0 * @param bool $show_image_input_box Set true to show. Set false to not show. * @param string $listing_type The custom post type slug. */ $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type); if ($show_image_input_box) { ?> <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?> <?php if ($image_limit == 1) { echo '<br /><small>(' . __('You can upload', GEODIRECTORY_TEXTDOMAIN) . ' ' . $image_limit . ' ' . __('image with this package', GEODIRECTORY_TEXTDOMAIN) . ')</small>'; } ?> <?php if ($image_limit > 1) { echo '<br /><small>(' . __('You can upload', GEODIRECTORY_TEXTDOMAIN) . ' ' . $image_limit . ' ' . __('images with this package', GEODIRECTORY_TEXTDOMAIN) . ')</small>'; } ?> <?php if ($image_limit == '') { echo '<br /><small>(' . __('You can upload unlimited images with this package', GEODIRECTORY_TEXTDOMAIN) . ')</small>'; } ?> </h5> <div class="geodir_form_row clearfix" id="<?php echo $id; ?> dropbox" align="center" style="border:1px solid #ccc; min-height:100px; height:auto; padding:10px;"> <input type="hidden" name="<?php echo $id; ?> " id="<?php echo $id; ?> " value="<?php echo $svalue; ?> "/> <input type="hidden" name="<?php echo $id; ?> image_limit" id="<?php echo $id; ?> image_limit" value="<?php echo $image_limit; ?> "/> <input type="hidden" name="<?php echo $id; ?> totImg" id="<?php echo $id; ?> totImg" value="<?php echo $totImg; ?> "/> <div class="plupload-upload-uic hide-if-no-js <?php if ($multiple) { ?> plupload-upload-uic-multiple<?php } ?> " id="<?php echo $id; ?> plupload-upload-ui"> <h4><?php _e('Drop files to upload', GEODIRECTORY_TEXTDOMAIN); ?> </h4><br/> <input id="<?php echo $id; ?> plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files', GEODIRECTORY_TEXTDOMAIN); ?> " class="geodir_button"/> <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?> "></span> <?php if ($width && $height) { ?> <span class="plupload-resize"></span> <span class="plupload-width" id="plupload-width<?php echo $width; ?> "></span> <span class="plupload-height" id="plupload-height<?php echo $height; ?> "></span> <?php } ?> <div class="filelist"></div> </div> <div class="plupload-thumbs <?php if ($multiple) { ?> plupload-thumbs-multiple<?php } ?> clearfix" id="<?php echo $id; ?> plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;"> </div> <span id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', GEODIRECTORY_TEXTDOMAIN); ?> </span> <span id="<?php echo $id; ?> upload-error" style="display:none"></span> </div> <?php } ?> <?php /** * Called on the add listing page form for frontend just after the image upload field. * * @since 1.0.0 */ do_action('geodir_after_main_form_fields'); ?> <!-- add captcha code --> <script> <!--<script>--> document.write('<inp' + 'ut type="hidden" id="geodir_sp' + 'amblocker_top_form" name="geodir_sp' + 'amblocker" value="64"/>') </script> <noscript> <div> <label><?php _e('Type 64 into this box', GEODIRECTORY_TEXTDOMAIN); ?> </label> <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/> </div> </noscript> <input type="text" id="geodir_filled_by_spam_bot_top_form" name="geodir_filled_by_spam_bot" value=""/> <!-- end captcha code --> <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" align="center" style="padding:2px;"> <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?> " class="geodir_button" <?php echo $submit_button; ?> /> <span class="geodir_message_note" style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', GEODIRECTORY_TEXTDOMAIN); ?> </span> </div> </form> <?php wp_reset_query(); }
/** * Prints Attachments meta box content. * * @since 1.0.0 * @package GeoDirectory * @global object $post The post object. * @global int $post_id The post ID. */ function geodir_post_attachments() { global $post, $post_id; wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename'); if (geodir_get_featured_image($post_id, 'thumbnail')) { echo '<h4>' . __('Featured Image', GEODIRECTORY_TEXTDOMAIN) . '</h4>'; geodir_show_featured_image($post_id, 'thumbnail'); } $image_limit = 0; ?> <h5 class="form_title"> <?php if ($image_limit != 0 && $image_limit == 1) { echo '<br /><small>(' . __('You can upload', GEODIRECTORY_TEXTDOMAIN) . ' ' . $image_limit . ' ' . __('image with this package', GEODIRECTORY_TEXTDOMAIN) . ')</small>'; } ?> <?php if ($image_limit != 0 && $image_limit > 1) { echo '<br /><small>(' . __('You can upload', GEODIRECTORY_TEXTDOMAIN) . ' ' . $image_limit . ' ' . __('images with this package', GEODIRECTORY_TEXTDOMAIN) . ')</small>'; } ?> <?php if ($image_limit == 0) { echo '<br /><small>(' . __('You can upload unlimited images with this package', GEODIRECTORY_TEXTDOMAIN) . ')</small>'; } ?> </h5> <?php $curImages = geodir_get_images($post_id); $place_img_array = array(); if (!empty($curImages)) { foreach ($curImages as $p_img) { $place_img_array[] = $p_img->src; } } if (!empty($place_img_array)) { $curImages = implode(',', $place_img_array); } // adjust values here $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls $svalue = $curImages; // this will be initial value of the above form field. Image urls. $multiple = true; // allow multiple files upload $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) ?> <div class="gtd-form_row clearfix" id="<?php echo $id; ?> dropbox" style="border:1px solid #999999; padding:5px;" align="center"> <input type="hidden" name="<?php echo $id; ?> " id="<?php echo $id; ?> " value="<?php echo $svalue; ?> "/> <div class="plupload-upload-uic hide-if-no-js <?php if ($multiple) { ?> plupload-upload-uic-multiple<?php } ?> " id="<?php echo $id; ?> plupload-upload-ui"> <h4><?php _e('Drop files to upload', GEODIRECTORY_TEXTDOMAIN); ?> </h4> <input id="<?php echo $id; ?> plupload-browse-button" type="button" value="<?php _e('Select Files', GEODIRECTORY_TEXTDOMAIN); ?> " class="button"/> <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?> "></span> <?php if ($width && $height) { ?> <span class="plupload-resize"></span> <span class="plupload-width" id="plupload-width<?php echo $width; ?> "></span> <span class="plupload-height" id="plupload-height<?php echo $height; ?> "></span> <?php } ?> <div class="filelist"></div> </div> <div class="plupload-thumbs <?php if ($multiple) { ?> plupload-thumbs-multiple<?php } ?> clearfix" id="<?php echo $id; ?> plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;"> </div> <span id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', GEODIRECTORY_TEXTDOMAIN); ?> </span> <span id="<?php echo $id; ?> upload-error" style="display:none"></span> </div> <?php }
/** * Displays custom fields html. * * @since 1.0.0 * @since 1.5.2 Added TERRAIN map type. * @package GeoDirectory * @global object $wpdb WordPress Database object. * @global object $post The current post object. * @global array $geodir_addon_list List of active GeoDirectory extensions. * @param int|string $package_id The package ID. * @param string $default Optional. When set to "default" it will display only default fields. * @param string $post_type Optional. The wordpress post type. */ function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') { global $is_default, $mapzoom; $show_editors = array(); $listing_type = $post_type; $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); foreach ($custom_fields as $key => $val) { $val = stripslashes_deep($val); // strip slashes from labels $name = $val['name']; $site_title = $val['site_title']; $type = $val['type']; $admin_desc = $val['desc']; $option_values = $val['option_values']; $is_required = $val['is_required']; $is_default = $val['is_default']; $is_admin = $val['is_admin']; $required_msg = $val['required_msg']; $extra_fields = unserialize($val['extra_fields']); $value = ''; /* field available to site admin only for edit */ $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false; if ($for_admin_use && !is_super_admin()) { continue; } if (is_admin()) { global $post; if (isset($_REQUEST['post'])) { $_REQUEST['pid'] = $_REQUEST['post']; } } if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && isset($_SESSION['listing'])) { $post = unserialize($_SESSION['listing']); $value = isset($post[$name]) ? $post[$name] : ''; } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { $value = geodir_get_post_meta($_REQUEST['pid'], $name, true); } else { if ($value == '') { $value = $val['default']; } } /** * Called before the custom fields info is output for submitting a post. * * Used dynamic hook type geodir_before_custom_form_field_$name. * * @since 1.0.0 * @param string $listing_type The post post type. * @param int $package_id The price package ID for the post. * @param array $val The settings array for the field. {@see geodir_custom_field_save()}. * @see 'geodir_after_custom_form_field_$name' */ do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val); if ($type == 'fieldset') { ?> <h5><?php echo $site_title; ?> <?php if ($admin_desc != '') { echo '<small>( ' . $admin_desc . ' )</small>'; } ?> </h5><?php } elseif ($type == 'address') { $prefix = $name . '_'; $site_title != '' ? $address_title = $site_title : ($address_title = ucwords($prefix . ' address')); $extra_fields['zip_lable'] != '' ? $zip_title = $extra_fields['zip_lable'] : ($zip_title = ucwords($prefix . ' zip/post code ')); $extra_fields['map_lable'] != '' ? $map_title = $extra_fields['map_lable'] : ($map_title = ucwords('set address on map')); $extra_fields['mapview_lable'] != '' ? $mapview_title = $extra_fields['mapview_lable'] : ($mapview_title = ucwords($prefix . ' mapview')); $address = ''; $zip = ''; $mapview = ''; $mapzoom = ''; $lat = ''; $lng = ''; if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && isset($_SESSION['listing'])) { $post = unserialize($_SESSION['listing']); $address = $post[$prefix . 'address']; $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && ($post_info = geodir_get_post_info($_REQUEST['pid']))) { $post_info = (array) $post_info; $address = $post_info[$prefix . 'address']; $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; } $location = geodir_get_default_location(); if (empty($city)) { $city = isset($location->city) ? $location->city : ''; } if (empty($region)) { $region = isset($location->region) ? $location->region : ''; } if (empty($country)) { $country = isset($location->country) ? $location->country : ''; } $lat_lng_blank = false; if (empty($lat) && empty($lng)) { $lat_lng_blank = true; } if (empty($lat)) { $lat = isset($location->city_latitude) ? $location->city_latitude : ''; } if (empty($lng)) { $lng = isset($location->city_longitude) ? $location->city_longitude : ''; } /** * Filter the default latitude. * * @since 1.0.0 * * @param float $lat Default latitude. * @param bool $is_admin For admin use only?. */ $lat = apply_filters('geodir_default_latitude', $lat, $is_admin); /** * Filter the default longitude. * * @since 1.0.0 * * @param float $lat Default longitude. * @param bool $is_admin For admin use only?. */ $lng = apply_filters('geodir_default_longitude', $lng, $is_admin); ?> <div id="geodir_<?php echo $prefix . 'address'; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input type="text" field_type="<?php echo $type; ?> " name="<?php echo $prefix . 'address'; ?> " id="<?php echo $prefix . 'address'; ?> " class="geodir_textfield" value="<?php echo esc_attr(stripslashes($address)); ?> "/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php /** * Called after the address input on the add listings. * * This is used by the location manage to add further locations info etc. * * @since 1.0.0 * @param array $val The array of setting for the custom field. {@see geodir_custom_field_save()}. */ do_action('geodir_address_extra_listing_fields', $val); if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> <div id="geodir_<?php echo $prefix . 'zip'; ?> _row" class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix"> <label> <?php _e($zip_title, 'geodirectory'); ?> <?php /*if($is_required) echo '<span>*</span>';*/ ?> </label> <input type="text" field_type="<?php echo $type; ?> " name="<?php echo $prefix . 'zip'; ?> " id="<?php echo $prefix . 'zip'; ?> " class="geodir_textfield autofill" value="<?php echo esc_attr(stripslashes($zip)); ?> "/> <?php /*if($is_required) {?> <span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span> <?php }*/ ?> </div> <?php } ?> <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?> <div id="geodir_<?php echo $prefix . 'map'; ?> _row" class="geodir_form_row clearfix"> <?php /** * Contains add listing page map functions. * * @since 1.0.0 */ include geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"; if ($lat_lng_blank) { $lat = ''; $lng = ''; } ?> <span class="geodir_message_note"><?php echo GET_MAP_MSG; ?> </span> </div> <?php /* show lat lng */ $style_latlng = isset($extra_fields['show_latlng']) && $extra_fields['show_latlng'] || is_admin() ? '' : 'style="display:none"'; ?> <div id="geodir_<?php echo $prefix . 'latitude'; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix" <?php echo $style_latlng; ?> > <label> <?php echo PLACE_ADDRESS_LAT; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input type="text" field_type="<?php echo $type; ?> " name="<?php echo $prefix . 'latitude'; ?> " id="<?php echo $prefix . 'latitude'; ?> " class="geodir_textfield" value="<?php echo esc_attr(stripslashes($lat)); ?> " size="25"/> <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <div id="geodir_<?php echo $prefix . 'longitude'; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix" <?php echo $style_latlng; ?> > <label> <?php echo PLACE_ADDRESS_LNG; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input type="text" field_type="<?php echo $type; ?> " name="<?php echo $prefix . 'longitude'; ?> " id="<?php echo $prefix . 'longitude'; ?> " class="geodir_textfield" value="<?php echo esc_attr(stripslashes($lng)); ?> " size="25"/> <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } ?> <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?> <div id="geodir_<?php echo $prefix . 'mapview'; ?> _row" class="geodir_form_row clearfix "> <label><?php _e($mapview_title, 'geodirectory'); ?> </label> <span class="geodir_user_define"><input field_type="<?php echo $type; ?> " type="radio" class="gd-checkbox" name="<?php echo $prefix . 'mapview'; ?> " id="<?php echo $prefix . 'mapview'; ?> " <?php if ($mapview == 'ROADMAP' || $mapview == '') { echo 'checked="checked"'; } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?> </span> <span class="geodir_user_define"> <input field_type="<?php echo $type; ?> " type="radio" class="gd-checkbox" name="<?php echo $prefix . 'mapview'; ?> " id="map_view1" <?php if ($mapview == 'SATELLITE') { echo 'checked="checked"'; } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?> </span> <span class="geodir_user_define"><input field_type="<?php echo $type; ?> " type="radio" class="gd-checkbox" name="<?php echo $prefix . 'mapview'; ?> " id="map_view2" <?php if ($mapview == 'HYBRID') { echo 'checked="checked"'; } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?> </span> <span class="geodir_user_define"><input field_type="<?php echo $type; ?> " type="radio" class="gd-checkbox" name="<?php echo $prefix . 'mapview'; ?> " id="map_view3" <?php if ($mapview == 'TERRAIN') { echo 'checked="checked"'; } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?> </span> </div> <?php } ?> <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?> <input type="hidden" value="<?php if (isset($mapzoom)) { echo esc_attr($mapzoom); } ?> " name="<?php echo $prefix . 'mapzoom'; ?> " id="<?php echo $prefix . 'mapzoom'; ?> "/> <?php } ?> <?php } elseif ($type == 'text') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr(stripslashes($value)); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'email') { if ($value == $val['default']) { $value = ''; } ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr(stripslashes($value)); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'phone') { if ($value == $val['default']) { $value = ''; } ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr(stripslashes($value)); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'url') { if ($value == $val['default']) { $value = ''; } ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr(stripslashes($value)); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'radio') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <?php if ($option_values) { $option_values_arr = explode(',', $option_values); for ($i = 0; $i < count($option_values_arr); $i++) { if (strstr($option_values_arr[$i], "/")) { $radio_attr = explode("/", $option_values_arr[$i]); $radio_lable = ucfirst($radio_attr[0]); $radio_value = $radio_attr[1]; } else { $radio_lable = ucfirst($option_values_arr[$i]); $radio_value = $option_values_arr[$i]; } ?> <input name="<?php echo $name; ?> " id="<?php echo $name; ?> " <?php if ($radio_value == $value) { echo 'checked="checked"'; } ?> value="<?php echo $radio_value; ?> " class="gd-checkbox" field_type="<?php echo $type; ?> " type="radio" /><?php _e($radio_lable); ?> <?php } } ?> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'checkbox') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <?php if ($value != '1') { $value = '0'; } ?> <input type="hidden" name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr($value); ?> "/> <input <?php if ($value == '1') { echo 'checked="checked"'; } ?> value="1" class="gd-checkbox" field_type="<?php echo $type; ?> " type="checkbox" onchange="if(this.checked){jQuery('#<?php echo $name; ?> ').val('1');} else{ jQuery('#<?php echo $name; ?> ').val('0');}"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'textarea') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label><?php if (is_array($extra_fields) && in_array('1', $extra_fields)) { $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?> <div class="editor" field_id="<?php echo $name; ?> " field_type="editor"> <?php wp_editor(stripslashes($value), $name, $editor_settings); ?> </div><?php } else { ?> <textarea field_type="<?php echo $type; ?> " class="geodir_textarea" name="<?php echo $name; ?> " id="<?php echo $name; ?> "><?php echo stripslashes($value); ?> </textarea><?php } ?> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'select') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row geodir_custom_fields clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <?php $option_values_arr = geodir_string_values_to_options($option_values); $select_options = ''; if (!empty($option_values_arr)) { foreach ($option_values_arr as $option_row) { if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { $option_label = isset($option_row['label']) ? $option_row['label'] : ''; $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; } else { $option_label = isset($option_row['label']) ? $option_row['label'] : ''; $option_value = isset($option_row['value']) ? $option_row['value'] : ''; $selected = $option_value == $value ? 'selected="selected"' : ''; $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; } } } ?> <select field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " class="geodir_textfield textfield_x chosen_select" data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…'; ?> " option-ajaxchosen="false"><?php echo $select_options; ?> </select> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } else { if ($type == 'multiselect') { $multi_display = 'select'; if (!empty($val['extra_fields'])) { $multi_display = unserialize($val['extra_fields']); } ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input type="hidden" name="gd_field_<?php echo $name; ?> " value="1"/> <?php if ($multi_display == 'select') { ?> <div class="geodir_multiselect_list"> <select field_type="<?php echo $type; ?> " name="<?php echo $name; ?> []" id="<?php echo $name; ?> " multiple="multiple" class="geodir_textfield textfield_x chosen_select" data-placeholder="<?php _e('Select', 'geodirectory'); ?> " option-ajaxchosen="false"> <?php } else { echo '<ul class="gd_multi_choice">'; } $option_values_arr = geodir_string_values_to_options($option_values); $select_options = ''; if (!empty($option_values_arr)) { foreach ($option_values_arr as $option_row) { if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { $option_label = isset($option_row['label']) ? $option_row['label'] : ''; if ($multi_display == 'select') { $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; } else { $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; } } else { $option_label = isset($option_row['label']) ? $option_row['label'] : ''; $option_value = isset($option_row['value']) ? $option_row['value'] : ''; $selected = $option_value == $value ? 'selected="selected"' : ''; $selected = ''; $checked = ''; if (!is_array($value) && trim($value) != '' || is_array($value) && !empty($value)) { if (!is_array($value)) { $value_array = explode(',', $value); } else { $value_array = $value; } if (is_array($value_array)) { if (in_array($option_value, $value_array)) { $selected = 'selected="selected"'; $checked = 'checked="checked"'; } } } if ($multi_display == 'select') { $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; } else { $select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; } } } } echo $select_options; if ($multi_display == 'select') { ?> </select></div> <?php } else { ?> </ul><?php } ?> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } else { if ($type == 'html') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?> <div class="editor" field_id="<?php echo $name; ?> " field_type="editor"> <?php wp_editor(stripslashes($value), $name, $editor_settings); ?> </div> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'datepicker') { if ($extra_fields['date_format'] == '') { $extra_fields['date_format'] = 'yy-mm-dd'; } $search = array('dd', 'mm', 'yy'); $replace = array('d', 'm', 'Y'); $date_format = str_replace($search, $replace, $extra_fields['date_format']); if ($value && !isset($_REQUEST['backandedit'])) { $time = strtotime($value); $value = date($date_format, $time); } ?> <script type="text/javascript"> jQuery(function () { jQuery("#<?php echo $name; ?> ").datepicker({changeMonth: true, changeYear: true,}); jQuery("#<?php echo $name; ?> ").datepicker("option", "dateFormat", '<?php echo $extra_fields['date_format']; ?> '); <?php if (!empty($value)) { ?> jQuery("#<?php echo $name; ?> ").datepicker("setDate", "<?php echo $value; ?> "); <?php } ?> }); </script> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr($value); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'time') { if ($value != '') { $value = date('H:i', strtotime($value)); } ?> <script type="text/javascript"> jQuery(document).ready(function () { jQuery('#<?php echo $name; ?> ').timepicker({ showPeriod: true, showLeadingZero: true, showPeriod: true, }); }); </script> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input readonly="readonly" field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr($value); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'taxonomy') { if ($value == $val['default']) { $value = ''; } ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <div id="<?php echo $name; ?> " class="geodir_taxonomy_field" style="float:left; width:70%;"> <?php global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; $exclude_cats = array(); if ($is_admin == '1') { $post_type = get_post_type(); $package_info = array(); $package_info = (array) geodir_post_package_info($package_info, $post, $post_type); if (!empty($package_info)) { if (isset($package_info['cat']) && $package_info['cat'] != '') { $exclude_cats = explode(',', $package_info['cat']); } } } $cat_display = unserialize($val['extra_fields']); if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) { $post_cat = implode(",", $post_cat[$name]); } else { if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); } } global $geodir_addon_list; if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { $catadd_limit = $wpdb->get_var($wpdb->prepare("SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", array($package_id))); } else { $catadd_limit = 0; } if ($cat_display != '' && $cat_display != 'ajax_chained') { $required_limit_msg = ''; if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); } else { $required_limit_msg = $required_msg; } echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; if ($cat_display == 'select' || $cat_display == 'multiselect') { $cat_display == ''; $multiple = ''; if ($cat_display == 'multiselect') { $multiple = 'multiple="multiple"'; } echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; if ($cat_display == 'select') { echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; } } echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); if ($cat_display == 'select' || $cat_display == 'multiselect') { echo '</select>'; } } else { echo geodir_custom_taxonomy_walker2($name, $catadd_limit); } ?> </div> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'file') { ?> <?php // adjust values here $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls if ($value != '') { $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. } else { $file_value = ''; } if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) { $file_multiple = true; } else { $file_multiple = false; } if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) { $file_image_limit = $extra_fields['image_limit']; } else { $file_image_limit = 1; } $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) if (!empty($file_value)) { $curImages = explode(',', $file_value); if (!empty($curImages)) { $file_totImg = count($curImages); } } $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : ''; $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; ?> <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?> <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?> <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?> <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?> </h5> <?php */ ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <div id="<?php echo $file_id; ?> dropbox" align="center" style=""> <label style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); echo $site_title; if ($is_required) { echo '<span>*</span>'; } ?> </label> <input class="geodir-custom-file-upload" field_type="file" type="hidden" name="<?php echo $file_id; ?> " id="<?php echo $file_id; ?> " value="<?php echo esc_attr($file_value); ?> "/> <input type="hidden" name="<?php echo $file_id; ?> image_limit" id="<?php echo $file_id; ?> image_limit" value="<?php echo $file_image_limit; ?> "/> <?php if ($allowed_file_types != '') { ?> <input type="hidden" name="<?php echo $file_id; ?> _allowed_types" id="<?php echo $file_id; ?> _allowed_types" value="<?php echo esc_attr($allowed_file_types); ?> " data-exts="<?php echo esc_attr($display_file_types); ?> "/> <?php } ?> <input type="hidden" name="<?php echo $file_id; ?> totImg" id="<?php echo $file_id; ?> totImg" value="<?php if (isset($file_totImg)) { echo esc_attr($file_totImg); } else { echo '0'; } ?> "/> <div style="float:left; width:55%;"> <div class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple) { ?> plupload-upload-uic-multiple<?php } ?> " id="<?php echo $file_id; ?> plupload-upload-ui" style="float:left; width:30%;"> <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */ ?> <input id="<?php echo $file_id; ?> plupload-browse-button" type="button" value="<?php $file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory'); ?> " class="geodir_button" style="margin-top:10px;"/> <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?> "></span> <?php if ($file_width && $file_height) { ?> <span class="plupload-resize"></span> <span class="plupload-width" id="plupload-width<?php echo $file_width; ?> "></span> <span class="plupload-height" id="plupload-height<?php echo $file_height; ?> "></span> <?php } ?> <div class="filelist"></div> </div> <div class="plupload-thumbs <?php if ($file_multiple) { ?> plupload-thumbs-multiple<?php } ?> " id="<?php echo $file_id; ?> plupload-thumbs" style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;"> </div> <?php /*?><span id="upload-msg" ><?php _e('Please drag & drop the images to rearrange the order');?></span><?php */ ?> <span id="<?php echo $file_id; ?> upload-error" style="display:none"></span> </div> </div> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : ''; ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } } } /** * Called after the custom fields info is output for submitting a post. * * Used dynamic hook type geodir_after_custom_form_field_$name. * * @since 1.0.0 * @param string $listing_type The post post type. * @param int $package_id The price package ID for the post. * @param array $val The settings array for the field. {@see geodir_custom_field_save()}. * @see 'geodir_before_custom_form_field_$name' */ do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val); } }
/** * Adds comment image upload form field to the detail page. * * @since 1.0.0 * @package GeoDirectory_Review_Rating_Manager */ function geodir_reviewrating_rating_img_html() { $id = "comment_images"; $svalue = isset($curImages) ? $curImages : ''; $multiple = true; $width = geodir_media_image_large_width(); $height = geodir_media_image_large_height(); ?> <div class="gd-form_row clearfix" id="<?php echo $id; ?> dropbox" align="center" style="border:1px solid #ccc; min-height:100px; height:auto; padding:10px;"> <input type="hidden" name="<?php echo $id; ?> " id="<?php echo $id; ?> " value="<?php echo $svalue; ?> " /> <div class="gd-plupload-upload-uic hide-if-no-js <?php if ($multiple) { ?> gd-plupload-upload-uic-multiple<?php } ?> " id="<?php echo $id; ?> plupload-upload-ui"> <h4><?php _e('Drop files to upload', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </h4><br/> <input id="<?php echo $id; ?> plupload-browse-button" type="button" value="<?php _e('Select Files', GEODIRREVIEWRATING_TEXTDOMAIN); ?> " class="button" accept="image/*" capture="camera"/> <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?> "></span> <?php if ($width && $height) { ?> <span class="plupload-resize"></span> <span class="plupload-width" id="plupload-width<?php echo $width; ?> "></span> <span class="plupload-height" id="plupload-height<?php echo $height; ?> "></span> <?php } ?> <div class="filelist"></div> </div> <div class="plupload-thumbs <?php if ($multiple) { ?> plupload-thumbs-multiple<?php } ?> clearfix" id="<?php echo $id; ?> plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;"> </div> <span id="upload-msg" ><?php _e('Please drag & drop the images to rearrange the order', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </span> <span id="upload-error" style="display:none"></span> </div><?php }