Pastoid

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

This paste was last updated on May 21, 2010 at 8:24 am.

Pasted Coderaw

	public function post_status( $tweet, $name, $pw )
	{
		$request = new RemoteRequest( 'http://twitter.com/statuses/update.xml', 'POST' );
		$request->add_header( array( 'Authorization' => 'Basic ' . base64_encode( "{$name}:{$pw}" ) ) );
		$request->set_body( 'source=habari&status=' . urlencode( $tweet ) );
		$request->execute();
	}
 
	/**
	 * React to the update of a post status to 'published'
	 * @param Post $post The post object with the status change
	 **/
	public function action_post_status_published( $post )
	{
		if ( $post->content_type == Post::type('entry') && Options::get( 'twitter__post_status' ) == '1' ) {
			$user = User::get_by_id( $post->user_id );
			if ( ! empty( $user->info->twitter_name ) && ! empty( $user->info->twitter_pass ) ) {
				$name = $user->info->twitter_name;
				$pw = $user->info->twitter_pass;
			} else {
				$name = Options::get( 'twitter__username' );
				$pw = Options::get( 'twitter__password' );
			}
			$this->post_status( Options::get( 'twitter__prepend' ) . $post->title . ' ' . $post->permalink, $name, $pw );
		}
		return $post;
	}
 
/*	public function action_post_insert_after( $post )
	{
		return $this->action_post_update_status( $post, -1, $post->status );
	}
*/
	/**
	 * Add last Twitter status, time, and image to the available template vars
	 * @param Theme $theme The theme that will display the template
	 **/
	public function theme_twitter( $theme )
	{

Toggle wordwrap

Referring DomainHits
Unknown Referer 127
pastoid.com 10
www.znatok.biz 1
Is this paste spam?
<Hide