Skip to content

Instantly share code, notes, and snippets.

@phenix-factory
phenix-factory / champs_extra_saisie.html
Created January 29, 2014 17:14
SPIP: Générer les saisies correspondantes à des champs extras sur un objet Spip
[(#REM) Récupérer le tableau des champs ]
[(#SET{les_champs,#CONFIG{champs_extras_spip_mailsubscribers}|unserialize})]
[(#REM) Générer les Saisies ]
[(#GENERER_SAISIES{#GET{les_champs}})]
@phenix-factory
phenix-factory / flex-video.css
Created February 20, 2014 09:16
CSS: Flex video de foundation
.flex-video {
position: relative;
padding-top: 1.5625rem;
padding-bottom: 67.5%;
height: 0;
margin-bottom: 1rem;
overflow: hidden; }
.flex-video.widescreen {
padding-bottom: 56.55%; }
.flex-video.vimeo {
@phenix-factory
phenix-factory / like_box_responsive.css
Created March 21, 2014 14:17
CSS: Facebook like box responsive.
/*
Make the Facebook Like box responsive (fluid width)
https://developers.facebook.com/docs/reference/plugins/like-box/
*/
/*
This element holds injected scripts inside iframes that in
some cases may stretch layouts. So, we're just hiding it.
*/
#fb-root {
@phenix-factory
phenix-factory / lister_fonction.php
Created June 23, 2014 10:19
PHP: lister le fonction disponnible
<?php
var_dump(get_defined_functions());
?>
@phenix-factory
phenix-factory / agenda.html
Last active August 29, 2015 14:04
Modèles Agenda
<B_agenda>
#ANCRE_PAGINATION
<BOUCLE_agenda(EVENEMENTS){age<=0}{par date}{pagination}>
<div class="bloc_agenda">
<h3><a href="#URL_ARTICLE" [title="(#TITRE|attribut_html)"]>#TITRE</a></h3>
[<p class="meta">(#DATE_DEBUT|affdate_debut_fin{#DATE_FIN, [(#HORAIRE*)]})</p>]
#DESCRIPTIF
</div>
@phenix-factory
phenix-factory / noDatePicker.js
Last active August 29, 2015 14:05
Desactiver les champs dates sur les navigateurs qui ont un datepicker natif
$(function () {
if (Modernizr.inputtypes.date) {
$(".formulaire_spip input[type='date']").prop("type", "text");
}
});
@phenix-factory
phenix-factory / normaliser_date_sql.php
Last active August 29, 2015 14:06
Fonction qui va normaliser n'importe quel format de date au format sql DATETIME
<?php
/**
* Fonction qui va normaliser n'importe quel format de date au format sql DATETIME
*
* @param mixed $date
* @access public
* @return mixed
*/
function filtre_normaliser_date_sql_dist($date) {
@phenix-factory
phenix-factory / ajouter_logo.php
Last active August 29, 2015 14:07
Ajouter un logo à un objet SPIP
<?php
/**
* Ajouter un logo à un objet SPIP
* On peu passer directement un file Path ou un $_FILE[input_name] à $fichier
*
* @param mixed $objet
* @param mixed $id_objet
* @param mixed $fichier
* @access public
@phenix-factory
phenix-factory / spip_log_erreur_json.php
Created October 16, 2014 10:03
SPIP: Log pour les erreurs d'encodage/décodage JSON
<?php
/**
* Fonction qui écrit dans les log de SPIP les erreurs d'encodage/décodage JSON
*
* @param string $filename Nom du fichier de log SPIP à utiliser
* @access public
*/
function spip_log_erreur_json($filename='json_erreur') {
// Gestion des erreur JSON
@phenix-factory
phenix-factory / saisie_implode_array.php
Created December 2, 2014 15:30
Implode les saisies de type data pour les inserer dans la base de donnée
<?php
function saisie_implode_array($saisies, $blacklist = array()) {
foreach($saisies as $index => $saisie){
// Si on trouve une clée datas il faut implode
if (
array_key_exists ('datas', $saisie['options']) // est-ce qu'il y a des data ?
and is_array(_request($saisie['options']['nom'])) // Il faut que ce soit un tableau
and !in_array($index, $blacklist) // Si c'est dans la blacklist on touche pas
) {
set_request($saisie['options']['nom'], implode(',', _request($saisie['options']['nom'])));