本文整理汇总了PHP中charitable_get_helper函数的典型用法代码示例。如果您正苦于以下问题:PHP charitable_get_helper函数的具体用法?PHP charitable_get_helper怎么用?PHP charitable_get_helper使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了charitable_get_helper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_with_campaign_id
/**
* Static method that is fired within 24 hours after a campaign is finished.
*
* @param int $campaign_id
* @return boolean
* @access public
* @static
* @since 1.1.0
*/
public static function send_with_campaign_id($campaign_id)
{
if (!charitable_get_helper('emails')->is_enabled_email(self::get_email_id())) {
return false;
}
$email = new Charitable_Email_Campaign_End(array('campaign' => new Charitable_Campaign($campaign_id)));
/**
* Don't resend the email.
*/
if ($email->is_sent_already($campaign_id)) {
return false;
}
/**
* Check whether the campaign expired in the last 24 hours.
*/
if (!$email->is_time_to_send()) {
return false;
}
$sent = $email->send();
/**
* Log that the email was sent.
*/
if (apply_filters('charitable_log_email_send', true, self::get_email_id(), $email)) {
$email->log($campaign_id, $sent);
}
return true;
}
示例2: send_with_donation_id
/**
* Static method that is fired right after a donation is completed, sending the donation receipt.
*
* @param int $donation_id
* @return boolean
* @access public
* @static
* @since 1.0.0
*/
public static function send_with_donation_id($donation_id)
{
if (!charitable_get_helper('emails')->is_enabled_email(self::get_email_id())) {
return false;
}
if (!charitable_is_approved_status(get_post_status($donation_id))) {
return false;
}
$donation = charitable_get_donation($donation_id);
if (!is_object($donation) || 0 == count($donation->get_campaign_donations())) {
return false;
}
if (!apply_filters('charitable_send_' . self::get_email_id(), true, $donation)) {
return false;
}
$email = new Charitable_Email_New_Donation(array('donation' => $donation));
/**
* Don't resend the email.
*/
if ($email->is_sent_already($donation_id)) {
return false;
}
$sent = $email->send();
/**
* Log that the email was sent.
*/
if (apply_filters('charitable_log_email_send', true, self::get_email_id(), $email)) {
$email->log($donation_id, $sent);
}
return true;
}
示例3: en_send_donation_receipt_for_pending_offline
/**
* Right after a donation is made, this sends the donation receipt to
* the donor if the donation is pending AND it was made in offline mode.
*
* @param int $donation_id
* @return boolean
*/
function en_send_donation_receipt_for_pending_offline($donation_id)
{
/* Verify that the email is enabled. */
if (!charitable_get_helper('emails')->is_enabled_email(Charitable_Email_Donation_Receipt::get_email_id())) {
return false;
}
/* If the donation is not pending, stop here. */
if ('charitable-pending' != get_post_status($donation_id)) {
return false;
}
/* If the donation was not made with the offline payment option, stop here. */
if ('offline' != get_post_meta($donation_id, 'donation_gateway', true)) {
return false;
}
/* All three of those checks passed, so proceed with sending the email. */
$email = new Charitable_Email_Donation_Receipt(array('donation' => new Charitable_Donation($donation_id)));
/* Don't resend the email. */
if ($email->is_sent_already($donation_id)) {
return false;
}
$sent = $email->send();
/* Log that the email was sent. */
if (apply_filters('charitable_log_email_send', true, Charitable_Email_Donation_Receipt::get_email_id(), $email)) {
$email->log($donation_id, $sent);
}
return true;
}
示例4: send_with_donation_id
/**
* Static method that is fired right after a donation is completed, sending the donation receipt.
*
* @param int $donation_id
* @return boolean
* @access public
* @static
* @since 1.0.0
*/
public static function send_with_donation_id($donation_id)
{
if (!charitable_get_helper('emails')->is_enabled_email(self::get_email_id())) {
return false;
}
if (!Charitable_Donation::is_approved_status(get_post_status($donation_id))) {
return false;
}
$email = new Charitable_Email_Donation_Receipt(array('donation' => new Charitable_Donation($donation_id)));
$email->send();
return true;
}
示例5: send_with_campaign_id
/**
* Static method that is fired within 24 hours after a campaign is finished.
*
* @param int $campaign_id
* @return boolean
* @access public
* @static
* @since 1.1.0
*/
public static function send_with_campaign_id($campaign_id)
{
if (!charitable_get_helper('emails')->is_enabled_email(self::get_email_id())) {
return false;
}
$campaign = new Charitable_Campaign($campaign_id);
$time_since_ended = $campaign->get_time_since_ended();
/* If the since since ended is 0 (campaign is still going) or more than 24 hours, return false */
if ($time_since_ended == 0 || $time_since_ended > 86400) {
return false;
}
$email = new Charitable_Email_Campaign_End(array('campaign' => $campaign));
$email->send();
return true;
}
示例6: en_send_donation_notification_for_pending_offline
/**
* Right after a donation is made, this sends a notification to admin if
* the donation is pending AND it was made in offline mode.
*
* @param int $donation_id
* @return boolean
*/
function en_send_donation_notification_for_pending_offline($donation_id)
{
/* Verify that the email is enabled. */
if (!charitable_get_helper('emails')->is_enabled_email(Charitable_Email_New_Donation::get_email_id())) {
return false;
}
/* If the donation is not pending, stop here. */
if ('charitable-pending' != get_post_status($donation_id)) {
return false;
}
/* If the donation was not made with the offline payment option, stop here. */
if ('offline' != get_post_meta($donation_id, 'donation_gateway', true)) {
return false;
}
/* All three of those checks passed, so proceed with sending the email. */
$email = new Charitable_Email_New_Donation(array('donation' => new Charitable_Donation($donation_id)));
$email->send();
return true;
}
开发者ID:rafecolton,项目名称:library,代码行数:26,代码来源:send-donation-notification-for-pending-offline-donations.php
示例7: send_with_donation_id
/**
* Static method that is fired right after a donation is completed, sending the donation receipt.
*
* @param int $donation_id
* @return boolean
* @access public
* @static
* @since 1.0.0
*/
public static function send_with_donation_id($donation_id)
{
if (!charitable_get_helper('emails')->is_enabled_email(self::get_email_id())) {
return false;
}
if (!charitable_is_approved_status(get_post_status($donation_id))) {
return false;
}
$email = new Charitable_Email_Donation_Receipt(array('donation' => charitable_get_donation($donation_id)));
/**
* Don't resend the email.
*/
if ($email->is_sent_already($donation_id)) {
return false;
}
$sent = $email->send();
/**
* Log that the email was sent.
*/
if (apply_filters('charitable_log_email_send', true, self::get_email_id(), $email)) {
$email->log($donation_id, $sent);
}
return true;
}
示例8: wp_enqueue_style
<?php
/**
* Display the Welcome page.
*
* @author Studio 164a
* @package Charitable/Admin View/Welcome Page
* @since 1.0.0
*/
wp_enqueue_style('charitable-admin-pages');
$gateways = Charitable_Gateways::get_instance()->get_active_gateways_names();
$campaigns = wp_count_posts('campaign');
$campaigns_count = $campaigns->publish + $campaigns->draft + $campaigns->future + $campaigns->pending + $campaigns->private;
$emails = charitable_get_helper('emails')->get_enabled_emails_names();
$install = isset($_GET['install']) && $_GET['install'];
?>
<div class="wrap about-wrap charitable-wrap">
<h1>
<strong>Charitable</strong>
<sup class="version"><?php
echo charitable()->get_version();
?>
</sup>
</h1>
<div class="badge">
<a href="https://www.wpcharitable.com/?utm_source=welcome-page&utm_medium=wordpress-dashboard&utm_campaign=home&utm_content=icon" target="_blank"><i class="icon-charitable"></i></a>
</div>
<div class="intro">
<?php
if ($install) {
_e('Thank you for installing Charitable!', 'charitable');
示例9: charitable_get_helper
<?php
/**
* Email Preview
*
* @author Studio 164a
* @package Charitable/Templates/Emails
* @version 1.0.0
*/
if (!defined('ABSPATH')) {
exit;
}
// Exit if accessed directly
if (!isset($_GET['email_id'])) {
return;
}
$email = charitable_get_helper('emails')->get_email($_GET['email_id']);
$email_object = new $email();
echo $email_object->preview();
示例10: setup_payment_fields
/**
* Set up payment fields based on the gateways that are installed and which one is default.
*
* @return void
* @access protected
* @since 1.0.0
*/
protected function setup_payment_fields()
{
$active_gateways = charitable_get_helper('gateways')->get_active_gateways();
$has_gateways = apply_filters('charitable_has_active_gateways', !empty($active_gateways));
/* If no gateways have been selected, display a notice and return the fields */
if (!$has_gateways) {
charitable_get_notices()->add_error($this->get_no_active_gateways_notice());
return;
}
if (count($active_gateways) == 1) {
add_filter('charitable_donation_form_hidden_fields', array($this, 'add_hidden_gateway_field'));
}
add_action('charitable_donation_form_fields', array($this, 'add_payment_fields'));
}
示例11: get_current_email_class
/**
* Returns the helper class of the email we're editing.
*
* @return Charitable_Email|false
* @access private
* @since 1.0.0
*/
private function get_current_email_class()
{
$email = charitable_get_helper('emails')->get_email($_GET['edit_email']);
return $email ? new $email() : false;
}
示例12: get_gateway_object
/**
* Returns the gateway's object helper.
*
* @return false|Charitable_Gateway
* @access public
* @since 1.0.0
*/
public function get_gateway_object()
{
$class = charitable_get_helper('gateways')->get_gateway($this->get_gateway());
if (!$class) {
return false;
}
return new $class();
}
示例13: save_license
/**
* Checks for updated license and invalidates status field if not set.
*
* @param mixed[] $values The parsed values combining old values & new values.
* @param mixed[] $new_values The newly submitted values.
* @return mixed[]
* @access public
* @since 1.0.0
*/
public function save_license($values, $new_values)
{
/* If we didn't just submit licenses, stop here. */
if (!isset($new_values['licenses'])) {
return $values;
}
$licenses = $new_values['licenses'];
foreach ($licenses as $product_key => $license) {
$license_data = charitable_get_helper('licenses')->verify_license($product_key, $license);
if (empty($license_data)) {
continue;
}
$values['licenses'][$product_key] = $license_data;
}
return $values;
}
示例14: charitable_get_helper
<?php
/**
* Display the table of emails.
*
* @author Studio 164a
* @package Charitable/Admin View/Settings
* @since 1.0.0
*/
$helper = charitable_get_helper('emails');
$emails = $helper->get_available_emails();
if (count($emails)) {
foreach ($emails as $email) {
$email = new $email();
$is_enabled = $helper->is_enabled_email($email->get_email_id());
$action_url = esc_url(add_query_arg(array('charitable_action' => $is_enabled ? 'disable_email' : 'enable_email', 'email_id' => $email->get_email_id(), '_nonce' => wp_create_nonce('email')), admin_url('admin.php?page=charitable-settings&tab=emails')));
?>
<div class="charitable-settings-object charitable-email cf">
<h4><?php
echo $email->get_name();
?>
</h4>
<span class="actions">
<?php
if ($is_enabled) {
$settings_url = esc_url(add_query_arg(array('group' => 'emails_' . $email->get_email_id()), admin_url('admin.php?page=charitable-settings&tab=emails')));
?>
<a href="<?php
echo $settings_url;
?>
" class="button button-primary"><?php
示例15: charitable_get_helper
<?php
/**
* Display the table of payment gateways.
*
* @author Studio 164a
* @package Charitable/Admin View/Settings
* @since 1.0.0
*/
$helper = charitable_get_helper('gateways');
$gateways = $helper->get_available_gateways();
$default = $helper->get_default_gateway();
if (count($gateways)) {
foreach ($gateways as $gateway) {
$gateway = new $gateway();
$is_active = $helper->is_active_gateway($gateway->get_gateway_id());
$action_url = esc_url(add_query_arg(array('charitable_action' => $is_active ? 'disable_gateway' : 'enable_gateway', 'gateway_id' => $gateway->get_gateway_id(), '_nonce' => wp_create_nonce('gateway')), admin_url('admin.php?page=charitable-settings&tab=gateways')));
$make_default_url = esc_url(add_query_arg(array('charitable_action' => 'make_default_gateway', 'gateway_id' => $gateway->get_gateway_id(), '_nonce' => wp_create_nonce('gateway')), admin_url('admin.php?page=charitable-settings&tab=gateways')));
?>
<div class="charitable-settings-object charitable-gateway cf">
<h4><?php
echo $gateway->get_name();
?>
</h4>
<?php
if ($gateway->get_gateway_id() == $default) {
?>
<span class="default-gateway"><?php
_e('Default gateway', 'charitable');
?>