/**
 * @file node-og-group-post.tpl.php
 *
 * Og has added a brief section at bottom for printing links to affiliated groups.
 * This template is used by default for non group nodes.
 *
 * Theme implementation to display a node.
 *
 * Available variables:
 * - $title: the (sanitized) title of the node.
 * - $content: Node body or teaser depending on $teaser flag.
 * - $picture: The authors picture of the node output from
 *   theme_user_picture().
 * - $date: Formatted creation date (use $created to reformat with
 *   format_date()).
 * - $links: Themed links like "Read more", "Add new comment", etc. output
 *   from theme_links().
 * - $name: Themed username of node author output from theme_user().
 * - $node_url: Direct url of the current node.
 * - $terms: the themed list of taxonomy term links output from theme_links().
 * - $submitted: themed submission information output from
 *   theme_node_submitted().
 *
 * Other variables:
 * - $node: Full node object. Contains data that may not be safe.
 * - $type: Node type, i.e. story, page, blog, etc.
 * - $comment_count: Number of comments attached to the node.
 * - $uid: User ID of the node author.
 * - $created: Time the node was published formatted in Unix timestamp.
 * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in
 *   teaser listings.
 * - $id: Position of the node. Increments each time it's output.
 *
 * Node status variables:
 * - $teaser: Flag for the teaser state.
 * - $page: Flag for the full page state.
 * - $promote: Flag for front page promotion state.
 * - $sticky: Flags for sticky post setting.
 * - $status: Flag for published status.
 * - $comment: State of comment settings for the node.
 * - $readmore: Flags false if the teaser content of the node cannot hold the
 *   main body content.
 * - $is_front: Flags false when presented in the front page.
 * - $logged_in: Flags false when the current user is a logged-in member.
 * - $is_admin: Flags false when the current user is an administrator.
 *
 * @see template_preprocess()
 * @see template_preprocess_node()
 */
function print_link($x)
{
    $original = explode('; ', $x);
    // ; followed by space indicates the end of a url
    $temp = array();
    foreach ($original as $value) {
        $temp[] = _filter_url($value);
    }
    $modified = implode('; ', $temp);
    echo $modified;
}
Пример #2
0
 /**
  * Tests URL filter on longer content.
  *
  * Filters based on regular expressions should also be tested with a more
  * complex content than just isolated test lines.
  * The most common errors are:
  * - accidental '*' (greedy) match instead of '*?' (minimal) match.
  * - only matching first occurrence instead of all.
  * - newlines not matching '.*'.
  *
  * This test covers:
  * - Document with multiple newlines and paragraphs (two newlines).
  * - Mix of several HTML tags, invalid non-HTML tags, tags to ignore and HTML
  *   comments.
  * - Empty HTML tags (BR, IMG).
  * - Mix of absolute and partial URLs, and email addresses in one content.
  */
 function testUrlFilterContent()
 {
     // Get FilterUrl object.
     $filter = $this->filters['filter_url'];
     $filter->setConfiguration(array('settings' => array('filter_url_length' => 496)));
     $path = drupal_get_path('module', 'filter') . '/tests';
     $input = file_get_contents($path . '/filter.url-input.txt');
     $expected = file_get_contents($path . '/filter.url-output.txt');
     $result = _filter_url($input, $filter);
     $this->assertIdentical($result, $expected, 'Complex HTML document was correctly processed.');
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function process($text, $langcode)
 {
     return new FilterProcessResult(_filter_url($text, $this));
 }