nend

  • When is a theme, no longer what it was when installed?
  • Posts: 165
Aeva custom URL's
« on June 8th, 2012, 10:58 PM »
I have a question, I want a certain formatting in Aeva custom sites list but when I do it it doesn't work.

Here is the working.
Code: [Select]
$sites[] = array(
'id' => 'ytsp',
'title' => 'YouTube Series & Playlist',
'website' => 'http://www.youtube.com',
'type' => 'custom',
'plugin' => 'other',
'pattern' => 'http://(?:www\.)?youtube\.com/embed/videoseries\?list=([0-9a-z]{18})',
'movie' => '<iframe width="853" height="480" src="http://www.youtube.com/embed/videoseries?list=$2" frameborder="0" allowfullscreen></iframe>',
);

This one doesn't work.
Code: [Select]
$sites[] = array(
'id' => 'ytsp',
'title' => 'YouTube Series & Playlist',
'website' => 'http://www.youtube.com',
'type' => 'custom',
'pattern' => 'http://(?:www\.)?youtube\.com/embed/videoseries\?list=([0-9a-z]{18})',
'movie' => 'http://www.youtube.com/embed/videoseries?list=$2',
'fix-html-pattern' => '<iframe width="853" height="480" src="$1" frameborder="0" allowfullscreen></iframe>',
);

I may be missing something, the first one works but I rather have the movie defined as a url and not code because I output these in a open graph hack I made.

No big deal if Aeva wasn't designed to do this, I can just regex the url from the html iframe code. -_-
Re: Aeva custom URL's
« Reply #1, on June 8th, 2012, 11:05 PM »
I may as well supply the open graph hack for Aeva if anyone finds it useful.

In Aeva-Embed.php Find
Code: [Select]
// All ampersands need to be &, however some may be already encoded. So to prevent double-encoding, convert them back to &, then back again
$object = str_replace(
array('&', '&', '&nbsp;', '&amp;', '<aeva-embed>', '<aeva-link>', '<aeva-title>'),
array('&', '&', ' ', '&', $embed, $input[2], isset($title) ? $title : $input[2]),
$object);
if (strpos($object, '<flashvars>') !== false)
$object = str_replace('<flashvars>', substr(strrchr($embed, '?'), 1), $object);

// Reduce remaining replacements allowed
if ($context['aeva']['remaining'] != -1)
{
$context['aeva']['remaining'] -= 1;
$context['aeva']['remaining_per_page'] -= 1;
}

Add Before
Code: [Select]
     $context['aeva']['og_url'] = $embed;

In you index.template.php add this bit to somewhere in the head area.
Code: [Select]
// Open Graph
if (isset($context['item_data']['type']) && $context['item_data']['type'] == 'video' || isset($context['item_data']['type']) && $context['item_data']['type'] == 'embed') {
$og_type = 'video';
$og_extra = isset($context['aeva']['og_url']) ?  '<meta property="og:video" content="'.$context['aeva']['og_url'].'">' : '<meta property="og:video" content="'.preg_replace(array('~\[url=([^]]*)][^[]*\[/url]~', '~\[url]([^[]*)\[/url]~'), '$1', $context['item_data']['embed_url']).'">';
}
echo '
<meta property="og:title" content="', $context['page_title_html_safe'], '"/>
<meta property="og:type" content="'.(isset($og_type) ? $og_type : 'website').'"/>';
// <meta property="og:url" content="'.(!empty($context['canonical_url']) ? $context['canonical_url'] : 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']).'"/>
echo '
<meta property="og:image" content="'.$context['rel_image'].'"/>
<meta property="og:site_name" content="Wrestle Topia"/>
<meta property="og:description" content="'.str_replace('"', ' ',$context['meta_description']).'"/>
'.(isset($og_extra) ? $og_extra : '');

Also you will have to add this bit in your html tag
Code: [Select]
xmlns:og="http://ogp.me/ns#"
Re: Aeva custom URL's
« Reply #2, on June 8th, 2012, 11:24 PM »
Figured another way around, just comment out one of my lines
Code: [Select]
     $context['aeva']['og_url'] = $embed;

Now I am questioning why I put that in there, must be a reason. :hmm:

This code that I already have in the head pulls from the url stored in Aeva if og_url isn't set.
Code: [Select]
$og_extra = isset($context['aeva']['og_url']) ?  '<meta property="og:video" content="'.$context['aeva']['og_url'].'">' : '<meta property="og:video" content="'.preg_replace(array('~\[url=([^]]*)][^[]*\[/url]~', '~\[url]([^[]*)\[/url]~'), '$1', $context['item_data']['embed_url']).'">';

Maybe it is old age, but I am only 28. Maybe there is a reason, maybe not, I don't remember. Looking at the code though there is more to the open graph thing, but I can't remember. Like the image part of it is tied into my code, I think, just found it through looking through it.

Code: [Select]
// Page thumbnail - Have to process the link tree for this, lol.
$rel_img = array_reverse($context['linktree']);
  if (isset($context['item_data']['current_thumb'])) {
$context['rel_image'] = $context['item_data']['current_thumb'][0];
} else if (isset($context['thumb']) && $context['thumb'] != '') {
$context['rel_image'] = 'http://wrestletopia.2-si.net/n/img/b/sm/'.$context['thumb'];
} else if (isset($board_info['thumb']) && $board_info['thumb'] != '') {
$context['rel_image'] = 'http://wrestletopia.2-si.net/n/img/b/sm/'.$board_info['thumb'];
} else if (isset($rel_img[1]) && file_exists($boarddir.'/img/b/sm/'.$rel_img[1]['name'].'.png')) {
$context['rel_image'] = 'http://wrestletopia.2-si.net/n/img/b/sm/'.$rel_img[1]['name'].'.png';
} else {
$context['rel_image'] = 'http://wrestletopia.2-si.net/n/img/viral/site_thumb.png';
}

and some of that is tied into my board images hack. O well it works now, I think maybe broke something commenting out my own code. Maybe it is a old remnant of a old way I used to do it.

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Aeva custom URL's
« Reply #3, on June 8th, 2012, 11:53 PM »
Well, it's Aeva for SMF I guess, so there's not much I can do to help... I'm just not familiar with it anymore. I made a lot of changes in Aeva of Wedge. (Heck, I also broke several things I still need to fix... -_-)