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 | |
use PHPUnit\Framework\TestCase; | |
final class FaviconTest extends TestCase { | |
public function testFaviconIncluded() { | |
$icons = array(); | |
$qp = html5qp( SITE_URL ); | |
$qp->find('link[rel="icon"]')->each( function( $i, $node ) use ( &$icons ) { | |
$icons[] = parse_url( $node->getAttribute( 'href' ), PHP_URL_PATH ); |
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
document.addEventListener( 'DOMContentLoaded', function() { | |
const websiteUrl = 'http://www.anred.org/?feed=rss2'; | |
const entityPattern = /\[(&(?:\#(?:(?<dec>[0-9]+)|[Xx](?<hex>[0-9A-Fa-f]+))|(?<named>[A-Za-z0-9]+));)\]/ | |
const feeds = [ | |
'http://www.anred.org/?feed=rss2' | |
]; | |
feeds.forEach( function( websiteUrl ) { | |
fetch( websiteUrl ).then( ( res ) => { |
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 | |
class WP_Customize_Editor extends WP_Customize_Control { | |
public $type = 'editor'; | |
public function render_content() { ?> | |
<label> | |
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> | |
<input id="<?php echo $this->id; ?>-link" type="hidden" class="wp-editor-area" <?php $this->link(); ?> value="<?php echo esc_textarea( $this->value() ); ?>"> | |
<?php |
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 auto_width_facebook_video( $result, $url, $args, $post_id ) { | |
return preg_replace('/data-width="(\d+)"/', 'data-width="auto"', $result); | |
} | |
add_filter('embed_oembed_html', 'auto_width_facebook_video', 11, 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
<?php | |
function wp_clean_on_paste( $in ) { | |
$in['paste_preprocess'] = "function( plugin, args ) { | |
var whitelist = 'a,p,span,b,strong,i,em,h3,h4,h5,h6,ul,li,ol'; | |
var stripped = jQuery('<div>' + args.content + '</div>'); | |
var els = stripped.find('*').not(whitelist); | |
for (var i = els.length - 1; i >= 0; i--) { | |
var e = els[i]; |
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 | |
if ( !defined( 'ABSPATH' ) ) exit; | |
function wp_keep_alive($headers, $wp) { | |
foreach ($headers as $key => $value) { | |
if ('connection' === strtolower($key)) { | |
unset($headers[$key]); | |
} | |
} |
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 | |
class WP_Deduplicator { | |
private static $published = array(); | |
public static function add( $post = null ) { | |
$post = get_post( $post ); | |
if ( !in_array( $post->ID, self::$published ) ) | |
array_push( self::$published, $post->ID ); | |
} |