1 common.test CommonBackdropAddFeedTestCase::urlToRSSLinkPattern($url, $title = '')

Create a pattern representing the RSS feed in the page.

File

core/modules/simpletest/tests/common.test, line 3269
Tests for common.inc functionality.

Class

CommonBackdropAddFeedTestCase
Basic tests for backdrop_add_feed().

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;
}