<!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>[213740] trunk/Websites/webkit.org</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">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213740">213740</a></dd>
<dt>Author</dt> <dd>jond@apple.com</dd>
<dt>Date</dt> <dd>2017-03-10 17:01:19 -0800 (Fri, 10 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Switch back to the Twitter API for the Tweet widget
https://bugs.webkit.org/show_bug.cgi?id=168749

Reviewed by Lucas Forschler.

Updates the Twitter widget tile implementation to prefer the Twitter API to populate tweets
displayed through the widget. If the API fails for any reason, it falls back to using the
Tweet listener for updated tweets.

The Twitter API provides the benefit of embedding media and being able to display the full
URLs rather than Twitter-shortened URLs.

* wp-content/plugins/tweet-listener.php:
* wp-content/themes/webkit/style.css:
(.twitter-tile .tile-content):
(.twitter-tile.text-only):
(.twitter-tile .media):
(.twitter-tile img):
* wp-content/themes/webkit/widgets/twitter.php:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebsiteswebkitorgChangeLog">trunk/Websites/webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsiteswebkitorgwpcontentpluginstweetlistenerphp">trunk/Websites/webkit.org/wp-content/plugins/tweet-listener.php</a></li>
<li><a href="#trunkWebsiteswebkitorgwpcontentthemeswebkitstylecss">trunk/Websites/webkit.org/wp-content/themes/webkit/style.css</a></li>
<li><a href="#trunkWebsiteswebkitorgwpcontentthemeswebkitwidgetstwitterphp">trunk/Websites/webkit.org/wp-content/themes/webkit/widgets/twitter.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebsiteswebkitorgChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Websites/webkit.org/ChangeLog (213739 => 213740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/webkit.org/ChangeLog        2017-03-11 00:59:39 UTC (rev 213739)
+++ trunk/Websites/webkit.org/ChangeLog        2017-03-11 01:01:19 UTC (rev 213740)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2017-03-10  Jon Davis  &lt;jond@apple.com&gt;
+
+        Switch back to the Twitter API for the Tweet widget
+        https://bugs.webkit.org/show_bug.cgi?id=168749
+
+        Reviewed by Lucas Forschler.
+        
+        Updates the Twitter widget tile implementation to prefer the Twitter API to populate tweets 
+        displayed through the widget. If the API fails for any reason, it falls back to using the 
+        Tweet listener for updated tweets.
+        
+        The Twitter API provides the benefit of embedding media and being able to display the full 
+        URLs rather than Twitter-shortened URLs.
+
+        * wp-content/plugins/tweet-listener.php:
+        * wp-content/themes/webkit/style.css:
+        (.twitter-tile .tile-content):
+        (.twitter-tile.text-only):
+        (.twitter-tile .media):
+        (.twitter-tile img):
+        * wp-content/themes/webkit/widgets/twitter.php:
+
</ins><span class="cx"> 2017-03-04  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         B3 should have comprehensive support for atomic operations
</span></span></pre></div>
<a id="trunkWebsiteswebkitorgwpcontentpluginstweetlistenerphp"></a>
<div class="modfile"><h4>Modified: trunk/Websites/webkit.org/wp-content/plugins/tweet-listener.php (213739 => 213740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/webkit.org/wp-content/plugins/tweet-listener.php        2017-03-11 00:59:39 UTC (rev 213739)
+++ trunk/Websites/webkit.org/wp-content/plugins/tweet-listener.php        2017-03-11 01:01:19 UTC (rev 213740)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx"> class TweetListener {
</span><span class="cx"> 
</span><span class="cx">     private static $object = null;
</span><del>-    
</del><ins>+
</ins><span class="cx">     const AUTH_TOKEN = TWITTER_LISTENER_AUTH;
</span><span class="cx">     const DATA_KEY = 'recent_tweet';
</span><span class="cx"> 
</span><span class="lines">@@ -28,9 +28,12 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     public function listen() {
</span><del>-        
</del><ins>+
+        if (!isset($_POST['token']) || $_POST['token'] != TWITTER_LISTENER_AUTH)
+            wp_die();
+
</ins><span class="cx">         $defaults = array(
</span><del>-            'text' =&gt; '', 
</del><ins>+            'text' =&gt; '',
</ins><span class="cx">             'username' =&gt; '@webkit',
</span><span class="cx">             'link' =&gt; '',
</span><span class="cx">             'created' =&gt; '',
</span><span class="lines">@@ -41,10 +44,10 @@
</span><span class="cx">         update_option(self::DATA_KEY, $data);
</span><span class="cx">         wp_die();
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     public function tweet() {
</span><span class="cx">         $data = (object)get_option(self::DATA_KEY);
</span><del>-        
</del><ins>+
</ins><span class="cx">         // Setup compatible Tweet structure
</span><span class="cx"> 
</span><span class="cx">         $Tweet = new StdClass();
</span><span class="lines">@@ -64,7 +67,7 @@
</span><span class="cx">                 $Tweet-&gt;entities-&gt;urls[] = $URL;
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-        
</del><ins>+
</ins><span class="cx">         return $Tweet;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebsiteswebkitorgwpcontentthemeswebkitstylecss"></a>
<div class="modfile"><h4>Modified: trunk/Websites/webkit.org/wp-content/themes/webkit/style.css (213739 => 213740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/webkit.org/wp-content/themes/webkit/style.css        2017-03-11 00:59:39 UTC (rev 213739)
+++ trunk/Websites/webkit.org/wp-content/themes/webkit/style.css        2017-03-11 01:01:19 UTC (rev 213740)
</span><span class="lines">@@ -653,6 +653,7 @@
</span><span class="cx">     position: relative;
</span><span class="cx">     box-sizing: border-box;
</span><span class="cx">     font-size: 2rem;
</span><ins>+    text-align: center;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .twitter-tile.text-only {
</span><span class="lines">@@ -659,8 +660,13 @@
</span><span class="cx">     display: -webkit-flex;
</span><span class="cx">     display: flex;
</span><span class="cx">     justify-content: center;
</span><ins>+    text-align: left;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.twitter-tile .media {
+    text-align: center;
+}
+
</ins><span class="cx"> .twitter-tile.text-only .tile-content {
</span><span class="cx">     font-size: 2.5rem;
</span><span class="cx">     font-weight: 400;
</span><span class="lines">@@ -670,8 +676,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .twitter-tile img {
</span><del>-    width: 100%;
</del><ins>+    display: inline-block;
+    width: auto;
</ins><span class="cx">     height: auto;
</span><ins>+    max-width: 100%;
</ins><span class="cx">     max-height: 256px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -699,6 +707,7 @@
</span><span class="cx">     display: inline-block;
</span><span class="cx">     margin: 0 1.3rem;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> .twitter-controls a {
</span><span class="cx">     opacity: 0.66;
</span><span class="cx">     transition: opacity 300ms ease-out;
</span></span></pre></div>
<a id="trunkWebsiteswebkitorgwpcontentthemeswebkitwidgetstwitterphp"></a>
<div class="modfile"><h4>Modified: trunk/Websites/webkit.org/wp-content/themes/webkit/widgets/twitter.php (213739 => 213740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/webkit.org/wp-content/themes/webkit/widgets/twitter.php        2017-03-11 00:59:39 UTC (rev 213739)
+++ trunk/Websites/webkit.org/wp-content/themes/webkit/widgets/twitter.php        2017-03-11 01:01:19 UTC (rev 213740)
</span><span class="lines">@@ -11,6 +11,7 @@
</span><span class="cx"> class WebKitTwitterTileWidget extends WebKitPostTileWidget {
</span><span class="cx"> 
</span><span class="cx">     const CACHEKEY = 'webkit_twitter_feed';
</span><ins>+    const ENDPOINT = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
</ins><span class="cx"> 
</span><span class="cx">     function __construct() {
</span><span class="cx">         parent::WP_Widget(false,
</span><span class="lines">@@ -30,35 +31,31 @@
</span><span class="cx">         if ( empty($Tweet) || empty($Tweet-&gt;text) )
</span><span class="cx">             return $this-&gt;follow_markup($options);
</span><span class="cx"> 
</span><del>-        // Show &quot;Follow @webkit&quot; instead of tweet for blog URLs
-        if ( ! empty($Tweet-&gt;entities)
-                &amp;&amp; ! empty($Tweet-&gt;entities-&gt;urls)
-                &amp;&amp; count($Tweet-&gt;entities-&gt;urls) == 1
-                &amp;&amp; preg_match('!webkit.org/blog/\d+/!', $Tweet-&gt;entities-&gt;urls[0]-&gt;expanded_url) == 1)
-            return $this-&gt;follow_markup($options);
-
</del><span class="cx">         $classes = array('tile', 'third-tile', 'twitter-tile');
</span><del>-
</del><span class="cx">         $text = (string)$options['text'];
</span><ins>+        $link = &quot;https://twitter.com/webkit/status/$Tweet-&gt;id&quot;;
</ins><span class="cx"> 
</span><span class="cx">         if ( ! empty($Tweet-&gt;text) )
</span><span class="cx">             $text = $Tweet-&gt;text;
</span><span class="cx"> 
</span><del>-        if ( ! empty($options['url']) )
-            $url = (string)$options['url'];
-
</del><span class="cx">         // Expand URLs
</span><span class="cx">         foreach ( $Tweet-&gt;entities-&gt;urls as $entry ) {
</span><span class="cx">             $expanded = '&lt;a href=&quot;' . esc_url($entry-&gt;expanded_url) . '&quot;&gt;'
</span><span class="cx">                                  . $entry-&gt;display_url . '&lt;/a&gt;';
</span><ins>+
+            // Don't show webkit.org links, just change the tile to use the link in the tweet
+            if ( preg_match('!webkit.org/.+?!', $entry-&gt;expanded_url) == 1 ) {
+                $expanded = '';
+                $link = $entry-&gt;expanded_url;
+            }
+
</ins><span class="cx">             $text = str_replace($entry-&gt;url, $expanded, $text);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $text = preg_replace('/RT @[^:]+:\s+/', '', $text, 1);
</span><ins>+        if ( ! ( empty($Tweet-&gt;entities) || empty($Tweet-&gt;entities-&gt;media) ) ) {
+            $Image = $Tweet-&gt;entities-&gt;media[0];
</ins><span class="cx"> 
</span><del>-        if ( empty($Tweet-&gt;entities) || empty($Tweet-&gt;entities-&gt;media) ) {
-
-            $Image = $Tweet-&gt;entities-&gt;media[0];
</del><span class="cx">             if ( empty($Image) ) $classes[] = 'text-only';
</span><span class="cx"> 
</span><span class="cx">             // Strip media links
</span><span class="lines">@@ -65,11 +62,13 @@
</span><span class="cx">             foreach ( $Tweet-&gt;entities-&gt;media as $entry ) {
</span><span class="cx">                 $text = str_replace($entry-&gt;url, '', $text);
</span><span class="cx">             }
</span><ins>+        } else {
+            $classes[] = 'text-only';
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         ?&gt;
</span><span class="cx">         &lt;div class=&quot;&lt;?php echo esc_attr(join(' ', $classes)); ?&gt;&quot;&gt;
</span><del>-            &lt;a href=&quot;http://twitter.com/webkit/status/&lt;?php echo esc_attr($Tweet-&gt;id); ?&gt;&quot; class=&quot;tile-link&quot;&gt;Clickable link to tweet&lt;/a&gt;
</del><ins>+            &lt;a href=&quot;&lt;?php echo esc_url($link); ?&gt;&quot; class=&quot;tile-link&quot;&gt;Clickable link to tweet&lt;/a&gt;
</ins><span class="cx">             &lt;div class=&quot;tile-content&quot;&gt;
</span><span class="cx">             &lt;?php if ( ! empty($Image) ): ?&gt;
</span><span class="cx">             &lt;img src=&quot;&lt;?php echo esc_url($Image-&gt;media_url_https); ?&gt;&quot;&gt;
</span><span class="lines">@@ -79,7 +78,7 @@
</span><span class="cx"> 
</span><span class="cx">             &lt;/div&gt;
</span><span class="cx">             &lt;ul class=&quot;twitter-controls&quot;&gt;
</span><del>-                &lt;li&gt;&lt;a href=&quot;https://twitter.com/webkit&quot; target=&quot;twitter-modal&quot;&gt;&lt;span class=&quot;twitter-icon&quot;&gt;Twitter&lt;/span&gt; @webkit&lt;/a&gt;&lt;/li&gt;
</del><ins>+                &lt;li&gt;&lt;a href=&quot;https://twitter.com/webkit&quot; target=&quot;twitter-modal&quot;&gt;&lt;span class=&quot;twitter-icon&quot;&gt;Twitter&lt;/span&gt;@webkit&lt;/a&gt;&lt;/li&gt;
</ins><span class="cx">                 &lt;li&gt;&lt;a href=&quot;https://twitter.com/intent/tweet?in-reply-to=&lt;?php echo esc_attr($Tweet-&gt;id); ?&gt;&quot; class=&quot;twitter-icon reply-icon&quot; target=&quot;twitter-modal&quot;&gt;Reply&lt;/a&gt;&lt;/li&gt;
</span><span class="cx">                 &lt;li&gt;&lt;a href=&quot;https://twitter.com/intent/retweet?tweet_id=&lt;?php echo esc_attr($Tweet-&gt;id); ?&gt;&quot; class=&quot;twitter-icon retweet-icon&quot; target=&quot;twitter-modal&quot;&gt;Retweet&lt;/a&gt;&lt;/li&gt;
</span><span class="cx">                 &lt;li&gt;&lt;a href=&quot;https://twitter.com/intent/favorite?tweet_id=&lt;?php echo esc_attr($Tweet-&gt;id); ?&gt;&quot; class=&quot;twitter-icon favorite-icon&quot; target=&quot;twitter-modal&quot;&gt;Favorite&lt;/a&gt;&lt;/li&gt;
</span><span class="lines">@@ -111,52 +110,45 @@
</span><span class="cx"> 
</span><span class="cx">     function tweet () {
</span><span class="cx"> 
</span><del>-        // Prefer pushed tweet
</del><ins>+        if ( false !== ( $cached = get_transient(self::CACHEKEY) ) )
+            return json_decode($cached);
+
+        // Get pushed Tweet as a fallback
+        $pushedTweet = false;
</ins><span class="cx">         if ( class_exists('TweetListener') ) {
</span><span class="cx">             $TweetListener = TweetListener::object();
</span><del>-            return $TweetListener-&gt;tweet();
</del><ins>+            $pushedTweet = $TweetListener-&gt;tweet();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        // Poll for tweet
-        if ( false !== ( $cached = get_transient(self::CACHEKEY) ) )
-            return json_decode($cached);
-
-        $endpoint = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
</del><ins>+        // Connect to Twitter API
</ins><span class="cx">         $parameters = array();
</span><span class="cx">         $options = array(
</span><span class="cx">             'method' =&gt; 'GET',
</span><span class="cx">         );
</span><span class="cx"> 
</span><del>-        $oauth_consumer_key = 'ypSvRp37vmyt3ldMPhs0e62c9';
-        $oauth_consumer_key_secret = 'mLuYD3AjUehUZKOgQIICA5Na69te45aSJTkdIDTGSg4cfHd6Lz';
-        $oauth_token = '14315023-7pHbcI5bk2QZhNiHR9uFudaksBzMPubEuOEmYj7YQ';
-        $oauth_token_secret = '0K9T9znxG4S9PUGunYZ5LwyKL9AR6v3eAXp6WKY2oi7Bg';
</del><ins>+        list($oauth_consumer_key, $oauth_consumer_key_secret) = explode(':', TWITTER_CONSUMER_KEY);
+        list($oauth_token, $oauth_token_secret) = explode(':', TWITTER_OAUTH_TOKEN);
</ins><span class="cx">         $oauth_timestamp = time();
</span><span class="cx">         $oauth_nonce = sha1(rand() . $oauth_timestamp);
</span><span class="cx"> 
</span><span class="cx">         $fields = array(
</span><span class="cx">             'oauth_consumer_key' =&gt; $oauth_consumer_key,
</span><del>-            'oauth_nonce' =&gt; sha1(rand() . time()),
</del><ins>+            'oauth_nonce' =&gt; $oauth_nonce,
</ins><span class="cx">             'oauth_signature_method' =&gt; 'HMAC-SHA1',
</span><del>-            'oauth_timestamp' =&gt; time(),
</del><ins>+            'oauth_timestamp' =&gt; $oauth_timestamp,
</ins><span class="cx">             'oauth_token' =&gt; $oauth_token,
</span><span class="cx">             'oauth_version' =&gt; '1.0',
</span><span class="cx">         );
</span><span class="cx">         $fields = array_merge($parameters, $fields);
</span><span class="cx"> 
</span><del>-        $base = array(
-            'GET', $endpoint, http_build_query($fields, '', '&amp;')
-        );
-        $base = join('&amp;', array_map('rawurlencode', $base));
</del><ins>+        $requestParts = array('GET', self::ENDPOINT, http_build_query($fields, '', '&amp;'));
+        $request = join('&amp;', array_map('rawurlencode', $requestParts));
</ins><span class="cx"> 
</span><ins>+        $authkeys = array($oauth_consumer_key_secret, $oauth_token_secret);
+        $auth = join('&amp;', array_map('rawurlencode', $authkeys));
</ins><span class="cx"> 
</span><del>-        $key = array(
-            $oauth_consumer_key_secret, $oauth_token_secret
-        );
-        $key = join('&amp;', array_map('rawurlencode', $key));
</del><ins>+        $signature = base64_encode( hash_hmac('sha1', $request, $auth, true) );
</ins><span class="cx"> 
</span><del>-        $signature = base64_encode( hash_hmac('sha1', $base, $key, true) );
-
</del><span class="cx">         $oauth = array(
</span><span class="cx">             'oauth_consumer_key' =&gt; $oauth_consumer_key,
</span><span class="cx">             'oauth_nonce' =&gt; $fields['oauth_nonce'],
</span><span class="lines">@@ -166,8 +158,9 @@
</span><span class="cx">             'oauth_token' =&gt; $oauth_token,
</span><span class="cx">             'oauth_version' =&gt; '1.0',
</span><span class="cx">         );
</span><ins>+
+        // Wrap values in double-quotes.
</ins><span class="cx">         $oauth = array_map(create_function('$h','return &quot;\&quot;$h\&quot;&quot;;'), $oauth);
</span><del>-
</del><span class="cx">         $oauth = http_build_query($oauth, '', ', ');
</span><span class="cx">         $oauth = str_replace('%22', '&quot;', $oauth);
</span><span class="cx"> 
</span><span class="lines">@@ -177,10 +170,10 @@
</span><span class="cx"> 
</span><span class="cx">         $options['headers'] = $headers;
</span><span class="cx"> 
</span><del>-        $response = wp_remote_get($endpoint, $options);
</del><ins>+        $response = wp_remote_get(self::ENDPOINT, $options);
</ins><span class="cx"> 
</span><span class="cx">         if ( is_a($response, 'WP_Error') )
</span><del>-            return false;
</del><ins>+            return $pushedTweet;
</ins><span class="cx"> 
</span><span class="cx">         if ( 200 == $response['response']['code'] &amp;&amp; ! empty($response['body']) ) {
</span><span class="cx">             $body = json_decode($response['body']);
</span><span class="lines">@@ -189,9 +182,14 @@
</span><span class="cx">             return $data;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        return false;
</del><ins>+        return $pushedTweet;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    function isWebKitLink ($Tweet) {
+        return ( ! empty($Tweet-&gt;entities-&gt;urls[0]-&gt;expanded_url)
+                &amp;&amp; preg_match('!webkit.org/.+?!', $Tweet-&gt;entities-&gt;urls[0]-&gt;expanded_url) == 1 );
+    }
+
</ins><span class="cx"> } // END class WebKitTwitterTileWidget
</span><span class="cx"> 
</span><span class="cx"> register_widget('WebKitTwitterTileWidget');
</span><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>