.
*/
// 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) {
$ret = '';
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
Function Tweaker revoked: $status
Function output:
$status
Function Tweaker will define WP_CONTENT_DIR as {$hmOptions['wpPluginDir']}
Function Tweaker will NOTdefine WP_CONTENT_DIR any more.
You may want to add this line to your wp_config.php
define('WP_CONTENT_DIR', $wpContentDir);
WP_CONTENT_DIR is not defined.
Defining it may solve all your problems regarding functions like plugin_dir_url(), plugins_url() and plugin_basename()
{$wpContentDir}? ";
echo "";
echo "";
}
?>
plugins_url()wp_config.php, please do so.redefinedFunctions*.php and may be able to fix your issues.