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
After February 6, this site will no longer have Facebook, Twitter, or OpenID sign-in options. Read our announcement about social media SSO support in 2.8 for more info.

Make sure you have a current, valid email address set in your profile and set a password so you can login without it. If you get locked out after that time, you can choose "Forgot Password" to fix it as long as a valid email is on your account.
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.