mirror of
https://github.com/myvesta/vesta
synced 2025-07-05 20:41:53 -07:00
tabs fix
This commit is contained in:
parent
beccead388
commit
3192243fb4
3 changed files with 32 additions and 32 deletions
|
@ -10,25 +10,25 @@ if ($counter<2) myvesta_throw_error(2, 'Function is missing');
|
|||
|
||||
$func=$argv[1];
|
||||
if (!function_exists($func)) {
|
||||
$func="myvesta_".$argv[1];
|
||||
if (!function_exists($func)) myvesta_throw_error(2, 'Function does not exists');
|
||||
$func="myvesta_".$argv[1];
|
||||
if (!function_exists($func)) myvesta_throw_error(2, 'Function does not exists');
|
||||
}
|
||||
|
||||
$params=array();
|
||||
|
||||
for ($i=2; $i<$counter; $i++) {
|
||||
$argv[$i]=myvesta_fix_backslashes($argv[$i]);
|
||||
$params[]=$argv[$i];
|
||||
$argv[$i]=myvesta_fix_backslashes($argv[$i]);
|
||||
$params[]=$argv[$i];
|
||||
}
|
||||
|
||||
$r=call_user_func_array($func, $params);
|
||||
if (is_bool($r)) {
|
||||
if ($r) {
|
||||
exit(0);
|
||||
} else {
|
||||
exit(MYVESTA_ERROR_GENERAL);
|
||||
}
|
||||
if ($r) {
|
||||
exit(0);
|
||||
} else {
|
||||
exit(MYVESTA_ERROR_GENERAL);
|
||||
}
|
||||
} else {
|
||||
echo $r;
|
||||
exit(0);
|
||||
echo $r;
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@ function myvesta_throw_error($code, $message) {
|
|||
}
|
||||
|
||||
function myvesta_fix_backslashes($s) {
|
||||
$s=str_replace("\\n", "\n", $s);
|
||||
$s=str_replace("\\r", "\r", $s);
|
||||
$s=str_replace("\\t", "\t", $s);
|
||||
return $s;
|
||||
$s=str_replace("\\n", "\n", $s);
|
||||
$s=str_replace("\\r", "\r", $s);
|
||||
$s=str_replace("\\t", "\t", $s);
|
||||
return $s;
|
||||
}
|
||||
|
||||
function myvesta_check_args ($requried_arguments, $arguments) {
|
||||
|
@ -45,11 +45,11 @@ function myvesta_check_args ($requried_arguments, $arguments) {
|
|||
|
||||
function myvesta_fix_args() {
|
||||
global $argv;
|
||||
$i=0;
|
||||
$i=0;
|
||||
foreach ($argv as $argument) {
|
||||
if ($i==0) {$i++; continue;}
|
||||
if ($i==0) {$i++; continue;}
|
||||
$argv[$i]=myvesta_fix_backslashes($argv[$i]);
|
||||
$i++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,8 @@ function myvesta_exit($code) {
|
|||
}
|
||||
|
||||
function myvesta_test_func () {
|
||||
$args=func_get_args();
|
||||
echo "You said: ";
|
||||
print_r ($args);
|
||||
echo "\n";
|
||||
$args=func_get_args();
|
||||
echo "You said: ";
|
||||
print_r ($args);
|
||||
echo "\n";
|
||||
}
|
||||
|
|
|
@ -11,49 +11,49 @@ function myvesta_replace_in_file($file, $find, $replace) {
|
|||
|
||||
$buf=str_replace($find, $replace, $buf);
|
||||
$r=file_put_contents($file, $buf);
|
||||
if ($r===false) return false;
|
||||
if ($r===false) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function myvesta_get_between_in_file($file, $left_substring, $right_substring, $start=0, $return_left_substring=0, $return_right_substring=0, $left_substring_necessary=1, $right_substring_necessary=1) {
|
||||
if (!file_exists($file)) return myvesta_throw_error (MYVESTA_ERROR_FILE_DOES_NOT_EXISTS, "File '$file' not found");
|
||||
$text=file_get_contents($file);
|
||||
return myvesta_str_get_between ($text, $left_substring, $right_substring, $start, $return_left_substring, $return_right_substring, $left_substring_necessary, $right_substring_necessary);
|
||||
return myvesta_str_get_between ($text, $left_substring, $right_substring, $start, $return_left_substring, $return_right_substring, $left_substring_necessary, $right_substring_necessary);
|
||||
}
|
||||
|
||||
function myvesta_replace_in_file_once_between_including_borders($file, $left, $right, $replace_with) {
|
||||
if (!file_exists($file)) return myvesta_throw_error (MYVESTA_ERROR_FILE_DOES_NOT_EXISTS, "File '$file' not found");
|
||||
$text=file_get_contents($file);
|
||||
$buf=myvesta_str_replace_once_between_including_borders($text, $left, $right, $replace_with);
|
||||
$buf=myvesta_str_replace_once_between_including_borders($text, $left, $right, $replace_with);
|
||||
$r=file_put_contents($file, $buf);
|
||||
if ($r===false) return false;
|
||||
if ($r===false) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function myvesta_strip_once_in_file_between_including_borders($file, $left, $right) {
|
||||
if (!file_exists($file)) return myvesta_throw_error (MYVESTA_ERROR_FILE_DOES_NOT_EXISTS, "File '$file' not found");
|
||||
$text=file_get_contents($file);
|
||||
$buf=myvesta_str_strip_once_between_including_borders($text, $left, $right);
|
||||
$buf=myvesta_str_strip_once_between_including_borders($text, $left, $right);
|
||||
$r=file_put_contents($file, $buf);
|
||||
if ($r===false) return false;
|
||||
if ($r===false) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function myvesta_replace_in_file_between_including_borders($file, $left, $right, $replace_with) {
|
||||
if (!file_exists($file)) return myvesta_throw_error (MYVESTA_ERROR_FILE_DOES_NOT_EXISTS, "File '$file' not found");
|
||||
$text=file_get_contents($file);
|
||||
$buf=myvesta_str_replace_between_including_borders($text, $left, $right, $replace_with);
|
||||
$buf=myvesta_str_replace_between_including_borders($text, $left, $right, $replace_with);
|
||||
$r=file_put_contents($file, $buf);
|
||||
if ($r===false) return false;
|
||||
if ($r===false) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function myvesta_strip_in_file_between_including_borders($file, $left, $right) {
|
||||
if (!file_exists($file)) return myvesta_throw_error (MYVESTA_ERROR_FILE_DOES_NOT_EXISTS, "File '$file' not found");
|
||||
$text=file_get_contents($file);
|
||||
$buf=myvesta_str_strip_between_including_borders($text, $left, $right);
|
||||
$buf=myvesta_str_strip_between_including_borders($text, $left, $right);
|
||||
$r=file_put_contents($file, $buf);
|
||||
if ($r===false) return false;
|
||||
if ($r===false) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue