Soon more technical posts about features of plugins

All plugins and especially xili-language contains a lot of features (template tags, shortcode, widget,…). We will try to begin a library of small posts to describe with pictures.

Examples

(These small posts are technically based on custom posts – They share the categories but they have their own tags to show the places in WP world)

Here some tags for these charts

 

 

Publié dans News | Laisser un commentaire

Extension xili-language : modèle de données et architecture pour un site multilingue [M à J]

Cet article – ici en version anglaise – décrit le pourquoi et le comment des choix qui ont régit à la conception de l’extension xili-language pour gérer un site multilingue tout en conservant la cohérence et la robustesse du modèle de données de WordPress. La comparaison avec d’autres solutions et extensions disponibles illustrent l’approche originale de la trilogie xili-language.

Après avoir été utilisé depuis sa conception en 2009 par des webmestres responsables de site CMS multilingues, de plus en plus la trilogie xili-language est utilisé par des néophytes en WordPress. Cet article fait la synthèse de questions sur l’architecture et le modèle de données sous jacent, choisis dès sa conception et années après années qui se sont confirmées depuis la version WP 2.3. Dans ces lignes sont aussi détaillées des points exposés dans le Codex WordPress.

Quelques propriétés de base WP :

Le coeur de WP est la table des « posts » avec les principales colonnes telles que « title« , « content« , « author« , « date« ,…
Le classement des articles est basé sur les catégories et les mots clés.
La catégorie est comme un rayon dans une librairie. Les mots clés sont comme des fiches ou marques de couleur apposées au livre.
L’ajout des outils/bibliothèques logiciels de taxinomie depuis WP 2.3 apportent des moyens puissants pour créer de nouvelles régles de classement.

xili-language repose avant tout sur l’architecture robuste de WP :

xili-language depuis WP 2.3 (24 September 2007) ajoute une nouvelle taxinomie dénommée « language » avec la clé de requête « lang ».
xili-language NE MODIFIE PAS le contenu de chaque « post » (article ou page ou post adapté – custom post ). Il ne détruit pas la structure de base du modèle de données.


un exemple : que se passe-t-il dans l’extension qtranslate ?
dès l’activation de l’extension, tous les contenus des articles sont modifiés – nouvelles balises etc… – parce que le contenu d’un champ contient simultanément les textes des 2, 3 voir plus langues… tel que vous pouvez le voir dans cette copie d’écran de phpMyAdmin.

DB modified by qTranslate

DB modified by qTranslate


DONC après desactivation de l’extension, tous les contenus deviennent illisibles, inexploitables et inexportables (xmlrpc).
posts list

posts list

xili-language n’ajoute pas de table. (tel que près de 13 dans l’extension WPML – à comparer avec les 11 tables d’origine de WordPress) – il est alors très complexe de récupérer et exporter un site sous WPML (nous l’avons testé pour un très gros site depuis sous xili-language premium…

wpml tables

wpml tables


Pour organiser (relier selon la langue) les articles (post, page, custom post), que fait xili-language :
Seuls des champs personnalisés sont ajoutés aux posts et contiennent les identifiants vers les autres posts selon leur langue. La taxinomie reste utilisable même si l’extension est désactivée en utilisant les custom taxinomies introduites récemment. Avec quelques petites fontions, il est possible d’exporter aisément un ensemble de posts associés à une langue.

Quelques questions :

Pourquoi xili-language ne fournit pas les drapeaux associés à chaque langue ?
xili-language traite les contenus pas les aspects des thèmes. Que se passe-t-il si un pays a un seul drapeau mais trois langues officielles ?
Sur ce site, il y a un exemple de thème enfant du thème « officiel » twentyten.
Idem sur ce site, pour un exemple de thème enfant du thème « officiel » twentyeleven.

Pourquoi xili-language n’ajoute pas un interface spécifique pour avoir simultanément les différentes versions selon les langues d’un article ?
Parce que les bons navigateurs bien conçus ont des onglets et qu’en bon traducteur, on travaille aisément avec plusieurs écrans.

Pourquoi xili-language n’a pas inclut xili-tidy-tags dans la même extension pour gérer (grouper) les mots clés (tags) selon la langue ?
Parce que xili-tidy-tags peut être utilisée sur des sites en une seule langue afin de classer sémantiquement des grandes quantités de mots clés.

Pourquoi selon les extensions « pour sites multilingues », les quantités statistiques indiquées dans le dépot des extentions sont si différentes ?

Le meilleur moyen de comparer n’est pas de prendre en compte la quantité totale mais la somme des pics lors d’une mise à jour.

Pourquoi xili-language ne traduit pas ?

Il ne faut pas confondre traducteur/adaptateur qui oeuvre sur le contenu et outil (extension) de classement et d’aide à la navigation ou d’affichage des élements du thème dans la bonne langue selon le contenu de l’article (selection du fichier .mo du thème selon la langue).

L’article original dans le WordPress Codex n’est pas très explicite sur le sujet : une langue = une instance de WordPress network (multisite) ?
WordPress basiquement est traduisible mais non multilingue. La plupart des extensions sont actives dans une seule instance de WP et tous les posts sont dans le même site web. Pour modifier les comportements et les rendus pendant la navigation, les processus sont complexes et utilisent de nombreux filtres (hook, API) dans le code pour avoir des effets sur le thème, les widgets etc… L’arrivée de WP network depuis la version 3.0 permet une approche plus élégante… c’est la raison de la naissance de xili-language premium : voir cet article qui présente les spécifications essentielles.
Note: la toute récente extension Multisite Language Switcher est proche dans la méthode.

Comment choisir une extension multilingue ?
Comme une maison, une voiture, un objet… selon les qualités souhaitées, la réversibilité (après désactivation), les exigences de maintenance… et en cherchant à comprendre comme elle est conçue et comment les données sont classées, conservées modifiées… Une bonne façon de soutenir un auteur d’extensions de faire des donations mais aussi de faire appel à ses services pour faire une analyse préalable afin d’éviter de construire un site web sur du sable en bord de mer 😉

D’autres questions ? Utiliser le formulaire ci-dessous ou de préférence le forum !

Michel de dev.xiligroup

Publié dans Experts corner, Studies, xili-language | Marqué avec | Laisser un commentaire

xili-language 2.2.0 pour WordPress 3.2

xili-language est compatible avec WP 3.2. (et est disponible ici)
Sources revus, dossier réorganisé, prêt pour l’option complète permalinks, nouveau menu centralisé dans la nouvelle barre d’admin

Le ReadMe !

Contributors: michelwppi, MS dev.xiligroup.com
Donate link: http://dev.xiligroup.com/
Tags: theme, post, plugin, posts, page, category, admin, multilingual, bilingual, taxonomy, dictionary, .mo file, .po file, localization, widget, language, international, i18n, l10n, WP network, multisite, blogroll, japanese, khmer, rtl, translation-ready, bbpress, jetpack, polylang
Requires at least: 4.3.5
Tested up to: 4.7.3
Stable tag: 2.21.2
License: GPLv2
xili-language lets you create and manage multilingual WP site in several languages with yours or most famous localizable themes. Ready for CMS design.

Description

xili-language provides for a bilingual (or multilingual) website an automatic selection of language (.mo) in theme according to the language of current post(s) or page. Theme's behaviour can be fully personalized through settings, hooks and api. Ready for CMS developers and designers.

  • xili-language plugin provides an automatic selection of language in theme according to the language of displayed post, series of posts, page or articles. If the post is in gaelic, the texts of the theme will be in gaelic if the author checks the post as gaelic and if the theme contains the right .mo file for this target language.

  • A very readable interface with a list of titles (and links) to help you write/edit/modify articles and their translations.

  • To help authoring, current user can choose language of his dashboard.

  • xili-language select on the fly the multilingual .mo files present in the theme's folder (no cookies, no redirections like "301").

  • xili-language uses a custom taxonomy to specify language of post, page and custom post. Full compatible with WP JSON REST API

  • xili-language plugin works on Wordpress installation in mono (standalone) or on one site belonging to a multisite (network) install.

  • xili-language plugin works on Wordpress installation for WebApp with JSON REST API - see changelog because WP JSON REST API 1.2.1 in under full development but yet powerful.

  • As educational plateform in constant changing since 2009, xili-language trilogy tries to use most of the WordPress Core functions and features (Custom taxonomy, API, metabox, pointer, help, pomo libraries, ...). The options are adjustable.

Version 2.21.2

For bbPress users, xili xl-bbp-addon plugin is no more a plugin. Components are optionally (if bbPress active) included. An option is also added in Experts tab of settings.

Prequisite

  • A project of a website with articles in different languages.
  • A localizable theme : Every themes with localization (or translation-ready like twentyfourteen) can be easily used (and improved) for realtime multilingual sites.
  • A tool to translate .po files of the theme and built .mo files (poEdit or better xili-dictionary - see below ).
  • see this page in wiki.xiligroup.org.

What to prepare before and during installation before activating

  • verify that your theme is translation-ready. Collect .po files of theme for target languages.
  • if rtl languages are used, verify that theme contains rtl.css file.

Links and documentation to read before activating

Themes provided as examples

Other compatible plugins by xiligroup dev

TRILOGY FOR MULTILINGUAL CMS WEBSITE including xili-language plugin

Please verify that you have installed the latest versions of:

  • xili-dictionary plugin: With xili-dictionary, it is easier to create or update online, via admin/dashboard UI, the files .mo of each language.
  • xili-tidy-tags plugin: With xili-tidy-tags, it is now possible to display sub-selection (cloud) of tags according language and semantic trans-language group (trademark,…).

That this plugin does not

With around 8000 php lines, xili-language is not everything…

  • xili-language plugin does not create additional tables in the database, do not create cookies and only use 4 lines in Options table. xili-language simply makes proper use of the taxonomy tables and postmeta table offered by WordPress to define language and link items between them. Because xili-language plugin does not modify deeply the post edit UI, it is possible to use iPhone / iPod Touch Wordpress app to prepare and draft the post.

  • xili-language plugin does not replace the author or the editor. No automatic translation. Content strategist is the master of the languages, the contents and the navigation inside the website. With xili-dictionary, webmaster can translate the theme's items and when .mo files are in place, xili-dictionary can be deactivated. For design, the creator is free to choose text or graphic. xili-language does not provide flags (or few as example in child-theme example like twentytwelve-xili )!

Newbie, WP user, Developer,…

  • Dear Newbie: originally built for webmaster and developer, the plugin trilogy progress since 6 years to be more and more plug and play for newbies who can read and spend a little time mainly for translation.

  • xili-language is also dedicated for theme's creator or webmaster with knowledges in CMS and WP and having (or not) tools to create .mo language files. Through API (hook), the plugin add automatic tools (or links or filters) for sidebar or top menus. Categories or Archives lists are translated also.

  • xili-language provides also series of functions which can be hooked in the functions.php file of the theme that you create i.e. for a cms like multilingual website.

Licence, donation, services, "as is", ...

Contrary to popular belief, GPL doesn't say that everything must be zero-cost, just that when you receive the software (plugin or theme) that it not restrict your freedoms in how you use it. Free open source plugin does not mean free services

  • Texts of licence: GPLv2
  • Donation link via paypal in sidebar of dev.xiligroup site
  • Services : As authors of plugin, dev.xiligroup team is able to provide services (consulting, training, support) with affordable prices for WP multilingual contexts in corporate or commercial websites.
  • Plugin is shipped as is : see no warranty chapter in license GPLv2.

Roadmap

  • Improved documentation for getting starts, template tags and functions - here in news or here by Vladimir.
  • Delivery of a premium services kit (with powerful features and attractive fees) packaged with professional training and support.
  • Updating sources (parts are 6 years old) with new libraries provided since WP 4.2.
  • Contributions are welcome 😉

Frequently Asked Questions

What is menus insertion point in navigation menus ?

It is the most recent way to add multilingual menus at a location in a theme. This method uses insertion point that will live choose the menu structure according current targeted language.

see this howto page

XL version > 2.9.10 : In appareance/menus, I do not see the boxes of insertion point (languages list, sub-selection pages or sub-selection menus) ?

To show insertion point metaboxes, remember to check them inside Screen Options. (top right tab near Help tab)

What about WP Network (previous WPMU) and the trilogy ?

xili-language, xili-tidy-tags, xili-dictionary Since WP 3.0-alpha, if multisite is activated, the trilogy is now compatible and will include progressively some improvements dedicaded especially for WP Network context. Future specific docs will be available for registered webmasters.

How to see post or page ID in dashbord ?

IDs of all types of post (post, page, CPT) are listed in Translation box (second column) under the content.

What about rtl languages ?

If your theme follow the WP core rules (like in Twenty Twelve) with rtl.css file, RTL languages are well displayed.

Where can I see websites using this plugin ?

Twenty Fifteen 2015

Twenty Fourteen 2014

Twenty Thirteen 2013

Responsive responsive

Twenty Twelve 2012

Twenty Eleven 2011

Twenty Ten 2010

dev.xiligroup.com here and examples child theme below:

And as you can see in stats, thousand of sites use xili-language (Stats in March 2015 are not good and must be fixed due to bad versioning sorting).

For commercial websites, is it possible to buy support ?

Yes, use contact form here. Multiple commercial theme were customized for clients using multilingual CMS.

What is gold functions ?, is it possible to buy them ?

Some gold functions (in xilidev-libraries) are explained here and some belong to pro services for commercial websites. Yes, use contact form here.

Support Forum or contact form ?

Effectively, prefer forum to obtain some support.

Does xiligroup provide free themes ?

Yes, example child themes of official themes like Twenty Twelve or Twenty Thirteen - see list above in previous question.

Is poEdit mandatory to edit .po and to build .mo file ?

xili-dictionary avoids to use poEdit to update .mo files with contents of terms of your database (categories, ...)

What about plugin admin settings UI localization ?

It is simple, if you have translated the settings UI of plugin in your mother language, you send us a message through the contact form that contains the link to your site where you have add the .po and .mo files. Don't forget to fill the header of the .po file with your name and email. If all is ok, the files will be added to the xili-language WP plugins repository. Because I am not able to verify the content, you remain responsible of your translation.

What about bookmarks and sub-selection according current language of displayed loop ?

Since version 1.8.5, xili-language has inside his class filters and actions to permit displaying sub-selection of links and bookmarks.

  • case of default widget-links : in xili-language settings, only check link categories where sub-selection is wanted.
  • case of template tags : <?php wp_list_bookmarks( array( 'lang'=>the_curlang() ) ; ?> here this new arg named lang is set to the current language.

Visit links list editor settings page and set for each link the language.

What happens if frontpage is a page ?

The page as frontpage must have its clones in each other languages. Like for posts, if the user's browser is not in the default language, xili-language will display the page in the corresponding language if set by the editor. home page of website dev.xiligroup.com uses this feature.

How to enlarge languages list of the dashboard ?

Since version 2.8, the current user (author) can choose language of his dashboard. To enlarge list of available languages, you must upload the xx_YY.mo files of other localized WP installs in the folder wp-content/languages/. For example, here a list for a trilingual website (english, french, german : fr_FR.mo, de_DE.mo. See this codex page about WP in your language to find kit containing wanted files.

Since 2.8.8, xili-language is able to help you to download admin translation files from Automattic and GlotPress site. See the 4th tab in settings. For official embedded themes ( Twentyten and others), the .mo files can also be downloaded.

Upgrade Notice

Please read the readme.txt before upgrading. As usually, don't forget to backup the database before major upgrade or testing no-current version. Upgrading can be easily procedeed through WP admin UI or through ftp (delete previous release folder before upgrading via ftp). Verify you install latest version of trilogy (xili-language, xili-tidy-tags, xili-dictionary). v2.1.0 is compatible with settings of previous release BUT introduces now a way to choose multiple navmenu locations - so revisit the settings page to confirm your previous choice or sets to new navigation way including singular links.

1. Technical infos

  • REMEMBER : xili-language follows the WordPress story since more than 6 years. Initially designed for webmasters with knowledge in WP, PHP,… step by step the plugin will improved to be more and more plug and play. So don't forget to visit this latest demo and news, see this other demo and Forum.

1.1. Prerequisite

Verify that your theme is international (translation ready) compatible (translatable terms like _e('the term','mythemedomaine') and no displayed texts 'hardcoded' (example in default bundled themes of WP named twentyfourteen or twentyfifteen ).

  • This latest version works with WP 4.0+ in mono or multisite.

1.2. CMS

  • CMS = Content Management System
  • Contains features dedicated to multilingual theme's creators and webmasters. Don't forget to read documented source code.

1.3. Documentation for developers

A table summarizes all the technical features (widgets, template tags, functions and hooks) of this powerful plugin for personalized CMS created by webmaster.

  • Provides infos about text direction ltr ou rtl of languages (arabic, hebraic,...) of theme and of each post in loop
  • unique id for category link hook see expert's corner posts
  • hooks to define header metas or language attributes in html tag.

1.4. More infos and docs

  • Other posts, articles and more descriptions here and here in action.
  • Visit also Forum to obtain more support or contribute to others by publishing reports about your experience.

2. Flags

Default flags provided in bundled child themes like TwentyFourteen-xili 2014 came from famfamfam. To be compliant to the design and look, choose your own series of flags. Be aware of size and file naming.

3. Compatibility

xili-language is compatible with the plugin xili-dictionary which is able to deliver .mo files on the fly through the WP admin UI (and .po files translatable by other translators). xili-dictionary used a specific taxonomy without adding tables in WP database.

xili-language is compatible with the plugin xili-tidy-tags. xili-tidy-tags lets you create multiple group of tags. That way, you can have a tag cloud for tags in English, another cloud for French tags, another for Spanish ones, and so on. You can also use the plugin for more than multilingual blogs. Basically, you can create any group of tags you want.

xili-language is full compatible with the plugin xilitheme-select to be used with iPhone, iPod Touch or other mobiles. Also with xili re/un-attach media !

More informations about other plugins in the website dev.xiligroup.com or in WP Repository

The plugin is frequently updated. Visit Other versions. See also the dev.xiligroup Forum.

2008-2016 - MS - dev.xiligroup.com

Publié dans News, xili-language | Marqué avec , , , | Laisser un commentaire

xili-language – release 2.2.0 – is shipped

xili-language is now compatible with WP 3.2. (available here)
source reviewed, folder reviewed, ready for lang permalinks option, new admin bar menu

WP 3.2 was shipped (July 4th) – version 2.2.0 will be the current version with some new features.

The ReadMe !

Contributors: michelwppi, MS dev.xiligroup.com
Donate link: http://dev.xiligroup.com/
Tags: theme, post, plugin, posts, page, category, admin, multilingual, bilingual, taxonomy, dictionary, .mo file, .po file, localization, widget, language, international, i18n, l10n, WP network, multisite, blogroll, japanese, khmer, rtl, translation-ready, bbpress, jetpack, polylang
Requires at least: 4.3.5
Tested up to: 4.7.3
Stable tag: 2.21.2
License: GPLv2
xili-language lets you create and manage multilingual WP site in several languages with yours or most famous localizable themes. Ready for CMS design.

Description

xili-language provides for a bilingual (or multilingual) website an automatic selection of language (.mo) in theme according to the language of current post(s) or page. Theme's behaviour can be fully personalized through settings, hooks and api. Ready for CMS developers and designers.

  • xili-language plugin provides an automatic selection of language in theme according to the language of displayed post, series of posts, page or articles. If the post is in gaelic, the texts of the theme will be in gaelic if the author checks the post as gaelic and if the theme contains the right .mo file for this target language.

  • A very readable interface with a list of titles (and links) to help you write/edit/modify articles and their translations.

  • To help authoring, current user can choose language of his dashboard.

  • xili-language select on the fly the multilingual .mo files present in the theme's folder (no cookies, no redirections like "301").

  • xili-language uses a custom taxonomy to specify language of post, page and custom post. Full compatible with WP JSON REST API

  • xili-language plugin works on Wordpress installation in mono (standalone) or on one site belonging to a multisite (network) install.

  • xili-language plugin works on Wordpress installation for WebApp with JSON REST API - see changelog because WP JSON REST API 1.2.1 in under full development but yet powerful.

  • As educational plateform in constant changing since 2009, xili-language trilogy tries to use most of the WordPress Core functions and features (Custom taxonomy, API, metabox, pointer, help, pomo libraries, ...). The options are adjustable.

Version 2.21.2

For bbPress users, xili xl-bbp-addon plugin is no more a plugin. Components are optionally (if bbPress active) included. An option is also added in Experts tab of settings.

Prequisite

  • A project of a website with articles in different languages.
  • A localizable theme : Every themes with localization (or translation-ready like twentyfourteen) can be easily used (and improved) for realtime multilingual sites.
  • A tool to translate .po files of the theme and built .mo files (poEdit or better xili-dictionary - see below ).
  • see this page in wiki.xiligroup.org.

What to prepare before and during installation before activating

  • verify that your theme is translation-ready. Collect .po files of theme for target languages.
  • if rtl languages are used, verify that theme contains rtl.css file.

Links and documentation to read before activating

Themes provided as examples

Other compatible plugins by xiligroup dev

TRILOGY FOR MULTILINGUAL CMS WEBSITE including xili-language plugin

Please verify that you have installed the latest versions of:

  • xili-dictionary plugin: With xili-dictionary, it is easier to create or update online, via admin/dashboard UI, the files .mo of each language.
  • xili-tidy-tags plugin: With xili-tidy-tags, it is now possible to display sub-selection (cloud) of tags according language and semantic trans-language group (trademark,…).

That this plugin does not

With around 8000 php lines, xili-language is not everything…

  • xili-language plugin does not create additional tables in the database, do not create cookies and only use 4 lines in Options table. xili-language simply makes proper use of the taxonomy tables and postmeta table offered by WordPress to define language and link items between them. Because xili-language plugin does not modify deeply the post edit UI, it is possible to use iPhone / iPod Touch Wordpress app to prepare and draft the post.

  • xili-language plugin does not replace the author or the editor. No automatic translation. Content strategist is the master of the languages, the contents and the navigation inside the website. With xili-dictionary, webmaster can translate the theme's items and when .mo files are in place, xili-dictionary can be deactivated. For design, the creator is free to choose text or graphic. xili-language does not provide flags (or few as example in child-theme example like twentytwelve-xili )!

Newbie, WP user, Developer,…

  • Dear Newbie: originally built for webmaster and developer, the plugin trilogy progress since 6 years to be more and more plug and play for newbies who can read and spend a little time mainly for translation.

  • xili-language is also dedicated for theme's creator or webmaster with knowledges in CMS and WP and having (or not) tools to create .mo language files. Through API (hook), the plugin add automatic tools (or links or filters) for sidebar or top menus. Categories or Archives lists are translated also.

  • xili-language provides also series of functions which can be hooked in the functions.php file of the theme that you create i.e. for a cms like multilingual website.

Licence, donation, services, "as is", ...

Contrary to popular belief, GPL doesn't say that everything must be zero-cost, just that when you receive the software (plugin or theme) that it not restrict your freedoms in how you use it. Free open source plugin does not mean free services

  • Texts of licence: GPLv2
  • Donation link via paypal in sidebar of dev.xiligroup site
  • Services : As authors of plugin, dev.xiligroup team is able to provide services (consulting, training, support) with affordable prices for WP multilingual contexts in corporate or commercial websites.
  • Plugin is shipped as is : see no warranty chapter in license GPLv2.

Roadmap

  • Improved documentation for getting starts, template tags and functions - here in news or here by Vladimir.
  • Delivery of a premium services kit (with powerful features and attractive fees) packaged with professional training and support.
  • Updating sources (parts are 6 years old) with new libraries provided since WP 4.2.
  • Contributions are welcome 😉

Frequently Asked Questions

What is menus insertion point in navigation menus ?

It is the most recent way to add multilingual menus at a location in a theme. This method uses insertion point that will live choose the menu structure according current targeted language.

see this howto page

XL version > 2.9.10 : In appareance/menus, I do not see the boxes of insertion point (languages list, sub-selection pages or sub-selection menus) ?

To show insertion point metaboxes, remember to check them inside Screen Options. (top right tab near Help tab)

What about WP Network (previous WPMU) and the trilogy ?

xili-language, xili-tidy-tags, xili-dictionary Since WP 3.0-alpha, if multisite is activated, the trilogy is now compatible and will include progressively some improvements dedicaded especially for WP Network context. Future specific docs will be available for registered webmasters.

How to see post or page ID in dashbord ?

IDs of all types of post (post, page, CPT) are listed in Translation box (second column) under the content.

What about rtl languages ?

If your theme follow the WP core rules (like in Twenty Twelve) with rtl.css file, RTL languages are well displayed.

Where can I see websites using this plugin ?

Twenty Fifteen 2015

Twenty Fourteen 2014

Twenty Thirteen 2013

Responsive responsive

Twenty Twelve 2012

Twenty Eleven 2011

Twenty Ten 2010

dev.xiligroup.com here and examples child theme below:

And as you can see in stats, thousand of sites use xili-language (Stats in March 2015 are not good and must be fixed due to bad versioning sorting).

For commercial websites, is it possible to buy support ?

Yes, use contact form here. Multiple commercial theme were customized for clients using multilingual CMS.

What is gold functions ?, is it possible to buy them ?

Some gold functions (in xilidev-libraries) are explained here and some belong to pro services for commercial websites. Yes, use contact form here.

Support Forum or contact form ?

Effectively, prefer forum to obtain some support.

Does xiligroup provide free themes ?

Yes, example child themes of official themes like Twenty Twelve or Twenty Thirteen - see list above in previous question.

Is poEdit mandatory to edit .po and to build .mo file ?

xili-dictionary avoids to use poEdit to update .mo files with contents of terms of your database (categories, ...)

What about plugin admin settings UI localization ?

It is simple, if you have translated the settings UI of plugin in your mother language, you send us a message through the contact form that contains the link to your site where you have add the .po and .mo files. Don't forget to fill the header of the .po file with your name and email. If all is ok, the files will be added to the xili-language WP plugins repository. Because I am not able to verify the content, you remain responsible of your translation.

What about bookmarks and sub-selection according current language of displayed loop ?

Since version 1.8.5, xili-language has inside his class filters and actions to permit displaying sub-selection of links and bookmarks.

  • case of default widget-links : in xili-language settings, only check link categories where sub-selection is wanted.
  • case of template tags : <?php wp_list_bookmarks( array( 'lang'=>the_curlang() ) ; ?> here this new arg named lang is set to the current language.

Visit links list editor settings page and set for each link the language.

What happens if frontpage is a page ?

The page as frontpage must have its clones in each other languages. Like for posts, if the user's browser is not in the default language, xili-language will display the page in the corresponding language if set by the editor. home page of website dev.xiligroup.com uses this feature.

How to enlarge languages list of the dashboard ?

Since version 2.8, the current user (author) can choose language of his dashboard. To enlarge list of available languages, you must upload the xx_YY.mo files of other localized WP installs in the folder wp-content/languages/. For example, here a list for a trilingual website (english, french, german : fr_FR.mo, de_DE.mo. See this codex page about WP in your language to find kit containing wanted files.

Since 2.8.8, xili-language is able to help you to download admin translation files from Automattic and GlotPress site. See the 4th tab in settings. For official embedded themes ( Twentyten and others), the .mo files can also be downloaded.

Upgrade Notice

Please read the readme.txt before upgrading. As usually, don't forget to backup the database before major upgrade or testing no-current version. Upgrading can be easily procedeed through WP admin UI or through ftp (delete previous release folder before upgrading via ftp). Verify you install latest version of trilogy (xili-language, xili-tidy-tags, xili-dictionary). v2.1.0 is compatible with settings of previous release BUT introduces now a way to choose multiple navmenu locations - so revisit the settings page to confirm your previous choice or sets to new navigation way including singular links.

1. Technical infos

  • REMEMBER : xili-language follows the WordPress story since more than 6 years. Initially designed for webmasters with knowledge in WP, PHP,… step by step the plugin will improved to be more and more plug and play. So don't forget to visit this latest demo and news, see this other demo and Forum.

1.1. Prerequisite

Verify that your theme is international (translation ready) compatible (translatable terms like _e('the term','mythemedomaine') and no displayed texts 'hardcoded' (example in default bundled themes of WP named twentyfourteen or twentyfifteen ).

  • This latest version works with WP 4.0+ in mono or multisite.

1.2. CMS

  • CMS = Content Management System
  • Contains features dedicated to multilingual theme's creators and webmasters. Don't forget to read documented source code.

1.3. Documentation for developers

A table summarizes all the technical features (widgets, template tags, functions and hooks) of this powerful plugin for personalized CMS created by webmaster.

  • Provides infos about text direction ltr ou rtl of languages (arabic, hebraic,...) of theme and of each post in loop
  • unique id for category link hook see expert's corner posts
  • hooks to define header metas or language attributes in html tag.

1.4. More infos and docs

  • Other posts, articles and more descriptions here and here in action.
  • Visit also Forum to obtain more support or contribute to others by publishing reports about your experience.

2. Flags

Default flags provided in bundled child themes like TwentyFourteen-xili 2014 came from famfamfam. To be compliant to the design and look, choose your own series of flags. Be aware of size and file naming.

3. Compatibility

xili-language is compatible with the plugin xili-dictionary which is able to deliver .mo files on the fly through the WP admin UI (and .po files translatable by other translators). xili-dictionary used a specific taxonomy without adding tables in WP database.

xili-language is compatible with the plugin xili-tidy-tags. xili-tidy-tags lets you create multiple group of tags. That way, you can have a tag cloud for tags in English, another cloud for French tags, another for Spanish ones, and so on. You can also use the plugin for more than multilingual blogs. Basically, you can create any group of tags you want.

xili-language is full compatible with the plugin xilitheme-select to be used with iPhone, iPod Touch or other mobiles. Also with xili re/un-attach media !

More informations about other plugins in the website dev.xiligroup.com or in WP Repository

The plugin is frequently updated. Visit Other versions. See also the dev.xiligroup Forum.

2008-2016 - MS - dev.xiligroup.com

Publié dans xili-language | Marqué avec , , , , | Laisser un commentaire

xili-dictionary : version 1.3.5 released

xili-dictionary is now compatible with WP 3.2 RC4.
new folder organization – fixes only > 3.1 – new capability rights for xili admin bar menu

The ReadMe !

Contributors: michelwppi, MS dev.xiligroup
Donate link: http://dev.xiligroup.com/
Tags: theme, post, plugin, posts, page, category, admin, multilingual, taxonomy, dictionary, .mo file, .po file, .pot file, l10n, i18n, language, international, wpmu, plural, multisite, WP network, translation, Polylang, xml
Requires at least: 3.6.1
Tested up to: 4.7.1
Stable tag: 2.12.5
License: GPLv2

xili-dictionary is a multilingual dictionary storable in CPT and terms to create and translate .po files or .mo files and more (import, export...)

Description

xili-dictionary is a dictionary storable in custom post type (CPT) and terms (custom taxonomy) to create, update and translate .po files or .mo files of current theme folder and of current plugins.

  • xili-dictionary is a plugin (compatible with plugin xili-language) to build a multilingual dictionary saved in the post tables of WordPress as CPT to build .mo files (used online by WP website), .po files (file assigned to a language and used by translator, text format of compiled .mo), and now .pot files. A .pot file (of theme or plugin) can be generated from sources w/o importing entries in dictionary. Files are read and saved on the right place (languages sub-folder) but can also be download on your desktop computer.
  • With this dictionary, collecting terms from taxonomies (title, description), from bloginfos, from wp_locale, from current theme - international terms with _e(), __() or _n() or _x(), _ex(), _nx(),... and other functions as in I10n.php - , it is possible to create and update .mo file in the current theme folder and current plugins.
  • By importing .mo files, it is possible to regenerate readable .po files and enrich translation tables.
  • xili-dictionary is full compatible with xili-language plugin and xili-tidy-tags plugin. Also compatible with xili re/un-attach media !
  • xili-dictionary can be used w/o a multilingual plugin or with multilingual plugin based on taxonomy named 'language' (Polylang).
  • As educational plateform in constant changing, xili-dictionary tries to use most of the WordPress Core functions and features (CPT, metabox, pointer, help, pomo libraries, ...).

roadmap

  • code source renewed continiously with latest WP tools since WP 4.3
  • readme rewritting

Version 2.12.5 (updated 2016-07-29)

see Changelog tab.

Installation

  1. Upload the folder containing xili-dictionary.php and language files to the /wp-content/plugins/ directory,
  2. Verify that your theme is international compatible - translatable terms like _e('the term','mytheme') and no text hardcoded -
  3. Activate and visit the dictionary page in tools menu and docs here -
  4. To edit a msg, you can start from dictionary list or XD msg list using current WP admin UI library. Don't forget to adapt UI with screen options and moving meta boxes.

More infos will be added progressively in a wiki here.

Frequently Asked Questions

Why xili-dictionary is not included in xili-language ?

  • because xili-dictionary is available for non multilingual site to manage theme and plugin translations.
  • because it is possible to desactivate xili-dictionary after creation of .po .mo files used by WP, xili-language or other extensions.

Where can I see websites using this plugin ?

Twenty Fifteen 2015 - contains also tips and tricks about WordPress

Twenty Fourteen 2014 - contains also latest informations and documentions about xili-language trilogy

Twenty Thirteen 2013

Twenty Twelve 2012

Twenty Eleven 2011

Twenty Ten 2010

Responsive responsive

The reference website under renovation: dev.xiligroup.com here

And as you can see in stats, thousand of sites use xili-language.

What is the difference with msgid and msgtr in .po file ?

The msgid line is equal to the term or sentence hardcoded in the theme functions like _e() or __(). msgstr is the translation in the target language : by instance fr_FR.po for a french dictionary. (the compiled file is fr_FR.mo saved in the theme folder. The root language is in Wordpress currently en_US, but with xili-dictionary, it is possible to create a en_US.mo containing the only few terms that you want to adapt or modify.

Is xili-dictionary usable without xili-language to edit .po or .mo file ?

Yes and now automatically detected ! For example, to modify the results of a translation for your site with your words.

What about plural translations ?

Today works with .mo or .po with simple twin msgid msgstr couple of lines and themes with functions like _e() or __() for localization AND _n() which manage singular and plural terms like msgid, msgid_plural, msgstr[0],...

What is a po file ?

It is a text file like this (here excerpt) with different types of msgid :

` msgctxt "comments number" msgid "%" msgstr "%"

msgid "Leave a reply" msgstr "Laisser une réponse"

msgid "One thought on “%2$s”" msgid_plural "%1$s thoughts on “%2$s”" msgstr[0] "Une réflexion au sujet de &laquo %2$s »" msgstr[1] "%1$s réflexions au sujet de &laquo %2$s »"

msgctxt "sentence" msgid "comment" msgid_plural "comments" msgstr[0] "commentaire" msgstr[1] "commentaires"

`

What happens if only the .mo is available ?

xili-dictionary is able to import a .mo of the target language and rebuild a .po editable in backend or a text editor. Example: if it_IT is in your language list, it_IT.mo can be imported, completed by webmaster and export as it_IT.po text file in languages sub-folder of the theme (as text backup).

What is the differences with poEdit application ?

Poedit is a standalone desktop application. Poedit offers the ways to translate apps and sites (that use gettext). This application is used by us to create localization of this and other plugins. xili-dictionary is online and based on WP Core and essentially made for files used by WP (theme, plugin, custom terms of site...). For technicians, some advantages: possible to recover .mo files, to translate online items, to export .pot files, and more... It is also possible to import msgid present in new template default functions introduced in recent versions.

What about WP multisite (or network - former named WPMU) and the trilogy ?

xili-language, xili-tidy-tags, xili-dictionary

Since WP 3.0, if multisite is activated, the trilogy is compatible and will include progressively some improvements dedicaded especially for WP network context.

Upgrade Notice

Upgrading can be easily procedeed through WP admin UI or through ftp (delete previous release folder before upgrading via ftp). IMPORTANT - Don't forget to backup before. Verify you install latest version of trilogy (xili-language, xili-tidy-tags,…).

More infos

This releases are for theme's creator or designer with some knowledges in i18n. Help are more and more included inside help tabs of dashboard and each screen.

The plugin post is frequently updated wiki.xiligroup.org

See dev.xiligroup forum plugins forum.

See also the Wordpress plugins forum.

2009-2016 MS - dev.xiligroup.com

Publié dans xili-dictionary | Laisser un commentaire

xili-tidy-tags: new release 1.6.1 shipped

What’s new in the version 1.6.1 of xili-tidy-tags plugin ?

  • xili-tidy-tags is now ready for custom taxonomy and custom post type (webmasters: read carefully source code and readme)
  • tags cloud widget with conditionnal display as other xili plugins.

Why « ready » ?
Because it is not documented and because some codes must be added in your theme according your new custom post and taxonomy.
This online website is powered by the latest version and will progressively contains a new series of custom posts with the same categories as current posts but with a custom taxonomy (as post tag but named wp_parts).

xili-tidy-tags menus on dashboard

xili-tidy-tags menus on dashboard - instantiation for custom taxonomy


a tip to see again clouds in widgets after updating !

Because some modifications were done since 1.6.0 to allow custom post tags for custom post type, it is necessary to go to appearance menu and save again widgets displaying clouds of groups.

Caution : If you use desktop ftp app. to update, delete previous folder before updating… Inside plugin folder, files and files are new reorganized. (no pb with automatic updating process when current version will be available)

The ReadMe !

Contributors: michelwppi, MS dev.xiligroup
Donate link: http://dev.xiligroup.com/
Tags: tags, posts, multilingual, taxonomy, shortcode
Requires at least: 4.6
Tested up to: 6.2
Stable tag: 1.12.04
License: GPLv2

xili-tidy-tags is a tool for grouping tags by semantic groups or by language and for creating tidy tag clouds.

Description

on monolingual website (blog or CMS)

xili-tidy-tags is a tool for grouping tags by semantic groups and sub-groups. This tags aggregator can also, by instance, be used to group tags according two or more main parts of the CMS website. It is also possible to create group of tags in parallel of category and display a ‘sub’ tag cloud only depending of the displayed category.

on multilingual website

xili-tidy-tags is a tool for grouping tags by language with xili-language plugin for multilingual site and for creating tidy tag clouds. By instance to present only tags in english when the theme is in english because the post or the current category present texts in english. Technically, as xili-language, this plugin don't create tables in wordpress db. He only use (rich) taxonomy features. So, with or without the plugin, the base structure is not modified.

Why xili-tidy-tags versus / against included parent property of terms ?

With default parent feature, a tag (term) can have only one parent. The default taxonomy (see file taxonomy.php in folder wp-includes) is very poweful but don't include the queries to group tags under one another tag. Is is the purpose of this plugin xili-tidy-tags created since WP 2.7 ! Initially created to group tags by language, he structurally contains all functions to group tags by semantic groups AND one tag can belong to one or more groups.

Why xili-tidy-tags introduces grouping features since version 1.9 ?

RESERVED for DEVELOPERS using template-tags Using nice feature "alias of" and "group" of WP core taxonomy.php, xili-tidy-tags offers now a way to "link" tags of different languages (red, rouge, rot,…). So when displaying list of french posts associated with a french tag (rouge), it is now possible to show a list of tags in other languages (red, rouge, rot,…) and visitor is now able to click on red and show the webpage of list of posts tagged with red. Only taxonomy wpdb tables are used, no new tables, no new lines in options table.

Widget to insert Tags cloud

The powerful widget is easy to setup and to choose what and when group of tags to display.

Template tags usable in theme design

Template tags are provided to enrich the theme and display sub-selection of tags. Through the settings admin UI, it is possible to assign to a tag one or more groups (by instance a french tag to the french language group. A trademark term like WordPress to a group named "trademark". You can choose different storage policies.

NEW 2 template-tags since 1.9 : xili_tidy_tags_group_links to show the group of tags containing the current tag (useful in tag.php of theme) and xili_tidy_tag_in_other_lang to return info (link) of one other tag of the group in an another lang. Xili-language version > 2.9.0 will use the links switching in language switching navigation menu when displaying tag.php page. (if "red" tag page is displayed, language menu for french will link to "rouge" !)

Shortcode

add shortcode inside a post content to include in your text a cloud of a group of tags.

Example of shortcode : [xili-tidy-tags params="tagsgroup=trademark&largest=10&smallest=10" glue=" | "] In this cas, the group of tags named 'trademark' will be display inside a paragraph of a post. The params are defined as in xili_tidy_tag_cloud() and as in wp_tag_cloud(). The glue is chars inserted between the tags (if omitted default is a space).

Example of tag cloud made with shortcode here

TRILOGY FOR MULTILINGUAL CMS SITE

Please verify that you have installed the latest versions of: xili-language, xili-tidy-tags, xili-dictionary

Translations available for admin UI

Roadmap

  • readme.txt rewritting.
  • more function for grouping new features introducted in version 1.9

Version 1.12.04

  • fixes forget nounce
  • Last Updated 2023-08-01

Version 1.12.01

  • Last Updated 2019-05-18
  • rewritten with WPCS rules
  • prerequisite PHP 7.1+
  • Previous Tags: tag,tags,theme,post,plugin,posts, page, category, admin,multilingual,taxonomy,dictionary,widget,CMS, multisite, wpmu, bbPress, shortcode
  • see tab and chapters in changelog

Installation

  1. Upload the folder containing xili-tidy-tags.php and others files to the /wp-content/plugins/ directory,
  2. If xili-language plugin is activated, groups of languages are automatically created. If not, you can also use xili-tidy-tags to group your tags in semantic group like technical, trademark...
  3. in theme, a new template tag is available : xili_tidy_tag_cloud Same passed values as tag_cloud but two new : tagsgroup and tagsallgroup . tagsallgroup can be the parent group slug, tagsgroup is one of the child group slug. If one or both are included, the cloud is built with sub-selected tags in this (theses) group(s).

Exemples of script in sidebar.php :

with xili-language plugin activated in multilingual website

<div><h2><?php _e('Tags cloud','xilidev');?></h2>
<?php if (function_exists('xili_tidy_tag_cloud') && class_exists('xili_language')) xili_tidy_tag_cloud('tagsgroup='.the_curlang().'&tagsallgroup=tidy-languages-group&largest=18'); ?>
</div>

with semantic group named as category and a group containing trademarks named trademark

<h2><?php _e('Tags cloud','xilidev');?></h2><?php
if (function_exists('xili_tidy_tag_cloud')) xili_tidy_tag_cloud('tagsgroup='.single_cat_title('',false).'&tagsallgroup=trademark&largest=18'); ?>
</div>

example of a splitted tag cloud of authors group (here separated by hr) - change html tags if you want to build a table with 3 columns

<div><h2><?php _e('Tags clouds','xilidev');?></h2><?php if (function_exists('xili_tidy_tag_cloud')) xili_tidy_tag_cloud('tagsgroup=authors&largest=18&&number=15'); ?>
<hr />
<?php if (function_exists('xili_tidy_tag_cloud')) xili_tidy_tag_cloud('tagsgroup=authors&largest=18&&offset=15&number=15'); ?>
<hr />
<?php if (function_exists('xili_tidy_tag_cloud')) xili_tidy_tag_cloud('tagsgroup=authors&largest=18&&offset=30&number=150'); ?>
</div>

note about template tag

If the two args tagsgroup and tagsallgroup are empty, the content is all the tags as in current tag cloud but with more features for selecting or look as soon documented.

note about widget

If you create the single widget since 0.9.0, with 0.9.2 (which allows more than one), you need to recreate one, two or more widget(s) in theme admin UI.

Frequently Asked Questions

What about WP 3.0 multisite mode (WPMU) and the trilogy ?

xili-language, xili-tidy-tags, xili-dictionary

Since WP 3.0-alpha and now with 3.1, if multisite is activated, the trilogy is now compatible and will include progressively some improvements dedicaded especially for WP network context. Future specific docs will be available for registered webmasters.

What about custom taxonomies and tidy grouping ?

Since release 1.6.0, xili-tidy-tags is compatible with custom taxonomies. Reserved for skilled webmasters with WP, data model and php knowledges. Multiple instantiation of this powerful plugin is possible.

Where can I see websites using this plugin ?

dev.xiligroup.com here

and

www.xiliphone.mobi here also usable with mobile as iPhone.

and the first from China since plugin version 0.8.0

layabozi.com here to sub select music maker name and other tags sub-groups.

and a wonderful website

Frases de cine with more than 200 tags.

or 794 point 8 - Petite bibliothèque vidéoludique as a library of video games.

Compatibility with other plugins ?

In xiligroup plugins series, xili-tidy-tags is compatible with xili-language, xili-dictionary, xilitheme-select and others , a set of plugins to create powerful multilingual (multisite) CMS website.

Upgrade Notice

  • As recommanded, don't forget to make a backup of the database.
  • Upgrading can be easily procedeed through WP admin UI or through ftp (delete previous release folder before upgrading via ftp).
  • If updating via desktop ftp : erase previous version folder before uploading latest version.
  • Verify you install latest version of xili-language trilogy.

More infos

Capabilities and roles :

0.9.5 : Administrator role can create grouping or setting capabilities for editor role. 'Grouping' permits to editor to group tags in group (lang and/or semantic). 'Setting' permits to editor to create, modify or delete semantic groups. Only administrator has access to languages groups.

The plugin post is frequently documented dev.xiligroup.com and updated Wordpress repository.

See also the dev.xiligroup plugins forum.

2009-2020 MS - dev.xiligroup.com

Publié dans xili-tidy-tags | Marqué avec , , , , | Laisser un commentaire

xili-language plugin data model and architecture : FAQ [updated]

After been used by webmasters for cms multilingual websites, more and more, xili-language trilogy is used by newbies. This article summarizes some questions about how the data model and architecture were choosen at begining and year after year confirmed. In these lines we detail some features and comparisons made in WordPress Codex.

A recent joined pdf (see at end) summarizes elements about data-model.

Some basic features of WP :

The core of WP is posts table with main columns like « title« , « content« , « author« , « date« ,…
The classification of posts is based on categories and post tags.
Category is like a shelf in a bookcase. And post tag is like color stamp or label on a book.
The insertion of taxinomy library since WP 2.3 offers a powerful tool to create other taxinomies.

xili-language based on the solid architecture of WP :

xili-language since WP 2.3 (24 September 2007) introduces a new taxonomy named « language » with query var named « lang ».
xili-language DON’T modify the content of each post. No inconsistency introduced in data model.


one example : what happen in the free plugin named qtranslate ?
after activation of this plugin, all content items of posts are modified – new tags etc… – because inside the field, the content is the sum of the texts in each language 2, 3 and more … as you can see in this snapshot of phpMyAdmin.

DB modified by qTranslate

DB modified by qTranslate


or after desactivating qtranslate plugin, all contents become unreadable and unexportable in post dashboard UI.
posts list

posts list

xili-language don’t add any table. (like more then 13 in WPML plugin – compared to the original 11 tables of WordPress) – to recover or transfer posts in one language, it become very complexe…

wpml tables

wpml tables


To organize posts and pages (and custom posts) in xili-language :
Only custom fields are added to link one post in a language and these translations in other languages. The taxonomy remains usable even if xili-language is desactivated by using custom taxonomy introduced recently.
With small functions, it is easy to export posts attached to a specific language.

Some questions :

Why xili-language don’t provide flags for language ?
xili-language works on the contents and not appearance. What happens in a country with one flag and three current languages ?
On this site, an example of child theme based on twentyten is provided.

Why xili-language don’t add a specific UI to have together a post and his translation ?
Because current well designed browsers has tabs and because when you translate, it is recommanded to have two screens and two windows !

Why xili-language don’t include xili-tidy-tags to organize tags according language ?
Because xili-tidy-tags can be used in mono language current websites to organize semantically large quantity of tags.

Why download quantities in WP plugin repository with others are so different ?

The best way to compare is not the total quantity but the peak during updating. And a young history like WP roadmap since version 1.

Why xili-language don’t translate ?

In dev.xiligroup team speaks only less than two languages 😉 but we provide tools to organize and create CMS multilingual and semantic sites…

The original article in WordPress Codex is not very explicit on the subject – one language, one WordPress instantiation ?
WordPress is basically localizable but not multilingual. Current multilingual plugin works inside one instantiation of WP and all posts are in the same website. To adapt the behavior, the process to switch between languages can be very complex with a lot of hooks and API to translate the terms of theme and widget… With avaibilility of WP network since version 3.0, a new elegant solution is possible… it is why xili-language premium is born : see this post which presents the main features.

How to choose multilingual plugins ?
Like a house or a car… according the features you want, the reversibility, the sustainability… and with understanding how it is developed and how the data model is conserved or modified…

Any other questions ? Use form below or forum !

Michel of dev.xiligroup

Publié dans Experts corner, Studies, xili-language, xili-tidy-tags | Marqué avec , , , | Laisser un commentaire

Alimenter un site WordPress à partir d’un autre site WP avec le protocole XMLRPC…

Cet article (rédigé en anglais comme ses codes source en exemple) décrit une extension

  • qui utilise l’ensemble des bibliothèques xmlrpc maintenant disponibles dans WP depuis la version 3.1.x
  • qui permet de publier un clone de l’article originel sur un autre site WP…

C’est un exemple assez simple destiné aux webmestres ayant des connaissances en php et en source WP mais qui contient quelques astuces…

Publié dans Experts corner, News | Laisser un commentaire

feed one WordPress site with post from another WP using xmlrpc protocol

To begin…
This post is published to relate recent experiments with xmlrpc protocol now fully available in WordPress (version >3.1) source code (server and client like desktop clients listed in codex).
Researchs on other tests on web were not fully successful because some posts are incomplete or too old according recent adds in WP code and specially about processes to sent media and attach it to remote post.

The context

One master (local) WP site and a target (remote) WP site where to send a post (or a part of this) when published locally.

Technical context

  • WordPress 3.1.3 on both sites and error.log available on both servers…
  • One website named local containing a plugin working as a xmlrpc client : the purpose of this article.
  • Another target site named remote accepting xmlrpc input (and login/pass with editing capabilities).
  • TIPS : to test use the error_log ( ‘message’) php function (and not echo or print_r) !

The testing process

We will create a small plugin without admin UI. When a local post is published, a remote post is created through xmlrpc with his attachment copied to target site. On local post a custom field is added and contains the ID of the post on the remote site.

This process is simple and can fully improved with, by example, cron tasks with sub-selection.

By traveling inside the source code, you will discover some tips and tricks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/*
Plugin Name: xili-xmlrpc
Plugin URI: http://dev.xiligroup.com/
Description: xili-xmlrpc is a tool to post from one site to another.
Author: dev.xiligroup.com - MS
Version: 0.5.0
Author URI: http://dev.xiligroup.com
*/
 
 
define('XILIXMLRPC_VER','0.5.0'); /* used in admin UI */
 
include_once(ABSPATH . WPINC . '/class-IXR.php'); /* not included in wp-settings */
include_once(ABSPATH . WPINC . '/class-wp-http-ixr-client.php'); /* not included in wp-settings */
 
/**
 * Class without admin UI
 *
 */
class xili_xmlrpc {
 
	var $test_url = 'http://subdomain.domain.tld/xmlrpc.php';
	var $remote_login = 'adlog';
	var $remote_passwd = 'thepasswd';
	var $remote_server = 'remoteslug'; // shortname used in custom field
 
	var $currentrequest = null;
	var $currentdate = true; // option to update target/remote date with now !
 
	/**
	 * hook when post is published - minimum for test
	 *
	 */
	function xili_xmlrpc () {
		add_action( 'publish_post', array( &$this,'send_post_to') );
	}

The start of the source code is easy readable.
The first function is the hook when a post is published and now the function fired :

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
	/**
	 * function fired when a post is published
	 *
	 * @param post ID
	 *
	 */
	function send_post_to ( $post_id ) {
 
		$to_post_id = get_post_meta ( $post_id , $this->remote_server, true );
 
		$this -> create_remote_categories_if ( $post_id );
 
		if ( $to_post_id > 0 ) { // mise à jour
			$remote_id = $this->edit_post_to ( $post_id ); /* not used now */
 
		} else {
			$guids = $this->send_attachments ( $post_id );
			$remote_id = $this->new_post_to ( $post_id ) ;
			if ( $remote_id ) {
			 		update_post_meta ( $post_id , $this->remote_server, $this->currentrequest ) ;
			}
			// update content after changing attachment url
			if ( $guids ) {	
				//error_log ( '- array -');
				$remote_id = $this->edit_post_to ( $post_id, $guids ); // create attachments link to parent in remote
			}
			// get attached medias
			$medias = $this->get_attached_medias ( $post_id , 'image') ;
			$remote_images = array();
			if ( $medias ) { //print_r( $medias );
				// create remote links of medias images
				foreach ( $medias as $oneimage ) {
					$remote_images[] = array ( 
					'link' => $oneimage['link'], 
					'file' => $oneimage['metadata']['file'], 
					'thumbnail' => array ( 'link' => $oneimage['thumbnail'], 
											'file' => $oneimage['metadata']['sizes']['thumbnail']['file'] ), 
					'medium' => array ('file' => $oneimage['metadata']['sizes']['medium']['file'] ), 
					'post-thumbnail' => array('file' => $oneimage['metadata']['sizes']['post-thumbnail']['file'] )   
					);
				}
				// synchronize 
				$search = array(); //local remaining link
				$replace = array();
				foreach ( $guids as $one_id => $one_attachment ) {
 
					foreach ( $remote_images as $oneimage ) {
						if ( $one_attachment['remote'] == $oneimage['link'] ) { //error_log ( '----> '.$oneimage['link'] );
							$remote_folder = str_replace ($oneimage['thumbnail']['file'], "", $oneimage['thumbnail']['link'] );
 
							$replace[] = $remote_folder.$oneimage['medium']['file']; //error_log ( '---med replace-> '.$remote_folder.$oneimage['medium']['file'] );
							$src_m = wp_get_attachment_image_src($one_id, 'medium');
							$search[] = $src_m[0]; // error_log ( '---med search-> '.$src_m[0] );
							$replace[] = $oneimage['thumbnail']['link'];
							$src = wp_get_attachment_image_src($one_id, 'thumbnail');  
							$search[] = $src[0];
						}
					}	
				}
				if ( $replace ) {	
				    // error_log ( '- array replace -');
					$remote_id = $this->edit_post_to ( $post_id, $guids, array ('search' => $search, 'replace' => $replace) );
				}
			}
 
		}
		// send the attachments
 
	}

In this main function, the step by step tips when creating a new remote one is :
Send the attachment BEFORE the new post containing link in content to attachment. (if the content don’t contain media links, attachments (child to parent) are impossible.
Create the new post,
Save the remote ID inside custom field of the local post,
Attach medias links in the content of the remote post.
After doing a fitting table of links inside contents (local and remote): updating remote content of post.

Other functions used by the main presented above :

A new post is created on remote with datas from local one (the links (src or…) inside content are not yet updated and link to local wp site:

140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
	/**
	 * Create a new remote post from a local one
	 *
	 * @param local post ID
	 *
	 */
	function new_post_to ( $post_id ) {
 
		$rpc = new WP_HTTP_IXR_Client( $this->test_url );
		$original_post = & get_post ($id = $post_id);
 
		$post = array(
		    'title' => $original_post->post_title,
		    'categories' => wp_get_object_terms($post_id, 'category', array('fields'=>'names') ),
		    'mt_keywords' => wp_get_object_terms($post_id, 'post_tag', array('fields'=>'names') ),
		    'description' => $original_post->post_content,
		    'wp_slug' => $original_post->post_name
		);
 
		$params = array(
		    0,
		    $this->remote_login,
		    $this->remote_passwd,
		    $post,
		    'publish'
		);
 
		$status = $rpc->query(
			'metaWeblog.newPost',
			$params	
		);
 
		$this->currentrequest = $rpc->getResponse(); 
		return $status; // ID or false
	}

Edit and update the remote post according optional 2nd and 3rd parameters:

176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
/**
	 * edit the local post clone content before to edit the remote one
	 *
	 * @param local ID
	 * @param guids of local images or attachments
	 * @param array of local - remote src or url inside content to proceed search and replace
	 */
	function edit_post_to ( $post_id , $guids = array(), $search_replace = array() ) {
 
		$rpc = new WP_HTTP_IXR_Client( $this->test_url );
		$original_post = & get_post ($id = $post_id);
 
		if ( $guids ) {
			$post_content = $original_post->post_content ;
			foreach ( $guids as $one_id => $one ) {
				$post_content = str_replace ( $one['local'], $one['remote'], $post_content );
			}
			if ( isset( $search_replace ['search']) ) 
				$post_content = str_replace ($search_replace ['search'], $search_replace ['replace'], $post_content);
 
		} else {
			$post_content = $original_post->post_content ;
		}
 
		$post = array(
		    'title' => $original_post->post_title,
		    'categories' => wp_get_object_terms($post_id, 'category', array('fields'=>'names') ),
		    'mt_keywords' => wp_get_object_terms($post_id, 'post_tag', array('fields'=>'names') ),
		    'description' => $post_content,
		    'wp_slug' => $original_post->post_name
		);
 
		if ( $this->currentdate ) {
			$newDate = new IXR_Date(strtotime('now'));
			$post['dateCreated'] =  $newDate;
		}
 
		$to_post_id = get_post_meta ( $post_id , $this->remote_server, true );
 
		if ( $to_post_id > 0 ) {
			$params = array(
		    	$to_post_id,
		    	$this->remote_login,
		    	$this->remote_passwd,
		    	$post,
		    	'publish'
			);
 
			$status = $rpc->query(
				'metaWeblog.editPost',
				$params	
			);
 
		/*
		if(!$status) {
		    echo 'Error [' . $rpc->getErrorCode() . ']: ' . $rpc->getErrorMessage();
		    exit();
		}
		*/
			$request = $rpc->getResponse(); 
 
			return $status; // ID or false
 
		} else {
 
			return false ;
		}
	}

This function must be launched BEFORE a new post containing attachment is created.
Why ?
Because the xmlrpc server process analyze the content of the post (links inside) and yet don’t use the parent/child way.

245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
/** 
	 * create a remote attachment
	 * use metaWeblog.newMediaObject
	 */
	function send_attachments ( $post_id ) {
 
		// get_attachments
		$attachments = & get_children( array(
			'post_parent' => $post_id,
    		'post_type'   => 'attachment',
			) 
		);
		if ( $attachments != array() ) {
 
			$rpc = new WP_HTTP_IXR_Client( $this->test_url );
			$to_post_id = get_post_meta ( $post_id , $this->remote_server, true );
			// 
			$guids = array();
			foreach ( $attachments as $attachment_id => $attachment ) {
 
 
 
				$params = array(
						0,
				    	$this->remote_login,
				    	$this->remote_passwd,
				    	array( 
				    		'name' => basename( get_attached_file( $attachment_id ) ), //$attachment->post_title,
							'type' => $attachment->post_mime_type,
							'bits' => new IXR_Base64 ( file_get_contents ( get_attached_file( $attachment_id ) ) )  // get_attached_file( $attachment_id)
						)
					);
 
				//error_log ('***'.$params[3]['bits']->getXml() );
				$status = $rpc->query(
						'metaWeblog.newMediaObject',
						$params	
					);
				if(!$status) {
		    			error_log ( 'Error [' . $rpc->getErrorCode() . ']: ' . $rpc->getErrorMessage() );
					}	
				if ( $status ) {
 
					$request = $rpc->getResponse(); //error_log( print_r( $request ) );
					$guids[$attachment_id] = array( 'local' => $attachment->guid, 'remote' => $request['url'] );
						error_log ( $request['url'] );
 
 
					/*
 
					*/
				}
 
			}
 
			return $guids;
		}	
 
		return array();	
	}

Used to collect remote infos about attachments sent to target WP site.

	/**
	 * get attached medias
	 *
	 *
	 *
	 */
	function get_attached_medias ( $post_id = 0, $mime_type = '' ) {
 
		$rpc = new WP_HTTP_IXR_Client( $this->test_url );
		$remote_post_id = get_post_meta ( $post_id , $this->remote_server, true );
 
		// get recent
		$params = array(
			0,
	    	$this->remote_login,
	    	$this->remote_passwd,
	    	array(
	    	'mime_type' => $mime_type,
	    	'parent_id' => $remote_post_id
		)
		);
 
		$status = $rpc->query(
			'wp.getMediaLibrary',
			$params	
		);
		if ( $status ) {
			$requestattach = $rpc->getResponse(); //print_r($requestattach);
 
			return $requestattach ;
			//$guids[$attachment_id] = array( 'local' => $attachment->guid, 'remote' => $requestattach[0]['link'] );
			error_log ( $requestattach[0]['link'] );
		}
		if(!$status) {
   			error_log ( 'Error [' . $rpc->getErrorCode() . ']: ' . $rpc->getErrorMessage() );
		}
		return array();
	}

Before ending the class of the plugin, a function that create categories on remote site if they not exists. Here in the example, we copy without choice the categories. but on a final release or for the special way of publishing, it is forecast to sub-select or to use a translation table.

345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
	/** 
	 * If remote category don't exist, create it
	 *
	 */
	function create_remote_categories_if ( $post_id ) {
 
		$thecats = wp_get_object_terms($post_id, 'category', array('fields'=>'names') ) ;
 
		$rpc = new WP_HTTP_IXR_Client( $this->test_url );
 
		$params = array(
				0,
		    	$this->remote_login,
		    	$this->remote_passwd
			);
 
		$status = $rpc->query(
				'metaWeblog.getCategories',
				$params	
			);
		if ( $status ) {
 
			$request = $rpc->getResponse();
 
			//print_r( $request );
 
			$remotecatsnames = array();
			foreach ( $request as $remotecategory ) {
 
				$remotecatsnames[] =  $remotecategory ['categoryName'] ;
			}
 
			foreach ( $thecats as $onecatname ) { // error_log ( $onecatname ) ;
 
				if ( !in_array ( $onecatname,  $remotecatsnames ) ) { //error_log ( $onecatname ) ;
					$params = array(
						0,
		    			$this->remote_login,
		    			$this->remote_passwd,
		    			array("name" => $onecatname)
					);
 
					$status = $rpc->query(
						'wp.newCategory',
						$params	
					);
					if(!$status) {
		    			error_log ( 'Error [' . $rpc->getErrorCode() . ']: ' . $rpc->getErrorMessage() );
					}
					if ( $status )  error_log ( $onecatname ) ;
 
				}
			}
		}
	}
 
} // end class
 
/**
 * plugin class instantiation
 *
 */
$xili_xmlrpc = new xili_xmlrpc ();

When the plugin is activated, and when a post is published in the local WP containing the plugin with right parameters, a post is created on the remote WP.

And for annexe, a function to get a remote post not yet used because, in the test, we only create a new post but don’t modify it after the first creating process including attachements (if exists).

110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
	/**
	 * get_post from remote with his remote ID
	 *
	 */
	function get_post_from ( $post_id ) { // 
 
		$rpc = new WP_HTTP_IXR_Client( $this->test_url );
 
		$params = array(
		    $post_id,
		    $this->remote_login,
		    $this->remote_passwd,
		);
 
		$status = $rpc->query(
			'metaWeblog.getPost',
			$params		
		);
 
		if(!$status) {
		    //echo 'Error [' . $rpc->getErrorCode() . ']: ' . $rpc->getErrorMessage();
		    //exit();
		    return false;
		} else {
			$request = $rpc->getResponse();
			return $request ;
		}
		//print_r($request);
	}

Infos for readers :
Around one day to go deep in xmlrpc processes and functions in WP Source Code.
Around two hours to write this post.

Enjoy it !

Michel of dev.xiligroup team

Publié dans Experts corner, News, Studies | Marqué avec , , | 7 commentaires

L’extension diaporama xili-floom-slideshow mise à jour

La mise à jour de l’extension 0.9.7 pour diaporama avec le javascript floom concerne :

  • la prise en compte de la façon sont créées la colonne post_name lors du téléchargement des images (depuis la 3.0, le champ TIFF (image description) est utilisée. Cela peut donc influencer la sous-sélection via le champ personnalisé ‘floom_subname’. Il est donc possible dans les réglages de choisir la colonne où le LIKE de la requête fera effet.
  • Le code source est revu en mode OOP. (Object Oriented Programming)

Utilisez le forum pour relater expériences ou questions.

Publié dans xili-plugins | Marqué avec , , , | Laisser un commentaire