User:Adam/Creating MediaWiki bots in PHP/in PHP 4From WikiSummary, the Free Social Science Summary Database A user has written to say that pasting the following code into BasicBot.php will make it work in PHP 4. While the code looks good, I haven't tested it, so use it at your own risk.
if (!function_exists('file_put_contents') && !defined('FILE_APPEND')) {
define('FILE_APPEND', 1);
function file_put_contents($n, $d, $flag = false) {
if ($flag == FILE_APPEND || strtoupper($flag) == 'FILE_APPEND') {
$mode = 'a';
} else {
$mode = 'w';
}
$f = @fopen($n, $mode);
if ($f === false) {
return 0;
} else {
if (is_array($d)) $d = implode($d);
$bytes_written = fwrite($f, $d);
fclose($f);
return $bytes_written;
}
}
}
if (!function_exists("htmlspecialchars_decode")) {
function htmlspecialchars_decode($string, $quote_style = ENT_COMPAT) {
return strtr($string, array_flip(
get_html_translation_table(HTML_SPECIALCHARS, $quote_style))
);
}
}
|
– Toolbox Ads by Google Please report inappropriate ads. We do not endorse services that facilitate plagiarism. |