Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Vanilla 2.6 is here! It includes security fixes and requires PHP 7.0. We have therefore ALSO released Vanilla 2.5.2 with security patches if you are still on PHP 5.6 to give you additional time to upgrade.
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

embedding links from metadata

This discussion is related to the OEmbed addon.
edited November 2015 in Vanilla 2.0 - 2.3

Hi,

This plugin is creating embeddable content for all links. Not just the ones in the user posts.

This includes, any links in the og metadata http://ogp.me/
These are located between the <head> tags of the page.

The causes (I suspect) are specifically these tags:

<head>
....
<meta property="og:description" content="look: http://imgur.com/gallery/C99i3pW">
<meta name="description" property="og:description" itemprop="description" content="look: http://imgur.com/gallery/C99i3pW">
...
</head>

The obvious solution would be to only search for URLs in the <body> tag (or a particualy set of divs).

However my programming knowledge is limited, and vanilla documentation is somewhat sparse.
Any help/tips will be appreciated.

The code i have to modify is probably here (class.oembed.plugin.php):

    public function base_links_handler($sender, $args)
    {
        $self = $this;

        $mixed =& $args['Mixed'];

        // Include Composer autoloader
        $this->getResource('library/vendors/autoload.php', true);

        // Get instance of Essence library
        $essence = \Essence\Essence::instance();

        // Replace links with embedable HTML
        $mixed = $essence->replace($mixed, function($media) use ($self) {
            $slug = str_replace(' ', '', ucwords($media->providerName));

            $media->set('providerSlug', $slug);

            include $self->getView($media->type.'.php');
        });
    }

cheers

Comments

Sign In or Register to comment.