function AddFeedTest::urlToRSSLinkPattern

Creates a pattern representing the RSS feed in the page.

1 call to AddFeedTest::urlToRSSLinkPattern()
AddFeedTest::testBasicFeedAddNoTitle in drupal/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php
Tests drupal_add_feed() with paths, URLs, and titles.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php, line 86
Definition of Drupal\system\Tests\Common\AddFeedTest.

Class

AddFeedTest
Tests drupal_add_feed().

Namespace

Drupal\system\Tests\Common

Code

function urlToRSSLinkPattern($url, $title = '') {

  // Escape any regular expression characters in the URL ('?' is the worst).
  $url = preg_replace('/([+?.*])/', '[$0]', $url);
  $generated_pattern = '%<link +rel="alternate" +type="application/rss.xml" +title="' . $title . '" +href="' . $url . '" */>%';
  return $generated_pattern;
}