This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:dev:284:registry [12.08.2015 20:05] – fixed some wiki syntax mistakes mrbaseman | 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) ====== | ====== The Registry (WbAdaptor) ====== | ||
Programming without **global** constants and variables. | Programming without **global** constants and variables. | ||
Line 10: | Line 8: | ||
Global constants (as well as global variables), used within classes, break up their clear encapsulation and can prevent the reusability of the code. See ' | Global constants (as well as global variables), used within classes, break up their clear encapsulation and can prevent the reusability of the code. See ' | ||
- | Global constants are, as has long been stated, from this version on deprecated, that is undesirable. See: [[en:dev: | + | Global constants are, as has long been stated, from this version on deprecated, that is undesirable. See: [[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 ' | 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 ' | ||
Line 29: | Line 27: | ||
^old constant | ^old constant | ||
- | |{introduced} | + | |NEW |getDatabase() |
- | |{introduced} | + | |NEW |getTranslate() |
- | |{introduced} | + | |NEW |getApplication() |
- | |{introduced} | + | |NEW |
- | |{introduced} | + | |NEW |PageId |
- | |{introduced} | + | |NEW |BlockId |
+ | |NEW |SectionId | ||
|WB_URL | |WB_URL | ||
- | |WB_REL | + | |WB_REL |
|WB_PATH | |WB_PATH | ||
|ADMIN_URL | |ADMIN_URL | ||
Line 44: | Line 43: | ||
|TEMPLATE | |TEMPLATE | ||
|TEMPLATE_DIR | |TEMPLATE_DIR | ||
- | |{introduced} | + | |NEW |TemplateUrl |
- | |{introduced} | + | |NEW |TemplateRel |
- | |{introduced} | + | |NEW |TemplatePath |
|ADMIN_DIRECTORY | |ADMIN_DIRECTORY | ||
|PAGES_DIRECTORY | |PAGES_DIRECTORY | ||
Line 53: | Line 52: | ||
|WB_REVISION | |WB_REVISION | ||
|WB_SP | |WB_SP | ||
- | |{introduced} | + | |NEW |AppName |
|STRING_DIR_MODE | |STRING_DIR_MODE | ||
|OCTAL_DIR_MODE | |OCTAL_DIR_MODE | ||
Line 70: | Line 69: | ||
* xxx**Dir** contains one or more successive directory names, and **must not** start with a slash ** / **. | * xxx**Dir** contains one or more successive directory names, and **must not** start with a slash ** / **. | ||
- | __Für alle Angaben gemeinsam gilt:__ | + | __for all statements in common the following rules apply:__ |
- | * Als PATH_SEPERATOR | + | * As PATH_SEPERATOR |
- | * Ist das letzte Element einer URL-,Rel-, Path-, | + | * If the last element of a URL, Rel, Path-, |
- | * Um sicher zu stellen, dass ein Verzeichnis mit einem einzelnen Slash** / **abgeschlossen wird genügt die kurze Sequenz\\ <php> $sPath = rtrim($sPath, | + | * To ensure that a directory path is terminated with a single slash** / **the short sequence is sufficient\\ <code> $sPath = rtrim($sPath, |
- | * Führende Slashes** / **werden entfernt mit\\ <php> $sPath = ltrim($sPath, | + | * |
- | + | ||
- | ALT => NEU Beispiele: | + | |
- | | ^ 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 // |