This repository was archived by the owner on Dec 21, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathgenerate.php
More file actions
executable file
·66 lines (52 loc) · 1.67 KB
/
generate.php
File metadata and controls
executable file
·66 lines (52 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env php
<?php
declare(strict_types=1);
require_once __DIR__ . '/config.php';
if ( $argc > 1 && $argv[1] === '-c' ) {
if ( empty( $argv[2] ) ) {
exit( 'Please provide a path to the configuration file.' );
}
if ( ! file_exists( $argv[2] ) ) {
exit( 'The provided configuration file does not exist: ' . $argv[2] );
}
require_once $argv[2];
} elseif ( file_exists( __DIR__ . '/local.config.php' ) ) {
require_once __DIR__ . '/local.config.php';
}
if ( class_exists( '\ReCalendar\LocalConfig' ) ) {
$config = new \Recalendar\LocalConfig();
} else {
$config = new \Recalendar\Config();
}
setlocale( LC_TIME, $config->get( \ReCalendar\Config::LOCALE ) );
require_once __DIR__ . '/recalendar.php';
function l( $stuff ) : void {
if ( is_string( $stuff ) ) {
echo $stuff . "\n";
} else {
var_export( $stuff );
echo "\n";
}
}
$defaultConfig = ( new \Mpdf\Config\ConfigVariables() )->getDefaults();
$fontDirs = $defaultConfig['fontDir'];
$defaultFontConfig = ( new \Mpdf\Config\FontVariables() )->getDefaults();
$fontData = $defaultFontConfig['fontdata'];
$mpdf = new \Mpdf\Mpdf( [
'fontDir' => array_merge( $fontDirs, [
__DIR__ . $config->get( \ReCalendar\Config::FONT_DIR ),
] ),
'fontdata' => $fontData + $config->get( \ReCalendar\Config::FONT_DATA ),
'mode' => 'utf-8',
'format' => $config->get( \ReCalendar\Config::FORMAT ),
'default_font' => $config->get( \ReCalendar\Config::FONT_DEFAULT ),
'margin_left' => 0,
'margin_right' => 0,
'margin_top' => 0,
'margin_bottom' => 0,
'margin_header' => 0,
'margin_footer' => 0,
] );
$mpdf->useSubstitutions = false;
$recalendar = new \ReCalendar\ReCalendar( $mpdf, $config );
$recalendar->generate();