Update YAML component, load via composer

This commit is contained in:
Loz Calver 2015-08-07 20:07:36 +01:00
parent 1167802b79
commit c303c6354b
4 changed files with 19 additions and 23 deletions

View File

@ -3,16 +3,16 @@ name: Oembed
Oembed: Oembed:
providers: providers:
'http://*.youtube.com/watch*': 'http://*.youtube.com/watch*':
http: 'http://www.youtube.com/oembed/', http: 'http://www.youtube.com/oembed/'
https: 'https://www.youtube.com/oembed/?scheme=https' https: 'https://www.youtube.com/oembed/?scheme=https'
'https://*.youtube.com/watch*': 'https://*.youtube.com/watch*':
http: 'http://www.youtube.com/oembed/', http: 'http://www.youtube.com/oembed/'
https: 'https://www.youtube.com/oembed/?scheme=https' https: 'https://www.youtube.com/oembed/?scheme=https'
'http://*.youtu.be/*': 'http://*.youtu.be/*':
http: 'http://www.youtube.com/oembed/', http: 'http://www.youtube.com/oembed/'
https: 'https://www.youtube.com/oembed/?scheme=https' https: 'https://www.youtube.com/oembed/?scheme=https'
'https://youtu.be/*': 'https://youtu.be/*':
http: 'http://www.youtube.com/oembed/', http: 'http://www.youtube.com/oembed/'
https: 'https://www.youtube.com/oembed/?scheme=https' https: 'https://www.youtube.com/oembed/?scheme=https'
'http://*.flickr.com/*': 'http://*.flickr.com/*':
'http://www.flickr.com/services/oembed/' 'http://www.flickr.com/services/oembed/'
@ -23,16 +23,16 @@ Oembed:
'http://*.hulu.com/watch/*': 'http://*.hulu.com/watch/*':
'http://www.hulu.com/api/oembed.json' 'http://www.hulu.com/api/oembed.json'
'http://*.vimeo.com/*': 'http://*.vimeo.com/*':
http: 'http://www.vimeo.com/api/oembed.json', http: 'http://www.vimeo.com/api/oembed.json'
https: 'https://www.vimeo.com/api/oembed.json' https: 'https://www.vimeo.com/api/oembed.json'
'https://*.vimeo.com/*': 'https://*.vimeo.com/*':
http: 'http://www.vimeo.com/api/oembed.json', http: 'http://www.vimeo.com/api/oembed.json'
https: 'https://www.vimeo.com/api/oembed.json' https: 'https://www.vimeo.com/api/oembed.json'
'http://twitter.com/*': 'http://twitter.com/*':
http: 'https://api.twitter.com/1/statuses/oembed.json', http: 'https://api.twitter.com/1/statuses/oembed.json'
https: 'https://api.twitter.com/1/statuses/oembed.json' https: 'https://api.twitter.com/1/statuses/oembed.json'
'https://twitter.com/*': 'https://twitter.com/*':
http: 'https://api.twitter.com/1/statuses/oembed.json', http: 'https://api.twitter.com/1/statuses/oembed.json'
https: 'https://api.twitter.com/1/statuses/oembed.json' https: 'https://api.twitter.com/1/statuses/oembed.json'
autodiscover: autodiscover:
true true

View File

@ -19,7 +19,8 @@
"php": ">=5.4.0", "php": ">=5.4.0",
"composer/installers": "~1.0", "composer/installers": "~1.0",
"monolog/monolog": "~1.11", "monolog/monolog": "~1.11",
"league/flysystem": "~1.0.12" "league/flysystem": "~1.0.12",
"symfony/yaml": "~2.7"
}, },
"require-dev": { "require-dev": {
"phpunit/PHPUnit": "~3.7" "phpunit/PHPUnit": "~3.7"

View File

@ -1,5 +1,6 @@
<?php <?php
use Symfony\Component\Yaml\Parser;
/** /**
* A utility class which builds a manifest of configuration items * A utility class which builds a manifest of configuration items
@ -249,11 +250,8 @@ class SS_ConfigManifest {
// Keep track of all the modules we've seen // Keep track of all the modules we've seen
$this->addModule(dirname(dirname($pathname))); $this->addModule(dirname(dirname($pathname)));
// Use the Zend copy of this script to prevent class conflicts when RailsYaml is included $parser = new Parser();
require_once 'thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib/'
. 'sfYamlParser.php';
$parser = new sfYamlParser();
// The base header // The base header
$base = array( $base = array(

View File

@ -1,4 +1,7 @@
<?php <?php
use Symfony\Component\Yaml\Dumper;
/** /**
* SilverStripe-variant of the "gettext" tool: * SilverStripe-variant of the "gettext" tool:
* Parses the string content of all PHP-files and SilverStripe templates * Parses the string content of all PHP-files and SilverStripe templates
@ -773,10 +776,6 @@ class i18nTextCollector_Writer_RailsYaml implements i18nTextCollector_Writer {
} }
public function getYaml($entities, $locale) { public function getYaml($entities, $locale) {
// Use the Zend copy of this script to prevent class conflicts when RailsYaml is included
require_once 'thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib'
. '/sfYamlDumper.php';
// Unflatten array // Unflatten array
$entitiesNested = array(); $entitiesNested = array();
foreach($entities as $entity => $spec) { foreach($entities as $entity => $spec) {
@ -793,12 +792,10 @@ class i18nTextCollector_Writer_RailsYaml implements i18nTextCollector_Writer {
} }
// Write YAML // Write YAML
$oldVersion = sfYaml::getSpecVersion(); $dumper = new Dumper();
sfYaml::setSpecVersion('1.1'); $dumper->setIndentation(2);
$yamlHandler = new sfYaml();
// TODO Dumper can't handle YAML comments, so the context information is currently discarded // TODO Dumper can't handle YAML comments, so the context information is currently discarded
$result = $yamlHandler->dump(array($locale => $entitiesNested), 99); $result = $dumper->dump(array($locale => $entitiesNested), 99);
sfYaml::setSpecVersion($oldVersion);
return $result; return $result;
} }
} }