| 399 | | /* Calculate the average publication interval for all feeds */ |
| 400 | | $all_feed_publication_interval_total = null; |
| 401 | | reset($this->rss_sources); |
| 402 | | foreach ($this->rss_sources as $rss_source) |
| 403 | | { |
| 404 | | $all_feed_publication_interval_total += $rss_source['rpr_computed_publication_interval']; |
| 405 | | } |
| 406 | | $all_feed_publication_interval = $all_feed_publication_interval_total / count($this->rss_sources); |
| 407 | | |
| 408 | | /*Calculate the adjusted dates and create the date list array. */ |
| 409 | | $item_date_array = array (); |
| 410 | | $item_date_array_index = 0; |
| 411 | | |
| 412 | | foreach ($this->rss_sources as $rss_sources_key => $rss_source) |
| 413 | | { |
| 414 | | foreach ($rss_source['magpie_array']->items as $item_key => $item) |
| 415 | | { |
| 416 | | /* Calculate the adjusted date */ |
| 417 | | $feed_publication_interval = $rss_source['rpr_computed_publication_interval']; |
| 418 | | $source_bias = $rss_source['source_bias']; |
| 419 | | $distance_to_today = abs(time() - $item['rpr_computed_phpdate']); |
| 420 | | /* With no strength modifier, a feed with a publication twice as long will get a 2x bonus on the distance to today */ |
| 421 | | $original_adjust_factor = $all_feed_publication_interval / $feed_publication_interval; |
| 422 | | if ($original_adjust_factor < 1) |
| | 397 | if (!empty ($this->rss_sources)) |
| | 398 | { |
| | 399 | /* Calculate the average publication interval for all feeds */ |
| | 400 | $all_feed_publication_interval_total = null; |
| | 401 | reset($this->rss_sources); |
| | 402 | foreach ($this->rss_sources as $rss_source) |
| | 403 | { |
| | 404 | $all_feed_publication_interval_total += $rss_source['rpr_computed_publication_interval']; |
| | 405 | } |
| | 406 | $all_feed_publication_interval = $all_feed_publication_interval_total / count($this->rss_sources); |
| | 407 | |
| | 408 | /*Calculate the adjusted dates and create the date list array. */ |
| | 409 | $item_date_array = array (); |
| | 410 | $item_date_array_index = 0; |
| | 411 | |
| | 412 | foreach ($this->rss_sources as $rss_sources_key => $rss_source) |
| | 413 | { |
| | 414 | foreach ($rss_source['magpie_array']->items as $item_key => $item) |
| 424 | | $algorithm_strength_modifier = 1 / $this->algorithm_strength_modifier; |
| | 416 | /* Calculate the adjusted date */ |
| | 417 | $feed_publication_interval = $rss_source['rpr_computed_publication_interval']; |
| | 418 | $source_bias = $rss_source['source_bias']; |
| | 419 | $distance_to_today = abs(time() - $item['rpr_computed_phpdate']); |
| | 420 | /* With no strength modifier, a feed with a publication twice as long will get a 2x bonus on the distance to today */ |
| | 421 | $original_adjust_factor = $all_feed_publication_interval / $feed_publication_interval; |
| | 422 | if ($original_adjust_factor < 1) |
| | 423 | { |
| | 424 | $algorithm_strength_modifier = 1 / $this->algorithm_strength_modifier; |
| | 425 | } |
| | 426 | |
| | 427 | /*Algorithm strength modifier doit modifier la difference de lécart du ratio |
| | 428 | $all_feed_publication_interval / $feed_publication_interval avec 1/1.*/ |
| | 429 | $adjust_factor = 1 - (1 - $original_adjust_factor) * $this->algorithm_strength_modifier; |
| | 430 | |
| | 431 | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_adjusted_date'] = time() - ($distance_to_today * $adjust_factor) / $source_bias; |
| | 432 | |
| | 433 | /* Memorize each date, and publication intervals so we can determine the "oldest" item to publish |
| | 434 | * Only consider items whose date is not farther from today than max_item_age */ |
| | 435 | if ($this->max_item_age == null || abs(time() - $item['rpr_computed_phpdate']) < $this->max_item_age) |
| | 436 | { |
| | 437 | $item_date_array[$item_date_array_index]['rpr_adjusted_date'] = $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_adjusted_date']; |
| | 438 | $item_date_array[$item_date_array_index]['rpr_computed_phpdate'] = $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_computed_phpdate']; |
| | 439 | $item_date_array[$item_date_array_index]['rss_sources_key'] = $rss_sources_key; |
| | 440 | $item_date_array_index ++; |
| | 441 | } |
| | 442 | |
| | 443 | if (isset ($this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_realphpdate'])) |
| | 444 | { |
| | 445 | /* Check if the item is newer than the last visit */ |
| | 446 | if ($last_visit != null && $item['rpr_realphpdate'] > $last_visit) |
| | 447 | { |
| | 448 | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_is_new'] = true; |
| | 449 | } |
| | 450 | |
| | 451 | /* Check if the item has been published today */ |
| | 452 | $item_getdate = getdate($this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_realphpdate']); |
| | 453 | $today_getdate = getdate(); |
| | 454 | if ($item_getdate['year'] == $today_getdate['year'] && $item_getdate['yday'] == $today_getdate['yday']) |
| | 455 | { |
| | 456 | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_is_today'] = true; |
| | 457 | } |
| | 458 | else |
| | 459 | { |
| | 460 | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_is_today'] = false; |
| | 461 | } |
| | 462 | } |
| | 463 | $content = null; |
| | 464 | if (!empty ($item['atom_content'])) |
| | 465 | { |
| | 466 | $content = $item['atom_content']; |
| | 467 | } |
| | 468 | else |
| | 469 | if (!empty ($item['content']['encoded'])) |
| | 470 | { |
| | 471 | $content = $item['content']['encoded']; |
| | 472 | } |
| | 473 | else |
| | 474 | if (!empty ($item['summary'])) |
| | 475 | { |
| | 476 | $content = $item['summary']; |
| | 477 | } |
| | 478 | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_content'] = $content; |
| | 479 | |
| | 480 | $summary = null; |
| | 481 | if (!empty ($item['summary'])) |
| | 482 | { |
| | 483 | $summary = $item['summary']; |
| | 484 | } |
| | 485 | else |
| | 486 | { |
| | 487 | $summary = $content; |
| | 488 | } |
| | 489 | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_summary'] = $summary; |
| | 490 | |
| 427 | | /*Algorithm strength modifier doit modifier la difference de lécart du ratio |
| 428 | | $all_feed_publication_interval / $feed_publication_interval avec 1/1.*/ |
| 429 | | $adjust_factor = 1 - (1 - $original_adjust_factor) * $this->algorithm_strength_modifier; |
| 430 | | |
| 431 | | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_adjusted_date'] = time() - ($distance_to_today * $adjust_factor) / $source_bias; |
| 432 | | |
| 433 | | /* Memorize each date, and publication intervals so we can determine the "oldest" item to publish |
| 434 | | * Only consider items whose date is not farther from today than max_item_age */ |
| 435 | | if ($this->max_item_age == null || abs(time() - $item['rpr_computed_phpdate']) < $this->max_item_age) |
| | 493 | //echo "<p>$i items, average_publication_interval (days) = ". $this->rss_sources[$rss_sources_key]['average_publication_interval']/(3600 * 24) . "</p>\n"; |
| | 494 | } // End foreach rss feeds |
| | 495 | |
| | 496 | /* Sort the item date array by adjusted date. */ |
| | 497 | usort($item_date_array, array ("RssPressReview", "_cmp_rpr_adjusted_date")); |
| | 498 | |
| | 499 | /*echo "<pre>"; |
| | 500 | print_r($item_date_array); |
| | 501 | echo "</pre>";*/ |
| | 502 | /* Find the "oldest" adjusted date to display */ |
| | 503 | if (count($item_date_array) < $number_of_items_to_display) |
| | 504 | { |
| | 505 | $number_of_items_to_display = count($item_date_array); |
| | 506 | } |
| | 507 | $min_rpr_adjusted_date_to_display = $item_date_array[$number_of_items_to_display -1]['rpr_adjusted_date']; |
| | 508 | |
| | 509 | if ($debug) |
| | 510 | echo "min_rpr_adjusted_date_to_display: $min_rpr_adjusted_date_to_display<br>\n"; |
| | 511 | /************** Now we actually display the feeds **************/ |
| | 512 | reset($this->rss_sources); |
| | 513 | $rss_info_tmp = null; |
| | 514 | foreach ($this->rss_sources as $rss_sources_key => $rss_source) |
| | 515 | { |
| | 516 | if (!$rss_source['magpie_array']) |
| 437 | | $item_date_array[$item_date_array_index]['rpr_adjusted_date'] = $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_adjusted_date']; |
| 438 | | $item_date_array[$item_date_array_index]['rpr_computed_phpdate'] = $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_computed_phpdate']; |
| 439 | | $item_date_array[$item_date_array_index]['rss_sources_key'] = $rss_sources_key; |
| 440 | | $item_date_array_index ++; |
| 441 | | } |
| 442 | | |
| 443 | | if (isset ($this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_realphpdate'])) |
| 444 | | { |
| 445 | | /* Check if the item is newer than the last visit */ |
| 446 | | if ($last_visit != null && $item['rpr_realphpdate'] > $last_visit) |
| 447 | | { |
| 448 | | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_is_new'] = true; |
| 449 | | } |
| 450 | | |
| 451 | | /* Check if the item has been published today */ |
| 452 | | $item_getdate = getdate($this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_realphpdate']); |
| 453 | | $today_getdate = getdate(); |
| 454 | | if ($item_getdate['year'] == $today_getdate['year'] && $item_getdate['yday'] == $today_getdate['yday']) |
| 455 | | { |
| 456 | | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_is_today'] = true; |
| 457 | | } |
| 458 | | else |
| 459 | | { |
| 460 | | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_is_today'] = false; |
| 461 | | } |
| 462 | | } |
| 463 | | $content = null; |
| 464 | | if(!empty($item['atom_content'])) |
| 465 | | { |
| 466 | | $content = $item['atom_content']; |
| 467 | | } |
| 468 | | else if(!empty($item['content']['encoded'])) |
| 469 | | { |
| 470 | | $content = $item['content']['encoded']; |
| 471 | | } |
| 472 | | else if(!empty($item['summary'])) |
| 473 | | { |
| 474 | | $content = $item['summary']; |
| 475 | | } |
| 476 | | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_content'] = $content; |
| 477 | | |
| 478 | | $summary = null; |
| 479 | | if(!empty($item['summary'])) |
| 480 | | { |
| 481 | | $summary = $item['summary']; |
| | 518 | echo _('get_rss_info(): Feed missing'); |
| | 519 | return false; |
| 485 | | $summary = $content; |
| | 523 | unset ($rss_info_tmp); |
| | 524 | $rss_info_tmp['channel'] = $this->rss_sources[$rss_sources_key]['magpie_array']->channel; |
| | 525 | |
| | 526 | $i = 0; |
| | 527 | /* Sort the items by date, so we get the most recent first */ |
| | 528 | if (!uasort($this->rss_sources[$rss_sources_key]['magpie_array']->items, array ("RssPressReview", "_cmp_date_item"))) |
| | 529 | { |
| | 530 | echo _('get_rss_info(): uasort() failed!'); |
| | 531 | return false; |
| | 532 | } |
| | 533 | |
| | 534 | $rss_info_tmp['items'] = array (); |
| | 535 | foreach ($this->rss_sources[$rss_sources_key]['magpie_array']->items as $item_key => $item) |
| | 536 | { |
| | 537 | if ($debug) |
| | 538 | echo "Is item with rpr_adjusted_date: ".$item['rpr_adjusted_date']." after the minimum date: $min_rpr_adjusted_date_to_display?<br>\n"; |
| | 539 | |
| | 540 | if ($item['rpr_adjusted_date'] >= $min_rpr_adjusted_date_to_display) |
| | 541 | { |
| | 542 | if ($debug) |
| | 543 | echo "YES!<br>\n"; |
| | 544 | if (!empty ($item['dc']['creator'])) |
| | 545 | { |
| | 546 | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_author'] = trim($item['dc']['creator']); |
| | 547 | } |
| | 548 | elseif (!empty ($item['author'])) |
| | 549 | { |
| | 550 | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_author'] = trim($item['author']); |
| | 551 | } |
| | 552 | elseif (!empty ($item['author_name'])) |
| | 553 | { |
| | 554 | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_author'] = trim($item['author_name']); |
| | 555 | } |
| | 556 | else |
| | 557 | { |
| | 558 | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_author'] = ''; |
| | 559 | } |
| | 560 | |
| | 561 | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_id'] = "summary_".mt_rand(1, 10000); |
| | 562 | array_push($rss_info_tmp['items'], $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]); |
| | 563 | } |
| | 564 | $i ++; |
| | 565 | } // End foreach items |
| | 566 | |
| | 567 | if ($debug) |
| | 568 | echo count($rss_info_tmp['items'])." items (out of ".count($rss->items).") are after the minimum date in feed $rss_sources_key<br>\n"; |
| | 569 | |
| | 570 | $rss_info[$rss_sources_key] = $rss_info_tmp; |
| 487 | | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_summary'] = $summary; |
| 488 | | |
| 489 | | } |
| 490 | | |
| 491 | | //echo "<p>$i items, average_publication_interval (days) = ". $this->rss_sources[$rss_sources_key]['average_publication_interval']/(3600 * 24) . "</p>\n"; |
| 492 | | } // End foreach rss feeds |
| 493 | | |
| 494 | | /* Sort the item date array by adjusted date. */ |
| 495 | | usort($item_date_array, array ("RssPressReview", "_cmp_rpr_adjusted_date")); |
| 496 | | |
| 497 | | /*echo "<pre>"; |
| 498 | | print_r($item_date_array); |
| 499 | | echo "</pre>";*/ |
| 500 | | /* Find the "oldest" adjusted date to display */ |
| 501 | | if (count($item_date_array) < $number_of_items_to_display) |
| 502 | | { |
| 503 | | $number_of_items_to_display = count($item_date_array); |
| 504 | | } |
| 505 | | $min_rpr_adjusted_date_to_display = $item_date_array[$number_of_items_to_display -1]['rpr_adjusted_date']; |
| 506 | | |
| 507 | | if ($debug) |
| 508 | | echo "min_rpr_adjusted_date_to_display: $min_rpr_adjusted_date_to_display<br>\n"; |
| 509 | | /************** Now we actually display the feeds **************/ |
| 510 | | reset($this->rss_sources); |
| 511 | | $rss_info_tmp = null; |
| 512 | | foreach ($this->rss_sources as $rss_sources_key => $rss_source) |
| 513 | | { |
| 514 | | if (!$rss_source['magpie_array']) |
| 515 | | { |
| 516 | | echo _('get_rss_info(): Feed missing'); |
| 517 | | return false; |
| 518 | | } |
| 519 | | else |
| 520 | | { |
| 521 | | unset ($rss_info_tmp); |
| 522 | | $rss_info_tmp['channel'] = $this->rss_sources[$rss_sources_key]['magpie_array']->channel; |
| 523 | | |
| 524 | | $i = 0; |
| 525 | | /* Sort the items by date, so we get the most recent first */ |
| 526 | | if (!uasort($this->rss_sources[$rss_sources_key]['magpie_array']->items, array ("RssPressReview", "_cmp_date_item"))) |
| 527 | | { |
| 528 | | echo _('get_rss_info(): uasort() failed!'); |
| 529 | | return false; |
| 530 | | } |
| 531 | | |
| 532 | | $rss_info_tmp['items'] = array (); |
| 533 | | foreach ($this->rss_sources[$rss_sources_key]['magpie_array']->items as $item_key => $item) |
| 534 | | { |
| 535 | | if ($debug) |
| 536 | | echo "Is item with rpr_adjusted_date: ".$item['rpr_adjusted_date']." after the minimum date: $min_rpr_adjusted_date_to_display?<br>\n"; |
| 537 | | |
| 538 | | if ($item['rpr_adjusted_date'] >= $min_rpr_adjusted_date_to_display) |
| 539 | | { |
| 540 | | if ($debug) |
| 541 | | echo "YES!<br>\n"; |
| 542 | | if (!empty ($item['dc']['creator'])) |
| 543 | | { |
| 544 | | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_author'] = trim($item['dc']['creator']); |
| 545 | | } |
| 546 | | elseif (!empty ($item['author'])) |
| 547 | | { |
| 548 | | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_author'] = trim($item['author']); |
| 549 | | } |
| 550 | | elseif (!empty ($item['author_name'])) |
| 551 | | { |
| 552 | | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_author'] = trim($item['author_name']); |
| 553 | | } |
| 554 | | else |
| 555 | | { |
| 556 | | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_author'] = ''; |
| 557 | | } |
| 558 | | |
| 559 | | $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]['rpr_id'] = "summary_".mt_rand(1, 10000); |
| 560 | | array_push($rss_info_tmp['items'], $this->rss_sources[$rss_sources_key]['magpie_array']->items[$item_key]); |
| 561 | | } |
| 562 | | $i ++; |
| 563 | | } // End foreach items |
| 564 | | |
| 565 | | if ($debug) |
| 566 | | echo count($rss_info_tmp['items'])." items (out of ".count($rss->items).") are after the minimum date in feed $rss_sources_key<br>\n"; |
| 567 | | |
| 568 | | $rss_info[$rss_sources_key] = $rss_info_tmp; |
| 569 | | } |
| 570 | | } // End foreach rss feeds |
| 571 | | /*echo "\n<pre>\n"; |
| 572 | | print_r($rss_info); |
| 573 | | echo "\n</pre>\n"; |
| 574 | | */ |
| 575 | | return $rss_info; |
| 576 | | |
| | 572 | } // End foreach rss feeds |
| | 573 | /*echo "\n<pre>\n"; |
| | 574 | print_r($rss_info); |
| | 575 | echo "\n</pre>\n"; |
| | 576 | */ |
| | 577 | return $rss_info; |
| | 578 | } |
| | 579 | else |
| | 580 | return null; |
| 587 | | |
| 588 | | <script language="JavaScript" type="text/javascript"> |
| 589 | | function MM_findObj(n, d) { //v4.0 |
| 590 | | var p,i,x; |
| 591 | | if(!d) d=document; |
| 592 | | if((p=n.indexOf("?"))>0&&parent.frames.length) { |
| 593 | | d=parent.frames[n.substring(p+1)].document; |
| 594 | | n=n.substring(0,p); |
| 595 | | } |
| 596 | | if(!(x=d[n])&&d.all) x=d.all[n]; |
| 597 | | for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; |
| 598 | | for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); |
| 599 | | if(!x && document.getElementById) x=document.getElementById(n); return x; |
| 600 | | } |
| 601 | | |
| 602 | | function changestyle(couche, style) { |
| 603 | | if (!(layer = MM_findObj(couche))) return; |
| 604 | | if(layer.className != "rpr_popup_inner_div_expanded") |
| 605 | | { |
| 606 | | layer.style.visibility = style; |
| 607 | | } |
| 608 | | } |
| 609 | | |
| 610 | | function changeclass(objet, myClass) |
| 611 | | { |
| 612 | | objet.className = myClass; |
| 613 | | } |
| 614 | | |
| 615 | | function toggleItemVisibility(item_id) |
| 616 | | { |
| 617 | | if (!(layer = MM_findObj(item_id))) return; |
| 618 | | if(layer.className != "rpr_popup_inner_div_expanded") |
| 619 | | { |
| 620 | | layer.style.visibility = "visible"; |
| 621 | | layer.className = "rpr_popup_inner_div_expanded"; |
| 622 | | } |
| 623 | | else |
| 624 | | { |
| 625 | | layer.style.visibility = "hidden"; |
| 626 | | layer.className = "rpr_popup_inner_div"; |
| 627 | | } |
| 628 | | } |
| 629 | | </script> |
| 630 | | |
| 631 | | <style type="text/css"> |
| 632 | | |
| 633 | | /*h2 {color: green}*/ |
| 634 | | .rpr_header {margin: 0em 0em 0em 0em; |
| 635 | | padding: 0em 0em 0em 0em;} |
| 636 | | .rpr_title { font-weight: bold; |
| 637 | | font-size: 90%} |
| 638 | | .rpr_title_date { font-weight: lighter; } |
| 639 | | |
| 640 | | .rpr_item_list { |
| 641 | | padding: 0em 1em 0em 1em; |
| 642 | | margin: 0em 1em 0em 1em;} |
| 643 | | .rpr_item { list-style-type: none; |
| 644 | | } |
| 645 | | .rpr_item_title { |
| 646 | | margin: 0em 0em 0em 0em; |
| 647 | | padding: 0em 0em 0em 0em;} |
| 648 | | |
| 649 | | |
| 650 | | .rpr_item_link { } |
| 651 | | .rpr_expand_switch { font-weight: bolder; |
| 652 | | text-decoration: none; |
| 653 | | /*border: 1px solid black*/ } |
| 654 | | /*.rpr_expand_switch:before { content: "+"; }*/ |
| 655 | | |
| 656 | | .rpr_popup_inner_div { |
| 657 | | z-index: 1000; |
| 658 | | display: inline; |
| 659 | | padding: 0.5em; |
| 660 | | border: 2px outset #324C48; |
| 661 | | background-color: #f9f9f9; |
| 662 | | visibility: hidden; |
| 663 | | position: absolute; |
| 664 | | left: 4em; |
| 665 | | top: 1.5em; |
| 666 | | width: 350px; |
| 667 | | -moz-opacity: 0.95; filter: alpha(opacity=95); |
| 668 | | } |
| 669 | | |
| 670 | | .rpr_popup_inner_div_expanded { |
| 671 | | margin: 0.5em 1em 0em 1em; |
| 672 | | padding: 0.5em; |
| 673 | | border: 2px outset #324C48; |
| 674 | | background-color: #f9f9f9; |
| 675 | | } |
| 676 | | .rpr_popup_outer_div { |
| 677 | | z-index: 1000; |
| 678 | | position: relative; |
| 679 | | display: inline; |
| 680 | | } |
| 681 | | |
| 682 | | |
| 683 | | </style> |
| 684 | | |
| 685 | | '; |
| 686 | | |
| | 591 | |
| | 592 | <script language="JavaScript" type="text/javascript"> |
| | 593 | function MM_findObj(n, d) { //v4.0 |
| | 594 | var p,i,x; |
| | 595 | if(!d) d=document; |
| | 596 | if((p=n.indexOf("?"))>0&&parent.frames.length) { |
| | 597 | d=parent.frames[n.substring(p+1)].document; |
| | 598 | n=n.substring(0,p); |
| | 599 | } |
| | 600 | if(!(x=d[n])&&d.all) x=d.all[n]; |
| | 601 | for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; |
| | 602 | for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); |
| | 603 | if(!x && document.getElementById) x=document.getElementById(n); return x; |
| | 604 | } |
| | 605 | |
| | 606 | function changestyle(couche, style) { |
| | 607 | if (!(layer = MM_findObj(couche))) return; |
| | 608 | if(layer.className != "rpr_popup_inner_div_expanded") |
| | 609 | { |
| | 610 | layer.style.visibility = style; |
| | 611 | } |
| | 612 | } |
| | 613 | |
| | 614 | function changeclass(objet, myClass) |
| | 615 | { |
| | 616 | objet.className = myClass; |
| | 617 | } |
| | 618 | |
| | 619 | function toggleItemVisibility(item_id) |
| | 620 | { |
| | 621 | if (!(layer = MM_findObj(item_id))) return; |
| | 622 | if(layer.className != "rpr_popup_inner_div_expanded") |
| | 623 | { |
| | 624 | layer.style.visibility = "visible"; |
| | 625 | layer.className = "rpr_popup_inner_div_expanded"; |
| | 626 | } |
| | 627 | else |
| | 628 | { |
| | 629 | layer.style.visibility = "hidden"; |
| | 630 | layer.className = "rpr_popup_inner_div"; |
| | 631 | } |
| | 632 | } |
| | 633 | </script> |
| | 634 | |
| | 635 | <style type="text/css"> |
| | 636 | |
| | 637 | /*h2 {color: green}*/ |
| | 638 | .rpr_header {margin: 0em 0em 0em 0em; |
| | 639 | padding: 0em 0em 0em 0em;} |
| | 640 | .rpr_title { font-weight: bold; |
| | 641 | font-size: 90%} |
| | 642 | .rpr_title_date { font-weight: lighter; } |
| | 643 | |
| | 644 | .rpr_item_list { |
| | 645 | padding: 0em 1em 0em 1em; |
| | 646 | margin: 0em 1em 0em 1em;} |
| | 647 | .rpr_item { list-style-type: none; |
| | 648 | } |
| | 649 | .rpr_item_title { |
| | 650 | margin: 0em 0em 0em 0em; |
| | 651 | padding: 0em 0em 0em 0em;} |
| | 652 | |
| | 653 | |
| | 654 | .rpr_item_link { } |
| | 655 | .rpr_expand_switch { font-weight: bolder; |
| | 656 | text-decoration: none; |
| | 657 | /*border: 1px solid black*/ } |
| | 658 | /*.rpr_expand_switch:before { content: "+"; }*/ |
| | 659 | |
| | 660 | .rpr_popup_inner_div { |
| | 661 | z-index: 1000; |
| | 662 | display: inline; |
| | 663 | padding: 0.5em; |
| | 664 | border: 2px outset #324C48; |
| | 665 | background-color: #f9f9f9; |
| | 666 | visibility: hidden; |
| | 667 | position: absolute; |
| | 668 | left: 4em; |
| | 669 | top: 1.5em; |
| | 670 | width: 350px; |
| | 671 | -moz-opacity: 0.95; filter: alpha(opacity=95); |
| | 672 | } |
| | 673 | |
| | 674 | .rpr_popup_inner_div_expanded { |
| | 675 | margin: 0.5em 1em 0em 1em; |
| | 676 | padding: 0.5em; |
| | 677 | border: 2px outset #324C48; |
| | 678 | background-color: #f9f9f9; |
| | 679 | } |
| | 680 | .rpr_popup_outer_div { |
| | 681 | z-index: 1000; |
| | 682 | position: relative; |
| | 683 | display: inline; |
| | 684 | } |
| | 685 | |
| | 686 | |
| | 687 | </style> |
| | 688 | |
| | 689 | '; |
| 709 | | $feed_html .= "<a class='y' href='".$feed['link']."'>".$feed['channel']['title']."</a>"; |
| | 706 | $feed_html = ''; |
| | 707 | $dhtml_id = "feed_".md5($feed_id); |
| | 708 | $feed_html .= "<p class='rpr_header'>"._('Source: '); |
| | 709 | $feed_html .= "<span class='rpr_title' onMouseOver=\"changestyle('$dhtml_id','visible');\" onMouseOut=\"changestyle('$dhtml_id','hidden');\">\n"; |
| | 710 | if (!empty ($feed['link'])) |
| | 711 | { |
| | 712 | $feed_html .= "<a class='y' href='".$feed['link']."'>".$feed['channel']['title']."</a>"; |
| | 713 | } |
| | 714 | else |
| | 715 | { |
| | 716 | $feed_html .= $feed['channel']['title']; |
| | 717 | } |
| | 718 | $feed_html .= "</span>\n"; |
| | 719 | $feed_html .= "</p>\n"; |
| | 720 | |
| | 721 | $feed_html .= "<div class='rpr_popup_outer_div'>\n"; |
| | 722 | $feed_html .= "<div id='$dhtml_id' class='rpr_popup_inner_div'>\n"; |
| | 723 | $feed_html .= "<p class='rpr_text'>{$feed['channel']['title']} </p>\n"; |
| | 724 | if (!empty ($feed['channel']['description'])) |
| | 725 | { |
| | 726 | $description = strip_tags($feed['channel']['description'], "<p><a><img><b><i>"); |
| | 727 | $feed_html .= "<p class='rpr_text'>{$description}</p>\n"; |
| | 728 | } |
| | 729 | $feed_html .= "<p class='rpr_text'>{$feed_id}</p>\n"; |
| | 730 | $feed_html .= "</div></div>\n"; |
| | 731 | |
| | 732 | $feed_html .= "<ul class='rpr_item_list'>\n"; |
| | 733 | |
| | 734 | foreach ($feed['items'] as $item) |
| | 735 | { |
| | 736 | if ($item['rpr_is_today']) |
| | 737 | { |
| | 738 | $display_date = _("Today"); |
| | 739 | } |
| | 740 | else |
| | 741 | if ($item['rpr_realphpdate'] != -1) |
| | 742 | { |
| | 743 | setlocale(LC_TIME, "fr_CA"); |
| | 744 | $display_date = strftime("%x", $item['rpr_realphpdate']); |
| | 745 | } |
| | 746 | else |
| | 747 | { |
| | 748 | $display_date = ''; |
| | 749 | //$display_date = "Estimated: ".strftime("%x", $item['rpr_computed_phpdate']); |
| | 750 | } |
| | 751 | |
| | 752 | $dhtml_id = "summary_".mt_rand(1, 10000); |
| | 753 | $feed_html .= "<li class='rpr_item'>\n"; |
| | 754 | $feed_html .= "<p class='rpr_item_title'>\n"; |
| | 755 | $item['rpr_is_today'] ? $switch_content = '-' : $switch_content = '+'; |
| | 756 | |
| | 757 | $feed_html .= "<a class='rpr_expand_switch' href='#dummy' onClick=\"toggleItemVisibility('$dhtml_id'); if(this.innerHTML=='+'){this.innerHTML='-';}else{this.innerHTML='+';}\">$switch_content</a> "; |
| | 758 | $feed_html .= "<span class='rpr_title_date'>$display_date</span>"; |
| | 759 | $feed_html .= "<span class='rpr_title' onMouseOver=\"changestyle('$dhtml_id','visible');\" onMouseOut=\"changestyle('$dhtml_id','hidden');\">\n"; |
| | 760 | if (!empty ($item['link'])) |
| | 761 | { |
| | 762 | $feed_html .= "<a class='rpr_item_link' href='{$item['link']}'>{$item['title']}</a>"; |
| | 763 | } |
| | 764 | else |
| | 765 | { |
| | 766 | $feed_html .= "{$item['title']}"; |
| | 767 | } |
| | 768 | $feed_html .= "</span></p>\n"; |
| | 769 | $feed_html .= "<div class='rpr_popup_outer_div'>\n"; |
| | 770 | $item['rpr_is_today'] ? $class = 'rpr_popup_inner_div_expanded' : $class = 'rpr_popup_inner_div'; |
| | 771 | $feed_html .= "<div class='$class' id='$dhtml_id'>\n"; |
| | 772 | $feed_html .= "<p class='rpr_text'>{$item['rpr_author']} ({$feed['channel']['title']}) $display_date</p>\n"; |
| | 773 | $summary = strip_tags($item['rpr_content'], "<br><p><a><img><b><i>"); |
| | 774 | $feed_html .= "<p class='rpr_text'>{$summary}</p></div>\n"; |
| | 775 | $feed_html .= "</div>\n"; |
| | 776 | $feed_html .= "</li>\n"; |
| | 777 | } |
| | 778 | $feed_html .= "</ul>\n"; |
| | 779 | |
| | 780 | $html .= $feed_html; |
| 711 | | else |
| 712 | | { |
| 713 | | $feed_html .= $feed['channel']['title']; |
| 714 | | } |
| 715 | | $feed_html .= "</span>\n"; |
| 716 | | $feed_html .= "</p>\n"; |
| 717 | | |
| 718 | | $feed_html .= "<div class='rpr_popup_outer_div'>\n"; |
| 719 | | $feed_html .= "<div id='$dhtml_id' class='rpr_popup_inner_div'>\n"; |
| 720 | | $feed_html .= "<p class='rpr_text'>{$feed['channel']['title']} </p>\n"; |
| 721 | | if(!empty($feed['channel']['description'])) |
| 722 | | { |
| 723 | | $description = strip_tags($feed['channel']['description'], "<p><a><img><b><i>"); |
| 724 | | $feed_html .= "<p class='rpr_text'>{$description}</p>\n"; |
| 725 | | } |
| 726 | | $feed_html .= "<p class='rpr_text'>{$feed_id}</p>\n"; |
| 727 | | $feed_html .= "</div></div>\n"; |
| 728 | | |
| 729 | | $feed_html .= "<ul class='rpr_item_list'>\n"; |
| 730 | | |
| 731 | | foreach ($feed['items'] as $item) |
| 732 | | { |
| 733 | | if ($item['rpr_is_today']) |
| 734 | | { |
| 735 | | $display_date = _("Today"); |
| 736 | | } |
| 737 | | else if ($item['rpr_realphpdate'] != -1) |
| 738 | | { |
| 739 | | setlocale(LC_TIME, "fr_CA"); |
| 740 | | $display_date = strftime("%x", $item['rpr_realphpdate']); |
| 741 | | } |
| 742 | | else |
| 743 | | { |
| 744 | | $display_date = ''; |
| 745 | | //$display_date = "Estimated: ".strftime("%x", $item['rpr_computed_phpdate']); |
| 746 | | } |
| 747 | | |
| 748 | | $dhtml_id = "summary_".mt_rand(1, 10000); |
| 749 | | $feed_html .= "<li class='rpr_item'>\n"; |
| 750 | | $feed_html .= "<p class='rpr_item_title'>\n"; |
| 751 | | $item['rpr_is_today'] ? $switch_content = '-':$switch_content = '+'; |
| 752 | | |
| 753 | | $feed_html .= "<a class='rpr_expand_switch' href='#dummy' onClick=\"toggleItemVisibility('$dhtml_id'); if(this.innerHTML=='+'){this.innerHTML='-';}else{this.innerHTML='+';}\">$switch_content</a> "; |
| 754 | | $feed_html .= "<span class='rpr_title_date'>$display_date</span>"; |
| 755 | | $feed_html .= "<span class='rpr_title' onMouseOver=\"changestyle('$dhtml_id','visible');\" onMouseOut=\"changestyle('$dhtml_id','hidden');\">\n"; |
| 756 | | if ($item['link']) |
| 757 | | { |
| 758 | | $feed_html .= "<a class='rpr_item_link' href='{$item['link']}'>{$item['title']}</a>"; |
| 759 | | } |
| 760 | | else |
| 761 | | { |
| 762 | | $feed_html .= "{$item['title']}"; |
| 763 | | } |
| 764 | | $feed_html .= "</span></p>\n"; |
| 765 | | $feed_html .= "<div class='rpr_popup_outer_div'>\n"; |
| 766 | | $item['rpr_is_today'] ? $class = 'rpr_popup_inner_div_expanded':$class = 'rpr_popup_inner_div'; |
| 767 | | $feed_html .= "<div class='$class' id='$dhtml_id'>\n"; |
| 768 | | $feed_html .= "<p class='rpr_text'>{$item['rpr_author']} ({$feed['channel']['title']}) $display_date</p>\n"; |
| 769 | | $summary = strip_tags($item['rpr_content'], "<br><p><a><img><b><i>"); |
| 770 | | $feed_html .= "<p class='rpr_text'>{$summary}</p></div>\n"; |
| 771 | | $feed_html .= "</div>\n"; |
| 772 | | $feed_html .= "</li>\n"; |
| 773 | | } |
| 774 | | $feed_html .= "</ul>\n"; |
| 775 | | |
| 776 | | $html .= $feed_html; |