Code source pour générer une url propre avec sh404sef pour le composant phoca gallery
On traite l'essentiel des entrées du controller pour l'affichage. Il faut rajouter la gestion des $task si vous utilisez les formulaires utilisateurs.
Donc pour les catégories de phoca gallery avec sh404sef il faut créer deux fichiers :
fichier de langue com_phocagallery.php dans /administrator/components/com_sh404sef/language/plugins/
<?php
if (!defined('_JEXEC')) die('Direct Access to this location is not allowed.');
// {shSourceVersionTag: Version x - 2007-09-20}
// français
$sh_LANG['fr']['_COM_SEF_PHOCAGALLERY'] = 'photographies';
$sh_LANG['fr']['_COM_SEF_USERPANEL'] = 'Panneau utilisateur';
$sh_LANG['fr']['_COM_SEF_3D'] = 'Vue 3D';
$sh_LANG['en']['_COM_SEF_PHOCAGALLERY'] = 'pictures';
$sh_LANG['en']['_COM_SEF_USERPANEL'] = 'User panel';
$sh_LANG['en']['_COM_SEF_3D'] = '3D view';
?>
fichier de plugins com_phocagallery.php dans/components/com_sh404sef/sef_ext
<?php
/**
* sh404SEF support for com_phocagallery component.
* Author : nl
* contact : nico@24bis.com
*
* {shSourceVersionTag: Version 1.01 - 2009-11-22}
*
* This is a sample sh404SEF native plugin file
*
*/
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' );
// ------------------ standard plugin initialize function - don't change ---------------------------
global $sh_LANG;
$sefConfig = & shRouter::shGetConfig();
$shLangName = '';
$shLangIso = '';
$title = array();
$shItemidString = '';
$dosef = shInitializePlugin( $lang, $shLangName, $shLangIso, $option);
if ($dosef == false) return;
// ------------------ standard plugin initialize function - don't change ---------------------------
// ------------------ load language file - adjust as needed ----------------------------------------
$shLangIso = shLoadPluginLanguage( 'com_phocagallery', $shLangIso, '_COM_SEF_PHOCAGALLERY');
// ------------------ load language file - adjust as needed ----------------------------------------
// remove common URL from GET vars list, so that they don't show up as query string in the URL
shRemoveFromGETVarsList('option');
shRemoveFromGETVarsList('lang');
if (!empty($Itemid))
shRemoveFromGETVarsList('Itemid');
$task = isset($task) ? @$task : null;
$Itemid = isset($Itemid) ? @$Itemid : null;
$id = isset($id) ? @$id : null;
if (!function_exists('getallcat')) {
function getallcat($id,&$listcat){
global $option,$shLangName;
$database =& JFactory::getDBO();
$sefConfig = & shRouter::shGetConfig();
if ($id){
$q = 'SELECT id, title, parent_id FROM #__phocagallery_categories WHERE id = '.$id;
$database->setQuery($q);
$value = $database->loadObject( ((shTranslateUrl($option, $shLangName)) ? true:false) ); //get it in the right language
if (is_object($value)){
if ($value->parent_id != 0){
getallcat($value->parent_id,$listcat);
}
$listcat[] = $value->title;
}
}
return $listcat;
}
}
switch ($view) {
case "cooliris3dwall"://vue 3dwallaper
$title[] = $sh_LANG[$shLangIso]['_COM_SEF_PHOCAGALLERY'];
shRemoveFromGETVarsList('view');
break;
case "user"://vue user panel
$title[] = $sh_LANG[$shLangIso]['_COM_SEF_PHOCAGALLERY'];
shRemoveFromGETVarsList('view');
break;
case "category": //une seule
case "categories"://plusieurs
default:
$title[] = $sh_LANG[$shLangIso]['_COM_SEF_PHOCAGALLERY'];
if (!empty($id)) {
$title = getallcat($id,$title);
shRemoveFromGETVarsList('id');
}
shRemoveFromGETVarsList('view');
break;
}
$title[] = '/';
// ------------------ standard plugin finalize function - don't change ---------------------------
if ($dosef){
$string = shFinalizePlugin( $string, $title, $shAppendString, $shItemidString,
(isset($limit) ? @$limit : null), (isset($limitstart) ? @$limitstart : null),
(isset($shLangName) ? @$shLangName : null));
}
// ------------------ standard plugin finalize function - don't change ---------------------------
?>