private function cancel_subscription()
 {
     $data = $this->decode_subscription_hash(isset($_GET['cancel']) ? $_GET['cancel'] : '');
     if (!$data) {
         return wpbdp_render_msg(_x('Invalid subscription.', 'manage subscriptions', 'WPBDM'), 'error');
     }
     global $wpbdp;
     $unsubscribe_form = $wpbdp->payments->render_unsubscribe_integration($data['category_info'], $data['listing']);
     return wpbdp_render('manage-recurring-cancel', array('listing' => $data['listing'], 'subscription' => $data['category_info'], 'unsubscribe_form' => $unsubscribe_form));
 }
 private function checkout()
 {
     $payment = WPBDP_Payment::get($this->category->payment_id);
     if (!$payment) {
         return wpbdp_render_msg(_x('Invalid renewal state.', 'renewal', 'WPBDM'), 'error');
     }
     require_once WPBDP_PATH . 'core/view-checkout.php';
     $checkout = new WPBDP_Checkout_Page($payment);
     return $checkout->dispatch();
 }
 public function dispatch()
 {
     $this->listing = WPBDP_Listing::get(intval($_GET['listing_id'] ? $_GET['listing_id'] : 0));
     if (!$this->listing || !wpbdp_user_can('upgrade-to-sticky', $this->listing->get_id())) {
         return wpbdp_render_msg(_x('Invalid link followed.', 'listing upgrade', 'WPBDM'), 'error');
     }
     $sticky_info = $this->upgrades_api->get_info($this->listing->get_id());
     if ($sticky_info->pending) {
         $html = '';
         $html .= wpbdp_render_msg(_x('Your listing is already pending approval for "featured" status.', 'templates', 'WPBDM'));
         $html .= sprintf('<a href="%s">%s</a>', $this->listing->get_permalink(), _x('Return to listing.', 'templates', 'WPBDM'));
         return $html;
     }
     if (isset($_POST['do_upgrade'])) {
         return $this->checkout();
     }
     return $this->upgrade_selection();
 }
 function dispatch()
 {
     $listing_id = intval($_REQUEST['listing_id']);
     if (!wpbdp_user_can('delete', $listing_id)) {
         $html .= wpbdp_render_msg(_x('Please log in to delete the listing.', 'delete listing', 'WPBDM'));
         $html .= wpbdp_render('parts/login-required', array('show_message' => false));
         return $html;
     }
     $listing = WPBDP_Listing::get($listing_id);
     $nonce = isset($_REQUEST['_wpnonce']) ? $_REQUEST['_wpnonce'] : '';
     if (!$listing) {
         die;
     }
     if ($nonce && wp_verify_nonce($nonce, 'delete listing ' . $listing->get_id())) {
         $listing->delete();
         return wpbdp_render_msg(_x('Your listing has been deleted.', 'delete listing', 'WPBDM'));
     }
     return wpbdp_render('delete-listing-confirm', array('listing' => $listing, 'has_recurring' => $this->has_recurring_fee($listing)));
 }
 protected function step_checkout()
 {
     global $wpbdp;
     if ($this->state->editing) {
         $this->state->advance(false);
         return $this->dispatch();
     }
     $payment = WPBDP_Payment::get($this->state->payment_id);
     if (!$payment) {
         return wpbdp_render_msg(_x('Invalid submit state.', 'submit_state', 'WPBDM'), 'error');
     }
     if ($payment->is_completed()) {
         $this->state->advance(false);
         return $this->dispatch();
     }
     require_once WPBDP_PATH . 'core/view-checkout.php';
     $checkout = new WPBDP_Checkout_Page($payment);
     return $checkout->dispatch();
 }
Esempio n. 6
0
 private function rejected()
 {
     $html = '';
     $html .= wpbdp_render_msg(implode('<br />', $this->payment->get_data('errors')), 'error');
     $html .= $this->api->render_details($this->payment);
     return $html;
 }
Esempio n. 7
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

$show_message = isset($show_message) ? $show_message : true;
if ($show_message) {
    echo wpbdp_render_msg(_x("You are not currently logged in. Please login or register first. When registering, you will receive an activation email. Be sure to check your spam if you don't see it in your email within 60 minutes.", 'templates', 'WPBDM'));
}
?>

<p></p>

<h2><?php 
_ex('Login', 'templates', 'WPBDM');
?>
</h2>
<?php 
wp_login_form();
?>

<?php 
$registration_url = trim(wpbdp_get_option('registration-url', ''));
if (!$registration_url && get_option('users_can_register')) {
    if (function_exists('wp_registration_url')) {
        $registration_url = wp_registration_url();
    } else {
        $registration_url = site_url('wp-login.php?action=register', 'login');
    }
}
$current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$registration_url = $registration_url ? add_query_arg(array('redirect_to' => urlencode($current_url)), $registration_url) : '';
$lost_password_url = add_query_arg('redirect_to', urlencode($current_url), wp_lostpassword_url());
?>
 public function dispatch()
 {
     $listing_id = intval(isset($_REQUEST['listing_id']) ? $_REQUEST['listing_id'] : 0);
     if (!$listing_id) {
         return '';
     }
     if (!$this->can_submit($listing_id, $error_msg)) {
         return wpbdp_render_msg($error_msg, 'error');
     }
     $this->listing_id = $listing_id;
     $this->prepare_input();
     if (!$this->validate()) {
         return $this->render_form($listing_id, $this->errors);
     }
     // Compose e-mail message.
     $replacements = array('listing-url' => get_permalink($listing_id), 'listing' => get_the_title($listing_id), 'name' => $this->name, 'email' => $this->email, 'message' => $this->message, 'date' => date_i18n(__('l F j, Y \\a\\t g:i a'), current_time('timestamp')));
     $email = wpbdp_email_from_template('email-templates-contact', $replacements);
     $email->from = "{$this->name} <{$this->email}>";
     $email->to = wpbusdirman_get_the_business_email($listing_id);
     $email->reply_to = $this->email;
     $email->template = 'businessdirectory-email';
     if (in_array('listing-contact', wpbdp_get_option('admin-notifications'), true)) {
         $email->cc[] = get_bloginfo('admin_email');
         if (wpbdp_get_option('admin-notifications-cc')) {
             $email->cc[] = wpbdp_get_option('admin-notifications-cc');
         }
     }
     $html = '';
     if ($email->send()) {
         $html .= wpbdp_render_msg('Your message has been sent.', 'contact-message', 'WPBDM');
         $this->update_contacts($listing_id);
     } else {
         $html .= wpbdp_render_msg(_x("There was a problem encountered. Your message has not been sent", 'contact-message', "WPBDM"), 'error');
     }
     $html .= sprintf('<p><a href="%s">%s</a></p>', get_permalink($listing_id), _x('Return to listing.', 'contact-message', "WPBDM"));
     return $html;
 }
Esempio n. 10
0
 public function render_payment_page($options_)
 {
     $options = array_merge(array('title' => _x('Checkout', 'payments-api', 'WPBDM'), 'item_text' => _x('Pay %1$s through %2$s', 'payments-api', 'WPBDM'), 'return_link' => null), $options_);
     $transaction = $this->get_transaction($options['transaction_id']);
     if ($transaction->status == 'approved' || $transaction->amount == 0.0) {
         return wpbdp_render_msg(_x('Your transaction has been approved.', 'payments-api', 'WPBDM'));
     }
     return wpbdp_render('payment-page', array('title' => $options['title'], 'item_text' => $options['item_text'], 'transaction' => $transaction, 'payment_methods' => $this->get_available_methods(), 'return_link' => $options['return_link']));
 }