Skip to content

Instantly share code, notes, and snippets.

View sybrew's full-sized avatar

Sybre Waaijer sybrew

View GitHub Profile
@sybrew
sybrew / pronamic-ideal-notice-killer.php
Last active April 17, 2016 05:20
Disables Annoying Pronamic iDeal upgrade nag until you reach 15 purchases.
<?php
/**
* Plugin Name: Pronamic IDEAL Notice Killer
* Plugin URI: https://hostmijnpagina.nl/
* Description: Disables Annoying Pronamic iDeal upgrade nag until you reach 15 purchases.
* Version: 1.0.0
* Author: Sybre Waaijer
* Author URI: https://cyberwire.nl/
* License: GPLv3
*/
@sybrew
sybrew / hello.class.php
Last active July 24, 2016 19:08
Hello Dolly OOP example (untested)
<?php
/*
Plugin Name: Hello Dolly OOP example
Plugin URI: https://wordpress.org/plugins/hello-dolly/
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
Author: Matt Mullenweg (and set to OOP by Sybre Waaijer)
Version: 1.6.oop
Author URI: http://ma.tt/
*/
<?php
/**
* Converts array to make a compatible list for both PHP5 and PHP7.
*
* @param array $array The array to convert.
* @return array $list in correct order to use PHPFUNCTION list().
*/
function prepare_list( array $array = array() ) {
if ( PHP_VERSION_ID >= 70000 )
@sybrew
sybrew / wpforo-tsf.php
Last active March 28, 2017 18:45
wpForo compat
<?php
/**
* wpForo + The SEO Framework compatibility hook.
*/
add_action( 'init', function() {
//* Only work on is_wpforo_page and when the_seo_framework is found.
if ( function_exists( 'the_seo_framework' ) && function_exists( 'is_wpforo_page' ) && is_wpforo_page() ) {
//* Fix titles.
@sybrew
sybrew / snap-tsf-conflict-unset.php
Created September 21, 2017 17:40
Unsets NextScripts: SNAP from detected plugins
<?php
// Don't include the php tag.
//= First filter: Unsets NextScripts SNAP from check.
add_filter( 'the_seo_framework_conflicting_plugins', function( $plugins ) {
unset( $plugins['open_graph']['NextScripts SNAP'] );
return $plugins;
} );
@sybrew
sybrew / reset-tsfem.php
Created November 13, 2017 10:42
Deletes TSFEM activation settings.
<?php
/**
* Plugin Name: Reset TSFEM activation settings
* Plugin URI: https://theseoframework.com/
* Description: Activate this plugin to remove TSF - Extension Manager activation settings.
* Author: Sybre Waaijer
* Version: 1.0.0
* Author URI: https://cyberwire.nl/
*/
@sybrew
sybrew / reset-tsf-testing-settings.php
Last active December 6, 2017 23:17
Removes TSF testing settings.
<?php
/**
* Plugin Name: Reset TSF testing settings
* Plugin URI: https://theseoframework.com/
* Description: Activate this plugin to remove TSF testing settings.
* Author: Sybre Waaijer
* Version: 1.0.0
* Author URI: https://cyberwire.nl/
*/
@sybrew
sybrew / upgrade-handler.class.php
Created January 6, 2018 01:12
An upgrading class that was planned, but can't work in TSFEM.
<?php
/**
* @package TSF_Extension_Manager/Bootstrap
*/
namespace TSF_Extension_Manager;
defined( 'TSF_EXTENSION_MANAGER_DB_VERSION' ) or die;
/**
* The SEO Framework - Extension Manager plugin
@sybrew
sybrew / remove-editor-requirement.php
Created February 9, 2018 12:46
Remove editor support requirement in TSF
<?php
//! Don't include the php tag.
add_filter( 'the_seo_framework_custom_post_type_support', function( $support ) {
return array_diff( $support, array( 'editor' ) );
} );
@sybrew
sybrew / ifthisthenthatand.php
Created March 13, 2018 16:19
A readable if this-then-that-and-else-this-then-that-and... function wrapper.
<?php
function if_( $value ) {
return new class( (bool) $value ) {
public $run, $and;
public $cb = [];
function __construct( $run ) { $this->run = $run; }
function __destruct() {
foreach ( $this->cb as $cb ) {
$cb ? $cb() : null;