Update and rename parse.colona.php to colona.format.v1.php
This commit is contained in:
parent
0c1e2ee8f8
commit
f440a95d92
37
helper/colona.format.v1.php
Normal file
37
helper/colona.format.v1.php
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if(!check_function_exists("decode_colona_format") {
|
||||||
|
function decode_colona_format($data) {
|
||||||
|
$lines = split_by_line($data);
|
||||||
|
|
||||||
|
$jobargs = array();
|
||||||
|
$eof = false;
|
||||||
|
$delimiter = ":";
|
||||||
|
|
||||||
|
$jobkey = "";
|
||||||
|
$jobvalue = "";
|
||||||
|
foreach($lines as $line) {
|
||||||
|
$pos = strpos($line, $delimiter);
|
||||||
|
|
||||||
|
if($pos !== false) {
|
||||||
|
$jobkey = rtrim(substr($line, 0, $pos));
|
||||||
|
$jobvalue = ltrim(substr($line, $pos + strlen($delimiter)));
|
||||||
|
if($jobvalue == "<<<EOF") {
|
||||||
|
$jobvalue = "";
|
||||||
|
$eof = true;
|
||||||
|
} else {
|
||||||
|
$jobargs[$jobkey] = $jobvalue;
|
||||||
|
}
|
||||||
|
} elseif($eof) {
|
||||||
|
if($line == "EOF;") {
|
||||||
|
$jobargs[$jobkey] = $jobvalue;
|
||||||
|
$eof = false;
|
||||||
|
} else {
|
||||||
|
$jobvalue .= $line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $jobargs;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,35 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
function parse_colona_format($data) {
|
|
||||||
$lines = split_by_line($data);
|
|
||||||
|
|
||||||
$jobargs = array();
|
|
||||||
$eof = false;
|
|
||||||
$delimiter = ":";
|
|
||||||
|
|
||||||
$jobkey = "";
|
|
||||||
$jobvalue = "";
|
|
||||||
foreach($lines as $line) {
|
|
||||||
$pos = strpos($line, $delimiter);
|
|
||||||
|
|
||||||
if($pos !== false) {
|
|
||||||
$jobkey = rtrim(substr($line, 0, $pos));
|
|
||||||
$jobvalue = ltrim(substr($line, $pos + strlen($delimiter)));
|
|
||||||
if($jobvalue == "<<<EOF") {
|
|
||||||
$jobvalue = "";
|
|
||||||
$eof = true;
|
|
||||||
} else {
|
|
||||||
$jobargs[$jobkey] = $jobvalue;
|
|
||||||
}
|
|
||||||
} elseif($eof) {
|
|
||||||
if($line == "EOF;") {
|
|
||||||
$jobargs[$jobkey] = $jobvalue;
|
|
||||||
$eof = false;
|
|
||||||
} else {
|
|
||||||
$jobvalue .= $line;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $jobargs;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user