Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
@afragen
afragen / add-plugin-dependency-api.php
Last active September 3, 2022 00:15
Add to Dependencies tab via Git Updater PRO REST API
<?php
/**
* Add Plugin Dependency via REST API.
*
* @package Fragen\Plugin_Dependency_API
*
* Plugin Name: Add Plugin Dependency via REST API
* Plugin URI: https://gist.github.com/afragen/ba3fc125fb0ecd242b1b162153d6adf9
* Description: Add plugin dependency data to Dependencies tab via REST API endpoint and allow for Install Now button to function.
* Version: 0.11.3
@afragen
afragen / change-wp-debugging-defaults.php
Created February 17, 2022 19:24
Single use plugin and filter showing how to change WP Debugging default constants.
<?php
/**
* Plugin Name: Change WP Debugging Defaults
* Plugin URI: https://gist.github.com/afragen/5c79984f154911be171c80468f676572
* Description: Single use plugin and filter showing how to change WP Debugging default constants.
* Version: 0.1
* Author: Andy Fragen
* License: MIT
* Requires at least: 5.2
* Requires PHP: 7.1
/**
* Moves a directory from one location to another via the rename() PHP function.
* If the renaming failed, falls back to copy_dir().
*
* Assumes that WP_Filesystem() has already been called and setup.
*
* @since 5.9.0
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
*
public function delete_temp_backup( $args ) {
global $wp_filesystem;
if ( empty( $args['slug'] ) || empty( $args['dir'] ) ) {
return false;
}
$temp_backup = trailingslashit( $wp_filesystem->wp_content_dir() . "upgrade/temp-backup/{$args['dir']}/{$args['slug']}" );
return $this->recursive_directory_delete( $temp_backup );
@afragen
afragen / filter-examples.txt
Last active December 8, 2021 01:30
Simple plugin to fix the plugins_url() and get_template_directory_uri() paths when WP installed in a subdirectory and wp-content not in ABSPATH
add_filter(
'subdirectory_fix_plugins_url',
function() {
return [ 'wpforms-lite', 'query-monitor' ];
}
);
add_filter(
'subdirectory_fix_template',
function() {
@afragen
afragen / change-default-content-folder.php
Last active October 25, 2021 20:27
Use the 'gu_fix_repo_slug' filter to change the default wp-content folder name.
<?php
/**
* Usage of 'gu_fix_repo_slug' filter.
*
* @package wordpress-plugin
* @link https://github.com/afragen/git-updater/issues/971
*/
/**
* Plugin Name: Change Default Content Folder
@afragen
afragen / show-gu-settings.php
Last active July 6, 2021 16:57
Simple plugin to override earlier filter set to hide Git Updater Settings
<?php
/**
* Plugin Name: Show Git Updater Settings
* Description: Override hiding of Git Updater Settings. Use only for debugging/testing. Someone set this for a good reason.
* Plugin URI: https://gist.github.com/afragen/290703613c50dab70dd06992c23cdfe0
* Author: Andy Fragen
* Author URI: https://github.com/afragen
* Version: 0.1
* Requires PHP: 5.6
* Requires at least: 5.2
<?php
/**
* Plugin Name: test
*/
use Fragen\Git_Updater\Plugin;
$bookings = array(
'name' => 'WooCommerce Bookings',
@afragen
afragen / git-updater-ignore.php
Last active September 13, 2024 19:53
A plugin to ignore specific repositories from Git Updater
<?php
/**
* Plugin Name: Git Updater Ignore
* Plugin URI: https://gist.github.com/afragen/414612961ac500b652862096a54d62d7
* Description: This plugin is used to set Git Updater to ignore specific repository slugs.
* Version: 0.3
* Author: Andy Fragen
* License: MIT
* Requires at least: 5.2
* Requires PHP: 5.6
@afragen
afragen / api-check-git-updater-premium-plugins.php
Last active June 2, 2021 19:26
Override default filters that skip API checks on premium Git Updater plugins in private repositories.
<?php
/**
* Plugin Name: API Check Git Updater Premium Plugins
* Plugin URI: https://gist.github.com/afragen/b752eb5da399a55f5597780efbbd5230
* Description: This plugin is used to override default exclusion of skipping API checks for Git Updater premium plugins in private repositories.
* Version: 0.1
* Author: Andy Fragen
* License: MIT
* Requires at least: 5.2
* Requires PHP: 7.1