Skip to content

Commit

Permalink
Amended routing doc (phalcon-orphanage#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay authored and SidRoberts committed Jul 21, 2016
1 parent c72d5b9 commit 2a8b629
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 18 deletions.
26 changes: 24 additions & 2 deletions en/reference/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,32 @@ And use this class instead of the anonymous function:
<?php
$router->add('/get/info/{id}', array(
$router->add('/get/info/{id}', [
'controller' => 'products',
'action' => 'info'
))->beforeMatch(array(new AjaxFilter(), 'check'));
])->beforeMatch([new AjaxFilter(), 'check']);
Since Phalcon 2.1.0 beta 1, there is another way to check this:

.. code-block:: php
<?php
$router->add('/login', [
'module' => 'admin',
'controller' => 'session'
])->beforeMatch(function ($uri, $route) {
/**
* @var string $uri
* @var \Phalcon\Mvc\Router\Route $route
* @var \Phalcon\DiInterface $this
* @var \Phalcon\Http\Request $request
*/
$request = $this->getShared('request');
// Check if the request was made with Ajax
return $request->isAjax();
});
Hostname Constraints
--------------------
Expand Down
26 changes: 24 additions & 2 deletions es/reference/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,32 @@ And use this class instead of the anonymous function:
<?php
$router->add('/get/info/{id}', array(
$router->add('/get/info/{id}', [
'controller' => 'products',
'action' => 'info'
))->beforeMatch(array(new AjaxFilter(), 'check'));
])->beforeMatch([new AjaxFilter(), 'check']);
Since Phalcon 2.1.0 beta 1, there is another way to check this:

.. code-block:: php
<?php
$router->add('/login', [
'module' => 'admin',
'controller' => 'session'
])->beforeMatch(function ($uri, $route) {
/**
* @var string $uri
* @var \Phalcon\Mvc\Router\Route $route
* @var \Phalcon\DiInterface $this
* @var \Phalcon\Http\Request $request
*/
$request = $this->getShared('request');
// Check if the request was made with Ajax
return $request->isAjax();
});
Hostname Constraints
--------------------
Expand Down
26 changes: 24 additions & 2 deletions fr/reference/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,32 @@ And use this class instead of the anonymous function:
<?php
$router->add('/get/info/{id}', array(
$router->add('/get/info/{id}', [
'controller' => 'products',
'action' => 'info'
))->beforeMatch(array(new AjaxFilter(), 'check'));
])->beforeMatch([new AjaxFilter(), 'check']);
Since Phalcon 2.1.0 beta 1, there is another way to check this:

.. code-block:: php
<?php
$router->add('/login', [
'module' => 'admin',
'controller' => 'session'
])->beforeMatch(function ($uri, $route) {
/**
* @var string $uri
* @var \Phalcon\Mvc\Router\Route $route
* @var \Phalcon\DiInterface $this
* @var \Phalcon\Http\Request $request
*/
$request = $this->getShared('request');
// Check if the request was made with Ajax
return $request->isAjax();
});
Hostname Constraints
--------------------
Expand Down
26 changes: 24 additions & 2 deletions ja/reference/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -786,10 +786,32 @@ Not Found パス
<?php
$router->add('/get/info/{id}', array(
$router->add('/get/info/{id}', [
'controller' => 'products',
'action' => 'info'
))->beforeMatch(array(new AjaxFilter(), 'check'));
])->beforeMatch([new AjaxFilter(), 'check']);
Since Phalcon 2.1.0 beta 1, there is another way to check this:

.. code-block:: php
<?php
$router->add('/login', [
'module' => 'admin',
'controller' => 'session'
])->beforeMatch(function ($uri, $route) {
/**
* @var string $uri
* @var \Phalcon\Mvc\Router\Route $route
* @var \Phalcon\DiInterface $this
* @var \Phalcon\Http\Request $request
*/
$request = $this->getShared('request');
// Check if the request was made with Ajax
return $request->isAjax();
});
ホスト名によるアクセス制限
--------------------------
Expand Down
26 changes: 24 additions & 2 deletions pl/reference/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,32 @@ And use this class instead of the anonymous function:
<?php
$router->add('/get/info/{id}', array(
$router->add('/get/info/{id}', [
'controller' => 'products',
'action' => 'info'
))->beforeMatch(array(new AjaxFilter(), 'check'));
])->beforeMatch([new AjaxFilter(), 'check']);
Since Phalcon 2.1.0 beta 1, there is another way to check this:

.. code-block:: php
<?php
$router->add('/login', [
'module' => 'admin',
'controller' => 'session'
])->beforeMatch(function ($uri, $route) {
/**
* @var string $uri
* @var \Phalcon\Mvc\Router\Route $route
* @var \Phalcon\DiInterface $this
* @var \Phalcon\Http\Request $request
*/
$request = $this->getShared('request');
// Check if the request was made with Ajax
return $request->isAjax();
});
Hostname Constraints
--------------------
Expand Down
26 changes: 24 additions & 2 deletions pt/reference/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,32 @@ And use this class instead of the anonymous function:
<?php
$router->add('/get/info/{id}', array(
$router->add('/get/info/{id}', [
'controller' => 'products',
'action' => 'info'
))->beforeMatch(array(new AjaxFilter(), 'check'));
])->beforeMatch([new AjaxFilter(), 'check']);
Since Phalcon 2.1.0 beta 1, there is another way to check this:

.. code-block:: php
<?php
$router->add('/login', [
'module' => 'admin',
'controller' => 'session'
])->beforeMatch(function ($uri, $route) {
/**
* @var string $uri
* @var \Phalcon\Mvc\Router\Route $route
* @var \Phalcon\DiInterface $this
* @var \Phalcon\Http\Request $request
*/
$request = $this->getShared('request');
// Check if the request was made with Ajax
return $request->isAjax();
});
Hostname Constraints
--------------------
Expand Down
26 changes: 24 additions & 2 deletions ru/reference/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -824,10 +824,32 @@ This is typically for an Error 404 page.
<?php
$router->add('/get/info/{id}', array(
$router->add('/get/info/{id}', [
'controller' => 'products',
'action' => 'info'
))->beforeMatch(array(new AjaxFilter(), 'check'));
])->beforeMatch([new AjaxFilter(), 'check']);
Начиная с Phalcon 2.1.0 beta 1, существует ещё один способ сделать эту проверку:

.. code-block:: php
<?php
$router->add('/login', [
'module' => 'admin',
'controller' => 'session'
])->beforeMatch(function ($uri, $route) {
/**
* @var string $uri
* @var \Phalcon\Mvc\Router\Route $route
* @var \Phalcon\DiInterface $this
* @var \Phalcon\Http\Request $request
*/
$request = $this->getShared('request');
// Проверяет был ли запрос сделан с помощью Ajax
return $request->isAjax();
});
Ограничение по имени хоста
--------------------------
Expand Down
26 changes: 24 additions & 2 deletions uk/reference/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,32 @@ And use this class instead of the anonymous function:
<?php
$router->add('/get/info/{id}', array(
$router->add('/get/info/{id}', [
'controller' => 'products',
'action' => 'info'
))->beforeMatch(array(new AjaxFilter(), 'check'));
])->beforeMatch([new AjaxFilter(), 'check']);
Since Phalcon 2.1.0 beta 1, there is another way to check this:

.. code-block:: php
<?php
$router->add('/login', [
'module' => 'admin',
'controller' => 'session'
])->beforeMatch(function ($uri, $route) {
/**
* @var string $uri
* @var \Phalcon\Mvc\Router\Route $route
* @var \Phalcon\DiInterface $this
* @var \Phalcon\Http\Request $request
*/
$request = $this->getShared('request');
// Check if the request was made with Ajax
return $request->isAjax();
});
Hostname Constraints
--------------------
Expand Down
26 changes: 24 additions & 2 deletions zh/reference/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -831,10 +831,32 @@ And use this class instead of the anonymous function:
<?php
$router->add('/get/info/{id}', array(
$router->add('/get/info/{id}', [
'controller' => 'products',
'action' => 'info'
))->beforeMatch(array(new AjaxFilter(), 'check'));
])->beforeMatch([new AjaxFilter(), 'check']);
Since Phalcon 2.1.0 beta 1, there is another way to check this:

.. code-block:: php
<?php
$router->add('/login', [
'module' => 'admin',
'controller' => 'session'
])->beforeMatch(function ($uri, $route) {
/**
* @var string $uri
* @var \Phalcon\Mvc\Router\Route $route
* @var \Phalcon\DiInterface $this
* @var \Phalcon\Http\Request $request
*/
$request = $this->getShared('request');
// Check if the request was made with Ajax
return $request->isAjax();
});
限制主机名(Hostname Constraints)
----------------------------------
Expand Down

0 comments on commit 2a8b629

Please sign in to comment.