Update of /cvsroot/phpicalendar/phpicalendar/functions/init
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv20875/functions/init
Modified Files:
Tag: phpicalendar-editor
date_range.php sanitize.php
Log Message:
merge with HEAD
Index: date_range.php
===================================================================
RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init/date_range.php,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -C2 -d -r1.10 -r1.10.2.1
*** date_range.php 29 Dec 2008 06:00:42 -0000 1.10
--- date_range.php 12 Apr 2010 18:58:37 -0000 1.10.2.1
***************
*** 31,34 ****
--- 31,35 ----
case 'week':
case 'day':
+ case 'print':
$mArray_begin = mktime (0,0,0,$start_month,1,($start_year));
$mArray_end = mktime (0,0,0,$end_month,31,($end_year));
Index: sanitize.php
===================================================================
RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init/sanitize.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** sanitize.php 23 Feb 2009 21:28:57 -0000 1.1.2.1
--- sanitize.php 12 Apr 2010 18:58:37 -0000 1.1.2.2
***************
*** 33,37 ****
--- 33,53 ----
}
+ /**
+ * Truncate a string to a specific number of words
+ */
+ function chopToWordCount($string, $count) {
+ $wc = str_word_count($string);
+ if ($wc > $count) {
+ $words = str_word_count($string, 2);
+ $last_word = array_slice($words, $count, 1, true);
+ $pos = key($last_word);
+ $string = substr($string, 0, $pos) . '...';
+ }
+ return $string;
+ }
+ /**
+ * Strip "dangerous" HTML to make it safe to print to web browsers
+ */
function sanitizeForWeb($string) {
$string = preg_replace('/<br\s*\/?>/', "\n", $string);
***************
*** 43,52 ****
$string = str_replace('"', '"', $string);
! $string = str_replace('<br />', "\n", $string);
!
return $string;
}
-
if (!isset($_SERVER) && isset($HTTP_SERVER_VARS)) {
$_SERVER = &$HTTP_SERVER_VARS;
--- 59,68 ----
$string = str_replace('"', '"', $string);
! $string = str_replace("\n", '<br />', $string);
! $string = str_replace("\t", ' ', $string);
!
return $string;
}
if (!isset($_SERVER) && isset($HTTP_SERVER_VARS)) {
$_SERVER = &$HTTP_SERVER_VARS;
|