User Tools

Site Tools


en:dev:all:wb-adaption

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:dev:all:wb-adaption [13.06.2015 15:47] – [Allgemeines] translated mrbasemanen: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 36: Line 34:
 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. 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.
 </blockquote>Website Baker from v2.8.4 on requires PHP 5.4.x as a minimum requirement. For a transitional period 2 different naming conventions for classes are permitted. However, the stated objective is to convert entirely to namespaces to utilize their advantages and also to reduce the cost significantly when naming classes. </blockquote>Website Baker from v2.8.4 on requires PHP 5.4.x as a minimum requirement. For a transitional period 2 different naming conventions for classes are permitted. However, the stated objective is to convert entirely to namespaces to utilize their advantages and also to reduce the cost significantly when naming classes.
-==== Klassen ==== +==== Classes ==== 
-Klassennamen müssen in **StudlyCaps** (auch //**UpperCamelCase**// genanntdeklariert werden und müssen folgender RegEx-Regel entsprechen: '/[A-Z][a-zA-Z0-9]+/'Nummern sind in Klassennamen gestattetsollten jedoch auf das Notwendigste beschränkt werden und keine Verwechslungsgefahr mit Buchstaben bergenBesteht der Klassenname aus mehr als einem Wortso ist der jeweils erste Buchstabe eines Wortes groß zu schreibenMehrere aufeinanderfolgende Großbuchstaben sind nicht erlaubtBeispiel anhand eines Namens+Class names must be declared in **StudlyCaps** (also called //**UpperCamelCase**//and correspond to the following RegEx rule '/[A-Z][a-zA-Z0-9]+/'Numbers are permitted in class namesbut should be limited to what is necessary and do not pose any risk of confusion with lettersIf the class name consists of more than one wordthe respective first letter of a word has to be in uppercaseSeveral consecutive uppercase letters are not allowedExample based on a name
-^Bezeichner ^ Status | +^Identifier ^ Status | 
-|smtp_mailer | [color=red]falsch[/color] | +|smtp_mailer | [color=red]wrong[/color] | 
-|Smtp_Mailer | [color=red]falsch[/color] | +|Smtp_Mailer | [color=red]wrong[/color] | 
-|SMTPmailer | [color=red]falsch[/color] | +|SMTPmailer | [color=red]wrong[/color] | 
-|SmtpMailer | [color=green]richtig[/color] |+|SmtpMailer | [color=green]correct[/color] | 
 + 
 +==== 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 "**Interface**", and the term must not be preceded by an underscore. As an example //**Plugin_Abstract**// is considered invalid, but **PluginAbstract** or **m_MyModul_PluginAbstract** would be valid names.
  
-==== Abstrakte Klassen und Interfaces ==== +==== Emulated namespaces ==== 
-Generell folgen abstrakte Klassen und Interfaces der gleichen Konvention wie Klassenmit einer zusätzlichen Regel: Die Namen von abstrakten Klassen und Interfaces sollten mit dem Term "**Abstract**" bzw"**Interface**" endenund dem Term darf kein Unterstrich vorangestellt seinAls Beispiel wird //**Plugin_Abstract**// als ungültig angenommenaber **PluginAbstract** oder **m_MyModul_PluginAbstract** wären gültige Namen.+In this mode in class names the underscore '_' is permitted additionally as special/functional character. Howeverit is intended solely as path separatorClass names in this context do not only consist of the name defined so farbut they must also contain a well-defined prefixOnly then it is possible to find the correct file out of the class nameso that the appropriate file can be loaded automatically (included) when accessing a class.
  
-==== Emulierte Namespaces ==== +The class libraries of WebsiteBaker are divided into several groups:\\ 
-In diesem Modus ist in Klassennamen zusätzlich der Unterstrich '_als Sonder-/Funktionszeichen gestattetEr dient jedoch ausschließlich als PfadseperatorKlassennamen bestehen hier nicht allein aus dem bis jetzt definierten Namensondern müssen zusätzlich noch genau definierte Präfixes enthalten. Nur dann ist es möglich, aus dem Klassennamen den exakten Dateinamen zu ermitteln, so dass die passende Datei bei einem Zugriff auf eine Klasse automatisch geladen(includedwerden kann.+**The core classes**: reside in the directory **''wb/framework/''** or one of its subdirectories. For these no prefix is needed at all.\\ 
 +**Classes of modules**: classes of modules in the appropriate module directory **''wb/modules/%module_name%/''** or one of its subdirectories. The identifier must necessarily get the prefix '**m_**'. **Example:** m_MyModule_PluginInterface \\ 
 +**Classes of ACP**: (AdminControlPanel => Former backend) are located in the directory **''wb/admin/''** or one of its subdirectories. The ClassIdentifier must necessarily get the prefix '**a_**'. **Example:** a_Pages_PageTree\\ 
 +**Classes of third-party libraries**: lying in the directory **''wb/include/''** and its subdirectories are not automatically covered by the autoloader. However, each library has the ability to carry out its own registration in the SPL autoloader stack. More on this can be found in the description of the autoloader the respective WB version. 
 +==== 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 **''wb/modules/MyModul/PluginAbstract.php''**.\\ 
 +For all other filesonly 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**:  sind im Verzeichnis **''wb/framework/''** oder einem seiner Unterverzeichnisse zu findenHierfür ist kein Prefix erforderlich.\\ +For naming directories the same basis as for files applyOnly alphanumeric characters and a few special characters of standard 7-bit ASCII range <128 (**[color=blue] ! # - @ ~ [/color]**) are allowedAs with file namesspacesand the underscore are prohibited.
-**Klassen der Module**: Klassen der Module im jeweiligen Modulverzeichnis **''wb/modules/%modul_name%/''** oder einem seiner Unterverzeichnisse. Der Bezeichner muss zwingend den Prefix  '**m_**' erhalten. **Beispiel:** m_MyModule_PluginInterface \\ +
-**Klassen des ACP**: (AdminControlPanel => ehemBackend) sind im Verzeichnis **''wb/admin/''** oder einem seiner Unterverzeichnisse zu findenDer KlassenBezeichner muss zwingend den Prefix '**a_**' erhalten. **Beispiel:** a_Pages_PageTree\\ +
-**Klassen der third-party libraries**: die im Verzeichniss **''wb/include/''** sowie seinen Unterverzeichnissen liegenwerden vom Autoloader nicht automatisch erfasst. Jede Library hat jedoch die Möglichkeiteine eigene Registrierung im SPL-Autoloaderstack vorzunehmen. Mehr dazu in der Beschreibung des Autoloaders der jeweiligen WB-Version.+
  
-==== 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 **''wb/modules/MyModul/PluginAbstract.php''**.\\ +
-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 enthaltenUnterstriche sind nicht gestattetNummern sind in Funktionsnamen gestattet aber in den meisten Fällen nicht empfohlen. +Function and method names may only contain alphanumeric charactersUnderscores are not permittedNumbers are however permitted in function names in most cases however not recommendedVerbosity is generally encouragedFunction names should be as verbose as possible to describe their purpose and behavior as precisely as possible.
-Wortreichtum wird generell befürwortetFunktionsnamen 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 //**lowerCamelCase**// (oder einfach //**camelCase**//geschrieben werdenDas bedeutet, mit einem klein geschriebenen Verb wie //get//, //set//, //add//, //delete//, //load//, //save//, //execute// etc. beginnen, das dann von einem Substantiv in StudlyCaps gefolgt werden kann, welches das zu bearbeitende Objekt beschreibtBeispiel: <php> $oMyObject->saveItemList(); </php> oder <php> reloadAllModules(); </php>+Functions or methods have to be written whenever possible in //**lowerCamelCase**// (or simply //**camelCase**//). This means they should begin with a lowercase verb like //get//, //set//, //add//, //delete//, //load//, //save//, //execute// etc. followed by a noun in StudlyCaps that describes the object to be processedExample: <php> $oMyObject->saveItemList(); </php> or <php> reloadAllModules(); </php>
  
-:!: **Achtung:** Es dürfen niemals doppelte Unterstriche als Prefix für Methoden-Funktions- oder Variablennamen verwendet werden. Es besteht hier die Gefahrdass es zu Überschneidungen mit aktuellen oder zukünftigen, PHP-eigenen Magic-Functions etc. kommt.+:!: **Warning:** doulble underscores may never be used as a prefix for methodfunctionor variable names. There is the danger that it overlaps with current or future, PHP's intrinsic Magic Functions etc..
  
en/dev/all/wb-adaption.1434210429.txt.gz · Last modified: 13.06.2015 15:47 by mrbaseman