Skip to content

Instantly share code, notes, and snippets.

@tcharlss
tcharlss / spip_afficher_duree.php
Last active January 13, 2023 16:02
Afficher humainement une durée avec SPIP
<?php
/**
* Afficher humainement une durée exprimée initialement en nombre de secondes
*
* On peut arrondir à une unité : heures, jours, …
*
* Exemples :
* - 14400 : 4 heures
* - 86400 : 1 jour
@tcharlss
tcharlss / spip_initiale.php
Last active November 28, 2023 21:48
SPIP : critère {initiale}
<?php
/**
* Calcul du critère `initiale`
*
* NE FONCTIONNE QU'AVEC MYSQL
*
* Extrait l'initiale d'un champ ou d'une expression.
* Ajoute l'alias `initiale` dans la boucle, ce qui permet de faire un GROUP BY `{fusion initiale}` ou un ORDER BY `{par initiale}`
* Voir aussi le pipeline pre_boucle à ce sujet.
@tcharlss
tcharlss / coordonneesAdressesRevert2v2.php
Last active November 26, 2021 13:48
Commande spip-cli pour rétablir la table spip_adresses suite à un revert du plugin de la v3 vers la v2, cf. https://git.spip.net/spip-contrib-extensions/coordonnees/issues/13
<?php
namespace Spip\Cli\Command;
use Spip\Cli\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
class coordonneesAdressesRevert2v2 extends Command {
@tcharlss
tcharlss / phpcs.xml
Created June 16, 2016 17:05 — forked from kent1D/phpcs.xml
PHP_CodeSniffer pour SPIP
<?xml version="1.0"?>
<ruleset name="SPIP">
<!--
Liens utiles
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
https://github.com/ucfcdl/fuelphp-phpcs/tree/master/Standards/FuelPHP
https://github.com/vanilla/addons/tree/master/standards/Vanilla
-->
<description>Coding rules for SPIP</description>