protected function render($template, $args = array(), $skipouter = false, $is_html = false)
 {
     $html = '';
     $html .= sprintf('<div id="wpbdp-submit-page" class="wpbdp-submit-page businessdirectory-submit businessdirectory wpbdp-page step-%s">', str_replace('_', '-', $this->state->step));
     $html .= sprintf('<h2>%s</h2>', $this->state->editing ? _x('Edit Your Listing', 'templates', 'WPBDM') : _x('Submit A Listing', 'templates', 'WPBDM'));
     if (current_user_can('administrator')) {
         if ($errors = wpbdp_payments_api()->check_config()) {
             foreach ($errors as $error) {
                 $html .= wpbdp_render_msg($error, 'error');
             }
         }
         $html .= wpbdp_render_msg(_x('You are logged in as an administrator. Any payment steps will be skipped.', 'templates', 'WPBDM'));
     }
     if ($this->errors) {
         foreach ($this->errors as &$e) {
             $html .= wpbdp_render_msg($e, 'error');
         }
     }
     if ($this->messages) {
         foreach ($this->messages as &$m) {
             $html .= wpbdp_render_msg($m);
         }
     }
     if (!$is_html) {
         $content = wpbdp_render('submit-listing/' . $template, array_merge(array('_state' => $this->state), $args), false);
     } else {
         $content = $template;
     }
     $html .= $content;
     $html .= '</div>';
     return apply_filters_ref_array('wpbdp_view_submit_listing', array($html, &$this->state));
 }
Beispiel #2
0
 public function get_fees_for_category($catid)
 {
     $fees = array();
     if (wpbdp_payments_api()->payments_possible()) {
         $parent_categories = wpbdp_get_parent_categories($catid);
         array_walk($parent_categories, create_function('&$x', '$x = intval($x->term_id);'));
         foreach ($this->get_fees() as $fee) {
             if ($fee->categories['all']) {
                 $fees[] = $fee;
             } else {
                 foreach ($fee->categories['categories'] as $fee_catid) {
                     if (in_array($fee_catid, $parent_categories)) {
                         $fees[] = $fee;
                         break;
                     }
                 }
             }
         }
     }
     if (!$fees) {
         $fees[] = $this->get_free_fee();
     }
     return $fees;
 }
 public function __construct(&$payment = null)
 {
     $this->api = wpbdp_payments_api();
     $this->payment = $payment;
 }
 public function has_module($name)
 {
     switch (strtolower($name)) {
         case 'payfast':
         case 'payfast-payment-module':
             return class_exists('WPBDP_Gateways_PayFast');
             break;
         case 'paypal':
         case 'paypal-gateway-module':
             return class_exists('WPBDP_Paypal_Module');
             break;
         case '2checkout':
         case 'twocheckout':
         case '2checkout-gateway-module':
             return class_exists('WPBDP_2Checkout_Module');
             break;
         case 'googlecheckout':
             return wpbdp_payments_api()->has_gateway('googlecheckout');
             break;
         case 'google-maps-module':
         case 'googlemaps':
             return class_exists('BusinessDirectory_GoogleMapsPlugin');
             break;
         case 'ratings-module':
         case 'ratings':
             return class_exists('BusinessDirectory_RatingsModule');
             break;
         case 'regions-module':
         case 'regions':
             return class_exists('WPBDP_RegionsPlugin');
             break;
         case 'file-attachments-module':
         case 'attachments':
             return class_exists('WPBDP_ListingAttachmentsModule');
             break;
         case 'zip-search-module':
         case 'zipcodesearch':
             return class_exists('WPBDP_ZIPCodeSearchModule');
             break;
         case 'featured-levels-module':
         case 'featuredlevels':
             return class_exists('WPBDP_FeaturedLevelsModule');
             break;
         case 'stripe-payment-module':
         case 'stripe':
             return class_exists('WPBDP_Stripe_Module');
             break;
         case 'categories':
             return class_exists('WPBDP_CategoriesModule');
             break;
         case 'claim-listings-module':
             return class_exists('WPBDP_Claim_Listings_Module');
             break;
         case 'discount-codes-module':
             return class_exists('WPBDP_Coupons_Module');
             break;
         default:
             break;
     }
     return false;
 }
Beispiel #5
0
 public function main_page()
 {
     $html = '';
     if (count(get_terms(WPBDP_CATEGORY_TAX, array('hide_empty' => 0))) == 0) {
         if (is_user_logged_in() && current_user_can('install_plugins')) {
             $html .= wpbdp_render_msg(_x('There are no categories assigned to the business directory yet. You need to assign some categories to the business directory. Only admins can see this message. Regular users are seeing a message that there are currently no listings in the directory. Listings cannot be added until you assign categories to the business directory.', 'templates', 'WPBDM'), 'error');
         } else {
             $html .= "<p>" . _x('There are currently no listings in the directory.', 'templates', 'WPBDM') . "</p>";
         }
     }
     if (current_user_can('administrator')) {
         if ($errors = wpbdp_payments_api()->check_config()) {
             foreach ($errors as $error) {
                 $html .= wpbdp_render_msg($error, 'error');
             }
         }
     }
     $listings = '';
     if (wpbdp_get_option('show-listings-under-categories')) {
         $listings = $this->view_listings(false);
     }
     if (current_user_can('administrator') && wpbdp_get_option('hide-empty-categories') && wp_count_terms(WPBDP_CATEGORY_TAX, 'hide_empty=0') > 0 && wp_count_terms(WPBDP_CATEGORY_TAX, 'hide_empty=1') == 0) {
         $msg = _x('You have "Hide Empty Categories" on and some categories that don\'t have listings in them. That means they won\'t show up on the front end of your site. If you didn\'t want that, click <a>here</a> to change the setting.', 'templates', 'WPBDM');
         $msg = str_replace('<a>', '<a href="' . admin_url('admin.php?page=wpbdp_admin_settings&groupid=listings#hide-empty-categories') . '">', $msg);
         $html .= wpbdp_render_msg($msg);
     }
     $html .= wpbdp_render(array('businessdirectory-main-page', 'wpbusdirman-index-categories'), array('submit_listing_button' => wpbusdirman_post_menu_button_submitlisting(), 'view_listings_button' => wpbusdirman_post_menu_button_viewlistings(), 'action_links' => wpbusdirman_post_menu_button_submitlisting() . wpbusdirman_post_menu_button_viewlistings(), 'search_form' => wpbdp_get_option('show-search-listings') ? wpbdp_search_form() : '', 'listings' => $listings));
     return $html;
 }
<?php 
_ex('Payment Mode:', 'admin infometabox', 'WPBDM');
?>
 <?php 
echo wpbdp_payments_api()->payments_possible() ? _x('Paid', 'admin infometabox', 'WPBDM') : _x('Free', 'admin infometabox', 'WPBDM');
?>
<br />
<?php 
if (current_user_can('administrator')) {
    echo sprintf(_x('To change your payment mode, go to <a href="%s">Payment Settings</a>.', 'admin infometabox', 'WPBDM'), admin_url('admin.php?page=wpbdp_admin_settings&groupid=payment'));
}
?>

<?php 
if (!wpbdp_payments_api()->payments_possible() && current_user_can('administrator')) {
    ?>
<p><i><?php 
    _ex('Note: In Free mode, the fee plans will always be set to "Free Listing" below.', 'admin infometabox', 'WPBDM');
    ?>
</i></p>
<?php 
}
?>

<?php 
echo wpbdp_render_page(WPBDP_PATH . 'admin/templates/listing-metabox-categories.tpl.php', array('categories' => $categories, 'listing' => $listing));
?>

<?php 
if ($listing->get_categories('expired')) {
Beispiel #7
0
function wpbdp_payments_possible()
{
    return wpbdp_payments_api()->payments_possible();
}
 public function dispatch()
 {
     global $wpdb;
     $api = wpbdp_payments_api();
     switch (wpbdp_getv($_REQUEST, 'action')) {
         case 'approve':
             if ($trans = $api->get_transaction($_GET['id'])) {
                 $trans->processed_on = current_time('mysql');
                 $trans->processed_by = 'admin';
                 $trans->status = 'approved';
                 $api->save_transaction($trans);
             }
             wpbdp_admin()->messages[] = _x('The transaction has been approved.', 'admin', 'WPBDM');
             break;
         case 'reject':
             if ($trans = $api->get_transaction($_GET['id'])) {
                 $trans->processed_on = current_time('mysql');
                 $trans->processed_by = 'admin';
                 $trans->status = 'rejected';
                 $api->save_transaction($trans);
             }
             wpbdp_admin()->messages[] = _x('The transaction has been rejected.', 'admin', 'WPBDM');
             break;
         case 'delete':
             $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}wpbdp_payments WHERE id = %d", $_GET['id']));
             wpbdp_admin()->messages[] = _x('The transaction has been deleted.', 'admin', 'WPBDM');
             break;
         default:
             break;
     }
     $_SERVER['REQUEST_URI'] = remove_query_arg(array('action', 'id'), $_SERVER['REQUEST_URI']);
     $this->clear_transactions();
     $this->transactions_table();
 }
 public function check_payments_possible()
 {
     // show messages only in directory admin pages
     if (isset($_GET['post_type']) && $_GET['post_type'] == WPBDP_POST_TYPE || isset($_GET['page']) && stripos($_GET['page'], 'wpbdp_') !== FALSE) {
         if ($errors = wpbdp_payments_api()->check_config()) {
             foreach ($errors as $error) {
                 $this->messages[] = array($error, 'error');
             }
         }
     }
 }