Skip to content

Commit 6194994

Browse files
author
SedLex
committed
* BUG: The notice was everywhere ...
1 parent e5d91b7 commit 6194994

File tree

3 files changed

+62
-51
lines changed

3 files changed

+62
-51
lines changed

lang/legi_display.pot

+42-42
Original file line numberDiff line numberDiff line change
@@ -1,203 +1,203 @@
11
Content-Transfer-Encoding: 8bit
22

3-
#: legi-display.php:626
3+
#: legi-display.php:633
44
#@ legi_display
55
msgid "List the available LEGI code that you have imported"
66
msgstr ""
77

8-
#: legi-display.php:705
8+
#: legi-display.php:712
99
#@ legi_display
1010
msgid "The code does not seems to be an appropriate code."
1111
msgstr ""
1212

13-
#: legi-display.php:710
13+
#: legi-display.php:717
1414
#@ legi_display
1515
msgid "The cache file %s has been deleted: it will be recreated in the next rendering of this code."
1616
msgstr ""
1717

18-
#: legi-display.php:713
18+
#: legi-display.php:720
1919
#@ legi_display
2020
msgid "Code that has just been imported"
2121
msgstr ""
2222

23-
#: legi-display.php:717
23+
#: legi-display.php:724
2424
#@ legi_display
2525
msgid "Choose a code to import/update in the following list:"
2626
msgstr ""
2727

28-
#: legi-display.php:725
29-
#: legi-display.php:730
28+
#: legi-display.php:732
29+
#: legi-display.php:737
3030
#@ legi_display
3131
msgid "Import"
3232
msgstr ""
3333

34-
#: legi-display.php:727
34+
#: legi-display.php:734
3535
#@ legi_display
3636
msgid "No code detected in your upload folder."
3737
msgstr ""
3838

39-
#: legi-display.php:732
39+
#: legi-display.php:739
4040
#@ legi_display
4141
msgid "Here is the list of code that has already been imported:"
4242
msgstr ""
4343

44-
#: legi-display.php:743
45-
#: legi-display.php:746
44+
#: legi-display.php:750
45+
#: legi-display.php:753
4646
#@ legi_display
4747
msgid "No code has been imported."
4848
msgstr ""
4949

50-
#: legi-display.php:749
50+
#: legi-display.php:756
5151
#@ legi_display
5252
msgid "Already imported"
5353
msgstr ""
5454

55-
#: legi-display.php:758
55+
#: legi-display.php:765
5656
#@ legi_display
5757
msgid "Import a code"
5858
msgstr ""
5959

60-
#: legi-display.php:762
60+
#: legi-display.php:769
6161
#@ legi_display
6262
msgid "This plugin Display French Codes and laws once the XML files are retrieved from %s. See %s for the licence."
6363
msgstr ""
6464

65-
#: legi-display.php:763
65+
#: legi-display.php:770
6666
#@ legi_display
6767
msgid "Purpose of that plugin"
6868
msgstr ""
6969

70-
#: legi-display.php:766
70+
#: legi-display.php:773
7171
#@ legi_display
7272
msgid "At first, download the file %s on %s."
7373
msgstr ""
7474

75-
#: legi-display.php:767
75+
#: legi-display.php:774
7676
#@ legi_display
7777
msgid "Unpack this file on your website (for instance, with %s if your are on Windows or any other compatible software)."
7878
msgstr ""
7979

80-
#: legi-display.php:768
80+
#: legi-display.php:775
8181
#@ legi_display
8282
msgid "The unpacked files should be stored without modification on you website, in the %s folder (and therefore, the path should be something like this %s)."
8383
msgstr ""
8484

85-
#: legi-display.php:769
85+
#: legi-display.php:776
8686
#@ legi_display
8787
msgid "Once this done, we should be able to import code in the Import tab."
8888
msgstr ""
8989

90-
#: legi-display.php:770
90+
#: legi-display.php:777
9191
#@ legi_display
9292
msgid "How to import the codes?"
9393
msgstr ""
9494

95-
#: legi-display.php:773
95+
#: legi-display.php:780
9696
#@ legi_display
9797
msgid "After the importation, you may insert in a page the shortcode %s in order to create a list of all imported codes. There is also a button in the page editor to insert such shortcode."
9898
msgstr ""
9999

100-
#: legi-display.php:774
100+
#: legi-display.php:781
101101
#@ legi_display
102102
msgid "How to consult a code?"
103103
msgstr ""
104104

105-
#: legi-display.php:779
105+
#: legi-display.php:786
106106
#@ legi_display
107107
msgid "How To"
108108
msgstr ""
109109

110-
#: legi-display.php:783
110+
#: legi-display.php:790
111111
#@ legi_display
112112
msgid "Sub-Dir"
113113
msgstr ""
114114

115-
#: legi-display.php:784
115+
#: legi-display.php:791
116116
#@ legi_display
117117
msgid "The name of the folder that will be used for displaying the French Code:"
118118
msgstr ""
119119

120-
#: legi-display.php:785
120+
#: legi-display.php:792
121121
#@ legi_display
122122
msgid "If the folder is %s, the url to access the code would be something like %s."
123123
msgstr ""
124124

125-
#: legi-display.php:786
125+
#: legi-display.php:793
126126
#@ legi_display
127127
msgid "For consistency, you may create a page accessible through this url and add a shortcode %s to display the list of all code you imported."
128128
msgstr ""
129129

130-
#: legi-display.php:788
130+
#: legi-display.php:795
131131
#@ legi_display
132132
msgid "Web-Crawlers"
133133
msgstr ""
134134

135-
#: legi-display.php:789
135+
#: legi-display.php:796
136136
#@ legi_display
137137
msgid "Allow the web crawlers (%s) to index the codes/articles:"
138138
msgstr ""
139139

140-
#: legi-display.php:790
140+
#: legi-display.php:797
141141
#@ legi_display
142142
msgid "It is recommended to de-activate this option as most of the crawlers penalize websites with a lot of new/similar contents."
143143
msgstr ""
144144

145-
#: legi-display.php:792
145+
#: legi-display.php:799
146146
#@ legi_display
147147
msgid "Appearance"
148148
msgstr ""
149149

150-
#: legi-display.php:793
150+
#: legi-display.php:800
151151
#@ legi_display
152152
msgid "The CSS to be used:"
153153
msgstr ""
154154

155-
#: legi-display.php:794
155+
#: legi-display.php:801
156156
#@ legi_display
157157
msgid "The default value is:"
158158
msgstr ""
159159

160-
#: legi-display.php:799
160+
#: legi-display.php:806
161161
#@ legi_display
162162
msgid "Parameters"
163163
msgstr ""
164164

165-
#: legi-display.php:807
165+
#: legi-display.php:814
166166
#@ legi_display
167167
msgid "Manage translations"
168168
msgstr ""
169169

170-
#: legi-display.php:814
170+
#: legi-display.php:821
171171
#@ legi_display
172172
msgid "Give feedback"
173173
msgstr ""
174174

175-
#: legi-display.php:822
175+
#: legi-display.php:829
176176
#@ legi_display
177177
msgid "Other plugins"
178178
msgstr ""
179179

180-
#: legi-display.php:913
180+
#: legi-display.php:920
181181
#@ legi_display
182182
msgid "No folder %s may be found in %s: Please dowload the XML file on %s and upload the appropriate folder here."
183183
msgstr ""
184184

185-
#: legi-display.php:917
185+
#: legi-display.php:924
186186
#@ legi_display
187187
msgid "The ID of the code should be 20 characters long (here, we have a %s characters long ID)."
188188
msgstr ""
189189

190-
#: legi-display.php:929
190+
#: legi-display.php:936
191191
#@ legi_display
192192
msgid "No folder %s may be found in %s. Please make sure that the ID is correct."
193193
msgstr ""
194194

195-
#: legi-display.php:944
195+
#: legi-display.php:951
196196
#@ legi_display
197197
msgid "%s entries have been imported (i.e. %s new entries and %s updated entries)."
198198
msgstr ""
199199

200-
#: legi-display.php:1730
200+
#: legi-display.php:1737
201201
#@ legi_display
202202
msgid "Error: no id provided"
203203
msgstr ""

legi-display.php

+16-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
Plugin Name: Legi Display
44
Plugin Tag: tag
55
Description: <p>Display French Codes and laws once the XML files are retrieved from ftp://legi@ftp2.journal-officiel.gouv.fr/</p><p>See http://rip.journal-officiel.gouv.fr/index.php/pages/LO for the licence</p>
6-
Version: 1.0.1
6+
Version: 1.0.2
7+
78
89
Framework: SL_Framework
910
Author: SedLex
@@ -438,6 +439,8 @@ function _modify_content($content, $type, $excerpt) {
438439
$crawler = " rel='nofollow'" ;
439440
}
440441

442+
$modified = false ;
443+
441444
// RECHERCHE
442445
if (preg_match_all("/#LEGI#([\w]*)_RECHERCHE#LEGI#/ui", $content, $matches, PREG_SET_ORDER)) {
443446
foreach ($matches as $m) {
@@ -472,6 +475,7 @@ function _modify_content($content, $type, $excerpt) {
472475
echo "Aucune recherche effectuée" ;
473476
}
474477
$content = str_replace($m[0], ob_get_clean(), $content) ;
478+
$modified = true ;
475479
}
476480
}
477481

@@ -487,6 +491,7 @@ function _modify_content($content, $type, $excerpt) {
487491
$array_to_display = $this->get_code_section($m[1]) ;
488492
SLFramework_Treelist::render($array_to_display, true, null, "code_hiera") ;
489493
$content = str_replace($m[0], ob_get_clean(), $content) ;
494+
$modified = true ;
490495
}
491496
$info = @unserialize($wpdb->get_var("SELECT info_code FROM ".$this->table_name." WHERE id_code='".$m[1]."' LIMIT 1")) ;
492497
}
@@ -549,18 +554,21 @@ function _modify_content($content, $type, $excerpt) {
549554
$array_to_display = $this->get_code_section($m[1],$m[2]) ;
550555
SLFramework_Treelist::render($array_to_display, true, null, "code_hiera") ;
551556
$content = str_replace($m[0], ob_get_clean(), $content) ;
557+
$modified = true ;
552558
}
553559
}
554560
// NOTICE
555561

556-
$content .= "<p>&nbsp;</p>" ;
557-
$content .= "<div class='notice_legi'>" ;
558-
$content .= "<p>Ces informations sont issues de la base de données \"<a href='http://www.data.gouv.fr/fr/dataset/legi-codes-lois-et-reglements-consolides'>LEGI</a>\" mise à disposition par LégiFrance, la direction de l'information légale et administrative et les services du Premier ministre.</p>" ;
559-
$content .= "<p>Les données sont reproduites sans modification, si ce n'est celles nécessaires à la mise en forme de la page.</p>" ;
560-
if ((isset($info))&&(is_array($info))) {
561-
$content .= "<p>La dernière mise à jour de ce code a été réalisé le ".$info['derniere_maj'].".</p>" ;
562+
if ($modified) {
563+
$content .= "<p>&nbsp;</p>" ;
564+
$content .= "<div class='notice_legi'>" ;
565+
$content .= "<p>Ces informations sont issues de la base de données \"<a href='http://www.data.gouv.fr/fr/dataset/legi-codes-lois-et-reglements-consolides'>LEGI</a>\" mise à disposition par LégiFrance, la direction de l'information légale et administrative et les services du Premier ministre.</p>" ;
566+
$content .= "<p>Les données sont reproduites sans modification, si ce n'est celles nécessaires à la mise en forme de la page.</p>" ;
567+
if ((isset($info))&&(is_array($info))) {
568+
$content .= "<p>La dernière mise à jour de ce code a été réalisé le ".$info['derniere_maj'].".</p>" ;
569+
}
570+
$content .= "</div>" ;
562571
}
563-
$content .= "</div>" ;
564572

565573
return $content;
566574
}

readme.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ Have fun !
4949

5050
== Changelog ==
5151

52+
= 1.0.2 =
53+
* BUG: The notice was everywhere ...
54+
5255
= 1.0.1 =
5356
* Avoid canonical redirection if the url is a code url
5457

@@ -58,4 +61,4 @@ Have fun !
5861
== Frequently Asked Questions ==
5962

6063

61-
InfoVersion:cbf59b46bce29bc339edf1aa01aee65ea905a1bf
64+
InfoVersion:32adce7a5ed7a975939f67a99424dcdef2cb52a5

0 commit comments

Comments
 (0)