cvs: pear /HTML_Javascript Javascript.php
| From: | Tal Peer | Date: | Thu, 08 Aug 2002 17:59:28 +0000 |
| Subject: | cvs: pear /HTML_Javascript Javascript.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5639@lists.php.net to get a copy of this message | ||
tal Thu Aug 8 13:59:28 2002 EDT
Modified files:
/pear/HTML_Javascript Javascript.php
Log:
* fixphpdoc
Index: pear/HTML_Javascript/Javascript.php
diff -u pear/HTML_Javascript/Javascript.php:1.26 pear/HTML_Javascript/Javascript.php:1.27
--- pear/HTML_Javascript/Javascript.php:1.26 Thu Aug 8 11:47:35 2002
+++ pear/HTML_Javascript/Javascript.php Thu Aug 8 13:59:28 2002
@@ -16,7 +16,7 @@
// | Authors: Tal Peer <tal@php.net> |
// | Pierre-Alain Joye <paj@pearfr.org> |
// +----------------------------------------------------------------------+
-// $Id: Javascript.php,v 1.26 2002/08/08 15:47:35 tal Exp $
+// $Id: Javascript.php,v 1.27 2002/08/08 17:59:28 tal Exp $
//Error codes
@@ -136,7 +136,15 @@
$this->PEAR();
}// }}} HTML_Javascript
-
+ // {{{ setOutputMode
+ /**
+ * Set the output mode for the script
+ *
+ * @param integer $mode the chosen output mode, can be either HTML_JAVASCRIPT_OUTPUT_RETURN,
HTML_JAVASCRIPT_OUTPUT_ECHO or HTML_JAVASCRIPT_OUTPUT_FILE
+ * @param string $file the path to the file (if $mode is HTML_JAVASCRIPT_OUTPUT_FILE)
+ * @access public
+ * @return mixed PEAR_Error or true
+ */
function setOutputMode($mode = HTML_JAVASCRIPT_OUTPUT_RETURN, $file = NULL)
{
if($mode == HTML_JAVASCRIPT_OUTPUT_FILE ) {
@@ -147,7 +155,8 @@
}
}
$this->_mode = $mode;
- }
+ return true;
+ } // }}} setOutputMode
// {{{ raiseError
/**
@@ -217,7 +226,11 @@
//{{{ _out
/**
+ * Checks the output mode and acts according to it
*
+ * @param string $str the string returned from the calling function
+ * @return mixed depends on the output mode, $str if it's HTML_JAVASCRIPT_OUTPUT_RETURN,
true otherwise
+ * @access private
*/
function _out($str)
{
@@ -230,15 +243,22 @@
return $str;
break;
}
+
case HTML_JAVASCRIPT_OUTPUT_ECHO: {
echo $str;
return true;
break;
}
+
case HTML_JAVASCRIPT_OUTPUT_FILE: {
$fp = fopen($file, 'ab');
fwrite($fp, $str);
return true;
+ break;
+ }
+
+ default: {
+ PEAR::raiseError('Invalid output mode');
break;
}
}