]> git.mxchange.org Git - friendica.git/blob - mod/update_community.php
The central item fetch does work now and the API now uses these functions
[friendica.git] / mod / update_community.php
1 <?php
2
3 // See update_profile.php for documentation
4
5 use Friendica\App;
6 use Friendica\Core\L10n;
7 use Friendica\Core\PConfig;
8
9 require_once 'mod/community.php';
10
11 function update_community_content(App $a) {
12         header("Content-type: text/html");
13         echo "<!DOCTYPE html><html><body>\r\n";
14         echo "<section>";
15
16         if ($_GET["force"] == 1) {
17                 $text = community_content($a, true);
18         } else {
19                 $text = '';
20         }
21
22         $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
23         $replace = "<img\${1} dst=\"\${2}\"";
24         $text = preg_replace($pattern, $replace, $text);
25
26         if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
27                 $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
28                 $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
29                 $text = preg_replace($pattern, $replace, $text);
30                 $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
31                 $text = preg_replace($pattern, $replace, $text);
32                 $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
33                 $text = preg_replace($pattern, $replace, $text);
34                 $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
35                 $text = preg_replace($pattern, $replace, $text);
36         }
37
38         echo str_replace("\t", "       ", $text);
39         echo "</section>";
40         echo "</body></html>\r\n";
41         killme();
42 }