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 35cb8d420b9cdea86df7d2df3ac955fb77434847 (commit)
from ae6209fc73ef21aff5a38ff2a72699086b50b095 (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 35cb8d420b9cdea86df7d2df3ac955fb77434847
Author: Ivan1986 <iva...@li...>
Date: Fri May 21 11:42:54 2010 +0400
Обертка для preg_match
diff --git a/lib/utils.php b/lib/utils.php
index 3d5f679..1248a4c 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -293,4 +293,24 @@ function pluralForm($n, $form1, $form2, $form5)
return $form5;
}
+/**
+ * Вызывает preg_match(_all) и
+ * <br>возвращается данные в удобном формате
+ * <br>с использованием флага PREG_SET_ORDER
+ *
+ * @param string $pattern регулярное выражение
+ * @param string $subject строка для поиска
+ * @param bool $all вызывать preg_match_all
+ * @return array найденные паттерны
+ */
+function preg($pattern, $subject, $all = true)
+{
+ $m = array();
+ if ($all)
+ preg_match_all($pattern, $subject, $m, PREG_SET_ORDER);
+ else
+ preg_match($pattern, $subject, $m);
+ return $m;
+}
+
?>
-----------------------------------------------------------------------
Summary of changes:
lib/utils.php | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
hooks/post-receive
--
quickfw
|