Changeset 2295
- Timestamp:
- 06/05/10 18:59:11 (13 years ago)
- Location:
- plugins/popularityContest
- Files:
-
- 1 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/popularityContest/_admin.php
r1569 r2295 2 2 # ***** BEGIN LICENSE BLOCK ***** 3 3 # 4 # This file is part of Popularity Contest .5 # Copyright 2007,2009Moe (http://gniark.net/)4 # This file is part of Popularity Contest, a plugin for Dotclear 2 5 # Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 6 6 # 7 # Popularity Contest is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 3 of the License, or 10 # (at your option) any later version. 7 # Popularity Contest is free software; you can redistribute it and/or 8 # modify it under the terms of the GNU General Public License v2.0 9 # as published by the Free Software Foundation. 11 10 # 12 11 # Popularity Contest is distributed in the hope that it will be useful, 13 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 14 # GNU General Public License for more details. 16 15 # 17 # You should have received a copy of the GNU General Public License 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 16 # You should have received a copy of the GNU General Public 17 # License along with this program. If not, see 18 # <http://www.gnu.org/licenses/>. 19 19 # 20 # Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 20 # Icon (icon.png) and images are from Silk Icons : 21 # <http://www.famfamfam.com/lab/icons/silk/> 21 22 # 22 23 # ***** END LICENSE BLOCK ***** -
plugins/popularityContest/_define.php
r1577 r2295 2 2 # ***** BEGIN LICENSE BLOCK ***** 3 3 # 4 # This file is part of Popularity Contest .5 # Copyright 2007,2009Moe (http://gniark.net/)4 # This file is part of Popularity Contest, a plugin for Dotclear 2 5 # Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 6 6 # 7 # Popularity Contest is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 3 of the License, or 10 # (at your option) any later version. 7 # Popularity Contest is free software; you can redistribute it and/or 8 # modify it under the terms of the GNU General Public License v2.0 9 # as published by the Free Software Foundation. 11 10 # 12 11 # Popularity Contest is distributed in the hope that it will be useful, 13 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 14 # GNU General Public License for more details. 16 15 # 17 # You should have received a copy of the GNU General Public License 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 16 # You should have received a copy of the GNU General Public 17 # License along with this program. If not, see 18 # <http://www.gnu.org/licenses/>. 19 19 # 20 # Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 20 # Icon (icon.png) and images are from Silk Icons : 21 # <http://www.famfamfam.com/lab/icons/silk/> 21 22 # 22 23 # ***** END LICENSE BLOCK ***** … … 28 29 /* Description*/ "Dotclear Popularity Contest (http://popcon.gniark.net/)", 29 30 /* Author */ "Moe (http://gniark.net/)", 30 /* Version */ '1. 3',31 /* Version */ '1.4', 31 32 /* Permissions */ null 32 33 ); -
plugins/popularityContest/_install.php
r1577 r2295 2 2 # ***** BEGIN LICENSE BLOCK ***** 3 3 # 4 # This file is part of Popularity Contest .5 # Copyright 2007,2009Moe (http://gniark.net/)4 # This file is part of Popularity Contest, a plugin for Dotclear 2 5 # Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 6 6 # 7 # Popularity Contest is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 3 of the License, or 10 # (at your option) any later version. 7 # Popularity Contest is free software; you can redistribute it and/or 8 # modify it under the terms of the GNU General Public License v2.0 9 # as published by the Free Software Foundation. 11 10 # 12 11 # Popularity Contest is distributed in the hope that it will be useful, 13 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 14 # GNU General Public License for more details. 16 15 # 17 # You should have received a copy of the GNU General Public License 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 16 # You should have received a copy of the GNU General Public 17 # License along with this program. If not, see 18 # <http://www.gnu.org/licenses/>. 19 19 # 20 # Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 20 # Icon (icon.png) and images are from Silk Icons : 21 # <http://www.famfamfam.com/lab/icons/silk/> 21 22 # 22 23 # ***** END LICENSE BLOCK ***** … … 56 57 $core->blog->settings->setNameSpace('system'); 57 58 59 # remove the file to force its update 60 if (file_exists(dirname(__FILE__).'/xml/plugins.xml')) 61 { 62 unlink(dirname(__FILE__).'/xml/plugins.xml'); 63 } 64 58 65 # La procédure d'installation commence vraiment là 59 66 $core->setVersion('popularityContest',$m_version); -
plugins/popularityContest/inc/lib.popularityContest.php
r1779 r2295 2 2 # ***** BEGIN LICENSE BLOCK ***** 3 3 # 4 # This file is part of Popularity Contest. 5 # Copyright 2007,2009 Moe (http://gniark.net/) 6 # 7 # Popularity Contest is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 3 of the License, or 10 # (at your option) any later version. 4 # This file is part of Popularity Contest, a plugin for Dotclear 2 5 # Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 6 # 7 # Popularity Contest is free software; you can redistribute it and/or 8 # modify it under the terms of the GNU General Public License v2.0 9 # as published by the Free Software Foundation. 11 10 # 12 11 # Popularity Contest is distributed in the hope that it will be useful, 13 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 14 # GNU General Public License for more details. 16 15 # 17 # You should have received a copy of the GNU General Public License 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 # 20 # Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 16 # You should have received a copy of the GNU General Public 17 # License along with this program. If not, see 18 # <http://www.gnu.org/licenses/>. 19 # 20 # Icon (icon.png) and images are from Silk Icons : 21 # <http://www.famfamfam.com/lab/icons/silk/> 21 22 # 22 23 # ***** END LICENSE BLOCK ***** … … 25 26 { 26 27 public static $send_url = 'http://popcon.gniark.net/send.php'; 27 public static $plugins_xml_url = 'http://popcon.gniark.net/raw .xml';28 public static $plugins_xml_url = 'http://popcon.gniark.net/raw2.xml'; 28 29 29 30 public static function getComboOptions() … … 124 125 $plugins_XML = self::getPluginsXML(); 125 126 126 $show_popularity = false; 127 128 if (($plugins_XML !== false)) 129 { 130 $show_popularity = true; 131 132 $attr = $plugins_XML->attributes(); 133 134 $plugins_popularity = array(); 127 $show_data = false; 128 129 $plugins_data = array(); 130 131 if ($plugins_XML !== false) 132 { 133 $show_data = true; 135 134 136 135 # inspired by daInstaller/inc/class.da.modules.parser.php … … 140 139 141 140 $id = (string) $attrs['id']; 142 $name = (string) $attrs['name']; 143 $popularity = (string) $attrs['popularity']; 141 $name = (string) $p->name; 142 $url = (string) $p->url; 143 $popularity = (int) $p->popularity; 144 144 145 $plugins_popularity[$id] = array( 146 'name' => $name, 145 $plugins_data[$id] = array( 146 //'name' => $name, 147 'url' => $url, 147 148 'popularity' => $popularity 148 149 ); … … 166 167 $table->header(__('Name'),'class="nowrap"'); 167 168 $table->header(__('Version'),'class="nowrap"'); 168 if ($show_ popularity) {$table->header(__('Popularity'),'class="nowrap"');}169 if ($show_data) {$table->header(__('Popularity'),'class="nowrap"');} 169 170 170 171 $table->part('body'); 171 172 172 foreach ($array as $k => $v) 173 { 174 $table->row(); 173 foreach ($array as $id => $v) 174 { 175 $icon = (file_exists($v['root'].'/icon.png')) ? 176 '<img src="index.php?pf='.$id.'/icon.png" style="height:16px;" alt="" />' : ''; 177 178 $name = $v['name']; 179 180 $popularity = ' '; 181 182 if ($show_data && (isset($plugins_data[$id]))) 183 { 184 $url = $plugins_data[$id]['url']; 185 186 if (!empty($url)) 187 { 188 $name = '<a href="'.$url.'">'.$name.'</a>'; 189 } 190 191 if ($plugins_data[$id]['popularity'] >= 0) 192 { 193 $popularity = $plugins_data[$id]['popularity'].' %'; 194 } 195 } 196 197 # display 198 $table->row('class="line"'); 199 175 200 if ($editable) 176 201 { 177 $table->cell(form::checkbox(array('hidden_plugins[]'),$k, 178 in_array($k,$hidden_plugins))); 179 } 180 $icon = (file_exists($v['root'].'/icon.png')) ? 181 '<img src="index.php?pf='.$k.'/icon.png" style="height:16px;" alt="" />' : ''; 202 $table->cell(form::checkbox(array('hidden_plugins[]'),$id, 203 in_array($id,$hidden_plugins))); 204 } 182 205 $table->cell($icon); 183 $table->cell($ k);184 $table->cell($ v['name']);206 $table->cell($id); 207 $table->cell($name); 185 208 $table->cell($v['version']); 186 209 187 if ($show_popularity) { 188 $popularity = ' '; 189 if (array_key_exists($k,$plugins_popularity)) 190 { 191 $popularity = $plugins_popularity[$k]['popularity'].'%'; 192 } 193 $table->cell($popularity); 210 if ($show_data) { 211 $table->cell($popularity,'class="right"'); 194 212 } 195 213 } … … 243 261 $dir = dirname($file); 244 262 263 files::makeDir($dir); 264 245 265 if (!is_writable($dir)) 246 266 { … … 270 290 } 271 291 } 292 293 # create table 294 public static function getResultsTable() 295 { 296 global $core,$hidden_plugins; 297 298 $plugins_XML = self::getPluginsXML(); 299 300 if ($plugins_XML === false) {return;} 301 302 $table = new table('class="clear" summary="'. 303 __('Plugins:').'"'); 304 $table->part('head'); 305 $table->row(); 306 $table->header(__('Icon'),'class="nowrap"'); 307 $table->header(__('Plugin'),'class="nowrap"'); 308 $table->header(__('Name'),'class="nowrap"'); 309 $table->header(__('Installed'),'class="nowrap"'); 310 $table->header(__('Popularity'),'class="nowrap"'); 311 312 $table->part('body'); 313 314 foreach ($plugins_XML->plugin as $plugin) 315 { 316 $table->row('class="line"'); 317 318 $attrs = $plugin->attributes(); 319 320 $id = (string) $attrs['id']; 321 322 $moduleExists = $core->plugins->moduleExists($id); 323 324 $icon = ''; 325 if ($moduleExists) 326 { 327 $icon = '<img src="index.php?pf='.$id.'/icon.png" style="height:16px;" alt="" />'; 328 } 329 330 $name = (string) $plugin->name; 331 332 $url = (string) $plugin->url; 333 334 if (!empty($url)) 335 { 336 $name = '<a href="'.$url.'">'.$name.'</a>'; 337 } 338 339 $installed = (($moduleExists) 340 ? '<img src="images/check-on.png" alt="'.__('yes').'" />' 341 : ''); 342 343 $popularity = (int) $plugin->popularity; 344 if ($popularity >= 0) 345 { 346 $popularity .= ' %'; 347 } 348 349 # display 350 $table->cell($icon,'class="icon"'); 351 $table->cell($id); 352 $table->cell($name); 353 $table->cell($installed); 354 $table->cell($popularity,'class="right"'); 355 } 356 357 return($table->get()); 358 } 272 359 } 273 360 -
plugins/popularityContest/index.php
r1577 r2295 2 2 # ***** BEGIN LICENSE BLOCK ***** 3 3 # 4 # This file is part of Popularity Contest. 5 # Copyright 2007,2009 Moe (http://gniark.net/) 6 # 7 # Popularity Contest is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 3 of the License, or 10 # (at your option) any later version. 4 # This file is part of Popularity Contest, a plugin for Dotclear 2 5 # Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 6 # 7 # Popularity Contest is free software; you can redistribute it and/or 8 # modify it under the terms of the GNU General Public License v2.0 9 # as published by the Free Software Foundation. 11 10 # 12 11 # Popularity Contest is distributed in the hope that it will be useful, 13 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 14 # GNU General Public License for more details. 16 15 # 17 # You should have received a copy of the GNU General Public License 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 # 20 # Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 16 # You should have received a copy of the GNU General Public 17 # License along with this program. If not, see 18 # <http://www.gnu.org/licenses/>. 19 # 20 # Icon (icon.png) and images are from Silk Icons : 21 # <http://www.famfamfam.com/lab/icons/silk/> 21 22 # 22 23 # ***** END LICENSE BLOCK ***** … … 28 29 $settings =& $core->blog->settings; 29 30 30 $msg = (string)''; 31 $errors = array(); 31 $msg = ''; 32 32 $tab = 'popularityContest'; 33 $tab = 'results'; 33 34 34 35 $time_interval_last_try = … … 122 123 dcPage::jsLoad('js/filter-controls.js')); 123 124 ?> 125 <style type="text/css"> 126 /*tr:hover {background:#eee none;}*/ 127 .icon {text-align:center;} 128 .default {background:transparent url(/images/template/default.png) repeat;} 129 .popularityContest {background:transparent url(/images/template/popularityContest.png) repeat;} 130 </style> 124 131 </head> 125 132 <body> … … 169 176 <p><?php echo $core->formNonce(); ?></p> 170 177 </form> 171 <p><a href="http://popcon.gniark.net/"><?php echo(__('Click here to see results.')); ?></a></p> 172 <h2><?php echo(__('Plugins:')); ?></h2> 178 <h3><?php echo(__('Installed plugins:')); ?></h3> 173 179 <?php echo(popularityContest::getPluginsTable()); ?> 174 180 </div> … … 196 202 </div> 197 203 204 <div class="multi-part" id="results" title="<?php echo __('results'); ?>"> 205 <p><a href="http://popcon.gniark.net/"><?php echo(__('Click here to see results.')); ?></a></p> 206 <h3><?php echo(__('Plugins:')); ?></h3> 207 <?php echo(popularityContest::getResultsTable()); ?> 208 </div> 209 198 210 </body> 199 211 </html> -
plugins/popularityContest/locales/fr/admin.lang.php
r1574 r2295 116 116 $GLOBALS['__l10n']['Save configuration'] = 'Enregistrer la configuration'; 117 117 118 $GLOBALS['__l10n']['results'] = 'résultats'; 119 120 118 121 ?> -
plugins/popularityContest/locales/fr/admin.po
r1779 r2295 162 162 msgstr "Enregistrer la configuration" 163 163 164 msgid "results" 165 msgstr "résultats"
Note: See TracChangeset
for help on using the changeset viewer.