Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
@afragen
afragen / test-ghu-gu-update.php
Last active May 15, 2021 23:00
Test updating from GitHub Updater v9.9.10 to Git Updater
<?php
/**
* Plugin Name: Test GitHub Updater to Git Updater update
* Plugin URI: https://gist.github.com/afragen/64e4037576bd5292b5f3aeb1db39e0eb
* Description: Test the update process from GitHub Updater v9.9.10 to Git Updater.
* Author: Andy Fragen
* Version: 0.1.0
* Author URI: http://thefragens.com
* Gist Plugin URI: https://gist.github.com/afragen/64e4037576bd5292b5f3aeb1db39e0eb
* License: MIT
@afragen
afragen / freemius-self-update.php
Created May 3, 2021 18:42
If the plugin can update outside of Freemius integration, this overrides the Freemius behavior.
/**
* Remove Freemius dashboard update overrides.
*
* @return void
*/
public function allow_self_update() {
remove_all_filters( 'after_plugin_row_git-updater/git-updater.php' );
remove_all_filters( 'after_plugin_row_git-updater-pro/git-updater.php' );
add_action(
@afragen
afragen / prevent-plugin-update-dot-org.php
Last active February 11, 2021 18:54
Prevent updating for specific WordPress plugins.
<?php
// Prevent updating of specific dot org plugins.
add_filter(
'site_transient_update_plugins',
function( $transient ) {
$plugin_arr = [ 'test-plugin2/test-plugin2.php', 'akismet/akismet.php' ];
foreach ( $plugin_arr as $plugin_file ) {
if ( isset( $transient->response[ $plugin_file ]->id )
&& false !== strpos( $transient->response[ $plugin_file ]->id, 'w.org/plugins' )
) {
@afragen
afragen / rollback-testing.php
Last active November 7, 2022 13:28
Plugin to simulate plugin/theme update failure for testing Rollback Update Failure feature plugin.
<?php
/**
* Rollback Update Testing
*
* @package rollback-update-testing
* @author Andy Fragen <[email protected]>
* @license MIT
*/
/**
@afragen
afragen / local-edd-store.php
Last active July 31, 2020 20:56
Needed for non https local EDD store to correctly run. Set $store_url to your local store URL.
<?php
/**
* Plugin Name: Local EDD Store
* Description: Set `reject_unsafe_urls` to false for $store_url. $store_url will need to be set for the URL of your local EDD store.
* Author: Andy Fragen
* Version: 0.3
* Gist Plugin URI: https://gist.github.com/afragen/ed00f34f8e03aeedb96bdbf6f3e50495
*/
add_filter(
@afragen
afragen / site-testing.php
Last active March 21, 2021 18:35
A simple plugin for adding filters/code for plugin testing.
<?php
/**
* Plugin Name: Site Testing
* Plugin URI: https://gist.github.com/afragen/a30b7766d8eb1aa22018130dfd5034f4
* Description: This plugin is used for site testing.
* Version: 0.4
* Author: Andy Fragen
* License: MIT
* Requires at least: 5.2
* Requires PHP: 7.1
@afragen
afragen / wp-mail-smtp-shim.php
Last active July 1, 2020 20:57
Shim to fix errors in WP 5.5-alpha+ and WP Mail SMTP
<?php
/**
* WP Mail SMTP Shim for WP 5.5 plugin bootstrap.
*
* @package WP_Mail_SMTP_Shim
* @author Andy Fragen
* @license MIT
*
* @wordpress-plugin
* Plugin Name: WP Mail SMTP Shim for WP 5.5
@afragen
afragen / switch-dependency-label.php
Last active June 27, 2020 21:32
Switch the Plugin Dependency label of wp-dependency-installer
<?php
/**
* Switch Plugin Dependency Label for WP Dependency Installer
*
* @package Switch_Plugin_Dependency_Label
* @author Andy Fragen
* @license MIT
*
* @wordpress-plugin
* Plugin Name: Switch Plugin Dependency Label
@afragen
afragen / .phpcs.xml
Last active June 15, 2023 20:58
My PHPCS rulesets using WPCS as a base.
<?xml version="1.0"?>
<ruleset name="WordPress-Beta-Tester">
<description>Keep long array syntax.</description>
<!-- Include main ruleset.xml -->
<rule ref="/Users/afragen/code-standards/ruleset.xml"/>
<rule ref="Generic.Arrays.DisallowShortArraySyntax" />
<!-- Use only long arrays -->
<rule ref="Generic.Arrays">
@afragen
afragen / set-category-colors-hash.php
Created October 30, 2019 19:32
Set the Category Colors options hash to pre-defined hash
<?php
/**
* Plugin Name: Set Category Colors Options Hash
* Author: Andy Fragen
* Author URI: https://github.com/afragen
* Version: 0.1
* Requires PHP: 5.3
*/
add_filter( 'teccc_set_options_hash', function(){