Skip to content

Instantly share code, notes, and snippets.

View herewithme's full-sized avatar
🎯
Focusing

Amaury Balmer herewithme

🎯
Focusing
View GitHub Profile
@herewithme
herewithme / members-fix-attachment.php
Created September 23, 2013 09:13
This plugin fix an issue with medias and content restriction on "Members" plugin WordPress (http://wordpress.org/plugins/members/). Allow to save correctly metabox data also for "attachment" post type.
<?php
/*
Plugin Name: Members - Fix for attachment
Plugin URI: http://www.beapi.fr
Description: This plugin fix an issue with medias and content restriction on "Members" plugin WordPress (http://wordpress.org/plugins/members/). Allow to save correctly metabox data also for "attachment" post type.
Author: BeAPI
Author URI: http://www.beapi.fr
Version: 0.1
----
@herewithme
herewithme / sanitize-filename.php
Created November 29, 2013 11:15
WordPress - No french punctuation and accents for filename
<?php
/*
Plugin Name: No french punctuation and accents for filename
Description: Remove all french punctuation and accents from the filename of upload for client limitation (Safari Mac/IOS)
Plugin URI: http://www.beapi.fr
Version: 1.0
Author: BeAPI
Author URI: http://www.beapi.fr
/*
@herewithme
herewithme / bea-acf-helpers.php
Created December 3, 2013 16:20
Small class helper for get ACF fields for a specific post type
<?php
class BEA_ACF_Helpers {
// Fields to not add to the available fields of acf
private static $unauth_fields = array(
'repeater',
'relationship',
'flexible_content'
);
/**
@herewithme
herewithme / search-files.php
Last active July 28, 2021 10:28
Search files with PHP Script - Help for find malware in uploads folder
<?php
$base_dir = dirname(__FILE__);
$extension_restriction = array(
'js',
'php'
);
$it = new RecursiveDirectoryIterator($base_dir);
foreach (new RecursiveIteratorIterator($it) as $file) {
if (in_array(strtolower(pathinfo( $file, PATHINFO_EXTENSION )), $extension_restriction)) {
@herewithme
herewithme / gist:fb65d93ca9c8a2c5cf1b
Created June 2, 2015 15:37
Force english on WP admin !
<?php
/*
Plugin Name: Languages Admin
Plugin URI: http://www.beapi.fr
Description: Force English on WP admin
Author: BeAPI
Author URI: http://www.beapi.fr
Version: 0.1
Text Domain: bea-languages
@herewithme
herewithme / varnish-purge-all.php
Last active February 16, 2016 11:47
Internal usage -- Purge all varnish when WP changes any content
<?php
/*
Plugin Name: Purge all varnish
Plugin URI: http://www.beapi.fr
Description: Purge all varnish cache when a post is modified/edited
Version: 1.3
Author: BeAPI
Author URI: http://www.beapi.fr
Network: true
*/
@herewithme
herewithme / wp-rocket-purge-all.php
Last active August 5, 2024 07:08
Purge all WP rocket cache when a post is modified/edited
<?php
/*
Plugin Name: Purge all WP Rocket cache
Plugin URI: http://www.beapi.fr
Description: Purge all WP rocket cache when a post is modified/edited
Version: 1.0
Author: BeAPI
Author URI: http://www.beapi.fr
Network: true
*/
@herewithme
herewithme / prod-images.php
Last active March 31, 2019 11:17
This plugin allow to build development environnement without copy data from uploads folder. Manage an failback with PHP and production assets.
<?php
/*
* Plugin Name: BEA - Prod images
* Version: 0.1
* Plugin URI: http://www.beapi.fr
* Description: This plugin allow to build development environnement without copy data from uploads folder. Manage an failback with PHP and production assets.
* Author: BeAPI
* Author URI: http://www.beapi.fr
* Domain Path: languages
* Network: false
@herewithme
herewithme / force-domain-mapping.php
Last active December 1, 2015 13:19
Force replace original domain by mapped domain for WPMU Domain Mapping
<?php
/*
Plugin Name: BEA Domain Mapping
Description: Always force replace original domain by mapping domain
Plugin URI: http://www.beapi.fr
Version: 1.0
Author: BeAPI
Author URI: http://www.beapi.fr
/*
@herewithme
herewithme / bench-memcached.php
Created December 3, 2015 23:47
Benchmark for test memcached performance
<?php
// Initialize values: 1000000 keys of 20 bytes with 40 bytes of data
$c = 1000000;
$values = array();
for ($i=0;$i<$c;$i++) $values[sprintf('%020s',$i)]=sha1($i);
// Memcached
$m = new Memcached();
$m->addServer('10.0.101.82', 11211);
$start = microtime(true);