User Tools

Site Tools


en:dev:284:registry

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:284:registry [12.08.2015 20:18] – [Changed identifiers] translated to the end of the section mrbasemanen: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 'Basics of object-oriented programming'. 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'.
  
-Global constants are, as has long been stated, from this version on deprecated, that is undesirable. See: [[en:dev:284:deprecated|Deprecated-List Entry 10 from 12.2013]].+Global constants are, as has long been stated, from this version on deprecated, that is undesirable. See: [[dev:284:deprecated|Deprecated-List Entry 10 from 12.2013]].
  
 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 '**WbAdaptor**' makes properties available that are similar to the previous constants. 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 '**WbAdaptor**' makes properties available that are similar to the previous constants.
Line 29: Line 27:
  
 ^old constant   ^new key    ^content (example)  ^ ^old constant   ^new key    ^content (example)  ^
-|{introduced}      |Db              |the current object for accessing the database +|NEW               |getDatabase()   |the current object for accessing the database 
-|{introduced}      |Trans           |the current translation object                 | +|NEW               |getTranslate()  |the current translation object                 | 
-|{introduced}      |App             |the current application/core object            |  +|NEW               |getApplication() |the current application/core object ($wb or $admin) |  
-|{introduced}      |PageId          |the ID of the current page                     | +|NEW               |getRequester()  |the current requester Objekt                  
-|{introduced}      |BlockId         |the ID of the current block                    | +|NEW               |PageId          |the ID of the current page                     | 
-|{introduced}      |SectionId       |the ID of the current section                  |+|NEW               |BlockId         |the ID of the current block                    | 
 +|NEW               |SectionId       |the ID of the current section                  |
 |WB_URL            |AppUrl          |http: ⁄⁄ example.com/wb/                                                     | |WB_URL            |AppUrl          |http: ⁄⁄ example.com/wb/                                                     |
-|WB_REL            |AppRel          |/wb/                                                                         |+|WB_REL            |AppRel          |/wb/  (absolute path from DOCUMENT_ROOT, for use as a relative URL)                                                                      |
 |WB_PATH           |AppPath         |/var/www/httpdocs/wb/ \\ alternatively, in Windows  ('c:/var/www/httpdocs/wb/' | |WB_PATH           |AppPath         |/var/www/httpdocs/wb/ \\ alternatively, in Windows  ('c:/var/www/httpdocs/wb/' |
 |ADMIN_URL         |AcpUrl          |http: ⁄⁄ example.com/wb/admin/                                               | |ADMIN_URL         |AcpUrl          |http: ⁄⁄ example.com/wb/admin/                                               |
Line 44: Line 43:
 |TEMPLATE          |Template        |MyTemplate             | |TEMPLATE          |Template        |MyTemplate             |
 |TEMPLATE_DIR      |TemplateDir     |templates/MyTemplate/  | |TEMPLATE_DIR      |TemplateDir     |templates/MyTemplate/  |
-|{introduced}      |TemplateUrl     |http: ⁄⁄ example.com/wb/templates/MyTemplate/ +|NEW               |TemplateUrl     |http: ⁄⁄ example.com/wb/templates/MyTemplate/ 
-|{introduced}      |TemplateRel     |/wb/templates/MyTemplate/ +|NEW               |TemplateRel     |/wb/templates/MyTemplate/ 
-|{introduced}      |TemplatePath    |/var/www/httpdocs/wb/templates/MyTemplate/  |+|NEW               |TemplatePath    |/var/www/httpdocs/wb/templates/MyTemplate/  |
 |ADMIN_DIRECTORY   |AcpDir          |admin/                                                                       | |ADMIN_DIRECTORY   |AcpDir          |admin/                                                                       |
 |PAGES_DIRECTORY   |PagesDir        |pages/                                                                       | |PAGES_DIRECTORY   |PagesDir        |pages/                                                                       |
Line 53: Line 52:
 |WB_REVISION       |AppRevision     |2060                                                                         | |WB_REVISION       |AppRevision     |2060                                                                         |
 |WB_SP             |AppServicePack  |SP1                                                                          | |WB_SP             |AppServicePack  |SP1                                                                          |
-|{introduced}  |AppName         |WebsiteBaker                                                                 |+|NEW               |AppName         |WebsiteBaker                                                                 |
 |STRING_DIR_MODE   |DirModeString   | %%rwxrwxr-x%%   (textual representation, corresponds to 0775 octal)                                                           | |STRING_DIR_MODE   |DirModeString   | %%rwxrwxr-x%%   (textual representation, corresponds to 0775 octal)                                                           |
 |OCTAL_DIR_MODE    |DirModeOctal    | %%509%% (stored integer, corresponds to 0775 written in octal)  | |OCTAL_DIR_MODE    |DirModeOctal    | %%509%% (stored integer, corresponds to 0775 written in octal)  |
Line 71: Line 70:
  
 __for all statements in common the following rules apply:__ __for all statements in common the following rules apply:__
-  * As PATH_SEPERATOR only the slash** / ** is allowed. Adjustments can be made easily with\\ <php> $sPath = str_replace('\\', '/', $sPath); </php>+  * As PATH_SEPERATOR only the slash** / ** is allowed. Adjustments can be made easily with\\ <code> $sPath = str_replace('\\', '/', $sPath); </code>
   * If the last element of a URL, Rel, Path-, or Dir-specified directory, the indication must terminate on a slash** / **.\\   * If the last element of a URL, Rel, Path-, or Dir-specified directory, the indication must terminate on a slash** / **.\\
-  * To ensure that a directory path is terminated with a single slash** / **the short sequence is sufficient\\ <php> $sPath = rtrim($sPath, '/').'/'; </php+  * To ensure that a directory path is terminated with a single slash** / **the short sequence is sufficient\\ <code> $sPath = rtrim($sPath, '/').'/'; </code
-  *  Leading slashes** / **are removed by\\ <php>  $sPath = ltrim($sPath, '/');  </php>+  *  Leading slashes** / **are removed by\\ <code>  $sPath = ltrim($sPath, '/');  </code>
  
 OLD => NEW example: OLD => NEW example:
Line 87: Line 86:
 ^new  | TemplateDir      | templates/MyTemplate/    | ^new  | TemplateDir      | templates/MyTemplate/    |
  
-===== Anwendung von WbAdaptor ===== +===== Application of WbAdaptor ===== 
-Diese Klasse ist von überall zu erreichenEs genügt völlig, die einzig existierende, aktive Instanz der Klasse mit\\ <php> $oReg = WbAdaptor::getInstance(); </phpin den aktuellen Sichtbarkeitsbereich zu importierenNoch besser ist jedoch die Nutzung von Dependency-Injectionalso die Übergabe der Instanz von außen an die Funktion oder Klasse.+This class can be reached from anywhereIt is sufficient to import that only existing active instance of the class with\\ <code> $oReg = \bin\WbAdaptor::getInstance(); </codeto import into the current scope 
 +But even better is the use of dependency injectioni.e. the transfer of the instance from outside to the function or class.
  
-:!: Es wird dringend empfohlen, den Bezeichner //**$oReg**// für die Instanz des WbAdaptor-Objektes zu verwenden um eine leichtere und über alle Programmteile durchgängige Lesbarkeit zu erreichen.+:!: It is strongly recommended that the identifier //**$oReg**// is used for the instance of the WbAdaptor object in order to achieve a better and consistent readability of all program components.
  
-Auch der Abruf der einzelnen Werte ist recht unproblematisch:\\ +Also the request of the individual values quite straightforward:\\ 
-<php> echo $oReg->TemplateDir.'images/logo.png'; </php> \\ +<code> echo $oReg->TemplateDir.'images/logo.png'; </code> \\ 
-Ausgabe:  ''templates/myTemplate/images/logo.png''+Output:  ''templates/myTemplate/images/logo.png''
  
-Was nach außen nicht sichtbar istist der Umstand dass alle abrufbaren Werte in zwei Basis-Gruppen abgelegt sind+What is not visible from the outsidethe fact is that all retrievable values are stored in two basic groups
-  * //System//  ⇒ das sind alle Werte, die bei unveränderten Grundeinstellungen bei jedem Scriptaufruf **immer** gleich sind+  * //System// -> these are all values that are **always** the same at constant, for basic settings constant for each script call
-  * //Request// ⇒ alle anderen Wertedie je nach SeiteBenutzerRequestmodus oder sonstigen Kriterien unterschiedliche Werte haben können+  * //Request// -> all other valueswhich candepending on the pageusers who request mode or other criteria have different values
-Die //System//-Werte sind geschützt und können **nicht** durch //Request//-Werte oder anderes überschrieben werden.+The system values are protected and can **not** be overridden by //Request// values or anything else.
  
  
en/dev/284/registry.1439410715.txt.gz · Last modified: 12.08.2015 20:18 by mrbaseman