Update SPYC Library.

This commit is contained in:
Andrés Montañez 2014-03-16 12:29:09 -03:00
parent 5cc9c02c3e
commit fc3b7d87a5
2 changed files with 33 additions and 34 deletions

View file

@ -1,7 +1,7 @@
<?php
/**
* Spyc -- A Simple PHP YAML Class
* @version 0.5
* @version 0.5.1
* @author Vlad Andersen <vlad.andersen@gmail.com>
* @author Chris Wanstrath <chris@ozmm.org>
* @link http://code.google.com/p/spyc/
@ -433,18 +433,16 @@ class Spyc {
$i--;
}
// Strip out comments
if (strpos ($line, '#')) {
$line = preg_replace('/\s*#([^"\']+)$/','',$line);
}
while (++$i < $cnt && self::greedilyNeedNextLine($line)) {
$line = rtrim ($line, " \n\t\r") . ' ' . ltrim ($Source[$i], " \t");
}
$i--;
if (strpos ($line, '#')) {
if (strpos ($line, '"') === false && strpos ($line, "'") === false)
$line = preg_replace('/\s+#(.+)$/','',$line);
}
$lineArray = $this->_parseLine($line);
if ($literalBlockStyle)
@ -654,6 +652,7 @@ class Spyc {
} while (strpos ($inline, '[') !== false || strpos ($inline, '{') !== false);
$explode = explode(',',$inline);
$explode = array_map('trim', $explode);
$stringi = 0; $i = 0;
while (1) {
@ -1032,14 +1031,14 @@ class Spyc {
}
// Enable use of Spyc from command line
// The syntax is the following: php spyc.php spyc.yaml
// The syntax is the following: php Spyc.php spyc.yaml
define ('SPYC_FROM_COMMAND_LINE', false);
do {
if (!SPYC_FROM_COMMAND_LINE) break;
if (empty ($_SERVER['argc']) || $_SERVER['argc'] < 2) break;
if (empty ($_SERVER['PHP_SELF']) || $_SERVER['PHP_SELF'] != 'spyc.php') break;
if (empty ($_SERVER['PHP_SELF']) || $_SERVER['PHP_SELF'] != 'Spyc.php') break;
$file = $argv[1];
printf ("Spyc loading file: %s\n", $file);
print_r (spyc_load_file ($file));

View file

@ -17,7 +17,7 @@ define('MAGALLANES_VERSION', '1.0.0');
define('MAGALLANES_DIRECTORY', $baseDir);
// Preload
require_once $baseDir . '/Mage/spyc.php';
require_once $baseDir . '/Mage/Spyc.php';
require_once $baseDir . '/Mage/Autoload.php';
spl_autoload_register(array('Mage\\Autoload', 'autoload'));