Skip to content

Commit fd68228

Browse files
MaelBriantinArthurlbc
authored andcommitted
feat(page-options): add page options classes for wkhtmltopdf
1 parent d6d4eda commit fd68228

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+986
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class Allow implements ExtraOption
10+
{
11+
public function __construct(private readonly string $path)
12+
{
13+
}
14+
15+
public function isRepeatable(): bool
16+
{
17+
return true;
18+
}
19+
20+
public function compile(): array
21+
{
22+
return ['--allow', $this->path];
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class BypassProxyFor implements ExtraOption
10+
{
11+
public function __construct(private readonly string $value)
12+
{
13+
}
14+
15+
public function isRepeatable(): bool
16+
{
17+
return true;
18+
}
19+
20+
public function compile(): array
21+
{
22+
return ['--bypass-proxy-for', $this->value];
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class CacheDir implements ExtraOption
10+
{
11+
public function __construct(private readonly string $path)
12+
{
13+
}
14+
15+
public function isRepeatable(): bool
16+
{
17+
return false;
18+
}
19+
20+
public function compile(): array
21+
{
22+
return ['--cache-dir', $this->path];
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class CheckBoxSvg implements ExtraOption
10+
{
11+
public function __construct(private readonly string $path)
12+
{
13+
}
14+
15+
public function isRepeatable(): bool
16+
{
17+
return false;
18+
}
19+
20+
public function compile(): array
21+
{
22+
return ['--checkbox-svg', $this->path];
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class CheckboxCheckedSvg implements ExtraOption
10+
{
11+
public function __construct(private readonly string $path)
12+
{
13+
}
14+
15+
public function isRepeatable(): bool
16+
{
17+
return false;
18+
}
19+
20+
public function compile(): array
21+
{
22+
return ['--checkbox-checked-svg', $this->path];
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class Cookie implements ExtraOption
10+
{
11+
public function __construct(private readonly string $name, private readonly string $value)
12+
{
13+
}
14+
15+
public function isRepeatable(): bool
16+
{
17+
return true;
18+
}
19+
20+
public function compile(): array
21+
{
22+
return ['--cookie', $this->name, $this->value];
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class CustomHeader implements ExtraOption
10+
{
11+
public function __construct(private readonly string $name, private readonly string $value)
12+
{
13+
}
14+
15+
public function isRepeatable(): bool
16+
{
17+
return true;
18+
}
19+
20+
public function compile(): array
21+
{
22+
return ['--custom-header', $this->name, $this->value];
23+
}
24+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class CustomHeaderPropagation implements ExtraOption
10+
{
11+
public function isRepeatable(): bool
12+
{
13+
return false;
14+
}
15+
16+
public function compile(): array
17+
{
18+
return ['--custom-header-propagation'];
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class DefaultHeader implements ExtraOption
10+
{
11+
public function isRepeatable(): bool
12+
{
13+
return false;
14+
}
15+
16+
public function compile(): array
17+
{
18+
return ['--default-header'];
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class DisableExternalLinks implements ExtraOption
10+
{
11+
public function isRepeatable(): bool
12+
{
13+
return false;
14+
}
15+
16+
public function compile(): array
17+
{
18+
return ['--disable-external-links'];
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class DisableInternalLinks implements ExtraOption
10+
{
11+
public function isRepeatable(): bool
12+
{
13+
return false;
14+
}
15+
16+
public function compile(): array
17+
{
18+
return ['--disable-internal-links'];
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class DisableJavascript implements ExtraOption
10+
{
11+
public function isRepeatable(): bool
12+
{
13+
return false;
14+
}
15+
16+
public function compile(): array
17+
{
18+
return ['--disable-javascript'];
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class DisableSmartShrinking implements ExtraOption
10+
{
11+
public function isRepeatable(): bool
12+
{
13+
return false;
14+
}
15+
16+
public function compile(): array
17+
{
18+
return ['--disable-smart-shrinking'];
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class EnableForms implements ExtraOption
10+
{
11+
public function isRepeatable(): bool
12+
{
13+
return false;
14+
}
15+
16+
public function compile(): array
17+
{
18+
return ['--enable-forms'];
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class EnableLocalFileAccess implements ExtraOption
10+
{
11+
public function isRepeatable(): bool
12+
{
13+
return false;
14+
}
15+
16+
public function compile(): array
17+
{
18+
return ['--enable-local-file-access'];
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
6+
7+
use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;
8+
9+
class EnablePlugins implements ExtraOption
10+
{
11+
public function isRepeatable(): bool
12+
{
13+
return false;
14+
}
15+
16+
public function compile(): array
17+
{
18+
return ['--enable-plugins'];
19+
}
20+
}

0 commit comments

Comments
 (0)