Page MenuHomeIn-Portal Phabricator

custom
No OneTemporary

File Metadata

Created
Mon, Jan 6, 12:06 AM
Index: branches/1.2.x/units/helpers/helpers_config.php
===================================================================
--- branches/1.2.x/units/helpers/helpers_config.php (revision 15130)
+++ branches/1.2.x/units/helpers/helpers_config.php (revision 15131)
@@ -1,14 +1,14 @@
<?php
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'custom-helpers',
'EventHandlerClass' => Array ('class' => 'kEventHandler', 'file' => '', 'build_event' => 'OnBuild'),
'RegisterClasses' => Array (
- Array ('pseudo' => 'SampleHelper', 'class' => 'SampleHelper', 'file' => 'sample_helper.php', 'build_event' => '', 'require_classes' => 'kHelper'),
+ Array ('pseudo' => 'SampleHelper', 'class' => 'SampleHelper', 'file' => 'sample_helper.php', 'build_event' => ''),
),
);
\ No newline at end of file
Index: branches/1.2.x/units/widgets/widget_eh.php
===================================================================
--- branches/1.2.x/units/widgets/widget_eh.php (revision 15130)
+++ branches/1.2.x/units/widgets/widget_eh.php (revision 15131)
@@ -1,310 +1,310 @@
<?php
defined('FULL_PATH') or die('restricted access!');
/**
* Widgets Event Handler (sample)
*
*/
class WidgetEventHandler extends kDBEventHandler {
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
protected function mapPermissions()
{
parent::mapPermissions();
$permissions = Array (
'OnItemBuild' => Array ('self' => true),
'OnCustomEvent' => Array ('self' => true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Checks user permission to execute given $event
*
* @param kEvent $event
* @return bool
* @access public
*/
- public function CheckPermission(kEvent &$event)
+ public function CheckPermission(kEvent $event)
{
$skip_permissions_check_events = Array (
'OnAnotherCustomEvent',
);
if ( in_array($event->Name, $skip_permissions_check_events) ) {
return true;
}
return parent::CheckPermission($event);
}
/**
* Set custom query for the list
*
* @param kEvent $event
*/
- function OnCustomEvent(&$event)
+ function OnCustomEvent($event)
{
$object =& $event->getObject();
/* @var $object kDBList */
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
- protected function SetCustomQuery(kEvent &$event)
+ protected function SetCustomQuery(kEvent $event)
{
parent::SetCustomQuery($event);
$object =& $event->getObject();
/* @var $object kDBList */
# identifying event based on special and setting filter
if ( $event->Special == 'custom-special' ) {
// $object->addFilter('primary_filter', '%1$s.Status = ' . STATUS_DISABLED);
}
}
/**
* Occurs before creating item
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemCreate(kEvent &$event)
+ protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
}
/**
* Occurs before updating item
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemUpdate(kEvent &$event)
+ protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
}
/**
* Occurs before deleting item, id of item being
* deleted is stored as 'id' event param
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemDelete(kEvent &$event)
+ protected function OnBeforeItemDelete(kEvent $event)
{
parent::OnBeforeItemDelete($event);
}
/**
* Occurs before loading item, 'id' parameter
* allows to get id of item being loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemLoad(kEvent &$event)
+ protected function OnBeforeItemLoad(kEvent $event)
{
parent::OnBeforeItemLoad($event);
}
/**
* Occurs after creating item
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemCreate(kEvent &$event)
+ protected function OnAfterItemCreate(kEvent $event)
{
parent::OnAfterItemCreate($event);
}
/**
* Occurs after updating item
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemUpdate(kEvent &$event)
+ protected function OnAfterItemUpdate(kEvent $event)
{
parent::OnAfterItemUpdate($event);
}
/**
* Occurs after deleting item, id of deleted item
* is stored as 'id' param of event
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemDelete(kEvent &$event)
+ protected function OnAfterItemDelete(kEvent $event)
{
parent::OnAfterItemDelete($event);
}
/**
* Loads user images
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemLoad(kEvent &$event)
+ protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
}
/**
* Builds/parses widget part of url
*
* @param int $rewrite_mode Mode in what rewrite listener was called. Possbile two modes: REWRITE_MODE_BUILD, REWRITE_MODE_PARSE.
* @param string $prefix Prefix, that listener uses for system integration
* @param Array $params Params, that are used for url building or created during url parsing.
* @param Array $url_parts Url parts to parse (only for parsing).
* @param bool $keep_events Keep event names in resulting url (only for building).
* @return bool Return true to continue to next listener; return false (when building) not to rewrite given prefix; return false (when parsing) to stop processing at this listener.
*/
function WidgetRewriteListener($rewrite_mode = REWRITE_MODE_BUILD, $prefix, &$params, &$url_parts, $keep_events = false)
{
if ($rewrite_mode == REWRITE_MODE_BUILD) {
return $this->WidgetRewriteBuilder($rewrite_mode, $prefix, $params, $url_parts, $keep_events);
}
if ($rewrite_mode == REWRITE_MODE_PARSE) {
return $this->WidgetRewriteParser($rewrite_mode, $prefix, $params, $url_parts);
}
return true;
}
/**
* Builds/parses widget part of url
*
* @param int $rewrite_mode Mode in what rewrite listener was called. Possbile two modes: REWRITE_MODE_BUILD, REWRITE_MODE_PARSE.
* @param string $prefix Prefix, that listener uses for system integration
* @param Array $params Params, that are used for url building or created during url parsing.
* @param Array $url_parts Url parts to parse (only for parsing).
* @param bool $keep_events Keep event names in resulting url (only for building).
* @return bool Return true to continue to next listener; return false (when building) not to rewrite given prefix; return false (when parsing) to stop processing at this listener.
*/
function WidgetRewriteBuilder($rewrite_mode = REWRITE_MODE_BUILD, $prefix, &$params, &$url_parts, $keep_events = false)
{
if ($params['t'] == 'widgets/widget_detail') {
// this is default template for this prefix, so don't add it to resulting url
$params['pass_template'] = false;
}
$rewrite_processor =& $this->Application->recallObject('kRewriteUrlProcessor');
/* @var $rewrite_processor kRewriteUrlProcessor */
$processed_params = $rewrite_processor->getProcessedParams($prefix, $params, $keep_events);
if ($processed_params === false) {
return '';
}
$ret = Array ('', '');
if ($processed_params[$prefix . '_id'] > 0) {
// add id
$sql = 'SELECT Title
FROM ' . TABLE_PREFIX . 'Widgets
WHERE WidgetId = ' . $processed_params[$prefix . '_id'];
$ret[0] .= 'widgets/' . $this->Conn->GetOne($sql) . '/';
} elseif ($processed_params[$prefix . '_Page'] > 1) {
// add page, only when ID is missing
$ret[1] .= $processed_params[$prefix . '_Page'] . '/';
}
$ret[0] = rtrim($ret[0], '/');
$ret[1] = rtrim($ret[1], '/');
return array_map('mb_strtolower', $ret);
}
/**
* Builds/parses widget part of url
*
* @param int $rewrite_mode Mode in what rewrite listener was called. Possbile two modes: REWRITE_MODE_BUILD, REWRITE_MODE_PARSE.
* @param string $prefix Prefix, that listener uses for system integration
* @param Array $params Params, that are used for url building or created during url parsing.
* @param Array $url_parts Url parts to parse (only for parsing).
* @return bool Return true to continue to next listener; return false (when building) not to rewrite given prefix; return false (when parsing) to stop processing at this listener.
*/
function WidgetRewriteParser($rewrite_mode = REWRITE_MODE_BUILD, $prefix, &$params, &$url_parts)
{
if ($url_parts[0] == 'widgets') {
$sql = 'SELECT WidgetId
FROM ' . TABLE_PREFIX . 'Widgets
WHERE Title = ' . $this->Conn->qstr($url_parts[1]);
$id = $this->Conn->GetOne($sql);
$to_parse = $url_parts;
$rewrite_processor =& $this->Application->recallObject('kRewriteUrlProcessor');
/* @var $rewrite_processor kRewriteUrlProcessor */
if ($id > 0) {
// id found
$rewrite_processor->partParsed($url_parts[0]);
$rewrite_processor->partParsed($url_parts[1]);
$params[$prefix . '_id'] = $id;
$to_parse = array_slice($to_parse, 2); // cut off first two parts - "widgets/<widget+name>"
$params['pass'][] = $prefix; // otherwise this prefix won't passed when pass="all" parameter used
}
$template = implode('/', $to_parse);
if ($template) {
// let others guess what template is
return true;
}
// template missing -> set default
$params['t'] = 'widgets/widget_detail';
return false;
}
return true;
}
}
\ No newline at end of file
Index: branches/1.2.x/units/sections/links/e_link_eh.php
===================================================================
--- branches/1.2.x/units/sections/links/e_link_eh.php (revision 15130)
+++ branches/1.2.x/units/sections/links/e_link_eh.php (revision 15131)
@@ -1,215 +1,215 @@
<?php
defined('FULL_PATH') or die('restricted access!');
/**
* Extends default LinksEventHandler class
*
*/
class ELinkEventHandler extends LinksEventHandler {
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
function mapPermissions()
{
parent::mapPermissions();
$permissions = Array (
'OnCustomEvent1' => Array ('self' => true),
'OnCustomEvent2' => Array ('self' => true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Checks user permission to execute given $event
*
* @param kEvent $event
* @return bool
* @access public
*/
- public function CheckPermission(kEvent &$event)
+ public function CheckPermission(kEvent $event)
{
$skip_permissions_check_events = Array (
'OnAnotherCustomEvent',
);
if ( in_array($event->Name, $skip_permissions_check_events) ) {
return true;
}
return parent::CheckPermission($event);
}
/**
* Occurs, when config was parsed, allows to change config data dynamically
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterConfigRead(kEvent &$event)
+ protected function OnAfterConfigRead(kEvent $event)
{
parent::OnAfterConfigRead($event);
# 1. Regular Fields from /in-link/units/links/links_config.php
$fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); #get regular fields
// $fields['Status']['default'] = STATUS_ACTIVE; #add/edit configuration (make default = STATUS_ACTIVE)
$this->Application->setUnitOption($event->Prefix, 'Fields', $fields); #save fields
# 2. Virtual Fields from /in-link/units/links/links_config.php
$virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields'); #get virtual fields
// $virtual_fields['UserName']['default'] = ''; #add/edit configuration
$this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields); #save virtual fields
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
- protected function SetCustomQuery(kEvent &$event)
+ protected function SetCustomQuery(kEvent $event)
{
parent::SetCustomQuery($event);
$object =& $event->getObject();
/* @var $object kDBList */
# identifying event based on special and setting filter
if ( $event->Special == 'custom-special' ) {
// $object->addFilter('primary_filter', '%1$s.Status = ' . STATUS_DISABLED);
}
# identifying event based not admin condition and setting filter
if ( !$this->Application->isAdminUser ) {
// $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE);
}
}
/**
* Makes reciprocal check on link, when it is created
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemCreate(kEvent &$event)
+ protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
}
/**
* Makes reciprocal check on link, when it is updated
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemUpdate(kEvent &$event)
+ protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
}
/**
* Occurs before deleting item, id of item being
* deleted is stored as 'id' event param
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemDelete(kEvent &$event)
+ protected function OnBeforeItemDelete(kEvent $event)
{
parent::OnBeforeItemDelete($event);
}
/**
* Occurs before loading item, 'id' parameter
* allows to get id of item being loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemLoad(kEvent &$event)
+ protected function OnBeforeItemLoad(kEvent $event)
{
parent::OnBeforeItemLoad($event);
}
/**
* Sets values for import process
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemCreate(kEvent &$event)
+ protected function OnAfterItemCreate(kEvent $event)
{
parent::OnAfterItemCreate($event);
}
/**
* Occurs after updating item
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemUpdate(kEvent &$event)
+ protected function OnAfterItemUpdate(kEvent $event)
{
parent::OnAfterItemUpdate($event);
}
/**
* Occurs after deleting item, id of deleted item
* is stored as 'id' param of event
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemDelete(kEvent &$event)
+ protected function OnAfterItemDelete(kEvent $event)
{
parent::OnAfterItemDelete($event);
}
/**
* Occurs after loading item, 'id' parameter
* allows to get id of item that was loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemLoad(kEvent &$event)
+ protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
}
}
\ No newline at end of file
Index: branches/1.2.x/units/sections/users/e_user_eh.php
===================================================================
--- branches/1.2.x/units/sections/users/e_user_eh.php (revision 15130)
+++ branches/1.2.x/units/sections/users/e_user_eh.php (revision 15131)
@@ -1,214 +1,214 @@
<?php
defined('FULL_PATH') or die('restricted access!');
/**
* Extends default UsersEventHandler class
*
*/
class EUserEventHandler extends UsersEventHandler {
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
protected function mapPermissions()
{
parent::mapPermissions();
$permissions = Array (
'OnCustomEvent1' => Array ('self' => true),
'OnCustomEvent2' => Array ('self' => true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Checks user permission to execute given $event
*
* @param kEvent $event
* @return bool
* @access public
*/
- public function CheckPermission(kEvent &$event)
+ public function CheckPermission(kEvent $event)
{
$skip_permissions_check_events = Array (
'OnAnotherCustomEvent',
);
if ( in_array($event->Name, $skip_permissions_check_events) ) {
return true;
}
return parent::CheckPermission($event);
}
/**
* Occurs, when config was parsed, allows to change config data dynamically
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterConfigRead(kEvent &$event)
+ protected function OnAfterConfigRead(kEvent $event)
{
parent::OnAfterConfigRead($event);
# 1. Regular Fields from /core/units/users/users_config.php
$fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); #get regular fields
// $fields['Status']['default'] = 1; #add/edit configuration (make default = 1)
$this->Application->setUnitOption($event->Prefix, 'Fields', $fields); #save regular fields
# 2. Virtual Fields from /core/units/users/users_config.php
$virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields'); #get virtual fields
// $virtual_fields['FullName']['default'] = ''; #add/edit configuration
$this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields); #save virtual fields
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
- protected function SetCustomQuery(kEvent &$event)
+ protected function SetCustomQuery(kEvent $event)
{
parent::SetCustomQuery($event);
$object =& $event->getObject();
/* @var $object kDBList */
# identifying event based on special and setting filter
if ( $event->Special == 'custom-special' ) {
// $object->addFilter('primary_filter', '%1$s.Status = ' . STATUS_DISABLED);
}
# identifying event based not admin condition and setting filter
if ( !$this->Application->isAdminUser ) {
// $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE);
}
}
/**
* Set's new unique resource id to user
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemCreate(kEvent &$event)
+ protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
}
/**
* Checks state against country
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemUpdate(kEvent &$event)
+ protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
}
/**
* Occurs before deleting item, id of item being
* deleted is stored as 'id' event param
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemDelete(kEvent &$event)
+ protected function OnBeforeItemDelete(kEvent $event)
{
parent::OnBeforeItemDelete($event);
}
/**
* Occurs before loading item, 'id' parameter
* allows to get id of item being loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemLoad(kEvent &$event)
+ protected function OnBeforeItemLoad(kEvent $event)
{
parent::OnBeforeItemLoad($event);
}
/**
* Redirects user after successful registration to confirmation template (on Front only)
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemCreate(kEvent &$event)
+ protected function OnAfterItemCreate(kEvent $event)
{
parent::OnAfterItemCreate($event);
}
/**
* Occurs after updating item
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemUpdate(kEvent &$event)
+ protected function OnAfterItemUpdate(kEvent $event)
{
parent::OnAfterItemUpdate($event);
}
/**
* Occurs after deleting item, id of deleted item
* is stored as 'id' param of event
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemDelete(kEvent &$event)
+ protected function OnAfterItemDelete(kEvent $event)
{
parent::OnAfterItemDelete($event);
}
/**
* Loads user images
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemLoad(kEvent &$event)
+ protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
}
}
\ No newline at end of file
Index: branches/1.2.x/units/sections/products/e_product_eh.php
===================================================================
--- branches/1.2.x/units/sections/products/e_product_eh.php (revision 15130)
+++ branches/1.2.x/units/sections/products/e_product_eh.php (revision 15131)
@@ -1,215 +1,215 @@
<?php
defined('FULL_PATH') or die('restricted access!');
/**
* Extends/overrides methods of default ProductsEventHandler class
*
*/
class EProductEventHandler extends ProductsEventHandler {
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
protected function mapPermissions()
{
parent::mapPermissions();
$permissions = Array (
'OnCustomEvent1' => Array ('self' => true),
'OnCustomEvent2' => Array ('self' => true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Checks user permission to execute given $event
*
* @param kEvent $event
* @return bool
* @access public
*/
- public function CheckPermission(kEvent &$event)
+ public function CheckPermission(kEvent $event)
{
$skip_permissions_check_events = Array (
'OnAnotherCustomEvent',
);
if ( in_array($event->Name, $skip_permissions_check_events) ) {
return true;
}
return parent::CheckPermission($event);
}
/**
* Occurs, when config was parsed, allows to change config data dynamically
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterConfigRead(kEvent &$event)
+ protected function OnAfterConfigRead(kEvent $event)
{
parent::OnAfterConfigRead($event);
# 1. Regular Fields from /in-commerce/units/products/products_config.php
$fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); #get regular fields
// $fields['Status']['default'] = STATUS_ACTIVE; #add/edit field configuration (make default = STATUS_ACTIVE)
$this->Application->setUnitOption($event->Prefix, 'Fields', $fields); #save regular fields
# 2. Virtual Fields from /in-commerce/units/products/products_config.php
$virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields'); #get virtual fields
// $virtual_fields['Qty']['default'] = 1; #add/edit field configuration
$this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields); # save virtual fields
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
- protected function SetCustomQuery(kEvent &$event)
+ protected function SetCustomQuery(kEvent $event)
{
parent::SetCustomQuery($event);
$object =& $event->getObject();
/* @var $object kDBList */
# identifying event based on special and setting filter
if ( $event->Special == 'custom-special' ) {
// $object->addFilter('primary_filter', '%1$s.Status = '.STATUS_DISABLED);
}
# identifying event based not admin condition and setting filter
if ( !$this->Application->isAdminUser ) {
// $object->addFilter('status_filter', '%1$s.Status = '.STATUS_ACTIVE);
}
}
/**
* Sets default processing data for subscriptions
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemCreate(kEvent &$event)
+ protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
}
/**
* Moves item to preferred category, updates item hits
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemUpdate(kEvent &$event)
+ protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
}
/**
* Occurs before deleting item, id of item being
* deleted is stored as 'id' event param
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemDelete(kEvent &$event)
+ protected function OnBeforeItemDelete(kEvent $event)
{
parent::OnBeforeItemDelete($event);
}
/**
* Occurs before loading item, 'id' parameter
* allows to get id of item being loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemLoad(kEvent &$event)
+ protected function OnBeforeItemLoad(kEvent $event)
{
parent::OnBeforeItemLoad($event);
}
/**
* Set new price to ProductsPricing
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemCreate(kEvent &$event)
+ protected function OnAfterItemCreate(kEvent $event)
{
parent::OnAfterItemCreate($event);
}
/**
* Occurs after updating item
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemUpdate(kEvent &$event)
+ protected function OnAfterItemUpdate(kEvent $event)
{
parent::OnAfterItemUpdate($event);
}
/**
* Occurs after deleting item, id of deleted item
* is stored as 'id' param of event
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemDelete(kEvent &$event)
+ protected function OnAfterItemDelete(kEvent $event)
{
parent::OnAfterItemDelete($event);
}
/**
* Occurs after loading item, 'id' parameter
* allows to get id of item that was loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemLoad(kEvent &$event)
+ protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
}
}
\ No newline at end of file
Index: branches/1.2.x/units/sections/reviews/e_review_eh.php
===================================================================
--- branches/1.2.x/units/sections/reviews/e_review_eh.php (revision 15130)
+++ branches/1.2.x/units/sections/reviews/e_review_eh.php (revision 15131)
@@ -1,148 +1,148 @@
<?php
defined('FULL_PATH') or die('restricted access!');
/**
* Extends/overrides methods of default ReviewsEventHandler class
*
*/
class EReviewEventHandler extends ReviewsEventHandler {
/**
* Occurs, when config was parsed, allows to change config data dynamically
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterConfigRead(kEvent &$event)
+ protected function OnAfterConfigRead(kEvent $event)
{
parent::OnAfterConfigRead($event);
// 1. add fields
// $fields = $this->Application->getUnitOption($event->Prefix, 'Fields');
// $this->Application->setUnitOption($event->Prefix, 'Fields', $fields);
// 2. calculated fields
// $calculated_fields = $this->Application->getUnitOption($event->Prefix, 'CalculatedFields');
// $this->Application->setUnitOption($event->Prefix, 'CalculatedFields', $calculated_fields);
}
/**
* Prefills all fields on front-end
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemCreate(kEvent &$event)
+ protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
}
/**
* Sets correct rating value
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemUpdate(kEvent &$event)
+ protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
}
/**
* Occurs before deleting item, id of item being
* deleted is stored as 'id' event param
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemDelete(kEvent &$event)
+ protected function OnBeforeItemDelete(kEvent $event)
{
parent::OnBeforeItemDelete($event);
}
/**
* Occurs before loading item, 'id' parameter
* allows to get id of item being loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemLoad(kEvent &$event)
+ protected function OnBeforeItemLoad(kEvent $event)
{
parent::OnBeforeItemLoad($event);
}
/**
* Updates item review counter
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemCreate(kEvent &$event)
+ protected function OnAfterItemCreate(kEvent $event)
{
parent::OnAfterItemCreate($event);
}
/**
* Occurs after updating item
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemUpdate(kEvent &$event)
+ protected function OnAfterItemUpdate(kEvent $event)
{
parent::OnAfterItemUpdate($event);
}
/**
* Occurs after deleting item, id of deleted item
* is stored as 'id' param of event
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemDelete(kEvent &$event)
+ protected function OnAfterItemDelete(kEvent $event)
{
parent::OnAfterItemDelete($event);
}
/**
* Occurs after loading item, 'id' parameter
* allows to get id of item that was loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemLoad(kEvent &$event)
+ protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
}
}
Index: branches/1.2.x/units/sections/categories/e_category_eh.php
===================================================================
--- branches/1.2.x/units/sections/categories/e_category_eh.php (revision 15130)
+++ branches/1.2.x/units/sections/categories/e_category_eh.php (revision 15131)
@@ -1,213 +1,213 @@
<?php
defined('FULL_PATH') or die('restricted access!');
/**
* Extends default CategoriesEventHandler class
*
*/
class ECategoryEventHandler extends CategoriesEventHandler {
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
protected function mapPermissions()
{
parent::mapPermissions();
$permissions = Array (
'OnCustomEvent1' => Array ('self' => true),
'OnCustomEvent2' => Array ('self' => true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Checks user permission to execute given $event
*
* @param kEvent $event
* @return bool
* @access public
*/
- public function CheckPermission(kEvent &$event)
+ public function CheckPermission(kEvent $event)
{
$skip_permissions_check_events = Array (
'OnAnotherCustomEvent',
);
if ( in_array($event->Name, $skip_permissions_check_events) ) {
return true;
}
return parent::CheckPermission($event);
}
/**
* Updates structure config
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterConfigRead(kEvent &$event)
+ protected function OnAfterConfigRead(kEvent $event)
{
parent::OnAfterConfigRead($event);
# 1. Regular Fields from /core/units/categories/categories_config.php
$fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); #get regular fields
// $fields['Status']['default'] = STATUS_ACTIVE; #add/edit configuration (make default = STATUS_ACTIVE)
$this->Application->setUnitOption($event->Prefix, 'Fields', $fields); #save fields
# 2. Virtual Fields from /core/units/categories/categories_config.php
$virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields'); #get virtual fields
// $virtual_fields['UserName']['default'] = ''; #add/edit configuration
$this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields); #save virtual fields
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
- protected function SetCustomQuery(kEvent &$event)
+ protected function SetCustomQuery(kEvent $event)
{
parent::SetCustomQuery($event);
$object =& $event->getObject();
/* @var $object kDBList */
# identifying event based on special and setting filter
if ( $event->Special == 'custom-special' ) {
// $object->addFilter('primary_filter', '%1$s.Status = ' . STATUS_DISABLED);
}
# identifying event based not admin condition and setting filter
if ( !$this->Application->isAdminUser ) {
// $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE);
}
}
/**
* Sets correct status for new categories created on front-end
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemCreate(kEvent &$event)
+ protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
}
/**
* Sets correct status for new categories created on front-end
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemUpdate(kEvent &$event)
+ protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
}
/**
* Occurs before deleting item, id of item being
* deleted is stored as 'id' event param
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemDelete(kEvent &$event)
+ protected function OnBeforeItemDelete(kEvent $event)
{
parent::OnBeforeItemDelete($event);
}
/**
* Occurs before loading item, 'id' parameter
* allows to get id of item being loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemLoad(kEvent &$event)
+ protected function OnBeforeItemLoad(kEvent $event)
{
parent::OnBeforeItemLoad($event);
}
/**
* Occurs after creating item
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemCreate(kEvent &$event)
+ protected function OnAfterItemCreate(kEvent $event)
{
parent::OnAfterItemCreate($event);
}
/**
* Occurs after updating item
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemUpdate(kEvent &$event)
+ protected function OnAfterItemUpdate(kEvent $event)
{
parent::OnAfterItemUpdate($event);
}
/**
* Occurs after deleting item, id of deleted item
* is stored as 'id' param of event
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemDelete(kEvent &$event)
+ protected function OnAfterItemDelete(kEvent $event)
{
parent::OnAfterItemDelete($event);
}
/**
* Removes this item and it's children (recursive) from structure dropdown
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemLoad(kEvent &$event)
+ protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
}
}
Index: branches/1.2.x/units/sections/articles/e_article_eh.php
===================================================================
--- branches/1.2.x/units/sections/articles/e_article_eh.php (revision 15130)
+++ branches/1.2.x/units/sections/articles/e_article_eh.php (revision 15131)
@@ -1,214 +1,214 @@
<?php
defined('FULL_PATH') or die('restricted access!');
/**
* Extends default ArticlesEventHandler class
*
*/
class EArticleEventHandler extends ArticlesEventHandler {
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
protected function mapPermissions()
{
parent::mapPermissions();
$permissions = Array (
'OnCustomEvent1' => Array ('self' => true),
'OnCustomEvent2' => Array ('self' => true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Checks user permission to execute given $event
*
* @param kEvent $event
* @return bool
* @access public
*/
- public function CheckPermission(kEvent &$event)
+ public function CheckPermission(kEvent $event)
{
$skip_permissions_check_events = Array (
'OnAnotherCustomEvent',
);
if ( in_array($event->Name, $skip_permissions_check_events) ) {
return true;
}
return parent::CheckPermission($event);
}
/**
* Occurs, when config was parsed, allows to change config data dynamically
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterConfigRead(kEvent &$event)
+ protected function OnAfterConfigRead(kEvent $event)
{
parent::OnAfterConfigRead($event);
# 1. Regular Fields from /in-news/units/articles/articles_config.php
$fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); #get regular fields
// $fields['Status']['default'] = STATUS_ACTIVE; #add/edit configuration (make default = STATUS_ACTIVE)
$this->Application->setUnitOption($event->Prefix, 'Fields', $fields); #save fields
# 2. Virtual Fields from /in-news/units/articles/articles_config.php
$virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields'); #get virtual fields
// $virtual_fields['UserName']['default'] = ''; #add/edit configuration
$this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields); #save virtual fields
}
/**
* Filters out archived articles
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
- protected function SetCustomQuery(kEvent &$event)
+ protected function SetCustomQuery(kEvent $event)
{
parent::SetCustomQuery($event);
$object =& $event->getObject();
/* @var $object kDBList */
# identifying event based on special and setting filter
if ( $event->Special == 'custom-special' ) {
// $object->addFilter('primary_filter', '%1$s.Status = ' . STATUS_DISABLED);
}
# identifying event based not admin condition and setting filter
if ( !$this->Application->isAdminUser ) {
// $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE);
}
}
/**
* Create missing excerpt
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemCreate(kEvent &$event)
+ protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
}
/**
* Create missing excerpt
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemUpdate(kEvent &$event)
+ protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
}
/**
* Occurs before deleting item, id of item being
* deleted is stored as 'id' event param
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemDelete(kEvent &$event)
+ protected function OnBeforeItemDelete(kEvent $event)
{
parent::OnBeforeItemDelete($event);
}
/**
* Occurs before loading item, 'id' parameter
* allows to get id of item being loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnBeforeItemLoad(kEvent &$event)
+ protected function OnBeforeItemLoad(kEvent $event)
{
parent::OnBeforeItemLoad($event);
}
/**
* Sets values for import process
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemCreate(kEvent &$event)
+ protected function OnAfterItemCreate(kEvent $event)
{
parent::OnAfterItemCreate($event);
}
/**
* Occurs after updating item
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemUpdate(kEvent &$event)
+ protected function OnAfterItemUpdate(kEvent $event)
{
parent::OnAfterItemUpdate($event);
}
/**
* Occurs after deleting item, id of deleted item
* is stored as 'id' param of event
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemDelete(kEvent &$event)
+ protected function OnAfterItemDelete(kEvent $event)
{
parent::OnAfterItemDelete($event);
}
/**
* Occurs after loading item, 'id' parameter
* allows to get id of item that was loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
- protected function OnAfterItemLoad(kEvent &$event)
+ protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
}
}
Index: branches/1.2.x/units/sections/custom_eh.php
===================================================================
--- branches/1.2.x/units/sections/custom_eh.php (revision 15130)
+++ branches/1.2.x/units/sections/custom_eh.php (revision 15131)
@@ -1,36 +1,36 @@
<?php
defined('FULL_PATH') or die('restricted access!');
/**
* Custom event handler class
*
*/
class CustomEventHandler extends kEventHandler {
/**
* [HOOK] Override cloned sub-items (ie. register extended classes for clones from Reviews, Images)
*
* @param kEvent $event
*/
- function OnOverrideClonedSubItems(&$event)
+ function OnOverrideClonedSubItems($event)
{
# register EReviewEventHandler class as extented from cloned ReviewEventHandler for article reviews ("n" prefix)
// $this->Application->registerClass('EReviewEventHandler', dirname(__FILE__) . '/reviews/e_review_eh.php', 'n-rev_EventHandler');
}
/**
* [HOOK] Modify config stored in "categories_config.php" without extending CategoriesEventHandler class
*
* @param kEvent $event
*/
- function OnModifyCategoriesConfig(&$event)
+ function OnModifyCategoriesConfig($event)
{
# get Fields configuration from /core/units/categories/categories_config.php
$fields = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'Fields');
# set configuration fields
$this->Application->setUnitOption($event->MasterEvent->Prefix, 'Fields', $fields);
}
}
\ No newline at end of file

Event Timeline