<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[31693] trunk/src: PressThis:</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/31693">31693</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/31693","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>azaozz</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-03-09 21:48:38 +0000 (Mon, 09 Mar 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>PressThis:
- Filter and select the content on the PHP side. Then pass only the needed data to JS.
- Add the suggested post title and contend directly to the HTML.
- Standardise the data type names.
- Some cleanup/reduction of the code in the bookmarklet.
See <a href="https://core.trac.wordpress.org/ticket/31373">#31373</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsspressthiscss">trunk/src/wp-admin/css/press-this.css</a></li>
<li><a href="#trunksrcwpadminincludesclasswppressthisphp">trunk/src/wp-admin/includes/class-wp-press-this.php</a></li>
<li><a href="#trunksrcwpadminjsbookmarkletjs">trunk/src/wp-admin/js/bookmarklet.js</a></li>
<li><a href="#trunksrcwpadminjsbookmarkletminjs">trunk/src/wp-admin/js/bookmarklet.min.js</a></li>
<li><a href="#trunksrcwpadminjspressthisjs">trunk/src/wp-admin/js/press-this.js</a></li>
<li><a href="#trunksrcwpincludeslinktemplatephp">trunk/src/wp-includes/link-template.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsspressthiscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/press-this.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/press-this.css 2015-03-09 21:16:47 UTC (rev 31692)
+++ trunk/src/wp-admin/css/press-this.css 2015-03-09 21:48:38 UTC (rev 31693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1388,6 +1388,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> margin: 0 auto;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* Make the text inside the editor textarea white. Prevents a "flash" on loading the page */
+#pressthis {
+ color: #fff;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> @media (min-width: 901px) {
</span><span class="cx" style="display: block; padding: 0 10px"> .editor {
</span><span class="cx" style="display: block; padding: 0 10px"> max-width: 760px;
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswppressthisphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/class-wp-press-this.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-press-this.php 2015-03-09 21:16:47 UTC (rev 31692)
+++ trunk/src/wp-admin/includes/class-wp-press-this.php 2015-03-09 21:48:38 UTC (rev 31693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,6 +14,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class WP_Press_This {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ private $images = array();
+
+ private $embeds = array();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Constructor.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,16 +35,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array Site settings.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function site_settings() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $default_html = array(
- 'quote' => '<blockquote>%1$s</blockquote>',
- 'link' => '<p>' . _x( 'Source:', 'Used in Press This to indicate where the content comes from.' ) .
- ' <em><a href="%1$s">%2$s</a></em></p>',
- );
-
</del><span class="cx" style="display: block; padding: 0 10px"> return array(
</span><span class="cx" style="display: block; padding: 0 10px"> // Used to trigger the bookmarklet update notice.
</span><span class="cx" style="display: block; padding: 0 10px"> // Needs to be set here and in get_shortcut_link() in wp-includes/link-template.php.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'version' => '6',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'version' => '7',
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filter whether or not Press This should redirect the user in the parent window upon save.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -50,16 +48,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param bool false Whether to redirect in parent window or not. Default false.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> 'redirInParent' => apply_filters( 'press_this_redirect_in_parent', false ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Filter the default HTML for the Press This editor.
- *
- * @since 4.2.0
- *
- * @param array $default_html Associative array with two keys: 'quote' where %1$s is replaced with the site description
- * or the selected content, and 'link' there %1$s is link href, %2$s is link text.
- */
- 'html' => apply_filters( 'press_this_suggested_html', $default_html ),
</del><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -435,7 +423,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> private function _process_meta_entry( $meta_name, $meta_value, $data ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( preg_match( '/:?(title|description|keywords)$/', $meta_name ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( preg_match( '/:?(title|description|keywords|site_name)$/', $meta_name ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $data['_meta'][ $meta_name ] = $meta_value;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> switch ( $meta_name ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -444,12 +432,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> case 'og:video:secure_url':
</span><span class="cx" style="display: block; padding: 0 10px"> $meta_value = $this->_limit_embed( $meta_value );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $data['_embed'] ) ) {
- $data['_embed'] = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $data['_embeds'] ) ) {
+ $data['_embeds'] = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $meta_value ) && ! in_array( $meta_value, $data['_embed'] ) ) {
- $data['_embed'][] = $meta_value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $meta_value ) && ! in_array( $meta_value, $data['_embeds'] ) ) {
+ $data['_embeds'][] = $meta_value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -461,12 +449,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> case 'twitter:image':
</span><span class="cx" style="display: block; padding: 0 10px"> $meta_value = $this->_limit_img( $meta_value );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $data['_img'] ) ) {
- $data['_img'] = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $data['_images'] ) ) {
+ $data['_images'] = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $meta_value ) && ! in_array( $meta_value, $data['_img'] ) ) {
- $data['_img'][] = $meta_value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $meta_value ) && ! in_array( $meta_value, $data['_images'] ) ) {
+ $data['_images'][] = $meta_value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -477,7 +465,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Fetches and parses _meta, _img, and _links data from the source.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Fetches and parses _meta, _images, and _links data from the source.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @access public
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -521,8 +509,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Fetch and gather <img> data.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( empty( $data['_img'] ) ) {
- $data['_img'] = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( empty( $data['_images'] ) ) {
+ $data['_images'] = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( preg_match_all( '/<img [^>]+>/', $source_content, $matches ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -537,16 +525,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( preg_match( '/src=(\'|")([^\'"]+)\\1/i', $value, $new_matches ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $src = $this->_limit_img( $new_matches[2] );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $src ) && ! in_array( $src, $data['_img'] ) ) {
- $data['_img'][] = $src;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $src ) && ! in_array( $src, $data['_images'] ) ) {
+ $data['_images'][] = $src;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Fetch and gather <iframe> data.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( empty( $data['_embed'] ) ) {
- $data['_embed'] = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( empty( $data['_embeds'] ) ) {
+ $data['_embeds'] = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( preg_match_all( '/<iframe [^>]+>/', $source_content, $matches ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -556,8 +544,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( preg_match( '/src=(\'|")([^\'"]+)\\1/', $value, $new_matches ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $src = $this->_limit_embed( $new_matches[2] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $src ) && ! in_array( $src, $data['_embed'] ) ) {
- $data['_embed'][] = $src;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $src ) && ! in_array( $src, $data['_embeds'] ) ) {
+ $data['_embeds'][] = $src;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -572,13 +560,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $items = $this->_limit_array( $matches[0] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $items as $value ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( preg_match( '/(rel|itemprop)="([^"]+)"[^>]+href="([^"]+)"/', $value, $new_matches ) ) {
- if ( 'alternate' === $new_matches[2] || 'thumbnailUrl' === $new_matches[2] || 'url' === $new_matches[2] ) {
- $url = $this->_limit_url( $new_matches[3] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( preg_match( '/rel=["\'](canonical|shortlink|icon)["\']/i', $value, $matches_rel ) && preg_match( '/href=[\'"]([^\'" ]+)[\'"]/i', $value, $matches_url ) ) {
+ $rel = $matches_rel[1];
+ $url = $this->_limit_url( $matches_url[1] );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $url ) && empty( $data['_links'][ $new_matches[2] ] ) ) {
- $data['_links'][ $new_matches[2] ] = $url;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $url ) && empty( $data['_links'][ $rel ] ) ) {
+ $data['_links'][ $rel ] = $url;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -600,7 +587,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Only instantiate the keys we want. Sanity check and sanitize each one.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( array( 'u', 's', 't', 'v', '_version' ) as $key ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( array( 'u', 's', 't', 'v' ) as $key ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $_POST[ $key ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $value = wp_unslash( $_POST[ $key ] );
</span><span class="cx" style="display: block; padding: 0 10px"> } else if ( ! empty( $_GET[ $key ] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -629,49 +616,57 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( apply_filters( 'enable_press_this_media_discovery', true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * If no title, _img, _embed, and _meta was passed via $_POST, fetch data from source as fallback,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * If no title, _images, _embed, and _meta was passed via $_POST, fetch data from source as fallback,
</ins><span class="cx" style="display: block; padding: 0 10px"> * making PT fully backward compatible with the older bookmarklet.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $_POST ) && ! empty( $data['u'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $this->source_data_fetch_fallback( $data['u'], $data );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( array( '_img', '_embed', '_meta' ) as $type ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( array( '_images', '_embeds' ) as $type ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $_POST[ $type ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $data[ $type ] = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $items = $this->_limit_array( $_POST[ $type ] );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $items = wp_unslash( $items );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $items as $key => $value ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! is_numeric( $key ) ) {
- $key = $this->_limit_string( wp_unslash( $key ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $type === '_images' ) {
+ $value = $this->_limit_img( wp_unslash( $value ) );
+ } else {
+ $value = $this->_limit_embed( wp_unslash( $value ) );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Sanity check. $key is usually things like 'title', 'description', 'keywords', etc.
- if ( empty( $key ) || strlen( $key ) > 100 ) {
- continue;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $value ) ) {
+ $data[ $type ][] = $value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( array( '_meta', '_links' ) as $type ) {
+ if ( empty( $_POST[ $type ] ) ) {
+ continue;
+ }
+
+ $data[ $type ] = array();
+ $items = $this->_limit_array( $_POST[ $type ] );
+
+ foreach ( $items as $key => $value ) {
+ // Sanity check. These are associative arrays, $key is usually things like 'title', 'description', 'keywords', etc.
+ if ( empty( $key ) || strlen( $key ) > 100 ) {
+ continue;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $type === '_meta' ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $value = $this->_limit_string( $value );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $value = $this->_limit_string( wp_unslash( $value ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $value ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $this->_process_meta_entry( $key, $value, $data );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if ( $type === '_img' ) {
- $value = $this->_limit_img( $value );
-
- if ( ! empty( $value ) ) {
- $data[ $type ][] = $value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ if ( in_array( $key, array( 'canonical', 'shortlink', 'icon' ), true ) ) {
+ $data[ $type ][ $key ] = $this->_limit_url( wp_unslash( $value ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if ( $type === '_embed' ) {
- $value = $this->_limit_embed( $value );
-
- if ( ! empty( $value ) ) {
- $data[ $type ][] = $value;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -749,6 +744,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <label for="post-format-<?php echo $attr_format ?>" class="post-format-icon post-format-<?php echo $attr_format; ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </fieldset>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -851,6 +847,194 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Get a list of embeds with no duplicates.
+ *
+ * @param array $data The site's data.
+ * @returns array
+ */
+ public function get_embeds( $data ) {
+ $selected_embeds = array();
+
+ if ( ! empty( $data['_embeds'] ) ) {
+ foreach( $data['_embeds'] as $src ) {
+ $prot_relative_src = preg_replace( '/^https?:/', '', $src );
+
+ if ( in_array( $prot_relative_src, $this->embeds ) ) {
+ continue;
+ }
+
+ $selected_embeds[] = $src;
+ $this->embeds[] = $prot_relative_src;
+ }
+ }
+
+ return $selected_embeds;
+ }
+
+ /**
+ * Get a list of images with no duplicates.
+ *
+ * @param array $data The site's data.
+ * @returns array
+ */
+ public function get_images( $data ) {
+ $selected_images = array();
+
+ if ( ! empty( $data['_images'] ) ) {
+ foreach( $data['_images'] as $src ) {
+ if ( false !== strpos( $src, 'gravatar.com' ) ) {
+ $src = preg_replace( '%http://[\d]+\.gravatar\.com/%', 'https://secure.gravatar.com/', $src );
+ }
+
+ $prot_relative_src = preg_replace( '/^https?:/', '', $src );
+
+ if ( in_array( $prot_relative_src, $this->images ) ||
+ ( false !== strpos( $src, 'avatar' ) && count( $this->images ) > 15 ) ) {
+ // Skip: already selected or some type of avatar and we've already gathered more than 15 images.
+ continue;
+ }
+
+ $selected_images[] = $src;
+ $this->images[] = $prot_relative_src;
+ }
+ }
+
+ return $selected_images;
+ }
+
+ /**
+ * Gets the source page's canonical link, based on passed location and meta data.
+ *
+ * @param array $data The site's data.
+ * @returns string Discovered canonical URL, or empty
+ */
+ public function get_canonical_link( $data ) {
+ $link = '';
+
+ if ( ! empty( $data['_links']['canonical'] ) ) {
+ $link = $data['_links']['canonical'];
+ } elseif ( ! empty( $data['u'] ) ) {
+ $link = $data['u'];
+ } elseif ( ! empty( $data['_meta'] ) ) {
+ if ( ! empty( $data['_meta']['twitter:url'] ) ) {
+ $link = $data['_meta']['twitter:url'];
+ } else if ( ! empty( $data['_meta']['og:url'] ) ) {
+ $link = $data['_meta']['og:url'];
+ }
+ }
+
+ if ( empty( $link ) && ! empty( $data['_links']['shortlink'] ) ) {
+ $link = $data['_links']['shortlink'];
+ }
+
+ return $link;
+ }
+
+ /**
+ * Gets the source page's site name, based on passed meta data.
+ *
+ * @param array $data The site's data.
+ * @returns string Discovered site name, or empty
+ */
+ public function get_source_site_name( $data ) {
+ $name = '';
+
+ if ( ! empty( $data['_meta'] ) ) {
+ if ( ! empty( $data['_meta']['og:site_name'] ) ) {
+ $name = $data['_meta']['og:site_name'];
+ } else if ( ! empty( $data['_meta']['application-name'] ) ) {
+ $name = $data['_meta']['application-name'];
+ }
+ }
+
+ return $name;
+ }
+
+ /**
+ * Gets the source page's title, based on passed title and meta data.
+ *
+ * @param array $data The site's data.
+ * @returns string Discovered page title, or empty
+ */
+ public function get_suggested_title( $data ) {
+ $title = '';
+
+ if ( ! empty( $data['t'] ) ) {
+ $title = $data['t'];
+ } elseif( ! empty( $data['_meta'] ) ) {
+ if ( ! empty( $data['_meta']['twitter:title'] ) ) {
+ $title = $data['_meta']['twitter:title'];
+ } else if ( ! empty( $data['_meta']['og:title'] ) ) {
+ $title = $data['_meta']['og:title'];
+ } else if ( ! empty( $data['_meta']['title'] ) ) {
+ $title = $data['_meta']['title'];
+ }
+ }
+
+ return $title;
+ }
+
+ /**
+ * Gets the source page's suggested content, based on passed data (description, selection, etc).
+ * Features a blockquoted excerpt, as well as content attribution, if any.
+ *
+ * @param array $data The site's data.
+ * @returns string Discovered content, or empty
+ */
+ public function get_suggested_content( $data ) {
+ $content = $text = '';
+
+ if ( ! empty( $data['s'] ) ) {
+ $text = $data['s'];
+ } else if ( ! empty( $data['_meta'] ) ) {
+ if ( ! empty( $data['_meta']['twitter:description'] ) ) {
+ $text = $data['_meta']['twitter:description'];
+ } else if ( ! empty( $data['_meta']['og:description'] ) ) {
+ $text = $data['_meta']['og:description'];
+ } else if ( ! empty( $data['_meta']['description'] ) ) {
+ $text = $data['_meta']['description'];
+ }
+ }
+
+ $default_html = array(
+ 'quote' => '<blockquote>%1$s</blockquote>',
+ 'link' => '<p>' . _x( 'Source:', 'Used in Press This to indicate where the content comes from.' ) .
+ ' <em><a href="%1$s">%2$s</a></em></p>',
+ );
+
+ /**
+ * Filter the default HTML for the Press This editor.
+ *
+ * @since 4.2.0
+ *
+ * @param array $default_html Associative array with two keys: 'quote' where %1$s is replaced with the site description
+ * or the selected content, and 'link' there %1$s is link href, %2$s is link text.
+ */
+ $default_html = apply_filters( 'press_this_suggested_html', $default_html, $data );
+
+ // Wrap suggested content in the specified HTML.
+ if ( ! empty( $default_html['quote'] ) ) {
+ $content = sprintf( $default_html['quote'], $text );
+ }
+
+ // Add source attribution if there is one available.
+ if ( ! empty( $default_html['link'] ) ) {
+ $title = $this->get_suggested_title( $data );
+ $url = $this->get_canonical_link( $data );
+
+ if ( ! $title ) {
+ $title = $this->get_source_site_name( $data );
+ }
+
+ if ( $url && $title ) {
+ $content .= sprintf( $default_html['link'], $url, $title );
+ }
+ }
+
+ return $content;
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Serves the app's base HTML, which in turns calls the load script.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -862,12 +1046,34 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Get data, new (POST) and old (GET).
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $this->merge_or_fetch_data();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post_title = $this->get_suggested_title( $data );
+
+ if ( empty( $title ) ) {
+ $title = __( 'New Post' );
+ }
+
+ $post_content = $this->get_suggested_content( $data );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Get site settings array/data.
</span><span class="cx" style="display: block; padding: 0 10px"> $site_settings = $this->site_settings();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Set the passed data.
- $data['_version'] = $site_settings['version'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Pass the images and embeds
+ $images = $this->get_images( $data );
+ $embeds = $this->get_embeds( $data );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $site_data = array(
+ 'v' => ! empty( $data['v'] ) ? $data['v'] : '',
+ 'hasData' => ! empty( $data ),
+ );
+
+ if ( ! empty( $images ) ) {
+ $site_data['_images'] = $images;
+ }
+
+ if ( ! empty( $embeds ) ) {
+ $site_data['_embeds'] = $embeds;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Add press-this-editor.css and remove theme's editor-style.css, if any.
</span><span class="cx" style="display: block; padding: 0 10px"> remove_editor_styles();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -890,8 +1096,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <title><?php esc_html_e( 'Press This!' ) ?></title>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <script>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- window.wpPressThisData = <?php echo wp_json_encode( $data ) ?>;
- window.wpPressThisConfig = <?php echo wp_json_encode( $site_settings ) ?>;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ window.wpPressThisData = <?php echo wp_json_encode( $site_data ); ?>;
+ window.wpPressThisConfig = <?php echo wp_json_encode( $site_settings ); ?>;
</ins><span class="cx" style="display: block; padding: 0 10px"> </script>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <script type="text/javascript">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -959,7 +1165,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
</span><span class="cx" style="display: block; padding: 0 10px"> $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> /** This filter is documented in wp-admin/admin-header.php */
</span><span class="cx" style="display: block; padding: 0 10px"> $admin_body_classes = apply_filters( 'admin_body_class', '' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1007,7 +1213,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <div id='app-container' class="editor">
</span><span class="cx" style="display: block; padding: 0 10px"> <span id="title-container-label" class="post-title-placeholder" aria-hidden="true"><?php _e( 'Post title' ); ?></span>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <h2 id="title-container" class="post-title" contenteditable="true" spellcheck="true" aria-label="<?php esc_attr_e( 'Post title' ); ?>" tabindex="0"></h2>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <h2 id="title-container" class="post-title" contenteditable="true" spellcheck="true" aria-label="<?php esc_attr_e( 'Post title' ); ?>" tabindex="0"><?php echo esc_html( $post_title ); ?></h2>
</ins><span class="cx" style="display: block; padding: 0 10px"> <div id='featured-media-container' class="featured-container no-media">
</span><span class="cx" style="display: block; padding: 0 10px"> <div id='all-media-widget' class="all-media">
</span><span class="cx" style="display: block; padding: 0 10px"> <div id='all-media-container'></div>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1015,7 +1221,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_editor( '', 'pressthis', array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_editor( $post_content, 'pressthis', array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'drag_drop_upload' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'editor_height' => 600,
</span><span class="cx" style="display: block; padding: 0 10px"> 'media_buttons' => false,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1039,7 +1245,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <div class="options-panel-back is-hidden" tabindex="-1"></div>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div class="options-panel-back is-hidden" tabindex="-1"></div>
</ins><span class="cx" style="display: block; padding: 0 10px"> <div class="options-panel is-off-screen is-hidden" tabindex="-1">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="post-options">
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpadminjsbookmarkletjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/bookmarklet.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/bookmarklet.js 2015-03-09 21:16:47 UTC (rev 31692)
+++ trunk/src/wp-admin/js/bookmarklet.js 2015-03-09 21:48:38 UTC (rev 31693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,7 +31,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> selection = document.selection.createRange().text || '';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- pt_url += ( pt_url.indexOf( '?' ) > -1 ? '&' : '?' ) + 'buster=' + ( new Date().getTime() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ pt_url += '&buster=' + ( new Date().getTime() );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! canPost ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( document.title ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -68,18 +68,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> form.appendChild( input );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( href.match( /\/\/www\.youtube\.com\/watch/ ) ) {
- add( '_embed[]', href );
- } else if ( href.match( /\/\/vimeo\.com\/(.+\/)?([\d]+)$/ ) ) {
- add( '_embed[]', href );
- } else if ( href.match( /\/\/(www\.)?dailymotion\.com\/video\/.+$/ ) ) {
- add( '_embed[]', href );
- } else if ( href.match( /\/\/soundcloud\.com\/.+$/ ) ) {
- add( '_embed[]', href );
- } else if ( href.match( /\/\/twitter\.com\/[^\/]+\/status\/[\d]+$/ ) ) {
- add( '_embed[]', href );
- } else if ( href.match( /\/\/vine\.co\/v\/[^\/]+/ ) ) {
- add( '_embed[]', href );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( href.match( /\/\/www\.youtube\.com\/watch/ ) ||
+ href.match( /\/\/vimeo\.com\/(.+\/)?([\d]+)$/ ) ||
+ href.match( /\/\/(www\.)?dailymotion\.com\/video\/.+$/ ) ||
+ href.match( /\/\/soundcloud\.com\/.+$/ ) ||
+ href.match( /\/\/twitter\.com\/[^\/]+\/status\/[\d]+$/ ) ||
+ href.match( /\/\/vine\.co\/v\/[^\/]+/ ) ) {
+
+ add( '_embeds[]', href );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> metas = head.getElementsByTagName( 'meta' ) || [];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -111,20 +107,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var g = links[ y ],
</span><span class="cx" style="display: block; padding: 0 10px"> g_rel = g.getAttribute( 'rel' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( g_rel ) {
- switch ( g_rel ) {
- case 'canonical':
- case 'icon':
- case 'shortlink':
- add( '_links[' + g_rel + ']', g.getAttribute( 'href' ) );
- break;
- case 'alternate':
- if ( 'application/json+oembed' === g.getAttribute( 'type' ) ) {
- add( '_links[' + g_rel + ']', g.getAttribute( 'href' ) );
- } else if ( 'handheld' === g.getAttribute( 'media' ) ) {
- add( '_links[' + g_rel + ']', g.getAttribute( 'href' ) );
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( g_rel === 'canonical' || g_rel === 'icon' || g_rel === 'shortlink' ) {
+ add( '_links[' + g_rel + ']', g.getAttribute( 'href' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -147,7 +131,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> img.src = imgs[ n ].src;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( img.width >= 256 && img.height >= 128 ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add( '_img[]', img.src );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add( '_images[]', img.src );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -158,7 +142,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add( '_embed[]', ifrs[ p ].src );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add( '_embeds[]', ifrs[ p ].src );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( document.title ) {
</span></span></pre></div>
<a id="trunksrcwpadminjsbookmarkletminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/bookmarklet.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/bookmarklet.min.js 2015-03-09 21:16:47 UTC (rev 31692)
+++ trunk/src/wp-admin/js/bookmarklet.min.js 2015-03-09 21:48:38 UTC (rev 31693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-(function(a,b,c,d){function e(a,c){if("undefined"!=typeof c){var d=b.createElement("input");d.name=a,d.value=c,d.type="hidden",o.appendChild(d)}}var f,g,h,i,j,k,l,m,n=a.encodeURIComponent,o=b.createElement("form"),p=b.getElementsByTagName("head")[0],q=new Image,r="_press_this_app",s=!0;if(d){if(!c.match(/^https?:/))return void(top.location.href=d);if(d+="&u="+n(c),c.match(/^https:/)&&d.match(/^http:/)&&(s=!1),a.getSelection?m=a.getSelection()+"":b.getSelection?m=b.getSelection()+"":b.selection&&(m=b.selection.createRange().text||""),d+=(d.indexOf("?")>-1?"&":"?")+"buster="+(new Date).getTime(),s||(b.title&&(d+="&t="+n(b.title.substr(0,256))),m&&(d+="&s="+n(m.substr(0,512))
)),f=a.outerWidth||b.documentElement.clientWidth||600,g=a.outerHeight||b.documentElement.clientHeight||700,f=800>f||f>5e3?600:.7*f,g=800>g||g>3e3?700:.9*g,!s)return void a.open(d,r,"location,resizable,scrollbars,width="+f+",height="+g);c.match(/\/\/www\.youtube\.com\/watch/)?e("_embed[]",c):c.match(/\/\/vimeo\.com\/(.+\/)?([\d]+)$/)?e("_embed[]",c):c.match(/\/\/(www\.)?dailymotion\.com\/video\/.+$/)?e("_embed[]",c):c.match(/\/\/soundcloud\.com\/.+$/)?e("_embed[]",c):c.match(/\/\/twitter\.com\/[^\/]+\/status\/[\d]+$/)?e("_embed[]",c):c.match(/\/\/vine\.co\/v\/[^\/]+/)&&e("_embed[]",c),h=p.getElementsByTagName("meta")||[];for(var t=0;t<h.length&&!(t>=50);t++){var u=h[t],v=u.getAttribute("name"),w=u.getAttribute("property"),x=u.getAttribute("content");v?e("_meta["+v+"]",x):w&&e("_meta["+w+"]&
quot;,x)}i=p.getElementsByTagName("link")||[];for(var y=0;y<i.length&&!(y>=50);y++){var z=i[y],A=z.getAttribute("rel");if(A)switch(A){case"canonical":case"icon":case"shortlink":e("_links["+A+"]",z.getAttribute("href"));break;case"alternate":"application/json+oembed"===z.getAttribute("type")?e("_links["+A+"]",z.getAttribute("href")):"handheld"===z.getAttribute("media")&&e("_links["+A+"]",z.getAttribute("href"))}}b.body.getElementsByClassName&&(j=b.body.getElementsByClassName("hfeed")[0]),j=b.getElementById("content")||j||b.body,k=j.getElementsByTagName("img")||[];for(var B=0;B<k.length&&!(B>=50);B++)k[B].src.indexOf("avatar")>-1||k[B].className.indexOf("avatar")>-1||(q.src=k[B].src,q.width>=256&a
mp;&q.height>=128&&e("_img[]",q.src));l=b.body.getElementsByTagName("iframe")||[];for(var C=0;C<l.length&&!(C>=50);C++)e("_embed[]",l[C].src);b.title&&e("t",b.title),m&&e("s",m),o.setAttribute("method","POST"),o.setAttribute("action",d),o.setAttribute("target",r),o.setAttribute("style","display: none;"),a.open("about:blank",r,"location,resizable,scrollbars,width="+f+",height="+g),b.body.appendChild(o),o.submit()}})(window,document,top.location.href,window.pt_url);
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+(function(a,b,c,d){function e(a,c){if("undefined"!=typeof c){var d=b.createElement("input");d.name=a,d.value=c,d.type="hidden",o.appendChild(d)}}var f,g,h,i,j,k,l,m,n=a.encodeURIComponent,o=b.createElement("form"),p=b.getElementsByTagName("head")[0],q=new Image,r="_press_this_app",s=!0;if(d){if(!c.match(/^https?:/))return void(top.location.href=d);if(d+="&u="+n(c),c.match(/^https:/)&&d.match(/^http:/)&&(s=!1),a.getSelection?m=a.getSelection()+"":b.getSelection?m=b.getSelection()+"":b.selection&&(m=b.selection.createRange().text||""),d+="&buster="+(new Date).getTime(),s||(b.title&&(d+="&t="+n(b.title.substr(0,256))),m&&(d+="&s="+n(m.substr(0,512)))),f=a.outerWidth||b.documentElement.clientWidth||600,g=a.ou
terHeight||b.documentElement.clientHeight||700,f=800>f||f>5e3?600:.7*f,g=800>g||g>3e3?700:.9*g,!s)return void a.open(d,r,"location,resizable,scrollbars,width="+f+",height="+g);(c.match(/\/\/www\.youtube\.com\/watch/)||c.match(/\/\/vimeo\.com\/(.+\/)?([\d]+)$/)||c.match(/\/\/(www\.)?dailymotion\.com\/video\/.+$/)||c.match(/\/\/soundcloud\.com\/.+$/)||c.match(/\/\/twitter\.com\/[^\/]+\/status\/[\d]+$/)||c.match(/\/\/vine\.co\/v\/[^\/]+/))&&e("_embeds[]",c),h=p.getElementsByTagName("meta")||[];for(var t=0;t<h.length&&!(t>=50);t++){var u=h[t],v=u.getAttribute("name"),w=u.getAttribute("property"),x=u.getAttribute("content");v?e("_meta["+v+"]",x):w&&e("_meta["+w+"]",x)}i=p.getElementsByTagName("link")||[];for(var y=0;y<i.length&&!(y>=50);y++){var z=i[y],A=z.getAttribute("rel");("canonical"===A||&
quot;icon"===A||"shortlink"===A)&&e("_links["+A+"]",z.getAttribute("href"))}b.body.getElementsByClassName&&(j=b.body.getElementsByClassName("hfeed")[0]),j=b.getElementById("content")||j||b.body,k=j.getElementsByTagName("img")||[];for(var B=0;B<k.length&&!(B>=50);B++)k[B].src.indexOf("avatar")>-1||k[B].className.indexOf("avatar")>-1||(q.src=k[B].src,q.width>=256&&q.height>=128&&e("_images[]",q.src));l=b.body.getElementsByTagName("iframe")||[];for(var C=0;C<l.length&&!(C>=50);C++)e("_embeds[]",l[C].src);b.title&&e("t",b.title),m&&e("s",m),o.setAttribute("method","POST"),o.setAttribute("action",d),o.setAttribute("target",r),o.setAttribute("style","display: none;"),a.open("about:blank",r,&
quot;location,resizable,scrollbars,width="+f+",height="+g),b.body.appendChild(o),o.submit()}})(window,document,top.location.href,window.pt_url);
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpadminjspressthisjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/press-this.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/press-this.js 2015-03-09 21:16:47 UTC (rev 31692)
+++ trunk/src/wp-admin/js/press-this.js 2015-03-09 21:48:38 UTC (rev 31693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,14 +8,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> saveAlert = false,
</span><span class="cx" style="display: block; padding: 0 10px"> textarea = document.createElement( 'textarea' ),
</span><span class="cx" style="display: block; padding: 0 10px"> sidebarIsOpen = false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- siteConfig = window.wpPressThisConfig || {},
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ settings = window.wpPressThisConfig || {},
</ins><span class="cx" style="display: block; padding: 0 10px"> data = window.wpPressThisData || {},
</span><span class="cx" style="display: block; padding: 0 10px"> smallestWidth = 128,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- interestingImages = getInterestingImages( data ) || [],
- interestingEmbeds = getInterestingEmbeds( data ) || [],
- hasEmptyTitleStr = false,
- suggestedTitleStr = getSuggestedTitle( data ),
- suggestedContentStr = getSuggestedContent( data ),
</del><span class="cx" style="display: block; padding: 0 10px"> hasSetFocus = false,
</span><span class="cx" style="display: block; padding: 0 10px"> catsCache = [],
</span><span class="cx" style="display: block; padding: 0 10px"> isOffScreen = 'is-off-screen',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -75,10 +70,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @returns string Sanitized text.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function sanitizeText( text ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- text = stripTags( text );
- textarea.innerHTML = text;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var _text = stripTags( text );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return stripTags( textarea.value );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ try {
+ textarea.innerHTML = _text;
+ _text = stripTags( textarea.value );
+ } catch ( er ) {}
+
+ return _text;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -99,190 +98,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Gets the source page's canonical link, based on passed location and meta data.
- *
- * @returns string Discovered canonical URL, or empty
- */
- function getCanonicalLink() {
- var link = '';
-
- if ( data._links && data._links.canonical ) {
- link = data._links.canonical;
- }
-
- if ( ! link && data.u ) {
- link = data.u;
- }
-
- if ( ! link && data._meta ) {
- if ( data._meta['twitter:url'] ) {
- link = data._meta['twitter:url'];
- } else if ( data._meta['og:url'] ) {
- link = data._meta['og:url'];
- }
- }
-
- return checkUrl( decodeURI( link ) );
- }
-
- /**
- * Gets the source page's site name, based on passed meta data.
- *
- * @returns string Discovered site name, or empty
- */
- function getSourceSiteName() {
- var name = '';
-
- if ( data._meta ) {
- if ( data._meta['og:site_name'] ) {
- name = data._meta['og:site_name'];
- } else if ( data._meta['application-name'] ) {
- name = data._meta['application-name'];
- }
- }
-
- return sanitizeText( name );
- }
-
- /**
- * Gets the source page's title, based on passed title and meta data.
- *
- * @returns string Discovered page title, or empty
- */
- function getSuggestedTitle() {
- var title = '';
-
- if ( data.t ) {
- title = data.t;
- }
-
- if ( ! title && data._meta ) {
- if ( data._meta['twitter:title'] ) {
- title = data._meta['twitter:title'];
- } else if ( data._meta['og:title'] ) {
- title = data._meta['og:title'];
- } else if ( data._meta.title ) {
- title = data._meta.title;
- }
- }
-
- if ( ! title ) {
- title = __( 'newPost' );
- hasEmptyTitleStr = true;
- }
-
- return sanitizeText( title );
- }
-
- /**
- * Gets the source page's suggested content, based on passed data (description, selection, etc).
- * Features a blockquoted excerpt, as well as content attribution, if any.
- *
- * @returns string Discovered content, or empty
- */
- function getSuggestedContent() {
- var content = '',
- text = '',
- title = getSuggestedTitle(),
- url = getCanonicalLink(),
- siteName = getSourceSiteName();
-
- if ( data.s ) {
- text = data.s;
- } else if ( data._meta ) {
- if ( data._meta['twitter:description'] ) {
- text = data._meta['twitter:description'];
- } else if ( data._meta['og:description'] ) {
- text = data._meta['og:description'];
- } else if ( data._meta.description ) {
- text = data._meta.description;
- }
- }
-
- if ( text && siteConfig.html.quote ) {
- // Wrap suggested content in specified HTML.
- content = siteConfig.html.quote.replace( /%1\$s/g, sanitizeText( text ) );
- }
-
- // Add a source attribution if there is one available.
- if ( url && siteConfig.html.link && ( ( title && __( 'newPost' ) !== title ) || siteName ) ) {
- content += siteConfig.html.link.replace( /%1\$s/g, encodeURI( url ) ).replace( /%2\$s/g, ( title || siteName ) );
- }
-
- return content || '';
- }
-
- /**
- * Get a list of valid embeds from what was passed via WpPressThis_App.data._embed on page load.
- *
- * @returns array
- */
- function getInterestingEmbeds() {
- var embeds = data._embed || [],
- interestingEmbeds = [],
- alreadySelected = [];
-
- if ( embeds.length ) {
- $.each( embeds, function ( i, src ) {
- if ( ! src ) {
- // Skip: no src value
- return;
- }
-
- var schemelessSrc = src.replace( /^https?:/, '' );
-
- if ( $.inArray( schemelessSrc, alreadySelected ) > -1 ) {
- // Skip: already shown
- return;
- }
-
- interestingEmbeds.push( src );
- alreadySelected.push( schemelessSrc );
- } );
- }
-
- return interestingEmbeds;
- }
-
- /**
- * Get a list of valid images from what was passed via WpPressThis_App.data._img and WpPressThis_App.data._meta on page load.
- *
- * @returns array
- */
- function getInterestingImages( data ) {
- var imgs = data._img || [],
- interestingImgs = [],
- alreadySelected = [];
-
- if ( imgs.length ) {
- $.each( imgs, function ( i, src ) {
- src = src.replace( /http:\/\/[\d]+\.gravatar\.com\//, 'https://secure.gravatar.com/' );
- src = checkUrl( src );
-
- if ( ! src ) {
- // Skip: no src value
- return;
- }
-
- var schemelessSrc = src.replace( /^https?:/, '' );
-
- if ( Array.prototype.indexOf && alreadySelected.indexOf( schemelessSrc ) > -1 ) {
- // Skip: already shown
- return;
- } else if ( src.indexOf( 'avatar' ) > -1 && interestingImgs.length >= 15 ) {
- // Skip: some type of avatar and we've already gathered more than 23 diff images to show
- return;
- }
-
- interestingImgs.push( src );
- alreadySelected.push( schemelessSrc );
- } );
- }
-
- return interestingImgs;
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Show UX spinner
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function showSpinner() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -345,7 +160,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> renderError( response.data.errorMessage );
</span><span class="cx" style="display: block; padding: 0 10px"> hideSpinner();
</span><span class="cx" style="display: block; padding: 0 10px"> } else if ( response.data.redirect ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( window.opener && siteConfig.redirInParent ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( window.opener && settings.redirInParent ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="cx" style="display: block; padding: 0 10px"> window.opener.location.href = response.data.redirect;
</span><span class="cx" style="display: block; padding: 0 10px"> } catch( er ) {}
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -456,7 +271,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Hide the form letting users enter a URL to be scanned, if a URL was already passed.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function renderToolsVisibility() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( data.u && data.u.match( /^https?:/ ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( data.hasData ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $( '#scanbar' ).hide();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -495,57 +310,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Prompt user to upgrade their bookmarklet if there is a version mismatch.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( data.v && data._version && ( data.v + '' ) !== ( data._version + '' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( data.v && settings.version && ( data.v + '' ) !== ( settings.version + '' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $( '.should-upgrade-bookmarklet' ).removeClass( 'is-hidden' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Render the suggested title, if any
- */
- function renderSuggestedTitle() {
- var suggestedTitle = suggestedTitleStr || '',
- $title = $( '#title-container' );
-
- if ( ! hasEmptyTitleStr ) {
- $( '#post_title' ).val( suggestedTitle );
- $title.text( suggestedTitle );
- $( '.post-title-placeholder' ).addClass( 'is-hidden' );
- }
-
- $title.on( 'keyup', function() {
- saveAlert = true;
- }).on( 'paste', function() {
- saveAlert = true;
-
- setTimeout( function() {
- $title.text( $title.text() );
- }, 100 );
- } );
-
- }
-
- /**
- * Render the suggested content, if any
- */
- function renderSuggestedContent() {
- if ( ! suggestedContentStr ) {
- return;
- }
-
- if ( ! editor ) {
- editor = window.tinymce.get( 'pressthis' );
- }
-
- if ( editor ) {
- editor.setContent( suggestedContentStr );
- editor.on( 'focus', function() {
- hasSetFocus = true;
- } );
- }
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Render the detected images and embed for selection, if any
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function renderDetectedMedia() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -555,12 +325,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> listContainer.empty();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( interestingEmbeds || interestingImages ) {
- listContainer.append( '<h2 class="screen-reader-text">' + __( 'allMediaHeading' ) + '</h2><ul class="wppt-all-media-list"/>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( data._embeds || data._images ) {
+ listContainer.append( '<h2 class="screen-reader-text">' + __( 'allMediaHeading' ) + '</h2><ul class="wppt-all-media-list" />' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( interestingEmbeds ) {
- $.each( interestingEmbeds, function ( i, src ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( data._embeds ) {
+ $.each( data._embeds, function ( i, src ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> src = checkUrl( src );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> var displaySrc = '',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -601,8 +371,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( interestingImages ) {
- $.each( interestingImages, function ( i, src ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( data._images ) {
+ $.each( data._images, function( i, src ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> src = checkUrl( src );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> var displaySrc = src.replace(/^(http[^\?]+)(\?.*)?$/, '$1');
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -716,25 +486,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Reset to options list
</span><span class="cx" style="display: block; padding: 0 10px"> $( '.post-options' ).removeClass( offscreenHidden );
</span><span class="cx" style="display: block; padding: 0 10px"> $( '.setting-modal').addClass( offscreenHidden );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Interactive behavior for the post title's field placeholder
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function monitorPlaceholder() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var $selector = $( '#title-container'),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $titleField = $( '#title-container'),
</ins><span class="cx" style="display: block; padding: 0 10px"> $placeholder = $('.post-title-placeholder');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $selector.on( 'focus', function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $titleField.on( 'focus', function() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $placeholder.addClass('is-hidden');
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } );
-
- $selector.on( 'blur', function() {
- if ( ! $( this ).text() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).on( 'blur', function() {
+ if ( ! $titleField.text() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $placeholder.removeClass('is-hidden');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+
+ if ( $titleField.text() ) {
+ $placeholder.addClass('is-hidden');
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /* ***************************************************************
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -747,9 +519,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function render(){
</span><span class="cx" style="display: block; padding: 0 10px"> // We're on!
</span><span class="cx" style="display: block; padding: 0 10px"> renderToolsVisibility();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- renderSuggestedTitle();
</del><span class="cx" style="display: block; padding: 0 10px"> renderDetectedMedia();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( document ).on( 'tinymce-editor-init', renderSuggestedContent );
</del><span class="cx" style="display: block; padding: 0 10px"> renderStartupNotices();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( window.tagBox ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -761,13 +531,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Set app events and other state monitoring related code.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function monitor(){
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( document ).on( 'tinymce-editor-init', function( event, ed ) {
+ editor = ed;
+
+ ed.on( 'focus', function() {
+ hasSetFocus = true;
+ } );
+ });
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $( '#current-site a').click( function( e ) {
</span><span class="cx" style="display: block; padding: 0 10px"> e.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Publish and Draft buttons and submit
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Publish, Draft and Preview buttons
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> $( '.post-actions' ).on( 'click.press-this', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var $target = $( event.target );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -876,8 +653,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> refreshCatsCache();
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Expose public methods
- // TODO: which are needed?
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Expose public methods?
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><span class="cx" style="display: block; padding: 0 10px"> renderNotice: renderNotice,
</span><span class="cx" style="display: block; padding: 0 10px"> renderError: renderError
</span></span></pre></div>
<a id="trunksrcwpincludeslinktemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/link-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/link-template.php 2015-03-09 21:16:47 UTC (rev 31692)
+++ trunk/src/wp-includes/link-template.php 2015-03-09 21:48:38 UTC (rev 31693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2600,7 +2600,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function get_shortcut_link() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $is_IE, $wp_version;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $bookmarklet_version = '6';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $bookmarklet_version = '7';
</ins><span class="cx" style="display: block; padding: 0 10px"> $link = '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $is_IE ) {
</span></span></pre>
</div>
</div>
</body>
</html>