From 6644dc4861272273acf683dd6e06ceb586f2e4db Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 21 Feb 2017 18:58:51 -0800 Subject: use head_add_link() for feed discovery --- Zotlabs/Module/Channel.php | 18 +++++++++++++----- Zotlabs/Module/Chat.php | 4 +--- Zotlabs/Module/Cloud.php | 2 -- Zotlabs/Module/Hcard.php | 15 ++++++++++++++- Zotlabs/Module/Profile.php | 17 +++++++++++++++-- Zotlabs/Module/Update_display.php | 18 +----------------- include/channel.php | 4 +--- 7 files changed, 45 insertions(+), 33 deletions(-) diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 45da92184..0d20e0080 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -41,12 +41,20 @@ class Channel extends \Zotlabs\Web\Controller { $profile = argv(1); } - \App::$page['htmlhead'] .= '' . "\r\n" ; - \App::$page['htmlhead'] .= '' . "\r\n" ; + head_add_link( [ + 'rel' => 'alternate', + 'type' => 'application/atom+xml', + 'title' => t('Posts and comments'), + 'href' => z_root() . '/feed/' . $which + ]); + + head_add_link( [ + 'rel' => 'alternate', + 'type' => 'application/atom+xml', + 'title' => t('Only posts'), + 'href' => z_root() . '/feed/' . $which . '?f=&top=1' + ]); - // Not yet ready for prime time - // \App::$page['htmlhead'] .= '' . "\r\n" ; - // \App::$page['htmlhead'] .= '' . "\r\n" ; // Run profile_load() here to make sure the theme is set before // we start loading content diff --git a/Zotlabs/Module/Chat.php b/Zotlabs/Module/Chat.php index 2c0e7a155..febfd51e5 100644 --- a/Zotlabs/Module/Chat.php +++ b/Zotlabs/Module/Chat.php @@ -33,9 +33,7 @@ class Chat extends \Zotlabs\Web\Controller { $which = $channel['channel_address']; $profile = argv(1); } - - \App::$page['htmlhead'] .= '' . "\r\n" ; - + // Run profile_load() here to make sure the theme is set before // we start loading content diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php index fa2ebbfc8..2b6d7bcbe 100644 --- a/Zotlabs/Module/Cloud.php +++ b/Zotlabs/Module/Cloud.php @@ -37,8 +37,6 @@ class Cloud extends \Zotlabs\Web\Controller { $profile = 0; - \App::$page['htmlhead'] .= '' . "\r\n"; - if ($which) profile_load( $which, $profile); diff --git a/Zotlabs/Module/Hcard.php b/Zotlabs/Module/Hcard.php index 93c8d3ece..ec9181f6a 100644 --- a/Zotlabs/Module/Hcard.php +++ b/Zotlabs/Module/Hcard.php @@ -29,7 +29,20 @@ class Hcard extends \Zotlabs\Web\Controller { $profile = $r[0]['profile_guid']; } - \App::$page['htmlhead'] .= '' . "\r\n" ; + head_add_link( [ + 'rel' => 'alternate', + 'type' => 'application/atom+xml', + 'title' => t('Posts and comments'), + 'href' => z_root() . '/feed/' . $which + ]); + + head_add_link( [ + 'rel' => 'alternate', + 'type' => 'application/atom+xml', + 'title' => t('Only posts'), + 'href' => z_root() . '/feed/' . $which . '?f=&top=1' + ]); + if(! $profile) { $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", diff --git a/Zotlabs/Module/Profile.php b/Zotlabs/Module/Profile.php index 0bc23952b..fda88da52 100644 --- a/Zotlabs/Module/Profile.php +++ b/Zotlabs/Module/Profile.php @@ -37,8 +37,21 @@ class Profile extends \Zotlabs\Web\Controller { $profile = $r[0]['profile_guid']; } - \App::$page['htmlhead'] .= '' . "\r\n" ; - + head_add_link( [ + 'rel' => 'alternate', + 'type' => 'application/atom+xml', + 'title' => t('Posts and comments'), + 'href' => z_root() . '/feed/' . $which + ]); + + head_add_link( [ + 'rel' => 'alternate', + 'type' => 'application/atom+xml', + 'title' => t('Only posts'), + 'href' => z_root() . '/feed/' . $which . '?f=&top=1' + ]); + + if(! $profile) { $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", dbesc(argv(1)) diff --git a/Zotlabs/Module/Update_display.php b/Zotlabs/Module/Update_display.php index 13b04204d..b2c6a56f5 100644 --- a/Zotlabs/Module/Update_display.php +++ b/Zotlabs/Module/Update_display.php @@ -21,26 +21,10 @@ class Update_display extends \Zotlabs\Web\Controller { $mod = new Display(); $text = $mod->get($profile_uid, $load); - $pattern = "/]*) src=\"([^\"]*)\"/"; - $replace = "'; - $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; - $text = preg_replace($pattern, $replace, $text); - } - */ echo str_replace("\t",' ',$text); echo (($_GET['msie'] == 1) ? '' : ''); echo "\r\n"; - // logger('update_display: ' . $text); + killme(); } diff --git a/include/channel.php b/include/channel.php index 856fb6303..71ba2476f 100644 --- a/include/channel.php +++ b/include/channel.php @@ -1976,9 +1976,7 @@ function channel_manual_conv_update($channel_id) { $x = get_pconfig($channel_id, 'system','manual_conversation_update'); if($x === false) - $x = get_config('system','manual_conversation_update'); - if($x === false) - $x = 1; + $x = get_config('system','manual_conversation_update', 1); return intval($x); -- cgit v1.2.3