diff options
30 files changed, 741 insertions, 146 deletions
diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index bfd0533..a65108a 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -70,7 +70,7 @@ unset($hook_suffixes, $hook_suffix); <div id="wpwrap"> <div id="wpcontent"> <div id="wphead"> -<h1><?php if ( '' == get_bloginfo('name') ) echo ' '; else echo get_bloginfo('name'); ?><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1> +<h1><?php if ( '' == get_bloginfo('name', 'display') ) echo ' '; else echo get_bloginfo('name', 'display'); ?><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1> </div> <?php diff --git a/wp-admin/gears-manifest.php b/wp-admin/gears-manifest.php index a6236f8..c8ea433 100644 --- a/wp-admin/gears-manifest.php +++ b/wp-admin/gears-manifest.php @@ -64,7 +64,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); ?> { "betaManifestVersion" : 1, -"version" : "<?php echo $man_version; ?>_20080626", +"version" : "<?php echo $man_version; ?>_20080703", "entries" : [ <?php echo $defaults; ?> @@ -191,5 +191,9 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); { "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif" }, { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/image.png" }, { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png" }, -{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/help.gif" } +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/help.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/image.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/media.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/video.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/audio.gif" } ]} diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 99f2bbd..a79944a 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -62,6 +62,25 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal return $html; } +function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) { + + if ( empty($alt) ) return $html; + $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; + + preg_match( '/width="([0-9]+)/', $html, $matches ); + if ( ! isset($matches[1]) ) return $html; + $width = $matches[1]; + + $html = preg_replace( '/align[^\s\'"]+\s?/', '', $html ); + if ( empty($align) ) $align = 'none'; + + $shcode = '[wp_caption id="' . $id . '" align="align' . $align + . '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/wp_caption]'; + + return apply_filters( 'image_add_caption_shortcode', $shcode, $html ); +} +add_filter( 'image_send_to_editor', 'image_add_caption', 20, 7 ); + function media_send_to_editor($html) { ?> <script type="text/javascript"> @@ -212,10 +231,10 @@ function media_buttons() { $audio_title = __('Add Audio'); $out = <<<EOF - <a href="{$image_upload_iframe_src}&TB_iframe=true" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a> - <a href="{$video_upload_iframe_src}&TB_iframe=true" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a> - <a href="{$audio_upload_iframe_src}&TB_iframe=true" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a> - <a href="{$media_upload_iframe_src}&TB_iframe=true" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a> + <a href="{$image_upload_iframe_src}&TB_iframe=true" id="add_image" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a> + <a href="{$video_upload_iframe_src}&TB_iframe=true" id="add_video" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a> + <a href="{$audio_upload_iframe_src}&TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a> + <a href="{$media_upload_iframe_src}&TB_iframe=true" id="add_media" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a> EOF; printf($context, $out); @@ -321,10 +340,8 @@ function media_sideload_image($file, $post_id, $desc = null) { $id = media_handle_sideload($file_array, $post_id, $desc); $src = $id; - unset($file_array); - if ( is_wp_error($id) ) { - $errors['upload_error'] = $id; + @unlink($file_array['tmp_name']); return $id; } } diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index 1d81bf8..7e1e75f 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -68,7 +68,7 @@ function insert_with_markers( $filename, $marker, $insertion ) { } } if (!$foundit) { - fwrite( $f, "# BEGIN {$marker}\n" ); + fwrite( $f, "\n# BEGIN {$marker}\n" ); foreach ( $insertion as $insertline ) fwrite( $f, "{$insertline}\n" ); fwrite( $f, "# END {$marker}\n" ); diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index f98b9de..a34aeab 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -93,7 +93,10 @@ function _wp_translate_postdata( $update = false ) { $hh = $_POST['hh']; $mn = $_POST['mn']; $ss = $_POST['ss']; + $aa = ($aa <= 0 ) ? date('Y') : $aa; + $mm = ($mm <= 0 ) ? date('n') : $mm; $jj = ($jj > 31 ) ? 31 : $jj; + $jj = ($jj <= 0 ) ? date('j') : $jj; $hh = ($hh > 23 ) ? $hh -24 : $hh; $mn = ($mn > 59 ) ? $mn -60 : $mn; $ss = ($ss > 59 ) ? $ss -60 : $ss; diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 346fe7e..bde13d0 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -767,6 +767,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true $actions = array(); + if ( current_user_can('edit_post', $comment->comment_post_ID) ) { $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | '; $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | '; @@ -779,9 +780,9 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true unset($actions['approve']); } - if ( current_user_can('edit_post', $comment->comment_post_ID) ) { $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | '; $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>'; + $actions = apply_filters( 'comment_row_actions', $actions, $comment ); foreach ( $actions as $action => $link ) echo "<span class='$action'>$link</span>"; } diff --git a/wp-admin/js/editor.js b/wp-admin/js/editor.js index 50955c7..d2049e4 100644 --- a/wp-admin/js/editor.js +++ b/wp-admin/js/editor.js @@ -52,6 +52,7 @@ switchEditors = { // Fix some block element newline issues content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div'); content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n'); + content = content.replace(new RegExp('\\s*\\[wp_caption([^\\[]+)\\[/wp_caption\\]\\s*', 'gi'), '\n\n[wp_caption$1[/wp_caption]\n\n'); var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre'; content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>'); @@ -69,7 +70,7 @@ switchEditors = { // Trim whitespace content = content.replace(new RegExp('^\\s*', ''), ''); - content = content.replace(new RegExp('\\s*$', ''), ''); + content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), ''); // put back the line breaks in pre|script content = content.replace(/<wp_temp>/g, '\n'); @@ -164,6 +165,7 @@ switchEditors = { pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n"); pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1"); pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1'); + pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[wp_caption([^\\[]+)\\[/wp_caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[wp_caption$1[/wp_caption]'); // pee = pee.replace(new RegExp('^((?: )*)\\s', 'mg'), '$1 '); // Fix the pre|script tags diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js index 99acd26..3a034ac 100644 --- a/wp-admin/js/media-upload.js +++ b/wp-admin/js/media-upload.js @@ -5,6 +5,9 @@ function send_to_editor(h) { if (tinymce.isIE) ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark); + if ( h.indexOf('[wp_caption') != -1 ) + h = ed.plugins.wpeditimage._do_shcode(h); + ed.execCommand('mceInsertContent', false, h); } else edInsertContent(edCanvas, h); diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index ee5d101..00742d1 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -9,7 +9,7 @@ if( $menu_perms[ 'plugins' ] != 1 ) return; $action = ''; -foreach( array('activate-selected', 'deactivate-selected', 'delete-selected') as $action_key ) { +foreach( array('activate-selected', 'deactivate-selected', 'delete-selected', 'clear-recent-list') as $action_key ) { if( isset($_POST[$action_key]) ) { $action = $action_key; break; @@ -156,11 +156,13 @@ if( !empty($action) ) { <?php require_once('admin-footer.php'); exit; - } - //$delete_result = delete_plugins($plugins); + } //Endif verify-delete + $delete_result = delete_plugins($plugins); wp_cache_delete('plugins', 'plugins'); - + break; + case 'clear-recent-list': + update_option('recently_activated', array()); break; } } @@ -204,8 +206,9 @@ validate_active_plugins(); <p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p> <?php +$all_plugins = apply_filters( 'all_plugins', get_plugins() ); $active_plugins = array(); -$available_plugins = array(); +$inactive_plugins = array(); $recent_plugins = array(); $recently_activated = (array)get_option('recently_activated'); @@ -216,8 +219,6 @@ foreach( $recently_activated as $key => $time ) if( $recently_activated != get_option('recently_activated') ) //If array changed, update it. update_option('recently_activated', $recently_activated); -$all_plugins = apply_filters( 'all_plugins', get_plugins() ); - $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); foreach( (array)$all_plugins as $plugin_file => $plugin_data) { @@ -230,13 +231,14 @@ foreach( (array)$all_plugins as $plugin_file => $plugin_data) { if( ! empty($plugin_data['Author']) ) $plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>'; + //Filter into individual sections if ( is_plugin_active($plugin_file) ) { $active_plugins[ $plugin_file ] = $plugin_data; } else { if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated? $recent_plugins[ $plugin_file ] = $plugin_data; else - $available_plugins[ $plugin_file ] = $plugin_data; + $inactive_plugins[ $plugin_file ] = $plugin_data; } } @@ -296,6 +298,7 @@ function print_plugins_table($plugins, $context = '') { } //End print_plugins_table() ?> +<?php if ( ! empty($active_plugins) ) : ?> <h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3> <form method="post" action="<?php echo admin_url('plugins.php') ?>"> <?php wp_nonce_field('bulk-manage-plugins') ?> @@ -310,9 +313,11 @@ function print_plugins_table($plugins, $context = '') { </form> <p><?php printf(__('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?></p> +<?php endif; ?> <?php if ( ! empty($recent_plugins) ) : ?> <h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3> +<p><?php _e('The following plugins were recently active. When a plugin has been inactive for more than 7 days it will be moved to the Inactive plugin list.') ?></p> <form method="post" action="<?php echo admin_url('plugins.php') ?>"> <?php wp_nonce_field('bulk-manage-plugins') ?> @@ -326,20 +331,24 @@ function print_plugins_table($plugins, $context = '') { </form> <?php endif; ?> -<h3 id="available-plugins"><?php _e('Available Plugins') ?></h3> +<?php if ( ! empty($inactive_plugins) ) : ?> +<h3 id="inactive-plugins"><?php _e('Inactive Plugins') ?></h3> <form method="post" action="<?php echo admin_url('plugins.php') ?>"> <?php wp_nonce_field('bulk-manage-plugins') ?> -<?php if ( ! empty($available_plugins) ) : ?> <div class="tablenav"> <div class="alignleft"> <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" /> </div> </div> <br class="clear" /> -<?php print_plugins_table($available_plugins, 'available') ?> +<?php print_plugins_table($inactive_plugins, 'inactive') ?> </form> <?php endif; ?> + +<?php if ( empty($all_plugins) ) : ?> +<p><?php _e('You do not appear to have any plugins available at this time.') ?></p> +<?php endif; ?> <?php if( is_site_admin() ) { ?> <p><?php printf(__('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), PLUGINDIR); ?></p> diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index 8365cfd..56d5a27 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -115,7 +115,7 @@ function aposfix($text) { } // Ajax Requests -$title = wp_specialchars(stripslashes($_GET['t'])); +$title = wp_specialchars(aposfix(stripslashes($_GET['t']))); $selection = str_replace("\n", "<br />", aposfix( stripslashes($_GET['s']) ) ); $url = clean_url($_GET['u']); @@ -136,8 +136,8 @@ if($_REQUEST['ajax'] == 'thickbox') { ?> <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/> </div> - <p><input type="hidden" name="this_photo" value="<?php echo $image; ?>" id="this_photo" /> - <a href="#" class="select"><img src="<?php echo $image; ?>" width="475" alt="<?php echo attribute_escape(__('Click to insert.')); ?>" title="<?php echo attribute_escape(__('Click to insert.')); ?>" /></a></p> + <p><input type="hidden" name="this_photo" value="<?php echo attribute_escape($image); ?>" id="this_photo" /> + <a href="#" class="select"><img src="<?php echo clean_url($image); ?>" width="475" alt="<?php echo attribute_escape(__('Click to insert.')); ?>" title="<?php echo attribute_escape(__('Click to insert.')); ?>" /></a></p> <p id="options"><a href="#" class="select"><?php _e('Insert Image'); ?></a> | <a href="#" class="cancel"><?php _e('Cancel'); ?></a></p> <?php die; @@ -171,14 +171,14 @@ if($_REQUEST['ajax'] == 'thickbox_url') { ?> if($_REQUEST['ajax'] == 'video') { ?> <h2 id="embededcode"><label for="embed_code"><?php _e('Embed Code') ?></label></h2> <div class="titlewrap" > - <textarea name="embed_code" id="embed_code" rows="8" cols="40"><?php echo $selection; ?></textarea> + <textarea name="embed_code" id="embed_code" rows="8" cols="40"><?php echo format_to_edit($selection); ?></textarea> </div> <?php die; } if($_REQUEST['ajax'] == 'photo_images') { function get_images_from_uri($uri) { - if(preg_match('/\.(jpg|png|gif)/', $uri) && !strpos($uri,'blogger.com')) + if(preg_match('/\.(jpg|jpe|jpeg|png|gif)/', $uri) && !strpos($uri,'blogger.com')) return "'".$uri."'"; $content = wp_remote_fopen($uri); @@ -186,7 +186,7 @@ if($_REQUEST['ajax'] == 'photo_images') { $host = parse_url($uri); - $pattern = '/<img ([^>]*)src=(\"|\')(.+?)(\2)([^>\/]*)\/*>/is'; + $pattern = '/<img ([^>]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif))(\2)([^>\/]*)\/*>/is'; preg_match_all($pattern, $content, $matches); if ( empty($matches[1]) ) return ''; @@ -199,7 +199,7 @@ if($_REQUEST['ajax'] == 'photo_images') { else $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src); - $sources[] = $src; + $sources[] = clean_url($src); } return "'" . implode("','", $sources) . "'"; } @@ -400,7 +400,7 @@ if($_REQUEST['ajax'] == 'photo') { ?> case 'quote' : set_menu('quote'); set_title('<?php _e('Quote') ?>'); - set_editor("<blockquote><p><?php echo $selection; ?> </p><p><cite><a href='<?php echo $url; ?>'><?php echo $title; ?> </a> </cite> </p></blockquote>"); + set_editor("<blockquote><p><?php echo format_to_edit($selection); ?> </p><p><cite><a href='<?php echo $url; ?>'><?php echo $title; ?> </a> </cite> </p></blockquote>"); return false; break; case 'video' : @@ -420,8 +420,9 @@ if($_REQUEST['ajax'] == 'photo') { ?> list($domain, $video_id) = split(".com/", $url); $content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /> <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>'; - if(trim($selection) == '') $selection = '<a href="http://www.vimeo.com/' . $video_id . '?pg=embed&sec=' . $video_id . '">' . $title . '</a> on <a href="http://vimeo.com?pg=embed&sec=' . $video_id . '">Vimeo</a>'; - }else { + if ( trim($selection) == '' ) + $selection = '<a href="http://www.vimeo.com/' . $video_id . '?pg=embed&sec=' . $video_id . '">' . $title . '</a> on <a href="http://vimeo.com?pg=embed&sec=' . $video_id . '">Vimeo</a>'; + } else { $content = $selection; } ?> jQuery('#embed_code').prepend('<?php echo htmlentities($content); ?>'); @@ -433,8 +434,8 @@ if($_REQUEST['ajax'] == 'photo') { ?> case 'photo' : set_menu('photo'); set_title('<?php _e('Post') ?>'); - <?php if($selection) { ?> - set_editor("<?php echo $selection; ?>"); + <?php if ($selection) { ?> + set_editor("<?php echo format_to_edit($selection); ?>"); <?php } ?> jQuery('#extra_fields').show(); jQuery('#extra_fields').before('<h2 id="waiting"><img src="images/loading.gif" alt="" /><?php echo js_escape( __( 'Loading...' ) ); ?></h2>'); @@ -499,7 +500,7 @@ if($_REQUEST['ajax'] == 'photo') { ?> <div class="editor_area"> <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2> <div class="editor-container"> - <textarea name="content" id="content" style="width:100%;" class="mceEditor"><?php if($selection) { ?><a href='<?php echo $url ?>'><?php echo $selection ?></a><?php } else { ?><a href='<?php echo $url ?>'><?php echo $title; ?></a><?php } ?></textarea> + <textarea name="content" id="content" style="width:100%;" class="mceEditor"><?php if ($selection) { ?><a href='<?php echo $url ?>'><?php echo format_to_edit($selection) ?></a><?php } else { ?><a href='<?php echo $url ?>'><?php echo $title; ?></a><?php } ?></textarea> </div> </div> </div> diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index a5c78c2..3b657c7 100644 --- a/wp-admin/setup-config.php +++ b/wp-admin/setup-config.php @@ -1,9 +1,10 @@ <?php die(); define('WP_INSTALLING', true); -//These two defines are required to allow us to use require_wp_db() to load the database class while being wp-content/wp-db.php aware +//These three defines are required to allow us to use require_wp_db() to load the database class while being wp-content/wp-db.php aware define('ABSPATH', dirname(dirname(__FILE__)).'/'); define('WPINC', 'wp-includes'); +define('WP_CONTENT_DIR', ABSPATH . 'wp-content'); require_once('../wp-includes/compat.php'); require_once('../wp-includes/functions.php'); @@ -197,7 +197,7 @@ class AtomServer { // check to see if AtomPub is enabled if( !get_option( 'enable_app' ) ) - $this->not_allowed( 'AtomPub services are disabled on this blog. An admin user can enable them at ' . admin_url('options-writing.php') ); + $this->not_allowed( sprintf( __( 'AtomPub services are disabled on this blog. An admin user can enable them at %s' ), admin_url('options-writing.php') ) ); // dispatch foreach($this->selectors as $regex => $funcs) { diff --git a/wp-content/themes/classic/style.css b/wp-content/themes/classic/style.css index 5c8bd4a..04f612d 100644 --- a/wp-content/themes/classic/style.css +++ b/wp-content/themes/classic/style.css @@ -319,3 +319,45 @@ ul.post-meta span.post-meta-key { font-style: normal; text-transform: capitalize; } + +/* Captions & aligment */ +.aligncenter, +dl.aligncenter { + display: block; + margin-left: auto; + margin-right: auto; +} + +.alignleft { + float: left; +} + +.alignright { + 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; +} +/* End captions & aligment */ diff --git a/wp-content/themes/default/style.css b/wp-content/themes/default/style.css index b927278..ba84cb1 100644 --- a/wp-content/themes/default/style.css +++ b/wp-content/themes/default/style.css @@ -638,6 +638,41 @@ a img { +/* Captions */ +.aligncenter, +dl.aligncenter { + display: block; + margin-left: auto; + margin-right: auto; +} + +.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; +} +/* End captions */ + + /* "Daisy, Daisy, give me your answer do. I'm half crazy all for the love of you. It won't be a stylish marriage, I can't afford a carriage. But you'll look sweet upon the seat of a bicycle built for two." */ 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 ] ) ) |