$link = "https://www.youtube.com/watch?v=sOnqjkJTMaA";
$youtube_ID = get_youtube_ID( $link );
echo $youtube_ID;
This file contains hidden or 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 esc_json( $json ) { | |
/** | |
* @var string $safe_json replace escapers | |
* @var array escapers | |
* @var array replacements | |
* | |
*/ | |
$safe_json = str_replace( | |
array( "\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c" ), |
This file contains hidden or 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 | |
/** | |
* Example <html <?php html_class( 'no-js' ); ?>> | |
*/ | |
function html_class( $class = '' ){ | |
echo 'class="' . join( ' ', get_html_class( $class ) ) . '"'; | |
} | |
function get_html_class( $class = '' ){ | |
$useragent = $_SERVER['HTTP_USER_AGENT']; | |
$useragent = isset( $useragent ) ? $useragent : ''; |
This file contains hidden or 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 wp_upload_image_by_url( $url, $post_ID = 0 ) { | |
require_once( ABSPATH . 'wp-admin/includes/media.php' ); | |
require_once( ABSPATH . 'wp-admin/includes/file.php' ); | |
require_once( ABSPATH . 'wp-admin/includes/image.php' ); | |
if ( '' == $post_id ) | |
return new WP_Error( 'upload_image_by_url_failed', __( 'Invalid post ID' ) ); |
This file contains hidden or 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 | |
/** | |
* Add user date register in column | |
* | |
* @author Lenivene Bezerra | |
* @return columns and filter orderby date user registered | |
*/ | |
add_filter( 'manage_users_columns', 'column_user_registered' ); | |
function column_user_registered( $columns ) { | |
$columns[ 'user_registered' ] = __( 'Date' ); |
This file contains hidden or 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
RewriteCond %{THE_REQUEST} \ /(.+)\.aspx | |
RewriteRule ^ /%1.html [L,R=301] |
This file contains hidden or 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 | |
if( ! function_exists( 'mb_ucfirst' ) ){ | |
function mb_ucfirst( $string = '', $encoding = "UTF-8" ){ | |
if( empty( $string ) ) | |
return false; | |
$strlen = mb_strlen( $string, $encoding ); | |
$firstChar = mb_substr( $string, 0, 1, $encoding ); | |
$end_Char = mb_substr( $string, 1, $strlen - 1, $encoding ); |
This file contains hidden or 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 b256_to_b10_encode( $string, $encoding = "UTF-8" ) { | |
bcscale( 0 ); | |
$result = "0"; | |
for ($i = mb_strlen( $string, $encoding )-1; $i >= 0; $i--) { | |
$result = bcadd( $result, bcmul( ord( $string[$i] ), bcpow( 256, $i ) ) ); | |
} |
This file contains hidden or 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 | |
if( ! function_exists( 'mb_strpos' ) ){ | |
function mb_strpos( $haystack, $needles, $offset=0 ){ | |
return strpos( $haystack, $needle, $offset ); | |
} | |
} | |
function mb_strposa( $haystack, $needles = array(), $offset=0 ) { | |
$chr = array(); | |
foreach( $needles as $needle ){ |