/** * Register and/or enqueue JavaScript during the enqueue scripts action * * @since 1.0.0 * * @return void */ public static function enqueueScripts() { \Vine\WordPress\JavaScriptLoaders\Embed::register(); }
/** * Handle shortcode macro * * @since 1.0.0 * * @param array $attributes shortcode attributes * @param string $content shortcode content. no effect * * @return string HTML markup */ public static function shortcodeHandler($attributes, $content = null) { global $content_width; $options = shortcode_atts(array('id' => '', 'width' => 0), $attributes, self::SHORTCODE_TAG); $vine_id = trim($options['id']); if (!$vine_id) { return ''; } $oembed_options = array(); $width = absint($options['width']); if ($width < 100 && isset($content_width)) { $width = absint($content_width); } if ($width > 100) { // reset max_width to max value supported by Vine // collapses cache hits if ($width > 600) { $width = 600; } $oembed_options['maxwidth'] = $width; } $html = trim(static::getOEmbedMarkup($vine_id, $oembed_options)); if ($html) { $html = '<div class="vine-embed">' . $html . '</div>'; \Vine\WordPress\JavaScriptLoaders\Embed::enqueue(); } return $html; }