/** * Register JavaScript during the enqueue scripts action * * @since 1.0.0 * * @return void */ public static function registerScripts() { // Twitter widgets \Twitter\WordPress\JavaScriptLoaders\Widgets::register(); // Vine embed \Twitter\WordPress\JavaScriptLoaders\VineEmbed::register(); // Twitter audience tracker and conversion \Twitter\WordPress\JavaScriptLoaders\Tracking::register(); }
/** * Register JavaScript during the enqueue scripts action * * @since 1.0.0 * * @return void */ public static function registerScripts() { // widgets.js \Twitter\WordPress\JavaScriptLoaders\Widgets::register(); // ad tracker \Twitter\WordPress\JavaScriptLoaders\Tracking::register(); }
/** * Handle shortcode macro * * @since 1.0.0 * * @param array $attributes shortcode attributes * @param string $content shortcode content. no effect * * @return string empty string. markup is queued for inclusion in wp_footer output */ public static function shortcodeHandler($attributes, $content = null) { $options = shortcode_atts(static::$SHORTCODE_DEFAULTS, $attributes, static::SHORTCODE_TAG); $tracking_id = trim($options['id']); if (!$tracking_id) { return ''; } \Twitter\WordPress\JavaScriptLoaders\Tracking::enqueue(); static::$tracking_ids[$tracking_id] = true; if (false === has_action('wp_footer', array(__CLASS__, 'trackerJavaScript'))) { // execute script after wp_print_footer_scripts action completes at priority 20 add_action('wp_footer', array(__CLASS__, 'trackerJavaScript'), 25); } // execute all trackers just before </body> return ''; }