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 93f6097f71fe7436238251a564a3afcbe7a924e2 (commit)
via f29016c53f0c03a9a209b0dd7ff47f3b04396cdb (commit)
via a0c11a5c296371ab2819e8b1556ef1c94cd6b29f (commit)
via 0bf48b6d8435bbcbc030ba6dfe43aa160001090e (commit)
via 7bf0a288e1b89abdbb3f78e89e84322cb65b4f34 (commit)
via eda3035492dde52dc149ee684fe66d708a098148 (commit)
via 9bd67ba7dbb13640c9eb73cc955bab1bb37f854c (commit)
via ab24b811da9cf5909bdcd733824be57740e34515 (commit)
via ddc51b78706a466a33e92c911020a03f3444a15e (commit)
via 844e5d9135d0e5baad2fd2ff667c003b2f3805f5 (commit)
via 3b280697d53c0e941d0e4c1fc023ff60b94b4825 (commit)
via c8ca0b1275839a5868a1670479e48a9ceb399dd0 (commit)
via 50750d384def8db6b9d5b703d5cbd15b278fa03f (commit)
via 21a82c9f77672df4c1b869977faa25742c40150e (commit)
via 8781ae85d90778b82e454c0cabe2a18c08f6bc0b (commit)
via 45e8b4959e5609038d6c532f3ddf67754a25e52b (commit)
via 0e4f07232acdf83e257a8a0127cfff4380a1292b (commit)
via 0f487adea48a7d7b74c3efdc0b27c765520d678b (commit)
via 22050b0340cc4b514164dc12ae9b0bbbc5b3967a (commit)
via b218d313da1a51454d63cae0d48ed6b2c8961cb5 (commit)
from bdb96f73364b68aefecf116c1cd850f953036515 (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 93f6097f71fe7436238251a564a3afcbe7a924e2
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Mar 3 17:53:48 2011 +0300
Упрощение в хелпере
diff --git a/QFW/QuickFW/Helpers.php b/QFW/QuickFW/Helpers.php
index b8539a3..0c23dee 100644
--- a/QFW/QuickFW/Helpers.php
+++ b/QFW/QuickFW/Helpers.php
@@ -88,8 +88,7 @@ class Hlp
}
if ($content===true)
{
- $content=ob_get_contents();
- ob_end_clean();
+ $content=ob_get_clean();
}
$k = '<!--HEAD'.$name.'-->';
commit f29016c53f0c03a9a209b0dd7ff47f3b04396cdb
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Mar 3 13:04:21 2011 +0300
Очепятка :)
diff --git a/lib/utils.php b/lib/utils.php
index cbe6f44..f03f08d 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -78,7 +78,7 @@ function checkUrl($url)
'!0[^.]|255)[0-9]{1,3}\.){3}(?!0|255)[0-9]{1,3})(?:/[a-zа-я0-9.,_@%&'.
'\[\]?+:=\~/"\'\(\)-]*)?(?:#[^ \'"&<>]*)?$~iu',$url,$ok))
return false; // если не правильно - выход
- // если нет протокала - добавить
+ // если нет протокола - добавить
if (strpos($url, '://') === false)
$url='http://'.$url;
return $url;
commit a0c11a5c296371ab2819e8b1556ef1c94cd6b29f
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Mar 3 12:44:06 2011 +0300
Немного привел в порядок функции
diff --git a/lib/Text.php b/lib/Text.php
index 68d8990..16e1b0d 100644
--- a/lib/Text.php
+++ b/lib/Text.php
@@ -33,9 +33,14 @@ class Text
}
/**
- * Обрезка текста
+ * Обрезает длинные строки
+ *
+ * @param string $str Строка
+ * @param integer $size длина, до которой обрезать
+ * @param bool $word Обрезать по словам
+ * @return string Обрезанная строка
*/
- static public function my_trim($str, $size, $word=false)
+ static public function myTrim($str, $size, $word=false)
{
if (mb_strlen($str)<=$size)
return $str;
@@ -49,7 +54,6 @@ class Text
return $str;
}
-
/**
* Печать размера файла в форматированном виде
*/
@@ -63,6 +67,59 @@ class Text
}
/**
+ * Вывод сообщения с разбивкой длинных слов без повреждения тегов
+ *
+ * @param string $msg собщение, в котором нужно разбить слова
+ * @param integer $n длина, на которой ставить пробел
+ * @return string сообщение со словами, не превышающими n символов
+ */
+ static public function msg2html($msg, $n=50)
+ {
+ $marker = " <> ";
+
+ # Сохраняем все тэги чтобы уберечь их от разбивки
+ preg_match_all("/(<.*?>)/si",$msg,$tags);
+
+ # Заменяем все тэги на маркеры
+ $msg = preg_replace("/(<.*?>)/si", $marker, $msg);
+
+ $msg = preg_replace('|\S{'.$n.'}|u','\0 ',$msg);
+
+ # Восстанавливаем тэги в места которых были отмечены маркерами
+ for ($i=0; $i<count($tags[0]); $i++)
+ $msg = preg_replace("/$marker/si", $tags[1][$i], $msg, 1);
+
+ return $msg;
+ }
+
+ /**
+ * Преобразование URL в ссылки
+ */
+ static public function make_urls($string)
+ {
+ $p = '/((?:(?:ht|f)tps?:\/\/|www\.)[^<\s\n]+)(?<![]\.,:;!\})<-])/msiu';
+ $r = '<a href="$1">$1</a>$2';
+
+ $string = preg_replace($p, $r, $string);
+
+ $p = '/ href="www\./msiu';
+ $r = ' href="http://www.';
+
+ return preg_replace($p, $r, $string);
+ }
+
+ /**
+ * Генерирует урл из текста - убирает / и применяет urlencode
+ *
+ * @param string $text
+ * @return string
+ */
+ static public function genUrl($text)
+ {
+ return rawurlencode(str_replace(array('/', ' '), '-', $text));
+ }
+
+ /**
* Формирование даты по-русски
* <br>так как при выстановке локали неправильно склоняет
*
@@ -97,6 +154,12 @@ class Text
return strtr(date($format, $time!==false ? $time : time()), $translation);
}
+ /**
+ * Формирует из timestamp строку времяни
+ *
+ * @param integer $ts timestamp
+ * @return string строка - сколько времени назад
+ */
static public function date_ago($ts)
{
$dif = time() - $ts;
diff --git a/lib/utils.php b/lib/utils.php
index 46bad18..cbe6f44 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -85,63 +85,6 @@ function checkUrl($url)
}
/**
- * Вывод сообщения с разбивкой длинных слов без повреждения тегов
- *
- * @param string $msg собщение, в котором нужно разбить слова
- * @param integer $n длина, на которой ставить пробел
- * @return string сообщение со словами, не превышающими n символов
- */
-function msg2html($msg, $n=50)
-{
- $marker = " <> ";
-
- # Сохраняем все тэги чтобы уберечь их от разбивки
- preg_match_all("/(<.*?>)/si",$msg,$tags);
-
- # Заменяем все тэги на маркеры
- $msg = preg_replace("/(<.*?>)/si", $marker, $msg);
-
- $msg = preg_replace('|\S{'.$n.'}|u','\0 ',$msg);
-
- # Восстанавливаем тэги в места которых были отмечены маркерами
- for ($i=0; $i<count($tags[0]); $i++)
- $msg = preg_replace("/$marker/si", $tags[1][$i], $msg, 1);
-
- return $msg;
-}
-
-/**
- * Преобразование URL в ссылки
- */
-function make_urls($string)
-{
- $p = '/((?:(?:ht|f)tps?:\/\/|www\.)[^<\s\n]+)(?<![]\.,:;!\})<-])/msiu';
- $r = '<a href="$1">$1</a>$2';
-
- $string = preg_replace($p, $r, $string);
-
- $p = '/ href="www\./msiu';
- $r = ' href="http://www.';
-
- return preg_replace($p, $r, $string);
-}
-
-/**
- * Обрезает длинные строки, не разрывая последнее слово
- *
- * @param string $str строка, которую нужно обрезать
- * @param integer $size до скольки знаков
- */
-function clearCut($str, $size)
-{
- if(mb_strlen($str) <= $size)
- return $str;
-
- $words = explode(' ', mb_substr($str, 0, $size));
- return implode(' ', array_slice($words, 0, count($words)-1)).'...';
-}
-
-/**
* Выдает несколько неповторяющихся случайных значений
*/
function n_rand($min, $max, $count)
@@ -295,16 +238,3 @@ function password_sailt($pass)
{
return md5($pass.QFW::$config['pass_sailt']);
}
-
-/**
- * Генерирует урл из текста - убирает / и применяет urlencode
- *
- * @param string $text
- * @return string
- */
-function genUrl($text)
-{
- return rawurlencode(str_replace(array('/', ' '), '-', $text));
-}
-
-?>
commit 0bf48b6d8435bbcbc030ba6dfe43aa160001090e
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Mar 3 12:31:33 2011 +0300
Очепятка
diff --git a/QFW/Templater/Templater.php b/QFW/Templater/Templater.php
index 4643d3b..a2da74b 100644
--- a/QFW/Templater/Templater.php
+++ b/QFW/Templater/Templater.php
@@ -18,12 +18,12 @@ abstract class Templater
/** @var String Основной шаблон (путь относительно директории шаблонов) */
public $mainTemplate;
- public function __construct($tmplPath, $mainTmpl)
+ public function __construct($tplPath, $mainTpl)
{
$this->_vars = array();
- $this->_tmplPath = $tmplPath;
+ $this->_tmplPath = $tplPath;
$this->P = QuickFW_Plugs::getInstance();
- $this->mainTemplate = $mainTmpl;
+ $this->mainTemplate = $mainTpl;
}
public function __get($name)
commit 7bf0a288e1b89abdbb3f78e89e84322cb65b4f34
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Mar 3 12:26:48 2011 +0300
Добавлены магические __get и __set в шаблонизатор
diff --git a/QFW/Templater/Templater.php b/QFW/Templater/Templater.php
index 6fea9da..4643d3b 100644
--- a/QFW/Templater/Templater.php
+++ b/QFW/Templater/Templater.php
@@ -26,6 +26,16 @@ abstract class Templater
$this->mainTemplate = $mainTmpl;
}
+ public function __get($name)
+ {
+ return $this->getTemplateVars($name);
+ }
+
+ public function __set($name, $value)
+ {
+ $this->assign($name, $value);
+ }
+
/**
* Присваение значения переменной шаблона
*
commit eda3035492dde52dc149ee684fe66d708a098148
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Mar 3 12:14:57 2011 +0300
Удаление старого кода
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index c48e249..cf1b2ad 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -206,9 +206,7 @@ class QuickFW_Router
{
$data = array_slice($patt,1,3);
$MCA = $this->loadMCA($data,'Block');
- // Если вы все еще сидите на PHP 5.2 то раскомментируйте старый вариант
- $MCA['Params'] = empty($patt[4]) ? array() :
- str_getcsv($patt[4],',',"'",'\\'); // $this->parseScobParams($patt[4]);
+ $MCA['Params'] = empty($patt[4]) ? array() : str_getcsv($patt[4],',',"'",'\\');
}
else
{
@@ -454,20 +452,6 @@ class QuickFW_Router
return array('params' => $params);
}
- protected function parseScobParams($par)
- {
-//регулярка для парсинга параметров - записана так, чтобы не было страшных экранировок
-$re = <<<SREG
-#\s*([^,"']+|"(?:[^"]|\\"|"")*?[^\"]"|'(?:[^']|\\'|'')*?[^\']')\s*(?:,|$)#
-SREG;
- $m=array();
- preg_match_all($re, $par, $m);
- foreach ($m[1] as &$v)
- $v = str_replace(array('""',"''",'\"',"\'"), array('"',"'",'"',"'"),
- trim($v,'\'" '));
- return $m[1];
- }
-
protected function loadMCA(&$data, $type)
{
while (isset($data[0]) AND $data[0] === '') array_shift($data);
diff --git a/QFW/Templater/Templater.php b/QFW/Templater/Templater.php
index f5e6059..6fea9da 100644
--- a/QFW/Templater/Templater.php
+++ b/QFW/Templater/Templater.php
@@ -130,9 +130,7 @@ abstract class Templater
*/
public function block($block)
{
- //TODO: убрать ненужную переменную после перехода на php 5.3
- $args = func_get_args();
- return call_user_func_array(array(&QFW::$router, 'blockRoute'), $args);
+ return call_user_func_array(array(&QFW::$router, 'blockRoute'), func_get_args());
}
/**
@@ -144,7 +142,6 @@ abstract class Templater
*/
public function localBlock($ns, $block)
{
- //TODO: убрать ненужную переменную после перехода на php 5.3
$args = func_get_args();
array_shift($args);
$c = $ns.'\QFW';
diff --git a/cron/cruise.php b/cron/cruise.php
index b270253..ae8f4e0 100644
--- a/cron/cruise.php
+++ b/cron/cruise.php
@@ -11,10 +11,8 @@
// define ('LOGPATH', VARPATH . '/log');
// define ('MODPATH', APPPATH . '/_common/models');
- //TODO: Выкинуть gethostbyaddr после перехода на PHP 5.3
if (empty($_SERVER['HTTP_HOST']))
- $_SERVER['HTTP_HOST'] = function_exists('gethostname') ?
- gethostname() : gethostbyaddr('127.0.0.1');
+ $_SERVER['HTTP_HOST'] = gethostname();
require (QFWPATH.'/Init.php');
diff --git a/cron/start.php b/cron/start.php
index 9afe7ce..30ea766 100644
--- a/cron/start.php
+++ b/cron/start.php
@@ -11,10 +11,8 @@
// define ('LOGPATH', VARPATH . '/log');
// define ('MODPATH', APPPATH . '/_common/models');
- //TODO: Выкинуть gethostbyaddr после перехода на PHP 5.3
if (empty($_SERVER['HTTP_HOST']))
- $_SERVER['HTTP_HOST'] = function_exists('gethostname') ?
- gethostname() : gethostbyaddr('127.0.0.1');
+ $_SERVER['HTTP_HOST'] = gethostname();
require (QFWPATH.'/Init.php');
diff --git a/lib/Log52.php b/lib/Log52.php
deleted file mode 100644
index c903358..0000000
--- a/lib/Log52.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-/**
- * Класс логирования
- *
- * <br>Аналог класса Log в версии для PHP 5.2
- * <br>Нет поддержки функции log, только out
- * <br>работает в 5.2, так как некоторые ...
- * <br>обновиться не могут :)
- *
- * @version PHP5.2
- */
-class Log
-{
- private static $l=null;
- private static $messages=array();
-
- /**
- * Заносит запись в лог
- *
- * @param string $string запись
- * @param string $to лог назначения
- */
- public static function out(string $string, string $to='general')
- {
- if (isset(QFW::$config['log'][$to]))
- $to = QFW::$config['log'][$to];
- if (self::$l === null)
- self::$l = new Log();
- if ($to == 'error')
- error_log($str);
- elseif(strpos($to,'mailto:')===0)
- self::$l->email($str,substr($to,7));
- elseif(strpos($to,'xmpp://')===0)
- self::$l->jabber($str,substr($to,7));
- else
- self::f($str, $to);
- }
-
- /**
- * Отправляет очередь сообщений
- * <br>нужно в случае длительной работы и отправке в jabber
- */
- public static function sendQuery()
- {
- if (isset(self::$messages['email']))
- {
- foreach (self::$messages['email'] as $k=>$msg)
- error_log(join("\n",$msg), 1, $k);
- unset(self::$messages['email']);
- }
- if (isset(self::$messages['jabber']))
- {
- if (!isset(QFW::$config['jabber']))
- error_log('Jabber не настроен ');
- else
- {
- $J = QFW::JabberFromConfig();
- $J->connect();
- $J->processUntil('session_start',10);
- $J->presence();
- foreach (self::$messages['jabber'] as $k=>$msg)
- $J->message($k, join("\n",$msg));
- $J->disconnect();
- }
- unset(self::$messages['jabber']);
- }
- }
-
- private function jabber($str, $to) { self::$messages['jabber'][$to][]=$str; }
- private function email($str, $to) { self::$messages['email'][$to][]=$str; }
- private static function f($str, $to)
- {
- error_log(date('Y-m-d H:i:s').': '.$str."\n", 3, LOGPATH.'/'.$to.'.log');
- }
-
- public function __destruct()
- {
- self::sendQuery();
- }
-
-}
-
-?>
\ No newline at end of file
commit 9bd67ba7dbb13640c9eb73cc955bab1bb37f854c
Merge: ab24b81 ddc51b7
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Mar 1 15:41:17 2011 +0300
В основную ветку добавлен суброутинг
diff --cc QFW/QuickFW/Router.php
index 33de1d1,2e75205..c48e249
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@@ -510,9 -561,9 +561,10 @@@ SREG
return $MCA;
}
}
+ $class = $this->sub.$class;
$vars = get_class_vars($class);
$acts = get_class_methods($class);
+ $defA = isset($vars['defA']) ? $vars['defA'] : $this->defA;
//Выполняется при первом вызове и сохраняет значение вызванного MCA
//Проверяем последний так как остальные уже записаны
commit ab24b811da9cf5909bdcd733824be57740e34515
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Feb 28 15:15:19 2011 +0300
Класс для доступа к массивам как к объектам
diff --git a/lib/RecursiveArrayAccess.php b/lib/RecursiveArrayAccess.php
new file mode 100644
index 0000000..0f39e41
--- /dev/null
+++ b/lib/RecursiveArrayAccess.php
@@ -0,0 +1,43 @@
+<?php
+
+class RecursiveArrayAccess implements ArrayAccess
+{
+ private $data = array();
+
+ // necessary for deep copies
+ public function __clone() {
+ foreach ($this->data as $key => $value) if ($value instanceof self) $this[$key] = clone $value;
+ }
+
+ public function __construct(array $data = array()) {
+ foreach ($data as $key => $value) $this[$key] = $value;
+ }
+
+ public function offsetSet($offset, $data) {
+ if (is_array($data)) $data = new self($data);
+ if ($offset === null) { // don't forget this!
+ $this->data[] = $data;
+ } else {
+ $this->data[$offset] = $data;
+ }
+ }
+
+ public function toArray() {
+ $data = $this->data;
+ foreach ($data as $key => $value) if ($value instanceof self) $data[$key] = $value->toArray();
+ return $data;
+ }
+
+ // as normal
+ //public function offsetGet($offset) { return isset($this->data[$offset]) ? $this->data[$offset] : null; }
+ public function offsetGet($offset) { return $this->data[$offset]; }
+ public function offsetExists($offset) { return isset($this->data[$offset]); }
+ public function offsetUnset($offset) { unset($this->data); }
+
+ //as prop
+ public function __get($offset) { return $this->offsetGet($offset); }
+ public function __set($offset, $data) { return $this->offsetSet($offset, $data); }
+ public function __isset($offset) { return $this->offsetExists($offset); }
+ public function __unset($offset) { return $this->offsetUnset($offset); }
+
+}
-----------------------------------------------------------------------
Summary of changes:
QFW/Init.php | 2 +-
QFW/QuickFW/Autoload.php | 12 ++-
QFW/QuickFW/Helpers.php | 3 +-
QFW/QuickFW/Router.php | 86 ++++++++++++++------
QFW/QuickFW/Url.php | 56 ++++++++-----
QFW/Templater/Templater.php | 33 +++++++-
QFW/sub.php | 43 ++++++++++
.../default/controllers/IndexController.php | 9 ++
.../test/default/controllers/IndexController.php | 20 +++++
.../default/test/default/templates/index.php | 5 +
application/default/test/sub.php | 46 +++++++++++
cron/cruise.php | 4 +-
cron/start.php | 4 +-
doc/asciidoc/mvc.txt | 26 ++++++
lib/Log52.php | 84 -------------------
lib/RecursiveArrayAccess.php | 43 ++++++++++
lib/Text.php | 69 +++++++++++++++-
lib/utils.php | 72 +----------------
18 files changed, 395 insertions(+), 222 deletions(-)
create mode 100644 QFW/sub.php
create mode 100644 application/default/test/default/controllers/IndexController.php
create mode 100644 application/default/test/default/templates/index.php
create mode 100644 application/default/test/sub.php
delete mode 100644 lib/Log52.php
create mode 100644 lib/RecursiveArrayAccess.php
hooks/post-receive
--
quickfw
|