Index: wp-includes/default-filters.php
===================================================================
--- wp-includes/default-filters.php	(revision 11685)
+++ wp-includes/default-filters.php	(working copy)
@@ -194,6 +194,7 @@
 add_action('admin_print_styles', 'print_admin_styles', 20);
 add_action('init', 'smilies_init', 5);
 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 );
+add_action( 'plugins_loaded', 'wp_maybe_load_shortcodes', 0 );
 add_action( 'shutdown', 'wp_ob_end_flush_all', 1);
 add_action( 'pre_post_update', 'wp_save_post_revision' );
 add_action('publish_post', '_publish_post_hook', 5, 1);
Index: wp-includes/default-shortcodes.php
===================================================================
--- wp-includes/default-shortcodes.php	(revision 0)
+++ wp-includes/default-shortcodes.php	(revision 0)
@@ -0,0 +1,312 @@
+<?php
+
+/*
+ * Archives shortcode
+ * @author bubel & mtdewvirus
+ */
+
+function archives_shortcode($attr) {
+	global $allowedposttags;
+	extract(shortcode_atts(array(
+		'type' => 'postbypost',
+		'limit' => '',
+		'format' => 'html',
+		'show_post_count' => false,
+		'before' => '',
+		'after' => '',
+		), $attr));
+
+	if ( !in_array($type, array('yearly', 'monthly', 'daily', 'weekly', 'postbypost')) )
+		$type = 'postbypost';
+
+        if ( !in_array($format, array('html', 'option', 'custom')) )
+                $format =  'html';
+
+        if ( '' != $limit )
+                $limit = (int)$limit;
+
+        $show_post_count = (bool)$show_post_count;
+        $before = wp_kses($before, $allowedposttags);
+        $after = wp_kses($after, $allowedposttags);
+
+        // Get the archives
+        $archives = wp_get_archives('type=' . $type . '&limit=' . $limit . '&format=' . $format . '&echo=0&show_post_count=' . $show_post_count . '');
+
+        // Check to see if there are any archives
+        if ( empty($archives) )
+                $archives = '<p>' . __('Your blog does not currently have any published posts.') . '</p>';
+	elseif ( 'option' == $format )
+		$archives = "<select name='archive-dropdown' onchange='document.location.href=this.options[this.selectedIndex].value;'><option value='" . get_permalink() . "'>--</option>" . $archives . "</select>";
+
+        return $archives;
+}
+
+/* Flickr Short Code
+Author: kellan
+License: BSD/GPL/public domain (take your pick)
+
+[flickr video=http://flickr.com/photos/revdancatt/2345938910/]
+[flickr video=2345938910]
+[flickr video=2345938910 show_info=true w=400 h=300]
+[flickr video=2345938910 show_info=true w=400 h=300 secret=846d9c1be9]
+
+and eventually
+
+[flickr photo=107274692]
+[flickr photo=107274692 size=m] 
+*/
+
+function flickr_shortcode_handler($atts) {
+	$atts = shortcode_atts(array(
+		'video' => 0,
+		'photo' => 0,
+		'show_info' => 0,
+		'w' => 400,
+		'h' => 300,
+		'secret' => 0,
+		'size' => 0
+	), $atts);
+
+	if ($atts['video']) {
+		$showing = 'video';
+		$src = $atts['video'];	
+	}
+	elseif ($atts['photo']) {
+		$showing = 'photo';
+		$src = $atts['photo'];
+	}
+	else {
+		return '';
+	}
+
+	if (preg_match("!photos/(([0-9a-zA-Z-_]+)|([0-9]+@N[0-9]+))/([0-9]+)/?$!", $src, $m)) {
+		$atts['photo_id'] = $m[4];
+	}
+	else {
+		$atts['photo_id'] = $atts['video'];
+	}
+
+	if ($showing == 'video') {
+		if (!$atts['show_info'] or in_array($atts['show_info'], array('yes', 'true'))) {
+			$atts['show_info'] = 'true';
+		}
+		elseif (in_array($atts['show_info'], array('false', 'no'))) {
+			$atts['show_info'] = 'false';
+		}
+
+		return flickr_shortcode_video_markup($atts);
+	}
+	else {
+		return '';
+	}
+}
+
+function flickr_shortcode_video_markup($atts) {
+	$photo_vars = "photo_id=$atts[photo_id]";	
+	if ($atts['secret']) {
+		$photo_vars .= "&amp;photo_secret=$atts[secret]";
+	}
+
+	$markup = <<<EOD
+<object type="application/x-shockwave-flash" width="$atts[w]" height="$atts[h]" data="http://www.flickr.com/apps/video/stewart.swf?v=1.161"
+classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> <param name="flashvars" value="$photo_vars&amp;flickr_show_info_box=$atts[show_info]"></param>
+<param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=1.161"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=1.161" bgcolor="#000000" allowfullscreen="true"
+flashvars="$photo_vars&amp;flickr_show_info_box=$atts[show_info]" height="$atts[h]" width="$atts[w]"></embed></object>
+EOD;
+	return $markup;
+}
+
+/*
+ polldaddy.com
+ [polldaddy poll="139742"]
+ */
+
+function polldaddy_shortcode_handler_set_data() {
+	$resource = wp_remote_get( 'http://polldaddy.com/xml/keywords.xml' );
+	$body = wp_remote_retrieve_body( $resource );
+	$keywords_xml = simplexml_load_string ( $body );
+	$keywords = array();
+	$keywords['generated'] = time();
+								
+	foreach ( $keywords_xml->keyword as $keyword_xml ){
+		$keywords[] = array( 'keyword' => (string) $keyword_xml, 'url' => (string) $keyword_xml['url'] );
+	}
+	wp_cache_set( 'pd-keywords', $keywords, 'site-options', 864000 );
+				
+	return $keywords;
+}
+
+function polldaddy_add_rating_js() {
+	wp_print_scripts( 'polldaddy-rating-js' );
+}
+
+function polldaddy_shortcode_handler( $atts, $content = null ) {
+	global $post;
+
+	extract( shortcode_atts( array(	'poll' => 'empty', 'rating' => 'empty', 'unique_id' => null, 'title' => null, 'permalink' => null, ), $atts ) );
+	$poll = (int) $poll;
+	$rating = (int) $rating;
+
+	if ( $rating > 0 ) 	{
+		if ( $unique_id != null ) {
+			$unique_id = wp_specialchars( $unique_id );
+		} else {
+			if ( is_page() ) {
+				$unique_id = 'wp-page-' . $post->ID;
+			}
+			else {
+				$unique_id = 'wp-post-' . $post->ID;
+			}
+		}
+
+		if ( $title != null ) {
+			$title = wp_specialchars( $title );
+		} else {
+			$title = urlencode( $post->post_title );
+		}
+		
+		if ( $permalink != null  ) {
+			$permalink = clean_url( $permalink );
+		} else {
+			$permalink = urlencode( get_permalink( $post->ID ) );
+		}
+		
+		wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
+		add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
+		
+		return '<div id="pd_rating_holder_' . $rating . '"></div>
+<script language="javascript">
+	PDRTJS_settings_' . $rating . ' = {
+		"id" : "' . $rating . '",
+		"unique_id" : "' . $unique_id . '",
+		"title" : "' . $title . '",
+		"permalink" : "' . $permalink . '"
+	};
+</script>';
+	} else if ( $poll > 0 ) {
+		$keywords = wp_cache_get( 'pd-keywords', 'site-options' );
+		if ( !$keywords || $keywords['generated'] <= ( time() - 300 ) ) {
+		
+			if ( !wp_cache_get( 'pd-keywords-fetching', 'site-options' ) ) {
+				wp_cache_set( 'pd-keywords-fetching', 1, 'site-options', 30 );
+				$keywords = polldaddy_shortcode_handler_set_data();
+			}
+		}
+
+		if ( !$keywords ) {
+			$keywords = array();
+		}
+	
+		$mod = ( $poll % ( count( $keywords ) - 1 ) );
+
+		return '<script type="text/javascript" language="javascript" charset="utf-8" src="http://static.polldaddy.com/p/' . $poll . '.js"></script>
+		<noscript>
+		<a href="http://answers.polldaddy.com/poll/' . $poll . '/">View This Poll</a><br/><span style="font-size:10px;"><a href="' . $keywords[ $mod ][ 'url' ] . '">' . $keywords[ $mod ][ 'keyword' ] . '</a></span>
+		</noscript>';
+	}
+}
+
+/*
+ * url can be:  
+ *    http://www.youtube.com/watch?v=H2Ncxw1xfck 
+ * or http://www.youtube.com/watch?v=H2Ncxw1xfck&w=320&h=240&fmt=1&rel=0&showsearch=1&hd=0
+ */
+
+function youtube_shortcode_handler( $atts, $content = null ) {
+	if ( !empty($atts) && !isset($atts['url']) && isset($atts[0]) )
+		$atts['url'] = $atts[0];
+
+	$atts = shortcode_atts( array('url' => ''), $atts );
+
+	if ( ! $atts['url'] )
+		return '';
+
+	return youtube_id($atts['url']);
+}
+
+function youtube_id( $url ) {
+	$url = trim( $url, ' "' );
+	$url = trim( $url );
+	$url = str_replace( '/v/', '/?v=', $url ); // new format - http://www.youtube.com/v/jF-kELmmvgA
+	$url = str_replace( '&amp;', '&', $url );
+	$url = parse_url($url);
+
+	if ( !isset($url['query']) )
+		return '<!--YouTube Error: bad URL entered-->';
+
+	parse_str($url['query'], $qargs);
+
+	if ( !isset($qargs['v']) )
+		return '<!--YouTube Error: bad URL entered-->';
+
+	$id = preg_replace('|[^_a-z0-9-]|i', '', $qargs['v']);
+
+	if ( is_feed() )
+		return '<span style="text-align:center; display: block;"><a href="' . get_permalink() . '"><img src="http://img.youtube.com/vi/' . $id . '/2.jpg" alt="" /></a></span>';
+
+	// calculate the width and height, taken content_width into consideration
+	global $content_width;
+
+	$input_w = (isset($qargs['w']) && intval($qargs['w'])) ? intval($qargs['w']) : 0; 
+	$input_h = (isset($qargs['h']) && intval($qargs['h'])) ? intval($qargs['h']) : 0; 
+
+	if ( $input_w > 0 && $input_h > 0 ){
+		$w = $input_w; 
+		$h = $input_h; 
+	} else if ( $input_w == 0 && $input_h == 0 ){
+
+		if ( isset($qargs['fmt']) && intval($qargs['fmt']) ) 
+			$w = ( !empty($content_width) ? min( $content_width, 480) : 480 );
+		else 
+			$w = ( !empty($content_width) ? min( $content_width, 425) : 425 );
+
+		$h = ceil($w * 14 / 17);
+
+	} else if ( $input_w > 0 ) {
+
+		$w = $input_w;
+		$h = ceil($w * 14 / 17);
+
+	} else { //input_h > 0
+
+		if ( isset($qargs['fmt']) && intval($qargs['fmt']) ) 
+			$w = ( !empty($content_width) ? min( $content_width, 480) : 480 );
+		else 
+			$w = ( !empty($content_width) ? min( $content_width, 425) : 425 );
+
+		$h = $input_h; 
+	}
+
+	$fmt = '';
+	if ( isset($qargs['fmt']) && intval($qargs['fmt']) )
+		$fmt = "&fmt={$qargs['fmt']}";
+
+	if ( isset($qargs['rel']) && 0 == $qargs['rel']) {
+		$rel = 0;
+	} else {
+		$rel = 1;
+	}
+
+	if ( isset($qargs['showsearch']) && 1 == $qargs['showsearch']) {
+		$search = 1;
+	} else {
+		$search = 0;
+	}
+
+	if ( isset($qargs['hd']) && 1 == $qargs['hd']) {
+		$hd = 1;
+	} else {
+		$hd = 0;
+	}
+
+	$video = "<span style='text-align:center; display: block;'><object width='$w' height='$h'><param name='movie' value='http://www.youtube.com/v/$id&rel=$rel&fs=1$fmt&showsearch=$search&hd=$hd' /> <param name='allowfullscreen' value='true' /> <param name='wmode' value='transparent' /> <embed src='http://www.youtube.com/v/$id&rel=$rel&fs=1$fmt&showsearch=$search&hd=$hd' type='application/x-shockwave-flash' allowfullscreen='true' width='$w' height='$h' wmode='transparent'></embed> </object></span>";
+
+	return $video;
+}
+
+function default_shortcode_init() {
+	add_shortcode('archives', 'archives_shortcode');
+	add_shortcode('flickr', 'flickr_shortcode_handler');
+	add_shortcode('polldaddy', 'polldaddy_shortcode_handler');
+	add_shortcode('youtube', 'youtube_shortcode_handler');
+}
\ No newline at end of file

Property changes on: wp-includes/default-shortcodes.php
___________________________________________________________________
Name: svn:eol-style
   + native

Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 11685)
+++ wp-includes/functions.php	(working copy)
@@ -2755,6 +2755,19 @@
 }
 
 /**
+ * Determines if default shortcodes should be loaded.
+ *
+ * @since 2.9.0
+ * @uses add_action()
+ */
+function wp_maybe_load_shortcodes() {
+	if ( ! apply_filters('load_default_shortcodes', true) )
+		return;
+	require_once( ABSPATH . WPINC . '/default-shortcodes.php' );
+	add_action('init', 'default_shortcode_init');
+}
+
+/**
  * Flush all output buffers for PHP 5.2.
  *
  * Make sure all output buffers are flushed before our singletons our destroyed.
