Changeset 48502 in spip-zone
- Timestamp:
- Jun 6, 2011, 11:31:22 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/svp/svp_fonctions.php
r48486 r48502 121 121 } 122 122 123 function svp_compter_telechargements($id_depot=0, $categorie='', $ branche_spip=''){124 $total = svp_compter('paquet', $id_depot, $categorie, $ branche_spip);123 function svp_compter_telechargements($id_depot=0, $categorie='', $compatible_spip=''){ 124 $total = svp_compter('paquet', $id_depot, $categorie, $compatible_spip); 125 125 $info = _T('svp:info_paquets_disponibles', array('total_paquets'=>$total['paquet'])); 126 126 return $info; … … 148 148 } 149 149 150 function svp_compter_plugins($id_depot=0, $categorie='', $ branche_spip='') {151 $total = svp_compter('plugin', $id_depot, $categorie, $ branche_spip);150 function svp_compter_plugins($id_depot=0, $categorie='', $compatible_spip='') { 151 $total = svp_compter('plugin', $id_depot, $categorie, $compatible_spip); 152 152 $info = _T('svp:info_plugins_disponibles', array('total_plugins'=>$total['plugin'])); 153 153 return $info; 154 154 } 155 155 156 function svp_compter($entite, $id_depot=0, $categorie='', $branche_spip=''){ 156 // Attention le criter de compatibilite spip pris en compte est uniquement celui d'une branche SPIP 157 function svp_compter($entite, $id_depot=0, $categorie='', $compatible_spip=''){ 157 158 $compteurs = array(); 158 159 … … 167 168 if ($categorie) 168 169 $where[] = "t2.categorie=" . sql_quote($categorie); 169 if ($branche_spip) { 170 $lister_compatibles = charger_fonction('svp_lister_compatibles', 'inc'); 171 $where[] = sql_in('t2.id_plugin', $lister_compatibles($branche_spip, 'plugins', 'id_plugin', 'tableau')); 170 if ($compatible_spip) { 171 $where[] = "LOCATE($compatible_spip, t2.branches_spip)>0"; 172 172 } 173 173 $compteurs['plugin'] = sql_count(sql_select('t2.id_plugin', $from, $where)); … … 179 179 $where[] = sql_in('t1.id_plugin', $ids); 180 180 } 181 if ($branche_spip) { 182 $lister_compatibles = charger_fonction('svp_lister_compatibles', 'inc'); 183 $ids = $lister_compatibles($branche_spip, 'paquets', 'id_paquet', 'tableau'); 184 $where[] = sql_in('t1.id_paquet', $ids); 181 if ($compatible_spip) { 182 $where[] = "LOCATE($compatible_spip, t1.branches_spip)>0"; 185 183 } 186 184 $compteurs['paquet'] = sql_countsel('spip_paquets AS t1', $where); … … 198 196 $ids = sql_allfetsel('id_plugin', 'spip_depots_plugins AS t1', $where); 199 197 $ids = array_map('reset', $ids); 200 }201 if ($branche_spip) {202 $lister_compatibles = charger_fonction('svp_lister_compatibles', 'inc');203 $ids_compat = $lister_compatibles($branche_spip, 'plugins', 'id_plugin', 'tableau');204 $ids = $ids ? array_intersect($ids, $ids_compat) : $ids_compat;205 }206 if ($id_depot OR $branche_spip)207 198 $where[] = sql_in('t2.id_plugin', $ids); 208 199 } 200 if ($compatible_spip) { 201 $where[] = "LOCATE($compatible_spip, t2.branches_spip)>0"; 202 } 209 203 if ($categorie) 210 204 $where[] = "t2.categorie=" . sql_quote($categorie);
Note: See TracChangeset
for help on using the changeset viewer.