diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-07-03 17:00:59 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-07-03 17:00:59 +0000 |
commit | 2b6348978ec434e2fa4114085783cf9ada097b22 (patch) | |
tree | a3745bb9ace00b0a8f687bc8c1bfb74bb885077c /wp-includes | |
parent | 102dc1d903d95fd7abdf2243d7e047b4b20099d3 (diff) | |
download | wordpress-mu-2b6348978ec434e2fa4114085783cf9ada097b22.tar.gz wordpress-mu-2b6348978ec434e2fa4114085783cf9ada097b22.tar.xz wordpress-mu-2b6348978ec434e2fa4114085783cf9ada097b22.zip |
WP Merge to rev 8249
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1347 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r-- | wp-includes/feed.php | 275 | ||||
-rw-r--r-- | wp-includes/functions.php | 5 | ||||
-rw-r--r-- | wp-includes/js/tinymce/langs/wp-langs.php | 7 | ||||
-rw-r--r-- | wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js | 44 | ||||
-rw-r--r-- | wp-includes/js/tinymce/plugins/wordpress/img/audio.gif | bin | 0 -> 146 bytes | |||
-rw-r--r-- | wp-includes/js/tinymce/plugins/wordpress/img/image.gif | bin | 0 -> 101 bytes | |||
-rw-r--r-- | wp-includes/js/tinymce/plugins/wordpress/img/media.gif | bin | 0 -> 149 bytes | |||
-rw-r--r-- | wp-includes/js/tinymce/plugins/wordpress/img/video.gif | bin | 0 -> 99 bytes | |||
-rw-r--r-- | wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js | 130 | ||||
-rw-r--r-- | wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js | 148 | ||||
-rw-r--r-- | wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css | 6 | ||||
-rw-r--r-- | wp-includes/js/tinymce/tiny_mce_config.php | 2 | ||||
-rw-r--r-- | wp-includes/js/tinymce/wordpress.css | 32 | ||||
-rw-r--r-- | wp-includes/media.php | 25 | ||||
-rw-r--r-- | wp-includes/script-loader.php | 14 | ||||
-rw-r--r-- | wp-includes/taxonomy.php | 3 |
16 files changed, 584 insertions, 107 deletions
diff --git a/wp-includes/feed.php b/wp-includes/feed.php index 4cf5e67..3ff5b9a 100644 --- a/wp-includes/feed.php +++ b/wp-includes/feed.php @@ -1,18 +1,83 @@ <?php +/** + * WordPress Feed API + * + * Many of the functions used in here belong in The Loop, or The Loop for the + * Feeds. + * + * @package WordPress + * @subpackage Feed + */ +/** + * RSS container for the bloginfo function. + * + * You can retrieve anything that you can using the get_bloginfo() function. + * Everything will be stripped of tags and characters converted, when the values + * are retrieved for use in the feeds. + * + * @package WordPress + * @subpackage Feed + * @since 1.5.1 + * @uses apply_filters() Calls 'get_bloginfo_rss' hook with two parameters. + * @see get_bloginfo() For the list of possible values to display. + * + * @param string $show See get_bloginfo() for possible values. + * @return string + */ function get_bloginfo_rss($show = '') { $info = strip_tags(get_bloginfo($show)); return apply_filters('get_bloginfo_rss', convert_chars($info), $show); } +/** + * Display RSS container for the bloginfo function. + * + * You can retrieve anything that you can using the get_bloginfo() function. + * Everything will be stripped of tags and characters converted, when the values + * are retrieved for use in the feeds. + * + * @package WordPress + * @subpackage Feed + * @since 0.71 + * @uses apply_filters() Calls 'bloginfo_rss' hook with two parameters. + * @see get_bloginfo() For the list of possible values to display. + * + * @param string $show See get_bloginfo() for possible values. + */ function bloginfo_rss($show = '') { echo apply_filters('bloginfo_rss', get_bloginfo_rss($show), $show); } +/** + * Retrieve the default feed. + * + * The default feed is 'rss2', unless a plugin changes it through the + * 'default_feed' filter. + * + * @package WordPress + * @subpackage Feed + * @since 2.5 + * @uses apply_filters() Calls 'default_feed' hook on the default feed string. + * + * @return string Default feed, or for example 'rss2', 'atom', etc. + */ function get_default_feed() { return apply_filters('default_feed', 'rss2'); } +/** + * Retrieve the blog title for the feed title. + * + * @package WordPress + * @subpackage Feed + * @since 2.2.0 + * @uses apply_filters() Calls 'get_wp_title_rss' hook on title. + * @uses wp_title() See function for $sep parameter usage. + * + * @param string $sep Optional.How to separate the title. See wp_title() for more info. + * @return string Error message on failure or blog title on success. + */ function get_wp_title_rss($sep = '»') { $title = wp_title($sep, false); if ( is_wp_error( $title ) ) @@ -21,22 +86,79 @@ function get_wp_title_rss($sep = '»') { return $title; } +/** + * Display the blog title for display of the feed title. + * + * @package WordPress + * @subpackage Feed + * @since 2.2.0 + * @uses apply_filters() Calls 'wp_title_rss' on the blog title. + * @see wp_title() $sep parameter usage. + * + * @param string $sep Optional. + */ function wp_title_rss($sep = '»') { echo apply_filters('wp_title_rss', get_wp_title_rss($sep)); } +/** + * Retrieve the current post title for the feed. + * + * @package WordPress + * @subpackage Feed + * @since 2.0.0 + * @uses apply_filters() Calls 'the_title_rss' on the post title. + * + * @return string Current post title. + */ function get_the_title_rss() { $title = get_the_title(); $title = apply_filters('the_title_rss', $title); return $title; } - +/** + * Display the post title in the feed. + * + * @package WordPress + * @subpackage Feed + * @since 0.71 + * @uses get_the_title_rss() Used to retrieve current post title. + */ function the_title_rss() { echo get_the_title_rss(); } - +/** + * Display the post content for the feed. + * + * For encoding the html or the $encode_html parameter, there are three possible + * values. '0' will make urls footnotes and use make_url_footnote(). '1' will + * encode special characters and automatically display all of the content. The + * value of '2' will strip all HTML tags from the content. + * + * Also note that you cannot set the amount of words and not set the html + * encoding. If that is the case, then the html encoding will default to 2, + * which will strip all HTML tags. + * + * To restrict the amount of words of the content, you can use the cut + * parameter. If the content is less than the amount, then there won't be any + * dots added to the end. If there is content left over, then dots will be added + * and the rest of the content will be removed. + * + * @package WordPress + * @subpackage Feed + * @since 0.71 + * @uses apply_filters() Calls 'the_content_rss' on the content before processing. + * @see get_the_content() For the $more_link_text, $stripteaser, and $more_file + * parameters. + * + * @param string $more_link_text Optional. Text to display when more content is available but not displayed. + * @param int|bool $stripteaser Optional. Default is 0. + * @param string $more_file Optional. + * @param int $cut Optional. Amount of words to keep for the content. + * @param int $encode_html Optional. How to encode the content. + */ function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { $content = get_the_content($more_link_text, $stripteaser, $more_file); $content = apply_filters('the_content_rss', $content); @@ -59,6 +181,8 @@ function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file $k = count($blah); $use_dotdotdot = 0; } + + /** @todo Check performance, might be faster to use array slice instead. */ for ( $i=0; $i<$k; $i++ ) $excerpt .= $blah[$i].' '; $excerpt .= ($use_dotdotdot) ? '...' : ''; @@ -68,21 +192,51 @@ function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file echo $content; } - +/** + * Display the post excerpt for the feed. + * + * @package WordPress + * @subpackage Feed + * @since 0.71 + * @uses apply_filters() Calls 'the_excerpt_rss' hook on the excerpt. + */ function the_excerpt_rss() { $output = get_the_excerpt(); echo apply_filters('the_excerpt_rss', $output); } +/** + * Display the permalink to the post for use in feeds. + * + * @package WordPress + * @subpackage Feed + * @since 2.3.0 + * @uses apply_filters() Call 'the_permalink_rss' on the post permalink + */ function the_permalink_rss() { echo apply_filters('the_permalink_rss', get_permalink()); - } +/** + * Display the feed GUID for the current comment. + * + * @package WordPress + * @subpackage Feed + * @since unknown + */ function comment_guid() { echo get_comment_guid(); } +/** + * Retrieve the feed GUID for the current comment. + * + * @package WordPress + * @subpackage Feed + * @since unknown + * + * @return bool|string false on failure or guid for comment on success. + */ function get_comment_guid() { global $comment; @@ -92,24 +246,71 @@ function get_comment_guid() { return get_the_guid($comment->comment_post_ID) . '#comment-' . $comment->comment_ID; } +/** + * Display the link to the comments. + * + * @since 1.5.0 + */ function comment_link() { echo get_comment_link(); } +/** + * Retrieve the current comment author for use in the feeds. + * + * @package WordPress + * @subpackage Feed + * @since 2.0.0 + * @uses apply_filters() Calls 'comment_author_rss' hook on comment author. + * @uses get_comment_author() + * + * @return string Comment Author + */ function get_comment_author_rss() { return apply_filters('comment_author_rss', get_comment_author() ); } +/** + * Display the current comment author in the feed. + * + * @package WordPress + * @subpackage Feed + * @since 1.0.0 + */ function comment_author_rss() { echo get_comment_author_rss(); } +/** + * Display the current comment content for use in the feeds. + * + * @package WordPress + * @subpackage Feed + * @since 1.0.0 + * @uses apply_filters() Calls 'comment_text_rss' filter on comment content. + * @uses get_comment_text() + */ function comment_text_rss() { $comment_text = get_comment_text(); $comment_text = apply_filters('comment_text_rss', $comment_text); echo $comment_text; } +/** + * Retrieve all of the post categories, formatted for use in feeds. + * + * All of the categories for the current post in the feed loop, will be + * retrieved and have feed markup added, so that they can easily be added to the + * RSS2, Atom, or RSS1 and RSS0.91 RDF feeds. + * + * @package WordPress + * @subpackage Feed + * @since 2.1.0 + * @uses apply_filters() + * + * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'. + * @return string All of the post categories for displaying in the feed. + */ function get_the_category_rss($type = 'rss') { $categories = get_the_category(); $tags = get_the_tags(); @@ -142,10 +343,29 @@ function get_the_category_rss($type = 'rss') { return apply_filters('the_category_rss', $the_list, $type); } +/** + * Display the post categories in the feed. + * + * @package WordPress + * @subpackage Feed + * @since 0.71 + * @see get_the_category_rss() For better explanation. + * + * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'. + */ function the_category_rss($type = 'rss') { echo get_the_category_rss($type); } +/** + * Display the HTML type based on the blog setting. + * + * The two possible values are either 'xhtml' or 'html'. + * + * @package WordPress + * @subpackage Feed + * @since 2.2.0 + */ function html_type_rss() { $type = get_bloginfo('html_type'); if (strpos($type, 'xhtml') !== false) @@ -155,7 +375,24 @@ function html_type_rss() { echo $type; } - +/** + * Display the rss enclosure for the current post. + * + * Uses the global $post to check whether the post requires a password and if + * the user has the password for the post. If not then it will return before + * displaying. + * + * Also uses the function get_post_custom() to get the post's 'enclosure' + * metadata field and parses the value to display the enclosure(s). The + * enclosure(s) consist of enclosure HTML tag(s) with a URI and other + * attributes. + * + * @package WordPress + * @subpackage Template + * @since 1.5.0 + * @uses apply_filters() Calls 'rss_enclosure' hook on rss enclosure. + * @uses get_post_custom() To get the current post enclosure metadata. + */ function rss_enclosure() { global $post; if ( !empty($post->post_password) && (!isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || $_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) ) @@ -171,6 +408,23 @@ function rss_enclosure() { } } +/** + * Display the atom enclosure for the current post. + * + * Uses the global $post to check whether the post requires a password and if + * the user has the password for the post. If not then it will return before + * displaying. + * + * Also uses the function get_post_custom() to get the post's 'enclosure' + * metadata field and parses the value to display the enclosure(s). The + * enclosure(s) consist of link HTML tag(s) with a URI and other attributes. + * + * @package WordPress + * @subpackage Template + * @since 2.2.0 + * @uses apply_filters() Calls 'atom_enclosure' hook on atom enclosure. + * @uses get_post_custom() To get the current post enclosure metadata. + */ function atom_enclosure() { global $post; if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) ) @@ -187,7 +441,7 @@ function atom_enclosure() { } /** - * prep_atom_text_construct() - Determine the type of a given string of data + * Determine the type of a string of data with the data formatted. * * Tell whether the type is text, html, or xhtml, per RFC 4287 section 3.1. * @@ -202,8 +456,8 @@ function atom_enclosure() { * @subpackage Feed * @since 2.5 * - * @param string $data input string - * @return array $result array(type, value) + * @param string $data Input string + * @return array array(type, value) */ function prep_atom_text_construct($data) { if (strpos($data, '<') === false && strpos($data, '&') === false) { @@ -232,14 +486,13 @@ function prep_atom_text_construct($data) { } /** - * self_link() - Generate a correct link for the atom:self elemet + * Display the link for the currently displayed feed in a XSS safe way. * - * Echo the link for the currently displayed feed in a XSS safe way. + * Generate a correct link for the atom:self element. * * @package WordPress * @subpackage Feed * @since 2.5 - * */ function self_link() { echo 'http' diff --git a/wp-includes/functions.php b/wp-includes/functions.php index c488fdd..0fe154d 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -515,8 +515,11 @@ function update_option( $option_name, $newvalue ) { $safe_option_name = $wpdb->escape( $option_name ); $newvalue = sanitize_option( $option_name, $newvalue ); - // If the new and old values are the same, no need to update. $oldvalue = get_option( $safe_option_name ); + + $newvalue = apply_filters( 'pre_update_option_' . $option_name, $newvalue, $oldvalue ); + + // If the new and old values are the same, no need to update. if ( $newvalue === $oldvalue ) return false; diff --git a/wp-includes/js/tinymce/langs/wp-langs.php b/wp-includes/js/tinymce/langs/wp-langs.php index 86b3e08..6922831 100644 --- a/wp-includes/js/tinymce/langs/wp-langs.php +++ b/wp-includes/js/tinymce/langs/wp-langs.php @@ -395,11 +395,16 @@ wp_more_desc:"' . mce_escape( __('Insert More tag') ) . ' (Alt+Shift+T)", wp_page_desc:"' . mce_escape( __('Insert Page break') ) . ' (Alt+Shift+P)", wp_help_desc:"' . mce_escape( __('Help') ) . ' (Alt+Shift+H)", wp_more_alt:"' . mce_escape( __('More...') ) . '", -wp_page_alt:"' . mce_escape( __('Next page...') ) . '" +wp_page_alt:"' . mce_escape( __('Next page...') ) . '", +add_media:"' . mce_escape( __('Add Media') ) . '", +add_image:"' . mce_escape( __('Add an Image') ) . '", +add_video:"' . mce_escape( __('Add Video') ) . '", +add_audio:"' . mce_escape( __('Add Audio') ) . '" }); tinyMCE.addI18n("' . $language . '.wpeditimage",{ edit_img:"' . mce_escape( __('Edit Image') ) . '", +del_img:"' . mce_escape( __('Delete Image') ) . '", adv_settings:"' . mce_escape( __('Advanced Settings') ) . '", none:"' . mce_escape( __('None') ) . '", size:"' . mce_escape( __('Size') ) . '", diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js index 418f3a4..ab3eb12 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js @@ -89,6 +89,50 @@ cmd : 'WP_Adv' }); + // Add Media buttons + ed.addButton('add_media', { + title : 'wordpress.add_media', + image : url + '/img/media.gif', + onclick : function() { + tb_show('', tinymce.DOM.get('add_media').href); + tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); + } + }); + + ed.addButton('add_image', { + title : 'wordpress.add_image', + image : url + '/img/image.gif', + onclick : function() { + tb_show('', tinymce.DOM.get('add_image').href); + tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); + } + }); + + ed.addButton('add_video', { + title : 'wordpress.add_video', + image : url + '/img/video.gif', + onclick : function() { + tb_show('', tinymce.DOM.get('add_video').href); + tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); + } + }); + + ed.addButton('add_audio', { + title : 'wordpress.add_audio', + image : url + '/img/audio.gif', + onclick : function() { + tb_show('', tinymce.DOM.get('add_audio').href); + tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); + } + }); + + // Add Media buttons to fullscreen + ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) { + if ( 'mceFullScreen' != cmd ) return; + if ( 'mce_fullscreen' != ed.id ) + ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media'; + }); + // Add class "alignleft", "alignright" and "aligncenter" when selecting align for images. ed.onExecCommand.add(function( ed, cmd ) { var n, bl, dom = ed.dom; diff --git a/wp-includes/js/tinymce/plugins/wordpress/img/audio.gif b/wp-includes/js/tinymce/plugins/wordpress/img/audio.gif Binary files differnew file mode 100644 index 0000000..f8ad223 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/img/audio.gif diff --git a/wp-includes/js/tinymce/plugins/wordpress/img/image.gif b/wp-includes/js/tinymce/plugins/wordpress/img/image.gif Binary files differnew file mode 100644 index 0000000..6736e6b --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/img/image.gif diff --git a/wp-includes/js/tinymce/plugins/wordpress/img/media.gif b/wp-includes/js/tinymce/plugins/wordpress/img/media.gif Binary files differnew file mode 100644 index 0000000..786e4f5 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/img/media.gif diff --git a/wp-includes/js/tinymce/plugins/wordpress/img/video.gif b/wp-includes/js/tinymce/plugins/wordpress/img/video.gif Binary files differnew file mode 100644 index 0000000..b8e0975 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/img/video.gif diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js index 33edd24..230746e 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js @@ -34,27 +34,76 @@ }); ed.onMouseUp.add(function(ed, e) { - if ( tinymce.isOpera ) - ed.plugins.wpeditimage.showButtons(e); + if ( ! tinymce.isOpera ) return; + if ( e.target.nodeName == 'IMG' ) + ed.plugins.wpeditimage.showButtons(e.target); }); ed.onMouseDown.add(function(ed, e) { - if ( tinymce.isOpera ) return; - ed.plugins.wpeditimage.showButtons(e); + if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) { + t.hideButtons(); + return; + } + ed.plugins.wpeditimage.showButtons(e.target); }); -/* - ed.onSetContent.add(function() { - t._fixCenter(ed.getBody()); + + ed.onKeyPress.add(function(ed, e) { + var DL, DIV; + + if ( e.keyCode == 13 && (DL = ed.dom.getParent(ed.selection.getNode(), 'DL')) ) { + var P = ed.dom.create('p', {}, ' '); + if ( (DIV = DL.parentNode) && DIV.nodeName == 'DIV' ) + ed.dom.insertAfter( P, DIV ); + else ed.dom.insertAfter( P, DL ); + + tinymce.dom.Event.cancel(e); + ed.selection.select(P); + return false; + } }); - ed.onPreProcess.add(function(ed, o) { - if (o.set) - t._fixCenter(o.node); + ed.onBeforeSetContent.add(function(ed, o) { + o.content = t._do_shcode(o.content); + }); + ed.onPostProcess.add(function(ed, o) { if (o.get) - ed.dom.removeClass(ed.dom.select('p', o.node), 'mce_iecenter'); + o.content = t._get_shcode(o.content); + }); + }, + + _do_shcode : function(co) { + return co.replace(/\[wp_caption([^\]]+)\]([\s\S]+?)\[\/wp_caption\][\s\u00a0]*/g, function(a,b,c){ + var id = b.match(/id=['"]([^'"]+)/), cls = b.match(/align=['"]([^'"]+)/); + var w = b.match(/width=['"]([0-9]+)/), cap = b.match(/caption=['"]([^'"]+)/); + + id = ( id && id[1] ) ? id[1] : ''; + cls = ( cls && cls[1] ) ? cls[1] : 'alignnone'; + w = ( w && w[1] ) ? w[1] : ''; + cap = ( cap && cap[1] ) ? cap[1] : ''; + if ( ! w || ! cap ) return c; + + var div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp'; + + return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp_caption '+cls+'" style="width: '+(10+parseInt(w))+ + 'px"><dt class="wp_caption_dt">'+c+'</dt><dd class="wp_caption_dd">'+cap+'</dd></dl></div>'; + }); + }, + + _get_shcode : function(co) { + return co.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>([^<]+)<\/dd>\s*<\/dl>\s*<\/div>\s*/g, function(a,b,c,cap){ + var id = b.match(/id=['"]([^'"]+)/), cls = b.match(/class=['"]([^'"]+)/); + var w = c.match(/width=['"]([0-9]+)/); + + id = ( id && id[1] ) ? id[1] : ''; + cls = ( cls && cls[1] ) ? cls[1] : 'alignnone'; + w = ( w && w[1] ) ? w[1] : ''; + + if ( ! w || ! cap ) return c; + cls = cls ? cls.match(/align[^ '"]+/) : ''; + + return '[wp_caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/wp_caption]'; }); -*/ }, _fixCenter : function(c) { @@ -71,32 +120,31 @@ }); }, - showButtons : function(e) { - var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y, el = e.target; + showButtons : function(n) { + var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y; - t.hideButtons(); - if (el.nodeName == 'IMG') { - if (ed.dom.getAttrib(el, 'class').indexOf('mceItem') != -1) - return; + if (ed.dom.getAttrib(n, 'class').indexOf('mceItem') != -1) + return; - vp = ed.dom.getViewPort(ed.getWin()); - p1 = DOM.getPos(ed.getContentAreaContainer()); - p2 = ed.dom.getPos(el); + vp = ed.dom.getViewPort(ed.getWin()); + p1 = DOM.getPos(ed.getContentAreaContainer()); + p2 = ed.dom.getPos(n); - X = Math.max(p2.x - vp.x, 0) + p1.x; - Y = Math.max(p2.y - vp.y, 0) + p1.y; + X = Math.max(p2.x - vp.x, 0) + p1.x; + Y = Math.max(p2.y - vp.y, 0) + p1.y; - DOM.setStyles('wp_editbtns', { - 'top' : Y+5+'px', - 'left' : X+5+'px', - 'display' : 'block' - }); + DOM.setStyles('wp_editbtns', { + 'top' : Y+5+'px', + 'left' : X+5+'px', + 'display' : 'block' + }); - t.btnsTout = window.setTimeout( function(){ed.plugins.wpeditimage.hideButtons();}, 5000 ); - } + t.btnsTout = window.setTimeout( function(){ed.plugins.wpeditimage.hideButtons();}, 5000 ); }, hideButtons : function() { + if ( tinymce.DOM.isHidden('wp_editbtns') ) return; + tinymce.DOM.hide('wp_editbtns'); window.clearTimeout(this.btnsTout); }, @@ -116,7 +164,7 @@ id : 'wp_editimgbtn', width : '24', height : '24', - title : 'Edit' + title : ed.getLang('wpeditimage.edit_img') }); wp_editimgbtn.onmousedown = function(e) { @@ -131,21 +179,23 @@ id : 'wp_delimgbtn', width : '24', height : '24', - title : 'Delete' + title : ed.getLang('wpeditimage.del_img') }); wp_delimgbtn.onmousedown = function(e) { var ed = tinyMCE.activeEditor, el = ed.selection.getNode(), p; - if ( el.nodeName != 'IMG' || ed.dom.getAttrib(el, 'class').indexOf('mceItem') != -1 ) return; + if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) { + if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') ) + ed.dom.remove(p); + else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 ) + ed.dom.remove(p); + else ed.dom.remove(el); - if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1) - ed.dom.remove(p); - else ed.dom.remove(el); - - this.parentNode.style.display = 'none'; - ed.execCommand('mceRepaint'); - return false; + this.parentNode.style.display = 'none'; + ed.execCommand('mceRepaint'); + return false; + } } }, diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js b/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js index 869dfd1..89b4d71 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js +++ b/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js @@ -95,6 +95,8 @@ var wpImage = { current_size_sel : 's100', width : '', height : '', + align : '', + img_alt : '', setTabs : function(tab) { var t = this; @@ -125,7 +127,7 @@ var wpImage = { imgAlignCls : function(v) { var t = this, cls = t.I('img_classes').value; - t.I('img_demo').className = v; + t.I('img_demo').className = t.align = v; cls = cls.replace( /align[^ "']+/gi, '' ); cls += (' ' + v); @@ -135,7 +137,7 @@ var wpImage = { t.I('hspace').value = ''; t.updateStyle('hspace'); } - + t.I('img_classes').value = cls; }, @@ -153,7 +155,7 @@ var wpImage = { showSizeSet : function() { var t = this; - + if ( (t.width * 1.3) > parseInt(t.preloadImg.width) ) { var s130 = t.I('s130'), s120 = t.I('s120'), s110 = t.I('s110'); @@ -243,7 +245,7 @@ var wpImage = { }, setup : function() { - var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), dom = tinyMCEPopup.dom; + var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption; document.dir = tinyMCEPopup.editor.getParam('directionality',''); tinyMCEPopup.restoreSelection(); el = ed.selection.getNode(); @@ -252,16 +254,32 @@ var wpImage = { f.img_src.value = d.src = link = ed.dom.getAttrib(el, 'src'); ed.dom.setStyle(el, 'float', ''); t.getImageData(); + c = ed.dom.getAttrib(el, 'class'); + caption = t.img_alt = ed.dom.getAttrib(el, 'alt'); + + if ( DL = dom.getParent(el, 'dl') ) { + var dlc = ed.dom.getAttrib(DL, 'class'); + dlc = dlc.match(/align[^ "']+/i); + if ( ! dom.hasClass(el, dlc) ) + c += ' '+dlc; + + tinymce.each(DL.childNodes, function(e) { + if ( e.nodeName == 'DD' ) { + caption = e.innerHTML; + return; + } + }); + } f.img_title.value = ed.dom.getAttrib(el, 'title'); - f.img_alt.value = ed.dom.getAttrib(el, 'alt'); + f.img_alt.value = caption; f.border.value = ed.dom.getAttrib(el, 'border'); f.vspace.value = ed.dom.getAttrib(el, 'vspace'); f.hspace.value = ed.dom.getAttrib(el, 'hspace'); f.align.value = ed.dom.getAttrib(el, 'align'); f.width.value = t.width = ed.dom.getAttrib(el, 'width'); f.height.value = t.height = ed.dom.getAttrib(el, 'height'); - f.img_classes.value = c = ed.dom.getAttrib(el, 'class'); + f.img_classes.value = c; f.img_style.value = ed.dom.getAttrib(el, 'style'); // Move attribs to styles @@ -291,27 +309,20 @@ var wpImage = { if ( c.indexOf('alignleft') != -1 ) { t.I('alignleft').checked = "checked"; - d.className = "alignleft"; + d.className = t.align = "alignleft"; } else if ( c.indexOf('aligncenter') != -1 ) { t.I('aligncenter').checked = "checked"; - d.className = "aligncenter"; + d.className = t.align = "aligncenter"; } else if ( c.indexOf('alignright') != -1 ) { t.I('alignright').checked = "checked"; - d.className = "alignright"; + d.className = t.align = "alignright"; } else if ( c.indexOf('alignnone') != -1 ) { t.I('alignnone').checked = "checked"; - d.className = "alignnone"; + d.className = t.align = "alignnone"; } if ( t.width && t.preloadImg.width ) t.showSizeSet(); document.body.style.display = ''; -/* - // Test if is attachment - if ( (id = c.match( /wp-image-([0-9]{1,6})/ )) && id[1] ) { - t.I('tab_attachment').href = tinymce.documentBaseURL + 'media.php?action=edit&attachment_id=' + id[1]; - t.I('tab_attachment').style.display = 'inline'; - } -*/ }, remove : function() { @@ -321,10 +332,11 @@ var wpImage = { el = ed.selection.getNode(); if (el.nodeName != 'IMG') return; - if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1) + if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') ) ed.dom.remove(p); - else - ed.dom.remove(el); + else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 ) + ed.dom.remove(p); + else ed.dom.remove(el); ed.execCommand('mceRepaint'); tinyMCEPopup.close(); @@ -332,31 +344,37 @@ var wpImage = { }, update : function() { - var t = this, f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, el, P, A, v = f.img_classes.value; + var t = this, f = document.forms[0], ed = tinyMCEPopup.editor, el, b, fixSafari = null, DL, P, A, DIV, do_caption = null, img_class = f.img_classes.value, html; tinyMCEPopup.restoreSelection(); el = ed.selection.getNode(); if (el.nodeName != 'IMG') return; - if (f.img_src.value === '') t.remove(); + if (f.img_src.value === '') { + t.remove(); + return; + } + + if ( f.img_alt.value != '' && f.width.value != '' ) { + do_caption = 1; + img_class = img_class.replace( /align[^ "']+\s?/gi, '' ); + } - A = ed.dom.getParent(el, 'A'); + A = ed.dom.getParent(el, 'a'); P = ed.dom.getParent(el, 'p'); + DL = ed.dom.getParent(el, 'dl'); + DIV = ed.dom.getParent(el, 'div'); + tinyMCEPopup.execCommand("mceBeginUndoLevel"); -/* if ( tinymce.isIE ) { - if ( f.img_classes.value.indexOf('aligncenter') != -1 ) - ed.dom.addClass(P, 'mce_iecenter'); - else ed.dom.removeClass(P, 'mce_iecenter'); - } -*/ + ed.dom.setAttribs(el, { src : f.img_src.value, title : f.img_title.value, - alt : f.img_alt.value, + alt : t.img_alt, width : f.width.value, height : f.height.value, style : f.img_style.value, - 'class' : '' //f.img_classes.value + 'class' : img_class }); if ( ! f.link_href.value ) { @@ -368,15 +386,20 @@ var wpImage = { } else { // Create new anchor elements if ( A == null ) { - if ( ! f.link_href.value.match(/https?:\/\//) ) f.link_href.value = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.link_href.value); - + + if ( tinymce.isWebKit && ed.dom.hasClass(el, 'aligncenter') ) { + ed.dom.removeClass(el, 'aligncenter'); + fixSafari = 1; + } + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); - + if ( fixSafari ) ed.dom.addClass(el, 'aligncenter'); + tinymce.each(ed.dom.select("a"), function(n) { if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { - + ed.dom.setAttribs(n, { href : f.link_href.value, title : f.link_title.value, @@ -399,15 +422,62 @@ var wpImage = { } } - ed.dom.setAttrib(el, 'class', f.img_classes.value); - - if ( v.indexOf('aligncenter') != -1 ) { + if ( do_caption ) { + var id, cap_id = '', cap, DT, DD, cap_width = 10 + parseInt(f.width.value), align = t.align.substring(5), div_cls = (t.align == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp'; + + if ( DL ) { + ed.dom.setAttribs(DL, { + 'class' : 'wp_caption '+t.align, + style : 'width: '+cap_width+'px;' + }); + + if ( DIV ) + ed.dom.setAttrib(DIV, 'class', div_cls); + + if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp_caption_dd') ) + ed.dom.setHTML(DD, f.img_alt.value); + + } else { + if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) && id[1] ) + cap_id = 'attachment_'+id[1]; + + if ( f.link_href.value ) html = ed.dom.getOuterHTML(ed.dom.getParent(el, 'a')); + else html = ed.dom.getOuterHTML(el); + + html = '<dl id="'+cap_id+'" class="wp_caption '+t.align+'" style="width: '+cap_width+ + 'px"><dt class="wp_caption_dt">'+html+'</dt><dd class="wp_caption_dd">'+f.img_alt.value+'</dd></dl>'; + + cap = ed.dom.create('div', {'class': div_cls}, html); + + if ( P ) { + P.parentNode.insertBefore(cap, P); + ed.dom.remove(P); + } + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + ed.execCommand('mceRepaint'); + tinyMCEPopup.close(); + return; + } else { + if ( DL && DIV ) { + if ( f.link_href.value ) html = ed.dom.getOuterHTML(ed.dom.getParent(el, 'a')); + else html = ed.dom.getOuterHTML(el); + + P = ed.dom.create('p', {}, html); + DIV.parentNode.insertBefore(P, DIV); + ed.dom.remove(DIV); + } + } + + if ( f.img_classes.value.indexOf('aligncenter') != -1 ) { if ( P && ( ! P.style || P.style.textAlign != 'center' ) ) ed.dom.setStyle(P, 'textAlign', 'center'); } else { if ( P && P.style && P.style.textAlign == 'center' ) ed.dom.setStyle(P, 'textAlign', ''); } + tinyMCEPopup.execCommand("mceEndUndoLevel"); ed.execCommand('mceRepaint'); tinyMCEPopup.close(); @@ -496,7 +566,7 @@ var wpImage = { f.width.value = t.width = t.preloadImg.width; f.height.value = t.height = t.preloadImg.height; } - + t.showSizeSet(); t.demoSetSize(); if ( f.img_style.value ) diff --git a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css index 1a94d83..df1e059 100644 --- a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css +++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css @@ -1,4 +1,4 @@ -body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} +body, td {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} body {background:#FFF;} body.mceForceColors {background:#FFF; color:#000;} h1 {font-size: 2em} @@ -17,7 +17,3 @@ ins {border-bottom:1px solid green; text-decoration: none; color:green} del {color:red; text-decoration:line-through} cite {border-bottom:1px dashed blue} acronym {border-bottom:1px dotted #CCC; cursor:help} - -p.mce_iecenter { - text-align: center; -} diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php index 8a2ff72..8a72ad4 100644 --- a/wp-includes/js/tinymce/tiny_mce_config.php +++ b/wp-includes/js/tinymce/tiny_mce_config.php @@ -222,7 +222,7 @@ if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) { // Setup cache info if ( $disk_cache ) { - $cacheKey = apply_filters('tiny_mce_version', '20080626'); + $cacheKey = apply_filters('tiny_mce_version', '20080703'); foreach ( $initArray as $v ) $cacheKey .= $v; diff --git a/wp-includes/js/tinymce/wordpress.css b/wp-includes/js/tinymce/wordpress.css index 1596f59..0b55d4e 100644 --- a/wp-includes/js/tinymce/wordpress.css +++ b/wp-includes/js/tinymce/wordpress.css @@ -1,6 +1,7 @@ /* This file contains the CSS data for the editable area(iframe) of TinyMCE */ -.aligncenter { +.aligncenter, +dl.aligncenter { display: block; margin-left: auto; margin-right: auto; @@ -14,6 +15,31 @@ float: right; } +.wp_caption { + border: 1px solid #ddd; + text-align: center; + background-color: #f3f3f3; + padding-top: 4px; + margin: 10px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.wp_caption img { + margin: 0; + padding: 0; + border: 0 none; +} + +.wp_caption_dd { + font-size: 11px; + line-height: 17px; + padding: 0 4px 5px; + margin: 0; +} + body.mceContentBody { background: #fff; color: #000; @@ -63,3 +89,7 @@ a.mceItemAnchor { padding-left: 12px; background: url(img/items.gif) no-repeat bottom left; } + +.mceIEcenter { + text-align: center; +} diff --git a/wp-includes/media.php b/wp-includes/media.php index fd4b0a2..dc625d0 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -350,6 +350,31 @@ function wp_get_attachment_image($attachment_id, $size='thumbnail', $icon = fals return $html; } +add_shortcode('wp_caption', 'wp_caption_shortcode'); + +function wp_caption_shortcode($attr, $content = null) { + + // Allow plugins/themes to override the default caption template. + $output = apply_filters('wp_caption_shortcode', '', $attr, $content); + if ( $output != '' ) + return $output; + + extract(shortcode_atts(array( + 'id' => '', + 'align' => 'alignnone', + 'width' => '', + 'caption' => '' + ), $attr)); + + if ( 1 > (int) $width || empty($caption) ) + return $content; + + if ( $id ) $id = 'id="' . $id . '" '; + + return '<dl ' . $id . 'class="wp_caption ' . $align . '" style="width: ' . (10 + (int) $width) . 'px">' + . '<dt class="wp_caption_dt">' . $content . '</dt><dd class="wp_caption_dd">' . $caption . '</dd></dl>'; +} + add_shortcode('gallery', 'gallery_shortcode'); function gallery_shortcode($attr) { diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 848f292..e8a7d40 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -34,10 +34,10 @@ function wp_default_scripts( &$scripts ) { $visual_editor = apply_filters('visual_editor', array('tiny_mce')); $scripts->add( 'editor', false, $visual_editor, '20080321' ); - $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080325' ); + $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080702' ); // Modify this version when tinyMCE plugins are changed. - $mce_version = apply_filters('tiny_mce_version', '20080626'); + $mce_version = apply_filters('tiny_mce_version', '20080703'); $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version ); $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); @@ -73,13 +73,13 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('jquery'), '1.1b'); $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20'); $scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1-20080430'); - $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.1.0'); - $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.1.0'); + $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2-20080430'); + $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2'); $scripts->localize( 'swfupload-degrade', 'uploadDegradeOptions', array( 'is_lighttpd_before_150' => is_lighttpd_before_150(), ) ); - $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.1.0'); - $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.1.0'); + $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2'); + $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080407'); // these error messages came from the sample swfupload js, they might need changing. $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array( 'queue_limit_exceeded' => __('You have attempted to queue too many files.'), @@ -159,7 +159,7 @@ function wp_default_scripts( &$scripts ) { 'edit' => __('Edit'), ) ); $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20080520' ); - $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20080625' ); + $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20080702' ); $scripts->localize( 'upload', 'uploadL10n', array( 'browseTitle' => attribute_escape(__('Browse your files')), 'back' => __('« Back'), diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index eaf8ade..6c6edea 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -601,7 +601,8 @@ function &get_terms($taxonomies, $args = '') { } // $args can be whatever, only use the args defined in defaults to compute the key - $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) ); + $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : ''; + $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key ); if ( $cache = wp_cache_get( 'get_terms', 'terms' ) ) { if ( isset( $cache[ $key ] ) ) |