merge opengraph fixes from dev
This commit is contained in:
parent
8727f12b18
commit
004861fbb7
@ -211,7 +211,7 @@ class Articles extends Controller {
|
||||
}
|
||||
|
||||
// Add Opengraph markup
|
||||
opengraph_add_meta(((! empty($items)) ? $r[0] : array()), App::$profile);
|
||||
opengraph_add_meta((! empty($items) ? $r[0] : []), $channel);
|
||||
|
||||
$mode = 'articles';
|
||||
|
||||
|
@ -110,8 +110,20 @@ class Channel extends Controller {
|
||||
|
||||
// Run profile_load() here to make sure the theme is set before
|
||||
// we start loading content
|
||||
|
||||
profile_load($which,$profile);
|
||||
|
||||
// Add Opengraph markup
|
||||
$mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
|
||||
if(strpos($mid,'b64.') === 0)
|
||||
$mid = @base64url_decode(substr($mid,4));
|
||||
|
||||
if($mid)
|
||||
$r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d AND item_private = 0 LIMIT 1",
|
||||
dbesc($mid),
|
||||
intval($channel['channel_id'])
|
||||
);
|
||||
|
||||
opengraph_add_meta($r ? $r[0] : [], $channel);
|
||||
}
|
||||
|
||||
function get($update = 0, $load = false) {
|
||||
@ -375,9 +387,6 @@ class Channel extends Controller {
|
||||
$items = array();
|
||||
}
|
||||
|
||||
// Add Opengraph markup
|
||||
opengraph_add_meta((isset($decoded) && (! empty($items)) ? $r[0] : array()), App::$profile);
|
||||
|
||||
if((! $update) && (! $load)) {
|
||||
|
||||
if($decoded)
|
||||
|
@ -9,11 +9,11 @@
|
||||
* @brief Adds Opengraph meta tags into HTML head
|
||||
*
|
||||
* @param array $item
|
||||
* @param array $profile
|
||||
* @param array $channel
|
||||
*
|
||||
*/
|
||||
|
||||
function opengraph_add_meta($item, $profile) {
|
||||
function opengraph_add_meta($item, $channel) {
|
||||
|
||||
if(! empty($item)) {
|
||||
|
||||
@ -48,11 +48,9 @@
|
||||
$ogtype = "article";
|
||||
}
|
||||
|
||||
$channel = channelx_by_n($profile['profile_uid']);
|
||||
|
||||
if(! isset($ogdesc)) {
|
||||
if($profile['about'] && perm_is_allowed($channel['channel_id'],get_observer_hash(),'view_profile')) {
|
||||
$ogdesc = $profile['about'];
|
||||
if(App::$profile['about'] && perm_is_allowed($channel['channel_id'],get_observer_hash(),'view_profile')) {
|
||||
$ogdesc = App::$profile['about'];
|
||||
}
|
||||
else {
|
||||
$ogdesc = sprintf( t('This is the home page of %s.'), $channel['channel_name']);
|
||||
@ -72,4 +70,3 @@
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user