Skip to content

Instantly share code, notes, and snippets.

Avatar

George Stephanis georgestephanis

View GitHub Profile
@georgestephanis
georgestephanis / build-markdown-table-of-plugins.php
Created Nov 27, 2020
This will build a github markdown table of all the plugins on a site.
View build-markdown-table-of-plugins.php
<?php
include( 'the/path/to/wp-load.php' );
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
}
$updates = get_site_transient( 'update_plugins' );
View child-theme-settings-migrator.php
<?php
/**
* Plugin Name: Child Theme Settings Migrator
*/
add_action( 'admin_init', 'child_theme_settings_migrator' );
function child_theme_settings_migrator() {
$theme = wp_get_theme();
View extra-user-reg.php
<?php
/**
* Plugin Name: Extra User Registration Source Tracking
* Description: Store data about a user's origin -- IP Address and User Agent -- when registering.
* Author: georgestephanis
* Author URI: http://wpspecialprojects.wordpress.com/
* License: GPLv2+
*/
@georgestephanis
georgestephanis / client.js
Last active Oct 22, 2020
This is an example client app to integrate with the WordPress 5.6 Application Passwords system. It walks the user through authenticating, and then queries and enumerates all users on the site.
View client.js
(function($){
const $root = $( '#root' );
const $stage1 = $( '.stage-1', $root );
const $stage2 = $( '.stage-2', $root );
// If there's no GET string, then no credentials have been passed back. Let's get them.
if ( ! window.location.href.includes('?') ) {
// Stage 1: Get the WordPress Site URL, Validate the REST API, and Send to the Authentication Flow
const $urlInput = $( 'input[type=url]', $stage1 );
@georgestephanis
georgestephanis / environment-notifier.php
Last active Oct 13, 2020
This plugin adds a node to the adminbar clarifying the current environment setting if not production.
View environment-notifier.php
<?php
/*
* Plugin Name: Environment Notifier
* Plugin URI: http://github.com/georgestephanis/environment-notifier/
* Description: This plugin adds a node to the adminbar clarifying the current environment setting if not production.
* Author: George Stephanis
* Version: 1.0
* Author URI: http://wpspecialprojects.wordpress.com
*/
View reusable-block-count.php
<?php
/**
* Plugin Name: Reusable Block Count
* Description: Display a "Reusable blocks" listing page, and a link to view all posts containing a given block.
* Author: georgestephanis
* Author URI: http://wpspecialprojects.wordpress.com/
* License: GPLv2+
*
* Loosely based on https://github.com/yeswework/fabrica-reusable-block-instances/
@georgestephanis
georgestephanis / _readme.md
Last active Apr 30, 2020
A validator script to confirm the validity and structure of Magic: The Gathering Arena Export/Import data. GPLv3
View _readme.md

Arena Export Validator

This is designed as a validator designed around current Arena standards -- to be used to validate and confirm whether or not a platform's generated export format meets Arena's specs (as Arena has no officially published specs, I've tried to determine varied test cases including decks with both commanders and companions).

Assumed Format of Export Data

  • There are four possible sections, that appear in the following sequence: Commander, Companion, Deck, Sideboard.
  • The section title is the first line of each section.
  • Blank lines are inserted after each section.
  • If a line begins with an integer, it's a card. If it begins with anything else, it's a Section title.
View MtgDeckCard.jsx
class MtgCard {
/* raw;
quantity;
name = '';
set = '';
setNumber = 0;
*/
constructor( input = '' ) {
this.raw = '';
View mtgax.php
<?php
define( 'MTGA_LANG', 'EN' );
define( 'MTGA_PATH', '/Applications/MTGArena.app/Contents/Resources/drive_c/Program Files/Wizards of the Coast/MTGA' );
define( 'MTGA_LOGS', MTGA_PATH . '/MTGA_Data/Logs/Logs' );
define( 'MTGA_DATA', MTGA_PATH . '/MTGA_Data/Downloads/Data' );
// Get all the logs!
$logs = glob( MTGA_LOGS . '/UTC_Log - * - 1.htm' );
View Stephanis.Scan.php
<?php
// Should this use RecursiveDirectoryIterator instead?
namespace Stephanis\Scan;
trait Props {
public $modified;
public $owner;
public $group;
You can’t perform that action at this time.