CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.3 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.3
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • Dispatcher
  • DispatcherFilter
  • Router
 1: <?php
 2: /**
 3:  *
 4:  * PHP 5
 5:  *
 6:  * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 7:  * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 8:  *
 9:  * Licensed under The MIT License
10:  * For full copyright and license information, please see the LICENSE.txt
11:  * Redistributions of files must retain the above copyright notice.
12:  *
13:  * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
14:  * @link          http://cakephp.org CakePHP(tm) Project
15:  * @package       Cake.Routing
16:  * @since         CakePHP(tm) v 2.2
17:  * @license       http://www.opensource.org/licenses/mit-license.php MIT License
18:  */
19: 
20: App::uses('CakeEventListener', 'Event');
21: 
22: /**
23:  * This abstract class represents a filter to be applied to a dispatcher cycle. It acts as as
24:  * event listener with the ability to alter the request or response as needed before it is handled
25:  * by a controller or after the response body has already been built.
26:  *
27:  * @package Cake.Routing
28:  */
29: abstract class DispatcherFilter implements CakeEventListener {
30: 
31: /**
32:  * Default priority for all methods in this filter
33:  *
34:  * @var int
35:  */
36:     public $priority = 10;
37: 
38: /**
39:  * Returns the list of events this filter listens to.
40:  * Dispatcher notifies 2 different events `Dispatcher.before` and `Dispatcher.after`.
41:  * By default this class will attach `preDispatch` and `postDispatch` method respectively.
42:  *
43:  * Override this method at will to only listen to the events you are interested in.
44:  *
45:  * @return array
46:  */
47:     public function implementedEvents() {
48:         return array(
49:             'Dispatcher.beforeDispatch' => array('callable' => 'beforeDispatch', 'priority' => $this->priority),
50:             'Dispatcher.afterDispatch' => array('callable' => 'afterDispatch', 'priority' => $this->priority),
51:         );
52:     }
53: 
54: /**
55:  * Method called before the controller is instantiated and called to serve a request.
56:  * If used with default priority, it will be called after the Router has parsed the
57:  * URL and set the routing params into the request object.
58:  *
59:  * If a CakeResponse object instance is returned, it will be served at the end of the
60:  * event cycle, not calling any controller as a result. This will also have the effect of
61:  * not calling the after event in the dispatcher.
62:  *
63:  * If false is returned, the event will be stopped and no more listeners will be notified.
64:  * Alternatively you can call `$event->stopPropagation()` to achieve the same result.
65:  *
66:  * @param CakeEvent $event container object having the `request`, `response` and `additionalParams`
67:  *  keys in the data property.
68:  * @return CakeResponse|boolean
69:  */
70:     public function beforeDispatch(CakeEvent $event) {
71:     }
72: 
73: /**
74:  * Method called after the controller served a request and generated a response.
75:  * It is possible to alter the response object at this point as it is not sent to the
76:  * client yet.
77:  *
78:  * If false is returned, the event will be stopped and no more listeners will be notified.
79:  * Alternatively you can call `$event->stopPropagation()` to achieve the same result.
80:  *
81:  * @param CakeEvent $event container object having the `request` and  `response`
82:  *  keys in the data property.
83:  * @return mixed boolean to stop the event dispatching or null to continue
84:  */
85:     public function afterDispatch(CakeEvent $event) {
86:     }
87: }
88: 
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs