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:
providers:
'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://*.youtube.com/watch*':
http: 'http://www.youtube.com/oembed/',
http: 'http://www.youtube.com/oembed/'
https: 'https://www.youtube.com/oembed/?scheme=https'
'http://*.youtu.be/*':
http: 'http://www.youtube.com/oembed/',
http: 'http://www.youtube.com/oembed/'
https: 'https://www.youtube.com/oembed/?scheme=https'
'https://youtu.be/*':
http: 'http://www.youtube.com/oembed/',
http: 'http://www.youtube.com/oembed/'
https: 'https://www.youtube.com/oembed/?scheme=https'
'http://*.flickr.com/*':
'http://www.flickr.com/services/oembed/'
@ -23,16 +23,16 @@ Oembed:
'http://*.hulu.com/watch/*':
'http://www.hulu.com/api/oembed.json'
'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://*.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'
'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://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'
autodiscover:
true

View File

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

View File

@ -1,5 +1,6 @@
<?php
use Symfony\Component\Yaml\Parser;
/**
* A utility class which builds a manifest of configuration items
@ -250,10 +251,7 @@ class SS_ConfigManifest {
// Keep track of all the modules we've seen
$this->addModule(dirname(dirname($pathname)));
// 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/'
. 'sfYamlParser.php';
$parser = new sfYamlParser();
$parser = new Parser();
// The base header
$base = array(

View File

@ -1,4 +1,7 @@
<?php
use Symfony\Component\Yaml\Dumper;
/**
* SilverStripe-variant of the "gettext" tool:
* 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) {
// 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
$entitiesNested = array();
foreach($entities as $entity => $spec) {
@ -793,12 +792,10 @@ class i18nTextCollector_Writer_RailsYaml implements i18nTextCollector_Writer {
}
// Write YAML
$oldVersion = sfYaml::getSpecVersion();
sfYaml::setSpecVersion('1.1');
$yamlHandler = new sfYaml();
$dumper = new Dumper();
$dumper->setIndentation(2);
// TODO Dumper can't handle YAML comments, so the context information is currently discarded
$result = $yamlHandler->dump(array($locale => $entitiesNested), 99);
sfYaml::setSpecVersion($oldVersion);
$result = $dumper->dump(array($locale => $entitiesNested), 99);
return $result;
}
}