1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8require_once("lib/copyrights/copyrightslib.php"); 9 10function wikiplugin_copyright_info() 11{ 12 return [ 13 'name' => tra('Copyright'), 14 'documentation' => 'PluginCopyright', 15 'description' => tra('Insert copyright notices'), 16 'prefs' => [ 'wiki_feature_copyrights', 'wikiplugin_copyright' ], 17 'body' => tr( 18 'Pattern for display of the copyright information. May contain %0~title~%1, %0~year~%1, %0~authors~%1 and %0~holder~%1.', 19 '<code>', 20 '</code>' 21 ), 22 'iconname' => 'copyright', 23 'introduced' => 1, 24 'params' => [ 25 ], 26 ]; 27} 28 29function wikiplugin_copyright($data, $params) 30{ 31 global $dbTiki; 32 33 $copyrightslib = new CopyrightsLib; 34 35 if (! isset($_REQUEST['page'])) { 36 return ''; 37 } 38 39 $result = ''; 40 41 $copyrights = $copyrightslib->list_copyrights($_REQUEST['page']); 42 43 for ($i = 0; $i < $copyrights['cant']; $i++) { 44 $notice = str_replace("~title~", $copyrights['data'][$i]['title'], $data); 45 46 $notice = str_replace("~year~", $copyrights['data'][$i]['year'], $notice); 47 $notice = str_replace("~authors~", $copyrights['data'][$i]['authors'], $notice); 48 $notice = str_replace("~holder~", $copyrights['data'][$i]['holder'], $notice); 49 $result = $result . $notice; 50 } 51 52 global $tiki_p_edit_copyrights; 53 54 if ((isset($tiki_p_edit_copyrights)) && ($tiki_p_edit_copyrights == 'y')) { 55 $result = $result . "\n<a href=\"copyrights.php?page=" . $_REQUEST['page'] . "\">Edit copyrights</a> for ((" . $_REQUEST['page'] . "))\n"; 56 } 57 58 return $result; 59} 60