better handling of channel meta

This commit is contained in:
zotlabs 2019-06-29 17:54:48 -07:00
parent df18f57217
commit a2a7a22c38
4 changed files with 10 additions and 10 deletions

View file

@ -136,14 +136,15 @@ class Channel extends Controller {
Libprofile::load($which,$profile);
App::$page['htmlhead'] .= '<meta property="og:title" content="' . htmlspecialchars($channel['channel_name']) . '">' . "\r\n";
App::$page['htmlhead'] .= '<meta property="og:image" content="' . $channel['xchan_photo_l'] . '">' . "\r\n";
App::$meta->set('og:title', $channel['channel_name']);
App::$meta->set('og:image', $channel['xchan_photo_l']);
App::$meta->set('og:type','webpage');
App::$meta->set('og:url', channel_url($channel));
if(App::$profile['about'] && perm_is_allowed($channel['channel_id'],get_observer_hash(),'view_profile')) {
App::$page['htmlhead'] .= '<meta property="og:description" content="' . htmlspecialchars(App::$profile['about']) . '">' . "\r\n";
App::$meta->set('og:description', App::$profile['about']);
}
else {
App::$page['htmlhead'] .= '<meta property="og:description" content="' . htmlspecialchars(sprintf( t('This is the home page of %s.'), $channel['channel_name'])) . '">' . "\r\n";
App::$meta->set('og:description', sprintf( t('This is the home page of %s.'), $channel['channel_name']));
}
}

View file

@ -50,12 +50,12 @@ class HttpMeta {
$o = '';
if($this->vars) {
foreach($this->vars as $k => $v) {
$o .= '<meta property="' . $k . '" content="' . urlencode($v) . '" />' . "\r\n" ;
$o .= '<meta property="' . htmlspecialchars($k,ENT_COMPAT,'UTF-8',false) . '" content="' . htmlspecialchars($v,ENT_COMPAT,'UTF-8',false) . '" />' . "\r\n" ;
}
}
if($this->check_required()) {
foreach($this->og as $k => $v) {
$o .= '<meta property="' . $k . '" content="' . urlencode($v) . '" />' . "\r\n" ;
$o .= '<meta property="' . htmlspecialchars($k,ENT_COMPAT,'UTF-8',false) . '" content="' . htmlspecialchars($v,ENT_COMPAT,'UTF-8',false) . '" />' . "\r\n" ;
}
}
if($o)

View file

@ -773,6 +773,8 @@ class App {
public static $force_max_items = 0;
public static $theme_thread_allow = true;
public static $meta;
/**
* @brief An array for all theme-controllable parameters
*
@ -818,8 +820,6 @@ class App {
private static $baseurl;
private static $meta;
/**
* App constructor.
*/

View file

@ -844,7 +844,6 @@ function head_get_links() {
return $str;
}
function format_css_if_exists($source) {
// script_path() returns https://yoursite.tld