Pastoid

The page you are looking at now is at this URL: http://pastoid.com/ay8

This paste was last updated on June 1, 2009 at 9:52 pm.

Pasted Coderaw

	/**
	* Actions to be carried out when the site is accessed
	* and the plugin is active.
	*/
	public function action_init()
	{
		$this->load_text_domain( 'podcast' );
		$this->add_template( 'podcast.multiple', dirname( __FILE__ ) . '/templates/rawphp/podcast.multiple.php' );
		$this->add_template( 'podcast.single', dirname( __FILE__ ) . '/templates/rawphp/podcast.single.php' );
		$this->add_template( 'podcast.multiple', dirname( __FILE__ ) . '/templates/hi/podcast.multiple.php' );
		$this->add_template( 'podcast.single', dirname( __FILE__ ) . '/templates/hi/podcast.single.php' );
 
		// Add a rewrite rule to get the actual location. Makes download stats possible
		// The url in the embedded player, the link under the player, and in the feed is set
		// to this format.
		$this->add_rule("'podcast'/podcast_name/post_name/method/filename", 'podcast_media');
	}
 
 
	/**
	 * Redirects the link from an embedded player, feed, or an html
	 * download link to the actual file
	 *
	 * @param PluginHandler $handler. Primarily used to get the handler vars
	 * @return Nothing.
	 * @TODO make sure $podcast actually holds a valid feed
	 * @TODO make reliable. currently only partially works locally,
	 */
	public function action_plugin_act_podcast_media( $handler )
	{
		$podcast = $handler->handler_vars['podcast_name'];
		$post = Post::get( array( 'slug' => $handler->handler_vars['post_name'] ) );
		$method = $handler->handler_vars['method'];
		$filename = $handler->handler_vars['filename'];
 
		$info = $post->info->{$podcast};
		if( !empty( $info ) && isset( $info['enclosure'] ) ) {
			$url = $info['enclosure'];
 
			// allow plugins to act. mostly good for stats
			Plugins::act( 'podcast_redirect', $podcast, $post, $method, $filename );
 
			$mimetype = Utils::mimetype( $url );
			header( 'Cache-Control: no-cache, must-revalidate' ); // HTTP/1.1
			header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
			header( 'Pragma:no-cache'); // HTTP/1.0
			header( 'Content-type: ' . $mimetype );
			header('Content-Length: '. $info['size'] );
 
			Utils::redirect( $url );
		}
 
	}
 

Toggle wordwrap

Referring DomainHits
Unknown Referer 127
pastoid.com 3
search.live.com 1
Is this paste spam?
<Hide