本文整理汇总了PHP中charitable_template函数的典型用法代码示例。如果您正苦于以下问题:PHP charitable_template函数的具体用法?PHP charitable_template怎么用?PHP charitable_template使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了charitable_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: charitable_plupload_image_upload
/**
* Upload an image via plupload.
*
* @return
*/
function charitable_plupload_image_upload()
{
$post_id = (int) filter_input(INPUT_POST, 'post_id', FILTER_SANITIZE_NUMBER_INT);
$field_id = (string) filter_input(INPUT_POST, 'field_id');
check_ajax_referer('charitable-upload-images-' . $field_id);
$file = $_FILES['async-upload'];
$file_attr = wp_handle_upload($file, array('test_form' => false));
if (isset($file_attr['error'])) {
wp_send_json_error($file_attr);
}
$attachment = array('guid' => $file_attr['url'], 'post_mime_type' => $file_attr['type'], 'post_title' => preg_replace('/\\.[^.]+$/', '', basename($file['name'])), 'post_content' => '', 'post_status' => 'inherit');
/**
* Insert the file as an attachment.
*/
$attachment_id = wp_insert_attachment($attachment, $file_attr['file'], $post_id);
if (is_wp_error($attachment_id)) {
wp_send_json_error();
}
wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file_attr['file']));
$size = (string) filter_input(INPUT_POST, 'size');
$max_uploads = (int) filter_input(INPUT_POST, 'max_uploads', FILTER_SANITIZE_NUMBER_INT);
if (!$size) {
$size = 'thumbnail';
}
ob_start();
charitable_template('form-fields/picture-preview.php', array('image' => $attachment_id, 'field' => array('key' => $field_id, 'size' => $size, 'max_uploads' => $max_uploads)));
wp_send_json_success(ob_get_clean());
}
示例2: widget
/**
* Displays the widget on the frontend.
*
* @param array $args
* @param array $instance
* @return void
* @access public
* @since 1.0.0
*/
public function widget($args, $instance)
{
if (!array_key_exists('campaign_id', $instance) || '' == $instance['campaign_id']) {
return;
}
charitable_template('widgets/donate.php', array_merge($args, $instance));
}
示例3: display
/**
* The callback method for the campaigns shortcode.
*
* This receives the user-defined attributes and passes the logic off to the class.
*
* @param array $atts User-defined shortcode attributes.
* @return string
* @access public
* @static
* @since 1.0.0
*/
public static function display($atts = array())
{
$defaults = array('logged_in_message' => __('You are already logged in!', 'charitable'), 'redirect' => esc_url(charitable_get_login_redirect_url()), 'registration_link_text' => __('Register', 'charitable'));
$args = shortcode_atts($defaults, $atts, 'charitable_login');
$args['login_form_args'] = self::get_login_form_args($args);
if (is_user_logged_in()) {
ob_start();
charitable_template('shortcodes/logged-in.php', $args);
return ob_get_clean();
}
if (false == $args['registration_link_text'] || 'false' == $args['registration_link_text']) {
$args['registration_link'] = false;
} else {
$registration_link = charitable_get_permalink('registration_page');
if (charitable_get_permalink('login_page') === $registration_link) {
$args['registration_link'] = false;
} else {
if (isset($_GET['redirect_to'])) {
$registration_link = add_query_arg('redirect_to', $_GET['redirect_to'], $registration_link);
}
$args['registration_link'] = $registration_link;
}
}
ob_start();
charitable_template('shortcodes/login.php', $args);
return apply_filters('charitable_login_shortcode', ob_get_clean());
}
示例4: widget
/**
* Display the widget contents on the front-end.
*
* @param array $args
* @param array $instance
* @return void
* @access public
* @since 1.0.0
*/
public function widget($args, $instance)
{
$instance = $this->get_parsed_args($instance);
$view_args = array_merge($args, $instance);
$view_args['donors'] = $this->get_widget_donors($instance);
charitable_template('widgets/donors.php', $view_args);
}
示例5: widget
/**
* Displays the widget on the frontend.
*
* @param array $args
* @param array $instance
* @return void
* @access public
* @since 1.0.0
*/
public function widget($args, $instance)
{
if (!isset($instance['campaign_id']) || $instance['campaign_id'] == '') {
return;
}
charitable_template('widgets/donate.php', array_merge($args, $instance));
}
示例6: display
/**
* The callback method for the campaigns shortcode.
*
* This receives the user-defined attributes and passes the logic off to the class.
*
* @param array $atts User-defined shortcode attributes.
* @return string
* @access public
* @static
* @since 1.0.0
*/
public static function display($atts)
{
$args = shortcode_atts($default, $atts, 'donations');
$view_args = array('donations' => self::get_donations($args));
ob_start();
charitable_template('shortcodes/my-donations.php', $view_args);
return apply_filters('charitable_my_donations_shortcode', ob_get_clean(), $args);
}
示例7: widget
/**
* Display the widget contents on the front-end.
*
* @param array $args
* @param array $instance
* @access public
* @since 1.0.0
*/
public function widget($args, $instance)
{
$view_args = array_merge($args, $instance);
if (!isset($view_args['title'])) {
$view_args['title'] = __('Donation Statistics', 'charitable');
}
charitable_template('widgets/donation-stats.php', $view_args);
}
示例8: display
/**
* The callback method for the campaigns shortcode.
*
* This receives the user-defined attributes and passes the logic off to the class.
*
* @param array $atts User-defined shortcode attributes.
* @return string
* @access public
* @static
* @since 1.0.0
*/
public static function display($atts)
{
if (!is_user_logged_in()) {
return Charitable_Login_Shortcode::display($atts);
}
$args = shortcode_atts(array(), $atts, 'charitable_profile');
ob_start();
charitable_template('shortcodes/profile.php', array('form' => new Charitable_Profile_Form($args)));
return apply_filters('charitable_profile_shortcode', ob_get_clean());
}
示例9: charitable_template_campaign_summary
/**
* Hide the campaign summary stats from a specific campaign, using the campaign ID.
*
* @param Charitable_Campaign $campaign
*/
function charitable_template_campaign_summary($campaign)
{
$campaign_id = 325;
// Replace with the ID of your campaign.
if ($campaign_id == $campaign->ID) {
// If you still want to show a Donate button, uncomment the line below.
// charitable_template_donate_button( $campaign );
return;
}
charitable_template('campaign/summary.php', array('campaign' => $campaign));
}
示例10: display
/**
* The callback method for the campaigns shortcode.
*
* This receives the user-defined attributes and passes the logic off to the class.
*
* @param array $atts User-defined shortcode attributes.
* @return string
* @access public
* @static
* @since 1.0.0
*/
public static function display($atts = array())
{
$defaults = array('logged_in_message' => __('You are already logged in!', 'charitable'), 'redirect' => false, 'login_link_text' => __('Signed up already? Login instead.', 'charitable'));
$args = shortcode_atts($defaults, $atts, 'charitable_registration');
ob_start();
if (is_user_logged_in()) {
charitable_template('shortcodes/logged-in.php', $args);
return ob_get_clean();
}
charitable_template('shortcodes/registration.php', array('form' => new Charitable_Registration_Form($args)));
return apply_filters('charitable_registration_shortcode', ob_get_clean());
}
示例11: display
/**
* The callback method for the campaigns shortcode.
*
* This receives the user-defined attributes and passes the logic off to the class.
*
* @param array $atts User-defined shortcode attributes.
* @return string
* @access public
* @static
* @since 1.0.0
*/
public static function display($atts)
{
global $wp;
$defaults = array('logged_in_message' => __('You are already logged in!', 'charitable'));
$args = shortcode_atts($defaults, $atts, 'charitable_login');
ob_start();
if (is_user_logged_in()) {
charitable_template('shortcodes/logged-in.php', $args);
return ob_get_clean();
}
$args['login_form_args'] = self::get_login_form_args($args);
charitable_template('shortcodes/login.php', $args);
return apply_filters('charitable_login_shortcode', ob_get_clean());
}
示例12: display
/**
* The callback method for the campaigns shortcode.
*
* This receives the user-defined attributes and passes the logic off to the class.
*
* @param array $atts User-defined shortcode attributes.
* @return string
* @access public
* @static
* @since 1.4.0
*/
public static function display($atts)
{
$defaults = array();
$args = shortcode_atts($defaults, $atts, 'charitable_my_donations');
ob_start();
/* If the user is logged out, redirect to login/registration page. */
if (!is_user_logged_in()) {
echo Charitable_Login_Shortcode::display(array('redirect' => charitable_get_current_url()));
return;
}
$user = charitable_get_user(get_current_user_id());
$view_args = array('donations' => new Charitable_Donations_Query(array('output' => 'posts', 'donor_id' => $user->get_donor_id(), 'orderby' => 'date', 'order' => 'DESC', 'number' => -1)));
charitable_template('shortcodes/my-donations.php', $view_args);
return apply_filters('charitable_my_donations_shortcode', ob_get_clean(), $args);
}
示例13: charitable_template_notices
/**
* Render any notices.
*
* @param array $notices
* @return void
* @since 1.4.0
*/
function charitable_template_notices($notices = array())
{
if (empty($notices)) {
$notices = charitable_get_notices()->get_notices();
}
charitable_template('form-fields/notices.php', array('notices' => $notices));
}
示例14: donate_button_loop_template
/**
* Renders the donate button template.
*
* @return void
* @access public
* @since 1.2.3
*/
public function donate_button_loop_template()
{
if ($this->has_ended()) {
return;
}
$display_option = charitable_get_option('donation_form_display', 'separate_page');
switch ($display_option) {
case 'modal':
$template_name = 'campaign-loop/donate-modal.php';
break;
default:
$template_name = apply_filters('charitable_donate_button_loop_template', 'campaign-loop/donate-link.php', $this);
}
charitable_template($template_name, array('campaign' => $this));
}
示例15: widget
/**
* Display the widget contents on the front-end.
*
* @param array $args
* @param array $instance
* @access public
* @since 1.0.0
*/
public function widget($args, $instance)
{
$view_args = array_merge($args, $instance);
charitable_template('widgets/campaign-terms.php', $view_args);
}