Dotclear

source: plugins/rateIt/index.php @ 1301

Revision 1301, 21.7 KB checked in by JcDenis, 14 years ago (diff)

rateIt 0.4:

  • changed database rateit_id to allow text id
  • fixed some js bugs
  • fixed translation
  • Added option to edit thank msg
  • Added cookie and/or ip option
  • Added images choice
  • Added some options to widget
  • Added extension ability
  • Added import/export support
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of rateIt, a plugin for Dotclear 2.
4#
5# Copyright (c) 2009 JC Denis and contributors
6# jcdenis@gdwd.com
7#
8# Licensed under the GPL version 2.0 license.
9# A copy of this license is available in LICENSE file or at
10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11#
12# -- END LICENSE BLOCK ------------------------------------
13
14if (!defined('DC_CONTEXT_ADMIN')) return;
15
16/** Init some values **/
17
18$msg = isset($_REQUEST['done']) ? __('Configuration saved') : '';
19$img_green = '<img alt="" src="images/check-on.png" />';
20$img_red = '<img alt="" src="images/check-off.png" />';
21
22$tab = array('about' => __('About'));
23if ($core->auth->check('usage,contentadmin',$core->blog->id))  {
24     $tab['post'] = __('Entries');
25     $tab['details'] = __('Details');
26}
27if ($core->auth->check('admin',$core->blog->id)) 
28     $tab['admin'] = __('Administration');
29if ($core->auth->isSuperAdmin()) 
30     $tab['uninstall'] = __('Uninstall');
31
32$show_filters = false;
33$user_id = !empty($_GET['user_id']) ? $_GET['user_id'] : '';
34$cat_id = !empty($_GET['cat_id']) ? $_GET['cat_id'] : '';
35$status = isset($_GET['status']) ? $_GET['status'] : '';
36$selected = isset($_GET['selected']) ? $_GET['selected'] : '';
37$sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : 'post_dt';
38$order = !empty($_GET['order']) ? $_GET['order'] : 'desc';
39$period = !empty($_GET['period']) ? $_GET['period'] : '';
40
41$page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1;
42$nb_per_page =  30;
43if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) {
44     if ($nb_per_page != $_GET['nb']) $show_filters = true;
45     $nb_per_page = (integer) $_GET['nb'];
46}
47
48$understand = isset($_POST['s']['understand']) ? $_POST['s']['understand'] : 0;
49$delete_table = isset($_POST['s']['delete_table']) ? $_POST['s']['delete_table'] : 0;
50$delete_settings = isset($_POST['s']['delete_settings']) ? $_POST['s']['delete_settings'] : 0;
51
52/** Combo array **/
53
54$combo_action = array();
55if ($core->auth->check('delete,contentadmin',$core->blog->id)) {
56     $combo_action[__('delete rating')] = 'rateit_empty';
57}
58if ($core->auth->check('publish,contentadmin',$core->blog->id)) {
59     $combo_action[__('publish')] = 'publish';
60     $combo_action[__('unpublish')] = 'unpublish';
61     $combo_action[__('schedule')] = 'schedule';
62     $combo_action[__('mark as pending')] = 'pending';
63     $combo_action[__('mark as selected')] = 'selected';
64     $combo_action[__('mark as unselected')] = 'unselected';
65}
66$combo_action[__('change category')] = 'category';
67if ($core->auth->check('admin',$core->blog->id)) {
68     $combo_action[__('change author')] = 'author';
69}
70if ($core->auth->check('delete,contentadmin',$core->blog->id)) {
71     $combo_action[__('delete')] = 'delete';
72}
73
74$categories_combo = array('-'=>'');
75try {
76     $categories = $core->blog->getCategories(array('post_type'=>'post'));
77} catch (Exception $e) {
78     $core->error->add($e->getMessage());
79}
80while ($categories->fetch()) {
81     $categories_combo[str_repeat('&nbsp;&nbsp;',$categories->level-1).'&bull; '.
82          html::escapeHTML($categories->cat_title)] = $categories->cat_id;
83}
84
85$status_combo = array('-' => '');
86foreach ($core->blog->getAllPostStatus() as $k => $v) {
87     $status_combo[$v] = (string) $k;
88}
89
90$selected_combo = array(
91'-' => '',
92__('selected') => '1',
93__('not selected') => '0'
94);
95
96$sortby_combo = array(
97__('Date') => 'post_dt',
98__('Votes') => 'rateit_total',
99__('Note') => 'rateit_note',
100__('Higher') => 'rateit_max',
101__('Lower') => 'rateit_min',
102__('Title') => 'post_title',
103__('Category') => 'cat_title',
104__('Author') => 'user_id',
105__('Status') => 'post_status',
106__('Selected') => 'post_selected'
107);
108
109$order_combo = array(
110__('Descending') => 'desc',
111__('Ascending') => 'asc'
112);
113
114/** "Static" params **/
115
116$params = array();
117$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
118$params['no_content'] = true;
119$params['rateit_type'] = 'post';
120$params['post_type'] = '';
121
122/** Filters **/
123
124if ($cat_id !== '' && in_array($cat_id,$categories_combo)) {
125     $params['cat_id'] = $cat_id;
126     $show_filters = true;
127}
128
129if ($status !== '' && in_array($status,$status_combo)) {
130     $params['post_status'] = $status;
131     $show_filters = true;
132}
133
134if ($selected !== '' && in_array($selected,$selected_combo)) {
135     $params['post_selected'] = $selected;
136     $show_filters = true;
137}
138
139if ($sortby !== '' && in_array($sortby,$sortby_combo)) {
140     if ($order !== '' && in_array($order,$order_combo)) {
141          $params['order'] = $sortby.' '.$order;
142     }   
143     if ($sortby != 'post_dt' || $order != 'desc') {
144          $show_filters = true;
145     }
146}
147
148/** Display **/
149
150$request_tab = isset($_REQUEST['t']) ? $_REQUEST['t'] : '';
151if (!$core->blog->settings->rateit_active && empty($request_tab)) $request_tab = 'admin';
152if ($core->blog->settings->rateit_active && empty($request_tab)) $request_tab = 'post';
153if (empty($request_tab)) $request_tab = 'about';
154
155echo 
156'<html>'.
157'<head>'.
158'<title>'.__('Rate it').'</title>'.
159dcPage::jsLoad('js/_posts_list.js').
160dcPage::jsPageTabs($request_tab).
161'</head>'.
162'<body>'.
163'<h2>'.html::escapeHTML($core->blog->name).' &rsaquo; '.__('Rate it').' &rsaquo; '.$tab[$request_tab].'</h2>'.
164 (!empty($msg) ? '<p class="message">'.$msg.'</p>' : '');
165
166/**************
167** Entries
168**************/
169
170if (isset($tab['post'])) {
171
172     $pager_base_url = $p_url.
173     '&amp;t=post'.
174     '&amp;cat_id='.$cat_id.
175     '&amp;status='.$status.
176     '&amp;selected='.$selected.
177     '&amp;sortby='.$sortby.
178     '&amp;order='.$order.
179     '&amp;nb='.$nb_per_page.
180     '&amp;page=%s';
181
182     try {
183          $rateIt = new rateIt($core);
184          $posts = $rateIt->getPostsByRate($params);
185          $counter = $rateIt->getPostsByRate($params,true);
186          $post_list = new rateItPostsList($core,$posts,$counter->f(0),$pager_base_url);
187     } catch (Exception $e) {
188          $core->error->add($e->getMessage());
189     }
190
191     echo 
192     '<div class="multi-part" id="post" title="'.$tab['post'].'">'.
193     '<p>'.__('This is the list of all entries having rating').'</p>';
194     if (!$show_filters) { 
195          echo dcPage::jsLoad('js/filter-controls.js').'<p><a id="filter-control" class="form-control" href="#">'.__('Filters').'</a></p>';
196     }
197     echo 
198     '<form action="'.$p_url.'" method="get" id="filters-form">'.
199     '<fieldset><legend>'.__('Filters').'</legend>'.
200     '<div class="three-cols">'.
201     '<div class="col">'.
202     '<label>'.__('Category:').form::combo('cat_id',$categories_combo,$cat_id).'</label> '.
203     '<label>'.__('Status:').form::combo('status',$status_combo,$status).'</label> '.
204     '<label>'.__('Selected:').form::combo('selected',$selected_combo,$selected).'</label> '.
205     '</div>'.
206     '<div class="col">'.
207     '<label>'.__('Order by:').form::combo('sortby',$sortby_combo,$sortby).'</label> '.
208     '<label>'.__('Sort:').form::combo('order',$order_combo,$order).'</label>'.
209     '</div>'.
210     '<div class="col">'.
211     '<p><label class="classic">'.form::field('nb',3,3,$nb_per_page).' '.__('Entries per page').'</label> '.
212     '<input type="submit" value="'.__('filter').'" />'.
213     form::hidden(array('p'),'rateIt').
214     form::hidden(array('t'),'post').
215     $core->formNonce().
216     '</p>'.
217     '</div>'.
218     '</div>'.
219     '<br class="clear" />'.
220     '</fieldset>'.
221     '</form>';
222
223     $post_list->display($page,$nb_per_page,
224          '<form action="posts_actions.php" method="post" id="form-actions">'.
225          '%s'.
226          '<div class="two-cols">'.
227          '<p class="col checkboxes-helpers"></p>'.
228          '<p class="col right">'.__('Selected entries action:').' '.
229          form::combo(array('action'),$combo_action).
230          '<input type="submit" value="'.__('ok').'" />'.
231          form::hidden(array('cat_id'),$cat_id).
232          form::hidden(array('status'),$status).
233          form::hidden(array('selected'),$selected).
234          form::hidden(array('sortby'),$sortby).
235          form::hidden(array('order'),$order).
236          form::hidden(array('page'),$page).
237          form::hidden(array('nb'),$nb_per_page).
238          form::hidden(array('redir'),$p_url.'&amp;t=post').
239          $core->formNonce().'</p>'.
240          '</div>'.
241          '</form>'
242     );
243     echo '</div>';
244}
245
246/**************
247** Details
248**************/
249
250if (isset($tab['details']) && isset($_REQUEST['type']) && isset($_REQUEST['id'])) {
251
252     $rateIt = new rateIt($core);
253
254     if (isset($_POST['action']) && $_POST['action'] == 'rateit_del_entry' && !empty($_POST['entries'])) {
255          foreach($_POST['entries'] AS $entry) {
256               $val = explode('|',$entry);
257               $rateIt->del($val[0],$val[1],$val[2]);
258          }
259          http::redirect($p_url.'&t=details&type='.$_REQUEST['type'].'&id='.$_REQUEST['id'].'&done=1');
260     }
261     $rs = $rateIt->getDetails($_REQUEST['type'],$_REQUEST['id']);
262
263     $lines = '';
264     while ($rs->fetch()) {
265          $lines .= 
266          '<tr class="line">'.
267          '<td class="nowrap">'.form::checkbox(array('entries[]'),$rs->rateit_type.'|'.$rs->rateit_id.'|'.$rs->rateit_ip,'','','',false).'</td>'.
268          '<td class="nowrap">'.$rs->rateit_time.'</td>'.
269          '<td class="nowrap">'.$rs->rateit_note.'</td>'.
270          '<td class="nowrap">'.$rs->rateit_quotient.'</td>'.
271          '<td class="nowrap maximal">'.$rs->rateit_ip.'</td>'.
272          '<td class="nowrap">'.$rs->rateit_type.'</td>'.
273          '<td class="nowrap">'.$rs->rateit_id.'</td>'.
274          '</tr>';
275     }
276
277     echo 
278     '<div class="multi-part" id="details" title="'.$tab['details'].'">'.
279     '<p>'.sprintf(__('This is detailed list for rating of type "%s" and id "%s"'),$_REQUEST['type'],$_REQUEST['id']).'</p>'.
280     '<form action="plugin.php" method="post" id="form-details">';
281
282     if ($lines=='') {
283          echo '<p class="message">'.__('There is no rating for this request at this time').'</p>';
284     } else {
285          echo 
286          '<table class="clear"><tr>'.
287          '<th colspan="2">'.__('Date').'</th>'.
288          '<th>'.__('Note').'</th>'.
289          '<th>'.__('Quotient').'</th>'.
290          '<th>'.__('Ip').'</th>'.
291          '<th>'.__('Type').'</th>'.
292          '<th>'.__('Id').'</th>'.
293          '</tr>'.
294          $lines.
295          '</table>';
296     }
297     if ($core->auth->check('delete,contentadmin',$core->blog->id)) {
298          echo 
299          '<div class="two-cols">'.
300          '<p class="col checkboxes-helpers"></p>'.
301          '<p class="col right">'.__('Selected entries action:').' '.
302          form::combo(array('action'),array(__('delete entry') => 'rateit_del_entry')).
303          '<input type="submit" name="save[details]" value="'.__('ok').'" />'.
304          form::hidden(array('p'),'rateIt').
305          form::hidden(array('t'),'details').
306          form::hidden(array('type'),$_REQUEST['type']).
307          form::hidden(array('id'),$_REQUEST['id']).
308          $core->formNonce().
309          '</p>'.
310          '</div>';
311     }
312     echo '
313     </form>
314     </div>';
315}
316
317/**************
318** New tab behavior
319**************/
320
321# --BEHAVIOR-- adminRateItTabs
322$core->callBehavior('adminRateItTabs',$core);
323
324/**************
325** Options
326**************/
327
328if (isset($tab['admin'])) {
329
330     echo '<div class="multi-part" id="admin" title="'.$tab['admin'].'">';
331
332     # Save admin options
333     if (!empty($_POST['save']['admin']) && isset($_POST['s'])) {
334          try {
335               $core->blog->settings->setNamespace('rateit');
336               $core->blog->settings->put('rateit_active',$_POST['s']['rateit_active'],'boolean','rateit plugin enabled',true,false);
337               $core->blog->settings->put('rateit_poststpl',$_POST['s']['rateit_poststpl'],'boolean','rateit template on post',true,false);
338               $core->blog->settings->put('rateit_userident',$_POST['s']['rateit_userident'],'integer','rateit use cookie and/or ip',true,false);
339               $core->blog->settings->put('rateit_quotient',$_POST['s']['rateit_quotient'],'integer','rateit maximum note',true,false);
340               $core->blog->settings->put('rateit_digit',$_POST['s']['rateit_digit'],'integer','rateit note digits number',true,false);
341               $core->blog->settings->put('rateit_msgthanks',$_POST['s']['rateit_msgthanks'],'string','rateit message when voted',true,false);
342
343               # change rate image
344               if (isset($_POST['s']['starsimage']) && preg_match('/^star-[0-9]+.png$/',$_POST['s']['starsimage'])) {
345
346                    $source = dirname(__FILE__).'/default-templates/img/stars/'.$_POST['s']['starsimage'];
347                    $dest = dirname(__FILE__).'/default-templates/img/rateit-stars.png';
348
349                    if (file_exists($source))
350                         file_put_contents($dest,file_get_contents($source));
351               }
352               # Upload rate image
353               if (isset($_POST['s']['starsimage']) && $_POST['s']['starsimage'] == 'user' && $_FILES['starsuserfile']['tmp_name']) {
354
355                    if (0 != $_FILES['starsuserfile']['error'])
356                         throw new Exception(__('Something went wrong while download file'));
357
358                    if ($_FILES['starsuserfile']['type'] != 'image/x-png')
359                         throw new Exception(__('Image must be in png format').$_FILES['starsuserfile']['type']);
360
361                    move_uploaded_file($_FILES['starsuserfile']['tmp_name'],dirname(__FILE__).'/default-templates/img/rateit-stars.png');
362               }
363               $core->blog->triggerBlog();
364               http::redirect($p_url.'&t=admin&done=1');
365          }
366          catch (Exception $e) {
367               $core->error->add($e->getMessage());
368          }
369     }
370
371     $combo_quotient = array();
372     for($i=2;$i<21;$i++){ $combo_quotient[$i] = $i; }
373     $combo_digit = array();
374     for($i=0;$i<5;$i++){ $combo_digit[$i] = $i; }
375     $combo_userident = array(__('Ip')=>0,__('Cookie')=>2,__('Both ip and cookie')=>1);
376     # Display
377     echo 
378     '<p>'.__('Administration of options of this extension on this blog').'</p>'.
379     '<form method="post" action="'.$p_url.'" enctype="multipart/form-data">'.
380     '<div class="two-cols">'.
381     '<div class="col">'.
382     '<h2>'.__('Extension').'</h2>'.
383     '<p class="field">'.__('Enable plugin').' '.form::combo(array('s[rateit_active]'),array(__('no')=>0,__('yes')=>1),$core->blog->settings->rateit_active).'</p>'.
384     '<p class="field">'.__('Include on entries').' '.form::combo(array('s[rateit_poststpl]'),array(__('no')=>0,__('yes')=>1),$core->blog->settings->rateit_poststpl).'</p>'.
385     '<p class="field">'.__('Identify users by').' '.form::combo(array('s[rateit_userident]'),$combo_userident,$core->blog->settings->rateit_userident).'</p>'.
386     '<h2>'.__('Note').'</h2>'.
387     '<p class="field">'.__('Note out of').' '.form::combo(array('s[rateit_quotient]'),$combo_quotient,$core->blog->settings->rateit_quotient).'</p>'.
388     '<p class="field">'.__('Number of digits').' '.form::combo(array('s[rateit_digit]'),$combo_digit,$core->blog->settings->rateit_digit).'</p>'.
389     '<p class="field">'.__('Message of thanks').' '.form::field(array('s[rateit_msgthanks]'),50,255,html::escapeHTML($core->blog->settings->rateit_msgthanks),'',2).'</p>'.
390     '<p class="form-note">&nbsp;<br />'.__('This message replaces stars, leave it empty to not replace stars').'</p>'.
391     '</div>'.
392     '<div class="col">'.
393     '<h2>'.__('Image').'</h2>';
394
395     $stars_theme_path = $core->blog->themes_path.'/'.$core->blog->settings->theme.'/img/rateit-stars.png';
396     $stars_rateit_path = dirname(__FILE__).'/default-templates/img/rateit-stars.png';
397     $stars_rateit_files = files::scandir(dirname(__FILE__).'/default-templates/img/stars');
398     $stars_url = $core->blog->url.'rateit/img/rateit-stars.png';
399
400     if (file_exists($stars_theme_path)) {
401          echo 
402          '<p>'.__('Rating image exists on theme it will be used:').'</p>'.
403          form::hidden(array('s[starsimage]'),'theme').
404          '<table><tr><th>'.__('negative').'</th><th>'.__('positive').'</th><th>'.__('hover').'</th><th>'.__('size').'</th></tr>'.
405          '<tr>'.rateit_demo($stars_theme_path,$stars_url).'</tr></table>';
406     } else {
407          echo
408          '<p>'.__('Rating image not exists on theme choose one to use:').'</p>'.
409          '<table><tr><th>&nbsp;</th><th>'.__('negative').'</th><th>'.__('positive').'</th><th>'.__('hover').'</th><th>'.__('size').'</th></tr>';
410          if (file_exists($stars_rateit_path)) {
411               echo 
412               '<tr><td>'.form::radio(array('s[starsimage]'),'default',1).'</td>'.
413               rateit_demo($stars_rateit_path,$stars_url).'</tr>';
414          }
415          sort($stars_rateit_files);
416          foreach($stars_rateit_files AS $f) {
417               if (!preg_match('/star-[0-9]+.png/',$f)) continue;
418
419               echo 
420               '<tr class="line"><td>'.form::radio(array('s[starsimage]'),$f).'</td>'.
421               rateit_demo(
422                    dirname(__FILE__).'/default-templates/img/stars/'.$f,
423                    'index.php?pf=rateIt/default-templates/img/stars/'.$f
424               ).'</tr>';
425          }
426          echo 
427          '<tr class="line"><td>'.form::radio(array('s[starsimage]'),'user').'</td>'.
428          '<td colspan="4">'.form::hidden(array('MAX_FILE_SIZE'),30000).'<input type="file" name="starsuserfile" /></td></tr>'.
429          '</table>'.
430          '<p class="form-note">'.__('Please read the README file before uploading image').'</p>';
431     }
432     echo
433     '</div>'.
434     '</div>'.
435     '<p>'.
436     form::hidden(array('p'),'rateIt').
437     form::hidden(array('t'),'admin').
438     $core->formNonce().
439     '<input type="submit" name="save[admin]" value="'.__('Save').'" /></p>'.
440     '</form>'.
441     '</div>';
442}
443
444/**************
445** Uninstall
446**************/
447
448if (isset($tab['uninstall']) && $core->auth->isSuperAdmin()) {
449
450     echo '<div class="multi-part" id="uninstall" title="'.$tab['uninstall'].'">';
451
452     # Save admin options
453     if (!empty($_POST['save']['validate']) && isset($_POST['s'])) {
454          try {
455               if (1 != $understand)
456                    throw new Exception(__('You must check warning in order to delete plugin.'));
457
458               if (1 == $delete_table)
459                    rateItInstall::delTable($core);
460
461               if (1 == $delete_settings)
462                    rateItInstall::delSettings($core);
463
464               rateItInstall::delVersion($core);
465               rateItInstall::delModule($core);
466          }
467          catch (Exception $e) {
468               $core->error->add($e->getMessage());
469          }
470
471          if (!$core->error->flag())
472               http::redirect('plugins.php?removed=1');
473     }
474     # Confirm options
475     if (!empty($_POST['save']['uninstall']) && isset($_POST['s']) && 1 == $understand) {
476          echo 
477          '<p>'.__('In order to properly uninstall this plugin, you must specify the actions to perform').'</p>'.
478          '<form method="post" action="'.$p_url.'">'.
479          '<p>'.
480          '<label class=" classic">'.sprintf(($understand ? $img_green : $img_red),'-').
481          __('You understand that if you delete this plugin, the other plugins that use there tables and classes will no longer work.').'</label><br />'.
482          '<label class=" classic">'.sprintf($img_green,'-').
483          __('Delete plugin files').'</label><br />'.
484          '<label class=" classic">'.sprintf(($delete_table ? $img_green : $img_red),'-').
485          __('Delete plugin database table').'</label><br />'.
486          '<label class=" classic">'.sprintf(($delete_settings ? $img_green : $img_red),'-').
487          __('Delete plugin settings').'</label><br />'.
488          '</p>'.
489          '<p>'.
490          form::hidden(array('p'),'rateIt').
491          form::hidden(array('t'),'uninstall').
492          form::hidden(array('s[understand]'),$understand).
493          form::hidden(array('s[delete_table]'),$delete_table).
494          form::hidden(array('s[delete_settings]'),$delete_settings).
495          $core->formNonce().
496          '<input type="submit" name="save[validate]" value="'.__('Uninstall').'" />'.
497          '<input type="submit" name="save[back]" value="'.__('Back').'" /></p>'.
498          '</form>';
499
500     # Option form
501     } else {
502          if (!empty($_POST['save']['uninstall']) && 1 != $understand)
503               $core->error->add(__('You must check warning in order to delete plugin.'));
504
505          echo 
506          '<p>'.__('In order to properly uninstall this plugin, you must specify the actions to perform').'</p>'.
507          '<form method="post" action="'.$p_url.'">'.
508          '<p>'.
509          '<label class=" classic">'.form::checkbox(array('s[understand]'),1,$understand).
510          __('You understand that if you delete this plugin, the other plugins that use there tables and classes will no longer work.').'</label><br />'.
511          '<label class=" classic">'.form::checkbox(array('s[delete_table]'),1,$delete_table).
512          __('Delete plugin database table').'</label><br />'.
513          '<label class=" classic">'.form::checkbox(array('s[delete_settings]'),1,$delete_settings).
514          __('Delete plugin settings').'</label><br />'.
515          '</p><p>'.
516          form::hidden('p','rateIt').
517          form::hidden('t','uninstall').
518          $core->formNonce().
519          '<input type="submit" name="save[uninstall]" value="'.__('Uninstall').'" /></p>'.
520          '</form>';
521     }
522     echo '</div>';
523}
524
525/**************
526** About
527**************/
528
529echo '
530<div class="multi-part" id="about" title="'.$tab['about'].'">
531<h3>'.__('Version:').'</h3>
532<ul><li>rateIt '.$core->plugins->moduleInfo('rateIt','version').'</li></ul>
533<h3>'.__('Support:').'</h3>
534<ul>
535<li><a href="http://blog.jcdenis.com/?q=dotclear+plugin+rateIt">Author\'s blog</a></li>
536<li><a href="http://forum.dotclear.net/index.php">Dotclear forum</a></li>
537<li><a href="http://lab.dotclear.org/wiki/plugin/rateIt">Dotclear lab</a></li>
538</ul>
539<h3>'.__('Copyrights:').'</h3>
540<ul>
541<li><strong>'.__('Files').'</strong><br />
542These files are parts of rateIt, a plugin for Dotclear 2.<br />
543Copyright (c) 2009 JC Denis and contributors<br />
544Licensed under the GPL version 2.0 license.<br />
545<a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">http://www.gnu.org/licenses/old-licenses/gpl-2.0.html</a>
546</li>
547<li><strong>'.__('Images').'</strong><br />
548Some icons from Silk icon set 1.3 by Mark James at:<br />
549<a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a><br />
550under a Creative Commons Attribution 2.5 License<br />
551<a href="http://creativecommons.org/licenses/by/2.5/">http://creativecommons.org/licenses/by/2.5/</a>.
552</li>
553</ul>
554<h3>'.__('Tools').'</h3>
555<ul>
556<li>Traduced with Dotclear plugin Translater,</li>
557<li>Packaged with Dotclear plugin Packager.</li>
558<li>Used jQuery Star Rating Plugin v3.12 by <a href="http://www.fyneworks.com/jquery/star-rating/">Fyneworks</a></li>
559</ul>
560</div>
561 </body>
562</html>';
563
564function rateit_demo($path,$url)
565{
566     $s = getimagesize($path);
567     return
568     '<td><div style="
569          display:block;
570          overflow:hidden;
571          text-indent:-999em;
572          margin: 0px;
573          padding: 1px;
574          background: transparent url('.$url.') no-repeat 0 0;
575          width:'.$s[0].'px;
576          height:'.(floor($s[1] /3)-1).'px;
577     ">&nbsp;</div></td>
578     <td><div style="
579          display:block;
580          overflow:hidden;
581          text-indent:-999em;
582          margin: 0px;
583          padding: 1px;
584          background: transparent url('.$url.') no-repeat 0 -'.floor($s[1] /3).'px;
585          width:'.$s[0].'px;
586          height:'.(floor($s[1] /3)-1).'px;
587     ">&nbsp;</div></td>
588     <td><div style="
589          display:block;
590          overflow:hidden;
591          text-indent:-999em;
592          margin: 0px;
593          padding: 1px;
594          background: transparent url('.$url.') no-repeat 0 -'.(floor($s[1] /3) *2).'px;
595          width:'.$s[0].'px;
596          height:'.(floor($s[1] /3)-1).'px;
597     ">&nbsp;</div></td><td>'.$s[0].'x'.floor($s[1] /3).'</td>';
598}
599?>
Note: See TracBrowser for help on using the repository browser.

Sites map