本文整理汇总了PHP中get_awpcp_option函数的典型用法代码示例。如果您正苦于以下问题:PHP get_awpcp_option函数的具体用法?PHP get_awpcp_option怎么用?PHP get_awpcp_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_awpcp_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
}
示例2: restore_missing_pages
public function restore_missing_pages()
{
$shortcodes = awpcp_pages();
$missing_pages = $this->missing_pages_finder->find_missing_pages();
$pages_to_restore = array_merge($missing_pages['not-found'], $missing_pages['not-referenced']);
$page_refs = awpcp_get_properties($pages_to_restore, 'page');
// If we are restoring the main page, let's do it first!
if (($p = array_search('main-page-name', $page_refs)) !== FALSE) {
// put the main page as the first page to restore
array_splice($pages_to_restore, 0, 0, array($pages_to_restore[$p]));
array_splice($pages_to_restore, $p + 1, 1);
}
$restored_pages = array();
foreach ($pages_to_restore as $page) {
$refname = $page->page;
$name = get_awpcp_option($refname);
if (strcmp($refname, 'main-page-name') == 0) {
awpcp_create_pages($name, $subpages = false);
} else {
awpcp_create_subpage($refname, $name, $shortcodes[$refname][1]);
}
$restored_pages[] = $page;
}
update_option('awpcp-flush-rewrite-rules', true);
return $restored_pages;
}
示例3: menu
/**
* Register Ad Management Panel menu
*/
public function menu()
{
/* Profile Menu */
// We are using read as an alias for edit_classifieds_listings. If a user can `read`,
// he or she can `edit_classifieds_listings`.
$capability = 'read';
// Account Balance
if (awpcp_payments_api()->credit_system_enabled() && !awpcp_current_user_is_admin()) {
$parts = array($this->account->title, $this->account->menu, $this->account->page);
$hook = add_users_page($parts[0], $parts[1], $capability, $parts[2], array($this->account, 'dispatch'));
add_action("admin_print_styles-{$hook}", array($this->account, 'scripts'));
}
$current_user_is_non_admin_moderator = awpcp_current_user_is_moderator() && !awpcp_current_user_is_admin();
if (get_awpcp_option('enable-user-panel') != 1 || $current_user_is_non_admin_moderator) {
return;
}
/* Ad Management Menu */
$slug = 'awpcp-panel';
$title = sprintf(__('%s Ad Management Panel', 'AWPCP'), get_bloginfo());
$menu = __('Ad Management', 'AWPCP');
$hook = add_menu_page($title, $menu, $capability, $slug, array($this->listings, 'dispatch'), MENUICO);
// Listings
$title = __('Manage Ad Listings', 'AWPCP');
$menu = __('Listings', 'AWPCP');
$hook = add_submenu_page($slug, $title, $menu, $capability, $slug, array($this->listings, 'dispatch'));
add_action("admin_print_styles-{$hook}", array($this->listings, 'scripts'));
do_action('awpcp_panel_add_submenu_page', $slug, $capability);
}
示例4: notices
public function notices()
{
if (!awpcp_current_user_is_admin()) {
return;
}
if (awpcp_request_param('page', false) == 'awpcp-admin-upgrade') {
return;
}
if (get_option('awpcp-pending-manual-upgrade')) {
ob_start();
include AWPCP_DIR . '/admin/templates/admin-pending-manual-upgrade-notice.tpl.php';
$html = ob_get_contents();
ob_end_clean();
echo $html;
return;
}
$show_quick_start_quide_notice = get_awpcp_option('show-quick-start-guide-notice');
$show_drip_autoresponder = get_awpcp_option('show-drip-autoresponder');
if ($show_quick_start_quide_notice && is_awpcp_admin_page() && !$show_drip_autoresponder) {
ob_start();
include AWPCP_DIR . '/admin/templates/admin-quick-start-guide-notice.tpl.php';
$html = ob_get_contents();
ob_end_clean();
echo $html;
}
if (get_awpcp_option('show-widget-modification-notice')) {
ob_start();
include AWPCP_DIR . '/admin/templates/admin-widget-modification-notice.tpl.php';
$html = ob_get_contents();
ob_end_clean();
echo $html;
}
do_action('awpcp-admin-notices');
}
示例5: 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;
}
示例6: get_panel_url
protected function get_panel_url()
{
if (awpcp_current_user_is_moderator() || !get_awpcp_option('enable-user-panel')) {
return awpcp_get_admin_listings_url();
}
return awpcp_get_user_panel_url();
}
示例7: maybe_enable_listing
private function maybe_enable_listing($listing, $transaction, $trigger_actions)
{
if ($listing->disabled && $this->should_enable_listing($listing, $transaction)) {
$should_approve_listing_images = get_awpcp_option('imagesapprove') ? false : true;
$listing->enable($should_approve_listing_images, $trigger_actions);
}
}
示例8: get_payment_terms
public function get_payment_terms()
{
global $wpdb;
if (!awpcp_payments_api()->payments_enabled()) {
return array($this->get_free_payment_term());
}
$order = get_awpcp_option('fee-order');
$direction = get_awpcp_option('fee-order-direction');
switch ($order) {
case 1:
$orderby = array('adterm_name', $direction);
break;
case 2:
$orderby = array("amount {$direction}, adterm_name", $direction);
break;
case 3:
$orderby = array("imagesallowed {$direction}, adterm_name", $direction);
break;
case 5:
$orderby = array("_duration_interval {$direction}, rec_period {$direction}, adterm_name", $direction);
break;
}
if (awpcp_current_user_is_admin()) {
$args = array('orderby' => $orderby[0], 'order' => $orderby[1]);
} else {
$args = array('where' => 'private = 0', 'orderby' => $orderby[0], 'order' => $orderby[1]);
}
return AWPCP_Fee::query($args);
}
示例9: awpcp_users_field
function awpcp_users_field()
{
if (get_awpcp_option('user-field-widget') == 'dropdown') {
return awpcp_users_dropdown();
} else {
return awpcp_users_autocomplete();
}
}
示例10: validate_group_settings
public function validate_group_settings($options, $group)
{
if (isset($options['enable-email-verification']) && $options['enable-email-verification'] && get_awpcp_option('requireuserregistration')) {
$message = __("Email verification was not enabled because Require Registration is on. Registered users don't need to verify the email address used for contact information.", 'AWPCP');
awpcp_flash($message, 'error');
$options['enable-email-verification'] = 0;
}
return $options;
}
示例11: normalize_query
private function normalize_query($user_query)
{
$query = wp_parse_args($user_query, array('context' => 'default', 'fields' => '*', 'raw' => false, 'id' => null, 'title' => null, 'keyword' => null, 'category_id' => null, 'exclude_category_id' => null, 'include_listings_in_children_categories' => true, 'user' => null, 'user_id' => null, 'contact_name' => null, 'price' => null, 'min_price' => null, 'max_price' => null, 'region' => '', 'country' => '', 'state' => '', 'city' => '', 'county' => '', 'regions' => array(), 'payment_status' => null, 'payer_email' => null, 'disabled_date' => null, 'end_date' => null, 'disabled' => null, 'verified' => null, 'featured' => null, 'flagged' => null, 'awaiting_approval' => null, 'have_media_awaiting_approval' => null, 'reviewed' => null, 'limit' => 0, 'offset' => 0, 'orderby' => 'default', 'order' => 'DESC'));
if (!is_array($query['context'])) {
$query['context'] = array($query['context']);
}
$query['regions'] = $this->normalize_regions_query($query);
$query['limit'] = $query['limit'] === 0 ? get_awpcp_option('adresultsperpage', 10) : $query['limit'];
return $query;
}
示例12: __construct
public function __construct($regions, $options)
{
// we need at least one region, even if its empty
if (empty($regions)) {
$this->regions = array(array('country' => '', 'county' => '', 'state' => '', 'city' => ''));
} else {
$this->regions = $regions;
}
$this->options = wp_parse_args($options, array('maxRegions' => 1, 'showTextField' => false, 'showExistingRegionsOnly' => get_awpcp_option('buildsearchdropdownlists'), 'hierarchy' => array('country', 'county', 'state', 'city'), 'enabled_fields' => awpcp_get_enabled_region_fields()));
$this->options['maxRegions'] = max($this->options['maxRegions'], count($regions));
}
示例13: awpcp_display_listings
/**
* @since 3.4
*/
function awpcp_display_listings($query, $context, $options)
{
$options = wp_parse_args($options, array('show_intro_message' => false, 'show_menu_items' => false, 'show_category_selector' => false, 'show_pagination' => false, 'before_content' => '', 'before_pagination' => '', 'before_list' => '', 'after_pagination' => '', 'after_content' => ''));
if (has_action('awpcp_browse_ads_template_action') || has_filter('awpcp_browse_ads_template_filter')) {
do_action('awpcp_browse_ads_template_action');
return apply_filters('awpcp_browse_ads_template_filter');
}
$results_per_page = absint(awpcp_request_param('results', get_awpcp_option('adresultsperpage', 10)));
$results_offset = absint(awpcp_request_param('offset', 0));
if (empty($query['limit']) && $results_per_page) {
$query['limit'] = $results_per_page;
}
if (empty($query['offset']) && $query['limit']) {
$query['offset'] = $results_offset;
}
$listings_collection = awpcp_listings_collection();
$listings = $listings_collection->find_enabled_listings_with_query($query);
$listings_count = $listings_collection->count_enabled_listings_with_query($query);
$before_content = apply_filters('awpcp-content-before-listings-page', $options['before_content'], $context);
$before_pagination = array();
if ($options['show_category_selector']) {
$before_pagination[15]['category-selector'] = awpcp_render_category_selector(array('required' => false));
}
if (is_array($options['before_pagination'])) {
$before_pagination = awpcp_array_merge_recursive($before_pagination, $options['before_pagination']);
} else {
$before_pagination[20]['user-content'] = $options['before_pagination'];
}
$before_pagination = apply_filters('awpcp-listings-before-content', $before_pagination, $context);
ksort($before_pagination);
$before_pagination = awpcp_flatten_array($before_pagination);
$before_list = apply_filters('awpcp-display-ads-before-list', $options['before_list'], $context);
if ($listings_count > 0) {
$pagination_options = array('results' => $results_per_page, 'offset' => $results_offset, 'total' => $listings_count);
$pagination = $options['show_pagination'] ? awpcp_pagination($pagination_options, awpcp_current_url()) : '';
$items = awpcp_render_listings_items($listings, $context);
} else {
$pagination = '';
$items = array();
}
$after_pagination = array('user-content' => $options['after_pagination']);
$after_pagination = apply_filters('awpcp-listings-after-content', $after_pagination, $context);
$after_content = apply_filters('awpcp-content-after-listings-page', $options['after_content'], $context);
ob_start();
include AWPCP_DIR . '/templates/frontend/listings.tpl.php';
$content = ob_get_contents();
ob_end_clean();
return $content;
}
示例14: create
public function create($args)
{
extract(wp_parse_args($args, array('enabled' => true, 'status' => null, 'is_primary' => false)));
$image_mime_types = awpcp_get_image_mime_types();
if (is_null($status)) {
if (!awpcp_current_user_is_moderator() && in_array($mime_type, $image_mime_types) && get_awpcp_option('imagesapprove')) {
$status = AWPCP_Media::STATUS_AWAITING_APPROVAL;
} else {
$status = AWPCP_Media::STATUS_APPROVED;
}
}
$data = compact('ad_id', 'name', 'path', 'mime_type', 'enabled', 'status', 'is_primary');
if ($insert_id = $this->save($data)) {
return $this->find_by_id($insert_id);
} else {
return null;
}
}
示例15: render
public function render($value, $errors, $listing, $context)
{
$characters_limit = $this->get_characters_limit_for_listing($listing);
if ($characters_limit['characters_allowed'] == 0) {
$characters_allowed_text = _x('No characters limit.', 'ad details form', 'AWPCP');
$remaining_characters_text = '';
} else {
$characters_allowed_text = _x('characters left.', 'ad details form', 'AWPCP');
$remaining_characters_text = $characters_limit['remaining_characters'];
}
if ($this->is_required()) {
$validators = 'required';
} else {
$validators = '';
}
$params = array('required' => $this->is_required(), 'value' => $this->format_value($value), 'errors' => $errors, 'label' => $this->get_label(), 'help_text' => nl2br(get_awpcp_option('htmlstatustext')), 'validators' => $validators, 'characters_allowed' => $characters_limit['characters_allowed'], 'characters_allowed_text' => $characters_allowed_text, 'remaining_characters' => $characters_limit['remaining_characters'], 'remaining_characters_text' => $remaining_characters_text, 'html' => array('id' => str_replace('_', '-', $this->get_slug()), 'name' => $this->get_slug(), 'readonly' => false));
return awpcp_render_template('frontend/form-fields/listing-details-form-field.tpl.php', $params);
}