Location: PHPKode > projects > Program E > docs/developer/Interpreter/_util_php.html
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos  -->
			<title>Docs for page util.php</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
						<script src="../media/lib/classTree.js"></script>
												<script language="javascript" type="text/javascript">
				var imgPlus = new Image();
				var imgMinus = new Image();
				imgPlus.src = "../media/images/plus.png";
				imgMinus.src = "../media/images/minus.png";
				
				function showNode(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
							var oImg = document.layers["img" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
							var oImg = document.all["img" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
							var oImg = document.getElementById("img" + Node);
									break;
							}
					oImg.src = imgMinus.src;
					oTable.style.display = "block";
				}
				
				function hideNode(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
							var oImg = document.layers["img" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
							var oImg = document.all["img" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
							var oImg = document.getElementById("img" + Node);
									break;
							}
					oImg.src = imgPlus.src;
					oTable.style.display = "none";
				}
				
				function nodeIsVisible(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
									break;
							}
					return (oTable && oTable.style.display == "block");
				}
				
				function toggleNodeVisibility(Node){
					if (nodeIsVisible(Node)){
						hideNode(Node);
					}else{
						showNode(Node);
					}
				}
			</script>
					</head>
		<body>
			<div class="page-body">			

<h2 class="file-name"><img src="../media/images/Page_logo.png" alt="File" style="vertical-align: middle">/util.php</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
							<a href="#sec-classes">Classes</a>
			|							<a href="#sec-includes">Includes</a>
			|											<a href="#sec-functions">Functions</a>
			</div>
	<div class="info-box-body">	
		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Util.php, Utility functions</p>
<p class="description"><p>Contains reusable functions for Program E</p></p>
	<ul class="tags">
				<li><span class="field">filesource:</span> <a href="..//__filesource/fsource_Interpreter__util.php.html">Source Code for this file</a></li>
				<li><span class="field">license:</span> <a href="http://opensource.org/licenses/gpl-license.php">GNU Public License</a></li>
				<li><span class="field">version:</span> 0.0.8</li>
				<li><span class="field">copyright:</span> 2002</li>
				<li><span class="field">author:</span> Paul Rydell</li>
			</ul>
		
			</div>
</div>
		
	<a name="sec-classes"></a>	
	<div class="info-box">
		<div class="info-box-title">Classes</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
			<span class="disabled">Classes</span>
			|							<a href="#sec-includes">Includes</a>
				|																<a href="#sec-functions">Functions</a>
					</div>
		<div class="info-box-body">	
			<table cellpadding="2" cellspacing="0" class="class-table">
				<tr>
					<th class="class-table-header">Class</th>
					<th class="class-table-header">Description</th>
				</tr>
								<tr>
					<td style="padding-right: 2em; vertical-align: top; white-space: nowrap">
						<img src="../media/images/Class.png"
								 alt=" class"
								 title=" class"/>
						<a href="../Interpreter/Response.html">Response</a>
					</td>
					<td>
											Class to hold the reponse
										</td>
				</tr>
							</table>
		</div>
	</div>

	<a name="sec-includes"></a>	
	<div class="info-box">
		<div class="info-box-title">Includes</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
							<a href="#sec-classes">Classes</a>
				|						<span class="disabled">Includes</span>
			|													<a href="#sec-functions">Functions</a>
					</div>
		<div class="info-box-body">	
			<a name="_admin/subs_inc"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Page.png" alt=" " />
		<span class="include-title">
			<span class="include-type">require_once</span>
			(<span class="include-name">"admin/subs.inc"</span>)
			(line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a59">59</a></span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">subs.inc has all of the substitution values and sentence splitter values</p>
	
</div>
		</div>
	</div>
	
	
	
	<a name="sec-functions"></a>	
	<div class="info-box">
		<div class="info-box-title">Functions</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
							<a href="#sec-classes">Classes</a>
				|										<a href="#sec-includes">Includes</a>
				|												<span class="disabled">Functions</span>
		</div>
		<div class="info-box-body">	
			<a name="functionaddinputs" id="functionaddinputs"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">addinputs</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a382">382</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Store the clients inputs into the database.</p>
<p class="description"><p>This is an array because it separates on .'s and other sentence splitters. Stores these in the  dstore table of the database.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> nothing</li>
				<li><span class="field">global:</span> integer $uid: </li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			addinputs
		</span>
					(<span class="var-type">array</span>&nbsp;<span class="var-name">$inputsarray</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$inputsarray</span><span class="var-description">: Contains multiple inputs (i.e. sentences) of a user</span>			</li>
				</ul>
		
	
</div>
<a name="functionaddthats" id="functionaddthats"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">addthats</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a415">415</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Store the bots responses into the database</p>
<p class="description"><p>This is an array because it separates on .'s and other sentence splitters. Stores these in the  thatindex table of the database.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> nothing</li>
				<li><span class="field">global:</span> integer $uid: </li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			addthats
		</span>
					(<span class="var-type">array</span>&nbsp;<span class="var-name">$inputsarray</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$inputsarray</span><span class="var-description">: Contains multiple inputs (sentences) of the bot</span>			</li>
				</ul>
		
	
</div>
<a name="functionbget" id="functionbget"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">bget</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a319">319</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get a value for some variable set by the user in AIML.</p>
<p class="description"><p>In the template (&lt;template&gt; ... &lt;/template&gt;) variables can be set and used during matching.  after matching these variables are stored in the table dstore. This function retrieves the  value of a stored variable. This type of variable is also called a 'predicate'.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> Either the value of the stored predicate, or the constand default                            value of a predicate</li>
				<li><span class="field">global:</span> integer $uid: </li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionrespond">respond()</a></li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			bget
		</span>
					(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$name</span>)
			</div>

		
	
</div>
<a name="functionbotget" id="functionbotget"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">botget</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a284">284</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get information about the bot that was entered in the startup.xml</p>
<p class="description"><p>In startup.xml there are a number of bot-varables called in AIML as &lt;bot name=&quot;foo&quot;/&gt;  These are stored in the table 'bot' and this function retrieves (ex.) the value of  bot-variable &quot;foo&quot;.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The value of requested bot variable.</li>
				<li><span class="field">global:</span> integer $uid: uid            is created in talk.php as $myuniqueid then transformed
                                in respond.php into $uid by reply()</li>
				<li><span class="field">global:</span> integer $selectbot: selectbot     is created in respond.php:replybotname() as $botid
                                which in return calls reply() that turns it into $selectbot</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
				<li><span class="field">see:</span> <a href="../Interpreter/_respond_php.html#functionreplybotname">replybotname()</a></li>
				<li><span class="field">see:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
				<li><span class="field">see:</span> <a href="../Interpreter/Responder/_talk_php.html">talk.php</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			botget
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$name</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$name</span><span class="var-description">: The name of the bot-variable of which the value is requested.</span>			</li>
				</ul>
		
	
</div>
<a name="functionbset" id="functionbset"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">bset</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a355">355</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Set the value for an AIML variable</p>
<p class="description"><p>Function to store the variable name and it's contents into the dstore table. It doens't  update the table, just the first insert.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> doesn't return anything</li>
				<li><span class="field">global:</span> integer $uid: </li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			bset
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$name</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$value</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$name</span><span class="var-description">: The name in which the value should be stored</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$value</span><span class="var-description">: The contents of the variable.</span>			</li>
				</ul>
		
	
</div>
<a name="functioncleanup" id="functioncleanup"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">cleanup</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a88">88</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">This function will clean up old data in the database that is not  needed according to user defined settings.</p>
<p class="description"><p>Deletes entries in the database tables dstore, thatstack, thatstackindex  and if set also conversationlog.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> nothing, deletes database entires</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
				<li><span class="field">uses:</span> <a href="../Interpreter/_util_php.html#functionmake_seed">make_seed()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			cleanup
		</span>
				()
			</div>

		
	
</div>
<a name="functionfirstsecond" id="functionfirstsecond"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">firstsecond</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a699">699</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Do a first to second person replacement</p>
<p class="description"><p>Replaces, for example, &quot;with you&quot; to &quot;with me&quot;. he gender related words and phrases that are used  can be found in subs.inc and originally in the startup.xml</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The string containing where the first-&gt;second related words have been replaced.</li>
				<li><span class="field">global:</span> array $firstsecondsearch: </li>
				<li><span class="field">global:</span> array $firstsecondreplace: </li>
				<li><span class="field">global:</span> array $aftersearch: </li>
				<li><span class="field">global:</span> array $afterreplace: </li>
				<li><span class="field">global:</span> integer $replacecounter: </li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			firstsecond
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$input</span><span class="var-description">: The string where the first-&gt;second related words/phrases need to be replaced</span>			</li>
				</ul>
		
	
</div>
<a name="functionfirstthird" id="functionfirstthird"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">firstthird</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a667">667</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Do a first to third person replacement</p>
<p class="description"><p>Replaces, for example, &quot;I was&quot; to &quot;he or she was&quot;. he gender related words and phrases that are used  can be found in subs.inc and originally in the startup.xml</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The string containing where the first-&gt;third related words have been replaced.</li>
				<li><span class="field">global:</span> array $firstthirdsearch: firstthirdsearch</li>
				<li><span class="field">global:</span> array $firstthirdreplace: firstthirdreplace</li>
				<li><span class="field">global:</span> array $aftersearch: </li>
				<li><span class="field">global:</span> array $afterreplace: </li>
				<li><span class="field">global:</span> array $contractsearch: </li>
				<li><span class="field">global:</span> array $contractreplace: </li>
				<li><span class="field">global:</span> integer $replacecounter: </li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			firstthird
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$input</span><span class="var-description">: The string where the first-&gt;third related words/phrases need to be replaced</span>			</li>
				</ul>
		
	
</div>
<a name="functiongender" id="functiongender"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">gender</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a633">633</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Reverse the gender of a phrase</p>
<p class="description"><p>Replaces, for example, 'he' in the string to 'she'. The gender related words and phrases that are used  can be found in subs.inc and originally in the startup.xml</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The string containing where the gender related words have been replaced.</li>
				<li><span class="field">global:</span> array $gendersearch: gendersearch</li>
				<li><span class="field">global:</span> array $genderreplace: genderreplace</li>
				<li><span class="field">global:</span> array $aftersearch: </li>
				<li><span class="field">global:</span> array $afterreplace: </li>
				<li><span class="field">global:</span> integer $replacecounter: </li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			gender
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$input</span><span class="var-description">: The string where the gender related words/phrases need to be replaced</span>			</li>
				</ul>
		
	
</div>
<a name="functionGetChildren" id="functionGetChildren"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">GetChildren</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a751">751</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get the child nodes of the XML tree</p>
<p class="description"><p>Retrieve the child nodes of the XML tree. This is a recursive function.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The child nodes in an array.</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_util_php.html#functionGetXMLTree">GetXMLTree()</a></li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_util_php.html#functionGetChildren">GetChildren()</a></li>
				<li><span class="field">uses:</span> <a href="../Interpreter/_util_php.html#functionGetChildren">GetChildren()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">array</span>
		<span class="method-name">
			GetChildren
		</span>
					(<span class="var-type">array</span>&nbsp;<span class="var-name">$vals</span>, <span class="var-type">integer</span>&nbsp;<span class="var-name">&$i</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$vals</span>			</li>
					<li>
				<span class="var-type">integer</span>
				<span class="var-name">&$i</span><span class="var-description">: call-by-reference variable for, most likely, GetXMLTree()</span>			</li>
				</ul>
		
	
</div>
<a name="functiongetfdate" id="functiongetfdate"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">getfdate</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a228">228</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">get the current date formatted.</p>
<p class="description"><p>Should look like: Wed Nov 14 18:09:55 CST 2002</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> formated date string, Day name, Month name, day number month, time, time zone and year.</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			getfdate
		</span>
				()
			</div>

		
	
</div>
<a name="functiongetid" id="functiongetid"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">getid</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a214">214</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get the ID, or IP of the user</p>
<p class="description"><p>Uses the server global REMOTE_ADDR.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> IP number</li>
				<li><span class="field">global:</span> REMOTE_ADDR 0: The user's remote address, i.e. LAN address.</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			getid
		</span>
				()
			</div>

		
	
</div>
<a name="functiongetinput" id="functiongetinput"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">getinput</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a537">537</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get the previous thing the client said</p>
<p class="description"><p>Retrieve the entire previous input of the user from the dstore table.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The previous input of the user.</li>
				<li><span class="field">global:</span> integer $uid: </li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			getinput
		</span>
					(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$index</span>)
			</div>

		
	
</div>
<a name="functiongetsize" id="functiongetsize"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">getsize</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a245">245</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Gets the numer of AIML categories stored in the database</p>
<p class="description"><p>The size of the AIML knowledgebase is counted in categories. This function  will count the number of categories based upon the number of records in the  templates table.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> the number of templates in the template database.</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
				<li><span class="field">uses:</span> <a href="../Interpreter/_util_php.html#functionwhichbots">whichbots()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">integer</span>
		<span class="method-name">
			getsize
		</span>
				()
			</div>

		
	
</div>
<a name="functiongetthat" id="functiongetthat"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">getthat</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a487">487</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get the previous thing the bot said</p>
<p class="description"><p>Retrieve from the thatindex table the previous output, per sentence, of what the bot said from the thatindex en thatstack table.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The requested sentence of the bot's output</li>
				<li><span class="field">global:</span> integer $uid: </li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			getthat
		</span>
					(<span class="var-type">integer</span>&nbsp;<span class="var-name">$index</span>, <span class="var-type">integer</span>&nbsp;<span class="var-name">$offset</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">integer</span>
				<span class="var-name">$index</span><span class="var-description">: Number between 1-5, 1 representing the previous bot output and 5 the 5th last bot output.</span>			</li>
					<li>
				<span class="var-type">integer</span>
				<span class="var-name">$offset</span><span class="var-description">: Bot output is saved per sentence. So 1 would be last sentence, 3 would be third last sentence of that bot output.</span>			</li>
				</ul>
		
	
</div>
<a name="functionGetXMLTree" id="functionGetXMLTree"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">GetXMLTree</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a797">797</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get an XML tree</p>
<p class="description"><p>Create an XML tree in array form from a large string.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> Multi dimensional array in an XML way containing XML data.</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionrespond">respond()</a></li>
				<li><span class="field">uses:</span> <a href="../Interpreter/_util_php.html#functionGetChildren">GetChildren()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">array</span>
		<span class="method-name">
			GetXMLTree
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$data</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$data</span><span class="var-description">: Large string that needs to be turned into XML data.</span>			</li>
				</ul>
		
	
</div>
<a name="functioninsertgossip" id="functioninsertgossip"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">insertgossip</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a726">726</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Insert gossip into the database</p>
<p class="description"><p>Gossip is an AIML tag where the user can store bits of information from one user and then  reuse is in the conversation of another user. It is the only tag that behaves this way. Stores  value into the gossip table of the database.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> Nothing.</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			insertgossip
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$gossip</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$gossip</span><span class="var-description">: The string that needs to be saved.</span>			</li>
				</ul>
		
	
</div>
<a name="functioniscustomtag" id="functioniscustomtag"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">iscustomtag</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a922">922</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Check to see if a tag is a custom tag.</p>
<p class="description"><p>Program E supports additional, non AIML 1.0x specified, custom tags. This function checks to see if  the encountered XML tag is indeed a custom AIML tag. If it is a custom tag, it will then the  appropriate function to use in &amp;$functicall.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> true/false</li>
				<li><span class="field">global:</span> array $cttags: cttags            contains all the custom tags. Array is created by loadcustomtags()</li>
				<li><span class="field">see:</span> <a href="../Interpreter/_util_php.html#functionloadcustomtags">loadcustomtags()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">boolean</span>
		<span class="method-name">
			iscustomtag
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$tagname</span>, <span class="var-type">&$functocall</span>&nbsp;<span class="var-name">&$functocall</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$tagname</span><span class="var-description">: name of the tag to be checked</span>			</li>
					<li>
				<span class="var-type">&$functocall</span>
				<span class="var-name">&$functocall</span><span class="var-description">: call-by-reference variable used to send back the function name that                                  needs to be called to process the tag's contents.</span>			</li>
				</ul>
		
	
</div>
<a name="functionisdeprecated" id="functionisdeprecated"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">isdeprecated</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a143">143</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Check if a tag is an old style AIML tag.</p>
<p class="description"><p>If it is then return its new name and the fact that it is deprecated. This  information is not send back through the return value, but by using call-by-reference  variable &amp;$ttag.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> true/false; either it is a depreciated AIML tag or it is not.</li>
			</ul>
	<div class="method-signature">
		<span class="method-result">boolean</span>
		<span class="method-name">
			isdeprecated
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$tag</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">&$ttag</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$tag</span><span class="var-description">: the tag name that needs to be checked</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">&$ttag</span><span class="var-description">: depreciated AIML tag name. Note, call-by-reference variable.</span>			</li>
				</ul>
		
	
</div>
<a name="functionloadcustomtags" id="functionloadcustomtags"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">loadcustomtags</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a945">945</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Load all custom tags</p>
<p class="description"><p>Create a global accessible array with all custom tags, based upon the custom tag functions (ct_FunctionName()).</p></p>
	<ul class="tags">
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
				<li><span class="field">see:</span> <a href="../Interpreter/_plugins_customtags_php.html">customtags.php</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			loadcustomtags
		</span>
				()
			</div>

		
	
</div>
<a name="functionlogconversation" id="functionlogconversation"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">logconversation</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a461">461</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Logs the whole input and response</p>
<p class="description"><p>Saves the input and response into the conversationlog table of the database.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> nothing</li>
				<li><span class="field">global:</span> integer $uid: </li>
				<li><span class="field">global:</span> integer $selectbot: </li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			logconversation
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">$response</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$reponse</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$input</span><span class="var-description">: The user's input.</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$reponse</span><span class="var-description">: The bot's response to the user's input.</span>			</li>
				</ul>
		
	
</div>
<a name="functionlookupbotid" id="functionlookupbotid"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">lookupbotid</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a972">972</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Look up the bot's ID number</p>
<p class="description"><p>From the bot's name, retrieve it's bot ID number from the bots table in the database. This  funtion requires that each bot has a uniqe name to function.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The bot ID that belongs to the unique botname.</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreplybotname">replybotname()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">integer</span>
		<span class="method-name">
			lookupbotid
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$botname</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$botname</span><span class="var-description">: The bot's name.</span>			</li>
				</ul>
		
	
</div>
<a name="functionmake_seed" id="functionmake_seed"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">make_seed</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a72">72</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Create a random number based upon the present time.</p>
	<ul class="tags">
				<li><span class="field">return:</span> A fully random generated floating point number.</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_util_php.html#functioncleanup">cleanup()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">float</span>
		<span class="method-name">
			make_seed
		</span>
				()
			</div>

		
	
</div>
<a name="functionmyfunc" id="functionmyfunc"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">myfunc</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a194">194</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Substitution routine</p>
<p class="description"><p>Is used in combination with for example <a href="../Interpreter/_util_php.html#functionfirstthird">firstthird()</a> <a href="../Interpreter/_util_php.html#functiongender">gender()</a>. The myfunc() is called from these functions from the arrays generated in subs.inc by <a href="../Loader/_admin_botloaderfuncs_php.html#functionmakesrphp">makesrphp()</a>.</p><p>When doing substitution myfunc replaces the words to be substituted with ~~x~~  where x is an incremented integer instead of what should eventually be substituted.  Then when all substitution is done another function will go through and replace the  ~~x~~ with the real value.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The user's input, with ~~number~~ where the words in the substitution list                          should be.</li>
				<li><span class="field">global:</span> integer $replacecounter: replacecounter  The incremented integer number for substitution.</li>
				<li><span class="field">global:</span> array $aftersearch: aftersearch       Contains ~~replacecounter number~~</li>
				<li><span class="field">global:</span> array $afterreplace: afterreplace      Countains the input. (Anne:Have no idea how this works, yet.)</li>
				<li><span class="field">todo:</span> Analyse if a straight replace will be more effective and efficient. Hard to see why this two-stage replace has any advantages. If not, then rename the function.</li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			myfunc
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$input</span><span class="var-description">: The new word replacing the old word.</span>			</li>
				</ul>
		
	
</div>
<a name="functionnormalsentences" id="functionnormalsentences"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">normalsentences</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a582">582</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Take the user input and do all substitutions and split it into sentences</p>
<p class="description"><p>The matching process searches a match for every sentence and in the end combines all  those individual matches into one reply. This funtion splits the sentences of the user's  input, replaces the words that need to be subtituted (found in startup.xml).</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> each individual sentence, ready for matching.</li>
				<li><span class="field">global:</span> array $contractsearch: contractsearch</li>
				<li><span class="field">global:</span> array $contractreplace: contractreplace</li>
				<li><span class="field">global:</span> mixed $abbrevsearch: abbrevsearch             not used in this function</li>
				<li><span class="field">global:</span> mixed $abbrevreplace: removepunct              used in this function, but code is commented out.</li>
				<li><span class="field">global:</span> array $removepunct: likeperiodsearch</li>
				<li><span class="field">global:</span> array $likeperiodsearch: likeperiodreplace</li>
				<li><span class="field">global:</span> array $likeperiodreplace: aftersearch</li>
				<li><span class="field">global:</span> array $aftersearch: afterreplace</li>
				<li><span class="field">global:</span> integer $afterreplace: replacecounter</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">array</span>
		<span class="method-name">
			normalsentences
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$input</span><span class="var-description">: The unchanged user input.</span>			</li>
				</ul>
		
	
</div>
<a name="functionss_timing_current" id="functionss_timing_current"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">ss_timing_current</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a864">864</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Retrieve timer data</p>
<p class="description"><p>Get the running time the timed script</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> the formated running time of the timed stript.</li>
				<li><span class="field">global:</span> array $ss_timing_start_times: ss_timing_start_times          contains the start and finish moments of the script</li>
				<li><span class="field">global:</span> array $ss_timing_stop_times: ss_timing_stop_times          contains the stop moments of a script</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			ss_timing_current
		</span>
					([<span class="var-type">string</span>&nbsp;<span class="var-name">$name</span> = <span class="var-default">'default'</span>])
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$name</span><span class="var-description">: default value is 'default' Makes it possibe to time more than                                               event in one script.</span>			</li>
				</ul>
		
	
</div>
<a name="functionss_timing_start" id="functionss_timing_start"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">ss_timing_start</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a829">829</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Start a timer</p>
<p class="description"><p>Save the start time of the to be timed script</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> nothing</li>
				<li><span class="field">global:</span> array $ss_timing_start_times: ss_timing_start_times          contains the start moments of the script</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			ss_timing_start
		</span>
					([<span class="var-type">string</span>&nbsp;<span class="var-name">$name</span> = <span class="var-default">'default'</span>])
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$name</span><span class="var-description">: default value is 'default' Makes it possibe to time more than                                               event in one script.</span>			</li>
				</ul>
		
	
</div>
<a name="functionss_timing_stop" id="functionss_timing_stop"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">ss_timing_stop</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a846">846</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Stop a timer</p>
<p class="description"><p>Save the stop time of the to be timed script</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> nothing</li>
				<li><span class="field">global:</span> array $ss_timing_stop_times: ss_timing_stop_times          contains the stop moments of a script</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionreply">reply()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			ss_timing_stop
		</span>
					([<span class="var-type">string</span>&nbsp;<span class="var-name">$name</span> = <span class="var-default">'default'</span>])
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$name</span><span class="var-description">: default value is 'default' Makes it possibe to time more than                                               event in one script.</span>			</li>
				</ul>
		
	
</div>
<a name="functionupperkeysarray" id="functionupperkeysarray"><!-- --></a>
<div class="oddrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">upperkeysarray</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a891">891</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Change the case of the keys of an array to all uppercase</p>
<p class="description"><p>Array keys can be number or strings. If strings then it's a good habit to use only uppercase.  This is sadly not always the case. This function makes sure that they are.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> Array containing only uppercase array keys.</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">array</span>
		<span class="method-name">
			upperkeysarray
		</span>
					(<span class="var-type">array</span>&nbsp;<span class="var-name">$testa</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$testa</span><span class="var-description">: Array suspected of having mixed case array keys.</span>			</li>
				</ul>
		
	
</div>
<a name="functionwhichbots" id="functionwhichbots"><!-- --></a>
<div class="evenrow">
	
	<div>
		<img src="../media/images/Function.png" />
		<span class="method-title">whichbots</span> (line <span class="line-number"><a href="..//__filesource/fsource_Interpreter__util.php.html#a996">996</a></span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Which bot is selected</p>
<p class="description"><p>Returns the bit of SQL query that limits the results to the selected bot.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The bit of SQL query that limits the results to the selected bot.</li>
				<li><span class="field">global:</span> string $selectbot: selectbot              The currently selected bot. The bot the user is chatting to.</li>
				<li><span class="field">usedby:</span> <a href="../Interpreter/_util_php.html#functiongetsize">getsize()</a></li>
			</ul>
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			whichbots
		</span>
				()
			</div>

		
	
</div>
		</div>
	</div>
	
	<p class="notes" id="credit">
		Documentation generated on Wed, 12 Jan 2005 12:24:49 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.0RC3</a>
	</p>
	</div></body>
</html>
Return current item: Program E