本文整理汇总了PHP中charitable_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP charitable_get_option函数的具体用法?PHP charitable_get_option怎么用?PHP charitable_get_option使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了charitable_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Uninstall the plugin.
*
* @access public
* @since 1.0.0
*/
public function __construct()
{
if (charitable()->is_deactivation() && charitable_get_option('delete_data_on_uninstall')) {
$this->remove_caps();
$this->remove_post_data();
$this->remove_tables();
do_action('charitable_uninstall');
}
}
示例2: donation_receipt_template
/**
* Load the donation receipt template if we're looking at a donation receipt.
*
* @param string $template
* @return string
* @access public
* @since 1.0.0
*/
public function donation_receipt_template($template)
{
if (charitable_is_page('donation_receipt_page')) {
if ('auto' != charitable_get_option('donation_receipt_page', 'auto')) {
return $template;
}
new Charitable_Ghost_Page('donation-receipt-page', array('title' => __('Your Receipt', 'charitable'), 'content' => sprintf('<p>%s</p>', __('Thank you for your donation!', 'charitable'))));
$new_template = apply_filters('charitable_donation_receipt_page_template', array('donation-receipt-page.php', 'page.php', 'index.php'));
$template = charitable_get_template_path($new_template, $template);
}
return $template;
}
示例3: wp_enqueue_scripts
/**
* Loads public facing scripts and stylesheets.
*
* @return void
* @access public
* @since 1.0.0
*/
public function wp_enqueue_scripts()
{
$vars = apply_filters('charitable_javascript_vars', array('ajaxurl' => admin_url('admin-ajax.php')));
wp_register_script('charitable-script', charitable()->get_path('assets', false) . 'js/charitable.js', array('jquery'), charitable()->get_version());
wp_localize_script('charitable-script', 'CHARITABLE_VARS', $vars);
wp_enqueue_script('charitable-script');
wp_register_style('charitable-styles', charitable()->get_path('assets', false) . 'css/charitable.css', array(), charitable()->get_version());
wp_enqueue_style('charitable-styles');
/* Lean Modal is registered but NOT enqueued yet. */
if ('modal' == charitable_get_option('donation_form_display', 'separate_page')) {
wp_register_script('lean-modal', charitable()->get_path('assets', false) . 'js/libraries/jquery.leanModal.js', array('jquery'), charitable()->get_version());
wp_register_style('lean-modal-css', charitable()->get_path('assets', false) . 'css/modal.css', array(), charitable()->get_version());
}
}
示例4: charitable_get_option
/**
* This returns the value for a particular Charitable setting.
*
* @param mixed $key Accepts an array of strings or a single string.
* @param mixed $default The value to return if key is not set.
* @param array $settings Optional. Used when $key is an array.
* @return mixed
* @since 1.0.0
*/
function charitable_get_option($key, $default = false, $settings = array())
{
if (empty($settings)) {
$settings = get_option('charitable_settings');
}
if (is_array($key)) {
$current_key = current($key);
/* Key does not exist */
if (!isset($settings[$current_key])) {
return $default;
} else {
array_shift($key);
if (empty($key)) {
return $settings[$current_key];
} else {
return charitable_get_option($key, $default, $settings[$current_key]);
}
}
} else {
return isset($settings[$key]) ? $settings[$key] : $default;
}
}
示例5: charitable_get_option
<?php
/**
* Display a series of checkboxes.
*
* @author Studio 164a
* @package Charitable/Admin View/Settings
* @since 1.0.0
*/
$value = charitable_get_option($view_args['key'], array());
if (empty($value)) {
$value = isset($view_args['default']) ? (array) $view_args['default'] : array();
}
if (!is_array($value)) {
$value = (array) $value;
}
?>
<ul class="charitable-checkbox-list <?php
echo esc_attr($view_args['classes']);
?>
">
<?php
foreach ($view_args['options'] as $option => $label) {
?>
<li><input type="checkbox"
id="<?php
printf('charitable_settings_%s_%s', implode('_', $view_args['key']), $option);
?>
"
示例6: maybe_enqueue_donation_form_scripts
/**
* Conditionally load the donation form scripts if we're viewing the donation form.
*
* @return boolean True if scripts were loaded. False otherwise.
* @access public
* @since 1.4.0
*/
public function maybe_enqueue_donation_form_scripts()
{
$load = charitable_is_page('campaign_donation_page');
if (!$load) {
$load = 'charitable_campaign_loop_before' == current_action() && 'modal' == charitable_get_option('donation_form_display', 'separate_page');
}
if ($load) {
$this->enqueue_donation_form_scripts();
}
return $load;
}
示例7: maybe_redirect_to_charitable_login
/**
* Redirect the user to the Charitable login page.
*
* @return void
* @access public
* @since 1.4.0
*/
public function maybe_redirect_to_charitable_login()
{
if (!apply_filters('charitable_disable_wp_login', false)) {
return;
}
if ('wp' == charitable_get_option('login_page', 'wp')) {
return;
}
/* Don't prevent logging out. */
if ($_SERVER['REQUEST_METHOD'] != 'GET') {
return;
}
wp_safe_redirect(esc_url_raw(charitable_get_permalink('login_page')));
exit;
}
示例8: get_enabled_emails
/**
* Returns the currently enabled emails.
*
* @return string[]
* @access public
* @since 1.0.0
*/
public function get_enabled_emails()
{
return charitable_get_option('enabled_emails', array());
}
示例9: test_charitable_get_option
function test_charitable_get_option()
{
$this->assertFalse(charitable_get_option('nonexistentkey'));
}
示例10: get_redirect_url
/**
* Return the base of the PayPal
*
* @param bool $ssl_check
* @return string
* @access public
* @since 1.0.0
*/
public function get_redirect_url($ssl_check = false)
{
$protocol = is_ssl() || !$ssl_check ? 'https://' : 'http://';
if (charitable_get_option('test_mode')) {
$paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr';
} else {
$paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr';
}
return apply_filters('charitable_paypal_uri', $paypal_uri);
}
示例11: get_value
/**
* Return the value for a particular gateway setting.
*
* @param string $setting
* @return mixed
* @access public
* @since 1.0.0
*/
public function get_value($setting)
{
$default = isset($this->defaults[$setting]) ? $this->defaults[$setting] : '';
return charitable_get_option($setting, $default, $this->get_settings());
}
示例12: get_licenses
/**
* Return the list of licenses.
*
* Note: The licenses are not necessarily valid. If a user enters an invalid
* license, the license will be stored but it will be flagged as invalid.
*
* @return array[]
* @access public
* @since 1.0.0
*/
public function get_licenses()
{
if (!isset($this->licenses)) {
$this->licenses = charitable_get_option('licenses', array());
}
return $this->licenses;
}
示例13: get_reset_password_template
/**
* Load the reset password template.
*
* @param string $template
* @return string
* @access protected
* @since 1.4.0
*/
protected function get_reset_password_template($template)
{
if ('wp' == charitable_get_option('login_page', 'wp')) {
return $template;
}
new Charitable_Ghost_Page('reset-password-page', array('title' => __('Reset Password', 'charitable'), 'content' => '<!-- Silence is golden -->'));
$new_template = apply_filters('charitable_reset_password_page_template', array('reset-password-page.php', 'page.php', 'index.php'));
return charitable_get_template_path($new_template, $template);
}
示例14: charitable_get_option
/**
* Renders the custom styles added by Charitable.
*
* Override this template by copying it to yourtheme/charitable/custom-styles.css.php
*
* @author Studio 164a
* @package Charitable/Templates/Donation Receipt
* @since 1.0.0
* @version 1.0.0
*/
if (!defined('ABSPATH')) {
exit;
}
// Exit if accessed directly
$highlight_colour = charitable_get_option('highlight_colour', apply_filters('charitable_default_highlight_colour', '#f89d35'));
?>
<style id="charitable-highlight-colour-styles">
.campaign-raised .amount,
.campaign-figures .amount,
.donors-count,
.time-left,
.charitable-form-field a:not(.button),
.charitable-form-fields .charitable-fieldset a:not(.button),
.charitable-notice,
.charitable-notice .errors a {
color: <?php
echo $highlight_colour;
?>
;
}
示例15: save_donation_meta
/**
* Save the meta for the donation.
*
* @param int $donation_id
* @return void
* @access public
* @since 1.0.0
*/
public function save_donation_meta($donation_id)
{
$meta = array('donation_gateway' => $this->get_donation_data_value('gateway'), 'donor' => $this->get_donation_data_value('user'), 'test_mode' => charitable_get_option('test_mode', 0), 'donation_key' => $this->get_donation_data_value('donation_key'));
if ($this->get_donation_data_value('meta')) {
$meta = array_merge($meta, $this->get_donation_data_value('meta'));
}
$meta = apply_filters('charitable_donation_meta', $meta, $donation_id, $this);
foreach ($meta as $meta_key => $value) {
$value = apply_filters('charitable_sanitize_donation_meta', $value, $meta_key);
update_post_meta($donation_id, $meta_key, $value);
}
}