function DrupalAddFeedTestCase::urlToRSSLinkPattern

Create a pattern representing the RSS feed in the page.

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

File

drupal/modules/simpletest/tests/common.test, line 3052
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;
}