#extends html # plugin DD snippet dd debug($${1});${0} endsnippet snippet creerobjet "SPIP creation objet" $tables['spip_$1s'] = [ 'type' => '${1:objet}', 'principale' => 'oui', 'table_objet_surnoms' => [], 'field'=> [ 'id_$1' => 'bigint(21) NOT NULL', $0 'statut' => 'varchar(20) DEFAULT "" NOT NULL', 'maj' => 'TIMESTAMP' ], 'key' => [ 'PRIMARY KEY' => 'id_$1', 'KEY statut' => 'statut', ], 'champs_editables' => [], 'champs_versionnes' => [], 'rechercher_champs' => [], 'join' => [], 'tables_jointures' => [], ]; endsnippet snippet action "SPIP action declenchee dans un lien" ${3:''}, ); ${0} return $valeurs; } function formulaires_`!v vim_snippets#Filename()`_verifier_dist($$1 $redirect = '') { $$2 = _request('$2'); $erreurs = array(); //champs obligatoire foreach (array ('$2') as $obligatoire) { if (!_request($obligatoire)) $erreurs[$obligatoire] = 'Ce champs est obligatoire'; } //autres erreurs $erreurs['$2'] = 'Ce champ ne convient pas.'; //Il y a des erreurs if (count($erreurs)) { $erreurs['message_erreur'] = 'Votre saisie contient des erreurs !'; } return $erreurs; } function formulaires_`!v vim_snippets#Filename()`_traiter_dist($$1 $redirect = '') { $$2 = _request('$2'); $retour = array(); $retour['message_ok'] = 'bravo'; if ($redirect) { $retour['redirect'] = $redirect; } $retour['editable'] = true; return $retour; } endsnippet snippet bigint "SQL bigint(21)" w 'bigint(${1:21}) NOT NULL',${0} endsnippet snippet float "SQL float" w 'float NOT NULL',${0} endsnippet snippet tinyint "SQL tinyint(4)" w 'tinyint(4) NOT NULL',${0} endsnippet snippet decimal "SQL decimal(10,2)" w 'decimal(10,2) DEFAULT "0" NOT NULL',${0} endsnippet snippet text "SQL text NOT NULL" w "text NOT NULL",${0} endsnippet snippet varchar "SQL varchar(25)" w "varchar(${1:255}) NOT NULL",${0} endsnippet snippet datetime "SQL datetime" w 'datetime NOT NULL DEFAULT "0000-00-00 00:00:00"',${0} endsnippet snippet php $${2:valeur_champs1}, '${3:champs2}' => $${4:valeur_champs2}, ); $id_objet = objet_inserer($objet, $id_parent); //ou $id_objet=$ma_variable; objet_modifier($objet, $id_objet, $set); endsnippet snippet api_lien "SPIP API Lien" // utilisation API editier_liens // http://www.spip.net/fr_article5477.html include_spip('action/editer_liens'); $objets_source = array("${1:auteur}"=>${2:id_auteur ou array}); $objets_lies = array("${3:article}"=>${:id_article ou array}); ${0} objet_associer($objets_source, $objets_lies); endsnippet snippet cache "SPIP invalide cache" include_spip('inc/invalideur'); suivre_invalideur("id='${1:id_objet}/1'"); ${0} endsnippet snippet req "SPIP _request()" w _request('${1}')${0} endsnippet snippet array "SPIP Array( X lignes)" w array( '${1}' => ${2},${0} ); endsnippet snippet array_ligne "SPIP Une ligne d'array" '${1:var}' => $$1,${0} endsnippet snippet vd "var_dump()" var_dump($${1:var}); ${0} endsnippet snippet ec "Echo" echo ${1}; ${0} endsnippet snippet ecbr "Echo
" echo "
"; ${0} endsnippet snippet pre "
 print_r"
echo "
";
	print_r($${1});
echo "
"; ${0} endsnippet snippet include "SPIP include_spip" include_spip('${1:fichier}'); ${0} endsnippet snippet pipeline "SPIP Les pipelines de base" /** * Charger des styles CSS * * @pipeline insert_head_css * @param string $flux Code html des styles CSS à charger * @return string Code html complété **/ function ${1:prefix}_insert_head_css($flux) { $flux .= '' . "\n"; $flux .= '' . "\n"; return $flux; } ${0} /** * Charger des scripts jquery * * @pipeline jqueryui_plugins * @param array $scripts Liste à charger * @return array Liste complétée **/ function $1_jquery_plugins($scripts) { $scripts[] = "aa"; $scripts[] = produire_fond_statique('javascript/bigup.js'); return $scripts; } /** * Charger des scripts jquery ui * * @pipeline jqueryui_plugins * @param array $scripts Liste à charger * @return array Liste complétée **/ function $1_jqueryui_plugins($scripts) { $scripts[] = "aa"; return $scripts; } endsnippet snippet debugspip "SPIP define de debug" function debug_spip() { define('_DEBUG_SLOW_QUERIES', true); define('_BOUCLE_PROFILER', 5000); define('_LOG_FILTRE_GRAVITE', 8); define('_LOG_FILELINE',true); define('_DEBUG_AUTORISER', true); define('_MAX_LOG', 500000); error_reporting(E_ALL^E_NOTICE); ini_set ("display_errors", "On"); ini_set("html_errors", "On"); ini_set("allow_url_fopen", "On"); define('SPIP_ERREUR_REPORT',E_ALL^E_NOTICE); define('SPIP_ERREUR_REPORT_INCLUDE_PLUGINS',E_ALL^E_NOTICE); define('_INTERDIRE_COMPACTE_HEAD_ECRIRE', true); define('_DEV_VERSION_SPIP_COMPAT',"3.2.99"); define('_TEST_EMAIL_DEST', 'tofulm@gmail.com'); //defined('_VERIF_MOBILE_DEBUG') || define('_VERIF_MOBILE_DEBUG', true); } if (!empty($_SERVER['SERVER_ADDR']) and $_SERVER['SERVER_ADDR'] === "127.0.0.1") { debug_spip(); } if (!empty($_SERVER['SERVER_ADDR']) and substr($_SERVER['SERVER_ADDR'],0,7) === "192.168") { debug_spip(); } endsnippet snippet /* /** * ${0} **/ endsnippet snippet doc /** * ${1:function non documente} * * @param ${2} * @return ${0} * @author tofulm **/ endsnippet # Function doc snippet fdoc /** * ${4:fonction non documente} * * @param ${5} * @return ${3} * @author tofulm **/ function ${1}(${2}) { ${6} } endsnippet snippet spip_log "SPIP fctn spip_log()" spip_log(${1},${2:"gamuza"}); ${0} endsnippet snippet if "if (condition) { ... }" if (${1}) { ${0:${VISUAL}} } endsnippet