Plugin Directory

Changeset 2301475


Ignore:
Timestamp:
05/09/2020 10:04:08 AM (6 years ago)
Author:
vthierry
Message:

from makefile

Location:
http-syndication/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • http-syndication/trunk/http_syndication.php

    r2260538 r2301475  
    6161      return $request;
    6262  }
    63 
    6463  // Implements the internal or external import shortcode
    6564  function import_shortcode($atts, $content) {
     
    144143  //
    145144
     145  // Adds the mediawiki url query
    146146  function http_syndication_url_mediawiki($url) {
    147147    return $url . (parse_url($url, PHP_URL_QUERY) === NULL ? "?" : "&") . "printable=yes&action=render";
    148148  }
    149149
     150  // Adds the syndication url query
    150151  function http_syndication_url_httpsyndication($url) {
    151152    return $url . (parse_url($url, PHP_URL_QUERY) === NULL ? "?" : "&") . "httpsyndication";
    152153  }
    153 
     154  // Returns the body content
    154155  function http_syndication_content_body($content) {
    155156    $pos = http_syndication::html_tag_pos($content, "body");
    156157    return $pos === FALSE ? $content : substr($content, $pos['start'], $pos['stop'] - $pos['start']);
    157158  }
    158 
     159  // Returns the content without any script
    159160  function http_syndication_content_noscript($content) {
    160161    while (true) {
     
    167168    }
    168169  }
    169  
     170  // Returns the contents associated to a tag
    170171  function http_syndication_content_tag_name($content, $atts) {
    171172    $result = "";
     
    181182    }
    182183  }
     184  // Returns the content associated to a tag id attribute
    183185  function http_syndication_content_tag_id($content, $atts) {
    184186    return $this->http_syndication_content_att($content, "id", $atts['tag_id'], $atts);
    185187  }
     188  // Returns the content associated to a tag class attribute
    186189  function http_syndication_content_tag_class($content, $atts) {
    187190    return $this->http_syndication_content_att($content, "class", $atts['tag_class'], $atts);
    188191  }
     192  // Parses the content and select the 1st one associated to a given attriburte
    189193  function http_syndication_content_att($content, $att, $id, $atts) {
    190194    $offset = 0;
     
    207211    return $content;
    208212  }
    209 
     213  // Encapsulates the content in a div with a given class or style
    210214  function http_syndication_encapsulate($content, $atts) {
    211215    if (isset($atts['class']) || isset($atts['style']))
     
    216220    return $content;
    217221  }
    218 
     222  // Replaces href by their absolute values
    219223  function http_syndication_content_absolute_href($content, $base) {
    220224    if (preg_match('/<\s*base\s*href=["\']([^"\']*)["\']/', $content, $matches, PREG_OFFSET_CAPTURE, 0) == 1)
     
    273277  }
    274278
    275   // Ensures hat all tags are closed.
     279  // Ensures hat all tags are closed, no more used, juste here for info.
    276280  static function html_repair($html_fragment) {
    277281/*
  • http-syndication/trunk/readme.txt

    r2260540 r2301475  
    4949  * `body=1` : in order to only import the `<body..>..</body>` part of the `<html><head>..</head><body..>..</body></html>` page.
    5050  * `tag_id=#id` : only extract the content of the 1st tag of the given id, i.e. the `<#tag id="#id">..</#tag>` part, where `#tag` is any tag (e.g., `div`, `span`, ..).
    51   * `tag_class=#class` : only extract the content of the 1st tag of the given class, i.e. the `<#tag class="#class">..</#tag>` part, where `#tag` is any tag (e.g., `div`, `span`, ..).
     51  * `tag_class=#class` : only extract the content of the 1st tag of the given class, i.e. the `<#tag class="#class">..</#tag>` part, where `#tag` is any tag (e.g., `div`, `span`, ..); the value `#class` can be a regex to deal with multiple defined classes.
    5252  * `tag_name=#name` : only extract the content of all tags of the given name, i.e. the `<#name ..>..</#name>` part (for code safety only 100 tags can be extracted).
    5353* Content filtering:
Note: See TracChangeset for help on using the changeset viewer.