コード例 #1
1
 public function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     echo sprintf('<form action="%s" method="GET">', wpbdp_get_page_link());
     echo '<input type="hidden" name="action" value="search" />';
     echo sprintf('<input type="hidden" name="page_id" value="%s" />', wpbdp_get_page_id('main'));
     echo '<input type="hidden" name="dosrch" value="1" />';
     if (wpbdp_getv($instance, 'form_mode', 'basic') == 'advanced') {
         $fields_api = wpbdp_formfields_api();
         foreach ($fields_api->get_fields() as $field) {
             if ($field->display_in('search') && in_array($field->get_id(), $instance['search_fields'])) {
                 echo $field->render(null, 'search');
             }
         }
     } else {
         echo '<input type="text" name="q" value="" />';
     }
     echo sprintf('<p><input type="submit" value="%s" class="submit wpbdp-search-widget-submit" /></p>', _x('Search', 'widgets', 'WPBDM'));
     echo '</form>';
     echo $after_widget;
 }
コード例 #2
0
 function main_page_breadcrumb($trail)
 {
     $last = $trail->trail[count($trail->trail) - 1];
     if (in_array('home', $last->type, true)) {
         array_pop($trail->trail);
     }
     $trail->add(new bcn_breadcrumb(get_the_title(wpbdp_get_page_id()), '', array(), wpbdp_get_page_link(), wpbdp_get_page_id()));
 }
コード例 #3
0
 public function get_renewal_url($category_id)
 {
     $hash = $this->get_renewal_hash($category_id);
     return add_query_arg(array('action' => 'renewlisting', 'renewal_id' => urlencode($hash)), wpbdp_get_page_link('main'));
 }
コード例 #4
0
 public function get_redirect_url()
 {
     if ($this->get_submit_state_id()) {
         if ($this->is_completed()) {
             return add_query_arg(array('_state' => $this->get_submit_state_id()), wpbdp_get_page_link('submit'));
         }
     }
     return $this->get_checkout_url(true);
 }
コード例 #5
0
 public function _fix_new_links()
 {
     // 'contributors' should still use the frontend to add listings (editors, authors and admins are allowed to add things directly)
     // XXX: this is kind of hacky but is the best we can do atm, there aren't hooks to change add links
     if (current_user_can('contributor') && isset($_GET['post_type']) && $_GET['post_type'] == WPBDP_POST_TYPE) {
         echo '<script type="text/javascript">';
         echo sprintf('jQuery(\'a.add-new-h2\').attr(\'href\', \'%s\');', wpbdp_get_page_link('add-listing'));
         echo '</script>';
     }
 }
コード例 #6
0
function wpbdp_search_form()
{
    $html = '';
    $html .= sprintf('<form id="wpbdmsearchform" action="" method="GET" class="wpbdp-search-form">
                      <input type="hidden" name="action" value="search" />
                      <input type="hidden" name="page_id" value="%d" />
                      <input type="hidden" name="dosrch" value="1" />', wpbdp_get_page_id('main'));
    $html .= '<input id="intextbox" maxlength="150" name="q" size="20" type="text" value="" />';
    $html .= sprintf('<input id="wpbdmsearchsubmit" class="submit" type="submit" value="%s" />', _x('Search Listings', 'templates', 'WPBDM'));
    $html .= sprintf('<a href="%s" class="advanced-search-link">%s</a>', esc_url(add_query_arg('action', 'search', wpbdp_get_page_link('main'))), _x('Advanced Search', 'templates', 'WPBDM'));
    $html .= '</form>';
    return $html;
}
コード例 #7
0
    <?php 
    do_action('wpbdp_before_search_results');
    ?>
    <div class="search-results">
    <?php 
    if (have_posts()) {
        ?>
        <?php 
        echo wpbdp_render('businessdirectory-listings');
        ?>
    <?php 
    } else {
        ?>
        <?php 
        _ex("No listings found.", 'templates', "WPBDM");
        ?>
        <br />
        <?php 
        echo sprintf('<a href="%s">%s</a>.', wpbdp_get_page_link('main'), _x('Return to directory', 'templates', 'WPBDM'));
        ?>
    
    <?php 
    }
    ?>
    </div>
    <?php 
    do_action('wpbdp_after_search_results');
}
?>
</div>
コード例 #8
0
 private function done()
 {
     $listing = WPBDP_Listing::get($this->payment->get_listing_id());
     $html = '';
     $html .= wpbdp_render_msg(_x('Your payment was received sucessfully.', 'checkout', 'WPBDM'));
     $html .= $this->api->render_details($this->payment);
     $html .= '<p>';
     if ($listing->is_published()) {
         $html .= sprintf('<a href="%s">%s</a>', $listing->get_permalink(), _x('← Return to your listing.', 'checkout', 'WPBDM'));
     } else {
         $html .= sprintf('<a href="%s">%s</a>', wpbdp_get_page_link('main'), _x('← Return to Directory.', 'checkout', 'WPBDM'));
     }
     $html .= '</p>';
     return $html;
 }
コード例 #9
0
 public function _template_redirect()
 {
     global $wp_query;
     if ($wp_query->get('wpbdpx')) {
         // Handle some special wpbdpx actions.
         $wpbdpx = $wp_query->get('wpbdpx');
         if (isset($this->{$wpbdpx}) && method_exists($this->{$wpbdpx}, 'process_request')) {
             $this->{$wpbdpx}->process_request();
             exit;
         }
     }
     if (is_feed()) {
         return;
     }
     // handle some deprecated stuff
     if (is_search() && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] == WPBDP_POST_TYPE) {
         $url = esc_url_raw(add_query_arg(array('action' => 'search', 'dosrch' => 1, 'q' => wpbdp_getv($_REQUEST, 's', '')), wpbdp_get_page_link('main')));
         wp_redirect($url);
         exit;
     }
     if (get_query_var('taxonomy') == WPBDP_CATEGORY_TAX && _wpbdp_template_mode('category') == 'page') {
         wp_redirect(esc_url_raw(add_query_arg('category', get_query_var('term'), wpbdp_get_page_link('main'))));
         // XXX
         exit;
     }
     if (get_query_var('taxonomy') == WPBDP_TAGS_TAX && _wpbdp_template_mode('category') == 'page') {
         wp_redirect(esc_url_raw(add_query_arg('tag', get_query_var('term'), wpbdp_get_page_link('main'))));
         // XXX
         exit;
     }
     if (is_single() && get_query_var('post_type') == WPBDP_POST_TYPE && _wpbdp_template_mode('single') == 'page') {
         $url = wpbdp_get_page_link('main');
         if (get_query_var('name')) {
             wp_redirect(esc_url_raw(add_query_arg('listing', get_query_var('name'), $url)));
             // XXX
         } else {
             wp_redirect(esc_url_raw(add_query_arg('id', get_query_var('p'), $url)));
             // XXX
         }
         exit;
     }
     global $post;
     if ($post && $post->ID == wpbdp_get_page_id('main') && (get_query_var('id') || get_query_var('listing'))) {
         $id_or_slug = false;
         foreach (array('id', 'preview_id', 'listing') as $x) {
             if (get_query_var($x)) {
                 $id_or_slug = get_query_var($x);
                 break;
             }
         }
         $listing = wpbdp_get_post_by_id_or_slug($id_or_slug, wpbdp_get_option('permalinks-no-id') ? 'slug' : 'id');
         if (!$listing || 'publish' != $listing->post_status && !current_user_can('edit_posts')) {
             $this->controller->action = null;
             status_header(404);
             nocache_headers();
             include get_404_template();
             exit;
         }
     }
 }
コード例 #10
0
ファイル: utils.php プロジェクト: Nedick/stzagora-website
/**
 * @since 3.5.4
 */
function wpbdp_email_from_template($setting, $replacements = array(), $args = array())
{
    global $wpbdp;
    $setting = $wpbdp->settings->get_setting($setting);
    if (!$setting || 'email_template' != $setting->type) {
        return false;
    }
    if (!class_exists('WPBDP_Email')) {
        require_once WPBDP_PATH . 'core/class-email.php';
    }
    $placeholders = isset($setting->args['placeholders']) && is_array($setting->args['placeholders']) ? $setting->args['placeholders'] : array();
    $value = wpbdp_get_option($setting->name);
    // Add core replacements.
    $replacements = array_merge($replacements, array('site-title' => get_bloginfo('name'), 'site-link' => sprintf('<a href="%s">%s</a>', get_bloginfo('url'), get_bloginfo('name')), 'site-url' => sprintf('<a href="%s">%s</a>', get_bloginfo('url'), get_bloginfo('url')), 'directory-url' => sprintf('<a href="%1$s">%1$s</a>', wpbdp_get_page_link('main')), 'today' => date_i18n(get_option('date_format')), 'now' => date_i18n(get_option('time_format'))));
    // Support old-style settings.
    if (!is_array($value)) {
        $subject = $setting->default['subject'];
        $body = $setting->default['body'];
    } else {
        $subject = $value['subject'];
        $body = $value['body'];
    }
    $email = new WPBDP_Email();
    $email->subject = $subject;
    $email->body = $body;
    foreach (array_keys($placeholders) as $placeholder) {
        if (!isset($replacements[$placeholder])) {
            continue;
        }
        $email->subject = str_replace('[' . $placeholder . ']', $replacements[$placeholder], $email->subject);
        $email->body = str_replace('[' . $placeholder . ']', $replacements[$placeholder], $email->body);
    }
    return $email;
}
コード例 #11
0
function wpbusdirman_post_menu_button_directory()
{
    return '<form method="post" action="' . wpbdp_get_page_link('main') . '"><input type="submit" class="viewlistingsbutton" value="' . __("Directory", "WPBDM") . '" /></form>';
}
コード例 #12
0
    ?>
	</ul>
<?php 
}
?>

<p><label><?php 
_ex('Listing Title: ', 'templates', 'WPBDM');
?>
</label><?php 
echo get_the_title($listing_id);
?>
</p>

<form method="POST" action="<?php 
echo wpbdp_get_page_link('main');
?>
">
	<input type="hidden" name="action" value="sendcontactmessage" />
	<input type="hidden" name="listing_id" value="<?php 
echo $listing_id;
?>
" />
	<?php 
wp_nonce_field('contact-form-' . $listing_id);
?>

	<?php 
if ($current_user) {
    ?>
		<p>
コード例 #13
0
ファイル: api.php プロジェクト: Nedick/stzagora-website
function wpbdp_get_page_link($name = 'main', $arg0 = null)
{
    $page_id = wpbdp_get_page_id($name);
    if ($page_id) {
        $link = _get_page_link($page_id);
    } else {
        switch ($name) {
            case 'view':
            case 'viewlisting':
            case 'show-listing':
            case 'showlisting':
                $link = get_permalink(intval($arg0));
                break;
            case 'edit':
            case 'editlisting':
            case 'edit-listing':
            case 'delete':
            case 'deletelisting':
            case 'delete-listing':
            case 'upgrade':
            case 'upgradetostickylisting':
            case 'upgradelisting':
            case 'upgrade-listing':
                $link = add_query_arg(array('action' => $name, 'listing_id' => intval($arg0)), wpbdp_get_page_link('main'));
                break;
            case 'viewlistings':
            case 'view-listings':
                $link = add_query_arg(array('action' => 'viewlistings'), wpbdp_get_page_link('main'));
                break;
            case 'add':
            case 'addlisting':
            case 'add-listing':
            case 'submit':
            case 'submitlisting':
            case 'submit-listing':
                $link = add_query_arg(array('action' => 'submitlisting'), wpbdp_get_page_link('main'));
                break;
            case 'search':
                $link = add_query_arg(array('action' => 'search'), wpbdp_get_page_link('main'));
                break;
            default:
                if (!wpbdp_get_page_id('main')) {
                    return '';
                }
                $link = wpbdp_get_page_link('main');
                break;
        }
    }
    return apply_filters('wpbdp_get_page_link', $link, $name, $arg0);
}
コード例 #14
0
        ?>
<form action="<?php 
        echo wpbdp_get_page_link('editlisting', $listing_id);
        ?>
" method="POST"><input type="submit" name="" value="<?php 
        _ex('Edit', 'templates', 'WPBDM');
        ?>
" class="edit-listing" /></form><?php 
    }
    ?>
-->
<!--<?php 
    if (wpbdp_user_can('delete', $listing_id)) {
        ?>
<form action="<?php 
        echo wpbdp_get_page_link('deletelisting', $listing_id);
        ?>
" method="POST"><input type="submit" name="" value="<?php 
        _ex('Delete', 'templates', 'WPBDM');
        ?>
" class="delete-listing" data-confirmation-message="<?php 
        _ex('Are you sure you wish to delete this listing?', 'templates', 'WPBDM');
        ?>
" /></form><?php 
    }
    ?>
-->
<?php 
}
?>
</div>
コード例 #15
0
ファイル: payment.php プロジェクト: Nedick/stzagora-website
 public function render_standard_checkout_page(&$payment, $opts = array())
 {
     if ($payment->is_completed()) {
         return;
     }
     $opts = wp_parse_args($opts, array('return_link' => '<a href="' . wpbdp_get_page_link('main') . '">' . _x('Return to Directory.', 'payment', 'WPBDM') . '</a>'));
     $html = '';
     if ($payment->is_pending() && $payment->has_been_processed()) {
         $html .= '<p>' . _x('Your payment is being processed by the payment gateway. Please reload this page in a moment to see if the status has changed or contact the site administrator.', 'payments', 'WPBDM') . '</p>';
     } elseif ($payment->is_rejected()) {
         if ($opts['retry_rejected']) {
             $html .= '<p>' . _x('The payment has been rejected by the payment gateway. Please contact the site administrator if you think there is an error or click "Change Payment Method" to select another payment method and try again.', 'payments', 'WPBDM') . '</p>';
             $html .= '<p><a href="' . esc_url(add_query_arg('change_payment_method', 1)) . '">' . _x('Change Payment Method', 'payments', 'WPBDM') . '</a></p>';
         } else {
             $html .= '<p>' . _x('The payment has been rejected by the payment gateway. Please contact the site administrator if you think there is an error.', 'payments', 'WPBDM') . '</p>';
         }
     } elseif ($payment->is_canceled()) {
         $html .= '<p>' . _x('The payment has been canceled at your request.', 'payments', 'WPBDM') . '</p>';
     } elseif ($payment->is_pending() && $payment->get_gateway()) {
         $html .= $this->render_invoice($payment);
         $html .= $this->render_payment_method_integration($payment);
     }
     if (!$opts['retry_rejected'] && $opts['return_link']) {
         $html .= '<p>' . $opts['return_link'] . '</p>';
     }
     return $html;
 }
コード例 #16
0
 function admin_menu()
 {
     add_menu_page(_x('Business Directory Admin', 'admin menu', "WPBDM"), _x('Directory Admin', 'admin menu', 'WPBDM'), 'administrator', 'wpbdp_admin', array(&$this, 'main_menu'), WPBDP_URL . 'admin/resources/menuico.png');
     add_submenu_page('wpbdp_admin', _x('Add New Listing', 'admin menu', 'WPBDM'), _x('Add New Listing', 'admin menu', 'WPBDM'), 'administrator', 'wpbdp_add_listing', '__return_null');
     add_submenu_page('wpbdp_admin', _x('Manage Options', 'admin menu', 'WPBDM'), _x('Manage Options', 'admin menu', 'WPBDM'), 'administrator', 'wpbdp_admin_settings', array($this, 'admin_settings'));
     add_submenu_page('wpbdp_admin', _x('Manage Fees', 'admin menu', 'WPBDM'), _x('Manage Fees', 'admin menu', 'WPBDM'), 'administrator', 'wpbdp_admin_fees', array('WPBDP_FeesAdmin', 'admin_menu_cb'));
     add_submenu_page('wpbdp_admin', _x('Manage Form Fields', 'admin menu', 'WPBDM'), _x('Manage Form Fields', 'admin menu', 'WPBDM'), 'administrator', 'wpbdp_admin_formfields', array('WPBDP_FormFieldsAdmin', 'admin_menu_cb'));
     add_submenu_page('wpbdp_admin', _x('Listings', 'admin menu', 'WPBDM'), _x('Listings', 'admin menu', 'WPBDM'), 'administrator', 'wpbdp_all_listings', '__return_false');
     // if ( wpbdp_payments_api()->payments_possible() ) {
     //     add_submenu_page( 'wpbdp_admin',
     //                       _x( 'Transactions', 'admin menu', 'WPBDM' ),
     //                       _x( 'Transactions', 'admin menu', 'WPBDM' ),
     //                       'administrator',
     //                       'wpbdp_manage_transactions',
     //                       array( 'WPBDP_TransactionsAdmin', 'admin_menu_cb' )
     //                     );
     // }
     add_submenu_page('wpbdp_admin', _x('CSV Import', 'admin menu', 'WPBDM'), _x('CSV Import', 'admin menu', 'WPBDM'), 'administrator', 'wpbdp-csv-import', array(&$this->csv_import, 'dispatch'));
     add_submenu_page('wpbdp_admin', _x('CSV Export', 'admin menu', 'WPBDM'), _x('CSV Export', 'admin menu', 'WPBDM'), 'administrator', 'wpbdp-csv-export', array(&$this->csv_export, 'dispatch'));
     add_submenu_page('wpbdp_admin', _x('Debug', 'admin menu', 'WPBDM'), _x('Debug', 'admin menu', 'WPBDM'), 'administrator', 'wpbdp-debug-info', array(&$this->debug_page, 'dispatch'));
     global $submenu;
     if (current_user_can('administrator')) {
         $submenu['wpbdp_admin'][1][2] = admin_url(sprintf('post-new.php?post_type=%s', WPBDP_POST_TYPE));
         $submenu['wpbdp_admin'][0][0] = _x('Main Menu', 'admin menu', 'WPBDM');
         $submenu['wpbdp_admin'][5][2] = admin_url('edit.php?post_type=' . WPBDP_POST_TYPE);
     } elseif (current_user_can('contributor')) {
         $m = $submenu['edit.php?post_type=' . WPBDP_POST_TYPE];
         $keys = array_keys($m);
         $m[$keys[1]][2] = wpbdp_get_page_link('add-listing');
     }
     do_action('wpbdp_admin_menu', 'wpbdp_admin');
     add_submenu_page('wpbdp_admin', _x('Uninstall Business Directory Plugin', 'admin menu', 'WPBDM'), _x('Uninstall', 'admin menu', 'WPBDM'), 'administrator', 'wpbdp_uninstall', array($this, 'uninstall_plugin'));
 }