<?php } ?> <h3><?php echo esc_html(__('Add Details and Contact Information', 'AWPCP')); ?> </h3> <?php if ($ui['category-field']) { ?> <p class="awpcp-form-spacer"> <?php $dropdown = new AWPCP_CategoriesDropdown(); ?> <?php echo $dropdown->render(array('selected' => awpcp_array_data('ad_category', '', $form), 'name' => 'ad_category')); ?> <?php echo awpcp_form_error('ad_category', $errors); ?> </p> <?php } ?> <?php echo awpcp_form_fields()->render_fields($form, $errors, isset($listing) ? $listing : null, array('category' => $form['ad_category'], 'action' => 'normal')); ?>
/** * @deprecated 3.4 */ function awpcp_display_ads($where, $byl, $hidepager, $grouporderby, $adorcat, $before_content = '') { _deprecated_function(__FUNCTION__, '3.4', 'awpcp_display_listings'); global $wpdb; global $awpcp_plugin_path; global $hasregionsmodule; $output = ''; $awpcp_browsecats_pageid = awpcp_get_page_id_by_ref('browse-categories-page-name'); $browseadspageid = awpcp_get_page_id_by_ref('browse-ads-page-name'); $searchadspageid = awpcp_get_page_id_by_ref('search-ads-page-name'); // filters to provide alternative method of storing custom layouts (e.g. can be outside of this plugin's directory) if (has_action('awpcp_browse_ads_template_action') || has_filter('awpcp_browse_ads_template_filter')) { do_action('awpcp_browse_ads_template_action'); $output = apply_filters('awpcp_browse_ads_template_filter'); return; } else { if (file_exists("{$awpcp_plugin_path}/awpcp_display_ads_my_layout.php") && get_awpcp_option('activatemylayoutdisplayads')) { include "{$awpcp_plugin_path}/awpcp_display_ads_my_layout.php"; } else { $output .= "<div id=\"classiwrapper\">"; $uiwelcome = stripslashes_deep(get_awpcp_option('uiwelcome')); $output .= apply_filters('awpcp-content-before-listings-page', ''); $output .= "<div class=\"uiwelcome\">{$uiwelcome}</div>"; $output .= awpcp_menu_items(); if ($hasregionsmodule == 1) { // Do not show Region Control form when showing Search Ads page // search result. Changing the current location will redirect the user // to the form instead of a filterd version of the form and that's confusing if (is_page(awpcp_get_page_id_by_ref('search-ads-page-name')) && isset($_POST['a']) && $_POST['a'] == 'dosearch') { // do nothing } else { $output .= awpcp_region_control_selector(); } } $output .= $before_content; $tbl_ads = $wpdb->prefix . "awpcp_ads"; $from = "{$tbl_ads}"; $ads_exist = ads_exist(); if (!$ads_exist) { $showcategories = "<p style=\"padding:10px\">"; $showcategories .= __("There are currently no ads in the system", "AWPCP"); $showcategories .= "</p>"; $pager1 = ''; $pager2 = ''; } else { $awpcp_image_display_list = array(); if ($adorcat == 'cat') { $tpname = get_permalink($awpcp_browsecats_pageid); } elseif ($adorcat == 'search') { $tpname = get_permalink($searchadspageid); } elseif (preg_match('/^custom:/', $adorcat)) { $tpname = str_replace('custom:', '', $adorcat); } else { $tpname = get_permalink($browseadspageid); } $results = get_awpcp_option('adresultsperpage', 10); $results = absint(awpcp_request_param('results', $results)); $offset = absint(awpcp_request_param('offset', 0)); if ($results === 0) { $results = 10; } $args = array('order' => AWPCP_Ad::get_order_conditions($grouporderby), 'offset' => $offset, 'limit' => $results); $ads = AWPCP_Ad::get_enabled_ads($args, array($where)); // get_where_conditions() is called from get_enabled_ads(), we need the // WHERE conditions here to pass them to create_pager() $where = AWPCP_Ad::get_where_conditions(array($where)); if (!isset($hidepager) || empty($hidepager)) { //Unset the page and action here...these do the wrong thing on display ad unset($_GET['page_id']); unset($_POST['page_id']); //unset($params['page_id']); $pager1 = create_pager($from, join(' AND ', $where), $offset, $results, $tpname); $pager2 = create_pager($from, join(' AND ', $where), $offset, $results, $tpname); } else { $pager1 = ''; $pager2 = ''; } $items = awpcp_render_listings_items($ads, 'listings'); $opentable = ""; $closetable = ""; if (empty($ads)) { $showcategories = "<p style=\"padding:20px;\">"; $showcategories .= __("There were no ads found", "AWPCP"); $showcategories .= "</p>"; $pager1 = ''; $pager2 = ''; } else { $showcategories = smart_table($items, intval($results / $results), $opentable, $closetable); } } $show_category_id = absint(awpcp_request_param('category_id')); if (!isset($url_browsecatselect) || empty($url_browsecatselect)) { $url_browsecatselect = get_permalink($awpcp_browsecats_pageid); } if ($ads_exist) { $category_id = (int) awpcp_request_param('category_id', -1); $category_id = $category_id === -1 ? (int) get_query_var('cid') : $category_id; $output .= "<div class=\"changecategoryselect\"><form method=\"post\" action=\"{$url_browsecatselect}\">"; $output .= '<div class="awpcp-category-dropdown-container">'; $dropdown = new AWPCP_CategoriesDropdown(); $output .= $dropdown->render(array('context' => 'search', 'name' => 'category_id', 'selected' => $category_id)); $output .= '</div>'; $output .= "<input type=\"hidden\" name=\"a\" value=\"browsecat\" /> <input class=\"button\" type=\"submit\" value=\""; $output .= __("Change Category", "AWPCP"); $output .= "\" /></form></div>"; $output .= "<div class=\"pager\">{$pager1}</div><div class=\"fixfloat\"></div>"; $output .= "<div id='awpcpcatname' class=\"fixfloat\">"; if ($category_id > 0) { $output .= "<h3>" . __("Category: ", "AWPCP") . get_adcatname($category_id) . "</h3>"; } $output .= "</div>"; } $output .= apply_filters('awpcp-display-ads-before-list', ''); $output .= "{$showcategories}"; if ($ads_exist) { $output .= " <div class=\"pager\">{$pager2}</div>"; } $output .= apply_filters('awpcp-content-after-listings-page', ''); $output .= "</div>"; } } return $output; }
function widget($args, $instance) { extract($args); $instance = wp_parse_args($instance, $this->defaults()); if (!empty($instance['subtitle'])) { $title = $instance['title'] . '<br/><span class="widgetstitle">' . $instance['subtitle'] . '</span>'; } else { $title = $instance['title'] . '</span>'; } echo '<div class="awpcp-search-listings-widget">'; echo $before_widget . $before_title . $title . $after_title; echo '<div align="center"><form method=\'get\' action="' . url_searchads() . '">'; $url_params = wp_parse_args(parse_url(url_searchads(), PHP_URL_QUERY)); foreach ($url_params as $param => $value) { echo '<input type="hidden" name="' . esc_attr($param) . '" value="' . esc_attr($value) . '" />'; } echo '<input type="hidden" name="a" value="dosearch"/>'; $keywordphrase = stripslashes_deep(awpcp_request_param('keywordphrase')); if ($instance['show_keyword'] == 1) { echo '<label for="awpcp-search-keywordphrase">' . __('Search by keyword', "AWPCP") . '</label>'; echo '<input id="awpcp-search-keywordphrase" type="text" name="keywordphrase" value="' . esc_attr($keywordphrase) . '">'; } if ($instance['show_by'] == 1) { echo $this->render_find_by_contact_name_field(); } echo $this->render_region_fields($instance); if ($instance['show_category'] == 1) { $label = __('Search by Category', "AWPCP"); $name = 'searchcategory'; $selected = stripslashes_deep(awpcp_request_param($name, null)); $dropdown = new AWPCP_CategoriesDropdown(); echo $dropdown->render(array('context' => 'search', 'selected' => $selected, 'required' => false, 'name' => $name, 'label' => $label)); } echo '<div class="submit"><input class="button" type="submit" value="' . __('Search', 'AWPCP') . '"></div>'; echo '</form></div>'; echo '</div>'; echo $after_widget; }
<div class="changecategoryselect"> <form method="post" action="<?php echo esc_attr($browse_categories_page_url); ?> "> <div class="awpcp-category-dropdown-container"> <?php $dropdown = new AWPCP_CategoriesDropdown(); ?> <?php echo $dropdown->render($category_dropdown_params); ?> </div> <?php foreach ($hidden as $field_name => $value) { ?> <input type="hidden" name="<?php echo esc_attr($field_name); ?> " value="<?php echo esc_attr($value); ?> " /> <?php } ?> <input class="button" type="submit" value="<?php echo esc_attr(__('Change Category', 'AWPCP')); ?>
<label for="query"><?php _e("Search for Ads containing this word or phrase", "AWPCP"); ?> :</label> <input type="text" id="query" class="inputbox" size="50" name="keywordphrase" value="<?php echo esc_attr($form['query']); ?> " /> <?php echo awpcp_form_error('query', $errors); ?> </p> <p class="awpcp-form-spacer"> <?php $dropdown = new AWPCP_CategoriesDropdown(); ?> <?php echo $dropdown->render(array('context' => 'search', 'selected' => awpcp_array_data('category', '', $form), 'name' => 'searchcategory', 'required' => false)); ?> </p> <?php if ($ui['posted-by-field']) { ?> <p class='awpcp-form-spacer'> <label for="name"><?php _e("For Ads Posted By", "AWPCP"); ?> </label> <select id="name" name="searchname">