Skip to content

Instantly share code, notes, and snippets.

@thefuxia
thefuxia / spam-template.txt
Created November 22, 2013 17:28
Spam template – found in our spam folder on http://wpkrauts.com
{
{I have|I’ve} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours.
{It’s|It is} pretty worth enough for me. {In my opinion|Personally|In my view},
if all {webmasters|site owners|website owners|web
owners} and bloggers made good content as you did, the {internet|net|web}
will be {much more|a lot more} useful than ever before.|
I {couldn’t|could not} {resist|refrain from} commenting. {Very
well|Perfectly|Well|Exceptionally well} written!|
{I will|I’ll} {right away|immediately} {take hold
of|grab|clutch|grasp|seize|snatch} your {rss|rss feed} as I {can not|can’t} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink}
@thefuxia
thefuxia / function.network_menu_page_url.php
Last active December 26, 2015 23:39
function network_menu_page_url()
<?php
/**
* Get the URL for a network plugin page.
*
* @param string $menu_slug
* @param string $parent_file
* @return string|bool Url or FALSE on failure
*/
function network_menu_page_url( $menu_slug = '', $parent_file = '' ) {
@thefuxia
thefuxia / post-preview-metabox.php
Created October 9, 2013 11:19
T5 Post Preview Metabox See the post preview on the edit page
<?php
/**
* Plugin Name: T5 Post Preview Metabox
* Description: See the post preview on the edit page
* Plugin URI:
* Version: 2013.02.04
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
* License URI: http://opensource.org/licenses/MIT
@thefuxia
thefuxia / t5-enforce-open-comments.php
Created September 29, 2013 14:19
T5 Enforce Open Comments
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Enforce Open Comments
* Description: Override auto-closing for individual posts
* Plugin URI: http://toscho.de
* Version: 2013.09.29
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
* License URI: http://opensource.org/licenses/MIT
@thefuxia
thefuxia / simple-type-casting.php
Created August 30, 2013 13:09
Simple Type Casting in PHP
<?php # -*- coding: utf-8 -*-
header( 'Content-Type: text/plain;charset=utf-8' );
interface Simple_Type
{
public function __construct( $var );
public function __get( $var );
}
@thefuxia
thefuxia / mvc-thumbnail-list.php
Created August 30, 2013 01:48
List of post thumbnails in an MVC pattern
<?php # -*- coding: utf-8 -*-
// Demo code for http://wordpress.stackexchange.com/q/112184/73
// Model interface
interface Post_Collector_Interface
{
public function set_groups( Array $groups );
public function get_post_ids();
}
@thefuxia
thefuxia / cpt-with-tax-slug.php
Last active August 4, 2017 21:09
CPT with tax slug
<?php # -*- coding: utf-8 -*-
namespace CPTPermalinkDemo;
/**
* Plugin Name: Custom post type with taxonomy permalink
* Description:
* Plugin URI:
* Version: 2013.07.19
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
@thefuxia
thefuxia / comment-meta-demo.php
Created June 6, 2013 02:39
Comment Meta Demo Create, save and display a comment meta field. Here, a commentator can select a role.
<?php # -*- coding: utf-8 -*-
namespace WPSE;
/**
* Plugin Name: Comment Meta Demo
* Description: Create, save and display a comment meta field. Here, a commentator can select a role.
* Plugin URI: http://wordpress.stackexchange.com/q/101579/73
* Version: 2013.06.06
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
@thefuxia
thefuxia / t5-unique-login-field.php
Last active December 18, 2015 01:09
T5 Unique Log-in Field
<?php # -*- coding: utf-8 -*-
namespace Unique_Login;
/**
* Plugin Name: T5 Unique Log-in Field
* Description: Adds a checkbox with a unique name to the login form to prevent scripted log-in attempts.
* Plugin URI:
* Version: 2013.06.14
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
@thefuxia
thefuxia / top-spam-mail-domains.php
Last active October 5, 2016 11:49
Top Spam Mail Domains WordPress plugin for a dashboard widget
<?php # -*- coding: utf-8 -*-
namespace WPSE;
/**
* Plugin Name: Top Mail Domains
* Description: List the most used domain names from spammers and users in two dashboard widgets.
* Version: 2013.06.02
* Author: Thomas Scholz
* Author URI: http://wpkrauts.com
* License: MIT
*/