[rkward-cvs] SF.net SVN: rkward:[2476] trunk/rkward/rkward/scriptbackends/common.php

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed May 13 16:29:26 UTC 2009


Revision: 2476
          http://rkward.svn.sourceforge.net/rkward/?rev=2476&view=rev
Author:   tfry
Date:     2009-05-13 16:29:26 +0000 (Wed, 13 May 2009)

Log Message:
-----------
Add convenience function to create call to rk.header

Modified Paths:
--------------
    trunk/rkward/rkward/scriptbackends/common.php

Modified: trunk/rkward/rkward/scriptbackends/common.php
===================================================================
--- trunk/rkward/rkward/scriptbackends/common.php	2009-05-13 15:39:41 UTC (rev 2475)
+++ trunk/rkward/rkward/scriptbackends/common.php	2009-05-13 16:29:26 UTC (rev 2476)
@@ -20,6 +20,25 @@
 	}
 }
 
+function makeHeaderCode ($title, $parameters=array ()) {
+	echo ("rk.header(\"" . escapeQuotes ($title) . "\"");
+	if (!empty ($parameters)) {
+		echo (", parameters=list(");
+		$first = true;
+		foreach ($parameters as $key => $value) {
+			if ($first) $first = false;
+			else echo (",\n\t");
+			echo ("\"" . escapeQuotes ($key) . "\", \"" . escapeQuotes ($value) . "\"");
+		}
+		echo (")");
+	}
+	echo (")\n");
+}
+
+function escapeQuotes ($input) {
+	return (str_replace ("\"", "\\\"", $input));
+}
+
 function getInput ($prompt) {
 	fputs (STDOUT, "#RKEND#\n" . $prompt . "#RKQEND#\n");
 	fflush (STDOUT);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list