This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:dev:284:registry [16.05.2015 11:46] – created Manuela v.d.Decken | en:dev:284:registry [26.09.2023 07:14] (current) – [Changed identifiers] Manuela v.d.Decken | ||
---|---|---|---|
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)// | + | ====== The Registry (WbAdaptor) ====== |
+ | Programming without | ||
- | ====== Die Registry (WbAdaptor) ====== | + | In the medium term it is planned to build up a ' |
- | Programmieren ohne **globale** Konstanten und Variablen. | + | ===== Overview |
+ | Global constants show a fundamental characteristic which very much supports ' | ||
- | Mittelfristig ist geplant, in WebsiteBaker eine ' | + | Global constants (as well as global variables), used within classes, break up their clear encapsulation and can prevent the reusability of the code. See 'Basics of object-oriented programming'. |
- | ===== Überblick ===== | + | |
- | Globale Konstanten haben eine grundlegende Eigenschaft, | + | |
- | Den scheinbaren Vorteilen stehen jedoch auch deutliche Nachteile gegenüber. | + | |
- | Sicherheitskritische Daten gehören **niemals** in Konstanten abgelegt. Das schönste Negativbeispiel sind in früheren WB-Versionen die Zugangsdaten zur Datenbank, die dadurch im letzten Droplet, im letzten variablen Codestück eines Templates etc. für jederman absolut frei zugänglich waren. | + | |
- | Globale Konstanten (ebenso wie globale Variablen), benutzt innerhalb von Klassen, durchbrechen deren klare Datenkapselung und können die Wiederverwendbarkeit von Code verhindern. Siehe ' | + | Global constants are, as has long been stated, from this version on deprecated, that is undesirable. See: [[dev: |
- | Globale Konstanten sind ja, wie schon seit langem bekannt, ab dieser Version deprecated, sprich unerwünscht. Siehe: [[dev: | + | Of course, discarding all previous constants without any replacement is clearly not a feasible approach. That's simply impossible. At least in the first step, the class ' |
- | Selbstverständlich funktioniert das jetzt nicht so, dass man alle bisherigen Konstanten einfach nur Ersatzlos streicht. Das ist schlichtweg unmöglich. Zumindest im ersten Schritt stellt die Klasse | + | A significant change has arisen about the spelling of the identifier: |
+ | The identifiers have been written entirely in capital letters and separated several individual words with an underscore **_**, the new identifiers however still consist of the same sub strings, but now they are written in '**// | ||
- | Eine wesentliche Änderung hat sich bei der Schreibweise der Bezeichner ergeben:\\ | + | __Example:__ **DEFAULT_TEMPLATE** becomes |
- | Wurden die Bezeichner bisher ausschließlich in Großbuchstaben geschrieben und mehrere Einzelworte durch einen Unterstrich | + | |
- | __Beispiel: | + | The transformation of the identifier is performed automatically when reading in the class WbAdaptor. |
- | Die Transformation der Bezeichner erfolgt automatisch beim Einlesen in die Klasse WbAdaptor. | + | So far so good. To make it not too simple, for about a dozen former constants the identifier (key) and also partially the content has completely changed!! |
- | Soweit so gut. Damit es nicht ganz so einfach wird, hat sich bei einem runden Dutzend ehemaliger Konstanten der Bezeichner(Schlüssel) komplett verändert und auch teilweise der Inhalt!! | + | ===== Changed identifiers ===== |
+ | List of new identifiers and examples of the current contents.\\ | ||
+ | FIXME (note: this list is not complete!) | ||
- | ===== Geänderte Bezeichner ===== | + | ^old constant |
- | + | |NEW |getDatabase() | |
- | Liste mit neuen Bezeichnern und Beispielen des jetzigen Inhaltes.\\ | + | |NEW |
- | FIXME (Achtung: diese Liste ist nicht vollständig!) | + | |NEW |getApplication() |
- | + | |NEW | |
- | ^alte Konstante | + | |NEW |PageId |
- | |{neu eingeführt} | + | |NEW |BlockId |
- | |{neu eingeführt} | + | |NEW |SectionId |
- | |{neu eingeführt} | + | |
- | |{neu eingeführt} | + | |
- | |{neu eingeführt} | + | |
- | |{neu eingeführt} | + | |
|WB_URL | |WB_URL | ||
- | |WB_REL | + | |WB_REL |
- | |WB_PATH | + | |WB_PATH |
|ADMIN_URL | |ADMIN_URL | ||
|ADMIN_REL | |ADMIN_REL | ||
Line 47: | Line 43: | ||
|TEMPLATE | |TEMPLATE | ||
|TEMPLATE_DIR | |TEMPLATE_DIR | ||
- | |{neu eingeführt} | + | |NEW |TemplateUrl |
- | |{neu eingeführt} | + | |NEW |TemplateRel |
- | |{neu eingeführt} | + | |NEW |TemplatePath |
|ADMIN_DIRECTORY | |ADMIN_DIRECTORY | ||
|PAGES_DIRECTORY | |PAGES_DIRECTORY | ||
Line 56: | Line 52: | ||
|WB_REVISION | |WB_REVISION | ||
|WB_SP | |WB_SP | ||
- | |{neu eingeführt} | + | |NEW |AppName |
- | |STRING_DIR_MODE | + | |STRING_DIR_MODE |
- | |OCTAL_DIR_MODE | + | |OCTAL_DIR_MODE |
- | |STRING_FILE_MODE | + | |STRING_FILE_MODE |
- | |OCTAL_FILE_MODE | + | |OCTAL_FILE_MODE |
- | Wer die Liste aufmerksam durchschaut, wird ein paar neue Gesetzmäßigkeiten erkennen: | + | Who looks attentively at the list, will recognize a few new laws: |
- | Die Zeichenfolge | + | The string |
- | Die Zeichenfolge | + | The string |
- | Unabhängig von den geänderten Präfixes gelten folgende Regeln für Endungen: | + | Regardless of the changed prefixes, the following rules apply for extensions: |
- | * xxx**Url** | + | |
- | * xxx**Path** | + | |
- | * xxx**Rel** | + | |
- | * xxx**Dir** | + | |
- | __Für alle Angaben gemeinsam gilt:__ | + | |
- | * Als PATH_SEPERATOR ist ausschließlich der Slash** / ** zugelassen. Anpassungen können problemlos erfolgen mit\\ <php> $sPath = str_replace(' | + | |
- | * Ist das letzte Element einer URL-,Rel-, Path-, oder Dir-Angabe ein Verzeichnis, | + | |
- | * Um sicher zu stellen, dass ein Verzeichnis mit einem einzelnen Slash** / **abgeschlossen wird genügt die kurze Sequenz\\ <php> $sPath = rtrim($sPath, | + | |
- | * Führende Slashes** / **werden entfernt mit\\ < | + | |
- | ALT => NEU Beispiele: | + | __for all statements in common the following rules apply:__ |
- | | ^ Schlüssel | + | |
- | ^alt | WB_URL | + | |
- | ^neu | AppUrl | + | |
- | ^alt | ADMIN_REL | + | |
- | ^neu | AcpRel | + | |
- | ^alt | PAGES_DIRECTORY | + | |
- | ^neu | PagesDir | + | |
- | ^alt | TEMPLATE_DIR | + | |
- | ^neu | TemplateDir | + | |
+ | OLD => NEW example: | ||
+ | | ^ key ^ value ^ | ||
+ | ^old | WB_URL | ||
+ | ^new | AppUrl | ||
+ | ^old | ADMIN_REL | ||
+ | ^new | AcpRel | ||
+ | ^old | PAGES_DIRECTORY | ||
+ | ^new | PagesDir | ||
+ | ^old | TEMPLATE_DIR | ||
+ | ^new | TemplateDir | ||
- | ===== Anwendung von WbAdaptor ===== | + | ===== Application of WbAdaptor ===== |
- | Diese Klasse ist von überall zu erreichen. Es genügt völlig, die einzig existierende, | + | This class can be reached from anywhere. It is sufficient to import that only existing active instance of the class with\\ <code> $oReg = \bin\WbAdaptor:: |
+ | But even better is the use of dependency injection, i.e. the transfer of the instance from outside to the function or class. | ||
- | :!: Es wird dringend empfohlen, den Bezeichner | + | :!: It is strongly recommended that the identifier |
- | Auch der Abruf der einzelnen Werte ist recht unproblematisch:\\ | + | Also the request of the individual values quite straightforward:\\ |
- | <php> echo $oReg-> | + | <code> echo $oReg-> |
- | Ausgabe: '' | + | Output: '' |
- | Was nach außen nicht sichtbar ist, ist der Umstand dass alle abrufbaren Werte in zwei Basis-Gruppen abgelegt sind: | + | What is not visible from the outside, the fact is that all retrievable values are stored |
- | * // | + | * // |
- | * // | + | * // |
- | Die // | + | The system values are protected and can **not** be overridden by // |