@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | // PUNCTUATION conversion |
| 53 | 53 | $punctuationColl = array_filter( |
| 54 | 54 | TextUtil::ALL_PUNCTUATION, |
| 55 | - function ($value) { |
|
| 55 | + function($value) { |
|
| 56 | 56 | // skip punctuation chars from mixed names (example : "Pierre-Marie L'Anglois") |
| 57 | 57 | return !in_array($value, ["'", '-', '-']); |
| 58 | 58 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $modText = preg_replace_callback_array( |
| 125 | 125 | [ |
| 126 | 126 | // URL |
| 127 | - '#\bhttps?://[^ \]]+#i' => function ($match) { |
|
| 127 | + '#\bhttps?://[^ \]]+#i' => function($match) { |
|
| 128 | 128 | // '#https?\:\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+\#]*[\w\-\@?^=%&/~\+#])?#' |
| 129 | 129 | $this->tokenValue['URL'][] = $match[0]; |
| 130 | 130 | |
@@ -132,26 +132,26 @@ discard block |
||
| 132 | 132 | }, |
| 133 | 133 | // BIBABREV : "dir.", "trad.", "(dir.)", "[dir.]", etc. |
| 134 | 134 | // TODO: regex flaw : "(" not evaluated in BIBABREV. Example : "(dir.)" |
| 135 | - '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function ($match) { |
|
| 135 | + '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function($match) { |
|
| 136 | 136 | $this->tokenValue['BIBABREV'][] = $match[0]; // [1] = dir |
| 137 | 137 | |
| 138 | 138 | return ' BIBABREV '; |
| 139 | 139 | }, |
| 140 | 140 | // AND |
| 141 | - '# (et|and|&|with|avec|e) #' => function ($match) { |
|
| 141 | + '# (et|and|&|with|avec|e) #' => function($match) { |
|
| 142 | 142 | $this->tokenValue['AND'][] = $match[1]; |
| 143 | 143 | |
| 144 | 144 | return ' AND '; |
| 145 | 145 | }, |
| 146 | 146 | // COMMA |
| 147 | - '#,#' => function () { |
|
| 147 | + '#,#' => function() { |
|
| 148 | 148 | return ' COMMA '; |
| 149 | 149 | }, |
| 150 | 150 | // INITIAL : 2) convert letter ("A.") or junior ("Jr.") or senior ("Sr.") |
| 151 | 151 | // extract initial before "." converted in PUNCTUATION |
| 152 | 152 | // Note : \b word boundary match between "L" and "'Amour" in "L'Amour" (for [A-Z]\b) |
| 153 | 153 | // \b([A-Z]\. |[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)+ for grouping "A. B." in same INITIAL ? |
| 154 | - "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function ($match) { |
|
| 154 | + "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function($match) { |
|
| 155 | 155 | $this->tokenValue['INITIAL'][] = $match[0]; |
| 156 | 156 | |
| 157 | 157 | return ' INITIAL '; |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function deleteEmptyValueArray(array $myArray): array |
| 22 | 22 | { |
| 23 | - return array_filter($myArray, function ($value) { |
|
| 23 | + return array_filter($myArray, function($value) { |
|
| 24 | 24 | return !is_null($value) && '' !== $value; |
| 25 | 25 | }); |
| 26 | 26 | } |
@@ -185,7 +185,7 @@ |
||
| 185 | 185 | ) { |
| 186 | 186 | array_walk( |
| 187 | 187 | $matches, |
| 188 | - function (&$value) { |
|
| 188 | + function(&$value) { |
|
| 189 | 189 | $value = str_replace(['CURLYBRACKETO', 'CURLYBRACKETC'], ['{', '}'], $value); |
| 190 | 190 | } |
| 191 | 191 | ); |
@@ -23,9 +23,9 @@ |
||
| 23 | 23 | if (200 !== $response->getStatusCode()) { |
| 24 | 24 | die('not 200 response'); |
| 25 | 25 | } |
| 26 | -try{ |
|
| 26 | +try { |
|
| 27 | 27 | $newText = $response->getBody()->getContents(); |
| 28 | -}catch (Throwable $e){ |
|
| 28 | +} catch (Throwable $e) { |
|
| 29 | 29 | dump($e); |
| 30 | 30 | die; |
| 31 | 31 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | } |
| 26 | 26 | try{ |
| 27 | 27 | $newText = $response->getBody()->getContents(); |
| 28 | -}catch (Throwable $e){ |
|
| 28 | +} catch (Throwable $e){ |
|
| 29 | 29 | dump($e); |
| 30 | 30 | die; |
| 31 | 31 | } |
@@ -221,7 +221,7 @@ |
||
| 221 | 221 | */ |
| 222 | 222 | public function minutesSinceLastEdit(string $title): int |
| 223 | 223 | { |
| 224 | - $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
| 224 | + $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
| 225 | 225 | |
| 226 | 226 | return (int) round((time() - strtotime($time)) / 60); |
| 227 | 227 | } |
@@ -165,7 +165,7 @@ |
||
| 165 | 165 | if (count($res) >= 2 && empty($auteur2)) { |
| 166 | 166 | // delete author-params |
| 167 | 167 | array_map( |
| 168 | - function ($param) { |
|
| 168 | + function($param) { |
|
| 169 | 169 | $this->unsetParam($param); |
| 170 | 170 | }, |
| 171 | 171 | ['auteur', 'auteurs', 'prénom1', 'nom1'] |
@@ -34,11 +34,11 @@ |
||
| 34 | 34 | |
| 35 | 35 | // {{Google Livres|= |
| 36 | 36 | // {{Google Livres|https://books.google.fr/books?id= |
| 37 | - $newText = str_replace('{{Google Livres|https://books.google.fr/books?id=','{{Google Livres|id=',$text); |
|
| 37 | + $newText = str_replace('{{Google Livres|https://books.google.fr/books?id=', '{{Google Livres|id=', $text); |
|
| 38 | 38 | |
| 39 | 39 | sleep(7); |
| 40 | 40 | |
| 41 | - if($newText === $text) { |
|
| 41 | + if ($newText === $text) { |
|
| 42 | 42 | echo "Skip identique\n"; |
| 43 | 43 | continue; |
| 44 | 44 | } |
@@ -136,8 +136,7 @@ |
||
| 136 | 136 | |
| 137 | 137 | private function onlineIsbnSearch(string $isbn, ?string $isbn10 = null) |
| 138 | 138 | { |
| 139 | - online: |
|
| 140 | - echo "sleep 10...\n"; |
|
| 139 | + online : echo "sleep 10...\n"; |
|
| 141 | 140 | sleep(10); |
| 142 | 141 | |
| 143 | 142 | try { |
@@ -32,25 +32,25 @@ discard block |
||
| 32 | 32 | $data = []; |
| 33 | 33 | |
| 34 | 34 | $monitor = $db->fetchRow('select count(id) from temprawopti where optidate is null and edited is null'); |
| 35 | -$data['not analyzed citation'] = (int)$monitor['count(id)']; |
|
| 35 | +$data['not analyzed citation'] = (int) $monitor['count(id)']; |
|
| 36 | 36 | |
| 37 | 37 | $monitor = $db->fetchRow('select count(id) from temprawopti where optidate is not null'); |
| 38 | -$data['analyzed citation'] = (int)$monitor['count(id)']; |
|
| 38 | +$data['analyzed citation'] = (int) $monitor['count(id)']; |
|
| 39 | 39 | |
| 40 | 40 | $monitor = $db->fetchRow('select count(distinct page) as n from temprawopti where skip=1 and edited is null'); |
| 41 | -$data['skip pages'] = (int)$monitor['n']; |
|
| 41 | +$data['skip pages'] = (int) $monitor['n']; |
|
| 42 | 42 | |
| 43 | 43 | $monitor = $db->fetchRow('select count(distinct page) as n from temprawopti where edited is true'); |
| 44 | -$data['edited pages'] = (int)$monitor['n']; |
|
| 44 | +$data['edited pages'] = (int) $monitor['n']; |
|
| 45 | 45 | |
| 46 | 46 | $monitor = $db->fetchRow('select count(id) from temprawopti where optidate > SUBDATE(NOW(),1)'); |
| 47 | -$data['analyzed citation 24H'] = (int)$monitor['count(id)']; |
|
| 47 | +$data['analyzed citation 24H'] = (int) $monitor['count(id)']; |
|
| 48 | 48 | |
| 49 | 49 | $monitor = $db->fetchRow('select count(id) as n from temprawopti where edited > SUBDATE(NOW(),1)'); |
| 50 | -$data['edited citations 24H'] = (int)$monitor['n']; |
|
| 50 | +$data['edited citations 24H'] = (int) $monitor['n']; |
|
| 51 | 51 | |
| 52 | 52 | $monitor = $db->fetchRow('select count(distinct page) as n from temprawopti where edited > SUBDATE(NOW(),1)'); |
| 53 | -$data['edited pages 24H'] = (int)$monitor['n']; |
|
| 53 | +$data['edited pages 24H'] = (int) $monitor['n']; |
|
| 54 | 54 | |
| 55 | 55 | $monitor = $db->fetchRow('SELECT count(distinct A.page) FROM TempRawOpti A |
| 56 | 56 | WHERE notcosmetic=1. |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | ) |
| 66 | 66 | AND A.page = B.page |
| 67 | 67 | )'); |
| 68 | -$data['waiting pages'] = (int)$monitor['count(distinct A.page)']; |
|
| 68 | +$data['waiting pages'] = (int) $monitor['count(distinct A.page)']; |
|
| 69 | 69 | |
| 70 | 70 | $data['currentdate'] = DateUtil::dateEnglish2french((new DateTime())->format('j F Y \à H\:i').' (CEST)'); |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | $monitWiki = ''; |
| 78 | -if(!empty($monitor)) { |
|
| 78 | +if (!empty($monitor)) { |
|
| 79 | 79 | foreach ($monitor as $monit) { |
| 80 | 80 | // % = "%" |
| 81 | 81 | $edited = new DateTime($monit['edited']); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | "<tr><td>%s %</td><td>%s</td><td>[https://fr.wikipedia.org/w/index.php?title=%s&action=history histo]</td><td>[[%s]]</td><td>%s</td></tr>\n", |
| 84 | 84 | $monit['altered'] ?? '?', |
| 85 | 85 | $edited->format('d-m-Y'), |
| 86 | - str_replace(' ','_', $monit['page']), |
|
| 86 | + str_replace(' ', '_', $monit['page']), |
|
| 87 | 87 | $monit['page'] ?? '??', |
| 88 | 88 | $monit['version'] |
| 89 | 89 | ); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | wiki; |
| 123 | 123 | |
| 124 | 124 | $wikiText = str_replace('#monitor#', $monitWiki, $wikiText); |
| 125 | -foreach($data as $key => $dat){ |
|
| 125 | +foreach ($data as $key => $dat) { |
|
| 126 | 126 | $wikiText = str_replace('#'.$key.'#', $dat, $wikiText); |
| 127 | 127 | } |
| 128 | 128 | |