示例#1
0
 /**
  * Render the widget.
  * 
  * @param array $args General widget arguments.
  * @param array $instance Specific instance arguments.
  * @uses WebcomicTag::webcomic_donation_form()
  */
 public function widget($args, $instance)
 {
     extract($args);
     extract($instance);
     if (!empty($image) and $image = wp_get_attachment_image($image, 'full')) {
         $label = preg_replace('/alt=".+?"/', 'alt="' . esc_attr($label) . '"', $image);
     }
     if ($output = WebcomicTag::webcomic_donation_form($label, $collection)) {
         echo $before_widget, empty($title) ? '' : $before_title . $title . $after_title, $output, $after_widget;
     }
 }
示例#2
0
文件: tags.php 项目: ecerta/webcomic
 /**
  * Render a donation form.
  * 
  * <code class="php">
  * // render a donation form for the current collection
  * webcomic_donation_form();
  * 
  * // render a donation form for collection 42 with a custom label
  * webcomic_donation_form( 'Support This Webcomic', 'webcomic42' );
  * </code>
  * 
  * <code class="bbcode">
  * // render a donation form for the current collection
  * [webcomic_donation_form]
  * 
  * // render a donation form for collection 42 with a custom label
  * [webcomic_donation_form collection="webcomic42"]Support This Webcomic[/webcomic_donation_form]
  * </code>
  * 
  * @package Webcomic
  * @param string $label The form submit button label.
  * @param string $collection The collection to render a donation form for.
  * @uses WebcomicTag::webcomic_donation_form()
  */
 function webcomic_donation_form($label = '', $collection = '')
 {
     echo WebcomicTag::webcomic_donation_form($label, $collection);
 }
示例#3
0
 /**
  * Handle webcomic_donation_form shortcode.
  * 
  * @param array $atts Shortcode attributes.
  * @return string
  * @uses WebcomicTag::webcomic_donation_form()
  */
 public function webcomic_donation_form($atts)
 {
     extract(shortcode_atts(array('label' => '', 'collection' => ''), $atts));
     $label = $content ? do_shortcode($content) : $label;
     return WebcomicTag::webcomic_donation_form($label, $collection);
 }