1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | User Custom Fields plugin for Piwigo by TEMMII | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2016-2022 ddtddt http://temmii.com/piwigo/ | |
---|
6 | // +-----------------------------------------------------------------------+ |
---|
7 | // | This program 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 | |
---|
10 | // | | |
---|
11 | // | This program is distributed in the hope that it will be useful, but | |
---|
12 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
13 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
14 | // | General Public License for more details. | |
---|
15 | // | | |
---|
16 | // | You should have received a copy of the GNU General Public License | |
---|
17 | // | along with this program; if not, write to the Free Software | |
---|
18 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
19 | // | USA. | |
---|
20 | // +-----------------------------------------------------------------------+ |
---|
21 | |
---|
22 | //ajouter filtre sur page option pour supprimer email obligatoire |
---|
23 | |
---|
24 | add_event_handler('loc_begin_admin_page', 'ucf_add_popin'); |
---|
25 | function ucf_add_popin(){ |
---|
26 | global $template; |
---|
27 | $template->set_prefilter('user_list', 'ucf_add_popin_prefilter'); |
---|
28 | $template->set_prefilter('config', 'ucf_config_prefilter'); |
---|
29 | } |
---|
30 | |
---|
31 | function ucf_add_popin_prefilter($content){ |
---|
32 | // add js link |
---|
33 | $search = '<div class="selection-mode-group-manager" style="right:30px">'; |
---|
34 | $replace = '{combine_script id="jquery.ucf" load=\'footer\' path="$UCF_PATH2/js/ucf.js"}'; |
---|
35 | $content = str_replace($search, $replace.$search, $content); |
---|
36 | |
---|
37 | //css |
---|
38 | $search = '</style>'; |
---|
39 | $replace = ' |
---|
40 | .user-property-user-ucf { |
---|
41 | margin-bottom:34px; |
---|
42 | height:20px; |
---|
43 | color: #000; |
---|
44 | cursor: pointer; |
---|
45 | } |
---|
46 | |
---|
47 | .user-ucf-title { |
---|
48 | font-size:1em; |
---|
49 | } |
---|
50 | |
---|
51 | '; |
---|
52 | $content = str_replace($search, $replace.$search, $content); |
---|
53 | |
---|
54 | $search = '<p class="user-property-button"> <span class="icon-signal user-edit-icon"> </span><a href="" >{\'Visit history\'|@translate}</a></p> |
---|
55 | </div> |
---|
56 | </div>'; |
---|
57 | |
---|
58 | $replace = '<div class="user-stats"> |
---|
59 | <div class="user-property-user-ucf"> |
---|
60 | <p class="user-property-button"> <span class="icon-pencil user-edit-icon"> </span><a data-url="{$UCF_ADMIN2}" href="#" >{\'Custom fields\'|@translate}</a></p> |
---|
61 | </div> |
---|
62 | </div>'; |
---|
63 | |
---|
64 | return str_replace($search,$search.$replace, $content); |
---|
65 | } |
---|
66 | |
---|
67 | function ucf_config_prefilter($content){ |
---|
68 | $search = '#(<li> |
---|
69 | <label class="font-checkbox"> |
---|
70 | <span class="icon-check"></span> |
---|
71 | <input type="checkbox" name="obligatory_user_mail_address").*Mail address is mandatory for registration\'\|translate} |
---|
72 | </label> |
---|
73 | </li>#ms'; |
---|
74 | return preg_replace($search, '', $content); |
---|
75 | } |
---|