[SPIP] Proposé : SPIP 4.0

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.

(https://www.spip.net/IMG/png/espace_prive_spip_40.png) **Aperçu de l’espace privé de SPIP 4.0 **

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.

(https://www.spip.net/IMG/png/login_spip_40.png) **Écran de connexion par défaut à SPIP 4.0 **

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.

(https://www.spip.net/IMG/png/login_spip_40_avec_image.png) **Écran de connexion avec une image, dans SPIP 4.0 **

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.

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
    :
    Templates doc.html, img.html and emb.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 templates image.html,
    audio.html, video.html and file.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 to true 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 :slight_smile:

<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.

  1. The bounding tag must now be <nav class="pagination">.

Until SPIP 3.2, for example, we wrote :

  1. [

    ( #PAGINATION ) ]

With SPIP 4.0, you must now use :

  1. [ ( #PAGINATION ) ]
  1. 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=ouito 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 the label_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 type page 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 :

  1. [ ( #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

**Squelettes-dist (public area theme by default) **

  • Le squelettes-dist now uses an HTML5 syntax

Other inputs|Retour au sommaire

[

(

#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 is true 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 the paquet.xmlare now. A plugin that would therefore only
    haveplugin.xml (without paquet.xml beside) will therefore no longer
    work from SPIP 4.0.

Miscellaneous

Files

  • Deletion of inc/mail deprecaated since SPIP 2. Use for example :

    $envoyer_mail
    
    
    =
    
     charger_fonction
    
    &#40;
    
    
    'envoyer_mail'
    
    
    ,
    
    
    'inc'
    
    
    &#41;
    
    
    ;
    
    
    $envoyer_mail
    
    
    &#40;
    
    
    ...
    
    
    &#41;
    
    
    ;
    
  • 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 in prive/squelettes.

**Tags / Filters / Criteria **

  • Deletion of tags #DEBUT_SURLIGNE and #FIN_SURLIGNE deprecated since
    SPIP 2. use CSS classes surlignable and pas_surlignable.
  • Filters aligner, aligner_gauche, aligner_droite, centrer,
    justifier and style_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(). Use sql_fetch() à la place.
  • Deletion of generer_url_retour(). Use parametre_url() instead, with
    the parameter ’redirect’.
  • Deletion of charger_php_extension() (Use extension_loaded())
  • Deletion of revisions_articles(). Use article_modifier()
  • Deletion of revision_article(). Use article_modifier()
  • Deletion of articles_set(). Use article_modifier()
  • Deletion of insert_article(). Use article_inserer()
  • Deletion of instituer_article(). Use article_instituer()
  • Deletion of insert_auteur(). Use auteur_inserer()
  • Deletion of auteurs_set(). Use auteur_modifier()
  • Deletion of instituer_auteur(). Use auteur_instituer()
  • Deletion of revision_auteur(). Use auteur_modifier()
  • Deletion of insert_rubrique(). Use rubrique_inserer()
  • Deletion of revisions_rubriques(). Use rubrique_modifier()
  • Deletion of instituer_rubrique(). Use rubrique_instituer()
  • Deletion of admin_repair_plat(). The .plat files are no longer used.
    This function is no longer called since r14292
  • Deletion of version_svn_courante(). Use version_vcs_courante()
  • Suppression de lire_meta(). Use $GLOBALS['meta'][$nom] ou
    lire_config('nom')
  • Deletion of auteur_referent(). Use auteur_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(). Use objet_modifier().
  • Deletion of notifier_publication_article().
  • Deletion of notifier_proposition_article().
  • Suppression de calcul_branche(). Use calcul_branche_in().
  • Deletion of ecrire_metas().
  • Deletion of spip_query_db(). Use sql_query() ou other.
  • Deletion of spip_get_lock() and spip_release_lock() which were no
    longer used.
  • Deletion of recuperer_entetes(). Use recuperer_entetes_complets().
  • Deletion of maj_version() and upgrade_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(). Use breve_inserer()
  • Deletion of revisions_breves(). Use breve_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(). Use document_modifier()
  • Deletion of insert_document(). Use document_inserer()
  • Deletion of revision_document(). Use document_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(). Use generer_lien_entite()
  • Deletion of instituer_document(). Use document_instituer()

Words

PHP Functions

  • Deletion of groupemots_inserer(). Use groupe_mots_inserer() ou
    objet_inserer()
  • Deletion of groupemots_modifier(). Use groupe_mots_modifier() ou
    objet_modifier()
  • Deletion of revision_groupe_mot(). Use groupe_mots_modifier()
  • Deletion of insert_mot(). Use mot_inserer()
  • Deletion of mots_set(). Use mot_modifier()
  • Deletion of revision_mot(). Use mot_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/)


rubon155-a9eec.jpg