/** * Render the widget. * * @param array $args General widget arguments. * @param array $instance Specific instance arguments. * @uses WebcomicTag::get_webcomic_collection() * @uses WebcomicTag::relative_webcomic_link() */ public function widget($args, $instance) { extract($args); extract($instance); if (!empty($image) and $image = wp_get_attachment_image($image, 'full')) { $link = preg_replace('/alt=".+?"/', 'alt="' . esc_attr($link) . '"', $image); } if ($output = WebcomicTag::webcomic_transcripts_link('%link', $none, $some, $off, $language)) { echo $before_widget, empty($title) ? '' : $before_title . $title . $after_title, $output, $after_widget; } }
/** * Render a webcomic transcripts link. * * <code class="php"> * // render a transcripts link * webcomic_transcripts_link(); * * // render a transcripts link for the language with a slug of 'en' * webcomic_transcripts_link( '%link', '', '', '', 'en' ); * * // render a transcript lik for webcomic 42 with custom link text * webcomic_transcripts_link( '%link', 'Transcribe Me!', 'Read Transcripts', 'Transcription Disabled', false, 42 ); * </code> * * <code class="bbcode"> * // render a transcripts link * [webcomic_transcripts_link]; * * // render a transcripts link for the language with a slug of 'en' * [webcomic_transcripts_link language="en"] * * // render a transcript lik for webcomic 42 with custom link text * [webcomic_transcripts_link none="Transcribe Me!" some="Read Transcripts" off="Transcription Disabled" the_post="42"] * </code> * * @package Webcomic * @param string $format Format string for the link. Should include the %link token, which will be replaced by the actual link. * @param string $none Format string for the link text when no transcripts have been published. Accepts %title and image size tokens. * @param string $some Format string for the link text when one or more transcripts have been published. Accepts %title and image size tokens. * @param string $off Format string for the link text when transcription has been disabled. Accepts %title and image size tokens. * @param mixed $language The term object or ID that transcripts should be limited to. * @param mixed $the_post The post object or ID to get a transcript link to. * @uses WebcomicTag::webcomic_transcripts_link() */ function webcomic_transcripts_link($format = '%link', $none = '', $some = '', $off = '', $language = false, $the_post = false) { echo WebcomicTag::webcomic_transcripts_link($format, $none, $some, $off, $language, $the_post); }
/** * Handle webcomic_transcripts_link shortcode. * * @param array $atts Shortcode attributes. * @return string * @uses WebcomicTag::webcomic_transcripts_link() */ public function webcomic_transcripts_link($atts) { extract(shortcode_atts(array('format' => '%link', 'none' => '', 'some' => '', 'off' => '', 'language' => false, 'the_post' => false), $atts)); return WebcomicTag::webcomic_transcripts_link($format, $none, $some, $off, $language, $the_post); }