Valider 2d136b5a rédigé par eric@smellup.net's avatar eric@smellup.net
Parcourir les fichiers

Renommage des fonctions de service encapsulant les librairies et des fichiers les contenant.

Mise à jour du paquet.xml (version, crédits, documentation)
Nettoyage de code inutile.
Ajout de log pour les erreurs.
parent 78c0ff81
Chargement en cours
Chargement en cours
Chargement en cours
Chargement en cours
+1 −1
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
* text=auto !eol
demo/yaml_boucle_data.html -text
inc/sfyaml.php -text
inc/yaml.php -text
inc/yaml_sfyaml.php -text
inc/yaml_to_array.php -text
lang/paquet-yaml.xml -text
lang/paquet-yaml_de.php -text
+2 −8
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -17,7 +17,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
 * @return string
 *        Chaîne YAML construite.
 */
function yaml_libyaml_encode($structure, $options = array()) {
function libyaml_yaml_encode($structure, $options = array()) {

	// Traitement des options
	if (!empty($options['indent']) and is_int($options['indent'])) {
@@ -42,13 +42,7 @@ function yaml_libyaml_encode($structure, $options = array()) {
 * @return bool|mixed
 *        Structure PHP produite par le parsing de la chaîne YAML.
 */
function yaml_libyaml_decode($input, $options = array()) {
function libyaml_yaml_decode($input, $options = array()) {

	return yaml_parse($input,-1);
}


function libyaml_tag_inclure($filename) {

	// De façon récursive on remplace le nom du fichier YAML à inclure par
}
+7 −3
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -18,7 +18,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
 * @return string
 *        Chaîne YAML construite.
 */
function yaml_sfyaml_encode($structure, $options = array()) {
function sfyaml_yaml_encode($structure, $options = array()) {

	require_once _DIR_PLUGIN_YAML . 'sfyaml/sfYaml.php';
	require_once _DIR_PLUGIN_YAML . 'sfyaml/sfYamlDumper.php';
@@ -54,7 +54,7 @@ function yaml_sfyaml_encode($structure, $options = array()) {
 * @return bool|mixed
 *        Structure PHP produite par le parsing de la chaîne YAML.
 */
function yaml_sfyaml_decode($input, $options = array()) {
function sfyaml_yaml_decode($input, $options = array()) {

	require_once _DIR_PLUGIN_YAML . 'sfyaml/sfYaml.php';
	require_once _DIR_PLUGIN_YAML . 'sfyaml/sfYamlParser.php';
@@ -66,10 +66,14 @@ function yaml_sfyaml_decode($input, $options = array()) {
	try {
		$parsed = $yaml->parse($input);
	} catch (Exception $exception) {
		// On garde la compatibilité ascendante avec l'ancien argument $show_error qui a été remplacé par $options.
		// On garde la compatibilité ascendante avec l'ancien argument $show_error qui a été remplacé par $options
		// mais on inverse la valeur par défaut.
		if ((is_bool($options) and $options) or (!empty($options['show_error']))) {
			throw new InvalidArgumentException(sprintf('Unable to parse string: %s', $exception->getMessage()));
		}

		// Pour compenser l'absence par défaut d'erreurs, on loge l'erreur dans les logs SPIP.
		spip_log("Erreur d'analyse YAML : " . $exception->getMessage(), 'yaml' . _LOG_ERREUR);
	}

	return $parsed;
+2 −2
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -20,7 +20,7 @@ require_once _DIR_PLUGIN_YAML . 'vendor/autoload.php';
 * @return string
 *        Chaîne YAML construite.
 */
function yaml_spyc_encode($structure, $options = array()) {
function spyc_yaml_encode($structure, $options = array()) {

	// Traitement des options
	if (empty($options['indent']) or (isset($options['indent']) and !is_int($options['indent']))) {
@@ -47,7 +47,7 @@ function yaml_spyc_encode($structure, $options = array()) {
 * @return bool|mixed
 *        Structure PHP produite par le parsing de la chaîne YAML.
 */
function yaml_spyc_decode($input, $options = array()) {
function spyc_yaml_decode($input, $options = array()) {

	return Spyc::YAMLLoadString($input);
}
+6 −6
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -22,7 +22,7 @@ use Symfony\Component\Yaml\Exception\ParseException;
 * @return string
 *        Chaîne YAML construite.
 */
function yaml_symfony_encode($structure, $options = array()) {
function symfony_yaml_encode($structure, $options = array()) {

	// Traitement des options du dump
	if (empty($options['inline']) or (isset($options['inline']) and !is_int($options['inline']))) {
@@ -55,17 +55,14 @@ function yaml_symfony_encode($structure, $options = array()) {
 * @return bool|mixed
 *        Structure PHP produite par le parsing de la chaîne YAML.
 */
function yaml_symfony_decode($input = true, $options = array()) {
function symfony_yaml_decode($input = true, $options = array()) {

	$parsed = false;

	// Traitement des options du parsing.
	$flags = 0;
//	if (!empty($options['include'])) {
//		$flags = Yaml::PARSE_CUSTOM_TAGS;
//	}
	if (isset($options['flags']) and is_int($options['flags'])) {
		$flags = $flags | $options['flags'];
		$flags = $options['flags'];
	}

	try {
@@ -74,6 +71,9 @@ function yaml_symfony_decode($input = true, $options = array()) {
		if ((is_bool($options) and $options) or (!empty($options['show_error']))) {
			printf('Unable to parse the YAML string: %s', $exception->getMessage());
		}

		// Pour compenser l'absence par défaut d'erreurs, on loge l'erreur dans les logs SPIP.
		spip_log("Erreur d'analyse YAML : " . $exception->getMessage(), 'yaml' . _LOG_ERREUR);
	}

	return $parsed;
Chargement en cours