You are here

function DrupalAddFeedTestCase::urlToRSSLinkPattern in Drupal 7

Create a pattern representing the RSS feed in the page.

1 call to DrupalAddFeedTestCase::urlToRSSLinkPattern()
DrupalAddFeedTestCase::testBasicFeedAddNoTitle in modules/simpletest/tests/common.test
Test drupal_add_feed() with paths, URLs, and titles.

File

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

Class

DrupalAddFeedTestCase
Basic tests for drupal_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;
}