Skip to content

Instantly share code, notes, and snippets.

View mecha's full-sized avatar

Miguel Muscat mecha

View GitHub Profile
@mecha
mecha / file-bomb.php
Last active November 7, 2023 20:01
1-line PHP File Bomb
<?php
file_put_contents(__FILE__, substr(file_get_contents(__FILE__), 7), FILE_APPEND);
@mecha
mecha / gist.php
Last active November 8, 2020 13:14
Freemius - Free plugin updates blocked if premium and free versions do not match
<?php
// Functions that you'll need
function get_free_version() { /* ... */ }
function get_premium_version() { /* ... */ }
function is_free_plugin($plugin_basename) { /* ... */ }
// Filter the value of the transient where WordPress stores pending updates
add_filter('site_transient_update_plugins', function ($value) {
// Only proceed if the transient has responses from update servers