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 _autop_newline_preservation_helper( $matches ) { | |
return str_replace( "\n", '<WPPreserveNewline />', $matches[0] ); | |
} | |
function get_html_split_regex() { | |
static $regex; | |
if ( ! isset( $regex ) ) { |
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
Africa/Abidjan | |
Africa/Accra | |
Africa/Addis_Ababa | |
Africa/Algiers | |
Africa/Asmara | |
Africa/Bamako | |
Africa/Bangui | |
Africa/Banjul | |
Africa/Bissau | |
Africa/Blantyre |
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
function encode_url($url) { | |
$parsed_url = parse_url($url); | |
$scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; | |
$host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; | |
$port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; | |
$user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; | |
$pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : ''; | |
$pass = ($user || $pass) ? "$pass@" : ''; | |
$path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; | |
$query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; |
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
function get_embed_url($url) { | |
global $cache; | |
// Check for YouTube | |
$matchFound = preg_match('/^(https?:\/\/(www\.)?youtube\.com\/watch\?(t=(.+)&)?v=|https?:\/\/youtu\.be\/)([^?]+)(\?(t=(.+))?.*)?$/', $url, $matches); | |
if ($matchFound) { | |
// Video is a Youtube video | |
$url = '//www.youtube.com/embed/' . $matches[5]; | |
if ($matches[4]) { | |
$url = $url . '?start=' . $matches[4]; |
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
function my_getimagesize($filename) { | |
$size = @getimagesize($filename); | |
if (is_array($size)) { | |
if (function_exists('exif_read_data')) { | |
$exif = @exif_read_data($filename); | |
if (is_array($exif) && isset($exif['Orientation']) && ($exif['Orientation'] == 6 || $exif['Orientation'] == 8)) { | |
// The image is tilted clockwise or counter-clockwise | |
// Flip width and height | |
$x = $size[0]; | |
$size[0] = $size[1]; |
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
function multiple_strftime($format) { | |
if (func_num_args() < 2) { | |
return $format; | |
} | |
$args = func_get_args(); | |
return strftime(preg_replace_callback('/%(\d)\$(.)/', function ($match) use ($args) { | |
if (isset($args[$match[1]])) { | |
if ($match[2] == 'O') { | |
// Ordinal day suffix | |
return date('S', $args[$match[1]]); |
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
function encode_mailto($s) { | |
return preg_replace_callback('#<a href="mailto:(.+?)">(.*?)</a>#', function ($matches) { | |
return '<a href="#" onclick="location.href=\'' . str_rot13('mailto:' . $matches[1]) . '\'.replace(/[a-zA-Z]/g,function(c){return String.fromCharCode((c<=\'Z\'?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);});return false">' . str_replace('@', ' [​at​] ', $matches[2]) . '</a>'; | |
}, $s); | |
} |
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 | |
$countries = array( | |
'en' => array( | |
'Afghanistan', | |
'Albania', | |
'Algeria', | |
'American Samoa', | |
'Andorra', | |
'Angola', |
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
function flushDOM() { | |
$('body').height(); | |
} |
NewerOlder