本文整理汇总了PHP中awpcp函数的典型用法代码示例。如果您正苦于以下问题:PHP awpcp函数的具体用法?PHP awpcp怎么用?PHP awpcp使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了awpcp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
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;
}
示例2: generate_html
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;
}
}
}
示例3: awpcp_listings_api
/**
* @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'];
}
示例4: awpcp_listing_upload_limits
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'];
}
示例5: dispatch
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();
}
示例6: awpcp_file_types
function awpcp_file_types()
{
static $instance = null;
if (is_null($instance)) {
$instance = new AWPCP_FileTypes(awpcp()->settings);
}
return $instance;
}
示例7: scripts
/**
* 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'));
}
示例8: awpcp_modules_manager
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;
}
示例9: awpcp_new_media_manager
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;
}
示例10: awpcp_task_queue
function awpcp_task_queue()
{
static $instance = null;
if (is_null($instance)) {
$instance = new AWPCP_TaskQueue(awpcp_tasks_collection(), awpcp()->settings);
}
return $instance;
}
示例11: dispatch
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();
}
示例12: render
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;
}
示例13: dispatch
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);
}
}
示例14: awpcp_get_edit_listing_menu_item
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));
}
}
示例15: awpcp_drip_autoresponder
function awpcp_drip_autoresponder()
{
return new AWPCP_DripAutoresponder(awpcp()->settings, awpcp_request());
}