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.1 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.1
      • 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
    • Network
      • Email
      • Http
    • Routing
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • CakeRoute
  • PluginShortRoute
  • RedirectRoute
 1: <?php
 2: /**
 3:  * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 4:  * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 5:  *
 6:  * Licensed under The MIT License
 7:  * Redistributions of files must retain the above copyright notice.
 8:  *
 9:  * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
10:  * @link          http://cakephp.org CakePHP(tm) Project
11:  * @since         CakePHP(tm) v 1.3
12:  * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
13:  */
14: 
15: App::uses('CakeRoute', 'Routing/Route');
16: 
17: /**
18:  * Plugin short route, that copies the plugin param to the controller parameters
19:  * It is used for supporting /:plugin routes.
20:  *
21:  * @package Cake.Routing.Route
22:  */
23: class PluginShortRoute extends CakeRoute {
24: 
25: /**
26:  * Parses a string url into an array. If a plugin key is found, it will be copied to the
27:  * controller parameter
28:  *
29:  * @param string $url The url to parse
30:  * @return mixed false on failure, or an array of request parameters
31:  */
32:     public function parse($url) {
33:         $params = parent::parse($url);
34:         if (!$params) {
35:             return false;
36:         }
37:         $params['controller'] = $params['plugin'];
38:         return $params;
39:     }
40: 
41: /**
42:  * Reverse route plugin shortcut urls. If the plugin and controller
43:  * are not the same the match is an auto fail.
44:  *
45:  * @param array $url Array of parameters to convert to a string.
46:  * @return mixed either false or a string url.
47:  */
48:     public function match($url) {
49:         if (isset($url['controller']) && isset($url['plugin']) && $url['plugin'] != $url['controller']) {
50:             return false;
51:         }
52:         $this->defaults['controller'] = $url['controller'];
53:         $result = parent::match($url);
54:         unset($this->defaults['controller']);
55:         return $result;
56:     }
57: 
58: }
59: 
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