. */ // TODO: Wrap hitman in a class to avoid potential name-collisions. function whack($fn) { $hitman = 'rename_function' ; if (function_exists($fn) && function_exists($hitman)) { $hitman($fn, $fn.'_old') ; $ret .= $fn . ' is KILLDED
' ; } else return false ; } function whack_em($funs, $revive=false) { $hitman = 'rename_function' ; $ret = '' ; if (!function_exists($hitman)) { $ret .= $hitman . ' Not found!!
You need the apd package for this plugin to work. Please install it by the command pecl install apd.' ; return $ret ; } foreach ($funs as $fn) { if ($revive) { $oldName = $fn.'_old' ; $newName = $fn ; } else { $oldName = $fn ; $newName = $fn.'_old' ; } if (function_exists($oldName)) { @$hitman($oldName, $newName) ; $ret .= "$oldName is renamed to $newName
" ; } else $ret .= $oldName . ' is not found
' ; } return $ret ; } function test_one($fn) { if (function_exists($fn)) { $fnout = $fn(__FILE__) ; $ret .= "Output of " . $fn . "(): is " . print_r($fnout, true) ."
"; } else $ret .= $fn . ' is not found
' ; return $ret ; } function test_functions($funs) { foreach ($funs as $fn) { $ret .= test_one($fn) ; $fnOld = $fn . "_old" ; $ret .= test_one($fnOld) ; } return $ret ; } function hitman_admin() { $mOptions = "hitman" ; $hmOptions = get_option($mOptions); $funs = array('plugin_dir_url', 'plugins_url', 'plugin_basename') ; $hmOptions['funList'] = $funs ; // TODO: expose the list to the end-user if (isset($_POST['kill_functions'])) { $status = whack_em($funs) ; echo "

Function Tweaker activated: $status

" ; $hmOptions['kill'] = true ; update_option($mOptions, $hmOptions) ; } if (isset($_POST['save_functions'])) { $status = whack_em($funs, true) ; echo "

Function Tweaker revoked: $status

" ; $hmOptions['kill'] = false ; update_option($mOptions, $hmOptions) ; } if (isset($_POST['test_functions'])) { $status = test_functions($funs) ; echo "

Function output:
$status

" ; } ?>

Function Tweaker Valid XHTML 1.0 Transitional


">