19 require_once
'OPiQuotations/log.inc';
24 ini_set(
'display_errors',
'stdout');
25 ini_set(
'display_startup_errors', 1);
26 ini_set(
'html_errors', 1);
30 assert_options(ASSERT_ACTIVE,
true);
31 assert_options(ASSERT_WARNING,
true);
32 assert_options(ASSERT_BAIL,
true);
37 ini_set(
'display_errors',
'stderr');
38 ini_set(
'display_startup_errors', 0);
39 ini_set(
'html_errors', 0);
43 assert_options(ASSERT_ACTIVE,
false);
44 assert_options(ASSERT_WARNING,
false);
45 assert_options(ASSERT_BAIL,
false);
47 set_error_handler(
'\OPiQuotations\error_handler');
52 mb_internal_encoding(
'UTF-8');
53 mb_regex_encoding(
'UTF-8');
54 mb_http_output(
'UTF-8');
55 mb_detect_order(
'UTF-8');
58 require_once
'OPiQuotations/OPiQuotations.inc';
70 'translation' =>
'Traduction',
72 'work' =>
'Œuvre',
73 'nation' =>
'Nation');
80 foreach ($_GET as $key=>$label) {
89 foreach (array(
'all',
'all_marked') as $key) {
90 if (isset($_params[$key])) {
97 foreach (
$params as $key=>$value) {
98 if ($value !== null) {
99 $params[$key] = preg_replace(
'/\.\.\./',
'…', # ellipsis
100 preg_replace(
'/\'/',
'’', # apostrophe
133 $ids = preg_replace(
'/(^[^0-9]+|[^0-9]+$)/',
'',
$param_value);
134 $ids = mb_split(
'[^\-0-9]+', $ids);
136 for (
$i = 0;
$i < count($ids);
$i++) {
138 $id = preg_replace(
'/(^[^0-9]+|[^0-9]+$)/',
'', $id);
144 $a = mb_split(
'-', $id);
148 $count_a = count($a);
150 for ($j = (
int)$a[0] + 1; $j <= (int)$a[$count_a - 1]; $j++) {
162 $ids = array_unique($ids, SORT_NUMERIC);
164 if ((count($ids) > 0) && ($ids[0] === 0)) {
171 if (count($ids) > 0) {
173 for (
$i = 0;
$i < count($ids) - 1;
$i++) {
174 if ($ids[
$i + 1] !== $ids[
$i] + 1) {
175 $a[] = ($first === $ids[
$i]
177 :
"$first-$ids[$i]");
178 $first = $ids[
$i + 1];
181 $a[] = ($first === $ids[
$i]
183 :
"$first-$ids[$i]");
191 $header =
'<strong>Numéro(s)</strong> '.implode(
', ', $a).
' : '.count(
$quots).
' résultat(s).';
198 $header =
'<strong>Sujet</strong> "'.htmlspecialchars(
$param_value).
'" : '.count(
$quots).
' résultat(s).';
203 $header =
'<strong>Texte</strong> "'.htmlspecialchars(
$param_value).
'" : '.count(
$quots).
' résultat(s).';
208 $header =
'<strong>Auteur</strong> "'.htmlspecialchars(
$param_value).
'" : '.count(
$quots).
' résultat(s).';
213 $header =
'<strong>Œuvre</strong> "'.htmlspecialchars(
$param_value).
'" : '.count(
$quots).
' résultat(s).';
218 $header =
'<strong>Nation</strong> "'.htmlspecialchars(
$param_value).
'" : '.count(
$quots).
' résultat(s).';
223 $header =
'<strong>Traduction</strong> "'.htmlspecialchars(
$param_value).
'" : '.count(
$quots).
' résultat(s).';
228 $header = count(
$quots).
' citations <strong>marquées</strong>.';
232 $header =
'<strong>Toutes</strong> les '.count(
$quots).
' citations.';
236 $header = count(
$quots).
' citations choisies <strong>aléatoirement</strong>.';
241 $only_one = (count(
$quots) === 1);
243 $keywords = [
'citation',
'citations',
'maxime',
'maximes',
'proverbe',
'proverbes',
'littérature',
'français'];
246 $title =
'OPiCitations n°'.$quots[0]->id().
' — Dictionnaire de plus de 3000 citations';
248 $desc =
'OPiCitations n°'.$quots[0]->id().
' :
249 '.htmlspecialchars(
$quots[0]->to_text());
256 :
$quots[0]->author()),
$quots[0]->work()] as $keyword) {
257 if ($keyword !== null) {
259 $a = explode(
' ', $keyword);
268 foreach ($a as $keyword) {
269 $keywords[] = htmlspecialchars($keyword);
282 $title =
'OPiCitations — Dictionnaire de plus de 3000 citations';
284 $desc =
'Dictionnaire de plus de 3000 citations.';
286 if ($header !== null) {
288 '.strip_tags($header);
297 $url_site =
'http://'.$_SERVER[
'HTTP_HOST'].dirname($_SERVER[
'PHP_SELF']).
'/';
301 $url .=
'?id='.$quots[0]->id();
305 $url .=
'?'.$param_key;
315 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
317 <meta name=
"viewport" content=
"width=device-width, initial-scale=1">
319 <meta name=
"author" content=
"Olivier Pirson">
320 <meta name=
"description" content=
"<?php echo $desc; ?>">
321 <meta name=
"keywords" content=
"<?php echo implode(',', $keywords); ?>">
322 <meta name=
"keywords" lang=
"en" content=
"quotation,quotations,maxim,maxims,proverb,proverbs,literature,French">
324 <title><?php echo $title; ?></title>
326 <link rel=
"stylesheet" type=
"text/css" href=
"public/css/style.min.css">
327 <style type=
"text/css" title=
"highlight">
331 <?php
if ($only_one): ?>
332 <script type=
"text/javascript">window.___gcfg = {lang:
'fr', parsetags:
'explicit'};</script>
333 <script type=
"text/javascript" src=
"http://platform.twitter.com/widgets.js" async=
"async"></script>
334 <script type=
"text/javascript" src=
"http://connect.facebook.net/fr_FR/sdk.js" async=
"async"></script>
335 <script type=
"text/javascript" src=
"https://apis.google.com/js/platform.js" async=
"async"></script>
337 <script type=
"text/javascript" src=
"public/js/OPiQuotations.automatic-min.js" async=
"async"></script>
339 <link rel=
"icon" type=
"image/x-icon" href=
"favicon.ico">
341 <link rel=
"canonical" href=
"<?php echo $url; ?>">
343 <meta
property=
"og:image" content=
"<?php echo $url_site; ?>public/img/OPiQuotations<?php
345 $all_is_maxim = !empty($quots) || ($param_key === 'nation');
348 foreach ($quots as $quot) {
349 if (!$quot->is_maxim()) {
350 $all_is_maxim = false;
360 unset($all_is_maxim);
363 <meta
property=
"og:description" content=
"<?php echo $desc_open_graph; ?>">
364 <meta
property=
"og:title" content=
"<?php echo $title; ?>">
365 <meta
property=
"og:type" content=
"website">
366 <meta
property=
"og:url" content=
"<?php echo $url; ?>">
368 <meta name=
"msapplication-TileColor" content=
"#fdfdd0">
369 <meta name=
"msapplication-square150x150logo" content=
"public/img/OPiQuotations-64x64-t.png">
374 <div
class=
"outdated-IE">
375 Votre navigateur est complètement <strong>obsolète</strong>.
377 <strong><a href=
"https://www.mozilla.org/" target=
"_blank">Firefox</a></strong>.
384 foreach (
$LABELS as $key=>$label) {
385 if (isset(
$lists[$key])) {
386 echo
'<section id="list-', $key,
'" class="list" aria-haspopup="true">
388 <button onclick="lists_hide();">Fermer</button>
389 <button class="float-right" onclick="lists_hide();">Fermer</button>
390 <h2>', $label,
's</h2>
392 <div id="list-', $key,
'-container">Chargement…</div>
406 <header
id=
"please-don-t-use-IE">
407 <p>Je vous en supplie,<br>utilisez un <i>vrai</i> navigateur !</p>
410 <strong><a href=
"https://www.mozilla.org/" target=
"_blank">Firefox</a></strong>.
414 <form
class=
"big-buttons" action=
"#">
415 <button name=
"random_10">10 choisies <strong>aléatoirement</strong></button>
416 <button name=
"all_marked">Toutes celles <strong>marquées</strong></button>
417 <button name=
"all"><strong>Toutes</strong> les citations/maximes</button>
419 <ul
id=
"menu" class=
"smallskip">
423 foreach (
$LABELS as $key=>$label) {
424 echo
' <li class="', $key,
'">
426 <label for="', $key,
'">', $label,
'</label> :
428 if (isset(
$lists[$key])) {
429 echo
' <button class="float-right" onclick="list_open(\''.$key.
'\');
return false;
">liste</button>
434 <input id="', $key, '" name="', $key, '" type="text
"', (isset($params[$key])
435 ? ' value="'.htmlspecialchars($params[$key]).'"'
448 <button onclick="highlight_on_off();
" title="Néglige certaines occurences utilisant certains caractères non-alphanumériques.
">Surligner</button>
449 <a class="go-bottom
" href="#bottom
"><span>↓</span></a>
450 <a class="go-top
" href="#top
"><span>↑</span></a>
457 <h2>À propos de</h2>
458 <div aria-haspopup="true">
460 <a class="nodecoration
" href="<?php echo
$url_site; ?>
">O<span class="surname
">Pi</span>Citations</a>
462 <p class="right
">version 02.00.00 — 26 octobre 2015</p>
464 Ensemble des citations pour l’essentiel jadis récoltées par mes soins au hasard de mes lectures
465 (accumulées dans un programme créé à l’époque en AMOS BASIC
466 et déjà réutilisées par ce
471 Vous pouvez me contacter par e-mail pour me signaler toute erreur constatée :
472 <a
class=
"monospace" href=
"mailto:olivier_pirson_opi@yahoo.fr">olivier_pirson_opi@yahoo.fr</a>
474 <p
class=
"smallskip sep">
475 Accompagnent cette application :
479 Une version réduite n’affichant qu’une seule citation
480 (pouvant être utilisée en tant qu’<span
class=
"monospace">iframe</span>
481 pour l’inclure dans une autre page Web) :
482 <strong><a
class=
"uneOPiQuotation" href=
"uneOPiCitation.php" target=
"_blank">une OPiCitation</a></strong>
485 Une citation postée chaque jour sur Twitter :
486 <strong><a href=
"https://twitter.com/OPiCitationJour" target=
"_blank">@OPiCitationJour</a></strong>
489 Une autre sur Facebook :
490 <strong><a href=
"https://www.facebook.com/1OPiCitationParJour" target=
"_blank">1OPiCitationParJour</a></strong>
493 <p
class=
"smallskip sep">
494 Programme PHP/MySQL/HTML/Sass/JavaScript sous licence libre <abbr title=
"GNU General Public License">GPL</abbr>.
498 Sources complètes (avec le fichier de citations) sur Bitbucket :
499 <strong><a lang=
"en" class=
"monospace" href=
"https://bitbucket.org/OPiMedia/opiquotations" target=
"_blank">https:
501 <li><strong><a lang=
"en" href=
"http://www.opimedia.be/DS/webdev/PHP/OPiQuotations/docs/index.html" target=
"_blank">Documentation HTML en ligne</a></strong></li>
503 <p
class=
"smallskip sep ds-jf-opi">
504 D’autres citations sur mes sites :
505 <a href=
"http://www.opimedia.be/DS/citations/index.htm" target=
"_blank"><img src=
"public/img/DS-t.png" width=
"80" height=
"34" alt=
"[DS]"></a>
506 <a href=
"http://www.opimedia.be/JF/citations/index.htm" target=
"_blank"><img src=
"public/img/JF-t.png" width=
"41" height=
"34" alt=
"[JF]"></a>
507 <a href=
"http://www.opimedia.be/citations/index.htm" target=
"_blank"><img src=
"public/img/OPi-t.png" width=
"41" height=
"34" alt=
"[OPi]"></a>
509 <p
class=
"smallskip sep center">
510 <a
class=
"donate" href=
"http://www.opimedia.be/donate/index.htm" target=
"_blank"></a>
511 <a
class=
"opi" href=
"http://www.opimedia.be/" target=
"_blank">Olivier <span
class=
"surname">Pirson</span> O<span
class=
"surname">Pi</span></a>
517 <small>Une citation par jour sur <strong>Twitter</strong> :</small><br>
518 <a
class=
"icon-Twitter" href=
"https://twitter.com/OPiCitationJour" target=
"_blank">@OPiCitationJour</a>
520 <div
class=
"smallskip">
521 <small>Une citation par jour sur <strong>Facebook</strong> :</small><br>
522 <a
class=
"icon-Facebook" href=
"https://www.facebook.com/1OPiCitationParJour" target=
"_blank">1OPiCitationParJour</a>
529 <a
class=
"nodecoration" href=
"<?php echo $url_site; ?>"><span>O<span
class=
"surname">Pi</span>Citations</span></a>
534 if ($header !== null) {
542 foreach (
$quots as $quot) {
554 echo
' <footer id="sharing-global">
555 Partager cette citation :
558 <a class="twitter-share-button" href="https://twitter.com/share" data-lang="fr" data-text="',
$quot_short,
'" data-url="',
$url,
'"',
560 ?
' data-via="OPiCitationJour"' #
' via @OPiCitationJour': length 21
563 <div class="fb-like" data-href="', $url,
'" data-layout="button_count" data-share="true" data-show-faces="true"></div>
565 <div class="g-plus" data-action="share" data-annotation="bubble" data-href="', $url,
'" data-width="120"></div>
574 <nav
id=
"right-panel">
575 <a
class=
"go-top" href=
"#top"><span>↑</span></a>
576 <a
class=
"go-bottom" href=
"#bottom"><span>↓</span></a>
579 <div
id=
"bottom"></div>