+ protected function OnBeforeItemCreate(kEvent $event)
+ {
+ parent::OnBeforeItemCreate($event);
+
+ }
+
+ /**
+ * Occurs before updating item
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ 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)
+ {
+ 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)
+ {
+ parent::OnBeforeItemLoad($event);
+
+
+ }
+
+
+ /**
+ * Occurs after creating item
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnAfterItemCreate(kEvent $event)
+ {
+ parent::OnAfterItemCreate($event);
+
- /**
- * Occurs before creating item
- *
- * @param kEvent $event
- * @return void
- * @access protected
- */
- protected function OnBeforeItemCreate(kEvent $event)
- {
- parent::OnBeforeItemCreate($event);
-
- }
-
- /**
- * Occurs before updating item
- *
- * @param kEvent $event
- * @return void
- * @access protected
- */
- 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)
- {
- 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)
- {
- parent::OnBeforeItemLoad($event);
+ }
+ /**
+ * Occurs after updating item
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ 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)
+ {
+ parent::OnAfterItemDelete($event);
+
+
+ }
+ /**
+ * Loads user images
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ 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.
- protected function OnAfterItemCreate(kEvent $event)
- {
- parent::OnAfterItemCreate($event);
-
-
- }
-
- /**
- * Occurs after updating item
- *
- * @param kEvent $event
- * @return void
- * @access protected
- */
- 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)
- {
- parent::OnAfterItemDelete($event);
-
-
- }
-
- /**
- * Loads user images
- *
- * @param kEvent $event
- * @return void
- * @access protected
- */
- 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.
+ * @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.
+ // this is default template for this prefix, so don't add it to resulting url
+ $params['pass_template'] = false;
}
- /**
- * 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.
- * @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]);
- $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;
+ $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)