- Timestamp:
- 09/07/06 04:38:25 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/wifidog/classes/Content/RssAggregator/RssAggregator.php
r1090 r1092 64 64 class RssAggregator extends Content { 65 65 /** 66 66 67 67 */ 68 68 private $content_rss_aggregator_row; 69 69 70 70 /** 71 71 72 72 */ 73 73 private $content_rss_aggregator_feeds_rows; 74 74 75 75 /** 76 76 77 77 */ 78 78 private $press_review; … … 114 114 if ($content_rss_aggregator_rows != null) { 115 115 $this->content_rss_aggregator_feeds_rows = $content_rss_aggregator_rows; 116 } 117 else { 116 } else { 118 117 $this->content_rss_aggregator_feeds_rows = array (); 119 118 } … … 139 138 } 140 139 } 141 } 142 else { 140 } else { 143 141 $html = _("RSS support is disabled"); 144 142 } … … 182 180 183 181 $retval = false; 184 } 185 else { 182 } else { 186 183 /* 187 184 * Successfull, but nothing modified … … 239 236 240 237 $retval = true; 241 } 242 else { 238 } else { 243 239 /* 244 240 * Successfull, but nothing modified … … 305 301 306 302 $retval = false; 307 } 308 else { 303 } else { 309 304 /* 310 305 * Successfull, but nothing modified … … 405 400 $html .= "<div class='admin_element_label'>\n"; 406 401 $html .= _("How much bonus feeds that do not publish as often get over feed that publish more often. 407 The default is 0.75, with a typical range between 0 and 1.408 At 0, you have a classic RSS aggregator, meaning the n most recent entries picked from all feeds409 will be displayed. 1 is usually as high as you'll want to go: Assuming that all410 an homogenous internal distribution (ex: one feed publishes exactly one entry a day, the411 second once every two days, and the third once every three days), and you ask for 15 entries,412 there will be 5 of each. While that may not sound usefull, it still is, as the feed's distribution is413 usually not homogenous.");402 The default is 0.75, with a typical range between 0 and 1. 403 At 0, you have a classic RSS aggregator, meaning the n most recent entries picked from all feeds 404 will be displayed. 1 is usually as high as you'll want to go: Assuming that all 405 an homogenous internal distribution (ex: one feed publishes exactly one entry a day, the 406 second once every two days, and the third once every three days), and you ask for 15 entries, 407 there will be 5 of each. While that may not sound usefull, it still is, as the feed's distribution is 408 usually not homogenous."); 414 409 $html .= ": </div>\n"; 415 410 $html .= "<div class='admin_element_data'>\n"; … … 428 423 $html .= "<div class='admin_element_label'>\n"; 429 424 $html .= _("Set the oldest entries (in seconds) you are willing to see. Any entries older than this will not 430 be considered at all for display, even if it means that the configured number of items to be displayed isn't reached.431 It's only usefull if all your feed publish very rarely, and you don't want very old entries to show up.");425 be considered at all for display, even if it means that the configured number of items to be displayed isn't reached. 426 It's only usefull if all your feed publish very rarely, and you don't want very old entries to show up."); 432 427 $html .= ": </div>\n"; 433 428 $html .= "<div class='admin_element_data'>\n"; … … 473 468 474 469 $sql = "SELECT count, content_rss_aggregator_feeds.url, title FROM content_rss_aggregator_feeds 475 JOIN (SELECT url, count(content_rss_aggregator_feeds.url) as count476 FROM content_rss_aggregator_feeds477 WHERE content_rss_aggregator_feeds.url NOT IN (SELECT url FROM content_rss_aggregator_feeds WHERE content_id='{$this->id}')478 GROUP BY content_rss_aggregator_feeds.content_id, content_rss_aggregator_feeds.url)479 AS available_feeds480 ON (available_feeds.url=content_rss_aggregator_feeds.url)481 ORDER by count DESC";470 JOIN (SELECT url, count(content_rss_aggregator_feeds.url) as count 471 FROM content_rss_aggregator_feeds 472 WHERE content_rss_aggregator_feeds.url NOT IN (SELECT url FROM content_rss_aggregator_feeds WHERE content_id='{$this->id}') 473 GROUP BY content_rss_aggregator_feeds.content_id, content_rss_aggregator_feeds.url) 474 AS available_feeds 475 ON (available_feeds.url=content_rss_aggregator_feeds.url) 476 ORDER by count DESC"; 482 477 483 478 $db->execSql($sql, $feed_urls, false); 484 485 foreach ($feed_urls as $feed_row) {486 $tab[$i][0] = $feed_row['url'];487 empty ($feed_row['title']) ? $title = $feed_row['url'] : $title = $feed_row['title'];488 $tab[$i][1] = sprintf(_("%s, used %d times"), $title, $feed_row['count']);489 $i++;490 }491 479 if ($feed_urls) { 480 foreach ($feed_urls as $feed_row) { 481 $tab[$i][0] = $feed_row['url']; 482 empty ($feed_row['title']) ? $title = $feed_row['url'] : $title = $feed_row['title']; 483 $tab[$i][1] = sprintf(_("%s, used %d times"), $title, $feed_row['count']); 484 $i++; 485 } 486 } 492 487 $name = "rss_aggregator_{$this->id}_feed_add"; 493 488 $html .= "<input type='text' size='60' value='' name='$name' id='$name'>\n"; … … 563 558 * 564 559 * @return string HTML code for the administration interface 565 560 566 561 */ 567 562 private function getFeedAdminUI($feed_row) { … … 602 597 if ($calculated_pub_interval == true) { 603 598 $html .= sprintf(_("The feed publishes an item every %.2f day(s)"), $calculated_pub_interval / (60 * 60 * 24)); 604 } 605 else { 599 } else { 606 600 $html .= "<div class='admin_element_label'><span class='warningmsg'>" . _("WARNING: This feed does not include the publication dates. 607 The system needs to be able to compute approximate publication608 date for each entry, so the entry can be weighted against the609 others. In order for the aggregator to do a good job, you need610 to estimate fublication frequency of the items, in days.611 If unset, defaults to one day.") . ": </span></div>\n";601 The system needs to be able to compute approximate publication 602 date for each entry, so the entry can be weighted against the 603 others. In order for the aggregator to do a good job, you need 604 to estimate fublication frequency of the items, in days. 605 If unset, defaults to one day.") . ": </span></div>\n"; 612 606 $html .= "<div class='admin_element_data'>\n"; 613 607 $name = "rss_aggregator_" . $this->id . "_feed_" . md5($feed_row['url']) . "_default_publication_interval"; … … 615 609 if (!empty ($feed_row['default_publication_interval'])) { 616 610 $value = $feed_row['default_publication_interval'] / (60 * 60 * 24); 617 } 618 else { 611 } else { 619 612 $value = ''; 620 613 } … … 631 624 $html .= "<li class='admin_element_item_container'>\n"; 632 625 $html .= "<div class='admin_element_label'>" . _("The bias to be given to the source by the selection algorithm. 633 Bias must be > 0 , typical values would be between 0.75 and 1.5634 and default is 1 (no bias). A bias of 2 will cause the items635 to \"look\" twice as recent to the algorithm. A bias of 0.5 to636 look twice as old. Be carefull, a bias of 2 will statistically637 cause the feed to have MORE than twice as many items displayed.") . ": </div>\n";626 Bias must be > 0 , typical values would be between 0.75 and 1.5 627 and default is 1 (no bias). A bias of 2 will cause the items 628 to \"look\" twice as recent to the algorithm. A bias of 0.5 to 629 look twice as old. Be carefull, a bias of 2 will statistically 630 cause the feed to have MORE than twice as many items displayed.") . ": </div>\n"; 638 631 $html .= "<div class='admin_element_data'>\n"; 639 632 … … 656 649 * 657 650 * @return void 658 651 659 652 */ 660 653 private function processFeedAdminUI($feed_row) { … … 680 673 elseif (!is_numeric($bias) || $bias <= 0) { 681 674 echo _("The bias must be a positive real number"); 682 } 683 else { 675 } else { 684 676 /* 685 677 * Successfull, but nothing modified … … 709 701 elseif (!is_numeric($bias) || $bias <= 0) { 710 702 echo _("The default publication must must be a positive integer or empty"); 711 } 712 else { 703 } else { 713 704 /* 714 705 * Successfull, but nothing modified … … 732 723 elseif (empty ($url)) { 733 724 echo _("The URL cannot be empty!"); 734 } 735 else { 725 } else { 736 726 /* 737 727 * Successfull, but nothing modified … … 754 744 try { 755 745 $html = $this->press_review->get_rss_html($this->content_rss_aggregator_row['number_of_display_items']); 756 } 757 catch (Exception $e) { 746 } catch (Exception $e) { 758 747 $html = sprintf(_("Could not get RSS feed: %s"), $feed_row['url']); 759 748 } 760 /* Handle hyperlink clicktrough logging */ 761 $html = $this->replaceHyperLinks($html); 762 763 } 764 else { 749 /* Handle hyperlink clicktrough logging */ 750 $html = $this->replaceHyperLinks($html); 751 752 } else { 765 753 $html = _("RSS support is disabled"); 766 754 } … … 780 768 * 781 769 * @return void 782 770 783 771 */ 784 772 private function refresh() {
