The CMS part of In-Portal introduces "editing mode" term, which can be any of:
The developers can determine which (if any) editing mode is active currently by checking "EDITING_MODE" constant value.
This constant however is only defined just before page content is generated, which makes it impossible to access it from hooks to "adm:OnStartup" event and such.
- move code for setting "EDITING_MODE" constant from "kApplication::Run" method into after hook to "adm:OnStartup" event
- locate places, where "EDITING_MODE" constant is used not while on Front-End and add extra defined('EDITING_MODE') check in there