コード例 #1
0
 /**
  * Get things started
  *
  * @since 1.0
  * @see   WP_List_Table::__construct()
  */
 public function __construct()
 {
     global $status, $page;
     // Set parent defaults
     parent::__construct(array('singular' => give_get_forms_label_singular(), 'plural' => give_get_forms_label_plural(), 'ajax' => false));
     add_action('give_log_view_actions', array($this, 'give_forms_filter'));
 }
コード例 #2
0
ファイル: post-types.php プロジェクト: wordimpress/give
/**
 * Registers and sets up the Donation Forms (give_forms) custom post type
 *
 * @since 1.0
 * @return void
 */
function give_setup_post_types()
{
    /** Give Forms Post Type */
    $give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false;
    $give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false;
    $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
    //support for old 'GIVE_FORMS_SLUG' constant
    if (defined('GIVE_FORMS_SLUG')) {
        $give_forms_slug = GIVE_FORMS_SLUG;
    }
    $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array('slug' => $give_forms_slug, 'with_front' => false);
    $give_forms_labels = apply_filters('give_forms_labels', array('name' => esc_html__('Donation %2$s', 'give'), 'singular_name' => '%1$s', 'add_new' => esc_html__('Add %1$s', 'give'), 'add_new_item' => esc_html__('Add New Donation %1$s', 'give'), 'edit_item' => esc_html__('Edit Donation %1$s', 'give'), 'new_item' => esc_html__('New %1$s', 'give'), 'all_items' => esc_html__('All %2$s', 'give'), 'view_item' => esc_html__('View %1$s', 'give'), 'search_items' => esc_html__('Search %2$s', 'give'), 'not_found' => esc_html__('No %2$s found', 'give'), 'not_found_in_trash' => esc_html__('No %2$s found in Trash', 'give'), 'parent_item_colon' => '', 'menu_name' => apply_filters('give_menu_name', esc_html__('Donations', 'give')), 'name_admin_bar' => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give'))));
    foreach ($give_forms_labels as $key => $value) {
        $give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural());
    }
    //Default give_forms supports
    $give_form_supports = array('title', 'thumbnail', 'excerpt', 'revisions', 'author');
    //Has the user disabled the excerpt
    if (give_get_option('disable_forms_excerpt') === 'on') {
        unset($give_form_supports[2]);
    }
    //Has user disabled the featured image?
    if (give_get_option('disable_form_featured_img') === 'on') {
        unset($give_form_supports[1]);
        remove_action('give_before_single_form_summary', 'give_show_form_images');
    }
    $give_forms_args = array('labels' => $give_forms_labels, 'public' => true, 'publicly_queryable' => $give_forms_singular, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => $give_forms_rewrite, 'map_meta_cap' => true, 'capability_type' => 'give_form', 'has_archive' => $give_forms_archives, 'menu_icon' => 'dashicons-give', 'hierarchical' => false, 'supports' => apply_filters('give_forms_supports', $give_form_supports));
    register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
    /** Payment Post Type */
    $payment_labels = array('name' => _x('Donations', 'post type general name', 'give'), 'singular_name' => _x('Donation', 'post type singular name', 'give'), 'add_new' => esc_html__('Add New', 'give'), 'add_new_item' => esc_html__('Add New Donation', 'give'), 'edit_item' => esc_html__('Edit Donation', 'give'), 'new_item' => esc_html__('New Donation', 'give'), 'all_items' => esc_html__('All Donations', 'give'), 'view_item' => esc_html__('View Donation', 'give'), 'search_items' => esc_html__('Search Donations', 'give'), 'not_found' => esc_html__('No Donations found', 'give'), 'not_found_in_trash' => esc_html__('No Donations found in Trash', 'give'), 'parent_item_colon' => '', 'menu_name' => esc_html__('Transactions', 'give'));
    $payment_args = array('labels' => apply_filters('give_payment_labels', $payment_labels), 'public' => false, 'query_var' => false, 'rewrite' => false, 'map_meta_cap' => true, 'capability_type' => 'give_payment', 'supports' => array('title'), 'can_export' => true);
    register_post_type('give_payment', $payment_args);
}
コード例 #3
0
ファイル: pdf-reports.php プロジェクト: wordimpress/give
/**
 * Generate PDF Reports.
 *
 * Generates PDF report on donations and income for all forms for the current year.
 *
 * @since  1.0
 *
 * @param string $data
 *
 * @uses   give_pdf
 */
function give_generate_pdf($data)
{
    if (!current_user_can('view_give_reports')) {
        wp_die(esc_html__('You do not have permission to generate PDF sales reports.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
    }
    if (!wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) {
        wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
    }
    require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php';
    require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php';
    $daterange = utf8_decode(sprintf(esc_html__('%1$s to %2$s', 'give'), date_i18n(get_option('date_format'), mktime(0, 0, 0, 1, 1, date('Y'))), date_i18n(get_option('date_format'))));
    $pdf = new give_pdf();
    $pdf->AddPage('L', 'A4');
    $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
    $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
    $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
    $pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png'), 247, 8);
    $pdf->SetMargins(8, 8, 8);
    $pdf->SetX(8);
    $pdf->SetFont('Helvetica', '', 16);
    $pdf->SetTextColor(50, 50, 50);
    $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
    $pdf->SetFont('Helvetica', '', 13);
    $pdf->Ln();
    $pdf->SetTextColor(150, 150, 150);
    $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')) . $daterange, 0, 2, 'L', false);
    $pdf->Ln();
    $pdf->SetTextColor(50, 50, 50);
    $pdf->SetFont('Helvetica', '', 14);
    $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
    $pdf->SetFont('Helvetica', '', 12);
    $pdf->SetFillColor(238, 238, 238);
    $pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
    $pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
    $pdf->Cell(50, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
    $pdf->Cell(50, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
    $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
    $pdf->Cell(35, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
    $year = date('Y');
    $give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1));
    if ($give_forms) {
        $pdf->SetWidths(array(70, 30, 50, 50, 45, 35));
        foreach ($give_forms as $form) {
            $pdf->SetFillColor(255, 255, 255);
            $title = $form->post_title;
            if (give_has_variable_prices($form->ID)) {
                $prices = give_get_variable_prices($form->ID);
                $first = $prices[0]['_give_amount'];
                $last = array_pop($prices);
                $last = $last['_give_amount'];
                if ($first < $last) {
                    $min = $first;
                    $max = $last;
                } else {
                    $min = $last;
                    $max = $first;
                }
                $price = html_entity_decode(give_currency_filter(give_format_amount($min)) . ' - ' . give_currency_filter(give_format_amount($max)));
            } else {
                $price = html_entity_decode(give_currency_filter(give_get_form_price($form->ID)));
            }
            $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
            $categories = !is_wp_error($categories) ? strip_tags($categories) : '';
            $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
            $tags = !is_wp_error($tags) ? strip_tags($tags) : '';
            $sales = give_get_form_sales_stats($form->ID);
            $link = get_permalink($form->ID);
            $earnings = html_entity_decode(give_currency_filter(give_get_form_earnings_stats($form->ID)));
            if (function_exists('iconv')) {
                // Ensure characters like euro; are properly converted.
                $price = iconv('UTF-8', 'windows-1252', utf8_encode($price));
                $earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings));
            }
            $pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings));
        }
    } else {
        $pdf->SetWidths(array(280));
        $title = utf8_decode(sprintf(esc_html__('No %s found.', 'give'), give_get_forms_label_plural()));
        $pdf->Row(array($title));
    }
    $pdf->Ln();
    $pdf->SetTextColor(50, 50, 50);
    $pdf->SetFont('Helvetica', '', 14);
    $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
    $pdf->SetFont('Helvetica', '', 12);
    $image = html_entity_decode(urldecode(give_draw_chart_image()));
    $image = str_replace(' ', '%20', $image);
    $pdf->SetX(25);
    $pdf->Image($image . '&file=.png');
    $pdf->Ln(7);
    $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n('Y-m-d')) . '.pdf', 'D');
}
コード例 #4
0
 /**
  * Get things started.
  *
  * @since 1.0
  * @see   WP_List_Table::__construct()
  */
 public function __construct()
 {
     // Set parent defaults.
     parent::__construct(array('singular' => give_get_forms_label_singular(), 'plural' => give_get_forms_label_plural(), 'ajax' => false));
 }
コード例 #5
0
ファイル: template.php プロジェクト: helgatheviking/Give
/**
 * Sale Notification Template Body
 *
 * @since  1.0
 *
 * @param int   $payment_id   Payment ID
 * @param array $payment_data Payment Data
 *
 * @return string $email_body Body of the email
 */
function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array())
{
    global $give_options;
    $user_info = maybe_unserialize($payment_data['user_info']);
    $email = give_get_payment_user_email($payment_id);
    if (isset($user_info['id']) && $user_info['id'] > 0) {
        $user_data = get_userdata($user_info['id']);
        $name = $user_data->display_name;
    } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
        $name = $user_info['first_name'] . ' ' . $user_info['last_name'];
    } else {
        $name = $email;
    }
    $gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true));
    $default_email_body = __('Hello', 'give') . "\n\n" . __('A donation has been made', 'give') . ".\n\n";
    $default_email_body .= sprintf(__('%s sold:', 'give'), give_get_forms_label_plural()) . "\n\n";
    $default_email_body .= __('Donor: ', 'give') . " " . html_entity_decode($name, ENT_COMPAT, 'UTF-8') . "\n";
    $default_email_body .= __('Amount: ', 'give') . " " . html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8') . "\n";
    $default_email_body .= __('Payment Method: ', 'give') . " " . $gateway . "\n\n";
    $default_email_body .= __('Thank you', 'give');
    $email = isset($give_options['donation_notification']) ? stripslashes($give_options['donation_notification']) : $default_email_body;
    $email_body = give_do_email_tags($email, $payment_id);
    return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
}
コード例 #6
0
ファイル: scripts.php プロジェクト: duongnguyen92/tvd12v2
/**
 * Load Admin Scripts
 *
 * Enqueues the required admin scripts.
 *
 * @since 1.0
 * @global       $post
 *
 * @param string $hook Page hook
 *
 * @return void
 */
function give_load_admin_scripts($hook)
{
    global $wp_version, $post, $post_type;
    //Directories of assets
    $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/';
    $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
    $css_dir = GIVE_PLUGIN_URL . 'assets/css/';
    // Use minified libraries if SCRIPT_DEBUG is turned off
    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    //Global Admin:
    wp_register_style('give-admin-bar-notification', $css_dir . 'adminbar-style.css');
    wp_enqueue_style('give-admin-bar-notification');
    //Give Admin Only:
    if (!apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
        return;
    }
    //CSS
    wp_register_style('jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css');
    wp_enqueue_style('jquery-ui-css');
    wp_register_style('give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION);
    wp_enqueue_style('give-admin');
    wp_register_style('jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION);
    wp_enqueue_style('jquery-chosen');
    wp_enqueue_style('thickbox');
    //JS
    wp_register_script('jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array('jquery'), GIVE_VERSION);
    wp_enqueue_script('jquery-chosen');
    wp_register_script('give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array('jquery'), GIVE_VERSION, false);
    wp_enqueue_script('give-admin-scripts');
    wp_register_script('jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js');
    wp_enqueue_script('jquery-flot');
    wp_register_script('give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array('jquery'), GIVE_VERSION, false);
    wp_enqueue_script('give-qtip');
    wp_enqueue_script('jquery-ui-datepicker');
    wp_enqueue_script('thickbox');
    //Forms CPT Script
    if ($post_type === 'give_forms') {
        wp_register_script('give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array('jquery'), GIVE_VERSION, false);
        wp_enqueue_script('give-admin-forms-scripts');
    }
    //Localize strings & variables for JS
    wp_localize_script('give-admin-scripts', 'give_vars', array('post_id' => isset($post->ID) ? $post->ID : null, 'give_version' => GIVE_VERSION, 'quick_edit_warning' => __('Sorry, not available for variable priced forms.', 'give'), 'delete_payment' => __('Are you sure you wish to delete this payment?', 'give'), 'delete_payment_note' => __('Are you sure you wish to delete this note?', 'give'), 'delete_tax_rate' => __('Are you sure you wish to delete this tax rate?', 'give'), 'revoke_api_key' => __('Are you sure you wish to revoke this API key?', 'give'), 'regenerate_api_key' => __('Are you sure you wish to regenerate this API key?', 'give'), 'resend_receipt' => __('Are you sure you wish to resend the donation receipt?', 'give'), 'copy_download_link_text' => __('Copy these links to your clipboard and give them to your donor', 'give'), 'delete_payment_download' => sprintf(__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()), 'one_price_min' => __('You must have at least one price', 'give'), 'one_file_min' => __('You must have at least one file', 'give'), 'one_field_min' => __('You must have at least one field', 'give'), 'one_option' => sprintf(__('Choose a %s', 'give'), give_get_forms_label_singular()), 'one_or_more_option' => sprintf(__('Choose one or more %s', 'give'), give_get_forms_label_plural()), 'numeric_item_price' => __('Item price must be numeric', 'give'), 'numeric_quantity' => __('Quantity must be numeric', 'give'), 'currency_sign' => give_currency_filter(''), 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', 'currency_decimals' => give_currency_decimal_filter(), 'new_media_ui' => apply_filters('give_use_35_media_ui', 1), 'remove_text' => __('Remove', 'give'), 'type_to_search' => sprintf(__('Type to search %s', 'give'), give_get_forms_label_plural())));
    if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) {
        //call for new media manager
        wp_enqueue_media();
    }
}
コード例 #7
0
 /**
  * Get things started
  *
  * @since 1.0
  * @uses  Give_Payment_History_Table::get_payment_counts()
  * @see   WP_List_Table::__construct()
  */
 public function __construct()
 {
     global $status, $page;
     // Set parent defaults
     parent::__construct(array('singular' => give_get_forms_label_singular(), 'plural' => give_get_forms_label_plural(), 'ajax' => false));
     $this->get_payment_counts();
     $this->process_bulk_action();
     $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
 }
コード例 #8
0
ファイル: reports.php プロジェクト: lots0logs/Give
/**
 * Renders the 'Export' tab on the Reports Page
 *
 * @since 1.0
 * @return void
 */
function give_reports_tab_export()
{
    ?>
	<div id="give-dashboard-widgets-wrap">
		<div id="post-body">
			<div id="post-body-content">

				<?php 
    do_action('give_reports_tab_export_content_top');
    ?>


				<table class="widefat export-options-table give-table">
					<thead>
					<tr>
						<th class="row-title"><?php 
    _e('Export Type', 'give');
    ?>
</th>
						<th><?php 
    _e('Export Options', 'give');
    ?>
</th>
					</tr>
					</thead>
					<tbody>
					<?php 
    do_action('give_reports_tab_export_table_top');
    ?>
					<tr class="give-export-pdf-sales-earnings">
						<td class="row-title">
							<h3><span><?php 
    _e('Export PDF of Donations and Income', 'give');
    ?>
</span></h3>

							<p><?php 
    _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give');
    ?>
</p>
						</td>
						<td>
							<a class="button" href="<?php 
    echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf');
    ?>
"><?php 
    _e('Generate PDF', 'give');
    ?>
</a>
						</td>
					</tr>
					<tr class="alternate give-export-sales-earnings">
						<td class="row-title">
							<h3><span><?php 
    _e('Export Income and Donation Stats', 'give');
    ?>
</span></h3>

							<p><?php 
    _e('Download a CSV of income and donations over time.', 'give');
    ?>
</p>
						</td>
						<td>
							<form method="post">
								<?php 
    echo Give()->html->year_dropdown('start_year');
    ?>
								<?php 
    echo Give()->html->month_dropdown('start_month');
    ?>
								<?php 
    echo _x('to', 'Date one to date two', 'give');
    ?>
								<?php 
    echo Give()->html->year_dropdown('end_year');
    ?>
								<?php 
    echo Give()->html->month_dropdown('end_month');
    ?>
								<input type="hidden" name="give-action" value="earnings_export" />
								<input type="submit" value="<?php 
    _e('Generate CSV', 'give');
    ?>
" class="button-secondary" />
							</form>
						</td>
					</tr>
					<tr class="give-export-payment-history">
						<td class="row-title">
							<h3><span><?php 
    _e('Export Donation History', 'give');
    ?>
</span></h3>

							<p><?php 
    _e('Download a CSV of all donations recorded.', 'give');
    ?>
</p>
						</td>
						<td>

							<form method="post">
								<?php 
    echo Give()->html->year_dropdown();
    ?>
								<?php 
    echo Give()->html->month_dropdown();
    ?>
								<select name="give_export_payment_status">
									<option value="0"><?php 
    _e('All Statuses', 'give');
    ?>
</option>
									<?php 
    $statuses = give_get_payment_statuses();
    foreach ($statuses as $status => $label) {
        echo '<option value="' . $status . '">' . $label . '</option>';
    }
    ?>
								</select>
								<input type="hidden" name="give-action" value="payment_export" />
								<input type="submit" value="<?php 
    _e('Generate CSV', 'give');
    ?>
" class="button-secondary" />
							</form>

						</td>
					</tr>
					<tr class="alt give-export-donors">
						<td class="row-title">
							<h3><span><?php 
    _e('Export Donors in CSV', 'give');
    ?>
</span></h3>

							<p><?php 
    _e('Download a CSV of all donors\' emails. Optionally export only donors that have donated to a particular form. Note: if you have a large number of donors, exporting the donation stats may fail.', 'give');
    ?>
</p>
						</td>
						<td>
							<form method="post" id="give_donor_export">
								<select name="give_export_download" id="give_donor_export_download">
									<option value="0"><?php 
    printf(__('All %s', 'give'), give_get_forms_label_plural());
    ?>
</option>
									<?php 
    $forms = get_posts(array('post_type' => 'give_forms', 'posts_per_page' => -1));
    if ($forms) {
        foreach ($forms as $form) {
            echo '<option value="' . $form->ID . '">' . get_the_title($form->ID) . '</option>';
        }
    }
    ?>
								</select>
								<select name="give_export_option" id="give_donor_export_option">
									<option value="emails"><?php 
    _e('Emails', 'give');
    ?>
</option>
									<option value="emails_and_names"><?php 
    _e('Emails and Names', 'give');
    ?>
</option>
									<option value="full"><?php 
    _e('Emails, Names, and Purchase Stats', 'give');
    ?>
</option>
								</select>
								<input type="hidden" name="give-action" value="email_export" />
								<input type="submit" value="<?php 
    _e('Generate CSV', 'give');
    ?>
" class="button-secondary" />
							</form>
						</td>
					</tr>
					<?php 
    do_action('give_reports_tab_export_table_bottom');
    ?>
					</tbody>
				</table>

				<?php 
    do_action('give_reports_tab_export_content_bottom');
    ?>

			</div>
			<!-- .post-body-content -->
		</div>
		<!-- .post-body -->
	</div><!-- #give-dashboard-widgets-wrap -->
	<?php 
}
コード例 #9
0
/**
 * Add download count to At a glance widget
 *
 * @since  1.0
 * @return void
 */
function give_dashboard_at_a_glance_widget($items)
{
    $num_posts = wp_count_posts('give_forms');
    if ($num_posts && $num_posts->publish) {
        $text = _n('%s Give ' . give_get_forms_label_singular(), '%s Give ' . give_get_forms_label_plural(), $num_posts->publish);
        $text = sprintf($text, number_format_i18n($num_posts->publish));
        if (current_user_can('edit_give_forms', get_the_ID())) {
            $text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text);
        } else {
            $text = sprintf('<span class="give-forms-count">%1$s</span>', $text);
        }
        $items[] = $text;
    }
    return $items;
}
コード例 #10
0
ファイル: scripts.php プロジェクト: wordimpress/give
/**
 * Load Admin Scripts
 *
 * Enqueues the required admin scripts.
 *
 * @since 1.0
 *
 * @global       $post
 * @global       $give_options
 *
 * @param string $hook Page hook
 *
 * @return void
 */
function give_load_admin_scripts($hook)
{
    global $wp_version, $post, $post_type, $give_options;
    //Directories of assets
    $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/';
    $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
    $css_dir = GIVE_PLUGIN_URL . 'assets/css/';
    // Use minified libraries if SCRIPT_DEBUG is turned off
    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    //Global Admin:
    wp_register_style('give-admin-bar-notification', $css_dir . 'adminbar-style.css');
    wp_enqueue_style('give-admin-bar-notification');
    //Give Admin Only:
    if (!apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
        return;
    }
    //CSS
    wp_register_style('jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css');
    wp_enqueue_style('jquery-ui-css');
    wp_register_style('give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION);
    wp_enqueue_style('give-admin');
    wp_register_style('jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION);
    wp_enqueue_style('jquery-chosen');
    wp_enqueue_style('thickbox');
    //JS
    wp_register_script('jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array('jquery'), GIVE_VERSION);
    wp_enqueue_script('jquery-chosen');
    wp_register_script('give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array('jquery'), GIVE_VERSION, false);
    wp_enqueue_script('give-accounting');
    wp_register_script('give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array('jquery'), GIVE_VERSION, false);
    wp_enqueue_script('give-admin-scripts');
    wp_register_script('jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js');
    wp_enqueue_script('jquery-flot');
    wp_register_script('give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array('jquery'), GIVE_VERSION, false);
    wp_enqueue_script('give-qtip');
    wp_enqueue_script('jquery-ui-datepicker');
    wp_enqueue_script('thickbox');
    // Forms CPT Script.
    if ($post_type === 'give_forms') {
        wp_register_script('give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array('jquery'), GIVE_VERSION, false);
        wp_enqueue_script('give-admin-forms-scripts');
    }
    //Settings Scripts
    if (isset($_GET['page']) && $_GET['page'] == 'give-settings') {
        wp_register_script('give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array('jquery'), GIVE_VERSION, false);
        wp_enqueue_script('give-admin-settings-scripts');
    }
    // Price Separators.
    $thousand_separator = give_get_price_thousand_separator();
    $decimal_separator = give_get_price_decimal_separator();
    //Localize strings & variables for JS
    wp_localize_script('give-admin-scripts', 'give_vars', array('post_id' => isset($post->ID) ? $post->ID : null, 'give_version' => GIVE_VERSION, 'thousands_separator' => $thousand_separator, 'decimal_separator' => $decimal_separator, 'quick_edit_warning' => esc_html__('Sorry, not available for variable priced forms.', 'give'), 'delete_payment' => esc_html__('Are you sure you wish to delete this payment?', 'give'), 'delete_payment_note' => esc_html__('Are you sure you wish to delete this note?', 'give'), 'revoke_api_key' => esc_html__('Are you sure you wish to revoke this API key?', 'give'), 'regenerate_api_key' => esc_html__('Are you sure you wish to regenerate this API key?', 'give'), 'resend_receipt' => esc_html__('Are you sure you wish to resend the donation receipt?', 'give'), 'copy_download_link_text' => esc_html__('Copy these links to your clipboard and give them to your donor.', 'give'), 'delete_payment_download' => sprintf(esc_html__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()), 'one_price_min' => esc_html__('You must have at least one price.', 'give'), 'one_file_min' => esc_html__('You must have at least one file.', 'give'), 'one_field_min' => esc_html__('You must have at least one field.', 'give'), 'one_option' => sprintf(esc_html__('Choose a %s', 'give'), give_get_forms_label_singular()), 'one_or_more_option' => sprintf(esc_html__('Choose one or more %s', 'give'), give_get_forms_label_plural()), 'numeric_item_price' => esc_html__('Item price must be numeric.', 'give'), 'numeric_quantity' => esc_html__('Quantity must be numeric.', 'give'), 'currency_sign' => give_currency_filter(''), 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', 'currency_decimals' => give_currency_decimal_filter(give_get_price_decimals()), 'new_media_ui' => apply_filters('give_use_35_media_ui', 1), 'remove_text' => esc_html__('Remove', 'give'), 'type_to_search' => sprintf(esc_html__('Type to search %s', 'give'), give_get_forms_label_plural()), 'batch_export_no_class' => esc_html__('You must choose a method.', 'give'), 'batch_export_no_reqs' => esc_html__('Required fields not completed.', 'give'), 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), 'price_format_guide' => sprintf(esc_html__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator)));
    if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) {
        //call for new media manager
        wp_enqueue_media();
    }
}
コード例 #11
0
ファイル: reports.php プロジェクト: wordimpress/give
/**
 * Default Report Views
 *
 * @since 1.0
 * @return array $views Report Views
 */
function give_reports_default_views()
{
    $views = array('earnings' => esc_html__('Income', 'give'), 'forms' => give_get_forms_label_plural(), 'donors' => esc_html__('Donors', 'give'), 'gateways' => esc_html__('Payment Methods', 'give'));
    $views = apply_filters('give_report_views', $views);
    return $views;
}
コード例 #12
0
ファイル: tools.php プロジェクト: wordimpress/give
/**
 * Display the recount stats tools
 *
 * @since       1.5
 * @return      void
 */
function give_tools_recount_stats_display()
{
    if (!current_user_can('manage_give_settings')) {
        return;
    }
    do_action('give_tools_recount_stats_before');
    ?>
	<div id="poststuff">
		<div class="postbox">

			<h2 class="hndle ui-sortable-handle"><span><?php 
    esc_html_e('Recount Stats', 'give');
    ?>
</span></h2>

			<div class="inside recount-stats-controls">
				<p><?php 
    esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give');
    ?>
</p>
				<form method="post" id="give-tools-recount-form" class="give-export-form">

					<?php 
    wp_nonce_field('give_ajax_export', 'give_ajax_export');
    ?>

					<select name="give-export-class" id="recount-stats-type">
						<option value="0" selected="selected" disabled="disabled"><?php 
    esc_html_e('Please select an option', 'give');
    ?>
</option>
						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php 
    esc_html_e('Recalculate Total Donation Income Amount', 'give');
    ?>
</option>
						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php 
    esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give');
    ?>
</option>
						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php 
    esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give');
    ?>
</option>
						<option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php 
    esc_html_e('Recalculate Donor Statistics', 'give');
    ?>
</option>
						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php 
    esc_html_e('Delete Test Transactions', 'give');
    ?>
</option>
						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php 
    esc_html_e('Delete All Data', 'give');
    ?>
</option>
						<?php 
    do_action('give_recount_tool_options');
    ?>
					</select>

					<span id="tools-form-dropdown" style="display: none">
						<?php 
    $args = array('name' => 'form_id', 'number' => -1, 'chosen' => true);
    echo Give()->html->forms_dropdown($args);
    ?>
					</span>

					<input type="submit" id="recount-stats-submit" value="<?php 
    esc_attr_e('Submit', 'give');
    ?>
" class="button-secondary"/>

					<br/>

					<span class="give-recount-stats-descriptions">
						<span id="recount-stats"><?php 
    esc_html_e('Recalculates the overall donation income amount.', 'give');
    ?>
</span>
						<span id="recount-form"><?php 
    printf(esc_html__('Recalculates the donation and income stats for a specific %s.', 'give'), give_get_forms_label_singular(true));
    ?>
</span>
						<span id="recount-all"><?php 
    printf(esc_html__('Recalculates the earnings and sales stats for all %s.', 'give'), give_get_forms_label_plural(true));
    ?>
</span>
						<span id="recount-customer-stats"><?php 
    esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give');
    ?>
</span>
						<?php 
    do_action('give_recount_tool_descriptions');
    ?>
						<span id="delete-test-transactions"><?php 
    _e('<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give');
    ?>
</span>
						<span id="reset-stats"><?php 
    _e('<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give');
    ?>
</span>
					</span>

					<span class="spinner"></span>

				</form>
				<?php 
    do_action('give_tools_recount_forms');
    ?>
			</div><!-- .inside -->
		</div><!-- .postbox -->
	</div><!-- #poststuff -->
	<?php 
    do_action('give_tools_recount_stats_after');
}