pike.git / lib / modules / Search.pmod / Filter.pmod / HTML.pmod

version» Context lines:

pike.git/lib/modules/Search.pmod/Filter.pmod/HTML.pmod:10:   inherit .Base;      constant contenttypes = ({ "text/html" });   constant fields = ({ "body", "title", "keywords", "description", "robots",    "headline", "modified", "author", "summary",   #ifdef INTRAWISE    "intrawise.folderid", "intrawise.type",   #endif    });    - static int(0..0) return_zero(mixed ... args) { return 0; } + protected int(0..0) return_zero(mixed ... args) { return 0; }    - static Parser.HTML parser; - static Parser.HTML cleaner; - static mapping entities; + protected Parser.HTML parser; + protected Parser.HTML cleaner; + protected mapping entities;    - static void create() { + protected void create() {    parser = Parser.HTML();    parser->case_insensitive_tag(1);    parser->lazy_entity_end(1);    parser->ignore_unknown(1);    parser->match_tag(0);       parser->add_quote_tag("?", return_zero, "?");       parser->_set_tag_callback(lambda(Parser.HTML p, string data) {    // Do nothing! Callback still needed so that    // unknown tags aren't sent to    // _set_data_callback.    });       constant ignore_tags = ({ "script", "style", });    parser->add_containers(mkmapping(ignore_tags, ({""})*sizeof(ignore_tags)));    - #if __VERSION__ > 7.4 +     cleaner = Parser.html_entity_parser(1); - #else -  cleaner = Parser.html_entity_parser(); -  cleaner->_set_entity_callback( -  lambda(Parser.HTML p,string ent) -  { -  string chr = Parser.decode_numeric_xml_entity(p->tag_name()); -  if (!chr) -  return 0; -  return ({chr}); -  }); - #endif +     cleaner->case_insensitive_tag(1);    cleaner->lazy_entity_end(1);    cleaner->ignore_unknown(1);    cleaner->match_tag(0);       cleaner->add_quote_tag("!--", return_zero, "--");    cleaner->add_quote_tag("?", return_zero, "?");    cleaner->_set_tag_callback(lambda(Parser.HTML p, string data) {    return ({ "" });    });       entities = ([]);    foreach(Parser.html_entities; string i; string v)    entities["&"+i+";"] = v;   }    - static string clean(string data) { + protected string clean(string data) {    return cleaner->finish(data)->read();   }      void parse_http_header(string header, string value, .Output res)   {    switch(lower_case(header))    {    case "robots":    res->fields->robots = (stringp(res->fields->robots)?    res->fields->robots+",": "") +