| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* JCH Optimize - Performs several front-end optimizations for fast downloads |
| 5 |
* |
| 6 |
* @package jchoptimize/wordpress-platform |
| 7 |
* @author Samuel Marshall <samuel@jch-optimize.net> |
| 8 |
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize |
| 9 |
* @license GNU/GPLv3, or later. See LICENSE file |
| 10 |
* |
| 11 |
* If LICENSE file missing, see <http://www.gnu.org/licenses/>. |
| 12 |
*/ |
| 13 |
|
| 14 |
namespace JchOptimize\WordPress\Admin\Settings; |
| 15 |
|
| 16 |
class SettingsPageLayout |
| 17 |
{ |
| 18 |
public static function start(): string |
| 19 |
{ |
| 20 |
return <<<HTML |
| 21 |
<div class="tab-content"> |
| 22 |
<div style="display:none"> |
| 23 |
<fieldset> |
| 24 |
<div> |
| 25 |
HTML; |
| 26 |
} |
| 27 |
|
| 28 |
public static function addTab(string $id, bool $active = false): string |
| 29 |
{ |
| 30 |
$active = $active ? ' active' : ''; |
| 31 |
|
| 32 |
return <<<HTML |
| 33 |
</div> |
| 34 |
</fieldset> |
| 35 |
</div> |
| 36 |
<div class="tab-pane{$active}" id="{$id}"> |
| 37 |
<fieldset style="display: none;"> |
| 38 |
<div> |
| 39 |
HTML; |
| 40 |
} |
| 41 |
|
| 42 |
public static function addSection(string $header = '', string $description = '', string $class = ''): string |
| 43 |
{ |
| 44 |
if (! empty($header)) { |
| 45 |
$header = <<<HMTL |
| 46 |
<legend>{$header}</legend> |
| 47 |
HMTL; |
| 48 |
} |
| 49 |
|
| 50 |
return <<<HTML |
| 51 |
</div> |
| 52 |
</fieldset> |
| 53 |
<fieldset class="jch-group p-4 mb-4 border border-1 rounded"> |
| 54 |
{$header} |
| 55 |
<p class="text-muted">{$description}</p> |
| 56 |
<div> |
| 57 |
HTML; |
| 58 |
} |
| 59 |
|
| 60 |
public static function end(): string |
| 61 |
{ |
| 62 |
return <<<HTML |
| 63 |
</div> |
| 64 |
</fieldset> |
| 65 |
</div> |
| 66 |
</div> |
| 67 |
HTML; |
| 68 |
} |
| 69 |
} |
| 70 |
|