dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
cms_content_template_language_contract_test.php
Go to the documentation of this file.
1<?php
5
6$moduleDir = dirname(__DIR__);
7$cmsClass = (string)file_get_contents(
8 $moduleDir . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'dbxContent_cms.class.php'
9);
10$templateDir = $moduleDir . DIRECTORY_SEPARATOR . 'tpl' . DIRECTORY_SEPARATOR . 'htm';
11
12foreach (array(
13 'private $contentTemplateNames = null',
14 'private function content_template_names(): array',
15 "dbx/modules/dbxContent/tpl/htm/",
16 'is_array($this->contentTemplateNames)',
17 'foreach ($this->content_template_names() as $name)',
18) as $part) {
19 if (strpos($cmsClass, $part) === false) {
20 fwrite(STDERR, "Sprachunabhängiger Content-Template-Vertrag fehlt: {$part}\n");
21 exit(1);
22 }
23}
24
25$methodStart = strpos($cmsClass, 'private function content_template_names(): array');
26$methodEnd = strpos($cmsClass, 'private function template_options()', $methodStart);
28foreach (array('dbx_lng_resolve_file', 'dbx_lng_name', 'dbx_lng') as $forbidden) {
29 if (strpos($methodSource, $forbidden) !== false) {
30 fwrite(STDERR, "c-*-Layouts dürfen nicht sprachabhängig aufgelöst werden: {$forbidden}\n");
31 exit(1);
32 }
33}
34
35foreach (array('de' => '', 'en' => '_en', 'es' => '_es') as $language => $suffix) {
36 foreach (array(
37 'cms-field-content-template-select',
38 'cms-field-folder-content-template-select',
39 ) as $name) {
40 $file = $templateDir . DIRECTORY_SEPARATOR . $name . $suffix . '.htm';
41 $source = is_file($file) ? (string)file_get_contents($file) : '';
42
43 if (substr_count($source, '{{name}_options}') !== 1) {
44 fwrite(
45 STDERR,
46 "Options-Platzhalter ist in {$language}/{$name} unvollständig oder mehrfach vorhanden.\n"
47 );
48 exit(1);
49 }
50
51 if (strpos($source, '{{name}_options</select>') !== false) {
52 fwrite(STDERR, "Defekter Options-Platzhalter in {$language}/{$name}.\n");
53 exit(1);
54 }
55 }
56}
57
58$contentTemplateDir = dirname($moduleDir) . DIRECTORY_SEPARATOR
59 . 'dbxContent' . DIRECTORY_SEPARATOR . 'tpl' . DIRECTORY_SEPARATOR . 'htm';
60$files = glob($contentTemplateDir . DIRECTORY_SEPARATOR . 'c-*.htm');
61if (!is_array($files) || count($files) < 2) {
62 fwrite(STDERR, "Keine gemeinsame c-*-Templatebasis gefunden.\n");
63 exit(1);
64}
65
66echo "OK: c-*-Content-Templates sind für de/en/es gemeinsam und auswählbar\n";
foreach(array( 'dbx_lng_resolve_file', 'dbx_lng_name', 'dbx_lng') as $forbidden) foreach(array('de'=> '', 'en'=> '_en', 'es'=> '_es') as $language=> $suffix) $contentTemplateDir
foreach(array('private $contentTemplateNames=null', 'private function content_template_names():array', "dbx/modules/dbxContent/tpl/htm/", 'is_array($this->contentTemplateNames)', 'foreach($this->content_template_names() as $name)',) as $part) $methodStart
$moduleDir
Architekturvertrag für die Fehlerprotokoll-Anzeige im Admin-Dashboard.
exit
Definition index.php:146