Title: [197880] trunk/Websites/webkit.org
Revision
197880
Author
[email protected]
Date
2016-03-09 13:30:07 -0800 (Wed, 09 Mar 2016)

Log Message

For RSS feeds, convert image and link relative URIs to absolute URIs
https://bugs.webkit.org/show_bug.cgi?id=155237

Reviewed by Timothy Hatcher.

* wp-content/themes/webkit/functions.php:

Modified Paths

Diff

Modified: trunk/Websites/webkit.org/ChangeLog (197879 => 197880)


--- trunk/Websites/webkit.org/ChangeLog	2016-03-09 21:22:36 UTC (rev 197879)
+++ trunk/Websites/webkit.org/ChangeLog	2016-03-09 21:30:07 UTC (rev 197880)
@@ -1,3 +1,12 @@
+2016-03-09  Jonathan Davis  <[email protected]>
+
+        For RSS feeds, convert image and link relative URIs to absolute URIs
+        https://bugs.webkit.org/show_bug.cgi?id=155237
+
+        Reviewed by Timothy Hatcher.
+
+        * wp-content/themes/webkit/functions.php:
+
 2016-03-03  Saam barati  <[email protected]>
 
         Update style guide to reflect our style of only using "override" or "final" when overriding virtual methods

Modified: trunk/Websites/webkit.org/wp-content/themes/webkit/functions.php (197879 => 197880)


--- trunk/Websites/webkit.org/wp-content/themes/webkit/functions.php	2016-03-09 21:22:36 UTC (rev 197879)
+++ trunk/Websites/webkit.org/wp-content/themes/webkit/functions.php	2016-03-09 21:30:07 UTC (rev 197880)
@@ -51,6 +51,15 @@
     return $title;
 });
 
+// For RSS feeds, convert relative URIs to absolute
+add_filter('the_content', function($content) {
+    if (!is_feed()) return $content;
+    $base = trailingslashit(get_site_url());
+    $content = preg_replace('/<a([^>]*) href="" '<a$1 href="" . $base . '$2"', $content);
+    $content = preg_replace('/<img([^>]*) src="" '<img$1 src="" . $base . '$2"', $content);
+    return $content;
+});
+
 // Hide category 41: Legacy from archives
 add_filter('pre_get_posts', function ($query) {
     if ( $query->is_home() )
@@ -58,7 +67,6 @@
     return $query;
 });
 
-
 include('widgets/post.php');
 include('widgets/icon.php');
 include('widgets/twitter.php');
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to