function cp_other_fields($renew_id = false) { global $wpdb, $cp_options; // are images on ads allowed if ($cp_options->ad_images) { if (appthemes_plupload_is_enabled()) { echo appthemes_plupload_form($renew_id); } else { if ($renew_id) { $imagecount = cp_get_ad_images($renew_id); echo cp_ad_edit_image_input_fields($imagecount); } else { echo cp_image_input_fields(); } } } // show the chargeable options if enabled if (cp_payments_is_enabled()) { // show the featured ad box if enabled if ($cp_options->sys_feat_price) { ?> <?php /*?><li id="list_featured_ad" class="withborder"> <div class="labelwrapper"> <label><?php printf( __( 'Featured Listing %s', APP_TD ), appthemes_get_price( $cp_options->sys_feat_price ) ); ?></label> </div> <div class="clr"></div> <input name="featured_ad" value="1" type="checkbox" <?php checked( isset($_POST['featured_ad']) ); ?> /> <?php _e( 'Your listing will appear in the featured slider section at the top of the front page.', APP_TD ); ?> <div class="clr"></div> </li><?php */ ?> <?php } if ($cp_options->price_scheme == 'single') { ?> <li> <div class="labelwrapper"> <label><?php _e('Ad Package:', APP_TD); ?> </label> </div> <?php // go get all the active ad packs and create a drop-down of options $results = $wpdb->get_results("SELECT * FROM {$wpdb->cp_ad_packs} WHERE pack_status = 'active' ORDER BY pack_id asc"); if ($results) { ?> <select name="ad_pack_id" class="dropdownlist required"> <?php foreach ($results as $result) { // external plugins can modify or disable field $result = apply_filters('cp_package_field', $result, 'ad'); if (!$result) { continue; } ?> <option value="<?php echo esc_attr($result->pack_id); ?> "><?php echo esc_attr(stripslashes($result->pack_name)); ?> </option> <?php } ?> </select> <?php } else { _e('Error: no ad pack has been defined. Please contact the site administrator.', APP_TD); } ?> <div class="clr"></div> </li> <?php } ?> <?php } // end charge for ads check }
/** * Displays the non-custom fields below the main listing submission form. * * @param int $listing_id * * @return void */ function cp_other_fields($listing_id) { global $cp_options; // are images on ads allowed if ($cp_options->ad_images) { if (appthemes_plupload_is_enabled()) { echo html('div class="ad-details-images-sep"', ' '); appthemes_plupload_form($listing_id); } else { $images_count = cp_get_ad_images($listing_id); cp_ad_edit_image_input_fields($images_count); } } // show the chargeable options if enabled if (cp_payments_is_enabled()) { // show the featured ad box if enabled if ($cp_options->sys_feat_price) { ?> <div class="ad-details-featured-sep"></div> <li id="list_featured_ad" class="withborder"> <div class="labelwrapper"> <label><?php printf(__('Featured Listing %s', APP_TD), appthemes_get_price($cp_options->sys_feat_price)); ?> </label> </div> <div class="clr"></div> <input name="featured_ad" value="1" type="checkbox" <?php checked(is_sticky($listing_id)); ?> /> <?php _e('Your listing will appear in the featured slider section at the top of the front page.', APP_TD); ?> <div class="clr"></div> </li> <?php } if ($cp_options->price_scheme == 'single') { ?> <li> <div class="labelwrapper"> <label><?php _e('Ad Package:', APP_TD); ?> </label> </div> <?php // go get all the active ad packs and create a drop-down of options $packages = cp_get_listing_packages(); if ($packages) { ?> <select name="ad_pack_id" class="dropdownlist required"> <?php foreach ($packages as $package) { // external plugins can modify or disable field $result = apply_filters('cp_package_field', $package, 'ad'); if (!$package) { continue; } ?> <option value="<?php echo esc_attr($package->ID); ?> "><?php echo esc_attr($package->pack_name); ?> </option> <?php } ?> </select> <?php } else { _e('Error: no ad pack has been defined. Please contact the site administrator.', APP_TD); } ?> <div class="clr"></div> </li> <?php } ?> <?php } }
function cp_other_fields($renew_id = false) { global $wpdb; // are images on ads allowed if (get_option('cp_ad_images') == 'yes') { if (appthemes_plupload_is_enabled()) { echo appthemes_plupload_form($renew_id); } else { if ($renew_id) { $imagecount = cp_get_ad_images($renew_id); echo cp_ad_edit_image_input_fields($imagecount); } else { echo cp_image_input_fields(); } } } // show the chargeable options if enabled if (get_option('cp_charge_ads') == 'yes') { // show the featured ad box if enabled if (get_option('cp_sys_feat_price')) { ?> <li id="list_featured_ad" class="withborder"> <div class="labelwrapper"> <label><?php printf(__('Featured Listing %s', APP_TD), cp_display_price(get_option('cp_sys_feat_price'), '', false)); ?> </label> </div> <div class="clr"></div> <input name="featured_ad" value="1" type="checkbox" <?php checked(isset($_POST['featured_ad'])); ?> /> <?php _e('Your listing will appear in the featured slider section at the top of the front page.', APP_TD); ?> <div class="clr"></div> </li> <?php } if (get_option('cp_price_scheme') == 'single') { ?> <li> <div class="labelwrapper"> <label><?php _e('Ad Package:', APP_TD); ?> </label> </div> <?php // go get all the active ad packs and create a drop-down of options $results = $wpdb->get_results("SELECT pack_id, pack_name FROM {$wpdb->cp_ad_packs} WHERE pack_status = 'active' ORDER BY pack_id asc"); if ($results) { ?> <select name="ad_pack_id" class="dropdownlist required"> <?php foreach ($results as $result) { ?> <option value="<?php echo esc_attr($result->pack_id); ?> "><?php echo esc_attr(stripslashes($result->pack_name)); ?> </option> <?php } ?> </select> <?php } else { _e('Error: no ad pack has been defined. Please contact the site administrator.', APP_TD); } ?> <div class="clr"></div> </li> <?php } ?> <?php if (get_option('cp_enable_coupons') == 'yes') { ?> <li> <div class="labelwrapper"> <label><?php _e('Coupon Code:', APP_TD); ?> </label> </div> <input type="text" class="text" value="" id="cp_coupon_code" name="cp_coupon_code" /> <div class="clr"></div> </li> <?php } } // end charge for ads check }
// if there's no form id it must mean the default form is being used so let's go grab those fields if (!$fid) { // use this if there's no custom form being used and give us the default form $sql = "SELECT field_label, field_name, field_type, field_values, field_tooltip, field_req FROM {$wpdb->cp_ad_fields} WHERE field_core = '1' ORDER BY field_id asc"; } else { // now we should have the formid so show the form layout based on the category selected $sql = $wpdb->prepare("SELECT f.field_label, f.field_name, f.field_type, f.field_values, f.field_perm, f.field_tooltip, m.meta_id, m.field_pos, m.field_req, m.form_id " . "FROM {$wpdb->cp_ad_fields} f " . "INNER JOIN {$wpdb->cp_ad_meta} m " . "ON f.field_id = m.field_id " . "WHERE m.form_id = %s " . "ORDER BY m.field_pos asc", $fid); } $results = $wpdb->get_results($sql); if ($results) { // build the edit ad form cp_formbuilder($results, $getad); } // check and make sure images are allowed if (get_option('cp_ad_images') == 'yes') { if (appthemes_plupload_is_enabled()) { echo appthemes_plupload_form($getad->ID); } else { $imagecount = cp_get_ad_images($getad->ID); // print out image upload fields. pass in count of images allowed echo cp_ad_edit_image_input_fields($imagecount); } } else { ?> <div class="pad10"></div> <li> <div class="labelwrapper"> <label><?php _e('Images:', APP_TD); ?>
function template_redirect() { global $cp_options; appthemes_auth_redirect_login(); // if not logged in, redirect to login page nocache_headers(); // redirect to dashboard if can't edit ad self::can_edit_ad(); // include all the functions needed for form require_once get_template_directory() . '/includes/forms/step-functions.php'; // add js files to wp_head. tiny_mce and validate add_action('wp_enqueue_scripts', 'cp_load_form_scripts'); // load app-plupload scripts if ($cp_options->ad_images && appthemes_plupload_is_enabled()) { add_action('wp_enqueue_scripts', 'appthemes_plupload_enqueue_scripts'); } }
/** * Enqueue scripts. * * return void */ public function enqueue_scripts() { global $cp_options; $step = _appthemes_get_step_from_query(); if ($step !== 'listing-details') { return; } if ($cp_options->ad_images && appthemes_plupload_is_enabled()) { $listing = $this->get_listing_obj(); appthemes_plupload_enqueue_scripts($listing->ID); } }
function template_redirect() { appthemes_auth_redirect_login(); // if not logged in, redirect to login page nocache_headers(); // include all the functions needed for form include_once TEMPLATEPATH . '/includes/forms/step-functions.php'; // add js files to wp_head. tiny_mce and validate add_action('wp_print_scripts', 'cp_load_form_scripts'); // load app-plupload scripts if (get_option('cp_ad_images') == 'yes' && appthemes_plupload_is_enabled()) { add_action('wp_print_scripts', 'appthemes_plupload_enqueue_scripts'); } add_action('appthemes_notices', array($this, 'show_notice')); }