function DrupalAddFeedTestCase::urlToRSSLinkPattern

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 3256

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.