Ejemplo n.º 1
0
function wpbdp_render($template, $vars = array(), $allow_override = true)
{
    $vars = wp_parse_args($vars, array('__page__' => array('class' => array(), 'content_class' => array(), 'before_content' => '')));
    $template_name = is_array($template) ? $template[0] : $template;
    $vars = apply_filters('wpbdp_template_vars', $vars, $template_name);
    return apply_filters("wpbdp_render_{$template_name}", wpbdp_render_page(wpbdp_locate_template($template, $allow_override), $vars, false));
}
Ejemplo n.º 2
0
function wpbdp_admin_header($title_ = null, $id = null, $h2items = array(), $sidebar = true)
{
    global $title;
    if (!$title_) {
        $title_ = $title;
    }
    return wpbdp_render_page(WPBDP_PATH . 'admin/templates/header.tpl.php', array('page_title' => $title_, 'page_id' => $id, 'h2items' => $h2items, 'sidebar' => $sidebar));
}
Ejemplo n.º 3
0
 public function ajax_payment_details()
 {
     if (!current_user_can('administrator')) {
         exit;
     }
     global $wpbdp;
     $response = new WPBDP_AJAX_Response();
     $payment = WPBDP_Payment::get(intval($_REQUEST['id']));
     if (!$payment) {
         $response->send_error();
     }
     $response->add('html', wpbdp_render_page(WPBDP_PATH . 'admin/templates/payment-details.tpl.php', array('payment' => $payment, 'invoice' => $wpbdp->payments->render_invoice($payment))));
     $response->send();
 }
Ejemplo n.º 4
0
 private function delete_fee()
 {
     global $wpdb;
     if (isset($_POST['doit'])) {
         $this->api->delete_fee($_POST['id']);
         $this->admin->messages[] = _x('Fee deleted.', 'fees admin', 'WPBDM');
         return $this->feesTable();
     } else {
         if ($fee = $this->api->get_fee_by_id($_REQUEST['id'])) {
             wpbdp_render_page(WPBDP_PATH . 'admin/templates/fees-confirm-delete.tpl.php', array('fee' => $fee), true);
         }
     }
 }
Ejemplo n.º 5
0
 private function import()
 {
     $sources = array();
     $csv_file = '';
     $zip_file = '';
     // CSV file.
     if (!empty($_POST['csv-file-local'])) {
         $csv_file = $this->get_imports_dir() . DIRECTORY_SEPARATOR . basename($_POST['csv-file-local']);
         $sources[] = basename($csv_file);
     }
     if (!$csv_file && !empty($_FILES['csv-file'])) {
         if (!$_FILES['csv-file']['error'] && is_uploaded_file($_FILES['csv-file']['tmp_name'])) {
             $sources[] = $_FILES['csv-file']['name'];
             $csv_file = $_FILES['csv-file']['tmp_name'];
         } elseif (UPLOAD_ERR_NO_FILE != $_FILES['csv-file']['error']) {
             wpbdp_admin_message(_x('There was an error uploading the CSV file.', 'admin csv-import', 'WPBDM'), 'error');
             return $this->import_settings();
         }
     }
     if (!$csv_file) {
         wpbdp_admin_message(_x('Please upload or select a CSV file.', 'admin csv-import', 'WPBDM'), 'error');
         return $this->import_settings();
     }
     // Images file.
     if (!empty($_POST['images-file-local'])) {
         $zip_file = $this->get_imports_dir() . DIRECTORY_SEPARATOR . basename($_POST['images-file-local']);
         $sources[] = basename($zip_file);
     }
     if (!$zip_file && !empty($_FILES['images-file'])) {
         if (UPLOAD_ERR_NO_FILE == $_FILES['images-file']['error']) {
         } else {
             if (!is_uploaded_file($_FILES['images-file']['tmp_name'])) {
                 wpbdp_admin_message(_x('There was an error uploading the images ZIP file.', 'admin csv-import', 'WPBDM'), 'error');
                 return $this->import_settings();
             }
         }
         $zip_file = $_FILES['images-file']['tmp_name'];
         $sources[] = $_FILES['images-file']['name'];
     }
     // Store settings to use as defaults next time.
     update_user_option(get_current_user_id(), 'wpbdp-csv-import-settings', $_POST['settings'], false);
     $import = null;
     try {
         $import = new WPBDP_CSV_Import('', $csv_file, $zip_file, array_merge($_POST['settings'], array('test-import' => !empty($_POST['test-import']))));
     } catch (Exception $e) {
         if ($import) {
             $import->cleanup();
         }
         $error = _x('An error was detected while validating the CSV file for import. Please fix this before proceeding.', 'admin csv-import', 'WPBDM');
         $error .= '<br />';
         $error .= '<b>' . $e->getMessage() . '</b>';
         wpbdp_admin_message($error, 'error');
         return $this->import_settings();
     }
     if ($import->in_test_mode()) {
         wpbdp_admin_message(_x('Import is in "test mode". Nothing will be inserted into the database.', 'admin csv-import', 'WPBDM'));
     }
     echo wpbdp_render_page(WPBDP_PATH . 'admin/templates/csv-import-progress.tpl.php', array('import' => $import, 'sources' => $sources));
 }
Ejemplo n.º 6
0
 private function deleteField()
 {
     global $wpdb;
     $field = WPBDP_FormField::get($_REQUEST['id']);
     if (!$field || $field->has_behavior_flag('no-delete')) {
         return;
     }
     if (isset($_POST['doit'])) {
         $ret = $field->delete();
         if (is_wp_error($ret)) {
             $this->admin->messages[] = array($ret->get_error_message(), 'error');
         } else {
             $this->admin->messages[] = _x('Field deleted.', 'form-fields admin', 'WPBDM');
         }
         return $this->fieldsTable();
     }
     wpbdp_render_page(WPBDP_PATH . 'admin/templates/form-fields-confirm-delete.tpl.php', array('field' => $field), true);
 }
    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')) {
    ?>
<a href="<?php 
    echo esc_url(add_query_arg('wpbdmaction', 'renewlisting'));
    ?>
" class="button-primary button"><?php 
    _ex('Renew listing in all expired categories', 'admin infometabox', 'WPBDM');
    ?>
</a>
<?php 
}
Ejemplo n.º 8
0
 function dispatch($plain = false)
 {
     global $wpdb;
     $debug_info = array();
     // basic BD setup info & tests
     $debug_info['basic']['_title'] = _x('BD Info', 'debug-info', 'WPBDM');
     $debug_info['basic']['BD version'] = WPBDP_VERSION;
     $debug_info['basic']['BD database revision (current)'] = WPBDP_Installer::DB_VERSION;
     $debug_info['basic']['BD database revision (installed)'] = get_option('wpbdp-db-version');
     $tables = apply_filters('wpbdp_debug_info_tables_check', array('wpbdp_form_fields', 'wpbdp_fees', 'wpbdp_payments', 'wpbdp_listing_fees'));
     $missing_tables = array();
     foreach ($tables as &$t) {
         if ($wpdb->get_var($wpdb->prepare('SHOW TABLES LIKE %s', $wpdb->prefix . $t)) == '') {
             $missing_tables[] = $t;
         }
     }
     $debug_info['basic']['Table check'] = $missing_tables ? sprintf(_('Missing tables: %s', 'debug-info', 'WPBDM'), implode(',', $missing_tables)) : _x('OK', 'debug-info', 'WPBDM');
     $debug_info['basic']['Main Page'] = sprintf('%d (%s)', wpbdp_get_page_id('main'), get_post_status(wpbdp_get_page_id('main')));
     $debug_info['basic'] = apply_filters('wpbdp_debug_info_section', $debug_info['basic'], 'basic');
     // BD options
     $blacklisted = array('googlecheckout-merchant', 'paypal-business-email', 'wpbdp-2checkout-seller', 'recaptcha-public-key', 'recaptcha-private-key');
     $debug_info['options']['_title'] = _x('BD Options', 'debug-info', 'WPBDM');
     $settings_api = wpbdp_settings_api();
     foreach ($settings_api->settings as &$s) {
         if ($s->type == 'core' || in_array($s->name, $blacklisted)) {
             continue;
         }
         $value = wpbdp_get_option($s->name);
         $debug_info['options'][$s->name] = is_array($value) ? implode(',', $value) : $value;
     }
     $debug_info['options'] = apply_filters('wpbdp_debug_info_section', $debug_info['options'], 'options');
     // environment info
     $debug_info['environment']['_title'] = _x('Environment', 'debug-info', 'WPBDM');
     $debug_info['environment']['WordPress version'] = get_bloginfo('version', 'raw');
     $debug_info['environment']['OS'] = php_uname('s') . ' ' . php_uname('r') . ' ' . php_uname('m');
     if (function_exists('apache_get_version')) {
         $apache_version = apache_get_version();
         $debug_info['environment']['Apache version'] = $apache_version;
     }
     $debug_info['environment']['PHP version'] = phpversion();
     $mysql_version = $wpdb->get_var('SELECT @@version');
     if ($sql_mode = $wpdb->get_var('SELECT @@sql_mode')) {
         $mysql_version .= ' ( ' . $sql_mode . ' )';
     }
     $debug_info['environment']['MySQL version'] = $mysql_version ? $mysql_version : 'N/A';
     $sqlite_version = class_exists('SQLite3') ? wpbdp_getv(SQLite3::version(), 'versionString', '') : (function_exists('sqlite_libversion') ? sqlite_libversion() : null);
     $debug_info['environment']['SQLite version'] = $sqlite_version ? $sqlite_version : 'N/A';
     $debug_info['environment']['cURL version'] = function_exists('curl_init') ? wpbdp_getv(curl_version(), 'version') : 'N/A';
     $debug_info['environment'] = apply_filters('wpbdp_debug_info_section', $debug_info['environment'], 'environment');
     $debug_info = apply_filters('wpbdp_debug_info', $debug_info);
     if ($plain) {
         foreach ($debug_info as &$section) {
             foreach ($section as $k => $v) {
                 if ($k == '_title') {
                     printf('== %s ==', $v);
                     print PHP_EOL;
                     continue;
                 }
                 printf("%-33s = %s", $k, $v);
                 print PHP_EOL;
             }
             print str_repeat(PHP_EOL, 2);
         }
         return;
     }
     echo wpbdp_render_page(WPBDP_PATH . 'admin/templates/debug-info.tpl.php', array('debug_info' => $debug_info));
 }
<p><strong><?php 
_ex('Categories for this listing', 'admin infometabox', 'WPBDM');
?>
</strong></p>

<?php 
echo wpbdp_render_page(WPBDP_PATH . 'admin/templates/listing-metabox-categories.tpl.php', array('categories' => $categories, 'listing' => $listing, 'display' => array('expiration'), 'admin_actions' => array('delete', 'renewal url', 'renewal email')));
?>

<?php 
if ($listing->get_categories('expired')) {
    ?>
<a href="<?php 
    echo esc_url(add_query_arg('wpbdmaction', 'renewlisting'));
    ?>
" class="button-primary button"><?php 
    _ex('Renew listing in all expired categories', 'admin infometabox', 'WPBDM');
    ?>
</a>
<?php 
}
Ejemplo n.º 10
0
 private function transactions_table()
 {
     $table = new WPBDP_TransactionsTable();
     $table->prepare_items();
     wpbdp_render_page(WPBDP_PATH . 'admin/templates/transactions.tpl.php', array('table' => $table), true);
 }
<?php

echo wpbdp_admin_header(_x('Uninstall Business Directory Plugin', 'uninstall', 'WPBDM'), 'admin-uninstall');
?>

<?php 
wpbdp_admin_notices();
?>

<?php 
echo wpbdp_render_page(WPBDP_PATH . 'admin/templates/uninstall-capture-form.tpl.php');
?>

<?php 
echo wpbdp_admin_footer();
Ejemplo n.º 12
0
 public function main_menu()
 {
     echo wpbdp_render_page(WPBDP_PATH . 'admin/templates/home.tpl.php');
 }
Ejemplo n.º 13
0
 public function dispatch()
 {
     echo wpbdp_render_page(WPBDP_PATH . 'admin/templates/csv-export.tpl.php');
 }
Ejemplo n.º 14
0
 private function tab_transactions()
 {
     echo wpbdp_render_page(WPBDP_PATH . 'admin/templates/listing-metabox-transactions.tpl.php', array('payments' => $this->listing->get_latest_payments()));
 }