Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
@afragen
afragen / .wp-env.json
Created May 24, 2023 19:26
Just an example, doesn't work for core development.
{
"core": "WordPress/wordpress-develop#trunk",
"phpVersion": "8.1",
"plugins": [
"https://downloads.wordpress.org/plugin/query-monitor.zip"
],
"port": 8888,
"testsPort": 8889,
"config": {
"WP_DEBUG": true,
@afragen
afragen / phpcs.xml
Last active September 10, 2023 16:55
phpcs files for my plugins and core plugins
<?xml version="1.0"?>
<ruleset name="AJF Coding Standards">
<description>A custom ruleset to take in account both WordPress and personal standards.</description>
<!-- Show progress and sniff codes in all reports -->
<arg value="ps"/>
<arg value="sp"/>
<arg name="colors"/>
<!-- Only check PHP files. -->
@afragen
afragen / karma.php
Last active February 2, 2024 17:23
Impose karma on specific users
<?php
/**
* Karma.
*
* @package Fragen\Karma
*
* Plugin Name: Karma
* Plugin URI: https://gist.github.com/afragen/b45511007d0a1c07ad285ce6e223a91c
* Description: Impose karma on users.
* Version: 0.8.0
@afragen
afragen / git-updater-fastspring-popup.php
Created November 3, 2022 23:34
Add javascript for FastSpring's Git Updater popup store.
<?php
/**
* Add FastSpring popup store script for Git Updater.
*
* @package FastSpringPopUpStore
*
* Plugin Name: FastSpring Popup Store for Git Updater
* Plugin URI: https://gist.github.com/afragen/e7819dd1e17be5792c299dbef989d446
* Description: Add FastSpring popup store javascript for Git Updater.
* Version: 0.1.0
@afragen
afragen / php.ini.hbs
Last active January 11, 2023 22:29
Stuff for xDebug 3.x and Local
; Add to all lightning services PHP conf files using xDebug 3.x
xdebug.mode=debug
xdebug.client_port=9003
xdebug.start_with_request=trigger
xdebug.discover_client_host=yes
xdebug.idekey=VSCODE
; Add to all lightning services PHP conf files using xDebug 2.x
xdebug.remote_enable=1
xdebug.remote_connect_back=Off
@afragen
afragen / trick-auto-update.php
Created August 24, 2022 20:03
Allows one to mash the WP Crontrol 'Run now' link with abandon.
/**
* Trick `WP_Automatic_Updater` into thinking there is no existing lock.
*
* By default, the auto-updater will only run once every hour even if
* the cron job is manually fired. That makes it hard to run multiple tests
* in a short period of time.
*/
add_filter(
'option_auto_updater.lock',
function ($value) {
<?php
/**
* Auto-update fatal error check test plugin.
*
* @package AutoUpdateFatalErrorCheck
*
* Plugin Name: Auto-update Fatal Error Check Test Plugin
* Plugin URI: https://github.com/afragen/fatal-plugin
* Description: Set local version to 0 and comment code from plugin for testing.
* Version: 0.1.1
@afragen
afragen / auto-update-fatal-error-check.php
Last active August 3, 2022 17:55
Run the Rollback code if the plugin has an activation error.
<?php
/**
* Auto-update fatal error check.
*
* @package AutoUpdateFatalErrorCheck
*
* Plugin Name: Auto-update Fatal Error Check
* Plugin URI: https://gist.github.com/afragen/518819349528dba930cf7845180d5274
* Description: Check for a PHP error on plugin auto-update and deactivate plugin if one exists.
* Version: 0.4.2
@afragen
afragen / gist-oembed.php
Last active August 5, 2022 19:56
WordPress plugin to embed gists or gist files.
<?php
/**
* Gist oEmbed.
*
* @package Fragen\Gist_OEmbed
*
* Plugin Name: Gist oEmbed
* Plugin URI: https://gist.github.com/afragen/36ab01da116aadd27a3f4d85cce90390
* Description: oEmbed Gist or files within Gists.
* Version: 0.6.2
@afragen
afragen / stop-auto-update-success-email.php
Last active May 2, 2023 16:52
Stop success update email for plugin/theme auto updates.
<?php
/**
* Stop success email from auto-updates.
*
* @package StopAutoUpdateSuccessEmail
*
* Plugin Name: Stop Auto-update Success Email
* Plugin URI: https://gist.github.com/afragen/e2f40ed2e71e590a127e8adc1db05948
* Description: Stop success email from auto-updates.
* Version: 0.2.0