public function render($params) { extract($params = wp_parse_args($params, array('context' => 'default', 'name' => 'category', 'label' => __('Ad Category', 'AWPCP'), 'required' => true, 'selected' => null, 'placeholders' => array()))); if ($context == 'search') { $placeholders = array_merge(array('default-option-first-level' => __('All Categories', 'AWPCP'), 'default-option-second-level' => __('All Sub-categories', 'AWPCP')), $placeholders); } else { if (get_awpcp_option('noadsinparentcat')) { $second_level_option_placeholder = __('Select a Sub-category', 'AWPCP'); } else { $second_level_option_placeholder = __('Select a Sub-category (optional)', 'AWPCP'); } $placeholders = array_merge(array('default-option-first-level' => __('Select a Category', 'AWPCP'), 'default-option-second-level' => $second_level_option_placeholder), $placeholders); } $categories = awpcp_categories_collection()->get_all(); $categories_hierarchy = awpcp_build_categories_hierarchy($categories); $chain = $this->get_category_parents($selected, $categories); $use_multiple_dropdowns = get_awpcp_option('use-multiple-category-dropdowns'); // export categories list to JavaScript, but don't replace an existing categories list awpcp()->js->set('categories', $categories_hierarchy, false); ob_start(); include AWPCP_DIR . '/frontend/templates/html-widget-category-dropdown.tpl.php'; $content = ob_get_contents(); ob_end_clean(); return $content; }
protected function generate_html($template_type = '') { $post_ids = array(); foreach ($this->search_results['items'] as $item_id => $item_html) { $post_ids[] = $item_id; } $conditions = array(); $conditions[] = "ad_id IN ( " . implode(',', $post_ids) . " ) "; $args = array(); $ads = AWPCP_Ad::get_enabled_ads($args, $conditions); $parity = array('displayaditemseven', 'displayaditemsodd'); if ('ajax' == $template_type) { $layout = buddyboss_global_search_buffer_template_part('loop/' . $this->type, $template_type, false); } else { $layout = get_awpcp_option('displayadlayoutcode'); if (empty($layout)) { $layout = awpcp()->settings->get_option_default_value('displayadlayoutcode'); } } if (!empty($ads)) { foreach ($ads as $i => $listing) { $rendered_listing = awpcp_do_placeholders($listing, $layout, $context); $rendered_listing = str_replace("\$awpcpdisplayaditems", $parity[$i % 2], $rendered_listing); if (function_exists('awpcp_featured_ads')) { $rendered_listing = awpcp_featured_ad_class($listing->ad_id, $rendered_listing); } $rendered_listing = apply_filters('awpcp-render-listing-item', $rendered_listing, $i + 1, $template_type); $result = array('id' => $listing->ad_id, 'type' => $this->type, 'title' => $listing->ad_title, 'html' => $rendered_listing); $this->search_results['items'][$listing->ad_id] = $result; } } }
/** * @since 3.0.2 */ function awpcp_listings_api() { if (!isset($GLOBALS['awpcp-listings-api'])) { $GLOBALS['awpcp-listings-api'] = new AWPCP_ListingsAPI(awpcp_listings_metadata(), awpcp_request(), awpcp()->settings); } return $GLOBALS['awpcp-listings-api']; }
function awpcp_listing_upload_limits() { if (!isset($GLOBALS['awpcp-listing-upload-limits'])) { $GLOBALS['awpcp-listing-upload-limits'] = new AWPCP_ListingUploadLimits(awpcp_file_types(), awpcp_payments_api(), awpcp()->settings); } return $GLOBALS['awpcp-listing-upload-limits']; }
public function dispatch() { wp_enqueue_script('awpcp-page-reply-to-ad'); $awpcp = awpcp(); $awpcp->js->localize('page-reply-to-ad', array('awpcp_sender_name' => __('Please enter your name.', 'AWPCP'), 'awpcp_sender_email' => __('Please enter your email address.', 'AWPCP'), 'awpcp_contact_message' => __('The message cannot be empty.', 'AWPCP'), 'captcha' => __('Please type in the result of the operation.', 'AWPCP'))); return $this->_dispatch(); }
function awpcp_file_types() { static $instance = null; if (is_null($instance)) { $instance = new AWPCP_FileTypes(awpcp()->settings); } return $instance; }
/** * Handler for admin_print_styles hook associated to this page. */ public function scripts() { // necessary in the Place Ad operation wp_enqueue_style('awpcp-frontend-style'); wp_enqueue_script('awpcp-admin-listings'); awpcp()->js->localize('admin-listings', 'delete-message', __('Are you sure you want to delete the selected Ads?', 'AWPCP')); awpcp()->js->localize('admin-listings', 'cancel', __('Cancel', 'AWPCP')); }
function awpcp_modules_manager() { static $instance = null; if (is_null($instance)) { $instance = new AWPCP_ModulesManager(awpcp(), awpcp_licenses_manager(), awpcp_modules_updater(), awpcp()->settings); } return $instance; }
function awpcp_new_media_manager() { static $instance = null; if (is_null($instance)) { $instance = new AWPCP_NewMediaManager(awpcp_media_api(), awpcp_uploaded_file_logic_factory(), awpcp()->settings); } return $instance; }
function awpcp_task_queue() { static $instance = null; if (is_null($instance)) { $instance = new AWPCP_TaskQueue(awpcp_tasks_collection(), awpcp()->settings); } return $instance; }
public function dispatch() { wp_enqueue_style('awpcp-jquery-ui'); wp_enqueue_script('awpcp-page-search-listings'); wp_enqueue_script('awpcp-extra-fields'); $awpcp = awpcp(); $awpcp->js->localize('page-search-ads', array('keywordphrase' => __('You did not enter a keyword or phrase to search for. You must at the very least provide a keyword or phrase to search for.', 'AWPCP'))); return $this->_dispatch(); }
public function render() { awpcp()->js->set('asynchronous-tasks', $this->tasks); awpcp()->js->set('asynchronous-tasks-texts', $this->texts); ob_start(); # TODO: move template to a top level templates directory # templates/components/asynchronous-tasks.tpl.php include AWPCP_DIR . '/admin/templates/asynchronous-tasks.tpl.php'; $output = ob_get_contents(); ob_end_clean(); return $output; }
public function dispatch($default = null) { do_action('awpcp-before-post-listing-page'); wp_enqueue_style('awpcp-jquery-ui'); wp_enqueue_script('awpcp-page-place-ad'); $awpcp = awpcp(); $awpcp->js->localize('page-place-ad-order', array('category' => __('Please select a category.', 'AWPCP'), 'user' => __("Please select the Ad's owner.", 'AWPCP'), 'payment_term' => __('Please select a payment term.', 'AWPCP'))); $awpcp->js->localize('page-place-ad-details', array('ad_title' => __('Please type in a title for your Ad.', 'AWPCP'), 'websiteurl' => __('Please type in a valid URL.', 'AWPCP'), 'ad_contact_name' => __('Please type in the name of the person to contact.', 'AWPCP'), 'ad_contact_email' => __('Please type in the email address of the person to contact.', 'AWPCP'), 'ad_contact_phone' => __('Please type in the phone number of the person to contact.', 'AWPCP'), 'ad_country' => __('The country is a required field.', 'AWPCP'), 'ad_county_village' => __('The county is a required field.', 'AWPCP'), 'ad_state' => __('The state is a required field.', 'AWPCP'), 'ad_city' => __('The city is a required field.', 'AWPCP'), 'ad_item_price' => __('Please type in a price for your Ad.', 'AWPCP'), 'ad_details' => __('Please type in the details of your Ad.', 'AWPCP'), 'captcha' => __('Please type in the result of the operation.', 'AWPCP'))); if (is_admin()) { echo $this->_dispatch($default); } else { return $this->_dispatch($default); } }
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)); } }
function awpcp_drip_autoresponder() { return new AWPCP_DripAutoresponder(awpcp()->settings, awpcp_request()); }
function awpcp_credit_system_settings() { return new AWPCP_CreditSystemSettings(awpcp()->settings); }
function awpcp_file_uploader() { return new AWPCP_FileUploader(awpcp_file_types(), awpcp_mime_types(), awpcp_request(), awpcp()->settings); }
function awpcp_listing_price_form_field($slug) { return new AWPCP_ListingPriceFormField($slug, awpcp()->settings); }
function awpcp_send_listing_to_facebook_helper() { return new AWPCP_SendListingToFacebookHelper(AWPCP_Facebook::instance(), awpcp_send_to_facebook_helper(), awpcp_listings_collection(), awpcp_listings_metadata(), awpcp()->settings); }
function awpcp_users_autocomplete() { return new AWPCP_UsersAutocomplete(awpcp_users_collection(), awpcp_request(), awpcp()->js); }
public function render($context, $translations = array(), $errors = array()) { $fields = $this->get_region_fields($context); if (empty($fields)) { return ''; } wp_enqueue_script('awpcp-multiple-region-selector'); awpcp()->js->localize('multiple-region-selector', array('select-placeholder' => _x('Select %s', 'Select <Region Type> in Multiple Region Selector', 'AWPCP'), 'duplicated-region' => __('This particular region is already selected in another field. Please choose one or more sub-regions, to make the selection more specific, or change the selected region.', 'AWPCP'), 'add-region' => $context == "search" ? __('Add Search Region', 'AWPCP') : __('Add Region', 'AWPCP'), 'remove-region' => $context == "search" ? __('Delete Search Region', 'AWPCP') : __('Remove Region', 'AWPCP'))); $regions = array(); foreach ($this->regions as $i => $region) { $hierarchy = array(); foreach ($fields as $type => $field) { $selected = awpcp_array_data($type, null, $region); $regions[$i][$type] = $field; $regions[$i][$type]['options'] = $this->get_region_field_options($context, $type, $selected, $hierarchy); $regions[$i][$type]['selected'] = awpcp_array_data($type, null, $region); $regions[$i][$type]['required'] = 'search' == $context ? false : $field['required']; if (isset($translations[$type])) { $regions[$i][$type]['param'] = $translations[$type]; } else { $regions[$i][$type]['param'] = $type; } // make values selected in parent fields available to child // fields when computing the field options. $hierarchy[$type] = $regions[$i][$type]['selected']; } } // use first region as template for additional regions $this->options['template'] = $regions[0]; $options = apply_filters('awpcp-multiple-region-selector-configuration', $this->options, $context, $fields); $uuid = uniqid(); awpcp()->js->set("multiple-region-selector-{$uuid}", array('options' => array_merge($options, array('fields' => array_keys($fields), 'context' => $context)), 'regions' => $regions)); ob_start(); include $this->template; $html = ob_get_contents(); ob_end_clean(); return $html; }
public function render() { $option_name = 'hide-all-payment-terms-if-no-category-is-selected'; awpcp()->js->set($option_name, awpcp_parse_bool(get_awpcp_option($option_name))); ob_start(); include AWPCP_DIR . '/frontend/templates/payments-payment-terms-table.tpl.php'; $html = ob_get_contents(); ob_end_clean(); return $html; }
function awpcp_image_resizer() { return new AWPCP_ImageResizer(awpcp_filesystem(), awpcp()->settings); }
function awpcp_drip_autoresponder_ajax_handler() { return new AWPCP_DripAutoresponderAjaxHandler(awpcp()->settings, awpcp_request(), awpcp_ajax_response()); }
function awpcp_image_file_processor() { return new AWPCP_ImageFileProcessor(awpcp()->settings); }
function awpcp_fee_payment_terms_notices() { return new AWPCP_FeePaymentTermsNotices(awpcp()->settings, awpcp_payments_api()); }
/** * @since 3.3.2 */ function awpcp_default_pagination_options($selected = 10) { $default_options = awpcp()->settings->get_option_default_value('pagination-options'); return awpcp_build_pagination_options($default_options, $selected); }
{ if ($action->is_enabled_for_listing($listing)) { $actions[$action->get_slug()] = $action; } } } function awpcp() { global $awpcp; if (!is_object($awpcp)) { $awpcp = new AWPCP(); $awpcp->bootstrap(); } return $awpcp; } awpcp(); $uploadfoldername = get_awpcp_option('uploadfoldername', "uploads"); define('MAINUPLOADURL', $wpcontenturl . '/' . $uploadfoldername); define('MAINUPLOADDIR', $wpcontentdir . '/' . $uploadfoldername); define('AWPCPUPLOADURL', $wpcontenturl . '/' . $uploadfoldername . '/awpcp'); define('AWPCPUPLOADDIR', $wpcontentdir . '/' . $uploadfoldername . '/awpcp/'); define('AWPCPTHUMBSUPLOADURL', $wpcontenturl . '/' . $uploadfoldername . '/awpcp/thumbs'); define('AWPCPTHUMBSUPLOADDIR', $wpcontentdir . '/' . $uploadfoldername . '/awpcp/thumbs/'); define('MENUICO', $awpcp_imagesurl . '/menuico.png'); global $awpcpthumbsurl; global $hascaticonsmodule; global $hasregionsmodule; global $haspoweredbyremovalmodule; global $hasgooglecheckoutmodule; global $hasextrafieldsmodule; global $hasrssmodule;
/** * @since 3.3 */ function awpcp_listings_collection() { return new AWPCP_ListingsCollection(awpcp_listings_finder(), awpcp()->settings, $GLOBALS['wpdb']); }
function awpcp_licenses_manager() { return new AWPCP_LicensesManager(awpcp_easy_digital_downloads(), awpcp()->settings); }