Revision: 685
http://cs-project.svn.sourceforge.net/cs-project/?rev=685&view=rev
Author: crazedsanity
Date: 2007-11-23 13:26:18 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
Force noteClass to format note data for uniform display.
/lib/noteClass.php:
* get_notes():
-- ARG CHANGE: NEW ARG: #3 ($formatIt=TRUE)
-- optionally format the note content & subject
-- format note content to use for multiple spaces, and replace
newlines ("\n") with HTML line breaks ("<BR>")
Modified Paths:
--------------
trunk/lib/noteClass.php
Modified: trunk/lib/noteClass.php
===================================================================
--- trunk/lib/noteClass.php 2007-11-23 21:06:10 UTC (rev 684)
+++ trunk/lib/noteClass.php 2007-11-23 21:26:18 UTC (rev 685)
@@ -52,7 +52,7 @@
* @return 0 FAIL: unable to retrieve notes.
* @return <array> PASS: array contains records, indexed by id.
*/
- function get_notes($critArr=NULL, $primaryOrder=NULL) {
+ function get_notes($critArr=NULL, $primaryOrder=NULL, $formatIt=TRUE) {
if(is_array($primaryOrder)) {
$arrayKeysArr = array_keys($primaryOrder);
@@ -102,10 +102,20 @@
$retval = $this->db->farray_fieldnames("note_id",NULL,0);
foreach($retval as $id=>$arr) {
- //add some wrapping & cleaning (so the data appears properly)
- $retval[$id]['subject'] = cleanString($retval[$id]['subject'], "htmlentity_plus_brackets");
- $retval[$id]['body'] = cleanString($retval[$id]['body'], "htmlentity_plus_brackets");
+ if($formatIt === TRUE) {
+ //add some wrapping & cleaning (so the data appears properly)
+ $retval[$id]['subject'] = cleanString($retval[$id]['subject'], "htmlentity_plus_brackets");
+
+ $body = $retval[$id]['body'];
+ $body = cleanString($body, "htmlentity_plus_brackets");
+ $body = preg_replace("/\n/", "<BR>", $body);
+ $body = preg_replace('/\s\s/', ' ', $body);
+ $body = preg_replace('/\S\s\s/', ' ', $body);
+
+ $retval[$id]['body'] = $body;
+ }
+
//make the created & updated fields nicer.
$cleanDatesArr = array('created', 'updated');
foreach($cleanDatesArr as $dateField) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|