This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:dev:all:wb-adaption [13.06.2015 15:29] – [Maximale Zeilenlänge] translated mrbaseman | en:dev:all:wb-adaption [13.06.2015 16:39] (current) – finished translation and removed the fixme-paragraph mrbaseman | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// | ||
- | |||
====== General adjustment for Website Baker ====== | ====== General adjustment for Website Baker ====== | ||
Since WebsiteBaker existed before the appearance of the PHP FIG standards a few adjustments to the standards are required, which are described below. Further adjustments to adhere are included in the chapters on the individual WB versions / WB version groups! | Since WebsiteBaker existed before the appearance of the PHP FIG standards a few adjustments to the standards are required, which are described below. Further adjustments to adhere are included in the chapters on the individual WB versions / WB version groups! | ||
Line 23: | Line 21: | ||
The target line length is 80 characters. Developers should keep each line of their code below 80 characters, as far as is possible and practicable. Nevertheless, | The target line length is 80 characters. Developers should keep each line of their code below 80 characters, as far as is possible and practicable. Nevertheless, | ||
- | ==== Zeilenbegrenzung | + | ==== Line termination |
- | Die Zeilenbegrenzung folgt der Unix Textdatei Konvention. Zeilen müssen mit einem einzelnen Zeilenvorschubzeichen(**LF**) | + | Line termination follows the Unix text file convention. Lines must end with a single linefeed |
- | :!: **Beachte:** Benutze nicht den Wagenrücklauf | + | :!: **Note:** Do not use the carriage return |
- | ===== Namens-Konventionen | + | ===== Naming conventions |
+ | |||
+ | ==== General | ||
- | ==== Allgemeines | + | Website Baker largely adopts the PSR here as well, in a version slightly adapted to the specific requirements WB. The main difference is found in the structure of the search paths for the files. In later versions also here a further approximation to PSR will take place. |
+ | < | ||
+ | **Note:** | ||
+ | Strict compliance with these conventions is imperative so that there can be no homonyms of classes and functions / methods in different modules. The core is thus able to clearly determine the location of the class file based on the class name to reload them using the autoloader optimized on WB. An explicit inclusion of the class files via include () or require () is superfluous. | ||
+ | </ | ||
+ | ==== Classes | ||
+ | Class names must be declared in **StudlyCaps** (also called // | ||
+ | ^Identifier ^ Status | | ||
+ | |smtp_mailer | [color=red]wrong[/ | ||
+ | |Smtp_Mailer | [color=red]wrong[/ | ||
+ | |SMTPmailer | [color=red]wrong[/ | ||
+ | |SmtpMailer | [color=green]correct[/ | ||
- | WebsiteBaker übernimmt auch hier weitgehendst die PSR in einer an die Besonderheiten von WB angepassten Form. Die wichtigste Abweichung findet sich im Aufbau der Suchpfade für die Dateien. In späteren Versionen wird auch hier eine weitere Annäherung an PSR erfolgen. | + | ==== Abstract classes and interfaces |
- | < | + | In general, abstract classes and interfaces follow the same conventions as classes, with an additional rule: The names of abstract classes and interfaces should end with the term "**Abstract**" or " |
- | **Hinweis: | + | |
- | Die strikte Einhaltung dieser Konventionen ist zwingend erforderlich, | + | |
- | </ | + | |
- | ==== Klassen | + | |
- | Klassennamen müssen in **StudlyCaps** (auch //**UpperCamelCase**// genannt) deklariert werden und müssen folgender RegEx-Regel entsprechen: | + | |
- | ^Bezeichner ^ Status | | + | |
- | |smtp_mailer | [color=red]falsch[/ | + | |
- | |Smtp_Mailer | [color=red]falsch[/ | + | |
- | |SMTPmailer | [color=red]falsch[/ | + | |
- | |SmtpMailer | [color=green]richtig[/ | + | |
- | ==== Abstrakte Klassen und Interfaces | + | ==== Emulated namespaces |
- | Generell folgen abstrakte Klassen und Interfaces der gleichen Konvention wie Klassen, mit einer zusätzlichen Regel: Die Namen von abstrakten Klassen und Interfaces sollten mit dem Term " | + | In this mode in class names the underscore ' |
- | ==== Emulierte Namespaces | + | The class libraries of WebsiteBaker are divided into several groups:\\ |
- | In diesem Modus ist in Klassennamen zusätzlich der Unterstrich | + | **The core classes**: reside in the directory **'' |
+ | **Classes of modules**: classes of modules in the appropriate module directory **'' | ||
+ | **Classes of ACP**: (AdminControlPanel | ||
+ | **Classes of third-party libraries**: | ||
+ | ==== Filenames | ||
+ | As far as the above-mentioned rules for class names have been complied with, the filename would clearly result from the class name. The class **m_MyModul_PluginAbstract** accordingly can be found in the file **'' | ||
+ | For all other files, only alphanumeric characters and the dash (**-**) are allowed. Spaces are strictly prohibited.\\ | ||
+ | Each file which contains executable PHP code should end with the extension **.php** and be carried out in UpperCamelCase. | ||
- | Die Klassenbibliotheken von WebsiteBaker sind in mehrere Gruppen aufgeteilt: | + | ==== Directories ==== |
- | **Klassen des Kerns**: | + | For naming directories the same basis as for files apply. Only alphanumeric characters and a few special characters of standard 7-bit ASCII range <128 (**[color=blue] ! # - . @ ~ [/color]**) are allowed. As with file names, spaces, and the underscore are prohibited. |
- | **Klassen der Module**: Klassen der Module im jeweiligen Modulverzeichnis **'' | + | |
- | **Klassen des ACP**: (AdminControlPanel | + | |
- | **Klassen der third-party libraries**: | + | |
- | ==== Dateinamen ==== | + | ==== Functions and Methods |
- | Soweit die vorgenannten Regeln für Klassennamen eingehalten wurden, ergeben sich die Dateinamen eindeutig aus den Klassennamen. Die Klasse **m_MyModul_PluginAbstract** findet sich demnach in der Datei **'' | + | |
- | Für alle anderen Dateien sind nur alphanummerische Zeichen und der Bindestrich (**-**) gestattet. Leerzeichen sind völlig verboten.\\ | + | |
- | Jede Datei, die ausführbaren PHP Code enthält sollte mit der Endung **.php** enden und in UpperCamelCase-Schreibweise ausgeführt sein. | + | |
- | ==== Verzeichnise ==== | + | |
- | Zur Benennung von Verzeichnissen gelten die selben Grundlagen wie für Dateien. Es sind nur alphanummerische Zeichen sowie nur wenige Sonderzeichen des Standard 7-Bit-ASCII Bereiches <128 (**[color=blue] ! # - . @ ~ [/color]**) zulässig. Wie bei Dateinamen, sind Leerzeichen und der Unterstrich grundsätzlich verboten. | + | |
- | ==== Funktionen und Methoden | + | |
- | Funktions- und Methodennamen dürfen nur Alphanummerische Zeichen enthalten. Unterstriche sind nicht gestattet. Nummern sind in Funktionsnamen gestattet aber in den meisten Fällen nicht empfohlen. | + | Function and method names may only contain alphanumeric characters. Underscores are not permitted. Numbers are however permitted |
- | Wortreichtum wird generell befürwortet. Funktionsnamen sollten so wortreich wie möglich sein um deren Zweck und Verhalten möglichst genau zu erklären. | + | |
- | Funktionen oder Methoden sollen möglichst immer in // | + | Functions or methods have to be written whenever possible |
- | :!: **Achtung:** Es dürfen niemals doppelte Unterstriche als Prefix für Methoden-, Funktions- oder Variablennamen verwendet werden. Es besteht hier die Gefahr, dass es zu Überschneidungen mit aktuellen oder zukünftigen, PHP-eigenen | + | :!: **Warning:** doulble underscores may never be used as a prefix for method, function, or variable names. There is the danger that it overlaps with current or future, PHP's intrinsic |