|
|
Line 6: |
Line 6: |
| | | |
| ... | | ... |
− |
| |
− | == About initSystem ==
| |
− |
| |
− | The term initSystem, apart from being a tag used to group certain PHP files together in the new documentation, embraces all files that are automatically included / initialized before any command scripts can be run.
| |
− |
| |
− | Zen Cart® v1.x uses a (non Object Oriented) page controller pattern to decide the scripts to run, based on HTTP_GET parameters.
| |
− |
| |
− | The most important of these is the 'main_page' HTTP_GET parameter.
| |
− |
| |
− | Depending on that parameter, a command script is then run.
| |
− |
| |
− | Each commmand script resides in a directory in <code>/ includes / modules / pages</code>.
| |
− |
| |
− | For example if main_page = login the command script would be taken from the <code>/ includes / modules / pages / login /</code> directory.
| |
− |
| |
− | However the first thing every command script always does is require () the /includes/application_top.php file. This is the heart of the initSystem.
| |
− |
| |
− | It is <code>application_top.php</code> that is responsible for initialising basic subsystems (database abstraction / sessions / languages etc.) and loading global configuration data.
| |
− |
| |
− | In the past this was done using a hard-coded script. From v1.3.0 on, however, Zen Cart® now uses a control array to decide which functions / classes / data files are to be included and initialised.
| |
− |
| |
− | This allows contribution authors and third party developers to gain access to and [[Extensibility|extend]] the initSystem without compromising upgradeability.
| |
− |
| |
− | * https://translate.googleusercontent.com/translate_c?act=url&depth=1&hl=en&ie=UTF8&prev=_t&rurl=translate.google.com&sl=ru&tl=en&u=http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials&usg=ALkJrhja3Beqgn27PEd24Tas8G_rhQk0_g#InitSystem
| |
| | | |
| == Observer class == | | == Observer class == |
Revision as of 11:09, 12 October 2015
Zen Cart extensibility is the extensibility principle as it applies to Zen Cart.
See also Learning Zen Cart (1).
Plugins
...
Observer class
The Observer Class allows a plugin to listen for for (observe) an event (a notification) and provide additional processing.
This notifier/observer interface also works in the Zen Cart admin panel.
Adding a notifier at specific processing points in the popular (e.g. orders.php
, customer.php
) admin pages, and providing observer code to insert their customization, may help installation and upgrade processes go much more smoothly.
Require login for EZ page
File:
/includes/modules/pages/page/header_php.php
Around line 23:
if ($ezpage_id == 0) zen_redirect(zen_href_link(FILENAME_DEFAULT));
Right below that, insert the following code, substituting '55' with the number of the page to protect:
if ($ezpage_id == 55) {
if (!$_SESSION['customer_id']) {
$_SESSION['navigation']->set_snapshot();
zen_redirect(zen_href_link(FILENAME_LOGIN, , 'SSL'));
}
}
See also