diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/3rdparty/libraries/PHPePub/EPub.php | 8 | ||||
-rwxr-xr-x | inc/3rdparty/libraries/feedwriter/FeedWriter.php | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | inc/3rdparty/libraries/readability/Readability.php | 17 | ||||
-rwxr-xr-x | inc/3rdparty/makefulltextfeed.php | 8 | ||||
-rwxr-xr-x | inc/3rdparty/makefulltextfeedHelpers.php | 10 | ||||
-rwxr-xr-x[-rw-r--r--] | inc/3rdparty/simple_html_dom.php | 105 | ||||
-rw-r--r-- | inc/3rdparty/site_config/standard/.about.com.txt | 14 | ||||
-rw-r--r-- | inc/3rdparty/site_config/standard/moo.nac.uci.edu.txt | 9 | ||||
-rwxr-xr-x[-rw-r--r--] | inc/3rdparty/site_config/standard/politico.com.txt | 4 | ||||
-rwxr-xr-x | inc/poche/Database.class.php | 3 | ||||
-rwxr-xr-x | inc/poche/Poche.class.php | 43 | ||||
-rwxr-xr-x | inc/poche/Tools.class.php | 6 | ||||
-rwxr-xr-x | inc/poche/config.inc.default.php | 4 |
13 files changed, 160 insertions, 72 deletions
diff --git a/inc/3rdparty/libraries/PHPePub/EPub.php b/inc/3rdparty/libraries/PHPePub/EPub.php index f1f41bd5..d9b990b7 100644 --- a/inc/3rdparty/libraries/PHPePub/EPub.php +++ b/inc/3rdparty/libraries/PHPePub/EPub.php | |||
@@ -41,6 +41,8 @@ class EPub { | |||
41 | 41 | ||
42 | private $bookVersion = EPub::BOOK_VERSION_EPUB2; | 42 | private $bookVersion = EPub::BOOK_VERSION_EPUB2; |
43 | 43 | ||
44 | private $debugInside = FALSE; | ||
45 | |||
44 | public $maxImageWidth = 768; | 46 | public $maxImageWidth = 768; |
45 | public $maxImageHeight = 1024; | 47 | public $maxImageHeight = 1024; |
46 | 48 | ||
@@ -132,10 +134,14 @@ class EPub { | |||
132 | * | 134 | * |
133 | * @return void | 135 | * @return void |
134 | */ | 136 | */ |
135 | function __construct($bookVersion = EPub::BOOK_VERSION_EPUB2, $languageCode = "en", $writingDirection = EPub::DIRECTION_LEFT_TO_RIGHT) { | 137 | function __construct($bookVersion = EPub::BOOK_VERSION_EPUB2, $debugInside = FALSE, $languageCode = "en", $writingDirection = EPub::DIRECTION_LEFT_TO_RIGHT) { |
136 | include_once("Zip.php"); | 138 | include_once("Zip.php"); |
137 | include_once("Logger.php"); | 139 | include_once("Logger.php"); |
138 | 140 | ||
141 | if (!$debugInside) { | ||
142 | error_reporting(E_ERROR | E_PARSE); | ||
143 | } | ||
144 | |||
139 | $this->bookVersion = $bookVersion; | 145 | $this->bookVersion = $bookVersion; |
140 | $this->writingDirection = $writingDirection; | 146 | $this->writingDirection = $writingDirection; |
141 | $this->languageCode = $languageCode; | 147 | $this->languageCode = $languageCode; |
diff --git a/inc/3rdparty/libraries/feedwriter/FeedWriter.php b/inc/3rdparty/libraries/feedwriter/FeedWriter.php index aa064afb..9446cddf 100755 --- a/inc/3rdparty/libraries/feedwriter/FeedWriter.php +++ b/inc/3rdparty/libraries/feedwriter/FeedWriter.php | |||
@@ -2,6 +2,7 @@ | |||
2 | define('RSS2', 1, true); | 2 | define('RSS2', 1, true); |
3 | define('JSON', 2, true); | 3 | define('JSON', 2, true); |
4 | define('JSONP', 3, true); | 4 | define('JSONP', 3, true); |
5 | define('ATOM', 4, true); | ||
5 | 6 | ||
6 | /** | 7 | /** |
7 | * Univarsel Feed Writer class | 8 | * Univarsel Feed Writer class |
diff --git a/inc/3rdparty/libraries/readability/Readability.php b/inc/3rdparty/libraries/readability/Readability.php index d0f09d74..4fa3ba63 100644..100755 --- a/inc/3rdparty/libraries/readability/Readability.php +++ b/inc/3rdparty/libraries/readability/Readability.php | |||
@@ -679,6 +679,7 @@ class Readability | |||
679 | } else { | 679 | } else { |
680 | $topCandidate->innerHTML = $page->documentElement->innerHTML; | 680 | $topCandidate->innerHTML = $page->documentElement->innerHTML; |
681 | $page->documentElement->innerHTML = ''; | 681 | $page->documentElement->innerHTML = ''; |
682 | $this->reinitBody(); | ||
682 | $page->documentElement->appendChild($topCandidate); | 683 | $page->documentElement->appendChild($topCandidate); |
683 | } | 684 | } |
684 | } else { | 685 | } else { |
@@ -794,8 +795,7 @@ class Readability | |||
794 | { | 795 | { |
795 | // TODO: find out why element disappears sometimes, e.g. for this URL http://www.businessinsider.com/6-hedge-fund-etfs-for-average-investors-2011-7 | 796 | // TODO: find out why element disappears sometimes, e.g. for this URL http://www.businessinsider.com/6-hedge-fund-etfs-for-average-investors-2011-7 |
796 | // in the meantime, we check and create an empty element if it's not there. | 797 | // in the meantime, we check and create an empty element if it's not there. |
797 | if (!isset($this->body->childNodes)) $this->body = $this->dom->createElement('body'); | 798 | $this->reinitBody(); |
798 | $this->body->innerHTML = $this->bodyCache; | ||
799 | 799 | ||
800 | if ($this->flagIsActive(self::FLAG_STRIP_UNLIKELYS)) { | 800 | if ($this->flagIsActive(self::FLAG_STRIP_UNLIKELYS)) { |
801 | $this->removeFlag(self::FLAG_STRIP_UNLIKELYS); | 801 | $this->removeFlag(self::FLAG_STRIP_UNLIKELYS); |
@@ -1134,5 +1134,18 @@ class Readability | |||
1134 | public function removeFlag($flag) { | 1134 | public function removeFlag($flag) { |
1135 | $this->flags = $this->flags & ~$flag; | 1135 | $this->flags = $this->flags & ~$flag; |
1136 | } | 1136 | } |
1137 | |||
1138 | /** | ||
1139 | * Will recreate previously deleted body property | ||
1140 | * | ||
1141 | * @return void | ||
1142 | */ | ||
1143 | protected function reinitBody() { | ||
1144 | if (!isset($this->body->childNodes)) { | ||
1145 | $this->body = $this->dom->createElement('body'); | ||
1146 | $this->body->innerHTML = $this->bodyCache; | ||
1147 | } | ||
1148 | } | ||
1149 | |||
1137 | } | 1150 | } |
1138 | ?> \ No newline at end of file | 1151 | ?> \ No newline at end of file |
diff --git a/inc/3rdparty/makefulltextfeed.php b/inc/3rdparty/makefulltextfeed.php index 7a56be8c..a081f88b 100755 --- a/inc/3rdparty/makefulltextfeed.php +++ b/inc/3rdparty/makefulltextfeed.php | |||
@@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
28 | // Request this file passing it a web page or feed URL in the querystring: makefulltextfeed.php?url=example.org/article | 28 | // Request this file passing it a web page or feed URL in the querystring: makefulltextfeed.php?url=example.org/article |
29 | // For more request parameters, see http://help.fivefilters.org/customer/portal/articles/226660-usage | 29 | // For more request parameters, see http://help.fivefilters.org/customer/portal/articles/226660-usage |
30 | 30 | ||
31 | error_reporting(E_ALL ^ E_NOTICE); | 31 | //error_reporting(E_ALL ^ E_NOTICE); |
32 | ini_set("display_errors", 1); | 32 | ini_set("display_errors", 1); |
33 | @set_time_limit(120); | 33 | @set_time_limit(120); |
34 | 34 | ||
@@ -671,7 +671,11 @@ foreach ($items as $key => $item) { | |||
671 | $html .= $item->get_description(); | 671 | $html .= $item->get_description(); |
672 | } else { | 672 | } else { |
673 | $readability->clean($content_block, 'select'); | 673 | $readability->clean($content_block, 'select'); |
674 | if ($options->rewrite_relative_urls) makeAbsolute($effective_url, $content_block); | 674 | // get base URL |
675 | $base_url = get_base_url($readability->dom); | ||
676 | if (!$base_url) $base_url = $effective_url; | ||
677 | // rewrite URLs | ||
678 | if ($options->rewrite_relative_urls) makeAbsolute($base_url, $content_block); | ||
675 | // footnotes | 679 | // footnotes |
676 | if (($links == 'footnotes') && (strpos($effective_url, 'wikipedia.org') === false)) { | 680 | if (($links == 'footnotes') && (strpos($effective_url, 'wikipedia.org') === false)) { |
677 | $readability->addFootnotes($content_block); | 681 | $readability->addFootnotes($content_block); |
diff --git a/inc/3rdparty/makefulltextfeedHelpers.php b/inc/3rdparty/makefulltextfeedHelpers.php index 4e985372..ac872ab8 100755 --- a/inc/3rdparty/makefulltextfeedHelpers.php +++ b/inc/3rdparty/makefulltextfeedHelpers.php | |||
@@ -377,3 +377,13 @@ function debug($msg) { | |||
377 | flush(); | 377 | flush(); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | |||
381 | function get_base_url($dom) { | ||
382 | $xpath = new DOMXPath($dom); | ||
383 | $base_url = @$xpath->evaluate('string(//head/base/@href)', $dom); | ||
384 | if ($base_url !== '') { | ||
385 | return $base_url; | ||
386 | } else { | ||
387 | return false; | ||
388 | } | ||
389 | } | ||
diff --git a/inc/3rdparty/simple_html_dom.php b/inc/3rdparty/simple_html_dom.php index 43b94e57..9b73b105 100644..100755 --- a/inc/3rdparty/simple_html_dom.php +++ b/inc/3rdparty/simple_html_dom.php | |||
@@ -34,7 +34,7 @@ | |||
34 | * @author S.C. Chen <me578022@gmail.com> | 34 | * @author S.C. Chen <me578022@gmail.com> |
35 | * @author John Schlick | 35 | * @author John Schlick |
36 | * @author Rus Carroll | 36 | * @author Rus Carroll |
37 | * @version 1.5 ($Rev: 202 $) | 37 | * @version 1.5 ($Rev: 210 $) |
38 | * @package PlaceLocalInclude | 38 | * @package PlaceLocalInclude |
39 | * @subpackage simple_html_dom | 39 | * @subpackage simple_html_dom |
40 | */ | 40 | */ |
@@ -269,7 +269,10 @@ class simple_html_dom_node | |||
269 | { | 269 | { |
270 | return $this->children; | 270 | return $this->children; |
271 | } | 271 | } |
272 | if (isset($this->children[$idx])) return $this->children[$idx]; | 272 | if (isset($this->children[$idx])) |
273 | { | ||
274 | return $this->children[$idx]; | ||
275 | } | ||
273 | return null; | 276 | return null; |
274 | } | 277 | } |
275 | 278 | ||
@@ -330,14 +333,14 @@ class simple_html_dom_node | |||
330 | function find_ancestor_tag($tag) | 333 | function find_ancestor_tag($tag) |
331 | { | 334 | { |
332 | global $debug_object; | 335 | global $debug_object; |
333 | if (is_object($debug_object)) { $debug_object->debugLogEntry(1); } | 336 | if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } |
334 | 337 | ||
335 | // Start by including ourselves in the comparison. | 338 | // Start by including ourselves in the comparison. |
336 | $returnDom = $this; | 339 | $returnDom = $this; |
337 | 340 | ||
338 | while (!is_null($returnDom)) | 341 | while (!is_null($returnDom)) |
339 | { | 342 | { |
340 | if (is_object($debug_object)) { $debug_object->debugLog(2, "Current tag is: " . $returnDom->tag); } | 343 | if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: " . $returnDom->tag); } |
341 | 344 | ||
342 | if ($returnDom->tag == $tag) | 345 | if ($returnDom->tag == $tag) |
343 | { | 346 | { |
@@ -374,7 +377,7 @@ class simple_html_dom_node | |||
374 | $text = " with text: " . $this->text; | 377 | $text = " with text: " . $this->text; |
375 | } | 378 | } |
376 | } | 379 | } |
377 | $debug_object->debugLog(1, 'Innertext of tag: ' . $this->tag . $text); | 380 | $debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text); |
378 | } | 381 | } |
379 | 382 | ||
380 | if ($this->tag==='root') return $this->innertext(); | 383 | if ($this->tag==='root') return $this->innertext(); |
@@ -532,7 +535,9 @@ class simple_html_dom_node | |||
532 | foreach ($head as $k=>$v) | 535 | foreach ($head as $k=>$v) |
533 | { | 536 | { |
534 | if (!isset($found_keys[$k])) | 537 | if (!isset($found_keys[$k])) |
538 | { | ||
535 | $found_keys[$k] = 1; | 539 | $found_keys[$k] = 1; |
540 | } | ||
536 | } | 541 | } |
537 | } | 542 | } |
538 | 543 | ||
@@ -554,7 +559,7 @@ class simple_html_dom_node | |||
554 | protected function seek($selector, &$ret, $lowercase=false) | 559 | protected function seek($selector, &$ret, $lowercase=false) |
555 | { | 560 | { |
556 | global $debug_object; | 561 | global $debug_object; |
557 | if (is_object($debug_object)) { $debug_object->debugLogEntry(1); } | 562 | if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } |
558 | 563 | ||
559 | list($tag, $key, $val, $exp, $no_key) = $selector; | 564 | list($tag, $key, $val, $exp, $no_key) = $selector; |
560 | 565 | ||
@@ -615,7 +620,7 @@ class simple_html_dom_node | |||
615 | // this is a normal search, we want the value of that attribute of the tag. | 620 | // this is a normal search, we want the value of that attribute of the tag. |
616 | $nodeKeyValue = $node->attr[$key]; | 621 | $nodeKeyValue = $node->attr[$key]; |
617 | } | 622 | } |
618 | if (is_object($debug_object)) {$debug_object->debugLog(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);} | 623 | if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);} |
619 | 624 | ||
620 | //PaperG - If lowercase is set, do a case insensitive test of the value of the selector. | 625 | //PaperG - If lowercase is set, do a case insensitive test of the value of the selector. |
621 | if ($lowercase) { | 626 | if ($lowercase) { |
@@ -623,7 +628,7 @@ class simple_html_dom_node | |||
623 | } else { | 628 | } else { |
624 | $check = $this->match($exp, $val, $nodeKeyValue); | 629 | $check = $this->match($exp, $val, $nodeKeyValue); |
625 | } | 630 | } |
626 | if (is_object($debug_object)) {$debug_object->debugLog(2, "after match: " . ($check ? "true" : "false"));} | 631 | if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: " . ($check ? "true" : "false"));} |
627 | 632 | ||
628 | // handle multiple class | 633 | // handle multiple class |
629 | if (!$check && strcasecmp($key, 'class')===0) { | 634 | if (!$check && strcasecmp($key, 'class')===0) { |
@@ -645,12 +650,12 @@ class simple_html_dom_node | |||
645 | unset($node); | 650 | unset($node); |
646 | } | 651 | } |
647 | // It's passed by reference so this is actually what this function returns. | 652 | // It's passed by reference so this is actually what this function returns. |
648 | if (is_object($debug_object)) {$debug_object->debugLog(1, "EXIT - ret: ", $ret);} | 653 | if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret);} |
649 | } | 654 | } |
650 | 655 | ||
651 | protected function match($exp, $pattern, $value) { | 656 | protected function match($exp, $pattern, $value) { |
652 | global $debug_object; | 657 | global $debug_object; |
653 | if (is_object($debug_object)) {$debug_object->debugLogEntry(1);} | 658 | if (is_object($debug_object)) {$debug_object->debug_log_entry(1);} |
654 | 659 | ||
655 | switch ($exp) { | 660 | switch ($exp) { |
656 | case '=': | 661 | case '=': |
@@ -672,7 +677,7 @@ class simple_html_dom_node | |||
672 | 677 | ||
673 | protected function parse_selector($selector_string) { | 678 | protected function parse_selector($selector_string) { |
674 | global $debug_object; | 679 | global $debug_object; |
675 | if (is_object($debug_object)) {$debug_object->debugLogEntry(1);} | 680 | if (is_object($debug_object)) {$debug_object->debug_log_entry(1);} |
676 | 681 | ||
677 | // pattern of CSS selectors, modified from mootools | 682 | // pattern of CSS selectors, modified from mootools |
678 | // Paperg: Add the colon to the attrbute, so that it properly finds <tag attr:ibute="something" > like google does. | 683 | // Paperg: Add the colon to the attrbute, so that it properly finds <tag attr:ibute="something" > like google does. |
@@ -683,7 +688,7 @@ class simple_html_dom_node | |||
683 | // $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; | 688 | // $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; |
684 | $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; | 689 | $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; |
685 | preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER); | 690 | preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER); |
686 | if (is_object($debug_object)) {$debug_object->debugLog(2, "Matches Array: ", $matches);} | 691 | if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches);} |
687 | 692 | ||
688 | $selectors = array(); | 693 | $selectors = array(); |
689 | $result = array(); | 694 | $result = array(); |
@@ -718,12 +723,14 @@ class simple_html_dom_node | |||
718 | return $selectors; | 723 | return $selectors; |
719 | } | 724 | } |
720 | 725 | ||
721 | function __get($name) { | 726 | function __get($name) |
727 | { | ||
722 | if (isset($this->attr[$name])) | 728 | if (isset($this->attr[$name])) |
723 | { | 729 | { |
724 | return $this->convert_text($this->attr[$name]); | 730 | return $this->convert_text($this->attr[$name]); |
725 | } | 731 | } |
726 | switch ($name) { | 732 | switch ($name) |
733 | { | ||
727 | case 'outertext': return $this->outertext(); | 734 | case 'outertext': return $this->outertext(); |
728 | case 'innertext': return $this->innertext(); | 735 | case 'innertext': return $this->innertext(); |
729 | case 'plaintext': return $this->text(); | 736 | case 'plaintext': return $this->text(); |
@@ -732,22 +739,30 @@ class simple_html_dom_node | |||
732 | } | 739 | } |
733 | } | 740 | } |
734 | 741 | ||
735 | function __set($name, $value) { | 742 | function __set($name, $value) |
736 | switch ($name) { | 743 | { |
744 | global $debug_object; | ||
745 | if (is_object($debug_object)) {$debug_object->debug_log_entry(1);} | ||
746 | |||
747 | switch ($name) | ||
748 | { | ||
737 | case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value; | 749 | case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value; |
738 | case 'innertext': | 750 | case 'innertext': |
739 | if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value; | 751 | if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value; |
740 | return $this->_[HDOM_INFO_INNER] = $value; | 752 | return $this->_[HDOM_INFO_INNER] = $value; |
741 | } | 753 | } |
742 | if (!isset($this->attr[$name])) { | 754 | if (!isset($this->attr[$name])) |
755 | { | ||
743 | $this->_[HDOM_INFO_SPACE][] = array(' ', '', ''); | 756 | $this->_[HDOM_INFO_SPACE][] = array(' ', '', ''); |
744 | $this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE; | 757 | $this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE; |
745 | } | 758 | } |
746 | $this->attr[$name] = $value; | 759 | $this->attr[$name] = $value; |
747 | } | 760 | } |
748 | 761 | ||
749 | function __isset($name) { | 762 | function __isset($name) |
750 | switch ($name) { | 763 | { |
764 | switch ($name) | ||
765 | { | ||
751 | case 'outertext': return true; | 766 | case 'outertext': return true; |
752 | case 'innertext': return true; | 767 | case 'innertext': return true; |
753 | case 'plaintext': return true; | 768 | case 'plaintext': return true; |
@@ -765,7 +780,7 @@ class simple_html_dom_node | |||
765 | function convert_text($text) | 780 | function convert_text($text) |
766 | { | 781 | { |
767 | global $debug_object; | 782 | global $debug_object; |
768 | if (is_object($debug_object)) {$debug_object->debugLogEntry(1);} | 783 | if (is_object($debug_object)) {$debug_object->debug_log_entry(1);} |
769 | 784 | ||
770 | $converted_text = $text; | 785 | $converted_text = $text; |
771 | 786 | ||
@@ -777,7 +792,7 @@ class simple_html_dom_node | |||
777 | $sourceCharset = strtoupper($this->dom->_charset); | 792 | $sourceCharset = strtoupper($this->dom->_charset); |
778 | $targetCharset = strtoupper($this->dom->_target_charset); | 793 | $targetCharset = strtoupper($this->dom->_target_charset); |
779 | } | 794 | } |
780 | if (is_object($debug_object)) {$debug_object->debugLog(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);} | 795 | if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);} |
781 | 796 | ||
782 | if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0)) | 797 | if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0)) |
783 | { | 798 | { |
@@ -1045,10 +1060,10 @@ class simple_html_dom | |||
1045 | 1060 | ||
1046 | // prepare | 1061 | // prepare |
1047 | $this->prepare($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText); | 1062 | $this->prepare($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText); |
1048 | // strip out comments | ||
1049 | $this->remove_noise("'<!--(.*?)-->'is"); | ||
1050 | // strip out cdata | 1063 | // strip out cdata |
1051 | $this->remove_noise("'<!\[CDATA\[(.*?)\]\]>'is", true); | 1064 | $this->remove_noise("'<!\[CDATA\[(.*?)\]\]>'is", true); |
1065 | // strip out comments | ||
1066 | $this->remove_noise("'<!--(.*?)-->'is"); | ||
1052 | // Per sourceforge http://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037 | 1067 | // Per sourceforge http://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037 |
1053 | // Script tags removal now preceeds style tag removal. | 1068 | // Script tags removal now preceeds style tag removal. |
1054 | // strip out <script> tags | 1069 | // strip out <script> tags |
@@ -1078,10 +1093,15 @@ class simple_html_dom | |||
1078 | // load html from file | 1093 | // load html from file |
1079 | function load_file() | 1094 | function load_file() |
1080 | { | 1095 | { |
1096 | //external error: NOT related to dom loading | ||
1097 | $extError=error_get_last(); | ||
1098 | |||
1081 | $args = func_get_args(); | 1099 | $args = func_get_args(); |
1082 | $this->load(call_user_func_array('file_get_contents', $args), true); | 1100 | $this->load(call_user_func_array('file_get_contents', $args), true); |
1101 | |||
1083 | // Throw an error if we can't properly load the dom. | 1102 | // Throw an error if we can't properly load the dom. |
1084 | if (($error=error_get_last())!==null) { | 1103 | $error=error_get_last(); |
1104 | if ($error!==$extError) { | ||
1085 | $this->clear(); | 1105 | $this->clear(); |
1086 | return false; | 1106 | return false; |
1087 | } | 1107 | } |
@@ -1198,22 +1218,22 @@ class simple_html_dom | |||
1198 | if ($success) | 1218 | if ($success) |
1199 | { | 1219 | { |
1200 | $charset = $matches[1]; | 1220 | $charset = $matches[1]; |
1201 | if (is_object($debug_object)) {$debug_object->debugLog(2, 'header content-type found charset of: ' . $charset);} | 1221 | if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: ' . $charset);} |
1202 | } | 1222 | } |
1203 | 1223 | ||
1204 | } | 1224 | } |
1205 | 1225 | ||
1206 | if (empty($charset)) | 1226 | if (empty($charset)) |
1207 | { | 1227 | { |
1208 | $el = $this->root->find('meta[http-equiv=Content-Type]',0); | 1228 | $el = $this->root->find('meta[http-equiv=Content-Type]',0, true); |
1209 | if (!empty($el)) | 1229 | if (!empty($el)) |
1210 | { | 1230 | { |
1211 | $fullvalue = $el->content; | 1231 | $fullvalue = $el->content; |
1212 | if (is_object($debug_object)) {$debug_object->debugLog(2, 'meta content-type tag found' . $fullvalue);} | 1232 | if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found' . $fullvalue);} |
1213 | 1233 | ||
1214 | if (!empty($fullvalue)) | 1234 | if (!empty($fullvalue)) |
1215 | { | 1235 | { |
1216 | $success = preg_match('/charset=(.+)/', $fullvalue, $matches); | 1236 | $success = preg_match('/charset=(.+)/i', $fullvalue, $matches); |
1217 | if ($success) | 1237 | if ($success) |
1218 | { | 1238 | { |
1219 | $charset = $matches[1]; | 1239 | $charset = $matches[1]; |
@@ -1221,7 +1241,7 @@ class simple_html_dom | |||
1221 | else | 1241 | else |
1222 | { | 1242 | { |
1223 | // If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1 | 1243 | // If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1 |
1224 | if (is_object($debug_object)) {$debug_object->debugLog(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');} | 1244 | if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');} |
1225 | $charset = 'ISO-8859-1'; | 1245 | $charset = 'ISO-8859-1'; |
1226 | } | 1246 | } |
1227 | } | 1247 | } |
@@ -1231,14 +1251,19 @@ class simple_html_dom | |||
1231 | // If we couldn't find a charset above, then lets try to detect one based on the text we got... | 1251 | // If we couldn't find a charset above, then lets try to detect one based on the text we got... |
1232 | if (empty($charset)) | 1252 | if (empty($charset)) |
1233 | { | 1253 | { |
1234 | // Have php try to detect the encoding from the text given to us. | 1254 | // Use this in case mb_detect_charset isn't installed/loaded on this machine. |
1235 | $charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) ); | 1255 | $charset = false; |
1236 | if (is_object($debug_object)) {$debug_object->debugLog(2, 'mb_detect found: ' . $charset);} | 1256 | if (function_exists('mb_detect_encoding')) |
1257 | { | ||
1258 | // Have php try to detect the encoding from the text given to us. | ||
1259 | $charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) ); | ||
1260 | if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: ' . $charset);} | ||
1261 | } | ||
1237 | 1262 | ||
1238 | // and if this doesn't work... then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need... | 1263 | // and if this doesn't work... then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need... |
1239 | if ($charset === false) | 1264 | if ($charset === false) |
1240 | { | 1265 | { |
1241 | if (is_object($debug_object)) {$debug_object->debugLog(2, 'since mb_detect failed - using default of utf-8');} | 1266 | if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8');} |
1242 | $charset = 'UTF-8'; | 1267 | $charset = 'UTF-8'; |
1243 | } | 1268 | } |
1244 | } | 1269 | } |
@@ -1246,11 +1271,11 @@ class simple_html_dom | |||
1246 | // Since CP1252 is a superset, if we get one of it's subsets, we want it instead. | 1271 | // Since CP1252 is a superset, if we get one of it's subsets, we want it instead. |
1247 | if ((strtolower($charset) == strtolower('ISO-8859-1')) || (strtolower($charset) == strtolower('Latin1')) || (strtolower($charset) == strtolower('Latin-1'))) | 1272 | if ((strtolower($charset) == strtolower('ISO-8859-1')) || (strtolower($charset) == strtolower('Latin1')) || (strtolower($charset) == strtolower('Latin-1'))) |
1248 | { | 1273 | { |
1249 | if (is_object($debug_object)) {$debug_object->debugLog(2, 'replacing ' . $charset . ' with CP1252 as its a superset');} | 1274 | if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing ' . $charset . ' with CP1252 as its a superset');} |
1250 | $charset = 'CP1252'; | 1275 | $charset = 'CP1252'; |
1251 | } | 1276 | } |
1252 | 1277 | ||
1253 | if (is_object($debug_object)) {$debug_object->debugLog(1, 'EXIT - ' . $charset);} | 1278 | if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - ' . $charset);} |
1254 | 1279 | ||
1255 | return $this->_charset = $charset; | 1280 | return $this->_charset = $charset; |
1256 | } | 1281 | } |
@@ -1616,14 +1641,14 @@ class simple_html_dom | |||
1616 | protected function remove_noise($pattern, $remove_tag=false) | 1641 | protected function remove_noise($pattern, $remove_tag=false) |
1617 | { | 1642 | { |
1618 | global $debug_object; | 1643 | global $debug_object; |
1619 | if (is_object($debug_object)) { $debug_object->debugLogEntry(1); } | 1644 | if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } |
1620 | 1645 | ||
1621 | $count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE); | 1646 | $count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE); |
1622 | 1647 | ||
1623 | for ($i=$count-1; $i>-1; --$i) | 1648 | for ($i=$count-1; $i>-1; --$i) |
1624 | { | 1649 | { |
1625 | $key = '___noise___'.sprintf('% 5d', count($this->noise)+1000); | 1650 | $key = '___noise___'.sprintf('% 5d', count($this->noise)+1000); |
1626 | if (is_object($debug_object)) { $debug_object->debugLog(2, 'key is: ' . $key); } | 1651 | if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: ' . $key); } |
1627 | $idx = ($remove_tag) ? 0 : 1; | 1652 | $idx = ($remove_tag) ? 0 : 1; |
1628 | $this->noise[$key] = $matches[$i][$idx][0]; | 1653 | $this->noise[$key] = $matches[$i][$idx][0]; |
1629 | $this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0])); | 1654 | $this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0])); |
@@ -1641,7 +1666,7 @@ class simple_html_dom | |||
1641 | function restore_noise($text) | 1666 | function restore_noise($text) |
1642 | { | 1667 | { |
1643 | global $debug_object; | 1668 | global $debug_object; |
1644 | if (is_object($debug_object)) { $debug_object->debugLogEntry(1); } | 1669 | if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } |
1645 | 1670 | ||
1646 | while (($pos=strpos($text, '___noise___'))!==false) | 1671 | while (($pos=strpos($text, '___noise___'))!==false) |
1647 | { | 1672 | { |
@@ -1649,7 +1674,7 @@ class simple_html_dom | |||
1649 | if (strlen($text) > $pos+15) | 1674 | if (strlen($text) > $pos+15) |
1650 | { | 1675 | { |
1651 | $key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13].$text[$pos+14].$text[$pos+15]; | 1676 | $key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13].$text[$pos+14].$text[$pos+15]; |
1652 | if (is_object($debug_object)) { $debug_object->debugLog(2, 'located key of: ' . $key); } | 1677 | if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: ' . $key); } |
1653 | 1678 | ||
1654 | if (isset($this->noise[$key])) | 1679 | if (isset($this->noise[$key])) |
1655 | { | 1680 | { |
@@ -1674,7 +1699,7 @@ class simple_html_dom | |||
1674 | function search_noise($text) | 1699 | function search_noise($text) |
1675 | { | 1700 | { |
1676 | global $debug_object; | 1701 | global $debug_object; |
1677 | if (is_object($debug_object)) { $debug_object->debugLogEntry(1); } | 1702 | if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } |
1678 | 1703 | ||
1679 | foreach($this->noise as $noiseElement) | 1704 | foreach($this->noise as $noiseElement) |
1680 | { | 1705 | { |
diff --git a/inc/3rdparty/site_config/standard/.about.com.txt b/inc/3rdparty/site_config/standard/.about.com.txt new file mode 100644 index 00000000..e1ebaee3 --- /dev/null +++ b/inc/3rdparty/site_config/standard/.about.com.txt | |||
@@ -0,0 +1,14 @@ | |||
1 | body: //div[@id='articlebody'] | ||
2 | title: //h1 | ||
3 | author: //p[@id='by']//a | ||
4 | |||
5 | next_page_link: //span[@class='next']/a | ||
6 | # Not the same as below! | ||
7 | |||
8 | prune: yes | ||
9 | tidy: no | ||
10 | |||
11 | # Annoying 'next' links plainly inside the article body | ||
12 | strip: //*[text()[contains(.,'Next: ')]] | ||
13 | |||
14 | test_url: http://psychology.about.com/od/theoriesofpersonality/ss/defensemech.htm | ||
diff --git a/inc/3rdparty/site_config/standard/moo.nac.uci.edu.txt b/inc/3rdparty/site_config/standard/moo.nac.uci.edu.txt new file mode 100644 index 00000000..24c949e9 --- /dev/null +++ b/inc/3rdparty/site_config/standard/moo.nac.uci.edu.txt | |||
@@ -0,0 +1,9 @@ | |||
1 | title: //div[@id='header']//h1[1] | ||
2 | |||
3 | body: //div[@id='content'] | ||
4 | |||
5 | strip_id_or_class: toc | ||
6 | |||
7 | prune: no | ||
8 | |||
9 | test_url: http://moo.nac.uci.edu/~hjm/HOWTO_move_data.html | ||
diff --git a/inc/3rdparty/site_config/standard/politico.com.txt b/inc/3rdparty/site_config/standard/politico.com.txt index 121fd5b9..c5302d1b 100644..100755 --- a/inc/3rdparty/site_config/standard/politico.com.txt +++ b/inc/3rdparty/site_config/standard/politico.com.txt | |||
@@ -4,10 +4,14 @@ body://div[contains(@class,"story-text")] | |||
4 | # Why doesn't this work? next_page_link://ul[contains(@class,"pagination")]/li/a[@rel="next"] | 4 | # Why doesn't this work? next_page_link://ul[contains(@class,"pagination")]/li/a[@rel="next"] |
5 | 5 | ||
6 | next_page_link://ul[contains(@class,"pagination")]/li[contains(@class, "current")]/following-sibling::node()/a | 6 | next_page_link://ul[contains(@class,"pagination")]/li[contains(@class, "current")]/following-sibling::node()/a |
7 | next_page_link://div[contains(@class,"pagination")]/ol/li[contains(@class, "current")]/following-sibling::node()/a | ||
7 | date://meta[@name="publish_date"]/@content | 8 | date://meta[@name="publish_date"]/@content |
8 | 9 | ||
9 | strip://div[contains(@class, "breadcrumbs")] | 10 | strip://div[contains(@class, "breadcrumbs")] |
10 | strip://a[contains(@class, "hidden")] | 11 | strip://a[contains(@class, "hidden")] |
11 | strip://div[contains(@class, "story-embed")] | 12 | strip://div[contains(@class, "story-embed")] |
12 | strip://div[contains(@class, "story-text")]//p/a[contains(text(), "Also on POLITICO:")]/.. | 13 | strip://div[contains(@class, "story-text")]//p/a[contains(text(), "Also on POLITICO:")]/.. |
14 | strip://div[contains(@class, "story-interrupt")] | ||
15 | strip://footer[contains(@class, "author-bio")] | ||
16 | |||
13 | test_url: http://www.politico.com/news/stories/0712/78105.html \ No newline at end of file | 17 | test_url: http://www.politico.com/news/stories/0712/78105.html \ No newline at end of file |
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 9e901974..11cccb72 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -409,6 +409,7 @@ class Database { | |||
409 | public function add($url, $title, $content, $user_id, $isFavorite=0, $isRead=0) { | 409 | public function add($url, $title, $content, $user_id, $isFavorite=0, $isRead=0) { |
410 | $sql_action = 'INSERT INTO entries ( url, title, content, user_id, is_fav, is_read ) VALUES (?, ?, ?, ?, ?, ?)'; | 410 | $sql_action = 'INSERT INTO entries ( url, title, content, user_id, is_fav, is_read ) VALUES (?, ?, ?, ?, ?, ?)'; |
411 | $params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead); | 411 | $params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead); |
412 | |||
412 | if ( !$this->executeQuery($sql_action, $params_action) ) { | 413 | if ( !$this->executeQuery($sql_action, $params_action) ) { |
413 | $id = null; | 414 | $id = null; |
414 | } | 415 | } |
@@ -487,7 +488,7 @@ class Database { | |||
487 | $sql = | 488 | $sql = |
488 | "SELECT entries.* FROM entries | 489 | "SELECT entries.* FROM entries |
489 | LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id | 490 | LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id |
490 | WHERE tags_entries.tag_id = ? AND entries.user_id=?"; | 491 | WHERE tags_entries.tag_id = ? AND entries.user_id=? ORDER by entries.id DESC"; |
491 | $query = $this->executeQuery($sql, array($tag_id, $user_id)); | 492 | $query = $this->executeQuery($sql, array($tag_id, $user_id)); |
492 | $entries = $query->fetchAll(); | 493 | $entries = $query->fetchAll(); |
493 | 494 | ||
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 37cf66a3..09a9f5ff 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -1083,11 +1083,10 @@ class Poche | |||
1083 | $config = $this->store->getConfigUser($user_id); | 1083 | $config = $this->store->getConfigUser($user_id); |
1084 | 1084 | ||
1085 | if ($config == null) { | 1085 | if ($config == null) { |
1086 | die(_('User with this id (' . $user_id . ') does not exist.')); | 1086 | die(sprintf(_('User with this id (%d) does not exist.'), $user_id)); |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | if (!in_array($type, $allowed_types) || | 1089 | if (!in_array($type, $allowed_types) || $token != $config['token']) { |
1090 | $token != $config['token']) { | ||
1091 | die(_('Uh, there is a problem while generating feeds.')); | 1090 | die(_('Uh, there is a problem while generating feeds.')); |
1092 | } | 1091 | } |
1093 | // Check the token | 1092 | // Check the token |
@@ -1145,17 +1144,18 @@ class Poche | |||
1145 | $config = HTMLPurifier_Config::createDefault(); | 1144 | $config = HTMLPurifier_Config::createDefault(); |
1146 | $config->set('Cache.SerializerPath', CACHE); | 1145 | $config->set('Cache.SerializerPath', CACHE); |
1147 | $config->set('HTML.SafeIframe', true); | 1146 | $config->set('HTML.SafeIframe', true); |
1147 | |||
1148 | //allow YouTube, Vimeo and dailymotion videos | 1148 | //allow YouTube, Vimeo and dailymotion videos |
1149 | $config->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/|www\.dailymotion\.com/embed/video/)%'); | 1149 | $config->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/|www\.dailymotion\.com/embed/video/)%'); |
1150 | 1150 | ||
1151 | return new HTMLPurifier($config); | 1151 | return new HTMLPurifier($config); |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | /** | 1154 | /** |
1155 | * handle epub | 1155 | * handle epub |
1156 | */ | 1156 | */ |
1157 | public function createEpub() { | 1157 | public function createEpub() { |
1158 | 1158 | ||
1159 | switch ($_GET['method']) { | 1159 | switch ($_GET['method']) { |
1160 | case 'id': | 1160 | case 'id': |
1161 | $entryID = filter_var($_GET['id'],FILTER_SANITIZE_NUMBER_INT); | 1161 | $entryID = filter_var($_GET['id'],FILTER_SANITIZE_NUMBER_INT); |
@@ -1191,7 +1191,7 @@ class Poche | |||
1191 | break; | 1191 | break; |
1192 | case 'default': | 1192 | case 'default': |
1193 | die(_('Uh, there is a problem while generating epub.')); | 1193 | die(_('Uh, there is a problem while generating epub.')); |
1194 | 1194 | ||
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | $content_start = | 1197 | $content_start = |
@@ -1204,19 +1204,18 @@ class Poche | |||
1204 | . "<body>\n"; | 1204 | . "<body>\n"; |
1205 | 1205 | ||
1206 | $bookEnd = "</body>\n</html>\n"; | 1206 | $bookEnd = "</body>\n</html>\n"; |
1207 | 1207 | ||
1208 | $log = new Logger("wallabag", TRUE); | 1208 | $log = new Logger("wallabag", TRUE); |
1209 | $fileDir = CACHE; | 1209 | $fileDir = CACHE; |
1210 | |||
1211 | 1210 | ||
1212 | $book = new EPub(EPub::BOOK_VERSION_EPUB3); | 1211 | $book = new EPub(EPub::BOOK_VERSION_EPUB3, DEBUG_POCHE); |
1213 | $log->logLine("new EPub()"); | 1212 | $log->logLine("new EPub()"); |
1214 | $log->logLine("EPub class version: " . EPub::VERSION); | 1213 | $log->logLine("EPub class version: " . EPub::VERSION); |
1215 | $log->logLine("EPub Req. Zip version: " . EPub::REQ_ZIP_VERSION); | 1214 | $log->logLine("EPub Req. Zip version: " . EPub::REQ_ZIP_VERSION); |
1216 | $log->logLine("Zip version: " . Zip::VERSION); | 1215 | $log->logLine("Zip version: " . Zip::VERSION); |
1217 | $log->logLine("getCurrentServerURL: " . $book->getCurrentServerURL()); | 1216 | $log->logLine("getCurrentServerURL: " . $book->getCurrentServerURL()); |
1218 | $log->logLine("getCurrentPageURL..: " . $book->getCurrentPageURL()); | 1217 | $log->logLine("getCurrentPageURL..: " . $book->getCurrentPageURL()); |
1219 | 1218 | ||
1220 | $book->setTitle(_('wallabag\'s articles')); | 1219 | $book->setTitle(_('wallabag\'s articles')); |
1221 | $book->setIdentifier("http://$_SERVER[HTTP_HOST]", EPub::IDENTIFIER_URI); // Could also be the ISBN number, prefered for published books, or a UUID. | 1220 | $book->setIdentifier("http://$_SERVER[HTTP_HOST]", EPub::IDENTIFIER_URI); // Could also be the ISBN number, prefered for published books, or a UUID. |
1222 | //$book->setLanguage("en"); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc. | 1221 | //$book->setLanguage("en"); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc. |
@@ -1226,39 +1225,39 @@ class Poche | |||
1226 | $book->setDate(time()); // Strictly not needed as the book date defaults to time(). | 1225 | $book->setDate(time()); // Strictly not needed as the book date defaults to time(). |
1227 | //$book->setRights("Copyright and licence information specific for the book."); // As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book. | 1226 | //$book->setRights("Copyright and licence information specific for the book."); // As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book. |
1228 | $book->setSourceURL("http://$_SERVER[HTTP_HOST]"); | 1227 | $book->setSourceURL("http://$_SERVER[HTTP_HOST]"); |
1229 | 1228 | ||
1230 | $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); | 1229 | $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); |
1231 | $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "wallabag"); | 1230 | $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "wallabag"); |
1232 | 1231 | ||
1233 | $cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; | 1232 | $cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; |
1234 | 1233 | ||
1235 | $log->logLine("Add Cover"); | 1234 | $log->logLine("Add Cover"); |
1236 | 1235 | ||
1237 | $fullTitle = "<h1> " . $bookTitle . "</h1>\n"; | 1236 | $fullTitle = "<h1> " . $bookTitle . "</h1>\n"; |
1238 | 1237 | ||
1239 | $book->setCoverImage("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png", $fullTitle); | 1238 | $book->setCoverImage("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png", $fullTitle); |
1240 | 1239 | ||
1241 | $cover = $content_start . '<div style="text-align:center;"><p>' . _('Produced by wallabag with PHPePub') . '</p><p>'. _('Please open <a href="https://github.com/wallabag/wallabag/issues" >an issue</a> if you have trouble with the display of this E-Book on your device.') . '</p></div>' . $bookEnd; | 1240 | $cover = $content_start . '<div style="text-align:center;"><p>' . _('Produced by wallabag with PHPePub') . '</p><p>'. _('Please open <a href="https://github.com/wallabag/wallabag/issues" >an issue</a> if you have trouble with the display of this E-Book on your device.') . '</p></div>' . $bookEnd; |
1242 | 1241 | ||
1243 | //$book->addChapter("Table of Contents", "TOC.xhtml", NULL, false, EPub::EXTERNAL_REF_IGNORE); | 1242 | //$book->addChapter("Table of Contents", "TOC.xhtml", NULL, false, EPub::EXTERNAL_REF_IGNORE); |
1244 | $book->addChapter("Notices", "Cover2.html", $cover); | 1243 | $book->addChapter("Notices", "Cover2.html", $cover); |
1245 | 1244 | ||
1246 | $book->buildTOC(); | 1245 | $book->buildTOC(); |
1247 | 1246 | ||
1248 | foreach ($entries as $entry) { //set tags as subjects | 1247 | foreach ($entries as $entry) { //set tags as subjects |
1249 | $tags = $this->store->retrieveTagsByEntry($entry['id']); | 1248 | $tags = $this->store->retrieveTagsByEntry($entry['id']); |
1250 | foreach ($tags as $tag) { | 1249 | foreach ($tags as $tag) { |
1251 | $book->setSubject($tag['value']); | 1250 | $book->setSubject($tag['value']); |
1252 | } | 1251 | } |
1253 | 1252 | ||
1254 | $log->logLine("Set up parameters"); | 1253 | $log->logLine("Set up parameters"); |
1255 | 1254 | ||
1256 | $chapter = $content_start . $entry['content'] . $bookEnd; | 1255 | $chapter = $content_start . $entry['content'] . $bookEnd; |
1257 | $book->addChapter($entry['title'], htmlspecialchars($entry['title']) . ".html", $chapter, true, EPub::EXTERNAL_REF_ADD); | 1256 | $book->addChapter($entry['title'], htmlspecialchars($entry['title']) . ".html", $chapter, true, EPub::EXTERNAL_REF_ADD); |
1258 | $log->logLine("Added chapter " . $entry['title']); | 1257 | $log->logLine("Added chapter " . $entry['title']); |
1259 | } | 1258 | } |
1260 | 1259 | ||
1261 | if (DEBUG_POCHE) { | 1260 | if (DEBUG_POCHE) { |
1262 | $epuplog = $book->getLog(); | 1261 | $epuplog = $book->getLog(); |
1263 | $book->addChapter("Log", "Log.html", $content_start . $log->getLog() . "\n</pre>" . $bookEnd); // log generation | 1262 | $book->addChapter("Log", "Log.html", $content_start . $log->getLog() . "\n</pre>" . $bookEnd); // log generation |
1264 | } | 1263 | } |
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 8073a3fe..cc01f403 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php | |||
@@ -18,8 +18,6 @@ class Tools | |||
18 | die(_('Oops, it seems you don\'t have PHP 5.')); | 18 | die(_('Oops, it seems you don\'t have PHP 5.')); |
19 | } | 19 | } |
20 | 20 | ||
21 | error_reporting(E_ALL); | ||
22 | |||
23 | function stripslashesDeep($value) { | 21 | function stripslashesDeep($value) { |
24 | return is_array($value) | 22 | return is_array($value) |
25 | ? array_map('stripslashesDeep', $value) | 23 | ? array_map('stripslashesDeep', $value) |
@@ -64,7 +62,7 @@ class Tools | |||
64 | if (strpos($host, ':') !== false) { | 62 | if (strpos($host, ':') !== false) { |
65 | $serverport = ''; | 63 | $serverport = ''; |
66 | } | 64 | } |
67 | 65 | ||
68 | return 'http' . ($https ? 's' : '') . '://' | 66 | return 'http' . ($https ? 's' : '') . '://' |
69 | . $host . $serverport . $scriptname; | 67 | . $host . $serverport . $scriptname; |
70 | } | 68 | } |
@@ -218,7 +216,7 @@ class Tools | |||
218 | 216 | ||
219 | public static function getDomain($url) | 217 | public static function getDomain($url) |
220 | { | 218 | { |
221 | return parse_url($url, PHP_URL_HOST); | 219 | return parse_url($url, PHP_URL_HOST); |
222 | } | 220 | } |
223 | 221 | ||
224 | public static function getReadingTime($text) { | 222 | public static function getReadingTime($text) { |
diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php index ffcd205d..95f727c6 100755 --- a/inc/poche/config.inc.default.php +++ b/inc/poche/config.inc.default.php | |||
@@ -30,6 +30,10 @@ | |||
30 | 30 | ||
31 | @define ('MODE_DEMO', FALSE); | 31 | @define ('MODE_DEMO', FALSE); |
32 | @define ('DEBUG_POCHE', FALSE); | 32 | @define ('DEBUG_POCHE', FALSE); |
33 | |||
34 | //default level of error reporting in application. Developers should override it in their config.inc.php: set to E_ALL. | ||
35 | @define ('ERROR_REPORTING', E_ALL & ~E_NOTICE); | ||
36 | |||
33 | @define ('DOWNLOAD_PICTURES', FALSE); # This can slow down the process of adding articles | 37 | @define ('DOWNLOAD_PICTURES', FALSE); # This can slow down the process of adding articles |
34 | @define ('REGENERATE_PICTURES_QUALITY', 75); | 38 | @define ('REGENERATE_PICTURES_QUALITY', 75); |
35 | @define ('CONVERT_LINKS_FOOTNOTES', FALSE); | 39 | @define ('CONVERT_LINKS_FOOTNOTES', FALSE); |