public function __construct($page = 'awpcp-place-ad', $title = null, $county_id = null) { if ($page == 'default') { $page = 'awpcp=place-ad'; } if ($title == 'default') { $title = null; } parent::__construct($page, $title); $this->county_id = $county_id; $this->authorization = awpcp_listing_authorization(); }
function awpcp_edit_listing_link_placeholder() { return new AWPCP_EditListingLinkPlaceholder(awpcp_listing_authorization()); }
public function __construct($page = 'awpcp-place-ad', $title = null) { parent::__construct($page, $title); $this->authorization = awpcp_listing_authorization(); }
function awpcp_get_edit_listing_menu_item() { $listings = awpcp_listings_collection(); $authorization = awpcp_listing_authorization(); $request = awpcp_request(); $settings = awpcp()->settings; try { $listing = $listings->get($request->get_ad_id()); } catch (AWPCP_Exception $e) { $listing = null; } if (is_object($listing) && $authorization->is_current_user_allowed_to_edit_listing($listing)) { $edit_ad_url = awpcp_get_edit_listing_direct_url($listing); } else { if (!$settings->get_option('requireuserregistration')) { $edit_ad_url = awpcp_get_edit_listing_generic_url(); } else { $edit_ad_url = null; } } if (is_null($edit_ad_url)) { return null; } else { $edit_ad_page_name = $settings->get_option('edit-ad-page-name'); return array('url' => $edit_ad_url, 'title' => esc_html($edit_ad_page_name)); } }
public function ajax() { $id = awpcp_post_param('id', 0); try { $listing = awpcp_listings_collection()->get($id); } catch (AWPCP_Exception $e) { $message = _x("The specified Ad doesn't exists.", 'ajax delete ad', 'AWPCP'); $response = json_encode(array('status' => 'error', 'message' => $message)); return $this->ajax_response($response); } if (!awpcp_listing_authorization()->is_current_user_allowed_to_edit_listing($listing)) { return false; } $errors = array(); if (isset($_POST['remove'])) { $result = deletead($id, $adkey = '', $editemail = '', $force = true, $errors); if (empty($errors)) { $response = json_encode(array('status' => 'success')); } else { $response = json_encode(array('status' => 'error', 'message' => join('<br/>', $errors))); } } else { $columns = 10; ob_start(); include AWPCP_DIR . '/admin/templates/delete_form.tpl.php'; $html = ob_get_contents(); ob_end_clean(); $response = json_encode(array('status' => 'success', 'html' => $html)); } return $this->ajax_response($response); }