Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| <?php | |
| /* | |
| Plugin Name: Disable plugins when doing local dev | |
| Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify | |
| Version: 0.1 | |
| License: GPL version 2 or any later version | |
| Author: Mark Jaquith | |
| Author URI: http://coveredwebservices.com/ | |
| */ |
| <?php | |
| // http://michelf.com/projects/php-markdown/extra/ | |
| require_once( dirname(__FILE__) . '/markdown-extra/markdown-extra.php' ); | |
| /** | |
| * Format posts/comments with Markdown at display time. Only process | |
| * blocks starting with \^md\s+. | |
| **/ | |
| function p2mis_comment_markdown( $text ) { |
| <?php | |
| /** | |
| * WordPress Chosen Taxonomy Metabox | |
| * Author: Helen Hou-Sandi | |
| * | |
| * Use Chosen for a replacement taxonomy metabox in WordPress | |
| * Useful for taxonomies that aren't changed much on the fly and are | |
| * non-hierarchical in nature, as Chosen is for flat selection only. | |
| * You can always use the taxonomy admin screen to add/edit taxonomy terms. | |
| * Categories need slightly different treatment from the rest in order to |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| <?php | |
| /* | |
| Usage: | |
| $frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL | |
| if ( !$frag->output() ) { // NOTE, testing for a return of false | |
| functions_that_do_stuff_live(); | |
| these_should_echo(); | |
| // IMPORTANT | |
| $frag->store(); | |
| // YOU CANNOT FORGET THIS. If you do, the site will break. |
| /** | |
| * Helper class for controlling all aspects of a view. | |
| * | |
| * Supported methods (automatically hooked): | |
| * - init() - for registering post types, taxonomies, rewrite rules etc. | |
| * - parse_query() - for correcting query flags | |
| * - pre_get_posts() - for altering the query, without affecting the query flags | |
| * - posts_search(), posts_clauses(), posts_request() - for direct SQL manipulation | |
| * - the_posts() - for various other manipulations | |
| * - template_redirect() - for enqueuing scripts etc. |
| <NotepadPlus> | |
| <UserLang name="LogFile" ext="log"> | |
| <Settings> | |
| <Global caseIgnored="yes" /> | |
| <TreatAsSymbol comment="no" commentLine="no" /> | |
| <Prefix words1="no" words2="no" words3="no" words4="no" /> | |
| </Settings> | |
| <KeywordLists> | |
| <Keywords name="Delimiters">[(0])0</Keywords> | |
| <Keywords name="Folder+"></Keywords> |
| <?php | |
| $root = $_SERVER['DOCUMENT_ROOT']; | |
| chdir( $root ); | |
| $path = '/'.ltrim( parse_url( $_SERVER['REQUEST_URI'] )['path'],'/' ); | |
| if ( file_exists( $root.$path ) ) | |
| { | |
| if ( is_dir( $root.$path ) && substr( $path,strlen( $path ) - 1, 1 ) !== '/' ) | |
| { |
| <?php | |
| /* Plugin Name: Damn Vulnerable WordPress Plugin | |
| * Description: Intentionally vulnerable plugin for plugin author education | |
| * Version: 0.1 | |
| * Plugin URI: http://make.wordpress.org/plugins/2013/04/09/intentionally-vulnerable-plugin/ | |
| * Author: Jon Cave | |
| * Author URI: http://joncave.co.uk | |
| * License: GPLv2+ | |
| * | |
| * DO NOT RUN THIS PLUGIN ON AN INTERNET ACCESSIBLE SITE |
| <?php # -*- coding: utf-8 -*- | |
| /** | |
| * Plugin Name: T5 Silent Flush | |
| * Description: Flushes rewrite rules whenever a custom post type or taxonomy is registered and not already part of these rules. This is a soft flush, the .htaccess will not be rewritten. | |
| * Version: 2013.05.04 | |
| * Author: Thomas Scholz <[email protected]> | |
| * Author URI: http://toscho.de | |
| * License: MIT | |
| * License URI: http://www.opensource.org/licenses/mit-license.php | |
| */ |