Skip to content

Instantly share code, notes, and snippets.

@thefuxia
thefuxia / t5-highlight.php
Created June 1, 2017 08:42
WordPress plugin for highlight.js
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Highlight
* Description: Use highlight.js on front end. Mark code with <code>&lt;pre class="language-php"&gt;&lt;code&gt;your code&lt;/code&gt;&lt;/pre&gt;</code>
* Version: 31.10.14
* Required: 4.0
* Author: Thomas Scholz
* Author URI: http://toscho.de
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
@thefuxia
thefuxia / Autoload.php
Created January 16, 2017 09:53
PSR 4 autoloader
<?php
namespace T5\Files;
/**
* Simple PSR-4 autoloader
* See http://codereview.stackexchange.com/a/150308/318 for an explanation
*/
class Autoload
{
/**
@thefuxia
thefuxia / login-form-widget.php
Last active July 10, 2024 23:35
WordPress Plugin: T5 Log In Form Widget
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Log in form widget
* Plugin URI: https://gist.github.com/toscho/c7459ee439fd2491c1f6
* Description: Shows a log in form in a widget.
* Version: 13.10.15
* Required: 4.0
* Author: Thomas Scholz <[email protected]>
* Author URI: http://toscho.de
* License: MIT
@thefuxia
thefuxia / fix-https-apache.php
Created July 23, 2015 17:11
T5 Fix HTTPS header on Apache
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Fix HTTPS header on Apache
* Version: 2015.07.23
* Author: toscho
* Author URI: http://toscho.de
* License: MIT
*/
if ( empty ( $_SERVER['SERVER_SOFTWARE'] ) )
return;
@thefuxia
thefuxia / whereami.php
Created July 4, 2015 08:21
Where am I?
<?php
/* Plugin Name: Where am I?
* Description: Adds the current server name and WordPress path to the admin footer.
* Version: 2015.07.04
* Author: toscho
* Author URI: http://wpkrauts.com/
* License: MIT
* License URI: http://opensource.org/licenses/MIT
*/
add_filter( 'admin_footer_text', function( $text ) {
@thefuxia
thefuxia / mock-wp-mail.php
Created June 22, 2015 10:18
Replace the pluggable function wp_mail() with a dummy.
<?php
// Plugin Name: Mock wp_mail()
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
return true;
}
@thefuxia
thefuxia / t5-editor-shortlink.php
Created May 8, 2015 08:24
WordPress Plugin: T5 Editor Shortlink
@thefuxia
thefuxia / t5-short-feed.php
Last active August 29, 2015 14:20
WordPress Plugin: T5 Short Feed
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Short Feed
* Plugin URI: https://gist.github.com/toscho/86d6ebcdec3be4d04af8
* Description: Creates a feed with just the excerpt, no matter what you have set for the main feed. Please visit the permalinks page once after activation. The feed is then available at <code>/feed/summary/</code>. Requires PHP 5.3.
* Version: 07.05.15
* Required: 4.2
* Author: Thomas Scholz <[email protected]>
* Author URI: http://toscho.de
* License: MIT
@thefuxia
thefuxia / plugin-debug-request.php
Last active September 5, 2024 01:51
Debug request
<?php
/**
* Plugin Name: T5 Debug Request
*/
is_admin() || add_action( 'shutdown', function() {
if ( ! current_user_can( 'update_core' ) )
return;
print '<pre>REQUEST';
@thefuxia
thefuxia / disable-open-sans.php
Created April 1, 2015 16:56
T5 Disable Open Sans
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Disable Open Sans
* Version: 2015.04.01
* Author: toscho
* License: MIT
*/
add_filter( 'gettext_with_context', 'disable_open_sans', 10, 4 );