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 89ab550468d7e75a3d965de46661847b59bf6be4 (commit)
via c33041e16b4cd4597fd1626528fdd445d18c94a2 (commit)
via 22a4c29cfc27657a4c0023e0146c97d27e9d805b (commit)
via 5cd62d380b86a8b5204f89d4b1bed70f5edb07c9 (commit)
via a0b3d2823dea0a5a4c2f2ca62e1eba22b3c1819a (commit)
from 97d4f68175e4d11ec2cb0204f39cfdabf31ba18a (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 89ab550468d7e75a3d965de46661847b59bf6be4
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Aug 4 23:30:21 2010 +0400
Автолоад контроллеров
diff --git a/QFW/QuickFW/Autoload.php b/QFW/QuickFW/Autoload.php
index c6176c6..1f43302 100644
--- a/QFW/QuickFW/Autoload.php
+++ b/QFW/QuickFW/Autoload.php
@@ -16,11 +16,36 @@ class Autoload
{
spl_autoload_register(array(__CLASS__, 'Bind'));
spl_autoload_register(array(__CLASS__, 'Dirs'));
+ spl_autoload_register(array(__CLASS__, 'Controller'));
if (is_callable($function))
spl_autoload_register($function);
}
/**
+ * Автолоад контроллеров (при наследовании)
+ *
+ * @param string $class искомый класс контроллера
+ */
+ static public function Controller($class)
+ {
+ if (mb_strpos($class, 'Controller') === false)
+ return false;
+ $class = strtr($class,'_','/');
+ //пространство имен
+ if ($pos = mb_strpos($class, '\\'))
+ {
+ $file =
+ strtolower(mb_substr($class, 0, $pos)).
+ '/controllers/'.
+ ucfirst(mb_substr($class, $pos+1));
+ }
+ else
+ $file = QFW::$router->cModule.'/controllers/'.$class;
+ require APPPATH.'/'.$file.'.php';
+ return true;
+ }
+
+ /**
* Автолоад некоторых стандартных классов
*
* <br>Так получилось, что эти классы находятся тут
commit c33041e16b4cd4597fd1626528fdd445d18c94a2
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Aug 4 23:25:05 2010 +0400
Более ранее выставление cMCA - теперь до включения файла с классом
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index 18bd1f4..4318313 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -399,19 +399,24 @@ SREG;
if ($cached)
{
$MCA = $cached['MCA'];
+ //устанавливаем переменные роутера
+ if ($this->module == '')
+ {
+ $this->module = $MCA['Module'];
+ $this->controller = $MCA['Controller'];
+ $this->action = $MCA['Action'];
+ $this->type = $MCA['Type'];
+ }
+ $this->cModule = $MCA['Module'];
+ $this->cController = $MCA['Controller'];
+ $this->cAction = $MCA['Action'];
+ //составляем путь и загружаем
$path = $this->baseDir.'/'.$MCA['Module'];
QFW::$view->setScriptPath($path.'/templates');
$class = ucfirst($MCA['Controller']).'Controller';
$fullname = $path . '/controllers/' . strtr($class,'_','/') . '.php';
require_once($fullname);
$class_key=$MCA['Module'].'|'.$MCA['Controller'];
- if ($this->module == '')
- {
- $this->cModule = $this->module = $MCA['Module'];
- $this->cController = $this->controller = $MCA['Controller'];
- $this->cAction = $this->action = $MCA['Action'];
- $this->type = $MCA['Type'];
- }
if (!isset($this->classes[$class_key]))
$this->classes[$class_key] = array(
'i' => $MCA['Class'] = new $class,
@@ -455,6 +460,9 @@ SREG;
$MCA['Controller'] = $cname;
$class_key=$MCA['Module'].'|'.$MCA['Controller'];
+ $this->cModule = $MCA['Module'];
+ $this->cController = $MCA['Controller'];
+
if (!isset($this->classes[$class_key]))
{
require_once($fullname);
@@ -516,6 +524,7 @@ SREG;
return $MCA;
}
}
+ $this->cAction = $MCA['Action'];
if (QFW::$config['QFW']['auto404'] && count($data)==$c && $c>0)
{ // если из URI после модуля ничего не забрали и что-то осталось
commit 22a4c29cfc27657a4c0023e0146c97d27e9d805b
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Aug 4 23:20:57 2010 +0400
Восстановление cMCA при ошибке роутера
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index acecdb0..18bd1f4 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -136,6 +136,12 @@ class QuickFW_Router
//Сохраняем старый путь шаблонов
$scriptPath = QFW::$view->getScriptPath();
+ //Выставляем новые пути вызова и сохраняем старые
+ list($lpPath, $this->ParentPath, $this->CurPath) =
+ array($this->ParentPath, $this->CurPath, $MCA['Path']);
+ //сохраняем прошлый MCA
+ list ($oModule, $oController, $oAction) =
+ array($this->cModule, $this->cController, $this->cAction);
if ($Uri instanceof Url)
$Uri = $Uri->intern();
@@ -163,6 +169,15 @@ class QuickFW_Router
if (isset($MCA['Error']))
{
+ //восстанавливаем MCA
+ list ($this->cModule, $this->cController, $this->cAction) =
+ array($oModule, $oController, $oAction);
+ //восстанавливаем пути вызова
+ list($this->CurPath, $this->ParentPath) =
+ array($this->ParentPath, $lpPath);
+ //Возвращаем путь к шаблонам после вызова
+ QFW::$view->setScriptPath($scriptPath);
+
if (QFW::$config['QFW']['release'])
return '';
return "Ошибка подключения блока ".$Uri." адрес был разобран в\t\t ".
@@ -174,27 +189,14 @@ class QuickFW_Router
if ($Params)
$MCA['Params'] = array_merge($MCA['Params'], $Params);
- //сохраняем пути вызова
- list($lpPath, $this->ParentPath, $this->CurPath) =
- array($this->ParentPath, $this->CurPath, $MCA['Path']);
-
- //сохраняем прошлый MCA
- list ($oModule, $oController, $oAction) =
- array($this->cModule, $this->cController, $this->cAction);
- //устанавливаем текущий
- list ($this->cModule, $this->cController, $this->cAction) =
- array($MCA['Module'], $MCA['Controller'], $MCA['Action']);
-
$result = call_user_func_array(array($MCA['Class'], $MCA['Action'].$MCA['Type']), $MCA['Params']);
//восстанавливаем MCA
list ($this->cModule, $this->cController, $this->cAction) =
array($oModule, $oController, $oAction);
-
//восстанавливаем пути вызова
list($this->CurPath, $this->ParentPath) =
array($this->ParentPath, $lpPath);
-
//Возвращаем путь к шаблонам после вызова
QFW::$view->setScriptPath($scriptPath);
commit 5cd62d380b86a8b5204f89d4b1bed70f5edb07c9
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Aug 4 22:46:51 2010 +0400
Автолоад классов, не поподающих в иерархий файлов
diff --git a/QFW/QuickFW/Autoload.php b/QFW/QuickFW/Autoload.php
index 92f9772..c6176c6 100644
--- a/QFW/QuickFW/Autoload.php
+++ b/QFW/QuickFW/Autoload.php
@@ -14,13 +14,37 @@ class Autoload
*/
static public function Init($function = false)
{
+ spl_autoload_register(array(__CLASS__, 'Bind'));
spl_autoload_register(array(__CLASS__, 'Dirs'));
if (is_callable($function))
spl_autoload_register($function);
}
/**
- * Функция автолоада
+ * Автолоад некоторых стандартных классов
+ *
+ * <br>Так получилось, что эти классы находятся тут
+ *
+ * @param string $class искомый класс
+ */
+ static public function Bind($class)
+ {
+ if (empty(self::$classes))
+ self::$classes = array(
+ 'ScafoldController' => LIBPATH.'/Modules/Scafold/ScafoldController.php',
+ 'QuickFW_Auth' => QFWPATH.'/QuickFW/Auth.php',
+ );
+ if (empty(self::$classes[$class]))
+ return false;
+ require self::$classes[$class];
+ return true;
+ }
+
+ /** @var array соответствие классов и файлов */
+ static private $classes;
+
+ /**
+ * Автолоад в директориях
*
* @param string $class искомый класс
*/
commit a0b3d2823dea0a5a4c2f2ca62e1eba22b3c1819a
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Aug 4 22:11:39 2010 +0400
Перенес класс rss
diff --git a/lib/Modules/Rss.php b/lib/Rss.php
similarity index 100%
rename from lib/Modules/Rss.php
rename to lib/Rss.php
-----------------------------------------------------------------------
Summary of changes:
QFW/QuickFW/Autoload.php | 51 ++++++++++++++++++++++++++++++++++++++++++++-
QFW/QuickFW/Router.php | 51 +++++++++++++++++++++++++++-----------------
lib/{Modules => }/Rss.php | 0
3 files changed, 81 insertions(+), 21 deletions(-)
rename lib/{Modules => }/Rss.php (100%)
hooks/post-receive
--
quickfw
|