Created
August 8, 2015 05:38
-
-
Save joshuaadickerson/376d510c9d752e9b290a to your computer and use it in GitHub Desktop.
A BBC tag for adding gist snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function gist_bbc(&$codes, &$no_autolink_tags, &$itemcodes) | |
{ | |
$codes[] = array( | |
'tag' => 'gist', | |
'type' => 'unparsed_content', | |
'content' => '<script src="$1.js"></script>', | |
'validate' => function(&$tag, &$data, $disabled) { | |
$data = strtr($data, array('<br />' => '')); | |
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0) | |
$data = 'https://' . $data; | |
}, | |
); | |
$no_autolink_tags[] = 'gist'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment