aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorManuel Hiebel <leuhmanu@mageia.org>2023-09-05 23:20:48 +0200
committerManuel Hiebel <leuhmanu@mageia.org>2023-09-05 23:20:48 +0200
commit704ff333cf615e79cc307182ad8cd07cdbd55a38 (patch)
treebf95bcb3fb1919b4ffa46cdfdf81a767fd1723b5 /test
parent6126b0a4e03d55617aaf5e7f0f808663106cbc99 (diff)
downloadwww-704ff333cf615e79cc307182ad8cd07cdbd55a38.tar
www-704ff333cf615e79cc307182ad8cd07cdbd55a38.tar.gz
www-704ff333cf615e79cc307182ad8cd07cdbd55a38.tar.bz2
www-704ff333cf615e79cc307182ad8cd07cdbd55a38.tar.xz
www-704ff333cf615e79cc307182ad8cd07cdbd55a38.zip
Test SimplePie
Diffstat (limited to 'test')
-rw-r--r--test/news.php79
1 files changed, 79 insertions, 0 deletions
diff --git a/test/news.php b/test/news.php
new file mode 100644
index 000000000..281cb61ec
--- /dev/null
+++ b/test/news.php
@@ -0,0 +1,79 @@
+<?php
+/**
+*/
+define('HLANG', true);
+define('ALIGNMENT', 'Center');
+require '../langs.php';
+$dictionary = read_translation_file($locale, array('index', 'news', 'common_footer'));
+$rtl = is_locale_rtl($locale);
+
+?><!DOCTYPE html>
+<html <?php echo $rtl ? 'dir="rtl"' : 'dir="ltr"'?> lang="<?php echo $locale; ?>">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <?php echo common_header(); ?>
+</head>
+<body>
+ <?php echo $hsnav?>
+
+<?php
+include_once G_APP_ROOT . '/lib/simplepie/autoloader.php';
+//include_once('../idn/idna_convert.class.php');
+
+// Parse it
+$feed = new SimplePie();
+
+
+ $feed->set_feed_url("https://blog.mageia.org/en");
+ $feed->set_cache_location(realpath(G_APP_ROOT . '/_nav/var/tmp/cache'));
+ $feed->set_cache_duration(3600 * $cache_timeout);
+ $feed->set_timeout(10); // second part of a #mga23215 bugfix
+ $feed->force_cache_fallback(true); // this should help if rss files are not retrievable
+ $feed->enable_order_by_date(true);
+ $feed->init();
+ $feed->handle_content_type();
+
+$feed->handle_content_type();
+
+?>
+
+<pre>
+<?php
+
+// memory_get_peak_usage() only exists on PHP 5.2 and higher if PHP is compiled with the --enable-memory-limit configuration option or on PHP 5.2.1 and higher (which runs as if --enable-memory-limit was on, with no option)
+if (function_exists('memory_get_peak_usage'))
+{
+ var_dump($time, memory_get_usage(), memory_get_peak_usage());
+}
+// memory_get_usage() only exists if PHP is compiled with the --enable-memory-limit configuration option or on PHP 5.2.1 and higher (which runs as if --enable-memory-limit was on, with no option)
+else if (function_exists('memory_get_usage'))
+{
+ var_dump($time, memory_get_usage());
+}
+else
+{
+ var_dump($time);
+}
+
+// Output buffer
+function callable_htmlspecialchars($string)
+{
+ return htmlspecialchars($string);
+}
+ob_start('callable_htmlspecialchars');
+
+// Output
+print_r($feed);
+ob_end_flush();
+
+?>
+</pre>
+
+ </div>
+
+ </div>
+</div>
+<?php echo common_footer($locale); ?>
+</body>
+</html>