This page requires admin privileges but Full-Text RSS has not been configured with admin credentials.
If you are the administrator, please edit your custom_config.php file and enter the credentials in the appropriate section. When you\'ve done that, this page will prompt you for your admin credentials.
You are viewing an auto-generated full-text RSS feed. RSS feeds allow you to stay up to date with the latest news and features you want from websites. Subscribe to this feed.
16 |
Below is the latest content available from this feed.
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/extract.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | // Usage
27 | // -----
28 | // Request this file passing it a web page URL in the querystring: extract.php?url=example.org
29 | // You can use GET and POST requests.
30 | // You'll get a simple JSON response:
31 | /*
32 | HTTP/1.0 200 OK
33 | {
34 | "title": "Blowing Smoke with Boxing's Big Voice",
35 | "content"
Content here
More content
",
36 | "author": "Rafi Kohan",
37 | "excerpt": "Short extract from the beginning of the article.",
38 | "language": "en",
39 | "url": "http://example.org/article.html",
40 | "effective_url": "http://example.org/article.html",
41 | "date": "2014-05-10"
42 | }
43 | */
44 |
45 | define('_FF_FTR_MODE', 'simple');
46 |
47 | // Don't process URL as feed
48 | $_POST['accept'] = 'html';
49 | // JSON output only
50 | $_POST['format'] = 'json';
51 | // Enable excerpts
52 | $_POST['summary'] = '1';
53 | // Guess language if it's not already marked up
54 | $_POST['lang'] = '2';
55 | // Don't produce result if extraction fails
56 | // Additional meta elements might still be useful (e.g. og/twitter elements),
57 | // so we're commeting this out from FTR 3.7
58 | //$_POST['exc'] = '1';
59 | // Enable XSS filtering (unless explicitly disabled)
60 | if (isset($_POST['xss']) && $_POST['xss'] !== '0') {
61 | $_POST['xss'] = '1';
62 | } elseif (isset($_GET['xss']) && $_GET['xss'] !== '0') {
63 | $_GET['xss'] = '1';
64 | } else {
65 | $_POST['xss'] = '1';
66 | }
67 |
68 | require 'makefulltextfeed.php';
--------------------------------------------------------------------------------
/images/agplv3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/timothytylee/full-text-rss/384d52fd83361ffd6e7f28bd39b322970a015a28/images/agplv3.png
--------------------------------------------------------------------------------
/js/bootstrap-popover.js:
--------------------------------------------------------------------------------
1 | /* ===========================================================
2 | * bootstrap-popover.js v2.0.3
3 | * http://twitter.github.com/bootstrap/javascript.html#popovers
4 | * ===========================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * =========================================================== */
19 |
20 |
21 | !function ($) {
22 |
23 | "use strict"; // jshint ;_;
24 |
25 |
26 | /* POPOVER PUBLIC CLASS DEFINITION
27 | * =============================== */
28 |
29 | var Popover = function ( element, options ) {
30 | this.init('popover', element, options)
31 | }
32 |
33 |
34 | /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
35 | ========================================== */
36 |
37 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
38 |
39 | constructor: Popover
40 |
41 | , setContent: function () {
42 | var $tip = this.tip()
43 | , title = this.getTitle()
44 | , content = this.getContent()
45 |
46 | $tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title)
47 | $tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content)
48 |
49 | $tip.removeClass('fade top bottom left right in')
50 | }
51 |
52 | , hasContent: function () {
53 | return this.getTitle() || this.getContent()
54 | }
55 |
56 | , getContent: function () {
57 | var content
58 | , $e = this.$element
59 | , o = this.options
60 |
61 | content = $e.attr('data-content')
62 | || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
63 |
64 | return content
65 | }
66 |
67 | , tip: function () {
68 | if (!this.$tip) {
69 | this.$tip = $(this.options.template)
70 | }
71 | return this.$tip
72 | }
73 |
74 | })
75 |
76 |
77 | /* POPOVER PLUGIN DEFINITION
78 | * ======================= */
79 |
80 | $.fn.popover = function (option) {
81 | return this.each(function () {
82 | var $this = $(this)
83 | , data = $this.data('popover')
84 | , options = typeof option == 'object' && option
85 | if (!data) $this.data('popover', (data = new Popover(this, options)))
86 | if (typeof option == 'string') data[option]()
87 | })
88 | }
89 |
90 | $.fn.popover.Constructor = Popover
91 |
92 | $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
93 | placement: 'right'
94 | , content: ''
95 | , template: '
'
96 | })
97 |
98 | }(window.jQuery);
--------------------------------------------------------------------------------
/js/bootstrap-tab.js:
--------------------------------------------------------------------------------
1 | /* ========================================================
2 | * bootstrap-tab.js v2.0.3
3 | * http://twitter.github.com/bootstrap/javascript.html#tabs
4 | * ========================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ======================================================== */
19 |
20 |
21 | !function ($) {
22 |
23 | "use strict"; // jshint ;_;
24 |
25 |
26 | /* TAB CLASS DEFINITION
27 | * ==================== */
28 |
29 | var Tab = function ( element ) {
30 | this.element = $(element)
31 | }
32 |
33 | Tab.prototype = {
34 |
35 | constructor: Tab
36 |
37 | , show: function () {
38 | var $this = this.element
39 | , $ul = $this.closest('ul:not(.dropdown-menu)')
40 | , selector = $this.attr('data-target')
41 | , previous
42 | , $target
43 | , e
44 |
45 | if (!selector) {
46 | selector = $this.attr('href')
47 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
48 | }
49 |
50 | if ( $this.parent('li').hasClass('active') ) return
51 |
52 | previous = $ul.find('.active a').last()[0]
53 |
54 | e = $.Event('show', {
55 | relatedTarget: previous
56 | })
57 |
58 | $this.trigger(e)
59 |
60 | if (e.isDefaultPrevented()) return
61 |
62 | $target = $(selector)
63 |
64 | this.activate($this.parent('li'), $ul)
65 | this.activate($target, $target.parent(), function () {
66 | $this.trigger({
67 | type: 'shown'
68 | , relatedTarget: previous
69 | })
70 | })
71 | }
72 |
73 | , activate: function ( element, container, callback) {
74 | var $active = container.find('> .active')
75 | , transition = callback
76 | && $.support.transition
77 | && $active.hasClass('fade')
78 |
79 | function next() {
80 | $active
81 | .removeClass('active')
82 | .find('> .dropdown-menu > .active')
83 | .removeClass('active')
84 |
85 | element.addClass('active')
86 |
87 | if (transition) {
88 | element[0].offsetWidth // reflow for transition
89 | element.addClass('in')
90 | } else {
91 | element.removeClass('fade')
92 | }
93 |
94 | if ( element.parent('.dropdown-menu') ) {
95 | element.closest('li.dropdown').addClass('active')
96 | }
97 |
98 | callback && callback()
99 | }
100 |
101 | transition ?
102 | $active.one($.support.transition.end, next) :
103 | next()
104 |
105 | $active.removeClass('in')
106 | }
107 | }
108 |
109 |
110 | /* TAB PLUGIN DEFINITION
111 | * ===================== */
112 |
113 | $.fn.tab = function ( option ) {
114 | return this.each(function () {
115 | var $this = $(this)
116 | , data = $this.data('tab')
117 | if (!data) $this.data('tab', (data = new Tab(this)))
118 | if (typeof option == 'string') data[option]()
119 | })
120 | }
121 |
122 | $.fn.tab.Constructor = Tab
123 |
124 |
125 | /* TAB DATA-API
126 | * ============ */
127 |
128 | $(function () {
129 | $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
130 | e.preventDefault()
131 | $(this).tab('show')
132 | })
133 | })
134 |
135 | }(window.jQuery);
--------------------------------------------------------------------------------
/libraries/DisableSimplePieSanitize.php:
--------------------------------------------------------------------------------
1 | infinite lifetime)
68 | * @return boolean true if no problem
69 | */
70 | public function save($data, $id, $tags = array(), $specificLifetime = false);
71 |
72 | /**
73 | * Remove a cache record
74 | *
75 | * @param string $id Cache id
76 | * @return boolean True if no problem
77 | */
78 | public function remove($id);
79 |
80 | /**
81 | * Clean some cache records
82 | *
83 | * Available modes are :
84 | * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used)
85 | * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used)
86 | * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags
87 | * ($tags can be an array of strings or a single string)
88 | * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
89 | * ($tags can be an array of strings or a single string)
90 | * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
91 | * ($tags can be an array of strings or a single string)
92 | *
93 | * @param string $mode Clean mode
94 | * @param array $tags Array of tags
95 | * @return boolean true if no problem
96 | */
97 | public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array());
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/libraries/Zend/Cache/Exception.php:
--------------------------------------------------------------------------------
1 | _previous = $previous;
48 | } else {
49 | parent::__construct($msg, (int) $code, $previous);
50 | }
51 | }
52 |
53 | /**
54 | * Overloading
55 | *
56 | * For PHP < 5.3.0, provides access to the getPrevious() method.
57 | *
58 | * @param string $method
59 | * @param array $args
60 | * @return mixed
61 | */
62 | public function __call($method, array $args)
63 | {
64 | if ('getprevious' == strtolower($method)) {
65 | return $this->_getPrevious();
66 | }
67 | return null;
68 | }
69 |
70 | /**
71 | * String representation of the exception
72 | *
73 | * @return string
74 | */
75 | public function __toString()
76 | {
77 | if (version_compare(PHP_VERSION, '5.3.0', '<')) {
78 | if (null !== ($e = $this->getPrevious())) {
79 | return $e->__toString()
80 | . "\n\nNext "
81 | . parent::__toString();
82 | }
83 | }
84 | return parent::__toString();
85 | }
86 |
87 | /**
88 | * Returns previous Exception
89 | *
90 | * @return Exception|null
91 | */
92 | protected function _getPrevious()
93 | {
94 | return $this->_previous;
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/libraries/feedwriter/FeedItem.php:
--------------------------------------------------------------------------------
1 |
9 | * @link http://www.ajaxray.com/projects/rss
10 | */
11 | class FeedItem
12 | {
13 | private $elements = array(); //Collection of feed elements
14 | private $version;
15 |
16 | /**
17 | * Constructor
18 | *
19 | * @param contant (RSS1/RSS2/ATOM) RSS2 is default.
20 | */
21 | function __construct($version = RSS2)
22 | {
23 | $this->version = $version;
24 | }
25 |
26 | /**
27 | * Set element (overwrites existing elements with $elementName)
28 | *
29 | * @access public
30 | * @param srting The tag name of an element
31 | * @param srting The content of tag
32 | * @param array Attributes(if any) in 'attrName' => 'attrValue' format
33 | * @return void
34 | */
35 | public function setElement($elementName, $content, $attributes = null)
36 | {
37 | if (isset($this->elements[$elementName])) {
38 | unset($this->elements[$elementName]);
39 | }
40 | $this->addElement($elementName, $content, $attributes);
41 | }
42 |
43 | /**
44 | * Add an element to elements array
45 | *
46 | * @access public
47 | * @param srting The tag name of an element
48 | * @param srting The content of tag
49 | * @param array Attributes(if any) in 'attrName' => 'attrValue' format
50 | * @return void
51 | */
52 | public function addElement($elementName, $content, $attributes = null)
53 | {
54 | $i = 0;
55 | if (isset($this->elements[$elementName])) {
56 | $i = count($this->elements[$elementName]);
57 | } else {
58 | $this->elements[$elementName] = array();
59 | }
60 | $this->elements[$elementName][$i]['name'] = $elementName;
61 | $this->elements[$elementName][$i]['content'] = $content;
62 | $this->elements[$elementName][$i]['attributes'] = $attributes;
63 | }
64 |
65 | /**
66 | * Set multiple feed elements from an array.
67 | * Elements which have attributes cannot be added by this method
68 | *
69 | * @access public
70 | * @param array array of elements in 'tagName' => 'tagContent' format.
71 | * @return void
72 | */
73 | public function addElementArray($elementArray)
74 | {
75 | if(! is_array($elementArray)) return;
76 | foreach ($elementArray as $elementName => $content)
77 | {
78 | $this->addElement($elementName, $content);
79 | }
80 | }
81 |
82 | /**
83 | * Return the collection of elements in this feed item
84 | *
85 | * @access public
86 | * @return array
87 | */
88 | public function getElements()
89 | {
90 | return $this->elements;
91 | }
92 |
93 | // Wrapper functions ------------------------------------------------------
94 |
95 | /**
96 | * Set the 'dscription' element of feed item
97 | *
98 | * @access public
99 | * @param string The content of 'description' element
100 | * @return void
101 | */
102 | public function setDescription($description)
103 | {
104 | $tag = ($this->version == ATOM)? 'summary' : 'description';
105 | $this->setElement($tag, $description);
106 | }
107 |
108 | /**
109 | * @desc Set the 'title' element of feed item
110 | * @access public
111 | * @param string The content of 'title' element
112 | * @return void
113 | */
114 | public function setTitle($title)
115 | {
116 | $this->setElement('title', $title);
117 | }
118 |
119 | /**
120 | * Set the 'date' element of feed item
121 | *
122 | * @access public
123 | * @param string The content of 'date' element
124 | * @return void
125 | */
126 | public function setDate($date)
127 | {
128 | if(! is_numeric($date))
129 | {
130 | $date = strtotime($date);
131 | }
132 |
133 | if($this->version == ATOM)
134 | {
135 | $tag = 'updated';
136 | $value = date(DATE_ATOM, $date);
137 | }
138 | elseif($this->version == RSS2)
139 | {
140 | $tag = 'pubDate';
141 | $value = date(DATE_RSS, $date);
142 | }
143 | else
144 | {
145 | $tag = 'dc:date';
146 | $value = date("Y-m-d", $date);
147 | }
148 |
149 | $this->setElement($tag, $value);
150 | }
151 |
152 | /**
153 | * Set the 'link' element of feed item
154 | *
155 | * @access public
156 | * @param string The content of 'link' element
157 | * @return void
158 | */
159 | public function setLink($link)
160 | {
161 | if($this->version == RSS2 || $this->version == RSS1)
162 | {
163 | $this->setElement('link', $link);
164 | }
165 | else
166 | {
167 | $this->setElement('link','',array('href'=>$link));
168 | $this->setElement('id', FeedWriter::uuid($link,'urn:uuid:'));
169 | }
170 |
171 | }
172 |
173 | /**
174 | * Set the 'encloser' element of feed item
175 | * For RSS 2.0 only
176 | *
177 | * @access public
178 | * @param string The url attribute of encloser tag
179 | * @param string The length attribute of encloser tag
180 | * @param string The type attribute of encloser tag
181 | * @return void
182 | */
183 | public function setEncloser($url, $length, $type)
184 | {
185 | $attributes = array('url'=>$url, 'length'=>$length, 'type'=>$type);
186 | $this->setElement('enclosure','',$attributes);
187 | }
188 |
189 | }
--------------------------------------------------------------------------------
/libraries/html5php/HTML5/Exception.php:
--------------------------------------------------------------------------------
1 | )
72 | * @return int One of the Tokenizer::TEXTMODE_* constants.
73 | */
74 | public function startTag($name, $attributes = array(), $selfClosing = false);
75 |
76 | /**
77 | * An end-tag.
78 | */
79 | public function endTag($name);
80 |
81 | /**
82 | * A comment section (unparsed character data).
83 | */
84 | public function comment($cdata);
85 |
86 | /**
87 | * A unit of parsed character data.
88 | *
89 | * Entities in this text are *already decoded*.
90 | */
91 | public function text($cdata);
92 |
93 | /**
94 | * Indicates that the document has been entirely processed.
95 | */
96 | public function eof();
97 |
98 | /**
99 | * Emitted when the parser encounters an error condition.
100 | */
101 | public function parseError($msg, $line, $col);
102 |
103 | /**
104 | * A CDATA section.
105 | *
106 | * @param string $data
107 | * The unparsed character data.
108 | */
109 | public function cdata($data);
110 |
111 | /**
112 | * This is a holdover from the XML spec.
113 | *
114 | * While user agents don't get PIs, server-side does.
115 | *
116 | * @param string $name
117 | * The name of the processor (e.g. 'php').
118 | * @param string $data
119 | * The unparsed data.
120 | */
121 | public function processingInstruction($name, $data = null);
122 | }
123 |
--------------------------------------------------------------------------------
/libraries/html5php/HTML5/Parser/FileInputStream.php:
--------------------------------------------------------------------------------
1 | is = $input;
32 | }
33 |
34 | /**
35 | * Get the current position.
36 | *
37 | * @return int The current intiger byte position.
38 | */
39 | public function position()
40 | {
41 | return $this->is->key();
42 | }
43 |
44 | /**
45 | * Take a peek at the next character in the data.
46 | *
47 | * @return string The next character.
48 | */
49 | public function peek()
50 | {
51 | return $this->is->peek();
52 | }
53 |
54 | /**
55 | * Get the next character.
56 | *
57 | * Note: This advances the pointer.
58 | *
59 | * @return string The next character.
60 | */
61 | public function next()
62 | {
63 | $this->is->next();
64 | if ($this->is->valid()) {
65 | if ($this->debug)
66 | fprintf(STDOUT, "> %s\n", $this->is->current());
67 | return $this->is->current();
68 | }
69 |
70 | return false;
71 | }
72 |
73 | /**
74 | * Get the current character.
75 | *
76 | * Note, this does not advance the pointer.
77 | *
78 | * @return string The current character.
79 | */
80 | public function current()
81 | {
82 | if ($this->is->valid()) {
83 | return $this->is->current();
84 | }
85 |
86 | return false;
87 | }
88 |
89 | /**
90 | * Silently consume N chars.
91 | */
92 | public function consume($count = 1)
93 | {
94 | for ($i = 0; $i < $count; ++ $i) {
95 | $this->next();
96 | }
97 | }
98 |
99 | /**
100 | * Unconsume some of the data.
101 | * This moves the data pointer backwards.
102 | *
103 | * @param int $howMany
104 | * The number of characters to move the pointer back.
105 | */
106 | public function unconsume($howMany = 1)
107 | {
108 | $this->is->unconsume($howMany);
109 | }
110 |
111 | /**
112 | * Get the next group of that contains hex characters.
113 | *
114 | * Note, along with getting the characters the pointer in the data will be
115 | * moved as well.
116 | *
117 | * @return string The next group that is hex characters.
118 | */
119 | public function getHex()
120 | {
121 | return $this->is->charsWhile(static::CHARS_HEX);
122 | }
123 |
124 | /**
125 | * Get the next group of characters that are ASCII Alpha characters.
126 | *
127 | * Note, along with getting the characters the pointer in the data will be
128 | * moved as well.
129 | *
130 | * @return string The next group of ASCII alpha characters.
131 | */
132 | public function getAsciiAlpha()
133 | {
134 | return $this->is->charsWhile(static::CHARS_ALPHA);
135 | }
136 |
137 | /**
138 | * Get the next group of characters that are ASCII Alpha characters and numbers.
139 | *
140 | * Note, along with getting the characters the pointer in the data will be
141 | * moved as well.
142 | *
143 | * @return string The next group of ASCII alpha characters and numbers.
144 | */
145 | public function getAsciiAlphaNum()
146 | {
147 | return $this->is->charsWhile(static::CHARS_ALNUM);
148 | }
149 |
150 | /**
151 | * Get the next group of numbers.
152 | *
153 | * Note, along with getting the characters the pointer in the data will be
154 | * moved as well.
155 | *
156 | * @return string The next group of numbers.
157 | */
158 | public function getNumeric()
159 | {
160 | return $this->is->charsWhile('0123456789');
161 | }
162 |
163 | /**
164 | * Consume whitespace.
165 | *
166 | * Whitespace in HTML5 is: formfeed, tab, newline, space.
167 | */
168 | public function whitespace()
169 | {
170 | return $this->is->charsWhile("\n\t\f ");
171 | }
172 |
173 | /**
174 | * Returns the current line that is being consumed.
175 | *
176 | * @return int The current line number.
177 | */
178 | public function currentLine()
179 | {
180 | return $this->is->currentLine();
181 | }
182 |
183 | /**
184 | * Read chars until something in the mask is encountered.
185 | */
186 | public function charsUntil($mask)
187 | {
188 | return $this->is->charsUntil($mask);
189 | }
190 |
191 | /**
192 | * Read chars as long as the mask matches.
193 | */
194 | public function charsWhile($mask)
195 | {
196 | return $this->is->charsWhile($mask);
197 | }
198 |
199 | /**
200 | * Returns the current column of the current line that the tokenizer is at.
201 | *
202 | * Newlines are column 0. The first char after a newline is column 1.
203 | *
204 | * @return int The column number.
205 | */
206 | public function columnOffset()
207 | {
208 | return $this->is->columnOffset();
209 | }
210 |
211 | /**
212 | * Get all characters until EOF.
213 | *
214 | * This consumes characters until the EOF.
215 | *
216 | * @return int The number of characters remaining.
217 | */
218 | public function remainingChars()
219 | {
220 | return $this->is->remainingChars();
221 | }
222 | }
223 |
--------------------------------------------------------------------------------
/libraries/html5php/HTML5/Parser/TreeBuildingRules.php:
--------------------------------------------------------------------------------
1 | 1,
20 | 'dd' => 1,
21 | 'dt' => 1,
22 | 'rt' => 1,
23 | 'rp' => 1,
24 | 'tr' => 1,
25 | 'th' => 1,
26 | 'td' => 1,
27 | 'thead' => 1,
28 | 'tfoot' => 1,
29 | 'tbody' => 1,
30 | 'table' => 1,
31 | 'optgroup' => 1,
32 | 'option' => 1
33 | );
34 |
35 | /**
36 | * Build a new rules engine.
37 | *
38 | * @param \DOMDocument $doc
39 | * The DOM document to use for evaluation and modification.
40 | */
41 | public function __construct($doc)
42 | {
43 | $this->doc = $doc;
44 | }
45 |
46 | /**
47 | * Returns true if the given tagname has special processing rules.
48 | */
49 | public function hasRules($tagname)
50 | {
51 | return isset(static::$tags[$tagname]);
52 | }
53 |
54 | /**
55 | * Evaluate the rule for the current tag name.
56 | *
57 | * This may modify the existing DOM.
58 | *
59 | * @return \DOMElement The new Current DOM element.
60 | */
61 | public function evaluate($new, $current)
62 | {
63 | switch ($new->tagName) {
64 | case 'li':
65 | return $this->handleLI($new, $current);
66 | case 'dt':
67 | case 'dd':
68 | return $this->handleDT($new, $current);
69 | case 'rt':
70 | case 'rp':
71 | return $this->handleRT($new, $current);
72 | case 'optgroup':
73 | return $this->closeIfCurrentMatches($new, $current, array(
74 | 'optgroup'
75 | ));
76 | case 'option':
77 | return $this->closeIfCurrentMatches($new, $current, array(
78 | 'option',
79 | ));
80 | case 'tr':
81 | return $this->closeIfCurrentMatches($new, $current, array(
82 | 'tr'
83 | ));
84 | case 'td':
85 | case 'th':
86 | return $this->closeIfCurrentMatches($new, $current, array(
87 | 'th',
88 | 'td'
89 | ));
90 | case 'tbody':
91 | case 'thead':
92 | case 'tfoot':
93 | case 'table': // Spec isn't explicit about this, but it's necessary.
94 |
95 | return $this->closeIfCurrentMatches($new, $current, array(
96 | 'thead',
97 | 'tfoot',
98 | 'tbody'
99 | ));
100 | }
101 |
102 | return $current;
103 | }
104 |
105 | protected function handleLI($ele, $current)
106 | {
107 | return $this->closeIfCurrentMatches($ele, $current, array(
108 | 'li'
109 | ));
110 | }
111 |
112 | protected function handleDT($ele, $current)
113 | {
114 | return $this->closeIfCurrentMatches($ele, $current, array(
115 | 'dt',
116 | 'dd'
117 | ));
118 | }
119 |
120 | protected function handleRT($ele, $current)
121 | {
122 | return $this->closeIfCurrentMatches($ele, $current, array(
123 | 'rt',
124 | 'rp'
125 | ));
126 | }
127 |
128 | protected function closeIfCurrentMatches($ele, $current, $match)
129 | {
130 | $tname = $current->tagName;
131 | if (in_array($current->tagName, $match)) {
132 | $current->parentNode->appendChild($ele);
133 | } else {
134 | $current->appendChild($ele);
135 | }
136 |
137 | return $ele;
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/libraries/html5php/HTML5/Parser/UTF8Utils.php:
--------------------------------------------------------------------------------
1 |
8 |
9 | Permission is hereby granted, free of charge, to any person obtaining a
10 | copy of this software and associated documentation files (the
11 | "Software"), to deal in the Software without restriction, including
12 | without limitation the rights to use, copy, modify, merge, publish,
13 | distribute, sublicense, and/or sell copies of the Software, and to
14 | permit persons to whom the Software is furnished to do so, subject to
15 | the following conditions:
16 |
17 | The above copyright notice and this permission notice shall be included
18 | in all copies or substantial portions of the Software.
19 |
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 |
28 | */
29 | /**
30 | * UTF-8 Utilities
31 | */
32 | class UTF8Utils
33 | {
34 |
35 | /**
36 | * The Unicode replacement character..
37 | */
38 | const FFFD = "\xEF\xBF\xBD";
39 |
40 | /**
41 | * Count the number of characters in a string.
42 | *
43 | * UTF-8 aware. This will try (in order) iconv,
44 | * MB, libxml, and finally a custom counter.
45 | *
46 | * @todo Move this to a general utility class.
47 | */
48 | public static function countChars($string)
49 | {
50 | // Get the length for the string we need.
51 | if (function_exists('mb_strlen')) {
52 | return mb_strlen($string, 'utf-8');
53 | } elseif (function_exists('iconv_strlen')) {
54 | return iconv_strlen($string, 'utf-8');
55 | } elseif (function_exists('utf8_decode')) {
56 | // MPB: Will this work? Won't certain decodes lead to two chars
57 | // extrapolated out of 2-byte chars?
58 | return strlen(utf8_decode($string));
59 | }
60 | $count = count_chars($string);
61 | // 0x80 = 0x7F - 0 + 1 (one added to get inclusive range)
62 | // 0x33 = 0xF4 - 0x2C + 1 (one added to get inclusive range)
63 | return array_sum(array_slice($count, 0, 0x80)) + array_sum(array_slice($count, 0xC2, 0x33));
64 | }
65 |
66 | /**
67 | * Convert data from the given encoding to UTF-8.
68 | *
69 | * This has not yet been tested with charactersets other than UTF-8.
70 | * It should work with ISO-8859-1/-13 and standard Latin Win charsets.
71 | *
72 | * @param string $data
73 | * The data to convert.
74 | * @param string $encoding
75 | * A valid encoding. Examples: http://www.php.net/manual/en/mbstring.supported-encodings.php
76 | */
77 | public static function convertToUTF8($data, $encoding = 'UTF-8')
78 | {
79 | /*
80 | * From the HTML5 spec: Given an encoding, the bytes in the input stream must be converted to Unicode characters for the tokeniser, as described by the rules for that encoding, except that the leading U+FEFF BYTE ORDER MARK character, if any, must not be stripped by the encoding layer (it is stripped by the rule below). Bytes or sequences of bytes in the original byte stream that could not be converted to Unicode characters must be converted to U+FFFD REPLACEMENT CHARACTER code points.
81 | */
82 |
83 | // mb_convert_encoding is chosen over iconv because of a bug. The best
84 | // details for the bug are on http://us1.php.net/manual/en/function.iconv.php#108643
85 | // which contains links to the actual but reports as well as work around
86 | // details.
87 | if (function_exists('mb_convert_encoding')) {
88 | // mb library has the following behaviors:
89 | // - UTF-16 surrogates result in false.
90 | // - Overlongs and outside Plane 16 result in empty strings.
91 |
92 | // Before we run mb_convert_encoding we need to tell it what to do with
93 | // characters it does not know. This could be different than the parent
94 | // application executing this library so we store the value, change it
95 | // to our needs, and then change it back when we are done. This feels
96 | // a little excessive and it would be great if there was a better way.
97 | $save = mb_substitute_character();
98 | mb_substitute_character('none');
99 | $data = mb_convert_encoding($data, 'UTF-8', $encoding);
100 | mb_substitute_character($save);
101 | } // @todo Get iconv running in at least some environments if that is possible.
102 | elseif (function_exists('iconv') && $encoding != 'auto') {
103 | // fprintf(STDOUT, "iconv found\n");
104 | // iconv has the following behaviors:
105 | // - Overlong representations are ignored.
106 | // - Beyond Plane 16 is replaced with a lower char.
107 | // - Incomplete sequences generate a warning.
108 | $data = @iconv($encoding, 'UTF-8//IGNORE', $data);
109 | } else {
110 | // we can make a conforming native implementation
111 | throw new Exception('Not implemented, please install mbstring or iconv');
112 | }
113 |
114 | /*
115 | * One leading U+FEFF BYTE ORDER MARK character must be ignored if any are present.
116 | */
117 | if (substr($data, 0, 3) === "\xEF\xBB\xBF") {
118 | $data = substr($data, 3);
119 | }
120 |
121 | return $data;
122 | }
123 |
124 | /**
125 | * Checks for Unicode code points that are not valid in a document.
126 | *
127 | * @param string $data
128 | * A string to analyze.
129 | * @return array An array of (string) error messages produced by the scanning.
130 | */
131 | public static function checkForIllegalCodepoints($data)
132 | {
133 | if (! function_exists('preg_match_all')) {
134 | throw\Exception('The PCRE library is not loaded or is not available.');
135 | }
136 |
137 | // Vestigal error handling.
138 | $errors = array();
139 |
140 | /*
141 | * All U+0000 null characters in the input must be replaced by U+FFFD REPLACEMENT CHARACTERs. Any occurrences of such characters is a parse error.
142 | */
143 | for ($i = 0, $count = substr_count($data, "\0"); $i < $count; $i ++) {
144 | $errors[] = 'null-character';
145 | }
146 |
147 | /*
148 | * Any occurrences of any characters in the ranges U+0001 to U+0008, U+000B, U+000E to U+001F, U+007F to U+009F, U+D800 to U+DFFF , U+FDD0 to U+FDEF, and characters U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, U+2FFFF, U+3FFFE, U+3FFFF, U+4FFFE, U+4FFFF, U+5FFFE, U+5FFFF, U+6FFFE, U+6FFFF, U+7FFFE, U+7FFFF, U+8FFFE, U+8FFFF, U+9FFFE, U+9FFFF, U+AFFFE, U+AFFFF, U+BFFFE, U+BFFFF, U+CFFFE, U+CFFFF, U+DFFFE, U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE, U+FFFFF, U+10FFFE, and U+10FFFF are parse errors. (These are all control characters or permanently undefined Unicode characters.)
149 | */
150 | // Check PCRE is loaded.
151 | $count = preg_match_all(
152 | '/(?:
153 | [\x01-\x08\x0B\x0E-\x1F\x7F] # U+0001 to U+0008, U+000B, U+000E to U+001F and U+007F
154 | |
155 | \xC2[\x80-\x9F] # U+0080 to U+009F
156 | |
157 | \xED(?:\xA0[\x80-\xFF]|[\xA1-\xBE][\x00-\xFF]|\xBF[\x00-\xBF]) # U+D800 to U+DFFFF
158 | |
159 | \xEF\xB7[\x90-\xAF] # U+FDD0 to U+FDEF
160 | |
161 | \xEF\xBF[\xBE\xBF] # U+FFFE and U+FFFF
162 | |
163 | [\xF0-\xF4][\x8F-\xBF]\xBF[\xBE\xBF] # U+nFFFE and U+nFFFF (1 <= n <= 10_{16})
164 | )/x', $data, $matches);
165 | for ($i = 0; $i < $count; $i ++) {
166 | $errors[] = 'invalid-codepoint';
167 | }
168 |
169 | return $errors;
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/libraries/html5php/HTML5/Serializer/README.md:
--------------------------------------------------------------------------------
1 | # The Serializer (Writer) Model
2 |
3 | The serializer roughly follows sections _8.1 Writing HTML documents_ and section
4 | _8.3 Serializing HTML fragments_ by converting DOMDocument, DOMDocumentFragment,
5 | and DOMNodeList into HTML5.
6 |
7 | [ HTML5 ] // Interface for saving.
8 | ||
9 | [ Traverser ] // Walk the DOM
10 | ||
11 | [ Rules ] // Convert DOM elements into strings.
12 | ||
13 | [ HTML5 ] // HTML5 document or fragment in text.
14 |
15 |
16 | ## HTML5 Class
17 |
18 | Provides the top level interface for saving.
19 |
20 | ## The Traverser
21 |
22 | Walks the DOM finding each element and passing it off to the output rules to
23 | convert to HTML5.
24 |
25 | ## Output Rules
26 |
27 | The output rules are defined in the RulesInterface which can have multiple
28 | implementations. Currently, the OutputRules is the default implementation that
29 | converts a DOM as is into HTML5.
30 |
31 | ## HTML5 String
32 |
33 | The output of the process it HTML5 as a string or saved to a file.
--------------------------------------------------------------------------------
/libraries/html5php/HTML5/Serializer/RulesInterface.php:
--------------------------------------------------------------------------------
1 | 'html',
21 | 'http://www.w3.org/1998/Math/MathML' => 'math',
22 | 'http://www.w3.org/2000/svg' => 'svg'
23 | );
24 |
25 | protected $dom;
26 |
27 | protected $options;
28 |
29 | protected $encode = false;
30 |
31 | protected $rules;
32 |
33 | protected $out;
34 |
35 | /**
36 | * Create a traverser.
37 | *
38 | * @param DOMNode|DOMNodeList $dom
39 | * The document or node to traverse.
40 | * @param resource $out
41 | * A stream that allows writing. The traverser will output into this
42 | * stream.
43 | * @param array $options
44 | * An array or options for the traverser as key/value pairs. These include:
45 | * - encode_entities: A bool to specify if full encding should happen for all named
46 | * charachter references. Defaults to false which escapes &'<>".
47 | * - output_rules: The path to the class handling the output rules.
48 | */
49 | public function __construct($dom, $out, RulesInterface $rules, $options = array())
50 | {
51 | $this->dom = $dom;
52 | $this->out = $out;
53 | $this->rules = $rules;
54 | $this->options = $options;
55 |
56 | $this->rules->setTraverser($this);
57 | }
58 |
59 | /**
60 | * Tell the traverser to walk the DOM.
61 | *
62 | * @return resource $out
63 | * Returns the output stream.
64 | */
65 | public function walk()
66 | {
67 | if ($this->dom instanceof \DOMDocument) {
68 | $this->rules->document($this->dom);
69 | } elseif ($this->dom instanceof \DOMDocumentFragment) {
70 | // Document fragments are a special case. Only the children need to
71 | // be serialized.
72 | if ($this->dom->hasChildNodes()) {
73 | $this->children($this->dom->childNodes);
74 | }
75 | } // If NodeList, loop
76 | elseif ($this->dom instanceof \DOMNodeList) {
77 | // If this is a NodeList of DOMDocuments this will not work.
78 | $this->children($this->dom);
79 | } // Else assume this is a DOMNode-like datastructure.
80 | else {
81 | $this->node($this->dom);
82 | }
83 |
84 | return $this->out;
85 | }
86 |
87 | /**
88 | * Process a node in the DOM.
89 | *
90 | * @param mixed $node
91 | * A node implementing \DOMNode.
92 | */
93 | public function node($node)
94 | {
95 | // A listing of types is at http://php.net/manual/en/dom.constants.php
96 | switch ($node->nodeType) {
97 | case XML_ELEMENT_NODE:
98 | $this->rules->element($node);
99 | break;
100 | case XML_TEXT_NODE:
101 | $this->rules->text($node);
102 | break;
103 | case XML_CDATA_SECTION_NODE:
104 | $this->rules->cdata($node);
105 | break;
106 | case XML_PI_NODE:
107 | $this->rules->processorInstruction($node);
108 | break;
109 | case XML_COMMENT_NODE:
110 | $this->rules->comment($node);
111 | break;
112 | // Currently we don't support embedding DTDs.
113 | default:
114 | //print '';
115 | break;
116 | }
117 | }
118 |
119 | /**
120 | * Walk through all the nodes on a node list.
121 | *
122 | * @param \DOMNodeList $nl
123 | * A list of child elements to walk through.
124 | */
125 | public function children($nl)
126 | {
127 | foreach ($nl as $node) {
128 | $this->node($node);
129 | }
130 | }
131 |
132 | /**
133 | * Is an element local?
134 | *
135 | * @param mixed $ele
136 | * An element that implement \DOMNode.
137 | *
138 | * @return bool True if local and false otherwise.
139 | */
140 | public function isLocalElement($ele)
141 | {
142 | $uri = $ele->namespaceURI;
143 | if (empty($uri)) {
144 | return false;
145 | }
146 |
147 | return isset(static::$local_ns[$uri]);
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/libraries/html5php/LICENSE.txt:
--------------------------------------------------------------------------------
1 | ## HTML5-PHP License
2 |
3 | Copyright (c) 2013 The Authors of HTML5-PHP
4 |
5 | Matt Butcher - mattbutcher@google.com
6 | Matt Farina - matt@mattfarina.com
7 | Asmir Mustafic - goetas@gmail.com
8 |
9 | Permission is hereby granted, free of charge, to any person obtaining a copy of
10 | this software and associated documentation files (the "Software"), to deal in
11 | the Software without restriction, including without limitation the rights to
12 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
13 | the Software, and to permit persons to whom the Software is furnished to do so,
14 | subject to the following conditions:
15 |
16 | The above copyright notice and this permission notice shall be included in all
17 | copies or substantial portions of the Software.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
21 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
22 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
23 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 |
26 | ## HTML5Lib License
27 |
28 | Portions of this are based on html5lib's PHP version, which was a
29 | sub-project of html5lib. The following is the list of contributors from
30 | html5lib:
31 |
32 | html5lib:
33 |
34 | Copyright (c) 2006-2009 The Authors
35 |
36 | Contributors:
37 | James Graham - jg307@cam.ac.uk
38 | Anne van Kesteren - annevankesteren@gmail.com
39 | Lachlan Hunt - lachlan.hunt@lachy.id.au
40 | Matt McDonald - kanashii@kanashii.ca
41 | Sam Ruby - rubys@intertwingly.net
42 | Ian Hickson (Google) - ian@hixie.ch
43 | Thomas Broyer - t.broyer@ltgt.net
44 | Jacques Distler - distler@golem.ph.utexas.edu
45 | Henri Sivonen - hsivonen@iki.fi
46 | Adam Barth - abarth@webkit.org
47 | Eric Seidel - eric@webkit.org
48 | The Mozilla Foundation (contributions from Henri Sivonen since 2008)
49 | David Flanagan (Mozilla) - dflanagan@mozilla.com
50 |
51 | Permission is hereby granted, free of charge, to any person obtaining a copy of
52 | this software and associated documentation files (the "Software"), to deal in
53 | the Software without restriction, including without limitation the rights to
54 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
55 | the Software, and to permit persons to whom the Software is furnished to do so,
56 | subject to the following conditions:
57 |
58 | The above copyright notice and this permission notice shall be included in all
59 | copies or substantial portions of the Software.
60 |
61 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
63 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
64 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
65 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
66 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
67 |
--------------------------------------------------------------------------------
/libraries/html5php/RELEASE.md:
--------------------------------------------------------------------------------
1 | # Release Notes
2 |
3 | 2.3.0 (2017-09-04)
4 |
5 | - #129: image within inline svg breaks system (fixed by #133)
6 | - #131: ² does not work (fixed by #132)
7 | - #134: Improve tokenizer performance by 20% (alternative version of #130 thanks to @MichaelHeerklotz)
8 | - #135: Raw & in attributes
9 |
10 | 2.2.2 (2016-09-22)
11 |
12 | - #116: In XML mode, tags are case sensitive
13 | - #115: Fix PHP Notice in OutputRules
14 | - #112: fix parsing of options of an optgroup
15 | - #111: Adding test for the address tag
16 |
17 | 2.2.1 (2016-05-10)
18 |
19 | - #109: Fixed issue where address tag could be written without closing tag (thanks sylus)
20 |
21 | 2.2.0 (2016-04-11)
22 |
23 | - #105: Enable composer cache (for CI/CD)
24 | - #100: Use mb_substitute_character inset of ini_set for environments where ini_set is disable (e.g., shared hosting)
25 | - #98: Allow link, meta, style tags in noscript tags
26 | - #96: Fixed xml:href on svgs that use the "use" breaking
27 | - #94: Counting UTF8 characters performance improvement
28 | - #93: Use newer version of coveralls package
29 | - #90: Remove duplicate test
30 | - #87: Allow multiple root nodes
31 |
32 | 2.1.2 (2015-06-07)
33 | - #82: Support for PHP7
34 | - #84: Improved boolean attribute handling
35 |
36 | 2.1.1 (2015-03-23)
37 | - #78: Fixes bug where unmatched entity like string drops everything after &.
38 |
39 | 2.1.0 (2015-02-01)
40 | - #74: Added `disable_html_ns` and `target_doc` dom parsing options
41 | - Unified option names
42 | - #73: Fixed alphabet, ß now can be detected
43 | - #75 and #76: Allow whitespace in RCDATA tags
44 | - #77: Fixed parsing blunder for json embeds
45 | - #72: Add options to HTML methods
46 |
47 | 2.0.2 (2014-12-17)
48 | - #50: empty document handling
49 | - #63: tags with strange capitalization
50 | - #65: dashes and underscores as allowed characters in tag names
51 | - #68: Fixed issue with non-inline elements inside inline containers
52 |
53 | 2.0.1 (2014-09-23)
54 | - #59: Fixed issue parsing some fragments.
55 | - #56: Incorrectly saw 0 as empty string
56 | - Sami as new documentation generator
57 |
58 | 2.0.0 (2014-07-28)
59 | - #53: Improved boolean attributes handling
60 | - #52: Facebook HHVM compatibility
61 | - #48: Adopted PSR-2 as coding standard
62 | - #47: Moved everything to Masterminds namespace
63 | - #45: Added custom namespaces
64 | - #44: Added support to XML-style namespaces
65 | - #37: Refactored HTML5 class removing static methods
66 |
67 | 1.0.5 (2014-06-10)
68 | - #38: Set the dev-master branch as the 1.0.x branch for composer (goetas)
69 | - #34: Tests use PSR-4 for autoloading. (goetas)
70 | - #40, #41: Fix entity handling in RCDATA sections. (KitaitiMakoto)
71 | - #32: Fixed issue where wharacter references were being incorrectly encoded in style tags.
72 |
73 | 1.0.4 (2014-04-29)
74 | - #30/#31 Don't throw an exception for invalid tag names.
75 |
76 | 1.0.3 (2014-02-28)
77 | - #23 and #29: Ignore attributes with illegal chars in name for the PHP DOM.
78 |
79 | 1.0.2 (2014-02-12)
80 | - #23: Handle missing tag close in attribute list.
81 | - #25: Fixed text escaping in the serializer (HTML% 8.3).
82 | - #27: Fixed tests on Windows: changed "\n" -> PHP_EOL.
83 | - #28: Fixed infinite loop for char "&" in unquoted attribute in parser.
84 | - #26: Updated tag name case handling to deal with uppercase usage.
85 | - #24: Newlines and tabs are allowed inside quoted attributes (HTML5 8.2.4).
86 | - Fixed Travis CI testing.
87 |
88 | 1.0.1 (2013-11-07)
89 | - CDATA encoding is improved. (Non-standard; Issue #19)
90 | - Some parser rules were not returning the new current element. (Issue #20)
91 | - Added, to the README, details on code test coverage and to packagist version.
92 | - Fixed processor instructions.
93 | - Improved test coverage and documentation coverage.
94 |
95 | 1.0.0 (2013-10-02)
96 | - Initial release.
97 |
--------------------------------------------------------------------------------
/libraries/html5php/autoloader.php:
--------------------------------------------------------------------------------
1 | path = dirname(__FILE__);
16 | }
17 |
18 | /**
19 | * Autoloader
20 | *
21 | * @param string $class The name of the class to attempt to load.
22 | */
23 | public function autoload($class)
24 | {
25 | // Only load the class if it starts with "HTML5"
26 | if (strpos($class, 'Masterminds\HTML5') !== 0)
27 | {
28 | return;
29 | }
30 | $class = substr($class, 12);
31 | //die($class);
32 |
33 | $filename = $this->path . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
34 | include $filename;
35 | }
36 | }
--------------------------------------------------------------------------------
/libraries/humble-http-agent/HumbleHttpAgentDummy.php:
--------------------------------------------------------------------------------
1 | body = $body;
33 | if (isset($headers)) $this->headers = $headers;
34 | }
35 |
36 | public function rewriteHashbangFragment($url) {
37 | return $url;
38 | }
39 |
40 | public function getRedirectURLfromHTML($url, $html) {
41 | return false;
42 | }
43 |
44 | public function getMetaRefreshURL($url, $html) {
45 | return false;
46 | }
47 |
48 | public function getUglyURL($url, $html) {
49 | return false;
50 | }
51 |
52 | public function removeFragment($url) {
53 | return $url;
54 | }
55 |
56 | public function rewriteUrls($url) {
57 | return $url;
58 | }
59 |
60 | public function enableDebug($bool=true) {
61 | return;
62 | }
63 |
64 | public function minimiseMemoryUse($bool = true) {
65 | return;
66 | }
67 |
68 | public function setMaxParallelRequests($max) {
69 | return;
70 | }
71 |
72 | public function validateUrl($url) {
73 | $url = filter_var($url, FILTER_SANITIZE_URL);
74 | $test = filter_var($url, FILTER_VALIDATE_URL);
75 | // deal with bug http://bugs.php.net/51192 (present in PHP 5.2.13 and PHP 5.3.2)
76 | if ($test === false) {
77 | $test = filter_var(strtr($url, '-', '_'), FILTER_VALIDATE_URL);
78 | }
79 | if ($test !== false && $test !== null && preg_match('!^https?://!', $url)) {
80 | return $url;
81 | } else {
82 | return false;
83 | }
84 | }
85 |
86 | public function fetchAll(array $urls) {
87 | return;
88 | }
89 |
90 | // fetch all URLs without following redirects
91 | public function fetchAllOnce(array $urls, $isRedirect=false) {
92 | return;
93 | }
94 |
95 | public function get($url, $remove=false, $gzdecode=true) {
96 | return array(
97 | 'body' => $this->body,
98 | 'headers' => $this->headers,
99 | 'status_code' => 200,
100 | 'effective_url' => $url
101 | );
102 | }
103 |
104 | public function parallelSupport() {
105 | return false;
106 | }
107 | }
--------------------------------------------------------------------------------
/libraries/humble-http-agent/SimplePie_HumbleHttpAgent.php:
--------------------------------------------------------------------------------
1 | encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
37 | }
38 | $this->url = $url;
39 | $this->useragent = $useragent;
40 | if (preg_match('/^http(s)?:\/\//i', $url))
41 | {
42 | if (!is_array($headers))
43 | {
44 | $headers = array();
45 | }
46 | $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
47 | $headers2 = array();
48 | foreach ($headers as $key => $value) {
49 | $headers2[] = "$key: $value";
50 | }
51 | //TODO: allow for HTTP headers
52 | // curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
53 |
54 | $response = self::$agent->get($url);
55 |
56 | if ($response === false || !isset($response['status_code'])) {
57 | $this->error = 'failed to fetch URL';
58 | $this->success = false;
59 | } else {
60 | // The extra lines at the end are there to satisfy SimplePie's HTTP parser.
61 | // The class expects a full HTTP message, whereas we're giving it only
62 | // headers - the new lines indicate the start of the body.
63 | $parser = new SimplePie_HTTP_Parser($response['headers']."\r\n\r\n");
64 | if ($parser->parse()) {
65 | $this->headers = $parser->headers;
66 | //$this->body = $parser->body;
67 | $this->body = $response['body'];
68 | $this->status_code = $parser->status_code;
69 | }
70 | }
71 | }
72 | else
73 | {
74 | $this->error = 'invalid URL';
75 | $this->success = false;
76 | }
77 | }
78 | }
--------------------------------------------------------------------------------
/libraries/language-detect/LanguageDetect/Exception.php:
--------------------------------------------------------------------------------
1 |
10 | * @license BSD http://www.opensource.org/licenses/bsd-license.php
11 | * @link http://pear.php.net/package/Text_LanguageDetect/
12 | */
13 |
14 | class Text_LanguageDetect_Exception extends Exception
15 | {
16 | /**
17 | * Database file could not be found
18 | */
19 | const DB_NOT_FOUND = 10;
20 |
21 | /**
22 | * Database file found, but not readable
23 | */
24 | const DB_NOT_READABLE = 11;
25 |
26 | /**
27 | * Database file is empty
28 | */
29 | const DB_EMPTY = 12;
30 |
31 | /**
32 | * Database contents is not a PHP array
33 | */
34 | const DB_NOT_ARRAY = 13;
35 |
36 | /**
37 | * Magic quotes are activated
38 | */
39 | const MAGIC_QUOTES = 14;
40 |
41 |
42 | /**
43 | * Parameter of invalid type passed to method
44 | */
45 | const PARAM_TYPE = 20;
46 |
47 | /**
48 | * Character in parameter is invalid
49 | */
50 | const INVALID_CHAR = 21;
51 |
52 |
53 | /**
54 | * Language is not in the database
55 | */
56 | const UNKNOWN_LANGUAGE = 30;
57 |
58 |
59 | /**
60 | * Error during block detection
61 | */
62 | const BLOCK_DETECTION = 40;
63 |
64 |
65 | /**
66 | * Error while clustering languages
67 | */
68 | const NO_HIGHEST_KEY = 50;
69 | }
70 |
--------------------------------------------------------------------------------
/libraries/language-detect/unicode_blocks.dat:
--------------------------------------------------------------------------------
1 | a:145:{i:0;a:3:{i:0;i:0;i:1;i:127;i:2;s:11:"Basic Latin";}i:1;a:3:{i:0;i:128;i:1;i:255;i:2;s:18:"Latin-1 Supplement";}i:2;a:3:{i:0;i:256;i:1;i:383;i:2;s:16:"Latin Extended-A";}i:3;a:3:{i:0;i:384;i:1;i:591;i:2;s:16:"Latin Extended-B";}i:4;a:3:{i:0;i:592;i:1;i:687;i:2;s:14:"IPA Extensions";}i:5;a:3:{i:0;i:688;i:1;i:767;i:2;s:24:"Spacing Modifier Letters";}i:6;a:3:{i:0;i:768;i:1;i:879;i:2;s:27:"Combining Diacritical Marks";}i:7;a:3:{i:0;i:880;i:1;i:1023;i:2;s:16:"Greek and Coptic";}i:8;a:3:{i:0;i:1024;i:1;i:1279;i:2;s:8:"Cyrillic";}i:9;a:3:{i:0;i:1280;i:1;i:1327;i:2;s:19:"Cyrillic Supplement";}i:10;a:3:{i:0;i:1328;i:1;i:1423;i:2;s:8:"Armenian";}i:11;a:3:{i:0;i:1424;i:1;i:1535;i:2;s:6:"Hebrew";}i:12;a:3:{i:0;i:1536;i:1;i:1791;i:2;s:6:"Arabic";}i:13;a:3:{i:0;i:1792;i:1;i:1871;i:2;s:6:"Syriac";}i:14;a:3:{i:0;i:1872;i:1;i:1919;i:2;s:17:"Arabic Supplement";}i:15;a:3:{i:0;i:1920;i:1;i:1983;i:2;s:6:"Thaana";}i:16;a:3:{i:0;i:2304;i:1;i:2431;i:2;s:10:"Devanagari";}i:17;a:3:{i:0;i:2432;i:1;i:2559;i:2;s:7:"Bengali";}i:18;a:3:{i:0;i:2560;i:1;i:2687;i:2;s:8:"Gurmukhi";}i:19;a:3:{i:0;i:2688;i:1;i:2815;i:2;s:8:"Gujarati";}i:20;a:3:{i:0;i:2816;i:1;i:2943;i:2;s:5:"Oriya";}i:21;a:3:{i:0;i:2944;i:1;i:3071;i:2;s:5:"Tamil";}i:22;a:3:{i:0;i:3072;i:1;i:3199;i:2;s:6:"Telugu";}i:23;a:3:{i:0;i:3200;i:1;i:3327;i:2;s:7:"Kannada";}i:24;a:3:{i:0;i:3328;i:1;i:3455;i:2;s:9:"Malayalam";}i:25;a:3:{i:0;i:3456;i:1;i:3583;i:2;s:7:"Sinhala";}i:26;a:3:{i:0;i:3584;i:1;i:3711;i:2;s:4:"Thai";}i:27;a:3:{i:0;i:3712;i:1;i:3839;i:2;s:3:"Lao";}i:28;a:3:{i:0;i:3840;i:1;i:4095;i:2;s:7:"Tibetan";}i:29;a:3:{i:0;i:4096;i:1;i:4255;i:2;s:7:"Myanmar";}i:30;a:3:{i:0;i:4256;i:1;i:4351;i:2;s:8:"Georgian";}i:31;a:3:{i:0;i:4352;i:1;i:4607;i:2;s:11:"Hangul Jamo";}i:32;a:3:{i:0;i:4608;i:1;i:4991;i:2;s:8:"Ethiopic";}i:33;a:3:{i:0;i:4992;i:1;i:5023;i:2;s:19:"Ethiopic Supplement";}i:34;a:3:{i:0;i:5024;i:1;i:5119;i:2;s:8:"Cherokee";}i:35;a:3:{i:0;i:5120;i:1;i:5759;i:2;s:37:"Unified Canadian Aboriginal Syllabics";}i:36;a:3:{i:0;i:5760;i:1;i:5791;i:2;s:5:"Ogham";}i:37;a:3:{i:0;i:5792;i:1;i:5887;i:2;s:5:"Runic";}i:38;a:3:{i:0;i:5888;i:1;i:5919;i:2;s:7:"Tagalog";}i:39;a:3:{i:0;i:5920;i:1;i:5951;i:2;s:7:"Hanunoo";}i:40;a:3:{i:0;i:5952;i:1;i:5983;i:2;s:5:"Buhid";}i:41;a:3:{i:0;i:5984;i:1;i:6015;i:2;s:8:"Tagbanwa";}i:42;a:3:{i:0;i:6016;i:1;i:6143;i:2;s:5:"Khmer";}i:43;a:3:{i:0;i:6144;i:1;i:6319;i:2;s:9:"Mongolian";}i:44;a:3:{i:0;i:6400;i:1;i:6479;i:2;s:5:"Limbu";}i:45;a:3:{i:0;i:6480;i:1;i:6527;i:2;s:6:"Tai Le";}i:46;a:3:{i:0;i:6528;i:1;i:6623;i:2;s:11:"New Tai Lue";}i:47;a:3:{i:0;i:6624;i:1;i:6655;i:2;s:13:"Khmer Symbols";}i:48;a:3:{i:0;i:6656;i:1;i:6687;i:2;s:8:"Buginese";}i:49;a:3:{i:0;i:7424;i:1;i:7551;i:2;s:19:"Phonetic Extensions";}i:50;a:3:{i:0;i:7552;i:1;i:7615;i:2;s:30:"Phonetic Extensions Supplement";}i:51;a:3:{i:0;i:7616;i:1;i:7679;i:2;s:38:"Combining Diacritical Marks Supplement";}i:52;a:3:{i:0;i:7680;i:1;i:7935;i:2;s:25:"Latin Extended Additional";}i:53;a:3:{i:0;i:7936;i:1;i:8191;i:2;s:14:"Greek Extended";}i:54;a:3:{i:0;i:8192;i:1;i:8303;i:2;s:19:"General Punctuation";}i:55;a:3:{i:0;i:8304;i:1;i:8351;i:2;s:27:"Superscripts and Subscripts";}i:56;a:3:{i:0;i:8352;i:1;i:8399;i:2;s:16:"Currency Symbols";}i:57;a:3:{i:0;i:8400;i:1;i:8447;i:2;s:39:"Combining Diacritical Marks for Symbols";}i:58;a:3:{i:0;i:8448;i:1;i:8527;i:2;s:18:"Letterlike Symbols";}i:59;a:3:{i:0;i:8528;i:1;i:8591;i:2;s:12:"Number Forms";}i:60;a:3:{i:0;i:8592;i:1;i:8703;i:2;s:6:"Arrows";}i:61;a:3:{i:0;i:8704;i:1;i:8959;i:2;s:22:"Mathematical Operators";}i:62;a:3:{i:0;i:8960;i:1;i:9215;i:2;s:23:"Miscellaneous Technical";}i:63;a:3:{i:0;i:9216;i:1;i:9279;i:2;s:16:"Control Pictures";}i:64;a:3:{i:0;i:9280;i:1;i:9311;i:2;s:29:"Optical Character Recognition";}i:65;a:3:{i:0;i:9312;i:1;i:9471;i:2;s:22:"Enclosed Alphanumerics";}i:66;a:3:{i:0;i:9472;i:1;i:9599;i:2;s:11:"Box Drawing";}i:67;a:3:{i:0;i:9600;i:1;i:9631;i:2;s:14:"Block Elements";}i:68;a:3:{i:0;i:9632;i:1;i:9727;i:2;s:16:"Geometric Shapes";}i:69;a:3:{i:0;i:9728;i:1;i:9983;i:2;s:21:"Miscellaneous Symbols";}i:70;a:3:{i:0;i:9984;i:1;i:10175;i:2;s:8:"Dingbats";}i:71;a:3:{i:0;i:10176;i:1;i:10223;i:2;s:36:"Miscellaneous Mathematical Symbols-A";}i:72;a:3:{i:0;i:10224;i:1;i:10239;i:2;s:21:"Supplemental Arrows-A";}i:73;a:3:{i:0;i:10240;i:1;i:10495;i:2;s:16:"Braille Patterns";}i:74;a:3:{i:0;i:10496;i:1;i:10623;i:2;s:21:"Supplemental Arrows-B";}i:75;a:3:{i:0;i:10624;i:1;i:10751;i:2;s:36:"Miscellaneous Mathematical Symbols-B";}i:76;a:3:{i:0;i:10752;i:1;i:11007;i:2;s:35:"Supplemental Mathematical Operators";}i:77;a:3:{i:0;i:11008;i:1;i:11263;i:2;s:32:"Miscellaneous Symbols and Arrows";}i:78;a:3:{i:0;i:11264;i:1;i:11359;i:2;s:10:"Glagolitic";}i:79;a:3:{i:0;i:11392;i:1;i:11519;i:2;s:6:"Coptic";}i:80;a:3:{i:0;i:11520;i:1;i:11567;i:2;s:19:"Georgian Supplement";}i:81;a:3:{i:0;i:11568;i:1;i:11647;i:2;s:8:"Tifinagh";}i:82;a:3:{i:0;i:11648;i:1;i:11743;i:2;s:17:"Ethiopic Extended";}i:83;a:3:{i:0;i:11776;i:1;i:11903;i:2;s:24:"Supplemental Punctuation";}i:84;a:3:{i:0;i:11904;i:1;i:12031;i:2;s:23:"CJK Radicals Supplement";}i:85;a:3:{i:0;i:12032;i:1;i:12255;i:2;s:15:"Kangxi Radicals";}i:86;a:3:{i:0;i:12272;i:1;i:12287;i:2;s:34:"Ideographic Description Characters";}i:87;a:3:{i:0;i:12288;i:1;i:12351;i:2;s:27:"CJK Symbols and Punctuation";}i:88;a:3:{i:0;i:12352;i:1;i:12447;i:2;s:8:"Hiragana";}i:89;a:3:{i:0;i:12448;i:1;i:12543;i:2;s:8:"Katakana";}i:90;a:3:{i:0;i:12544;i:1;i:12591;i:2;s:8:"Bopomofo";}i:91;a:3:{i:0;i:12592;i:1;i:12687;i:2;s:25:"Hangul Compatibility Jamo";}i:92;a:3:{i:0;i:12688;i:1;i:12703;i:2;s:6:"Kanbun";}i:93;a:3:{i:0;i:12704;i:1;i:12735;i:2;s:17:"Bopomofo Extended";}i:94;a:3:{i:0;i:12736;i:1;i:12783;i:2;s:11:"CJK Strokes";}i:95;a:3:{i:0;i:12784;i:1;i:12799;i:2;s:28:"Katakana Phonetic Extensions";}i:96;a:3:{i:0;i:12800;i:1;i:13055;i:2;s:31:"Enclosed CJK Letters and Months";}i:97;a:3:{i:0;i:13056;i:1;i:13311;i:2;s:17:"CJK Compatibility";}i:98;a:3:{i:0;i:13312;i:1;i:19903;i:2;s:34:"CJK Unified Ideographs Extension A";}i:99;a:3:{i:0;i:19904;i:1;i:19967;i:2;s:23:"Yijing Hexagram Symbols";}i:100;a:3:{i:0;i:19968;i:1;i:40959;i:2;s:22:"CJK Unified Ideographs";}i:101;a:3:{i:0;i:40960;i:1;i:42127;i:2;s:12:"Yi Syllables";}i:102;a:3:{i:0;i:42128;i:1;i:42191;i:2;s:11:"Yi Radicals";}i:103;a:3:{i:0;i:42752;i:1;i:42783;i:2;s:21:"Modifier Tone Letters";}i:104;a:3:{i:0;i:43008;i:1;i:43055;i:2;s:12:"Syloti Nagri";}i:105;a:3:{i:0;i:44032;i:1;i:55215;i:2;s:16:"Hangul Syllables";}i:106;a:3:{i:0;i:55296;i:1;i:56191;i:2;s:15:"High Surrogates";}i:107;a:3:{i:0;i:56192;i:1;i:56319;i:2;s:27:"High Private Use Surrogates";}i:108;a:3:{i:0;i:56320;i:1;i:57343;i:2;s:14:"Low Surrogates";}i:109;a:3:{i:0;i:57344;i:1;i:63743;i:2;s:16:"Private Use Area";}i:110;a:3:{i:0;i:63744;i:1;i:64255;i:2;s:28:"CJK Compatibility Ideographs";}i:111;a:3:{i:0;i:64256;i:1;i:64335;i:2;s:29:"Alphabetic Presentation Forms";}i:112;a:3:{i:0;i:64336;i:1;i:65023;i:2;s:27:"Arabic Presentation Forms-A";}i:113;a:3:{i:0;i:65024;i:1;i:65039;i:2;s:19:"Variation Selectors";}i:114;a:3:{i:0;i:65040;i:1;i:65055;i:2;s:14:"Vertical Forms";}i:115;a:3:{i:0;i:65056;i:1;i:65071;i:2;s:20:"Combining Half Marks";}i:116;a:3:{i:0;i:65072;i:1;i:65103;i:2;s:23:"CJK Compatibility Forms";}i:117;a:3:{i:0;i:65104;i:1;i:65135;i:2;s:19:"Small Form Variants";}i:118;a:3:{i:0;i:65136;i:1;i:65279;i:2;s:27:"Arabic Presentation Forms-B";}i:119;a:3:{i:0;i:65280;i:1;i:65519;i:2;s:29:"Halfwidth and Fullwidth Forms";}i:120;a:3:{i:0;i:65520;i:1;i:65535;i:2;s:8:"Specials";}i:121;a:3:{i:0;i:65536;i:1;i:65663;i:2;s:18:"Linear B Syllabary";}i:122;a:3:{i:0;i:65664;i:1;i:65791;i:2;s:18:"Linear B Ideograms";}i:123;a:3:{i:0;i:65792;i:1;i:65855;i:2;s:14:"Aegean Numbers";}i:124;a:3:{i:0;i:65856;i:1;i:65935;i:2;s:21:"Ancient Greek Numbers";}i:125;a:3:{i:0;i:66304;i:1;i:66351;i:2;s:10:"Old Italic";}i:126;a:3:{i:0;i:66352;i:1;i:66383;i:2;s:6:"Gothic";}i:127;a:3:{i:0;i:66432;i:1;i:66463;i:2;s:8:"Ugaritic";}i:128;a:3:{i:0;i:66464;i:1;i:66527;i:2;s:11:"Old Persian";}i:129;a:3:{i:0;i:66560;i:1;i:66639;i:2;s:7:"Deseret";}i:130;a:3:{i:0;i:66640;i:1;i:66687;i:2;s:7:"Shavian";}i:131;a:3:{i:0;i:66688;i:1;i:66735;i:2;s:7:"Osmanya";}i:132;a:3:{i:0;i:67584;i:1;i:67647;i:2;s:17:"Cypriot Syllabary";}i:133;a:3:{i:0;i:68096;i:1;i:68191;i:2;s:10:"Kharoshthi";}i:134;a:3:{i:0;i:118784;i:1;i:119039;i:2;s:25:"Byzantine Musical Symbols";}i:135;a:3:{i:0;i:119040;i:1;i:119295;i:2;s:15:"Musical Symbols";}i:136;a:3:{i:0;i:119296;i:1;i:119375;i:2;s:30:"Ancient Greek Musical Notation";}i:137;a:3:{i:0;i:119552;i:1;i:119647;i:2;s:21:"Tai Xuan Jing Symbols";}i:138;a:3:{i:0;i:119808;i:1;i:120831;i:2;s:33:"Mathematical Alphanumeric Symbols";}i:139;a:3:{i:0;i:131072;i:1;i:173791;i:2;s:34:"CJK Unified Ideographs Extension B";}i:140;a:3:{i:0;i:194560;i:1;i:195103;i:2;s:39:"CJK Compatibility Ideographs Supplement";}i:141;a:3:{i:0;i:917504;i:1;i:917631;i:2;s:4:"Tags";}i:142;a:3:{i:0;i:917760;i:1;i:917999;i:2;s:30:"Variation Selectors Supplement";}i:143;a:3:{i:0;i:983040;i:1;i:1048575;i:2;s:32:"Supplementary Private Use Area-A";}i:144;a:3:{i:0;i:1048576;i:1;i:1114111;i:2;s:32:"Supplementary Private Use Area-B";}}
--------------------------------------------------------------------------------
/libraries/readability/JSLikeHTMLElement.php:
--------------------------------------------------------------------------------
1 | registerNodeClass('DOMElement', 'JSLikeHTMLElement');
16 | * $doc->loadHTML('