SPIP
Article proposé
L’article « SPIP 4.0
(SPIP) » est proposé
à la publication depuis le mercredi 23 février 2022.
SPIP 4.0
mercredi 23 février 2022 , par jack
Sommaire
- Interface
- PHP compatibility
- Database
- Extended template syntax
- Changes and inputs for templates
- Other inputs
- Corrections
- Cleaning
- Depreciations
- Plugins
Interface |Retour au sommaire
Rebranded private area
A great deal of ergonomic work has been initiated to make the private area
adaptable to all screen sizes in order to facilitate its use.
The private area adapts better to the width of the screen, and starts to
use different CSS variables to facilitate its maintenance.
L’espace privé de SPIP 4.0 dans le site SPIP Contrib.
(https://www.spip.net/IMG/png/article_vue.png) **Vue d’un article (avec la couleur grise) ** (https://www.spip.net/IMG/png/article_edit.png) **Édition d’un article (avec la couleur grise) **An elegant login screen
The default login page (login.html) is all re-styled, with a pink SPIP
background.
L’écran de connexion sur le site SPIP.net.
And if the pink surprises you, don’t panic ! There is a new form in the
site identity configuration. It allows you to choose the colour you want.
And even better : it even allows you to add a beautiful background image.
Iconography in SVG
A large part of the icons and illustrations in the private area of SPIP and
its plugins have been converted to SVG.
- Tickets #4468 (#4468 - Unification des CSS pour les boutons et les icônes - spip - SPIP on GIT) and #4562
(#4562 - Suite #4468 : Unification des CSS pour les boutons et les icônes - spip - SPIP on GIT) : Harmonisation in the private area of
the HTML & CSS of buttons - New icon set based on Numix theme (in SVG) for document types in the
media library
Documents & Logos
A lot of work has been done on documents and logos :
- The logos of articles and other editorial objects are stored like
documents (in spip_documents in the database, and in IMG/logo/ on the disk,
keeping the file name). A migration phase moves the logos to their new
location on the disk. - Logos, image documents and image filters accept and support the SVG
format - The
img tag
(SPIP) filter allows
you to manage SVG files and declare their size - The new
balise_svg
filter allows you to embed the source code of an
SVG image file into the html code directly. Can be handy for example for
small icons. - Documents / logos can be uploaded by drag’n’drop, whatever their
size (integration of the BigUp plugin in plugins-dist, improved for the
occasion). The maximum size allowed is configurable. - Document templates (
<docXX>, <imgXX>, ...
) are revised and simplified
and use the<figure>
tag. Commit fa13018a
(https://git.spip.net/SPIP/medias/commit/fa13018a9ef63c633e78da253106867d6bac8a78).Warning
: Templatesdoc.html
,img.html
andemb.html
files are no longer
used (and so any old overloading of these files into plugins or templates
will no longer be used). Instead, we use the templatesimage.html
,
audio.html
,video.html
andfile.html
, corresponding to the document
type. The document mode is no longer taken into account for the calculation
of the template. - Possibility of declining the HTML files of the document templates by
type of file (detailed mime type) :file_text_csv.html
or main :
file_text.html
; or per extension :video_mp4.html
. As a result your
custom variants doc_[variant].html corresponding to the shortcut
<docN|variant>
will no longer work and should be declined :
image_[variante].html
,video_[variante].html
, etc. - Writing SPIP shortcuts for document templates
<docXX>
,<imgXX>
ou
<embXX>
becomes equivalent. The recommended writing is<docXX>
(where
XX is the document number). - The notion of Portfolio and document/image mode on documents
disappears. Commit 9cf774b9
(Disparition de la notion de portfolio et de toute reference au mode image/document des images · 9cf774b9eb - medias - SPIP on GIT).
The constant_COMPORTEMENT_HISTORIQUE_PORTFOLIO
declared totrue
allows
the old functioning to be restored.
PHP compatibility |Retour au sommaire
Limitation of the compatibility of SPIP 4.0 with PHP from 7.3 to 8.0.
Numerous notices and deprecations have also been corrected. Note that SPIP
3.2 will be the last version of SPIP to be compatible with PHP 5.
Database|Retour au sommaire
SPIP 4.0 works with Mysql or Sqlite. It can update a database from a SPIP
= 2.0.0.
For an update of an earlier SPIP, a migration step to SPIP 3.2 will be
necessary.
Extended template syntax[|Retour au
sommaire](#s-Extended-template-syntax)
Added support for anonymous loops : <BOUCLE(ARTICLES)>
Tired of being recorded ? An anonymous loop does not need to specify its
name !
It will automatically be assigned an identifier internally.
[
(
#REM
)
A loop named
]
<B_my_name>
<ul>
<BOUCLE_my_name
(ARTICLES)
{id_article}
{0,5}
>
<li>
#TITRE
</li>
</BOUCLE_my_name>
</ul>
</B_my_name>
[
(
#REM
)
An anonymous loop
]
<B>
<ul>
<BOUCLE(ARTICLES)
{id_article}
{0,5}
>
<li>
#TITRE
</li>
</BOUCLE>
</ul>
</B>
And if you are ambitious, you can put as many as you want in a template,
and even nest them ! But think about your successors, so that the code
doesn’t become too anonymous to find its way around
<B>
<ul class="rubriques">
<BOUCLE(RUBRIQUES)
{racine}
{par num titre, titre}
>
<li>
<h3>
#TITRE
</h3>
<B>
<ul class="articles">
<BOUCLE(ARTICLES)
{id_rubrique}
{!par date}
{0,5}
>
<li><a href="
#URL_ARTICLE
">
#TITRE
</a></li>
</BOUCLE>
</ul>
</B>
</li>
</BOUCLE>
</ul>
</B>
Adding non-conditional parts of loops, before <BB_boucle>
and after
</BB_boucle>
A syntax for non-conditional parts of loops is added : this content will
always be displayed, whether there is a result or not, while allowing the
use of loop-specific tags
(#TOTAL_BOUCLE
, #TRI
, etc).
This syntax is particularly useful for arrays of elements with sorting and
filtering. If the loop does not return any elements, we still want to
display the filters (to uncheck/change them).
[
(
#REM
)
A non-conditional part before/after the loop
]
<BB_non-conditional>
[
(
#REM
)
this part is displayed even if the loop does not return any articles
]
<h3>The articles</h3>
Nombre :
#TOTAL_BOUCLE
<br>
<BOUCLE_non-conditional(ARTICLES)
{id_article?}
{id_rubrique?}
{!par date}
{0,5}
{', '}
>
<a href="
#URL_ARTICLE
">
#TITRE
</a>
</BOUCLE_non-conditional>
[
(
#REM
)
this part is displayed even if the loop does not return any articles
]
<nav class="pagination" role="navigation">
#PAGINATION
</nav>
</BB_non-conditional>
This completes the conditional parts of the loops before <B_boucle>
and
after </B_boucle>
which are only displayed if the loop has at least one
result.
[
(
#REM
)
A conditional part before/after the loop
]
<B_conditional>
[
(
#REM
)
this part is only displayed if the loop returns articles
]
<h3>The articles</h3>
Nombre :
#TOTAL_BOUCLE
<br>
<BOUCLE_conditional
(ARTICLES)
{id_article}
{id_article?}
{id_rubrique?}
{!par date}
{0,5}
{', '}
>
<a href="
#URL_ARTICLE
">
#TITRE
</a>
</BOUCLE_conditional>
[
(
#REM
)
this part is only displayed if the loop returns articles
]
<nav class="pagination" role="navigation">
#PAGINATION
</nav>
</B_conditional>
<h3>No article</h3>
<//B_conditional>
The unconditional part of the loops can be coupled with the conditional
part : in this case it frames the conditional part.
[
(
#REM
)
Mix non conditional / conditional before / after
]
<BB_mix>
<div class="articles">
<h3>The articles</h3>
<B_mix>
<ul>
<BOUCLE_mix
(ARTICLES)
{id_article}
{id_article}
{!par date}
{0,5}
{', '}
>
<li>
#TITRE
</li>
</BOUCLE_mix>
</ul>
<nav class="pagination" role="navigation">
#PAGINATION
</nav>
</B_mix>
</div>
</BB_mix>
** Added support for loops in the conditional part of tags**
Yes, we can now put loops in tags !
Yes we can ! In the conditional part of tags.
Some examples :
[
(
#BALISE
)
<BOUCLE(ARTICLES)
{0,1}
>
#TITRE
</BOUCLE>
]
[
<BOUCLE(ARTICLES)
{0,1}
>
#TITRE
</BOUCLE>
(
#BALISE
)
]
[
(
#ENV
{documents}
|oui
)
<B_docs>
<ul>
<BOUCLE_docs
(DOCUMENTS)
{id_article}
{par num titre, titre}
{mode=document}
>
<li>
<a href="
#URL_DOCUMENT
">
[
(
#TITRE
|sinon
{Document n°
#ID_DOCUMENT
}
)
]
\
(
#EXTENSION
\
)
</a>
</li>
</BOUCLE_docs>
<ul>
</B_docs>
]
Changes and inputs for templates [|Retour au
sommaire](#s-Changes-and-inputs-for-templates)
** The tags #PAGINATION
require a change in syntax and arguments. **
The change is 1) to the wrapper tag, which should be nav
2) to the
arguments.
- The bounding tag must now be
<nav class="pagination">
.
Until SPIP 3.2, for example, we wrote :
- [
( #PAGINATION ) ]
With SPIP 4.0, you must now use :
- [ ( #PAGINATION ) ]
- There is now only one pagination template. As a result, differences in
pagination rendering are made by passing arguments to it.
-
afficher_lien_precedent=oui
to display the<
to previous results -
afficher_lien_suivant=oui
to display the>
which leads to the
following results -
afficher_lien_tous=oui
to display a link to view all results
simultaneously. In this case, the link text is «∞
» by default, but it
is possible to specify another label with thelabel_tous
. Example :
label_tous=tous
. -
nombre_liens_max
is used to define the maximum number of pagination
links displayed by the template. You can also use the constant
_PAGINATION_NOMBRE_LIENS_MAX
for the public area
_PAGINATION_NOMBRE_LIENS_MAX_ECRIRE
for the private area.
The first argument can indicate what type of pagination is needed. It can
also be indicated with an argument type_pagination
.
Example : `
#PAGINATION
{naturel}
is equivalent to
#PAGINATION
{type_pagination=naturel}
` .
-
type_pagination=page
to display the page numbers : 1, 2, 3, 4… -
type_pagination=rang
to display the ranks : 0, 10, 20, 30… -
type_pagination=naturel
to display the ranks with 1 instead of 0 : 1,
10, 20, 30… -
type_pagination=resultats
to display the ranks from 10 to 10 starting
at 1 : 1, 11, 21, 31… -
type_pagination=page_precedent_suivant
is the combination of a
pagination of typepage
with previous and next links.
The use of the tag in the private area is detected automatically, making it
unnecessary to pass the argument type_pagination=prive
. However, since
compatibility with the old syntax is assured on this point, the argument of
the old version can be kept on old templates as follows :
- [ ( #PAGINATION {prive} )
Critère {id_?}
Criterion {id_?}
allows you to make all possible connections with the
environment variables. It therefore behaves as many criteria as possible
{id_xxx ?}
for the given loop.
Voir id_ ? (SPIP)
Function lister_champs_id_conditionnel
and pipeline
exclure_id_conditionnel
Criterion {id_?}
is based directly on the function
lister_champs_id_conditionnel($table)
which returns a list of possible
conditional selection fields for this table.
The calculation is made from the fields beginning with ’id_’ in the
table, as well as a possible ’object’ field. It is then completed with
the primary keys of the editorial tables which can be easily linked.
Finally, the result goes through the pipeline exclure_id_conditionnel
which allows you to exclude certain fields from the list calculated by the
function lister_champs_id_conditionnel
. See example in plugin Brèves or
plugin SVP.
Criterion {par_ordre_liste champ,#LISTE{...}}
New criterion par_ordre_liste
(SPIP) to order a loop
in a specific sequence.
Criterion {fusion_supprimer}
This criterion is part of the Core. It was previously defined in the
SPIP-Bonux plugin. Important : You must update the SPIP-Bonux plugin,
if it is active, to version >= 3.7.1 before updating the site to SPIP
4.0 to avoid a conflict.
Filter and function identifiant_slug
Ticket #4628 (#4628 - Intégrer la fonction slugify - spip - SPIP on GIT) : adding the function
identifier_slug()
(SPIP). Transforms
plain text into a short name that can be used as an identifier, class, id,
url… by keeping only alphanumeric characters and a separator.
Filters label_nettoyer
and label_ponctuer
These filters are added to manage and make better use of SPIP’s
historical language strings (sometimes with ` :`, sometimes without).
-
label_nettoyer
remove the` :` at end of text -
label_ponctuer
add` :` at end of text
Evolution criteria {tri}
and {par num xxx}
- Criterion
{tri xxx}
accepts#TRI{par numéro, num xxx}
behaving as
{par num xxx}
(elements without numbers are ordered after elements with
numbers) - Criterion
{par num xxx}
integrate automatically criterion{par sinum xxx}
before it : thus in(ARTICLES){par num titre}
, items without
numbers (or with the number 0) go after items with a number
Other points about templates
- New arguments for
#FORMULAIRE_INSCRIPTION
and#FORMULAIRE_LOGIN
- New filters ajouter_class
(SPIP),
supprimer_class
(SPIP) and
commuter_class (SPIP) - Filter lien_ou_expose
(SPIP) amélioré - Filter
|singulier_ou_pluriel
can be extended for each language by
creating its ownsingulier_ou_pluriel_<lang>
filter, which will be called
if the language matches - New filter appliquer_si_filtre
(Fix #4656 et #3799 : |appliquer_filtre revient a son fonctionnement initial, c'est a dire qu'il ne renvoie rien si le filtre cherche n'existe pas · 668d321299 - spip - SPIP on GIT) as a complement to
appliquer_filtre
(SPIP) : the 1st
returns the initial content if the filter sought does not exist, the 2nd
returns nothing.
**Squelettes-dist (public area theme by default) **
- Le squelettes-dist now uses an HTML5 syntax
Other inputs|Retour au sommaire
- Integration of the Javascript library Sortable.js
(SortableJS) to support drag and drop in a more
fluid way, in particular to order documents, replacing the jQuery UI
module. - A new lightweight, accessible, responsive and prettier modal box based
on Lity (Lity - Lightweight, accessible and responsive lightbox) - An XSLT stylesheet provides styled RSS feeds
- The statistics graph redesigned (it uses d3.js)
- The companion can be ignored for each author who already knows SPIP
- The « limit to HTML4 » option for the public area is removed. The default
templates (the dist) are now HTML 5 (backwards compatibility plugin
(spip-contrib-extensions/historique_spip32_html4: Reprise de l'option de configuration présente jusqu'à SPIP 3.2 pour imposer le code en version HTML 4 - historique_spip32_html4 - SPIP on GIT)) - The summary attribute for tables is removed
- Default h2 level headings, not h3 level as before (backwards
compatibility plugin
(spip-contrib-extensions/historique_spip32_h3: Intertitres H3 : plugin de compatibilité pour conserver les intertitres en H3 - historique_spip32_h3 - SPIP on GIT)) - The
autoriser_exception()
function accepts an * argument as an id :
this allows it for any id. When we cancel an exception with *, it cancels
all exceptions for that object, even those that would have been thrown
individually with ids. - Filter
heure_minutes
accepts as an optional argumentabbr
when you
do not wish to indicate the unit of minutes. Thus `
[
(
#DATE
|heures_minutes
{abbr}
)
]
will display, for example :
17h26`
- The constant
_AUTO_SELECTION_RUBRIQUE
, which automatically assigns a
field when an article is created if its value istrue
now additionally
accepts an integer : in this case it corresponds to the field identifier to
be assigned by default. - If the 3rd parameter (class) of
#BUTTON_ACTION{link, url, class ,confirmation message}
contains « ajax », this class is added to the form
that contains the button.
Corrections |Retour au sommaire
- Update of all used JS libraries
- [login] Ticket #3957 (#3957 - Supprimer le cadena de login.js - spip - SPIP on GIT) : Do not
display the padlock on the login page, too ambiguous with the https padlock
of the browser. - [admin] The link « Show visitors » is not shown if there are no users
with this status on the site. - [svp][plugins] If there is an XML error on a package.xml, it is
directly explained on the plugin management page.
Cleaning |Retour au sommaire
Plugins
- Files
plugin.xml
from SPIP 2.x plugins are no longer interpreted.
Only thepaquet.xml
are now. A plugin that would therefore only
haveplugin.xml
(withoutpaquet.xml
beside) will therefore no longer
work from SPIP 4.0.
Miscellaneous
- Ticket #4060 (#4060 - Nettoyage du code PHP < 5.4 - spip - SPIP on GIT) : Code cleaning < PHP
5.4 - Cleaning code & CSS <= IE9
- Cleaning htaccess (no longer compat on URLs .php(3) for SPIP <= 1.8
Files
-
Deletion of
inc/mail
deprecaated since SPIP 2. Use for example :$envoyer_mail = charger_fonction ( 'envoyer_mail' , 'inc' ) ; $envoyer_mail ( ... ) ;
-
Deletion of
action/preferer.php
unused since SPIP 3.2 (deletion of
ecrire/oo/). -
Deletion of
exec/valider_xml.php
not functional, moved to the plugin
to be fixed Valider XML
(https://zone.spip.org/trac/spip-zone/changeset/108307) -
Deletion of
exec/fond_monobloc.php
. Create the templates for the
private area inprive/squelettes
.
**Tags / Filters / Criteria **
- Deletion of tags
#DEBUT_SURLIGNE
and#FIN_SURLIGNE
deprecated since
SPIP 2. use CSS classessurlignable
andpas_surlignable
. - Filters
aligner
,aligner_gauche
,aligner_droite
,centrer
,
justifier
andstyle_align
are deleted. Use CSS code to obtain the same
result. - Deletion of
#LOGIN_PRIVE
. Use#FORMULAIRE_LOGIN
- Deletion of
#LOGIN_PUBLIC
. Use#FORMULAIRE_LOGIN
- Deletion of
#DOSSIER_SQUELETTE
. Use#CHEMIN
- Deletion of
#NOOP
. Use#VAL
- Deletion of
{datasource ...}
. Use directly criterion{source ...}
PHP Functions
- Deletion of
echo_log()
(useless now). - Deletion of
spip_fetch_array()
. Usesql_fetch()
à la place. - Deletion of
generer_url_retour()
. Useparametre_url()
instead, with
the parameter ’redirect’. - Deletion of
charger_php_extension()
(Useextension_loaded()
) - Deletion of
revisions_articles()
. Usearticle_modifier()
- Deletion of
revision_article()
. Usearticle_modifier()
- Deletion of
articles_set()
. Usearticle_modifier()
- Deletion of
insert_article()
. Usearticle_inserer()
- Deletion of
instituer_article()
. Usearticle_instituer()
- Deletion of
insert_auteur()
. Useauteur_inserer()
- Deletion of
auteurs_set()
. Useauteur_modifier()
- Deletion of
instituer_auteur()
. Useauteur_instituer()
- Deletion of
revision_auteur()
. Useauteur_modifier()
- Deletion of
insert_rubrique()
. Userubrique_inserer()
- Deletion of
revisions_rubriques()
. Userubrique_modifier()
- Deletion of
instituer_rubrique()
. Userubrique_instituer()
- Deletion of
admin_repair_plat()
. The .plat files are no longer used.
This function is no longer called sincer14292
- Deletion of
version_svn_courante()
. Useversion_vcs_courante()
- Suppression de
lire_meta()
. Use$GLOBALS['meta'][$nom]
ou
lire_config('nom')
- Deletion of
auteur_referent()
. Useauteur_associer()
- Deletion of
table_jointure()
. Use the API editer_liens or the
linkage tables spip_xx_liens ou spip_yy_liens, depending on. - Deletion of
modifier_contenu()
. Use the generic functions for the
content modification API. - Deletion of
revision_objet()
. Useobjet_modifier()
. - Deletion of
notifier_publication_article()
. - Deletion of
notifier_proposition_article()
. - Suppression de
calcul_branche()
. Usecalcul_branche_in()
. - Deletion of
ecrire_metas()
. - Deletion of
spip_query_db()
. Usesql_query()
ou other. - Deletion of
spip_get_lock()
andspip_release_lock()
which were no
longer used. - Deletion of
recuperer_entetes()
. Userecuperer_entetes_complets()
. - Deletion of
maj_version()
andupgrade_vers()
which are no longer
useful. - Deletion of
upgrade_types_documents()
. Use directly
creer_base_types_doc()
from Medias plugin.
Depreciations|Retour au sommaire
- The
<BOUCLE(POUR)
and its criterion{tableau ...}
are deprecated in
favour of the<BOUCLE(DATA)
and its criterion{source table, ...}
. - Similarly, the
|foreach
filter is deprecated in favour of the
loop-based syntax(DATA)
.
Plugins |Retour au sommaire
– Plugins breves, jquery_ui, organiseur, petitions,
vertebres, squelettes_par_rubriques are no longer distributed
with SPIP by default.
– But breves, organiseur, petitions,
squelettes_par_rubriques are still maintained !
– jquery_ui is maintained by the community, but depreciated
– vertebres although functional in SPIP 4.0 is abandoned : the
Adminer plugin is a more complete alternative.
To facilitate the deletion of their tables in the database during the 3.2
→ 4.0 migration, the dedicated plugin Leon is made available to you :
Breves
PHP Functions
- Deletion of
insert_breve()
. Usebreve_inserer()
- Deletion of
revisions_breves()
. Usebreve_modifier()
Grenier plugin
The grenier plugin is cleaned up and only contains the functions removed
from SPIP 3.2 and SPIP 4.0.
Anything prior to SPIP 3.2 is no longer present in it.
It contains the various functions and files removed from SPIP 4.0 that
could potentially be used by templates or plugins.
Medias
PHP Functions
- Deletion of
document_set()
. Usedocument_modifier()
- Deletion of
insert_document()
. Usedocument_inserer()
- Deletion of
revision_document()
. Usedocument_modifier()
- Deletion of
afficher_documents_colonne()
. Use the expected inclusion
or a true editorial object declaration (the document column is then
automatically displayed on the object’s edit page) - Deletion of
lien_objet()
. Usegenerer_lien_entite()
- Deletion of
instituer_document()
. Usedocument_instituer()
Words
PHP Functions
- Deletion of
groupemots_inserer()
. Usegroupe_mots_inserer()
ou
objet_inserer()
- Deletion of
groupemots_modifier()
. Usegroupe_mots_modifier()
ou
objet_modifier()
- Deletion of
revision_groupe_mot()
. Usegroupe_mots_modifier()
- Deletion of
insert_mot()
. Usemot_inserer()
- Deletion of
mots_set()
. Usemot_modifier()
- Deletion of
revision_mot()
. Usemot_modifier()
Petitions
The use of petitions is now optional : they are disabled by default on new
installations [1] . You can activate them in the site content
configuration.
Sites
PHP Functions
- Deletion of
insert_syndic()
. Use site_inserer() - Deletion of
revisions_sites()
. Use site_modifier() - Deletion of
syndic_set()
. Use site_modifier() - Deletion of
instituer_syndic()
. Use objet_instituer()
[1] On existing installations, this is only the case if they were not used
before
— Envoyé par SPIP (https://www.spip.net/)