<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')); ?> " /> </form> <?php if ($category_id > 0) { ?> <div id='awpcpcatname' class="fixfloat"> <h3><?php echo esc_html(__('Category: ', 'AWPCP') . get_adcatname($category_id)); ?> </h3> </div> <?php } ?> </div>
/** * @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; }
public function view_ad($ad) { $category_name = get_adcatname($ad->ad_category_id); $category_url = $this->url(array('showadsfromcat_id' => $ad->ad_category_id)); $content = showad($ad->ad_id, $omitmenu = 1); $links = $this->links($this->actions($ad, array('edit', 'enable', 'disable', 'spam', 'make-featured', 'remove-featured'))); $params = array('ad' => $ad, 'category' => array('name' => $category_name, 'url' => $category_url), 'links' => $links, 'content' => $content); $template = AWPCP_DIR . '/admin/templates/admin-panel-listings-view.tpl.php'; echo $this->render($template, $params); }
public function get_category_name() { if (!isset($this->category_name)) { $this->category_name = get_adcatname($object->category_id); } return $this->category_name; }
/** * @since 3.2 */ function awpcp_do_placeholder_parent_category_name($ad, $placeholder) { return esc_html(stripslashes(get_adcatname($ad->ad_category_parent_id))); }
function url_showad($ad_id) { try { $ad = awpcp_listings_collection()->get($ad_id); } catch (AWPCP_Exception $e) { return false; } $seoFriendlyUrls = get_awpcp_option('seofriendlyurls'); $permastruc = get_option('permalink_structure'); $awpcp_showad_pageid = awpcp_get_page_id_by_ref('show-ads-page-name'); $base_url = get_permalink($awpcp_showad_pageid); $url = false; $params = array('id' => $ad_id); if ($seoFriendlyUrls && isset($permastruc) && !empty($permastruc)) { $url = sprintf('%s/%s', trim($base_url, '/'), $ad_id); $region = $ad->get_first_region(); $parts = array(); if (get_awpcp_option('include-title-in-listing-url')) { $parts[] = sanitize_title($ad->get_title()); } if (get_awpcp_option('include-city-in-listing-url') && $region) { $parts[] = sanitize_title(awpcp_array_data('city', '', $region)); } if (get_awpcp_option('include-state-in-listing-url') && $region) { $parts[] = sanitize_title(awpcp_array_data('state', '', $region)); } if (get_awpcp_option('include-country-in-listing-url') && $region) { $parts[] = sanitize_title(awpcp_array_data('country', '', $region)); } if (get_awpcp_option('include-county-in-listing-url') && $region) { $parts[] = sanitize_title(awpcp_array_data('county', '', $region)); } if (get_awpcp_option('include-category-in-listing-url')) { $awpcp_ad_category_id = $ad->ad_category_id; $parts[] = sanitize_title(get_adcatname($awpcp_ad_category_id)); } // always append a slash (RSS module issue) $url = sprintf("%s%s", trailingslashit($url), join('/', array_filter($parts))); $url = user_trailingslashit($url); } else { $base_url = user_trailingslashit($base_url); $url = add_query_arg(urlencode_deep($params), $base_url); } return apply_filters('awpcp-listing-url', $url, $ad); }
private function get_page_title($fallback_separator = '-', $seplocation = 'right') { $separator = $this->get_separator($fallback_separator); $parts = array(); if (!empty($this->category_id)) { $parts[] = get_adcatname($this->category_id); } else { if (!is_null($this->listing)) { $regions = $this->listing->get_regions(); if (count($regions) > 0) { $region = $regions[0]; } else { $region = array(); } if (get_awpcp_option('showcategoryinpagetitle')) { $parts[] = get_adcatname($this->listing->ad_category_id); } if (get_awpcp_option('showcountryinpagetitle')) { $parts[] = awpcp_array_data('country', '', $region); } if (get_awpcp_option('showstateinpagetitle')) { $parts[] = awpcp_array_data('state', '', $region); } if (get_awpcp_option('showcityinpagetitle')) { $parts[] = awpcp_array_data('city', '', $region); } if (get_awpcp_option('showcountyvillageinpagetitle')) { $parts[] = awpcp_array_data('county', '', $region); } $parts[] = $this->listing->get_title(); } } $parts = array_filter($parts); $parts = $seplocation === 'right' ? array_reverse($parts) : $parts; return implode(" {$separator} ", $parts); }