This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "quickfw".
The branch, master has been updated
via 6d8b112233fa8bbfc4c3e243ffe04be1f4b7c436 (commit)
from c379916d66f322799f3ae1bb395ac3a1d0d808b9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6d8b112233fa8bbfc4c3e243ffe04be1f4b7c436
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Nov 3 11:29:32 2010 +0300
Полный бэкреврайт
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index 84e6c78..3124e6f 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -305,6 +305,8 @@ class QuickFW_Router
protected $rewrite = false;
/** @var array Массив обратных преобразований Uri */
protected $backrewrite = false;
+ /** @var array Массив обратных преобразований Urr */
+ protected $backrewriteUrl = false;
/**
* Функция производит преобразования урла для вывода на страницу
@@ -319,6 +321,18 @@ class QuickFW_Router
}
/**
+ * Функция производит фитальные преобразования полного урла
+ *
+ * @internal
+ * @param string $url Url для бекреврайта
+ * @return string преобразованный Url
+ */
+ public function backrewriteUrl($url)
+ {
+ return $this->rewr($url, 'backrewriteUrl');
+ }
+
+ /**
* Функция производит преобразования урла при запросе
*
* @internal
@@ -342,17 +356,19 @@ class QuickFW_Router
{
if (!QFW::$config['redirection']['useRewrite'])
return $uri;
- if ($this->$type == false)
+ if ($this->$type === false)
{
- $rewrite = array();
- $backrewrite = array();
+ $rewrite = $backrewrite = $backrewriteUrl = array();
require_once APPPATH . '/rewrite.php';
$this->rewrite = $rewrite;
$this->backrewrite = $backrewrite;
+ $this->backrewriteUrl = $backrewriteUrl;
}
+ if (empty($this->$type))
+ return $uri;
if (is_array($this->$type))
return preg_replace(array_keys($this->$type), array_values($this->$type), $uri);
- elseif (is_callable($this->$type))
+ if (is_callable($this->$type))
{
$f = $this->$type;
return $f($uri);
diff --git a/QFW/QuickFW/Url.php b/QFW/QuickFW/Url.php
index 63c22d5..bd2ab8c 100644
--- a/QFW/QuickFW/Url.php
+++ b/QFW/QuickFW/Url.php
@@ -138,10 +138,11 @@ class Url
*/
public function __toString()
{
- return self::$config['base'].$this->u.
+ return QFW::$router->backrewriteUrl(
+ self::$config['base'].QFW::$router->backrewrite($this->u).
($this->u!=='' ? self::$config['ext'] : '').
($this->get ? '?' . $this->get : '').
- ($this->ancor ? '#' . $this->ancor : '');
+ ($this->ancor ? '#' . $this->ancor : ''));
}
diff --git a/application/rewrite.php b/application/rewrite.php
index 5a8b367..9c7ea74 100644
--- a/application/rewrite.php
+++ b/application/rewrite.php
@@ -4,5 +4,13 @@ $rewrite = array(
);
$backrewrite = array(
);
+$backrewriteUrl = array(
+);
+
+/* пример */
+/*$backrewriteUrl = function($url)
+{
+ return $url.'?from='.QFW::$router->RequestUri ;
+}*/
?>
\ No newline at end of file
-----------------------------------------------------------------------
Summary of changes:
QFW/QuickFW/Router.php | 24 ++++++++++++++++++++----
QFW/QuickFW/Url.php | 5 +++--
application/rewrite.php | 8 ++++++++
3 files changed, 31 insertions(+), 6 deletions(-)
hooks/post-receive
--
quickfw
|