1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | PiwiShack - a Piwigo Plugin | |
---|
4 | // | Copyright (C) 2009 MOREAU Julien - gotcha@piwigo.org | |
---|
5 | // +-----------------------------------------------------------------------+ |
---|
6 | // | This program is free software; you can redistribute it and/or modify | |
---|
7 | // | it under the terms of the GNU General Public License as published by | |
---|
8 | // | the Free Software Foundation | |
---|
9 | // | | |
---|
10 | // | This program is distributed in the hope that it will be useful, but | |
---|
11 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
12 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
13 | // | General Public License for more details. | |
---|
14 | // | | |
---|
15 | // | You should have received a copy of the GNU General Public License | |
---|
16 | // | along with this program; if not, write to the Free Software | |
---|
17 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
18 | // | USA. | |
---|
19 | // +-----------------------------------------------------------------------+ |
---|
20 | |
---|
21 | class PiwiShack |
---|
22 | { |
---|
23 | var $plugin_name, $plugin_path; |
---|
24 | var $opened, $to_close; |
---|
25 | |
---|
26 | function PiwiShack($plugin_name, $plugin_path) |
---|
27 | { |
---|
28 | // Args |
---|
29 | $this->plugin_name = $plugin_name; |
---|
30 | $this->plugin_path = $plugin_path; |
---|
31 | // handler |
---|
32 | $this->initialize_event_handler(); |
---|
33 | } |
---|
34 | |
---|
35 | function initialize_event_handler() |
---|
36 | { |
---|
37 | if (script_basename() != $this->plugin_name.'_controller') |
---|
38 | { |
---|
39 | add_event_handler('loc_end_page_header', array(&$this, 'loc_end_page_header')); |
---|
40 | add_event_handler('loc_end_index', array(&$this, 'loc_end_index')); |
---|
41 | add_event_handler('picture_pictures_data', array(&$this, 'picture_pictures_data')); |
---|
42 | } |
---|
43 | |
---|
44 | if (isset($_GET[$this->plugin_name])) |
---|
45 | { |
---|
46 | add_event_handler('loc_begin_page_header', array(&$this, 'loc_begin_page_header')); |
---|
47 | pwg_set_session_var($this->plugin_name, ($_GET[$this->plugin_name] === 'open')); |
---|
48 | } |
---|
49 | $this->opened = pwg_get_session_var($this->plugin_name, false); |
---|
50 | $this->to_close = (isset($_GET[$this->plugin_name]) and ($_GET[$this->plugin_name] === 'close')); |
---|
51 | } |
---|
52 | |
---|
53 | function get_thumb_post_on_a_website() |
---|
54 | { |
---|
55 | global $page, $lang_info; |
---|
56 | |
---|
57 | $list = array(); |
---|
58 | |
---|
59 | $S = ''; |
---|
60 | |
---|
61 | switch (script_basename()) |
---|
62 | { |
---|
63 | case 'index': |
---|
64 | { |
---|
65 | global $pictures; |
---|
66 | |
---|
67 | if (isset($pictures)) |
---|
68 | { |
---|
69 | $list = $pictures; |
---|
70 | } |
---|
71 | break; |
---|
72 | } |
---|
73 | case 'picture': |
---|
74 | { |
---|
75 | global $picture; |
---|
76 | |
---|
77 | if (isset($picture['current'])) |
---|
78 | { |
---|
79 | $list[] = $picture['current']; |
---|
80 | } |
---|
81 | break; |
---|
82 | } |
---|
83 | } |
---|
84 | |
---|
85 | if (empty($list) and !empty($page['items'])) |
---|
86 | { |
---|
87 | $query = ' |
---|
88 | SELECT * |
---|
89 | FROM '.IMAGES_TABLE.' |
---|
90 | WHERE id IN ('.implode(',', $page['items']).') |
---|
91 | ;'; |
---|
92 | |
---|
93 | $result = pwg_query($query); |
---|
94 | |
---|
95 | while ($row = mysql_fetch_assoc($result)) |
---|
96 | { |
---|
97 | $row['rank'] = $page['rank_of'][ $row['id'] ]; |
---|
98 | array_push($list, $row); |
---|
99 | } |
---|
100 | |
---|
101 | usort($list, 'rank_compare'); |
---|
102 | } |
---|
103 | if (!empty($list)) |
---|
104 | { |
---|
105 | |
---|
106 | set_make_full_url(); |
---|
107 | |
---|
108 | foreach ($list as $row) |
---|
109 | { |
---|
110 | /* |
---|
111 | Affichage de la miniature sur des sites. Cliquable. |
---|
112 | EXEMPLE |
---|
113 | <a href="{$ROOT_WAY}{$current.U_IMG}" target=_blank><img src="{$ROOT_WAY}{$current.THUMB_SRC|@replace:'./':''}" /></a> |
---|
114 | */ |
---|
115 | $S .= '<a href=\"'. |
---|
116 | duplicate_picture_url( |
---|
117 | array( |
---|
118 | 'image_id' => $row['id'], |
---|
119 | 'image_file' => $row['file'], |
---|
120 | )).'\" target=_blank><img src=\"'. |
---|
121 | str_replace('/./', '/', get_thumbnail_url($row)).'\" /></a>'; |
---|
122 | $S .= '\n\n'; |
---|
123 | } |
---|
124 | |
---|
125 | unset_make_full_url(); |
---|
126 | } |
---|
127 | |
---|
128 | return $S; |
---|
129 | } |
---|
130 | |
---|
131 | function get_thumb_post_on_a_forum() |
---|
132 | { |
---|
133 | global $page, $lang_info; |
---|
134 | |
---|
135 | $list = array(); |
---|
136 | |
---|
137 | $S = ''; |
---|
138 | |
---|
139 | switch (script_basename()) |
---|
140 | { |
---|
141 | case 'index': |
---|
142 | { |
---|
143 | global $pictures; |
---|
144 | |
---|
145 | if (isset($pictures)) |
---|
146 | { |
---|
147 | $list = $pictures; |
---|
148 | } |
---|
149 | break; |
---|
150 | } |
---|
151 | case 'picture': |
---|
152 | { |
---|
153 | global $picture; |
---|
154 | |
---|
155 | if (isset($picture['current'])) |
---|
156 | { |
---|
157 | $list[] = $picture['current']; |
---|
158 | } |
---|
159 | break; |
---|
160 | } |
---|
161 | } |
---|
162 | |
---|
163 | if (empty($list) and !empty($page['items'])) |
---|
164 | { |
---|
165 | $query = ' |
---|
166 | SELECT * |
---|
167 | FROM '.IMAGES_TABLE.' |
---|
168 | WHERE id IN ('.implode(',', $page['items']).') |
---|
169 | ;'; |
---|
170 | |
---|
171 | $result = pwg_query($query); |
---|
172 | |
---|
173 | while ($row = mysql_fetch_assoc($result)) |
---|
174 | { |
---|
175 | $row['rank'] = $page['rank_of'][ $row['id'] ]; |
---|
176 | array_push($list, $row); |
---|
177 | } |
---|
178 | |
---|
179 | usort($list, 'rank_compare'); |
---|
180 | } |
---|
181 | if (!empty($list)) |
---|
182 | { |
---|
183 | |
---|
184 | set_make_full_url(); |
---|
185 | |
---|
186 | foreach ($list as $row) |
---|
187 | { |
---|
188 | /* |
---|
189 | Affichage de la miniature sur des forums. Cliquable. |
---|
190 | EXEMPLE |
---|
191 | [url={$ROOT_WAY}{$current.U_IMG}][img]{$ROOT_WAY}{$current.THUMB_SRC|@replace:'./':''}[/img][/url] |
---|
192 | */ |
---|
193 | $S .= '[url='. |
---|
194 | duplicate_picture_url( |
---|
195 | array( |
---|
196 | 'image_id' => $row['id'], |
---|
197 | 'image_file' => $row['file'], |
---|
198 | )).'][img]'. |
---|
199 | str_replace('/./', '/', get_thumbnail_url($row)).'[/img][/url]'; |
---|
200 | $S .= '\n\n'; |
---|
201 | } |
---|
202 | |
---|
203 | unset_make_full_url(); |
---|
204 | } |
---|
205 | |
---|
206 | return $S; |
---|
207 | } |
---|
208 | |
---|
209 | function get_view_post_on_a_website() |
---|
210 | { |
---|
211 | global $page, $lang_info; |
---|
212 | |
---|
213 | $list = array(); |
---|
214 | |
---|
215 | $S = ''; |
---|
216 | |
---|
217 | switch (script_basename()) |
---|
218 | { |
---|
219 | case 'index': |
---|
220 | { |
---|
221 | global $pictures; |
---|
222 | |
---|
223 | if (isset($pictures)) |
---|
224 | { |
---|
225 | $list = $pictures; |
---|
226 | } |
---|
227 | break; |
---|
228 | } |
---|
229 | case 'picture': |
---|
230 | { |
---|
231 | global $picture; |
---|
232 | |
---|
233 | if (isset($picture['current'])) |
---|
234 | { |
---|
235 | $list[] = $picture['current']; |
---|
236 | } |
---|
237 | break; |
---|
238 | } |
---|
239 | } |
---|
240 | |
---|
241 | if (empty($list) and !empty($page['items'])) |
---|
242 | { |
---|
243 | $query = ' |
---|
244 | SELECT * |
---|
245 | FROM '.IMAGES_TABLE.' |
---|
246 | WHERE id IN ('.implode(',', $page['items']).') |
---|
247 | ;'; |
---|
248 | |
---|
249 | $result = pwg_query($query); |
---|
250 | |
---|
251 | while ($row = mysql_fetch_assoc($result)) |
---|
252 | { |
---|
253 | $row['rank'] = $page['rank_of'][ $row['id'] ]; |
---|
254 | array_push($list, $row); |
---|
255 | } |
---|
256 | |
---|
257 | usort($list, 'rank_compare'); |
---|
258 | } |
---|
259 | if (!empty($list)) |
---|
260 | { |
---|
261 | include_once(PHPWG_ROOT_PATH.'/include/functions_picture.inc.php'); |
---|
262 | set_make_full_url(); |
---|
263 | |
---|
264 | foreach ($list as $row) |
---|
265 | { |
---|
266 | /* |
---|
267 | Affichage de la vue normale sur des sites. Non cliquable. |
---|
268 | EXEMPLE |
---|
269 | <a href="{$ROOT_WAY}{$current.U_IMG}" target=_blank><img src="{$ROOT_WAY}{$SRC_IMG|@replace:'./':''}" /></a> |
---|
270 | */ |
---|
271 | $S .= '<a href=\"'. |
---|
272 | duplicate_picture_url( |
---|
273 | array( |
---|
274 | 'image_id' => $row['id'], |
---|
275 | 'image_file' => $row['file'], |
---|
276 | )).'\" target=_blank><img src=\"'.get_absolute_root_url(). |
---|
277 | str_replace('/./', '/', get_image_url($row)).'\" /></a>'; |
---|
278 | $S .= '\n\n'; |
---|
279 | } |
---|
280 | |
---|
281 | unset_make_full_url(); |
---|
282 | } |
---|
283 | |
---|
284 | return $S; |
---|
285 | } |
---|
286 | |
---|
287 | function get_view_direct_link() |
---|
288 | { |
---|
289 | global $page, $lang_info; |
---|
290 | |
---|
291 | $list = array(); |
---|
292 | |
---|
293 | $S = ''; |
---|
294 | |
---|
295 | switch (script_basename()) |
---|
296 | { |
---|
297 | case 'index': |
---|
298 | { |
---|
299 | global $pictures; |
---|
300 | |
---|
301 | if (isset($pictures)) |
---|
302 | { |
---|
303 | $list = $pictures; |
---|
304 | } |
---|
305 | break; |
---|
306 | } |
---|
307 | case 'picture': |
---|
308 | { |
---|
309 | global $picture; |
---|
310 | |
---|
311 | if (isset($picture['current'])) |
---|
312 | { |
---|
313 | $list[] = $picture['current']; |
---|
314 | } |
---|
315 | break; |
---|
316 | } |
---|
317 | } |
---|
318 | |
---|
319 | if (empty($list) and !empty($page['items'])) |
---|
320 | { |
---|
321 | $query = ' |
---|
322 | SELECT * |
---|
323 | FROM '.IMAGES_TABLE.' |
---|
324 | WHERE id IN ('.implode(',', $page['items']).') |
---|
325 | ;'; |
---|
326 | |
---|
327 | $result = pwg_query($query); |
---|
328 | |
---|
329 | while ($row = mysql_fetch_assoc($result)) |
---|
330 | { |
---|
331 | $row['rank'] = $page['rank_of'][ $row['id'] ]; |
---|
332 | array_push($list, $row); |
---|
333 | } |
---|
334 | |
---|
335 | usort($list, 'rank_compare'); |
---|
336 | } |
---|
337 | if (!empty($list)) |
---|
338 | { |
---|
339 | include_once(PHPWG_ROOT_PATH.'/include/functions_picture.inc.php'); |
---|
340 | set_make_full_url(); |
---|
341 | |
---|
342 | $page_name = script_basename(); |
---|
343 | if ( $page_name == 'picture') |
---|
344 | { |
---|
345 | foreach ($list as $row) |
---|
346 | { |
---|
347 | /* |
---|
348 | Affichage du chemin en clair du lien vers la vue normale. |
---|
349 | EXEMPLE |
---|
350 | {$ROOT_WAY}{$SRC_IMG|@replace:'./':''} |
---|
351 | */ |
---|
352 | $S .= get_absolute_root_url(). |
---|
353 | str_replace('./', '', get_image_url($row)); |
---|
354 | $S .= '\n\n'; |
---|
355 | } |
---|
356 | |
---|
357 | unset_make_full_url(); |
---|
358 | } |
---|
359 | else |
---|
360 | { |
---|
361 | foreach ($list as $row) |
---|
362 | { |
---|
363 | /* |
---|
364 | Affichage du chemin en clair du lien vers la vue normale. |
---|
365 | EXEMPLE |
---|
366 | {$ROOT_WAY}{$SRC_IMG|@replace:'./':''} |
---|
367 | */ |
---|
368 | $S .= get_image_url($row); |
---|
369 | $S .= '\n\n'; |
---|
370 | } |
---|
371 | } |
---|
372 | |
---|
373 | unset_make_full_url(); |
---|
374 | } |
---|
375 | |
---|
376 | |
---|
377 | return $S; |
---|
378 | } |
---|
379 | |
---|
380 | function get_p_perso_writer_01() |
---|
381 | { |
---|
382 | global $page, $lang_info; |
---|
383 | |
---|
384 | $list = array(); |
---|
385 | |
---|
386 | $S = ''; |
---|
387 | |
---|
388 | switch (script_basename()) |
---|
389 | { |
---|
390 | case 'index': |
---|
391 | { |
---|
392 | global $pictures; |
---|
393 | |
---|
394 | if (isset($pictures)) |
---|
395 | { |
---|
396 | $list = $pictures; |
---|
397 | } |
---|
398 | break; |
---|
399 | } |
---|
400 | case 'picture': |
---|
401 | { |
---|
402 | global $picture; |
---|
403 | |
---|
404 | if (isset($picture['current'])) |
---|
405 | { |
---|
406 | $list[] = $picture['current']; |
---|
407 | } |
---|
408 | break; |
---|
409 | } |
---|
410 | } |
---|
411 | |
---|
412 | if (empty($list) and !empty($page['items'])) |
---|
413 | { |
---|
414 | $query = ' |
---|
415 | SELECT * |
---|
416 | FROM '.IMAGES_TABLE.' |
---|
417 | WHERE id IN ('.implode(',', $page['items']).') |
---|
418 | ;'; |
---|
419 | |
---|
420 | $result = pwg_query($query); |
---|
421 | |
---|
422 | while ($row = mysql_fetch_assoc($result)) |
---|
423 | { |
---|
424 | $row['rank'] = $page['rank_of'][ $row['id'] ]; |
---|
425 | array_push($list, $row); |
---|
426 | } |
---|
427 | |
---|
428 | usort($list, 'rank_compare'); |
---|
429 | } |
---|
430 | if (!empty($list)) |
---|
431 | { |
---|
432 | include_once(PHPWG_ROOT_PATH.'/include/functions_picture.inc.php'); |
---|
433 | set_make_full_url(); |
---|
434 | |
---|
435 | foreach ($list as $row) |
---|
436 | { |
---|
437 | /* |
---|
438 | Affichage Personnalisé, 01. |
---|
439 | EXEMPLE |
---|
440 | <h6 style="text-align: center;"><a href="{$ROOT_WAY}{$current.U_IMG}" target="_blank"><img class="aligncenter" style="width: 100%; height: 100%;" src="{$ROOT_WAY}{$SRC_IMG|@replace:'./':''}" alt="{$ALT_IMG}" /></a><em><a href="{$ROOT_WAY}{$U_UP}"; target="_blank">Galerie complète à visiter</a></em></h6> |
---|
441 | */ |
---|
442 | |
---|
443 | $S .= '<h6 style=\"text-align: center;\"><a href=\"'. // Arguments à transmettre |
---|
444 | duplicate_picture_url( // Lien Piwigo vers la page de la vue normale |
---|
445 | array( |
---|
446 | 'image_id' => $row['id'], |
---|
447 | 'image_file' => $row['file'], |
---|
448 | )). |
---|
449 | '\" target=\"_blank\"><img class=\"aligncenter\" style=\"width: 100%; height: 100%;\" src=\"'. // Arguments à transmettre |
---|
450 | get_absolute_root_url().str_replace('./', '', get_image_url($row)). // Liens direct vers la vue normale |
---|
451 | '\" alt=\"'. // Arguments à transmettre |
---|
452 | $row['file']. // Noms du fichier |
---|
453 | '\" /></a><em><a href=\"'. // Arguments à transmettre |
---|
454 | duplicate_index_url(). // Catégorie parente |
---|
455 | '\"; target=\"_blank\"><br />Galerie complète à visiter</a></em></h6>'; // Arguments à transmettre |
---|
456 | $S .= '\n\n'; |
---|
457 | } |
---|
458 | |
---|
459 | unset_make_full_url(); |
---|
460 | } |
---|
461 | |
---|
462 | return $S; |
---|
463 | } |
---|
464 | |
---|
465 | function get_p_perso_writer_02() |
---|
466 | { |
---|
467 | global $page, $lang_info; |
---|
468 | |
---|
469 | $list = array(); |
---|
470 | |
---|
471 | $S = ''; |
---|
472 | |
---|
473 | switch (script_basename()) |
---|
474 | { |
---|
475 | case 'index': |
---|
476 | { |
---|
477 | global $pictures; |
---|
478 | |
---|
479 | if (isset($pictures)) |
---|
480 | { |
---|
481 | $list = $pictures; |
---|
482 | } |
---|
483 | break; |
---|
484 | } |
---|
485 | case 'picture': |
---|
486 | { |
---|
487 | global $picture; |
---|
488 | |
---|
489 | if (isset($picture['current'])) |
---|
490 | { |
---|
491 | $list[] = $picture['current']; |
---|
492 | } |
---|
493 | break; |
---|
494 | } |
---|
495 | } |
---|
496 | |
---|
497 | if (empty($list) and !empty($page['items'])) |
---|
498 | { |
---|
499 | $query = ' |
---|
500 | SELECT * |
---|
501 | FROM '.IMAGES_TABLE.' |
---|
502 | WHERE id IN ('.implode(',', $page['items']).') |
---|
503 | ;'; |
---|
504 | |
---|
505 | $result = pwg_query($query); |
---|
506 | |
---|
507 | while ($row = mysql_fetch_assoc($result)) |
---|
508 | { |
---|
509 | $row['rank'] = $page['rank_of'][ $row['id'] ]; |
---|
510 | array_push($list, $row); |
---|
511 | } |
---|
512 | |
---|
513 | usort($list, 'rank_compare'); |
---|
514 | } |
---|
515 | |
---|
516 | if (!empty($list)) |
---|
517 | { |
---|
518 | include_once(PHPWG_ROOT_PATH.'/include/functions_url.inc.php'); |
---|
519 | set_make_full_url(); |
---|
520 | |
---|
521 | foreach ($list as $row) |
---|
522 | { |
---|
523 | //'[(('.$picture['current']['thumbnail'].'))|'.$picture['current']['url'].'|'.$lang_info['code'].']'; |
---|
524 | $S .= '*** '.(!empty($row['name']) ? $row['name'] : $row['file']).' ***\n'; |
---|
525 | $S .= '[(('. |
---|
526 | str_replace('/./', '/', get_thumbnail_url($row)).'))|'. |
---|
527 | duplicate_picture_url( |
---|
528 | array( |
---|
529 | 'image_id' => $row['id'], |
---|
530 | 'image_file' => $row['file'], |
---|
531 | )).'|'. |
---|
532 | $lang_info['code'].']'; |
---|
533 | $S .= '\n\n'; |
---|
534 | } |
---|
535 | |
---|
536 | unset_make_full_url(); |
---|
537 | |
---|
538 | } |
---|
539 | |
---|
540 | return $S; |
---|
541 | } |
---|
542 | |
---|
543 | // Fin de la définition des champs |
---|
544 | |
---|
545 | function loc_begin_page_header() |
---|
546 | { |
---|
547 | global $template; |
---|
548 | |
---|
549 | $redirect_url = ( script_basename()=='picture' |
---|
550 | ? duplicate_picture_url(array(), array($this->plugin_name)) |
---|
551 | : duplicate_index_url(array(), array($this->plugin_name)) |
---|
552 | ); |
---|
553 | |
---|
554 | $template->assign( |
---|
555 | array( |
---|
556 | 'page_refresh' => array( |
---|
557 | 'TIME' => 1, |
---|
558 | 'U_REFRESH' => $redirect_url |
---|
559 | ) |
---|
560 | )); |
---|
561 | } |
---|
562 | |
---|
563 | function loc_end_page_header() |
---|
564 | { |
---|
565 | global $template; |
---|
566 | |
---|
567 | if ($this->opened or $this->to_close) |
---|
568 | { |
---|
569 | $plugin_root_url = get_root_url().'plugins/'.$this->plugin_name.'/'; |
---|
570 | |
---|
571 | $js = ' |
---|
572 | <script type="text/javascript"> |
---|
573 | var theController = window.open("", "'.$this->plugin_name.'_controller", "alwaysRaised=yes,dependent=yes,toolbar=no,height=843,width=1220,menubar=no,resizable=yes,scrollbars=yes,status=no");'; |
---|
574 | |
---|
575 | if ($this->to_close) |
---|
576 | { |
---|
577 | $js .= ' |
---|
578 | theController.close();'; |
---|
579 | } |
---|
580 | else |
---|
581 | { |
---|
582 | $js .= ' |
---|
583 | if (theController.location.toString()=="about:blank" || !theController.location.toString().match(/^(https?.*\/)'.$this->plugin_name.'_controller\.php(\?.+)?$/)) |
---|
584 | { |
---|
585 | theController.location = "'.$plugin_root_url.$this->plugin_name.'_controller.php"; |
---|
586 | } |
---|
587 | else |
---|
588 | { |
---|
589 | theController.focus(); |
---|
590 | } |
---|
591 | theController.document.getElementsByName("thumb_Post_on_a_website")[0].value = "'.$this->get_thumb_post_on_a_website().'"; |
---|
592 | theController.document.getElementsByName("thumb_Post_on_a_forum")[0].value = "'.$this->get_thumb_post_on_a_forum().'"; |
---|
593 | theController.document.getElementsByName("view_Post_on_a_website")[0].value = "'.$this->get_view_post_on_a_website().'"; |
---|
594 | theController.document.getElementsByName("view_Direct_link")[0].value = "'.$this->get_view_direct_link().'"; |
---|
595 | theController.document.getElementsByName("p_Perso_writer_01")[0].value = "'.$this->get_p_perso_writer_01().'"; |
---|
596 | theController.document.getElementsByName("p_Perso_writer_02")[0].value = "'.$this->get_p_perso_writer_02().'";'; |
---|
597 | } |
---|
598 | $js .= ' |
---|
599 | </script>'; |
---|
600 | |
---|
601 | $template->append('head_elements', $js); |
---|
602 | } |
---|
603 | } |
---|
604 | |
---|
605 | function get_link_icon($main_link) |
---|
606 | { |
---|
607 | global $page; |
---|
608 | |
---|
609 | if (empty($page['items'])) |
---|
610 | { |
---|
611 | return; |
---|
612 | } |
---|
613 | |
---|
614 | $this->loading_lang(); |
---|
615 | |
---|
616 | if ($this->opened) |
---|
617 | { |
---|
618 | $suffix_url = 'close'; |
---|
619 | $link_title = l10n('close_window_piwishack'); |
---|
620 | } |
---|
621 | else |
---|
622 | { |
---|
623 | $suffix_url = 'open'; |
---|
624 | $link_title = l10n('open_window_piwishack'); |
---|
625 | } |
---|
626 | |
---|
627 | $link_url = add_url_params($main_link, array($this->plugin_name => $suffix_url)); |
---|
628 | if (!empty($link_url)) |
---|
629 | { |
---|
630 | $link_url = |
---|
631 | '<a href="'.$link_url.'" title="'.$link_title.'" rel="nofollow"><img src="'.get_root_url().'plugins/'.$this->plugin_name.'/icon/controller_'.$suffix_url.'.png" class="button" alt="PiwiShack controller"></a>'; |
---|
632 | } |
---|
633 | |
---|
634 | return $link_url; |
---|
635 | } |
---|
636 | |
---|
637 | function loc_end_index() |
---|
638 | { |
---|
639 | global $template; |
---|
640 | |
---|
641 | $link_url = $this->get_link_icon(duplicate_index_url()); |
---|
642 | if (!empty($link_url)) |
---|
643 | { |
---|
644 | $template->concat( |
---|
645 | 'PLUGIN_INDEX_ACTIONS', |
---|
646 | '<li>'.$link_url.'</li>'); |
---|
647 | } |
---|
648 | } |
---|
649 | |
---|
650 | function picture_pictures_data($pictures) |
---|
651 | { |
---|
652 | global $template; |
---|
653 | |
---|
654 | $link_url = $this->get_link_icon(duplicate_picture_url()); |
---|
655 | if (!empty($link_url)) |
---|
656 | { |
---|
657 | $template->concat( |
---|
658 | 'PLUGIN_PICTURE_ACTIONS', |
---|
659 | $link_url); |
---|
660 | } |
---|
661 | |
---|
662 | return $pictures; |
---|
663 | } |
---|
664 | |
---|
665 | function loading_lang() |
---|
666 | { |
---|
667 | load_language('plugin.lang', $this->plugin_path); |
---|
668 | } |
---|
669 | } |
---|
670 | |
---|
671 | ?> |
---|