parent
							
								
									f5a4e5d5a0
								
							
						
					
					
						commit
						d9f745a9ee
					
				
				 2 changed files with 1 additions and 45 deletions
			
			
		| @ -1,44 +0,0 @@ | |||||||
| <?php |  | ||||||
| // read vor.txt and generate vor.md, inserting dates if missing |  | ||||||
| date_default_timezone_set("CET"); |  | ||||||
| setlocale(LC_TIME, 'de_DE.utf8'); |  | ||||||
| $file_txt = 'vor.txt'; |  | ||||||
| $file_md = 'vor.md'; |  | ||||||
| $fil = file($file_txt, FILE_IGNORE_NEW_LINES); |  | ||||||
| // Insert header |  | ||||||
| $arr = ['| | |  |', '|:------|:------|:------|']; |  | ||||||
| $ts=(new DateTime('first day of this month'))->getTimeStamp(); |  | ||||||
| $tues_ts = strtotime('fourth tuesday of this month', $ts); |  | ||||||
| 
 |  | ||||||
| // Are we past the fourth Tuesday of     the month?  |  | ||||||
| if ((new DateTime())->getTimeStamp() >= $tues_ts) { |  | ||||||
|     $ts = strtotime('+1 month', $ts); |  | ||||||
| }     |  | ||||||
| 
 |  | ||||||
| // This for PHP >= 8.1 as the old strftime will be deprecated by then |  | ||||||
| // $date_time = new DateTime(); |  | ||||||
| // $date_time->setTimestamp(strtotime('fourth tuesday of this month', $ts)); |  | ||||||
| foreach ($fil as $line) { |  | ||||||
|     // Skip empty lines |  | ||||||
|     if (strlen($line)) { |  | ||||||
|         $fields = array_filter(explode('|', $line)); |  | ||||||
|         if (count($fields) == 2) { |  | ||||||
|             // Date missing, insert |  | ||||||
|             $tuesday = strftime('%A, %d.%m.%Y ', strtotime('fourth tuesday of this month', $ts)); |  | ||||||
|             // $tuesday = datefmt_format_object($date_time, 'cccc, d.M.yyyy ', 'de_DE.utf8'); |  | ||||||
|             array_unshift($fields, $tuesday); |  | ||||||
|         } |  | ||||||
|         $ts = strtotime('+1 month', $ts); |  | ||||||
|         $li = implode('|', $fields); |  | ||||||
|         // Insert leading and trailing spaces if required |  | ||||||
|         if ($li[0] != ' ') { |  | ||||||
|             $li = ' ' . $li; |  | ||||||
|         } |  | ||||||
|         if (substr($li, -1) != ' ') { |  | ||||||
|             $li = $li . ' '; |  | ||||||
|         } |  | ||||||
|         array_push($arr, '|' . $li . '|');     |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| file_put_contents($file_md, implode(PHP_EOL, $arr) . PHP_EOL); |  | ||||||
| ?> |  | ||||||
| @ -1,6 +1,6 @@ | |||||||
| | November-FAQ | alle | | | November-FAQ | alle | | ||||||
| | Dezember | Jahresausklang (Details inkl. Zeit und Ort via ML) | alle | | | Dezember | Jahresausklang (Details inkl. Zeit und Ort via ML) | alle | | ||||||
| | Januar- / Jahreseinklangs-FAQ | alle | | | Januar- / Jahreseinklangs-FAQ | alle | | ||||||
| | OS-Level Virtualisation Teil 1 (Container und anderes Voodoo) | Christoph | | | OS-Level Virtualisation Teil 1 (Container und anderer Voodoo) | Christoph | | ||||||
| | OS-Level Virtualisation Teil 2 (Kubernetes und weiterer Hipster-Krimskrams) | Christoph | | | OS-Level Virtualisation Teil 2 (Kubernetes und weiterer Hipster-Krimskrams) | Christoph | | ||||||
| 
 | 
 | ||||||
|  | |||||||
					Loading…
					
					
				
		Reference in new issue