/trunk/doc/ApiGen/class-Cli.html |
---|
New file |
0,0 → 1,230 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Cli | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li class="active"><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Cli</h1> |
<div class="description"> |
<p>CLI permet de récupérer les paramètres passés en ligne de commande pour |
instancier une classe héritant de la classe abstraite Script. Elle va |
déclencher l'éxecution du script via l'appel de la méthode executer(). C'est |
une Singleton.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Author:</b> |
Delphine CAUQUIL <<a |
href="mailto:delphine@tela-botanica.org">delphine@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Cli.php 387 2011-10-28 15:57:40Z jpm $<br> |
<b>Since:</b> |
0.3<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Cli.html#4-107" title="Go to source code">framework/Cli.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="executer" id="_executer"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_executer">#</a> |
<code><a href="source-class-Cli.html#27-57" title="Go to source code">executer</a>( )</code> |
<div class="description short"> |
<p>Execute la ligne de commande en récupérant le nom du script à lancer et |
ses paramètres. Instancie la classe du script à lancer et appelle la méthode |
executer().</p> |
</div> |
<div class="description detailed hidden"> |
<p>Execute la ligne de commande en récupérant le nom du script à lancer et |
ses paramètres. Instancie la classe du script à lancer et appelle la méthode |
executer().</p> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-MonService.html |
---|
New file |
0,0 → 1,128 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File exemples/services/modules/0.1/MonService.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li class="active"><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-MonService.html" title="Summary of MonService"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1">1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2">2: </a><span class="php-keyword1">class</span> <a id="MonService" href="#MonService">MonService</a> <span class="php-keyword1">extends</span> RestService { |
</span><span id="3" class="l"><a class="l" href="#3">3: </a> |
</span><span id="4" class="l"><a class="l" href="#4">4: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_consulter" href="#_consulter">consulter</a>(<span class="php-var">$ressources</span>, <span class="php-var">$parametres</span>) { |
</span><span id="5" class="l"><a class="l" href="#5">5: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"ok"</span>; |
</span><span id="6" class="l"><a class="l" href="#6">6: </a> } |
</span><span id="7" class="l"><a class="l" href="#7">7: </a>} |
</span><span id="8" class="l"><a class="l" href="#8">8: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-MonService.html |
---|
New file |
0,0 → 1,280 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class MonService | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li class="active"><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class MonService</h1> |
<div class="description"> |
<p>Classe principale gérant les services. Paramètres liés dans config.ini : - |
serveur.baseURL</p> |
<p>Encodage en entrée : utf8 Encodage en sortie : utf8</p> |
</div> |
<dl class="tree"> |
<dd style="padding-left:0px"> |
<a href="class-RestService.html"><span>RestService</span></a> |
</dd> |
<dd style="padding-left:30px"> |
<img src="resources/inherit.png" alt="Extended by"> |
<b><span>MonService</span></b> |
</dd> |
</dl> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
Php 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="GPL">v3 <http://www.gnu.org/licenses/gpl.txt></a><br> |
<b>License:</b> |
<a href="CECILL">v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt></a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: RestService.php 417 2012-05-15 09:24:12Z jpm $<br> |
<b>Since:</b> |
0.3<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-MonService.html#2-7" title="Go to source code">exemples/services/modules/0.1/MonService.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="consulter" id="_consulter"> |
<td class="attributes"><code> |
public |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_consulter">#</a> |
<code><a href="source-class-MonService.html#4-6" title="Go to source code">consulter</a>( <span>array <var>$ressources</var></span>, <span>array <var>$parametres</var></span> )</code> |
<div class="description short"> |
<p>Méthode appelée lors d'une requête HTTP de type GET.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode appelée lors d'une requête HTTP de type GET.</p> |
<p>Si la consultation est un succès, le code statut HTTP retourné sera 200. |
Dans tous les autres cas, la méthode devra retourner le code statut HTTP |
adéquate.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$ressources</var></dt> |
<dd><code>array</code><br>Morceaux de l'url servant à préciser la ressource concerné pour le service |
demandé.</dd> |
<dt><var>$parametres</var></dt> |
<dd><code>array</code><br>Partie de l'url situé après le '?' servant à paramétrer le service demandé.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>une chaine indiquant le succès de l'opération et les données demandées.<br> |
</div> |
<h4>Overrides</h4> |
<div class="list"><code><a href="class-RestService.html#_consulter">RestService::consulter()</a></code></div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary inherited"> |
<caption>Methods inherited from <a href="class-RestService.html#methods">RestService</a></caption> |
<tr> |
<td><code> |
<a href="class-RestService.html#___construct">__construct()</a>, |
<a href="class-RestService.html#_ajouter">ajouter()</a>, |
<a href="class-RestService.html#_ajouterMessage">ajouterMessage()</a>, |
<a href="class-RestService.html#_getBdd">getBdd()</a>, |
<a href="class-RestService.html#_getRestClient">getRestClient()</a>, |
<a href="class-RestService.html#_initialiser">initialiser()</a>, |
<a href="class-RestService.html#_modifier">modifier()</a>, |
<a href="class-RestService.html#_supprimer">supprimer()</a>, |
<a href="class-RestService.html#_utiliserParametresBruts">utiliserParametresBruts()</a> |
</code></td> |
</tr> |
</table> |
<table class="summary inherited"> |
<caption>Properties inherited from <a href="class-RestService.html#properties">RestService</a></caption> |
<tr> |
<td><code> |
<a href="class-RestService.html#$bdd"><var><span class="deprecated">$bdd</span></var></a>, |
<a href="class-RestService.html#$utilisationParametresBruts"><var>$utilisationParametresBruts</var></a> |
</code></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-ServiceCacheFichier.html |
---|
New file |
0,0 → 1,219 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File exemples/services/modules/0.1/ServiceCacheFichier.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li class="active"><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-ServiceCacheFichier.html" title="Summary of ServiceCacheFichier"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-keyword1">class</span> <a id="ServiceCacheFichier" href="#ServiceCacheFichier">ServiceCacheFichier</a> <span class="php-keyword1">extends</span> RestService { |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a> |
</span><span id="4" class="l"><a class="l" href="#4"> 4: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_consulter" href="#_consulter">consulter</a>(<span class="php-var">$ressources</span>, <span class="php-var">$parametres</span>) { |
</span><span id="5" class="l"><a class="l" href="#5"> 5: </a> <span class="php-comment">// Redéfinition ici mais peut être configuré depuis le fichier config.ini</span> |
</span><span id="6" class="l"><a class="l" href="#6"> 6: </a> <span class="php-var">$options</span> = <span class="php-keyword1">array</span>( |
</span><span id="7" class="l"><a class="l" href="#7"> 7: </a> <span class="php-quote">'stockage_mode'</span> => Cache::STOCKAGE_MODE_FICHIER, |
</span><span id="8" class="l"><a class="l" href="#8"> 8: </a> <span class="php-quote">'stockage_chemin'</span> => Fichier::getDossierTmp(), |
</span><span id="9" class="l"><a class="l" href="#9"> 9: </a> <span class="php-quote">'controle_ecriture'</span> => <span class="php-keyword1">false</span>, |
</span><span id="10" class="l"><a class="l" href="#10">10: </a> <span class="php-quote">'mise_en_cache'</span> => <span class="php-keyword1">true</span>, |
</span><span id="11" class="l"><a class="l" href="#11">11: </a> <span class="php-quote">'cache_id_prefixe'</span> => <span class="php-keyword1">null</span>, |
</span><span id="12" class="l"><a class="l" href="#12">12: </a> <span class="php-quote">'serialisation_auto'</span> => <span class="php-keyword1">false</span>, |
</span><span id="13" class="l"><a class="l" href="#13">13: </a> <span class="php-quote">'nettoyage_auto'</span> => <span class="php-num">10</span>, |
</span><span id="14" class="l"><a class="l" href="#14">14: </a> <span class="php-quote">'duree_de_vie'</span> => <span class="php-num">3600</span>, |
</span><span id="15" class="l"><a class="l" href="#15">15: </a> ); |
</span><span id="16" class="l"><a class="l" href="#16">16: </a> <span class="php-comment">// Redéfinition ici mais peut être configuré depuis le fichier config.ini</span> |
</span><span id="17" class="l"><a class="l" href="#17">17: </a> <span class="php-var">$options_stockage</span> = <span class="php-keyword1">array</span>( |
</span><span id="18" class="l"><a class="l" href="#18">18: </a> <span class="php-quote">'fichier_verrou'</span> => <span class="php-keyword1">false</span>, |
</span><span id="19" class="l"><a class="l" href="#19">19: </a> <span class="php-quote">'controle_lecture'</span> => <span class="php-keyword1">false</span>, |
</span><span id="20" class="l"><a class="l" href="#20">20: </a> <span class="php-quote">'controle_lecture_type'</span> => <span class="php-quote">'crc32'</span>, |
</span><span id="21" class="l"><a class="l" href="#21">21: </a> <span class="php-quote">'dossier_niveau'</span> => <span class="php-num">2</span>, |
</span><span id="22" class="l"><a class="l" href="#22">22: </a> <span class="php-quote">'dossier_umask'</span> => <span class="php-num">0707</span>, |
</span><span id="23" class="l"><a class="l" href="#23">23: </a> <span class="php-quote">'fichier_prefixe'</span> => <span class="php-quote">'tbf'</span>, |
</span><span id="24" class="l"><a class="l" href="#24">24: </a> <span class="php-quote">'fichier_umask'</span> => <span class="php-num">0606</span>, |
</span><span id="25" class="l"><a class="l" href="#25">25: </a> <span class="php-quote">'metadonnees_max_taille'</span> => <span class="php-num">100</span> |
</span><span id="26" class="l"><a class="l" href="#26">26: </a> ); |
</span><span id="27" class="l"><a class="l" href="#27">27: </a> <span class="php-var">$cache</span> = <span class="php-keyword1">new</span> Cache(<span class="php-var">$options</span>, <span class="php-var">$options_stockage</span>); |
</span><span id="28" class="l"><a class="l" href="#28">28: </a> |
</span><span id="29" class="l"><a class="l" href="#29">29: </a> <span class="php-var">$id</span> = <span class="php-quote">'monCache'</span>; <span class="php-comment">// id de cache de "ce que l'on veut cacher"</span> |
</span><span id="30" class="l"><a class="l" href="#30">30: </a> <span class="php-var">$id01</span> = <span class="php-var">$id</span>.<span class="php-quote">'01'</span>; |
</span><span id="31" class="l"><a class="l" href="#31">31: </a> <span class="php-var">$id02</span> = <span class="php-var">$id</span>.<span class="php-quote">'02'</span>; |
</span><span id="32" class="l"><a class="l" href="#32">32: </a> <span class="php-var">$id03</span> = <span class="php-var">$id</span>.<span class="php-quote">'03'</span>; |
</span><span id="33" class="l"><a class="l" href="#33">33: </a> <span class="php-keyword1">if</span> (!(<span class="php-var">$donnees</span> = <span class="php-var">$cache</span>->charger(<span class="php-var">$id01</span>))) { |
</span><span id="34" class="l"><a class="l" href="#34">34: </a> <span class="php-var">$donnees</span> = <span class="php-quote">'Mise en cache à : '</span>.<span class="php-keyword2">strftime</span>(<span class="php-quote">'%A %d %B %Y à %H:%M:%S'</span>, <span class="php-keyword2">time</span>()).<span class="php-quote">'<br/>'</span>; |
</span><span id="35" class="l"><a class="l" href="#35">35: </a> <span class="php-keyword1">for</span> (<span class="php-var">$i</span> = <span class="php-num">0</span>; <span class="php-var">$i</span> < <span class="php-num">100000</span>; <span class="php-var">$i</span>++) { |
</span><span id="36" class="l"><a class="l" href="#36">36: </a> <span class="php-var">$donnees</span> .= <span class="php-var">$i</span>; |
</span><span id="37" class="l"><a class="l" href="#37">37: </a> } |
</span><span id="38" class="l"><a class="l" href="#38">38: </a> <span class="php-var">$cache</span>->sauver(<span class="php-var">$donnees</span>, <span class="php-var">$id01</span>); |
</span><span id="39" class="l"><a class="l" href="#39">39: </a> <span class="php-var">$cache</span>->sauver(<span class="php-var">$donnees</span>, <span class="php-var">$id02</span>, <span class="php-keyword1">array</span>(<span class="php-quote">'tagTest01'</span>)); |
</span><span id="40" class="l"><a class="l" href="#40">40: </a> <span class="php-var">$cache</span>->sauver(<span class="php-var">$donnees</span>, <span class="php-var">$id03</span>, <span class="php-keyword1">array</span>(<span class="php-quote">'tagTest01'</span>,<span class="php-quote">'tagTest02'</span>, <span class="php-quote">'tagTest03'</span>)); |
</span><span id="41" class="l"><a class="l" href="#41">41: </a> } |
</span><span id="42" class="l"><a class="l" href="#42">42: </a> <span class="php-comment">// Affichage des données</span> |
</span><span id="43" class="l"><a class="l" href="#43">43: </a> <span class="php-keyword1">echo</span> <span class="php-var">$donnees</span>.<span class="php-quote">'<br/>'</span>; |
</span><span id="44" class="l"><a class="l" href="#44">44: </a> |
</span><span id="45" class="l"><a class="l" href="#45">45: </a> <span class="php-comment">// Affichage des ids du cache</span> |
</span><span id="46" class="l"><a class="l" href="#46">46: </a> <span class="php-keyword1">echo</span> <span class="php-quote">'Ids des enregistrements en cache : <pre>'</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$cache</span>->getIds(), <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="47" class="l"><a class="l" href="#47">47: </a> |
</span><span id="48" class="l"><a class="l" href="#48">48: </a> <span class="php-comment">// Affichage des ids du cache</span> |
</span><span id="49" class="l"><a class="l" href="#49">49: </a> <span class="php-keyword1">echo</span> <span class="php-quote">'Tags des enregistrements en cache : <pre>'</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$cache</span>->getTags(), <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="50" class="l"><a class="l" href="#50">50: </a> |
</span><span id="51" class="l"><a class="l" href="#51">51: </a> <span class="php-comment">// Affichage des ids du cache pour un tag donnée</span> |
</span><span id="52" class="l"><a class="l" href="#52">52: </a> <span class="php-var">$tag01</span> = <span class="php-quote">'tagTest01'</span>; |
</span><span id="53" class="l"><a class="l" href="#53">53: </a> <span class="php-var">$tag02</span> = <span class="php-quote">'tagTest02'</span>; |
</span><span id="54" class="l"><a class="l" href="#54">54: </a> <span class="php-var">$tag03</span> = <span class="php-quote">'tagTest03'</span>; |
</span><span id="55" class="l"><a class="l" href="#55">55: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Ids avec les tag '</span><span class="php-var">$tag02</span><span class="php-quote">, </span><span class="php-var">$tag03</span><span class="php-quote">' : "</span>.<span class="php-quote">'<pre>'</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$cache</span>->getIdsAvecLesTags(<span class="php-keyword1">array</span>(<span class="php-var">$tag02</span>, <span class="php-var">$tag03</span>)), <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="56" class="l"><a class="l" href="#56">56: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Ids possédant le tag '</span><span class="php-var">$tag01</span><span class="php-quote">' : "</span>.<span class="php-quote">'<pre>'</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$cache</span>->getIdsAvecUnTag(<span class="php-keyword1">array</span>(<span class="php-var">$tag01</span>)), <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="57" class="l"><a class="l" href="#57">57: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Ids sans les tag '</span><span class="php-var">$tag01</span><span class="php-quote">, </span><span class="php-var">$tag02</span><span class="php-quote">' : "</span>.<span class="php-quote">'<pre>'</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$cache</span>->getIdsSansLesTags(<span class="php-keyword1">array</span>(<span class="php-var">$tag01</span>, <span class="php-var">$tag02</span>)), <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="58" class="l"><a class="l" href="#58">58: </a> |
</span><span id="59" class="l"><a class="l" href="#59">59: </a> <span class="php-comment">// Test du test de l'existence du cache</span> |
</span><span id="60" class="l"><a class="l" href="#60">60: </a> <span class="php-var">$id_test</span> = <span class="php-var">$id01</span>; |
</span><span id="61" class="l"><a class="l" href="#61">61: </a> <span class="php-keyword1">echo</span> (<span class="php-var">$cache</span>->tester(<span class="php-var">$id_test</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id_test</span><span class="php-quote">' existe"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id_test</span><span class="php-quote">' devrait exister"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="62" class="l"><a class="l" href="#62">62: </a> |
</span><span id="63" class="l"><a class="l" href="#63">63: </a> <span class="php-comment">// Affichage du pourcentage de remplissage</span> |
</span><span id="64" class="l"><a class="l" href="#64">64: </a> <span class="php-keyword1">echo</span> <span class="php-quote">'Pourcentage de remplissage : '</span>.<span class="php-var">$cache</span>->getPourcentageRemplissage().<span class="php-quote">'%<br/>'</span>; |
</span><span id="65" class="l"><a class="l" href="#65">65: </a> |
</span><span id="66" class="l"><a class="l" href="#66">66: </a> <span class="php-comment">// Affichage des métadonnées</span> |
</span><span id="67" class="l"><a class="l" href="#67">67: </a> <span class="php-var">$meta03</span> = <span class="php-var">$cache</span>->getMetadonnees(<span class="php-var">$id03</span>); |
</span><span id="68" class="l"><a class="l" href="#68">68: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Métadonnées du cache '</span><span class="php-var">$id03</span><span class="php-quote">' : <pre>"</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$meta03</span>, <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="69" class="l"><a class="l" href="#69">69: </a> <span class="php-var">$meta01</span> = <span class="php-var">$cache</span>->getMetadonnees(<span class="php-var">$id_test</span>); |
</span><span id="70" class="l"><a class="l" href="#70">70: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Métadonnées du cache '</span><span class="php-var">$id_test</span><span class="php-quote">' : <pre>"</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$meta01</span>, <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="71" class="l"><a class="l" href="#71">71: </a> |
</span><span id="72" class="l"><a class="l" href="#72">72: </a> <span class="php-comment">// Nettoyage & suppression</span> |
</span><span id="73" class="l"><a class="l" href="#73">73: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Temps avant suppression du cache : "</span>.(<span class="php-keyword2">time</span>() - <span class="php-var">$meta01</span>[<span class="php-quote">'expiration'</span>]).<span class="php-quote">'s<br/>'</span>; |
</span><span id="74" class="l"><a class="l" href="#74">74: </a> <span class="php-keyword1">if</span> ((<span class="php-keyword2">time</span>() - <span class="php-var">$meta01</span>[<span class="php-quote">'expiration'</span>]) >= -<span class="php-num">30</span>) { |
</span><span id="75" class="l"><a class="l" href="#75">75: </a> <span class="php-comment">// Suppressions</span> |
</span><span id="76" class="l"><a class="l" href="#76">76: </a> <span class="php-var">$cache</span>->supprimer(<span class="php-var">$id_test</span>); |
</span><span id="77" class="l"><a class="l" href="#77">77: </a> <span class="php-keyword1">echo</span> (!<span class="php-var">$cache</span>->tester(<span class="php-var">$id_test</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id_test</span><span class="php-quote">' a bien été supprimé"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id_test</span><span class="php-quote">' n'a pas été supprimé"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="78" class="l"><a class="l" href="#78">78: </a> |
</span><span id="79" class="l"><a class="l" href="#79">79: </a> <span class="php-comment">// Nettoyage</span> |
</span><span id="80" class="l"><a class="l" href="#80">80: </a> <span class="php-var">$cache</span>->nettoyer(Cache::NETTOYAGE_MODE_AVEC_LES_TAGS, <span class="php-keyword1">array</span>(<span class="php-var">$tag02</span>, <span class="php-var">$tag03</span>)); |
</span><span id="81" class="l"><a class="l" href="#81">81: </a> <span class="php-keyword1">echo</span> (!<span class="php-var">$cache</span>->tester(<span class="php-var">$id03</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id03</span><span class="php-quote">' a bien été supprimé"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id03</span><span class="php-quote">' n'a pas été supprimé"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="82" class="l"><a class="l" href="#82">82: </a> <span class="php-var">$cache</span>->nettoyer(Cache::NETTOYAGE_MODE_SANS_LES_TAGS, <span class="php-keyword1">array</span>(<span class="php-var">$tag01</span>)); |
</span><span id="83" class="l"><a class="l" href="#83">83: </a> <span class="php-keyword1">echo</span> (<span class="php-var">$cache</span>->tester(<span class="php-var">$id02</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' n'a pas été supprimé"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' a été supprimé"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="84" class="l"><a class="l" href="#84">84: </a> <span class="php-var">$cache</span>->nettoyer(Cache::NETTOYAGE_MODE_EXPIRATION); |
</span><span id="85" class="l"><a class="l" href="#85">85: </a> <span class="php-keyword1">echo</span> (<span class="php-var">$cache</span>->tester(<span class="php-var">$id02</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' n'a pas été supprimé"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' a été supprimé"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="86" class="l"><a class="l" href="#86">86: </a> <span class="php-var">$cache</span>->nettoyer(Cache::NETTOYAGE_MODE_TOUS); |
</span><span id="87" class="l"><a class="l" href="#87">87: </a> <span class="php-keyword1">echo</span> (!<span class="php-var">$cache</span>->tester(<span class="php-var">$id01</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' a été supprimé"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' n'a pas été supprimé"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="88" class="l"><a class="l" href="#88">88: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> ((<span class="php-keyword2">time</span>() - <span class="php-var">$meta01</span>[<span class="php-quote">'expiration'</span>]) < -<span class="php-num">60</span>) { |
</span><span id="89" class="l"><a class="l" href="#89">89: </a> <span class="php-comment">// Test ajout d'une durée de vie supplémentaire</span> |
</span><span id="90" class="l"><a class="l" href="#90">90: </a> <span class="php-var">$meta01</span> = <span class="php-var">$cache</span>->getMetadonnees(<span class="php-var">$id_test</span>); |
</span><span id="91" class="l"><a class="l" href="#91">91: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Durée de vie du cache '</span><span class="php-var">$id_test</span><span class="php-quote">' : "</span>.<span class="php-var">$meta01</span>[<span class="php-quote">'expiration'</span>].<span class="php-quote">'<br/>'</span>; |
</span><span id="92" class="l"><a class="l" href="#92">92: </a> <span class="php-var">$cache</span>->ajouterSupplementDureeDeVie(<span class="php-var">$id_test</span>, -<span class="php-num">3540</span>); |
</span><span id="93" class="l"><a class="l" href="#93">93: </a> <span class="php-var">$meta02</span> = <span class="php-var">$cache</span>->getMetadonnees(<span class="php-var">$id_test</span>); |
</span><span id="94" class="l"><a class="l" href="#94">94: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Durée de vie du cache '</span><span class="php-var">$id_test</span><span class="php-quote">' après ajout supplément de -3540s : "</span>.<span class="php-var">$meta02</span>[<span class="php-quote">'expiration'</span>]. |
</span><span id="95" class="l"><a class="l" href="#95">95: </a> <span class="php-quote">' - diff. : '</span>.(<span class="php-var">$meta02</span>[<span class="php-quote">'expiration'</span>] - <span class="php-var">$meta01</span>[<span class="php-quote">'expiration'</span>]).<span class="php-quote">'<br/>'</span>; |
</span><span id="96" class="l"><a class="l" href="#96">96: </a> } |
</span><span id="97" class="l"><a class="l" href="#97">97: </a> } |
</span><span id="98" class="l"><a class="l" href="#98">98: </a>} |
</span><span id="99" class="l"><a class="l" href="#99">99: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-I18n.html |
---|
New file |
0,0 → 1,355 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/I18n.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li class="active"><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-I18n.html" title="Summary of I18n"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * I18n permet de traduire une application à partir de données stockées dans des fichiers ini. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * Si vous souhaitez utiliser le fonctionnement par défaut vous devrez : |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * - déposer les fichiers ini dans le dossier définit par la variable de config "chemin_i18n". |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * - nommer les fichiers selon la forme "locale.ini" (Ex.: fr.ini ou fr_CH.ini ). |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * Elle offre l'accès en lecture seule aux paramètres des fichiers ini. |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * C'est une Singleton. Une seule classe de traduction peut être instanciée par Application. |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @package Framework |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
</span></span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-comment"> * @version $Id: I18n.php 331 2011-02-24 18:03:35Z jpm $ |
</span></span><span id="20" class="l"><a class="l" href="#20"> 20: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="21" class="l"><a class="l" href="#21"> 21: </a><span class="php-comment"> */</span> |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a><span class="php-keyword1">class</span> <a id="I18n" href="#I18n">I18n</a> { |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> <span class="php-comment">/** Format de traduction utilisant les fichier .ini */</span> |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> <span class="php-keyword1">const</span> <a id="FORMAT_INI" href="#FORMAT_INI">FORMAT_INI</a> = <span class="php-quote">'.ini'</span>; |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> <span class="php-comment">/** Instance de la classe pointant sur elle même (pour le pattern singleton) */</span> |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$instance" href="#$instance">$instance</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> <span class="php-comment">/** Fichiers de traduction disponibles. */</span> |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$traductions" href="#$traductions">$traductions</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> <span class="php-comment">/** Langue courrante utilisée par l'application. */</span> |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$langue" href="#$langue">$langue</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-comment">/** Tableau des noms des paramètres à définir dans le fichier de config car obligatoirement nécessaire à cette classe.*/</span> |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$parametres_obligatoires" href="#$parametres_obligatoires">$parametres_obligatoires</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'chemin_i18n'</span>, <span class="php-quote">'i18n_url_parametre'</span>, <span class="php-quote">'i18n_langue_defaut'</span>, <span class="php-quote">'debogage'</span>); |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>() { |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> Config::verifierPresenceParametres(self::<span class="php-var">$parametres_obligatoires</span>); |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> self::trouverLangue(); |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> } |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> <span class="php-comment">/** |
</span></span><span id="44" class="l"><a class="l" href="#44"> 44: </a><span class="php-comment"> * Accesseur pour la valeur d'une traduction |
</span></span><span id="45" class="l"><a class="l" href="#45"> 45: </a><span class="php-comment"> * @param string $param le nom du paramètre |
</span></span><span id="46" class="l"><a class="l" href="#46"> 46: </a><span class="php-comment"> * @return string la valeur du paramètre |
</span></span><span id="47" class="l"><a class="l" href="#47"> 47: </a><span class="php-comment"> */</span> |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_get" href="#_get">get</a>(<span class="php-var">$identifiant</span>, <span class="php-var">$langue</span> = <span class="php-keyword1">null</span>) { |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> self::verifierCreationInstance(); |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> <span class="php-var">$texte</span> = <span class="php-quote">''</span>; |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> <span class="php-comment">// Récupération de la langue actuellement demandée</span> |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> <span class="php-var">$langue_a_charger</span> = self::<span class="php-var">$langue</span>; |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_null</span>(<span class="php-var">$langue</span>)) { |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> <span class="php-var">$langue_a_charger</span> = <span class="php-var">$langue</span>; |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> } |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(self::<span class="php-var">$traductions</span>[<span class="php-var">$langue_a_charger</span>])) { |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-comment">// Tentative de chargement du fichier de traduction</span> |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> <span class="php-var">$chargement</span> = self::charger(<span class="php-var">$langue_a_charger</span>); |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> <span class="php-keyword1">if</span> (<span class="php-var">$chargement</span> === <span class="php-keyword1">false</span>) { |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> <span class="php-var">$m</span> = <span class="php-quote">"Le fichier d'i18n pour la langue '</span><span class="php-var">$langue_a_charger</span><span class="php-quote">' demandée n'a pas été trouvé."</span>; |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> self::ajouterErreur(<span class="php-var">$m</span>); |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> } |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> } |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> <span class="php-comment">// Recherche de la langue dans le tableau des traductions</span> |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(self::<span class="php-var">$traductions</span>[<span class="php-var">$langue_a_charger</span>]) && self::<span class="php-var">$traductions</span>[<span class="php-var">$langue_a_charger</span>] !== <span class="php-keyword1">false</span>) { |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> <span class="php-comment">// Recherche de la traduction demandée</span> |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> <span class="php-var">$valeur</span> = self::getValeur(<span class="php-var">$identifiant</span>, self::<span class="php-var">$traductions</span>[<span class="php-var">$langue_a_charger</span>]); |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> <span class="php-keyword1">if</span> (<span class="php-var">$valeur</span> !== <span class="php-keyword1">false</span>) { |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> <span class="php-var">$texte</span> = <span class="php-var">$valeur</span>; |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> } <span class="php-keyword1">else</span> { |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> <span class="php-var">$m</span> = <span class="php-quote">"Le traduction n'existe pas pour l'identifiant '</span><span class="php-var">$identifiant</span><span class="php-quote">' demandé."</span>; |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> self::ajouterErreur(<span class="php-var">$m</span>); |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> } |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> } |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> <span class="php-keyword1">return</span> <span class="php-var">$texte</span>; |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> } |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> <span class="php-comment">/** |
</span></span><span id="83" class="l"><a class="l" href="#83"> 83: </a><span class="php-comment"> * Charge un fichier ini dans le tableau des paramètres de l'appli |
</span></span><span id="84" class="l"><a class="l" href="#84"> 84: </a><span class="php-comment"> * @param string $fichier_ini le nom du fichier à charger |
</span></span><span id="85" class="l"><a class="l" href="#85"> 85: </a><span class="php-comment"> * @return boolean true, si le fichier a été trouvé et correctement chargé, sinon false. |
</span></span><span id="86" class="l"><a class="l" href="#86"> 86: </a><span class="php-comment"> */</span> |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_charger" href="#_charger">charger</a>(<span class="php-var">$langue</span>, <span class="php-var">$fichier</span> = <span class="php-keyword1">null</span>, <span class="php-var">$format</span> = self::FORMAT_INI) { |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> self::verifierCreationInstance(); |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> <span class="php-var">$ok</span> = <span class="php-keyword1">false</span>; |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-comment">// Création du chemin vers le fichier de traduction par défaut</span> |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_null</span>(<span class="php-var">$fichier</span>)) { |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-var">$fichier</span> = Config::get(<span class="php-quote">'chemin_i18n'</span>).<span class="php-var">$langue</span>.<span class="php-var">$format</span>; |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> } |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> <span class="php-comment">// Chargement </span> |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-keyword1">if</span> (<span class="php-var">$format</span> == self::FORMAT_INI) { |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-var">$ok</span> = self::chargerFichierIni(<span class="php-var">$fichier</span>, <span class="php-var">$langue</span>); |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> } <span class="php-keyword1">else</span> { |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> <span class="php-var">$m</span> = <span class="php-quote">"Le format '</span><span class="php-var">$format</span><span class="php-quote">' de fichier de traduction n'est pas pris en compte par le Framework."</span>; |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> self::ajouterErreur(<span class="php-var">$m</span>); |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> } |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> <span class="php-keyword1">return</span> <span class="php-var">$ok</span>; |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> } |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> <span class="php-comment">/** |
</span></span><span id="108" class="l"><a class="l" href="#108">108: </a><span class="php-comment"> * Définit la langue utiliser pour rechercher une traduction. |
</span></span><span id="109" class="l"><a class="l" href="#109">109: </a><span class="php-comment"> * @param string $fichier_ini le nom du fichier à charger |
</span></span><span id="110" class="l"><a class="l" href="#110">110: </a><span class="php-comment"> * @return array le fichier ini parsé |
</span></span><span id="111" class="l"><a class="l" href="#111">111: </a><span class="php-comment"> */</span> |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_setLangue" href="#_setLangue">setLangue</a>(<span class="php-var">$langue</span>) { |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> self::verifierCreationInstance(); |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> self::<span class="php-var">$langue</span> = <span class="php-var">$langue</span>; |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> } |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> <span class="php-comment">/** |
</span></span><span id="118" class="l"><a class="l" href="#118">118: </a><span class="php-comment"> * Renvoie la valeur demandé grâce une chaine de paramètres |
</span></span><span id="119" class="l"><a class="l" href="#119">119: </a><span class="php-comment"> * @param string $param la chaine identifiante |
</span></span><span id="120" class="l"><a class="l" href="#120">120: </a><span class="php-comment"> * @param array $i18n le tableau de traductions |
</span></span><span id="121" class="l"><a class="l" href="#121">121: </a><span class="php-comment"> * @return mixed la valeur correspondante à la chaine identifiante si elle est trouvée, sinon false. |
</span></span><span id="122" class="l"><a class="l" href="#122">122: </a><span class="php-comment"> */</span> |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getValeur" href="#_getValeur">getValeur</a>(<span class="php-var">$param</span>, <span class="php-var">$i18n</span>) { |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> <span class="php-keyword1">if</span> (<span class="php-var">$param</span> === <span class="php-keyword1">null</span>) { |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> } <span class="php-keyword1">else</span> { |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$i18n</span>[<span class="php-var">$param</span>])) { |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-keyword1">return</span> <span class="php-var">$i18n</span>[<span class="php-var">$param</span>]; |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-keyword2">strpos</span>(<span class="php-var">$param</span>, <span class="php-quote">'.'</span>) !== <span class="php-keyword1">false</span>) { |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> <span class="php-var">$pieces</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">'.'</span>, <span class="php-var">$param</span>, <span class="php-num">2</span>); |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$pieces</span>[<span class="php-num">0</span>]) && <span class="php-keyword2">strlen</span>(<span class="php-var">$pieces</span>[<span class="php-num">1</span>])) { |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$i18n</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]])) { |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$i18n</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]])) { |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> <span class="php-keyword1">return</span> self::getValeur(<span class="php-var">$pieces</span>[<span class="php-num">1</span>], <span class="php-var">$i18n</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]]); |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> } |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> } |
</span><span id="137" class="l"><a class="l" href="#137">137: </a> } |
</span><span id="138" class="l"><a class="l" href="#138">138: </a> } <span class="php-keyword1">else</span> { |
</span><span id="139" class="l"><a class="l" href="#139">139: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> } |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> } |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> } |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-comment">/** |
</span></span><span id="145" class="l"><a class="l" href="#145">145: </a><span class="php-comment"> * Parse le fichier ini donné en paramètre |
</span></span><span id="146" class="l"><a class="l" href="#146">146: </a><span class="php-comment"> * @param string $fichier_ini nom du fichier ini à parser |
</span></span><span id="147" class="l"><a class="l" href="#147">147: </a><span class="php-comment"> * @param string $langue la langue correspondant au fichier |
</span></span><span id="148" class="l"><a class="l" href="#148">148: </a><span class="php-comment"> * @return boolean true si le chargement c'est bien passé, sinon false. |
</span></span><span id="149" class="l"><a class="l" href="#149">149: </a><span class="php-comment"> */</span> |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_chargerFichierIni" href="#_chargerFichierIni">chargerFichierIni</a>(<span class="php-var">$fichier_ini</span>, <span class="php-var">$langue</span>) { |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> self::<span class="php-var">$traductions</span>[<span class="php-var">$langue</span>] = <span class="php-keyword1">false</span>; |
</span><span id="152" class="l"><a class="l" href="#152">152: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">file_exists</span>(<span class="php-var">$fichier_ini</span>)) { |
</span><span id="153" class="l"><a class="l" href="#153">153: </a> <span class="php-var">$ini</span> = <span class="php-keyword2">parse_ini_file</span>(<span class="php-var">$fichier_ini</span>, <span class="php-keyword1">true</span>); |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> <span class="php-var">$ini</span> = self::analyserTableauIni(<span class="php-var">$ini</span>); |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> self::<span class="php-var">$traductions</span>[<span class="php-var">$langue</span>] = <span class="php-var">$ini</span>; |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> } |
</span><span id="157" class="l"><a class="l" href="#157">157: </a> <span class="php-keyword1">return</span> (self::<span class="php-var">$traductions</span>[<span class="php-var">$langue</span>] === <span class="php-keyword1">false</span>) ? <span class="php-keyword1">false</span> : <span class="php-keyword1">true</span>; |
</span><span id="158" class="l"><a class="l" href="#158">158: </a> } |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> <span class="php-comment">/** |
</span></span><span id="161" class="l"><a class="l" href="#161">161: </a><span class="php-comment"> * Analyse un tableau de traductions pour évaluer les clés. |
</span></span><span id="162" class="l"><a class="l" href="#162">162: </a><span class="php-comment"> * @param array $i18n le tableau de traductions |
</span></span><span id="163" class="l"><a class="l" href="#163">163: </a><span class="php-comment"> * @return array le tableau analysé et modifié si nécessaire. |
</span></span><span id="164" class="l"><a class="l" href="#164">164: </a><span class="php-comment"> */</span> |
</span><span id="165" class="l"><a class="l" href="#165">165: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_analyserTableauIni" href="#_analyserTableauIni">analyserTableauIni</a>(<span class="php-var">$i18n</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="166" class="l"><a class="l" href="#166">166: </a> <span class="php-comment">//ATTENTION : il est important de passer la valeur par référence car nous la modifions dynamiquement dans la boucle</span> |
</span><span id="167" class="l"><a class="l" href="#167">167: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$i18n</span> <span class="php-keyword1">as</span> <span class="php-var">$cle</span> => &<span class="php-var">$valeur</span>) { |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$valeur</span>)) { |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> <span class="php-var">$i18n</span>[<span class="php-var">$cle</span>] = self::analyserTableauIni(<span class="php-var">$valeur</span>); |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> } <span class="php-keyword1">else</span> { |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> <span class="php-var">$i18n</span> = self::evaluerCle(<span class="php-var">$i18n</span>, <span class="php-var">$cle</span>, <span class="php-var">$valeur</span>); |
</span><span id="172" class="l"><a class="l" href="#172">172: </a> } |
</span><span id="173" class="l"><a class="l" href="#173">173: </a> } |
</span><span id="174" class="l"><a class="l" href="#174">174: </a> <span class="php-keyword1">return</span> <span class="php-var">$i18n</span>; |
</span><span id="175" class="l"><a class="l" href="#175">175: </a> } |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> |
</span><span id="177" class="l"><a class="l" href="#177">177: </a> <span class="php-comment">/** |
</span></span><span id="178" class="l"><a class="l" href="#178">178: </a><span class="php-comment"> * Dans le cas des chaines de traduction à sous clé (ex.: cle.souscle), cette méthode |
</span></span><span id="179" class="l"><a class="l" href="#179">179: </a><span class="php-comment"> * évalue les valeurs correspondantes et créée les sous tableaux associés. |
</span></span><span id="180" class="l"><a class="l" href="#180">180: </a><span class="php-comment"> * @param array $i18n tableau de traductions (par référence) |
</span></span><span id="181" class="l"><a class="l" href="#181">181: </a><span class="php-comment"> * @param string $cle la cle dans le tableau |
</span></span><span id="182" class="l"><a class="l" href="#182">182: </a><span class="php-comment"> * @param string $valeur la valeur à affecter |
</span></span><span id="183" class="l"><a class="l" href="#183">183: </a><span class="php-comment"> */</span> |
</span><span id="184" class="l"><a class="l" href="#184">184: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_evaluerCle" href="#_evaluerCle">evaluerCle</a>(<span class="php-var">$i18n</span>, <span class="php-var">$cle</span>, <span class="php-var">$valeur</span>) { |
</span><span id="185" class="l"><a class="l" href="#185">185: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strpos</span>(<span class="php-var">$cle</span>, <span class="php-quote">'.'</span>) !== <span class="php-keyword1">false</span>) { |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> <span class="php-keyword1">unset</span>(<span class="php-var">$i18n</span>[<span class="php-var">$cle</span>]); |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> <span class="php-var">$pieces</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">'.'</span>, <span class="php-var">$cle</span>, <span class="php-num">2</span>); |
</span><span id="188" class="l"><a class="l" href="#188">188: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$pieces</span>[<span class="php-num">0</span>]) && <span class="php-keyword2">strlen</span>(<span class="php-var">$pieces</span>[<span class="php-num">1</span>])) { |
</span><span id="189" class="l"><a class="l" href="#189">189: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$i18n</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]]) && !<span class="php-keyword2">is_array</span>(<span class="php-var">$i18n</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]])) { |
</span><span id="190" class="l"><a class="l" href="#190">190: </a> <span class="php-var">$m</span> = <span class="php-quote">"Ne peut pas créer de sous-clé pour '</span><span class="php-var">{$pieces[0]}</span><span class="php-quote">' car la clé existe déjà"</span>; |
</span><span id="191" class="l"><a class="l" href="#191">191: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$m</span>, E_USER_WARNING); |
</span><span id="192" class="l"><a class="l" href="#192">192: </a> } <span class="php-keyword1">else</span> { |
</span><span id="193" class="l"><a class="l" href="#193">193: </a> <span class="php-var">$i18n</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]][<span class="php-var">$pieces</span>[<span class="php-num">1</span>]] = <span class="php-var">$valeur</span>; |
</span><span id="194" class="l"><a class="l" href="#194">194: </a> <span class="php-var">$i18n</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]] = self::evaluerCle(<span class="php-var">$i18n</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]], <span class="php-var">$pieces</span>[<span class="php-num">1</span>], <span class="php-var">$valeur</span>); |
</span><span id="195" class="l"><a class="l" href="#195">195: </a> } |
</span><span id="196" class="l"><a class="l" href="#196">196: </a> } <span class="php-keyword1">else</span> { |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> <span class="php-var">$m</span> = <span class="php-quote">"Clé invalide '</span><span class="php-var">$cle</span><span class="php-quote">'"</span>; |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$m</span>, E_USER_WARNING); |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> } |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> } <span class="php-keyword1">else</span> { |
</span><span id="201" class="l"><a class="l" href="#201">201: </a> <span class="php-var">$i18n</span>[<span class="php-var">$cle</span>] = <span class="php-var">$valeur</span>; |
</span><span id="202" class="l"><a class="l" href="#202">202: </a> } |
</span><span id="203" class="l"><a class="l" href="#203">203: </a> <span class="php-keyword1">return</span> <span class="php-var">$i18n</span>; |
</span><span id="204" class="l"><a class="l" href="#204">204: </a> } |
</span><span id="205" class="l"><a class="l" href="#205">205: </a> |
</span><span id="206" class="l"><a class="l" href="#206">206: </a> <span class="php-comment">/** |
</span></span><span id="207" class="l"><a class="l" href="#207">207: </a><span class="php-comment"> * Cherche l'information sur la langue demandée par l'application |
</span></span><span id="208" class="l"><a class="l" href="#208">208: </a><span class="php-comment"> */</span> |
</span><span id="209" class="l"><a class="l" href="#209">209: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_trouverLangue" href="#_trouverLangue">trouverLangue</a>() { |
</span><span id="210" class="l"><a class="l" href="#210">210: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$_GET</span>[Config::get(<span class="php-quote">'i18n_url_parametre'</span>)])) { |
</span><span id="211" class="l"><a class="l" href="#211">211: </a> self::<span class="php-var">$langue</span> = <span class="php-var">$_GET</span>[Config::get(<span class="php-quote">'i18n_url_parametre'</span>)]; |
</span><span id="212" class="l"><a class="l" href="#212">212: </a> } <span class="php-keyword1">else</span> { |
</span><span id="213" class="l"><a class="l" href="#213">213: </a> self::<span class="php-var">$langue</span> = Config::get(<span class="php-quote">'i18n_langue_defaut'</span>); |
</span><span id="214" class="l"><a class="l" href="#214">214: </a> } |
</span><span id="215" class="l"><a class="l" href="#215">215: </a> } |
</span><span id="216" class="l"><a class="l" href="#216">216: </a> |
</span><span id="217" class="l"><a class="l" href="#217">217: </a> <span class="php-comment">/** |
</span></span><span id="218" class="l"><a class="l" href="#218">218: </a><span class="php-comment"> * Vérifie si l'instance de classe à été crée, si non la crée |
</span></span><span id="219" class="l"><a class="l" href="#219">219: </a><span class="php-comment"> */</span> |
</span><span id="220" class="l"><a class="l" href="#220">220: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_verifierCreationInstance" href="#_verifierCreationInstance">verifierCreationInstance</a>() { |
</span><span id="221" class="l"><a class="l" href="#221">221: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">empty</span>(self::<span class="php-var">$instance</span>)) { |
</span><span id="222" class="l"><a class="l" href="#222">222: </a> self::<span class="php-var">$instance</span> = <span class="php-keyword1">new</span> I18n(); |
</span><span id="223" class="l"><a class="l" href="#223">223: </a> } |
</span><span id="224" class="l"><a class="l" href="#224">224: </a> } |
</span><span id="225" class="l"><a class="l" href="#225">225: </a> |
</span><span id="226" class="l"><a class="l" href="#226">226: </a> <span class="php-comment">/** |
</span></span><span id="227" class="l"><a class="l" href="#227">227: </a><span class="php-comment"> * Ajouter une message d'erreur |
</span></span><span id="228" class="l"><a class="l" href="#228">228: </a><span class="php-comment"> */</span> |
</span><span id="229" class="l"><a class="l" href="#229">229: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_ajouterErreur" href="#_ajouterErreur">ajouterErreur</a>(<span class="php-var">$m</span>, <span class="php-var">$e</span> = E_USER_WARNING) { |
</span><span id="230" class="l"><a class="l" href="#230">230: </a> <span class="php-keyword1">if</span> (Config::get(<span class="php-quote">'debogage'</span>) === <span class="php-keyword1">true</span>) { |
</span><span id="231" class="l"><a class="l" href="#231">231: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$m</span>, <span class="php-var">$e</span>); |
</span><span id="232" class="l"><a class="l" href="#232">232: </a> } |
</span><span id="233" class="l"><a class="l" href="#233">233: </a> } |
</span><span id="234" class="l"><a class="l" href="#234">234: </a>} |
</span><span id="235" class="l"><a class="l" href="#235">235: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-CacheSimple.html |
---|
New file |
0,0 → 1,299 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class CacheSimple | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li class="active"><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class CacheSimple</h1> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://framework.zend.com/license/new-bsd">Licence New BSD</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL</a><br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Author:</b> |
Aurélien PERONNET <<a |
href="mailto:aurelien@tela-botanica.org">aurelien@<!-- -->tela-botanica.org</a>><br> |
<b>Located at</b> <a href="source-class-CacheSimple.html#23-126" title="Go to source code">framework/CacheSimple.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="__construct" id="___construct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___construct">#</a> |
<code><a href="source-class-CacheSimple.html#35-62" title="Go to source code">__construct</a>( <span>mixed <var>$options</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="charger" id="_charger"> |
<td class="attributes"><code> |
public |
string|false |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_charger">#</a> |
<code><a href="source-class-CacheSimple.html#72-87" title="Go to source code">charger</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Teste si le cache est disponible pour l'id donné et (si oui) le retourne |
(sinon renvoie false)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Teste si le cache est disponible pour l'id donné et (si oui) le retourne |
(sinon renvoie false)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id l'identifiant du Cache.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string|false</code><br>les données en cache.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="sauver" id="_sauver"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_sauver">#</a> |
<code><a href="source-class-CacheSimple.html#89-125" title="Go to source code">sauver</a>( <span>string <var>$contenu</var></span>, <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Sauvegarde la chaine de données dans un fichier texte.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Sauvegarde la chaine de données dans un fichier texte.</p> |
<p>Note : $contenu est toujours de type "string". C'est à vous de gérer la |
sérialisation.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$contenu</var></dt> |
<dd><code>string</code><br>$contenu les données à mettre en cache.</dd> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id l'identifiant du Cache.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true si aucun problème<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-I18n.html |
---|
New file |
0,0 → 1,360 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class I18n | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li class="active"><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class I18n</h1> |
<div class="description"> |
<p>I18n permet de traduire une application à partir de données stockées dans |
des fichiers ini. Si vous souhaitez utiliser le fonctionnement par défaut vous |
devrez :</p> |
<ul> |
<li>déposer les fichiers ini dans le dossier définit par la variable de config |
"chemin_i18n".</li> |
<li>nommer les fichiers selon la forme "locale.ini" (Ex.: fr.ini ou fr_CH.ini |
).</li> |
</ul> |
<p>Elle offre l'accès en lecture seule aux paramètres des fichiers ini. C'est |
une Singleton. Une seule classe de traduction peut être instanciée par |
Application.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL</a><br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: I18n.php 331 2011-02-24 18:03:35Z jpm $<br> |
<b>Since:</b> |
0.3<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-I18n.html#3-234" title="Go to source code">framework/I18n.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="get" id="_get"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_get">#</a> |
<code><a href="source-class-I18n.html#43-80" title="Go to source code">get</a>( <span>string <var>$identifiant</var></span>, <span>mixed <var>$langue</var> = <span class="php-keyword1">null</span></span> )</code> |
<div class="description short"> |
<p>Accesseur pour la valeur d'une traduction</p> |
</div> |
<div class="description detailed hidden"> |
<p>Accesseur pour la valeur d'une traduction</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$identifiant</var></dt> |
<dd><code>string</code><br>$param le nom du paramètre</dd> |
<dt><var>$langue</var></dt> |
<dd></dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>la valeur du paramètre<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="charger" id="_charger"> |
<td class="attributes"><code> |
public static |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_charger">#</a> |
<code><a href="source-class-I18n.html#82-105" title="Go to source code">charger</a>( <span>string <var>$langue</var></span>, <span>mixed <var>$fichier</var> = <span class="php-keyword1">null</span></span>, <span>mixed <var>$format</var> = <code><a href="class-I18n.html#FORMAT_INI">I18n::<b>FORMAT_INI</b></a></code></span> )</code> |
<div class="description short"> |
<p>Charge un fichier ini dans le tableau des paramètres de l'appli</p> |
</div> |
<div class="description detailed hidden"> |
<p>Charge un fichier ini dans le tableau des paramètres de l'appli</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$langue</var></dt> |
<dd><code>string</code><br>$fichier_ini le nom du fichier à charger</dd> |
<dt><var>$fichier</var></dt> |
<dd></dd> |
<dt><var>$format</var></dt> |
<dd></dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true, si le fichier a été trouvé et correctement chargé, sinon false.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="setLangue" id="_setLangue"> |
<td class="attributes"><code> |
public static |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setLangue">#</a> |
<code><a href="source-class-I18n.html#107-115" title="Go to source code">setLangue</a>( <span>string <var>$langue</var></span> )</code> |
<div class="description short"> |
<p>Définit la langue utiliser pour rechercher une traduction.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Définit la langue utiliser pour rechercher une traduction.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$langue</var></dt> |
<dd><code>string</code><br>$fichier_ini le nom du fichier à charger</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>le fichier ini parsé<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="constants"> |
<caption>Constants summary</caption> |
<tr data-order="FORMAT_INI" id="FORMAT_INI"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-I18n.html#23-24" title="Go to source code"><b>FORMAT_INI</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'.ini'</span></code></td> |
<td class="description"><div> |
<a href="#FORMAT_INI" class="anchor">#</a> |
<div class="description short"> |
<p>Format de traduction utilisant les fichier .ini</p> |
</div> |
<div class="description detailed hidden"> |
<p>Format de traduction utilisant les fichier .ini</p> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Chronometre.html |
---|
New file |
0,0 → 1,258 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Chronometre.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li class="active"><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Chronometre.html" title="Summary of Chronometre"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** Chronometre permet de stocker et d'afficher les temps d'éxécution de script. |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * Cette classe permet de réaliser un ensemble de mesure de temps prises à différents endroits d'un script. |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * Ces mesures peuvent ensuite être affichées au sein d'un tableau XHTML. |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @package Framework |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @version $Id: Chronometre.php 327 2011-02-08 17:54:34Z jpm $ |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> */</span> |
</span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-keyword1">class</span> <a id="Chronometre" href="#Chronometre">Chronometre</a> { |
</span><span id="18" class="l"><a class="l" href="#18"> 18: </a> <span class="php-comment">/*** Attributs : ***/</span> |
</span><span id="19" class="l"><a class="l" href="#19"> 19: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$pointArretNumero" href="#$pointArretNumero">$pointArretNumero</a></span> = <span class="php-num">1</span>; |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$temps" href="#$temps">$temps</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> <span class="php-comment">/** Accesseurs : |
</span></span><span id="23" class="l"><a class="l" href="#23"> 23: </a><span class="php-comment"> * |
</span></span><span id="24" class="l"><a class="l" href="#24"> 24: </a><span class="php-comment"> * @param string $cle la cle associée à un chronomètre particulier |
</span></span><span id="25" class="l"><a class="l" href="#25"> 25: </a><span class="php-comment"> * |
</span></span><span id="26" class="l"><a class="l" href="#26"> 26: </a><span class="php-comment"> * @return int le temps écoulé |
</span></span><span id="27" class="l"><a class="l" href="#27"> 27: </a><span class="php-comment"> */</span> |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getTemps" href="#_getTemps">getTemps</a>(<span class="php-var">$cle</span> = <span class="php-keyword1">null</span>) { |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_null</span>(<span class="php-var">$cle</span>)) { |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-var">$temps</span> = self::<span class="php-var">$temps</span>; |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> } <span class="php-keyword1">else</span> { |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> <span class="php-keyword1">foreach</span> (self::<span class="php-var">$temps</span> <span class="php-keyword1">as</span> <span class="php-var">$temps_enrg</span>) { |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$temps_enrg</span>[<span class="php-var">$cle</span>])) { |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> <span class="php-var">$temps</span> = <span class="php-var">$temps_enrg</span>; |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-keyword1">break</span>; |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> } |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> } |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> } |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> <span class="php-keyword1">return</span> <span class="php-var">$temps</span>; |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> } |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> <span class="php-comment">/** Setteur pour la variable temps |
</span></span><span id="43" class="l"><a class="l" href="#43"> 43: </a><span class="php-comment"> * |
</span></span><span id="44" class="l"><a class="l" href="#44"> 44: </a><span class="php-comment"> * @param array() $moment ajoute des points de chronométrage au tableau _temps |
</span></span><span id="45" class="l"><a class="l" href="#45"> 45: </a><span class="php-comment"> * |
</span></span><span id="46" class="l"><a class="l" href="#46"> 46: </a><span class="php-comment"> * @return null |
</span></span><span id="47" class="l"><a class="l" href="#47"> 47: </a><span class="php-comment"> */</span> |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_setTemps" href="#_setTemps">setTemps</a>(<span class="php-var">$cle</span>, <span class="php-var">$moment</span>) { |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-keyword2">array_push</span>(self::<span class="php-var">$temps</span>, <span class="php-keyword1">array</span>(<span class="php-var">$cle</span> => <span class="php-var">$moment</span>)); |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> } |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> <span class="php-comment">/*** Méthodes : ***/</span> |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-comment">/** |
</span></span><span id="55" class="l"><a class="l" href="#55"> 55: </a><span class="php-comment"> * Effectue un chronometrage. |
</span></span><span id="56" class="l"><a class="l" href="#56"> 56: </a><span class="php-comment"> * Vous pouvez indiquer le nom du point de chronométrage. |
</span></span><span id="57" class="l"><a class="l" href="#57"> 57: </a><span class="php-comment"> * Si vous n'indiquez rien, un nombre sera généré en débutant à 1. |
</span></span><span id="58" class="l"><a class="l" href="#58"> 58: </a><span class="php-comment"> * |
</span></span><span id="59" class="l"><a class="l" href="#59"> 59: </a><span class="php-comment"> * @param string le nom du point de chronométrage |
</span></span><span id="60" class="l"><a class="l" href="#60"> 60: </a><span class="php-comment"> * @return null |
</span></span><span id="61" class="l"><a class="l" href="#61"> 61: </a><span class="php-comment"> */</span> |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_chrono" href="#_chrono">chrono</a>(<span class="php-var">$cle</span> = <span class="php-keyword1">null</span>) { |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> <span class="php-keyword1">if</span> (<span class="php-var">$cle</span> == <span class="php-keyword1">null</span>) { |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-var">$cle</span> = (<span class="php-keyword2">count</span>(self::<span class="php-var">$temps</span>) == <span class="php-num">0</span>) ? <span class="php-quote">'Début'</span> : self::<span class="php-var">$pointArretNumero</span>++; |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> } |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> <span class="php-var">$moment</span> = <span class="php-keyword2">microtime</span>(); |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> self::setTemps(<span class="php-var">$cle</span>, <span class="php-var">$moment</span>); |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> } |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> <span class="php-comment">/** |
</span></span><span id="71" class="l"><a class="l" href="#71"> 71: </a><span class="php-comment"> * Permet d'afficher les temps d'éxécution de différentes parties d'un script. |
</span></span><span id="72" class="l"><a class="l" href="#72"> 72: </a><span class="php-comment"> * |
</span></span><span id="73" class="l"><a class="l" href="#73"> 73: </a><span class="php-comment"> * Cette fonction permet d'afficher un ensemble de mesure de temps prises à différents endroits d'un script. |
</span></span><span id="74" class="l"><a class="l" href="#74"> 74: </a><span class="php-comment"> * Ces mesures sont affichées au sein d'un tableau XHTML dont on peut controler l'indentation des balises. |
</span></span><span id="75" class="l"><a class="l" href="#75"> 75: </a><span class="php-comment"> * Pour un site en production, il suffit d'ajouter un style #chrono {display:none;} dans la css. |
</span></span><span id="76" class="l"><a class="l" href="#76"> 76: </a><span class="php-comment"> * De cette façon, le tableau ne s'affichera pas. Le webmaster lui pourra rajouter sa propre feuille de style |
</span></span><span id="77" class="l"><a class="l" href="#77"> 77: </a><span class="php-comment"> * affichant le tableau. |
</span></span><span id="78" class="l"><a class="l" href="#78"> 78: </a><span class="php-comment"> * Le développeur initial de cette fonction est Loic d'Anterroches. |
</span></span><span id="79" class="l"><a class="l" href="#79"> 79: </a><span class="php-comment"> * Elle a été modifiée par Jean-Pascal Milcent. |
</span></span><span id="80" class="l"><a class="l" href="#80"> 80: </a><span class="php-comment"> * |
</span></span><span id="81" class="l"><a class="l" href="#81"> 81: </a><span class="php-comment"> * @author Loic d'Anterroches |
</span></span><span id="82" class="l"><a class="l" href="#82"> 82: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="83" class="l"><a class="l" href="#83"> 83: </a><span class="php-comment"> * @param string l'eventuel nom du point de chronométrage de fin. |
</span></span><span id="84" class="l"><a class="l" href="#84"> 84: </a><span class="php-comment"> * @return string la chaine XHTML de mesure des temps. |
</span></span><span id="85" class="l"><a class="l" href="#85"> 85: </a><span class="php-comment"> */</span> |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_afficherChrono" href="#_afficherChrono">afficherChrono</a>(<span class="php-var">$cle</span> = <span class="php-keyword1">null</span>) { |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(self::<span class="php-var">$temps</span>) == <span class="php-num">0</span>) { |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> <span class="php-var">$sortie</span> = <span class="php-quote">"Aucun chronométrage à l'aide de Chronometre::chrono() n'a été réalisé."</span>; |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> } <span class="php-keyword1">else</span> { |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> <span class="php-comment">// Création du chrono de fin</span> |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> self::chrono(<span class="php-quote">'Fin'</span>); |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-var">$total_tps_ecoule</span> = <span class="php-num">0</span>; |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> <span class="php-var">$tps_debut</span> = <span class="php-keyword1">null</span>; |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> <span class="php-var">$tbody</span> = <span class="php-quote">''</span>; |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> <span class="php-keyword1">foreach</span> (self::getTemps() <span class="php-keyword1">as</span> <span class="php-var">$temps</span>) { |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$temps</span> <span class="php-keyword1">as</span> <span class="php-var">$cle</span> => <span class="php-var">$valeur</span>) { |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-comment">// Récupération de la premiére mesure</span> |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_null</span>(<span class="php-var">$tps_debut</span>)) { |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> <span class="php-var">$tps_debut</span> = self::getMicroTime(<span class="php-var">$valeur</span>); |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> } |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> <span class="php-comment">// Récupération de la mesure courrante</span> |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> <span class="php-var">$tps_fin</span> = self::getMicroTime(<span class="php-var">$valeur</span>); |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-var">$tps_ecoule</span> = <span class="php-keyword2">abs</span>(<span class="php-var">$tps_fin</span> - <span class="php-var">$tps_debut</span>); |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> <span class="php-var">$total_tps_ecoule</span> += <span class="php-var">$tps_ecoule</span>; |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> <span class="php-var">$tps_debut</span> = <span class="php-var">$tps_fin</span>; |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> <span class="php-comment">// Gestion affichage</span> |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> <span class="php-var">$total_tps_ecoule_fmt</span> = <span class="php-keyword2">number_format</span>(<span class="php-var">$total_tps_ecoule</span>, <span class="php-num">3</span>, <span class="php-quote">','</span>, <span class="php-quote">' '</span>); |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> <span class="php-var">$tps_ecoule_fmt</span> = <span class="php-keyword2">number_format</span>(<span class="php-var">$tps_ecoule</span>, <span class="php-num">3</span>, <span class="php-quote">','</span>, <span class="php-quote">' '</span>); |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> <span class="php-var">$tbody</span> .= <span class="php-quote">'<tr><th>'</span>.<span class="php-var">$cle</span>.<span class="php-quote">'</th><td>'</span>.<span class="php-var">$tps_ecoule_fmt</span>.<span class="php-quote">'</td><td>'</span>.<span class="php-var">$total_tps_ecoule_fmt</span>.<span class="php-quote">'</td></tr>'</span>.<span class="php-quote">"\n"</span>; |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> } |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> } |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> <span class="php-var">$total_tps_ecoule_final_fmt</span> = <span class="php-keyword2">number_format</span>(<span class="php-var">$total_tps_ecoule</span>, <span class="php-num">3</span>, <span class="php-quote">','</span>, <span class="php-quote">' '</span>); |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> <span class="php-comment">// Début création de l'affichage</span> |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> <span class="php-var">$sortie</span> = <span class="php-quote">'<table id="chrono" lang="fr" summary="Résultat duchronométrage du programme affichant la page actuelle.">'</span>.<span class="php-quote">"\n"</span>. |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-quote">'<caption>Chronométrage</caption>'</span>.<span class="php-quote">"\n"</span>. |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> <span class="php-quote">'<thead>'</span>.<span class="php-quote">"\n"</span>. |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> <span class="php-quote">' <tr><th>Action</th><th title="Temps écoulé vis à vis de l\'action précédente">Temps écoulé (en s.)</th><th>Cumul du temps écoulé (en s.)</th></tr>'</span>.<span class="php-quote">"\n"</span>. |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-quote">'</thead>'</span>.<span class="php-quote">"\n"</span>. |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> <span class="php-quote">'<tbody>'</span>.<span class="php-quote">"\n"</span>. |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-var">$tbody</span>. |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> <span class="php-quote">'</tbody>'</span>.<span class="php-quote">"\n"</span>. |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> <span class="php-quote">'<tfoot>'</span>.<span class="php-quote">"\n"</span>. |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-quote">' <tr><th>Total du temps écoulé (en s.)</th><td colspan="2">'</span>.<span class="php-var">$total_tps_ecoule_final_fmt</span>.<span class="php-quote">'</td></tr>'</span>.<span class="php-quote">"\n"</span>. |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-quote">'</tfoot>'</span>.<span class="php-quote">"\n"</span>. |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-quote">'</table>'</span>.<span class="php-quote">"\n"</span>; |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> } |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> <span class="php-keyword1">return</span> <span class="php-var">$sortie</span>; |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> } |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getMicroTime" href="#_getMicroTime">getMicroTime</a>(<span class="php-var">$utps</span>) { |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> <span class="php-keyword1">list</span>(<span class="php-var">$usec</span>, <span class="php-var">$sec</span>) = <span class="php-keyword2">explode</span>(<span class="php-quote">' '</span>, <span class="php-var">$utps</span>); |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> <span class="php-keyword1">return</span> ((float)<span class="php-var">$usec</span> + (float)<span class="php-var">$sec</span>); |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> } |
</span><span id="137" class="l"><a class="l" href="#137">137: </a>} |
</span><span id="138" class="l"><a class="l" href="#138">138: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Chaine.html |
---|
New file |
0,0 → 1,170 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/utilitaires/Chaine.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li class="active"><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li class="active"><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Utilitaire.html" title="Summary of Utilitaire"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Chaine.html" title="Summary of Chaine"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe fournissant des méthodes statiques de manipulation des chaînes de caractères (String). |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @package Utilitaire |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="10" class="l"><a class="l" href="#10">10: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="11" class="l"><a class="l" href="#11">11: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="12" class="l"><a class="l" href="#12">12: </a><span class="php-comment"> * @version $Id: Chaine.php 343 2011-06-09 14:59:36Z jpm $ |
</span></span><span id="13" class="l"><a class="l" href="#13">13: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="14" class="l"><a class="l" href="#14">14: </a><span class="php-comment"> */</span> |
</span><span id="15" class="l"><a class="l" href="#15">15: </a><span class="php-keyword1">class</span> <a id="Chaine" href="#Chaine">Chaine</a> { |
</span><span id="16" class="l"><a class="l" href="#16">16: </a> |
</span><span id="17" class="l"><a class="l" href="#17">17: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$caracteres_accentues" href="#$caracteres_accentues">$caracteres_accentues</a></span> = <span class="php-keyword1">array</span>( |
</span><span id="18" class="l"><a class="l" href="#18">18: </a> <span class="php-quote">'À'</span>, <span class="php-quote">'Á'</span>, <span class="php-quote">'Â'</span>, <span class="php-quote">'Ã'</span>, <span class="php-quote">'Ä'</span>, <span class="php-quote">'Å'</span>, <span class="php-quote">'Æ'</span>, <span class="php-quote">'Ç'</span>, <span class="php-quote">'È'</span>, <span class="php-quote">'É'</span>, <span class="php-quote">'Ê'</span>, <span class="php-quote">'Ë'</span>, <span class="php-quote">'Ì'</span>, <span class="php-quote">'Í'</span>, <span class="php-quote">'Î'</span>, |
</span><span id="19" class="l"><a class="l" href="#19">19: </a> <span class="php-quote">'Ï'</span>, <span class="php-quote">'Ð'</span>, <span class="php-quote">'Ñ'</span>, <span class="php-quote">'Ò'</span>, <span class="php-quote">'Ó'</span>, <span class="php-quote">'Ô'</span>, <span class="php-quote">'Õ'</span>, <span class="php-quote">'Ö'</span>, <span class="php-quote">'Ø'</span>, <span class="php-quote">'Ù'</span>, <span class="php-quote">'Ú'</span>, <span class="php-quote">'Û'</span>, <span class="php-quote">'Ü'</span>, <span class="php-quote">'Ý'</span>, <span class="php-quote">'ß'</span>, |
</span><span id="20" class="l"><a class="l" href="#20">20: </a> <span class="php-quote">'à'</span>, <span class="php-quote">'á'</span>, <span class="php-quote">'â'</span>, <span class="php-quote">'ã'</span>, <span class="php-quote">'ä'</span>, <span class="php-quote">'å'</span>, <span class="php-quote">'æ'</span>, <span class="php-quote">'ç'</span>, <span class="php-quote">'è'</span>, <span class="php-quote">'é'</span>, <span class="php-quote">'ê'</span>, <span class="php-quote">'ë'</span>, <span class="php-quote">'ì'</span>, <span class="php-quote">'í'</span>, <span class="php-quote">'î'</span>, |
</span><span id="21" class="l"><a class="l" href="#21">21: </a> <span class="php-quote">'ï'</span>, <span class="php-quote">'ñ'</span>, <span class="php-quote">'ò'</span>, <span class="php-quote">'ó'</span>, <span class="php-quote">'ô'</span>, <span class="php-quote">'õ'</span>, <span class="php-quote">'ö'</span>, <span class="php-quote">'ø'</span>, <span class="php-quote">'ù'</span>, <span class="php-quote">'ú'</span>, <span class="php-quote">'û'</span>, <span class="php-quote">'ü'</span>, <span class="php-quote">'ý'</span>, <span class="php-quote">'ÿ'</span>, <span class="php-quote">'Ā'</span>, |
</span><span id="22" class="l"><a class="l" href="#22">22: </a> <span class="php-quote">'ā'</span>, <span class="php-quote">'Ă'</span>, <span class="php-quote">'ă'</span>, <span class="php-quote">'Ą'</span>, <span class="php-quote">'ą'</span>, <span class="php-quote">'Ć'</span>, <span class="php-quote">'ć'</span>, <span class="php-quote">'Ĉ'</span>, <span class="php-quote">'ĉ'</span>, <span class="php-quote">'Ċ'</span>, <span class="php-quote">'ċ'</span>, <span class="php-quote">'Č'</span>, <span class="php-quote">'č'</span>, <span class="php-quote">'Ď'</span>, <span class="php-quote">'ď'</span>, |
</span><span id="23" class="l"><a class="l" href="#23">23: </a> <span class="php-quote">'Đ'</span>, <span class="php-quote">'đ'</span>, <span class="php-quote">'Ē'</span>, <span class="php-quote">'ē'</span>, <span class="php-quote">'Ĕ'</span>, <span class="php-quote">'ĕ'</span>, <span class="php-quote">'Ė'</span>, <span class="php-quote">'ė'</span>, <span class="php-quote">'Ę'</span>, <span class="php-quote">'ę'</span>, <span class="php-quote">'Ě'</span>, <span class="php-quote">'ě'</span>, <span class="php-quote">'Ĝ'</span>, <span class="php-quote">'ĝ'</span>, <span class="php-quote">'Ğ'</span>, |
</span><span id="24" class="l"><a class="l" href="#24">24: </a> <span class="php-quote">'ğ'</span>, <span class="php-quote">'Ġ'</span>, <span class="php-quote">'ġ'</span>, <span class="php-quote">'Ģ'</span>, <span class="php-quote">'ģ'</span>, <span class="php-quote">'Ĥ'</span>, <span class="php-quote">'ĥ'</span>, <span class="php-quote">'Ħ'</span>, <span class="php-quote">'ħ'</span>, <span class="php-quote">'Ĩ'</span>, <span class="php-quote">'ĩ'</span>, <span class="php-quote">'Ī'</span>, <span class="php-quote">'ī'</span>, <span class="php-quote">'Ĭ'</span>, <span class="php-quote">'ĭ'</span>, |
</span><span id="25" class="l"><a class="l" href="#25">25: </a> <span class="php-quote">'Į'</span>, <span class="php-quote">'į'</span>, <span class="php-quote">'İ'</span>, <span class="php-quote">'ı'</span>, <span class="php-quote">'IJ'</span>, <span class="php-quote">'ij'</span>, <span class="php-quote">'Ĵ'</span>, <span class="php-quote">'ĵ'</span>, <span class="php-quote">'Ķ'</span>, <span class="php-quote">'ķ'</span>, <span class="php-quote">'Ĺ'</span>, <span class="php-quote">'ĺ'</span>, <span class="php-quote">'Ļ'</span>, <span class="php-quote">'ļ'</span>, <span class="php-quote">'Ľ'</span>, |
</span><span id="26" class="l"><a class="l" href="#26">26: </a> <span class="php-quote">'ľ'</span>, <span class="php-quote">'Ŀ'</span>, <span class="php-quote">'ŀ'</span>, <span class="php-quote">'Ł'</span>, <span class="php-quote">'ł'</span>, <span class="php-quote">'Ń'</span>, <span class="php-quote">'ń'</span>, <span class="php-quote">'Ņ'</span>, <span class="php-quote">'ņ'</span>, <span class="php-quote">'Ň'</span>, <span class="php-quote">'ň'</span>, <span class="php-quote">'ʼn'</span>, <span class="php-quote">'Ō'</span>, <span class="php-quote">'ō'</span>, <span class="php-quote">'Ŏ'</span>, |
</span><span id="27" class="l"><a class="l" href="#27">27: </a> <span class="php-quote">'ŏ'</span>, <span class="php-quote">'Ő'</span>, <span class="php-quote">'ő'</span>, <span class="php-quote">'Œ'</span>, <span class="php-quote">'œ'</span>, <span class="php-quote">'Ŕ'</span>, <span class="php-quote">'ŕ'</span>, <span class="php-quote">'Ŗ'</span>, <span class="php-quote">'ŗ'</span>, <span class="php-quote">'Ř'</span>, <span class="php-quote">'ř'</span>, <span class="php-quote">'Ś'</span>, <span class="php-quote">'ś'</span>, <span class="php-quote">'Ŝ'</span>, <span class="php-quote">'ŝ'</span>, |
</span><span id="28" class="l"><a class="l" href="#28">28: </a> <span class="php-quote">'Ş'</span>, <span class="php-quote">'ş'</span>, <span class="php-quote">'Š'</span>, <span class="php-quote">'š'</span>, <span class="php-quote">'Ţ'</span>, <span class="php-quote">'ţ'</span>, <span class="php-quote">'Ť'</span>, <span class="php-quote">'ť'</span>, <span class="php-quote">'Ŧ'</span>, <span class="php-quote">'ŧ'</span>, <span class="php-quote">'Ũ'</span>, <span class="php-quote">'ũ'</span>, <span class="php-quote">'Ū'</span>, <span class="php-quote">'ū'</span>, <span class="php-quote">'Ŭ'</span>, |
</span><span id="29" class="l"><a class="l" href="#29">29: </a> <span class="php-quote">'ŭ'</span>, <span class="php-quote">'Ů'</span>, <span class="php-quote">'ů'</span>, <span class="php-quote">'Ű'</span>, <span class="php-quote">'ű'</span>, <span class="php-quote">'Ų'</span>, <span class="php-quote">'ų'</span>, <span class="php-quote">'Ŵ'</span>, <span class="php-quote">'ŵ'</span>, <span class="php-quote">'Ŷ'</span>, <span class="php-quote">'ŷ'</span>, <span class="php-quote">'Ÿ'</span>, <span class="php-quote">'Ź'</span>, <span class="php-quote">'ź'</span>, <span class="php-quote">'Ż'</span>, |
</span><span id="30" class="l"><a class="l" href="#30">30: </a> <span class="php-quote">'ż'</span>, <span class="php-quote">'Ž'</span>, <span class="php-quote">'ž'</span>, <span class="php-quote">'ſ'</span>, <span class="php-quote">'ƒ'</span>, <span class="php-quote">'Ơ'</span>, <span class="php-quote">'ơ'</span>, <span class="php-quote">'Ư'</span>, <span class="php-quote">'ư'</span>, <span class="php-quote">'Ǎ'</span>, <span class="php-quote">'ǎ'</span>, <span class="php-quote">'Ǐ'</span>, <span class="php-quote">'ǐ'</span>, <span class="php-quote">'Ǒ'</span>, <span class="php-quote">'ǒ'</span>, |
</span><span id="31" class="l"><a class="l" href="#31">31: </a> <span class="php-quote">'Ǔ'</span>, <span class="php-quote">'ǔ'</span>, <span class="php-quote">'Ǖ'</span>, <span class="php-quote">'ǖ'</span>, <span class="php-quote">'Ǘ'</span>, <span class="php-quote">'ǘ'</span>, <span class="php-quote">'Ǚ'</span>, <span class="php-quote">'ǚ'</span>, <span class="php-quote">'Ǜ'</span>, <span class="php-quote">'ǜ'</span>, <span class="php-quote">'Ǻ'</span>, <span class="php-quote">'ǻ'</span>, <span class="php-quote">'Ǽ'</span>, <span class="php-quote">'ǽ'</span>, <span class="php-quote">'Ǿ'</span>, <span class="php-quote">'ǿ'</span>); |
</span><span id="32" class="l"><a class="l" href="#32">32: </a> |
</span><span id="33" class="l"><a class="l" href="#33">33: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$caracteres_normaux" href="#$caracteres_normaux">$caracteres_normaux</a></span> = <span class="php-keyword1">array</span>( |
</span><span id="34" class="l"><a class="l" href="#34">34: </a> <span class="php-quote">'A'</span>, <span class="php-quote">'A'</span>, <span class="php-quote">'A'</span>, <span class="php-quote">'A'</span>, <span class="php-quote">'A'</span>, <span class="php-quote">'A'</span>, <span class="php-quote">'AE'</span>, <span class="php-quote">'C'</span>, <span class="php-quote">'E'</span>, <span class="php-quote">'E'</span>, <span class="php-quote">'E'</span>, <span class="php-quote">'E'</span>, <span class="php-quote">'I'</span>, <span class="php-quote">'I'</span>, <span class="php-quote">'I'</span>, |
</span><span id="35" class="l"><a class="l" href="#35">35: </a> <span class="php-quote">'I'</span>, <span class="php-quote">'D'</span>, <span class="php-quote">'N'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'Y'</span>, <span class="php-quote">'s'</span>, |
</span><span id="36" class="l"><a class="l" href="#36">36: </a> <span class="php-quote">'a'</span>, <span class="php-quote">'a'</span>, <span class="php-quote">'a'</span>, <span class="php-quote">'a'</span>, <span class="php-quote">'a'</span>, <span class="php-quote">'a'</span>, <span class="php-quote">'ae'</span>, <span class="php-quote">'c'</span>, <span class="php-quote">'e'</span>, <span class="php-quote">'e'</span>, <span class="php-quote">'e'</span>, <span class="php-quote">'e'</span>, <span class="php-quote">'i'</span>, <span class="php-quote">'i'</span>, <span class="php-quote">'i'</span>, |
</span><span id="37" class="l"><a class="l" href="#37">37: </a> <span class="php-quote">'i'</span>, <span class="php-quote">'n'</span>, <span class="php-quote">'o'</span>, <span class="php-quote">'o'</span>, <span class="php-quote">'o'</span>, <span class="php-quote">'o'</span>, <span class="php-quote">'o'</span>, <span class="php-quote">'o'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'y'</span>, <span class="php-quote">'y'</span>, <span class="php-quote">'A'</span>, <span class="php-quote">'a'</span>, |
</span><span id="38" class="l"><a class="l" href="#38">38: </a> <span class="php-quote">'A'</span>, <span class="php-quote">'a'</span>, <span class="php-quote">'A'</span>, <span class="php-quote">'a'</span>, <span class="php-quote">'C'</span>, <span class="php-quote">'c'</span>, <span class="php-quote">'C'</span>, <span class="php-quote">'c'</span>, <span class="php-quote">'C'</span>, <span class="php-quote">'c'</span>, <span class="php-quote">'C'</span>, <span class="php-quote">'c'</span>, <span class="php-quote">'D'</span>, <span class="php-quote">'d'</span>, <span class="php-quote">'D'</span>, <span class="php-quote">'d'</span>, |
</span><span id="39" class="l"><a class="l" href="#39">39: </a> <span class="php-quote">'E'</span>, <span class="php-quote">'e'</span>, <span class="php-quote">'E'</span>, <span class="php-quote">'e'</span>, <span class="php-quote">'E'</span>, <span class="php-quote">'e'</span>, <span class="php-quote">'E'</span>, <span class="php-quote">'e'</span>, <span class="php-quote">'E'</span>, <span class="php-quote">'e'</span>, <span class="php-quote">'G'</span>, <span class="php-quote">'g'</span>, <span class="php-quote">'G'</span>, <span class="php-quote">'g'</span>, <span class="php-quote">'G'</span>, <span class="php-quote">'g'</span>, |
</span><span id="40" class="l"><a class="l" href="#40">40: </a> <span class="php-quote">'G'</span>, <span class="php-quote">'g'</span>, <span class="php-quote">'H'</span>, <span class="php-quote">'h'</span>, <span class="php-quote">'H'</span>, <span class="php-quote">'h'</span>, <span class="php-quote">'I'</span>, <span class="php-quote">'i'</span>, <span class="php-quote">'I'</span>, <span class="php-quote">'i'</span>, <span class="php-quote">'I'</span>, <span class="php-quote">'i'</span>, <span class="php-quote">'I'</span>, <span class="php-quote">'i'</span>, <span class="php-quote">'I'</span>, <span class="php-quote">'i'</span>, |
</span><span id="41" class="l"><a class="l" href="#41">41: </a> <span class="php-quote">'IJ'</span>, <span class="php-quote">'ij'</span>, <span class="php-quote">'J'</span>, <span class="php-quote">'j'</span>, <span class="php-quote">'K'</span>, <span class="php-quote">'k'</span>, <span class="php-quote">'L'</span>, <span class="php-quote">'l'</span>, <span class="php-quote">'L'</span>, <span class="php-quote">'l'</span>, <span class="php-quote">'L'</span>, <span class="php-quote">'l'</span>, <span class="php-quote">'L'</span>, <span class="php-quote">'l'</span>, <span class="php-quote">'l'</span>, <span class="php-quote">'l'</span>, |
</span><span id="42" class="l"><a class="l" href="#42">42: </a> <span class="php-quote">'N'</span>, <span class="php-quote">'n'</span>, <span class="php-quote">'N'</span>, <span class="php-quote">'n'</span>, <span class="php-quote">'N'</span>, <span class="php-quote">'n'</span>, <span class="php-quote">'n'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'o'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'o'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'o'</span>, <span class="php-quote">'OE'</span>, <span class="php-quote">'oe'</span>, <span class="php-quote">'R'</span>, |
</span><span id="43" class="l"><a class="l" href="#43">43: </a> <span class="php-quote">'r'</span>, <span class="php-quote">'R'</span>, <span class="php-quote">'r'</span>, <span class="php-quote">'R'</span>, <span class="php-quote">'r'</span>, <span class="php-quote">'S'</span>, <span class="php-quote">'s'</span>, <span class="php-quote">'S'</span>, <span class="php-quote">'s'</span>, <span class="php-quote">'S'</span>, <span class="php-quote">'s'</span>, <span class="php-quote">'S'</span>, <span class="php-quote">'s'</span>, <span class="php-quote">'T'</span>, <span class="php-quote">'t'</span>, <span class="php-quote">'T'</span>, <span class="php-quote">'t'</span>, |
</span><span id="44" class="l"><a class="l" href="#44">44: </a> <span class="php-quote">'T'</span>, <span class="php-quote">'t'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'W'</span>, <span class="php-quote">'w'</span>, <span class="php-quote">'Y'</span>, |
</span><span id="45" class="l"><a class="l" href="#45">45: </a> <span class="php-quote">'y'</span>, <span class="php-quote">'Y'</span>, <span class="php-quote">'Z'</span>, <span class="php-quote">'z'</span>, <span class="php-quote">'Z'</span>, <span class="php-quote">'z'</span>, <span class="php-quote">'Z'</span>, <span class="php-quote">'z'</span>, <span class="php-quote">'s'</span>, <span class="php-quote">'f'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'o'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'A'</span>, <span class="php-quote">'a'</span>, <span class="php-quote">'I'</span>, |
</span><span id="46" class="l"><a class="l" href="#46">46: </a> <span class="php-quote">'i'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'o'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'U'</span>, <span class="php-quote">'u'</span>, <span class="php-quote">'A'</span>, <span class="php-quote">'a'</span>, <span class="php-quote">'AE'</span>, <span class="php-quote">'ae'</span>, <span class="php-quote">'O'</span>, <span class="php-quote">'o'</span>); |
</span><span id="47" class="l"><a class="l" href="#47">47: </a> |
</span><span id="48" class="l"><a class="l" href="#48">48: </a> <span class="php-comment">/** |
</span></span><span id="49" class="l"><a class="l" href="#49">49: </a><span class="php-comment"> * Supprime ou remplace les accents d'une chaine en PHP. |
</span></span><span id="50" class="l"><a class="l" href="#50">50: </a><span class="php-comment"> * La solution retenu, provenant du site |
</span></span><span id="51" class="l"><a class="l" href="#51">51: </a><span class="php-comment"> * {@link http://www.lecoindunet.com/zone_php/scripts_utiles/remplacer-les-caracteres-accentues-dune-chaine-en-php-72 lecoindunet.com}, |
</span></span><span id="52" class="l"><a class="l" href="#52">52: </a><span class="php-comment"> * consiste en deux tableaux (caractères avec et sans accents) car cela permetra éventuellement |
</span></span><span id="53" class="l"><a class="l" href="#53">53: </a><span class="php-comment"> * de fournir des méthodes pour récupérer ces tableaux pour d'autres traitements. |
</span></span><span id="54" class="l"><a class="l" href="#54">54: </a><span class="php-comment"> * Une autre solution aurait été d'utiliser les entités HTML comme proposé par le site |
</span></span><span id="55" class="l"><a class="l" href="#55">55: </a><span class="php-comment"> * {@link http://www.weirdog.com/blog/php/supprimer-les-accents-des-caracteres-accentues.html weirdog.com}. |
</span></span><span id="56" class="l"><a class="l" href="#56">56: </a><span class="php-comment"> * |
</span></span><span id="57" class="l"><a class="l" href="#57">57: </a><span class="php-comment"> * @param String $chaine la chaine de caractères dans laquelle supprimer les accents. |
</span></span><span id="58" class="l"><a class="l" href="#58">58: </a><span class="php-comment"> * @param String $encodage le code d'encodage de la chaine si ce n'est pas de l'UTF-8. |
</span></span><span id="59" class="l"><a class="l" href="#59">59: </a><span class="php-comment"> * @return la chaine de caractères sans accent. |
</span></span><span id="60" class="l"><a class="l" href="#60">60: </a><span class="php-comment"> */</span> |
</span><span id="61" class="l"><a class="l" href="#61">61: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_supprimerAccents" href="#_supprimerAccents">supprimerAccents</a>(<span class="php-var">$chaine</span>, <span class="php-var">$encodage</span> = <span class="php-quote">'UTF-8'</span>) { |
</span><span id="62" class="l"><a class="l" href="#62">62: </a> <span class="php-keyword1">if</span> (<span class="php-var">$encodage</span> != <span class="php-quote">'UTF-8'</span>) { |
</span><span id="63" class="l"><a class="l" href="#63">63: </a> <span class="php-keyword2">mb_convert_variables</span>(<span class="php-var">$encodage</span>, <span class="php-quote">'UTF-8'</span>, self::<span class="php-var">$caracteres_accentues</span>, self::<span class="php-var">$caracteres_normaux</span>); |
</span><span id="64" class="l"><a class="l" href="#64">64: </a> } |
</span><span id="65" class="l"><a class="l" href="#65">65: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">str_replace</span>(self::<span class="php-var">$caracteres_accentues</span>, self::<span class="php-var">$caracteres_normaux</span>, <span class="php-var">$chaine</span>); |
</span><span id="66" class="l"><a class="l" href="#66">66: </a> } |
</span><span id="67" class="l"><a class="l" href="#67">67: </a>} |
</span><span id="68" class="l"><a class="l" href="#68">68: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/package-None.html |
---|
New file |
0,0 → 1,125 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>No package | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li class="active"><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li><a href="class-MonScript.html">MonScript</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li class="active"> |
<span>Package</span> </li> |
<li> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="package"> |
<h1>No package</h1> |
<table class="summary" id="classes"> |
<caption>Classes summary</caption> |
<tr> |
<td class="name"><a href="class-CacheFichier.html">CacheFichier</a></td> |
<td></td> |
</tr> |
<tr> |
<td class="name"><a href="class-CacheSqlite.html">CacheSqlite</a></td> |
<td></td> |
</tr> |
<tr> |
<td class="name"><a href="class-MonScript.html">MonScript</a></td> |
<td>Exemple de script utilisable avec le TBFramework. Pour le lancer, taper en ligne |
de commande, en vous plaçant dans le dossier /framework/exemple/scripts/ : |
<code>/opt/lampp/bin/php cli.php mon_script -a test</code></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Chaine.html |
---|
New file |
0,0 → 1,220 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Chaine | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li class="active"><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li class="active"><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Utilitaire.html" title="Summary of Utilitaire"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Chaine</h1> |
<div class="description"> |
<p>Classe fournissant des méthodes statiques de manipulation des chaînes de |
caractères (String).</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Utilitaire.html">Utilitaire</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Chaine.php 343 2011-06-09 14:59:36Z jpm $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Chaine.html#3-67" title="Go to source code">framework/utilitaires/Chaine.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="supprimerAccents" id="_supprimerAccents"> |
<td class="attributes"><code> |
public static |
la |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_supprimerAccents">#</a> |
<code><a href="source-class-Chaine.html#48-66" title="Go to source code">supprimerAccents</a>( <span>String <var>$chaine</var></span>, <span>String <var>$encodage</var> = <span class="php-quote">'UTF-8'</span></span> )</code> |
<div class="description short"> |
<p>Supprime ou remplace les accents d'une chaine en PHP. La solution retenu, |
provenant du site <a href="http://www.lecoindunet.com/zone_php/scripts_utiles/remplacer-les-caracteres-accentues-dune-chaine-en-php-72">lecoindunet.com</a>, consiste en deux tableaux (caractères avec et sans accents) |
car cela permetra éventuellement de fournir des méthodes pour récupérer ces |
tableaux pour d'autres traitements. Une autre solution aurait été d'utiliser |
les entités HTML comme proposé par le site <a href="http://www.weirdog.com/blog/php/supprimer-les-accents-des-caracteres-accentues.html">weirdog.com</a>.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Supprime ou remplace les accents d'une chaine en PHP. La solution retenu, |
provenant du site <a href="http://www.lecoindunet.com/zone_php/scripts_utiles/remplacer-les-caracteres-accentues-dune-chaine-en-php-72">lecoindunet.com</a>, consiste en deux tableaux (caractères avec et sans accents) |
car cela permetra éventuellement de fournir des méthodes pour récupérer ces |
tableaux pour d'autres traitements. Une autre solution aurait été d'utiliser |
les entités HTML comme proposé par le site <a href="http://www.weirdog.com/blog/php/supprimer-les-accents-des-caracteres-accentues.html">weirdog.com</a>.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$chaine</var></dt> |
<dd><code>String</code><br>$chaine la chaine de caractères dans laquelle supprimer les accents.</dd> |
<dt><var>$encodage</var></dt> |
<dd><code>String</code><br>$encodage le code d'encodage de la chaine si ce n'est pas de l'UTF-8.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>la</code><br>chaine de caractères sans accent.<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-RestServeur.html |
---|
New file |
0,0 → 1,865 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class RestServeur | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li class="active"><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class RestServeur</h1> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="GPL">v3 <http://www.gnu.org/licenses/gpl.txt></a><br> |
<b>License:</b> |
<a href="CECILL">v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt></a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Located at</b> <a href="source-class-RestServeur.html#42-666" title="Go to source code">framework/RestServeur.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="__construct" id="___construct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___construct">#</a> |
<code><a href="source-class-RestServeur.html#192-220" title="Go to source code">__construct</a>( )</code> |
<div class="description short"> |
<p>Analyse les données envoyées au serveur, enregistre la méthode HTTP |
utilisée pour appeler le serveur et parse l'url appelée pour trouver le |
service demandé.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Analyse les données envoyées au serveur, enregistre la méthode HTTP |
utilisée pour appeler le serveur et parse l'url appelée pour trouver le |
service demandé.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="chargerClasse" id="_chargerClasse"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_chargerClasse">#</a> |
<code><a href="source-class-RestServeur.html#364-382" title="Go to source code">chargerClasse</a>( <span>string <var>$classe</var></span> )</code> |
<div class="description short"> |
<p>La méthode __autoload() charge dynamiquement les classes trouvées dans le |
code. Cette fonction est appelée par php5 quand il trouve une instanciation de |
classe dans le code.</p> |
</div> |
<div class="description detailed hidden"> |
<p>La méthode __autoload() charge dynamiquement les classes trouvées dans le |
code. Cette fonction est appelée par php5 quand il trouve une instanciation de |
classe dans le code.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$classe</var></dt> |
<dd><code>string</code><br>le nom de la classe appelée.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code></code><br>le fichier contenant la classe doit être inclu par la fonction.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="executer" id="_executer"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_executer">#</a> |
<code><a href="source-class-RestServeur.html#384-419" title="Go to source code">executer</a>( )</code> |
<div class="description short"> |
<p>Execute la requête.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Execute la requête.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="envoyerEnteteStatutHttp" id="_envoyerEnteteStatutHttp"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_envoyerEnteteStatutHttp">#</a> |
<code><a href="source-class-RestServeur.html#569-579" title="Go to source code">envoyerEnteteStatutHttp</a>( <span>integer <var>$code</var></span> )</code> |
<div class="description short"> |
<p>Envoyer un entête HTTP (version 1.0) de statut. Il remplacera |
systématiquement tout entête HTTP de statut précédement envoyé.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Envoyer un entête HTTP (version 1.0) de statut. Il remplacera |
systématiquement tout entête HTTP de statut précédement envoyé.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$code</var></dt> |
<dd><code>integer</code><br>$code entier indiquant le code du statut de l'entête HTTP à envoyer.</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="gererErreurs" id="_gererErreurs"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_gererErreurs">#</a> |
<code><a href="source-class-RestServeur.html#601-642" title="Go to source code">gererErreurs</a>( )</code> |
<div class="description short"> |
<p>Si des exceptions ou des erreurs sont soulevées par le serveur ou les |
services, elles sont gérées par cette méthode. Si nous avec des erreurs d'un |
type différent d'E_USER_NOTICE (réservé au débogage), elle sont renvoyées |
sur la sortie standard (via echo). Si seulement des erreurs de type |
E_USER_NOTICE, sont présentes, elle sont envoyées en fonction du contenu du |
paramètre de config "debogage_mode" :<br /> |
- Debug::MODE_ECHO : les messages sont affichés en utilisant echo au moment où |
ils sont déclenchés dans le code.<br /> |
- Debug::MODE_NOTICE : les message sont stockés par le gestionnaire d'exception |
sous forme d'erreur de type<br /> |
E_USER_NOTICE et sont renvoyés sur la sortie standard à la fin de l'execution |
du programme (via echo).<br /> |
- Debug::MODE_ENTETE_HTTP : les message sont stockés par le gestionnaire |
d'exception sous forme d'erreur de type<br /> |
E_USER_NOTICE et sont renvoyés dans un entête HTTP (X_REST_DEBOGAGE_MESSAGES) |
à la fin de l'execution du programme.<br /> |
- Autre valeur : les messages sont formatés puis retournés par la fonction de |
débogage (à vous de les afficher).</p> |
</div> |
<div class="description detailed hidden"> |
<p>Si des exceptions ou des erreurs sont soulevées par le serveur ou les |
services, elles sont gérées par cette méthode. Si nous avec des erreurs d'un |
type différent d'E_USER_NOTICE (réservé au débogage), elle sont renvoyées |
sur la sortie standard (via echo). Si seulement des erreurs de type |
E_USER_NOTICE, sont présentes, elle sont envoyées en fonction du contenu du |
paramètre de config "debogage_mode" : - Debug::MODE_ECHO : les messages sont |
affichés en utilisant echo au moment où ils sont déclenchés dans le code. - |
Debug::MODE_NOTICE : les message sont stockés par le gestionnaire d'exception |
sous forme d'erreur de type E_USER_NOTICE et sont renvoyés sur la sortie |
standard à la fin de l'execution du programme (via echo). - |
Debug::MODE_ENTETE_HTTP : les message sont stockés par le gestionnaire |
d'exception sous forme d'erreur de type E_USER_NOTICE et sont renvoyés dans un |
entête HTTP (X_REST_DEBOGAGE_MESSAGES) à la fin de l'execution du programme. - |
Autre valeur : les messages sont formatés puis retournés par la fonction de |
débogage (à vous de les afficher).</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="ajouterMessage" id="_ajouterMessage"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_ajouterMessage">#</a> |
<code><a href="source-class-RestServeur.html#645-654" title="Go to source code">ajouterMessage</a>( <span>string <var>$message</var></span> )</code> |
<div class="description short"> |
<p>Permet d'ajouter un message d'erreur ou d'avertissement qui sera envoyé au |
client. Le message doit être au format texte et en UTF-8.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Permet d'ajouter un message d'erreur ou d'avertissement qui sera envoyé au |
client. Le message doit être au format texte et en UTF-8.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$message</var></dt> |
<dd><code>string</code><br>$message le message à envoyer.</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="constants"> |
<caption>Constants summary</caption> |
<tr data-order="METHODE_GET" id="METHODE_GET"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#44-45" title="Go to source code"><b>METHODE_GET</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'consulter'</span></code></td> |
<td class="description"><div> |
<a href="#METHODE_GET" class="anchor">#</a> |
<div class="description short"> |
<p>Nom de la méthode appelée dans un service pour éxécuter une requête de |
type GET.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Nom de la méthode appelée dans un service pour éxécuter une requête de |
type GET.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="METHODE_POST" id="METHODE_POST"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#47-48" title="Go to source code"><b>METHODE_POST</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'modifier'</span></code></td> |
<td class="description"><div> |
<a href="#METHODE_POST" class="anchor">#</a> |
<div class="description short"> |
<p>Nom de la méthode appelée dans un service pour éxécuter une requête de |
type POST.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Nom de la méthode appelée dans un service pour éxécuter une requête de |
type POST.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="METHODE_DELETE" id="METHODE_DELETE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#50-51" title="Go to source code"><b>METHODE_DELETE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'supprimer'</span></code></td> |
<td class="description"><div> |
<a href="#METHODE_DELETE" class="anchor">#</a> |
<div class="description short"> |
<p>Nom de la méthode appelée dans un service pour éxécuter une requête de |
type DELETE.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Nom de la méthode appelée dans un service pour éxécuter une requête de |
type DELETE.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="METHODE_PUT" id="METHODE_PUT"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#53-54" title="Go to source code"><b>METHODE_PUT</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'ajouter'</span></code></td> |
<td class="description"><div> |
<a href="#METHODE_PUT" class="anchor">#</a> |
<div class="description short"> |
<p>Nom de la méthode appelée dans un service pour éxécuter une requête de |
type PUT.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Nom de la méthode appelée dans un service pour éxécuter une requête de |
type PUT.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="HTTP_CODE_OK" id="HTTP_CODE_OK"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#56-59" title="Go to source code"><b>HTTP_CODE_OK</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'200'</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_CODE_OK" class="anchor">#</a> |
<div class="description short"> |
<p>Code HTTP 200 indiquant le succès de l'accès à un service web par la |
méthode GET. L'utiliser lors d'une requète de type GET (consulter) pour |
indiquer le succès de l'opération. Sera renvoyée par défaut par PHP.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Code HTTP 200 indiquant le succès de l'accès à un service web par la |
méthode GET. L'utiliser lors d'une requète de type GET (consulter) pour |
indiquer le succès de l'opération. Sera renvoyée par défaut par PHP.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="HTTP_CODE_CREATION_OK" id="HTTP_CODE_CREATION_OK"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#61-63" title="Go to source code"><b>HTTP_CODE_CREATION_OK</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'201'</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_CODE_CREATION_OK" class="anchor">#</a> |
<div class="description short"> |
<p>Code HTTP 201 indiquant que l'accès à un service web est un succès et que |
la ressource a été créée ou modifié. L'utiliser lors d'une requète de type |
PUT (ajouter) ou POST (modifier) pour indiquer le succès de l'opération.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Code HTTP 201 indiquant que l'accès à un service web est un succès et que |
la ressource a été créée ou modifié. L'utiliser lors d'une requète de type |
PUT (ajouter) ou POST (modifier) pour indiquer le succès de l'opération.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="HTTP_CODE_SUPPRESSION_OK" id="HTTP_CODE_SUPPRESSION_OK"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#65-68" title="Go to source code"><b>HTTP_CODE_SUPPRESSION_OK</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'204'</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_CODE_SUPPRESSION_OK" class="anchor">#</a> |
<div class="description short"> |
<p>Code HTTP 204 indique que l'accès à un service web est un succès et qu'il |
n'y a pas de contenu à renvoyer. L'utiliser lors d'une requète de type DELETE |
(supprimer) pour indiquer le succès de l'opération si aucun contenu (status) |
ne doit être renvoyé, sinon utiliser 200 OK.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Code HTTP 204 indique que l'accès à un service web est un succès et qu'il |
n'y a pas de contenu à renvoyer. L'utiliser lors d'une requète de type DELETE |
(supprimer) pour indiquer le succès de l'opération si aucun contenu (status) |
ne doit être renvoyé, sinon utiliser 200 OK.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="HTTP_CODE_MAUVAISE_REQUETE" id="HTTP_CODE_MAUVAISE_REQUETE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#70-73" title="Go to source code"><b>HTTP_CODE_MAUVAISE_REQUETE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'400'</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_CODE_MAUVAISE_REQUETE" class="anchor">#</a> |
<div class="description short"> |
<p>Code HTTP 400 indique que les paramètres envoyés au service contiennent des |
erreurs. L'utiliser pour indiquer l'échec de l'accès au service. La réponse |
pourra contenir un message expliquant la source de l'erreur.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Code HTTP 400 indique que les paramètres envoyés au service contiennent des |
erreurs. L'utiliser pour indiquer l'échec de l'accès au service. La réponse |
pourra contenir un message expliquant la source de l'erreur.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="HTTP_CODE_ACCES_NON_AUTORISE" id="HTTP_CODE_ACCES_NON_AUTORISE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#75-77" title="Go to source code"><b>HTTP_CODE_ACCES_NON_AUTORISE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'401'</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_CODE_ACCES_NON_AUTORISE" class="anchor">#</a> |
<div class="description short"> |
<p>Code HTTP 401 indiquant que l'accès à un service web est refusé car |
l'authentification (obligatoire) a échoué pour accéder à la ressource.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Code HTTP 401 indiquant que l'accès à un service web est refusé car |
l'authentification (obligatoire) a échoué pour accéder à la ressource.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="HTTP_CODE_RESSOURCE_INTROUVABLE" id="HTTP_CODE_RESSOURCE_INTROUVABLE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#79-80" title="Go to source code"><b>HTTP_CODE_RESSOURCE_INTROUVABLE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'404'</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_CODE_RESSOURCE_INTROUVABLE" class="anchor">#</a> |
<div class="description short"> |
<p>Code HTTP 404 indiquant que la ressource indiquée par l'url est |
introuvable.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Code HTTP 404 indiquant que la ressource indiquée par l'url est |
introuvable.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="HTTP_CODE_METHODE_NON_AUTORISE" id="HTTP_CODE_METHODE_NON_AUTORISE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#82-85" title="Go to source code"><b>HTTP_CODE_METHODE_NON_AUTORISE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'405'</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_CODE_METHODE_NON_AUTORISE" class="anchor">#</a> |
<div class="description short"> |
<p>Code HTTP 405 indiquant soit :<br /> |
- que le service web ne possède pas d'accès la ressource correspondant à la |
méthode HTTP employée.<br /> |
- que la méthode HTTP enployée n'est pas en accord avec la ressource indiquée |
par l'url.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Code HTTP 405 indiquant soit : - que le service web ne possède pas d'accès |
la ressource correspondant à la méthode HTTP employée. - que la méthode HTTP |
enployée n'est pas en accord avec la ressource indiquée par l'url.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="HTTP_CODE_CONFLIT" id="HTTP_CODE_CONFLIT"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#87-90" title="Go to source code"><b>HTTP_CODE_CONFLIT</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'409'</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_CODE_CONFLIT" class="anchor">#</a> |
<div class="description short"> |
<p>Code d'erreur HTTP 409 indiquant qu'un conflit est survenu vis à vis de la |
ressource. Par exemple, essayer de créer deux fois la même ressource ou bien |
tenter de modifier une ressource qui a été modifiée par ailleurs.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Code d'erreur HTTP 409 indiquant qu'un conflit est survenu vis à vis de la |
ressource. Par exemple, essayer de créer deux fois la même ressource ou bien |
tenter de modifier une ressource qui a été modifiée par ailleurs.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="HTTP_CODE_CONTENU_REQUIS" id="HTTP_CODE_CONTENU_REQUIS"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#92-93" title="Go to source code"><b>HTTP_CODE_CONTENU_REQUIS</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'411'</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_CODE_CONTENU_REQUIS" class="anchor">#</a> |
<div class="description short"> |
<p>Code HTTP 411 indiquant que des paramètres passés dans le contenu de la |
requête sont nécessaires au service.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Code HTTP 411 indiquant que des paramètres passés dans le contenu de la |
requête sont nécessaires au service.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="HTTP_CODE_ERREUR" id="HTTP_CODE_ERREUR"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#95-97" title="Go to source code"><b>HTTP_CODE_ERREUR</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'500'</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_CODE_ERREUR" class="anchor">#</a> |
<div class="description short"> |
<p>Code d'erreur HTTP 500 Internal Server Error. L'utiliser quand le serveur ou |
un service soulève une erreur ou une exception.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Code d'erreur HTTP 500 Internal Server Error. L'utiliser quand le serveur ou |
un service soulève une erreur ou une exception.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="MOTIF_API_VERSION" id="MOTIF_API_VERSION"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#99-100" title="Go to source code"><b>MOTIF_API_VERSION</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'/^[0-9]+(?:[.][0-9]+)*$/'</span></code></td> |
<td class="description"><div> |
<a href="#MOTIF_API_VERSION" class="anchor">#</a> |
<div class="description short"> |
<p>Motif de l'epression régulière vérfiant la version de l'API.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Motif de l'epression régulière vérfiant la version de l'API.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="MOTIF_SERVICE_NOM" id="MOTIF_SERVICE_NOM"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestServeur.html#102-103" title="Go to source code"><b>MOTIF_SERVICE_NOM</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'/^[a-z0-9]+(?:[-][a-z0-9]+)*$/'</span></code></td> |
<td class="description"><div> |
<a href="#MOTIF_SERVICE_NOM" class="anchor">#</a> |
<div class="description short"> |
<p>Motif de l'epression régulière vérfiant le nom du service.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Motif de l'epression régulière vérfiant le nom du service.</p> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Controleur.html |
---|
New file |
0,0 → 1,275 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Controleur.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li class="active"><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Controleur.html" title="Summary of Controleur"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe Controleur, coeur d'une application, c'est normalement la seule classe d'une application |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * qui devrait être appelée de l'extérieur. |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * Elle est abstraite donc doit obligatoirement être étendue. |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @category php 5.2 |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @package Framework |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @author Aurélien PERONNET <aurelien@tela-botanica.org> |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @version $Id: Controleur.php 415 2012-04-04 09:05:55Z jpm $ |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> * |
</span></span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-comment"> */</span> |
</span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-keyword1">abstract</span> <span class="php-keyword1">class</span> <a id="Controleur" href="#Controleur">Controleur</a> { |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> <span class="php-comment">/** Variable statique indiquant que les tableaux _GET et _POST ont déjà été encodé au format de l'appli. */</span> |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$encodage" href="#$encodage">$encodage</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> <span class="php-comment">/** Chemin de base vers les classes métiers de la partie Modèle de l'application. */</span> |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$base_chemin_modele" href="#$base_chemin_modele">$base_chemin_modele</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> <span class="php-comment">/** Chemin de base vers les fichiers squelette de la partie Vue de l'application. */</span> |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$base_chemin_squelette" href="#$base_chemin_squelette">$base_chemin_squelette</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> <span class="php-comment">/** Chemin de base vers les classes controleurs de la partie Controleur de l'application. */</span> |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$base_chemin_controleur" href="#$base_chemin_controleur">$base_chemin_controleur</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> <span class="php-comment">/** Objet URL contant l'url de la base de l'application. */</span> |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$base_url_applicaton" href="#$base_url_applicaton">$base_url_applicaton</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-comment">/** Tableau des noms des paramètres à définir dans le fichier de config car obligatoirement nécessaire à cette classe.*/</span> |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$parametres_obligatoires" href="#$parametres_obligatoires">$parametres_obligatoires</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'chemin_modeles'</span>, <span class="php-quote">'chemin_squelettes'</span>, <span class="php-quote">'chemin_controleurs'</span>, <span class="php-quote">'base_url_application'</span>); |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> <span class="php-comment">/** |
</span></span><span id="39" class="l"><a class="l" href="#39"> 39: </a><span class="php-comment"> * Constructeur par défaut |
</span></span><span id="40" class="l"><a class="l" href="#40"> 40: </a><span class="php-comment"> */</span> |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>() { |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> Config::verifierPresenceParametres(<span class="php-var">$this</span>->parametres_obligatoires); |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> <span class="php-var">$this</span>->base_chemin_modele = Config::get(<span class="php-quote">'chemin_modeles'</span>); |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> <span class="php-keyword1">if</span> (Registre::existe(<span class="php-quote">'tbf.chemin_modeles'</span>)) { |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> <span class="php-var">$this</span>->base_chemin_modele = Registre::get(<span class="php-quote">'tbf.chemin_modeles'</span>); |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> } |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-var">$this</span>->base_chemin_squelette = Config::get(<span class="php-quote">'chemin_squelettes'</span>); |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> <span class="php-keyword1">if</span> (Registre::existe(<span class="php-quote">'tbf.chemin_squelettes'</span>)) { |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> <span class="php-var">$this</span>->base_chemin_squelette = Registre::get(<span class="php-quote">'tbf.chemin_squelettes'</span>); |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> } |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-var">$this</span>->base_chemin_controleur = Config::get(<span class="php-quote">'chemin_controleurs'</span>); |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> <span class="php-keyword1">if</span> (Registre::existe(<span class="php-quote">'tbf.chemin_controleurs'</span>)) { |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> <span class="php-var">$this</span>->base_chemin_squelette = Registre::get(<span class="php-quote">'tbf.chemin_controleurs'</span>); |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> } |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-var">$this</span>->base_url_application = <span class="php-keyword1">new</span> Url(Config::get(<span class="php-quote">'base_url_application'</span>)); |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> } |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> <span class="php-comment">/** |
</span></span><span id="63" class="l"><a class="l" href="#63"> 63: </a><span class="php-comment"> * Permet de récupérer le chemin vers les squelettes. |
</span></span><span id="64" class="l"><a class="l" href="#64"> 64: </a><span class="php-comment"> * |
</span></span><span id="65" class="l"><a class="l" href="#65"> 65: </a><span class="php-comment"> * @return String $chemin chemin vers les squelettes |
</span></span><span id="66" class="l"><a class="l" href="#66"> 66: </a><span class="php-comment"> */</span> |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getCheminSquelette" href="#_getCheminSquelette">getCheminSquelette</a>() { |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->base_chemin_squelette; |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> } |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> <span class="php-comment">/** |
</span></span><span id="72" class="l"><a class="l" href="#72"> 72: </a><span class="php-comment"> * Permet de définir dynamiquement le chemin vers les squelettes. |
</span></span><span id="73" class="l"><a class="l" href="#73"> 73: </a><span class="php-comment"> * |
</span></span><span id="74" class="l"><a class="l" href="#74"> 74: </a><span class="php-comment"> * @param String $chemin chemin vers les squelettes |
</span></span><span id="75" class="l"><a class="l" href="#75"> 75: </a><span class="php-comment"> */</span> |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_setCheminSquelette" href="#_setCheminSquelette">setCheminSquelette</a>(<span class="php-var">$chemin</span>) { |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> <span class="php-var">$this</span>->base_chemin_squelette = <span class="php-var">$chemin</span>; |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> } |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> <span class="php-comment">/** |
</span></span><span id="81" class="l"><a class="l" href="#81"> 81: </a><span class="php-comment"> * Charge un modele donné et le rend disponible sous la forme $this->nom_modele |
</span></span><span id="82" class="l"><a class="l" href="#82"> 82: </a><span class="php-comment"> * |
</span></span><span id="83" class="l"><a class="l" href="#83"> 83: </a><span class="php-comment"> * @param string $nom_modele le nom du modèle à charger |
</span></span><span id="84" class="l"><a class="l" href="#84"> 84: </a><span class="php-comment"> * |
</span></span><span id="85" class="l"><a class="l" href="#85"> 85: </a><span class="php-comment"> * @return boolean false si le chargement a échoué, sinon true. |
</span></span><span id="86" class="l"><a class="l" href="#86"> 86: </a><span class="php-comment"> */</span> |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_chargerModele" href="#_chargerModele">chargerModele</a>(<span class="php-var">$nom_modele</span>) { |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> <span class="php-var">$sortie</span> = <span class="php-keyword1">true</span>; |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>-><span class="php-var">$nom_modele</span>)) { |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> <span class="php-var">$modele</span> = <span class="php-var">$this</span>->getModele(<span class="php-var">$nom_modele</span>); |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-keyword1">if</span> (<span class="php-var">$modele</span> !== <span class="php-keyword1">false</span>) { |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-var">$this</span>-><span class="php-var">$nom_modele</span> = <span class="php-keyword1">new</span> <span class="php-var">$nom_modele</span>; |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> } <span class="php-keyword1">else</span> { |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> <span class="php-var">$sortie</span> = <span class="php-keyword1">false</span>; |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> } |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> } |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-keyword1">return</span> <span class="php-var">$sortie</span>; |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> } |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> <span class="php-comment">/** |
</span></span><span id="101" class="l"><a class="l" href="#101">101: </a><span class="php-comment"> * Retourne un modele donné |
</span></span><span id="102" class="l"><a class="l" href="#102">102: </a><span class="php-comment"> * |
</span></span><span id="103" class="l"><a class="l" href="#103">103: </a><span class="php-comment"> * @param string $nom_modele le nom du fichier modèle à charger sans son extension |
</span></span><span id="104" class="l"><a class="l" href="#104">104: </a><span class="php-comment"> * @param String $ext l'extension du fichier du modèle (par défaut : ".php") |
</span></span><span id="105" class="l"><a class="l" href="#105">105: </a><span class="php-comment"> * |
</span></span><span id="106" class="l"><a class="l" href="#106">106: </a><span class="php-comment"> * @return mixed false si le chargement a échoué, sinon l'objet du modèle demandé. |
</span></span><span id="107" class="l"><a class="l" href="#107">107: </a><span class="php-comment"> */</span> |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getModele" href="#_getModele">getModele</a>(<span class="php-var">$nom_modele</span>, <span class="php-var">$ext</span> = <span class="php-quote">'.php'</span>) { |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> <span class="php-var">$sortie</span> = <span class="php-keyword1">false</span>; |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> <span class="php-var">$chemin_modele</span> = <span class="php-var">$this</span>->registre->get(<span class="php-quote">'base_chemin_modele'</span>).<span class="php-var">$nom_modele</span>.<span class="php-var">$ext</span>; |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">file_exists</span>(<span class="php-var">$chemin_modele</span>)) { |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-keyword1">include_once</span> <span class="php-var">$chemin_modele</span>; |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">class_exists</span>(<span class="php-var">$nom_modele</span>)) { |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> <span class="php-var">$sortie</span> = <span class="php-keyword1">new</span> <span class="php-var">$nom_modele</span>; |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> } |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> } |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-keyword1">return</span> <span class="php-var">$sortie</span>; |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> } |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-comment">/** |
</span></span><span id="122" class="l"><a class="l" href="#122">122: </a><span class="php-comment"> * Fonction prenant en paramètre le nom d'un squelette et un tableau associatif de données, |
</span></span><span id="123" class="l"><a class="l" href="#123">123: </a><span class="php-comment"> * en extrait les variables, charge le squelette et retourne le résultat des deux combinés. |
</span></span><span id="124" class="l"><a class="l" href="#124">124: </a><span class="php-comment"> * |
</span></span><span id="125" class="l"><a class="l" href="#125">125: </a><span class="php-comment"> * @param String $nom_squelette le nom du squelette sans son extension si elle vaut ".tpl.html" |
</span></span><span id="126" class="l"><a class="l" href="#126">126: </a><span class="php-comment"> * @param Array $donnees un tableau associatif contenant les variables a injecter dans la vue |
</span></span><span id="127" class="l"><a class="l" href="#127">127: </a><span class="php-comment"> * @since 0.4 suppression du paramètre 'ext' => le mettre directement dans le nom du squelette |
</span></span><span id="128" class="l"><a class="l" href="#128">128: </a><span class="php-comment"> * |
</span></span><span id="129" class="l"><a class="l" href="#129">129: </a><span class="php-comment"> * @return boolean false si la vue n'existe pas, sinon la chaine résultat. |
</span></span><span id="130" class="l"><a class="l" href="#130">130: </a><span class="php-comment"> */</span> |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getVue" href="#_getVue">getVue</a>(<span class="php-var">$nom_squelette</span>, <span class="php-var">$donnees</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> <span class="php-var">$donnees</span> = <span class="php-var">$this</span>->preTraiterDonnees(<span class="php-var">$donnees</span>); |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> <span class="php-var">$chemin_squelette</span> = <span class="php-var">$this</span>->base_chemin_squelette.<span class="php-var">$nom_squelette</span>.<span class="php-quote">'.tpl.html'</span>; |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">file_exists</span>(<span class="php-var">$chemin_squelette</span>) === <span class="php-keyword1">false</span>) { |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> <span class="php-var">$chemin_squelette</span> = <span class="php-var">$this</span>->base_chemin_squelette.<span class="php-var">$nom_squelette</span>; |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> } |
</span><span id="137" class="l"><a class="l" href="#137">137: </a> <span class="php-var">$sortie</span> = SquelettePhp::analyser(<span class="php-var">$chemin_squelette</span>, <span class="php-var">$donnees</span>); |
</span><span id="138" class="l"><a class="l" href="#138">138: </a> |
</span><span id="139" class="l"><a class="l" href="#139">139: </a> <span class="php-keyword1">return</span> <span class="php-var">$sortie</span>; |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> } |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> <span class="php-comment">/** |
</span></span><span id="143" class="l"><a class="l" href="#143">143: </a><span class="php-comment"> * Fonction prenant en paramètre un tableau de données et effectuant un traitement dessus. |
</span></span><span id="144" class="l"><a class="l" href="#144">144: </a><span class="php-comment"> * Cette fonction est à surcharger dans les classes filles pour automatiser un traitement |
</span></span><span id="145" class="l"><a class="l" href="#145">145: </a><span class="php-comment"> * avant chaque chargement de vue. |
</span></span><span id="146" class="l"><a class="l" href="#146">146: </a><span class="php-comment"> * |
</span></span><span id="147" class="l"><a class="l" href="#147">147: </a><span class="php-comment"> * @param Array $donnees Le tableau de données à traiter |
</span></span><span id="148" class="l"><a class="l" href="#148">148: </a><span class="php-comment"> * |
</span></span><span id="149" class="l"><a class="l" href="#149">149: </a><span class="php-comment"> * @return Array $donnees Le tableau de données traité |
</span></span><span id="150" class="l"><a class="l" href="#150">150: </a><span class="php-comment"> */</span> |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_preTraiterDonnees" href="#_preTraiterDonnees">preTraiterDonnees</a>(&<span class="php-var">$donnees</span>) { |
</span><span id="152" class="l"><a class="l" href="#152">152: </a> <span class="php-keyword1">return</span> <span class="php-var">$donnees</span>; |
</span><span id="153" class="l"><a class="l" href="#153">153: </a> } |
</span><span id="154" class="l"><a class="l" href="#154">154: </a>} |
</span><span id="155" class="l"><a class="l" href="#155">155: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/tree.html |
---|
New file |
0,0 → 1,371 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Tree | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonScript.html">MonScript</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
<h3>Exceptions</h3> |
<ul> |
<li><a href="class-Exception.html">Exception</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<span>Package</span> </li> |
<li> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li class="active"> |
<span>Tree</span> </li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content"> |
<h1>Tree</h1> |
<h3>Classes</h3> |
<div class="tree"> |
<ul> |
<li><div class="notlast"><a href="class-Bdd.html"><span>Bdd</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Cache.html"><span>Cache</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-CacheFichier.html"><span>CacheFichier</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-CacheSimple.html"><span>CacheSimple</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-CacheSqlite.html"><span>CacheSqlite</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Chaine.html"><span>Chaine</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Chronometre.html"><span>Chronometre</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Cli.html"><span>Cli</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Config.html"><span>Config</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Controleur.html"><span>Controleur</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Debug.html"><span>Debug</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Encodage.html"><span>Encodage</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Fichier.html"><span>Fichier</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Framework.html"><span>Framework</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-GestionnaireException.html"><span>GestionnaireException</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-I18n.html"><span>I18n</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Log.html"><span>Log</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Pattern.html"><span>Pattern</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Registre.html"><span>Registre</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-RestClient.html"><span>RestClient</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-RestServeur.html"><span>RestServeur</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-RestService.html"><span>RestService</span></a> |
</div> |
<ul> |
<li><div class="notlast"><a href="class-MonService.html"><span>MonService</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-ServiceCacheFichier.html"><span>ServiceCacheFichier</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-ServiceCacheSimple.html"><span>ServiceCacheSimple</span></a> |
</div> |
</li> |
<li class="last"><div class="last"><a href="class-ServiceCacheSqlite.html"><span>ServiceCacheSqlite</span></a> |
</div> |
</ul></li> |
<li><div class="notlast"><a href="class-Script.html"><span>Script</span></a> |
</div> |
<ul> |
<li class="last"><div class="last"><a href="class-MonScript.html"><span>MonScript</span></a> |
</div> |
</ul></li> |
<li><div class="notlast"><a href="class-SquelettePhp.html"><span>SquelettePhp</span></a> |
</div> |
</li> |
<li><div class="notlast"><a href="class-Tableau.html"><span>Tableau</span></a> |
</div> |
</li> |
<li class="last"><div class="last"><a href="class-Url.html"><span>Url</span></a> |
</div> |
</li> |
</ul> |
</div> |
<h3>Exceptions</h3> |
<div class="tree"> |
<ul> |
<li class="last"><div class="last"><a href="class-Exception.html"><span>Exception</span></a> |
</div> |
</li> |
</ul> |
</div> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-RestService.html |
---|
New file |
0,0 → 1,271 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/RestService.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li class="active"><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-RestService.html" title="Summary of RestService"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">/** |
</span></span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment"> * Classe principale gérant les services. |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Paramètres liés dans config.ini : |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * - serveur.baseURL |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * Encodage en entrée : utf8 |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * Encodage en sortie : utf8 |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @category Php 5.2 |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @package Framework |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt> |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt> |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> * @version $Id: RestService.php 417 2012-05-15 09:24:12Z jpm $ |
</span></span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-comment"> */</span> |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a><span class="php-keyword1">abstract</span> <span class="php-keyword1">class</span> <a id="RestService" href="#RestService">RestService</a> { |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> <span class="php-comment">/** Objet de connection à la base de données. |
</span></span><span id="23" class="l"><a class="l" href="#23"> 23: </a><span class="php-comment"> * @deprecated Utiliser la methode getBdd(). |
</span></span><span id="24" class="l"><a class="l" href="#24"> 24: </a><span class="php-comment"> * @see getBdd() |
</span></span><span id="25" class="l"><a class="l" href="#25"> 25: </a><span class="php-comment"> */</span> |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$bdd" href="#$bdd">$bdd</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-comment">/** Objet Rest Client. */</span> |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$RestClient" href="#$RestClient">$RestClient</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> <span class="php-comment">/** Indique si oui (true) ou non (false), on veut utiliser les paramètres brutes. */</span> |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$utilisationParametresBruts" href="#$utilisationParametresBruts">$utilisationParametresBruts</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>(<span class="php-var">$config</span>) { |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-var">$this</span>->config = <span class="php-var">$config</span>; |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> <span class="php-var">$this</span>->bdd = <span class="php-keyword1">new</span> Bdd(); |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> } |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_initialiser" href="#_initialiser">initialiser</a>() { |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> } |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> <span class="php-comment">/** |
</span></span><span id="44" class="l"><a class="l" href="#44"> 44: </a><span class="php-comment"> * Méthode de connection à la base de données sur demande. |
</span></span><span id="45" class="l"><a class="l" href="#45"> 45: </a><span class="php-comment"> * Tous les services web n'ont pas besoin de s'y connecter. |
</span></span><span id="46" class="l"><a class="l" href="#46"> 46: </a><span class="php-comment"> */</span> |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getBdd" href="#_getBdd">getBdd</a>() { |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-keyword1">if</span> (! <span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->bdd)) { |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-var">$this</span>->bdd = <span class="php-keyword1">new</span> Bdd(); |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> } |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->bdd; |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> } |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-comment">/** |
</span></span><span id="55" class="l"><a class="l" href="#55"> 55: </a><span class="php-comment"> * Méthode permettant de faire appel à un client REST en fonction des besoins du service. |
</span></span><span id="56" class="l"><a class="l" href="#56"> 56: </a><span class="php-comment"> */</span> |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getRestClient" href="#_getRestClient">getRestClient</a>() { |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> <span class="php-keyword1">if</span> (! <span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->RestClient)) { |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-var">$this</span>->RestClient = <span class="php-keyword1">new</span> RestClient(); |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> } |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->RestClient; |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> } |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-comment">/** |
</span></span><span id="65" class="l"><a class="l" href="#65"> 65: </a><span class="php-comment"> * Méthode permettant de savoir si le service veut utiliser des paramètres bruts (issu de la QueryString) |
</span></span><span id="66" class="l"><a class="l" href="#66"> 66: </a><span class="php-comment"> * ou pas (issu de $_GET). |
</span></span><span id="67" class="l"><a class="l" href="#67"> 67: </a><span class="php-comment"> */</span> |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_utiliserParametresBruts" href="#_utiliserParametresBruts">utiliserParametresBruts</a>() { |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->utilisationParametresBruts; |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> } |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> <span class="php-comment">/** |
</span></span><span id="73" class="l"><a class="l" href="#73"> 73: </a><span class="php-comment"> * Permet d'ajouter un message d'erreur ou d'avertissement qui sera envoyé au client. |
</span></span><span id="74" class="l"><a class="l" href="#74"> 74: </a><span class="php-comment"> * Le message doit être au format texte et en UTF-8. |
</span></span><span id="75" class="l"><a class="l" href="#75"> 75: </a><span class="php-comment"> * @param string $message le message à envoyer. |
</span></span><span id="76" class="l"><a class="l" href="#76"> 76: </a><span class="php-comment"> */</span> |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_ajouterMessage" href="#_ajouterMessage">ajouterMessage</a>(<span class="php-var">$message</span>) { |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> RestServeur::ajouterMessage(<span class="php-var">$message</span>); |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> } |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> <span class="php-comment">/** |
</span></span><span id="82" class="l"><a class="l" href="#82"> 82: </a><span class="php-comment"> * Méthode appelée lors d'une requête HTTP de type GET. |
</span></span><span id="83" class="l"><a class="l" href="#83"> 83: </a><span class="php-comment"> * |
</span></span><span id="84" class="l"><a class="l" href="#84"> 84: </a><span class="php-comment"> * Si la consultation est un succès, le code statut HTTP retourné sera 200. Dans tous les autres cas, |
</span></span><span id="85" class="l"><a class="l" href="#85"> 85: </a><span class="php-comment"> * la méthode devra retourner le code statut HTTP adéquate. |
</span></span><span id="86" class="l"><a class="l" href="#86"> 86: </a><span class="php-comment"> * |
</span></span><span id="87" class="l"><a class="l" href="#87"> 87: </a><span class="php-comment"> * @param array Morceaux de l'url servant à préciser la ressource concerné pour le service demandé. |
</span></span><span id="88" class="l"><a class="l" href="#88"> 88: </a><span class="php-comment"> * @param array Partie de l'url situé après le '?' servant à paramétrer le service demandé. |
</span></span><span id="89" class="l"><a class="l" href="#89"> 89: </a><span class="php-comment"> * @return string une chaine indiquant le succès de l'opération et les données demandées. |
</span></span><span id="90" class="l"><a class="l" href="#90"> 90: </a><span class="php-comment"> */</span> |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_consulter" href="#_consulter">consulter</a>(<span class="php-var">$ressources</span>, <span class="php-var">$parametres</span>) { |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> RestServeur::envoyerEnteteStatutHttp(RestServeur::HTTP_CODE_METHODE_NON_AUTORISE); |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> RestServeur::ajouterMessage(<span class="php-quote">"Le service '"</span>.<span class="php-keyword2">get_class</span>(<span class="php-var">$this</span>).<span class="php-quote">"' n'autorise pas la consultation."</span>); |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> } |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> <span class="php-comment">/** |
</span></span><span id="97" class="l"><a class="l" href="#97"> 97: </a><span class="php-comment"> * Méthode appelée lors d'une requête HTTP de type POST. |
</span></span><span id="98" class="l"><a class="l" href="#98"> 98: </a><span class="php-comment"> * |
</span></span><span id="99" class="l"><a class="l" href="#99"> 99: </a><span class="php-comment"> * La ressource à modifier est indiquée via l'url. Les données devant servir à la mise à jours sont passées dans le corps |
</span></span><span id="100" class="l"><a class="l" href="#100">100: </a><span class="php-comment"> * de la requête. |
</span></span><span id="101" class="l"><a class="l" href="#101">101: </a><span class="php-comment"> * Si la modification est un succès, la méthode devra retourner "true" et le code statut HTTP retourné sera 201. |
</span></span><span id="102" class="l"><a class="l" href="#102">102: </a><span class="php-comment"> * |
</span></span><span id="103" class="l"><a class="l" href="#103">103: </a><span class="php-comment"> * @param array Morceaux de l'url servant à préciser la ressource concerné pour le service demandé. |
</span></span><span id="104" class="l"><a class="l" href="#104">104: </a><span class="php-comment"> * @param array les données transférées dans le corps de la requête devant servir à la modification. |
</span></span><span id="105" class="l"><a class="l" href="#105">105: </a><span class="php-comment"> * @return mixed une chaine indiquant le succès de l'opération ou rien. |
</span></span><span id="106" class="l"><a class="l" href="#106">106: </a><span class="php-comment"> */</span> |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_modifier" href="#_modifier">modifier</a>(<span class="php-var">$ressources</span>, <span class="php-var">$requeteDonnees</span>) { |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> RestServeur::envoyerEnteteStatutHttp(RestServeur::HTTP_CODE_METHODE_NON_AUTORISE); |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> RestServeur::ajouterMessage(<span class="php-quote">"Le service '"</span>.<span class="php-keyword2">get_class</span>(<span class="php-var">$this</span>).<span class="php-quote">"' n'autorise pas la modification."</span>); |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> } |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-comment">/** |
</span></span><span id="114" class="l"><a class="l" href="#114">114: </a><span class="php-comment"> * Méthode appelée lors d'une requête HTTP de type PUT. |
</span></span><span id="115" class="l"><a class="l" href="#115">115: </a><span class="php-comment"> * |
</span></span><span id="116" class="l"><a class="l" href="#116">116: </a><span class="php-comment"> * L'identifiant de la ressource à ajouter est indiqué via l'url si on le connait par avance. Sinon, il doit être créé par |
</span></span><span id="117" class="l"><a class="l" href="#117">117: </a><span class="php-comment"> * le service. Dans ce dernier cas, le nouvel identifiant devrait être renvoyé dans le corps de la réponse. |
</span></span><span id="118" class="l"><a class="l" href="#118">118: </a><span class="php-comment"> * Si l'ajout est un succès, la méthode devra retourner "true" ou l'identifiant. |
</span></span><span id="119" class="l"><a class="l" href="#119">119: </a><span class="php-comment"> * Le code statut HTTP retourné sera 201 en cas de succès. |
</span></span><span id="120" class="l"><a class="l" href="#120">120: </a><span class="php-comment"> * Dans le cas contraire, la méthode devra retourner false. |
</span></span><span id="121" class="l"><a class="l" href="#121">121: </a><span class="php-comment"> * |
</span></span><span id="122" class="l"><a class="l" href="#122">122: </a><span class="php-comment"> * @param array Morceaux de l'url servant à préciser la ressource concerné pour le service demandé. |
</span></span><span id="123" class="l"><a class="l" href="#123">123: </a><span class="php-comment"> * @param array les données transférées dans le corps de la requête devant servir à l'ajout. |
</span></span><span id="124" class="l"><a class="l" href="#124">124: </a><span class="php-comment"> * @return string l'identifiant créé. |
</span></span><span id="125" class="l"><a class="l" href="#125">125: </a><span class="php-comment"> */</span> |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ajouter" href="#_ajouter">ajouter</a>(<span class="php-var">$ressources</span>, <span class="php-var">$requeteDonnees</span>) { |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> RestServeur::envoyerEnteteStatutHttp(RestServeur::HTTP_CODE_METHODE_NON_AUTORISE); |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> RestServeur::ajouterMessage(<span class="php-quote">"Le service '"</span>.<span class="php-keyword2">get_class</span>(<span class="php-var">$this</span>).<span class="php-quote">"' n'autorise pas la création."</span>); |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> } |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> <span class="php-comment">/** |
</span></span><span id="133" class="l"><a class="l" href="#133">133: </a><span class="php-comment"> * Méthode appelée lors d'une requête HTTP de type DELETE (ou POST avec action=DELETE dans le corps de la requete). |
</span></span><span id="134" class="l"><a class="l" href="#134">134: </a><span class="php-comment"> * |
</span></span><span id="135" class="l"><a class="l" href="#135">135: </a><span class="php-comment"> * Si la suppression est un succès, la méthode devra retourner "true" et le code statut HTTP retourné par |
</span></span><span id="136" class="l"><a class="l" href="#136">136: </a><span class="php-comment"> * RestServeur sera 204. |
</span></span><span id="137" class="l"><a class="l" href="#137">137: </a><span class="php-comment"> * Si la ressource à supprimer est introuvable, la méthode devra retourner "false" et le code statut HTTP |
</span></span><span id="138" class="l"><a class="l" href="#138">138: </a><span class="php-comment"> * retourné par RestServeur sera 404. |
</span></span><span id="139" class="l"><a class="l" href="#139">139: </a><span class="php-comment"> * Dans les autres cas de figure ou si vous souhaitez gérer vos propres codes de retour erreur, retourner |
</span></span><span id="140" class="l"><a class="l" href="#140">140: </a><span class="php-comment"> * la valeur null ou rien. |
</span></span><span id="141" class="l"><a class="l" href="#141">141: </a><span class="php-comment"> * |
</span></span><span id="142" class="l"><a class="l" href="#142">142: </a><span class="php-comment"> * @param array Morceaux de l'url servant à préciser la ressource concerné pour le service demandé. |
</span></span><span id="143" class="l"><a class="l" href="#143">143: </a><span class="php-comment"> * @return mixed une chaine indiquant le succès de l'opération ou rien. |
</span></span><span id="144" class="l"><a class="l" href="#144">144: </a><span class="php-comment"> */</span> |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_supprimer" href="#_supprimer">supprimer</a>(<span class="php-var">$ressources</span>) { |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> RestServeur::envoyerEnteteStatutHttp(RestServeur::HTTP_CODE_METHODE_NON_AUTORISE); |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> RestServeur::ajouterMessage(<span class="php-quote">"Le service '"</span>.<span class="php-keyword2">get_class</span>(<span class="php-var">$this</span>).<span class="php-quote">"' n'autorise pas la suppression."</span>); |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">null</span>; |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> } |
</span><span id="150" class="l"><a class="l" href="#150">150: </a>} |
</span><span id="151" class="l"><a class="l" href="#151">151: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Controleur.html |
---|
New file |
0,0 → 1,517 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Controleur | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li class="active"><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Controleur</h1> |
<div class="description"> |
<p>Classe Controleur, coeur d'une application, c'est normalement la seule classe |
d'une application qui devrait être appelée de l'extérieur. Elle est abstraite |
donc doit obligatoirement être étendue.</p> |
</div> |
<div class="info"> |
<b>Abstract</b><br> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
php 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2009, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL</a><br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL</a><br> |
<b>Author:</b> |
Aurélien PERONNET <<a |
href="mailto:aurelien@tela-botanica.org">aurelien@<!-- -->tela-botanica.org</a>><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Controleur.php 415 2012-04-04 09:05:55Z jpm $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Controleur.html#3-154" title="Go to source code">framework/Controleur.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="__construct" id="___construct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___construct">#</a> |
<code><a href="source-class-Controleur.html#38-60" title="Go to source code">__construct</a>( )</code> |
<div class="description short"> |
<p>Constructeur par défaut</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constructeur par défaut</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="getCheminSquelette" id="_getCheminSquelette"> |
<td class="attributes"><code> |
protected |
String |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getCheminSquelette">#</a> |
<code><a href="source-class-Controleur.html#62-69" title="Go to source code">getCheminSquelette</a>( )</code> |
<div class="description short"> |
<p>Permet de récupérer le chemin vers les squelettes.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Permet de récupérer le chemin vers les squelettes.</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>String</code><br>$chemin chemin vers les squelettes<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="setCheminSquelette" id="_setCheminSquelette"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setCheminSquelette">#</a> |
<code><a href="source-class-Controleur.html#71-78" title="Go to source code">setCheminSquelette</a>( <span>String <var>$chemin</var></span> )</code> |
<div class="description short"> |
<p>Permet de définir dynamiquement le chemin vers les squelettes.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Permet de définir dynamiquement le chemin vers les squelettes.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$chemin</var></dt> |
<dd><code>String</code><br>$chemin chemin vers les squelettes</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="chargerModele" id="_chargerModele"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_chargerModele">#</a> |
<code><a href="source-class-Controleur.html#80-98" title="Go to source code">chargerModele</a>( <span>string <var>$nom_modele</var></span> )</code> |
<div class="description short"> |
<p>Charge un modele donné et le rend disponible sous la forme |
$this->nom_modele</p> |
</div> |
<div class="description detailed hidden"> |
<p>Charge un modele donné et le rend disponible sous la forme |
$this->nom_modele</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$nom_modele</var></dt> |
<dd><code>string</code><br>$nom_modele le nom du modèle à charger</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>false si le chargement a échoué, sinon true.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getModele" id="_getModele"> |
<td class="attributes"><code> |
protected |
mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getModele">#</a> |
<code><a href="source-class-Controleur.html#100-119" title="Go to source code">getModele</a>( <span>string <var>$nom_modele</var></span>, <span>String <var>$ext</var> = <span class="php-quote">'.php'</span></span> )</code> |
<div class="description short"> |
<p>Retourne un modele donné</p> |
</div> |
<div class="description detailed hidden"> |
<p>Retourne un modele donné</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$nom_modele</var></dt> |
<dd><code>string</code><br>$nom_modele le nom du fichier modèle à charger sans son extension</dd> |
<dt><var>$ext</var></dt> |
<dd><code>String</code><br>$ext l'extension du fichier du modèle (par défaut : ".php")</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed</code><br>false si le chargement a échoué, sinon l'objet du modèle demandé.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getVue" id="_getVue"> |
<td class="attributes"><code> |
protected |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getVue">#</a> |
<code><a href="source-class-Controleur.html#121-140" title="Go to source code">getVue</a>( <span>String <var>$nom_squelette</var></span>, <span>Array <var>$donnees</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Fonction prenant en paramètre le nom d'un squelette et un tableau associatif |
de données, en extrait les variables, charge le squelette et retourne le |
résultat des deux combinés.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Fonction prenant en paramètre le nom d'un squelette et un tableau associatif |
de données, en extrait les variables, charge le squelette et retourne le |
résultat des deux combinés.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$nom_squelette</var></dt> |
<dd><code>String</code><br>$nom_squelette le nom du squelette sans son extension si elle vaut ".tpl.html"</dd> |
<dt><var>$donnees</var></dt> |
<dd><code>Array</code><br>$donnees un tableau associatif contenant les variables a injecter dans la vue</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>false si la vue n'existe pas, sinon la chaine résultat.<br> |
</div> |
<h4>Since</h4> |
<div class="list"> |
0.4 suppression du paramètre 'ext' => le mettre directement dans le nom du |
squelette<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="preTraiterDonnees" id="_preTraiterDonnees"> |
<td class="attributes"><code> |
protected |
Array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_preTraiterDonnees">#</a> |
<code><a href="source-class-Controleur.html#142-153" title="Go to source code">preTraiterDonnees</a>( <span>Array <var>& $donnees</var></span> )</code> |
<div class="description short"> |
<p>Fonction prenant en paramètre un tableau de données et effectuant un |
traitement dessus. Cette fonction est à surcharger dans les classes filles pour |
automatiser un traitement avant chaque chargement de vue.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Fonction prenant en paramètre un tableau de données et effectuant un |
traitement dessus. Cette fonction est à surcharger dans les classes filles pour |
automatiser un traitement avant chaque chargement de vue.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$donnees</var></dt> |
<dd><code>Array</code><br>$donnees Le tableau de données à traiter</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>Array</code><br>$donnees Le tableau de données traité<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr data-order="parametres_obligatoires" id="$parametres_obligatoires"> |
<td class="attributes"><code> |
protected |
array |
</code></td> |
<td class="name"> |
<a href="source-class-Controleur.html#35-36" title="Go to source code"><var>$parametres_obligatoires</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">array</span>(<span class="php-quote">'chemin_modeles'</span>, <span class="php-quote">'chemin_squelettes'</span>, <span class="php-quote">'chemin_controleurs'</span>, <span class="php-quote">'base_url_application'</span>)</code></td> |
<td class="description"><div> |
<a href="#$parametres_obligatoires" class="anchor">#</a> |
<div class="description short"> |
<p>Tableau des noms des paramètres à définir dans le fichier de config car |
obligatoirement nécessaire à cette classe.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Tableau des noms des paramètres à définir dans le fichier de config car |
obligatoirement nécessaire à cette classe.</p> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Framework.html |
---|
New file |
0,0 → 1,449 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Framework | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li class="active"><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Framework</h1> |
<div class="description"> |
<p>Classe de base du Framework : - fournissant des infos sur l'application, - |
paramétrant l'environnement de l'appli et du framework, - réalisant des |
traitements sur les variables globales ($_GET, $_POST, $_COOKIE...)</p> |
<p>Cette classe contient la fonction de chargement automatique de classes. Ce |
fichier doit toujours rester à la racine du framework car il initialise le |
chemin de l'application en se basant sur son propre emplacement.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Framework.php 393 2011-11-10 13:36:48Z jpm $<br> |
<b>Since:</b> |
0.3<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Framework.html#3-252" title="Go to source code">framework/Framework.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="setCheminAppli" id="_setCheminAppli"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setCheminAppli">#</a> |
<code><a href="source-class-Framework.html#143-161" title="Go to source code">setCheminAppli</a>( <span>string <var>$chemin_fichier_principal</var></span> )</code> |
<div class="description short"> |
<p>Permet d'indiquer le chemin de base de l'Application. Cette méthode doit |
obligatoirement être utilisée par l'application pour que le Framework |
fonctionne correctement.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Permet d'indiquer le chemin de base de l'Application. Cette méthode doit |
obligatoirement être utilisée par l'application pour que le Framework |
fonctionne correctement.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$chemin_fichier_principal</var></dt> |
<dd><code>string</code><br>$chemin_fichier_principal chemin de base</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getCheminAppli" id="_getCheminAppli"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getCheminAppli">#</a> |
<code><a href="source-class-Framework.html#163-169" title="Go to source code">getCheminAppli</a>( )</code> |
<div class="description short"> |
<p>accesseur pour le chemin</p> |
</div> |
<div class="description detailed hidden"> |
<p>accesseur pour le chemin</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>le chemin<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="setInfoAppli" id="_setInfoAppli"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setInfoAppli">#</a> |
<code><a href="source-class-Framework.html#171-185" title="Go to source code">setInfoAppli</a>( <span>array <var>$info</var></span> )</code> |
<div class="description short"> |
<p>Le tableau des informations sur l'application possède les clés suivantes |
:</p> |
<ul> |
<li>nom : nom de l'application</li> |
<li>abr : abréviation de l'application</li> |
<li>encodage : encodage de l'application (ISO-8859-15, UTF-8...)</li> |
</ul> |
</div> |
<div class="description detailed hidden"> |
<p>Le tableau des informations sur l'application possède les clés suivantes |
:</p> |
<ul> |
<li>nom : nom de l'application</li> |
<li>abr : abréviation de l'application</li> |
<li>encodage : encodage de l'application (ISO-8859-15, UTF-8...)</li> |
</ul> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$info</var></dt> |
<dd><code>array</code><br>$info tableau fournissant des informations sur l'application</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getInfoAppli" id="_getInfoAppli"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getInfoAppli">#</a> |
<code><a href="source-class-Framework.html#187-199" title="Go to source code">getInfoAppli</a>( <span>string <var>$cle</var> = <span class="php-keyword1">null</span></span> )</code> |
<div class="description short"> |
<p>Accesseur pour le tableau d'infos sur l'application.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Accesseur pour le tableau d'infos sur l'application.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$cle</var></dt> |
<dd><code>string</code><br>$cle la clé à laquelle on veut accéder</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="verifierEtReencoderTableauRequete" id="_verifierEtReencoderTableauRequete"> |
<td class="attributes"><code> |
protected static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_verifierEtReencoderTableauRequete">#</a> |
<code><a href="source-class-Framework.html#201-214" title="Go to source code">verifierEtReencoderTableauRequete</a>( )</code> |
<div class="description short"> |
<p>Procédure vérifiant l'encodage des tableaux $_GET et $_POST et les |
transcodant dans l'encodage de l'application</p> |
</div> |
<div class="description detailed hidden"> |
<p>Procédure vérifiant l'encodage des tableaux $_GET et $_POST et les |
transcodant dans l'encodage de l'application</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="encoderTableau" id="_encoderTableau"> |
<td class="attributes"><code> |
final protected static |
Array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_encoderTableau">#</a> |
<code><a href="source-class-Framework.html#232-251" title="Go to source code">encoderTableau</a>( <span>mixed <var>$tableau</var></span>, <span>mixed <var>$encodage_sortie</var></span>, <span>mixed <var>$encodage_entree</var> = <span class="php-keyword1">null</span></span> )</code> |
<div class="description short"> |
<p>Fonction récursive transcodant toutes les valeurs d'un tableau de leur |
encodage d'entrée vers un encodage de sortie donné</p> |
</div> |
<div class="description detailed hidden"> |
<p>Fonction récursive transcodant toutes les valeurs d'un tableau de leur |
encodage d'entrée vers un encodage de sortie donné</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tableau</var></dt> |
<dd><code>mixed</code><br>$tableau Array Un tableau de données à encoder</dd> |
<dt><var>$encodage_sortie</var></dt> |
<dd><code>mixed</code><br>$encodage_sortie String l'encodage vers lequel on doit transcoder</dd> |
<dt><var>$encodage_entree</var></dt> |
<dd><code>mixed</code><br>$encodage_entree String l'encodage original des chaines du tableau (optionnel)</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>Array</code><br>Le tableau encodé dans l'encodage de sortie<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/deprecated.html |
---|
New file |
0,0 → 1,199 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Deprecated | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonScript.html">MonScript</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
<h3>Exceptions</h3> |
<ul> |
<li><a href="class-Exception.html">Exception</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<span>Package</span> </li> |
<li> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li class="active"> |
<span>Deprecated</span> </li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content"> |
<h1>Deprecated</h1> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr> |
<td class="name"><a href="class-Bdd.html">Bdd</a></td> |
<td class="name"><code><a href="class-Bdd.html#_protegerTableau">protegerTableau()</a></code></td> |
<td> |
changement de nom. Deviendra "private" dans la version 0.5. Utiliser à la place |
: @see proteger |
<!-- by Texy2! --><br> |
</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Bdd.html">Bdd</a></td> |
<td class="name"><code><a href="class-Bdd.html#_requete">requete()</a></code></td> |
<td> |
changement de nom. Disparaîtra dans la version 0.4. Utiliser à la place : @see |
requeter<br> |
</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Bdd.html">Bdd</a></td> |
<td class="name"><code><a href="class-Bdd.html#_requeteTous">requeteTous()</a></code></td> |
<td> |
changement de nom. Disparaîtra dans la version 0.4. Utiliser à la place : @see |
recupererTous<br> |
</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Bdd.html">Bdd</a></td> |
<td class="name"><code><a href="class-Bdd.html#_requeteUn">requeteUn()</a></code></td> |
<td> |
changement de nom. Disparaîtra dans la version 0.4. Utiliser à la place : @see |
recuperer<br> |
</td> |
</tr> |
<tr> |
<td class="name"><a href="class-GestionnaireException.html">GestionnaireException</a></td> |
<td class="name"><code><a href="class-GestionnaireException.html#_getExceptions">getExceptions()</a></code></td> |
<td> |
</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Tableau.html">Tableau</a></td> |
<td class="name"><code><a href="class-Tableau.html#_trierTableauMd">trierTableauMd()</a></code></td> |
<td> |
Utiliser la méthode trierMD()<br> |
</td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr> |
<td class="name"><a href="class-RestService.html">RestService</a></td> |
<td class="name"><a href="class-RestService.html#$bdd"><var>$bdd</var></a></td> |
<td> |
Utiliser la methode getBdd().<br> |
</td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/package-Utilitaire.html |
---|
New file |
0,0 → 1,136 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Package Utilitaire | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li class="active"><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li class="active"> |
<span>Package</span> </li> |
<li> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="package"> |
<h1>Package Utilitaire</h1> |
<table class="summary" id="classes"> |
<caption>Classes summary</caption> |
<tr> |
<td class="name"><a href="class-Chaine.html">Chaine</a></td> |
<td>Classe fournissant des méthodes statiques de manipulation des chaînes de |
caractères (String).</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Encodage.html">Encodage</a></td> |
<td>Classe fournissant des méthodes statiques concernant l'encodage et le décodage |
des caractères de variable.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Fichier.html">Fichier</a></td> |
<td>Classe fournissant des méthodes statiques de manipulation des fichiers.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Pattern.html">Pattern</a></td> |
<td>Classe fournissant des constantes correspondant à des expressions régulières |
de vérification très courrantes.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Tableau.html">Tableau</a></td> |
<td></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Cache.html |
---|
New file |
0,0 → 1,627 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Cache.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li class="active"><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Cache.html" title="Summary of Cache"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe Cache permettant de mettre en cache des données. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * Basée sur les principes de Zend_Cache (Copyright (c) 2005-2010, Zend Technologies USA, Inc. All rights reserved.) |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @category php 5.2 |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @package Framework |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @license http://framework.zend.com/license/new-bsd Licence New BSD |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @version $Id: Cache.php 299 2011-01-18 14:03:46Z jpm $ |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> */</span> |
</span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-keyword1">class</span> <a id="Cache" href="#Cache">Cache</a> { |
</span><span id="18" class="l"><a class="l" href="#18"> 18: </a> <span class="php-comment">/** Socke les enregistrements du cache dans des fichiers textes de façon extremement simple. */</span> |
</span><span id="19" class="l"><a class="l" href="#19"> 19: </a> <span class="php-keyword1">const</span> <a id="STOCKAGE_MODE_SIMPLE" href="#STOCKAGE_MODE_SIMPLE">STOCKAGE_MODE_SIMPLE</a> = <span class="php-quote">"FichierSimple"</span>; |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> <span class="php-comment">/** Socke les enregistrements du cache dans des fichiers textes. */</span> |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> <span class="php-keyword1">const</span> <a id="STOCKAGE_MODE_FICHIER" href="#STOCKAGE_MODE_FICHIER">STOCKAGE_MODE_FICHIER</a> = <span class="php-quote">"Fichier"</span>; |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> <span class="php-comment">/** Socke les enregistrements du cache dans une base de données SQLite. */</span> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> <span class="php-keyword1">const</span> <a id="STOCKAGE_MODE_SQLITE" href="#STOCKAGE_MODE_SQLITE">STOCKAGE_MODE_SQLITE</a> = <span class="php-quote">"Sqlite"</span>; |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> <span class="php-comment">/** 'tous' (par défaut) : supprime tous les enregistrements. */</span> |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> <span class="php-keyword1">const</span> <a id="NETTOYAGE_MODE_TOUS" href="#NETTOYAGE_MODE_TOUS">NETTOYAGE_MODE_TOUS</a> = <span class="php-quote">"tous"</span>; |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> <span class="php-comment">/** 'expiration' : supprime tous les enregistrements dont la date d'expériration est dépassée. */</span> |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-keyword1">const</span> <a id="NETTOYAGE_MODE_EXPIRATION" href="#NETTOYAGE_MODE_EXPIRATION">NETTOYAGE_MODE_EXPIRATION</a> = <span class="php-quote">"expiration"</span>; |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> <span class="php-comment">/** 'avecLesTags' : supprime tous les enregistrements contenant tous les tags indiqués. */</span> |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-keyword1">const</span> <a id="NETTOYAGE_MODE_AVEC_LES_TAGS" href="#NETTOYAGE_MODE_AVEC_LES_TAGS">NETTOYAGE_MODE_AVEC_LES_TAGS</a> = <span class="php-quote">"avecLesTags"</span>; |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> <span class="php-comment">/** 'sansLesTags' : supprime tous les enregistrements contenant aucun des tags indiqués. */</span> |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> <span class="php-keyword1">const</span> <a id="NETTOYAGE_MODE_SANS_LES_TAGS" href="#NETTOYAGE_MODE_SANS_LES_TAGS">NETTOYAGE_MODE_SANS_LES_TAGS</a> = <span class="php-quote">"sansLesTags"</span>; |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> <span class="php-comment">/** 'avecUnTag' : supprime tous les enregistrements contenant au moins un des tags indiqués. */</span> |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> <span class="php-keyword1">const</span> <a id="NETTOYAGE_MODE_AVEC_UN_TAG" href="#NETTOYAGE_MODE_AVEC_UN_TAG">NETTOYAGE_MODE_AVEC_UN_TAG</a> = <span class="php-quote">"avecUnTag"</span>; |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> <span class="php-comment">/** |
</span></span><span id="37" class="l"><a class="l" href="#37"> 37: </a><span class="php-comment"> * Dernier identifiant de cache utilisé. |
</span></span><span id="38" class="l"><a class="l" href="#38"> 38: </a><span class="php-comment"> * |
</span></span><span id="39" class="l"><a class="l" href="#39"> 39: </a><span class="php-comment"> * @var string $dernier_id |
</span></span><span id="40" class="l"><a class="l" href="#40"> 40: </a><span class="php-comment"> */</span> |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$dernier_id" href="#$dernier_id">$dernier_id</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> <span class="php-comment">/** |
</span></span><span id="44" class="l"><a class="l" href="#44"> 44: </a><span class="php-comment"> * Les options disponibles pour le cache : |
</span></span><span id="45" class="l"><a class="l" href="#45"> 45: </a><span class="php-comment"> * ====> (string) stockage_mode : |
</span></span><span id="46" class="l"><a class="l" href="#46"> 46: </a><span class="php-comment"> * Indique le mode de stockage du cache à utiliser parmis : |
</span></span><span id="47" class="l"><a class="l" href="#47"> 47: </a><span class="php-comment"> * - Cache::STOCKAGE_MODE_FICHIER : sous forme d'une arborescence de fichiers et dossier |
</span></span><span id="48" class="l"><a class="l" href="#48"> 48: </a><span class="php-comment"> * - Cache::STOCKAGE_MODE_SQLITE : sous forme d'une base de données SQLite |
</span></span><span id="49" class="l"><a class="l" href="#49"> 49: </a><span class="php-comment"> * |
</span></span><span id="50" class="l"><a class="l" href="#50"> 50: </a><span class="php-comment"> * ====> (string) stockage_chemin : |
</span></span><span id="51" class="l"><a class="l" href="#51"> 51: </a><span class="php-comment"> * Chemin vers : |
</span></span><span id="52" class="l"><a class="l" href="#52"> 52: </a><span class="php-comment"> * - Cache::STOCKAGE_MODE_FICHIER : le dossier devant contenir l'arborescence. |
</span></span><span id="53" class="l"><a class="l" href="#53"> 53: </a><span class="php-comment"> * - Cache::STOCKAGE_MODE_SQLITE : le fichier contenant la base SQLite. |
</span></span><span id="54" class="l"><a class="l" href="#54"> 54: </a><span class="php-comment"> * |
</span></span><span id="55" class="l"><a class="l" href="#55"> 55: </a><span class="php-comment"> * ====> (boolean) controle_ecriture : |
</span></span><span id="56" class="l"><a class="l" href="#56"> 56: </a><span class="php-comment"> * - Active / Désactive le controle d'écriture (le cache est lue jute après l'écriture du fichier pour détecter sa corruption) |
</span></span><span id="57" class="l"><a class="l" href="#57"> 57: </a><span class="php-comment"> * - Activer le controle d'écriture ralentira légèrement l'écriture du fichier de cache mais pas sa lecture |
</span></span><span id="58" class="l"><a class="l" href="#58"> 58: </a><span class="php-comment"> * Le controle d'écriture peut détecter la corruption de fichier mais ce n'est pas un système de controle parfait. |
</span></span><span id="59" class="l"><a class="l" href="#59"> 59: </a><span class="php-comment"> * |
</span></span><span id="60" class="l"><a class="l" href="#60"> 60: </a><span class="php-comment"> * ====> (boolean) mise_en_cache : |
</span></span><span id="61" class="l"><a class="l" href="#61"> 61: </a><span class="php-comment"> * - Active / Désactive la mise en cache |
</span></span><span id="62" class="l"><a class="l" href="#62"> 62: </a><span class="php-comment"> * (peut être très utile pour le débogage des scripts utilisant le cache |
</span></span><span id="63" class="l"><a class="l" href="#63"> 63: </a><span class="php-comment"> * |
</span></span><span id="64" class="l"><a class="l" href="#64"> 64: </a><span class="php-comment"> * =====> (string) cache_id_prefixe : |
</span></span><span id="65" class="l"><a class="l" href="#65"> 65: </a><span class="php-comment"> * - préfixe pour les identifiant de cache ( = espace de nom) |
</span></span><span id="66" class="l"><a class="l" href="#66"> 66: </a><span class="php-comment"> * |
</span></span><span id="67" class="l"><a class="l" href="#67"> 67: </a><span class="php-comment"> * ====> (boolean) serialisation_auto : |
</span></span><span id="68" class="l"><a class="l" href="#68"> 68: </a><span class="php-comment"> * - Active / Désactive la sérialisation automatique |
</span></span><span id="69" class="l"><a class="l" href="#69"> 69: </a><span class="php-comment"> * - Peut être utilisé pour sauver directement des données qui ne sont pas des chaines (mais c'est plus lent) |
</span></span><span id="70" class="l"><a class="l" href="#70"> 70: </a><span class="php-comment"> * |
</span></span><span id="71" class="l"><a class="l" href="#71"> 71: </a><span class="php-comment"> * ====> (int) nettoyage_auto : |
</span></span><span id="72" class="l"><a class="l" href="#72"> 72: </a><span class="php-comment"> * - Désactive / Régler le processus de nettoyage automatique |
</span></span><span id="73" class="l"><a class="l" href="#73"> 73: </a><span class="php-comment"> * - Le processus de nettoyage automatiques détruit les fichier trop vieux (pour la durée de vie donnée) |
</span></span><span id="74" class="l"><a class="l" href="#74"> 74: </a><span class="php-comment"> * quand un nouveau fichier de cache est écrit : |
</span></span><span id="75" class="l"><a class="l" href="#75"> 75: </a><span class="php-comment"> * 0 => pas de nettoyage automatique |
</span></span><span id="76" class="l"><a class="l" href="#76"> 76: </a><span class="php-comment"> * 1 => nettoyage automatique systématique |
</span></span><span id="77" class="l"><a class="l" href="#77"> 77: </a><span class="php-comment"> * x (integer) > 1 => nettoyage automatique toutes les 1 fois (au hasard) sur x écriture de fichier de cache |
</span></span><span id="78" class="l"><a class="l" href="#78"> 78: </a><span class="php-comment"> * |
</span></span><span id="79" class="l"><a class="l" href="#79"> 79: </a><span class="php-comment"> * ====> (int) duree_de_vie : |
</span></span><span id="80" class="l"><a class="l" href="#80"> 80: </a><span class="php-comment"> * - Durée de vie du cache (en secondes) |
</span></span><span id="81" class="l"><a class="l" href="#81"> 81: </a><span class="php-comment"> * - Si null, le cache est valide indéfiniment. |
</span></span><span id="82" class="l"><a class="l" href="#82"> 82: </a><span class="php-comment"> * |
</span></span><span id="83" class="l"><a class="l" href="#83"> 83: </a><span class="php-comment"> * @var array $options les options disponibles pour le cache . |
</span></span><span id="84" class="l"><a class="l" href="#84"> 84: </a><span class="php-comment"> */</span> |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$options" href="#$options">$options</a></span> = <span class="php-keyword1">array</span>( |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> <span class="php-quote">'stockage_mode'</span> => self::STOCKAGE_MODE_FICHIER, |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-quote">'stockage_chemin'</span> => <span class="php-keyword1">null</span>, |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> <span class="php-quote">'controle_ecriture'</span> => <span class="php-keyword1">true</span>, |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> <span class="php-quote">'mise_en_cache'</span> => <span class="php-keyword1">true</span>, |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> <span class="php-quote">'cache_id_prefixe'</span> => <span class="php-keyword1">null</span>, |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-quote">'serialisation_auto'</span> => <span class="php-keyword1">false</span>, |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-quote">'nettoyage_auto'</span> => <span class="php-num">10</span>, |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-quote">'duree_de_vie'</span> => <span class="php-num">3600</span>, |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> ); |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$stockage" href="#$stockage">$stockage</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>(<span class="php-var">$options</span> = <span class="php-keyword1">array</span>(), <span class="php-var">$options_stockage</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> <span class="php-var">$this</span>->initialiserOptionsParConfig(); |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> <span class="php-var">$this</span>->setOptions(<span class="php-var">$options</span>); |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_mode'</span>] == self::STOCKAGE_MODE_FICHIER) { |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> <span class="php-var">$this</span>->stockage = <span class="php-keyword1">new</span> CacheFichier(<span class="php-var">$options_stockage</span>, <span class="php-var">$this</span>); |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> <span class="php-var">$this</span>->stockage->setEmplacement(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>]); |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_mode'</span>] == self::STOCKAGE_MODE_SQLITE) { |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-var">$this</span>->stockage = <span class="php-keyword1">new</span> CacheSqlite(<span class="php-var">$options_stockage</span>, <span class="php-var">$this</span>); |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> <span class="php-var">$this</span>->stockage->setEmplacement(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>]); |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> } <span class="php-keyword1">else</span> { |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Ce mode de stockage n'existe pas ou ne supporte pas la création par le constructeur"</span>, E_USER_WARNING); |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> } |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> } |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_initialiserOptionsParConfig" href="#_initialiserOptionsParConfig">initialiserOptionsParConfig</a>() { |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-keyword1">while</span> (<span class="php-keyword1">list</span>(<span class="php-var">$nom</span>, <span class="php-var">$valeur</span>) = <span class="php-keyword2">each</span>(<span class="php-var">$this</span>->options)) { |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> <span class="php-keyword1">if</span> (Config::existe(<span class="php-var">$nom</span>)) { |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> <span class="php-var">$this</span>->options[<span class="php-var">$nom</span>] = Config::get(<span class="php-var">$nom</span>); |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> } |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> } |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> } |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_setOptions" href="#_setOptions">setOptions</a>(<span class="php-var">$options</span>) { |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-keyword1">while</span> (<span class="php-keyword1">list</span>(<span class="php-var">$nom</span>, <span class="php-var">$valeur</span>) = <span class="php-keyword2">each</span>(<span class="php-var">$options</span>)) { |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_string</span>(<span class="php-var">$nom</span>)) { |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Nom d'option incorecte : </span><span class="php-var">$nom</span><span class="php-quote">"</span>, E_USER_WARNING); |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> } |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> <span class="php-var">$nom</span> = <span class="php-keyword2">strtolower</span>(<span class="php-var">$nom</span>); |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">array_key_exists</span>(<span class="php-var">$nom</span>, <span class="php-var">$this</span>->options)) { |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-var">$this</span>->options[<span class="php-var">$nom</span>] = <span class="php-var">$valeur</span>; |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> } |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> } |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> } |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> <span class="php-comment">/** |
</span></span><span id="133" class="l"><a class="l" href="#133">133: </a><span class="php-comment"> * Permet de (re-)définir l'emplacement pour le stockage du cache. |
</span></span><span id="134" class="l"><a class="l" href="#134">134: </a><span class="php-comment"> * En fonction du mode de stockage utilisé , l'emplacement indiqué correspondra au chemin du : |
</span></span><span id="135" class="l"><a class="l" href="#135">135: </a><span class="php-comment"> * - dossier où stocker les fichiers pour le mode "fichier". |
</span></span><span id="136" class="l"><a class="l" href="#136">136: </a><span class="php-comment"> * - fichier de la base de données pour le mode "sqlite". |
</span></span><span id="137" class="l"><a class="l" href="#137">137: </a><span class="php-comment"> * @param string $emplacement chemin vers dossier (Cache::STOCKAGE_MODE_FICHIER) ou fichier base Sqlite (Cache::STOCKAGE_MODE_SQLITE) |
</span></span><span id="138" class="l"><a class="l" href="#138">138: </a><span class="php-comment"> * @return void |
</span></span><span id="139" class="l"><a class="l" href="#139">139: </a><span class="php-comment"> */</span> |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_setEmplacement" href="#_setEmplacement">setEmplacement</a>(<span class="php-var">$emplacement</span>) { |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> <span class="php-keyword1">if</span> (<span class="php-var">$emplacement</span> != <span class="php-keyword1">null</span>) { |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'setEmplacement'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$emplacement</span>)); |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> } <span class="php-keyword1">else</span> { |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"L'emplacement ne peut pas être null."</span>, E_USER_WARNING); |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> } |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> } |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_fabriquer" href="#_fabriquer">fabriquer</a>(<span class="php-var">$mode</span>, <span class="php-var">$options</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> <span class="php-keyword1">if</span> (<span class="php-var">$mode</span> == self::STOCKAGE_MODE_SIMPLE) { |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">new</span> CacheSimple(<span class="php-var">$options</span>); |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> } <span class="php-keyword1">else</span> { |
</span><span id="152" class="l"><a class="l" href="#152">152: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Le mode '</span><span class="php-var">$mode</span><span class="php-quote">' de stockage n'existe pas ou ne supporte pas la création par fabrique"</span>, E_USER_WARNING); |
</span><span id="153" class="l"><a class="l" href="#153">153: </a> } |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> } |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> |
</span><span id="157" class="l"><a class="l" href="#157">157: </a> <span class="php-comment">/** |
</span></span><span id="158" class="l"><a class="l" href="#158">158: </a><span class="php-comment"> * Teste si un cache est disponible pour l'identifiant donné et (si oui) le retourne (false dans le cas contraire) |
</span></span><span id="159" class="l"><a class="l" href="#159">159: </a><span class="php-comment"> * |
</span></span><span id="160" class="l"><a class="l" href="#160">160: </a><span class="php-comment"> * @param string $id Identifiant de cache. |
</span></span><span id="161" class="l"><a class="l" href="#161">161: </a><span class="php-comment"> * @param boolean $ne_pas_tester_validiter_du_cache Si mis à true, la validité du cache n'est pas testée |
</span></span><span id="162" class="l"><a class="l" href="#162">162: </a><span class="php-comment"> * @return mixed|false Cached datas |
</span></span><span id="163" class="l"><a class="l" href="#163">163: </a><span class="php-comment"> */</span> |
</span><span id="164" class="l"><a class="l" href="#164">164: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_charger" href="#_charger">charger</a>(<span class="php-var">$id</span>, <span class="php-var">$ne_pas_tester_validiter_du_cache</span> = <span class="php-keyword1">false</span>) { |
</span><span id="165" class="l"><a class="l" href="#165">165: </a> <span class="php-var">$donnees</span> = <span class="php-keyword1">false</span>; |
</span><span id="166" class="l"><a class="l" href="#166">166: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'mise_en_cache'</span>] === <span class="php-keyword1">true</span>) { |
</span><span id="167" class="l"><a class="l" href="#167">167: </a> <span class="php-var">$id</span> = <span class="php-var">$this</span>->prefixerId(<span class="php-var">$id</span>); |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> <span class="php-var">$this</span>->dernier_id = <span class="php-var">$id</span>; |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> self::validerIdOuTag(<span class="php-var">$id</span>); |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> <span class="php-var">$donnees</span> = <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'charger'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$id</span>, <span class="php-var">$ne_pas_tester_validiter_du_cache</span>)); |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> <span class="php-var">$donnees</span> = <span class="php-var">$this</span>->deserialiserAutomatiquement(<span class="php-var">$donnees</span>); |
</span><span id="172" class="l"><a class="l" href="#172">172: </a> } |
</span><span id="173" class="l"><a class="l" href="#173">173: </a> <span class="php-keyword1">return</span> <span class="php-var">$donnees</span>; |
</span><span id="174" class="l"><a class="l" href="#174">174: </a> } |
</span><span id="175" class="l"><a class="l" href="#175">175: </a> |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> <span class="php-comment">/** |
</span></span><span id="177" class="l"><a class="l" href="#177">177: </a><span class="php-comment"> * Test if a cache is available for the given id |
</span></span><span id="178" class="l"><a class="l" href="#178">178: </a><span class="php-comment"> * |
</span></span><span id="179" class="l"><a class="l" href="#179">179: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="180" class="l"><a class="l" href="#180">180: </a><span class="php-comment"> * @return int|false Last modified time of cache entry if it is available, false otherwise |
</span></span><span id="181" class="l"><a class="l" href="#181">181: </a><span class="php-comment"> */</span> |
</span><span id="182" class="l"><a class="l" href="#182">182: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_tester" href="#_tester">tester</a>(<span class="php-var">$id</span>) { |
</span><span id="183" class="l"><a class="l" href="#183">183: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">false</span>; |
</span><span id="184" class="l"><a class="l" href="#184">184: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'mise_en_cache'</span>] === <span class="php-keyword1">true</span>) { |
</span><span id="185" class="l"><a class="l" href="#185">185: </a> <span class="php-var">$id</span> = <span class="php-var">$this</span>->prefixerId(<span class="php-var">$id</span>); |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> self::validerIdOuTag(<span class="php-var">$id</span>); |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> <span class="php-var">$this</span>->dernier_id = <span class="php-var">$id</span>; |
</span><span id="188" class="l"><a class="l" href="#188">188: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'tester'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$id</span>)); |
</span><span id="189" class="l"><a class="l" href="#189">189: </a> } |
</span><span id="190" class="l"><a class="l" href="#190">190: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="191" class="l"><a class="l" href="#191">191: </a> } |
</span><span id="192" class="l"><a class="l" href="#192">192: </a> |
</span><span id="193" class="l"><a class="l" href="#193">193: </a> <span class="php-comment">/** |
</span></span><span id="194" class="l"><a class="l" href="#194">194: </a><span class="php-comment"> * Sauvegarde en cache les données passées en paramètre. |
</span></span><span id="195" class="l"><a class="l" href="#195">195: </a><span class="php-comment"> * |
</span></span><span id="196" class="l"><a class="l" href="#196">196: </a><span class="php-comment"> * @param mixed $donnees Données à mettre en cache (peut être différent d'une chaine si serialisation_auto vaut true). |
</span></span><span id="197" class="l"><a class="l" href="#197">197: </a><span class="php-comment"> * @param string $id Identifiant du cache (s'il n'est pas définit, le dernier identifiant sera utilisé). |
</span></span><span id="198" class="l"><a class="l" href="#198">198: </a><span class="php-comment"> * @param array $tags Mots-clés du cache. |
</span></span><span id="199" class="l"><a class="l" href="#199">199: </a><span class="php-comment"> * @param int $duree_de_vie_specifique Si != false, indique une durée de vie spécifique pour cet enregistrement en cache (null => durée de vie infinie) |
</span></span><span id="200" class="l"><a class="l" href="#200">200: </a><span class="php-comment"> * @return boolean True si aucun problème n'est survenu. |
</span></span><span id="201" class="l"><a class="l" href="#201">201: </a><span class="php-comment"> */</span> |
</span><span id="202" class="l"><a class="l" href="#202">202: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_sauver" href="#_sauver">sauver</a>(<span class="php-var">$donnees</span>, <span class="php-var">$id</span> = <span class="php-keyword1">null</span>, <span class="php-var">$tags</span> = <span class="php-keyword1">array</span>(), <span class="php-var">$duree_de_vie_specifique</span> = <span class="php-keyword1">false</span>) { |
</span><span id="203" class="l"><a class="l" href="#203">203: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="204" class="l"><a class="l" href="#204">204: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'mise_en_cache'</span>] === <span class="php-keyword1">true</span>) { |
</span><span id="205" class="l"><a class="l" href="#205">205: </a> <span class="php-var">$id</span> = (<span class="php-var">$id</span> === <span class="php-keyword1">null</span>) ? <span class="php-var">$this</span>->dernier_id : <span class="php-var">$this</span>->prefixerId(<span class="php-var">$id</span>); |
</span><span id="206" class="l"><a class="l" href="#206">206: </a> |
</span><span id="207" class="l"><a class="l" href="#207">207: </a> self::validerIdOuTag(<span class="php-var">$id</span>); |
</span><span id="208" class="l"><a class="l" href="#208">208: </a> self::validerTableauDeTags(<span class="php-var">$tags</span>); |
</span><span id="209" class="l"><a class="l" href="#209">209: </a> <span class="php-var">$donnees</span> = <span class="php-var">$this</span>->serialiserAutomatiquement(<span class="php-var">$donnees</span>); |
</span><span id="210" class="l"><a class="l" href="#210">210: </a> <span class="php-var">$this</span>->nettoyerAutomatiquement(); |
</span><span id="211" class="l"><a class="l" href="#211">211: </a> |
</span><span id="212" class="l"><a class="l" href="#212">212: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'sauver'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$donnees</span>, <span class="php-var">$id</span>, <span class="php-var">$tags</span>, <span class="php-var">$duree_de_vie_specifique</span>)); |
</span><span id="213" class="l"><a class="l" href="#213">213: </a> |
</span><span id="214" class="l"><a class="l" href="#214">214: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span> == <span class="php-keyword1">false</span>) { |
</span><span id="215" class="l"><a class="l" href="#215">215: </a> <span class="php-comment">// Le cache étant peut être corrompu, nous le supprimons</span> |
</span><span id="216" class="l"><a class="l" href="#216">216: </a> <span class="php-var">$this</span>->supprimer(<span class="php-var">$id</span>); |
</span><span id="217" class="l"><a class="l" href="#217">217: </a> } <span class="php-keyword1">else</span> { |
</span><span id="218" class="l"><a class="l" href="#218">218: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->controlerEcriture(<span class="php-var">$id</span>, <span class="php-var">$donnees</span>); |
</span><span id="219" class="l"><a class="l" href="#219">219: </a> } |
</span><span id="220" class="l"><a class="l" href="#220">220: </a> } |
</span><span id="221" class="l"><a class="l" href="#221">221: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="222" class="l"><a class="l" href="#222">222: </a> } |
</span><span id="223" class="l"><a class="l" href="#223">223: </a> |
</span><span id="224" class="l"><a class="l" href="#224">224: </a> <span class="php-comment">/** |
</span></span><span id="225" class="l"><a class="l" href="#225">225: </a><span class="php-comment"> * Supprime un enregistrement en cache. |
</span></span><span id="226" class="l"><a class="l" href="#226">226: </a><span class="php-comment"> * |
</span></span><span id="227" class="l"><a class="l" href="#227">227: </a><span class="php-comment"> * @param string $id Identificant du cache à supprimer. |
</span></span><span id="228" class="l"><a class="l" href="#228">228: </a><span class="php-comment"> * @return boolean True si ok |
</span></span><span id="229" class="l"><a class="l" href="#229">229: </a><span class="php-comment"> */</span> |
</span><span id="230" class="l"><a class="l" href="#230">230: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_supprimer" href="#_supprimer">supprimer</a>(<span class="php-var">$id</span>) { |
</span><span id="231" class="l"><a class="l" href="#231">231: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="232" class="l"><a class="l" href="#232">232: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'mise_en_cache'</span>] === <span class="php-keyword1">true</span>) { |
</span><span id="233" class="l"><a class="l" href="#233">233: </a> <span class="php-var">$id</span> = <span class="php-var">$this</span>->prefixerId(<span class="php-var">$id</span>); |
</span><span id="234" class="l"><a class="l" href="#234">234: </a> self::validerIdOuTag(<span class="php-var">$id</span>); |
</span><span id="235" class="l"><a class="l" href="#235">235: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'supprimer'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$id</span>)); |
</span><span id="236" class="l"><a class="l" href="#236">236: </a> } |
</span><span id="237" class="l"><a class="l" href="#237">237: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="238" class="l"><a class="l" href="#238">238: </a> } |
</span><span id="239" class="l"><a class="l" href="#239">239: </a> |
</span><span id="240" class="l"><a class="l" href="#240">240: </a> <span class="php-comment">/** |
</span></span><span id="241" class="l"><a class="l" href="#241">241: </a><span class="php-comment"> * Nettoyage des enregistrements en cache |
</span></span><span id="242" class="l"><a class="l" href="#242">242: </a><span class="php-comment"> * |
</span></span><span id="243" class="l"><a class="l" href="#243">243: </a><span class="php-comment"> * Mode de nettoyage disponibles : |
</span></span><span id="244" class="l"><a class="l" href="#244">244: </a><span class="php-comment"> * 'tous' (défaut) => supprime tous les enregistrements ($tags n'est pas utilisé) |
</span></span><span id="245" class="l"><a class="l" href="#245">245: </a><span class="php-comment"> * 'expiration' => supprime tous les enregistrements dont la date d'expériration est dépassée ($tags n'est pas utilisé) |
</span></span><span id="246" class="l"><a class="l" href="#246">246: </a><span class="php-comment"> * 'avecLesTag' => supprime tous les enregistrements contenant tous les tags indiqués |
</span></span><span id="247" class="l"><a class="l" href="#247">247: </a><span class="php-comment"> * 'sansLesTag' => supprime tous les enregistrements contenant aucun des tags indiqués |
</span></span><span id="248" class="l"><a class="l" href="#248">248: </a><span class="php-comment"> * 'avecUnTag' => supprime tous les enregistrements contenant au moins un des tags indiqués |
</span></span><span id="249" class="l"><a class="l" href="#249">249: </a><span class="php-comment"> * |
</span></span><span id="250" class="l"><a class="l" href="#250">250: </a><span class="php-comment"> * @param string $mode mode de nettoyage |
</span></span><span id="251" class="l"><a class="l" href="#251">251: </a><span class="php-comment"> * @param array|string $tags peut être un tableau de chaîne ou une simple chaine. |
</span></span><span id="252" class="l"><a class="l" href="#252">252: </a><span class="php-comment"> * @return boolean True si ok |
</span></span><span id="253" class="l"><a class="l" href="#253">253: </a><span class="php-comment"> */</span> |
</span><span id="254" class="l"><a class="l" href="#254">254: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_nettoyer" href="#_nettoyer">nettoyer</a>(<span class="php-var">$mode</span> = self::NETTOYAGE_MODE_TOUS, <span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="255" class="l"><a class="l" href="#255">255: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="256" class="l"><a class="l" href="#256">256: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'mise_en_cache'</span>] === <span class="php-keyword1">true</span>) { |
</span><span id="257" class="l"><a class="l" href="#257">257: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">in_array</span>(<span class="php-var">$mode</span>, <span class="php-keyword1">array</span>(Cache::NETTOYAGE_MODE_TOUS, |
</span><span id="258" class="l"><a class="l" href="#258">258: </a> Cache::NETTOYAGE_MODE_EXPIRATION, |
</span><span id="259" class="l"><a class="l" href="#259">259: </a> Cache::NETTOYAGE_MODE_AVEC_LES_TAGS, |
</span><span id="260" class="l"><a class="l" href="#260">260: </a> Cache::NETTOYAGE_MODE_SANS_LES_TAGS, |
</span><span id="261" class="l"><a class="l" href="#261">261: </a> Cache::NETTOYAGE_MODE_AVEC_UN_TAG))) { |
</span><span id="262" class="l"><a class="l" href="#262">262: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Le mode de nettoyage du cache indiqué n'est pas valide"</span>, E_USER_WARNING); |
</span><span id="263" class="l"><a class="l" href="#263">263: </a> } |
</span><span id="264" class="l"><a class="l" href="#264">264: </a> self::validerTableauDeTags(<span class="php-var">$tags</span>); |
</span><span id="265" class="l"><a class="l" href="#265">265: </a> |
</span><span id="266" class="l"><a class="l" href="#266">266: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'nettoyer'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$mode</span>, <span class="php-var">$tags</span>)); |
</span><span id="267" class="l"><a class="l" href="#267">267: </a> } |
</span><span id="268" class="l"><a class="l" href="#268">268: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="269" class="l"><a class="l" href="#269">269: </a> } |
</span><span id="270" class="l"><a class="l" href="#270">270: </a> |
</span><span id="271" class="l"><a class="l" href="#271">271: </a> <span class="php-comment">/** |
</span></span><span id="272" class="l"><a class="l" href="#272">272: </a><span class="php-comment"> * Return an array of stored cache ids |
</span></span><span id="273" class="l"><a class="l" href="#273">273: </a><span class="php-comment"> * |
</span></span><span id="274" class="l"><a class="l" href="#274">274: </a><span class="php-comment"> * @return array array of stored cache ids (string) |
</span></span><span id="275" class="l"><a class="l" href="#275">275: </a><span class="php-comment"> */</span> |
</span><span id="276" class="l"><a class="l" href="#276">276: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIds" href="#_getIds">getIds</a>() { |
</span><span id="277" class="l"><a class="l" href="#277">277: </a> <span class="php-var">$ids</span> = <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'getIds'</span>); |
</span><span id="278" class="l"><a class="l" href="#278">278: </a> <span class="php-var">$ids</span> = <span class="php-var">$this</span>->supprimerPrefixe(<span class="php-var">$ids</span>); |
</span><span id="279" class="l"><a class="l" href="#279">279: </a> <span class="php-keyword1">return</span> <span class="php-var">$ids</span>; |
</span><span id="280" class="l"><a class="l" href="#280">280: </a> } |
</span><span id="281" class="l"><a class="l" href="#281">281: </a> |
</span><span id="282" class="l"><a class="l" href="#282">282: </a> <span class="php-comment">/** |
</span></span><span id="283" class="l"><a class="l" href="#283">283: </a><span class="php-comment"> * Return an array of stored tags |
</span></span><span id="284" class="l"><a class="l" href="#284">284: </a><span class="php-comment"> * |
</span></span><span id="285" class="l"><a class="l" href="#285">285: </a><span class="php-comment"> * @return array array of stored tags (string) |
</span></span><span id="286" class="l"><a class="l" href="#286">286: </a><span class="php-comment"> */</span> |
</span><span id="287" class="l"><a class="l" href="#287">287: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getTags" href="#_getTags">getTags</a>() { |
</span><span id="288" class="l"><a class="l" href="#288">288: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'getTags'</span>); |
</span><span id="289" class="l"><a class="l" href="#289">289: </a> } |
</span><span id="290" class="l"><a class="l" href="#290">290: </a> |
</span><span id="291" class="l"><a class="l" href="#291">291: </a> <span class="php-comment">/** |
</span></span><span id="292" class="l"><a class="l" href="#292">292: </a><span class="php-comment"> * Return an array of stored cache ids which match given tags |
</span></span><span id="293" class="l"><a class="l" href="#293">293: </a><span class="php-comment"> * |
</span></span><span id="294" class="l"><a class="l" href="#294">294: </a><span class="php-comment"> * In case of multiple tags, a logical AND is made between tags |
</span></span><span id="295" class="l"><a class="l" href="#295">295: </a><span class="php-comment"> * |
</span></span><span id="296" class="l"><a class="l" href="#296">296: </a><span class="php-comment"> * @param array $tags array of tags |
</span></span><span id="297" class="l"><a class="l" href="#297">297: </a><span class="php-comment"> * @return array array of matching cache ids (string) |
</span></span><span id="298" class="l"><a class="l" href="#298">298: </a><span class="php-comment"> */</span> |
</span><span id="299" class="l"><a class="l" href="#299">299: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIdsAvecLesTags" href="#_getIdsAvecLesTags">getIdsAvecLesTags</a>(<span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="300" class="l"><a class="l" href="#300">300: </a> <span class="php-var">$ids</span> = <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'getIdsAvecLesTags'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$tags</span>)); |
</span><span id="301" class="l"><a class="l" href="#301">301: </a> <span class="php-var">$ids</span> = <span class="php-var">$this</span>->supprimerPrefixe(<span class="php-var">$ids</span>); |
</span><span id="302" class="l"><a class="l" href="#302">302: </a> <span class="php-keyword1">return</span> <span class="php-var">$ids</span>; |
</span><span id="303" class="l"><a class="l" href="#303">303: </a> } |
</span><span id="304" class="l"><a class="l" href="#304">304: </a> |
</span><span id="305" class="l"><a class="l" href="#305">305: </a> <span class="php-comment">/** |
</span></span><span id="306" class="l"><a class="l" href="#306">306: </a><span class="php-comment"> * Return an array of stored cache ids which don't match given tags |
</span></span><span id="307" class="l"><a class="l" href="#307">307: </a><span class="php-comment"> * |
</span></span><span id="308" class="l"><a class="l" href="#308">308: </a><span class="php-comment"> * In case of multiple tags, a logical OR is made between tags |
</span></span><span id="309" class="l"><a class="l" href="#309">309: </a><span class="php-comment"> * |
</span></span><span id="310" class="l"><a class="l" href="#310">310: </a><span class="php-comment"> * @param array $tags array of tags |
</span></span><span id="311" class="l"><a class="l" href="#311">311: </a><span class="php-comment"> * @return array array of not matching cache ids (string) |
</span></span><span id="312" class="l"><a class="l" href="#312">312: </a><span class="php-comment"> */</span> |
</span><span id="313" class="l"><a class="l" href="#313">313: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIdsSansLesTags" href="#_getIdsSansLesTags">getIdsSansLesTags</a>(<span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="314" class="l"><a class="l" href="#314">314: </a> <span class="php-var">$ids</span> = <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'getIdsSansLesTags'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$tags</span>)); |
</span><span id="315" class="l"><a class="l" href="#315">315: </a> <span class="php-var">$ids</span> = <span class="php-var">$this</span>->supprimerPrefixe(<span class="php-var">$ids</span>); |
</span><span id="316" class="l"><a class="l" href="#316">316: </a> <span class="php-keyword1">return</span> <span class="php-var">$ids</span>; |
</span><span id="317" class="l"><a class="l" href="#317">317: </a> } |
</span><span id="318" class="l"><a class="l" href="#318">318: </a> |
</span><span id="319" class="l"><a class="l" href="#319">319: </a> <span class="php-comment">/** |
</span></span><span id="320" class="l"><a class="l" href="#320">320: </a><span class="php-comment"> * Return an array of stored cache ids which match any given tags |
</span></span><span id="321" class="l"><a class="l" href="#321">321: </a><span class="php-comment"> * |
</span></span><span id="322" class="l"><a class="l" href="#322">322: </a><span class="php-comment"> * In case of multiple tags, a logical OR is made between tags |
</span></span><span id="323" class="l"><a class="l" href="#323">323: </a><span class="php-comment"> * |
</span></span><span id="324" class="l"><a class="l" href="#324">324: </a><span class="php-comment"> * @param array $tags array of tags |
</span></span><span id="325" class="l"><a class="l" href="#325">325: </a><span class="php-comment"> * @return array array of matching any cache ids (string) |
</span></span><span id="326" class="l"><a class="l" href="#326">326: </a><span class="php-comment"> */</span> |
</span><span id="327" class="l"><a class="l" href="#327">327: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIdsAvecUnTag" href="#_getIdsAvecUnTag">getIdsAvecUnTag</a>(<span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="328" class="l"><a class="l" href="#328">328: </a> <span class="php-var">$ids</span> = <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'getIdsAvecUnTag'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$tags</span>)); |
</span><span id="329" class="l"><a class="l" href="#329">329: </a> <span class="php-var">$ids</span> = <span class="php-var">$this</span>->supprimerPrefixe(<span class="php-var">$ids</span>); |
</span><span id="330" class="l"><a class="l" href="#330">330: </a> <span class="php-keyword1">return</span> <span class="php-var">$ids</span>; |
</span><span id="331" class="l"><a class="l" href="#331">331: </a> } |
</span><span id="332" class="l"><a class="l" href="#332">332: </a> |
</span><span id="333" class="l"><a class="l" href="#333">333: </a> <span class="php-comment">/** |
</span></span><span id="334" class="l"><a class="l" href="#334">334: </a><span class="php-comment"> * Return the filling percentage of the backend storage |
</span></span><span id="335" class="l"><a class="l" href="#335">335: </a><span class="php-comment"> * |
</span></span><span id="336" class="l"><a class="l" href="#336">336: </a><span class="php-comment"> * @return int integer between 0 and 100 |
</span></span><span id="337" class="l"><a class="l" href="#337">337: </a><span class="php-comment"> */</span> |
</span><span id="338" class="l"><a class="l" href="#338">338: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getPourcentageRemplissage" href="#_getPourcentageRemplissage">getPourcentageRemplissage</a>() { |
</span><span id="339" class="l"><a class="l" href="#339">339: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'getPourcentageRemplissage'</span>); |
</span><span id="340" class="l"><a class="l" href="#340">340: </a> } |
</span><span id="341" class="l"><a class="l" href="#341">341: </a> |
</span><span id="342" class="l"><a class="l" href="#342">342: </a> <span class="php-comment">/** |
</span></span><span id="343" class="l"><a class="l" href="#343">343: </a><span class="php-comment"> * Return an array of metadatas for the given cache id |
</span></span><span id="344" class="l"><a class="l" href="#344">344: </a><span class="php-comment"> * |
</span></span><span id="345" class="l"><a class="l" href="#345">345: </a><span class="php-comment"> * The array will include these keys : |
</span></span><span id="346" class="l"><a class="l" href="#346">346: </a><span class="php-comment"> * - expire : the expire timestamp |
</span></span><span id="347" class="l"><a class="l" href="#347">347: </a><span class="php-comment"> * - tags : a string array of tags |
</span></span><span id="348" class="l"><a class="l" href="#348">348: </a><span class="php-comment"> * - mtime : timestamp of last modification time |
</span></span><span id="349" class="l"><a class="l" href="#349">349: </a><span class="php-comment"> * |
</span></span><span id="350" class="l"><a class="l" href="#350">350: </a><span class="php-comment"> * @param string $id cache id |
</span></span><span id="351" class="l"><a class="l" href="#351">351: </a><span class="php-comment"> * @return array array of metadatas (false if the cache id is not found) |
</span></span><span id="352" class="l"><a class="l" href="#352">352: </a><span class="php-comment"> */</span> |
</span><span id="353" class="l"><a class="l" href="#353">353: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getMetadonnees" href="#_getMetadonnees">getMetadonnees</a>(<span class="php-var">$id</span>) { |
</span><span id="354" class="l"><a class="l" href="#354">354: </a> <span class="php-var">$id</span> = <span class="php-var">$this</span>->prefixerId(<span class="php-var">$id</span>); |
</span><span id="355" class="l"><a class="l" href="#355">355: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'getMetadonnees'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$id</span>)); |
</span><span id="356" class="l"><a class="l" href="#356">356: </a> } |
</span><span id="357" class="l"><a class="l" href="#357">357: </a> |
</span><span id="358" class="l"><a class="l" href="#358">358: </a> <span class="php-comment">/** |
</span></span><span id="359" class="l"><a class="l" href="#359">359: </a><span class="php-comment"> * Give (if possible) an extra lifetime to the given cache id |
</span></span><span id="360" class="l"><a class="l" href="#360">360: </a><span class="php-comment"> * |
</span></span><span id="361" class="l"><a class="l" href="#361">361: </a><span class="php-comment"> * @param string $id cache id |
</span></span><span id="362" class="l"><a class="l" href="#362">362: </a><span class="php-comment"> * @param int $extraLifetime |
</span></span><span id="363" class="l"><a class="l" href="#363">363: </a><span class="php-comment"> * @return boolean true if ok |
</span></span><span id="364" class="l"><a class="l" href="#364">364: </a><span class="php-comment"> */</span> |
</span><span id="365" class="l"><a class="l" href="#365">365: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ajouterSupplementDureeDeVie" href="#_ajouterSupplementDureeDeVie">ajouterSupplementDureeDeVie</a>(<span class="php-var">$id</span>, <span class="php-var">$supplement_duree_de_vie</span>) { |
</span><span id="366" class="l"><a class="l" href="#366">366: </a> <span class="php-var">$id</span> = <span class="php-var">$this</span>->prefixerId(<span class="php-var">$id</span>); |
</span><span id="367" class="l"><a class="l" href="#367">367: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'ajouterSupplementDureeDeVie'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$id</span>, <span class="php-var">$supplement_duree_de_vie</span>)); |
</span><span id="368" class="l"><a class="l" href="#368">368: </a> } |
</span><span id="369" class="l"><a class="l" href="#369">369: </a> |
</span><span id="370" class="l"><a class="l" href="#370">370: </a> |
</span><span id="371" class="l"><a class="l" href="#371">371: </a> <span class="php-comment">/** |
</span></span><span id="372" class="l"><a class="l" href="#372">372: </a><span class="php-comment"> * Fabrique et retourne l'identifiant du cache avec son préfixe. |
</span></span><span id="373" class="l"><a class="l" href="#373">373: </a><span class="php-comment"> * |
</span></span><span id="374" class="l"><a class="l" href="#374">374: </a><span class="php-comment"> * Vérifie l'option 'cache_id_prefixe' et retourne le nouvel id avec préfixe ou simplement l'id lui même si elle vaut null. |
</span></span><span id="375" class="l"><a class="l" href="#375">375: </a><span class="php-comment"> * |
</span></span><span id="376" class="l"><a class="l" href="#376">376: </a><span class="php-comment"> * @param string $id Identifiant du cache. |
</span></span><span id="377" class="l"><a class="l" href="#377">377: </a><span class="php-comment"> * @return string Identifiant du cache avec ou sans préfixe. |
</span></span><span id="378" class="l"><a class="l" href="#378">378: </a><span class="php-comment"> */</span> |
</span><span id="379" class="l"><a class="l" href="#379">379: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_prefixerId" href="#_prefixerId">prefixerId</a>(<span class="php-var">$id</span>) { |
</span><span id="380" class="l"><a class="l" href="#380">380: </a> <span class="php-var">$nouvel_id</span> = <span class="php-var">$id</span>; |
</span><span id="381" class="l"><a class="l" href="#381">381: </a> <span class="php-keyword1">if</span> ((<span class="php-var">$id</span> !== <span class="php-keyword1">null</span>) && <span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->options[<span class="php-quote">'cache_id_prefixe'</span>])) { |
</span><span id="382" class="l"><a class="l" href="#382">382: </a> <span class="php-var">$nouvel_id</span> = <span class="php-var">$this</span>->options[<span class="php-quote">'cache_id_prefixe'</span>].<span class="php-var">$id</span>; |
</span><span id="383" class="l"><a class="l" href="#383">383: </a> } |
</span><span id="384" class="l"><a class="l" href="#384">384: </a> <span class="php-keyword1">return</span> <span class="php-var">$nouvel_id</span>; |
</span><span id="385" class="l"><a class="l" href="#385">385: </a> } |
</span><span id="386" class="l"><a class="l" href="#386">386: </a> |
</span><span id="387" class="l"><a class="l" href="#387">387: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_executerMethodeStockage" href="#_executerMethodeStockage">executerMethodeStockage</a>(<span class="php-var">$methode</span>, <span class="php-var">$params</span> = <span class="php-keyword1">null</span>) { |
</span><span id="388" class="l"><a class="l" href="#388">388: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">method_exists</span>(<span class="php-var">$this</span>->stockage, <span class="php-var">$methode</span>)) { |
</span><span id="389" class="l"><a class="l" href="#389">389: </a> <span class="php-keyword1">if</span> (<span class="php-var">$params</span> == <span class="php-keyword1">null</span>) { |
</span><span id="390" class="l"><a class="l" href="#390">390: </a> <span class="php-var">$resultat</span> = <span class="php-keyword2">call_user_func</span>(<span class="php-keyword1">array</span>(<span class="php-var">$this</span>->stockage, <span class="php-var">$methode</span>)); |
</span><span id="391" class="l"><a class="l" href="#391">391: </a> } <span class="php-keyword1">else</span> { |
</span><span id="392" class="l"><a class="l" href="#392">392: </a> <span class="php-var">$resultat</span> = <span class="php-keyword2">call_user_func_array</span>(<span class="php-keyword1">array</span>(<span class="php-var">$this</span>->stockage, <span class="php-var">$methode</span>), <span class="php-var">$params</span>); |
</span><span id="393" class="l"><a class="l" href="#393">393: </a> } |
</span><span id="394" class="l"><a class="l" href="#394">394: </a> } <span class="php-keyword1">else</span> { |
</span><span id="395" class="l"><a class="l" href="#395">395: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">false</span>; |
</span><span id="396" class="l"><a class="l" href="#396">396: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"La méthode '</span><span class="php-var">$methode</span><span class="php-quote">' n'existe pas dans la classe '"</span>.<span class="php-keyword2">get_class</span>(<span class="php-var">$this</span>).<span class="php-quote">"'."</span>, E_USER_WARNING); |
</span><span id="397" class="l"><a class="l" href="#397">397: </a> } |
</span><span id="398" class="l"><a class="l" href="#398">398: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="399" class="l"><a class="l" href="#399">399: </a> } |
</span><span id="400" class="l"><a class="l" href="#400">400: </a> |
</span><span id="401" class="l"><a class="l" href="#401">401: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_supprimerPrefixe" href="#_supprimerPrefixe">supprimerPrefixe</a>(<span class="php-var">$ids</span>) { |
</span><span id="402" class="l"><a class="l" href="#402">402: </a> <span class="php-comment">// Il est nécessaire de retirer les cache_id_prefixe des ids (voir #ZF-6178, #ZF-7600)</span> |
</span><span id="403" class="l"><a class="l" href="#403">403: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->options[<span class="php-quote">'cache_id_prefixe'</span>]) && <span class="php-var">$this</span>->options[<span class="php-quote">'cache_id_prefixe'</span>] !== <span class="php-quote">''</span>) { |
</span><span id="404" class="l"><a class="l" href="#404">404: </a> <span class="php-var">$prefixe</span> =& <span class="php-var">$this</span>->options[<span class="php-quote">'cache_id_prefixe'</span>]; |
</span><span id="405" class="l"><a class="l" href="#405">405: </a> <span class="php-var">$prefixe_longueur</span> = <span class="php-keyword2">strlen</span>(<span class="php-var">$prefixe</span>); |
</span><span id="406" class="l"><a class="l" href="#406">406: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$ids</span> <span class="php-keyword1">as</span> &<span class="php-var">$id</span>) { |
</span><span id="407" class="l"><a class="l" href="#407">407: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strpos</span>(<span class="php-var">$id</span>, <span class="php-var">$prefixe</span>) === <span class="php-num">0</span>) { |
</span><span id="408" class="l"><a class="l" href="#408">408: </a> <span class="php-var">$id</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$id</span>, <span class="php-var">$prefixe_longueur</span>); |
</span><span id="409" class="l"><a class="l" href="#409">409: </a> } |
</span><span id="410" class="l"><a class="l" href="#410">410: </a> } |
</span><span id="411" class="l"><a class="l" href="#411">411: </a> } |
</span><span id="412" class="l"><a class="l" href="#412">412: </a> <span class="php-keyword1">return</span> <span class="php-var">$ids</span>; |
</span><span id="413" class="l"><a class="l" href="#413">413: </a> } |
</span><span id="414" class="l"><a class="l" href="#414">414: </a> |
</span><span id="415" class="l"><a class="l" href="#415">415: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_controlerEcriture" href="#_controlerEcriture">controlerEcriture</a>(<span class="php-var">$id</span>, <span class="php-var">$donnees_avant_ecriture</span>) { |
</span><span id="416" class="l"><a class="l" href="#416">416: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="417" class="l"><a class="l" href="#417">417: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'controle_ecriture'</span>]) { |
</span><span id="418" class="l"><a class="l" href="#418">418: </a> <span class="php-var">$donnees_apres_ecriture</span> = <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'charger'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$id</span>, <span class="php-keyword1">true</span>)); |
</span><span id="419" class="l"><a class="l" href="#419">419: </a> <span class="php-keyword1">if</span> (<span class="php-var">$donnees_avant_ecriture</span> != <span class="php-var">$donnees_apres_ecriture</span>) { |
</span><span id="420" class="l"><a class="l" href="#420">420: </a> <span class="php-var">$this</span>->executerMethodeStockage(<span class="php-quote">'supprimer'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$id</span>)); |
</span><span id="421" class="l"><a class="l" href="#421">421: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">false</span>; |
</span><span id="422" class="l"><a class="l" href="#422">422: </a> } |
</span><span id="423" class="l"><a class="l" href="#423">423: </a> } |
</span><span id="424" class="l"><a class="l" href="#424">424: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="425" class="l"><a class="l" href="#425">425: </a> } |
</span><span id="426" class="l"><a class="l" href="#426">426: </a> |
</span><span id="427" class="l"><a class="l" href="#427">427: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_deserialiserAutomatiquement" href="#_deserialiserAutomatiquement">deserialiserAutomatiquement</a>(<span class="php-var">$donnees</span>) { |
</span><span id="428" class="l"><a class="l" href="#428">428: </a> <span class="php-keyword1">if</span> (<span class="php-var">$donnees</span> !== <span class="php-keyword1">false</span> && <span class="php-var">$this</span>->options[<span class="php-quote">'serialisation_auto'</span>]) { |
</span><span id="429" class="l"><a class="l" href="#429">429: </a> <span class="php-comment">// we need to unserialize before sending the result</span> |
</span><span id="430" class="l"><a class="l" href="#430">430: </a> <span class="php-var">$donnees</span> = <span class="php-keyword2">unserialize</span>(<span class="php-var">$donnees</span>); |
</span><span id="431" class="l"><a class="l" href="#431">431: </a> } |
</span><span id="432" class="l"><a class="l" href="#432">432: </a> <span class="php-keyword1">return</span> <span class="php-var">$donnees</span>; |
</span><span id="433" class="l"><a class="l" href="#433">433: </a> } |
</span><span id="434" class="l"><a class="l" href="#434">434: </a> |
</span><span id="435" class="l"><a class="l" href="#435">435: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_serialiserAutomatiquement" href="#_serialiserAutomatiquement">serialiserAutomatiquement</a>(<span class="php-var">$donnees</span>) { |
</span><span id="436" class="l"><a class="l" href="#436">436: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'serialisation_auto'</span>]) { |
</span><span id="437" class="l"><a class="l" href="#437">437: </a> <span class="php-comment">// we need to serialize datas before storing them</span> |
</span><span id="438" class="l"><a class="l" href="#438">438: </a> <span class="php-var">$donnees</span> = <span class="php-keyword2">serialize</span>(<span class="php-var">$donnees</span>); |
</span><span id="439" class="l"><a class="l" href="#439">439: </a> } <span class="php-keyword1">else</span> { |
</span><span id="440" class="l"><a class="l" href="#440">440: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_string</span>(<span class="php-var">$donnees</span>)) { |
</span><span id="441" class="l"><a class="l" href="#441">441: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Les données doivent être une chaîne de caractères ou vous devez activez l'option serialisation_auto = true"</span>, E_USER_WARNING); |
</span><span id="442" class="l"><a class="l" href="#442">442: </a> } |
</span><span id="443" class="l"><a class="l" href="#443">443: </a> } |
</span><span id="444" class="l"><a class="l" href="#444">444: </a> <span class="php-keyword1">return</span> <span class="php-var">$donnees</span>; |
</span><span id="445" class="l"><a class="l" href="#445">445: </a> } |
</span><span id="446" class="l"><a class="l" href="#446">446: </a> |
</span><span id="447" class="l"><a class="l" href="#447">447: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_nettoyerAutomatiquement" href="#_nettoyerAutomatiquement">nettoyerAutomatiquement</a>() { |
</span><span id="448" class="l"><a class="l" href="#448">448: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'nettoyage_auto'</span>] > <span class="php-num">0</span>) { |
</span><span id="449" class="l"><a class="l" href="#449">449: </a> <span class="php-var">$rand</span> = <span class="php-keyword2">rand</span>(<span class="php-num">1</span>, <span class="php-var">$this</span>->options[<span class="php-quote">'nettoyage_auto'</span>]); |
</span><span id="450" class="l"><a class="l" href="#450">450: </a> <span class="php-keyword1">if</span> (<span class="php-var">$rand</span> == <span class="php-num">1</span>) { |
</span><span id="451" class="l"><a class="l" href="#451">451: </a> <span class="php-var">$this</span>->nettoyer(self::NETTOYAGE_MODE_EXPIRATION); |
</span><span id="452" class="l"><a class="l" href="#452">452: </a> } |
</span><span id="453" class="l"><a class="l" href="#453">453: </a> } |
</span><span id="454" class="l"><a class="l" href="#454">454: </a> } |
</span><span id="455" class="l"><a class="l" href="#455">455: </a> |
</span><span id="456" class="l"><a class="l" href="#456">456: </a> <span class="php-comment">/** |
</span></span><span id="457" class="l"><a class="l" href="#457">457: </a><span class="php-comment"> * Valide un identifiant de cache ou un tag (securité, nom de fichiers fiables, préfixes réservés...) |
</span></span><span id="458" class="l"><a class="l" href="#458">458: </a><span class="php-comment"> * |
</span></span><span id="459" class="l"><a class="l" href="#459">459: </a><span class="php-comment"> * @param string $chaine Identificant de cache ou tag |
</span></span><span id="460" class="l"><a class="l" href="#460">460: </a><span class="php-comment"> * @return void |
</span></span><span id="461" class="l"><a class="l" href="#461">461: </a><span class="php-comment"> */</span> |
</span><span id="462" class="l"><a class="l" href="#462">462: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_validerIdOuTag" href="#_validerIdOuTag">validerIdOuTag</a>(<span class="php-var">$chaine</span>) { |
</span><span id="463" class="l"><a class="l" href="#463">463: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_string</span>(<span class="php-var">$chaine</span>)) { |
</span><span id="464" class="l"><a class="l" href="#464">464: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">'Id ou tag invalide : doit être une chaîne de caractères'</span>, E_USER_ERROR); |
</span><span id="465" class="l"><a class="l" href="#465">465: </a> } |
</span><span id="466" class="l"><a class="l" href="#466">466: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$chaine</span>, <span class="php-num">0</span>, <span class="php-num">9</span>) == <span class="php-quote">'internal-'</span>) { |
</span><span id="467" class="l"><a class="l" href="#467">467: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">'"internal-*" identifiants ou tags sont réservés'</span>, E_USER_WARNING); |
</span><span id="468" class="l"><a class="l" href="#468">468: </a> } |
</span><span id="469" class="l"><a class="l" href="#469">469: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">preg_match</span>(<span class="php-quote">'~^[a-zA-Z0-9_]+$~D'</span>, <span class="php-var">$chaine</span>)) { |
</span><span id="470" class="l"><a class="l" href="#470">470: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Id ou tag invalide '</span><span class="php-var">$chaine</span><span class="php-quote">' : doit contenir seulement [a-zA-Z0-9_]"</span>, E_USER_WARNING); |
</span><span id="471" class="l"><a class="l" href="#471">471: </a> } |
</span><span id="472" class="l"><a class="l" href="#472">472: </a> } |
</span><span id="473" class="l"><a class="l" href="#473">473: </a> |
</span><span id="474" class="l"><a class="l" href="#474">474: </a> <span class="php-comment">/** |
</span></span><span id="475" class="l"><a class="l" href="#475">475: </a><span class="php-comment"> * Valide un tableau de tags (securité, nom de fichiers fiables, préfixes réservés...) |
</span></span><span id="476" class="l"><a class="l" href="#476">476: </a><span class="php-comment"> * |
</span></span><span id="477" class="l"><a class="l" href="#477">477: </a><span class="php-comment"> * @param array $tags tableau de tags |
</span></span><span id="478" class="l"><a class="l" href="#478">478: </a><span class="php-comment"> * @return void |
</span></span><span id="479" class="l"><a class="l" href="#479">479: </a><span class="php-comment"> */</span> |
</span><span id="480" class="l"><a class="l" href="#480">480: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_validerTableauDeTags" href="#_validerTableauDeTags">validerTableauDeTags</a>(<span class="php-var">$tags</span>) { |
</span><span id="481" class="l"><a class="l" href="#481">481: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_array</span>(<span class="php-var">$tags</span>)) { |
</span><span id="482" class="l"><a class="l" href="#482">482: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Tableau de tags invalide : doit être un tableau 'array'"</span>, E_USER_WARNING); |
</span><span id="483" class="l"><a class="l" href="#483">483: </a> } |
</span><span id="484" class="l"><a class="l" href="#484">484: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tags</span> <span class="php-keyword1">as</span> <span class="php-var">$tag</span>) { |
</span><span id="485" class="l"><a class="l" href="#485">485: </a> self::validerIdOuTag(<span class="php-var">$tag</span>); |
</span><span id="486" class="l"><a class="l" href="#486">486: </a> } |
</span><span id="487" class="l"><a class="l" href="#487">487: </a> <span class="php-keyword2">reset</span>(<span class="php-var">$tags</span>); |
</span><span id="488" class="l"><a class="l" href="#488">488: </a> } |
</span><span id="489" class="l"><a class="l" href="#489">489: </a> |
</span><span id="490" class="l"><a class="l" href="#490">490: </a> <span class="php-comment">/** |
</span></span><span id="491" class="l"><a class="l" href="#491">491: </a><span class="php-comment"> * Calcule et retourne le timestamp d'expiration |
</span></span><span id="492" class="l"><a class="l" href="#492">492: </a><span class="php-comment"> * |
</span></span><span id="493" class="l"><a class="l" href="#493">493: </a><span class="php-comment"> * @return int timestamp d'expiration (unix timestamp) |
</span></span><span id="494" class="l"><a class="l" href="#494">494: </a><span class="php-comment"> */</span> |
</span><span id="495" class="l"><a class="l" href="#495">495: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getTimestampExpiration" href="#_getTimestampExpiration">getTimestampExpiration</a>(<span class="php-var">$duree_de_vie</span>) { |
</span><span id="496" class="l"><a class="l" href="#496">496: </a> <span class="php-keyword1">if</span> (<span class="php-var">$duree_de_vie</span> === <span class="php-keyword1">false</span>) { |
</span><span id="497" class="l"><a class="l" href="#497">497: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->options[<span class="php-quote">'duree_de_vie'</span>]) && <span class="php-keyword2">is_int</span>(<span class="php-var">$this</span>->options[<span class="php-quote">'duree_de_vie'</span>])) { |
</span><span id="498" class="l"><a class="l" href="#498">498: </a> <span class="php-var">$duree_de_vie</span> = (int) <span class="php-var">$this</span>->options[<span class="php-quote">'duree_de_vie'</span>]; |
</span><span id="499" class="l"><a class="l" href="#499">499: </a> } <span class="php-keyword1">else</span> { |
</span><span id="500" class="l"><a class="l" href="#500">500: </a> <span class="php-var">$duree_de_vie</span> = <span class="php-num">3600</span>; |
</span><span id="501" class="l"><a class="l" href="#501">501: </a> } |
</span><span id="502" class="l"><a class="l" href="#502">502: </a> } |
</span><span id="503" class="l"><a class="l" href="#503">503: </a> <span class="php-var">$timestamp</span> = (<span class="php-var">$duree_de_vie</span> === <span class="php-keyword1">null</span>) ? <span class="php-num">9999999999</span> : (<span class="php-keyword2">time</span>() + <span class="php-var">$duree_de_vie</span>); |
</span><span id="504" class="l"><a class="l" href="#504">504: </a> <span class="php-keyword1">return</span> <span class="php-var">$timestamp</span>; |
</span><span id="505" class="l"><a class="l" href="#505">505: </a> } |
</span><span id="506" class="l"><a class="l" href="#506">506: </a> |
</span><span id="507" class="l"><a class="l" href="#507">507: </a></span>}</code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-GestionnaireException.html |
---|
New file |
0,0 → 1,370 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/GestionnaireException.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li class="active"><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-GestionnaireException.html" title="Summary of GestionnaireException"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe de gestion des exceptions. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * C'est un Singleton. |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @package Framework |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @author Aurélien PERONNET <aurelien@tela-botanica.org> |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jmp@tela-botanica.org> |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @version $Id: GestionnaireException.php 369 2011-10-03 12:47:17Z jpm $$ |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> */</span> |
</span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-keyword1">class</span> <a id="GestionnaireException" href="#GestionnaireException">GestionnaireException</a> { |
</span><span id="19" class="l"><a class="l" href="#19"> 19: </a> |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> <span class="php-keyword1">const</span> <a id="MODE_CLI" href="#MODE_CLI">MODE_CLI</a> = <span class="php-quote">'cli'</span>; |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> <span class="php-comment">/** Liste des exceptions enregistrées */</span> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$exceptions" href="#$exceptions">$exceptions</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> <span class="php-comment">/** Détermine si l'on affiche ou non le contexte */</span> |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$contexte" href="#$contexte">$contexte</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-comment">/** Détermine si l'on loggue ou non les erreurs */</span> |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$logger" href="#$logger">$logger</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> <span class="php-comment">/** Détermine si l'affichage des erreurs est forcé (true) ou pas (false) à la destruction de la classe */</span> |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$afficher" href="#$afficher">$afficher</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> <span class="php-comment">/** Definit si php est lancé en ligne de commande ou en mode serveur */</span> |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$mode" href="#$mode">$mode</a></span> = <span class="php-keyword1">null</span> ; |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> <span class="php-comment">/** Tableau des noms des paramètres à définir dans le fichier de config car obligatoirement nécessaire à cette classe.*/</span> |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$parametres_obligatoires" href="#$parametres_obligatoires">$parametres_obligatoires</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'debogage'</span>, <span class="php-quote">'debogage_contexte'</span>, <span class="php-quote">'log_debogage'</span>); |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> <span class="php-comment">/** Initialise le Gestionnaire d'exceptions et d'erreur sans tenir comptes des paramêtres de config. */</span> |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_initialiser" href="#_initialiser">initialiser</a>() { |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> self::<span class="php-var">$mode</span> = <span class="php-keyword2">php_sapi_name</span>(); |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> <span class="php-comment">// Désactivation des balises HTML dans les messages d'erreur de PHP en mode ligne de commande</span> |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> <span class="php-keyword1">if</span> (self::<span class="php-var">$mode</span> == self::MODE_CLI) { |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> <span class="php-keyword2">ini_set</span>(<span class="php-quote">'html_errors'</span>, <span class="php-num">0</span>); |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> } |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-keyword2">set_exception_handler</span>(<span class="php-keyword1">array</span>(<span class="php-keyword2">get_class</span>(),<span class="php-quote">'gererException'</span>)); |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-keyword2">set_error_handler</span>(<span class="php-keyword1">array</span>(<span class="php-keyword2">get_class</span>(),<span class="php-quote">'gererErreur'</span>)); |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> } |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> <span class="php-comment">/** Configure le Gestionnaire d'exceptions et d'erreur à partir des paramêtres de config. */</span> |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_configurer" href="#_configurer">configurer</a>() { |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> Config::verifierPresenceParametres(self::<span class="php-var">$parametres_obligatoires</span>); |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> self::<span class="php-var">$contexte</span> = Config::get(<span class="php-quote">'debogage_contexte'</span>); |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> self::<span class="php-var">$logger</span> = Config::get(<span class="php-quote">'log_debogage'</span>); |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> self::<span class="php-var">$afficher</span> = Config::get(<span class="php-quote">'debogage'</span>); |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> } |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> <span class="php-comment">/** |
</span></span><span id="61" class="l"><a class="l" href="#61"> 61: </a><span class="php-comment"> * Renvoie le nombre d'exceptions et d'erreurs levées. |
</span></span><span id="62" class="l"><a class="l" href="#62"> 62: </a><span class="php-comment"> * @see getExceptions() pour obtenir les exceptions formatées. |
</span></span><span id="63" class="l"><a class="l" href="#63"> 63: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="64" class="l"><a class="l" href="#64"> 64: </a><span class="php-comment"> * @return int le nombre d'exception actuellement levées |
</span></span><span id="65" class="l"><a class="l" href="#65"> 65: </a><span class="php-comment"> */</span> |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getExceptionsNbre" href="#_getExceptionsNbre">getExceptionsNbre</a>() { |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">count</span>(self::<span class="php-var">$exceptions</span>); |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> } |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> <span class="php-comment">/** |
</span></span><span id="71" class="l"><a class="l" href="#71"> 71: </a><span class="php-comment"> * Renvoie le booleen définissant si l'on affiche le contexte ou non |
</span></span><span id="72" class="l"><a class="l" href="#72"> 72: </a><span class="php-comment"> * @return bool true si on affiche le contexte sinon false. |
</span></span><span id="73" class="l"><a class="l" href="#73"> 73: </a><span class="php-comment"> */</span> |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getContexte" href="#_getContexte">getContexte</a>() { |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> <span class="php-keyword1">return</span> self::<span class="php-var">$contexte</span>; |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> } |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> <span class="php-comment">/** |
</span></span><span id="79" class="l"><a class="l" href="#79"> 79: </a><span class="php-comment"> * Definit si l'on veut afficher le contexte ou non |
</span></span><span id="80" class="l"><a class="l" href="#80"> 80: </a><span class="php-comment"> * @param bool true si on veut afficher le contexte, false sinon, par défaut vaut false |
</span></span><span id="81" class="l"><a class="l" href="#81"> 81: </a><span class="php-comment"> */</span> |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_setContexte" href="#_setContexte">setContexte</a>(<span class="php-var">$contexte</span>) { |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> self::<span class="php-var">$contexte</span> = <span class="php-var">$contexte</span>; |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> } |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> <span class="php-comment">/** |
</span></span><span id="87" class="l"><a class="l" href="#87"> 87: </a><span class="php-comment"> * Fonction de gestion des exceptions, remplace le handler par défaut. |
</span></span><span id="88" class="l"><a class="l" href="#88"> 88: </a><span class="php-comment"> * Si une boucle génère de multiple exception (ou erreur) identique une seule sera stockée. |
</span></span><span id="89" class="l"><a class="l" href="#89"> 89: </a><span class="php-comment"> * @param Exception $e l'exception à traiter |
</span></span><span id="90" class="l"><a class="l" href="#90"> 90: </a><span class="php-comment"> */</span> |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_gererException" href="#_gererException">gererException</a>(Exception <span class="php-var">$e</span>) { |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-var">$cle</span> = <span class="php-keyword2">hash</span>(<span class="php-quote">'md5'</span>, <span class="php-var">$e</span>->getMessage().<span class="php-quote">'-'</span>.<span class="php-var">$e</span>->getFile().<span class="php-quote">'-'</span>.<span class="php-var">$e</span>->getLine()); |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(self::<span class="php-var">$exceptions</span>[<span class="php-var">$cle</span>])) { |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> self::<span class="php-var">$exceptions</span>[<span class="php-var">$cle</span>] = <span class="php-var">$e</span>; |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> self::loggerException(<span class="php-var">$e</span>); |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> } |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> } |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> <span class="php-comment">/** |
</span></span><span id="100" class="l"><a class="l" href="#100">100: </a><span class="php-comment"> * Gère les erreurs en les convertissant en exceptions (remplace la fonction gestion d'erreurs native de php) |
</span></span><span id="101" class="l"><a class="l" href="#101">101: </a><span class="php-comment"> * @param int $niveau le niveau de l'erreur |
</span></span><span id="102" class="l"><a class="l" href="#102">102: </a><span class="php-comment"> * @param string $message le message associé à l'erreur |
</span></span><span id="103" class="l"><a class="l" href="#103">103: </a><span class="php-comment"> * @param string $fichier le nom du fichier où l'erreur s'est produite |
</span></span><span id="104" class="l"><a class="l" href="#104">104: </a><span class="php-comment"> * @param int $ligne la ligne où l'erreur s'est produite |
</span></span><span id="105" class="l"><a class="l" href="#105">105: </a><span class="php-comment"> * @param string $contexte le contexte associé à l'erreur |
</span></span><span id="106" class="l"><a class="l" href="#106">106: </a><span class="php-comment"> */</span> |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_gererErreur" href="#_gererErreur">gererErreur</a>(<span class="php-var">$niveau</span>, <span class="php-var">$message</span>, <span class="php-var">$fichier</span>, <span class="php-var">$ligne</span>, <span class="php-var">$contexte</span>){ |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> <span class="php-comment">// Si un rapport d'erreur existe, création d'une exception</span> |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">error_reporting</span>() != <span class="php-num">0</span>) { |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> <span class="php-var">$e</span> = <span class="php-keyword1">new</span> ErrorException(<span class="php-var">$message</span>, <span class="php-num">0</span>, <span class="php-var">$niveau</span>, <span class="php-var">$fichier</span>, <span class="php-var">$ligne</span>); |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> self::gererException(<span class="php-var">$e</span>); |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> } |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">null</span>; |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> } |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> <span class="php-comment">/** |
</span></span><span id="117" class="l"><a class="l" href="#117">117: </a><span class="php-comment"> * Renvoie les exceptions au format (X)HTML ou bien au format texte suivant le mode d'utilisation de PHP. |
</span></span><span id="118" class="l"><a class="l" href="#118">118: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="119" class="l"><a class="l" href="#119">119: </a><span class="php-comment"> * @deprecated |
</span></span><span id="120" class="l"><a class="l" href="#120">120: </a><span class="php-comment"> * @see getExceptionsFormatees() |
</span></span><span id="121" class="l"><a class="l" href="#121">121: </a><span class="php-comment"> * @return string les exceptions formatées en texte ou (X)HTML. |
</span></span><span id="122" class="l"><a class="l" href="#122">122: </a><span class="php-comment"> */</span> |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getExceptions" href="#_getExceptions">getExceptions</a>() { |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> <span class="php-keyword1">return</span> self::getExceptionsFormatees(); |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> } |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-comment">/** |
</span></span><span id="128" class="l"><a class="l" href="#128">128: </a><span class="php-comment"> * Renvoie les exceptions au format (X)HTML ou bien au format texte suivant le mode d'utilisation de PHP. |
</span></span><span id="129" class="l"><a class="l" href="#129">129: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="130" class="l"><a class="l" href="#130">130: </a><span class="php-comment"> * @return string les exceptions formatées en texte ou (X)HTML. |
</span></span><span id="131" class="l"><a class="l" href="#131">131: </a><span class="php-comment"> */</span> |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getExceptionsFormatees" href="#_getExceptionsFormatees">getExceptionsFormatees</a>() { |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> <span class="php-var">$retour</span> = <span class="php-quote">''</span>; |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> <span class="php-keyword1">if</span> (self::getExceptionsNbre() > <span class="php-num">0</span>) { |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> <span class="php-keyword1">foreach</span> (self::<span class="php-var">$exceptions</span> <span class="php-keyword1">as</span> <span class="php-var">$cle</span> => <span class="php-var">$e</span>) { |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> <span class="php-keyword1">switch</span> (self::<span class="php-var">$mode</span>) { |
</span><span id="137" class="l"><a class="l" href="#137">137: </a> <span class="php-keyword1">case</span> self::MODE_CLI : |
</span><span id="138" class="l"><a class="l" href="#138">138: </a> <span class="php-var">$retour</span> .= self::formaterExceptionTxt(<span class="php-var">$e</span>); |
</span><span id="139" class="l"><a class="l" href="#139">139: </a> <span class="php-keyword1">break</span>; |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> <span class="php-keyword1">default</span>: |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> <span class="php-var">$retour</span> .= self::formaterExceptionXhtml(<span class="php-var">$e</span>); |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> } |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-comment">// Nous vidons le tableau des exceptions au fur et à mesure pour éviter le réaffichage avec le destructeur.</span> |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-keyword1">unset</span>(self::<span class="php-var">$exceptions</span>[<span class="php-var">$cle</span>]); |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> } |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> } |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> } |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> <span class="php-comment">/** |
</span></span><span id="151" class="l"><a class="l" href="#151">151: </a><span class="php-comment"> * Renvoie le tableau d'objets Exception générées par le script PHP triées du niveau de sévérité le plus élevé au moins élevé. |
</span></span><span id="152" class="l"><a class="l" href="#152">152: </a><span class="php-comment"> * Format du tableau : |
</span></span><span id="153" class="l"><a class="l" href="#153">153: </a><span class="php-comment"> * array{sévérité_1 = array{Exception1, Exception2, Exception3,...}, sévérité_1 = array{Exception1, Exception2, ...}, ...}; |
</span></span><span id="154" class="l"><a class="l" href="#154">154: </a><span class="php-comment"> * ATTENTION : si vous utilisez cette méthode, c'est à vous de gérer l'affichage des Exceptions. Le gestionnaire d'exception |
</span></span><span id="155" class="l"><a class="l" href="#155">155: </a><span class="php-comment"> * n'enverra plus rien au navigateur ou à la console. |
</span></span><span id="156" class="l"><a class="l" href="#156">156: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="157" class="l"><a class="l" href="#157">157: </a><span class="php-comment"> * @return array le tableau trié d'objet Exception. |
</span></span><span id="158" class="l"><a class="l" href="#158">158: </a><span class="php-comment"> */</span> |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getExceptionsTriees" href="#_getExceptionsTriees">getExceptionsTriees</a>() { |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">array</span>(); |
</span><span id="161" class="l"><a class="l" href="#161">161: </a> <span class="php-keyword1">if</span> (self::getExceptionsNbre() > <span class="php-num">0</span>) { |
</span><span id="162" class="l"><a class="l" href="#162">162: </a> <span class="php-keyword1">foreach</span> (self::<span class="php-var">$exceptions</span> <span class="php-keyword1">as</span> <span class="php-var">$cle</span> => <span class="php-var">$e</span>) { |
</span><span id="163" class="l"><a class="l" href="#163">163: </a> <span class="php-var">$retour</span>[<span class="php-var">$e</span>->getSeverity()][] = <span class="php-var">$e</span>; |
</span><span id="164" class="l"><a class="l" href="#164">164: </a> <span class="php-comment">// Nous vidons le tableau des exceptions au fur et à mesure pour éviter le réaffichage avec le destructeur.</span> |
</span><span id="165" class="l"><a class="l" href="#165">165: </a> <span class="php-keyword1">unset</span>(self::<span class="php-var">$exceptions</span>[<span class="php-var">$cle</span>]); |
</span><span id="166" class="l"><a class="l" href="#166">166: </a> } |
</span><span id="167" class="l"><a class="l" href="#167">167: </a> <span class="php-keyword2">ksort</span>(<span class="php-var">$retour</span>); |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> } |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> } |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> |
</span><span id="172" class="l"><a class="l" href="#172">172: </a> <span class="php-comment">/** |
</span></span><span id="173" class="l"><a class="l" href="#173">173: </a><span class="php-comment"> * Logue une exception donnée sous une forme lisible si self::logger vaut true. |
</span></span><span id="174" class="l"><a class="l" href="#174">174: </a><span class="php-comment"> * @param Exception $e l'exception à logger |
</span></span><span id="175" class="l"><a class="l" href="#175">175: </a><span class="php-comment"> */</span> |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_loggerException" href="#_loggerException">loggerException</a>(Exception <span class="php-var">$e</span>) { |
</span><span id="177" class="l"><a class="l" href="#177">177: </a> <span class="php-keyword1">if</span> (self::<span class="php-var">$logger</span>) { |
</span><span id="178" class="l"><a class="l" href="#178">178: </a> <span class="php-var">$message</span> = self::formaterExceptionTxt(<span class="php-var">$e</span>); |
</span><span id="179" class="l"><a class="l" href="#179">179: </a> <span class="php-keyword2">Log</span>::ajouterEntree(<span class="php-quote">'erreurs'</span>, <span class="php-var">$message</span>); |
</span><span id="180" class="l"><a class="l" href="#180">180: </a> } |
</span><span id="181" class="l"><a class="l" href="#181">181: </a> } |
</span><span id="182" class="l"><a class="l" href="#182">182: </a> |
</span><span id="183" class="l"><a class="l" href="#183">183: </a> <span class="php-comment">/** |
</span></span><span id="184" class="l"><a class="l" href="#184">184: </a><span class="php-comment"> * Formate une exception de type Notice générée par la classe Debug. |
</span></span><span id="185" class="l"><a class="l" href="#185">185: </a><span class="php-comment"> * Seul le message est gardé car les autres infos font référence à la classe Debug et non à l'endroit où |
</span></span><span id="186" class="l"><a class="l" href="#186">186: </a><span class="php-comment"> * le débug est lancée. |
</span></span><span id="187" class="l"><a class="l" href="#187">187: </a><span class="php-comment"> * TODO : faire en sorte d'afficher le fichier et la ligne où le débug est lancé. |
</span></span><span id="188" class="l"><a class="l" href="#188">188: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="189" class="l"><a class="l" href="#189">189: </a><span class="php-comment"> * @param Exception l'exception à formater. |
</span></span><span id="190" class="l"><a class="l" href="#190">190: </a><span class="php-comment"> */</span> |
</span><span id="191" class="l"><a class="l" href="#191">191: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_formaterExceptionDebug" href="#_formaterExceptionDebug">formaterExceptionDebug</a>(Exception <span class="php-var">$e</span>) { |
</span><span id="192" class="l"><a class="l" href="#192">192: </a> <span class="php-var">$txt</span> = <span class="php-quote">''</span>; |
</span><span id="193" class="l"><a class="l" href="#193">193: </a> <span class="php-keyword1">if</span> (<span class="php-var">$e</span>->getSeverity() == E_USER_NOTICE) { |
</span><span id="194" class="l"><a class="l" href="#194">194: </a> <span class="php-var">$txt</span> = <span class="php-var">$e</span>->getMessage(); |
</span><span id="195" class="l"><a class="l" href="#195">195: </a> } <span class="php-keyword1">else</span> { |
</span><span id="196" class="l"><a class="l" href="#196">196: </a> <span class="php-var">$txt</span> = self::formaterExceptionTxt(<span class="php-var">$e</span>); |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> } |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> <span class="php-keyword1">return</span> <span class="php-var">$txt</span>; |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> } |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> |
</span><span id="201" class="l"><a class="l" href="#201">201: </a> <span class="php-comment">/** |
</span></span><span id="202" class="l"><a class="l" href="#202">202: </a><span class="php-comment"> * Formate en texte une exception passée en paramètre. |
</span></span><span id="203" class="l"><a class="l" href="#203">203: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="204" class="l"><a class="l" href="#204">204: </a><span class="php-comment"> * @param Exception l'exception à formater. |
</span></span><span id="205" class="l"><a class="l" href="#205">205: </a><span class="php-comment"> */</span> |
</span><span id="206" class="l"><a class="l" href="#206">206: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_formaterExceptionTxt" href="#_formaterExceptionTxt">formaterExceptionTxt</a>(Exception <span class="php-var">$e</span>) { |
</span><span id="207" class="l"><a class="l" href="#207">207: </a> <span class="php-var">$message</span> = <span class="php-quote">''</span>; |
</span><span id="208" class="l"><a class="l" href="#208">208: </a> <span class="php-var">$message</span> .= <span class="php-var">$e</span>->getMessage().<span class="php-quote">"\n"</span>; |
</span><span id="209" class="l"><a class="l" href="#209">209: </a> <span class="php-var">$message</span> .= <span class="php-quote">'Fichier : '</span>.<span class="php-var">$e</span>->getFile().<span class="php-quote">"\n"</span>; |
</span><span id="210" class="l"><a class="l" href="#210">210: </a> <span class="php-var">$message</span> .= <span class="php-quote">'Ligne : '</span>.<span class="php-var">$e</span>->getLine().<span class="php-quote">"\n"</span>; |
</span><span id="211" class="l"><a class="l" href="#211">211: </a> <span class="php-keyword1">if</span> (self::getContexte()) { |
</span><span id="212" class="l"><a class="l" href="#212">212: </a> <span class="php-var">$message</span> .= <span class="php-quote">'Contexte : '</span>.<span class="php-quote">"\n"</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$e</span>->getTraceAsString(), <span class="php-keyword1">true</span>).<span class="php-quote">"\n"</span>; |
</span><span id="213" class="l"><a class="l" href="#213">213: </a> } |
</span><span id="214" class="l"><a class="l" href="#214">214: </a> <span class="php-var">$message</span> .= <span class="php-quote">"\n"</span>; |
</span><span id="215" class="l"><a class="l" href="#215">215: </a> <span class="php-keyword1">return</span> <span class="php-var">$message</span>; |
</span><span id="216" class="l"><a class="l" href="#216">216: </a> } |
</span><span id="217" class="l"><a class="l" href="#217">217: </a> |
</span><span id="218" class="l"><a class="l" href="#218">218: </a> <span class="php-comment">/** |
</span></span><span id="219" class="l"><a class="l" href="#219">219: </a><span class="php-comment"> * Formate en (X)HTML une exception passée en paramètre. |
</span></span><span id="220" class="l"><a class="l" href="#220">220: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="221" class="l"><a class="l" href="#221">221: </a><span class="php-comment"> * @param Exception l'exception à formater. |
</span></span><span id="222" class="l"><a class="l" href="#222">222: </a><span class="php-comment"> */</span> |
</span><span id="223" class="l"><a class="l" href="#223">223: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_formaterExceptionXhtml" href="#_formaterExceptionXhtml">formaterExceptionXhtml</a>(Exception <span class="php-var">$e</span>) { |
</span><span id="224" class="l"><a class="l" href="#224">224: </a> <span class="php-var">$message</span> = <span class="php-quote">''</span>; |
</span><span id="225" class="l"><a class="l" href="#225">225: </a> <span class="php-var">$message</span> .= <span class="php-quote">'<div class="debogage">'</span>.<span class="php-quote">"\n"</span>; |
</span><span id="226" class="l"><a class="l" href="#226">226: </a> <span class="php-var">$message</span> .= <span class="php-var">$e</span>->getMessage().<span class="php-quote">"\n"</span>; |
</span><span id="227" class="l"><a class="l" href="#227">227: </a> <span class="php-var">$message</span> .= <span class="php-quote">'<span class="debogage_fichier">'</span>.<span class="php-quote">'Fichier : '</span>.<span class="php-var">$e</span>->getFile().<span class="php-quote">'</span>'</span>.<span class="php-quote">"\n"</span>; |
</span><span id="228" class="l"><a class="l" href="#228">228: </a> <span class="php-var">$message</span> .= <span class="php-quote">'<span class="debogage_ligne">'</span>.<span class="php-quote">'Ligne : '</span>.<span class="php-var">$e</span>->getLine().<span class="php-quote">'</span>'</span>.<span class="php-quote">"\n"</span>; |
</span><span id="229" class="l"><a class="l" href="#229">229: </a> <span class="php-keyword1">if</span> (self::getContexte()) { |
</span><span id="230" class="l"><a class="l" href="#230">230: </a> <span class="php-var">$message</span> .= <span class="php-quote">'<pre>'</span>.<span class="php-quote">"\n"</span>; |
</span><span id="231" class="l"><a class="l" href="#231">231: </a> <span class="php-var">$message</span> .= <span class="php-quote">'<strong>Contexte : </strong>'</span>.<span class="php-quote">"\n"</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$e</span>->getTraceAsString(), <span class="php-keyword1">true</span>).<span class="php-quote">"\n"</span>; |
</span><span id="232" class="l"><a class="l" href="#232">232: </a> <span class="php-var">$message</span> .= <span class="php-quote">'</pre>'</span>.<span class="php-quote">"\n"</span>; |
</span><span id="233" class="l"><a class="l" href="#233">233: </a> } |
</span><span id="234" class="l"><a class="l" href="#234">234: </a> <span class="php-var">$message</span> .= <span class="php-quote">'</div>'</span>.<span class="php-quote">"\n"</span>; |
</span><span id="235" class="l"><a class="l" href="#235">235: </a> <span class="php-keyword1">return</span> <span class="php-var">$message</span>; |
</span><span id="236" class="l"><a class="l" href="#236">236: </a> } |
</span><span id="237" class="l"><a class="l" href="#237">237: </a> |
</span><span id="238" class="l"><a class="l" href="#238">238: </a> <span class="php-comment">/** |
</span></span><span id="239" class="l"><a class="l" href="#239">239: </a><span class="php-comment"> * Lors de la destruction de la classe si des exceptions n'ont pas été affichées, et si le débogage est à true, elles sont |
</span></span><span id="240" class="l"><a class="l" href="#240">240: </a><span class="php-comment"> * affichées. |
</span></span><span id="241" class="l"><a class="l" href="#241">241: </a><span class="php-comment"> */</span> |
</span><span id="242" class="l"><a class="l" href="#242">242: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___destruct" href="#___destruct">__destruct</a>() { |
</span><span id="243" class="l"><a class="l" href="#243">243: </a> <span class="php-comment">// Si des erreurs n'ont pas été affichée nous forçons leur affichage</span> |
</span><span id="244" class="l"><a class="l" href="#244">244: </a> <span class="php-keyword1">if</span> (self::<span class="php-var">$afficher</span> && self::getExceptionsNbre() > <span class="php-num">0</span>) { |
</span><span id="245" class="l"><a class="l" href="#245">245: </a> <span class="php-keyword1">echo</span> self::getExceptionsFormatees(); |
</span><span id="246" class="l"><a class="l" href="#246">246: </a> } |
</span><span id="247" class="l"><a class="l" href="#247">247: </a> } |
</span><span id="248" class="l"><a class="l" href="#248">248: </a> |
</span><span id="249" class="l"><a class="l" href="#249">249: </a>} |
</span><span id="250" class="l"><a class="l" href="#250">250: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/404.html |
---|
New file |
0,0 → 1,136 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>Page not found | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonScript.html">MonScript</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
<h3>Exceptions</h3> |
<ul> |
<li><a href="class-Exception.html">Exception</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<span>Package</span> </li> |
<li> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content"> |
<h1>Page not found</h1> |
<p>The requested page could not be found.</p> |
<p>You have probably clicked on a link that is outdated and points to a page that does not exist any more or you have made an typing error in the address.</p> |
<p>To continue please try to find requested page in the menu, take a look at <a href="tree.html">the tree view</a> of the whole project or use search field on the top.</p> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Fichier.html |
---|
New file |
0,0 → 1,422 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Fichier | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li class="active"><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li class="active"><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Utilitaire.html" title="Summary of Utilitaire"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Fichier</h1> |
<div class="description"> |
<p>Classe fournissant des méthodes statiques de manipulation des fichiers.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Utilitaire.html">Utilitaire</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2009, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Fichier.php 352 2011-07-21 10:25:56Z jpm $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Fichier.html#3-201" title="Go to source code">framework/utilitaires/Fichier.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="creerFichier" id="_creerFichier"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_creerFichier">#</a> |
<code><a href="source-class-Fichier.html#16-46" title="Go to source code">creerFichier</a>( <span>string <var>$fichier</var></span>, <span>string <var>$contenu</var></span> )</code> |
<div class="description short"> |
<p>Créer et stocke du contenu dans un fichier.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Créer et stocke du contenu dans un fichier.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$fichier</var></dt> |
<dd><code>string</code><br>le chemin et le nom du fichier.</dd> |
<dt><var>$contenu</var></dt> |
<dd><code>string</code><br>le contenu à stocker dans le fichier.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>true en cas de succès sinon false.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="creerFichierGzip" id="_creerFichierGzip"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_creerFichierGzip">#</a> |
<code><a href="source-class-Fichier.html#48-83" title="Go to source code">creerFichierGzip</a>( <span>string <var>$fichier</var></span>, <span>string <var>$contenu</var></span> )</code> |
<div class="description short"> |
<p>Créer et stocke du contenu dans un fichier compressé en Gzip.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Créer et stocke du contenu dans un fichier compressé en Gzip.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$fichier</var></dt> |
<dd><code>string</code><br>le chemin et le nom du fichier.</dd> |
<dt><var>$contenu</var></dt> |
<dd><code>string</code><br>le contenu à stocker dans le fichier.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>true en cas de succès sinon false.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="supprimerDossier" id="_supprimerDossier"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_supprimerDossier">#</a> |
<code><a href="source-class-Fichier.html#85-107" title="Go to source code">supprimerDossier</a>( <span>string <var>$dossier</var></span> )</code> |
<div class="description short"> |
<p>Supprime récursivement un dossier et tout son contenu.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Supprime récursivement un dossier et tout son contenu.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$dossier</var></dt> |
<dd><code>string</code><br>$dossier le chemin vers le dossier à supprimer.</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="convertirTaille" id="_convertirTaille"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_convertirTaille">#</a> |
<code><a href="source-class-Fichier.html#109-119" title="Go to source code">convertirTaille</a>( <span>integer <var>$taille</var></span> )</code> |
<div class="description short"> |
<p>Convertion d'un nombre d'octet en kB, MB, GB.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Convertion d'un nombre d'octet en kB, MB, GB.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$taille</var></dt> |
<dd><code>integer</code><br>$taille la taille en octet à convertir</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>la chaine représentant la taille en octets.<br> |
</div> |
<h4>Link</h4> |
<div class="list"> |
<a href="http://forum.webmaster-rank.info/developpement-site/code-taille-memoire-d-une-variable-en-php-t1344.html">http://forum.webmaster-rank.info/developpement-site/code-taille-memoire-d-une-variable-en-php-t1344.html</a><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getDossierTmp" id="_getDossierTmp"> |
<td class="attributes"><code> |
public static |
string|false |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getDossierTmp">#</a> |
<code><a href="source-class-Fichier.html#121-186" title="Go to source code">getDossierTmp</a>( )</code> |
<div class="description short"> |
<p>Détermine le dossier système temporaire et détecte si nous y avons accès |
en lecture et écriture.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Détermine le dossier système temporaire et détecte si nous y avons accès |
en lecture et écriture.</p> |
<p>Inspiré de Zend_File_Transfer_Adapter_Abstract & Zend_Cache</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>string|false</code><br>le chemine vers le dossier temporaire ou false en cas d'échec.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="etreAccessibleEnLectureEtEcriture" id="_etreAccessibleEnLectureEtEcriture"> |
<td class="attributes"><code> |
protected static |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_etreAccessibleEnLectureEtEcriture">#</a> |
<code><a href="source-class-Fichier.html#188-200" title="Go to source code">etreAccessibleEnLectureEtEcriture</a>( <span>mixed <var>$ressource</var></span> )</code> |
<div class="description short"> |
<p>Vérifie si le fichier ou dossier est accessible en lecture et écriture.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Vérifie si le fichier ou dossier est accessible en lecture et écriture.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$ressource</var></dt> |
<dd><code>mixed</code><br>$ressource chemin vers le dossier ou fichier à tester</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true si la ressource est accessible en lecture et écriture.<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Pattern.html |
---|
New file |
0,0 → 1,126 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/utilitaires/Pattern.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li class="active"><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li class="active"><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Utilitaire.html" title="Summary of Utilitaire"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Pattern.html" title="Summary of Pattern"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe fournissant des constantes correspondant à des expressions régulières de vérification très courrantes. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @package Utilitaire |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="10" class="l"><a class="l" href="#10">10: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="11" class="l"><a class="l" href="#11">11: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="12" class="l"><a class="l" href="#12">12: </a><span class="php-comment"> * @version $Id: Pattern.php 299 2011-01-18 14:03:46Z jpm $ |
</span></span><span id="13" class="l"><a class="l" href="#13">13: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="14" class="l"><a class="l" href="#14">14: </a><span class="php-comment"> */</span> |
</span><span id="15" class="l"><a class="l" href="#15">15: </a><span class="php-keyword1">class</span> <span class="php-keyword2">Pattern</span> { |
</span><span id="16" class="l"><a class="l" href="#16">16: </a> <span class="php-keyword1">const</span> <a id="PRENOM" href="#PRENOM">PRENOM</a> = <span class="php-quote">"[\p{L}-]+"</span>;<span class="php-comment">// Pattern prénom</span> |
</span><span id="17" class="l"><a class="l" href="#17">17: </a> <span class="php-keyword1">const</span> <a id="NOM" href="#NOM">NOM</a> = <span class="php-quote">"[\p{Lu}]+"</span>;<span class="php-comment">// Pattern nom</span> |
</span><span id="18" class="l"><a class="l" href="#18">18: </a> <span class="php-keyword1">const</span> <a id="COURRIEL" href="#COURRIEL">COURRIEL</a> = <span class="php-quote">"[a-z0-9!#</span><span class="php-var">$</span><span class="php-quote">%&'*+=?^_`{|}~-]+(?:\\.[a-z0-9!#</span><span class="php-var">$</span><span class="php-quote">%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"</span>;<span class="php-comment">// Pattern courriel</span> |
</span><span id="19" class="l"><a class="l" href="#19">19: </a> <span class="php-keyword1">const</span> <a id="URL" href="#URL">URL</a> = <span class="php-quote">"^(?:(?:ht|f)tp(?:s?)\\:\\/\\/|~/|/)?(?:\\w+:\\w+@)?(?:(?:[-\\w]+\\.)+(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?::[\\d]{1,5})?(?:(?:(?:/(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,=]|%[a-f\\d]{2})+)+|/)+|\\?|#)?(?:(?:\\?(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,*:]|%[a-f\\d{2}])+=(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,*:=]|%[a-f\\d]{2})*)(?:&(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,*:]|%[a-f\\d{2}])+=(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,*:=]|%[a-f\\d]{2})*)*)*(?:#(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,*:=]|%[a-f\\d]{2})*)?</span><span class="php-var">$</span><span class="php-quote">"</span>; |
</span><span id="20" class="l"><a class="l" href="#20">20: </a> <span class="php-keyword1">const</span> <a id="HEURE_MINUTE" href="#HEURE_MINUTE">HEURE_MINUTE</a> = <span class="php-quote">"^(?:[0-1][0-9]|2[0-4]):(?:[0-5][0-9]|60)</span><span class="php-var">$</span><span class="php-quote">"</span>;<span class="php-comment">// Heure au format 24h avec séparateur d'heure et minute ':' </span> |
</span><span id="21" class="l"><a class="l" href="#21">21: </a> <span class="php-keyword1">const</span> <a id="LATITUDE" href="#LATITUDE">LATITUDE</a> = <span class="php-quote">"^-?([0-8]?[0-9]([.,][0-9]*)?|90)</span><span class="php-var">$</span><span class="php-quote">"</span>; <span class="php-comment">// Nombre décimal positif ou négatif allant de 0 à 89 ou nombre entier valant 90 avec pour séparateur des décimales "." ou ","</span> |
</span><span id="22" class="l"><a class="l" href="#22">22: </a> <span class="php-keyword1">const</span> <a id="LONGITUDE" href="#LONGITUDE">LONGITUDE</a> = <span class="php-quote">"^-?((1[0-7][0-9]|[1-9]?[0-9])([.,][0-9]*)?|180)</span><span class="php-var">$</span><span class="php-quote">"</span>; <span class="php-comment">// Nombre décimal positif ou négatif allant de 0 à 179 ou nombre entier valant 180 avec pour séparateur des décimales "." ou ","</span> |
</span><span id="23" class="l"><a class="l" href="#23">23: </a>} |
</span><span id="24" class="l"><a class="l" href="#24">24: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-MonScript.html |
---|
New file |
0,0 → 1,166 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File exemples/scripts/modules/mon_script/MonScript.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li class="active"><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li class="active"><a href="class-MonScript.html">MonScript</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-None.html" title="Summary of None"><span>Package</span></a> |
</li> |
<li> |
<a href="class-MonScript.html" title="Summary of MonScript"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Exemple de script utilisable avec le TBFramework. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * Pour le lancer, taper en ligne de commande, en vous plaçant dans le dossier /framework/exemple/scripts/ : |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * <code>/opt/lampp/bin/php cli.php mon_script -a test</code> |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="10" class="l"><a class="l" href="#10">10: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="11" class="l"><a class="l" href="#11">11: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="12" class="l"><a class="l" href="#12">12: </a><span class="php-comment"> * @version $Id$ |
</span></span><span id="13" class="l"><a class="l" href="#13">13: </a><span class="php-comment"> */</span> |
</span><span id="14" class="l"><a class="l" href="#14">14: </a><span class="php-keyword1">class</span> <a id="MonScript" href="#MonScript">MonScript</a> <span class="php-keyword1">extends</span> Script { |
</span><span id="15" class="l"><a class="l" href="#15">15: </a> |
</span><span id="16" class="l"><a class="l" href="#16">16: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$parametres_autorises" href="#$parametres_autorises">$parametres_autorises</a></span> = <span class="php-keyword1">array</span>( |
</span><span id="17" class="l"><a class="l" href="#17">17: </a> <span class="php-quote">'-y'</span> => <span class="php-keyword1">array</span>(<span class="php-keyword1">false</span>, <span class="php-quote">'exemple de valeur par défaut'</span>, <span class="php-quote">'Un parametre supplémentaire de test'</span>)); |
</span><span id="18" class="l"><a class="l" href="#18">18: </a> |
</span><span id="19" class="l"><a class="l" href="#19">19: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_executer" href="#_executer">executer</a>() { |
</span><span id="20" class="l"><a class="l" href="#20">20: </a> <span class="php-comment">// Récupération de paramêtres</span> |
</span><span id="21" class="l"><a class="l" href="#21">21: </a> |
</span><span id="22" class="l"><a class="l" href="#22">22: </a> <span class="php-comment">// Lancement de l'action demandée</span> |
</span><span id="23" class="l"><a class="l" href="#23">23: </a> <span class="php-var">$cmd</span> = <span class="php-var">$this</span>->getParametre(<span class="php-quote">'a'</span>); |
</span><span id="24" class="l"><a class="l" href="#24">24: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$cmd</span>) { |
</span><span id="25" class="l"><a class="l" href="#25">25: </a> <span class="php-keyword1">case</span> <span class="php-quote">'test'</span> : |
</span><span id="26" class="l"><a class="l" href="#26">26: </a> <span class="php-var">$this</span>->executerTest(); |
</span><span id="27" class="l"><a class="l" href="#27">27: </a> <span class="php-keyword1">break</span>; |
</span><span id="28" class="l"><a class="l" href="#28">28: </a> <span class="php-keyword1">default</span> : |
</span><span id="29" class="l"><a class="l" href="#29">29: </a> <span class="php-var">$this</span>->traiterErreur(<span class="php-quote">'Erreur : la commande "%s" n\'existe pas!'</span>, <span class="php-keyword1">array</span>(<span class="php-var">$cmd</span>)); |
</span><span id="30" class="l"><a class="l" href="#30">30: </a> } |
</span><span id="31" class="l"><a class="l" href="#31">31: </a> } |
</span><span id="32" class="l"><a class="l" href="#32">32: </a> |
</span><span id="33" class="l"><a class="l" href="#33">33: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_executerTest" href="#_executerTest">executerTest</a>() { |
</span><span id="34" class="l"><a class="l" href="#34">34: </a> <span class="php-keyword1">print</span>(<span class="php-quote">'Config: '</span>.Config::get(<span class="php-quote">'param1'</span>).<span class="php-quote">"\n"</span>); |
</span><span id="35" class="l"><a class="l" href="#35">35: </a> <span class="php-var">$this</span>->traiterErreur(<span class="php-quote">"Un msg d'%s"</span>, <span class="php-keyword1">array</span>(<span class="php-quote">'erreur'</span>)); |
</span><span id="36" class="l"><a class="l" href="#36">36: </a> <span class="php-var">$this</span>->traiterErreur(<span class="php-quote">"Un msg d'erreur sans paramètre"</span>); |
</span><span id="37" class="l"><a class="l" href="#37">37: </a> <span class="php-var">$this</span>->traiterAvertissement(<span class="php-quote">"Un msg d'%s"</span>, <span class="php-keyword1">array</span>(<span class="php-quote">'avertissement'</span>)); |
</span><span id="38" class="l"><a class="l" href="#38">38: </a> <span class="php-var">$this</span>->traiterAvertissement(<span class="php-quote">"Un msg d'avertissement sans paramètre"</span>); |
</span><span id="39" class="l"><a class="l" href="#39">39: </a> <span class="php-var">$this</span>->traiterInfo(<span class="php-quote">"Un msg d'%s"</span>, <span class="php-keyword1">array</span>(<span class="php-quote">'info'</span>)); |
</span><span id="40" class="l"><a class="l" href="#40">40: </a> <span class="php-var">$this</span>->traiterInfo(<span class="php-quote">"Un msg d'info sans paramètre"</span>); |
</span><span id="41" class="l"><a class="l" href="#41">41: </a> <span class="php-keyword1">echo</span> <span class="php-var">$this</span>->formaterMsg(<span class="php-quote">"Un msg %s"</span>, <span class="php-keyword1">array</span>(<span class="php-quote">'formaté'</span>)); |
</span><span id="42" class="l"><a class="l" href="#42">42: </a> <span class="php-keyword1">echo</span> <span class="php-var">$this</span>->formaterMsg(<span class="php-quote">"Le parametre y : %s"</span>, <span class="php-keyword1">array</span>(<span class="php-var">$this</span>->getParametre(<span class="php-quote">'y'</span>))); |
</span><span id="43" class="l"><a class="l" href="#43">43: </a> |
</span><span id="44" class="l"><a class="l" href="#44">44: </a> <span class="php-comment">// Test de l'affichage de l'avancement dans une boucle en partant de 1</span> |
</span><span id="45" class="l"><a class="l" href="#45">45: </a> <span class="php-var">$ma_liste</span> = <span class="php-keyword1">array</span>(); |
</span><span id="46" class="l"><a class="l" href="#46">46: </a> <span class="php-keyword1">for</span> (<span class="php-var">$i</span> = <span class="php-num">0</span>; <span class="php-var">$i</span> < <span class="php-num">1000</span>; <span class="php-var">$i</span>++) { |
</span><span id="47" class="l"><a class="l" href="#47">47: </a> <span class="php-var">$ma_liste</span>[] = <span class="php-var">$i</span>; |
</span><span id="48" class="l"><a class="l" href="#48">48: </a> |
</span><span id="49" class="l"><a class="l" href="#49">49: </a> <span class="php-keyword1">for</span> (<span class="php-var">$j</span> = <span class="php-num">0</span>; <span class="php-var">$j</span> < <span class="php-num">100</span>; <span class="php-var">$j</span>++) { |
</span><span id="50" class="l"><a class="l" href="#50">50: </a> <span class="php-var">$ma_liste</span>[] = <span class="php-quote">"</span><span class="php-var">$i</span><span class="php-quote">-</span><span class="php-var">$j</span><span class="php-quote">"</span>; |
</span><span id="51" class="l"><a class="l" href="#51">51: </a> <span class="php-comment">// 1 seule boucle peut être affichée</span> |
</span><span id="52" class="l"><a class="l" href="#52">52: </a> } |
</span><span id="53" class="l"><a class="l" href="#53">53: </a> <span class="php-var">$this</span>->afficherAvancement(<span class="php-quote">"Afficher de l'avancement de la boucle for"</span>, <span class="php-num">1</span>); |
</span><span id="54" class="l"><a class="l" href="#54">54: </a> } |
</span><span id="55" class="l"><a class="l" href="#55">55: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"\n"</span>; |
</span><span id="56" class="l"><a class="l" href="#56">56: </a> |
</span><span id="57" class="l"><a class="l" href="#57">57: </a> <span class="php-comment">// Test de l'affichage de l'avancement dans une boucle en partant par défaut de 0</span> |
</span><span id="58" class="l"><a class="l" href="#58">58: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$ma_liste</span> <span class="php-keyword1">as</span> <span class="php-var">$cle</span> => <span class="php-var">$valeur</span>) { |
</span><span id="59" class="l"><a class="l" href="#59">59: </a> <span class="php-var">$this</span>->afficherAvancement(<span class="php-quote">"Afficher de l'avancement de la boucle foreach"</span>); |
</span><span id="60" class="l"><a class="l" href="#60">60: </a> } |
</span><span id="61" class="l"><a class="l" href="#61">61: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"\n"</span>; |
</span><span id="62" class="l"><a class="l" href="#62">62: </a> |
</span><span id="63" class="l"><a class="l" href="#63">63: </a> <span class="php-keyword1">print</span>(<span class="php-quote">"test réussi!\n"</span>); |
</span><span id="64" class="l"><a class="l" href="#64">64: </a> } |
</span><span id="65" class="l"><a class="l" href="#65">65: </a>} |
</span><span id="66" class="l"><a class="l" href="#66">66: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Tableau.html |
---|
New file |
0,0 → 1,424 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Tableau | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li class="active"><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li class="active"><a href="class-Tableau.html">Tableau</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Utilitaire.html" title="Summary of Utilitaire"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Tableau</h1> |
<div class="info"> |
<b>Package:</b> <a href="package-Utilitaire.html">Utilitaire</a><br> |
<b>Copyright:</b> |
Copyright (c) 2009, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Located at</b> <a href="source-class-Tableau.html#16-150" title="Go to source code">framework/utilitaires/Tableau.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="etendre" id="_etendre"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_etendre">#</a> |
<code><a href="source-class-Tableau.html#24-49" title="Go to source code">etendre</a>( <span>array <var>& $tableau_a_etendre</var></span>, <span>array <var>& $tableau_a_copier</var></span> )</code> |
<div class="description short"> |
<p>Etend le tableau à étendre avec les données du tableau à copier. Si des |
clés sont identiques entre les deux tableaux une erreur est déclenchée et la |
valeur du tableau à étendre est gardée. Si les deux tableaux ont des clés |
numériques leurs valeurs sont gardées (à la différence de array_merge). Les |
tableaux sont passés par références et le tableau à copier est |
progressivement détruit pour éviter la consomation de mémoire.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Etend le tableau à étendre avec les données du tableau à copier. Si des |
clés sont identiques entre les deux tableaux une erreur est déclenchée et la |
valeur du tableau à étendre est gardée. Si les deux tableaux ont des clés |
numériques leurs valeurs sont gardées (à la différence de array_merge). Les |
tableaux sont passés par références et le tableau à copier est |
progressivement détruit pour éviter la consomation de mémoire.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tableau_a_etendre</var></dt> |
<dd><code>array</code><br>$tableau_a_etendre</dd> |
<dt><var>$tableau_a_copier</var></dt> |
<dd><code>array</code><br>$tableau_a_copier</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="trierTableauMd" id="_trierTableauMd"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_trierTableauMd">#</a> |
<code><a href="source-class-Tableau.html#51-57" title="Go to source code">trierTableauMd</a>( <span>mixed <var>$array</var></span>, <span>mixed <var>$cols</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
<h4>Deprecated</h4> |
<div class="list"> |
Utiliser la méthode trierMD()<br> |
</div> |
<h4>See</h4> |
<div class="list"> |
<code><code><a href="class-Tableau.html#_trierMD">Tableau::trierMD()</a></code></code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="trierMD" id="_trierMD"> |
<td class="attributes"><code> |
public static |
Array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_trierMD">#</a> |
<code><a href="source-class-Tableau.html#59-102" title="Go to source code">trierMD</a>( <span>Array <var>$array</var></span>, <span>Array <var>$cols</var></span> )</code> |
<div class="description short"> |
<p>Permet de trier un tableau multi-dimenssionnel en gardant l'ordre des |
clés.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Permet de trier un tableau multi-dimenssionnel en gardant l'ordre des |
clés.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$array</var></dt> |
<dd><code>Array</code><br>$array le tableau à trier</dd> |
<dt><var>$cols</var></dt> |
<dd><code>Array</code><br>$cols tableau indiquant en clé la colonne à trier et en valeur l'ordre avec |
SORT_ASC ou SORT_DESC</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>Array</code><br>le tableau trié.<br> |
</div> |
<h4>Author</h4> |
<div class="list"> |
cagret at gmail dot com<br> |
</div> |
<h4>See</h4> |
<div class="list"> |
<a |
href="http://fr.php.net/manual/fr/function.array-multisort.php">http://fr.php.net/manual/fr/function.array-multisort.php</a> |
Post du 21-Jun-2009 12:38<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="trierMDType" id="_trierMDType"> |
<td class="attributes"><code> |
public static |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_trierMDType">#</a> |
<code><a href="source-class-Tableau.html#104-123" title="Go to source code">trierMDType</a>( <span>array <var>& $tableau</var></span>, <span>array <var>$cols</var></span>, <span>string <var>$type</var> = <code><a href="class-Tableau.html#TRI_CASSE_INSENSIBLE">Tableau::<b>TRI_CASSE_INSENSIBLE</b></a></code></span> )</code> |
<div class="description short"> |
<p>Méthode réalisant un tri d'un tableau multidimension. Attention les clés |
du tableau ne sont pas modifiées. A utiliser de cette façon: |
EfloreTriage::trieMultiple( $tableau_multidimension, array('ma_cle1' => |
SORT_ASC, 'ma_cle2' => SORT_DESC), $type_de_tri); Utiliser les constantes php |
SORT_DESC ou SORT_ASC pour l'odre de tri. Pour le type de tri : utiliser :<br /> |
- Tableau::TRI_NATUREL pour un trie naturel,<br /> |
- Tableau::TRI_CASSE_SENSIBLE pour un tri sensible à la casse,<br /> |
- Tableau::TRI_CASSE_INSENSIBLE pour un tri insensible à la casse.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode réalisant un tri d'un tableau multidimension. Attention les clés |
du tableau ne sont pas modifiées. A utiliser de cette façon: |
EfloreTriage::trieMultiple( $tableau_multidimension, array('ma_cle1' => |
SORT_ASC, 'ma_cle2' => SORT_DESC), $type_de_tri); Utiliser les constantes php |
SORT_DESC ou SORT_ASC pour l'odre de tri. Pour le type de tri : utiliser : - |
Tableau::TRI_NATUREL pour un trie naturel, - Tableau::TRI_CASSE_SENSIBLE pour un |
tri sensible à la casse, - Tableau::TRI_CASSE_INSENSIBLE pour un tri insensible |
à la casse.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tableau</var></dt> |
<dd><code>array</code><br>le tableau à trier</dd> |
<dt><var>$cols</var></dt> |
<dd><code>array</code><br>le talbeau des colonnes à trier constituer de nom de clé en clé et d'ordres |
de tri en valeur.</dd> |
<dt><var>$type</var></dt> |
<dd><code>string</code><br>le type de tri à appliquer.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>le tableau trié.<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="constants"> |
<caption>Constants summary</caption> |
<tr data-order="TRI_NATUREL" id="TRI_NATUREL"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Tableau.html#17" title="Go to source code"><b>TRI_NATUREL</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'nat'</span></code></td> |
<td class="description"><div> |
<a href="#TRI_NATUREL" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="TRI_CASSE_SENSIBLE" id="TRI_CASSE_SENSIBLE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Tableau.html#18" title="Go to source code"><b>TRI_CASSE_SENSIBLE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'ci'</span></code></td> |
<td class="description"><div> |
<a href="#TRI_CASSE_SENSIBLE" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="TRI_CASSE_INSENSIBLE" id="TRI_CASSE_INSENSIBLE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Tableau.html#19" title="Go to source code"><b>TRI_CASSE_INSENSIBLE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'ci'</span></code></td> |
<td class="description"><div> |
<a href="#TRI_CASSE_INSENSIBLE" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Log.html |
---|
New file |
0,0 → 1,269 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Log.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li class="active"><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Log.html" title="Summary of Log"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">//declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe permettant de logger des messages dans les fichier situés dans le dossier de log. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @package Framework |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @author Aurélien PERONNET <aurelien@tela-botanica.org> |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @version $Id: Log.php 274 2010-12-28 15:37:22Z jpm $ |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> */</span> |
</span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-keyword1">class</span> <span class="php-keyword2">Log</span> { |
</span><span id="17" class="l"><a class="l" href="#17"> 17: </a> |
</span><span id="18" class="l"><a class="l" href="#18"> 18: </a> <span class="php-comment">/** Boolean indiquant si l'on doit utiliser les logs ou pas. */</span> |
</span><span id="19" class="l"><a class="l" href="#19"> 19: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$logger" href="#$logger">$logger</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> <span class="php-comment">/** Tableau associatif stockant les descripteurs de fichiers. */</span> |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$fichiersLog" href="#$fichiersLog">$fichiersLog</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> <span class="php-comment">/** Chemin de base du dossier log de l'application. */</span> |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$cheminLogs" href="#$cheminLogs">$cheminLogs</a></span> = <span class="php-quote">''</span>; |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> <span class="php-comment">/** Booleen indiquant si l'on peut correctement écrire dans les fichiers de logs. */</span> |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$droitLogger" href="#$droitLogger">$droitLogger</a></span> = <span class="php-keyword1">true</span>; |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-comment">/** Zone horaire (pour éviter des avertissements dans les dates). */</span> |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$timeZone" href="#$timeZone">$timeZone</a></span> = <span class="php-quote">'Europe/Paris'</span>; |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> <span class="php-comment">/** Taille maximum d'un fichier de log avant que celui ne soit archivé (en octets). */</span> |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$tailleMax" href="#$tailleMax">$tailleMax</a></span> = <span class="php-num">10000</span>; |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> <span class="php-comment">/** séparateur de dossier dans un chemin. */</span> |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$sd" href="#$sd">$sd</a></span> = DIRECTORY_SEPARATOR; |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> <span class="php-comment">/** Extension des fichiers de log. */</span> |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$ext" href="#$ext">$ext</a></span> = <span class="php-quote">'.log'</span>; |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> <span class="php-comment">/** Tableau des noms des paramètres à définir dans le fichier de config car obligatoirement nécessaire à cette classe.*/</span> |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$parametres_obligatoires" href="#$parametres_obligatoires">$parametres_obligatoires</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'chemin_logs'</span>, <span class="php-quote">'i18n_timezone'</span>, <span class="php-quote">'log_taille_max'</span>, <span class="php-quote">'log_debogage'</span>); |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> <span class="php-comment">/** Initialiser les logs par défaut, sans tenir comptes des paramêtres de config. */</span> |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_initialiser" href="#_initialiser">initialiser</a>() { |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> <span class="php-comment">// gestion de la timezone pour éviter des erreurs</span> |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">function_exists</span>(<span class="php-quote">'date_default_timezone_set'</span>) && <span class="php-keyword2">function_exists</span>(<span class="php-quote">'date_default_timezone_get'</span>)) { |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-keyword2">date_default_timezone_set</span>(self::<span class="php-var">$timeZone</span>); |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> } |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> <span class="php-keyword1">if</span> (self::<span class="php-var">$logger</span> && (!<span class="php-keyword2">is_dir</span>(self::<span class="php-var">$cheminLogs</span>) || !<span class="php-keyword2">is_writable</span>(self::<span class="php-var">$cheminLogs</span>))) { |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> self::desactiverEcriture(); |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> } |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> } |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> <span class="php-comment">/** Configure le Log à partir des paramêtres de config. */</span> |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_configurer" href="#_configurer">configurer</a>() { |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> Config::verifierPresenceParametres(self::<span class="php-var">$parametres_obligatoires</span>); |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> self::<span class="php-var">$cheminLogs</span> = Config::get(<span class="php-quote">'chemin_logs'</span>); |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> self::<span class="php-var">$timeZone</span> = (Config::get(<span class="php-quote">'i18n_timezone'</span>) != <span class="php-quote">''</span>) ? Config::get(<span class="php-quote">'i18n_timezone'</span>) : self::<span class="php-var">$timeZone</span>; |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> self::<span class="php-var">$tailleMax</span> = (Config::get(<span class="php-quote">'log_taille_max'</span>) != <span class="php-quote">''</span>) ? Config::get(<span class="php-quote">'log_taille_max'</span>) : self::<span class="php-var">$tailleMax</span>; |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> self::<span class="php-var">$logger</span> = (Config::get(<span class="php-quote">'log_debogage'</span>) != <span class="php-quote">''</span>) ? Config::get(<span class="php-quote">'log_debogage'</span>) : self::<span class="php-var">$logger</span>; |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> self::initialiser(); |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> } |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> <span class="php-comment">/** |
</span></span><span id="68" class="l"><a class="l" href="#68"> 68: </a><span class="php-comment"> * Ajoute une entrée au log spécifié par le paramètre $nomFichier |
</span></span><span id="69" class="l"><a class="l" href="#69"> 69: </a><span class="php-comment"> * @param string $nomFichier le nom du fichier dans lequel écrire |
</span></span><span id="70" class="l"><a class="l" href="#70"> 70: </a><span class="php-comment"> */</span> |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_ajouterEntree" href="#_ajouterEntree">ajouterEntree</a>(<span class="php-var">$nomFichier</span>, <span class="php-var">$entree</span>, <span class="php-var">$mode</span> = <span class="php-quote">'a+'</span>) { |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> <span class="php-keyword1">if</span> (self::<span class="php-var">$droitLogger</span>) { |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> <span class="php-var">$date</span> = <span class="php-quote">"\n\n"</span>.<span class="php-keyword2">date</span>(<span class="php-quote">'d m Y H:i'</span>).<span class="php-quote">"\n"</span> ; |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> <span class="php-keyword1">if</span> (self::verifierOuvrirFichier(<span class="php-var">$nomFichier</span>, <span class="php-var">$mode</span>)) { |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> <span class="php-keyword2">fwrite</span>(self::<span class="php-var">$fichiersLog</span>[<span class="php-var">$nomFichier</span>], <span class="php-var">$date</span>.<span class="php-var">$entree</span>); |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> self::verifierTailleFichierOuArchiver(<span class="php-var">$nomFichier</span>); |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> } <span class="php-keyword1">else</span> { |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> self::desactiverEcriture(<span class="php-var">$nomFichier</span>); |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> } |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> } |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> } |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> <span class="php-comment">/** |
</span></span><span id="85" class="l"><a class="l" href="#85"> 85: </a><span class="php-comment"> * Vide un fichier log indiqué |
</span></span><span id="86" class="l"><a class="l" href="#86"> 86: </a><span class="php-comment"> * @param string $nomFichier le nom du fichier à vider |
</span></span><span id="87" class="l"><a class="l" href="#87"> 87: </a><span class="php-comment"> */</span> |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_viderLog" href="#_viderLog">viderLog</a>(<span class="php-var">$nomFichier</span>) { |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> self::ajouterEntree(<span class="php-var">$nomFichier</span>, <span class="php-quote">''</span>, <span class="php-quote">'w'</span>); |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> } |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-comment">/** |
</span></span><span id="93" class="l"><a class="l" href="#93"> 93: </a><span class="php-comment"> * Vérifie la présence d'un fichier dans le tableau, ses droits d'écriture, l'ouvre si nécessaire. |
</span></span><span id="94" class="l"><a class="l" href="#94"> 94: </a><span class="php-comment"> * |
</span></span><span id="95" class="l"><a class="l" href="#95"> 95: </a><span class="php-comment"> * @param string $nomFichier le nom du fichier dont on doit vérifier la présence |
</span></span><span id="96" class="l"><a class="l" href="#96"> 96: </a><span class="php-comment"> * @return boolean true si le fichier est ouvert ou maintenant accessible, false sinon |
</span></span><span id="97" class="l"><a class="l" href="#97"> 97: </a><span class="php-comment"> */</span> |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_verifierOuvrirFichier" href="#_verifierOuvrirFichier">verifierOuvrirFichier</a>(<span class="php-var">$nomFichier</span>,<span class="php-var">$mode</span>) { |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">in_array</span>(<span class="php-var">$nomFichier</span>, self::<span class="php-var">$fichiersLog</span>)) { |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_writable</span>(self::<span class="php-var">$cheminLogs</span>.<span class="php-var">$nomFichier</span>.self::<span class="php-var">$ext</span>)) { |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">true</span>; |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> } |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> } <span class="php-keyword1">else</span> { |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-var">$fp</span> = @<span class="php-keyword2">fopen</span>(self::<span class="php-var">$cheminLogs</span>.<span class="php-var">$nomFichier</span>.self::<span class="php-var">$ext</span>,<span class="php-var">$mode</span>); |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> <span class="php-keyword1">if</span> (<span class="php-var">$fp</span> && <span class="php-keyword2">is_writable</span>(self::<span class="php-var">$cheminLogs</span>.<span class="php-var">$nomFichier</span>.self::<span class="php-var">$ext</span>)) { |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> self::<span class="php-var">$fichiersLog</span>[<span class="php-var">$nomFichier</span>] = <span class="php-var">$fp</span>; |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">true</span>; |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> } |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> } |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> } |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> <span class="php-comment">/** |
</span></span><span id="115" class="l"><a class="l" href="#115">115: </a><span class="php-comment"> * Vérifie la taille d'un fichier donné et si celle ci est trop importante |
</span></span><span id="116" class="l"><a class="l" href="#116">116: </a><span class="php-comment"> * archive le fichier de log |
</span></span><span id="117" class="l"><a class="l" href="#117">117: </a><span class="php-comment"> * @param string $nomFichier nom du fichier à vérifier |
</span></span><span id="118" class="l"><a class="l" href="#118">118: </a><span class="php-comment"> */</span> |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_verifierTailleFichierOuArchiver" href="#_verifierTailleFichierOuArchiver">verifierTailleFichierOuArchiver</a>(<span class="php-var">$nomFichier</span>) { |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> <span class="php-keyword1">if</span>(<span class="php-keyword2">filesize</span>(self::<span class="php-var">$cheminLogs</span>.<span class="php-var">$nomFichier</span>.self::<span class="php-var">$ext</span>) > self::<span class="php-var">$tailleMax</span>) { |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-keyword2">rename</span>(self::<span class="php-var">$cheminLogs</span>.<span class="php-var">$nomFichier</span>.self::<span class="php-var">$ext</span>,self::<span class="php-var">$cheminLogs</span>.<span class="php-var">$nomFichier</span>.<span class="php-keyword2">date</span>(<span class="php-quote">'d_m_Y_H:i'</span>).self::<span class="php-var">$ext</span>); |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> self::ajouterEntree(<span class="php-var">$nomFichier</span>,<span class="php-quote">''</span>); |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> } |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> } |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-comment">/** |
</span></span><span id="127" class="l"><a class="l" href="#127">127: </a><span class="php-comment"> * Désactive l'écriture du log et envoie un message au gestionnaire d'erreurs |
</span></span><span id="128" class="l"><a class="l" href="#128">128: </a><span class="php-comment"> * @param string $nomFichier le nom du fichier qui a causé l'erreur |
</span></span><span id="129" class="l"><a class="l" href="#129">129: </a><span class="php-comment"> */</span> |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_desactiverEcriture" href="#_desactiverEcriture">desactiverEcriture</a>(<span class="php-var">$nomFichier</span> = <span class="php-quote">''</span>) { |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> self::<span class="php-var">$droitLogger</span> = <span class="php-keyword1">false</span>; |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> <span class="php-keyword1">if</span> (<span class="php-var">$nomFichier</span> != <span class="php-quote">''</span>) { |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> <span class="php-var">$fichierDossier</span> = <span class="php-quote">'fichier '</span>.<span class="php-var">$nomFichier</span> ; |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> } <span class="php-keyword1">else</span> { |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> <span class="php-var">$fichierDossier</span> = <span class="php-quote">'dossier des logs'</span>; |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> } |
</span><span id="137" class="l"><a class="l" href="#137">137: </a> <span class="php-var">$message</span> = <span class="php-quote">'Écriture impossible dans le '</span>.<span class="php-var">$fichierDossier</span>.<span class="php-quote">', Assurez-vous des droits du dossier et des fichiers'</span>; |
</span><span id="138" class="l"><a class="l" href="#138">138: </a> <span class="php-var">$e</span> = <span class="php-keyword1">new</span> ErrorException(<span class="php-var">$message</span>, <span class="php-num">0</span>, E_USER_WARNING, __FILE__, __LINE__); |
</span><span id="139" class="l"><a class="l" href="#139">139: </a> GestionnaireException::gererException(<span class="php-var">$e</span>); |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> } |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> <span class="php-comment">/** Destructeur de classe, ferme les descripteurs ouverts. */</span> |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___destruct" href="#___destruct">__destruct</a>() { |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-keyword1">foreach</span>(self::<span class="php-var">$fichiersLog</span> <span class="php-keyword1">as</span> <span class="php-var">$nomFichier</span> => <span class="php-var">$fp</span>) { |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> <span class="php-keyword2">fclose</span>(<span class="php-var">$fp</span>); |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> } |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> } |
</span><span id="148" class="l"><a class="l" href="#148">148: </a>} |
</span><span id="149" class="l"><a class="l" href="#149">149: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-CacheSqlite.html |
---|
New file |
0,0 → 1,717 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/CacheSqlite.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li class="active"><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li class="active"><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li><a href="class-MonScript.html">MonScript</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-None.html" title="Summary of None"><span>Package</span></a> |
</li> |
<li> |
<a href="class-CacheSqlite.html" title="Summary of CacheSqlite"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-keyword1">class</span> <a id="CacheSqlite" href="#CacheSqlite">CacheSqlite</a> { |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a> <span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Options disponibles : |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * ====> (string) stockage_chemin : |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * Chemin vers le fichier contenant la base SQLite. |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * ====> (int) defragmentation_auto : |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * - Désactive / Régler le processus de défragmentation automatique |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * - Le processus de défragmentation automatiques réduit la taille du fichier contenant la base de données |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * quand un ajout ou une suppression de cache est réalisée : |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * 0 => pas de défragmentation automatique |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * 1 => défragmentation automatique systématique |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * x (integer) > 1 => défragmentation automatique toutes les 1 fois (au hasard) sur x ajout ou suppression de cache |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> * |
</span></span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-comment"> * @var array options disponibles |
</span></span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-comment"> */</span> |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$options" href="#$options">$options</a></span> = <span class="php-keyword1">array</span>( |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> <span class="php-quote">'stockage_chemin'</span> => <span class="php-keyword1">null</span>, |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> <span class="php-quote">'defragmentation_auto'</span> => <span class="php-num">10</span> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> ); |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> <span class="php-comment">/** |
</span></span><span id="26" class="l"><a class="l" href="#26"> 26: </a><span class="php-comment"> * DB ressource |
</span></span><span id="27" class="l"><a class="l" href="#27"> 27: </a><span class="php-comment"> * |
</span></span><span id="28" class="l"><a class="l" href="#28"> 28: </a><span class="php-comment"> * @var mixed $db |
</span></span><span id="29" class="l"><a class="l" href="#29"> 29: </a><span class="php-comment"> */</span> |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$bdd" href="#$bdd">$bdd</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> <span class="php-comment">/** |
</span></span><span id="33" class="l"><a class="l" href="#33"> 33: </a><span class="php-comment"> * Boolean to store if the structure has benn checked or not |
</span></span><span id="34" class="l"><a class="l" href="#34"> 34: </a><span class="php-comment"> * |
</span></span><span id="35" class="l"><a class="l" href="#35"> 35: </a><span class="php-comment"> * @var boolean $structure_ok |
</span></span><span id="36" class="l"><a class="l" href="#36"> 36: </a><span class="php-comment"> */</span> |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$structure_ok" href="#$structure_ok">$structure_ok</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$Cache" href="#$Cache">$Cache</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> <span class="php-comment">/** |
</span></span><span id="42" class="l"><a class="l" href="#42"> 42: </a><span class="php-comment"> * Constructor |
</span></span><span id="43" class="l"><a class="l" href="#43"> 43: </a><span class="php-comment"> * |
</span></span><span id="44" class="l"><a class="l" href="#44"> 44: </a><span class="php-comment"> * @param array $options Associative array of options |
</span></span><span id="45" class="l"><a class="l" href="#45"> 45: </a><span class="php-comment"> * @throws Zend_cache_Exception |
</span></span><span id="46" class="l"><a class="l" href="#46"> 46: </a><span class="php-comment"> * @return void |
</span></span><span id="47" class="l"><a class="l" href="#47"> 47: </a><span class="php-comment"> */</span> |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>(<span class="php-keyword1">array</span> <span class="php-var">$options</span> = <span class="php-keyword1">array</span>(), Cache <span class="php-var">$cache</span>) { |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-var">$this</span>->Cache = <span class="php-var">$cache</span>; |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">extension_loaded</span>(<span class="php-quote">'sqlite'</span>)) { |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> <span class="php-var">$this</span>->initialiserOptionsParConfig(); |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> <span class="php-var">$this</span>->setOptions(<span class="php-var">$options</span>); |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> } <span class="php-keyword1">else</span> { |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-var">$e</span> = <span class="php-quote">"Impossible d'utiliser le cache SQLITE car l'extenssion 'sqlite' n'est pas chargée dans l'environnement PHP courrant."</span>; |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_ERROR); |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> } |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> } |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_initialiserOptionsParConfig" href="#_initialiserOptionsParConfig">initialiserOptionsParConfig</a>() { |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> <span class="php-keyword1">while</span> (<span class="php-keyword1">list</span>(<span class="php-var">$nom</span>, <span class="php-var">$valeur</span>) = <span class="php-keyword2">each</span>(<span class="php-var">$this</span>->options)) { |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> <span class="php-keyword1">if</span> (Config::existe(<span class="php-var">$nom</span>)) { |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> <span class="php-var">$this</span>->options[<span class="php-var">$nom</span>] = Config::get(<span class="php-var">$nom</span>); |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> } |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> } |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> } |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> <span class="php-comment">/** |
</span></span><span id="68" class="l"><a class="l" href="#68"> 68: </a><span class="php-comment"> * Destructor |
</span></span><span id="69" class="l"><a class="l" href="#69"> 69: </a><span class="php-comment"> * |
</span></span><span id="70" class="l"><a class="l" href="#70"> 70: </a><span class="php-comment"> * @return void |
</span></span><span id="71" class="l"><a class="l" href="#71"> 71: </a><span class="php-comment"> */</span> |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___destruct" href="#___destruct">__destruct</a>() { |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> @<span class="php-keyword2">sqlite_close</span>(<span class="php-var">$this</span>->getConnexion()); |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> } |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_setOptions" href="#_setOptions">setOptions</a>(<span class="php-var">$options</span>) { |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> <span class="php-keyword1">while</span> (<span class="php-keyword1">list</span>(<span class="php-var">$nom</span>, <span class="php-var">$valeur</span>) = <span class="php-keyword2">each</span>(<span class="php-var">$options</span>)) { |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_string</span>(<span class="php-var">$nom</span>)) { |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Nom d'option incorecte : </span><span class="php-var">$nom</span><span class="php-quote">"</span>, E_USER_WARNING); |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> } |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> <span class="php-var">$nom</span> = <span class="php-keyword2">strtolower</span>(<span class="php-var">$nom</span>); |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">array_key_exists</span>(<span class="php-var">$nom</span>, <span class="php-var">$this</span>->options)) { |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> <span class="php-var">$this</span>->options[<span class="php-var">$nom</span>] = <span class="php-var">$valeur</span>; |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> } |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> } |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> } |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_setEmplacement" href="#_setEmplacement">setEmplacement</a>(<span class="php-var">$emplacement</span>) { |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">extension_loaded</span>(<span class="php-quote">'sqlite'</span>)) { |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> <span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>] = <span class="php-var">$emplacement</span>; |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> } <span class="php-keyword1">else</span> { |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Impossible d'utiliser le mode de sotckage SQLite car l'extenssion 'sqlite' n'est pas chargé dans "</span>. |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-quote">"l'environnement PHP courrant."</span>, E_USER_ERROR); |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> } |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> } |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-comment">/** |
</span></span><span id="98" class="l"><a class="l" href="#98"> 98: </a><span class="php-comment"> * Test if a cache is available for the given id and (if yes) return it (false else) |
</span></span><span id="99" class="l"><a class="l" href="#99"> 99: </a><span class="php-comment"> * |
</span></span><span id="100" class="l"><a class="l" href="#100">100: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="101" class="l"><a class="l" href="#101">101: </a><span class="php-comment"> * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested |
</span></span><span id="102" class="l"><a class="l" href="#102">102: </a><span class="php-comment"> * @return string|false Cached datas |
</span></span><span id="103" class="l"><a class="l" href="#103">103: </a><span class="php-comment"> */</span> |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_charger" href="#_charger">charger</a>(<span class="php-var">$id</span>, <span class="php-var">$ne_pas_tester_validiter_du_cache</span> = <span class="php-keyword1">false</span>) { |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> <span class="php-var">$requete</span> = <span class="php-quote">"SELECT content FROM cache WHERE id = '</span><span class="php-var">$id</span><span class="php-quote">'"</span>. |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> ((<span class="php-var">$ne_pas_tester_validiter_du_cache</span>) ? <span class="php-quote">''</span> : <span class="php-quote">' AND (expire = 0 OR expire > '</span>.<span class="php-keyword2">time</span>().<span class="php-quote">')'</span>); |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-var">$requete</span>); |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> <span class="php-var">$ligne</span> = @<span class="php-keyword2">sqlite_fetch_array</span>(<span class="php-var">$resultat</span>); |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> <span class="php-keyword1">return</span> (<span class="php-var">$ligne</span>) ? <span class="php-var">$ligne</span>[<span class="php-quote">'content'</span>] : <span class="php-keyword1">false</span>; |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> } |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-comment">/** |
</span></span><span id="114" class="l"><a class="l" href="#114">114: </a><span class="php-comment"> * Test if a cache is available or not (for the given id) |
</span></span><span id="115" class="l"><a class="l" href="#115">115: </a><span class="php-comment"> * |
</span></span><span id="116" class="l"><a class="l" href="#116">116: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="117" class="l"><a class="l" href="#117">117: </a><span class="php-comment"> * @return mixed|false (a cache is not available) or "last modified" timestamp (int) of the available cache record |
</span></span><span id="118" class="l"><a class="l" href="#118">118: </a><span class="php-comment"> */</span> |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_tester" href="#_tester">tester</a>(<span class="php-var">$id</span>) { |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-var">$requete</span> = <span class="php-quote">"SELECT lastModified FROM cache WHERE id = '</span><span class="php-var">$id</span><span class="php-quote">' AND (expire = 0 OR expire > "</span>.<span class="php-keyword2">time</span>().<span class="php-quote">')'</span>; |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-var">$requete</span>); |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-var">$ligne</span> = @<span class="php-keyword2">sqlite_fetch_array</span>(<span class="php-var">$resultat</span>); |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> <span class="php-keyword1">return</span> (<span class="php-var">$ligne</span>) ? ((int) <span class="php-var">$ligne</span>[<span class="php-quote">'lastModified'</span>]) : <span class="php-keyword1">false</span>; |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> } |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-comment">/** |
</span></span><span id="128" class="l"><a class="l" href="#128">128: </a><span class="php-comment"> * Save some string datas into a cache record |
</span></span><span id="129" class="l"><a class="l" href="#129">129: </a><span class="php-comment"> * |
</span></span><span id="130" class="l"><a class="l" href="#130">130: </a><span class="php-comment"> * Note : $data is always "string" (serialization is done by the |
</span></span><span id="131" class="l"><a class="l" href="#131">131: </a><span class="php-comment"> * core not by the backend) |
</span></span><span id="132" class="l"><a class="l" href="#132">132: </a><span class="php-comment"> * |
</span></span><span id="133" class="l"><a class="l" href="#133">133: </a><span class="php-comment"> * @param string $data Datas to cache |
</span></span><span id="134" class="l"><a class="l" href="#134">134: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="135" class="l"><a class="l" href="#135">135: </a><span class="php-comment"> * @param array $tags Array of strings, the cache record will be tagged by each string entry |
</span></span><span id="136" class="l"><a class="l" href="#136">136: </a><span class="php-comment"> * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) |
</span></span><span id="137" class="l"><a class="l" href="#137">137: </a><span class="php-comment"> * @throws Zend_Cache_Exception |
</span></span><span id="138" class="l"><a class="l" href="#138">138: </a><span class="php-comment"> * @return boolean True if no problem |
</span></span><span id="139" class="l"><a class="l" href="#139">139: </a><span class="php-comment"> */</span> |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_sauver" href="#_sauver">sauver</a>(<span class="php-var">$donnees</span>, <span class="php-var">$id</span>, <span class="php-var">$tags</span> = <span class="php-keyword1">array</span>(), <span class="php-var">$duree_vie_specifique</span> = <span class="php-keyword1">false</span>) { |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-comment">//FIXME : si l'extension n'est pas installée, le cache passe tout de même par cette fonction et s'arrête à cet endroit.</span> |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-var">$donnees</span> = @<span class="php-keyword2">sqlite_escape_string</span>(<span class="php-var">$donnees</span>); |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> <span class="php-var">$timestamp_courrant</span> = <span class="php-keyword2">time</span>(); |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> <span class="php-var">$expiration</span> = <span class="php-var">$this</span>->Cache->getTimestampExpiration(<span class="php-var">$duree_vie_specifique</span>); |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">"DELETE FROM cache WHERE id = '</span><span class="php-var">$id</span><span class="php-quote">'"</span>); |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> <span class="php-var">$sql</span> = <span class="php-quote">"INSERT INTO cache (id, content, lastModified, expire) VALUES ('</span><span class="php-var">$id</span><span class="php-quote">', '</span><span class="php-var">$donnees</span><span class="php-quote">', </span><span class="php-var">$timestamp_courrant</span><span class="php-quote">, </span><span class="php-var">$expiration</span><span class="php-quote">)"</span>; |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-var">$sql</span>); |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> <span class="php-keyword1">if</span> (!<span class="php-var">$resultat</span>) { |
</span><span id="152" class="l"><a class="l" href="#152">152: </a> <span class="php-comment">// TODO : ajouter un log sauver() : impossible de stocker le cache d'id '$id'</span> |
</span><span id="153" class="l"><a class="l" href="#153">153: </a> Debug::printr(<span class="php-quote">"sauver() : impossible de stocker le cache d'id '</span><span class="php-var">$id</span><span class="php-quote">'"</span>); |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">false</span>; |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> } <span class="php-keyword1">else</span> { |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="157" class="l"><a class="l" href="#157">157: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tags</span> <span class="php-keyword1">as</span> <span class="php-var">$tag</span>) { |
</span><span id="158" class="l"><a class="l" href="#158">158: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->enregisterTag(<span class="php-var">$id</span>, <span class="php-var">$tag</span>) && <span class="php-var">$resultat</span>; |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> } |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> } |
</span><span id="161" class="l"><a class="l" href="#161">161: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="162" class="l"><a class="l" href="#162">162: </a> } |
</span><span id="163" class="l"><a class="l" href="#163">163: </a> |
</span><span id="164" class="l"><a class="l" href="#164">164: </a> <span class="php-comment">/** |
</span></span><span id="165" class="l"><a class="l" href="#165">165: </a><span class="php-comment"> * Remove a cache record |
</span></span><span id="166" class="l"><a class="l" href="#166">166: </a><span class="php-comment"> * |
</span></span><span id="167" class="l"><a class="l" href="#167">167: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="168" class="l"><a class="l" href="#168">168: </a><span class="php-comment"> * @return boolean True if no problem |
</span></span><span id="169" class="l"><a class="l" href="#169">169: </a><span class="php-comment"> */</span> |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_supprimer" href="#_supprimer">supprimer</a>(<span class="php-var">$id</span>) { |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="172" class="l"><a class="l" href="#172">172: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">"SELECT COUNT(*) AS nbr FROM cache WHERE id = '</span><span class="php-var">$id</span><span class="php-quote">'"</span>); |
</span><span id="173" class="l"><a class="l" href="#173">173: </a> <span class="php-var">$resultat_nbre</span> = @<span class="php-keyword2">sqlite_fetch_single</span>(<span class="php-var">$resultat</span>); |
</span><span id="174" class="l"><a class="l" href="#174">174: </a> <span class="php-var">$suppression_cache</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">"DELETE FROM cache WHERE id = '</span><span class="php-var">$id</span><span class="php-quote">'"</span>); |
</span><span id="175" class="l"><a class="l" href="#175">175: </a> <span class="php-var">$suppression_tags</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">"DELETE FROM tag WHERE id = '</span><span class="php-var">$id</span><span class="php-quote">'"</span>); |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> <span class="php-var">$this</span>->defragmenterAutomatiquement(); |
</span><span id="177" class="l"><a class="l" href="#177">177: </a> <span class="php-keyword1">return</span> (<span class="php-var">$resultat_nbre</span> && <span class="php-var">$suppression_cache</span> && <span class="php-var">$suppression_tags</span>); |
</span><span id="178" class="l"><a class="l" href="#178">178: </a> } |
</span><span id="179" class="l"><a class="l" href="#179">179: </a> |
</span><span id="180" class="l"><a class="l" href="#180">180: </a> <span class="php-comment">/** |
</span></span><span id="181" class="l"><a class="l" href="#181">181: </a><span class="php-comment"> * Clean some cache records |
</span></span><span id="182" class="l"><a class="l" href="#182">182: </a><span class="php-comment"> * |
</span></span><span id="183" class="l"><a class="l" href="#183">183: </a><span class="php-comment"> * Available modes are : |
</span></span><span id="184" class="l"><a class="l" href="#184">184: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) |
</span></span><span id="185" class="l"><a class="l" href="#185">185: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) |
</span></span><span id="186" class="l"><a class="l" href="#186">186: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags |
</span></span><span id="187" class="l"><a class="l" href="#187">187: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="188" class="l"><a class="l" href="#188">188: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} |
</span></span><span id="189" class="l"><a class="l" href="#189">189: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="190" class="l"><a class="l" href="#190">190: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags |
</span></span><span id="191" class="l"><a class="l" href="#191">191: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="192" class="l"><a class="l" href="#192">192: </a><span class="php-comment"> * |
</span></span><span id="193" class="l"><a class="l" href="#193">193: </a><span class="php-comment"> * @param string $mode Clean mode |
</span></span><span id="194" class="l"><a class="l" href="#194">194: </a><span class="php-comment"> * @param array $tags Array of tags |
</span></span><span id="195" class="l"><a class="l" href="#195">195: </a><span class="php-comment"> * @return boolean True if no problem |
</span></span><span id="196" class="l"><a class="l" href="#196">196: </a><span class="php-comment"> */</span> |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_nettoyer" href="#_nettoyer">nettoyer</a>(<span class="php-var">$mode</span> = Cache::NETTOYAGE_MODE_TOUS, <span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->nettoyerSqlite(<span class="php-var">$mode</span>, <span class="php-var">$tags</span>); |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> <span class="php-var">$this</span>->defragmenterAutomatiquement(); |
</span><span id="201" class="l"><a class="l" href="#201">201: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="202" class="l"><a class="l" href="#202">202: </a> } |
</span><span id="203" class="l"><a class="l" href="#203">203: </a> |
</span><span id="204" class="l"><a class="l" href="#204">204: </a> <span class="php-comment">/** |
</span></span><span id="205" class="l"><a class="l" href="#205">205: </a><span class="php-comment"> * Return an array of stored cache ids |
</span></span><span id="206" class="l"><a class="l" href="#206">206: </a><span class="php-comment"> * |
</span></span><span id="207" class="l"><a class="l" href="#207">207: </a><span class="php-comment"> * @return array array of stored cache ids (string) |
</span></span><span id="208" class="l"><a class="l" href="#208">208: </a><span class="php-comment"> */</span> |
</span><span id="209" class="l"><a class="l" href="#209">209: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIds" href="#_getIds">getIds</a>() { |
</span><span id="210" class="l"><a class="l" href="#210">210: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="211" class="l"><a class="l" href="#211">211: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">'SELECT id FROM cache WHERE (expire = 0 OR expire > '</span>.<span class="php-keyword2">time</span>().<span class="php-quote">')'</span>); |
</span><span id="212" class="l"><a class="l" href="#212">212: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">array</span>(); |
</span><span id="213" class="l"><a class="l" href="#213">213: </a> <span class="php-keyword1">while</span> (<span class="php-var">$id</span> = @<span class="php-keyword2">sqlite_fetch_single</span>(<span class="php-var">$resultat</span>)) { |
</span><span id="214" class="l"><a class="l" href="#214">214: </a> <span class="php-var">$retour</span>[] = <span class="php-var">$id</span>; |
</span><span id="215" class="l"><a class="l" href="#215">215: </a> } |
</span><span id="216" class="l"><a class="l" href="#216">216: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="217" class="l"><a class="l" href="#217">217: </a> } |
</span><span id="218" class="l"><a class="l" href="#218">218: </a> |
</span><span id="219" class="l"><a class="l" href="#219">219: </a> <span class="php-comment">/** |
</span></span><span id="220" class="l"><a class="l" href="#220">220: </a><span class="php-comment"> * Return an array of stored tags |
</span></span><span id="221" class="l"><a class="l" href="#221">221: </a><span class="php-comment"> * |
</span></span><span id="222" class="l"><a class="l" href="#222">222: </a><span class="php-comment"> * @return array array of stored tags (string) |
</span></span><span id="223" class="l"><a class="l" href="#223">223: </a><span class="php-comment"> */</span> |
</span><span id="224" class="l"><a class="l" href="#224">224: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getTags" href="#_getTags">getTags</a>() { |
</span><span id="225" class="l"><a class="l" href="#225">225: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="226" class="l"><a class="l" href="#226">226: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">'SELECT DISTINCT(name) AS name FROM tag'</span>); |
</span><span id="227" class="l"><a class="l" href="#227">227: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">array</span>(); |
</span><span id="228" class="l"><a class="l" href="#228">228: </a> <span class="php-keyword1">while</span> (<span class="php-var">$id</span> = @<span class="php-keyword2">sqlite_fetch_single</span>(<span class="php-var">$resultat</span>)) { |
</span><span id="229" class="l"><a class="l" href="#229">229: </a> <span class="php-var">$retour</span>[] = <span class="php-var">$id</span>; |
</span><span id="230" class="l"><a class="l" href="#230">230: </a> } |
</span><span id="231" class="l"><a class="l" href="#231">231: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="232" class="l"><a class="l" href="#232">232: </a> } |
</span><span id="233" class="l"><a class="l" href="#233">233: </a> |
</span><span id="234" class="l"><a class="l" href="#234">234: </a> <span class="php-comment">/** |
</span></span><span id="235" class="l"><a class="l" href="#235">235: </a><span class="php-comment"> * Return an array of stored cache ids which match given tags |
</span></span><span id="236" class="l"><a class="l" href="#236">236: </a><span class="php-comment"> * |
</span></span><span id="237" class="l"><a class="l" href="#237">237: </a><span class="php-comment"> * In case of multiple tags, a logical AND is made between tags |
</span></span><span id="238" class="l"><a class="l" href="#238">238: </a><span class="php-comment"> * |
</span></span><span id="239" class="l"><a class="l" href="#239">239: </a><span class="php-comment"> * @param array $tags array of tags |
</span></span><span id="240" class="l"><a class="l" href="#240">240: </a><span class="php-comment"> * @return array array of matching cache ids (string) |
</span></span><span id="241" class="l"><a class="l" href="#241">241: </a><span class="php-comment"> */</span> |
</span><span id="242" class="l"><a class="l" href="#242">242: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIdsAvecLesTags" href="#_getIdsAvecLesTags">getIdsAvecLesTags</a>(<span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="243" class="l"><a class="l" href="#243">243: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="244" class="l"><a class="l" href="#244">244: </a> <span class="php-var">$premier</span> = <span class="php-keyword1">true</span>; |
</span><span id="245" class="l"><a class="l" href="#245">245: </a> <span class="php-var">$ids</span> = <span class="php-keyword1">array</span>(); |
</span><span id="246" class="l"><a class="l" href="#246">246: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tags</span> <span class="php-keyword1">as</span> <span class="php-var">$tag</span>) { |
</span><span id="247" class="l"><a class="l" href="#247">247: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">"SELECT DISTINCT(id) AS id FROM tag WHERE name='</span><span class="php-var">$tag</span><span class="php-quote">'"</span>); |
</span><span id="248" class="l"><a class="l" href="#248">248: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span>) { |
</span><span id="249" class="l"><a class="l" href="#249">249: </a> <span class="php-var">$lignes</span> = @<span class="php-keyword2">sqlite_fetch_all</span>(<span class="php-var">$resultat</span>, SQLITE_ASSOC); |
</span><span id="250" class="l"><a class="l" href="#250">250: </a> <span class="php-var">$ids_tmp</span> = <span class="php-keyword1">array</span>(); |
</span><span id="251" class="l"><a class="l" href="#251">251: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$lignes</span> <span class="php-keyword1">as</span> <span class="php-var">$ligne</span>) { |
</span><span id="252" class="l"><a class="l" href="#252">252: </a> <span class="php-var">$ids_tmp</span>[] = <span class="php-var">$ligne</span>[<span class="php-quote">'id'</span>]; |
</span><span id="253" class="l"><a class="l" href="#253">253: </a> } |
</span><span id="254" class="l"><a class="l" href="#254">254: </a> <span class="php-keyword1">if</span> (<span class="php-var">$premier</span>) { |
</span><span id="255" class="l"><a class="l" href="#255">255: </a> <span class="php-var">$ids</span> = <span class="php-var">$ids_tmp</span>; |
</span><span id="256" class="l"><a class="l" href="#256">256: </a> <span class="php-var">$premier</span> = <span class="php-keyword1">false</span>; |
</span><span id="257" class="l"><a class="l" href="#257">257: </a> } <span class="php-keyword1">else</span> { |
</span><span id="258" class="l"><a class="l" href="#258">258: </a> <span class="php-var">$ids</span> = <span class="php-keyword2">array_intersect</span>(<span class="php-var">$ids</span>, <span class="php-var">$ids_tmp</span>); |
</span><span id="259" class="l"><a class="l" href="#259">259: </a> } |
</span><span id="260" class="l"><a class="l" href="#260">260: </a> } |
</span><span id="261" class="l"><a class="l" href="#261">261: </a> } |
</span><span id="262" class="l"><a class="l" href="#262">262: </a> |
</span><span id="263" class="l"><a class="l" href="#263">263: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">array</span>(); |
</span><span id="264" class="l"><a class="l" href="#264">264: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$ids</span>) > <span class="php-num">0</span>) { |
</span><span id="265" class="l"><a class="l" href="#265">265: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$ids</span> <span class="php-keyword1">as</span> <span class="php-var">$id</span>) { |
</span><span id="266" class="l"><a class="l" href="#266">266: </a> <span class="php-var">$retour</span>[] = <span class="php-var">$id</span>; |
</span><span id="267" class="l"><a class="l" href="#267">267: </a> } |
</span><span id="268" class="l"><a class="l" href="#268">268: </a> } |
</span><span id="269" class="l"><a class="l" href="#269">269: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="270" class="l"><a class="l" href="#270">270: </a> } |
</span><span id="271" class="l"><a class="l" href="#271">271: </a> |
</span><span id="272" class="l"><a class="l" href="#272">272: </a> <span class="php-comment">/** |
</span></span><span id="273" class="l"><a class="l" href="#273">273: </a><span class="php-comment"> * Return an array of stored cache ids which don't match given tags |
</span></span><span id="274" class="l"><a class="l" href="#274">274: </a><span class="php-comment"> * |
</span></span><span id="275" class="l"><a class="l" href="#275">275: </a><span class="php-comment"> * In case of multiple tags, a logical OR is made between tags |
</span></span><span id="276" class="l"><a class="l" href="#276">276: </a><span class="php-comment"> * |
</span></span><span id="277" class="l"><a class="l" href="#277">277: </a><span class="php-comment"> * @param array $tags array of tags |
</span></span><span id="278" class="l"><a class="l" href="#278">278: </a><span class="php-comment"> * @return array array of not matching cache ids (string) |
</span></span><span id="279" class="l"><a class="l" href="#279">279: </a><span class="php-comment"> */</span> |
</span><span id="280" class="l"><a class="l" href="#280">280: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIdsSansLesTags" href="#_getIdsSansLesTags">getIdsSansLesTags</a>(<span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="281" class="l"><a class="l" href="#281">281: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="282" class="l"><a class="l" href="#282">282: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">'SELECT id FROM cache'</span>); |
</span><span id="283" class="l"><a class="l" href="#283">283: </a> <span class="php-var">$lignes</span> = @<span class="php-keyword2">sqlite_fetch_all</span>(<span class="php-var">$resultat</span>, SQLITE_ASSOC); |
</span><span id="284" class="l"><a class="l" href="#284">284: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">array</span>(); |
</span><span id="285" class="l"><a class="l" href="#285">285: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$lignes</span> <span class="php-keyword1">as</span> <span class="php-var">$ligne</span>) { |
</span><span id="286" class="l"><a class="l" href="#286">286: </a> <span class="php-var">$id</span> = <span class="php-var">$ligne</span>[<span class="php-quote">'id'</span>]; |
</span><span id="287" class="l"><a class="l" href="#287">287: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">false</span>; |
</span><span id="288" class="l"><a class="l" href="#288">288: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tags</span> <span class="php-keyword1">as</span> <span class="php-var">$tag</span>) { |
</span><span id="289" class="l"><a class="l" href="#289">289: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">"SELECT COUNT(*) AS nbr FROM tag WHERE name = '</span><span class="php-var">$tag</span><span class="php-quote">' AND id = '</span><span class="php-var">$id</span><span class="php-quote">'"</span>); |
</span><span id="290" class="l"><a class="l" href="#290">290: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span>) { |
</span><span id="291" class="l"><a class="l" href="#291">291: </a> <span class="php-var">$nbre</span> = (int) @<span class="php-keyword2">sqlite_fetch_single</span>(<span class="php-var">$resultat</span>); |
</span><span id="292" class="l"><a class="l" href="#292">292: </a> <span class="php-keyword1">if</span> (<span class="php-var">$nbre</span> > <span class="php-num">0</span>) { |
</span><span id="293" class="l"><a class="l" href="#293">293: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">true</span>; |
</span><span id="294" class="l"><a class="l" href="#294">294: </a> } |
</span><span id="295" class="l"><a class="l" href="#295">295: </a> } |
</span><span id="296" class="l"><a class="l" href="#296">296: </a> } |
</span><span id="297" class="l"><a class="l" href="#297">297: </a> <span class="php-keyword1">if</span> (!<span class="php-var">$correspondance</span>) { |
</span><span id="298" class="l"><a class="l" href="#298">298: </a> <span class="php-var">$retour</span>[] = <span class="php-var">$id</span>; |
</span><span id="299" class="l"><a class="l" href="#299">299: </a> } |
</span><span id="300" class="l"><a class="l" href="#300">300: </a> } |
</span><span id="301" class="l"><a class="l" href="#301">301: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="302" class="l"><a class="l" href="#302">302: </a> } |
</span><span id="303" class="l"><a class="l" href="#303">303: </a> |
</span><span id="304" class="l"><a class="l" href="#304">304: </a> <span class="php-comment">/** |
</span></span><span id="305" class="l"><a class="l" href="#305">305: </a><span class="php-comment"> * Return an array of stored cache ids which match any given tags |
</span></span><span id="306" class="l"><a class="l" href="#306">306: </a><span class="php-comment"> * |
</span></span><span id="307" class="l"><a class="l" href="#307">307: </a><span class="php-comment"> * In case of multiple tags, a logical AND is made between tags |
</span></span><span id="308" class="l"><a class="l" href="#308">308: </a><span class="php-comment"> * |
</span></span><span id="309" class="l"><a class="l" href="#309">309: </a><span class="php-comment"> * @param array $tags array of tags |
</span></span><span id="310" class="l"><a class="l" href="#310">310: </a><span class="php-comment"> * @return array array of any matching cache ids (string) |
</span></span><span id="311" class="l"><a class="l" href="#311">311: </a><span class="php-comment"> */</span> |
</span><span id="312" class="l"><a class="l" href="#312">312: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIdsAvecUnTag" href="#_getIdsAvecUnTag">getIdsAvecUnTag</a>(<span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="313" class="l"><a class="l" href="#313">313: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="314" class="l"><a class="l" href="#314">314: </a> <span class="php-var">$premier</span> = <span class="php-keyword1">true</span>; |
</span><span id="315" class="l"><a class="l" href="#315">315: </a> <span class="php-var">$ids</span> = <span class="php-keyword1">array</span>(); |
</span><span id="316" class="l"><a class="l" href="#316">316: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tags</span> <span class="php-keyword1">as</span> <span class="php-var">$tag</span>) { |
</span><span id="317" class="l"><a class="l" href="#317">317: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">"SELECT DISTINCT(id) AS id FROM tag WHERE name = '</span><span class="php-var">$tag</span><span class="php-quote">'"</span>); |
</span><span id="318" class="l"><a class="l" href="#318">318: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span>) { |
</span><span id="319" class="l"><a class="l" href="#319">319: </a> <span class="php-var">$lignes</span> = @<span class="php-keyword2">sqlite_fetch_all</span>(<span class="php-var">$resultat</span>, SQLITE_ASSOC); |
</span><span id="320" class="l"><a class="l" href="#320">320: </a> <span class="php-var">$ids_tmp</span> = <span class="php-keyword1">array</span>(); |
</span><span id="321" class="l"><a class="l" href="#321">321: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$lignes</span> <span class="php-keyword1">as</span> <span class="php-var">$ligne</span>) { |
</span><span id="322" class="l"><a class="l" href="#322">322: </a> <span class="php-var">$ids_tmp</span>[] = <span class="php-var">$ligne</span>[<span class="php-quote">'id'</span>]; |
</span><span id="323" class="l"><a class="l" href="#323">323: </a> } |
</span><span id="324" class="l"><a class="l" href="#324">324: </a> <span class="php-keyword1">if</span> (<span class="php-var">$premier</span>) { |
</span><span id="325" class="l"><a class="l" href="#325">325: </a> <span class="php-var">$ids</span> = <span class="php-var">$ids_tmp</span>; |
</span><span id="326" class="l"><a class="l" href="#326">326: </a> <span class="php-var">$premier</span> = <span class="php-keyword1">false</span>; |
</span><span id="327" class="l"><a class="l" href="#327">327: </a> } <span class="php-keyword1">else</span> { |
</span><span id="328" class="l"><a class="l" href="#328">328: </a> <span class="php-var">$ids</span> = <span class="php-keyword2">array_merge</span>(<span class="php-var">$ids</span>, <span class="php-var">$ids_tmp</span>); |
</span><span id="329" class="l"><a class="l" href="#329">329: </a> } |
</span><span id="330" class="l"><a class="l" href="#330">330: </a> } |
</span><span id="331" class="l"><a class="l" href="#331">331: </a> } |
</span><span id="332" class="l"><a class="l" href="#332">332: </a> |
</span><span id="333" class="l"><a class="l" href="#333">333: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">array</span>(); |
</span><span id="334" class="l"><a class="l" href="#334">334: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$ids</span>) > <span class="php-num">0</span>) { |
</span><span id="335" class="l"><a class="l" href="#335">335: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$ids</span> <span class="php-keyword1">as</span> <span class="php-var">$id</span>) { |
</span><span id="336" class="l"><a class="l" href="#336">336: </a> <span class="php-var">$retour</span>[] = <span class="php-var">$id</span>; |
</span><span id="337" class="l"><a class="l" href="#337">337: </a> } |
</span><span id="338" class="l"><a class="l" href="#338">338: </a> } |
</span><span id="339" class="l"><a class="l" href="#339">339: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="340" class="l"><a class="l" href="#340">340: </a> } |
</span><span id="341" class="l"><a class="l" href="#341">341: </a> |
</span><span id="342" class="l"><a class="l" href="#342">342: </a> <span class="php-comment">/** |
</span></span><span id="343" class="l"><a class="l" href="#343">343: </a><span class="php-comment"> * Return the filling percentage of the backend storage |
</span></span><span id="344" class="l"><a class="l" href="#344">344: </a><span class="php-comment"> * |
</span></span><span id="345" class="l"><a class="l" href="#345">345: </a><span class="php-comment"> * @throws Zend_Cache_Exception |
</span></span><span id="346" class="l"><a class="l" href="#346">346: </a><span class="php-comment"> * @return int integer between 0 and 100 |
</span></span><span id="347" class="l"><a class="l" href="#347">347: </a><span class="php-comment"> */</span> |
</span><span id="348" class="l"><a class="l" href="#348">348: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getPourcentageRemplissage" href="#_getPourcentageRemplissage">getPourcentageRemplissage</a>() { |
</span><span id="349" class="l"><a class="l" href="#349">349: </a> <span class="php-var">$dossier</span> = <span class="php-keyword2">dirname</span>(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>]); |
</span><span id="350" class="l"><a class="l" href="#350">350: </a> <span class="php-var">$libre</span> = <span class="php-keyword2">disk_free_space</span>(<span class="php-var">$dossier</span>); |
</span><span id="351" class="l"><a class="l" href="#351">351: </a> <span class="php-var">$total</span> = <span class="php-keyword2">disk_total_space</span>(<span class="php-var">$dossier</span>); |
</span><span id="352" class="l"><a class="l" href="#352">352: </a> |
</span><span id="353" class="l"><a class="l" href="#353">353: </a> <span class="php-var">$pourcentage</span> = <span class="php-num">0</span>; |
</span><span id="354" class="l"><a class="l" href="#354">354: </a> <span class="php-keyword1">if</span> (<span class="php-var">$total</span> == <span class="php-num">0</span>) { |
</span><span id="355" class="l"><a class="l" href="#355">355: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Impossible d'utiliser la fonction disk_total_space"</span>, E_USER_WARNING); |
</span><span id="356" class="l"><a class="l" href="#356">356: </a> } <span class="php-keyword1">else</span> { |
</span><span id="357" class="l"><a class="l" href="#357">357: </a> <span class="php-var">$pourcentage</span> = (<span class="php-var">$libre</span> >= <span class="php-var">$total</span>) ? <span class="php-num">100</span> : ((int) (<span class="php-num">100</span>. * (<span class="php-var">$total</span> - <span class="php-var">$libre</span>) / <span class="php-var">$total</span>)); |
</span><span id="358" class="l"><a class="l" href="#358">358: </a> } |
</span><span id="359" class="l"><a class="l" href="#359">359: </a> <span class="php-keyword1">return</span> <span class="php-var">$pourcentage</span>; |
</span><span id="360" class="l"><a class="l" href="#360">360: </a> } |
</span><span id="361" class="l"><a class="l" href="#361">361: </a> |
</span><span id="362" class="l"><a class="l" href="#362">362: </a> <span class="php-comment">/** |
</span></span><span id="363" class="l"><a class="l" href="#363">363: </a><span class="php-comment"> * Return an array of metadatas for the given cache id |
</span></span><span id="364" class="l"><a class="l" href="#364">364: </a><span class="php-comment"> * |
</span></span><span id="365" class="l"><a class="l" href="#365">365: </a><span class="php-comment"> * The array must include these keys : |
</span></span><span id="366" class="l"><a class="l" href="#366">366: </a><span class="php-comment"> * - expire : the expire timestamp |
</span></span><span id="367" class="l"><a class="l" href="#367">367: </a><span class="php-comment"> * - tags : a string array of tags |
</span></span><span id="368" class="l"><a class="l" href="#368">368: </a><span class="php-comment"> * - mtime : timestamp of last modification time |
</span></span><span id="369" class="l"><a class="l" href="#369">369: </a><span class="php-comment"> * |
</span></span><span id="370" class="l"><a class="l" href="#370">370: </a><span class="php-comment"> * @param string $id cache id |
</span></span><span id="371" class="l"><a class="l" href="#371">371: </a><span class="php-comment"> * @return array array of metadatas (false if the cache id is not found) |
</span></span><span id="372" class="l"><a class="l" href="#372">372: </a><span class="php-comment"> */</span> |
</span><span id="373" class="l"><a class="l" href="#373">373: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getMetadonnees" href="#_getMetadonnees">getMetadonnees</a>(<span class="php-var">$id</span>) { |
</span><span id="374" class="l"><a class="l" href="#374">374: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="375" class="l"><a class="l" href="#375">375: </a> <span class="php-var">$tags</span> = <span class="php-keyword1">array</span>(); |
</span><span id="376" class="l"><a class="l" href="#376">376: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">"SELECT name FROM tag WHERE id = '</span><span class="php-var">$id</span><span class="php-quote">'"</span>); |
</span><span id="377" class="l"><a class="l" href="#377">377: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span>) { |
</span><span id="378" class="l"><a class="l" href="#378">378: </a> <span class="php-var">$lignes</span> = @<span class="php-keyword2">sqlite_fetch_all</span>(<span class="php-var">$resultat</span>, SQLITE_ASSOC); |
</span><span id="379" class="l"><a class="l" href="#379">379: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$lignes</span> <span class="php-keyword1">as</span> <span class="php-var">$ligne</span>) { |
</span><span id="380" class="l"><a class="l" href="#380">380: </a> <span class="php-var">$tags</span>[] = <span class="php-var">$ligne</span>[<span class="php-quote">'name'</span>]; |
</span><span id="381" class="l"><a class="l" href="#381">381: </a> } |
</span><span id="382" class="l"><a class="l" href="#382">382: </a> } |
</span><span id="383" class="l"><a class="l" href="#383">383: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">"SELECT lastModified, expire FROM cache WHERE id = '</span><span class="php-var">$id</span><span class="php-quote">'"</span>); |
</span><span id="384" class="l"><a class="l" href="#384">384: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span>) { |
</span><span id="385" class="l"><a class="l" href="#385">385: </a> <span class="php-var">$ligne</span> = @<span class="php-keyword2">sqlite_fetch_array</span>(<span class="php-var">$resultat</span>, SQLITE_ASSOC); |
</span><span id="386" class="l"><a class="l" href="#386">386: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">array</span>( |
</span><span id="387" class="l"><a class="l" href="#387">387: </a> <span class="php-quote">'tags'</span> => <span class="php-var">$tags</span>, |
</span><span id="388" class="l"><a class="l" href="#388">388: </a> <span class="php-quote">'mtime'</span> => <span class="php-var">$ligne</span>[<span class="php-quote">'lastModified'</span>], |
</span><span id="389" class="l"><a class="l" href="#389">389: </a> <span class="php-quote">'expiration'</span> => <span class="php-var">$ligne</span>[<span class="php-quote">'expire'</span>]); |
</span><span id="390" class="l"><a class="l" href="#390">390: </a> } <span class="php-keyword1">else</span> { |
</span><span id="391" class="l"><a class="l" href="#391">391: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">false</span>; |
</span><span id="392" class="l"><a class="l" href="#392">392: </a> } |
</span><span id="393" class="l"><a class="l" href="#393">393: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="394" class="l"><a class="l" href="#394">394: </a> } |
</span><span id="395" class="l"><a class="l" href="#395">395: </a> |
</span><span id="396" class="l"><a class="l" href="#396">396: </a> <span class="php-comment">/** |
</span></span><span id="397" class="l"><a class="l" href="#397">397: </a><span class="php-comment"> * Give (if possible) an extra lifetime to the given cache id |
</span></span><span id="398" class="l"><a class="l" href="#398">398: </a><span class="php-comment"> * |
</span></span><span id="399" class="l"><a class="l" href="#399">399: </a><span class="php-comment"> * @param string $id cache id |
</span></span><span id="400" class="l"><a class="l" href="#400">400: </a><span class="php-comment"> * @param int $extraLifetime |
</span></span><span id="401" class="l"><a class="l" href="#401">401: </a><span class="php-comment"> * @return boolean true if ok |
</span></span><span id="402" class="l"><a class="l" href="#402">402: </a><span class="php-comment"> */</span> |
</span><span id="403" class="l"><a class="l" href="#403">403: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ajouterSupplementDureeDeVie" href="#_ajouterSupplementDureeDeVie">ajouterSupplementDureeDeVie</a>(<span class="php-var">$id</span>, <span class="php-var">$supplement_duree_de_vie</span>) { |
</span><span id="404" class="l"><a class="l" href="#404">404: </a> <span class="php-var">$this</span>->verifierEtCreerStructureBdd(); |
</span><span id="405" class="l"><a class="l" href="#405">405: </a> <span class="php-var">$augmentation</span> = <span class="php-keyword1">false</span>; |
</span><span id="406" class="l"><a class="l" href="#406">406: </a> <span class="php-var">$requete</span> = <span class="php-quote">"SELECT expire FROM cache WHERE id = '</span><span class="php-var">$id</span><span class="php-quote">' AND (expire = 0 OR expire > "</span>.<span class="php-keyword2">time</span>().<span class="php-quote">')'</span>; |
</span><span id="407" class="l"><a class="l" href="#407">407: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-var">$requete</span>); |
</span><span id="408" class="l"><a class="l" href="#408">408: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span>) { |
</span><span id="409" class="l"><a class="l" href="#409">409: </a> <span class="php-var">$expiration</span> = @<span class="php-keyword2">sqlite_fetch_single</span>(<span class="php-var">$resultat</span>); |
</span><span id="410" class="l"><a class="l" href="#410">410: </a> <span class="php-var">$nouvelle_expiration</span> = <span class="php-var">$expiration</span> + <span class="php-var">$supplement_duree_de_vie</span>; |
</span><span id="411" class="l"><a class="l" href="#411">411: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">'UPDATE cache SET lastModified = '</span>.<span class="php-keyword2">time</span>().<span class="php-quote">", expire = </span><span class="php-var">$nouvelle_expiration</span><span class="php-quote"> WHERE id = '</span><span class="php-var">$id</span><span class="php-quote">'"</span>); |
</span><span id="412" class="l"><a class="l" href="#412">412: </a> <span class="php-var">$augmentation</span> = (<span class="php-var">$resultat</span>) ? <span class="php-keyword1">true</span> : <span class="php-keyword1">false</span>; |
</span><span id="413" class="l"><a class="l" href="#413">413: </a> } |
</span><span id="414" class="l"><a class="l" href="#414">414: </a> <span class="php-keyword1">return</span> <span class="php-var">$augmentation</span>; |
</span><span id="415" class="l"><a class="l" href="#415">415: </a> } |
</span><span id="416" class="l"><a class="l" href="#416">416: </a> |
</span><span id="417" class="l"><a class="l" href="#417">417: </a> <span class="php-comment">/** |
</span></span><span id="418" class="l"><a class="l" href="#418">418: </a><span class="php-comment"> * Return the connection resource |
</span></span><span id="419" class="l"><a class="l" href="#419">419: </a><span class="php-comment"> * |
</span></span><span id="420" class="l"><a class="l" href="#420">420: </a><span class="php-comment"> * If we are not connected, the connection is made |
</span></span><span id="421" class="l"><a class="l" href="#421">421: </a><span class="php-comment"> * |
</span></span><span id="422" class="l"><a class="l" href="#422">422: </a><span class="php-comment"> * @throws Zend_Cache_Exception |
</span></span><span id="423" class="l"><a class="l" href="#423">423: </a><span class="php-comment"> * @return resource Connection resource |
</span></span><span id="424" class="l"><a class="l" href="#424">424: </a><span class="php-comment"> */</span> |
</span><span id="425" class="l"><a class="l" href="#425">425: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_getConnexion" href="#_getConnexion">getConnexion</a>() { |
</span><span id="426" class="l"><a class="l" href="#426">426: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_resource</span>(<span class="php-var">$this</span>->bdd)) { |
</span><span id="427" class="l"><a class="l" href="#427">427: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>] === <span class="php-keyword1">null</span>) { |
</span><span id="428" class="l"><a class="l" href="#428">428: </a> <span class="php-var">$e</span> = <span class="php-quote">"L'emplacement du chemin vers le fichier de la base de données SQLite n'a pas été défini"</span>; |
</span><span id="429" class="l"><a class="l" href="#429">429: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_ERROR); |
</span><span id="430" class="l"><a class="l" href="#430">430: </a> } <span class="php-keyword1">else</span> { |
</span><span id="431" class="l"><a class="l" href="#431">431: </a> <span class="php-var">$this</span>->bdd = <span class="php-keyword2">sqlite_open</span>(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>]); |
</span><span id="432" class="l"><a class="l" href="#432">432: </a> <span class="php-keyword1">if</span> (!(<span class="php-keyword2">is_resource</span>(<span class="php-var">$this</span>->bdd))) { |
</span><span id="433" class="l"><a class="l" href="#433">433: </a> <span class="php-var">$e</span> = <span class="php-quote">"Impossible d'ouvrir le fichier '"</span>.<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>].<span class="php-quote">"' de la base de données SQLite."</span>; |
</span><span id="434" class="l"><a class="l" href="#434">434: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_ERROR); |
</span><span id="435" class="l"><a class="l" href="#435">435: </a> <span class="php-var">$this</span>->bdd = <span class="php-keyword1">null</span>; |
</span><span id="436" class="l"><a class="l" href="#436">436: </a> } |
</span><span id="437" class="l"><a class="l" href="#437">437: </a> } |
</span><span id="438" class="l"><a class="l" href="#438">438: </a> } |
</span><span id="439" class="l"><a class="l" href="#439">439: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->bdd; |
</span><span id="440" class="l"><a class="l" href="#440">440: </a> } |
</span><span id="441" class="l"><a class="l" href="#441">441: </a> |
</span><span id="442" class="l"><a class="l" href="#442">442: </a> <span class="php-comment">/** |
</span></span><span id="443" class="l"><a class="l" href="#443">443: </a><span class="php-comment"> * Execute une requête SQL sans afficher de messages d'erreur. |
</span></span><span id="444" class="l"><a class="l" href="#444">444: </a><span class="php-comment"> * |
</span></span><span id="445" class="l"><a class="l" href="#445">445: </a><span class="php-comment"> * @param string $requete requête SQL |
</span></span><span id="446" class="l"><a class="l" href="#446">446: </a><span class="php-comment"> * @return mixed|false resultats de la requête |
</span></span><span id="447" class="l"><a class="l" href="#447">447: </a><span class="php-comment"> */</span> |
</span><span id="448" class="l"><a class="l" href="#448">448: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_requeter" href="#_requeter">requeter</a>(<span class="php-var">$requete</span>) { |
</span><span id="449" class="l"><a class="l" href="#449">449: </a> <span class="php-var">$bdd</span> = <span class="php-var">$this</span>->getConnexion(); |
</span><span id="450" class="l"><a class="l" href="#450">450: </a> <span class="php-comment">//Debug::printr($requete);</span> |
</span><span id="451" class="l"><a class="l" href="#451">451: </a> <span class="php-var">$resultat</span> = (<span class="php-keyword2">is_resource</span>(<span class="php-var">$bdd</span>)) ? @<span class="php-keyword2">sqlite_query</span>(<span class="php-var">$bdd</span>, <span class="php-var">$requete</span>, SQLITE_ASSOC, <span class="php-var">$e_sqlite</span>) : <span class="php-keyword1">false</span>; |
</span><span id="452" class="l"><a class="l" href="#452">452: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_resource</span>(<span class="php-var">$bdd</span>) && ! <span class="php-var">$resultat</span>) { |
</span><span id="453" class="l"><a class="l" href="#453">453: </a> Debug::printr(<span class="php-quote">"Erreur SQLITE :\n</span><span class="php-var">$e_sqlite</span><span class="php-quote">\nPour la requête :\n</span><span class="php-var">$requete</span><span class="php-quote">\nRessource : </span><span class="php-var">$bdd</span><span class="php-quote">"</span>); |
</span><span id="454" class="l"><a class="l" href="#454">454: </a> } |
</span><span id="455" class="l"><a class="l" href="#455">455: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="456" class="l"><a class="l" href="#456">456: </a> } |
</span><span id="457" class="l"><a class="l" href="#457">457: </a> |
</span><span id="458" class="l"><a class="l" href="#458">458: </a> <span class="php-comment">/** |
</span></span><span id="459" class="l"><a class="l" href="#459">459: </a><span class="php-comment"> * Deal with the automatic vacuum process |
</span></span><span id="460" class="l"><a class="l" href="#460">460: </a><span class="php-comment"> * |
</span></span><span id="461" class="l"><a class="l" href="#461">461: </a><span class="php-comment"> * @return void |
</span></span><span id="462" class="l"><a class="l" href="#462">462: </a><span class="php-comment"> */</span> |
</span><span id="463" class="l"><a class="l" href="#463">463: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_defragmenterAutomatiquement" href="#_defragmenterAutomatiquement">defragmenterAutomatiquement</a>() { |
</span><span id="464" class="l"><a class="l" href="#464">464: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'defragmentation_auto'</span>] > <span class="php-num">0</span>) { |
</span><span id="465" class="l"><a class="l" href="#465">465: </a> <span class="php-var">$rand</span> = <span class="php-keyword2">rand</span>(<span class="php-num">1</span>, <span class="php-var">$this</span>->options[<span class="php-quote">'defragmentation_auto'</span>]); |
</span><span id="466" class="l"><a class="l" href="#466">466: </a> <span class="php-keyword1">if</span> (<span class="php-var">$rand</span> == <span class="php-num">1</span>) { |
</span><span id="467" class="l"><a class="l" href="#467">467: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'VACUUM'</span>); |
</span><span id="468" class="l"><a class="l" href="#468">468: </a> @<span class="php-keyword2">sqlite_close</span>(<span class="php-var">$this</span>->getConnexion()); |
</span><span id="469" class="l"><a class="l" href="#469">469: </a> } |
</span><span id="470" class="l"><a class="l" href="#470">470: </a> } |
</span><span id="471" class="l"><a class="l" href="#471">471: </a> } |
</span><span id="472" class="l"><a class="l" href="#472">472: </a> |
</span><span id="473" class="l"><a class="l" href="#473">473: </a> <span class="php-comment">/** |
</span></span><span id="474" class="l"><a class="l" href="#474">474: </a><span class="php-comment"> * Register a cache id with the given tag |
</span></span><span id="475" class="l"><a class="l" href="#475">475: </a><span class="php-comment"> * |
</span></span><span id="476" class="l"><a class="l" href="#476">476: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="477" class="l"><a class="l" href="#477">477: </a><span class="php-comment"> * @param string $tag Tag |
</span></span><span id="478" class="l"><a class="l" href="#478">478: </a><span class="php-comment"> * @return boolean True if no problem |
</span></span><span id="479" class="l"><a class="l" href="#479">479: </a><span class="php-comment"> */</span> |
</span><span id="480" class="l"><a class="l" href="#480">480: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_enregisterTag" href="#_enregisterTag">enregisterTag</a>(<span class="php-var">$id</span>, <span class="php-var">$tag</span>) { |
</span><span id="481" class="l"><a class="l" href="#481">481: </a> <span class="php-var">$requete_suppression</span> = <span class="php-quote">"DELETE FROM tag WHERE name = '</span><span class="php-var">$tag</span><span class="php-quote">' AND id = '</span><span class="php-var">$id</span><span class="php-quote">'"</span>; |
</span><span id="482" class="l"><a class="l" href="#482">482: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-var">$requete_suppression</span>); |
</span><span id="483" class="l"><a class="l" href="#483">483: </a> <span class="php-var">$requete_insertion</span> = <span class="php-quote">"INSERT INTO tag(name,id) VALUES ('</span><span class="php-var">$tag</span><span class="php-quote">','</span><span class="php-var">$id</span><span class="php-quote">')"</span>; |
</span><span id="484" class="l"><a class="l" href="#484">484: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-var">$requete_insertion</span>); |
</span><span id="485" class="l"><a class="l" href="#485">485: </a> <span class="php-keyword1">if</span> (!<span class="php-var">$resultat</span>) { |
</span><span id="486" class="l"><a class="l" href="#486">486: </a> <span class="php-comment">// TODO : ajouter un log -> impossible d'enregistrer le tag=$tag pour le cache id=$id");</span> |
</span><span id="487" class="l"><a class="l" href="#487">487: </a> Debug::printr(<span class="php-quote">"Impossible d'enregistrer le tag=</span><span class="php-var">$tag</span><span class="php-quote"> pour le cache id=</span><span class="php-var">$id</span><span class="php-quote">"</span>); |
</span><span id="488" class="l"><a class="l" href="#488">488: </a> } |
</span><span id="489" class="l"><a class="l" href="#489">489: </a> <span class="php-keyword1">return</span> (<span class="php-var">$resultat</span>) ? <span class="php-keyword1">true</span> : <span class="php-keyword1">false</span>; |
</span><span id="490" class="l"><a class="l" href="#490">490: </a> } |
</span><span id="491" class="l"><a class="l" href="#491">491: </a> |
</span><span id="492" class="l"><a class="l" href="#492">492: </a> <span class="php-comment">/** |
</span></span><span id="493" class="l"><a class="l" href="#493">493: </a><span class="php-comment"> * Build the database structure |
</span></span><span id="494" class="l"><a class="l" href="#494">494: </a><span class="php-comment"> * |
</span></span><span id="495" class="l"><a class="l" href="#495">495: </a><span class="php-comment"> * @return false |
</span></span><span id="496" class="l"><a class="l" href="#496">496: </a><span class="php-comment"> */</span> |
</span><span id="497" class="l"><a class="l" href="#497">497: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_creerStructure" href="#_creerStructure">creerStructure</a>() { |
</span><span id="498" class="l"><a class="l" href="#498">498: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'DROP INDEX IF EXISTS tag_id_index'</span>); |
</span><span id="499" class="l"><a class="l" href="#499">499: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'DROP INDEX IF EXISTS tag_name_index'</span>); |
</span><span id="500" class="l"><a class="l" href="#500">500: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'DROP INDEX IF EXISTS cache_id_expire_index'</span>); |
</span><span id="501" class="l"><a class="l" href="#501">501: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'DROP TABLE IF EXISTS version'</span>); |
</span><span id="502" class="l"><a class="l" href="#502">502: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'DROP TABLE IF EXISTS cache'</span>); |
</span><span id="503" class="l"><a class="l" href="#503">503: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'DROP TABLE IF EXISTS tag'</span>); |
</span><span id="504" class="l"><a class="l" href="#504">504: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'CREATE TABLE version (num INTEGER PRIMARY KEY)'</span>); |
</span><span id="505" class="l"><a class="l" href="#505">505: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'CREATE TABLE cache(id TEXT PRIMARY KEY, content BLOB, lastModified INTEGER, expire INTEGER)'</span>); |
</span><span id="506" class="l"><a class="l" href="#506">506: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'CREATE TABLE tag (name TEXT, id TEXT)'</span>); |
</span><span id="507" class="l"><a class="l" href="#507">507: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'CREATE INDEX tag_id_index ON tag(id)'</span>); |
</span><span id="508" class="l"><a class="l" href="#508">508: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'CREATE INDEX tag_name_index ON tag(name)'</span>); |
</span><span id="509" class="l"><a class="l" href="#509">509: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'CREATE INDEX cache_id_expire_index ON cache(id, expire)'</span>); |
</span><span id="510" class="l"><a class="l" href="#510">510: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">'INSERT INTO version (num) VALUES (1)'</span>); |
</span><span id="511" class="l"><a class="l" href="#511">511: </a> } |
</span><span id="512" class="l"><a class="l" href="#512">512: </a> |
</span><span id="513" class="l"><a class="l" href="#513">513: </a> <span class="php-comment">/** |
</span></span><span id="514" class="l"><a class="l" href="#514">514: </a><span class="php-comment"> * Check if the database structure is ok (with the good version) |
</span></span><span id="515" class="l"><a class="l" href="#515">515: </a><span class="php-comment"> * |
</span></span><span id="516" class="l"><a class="l" href="#516">516: </a><span class="php-comment"> * @return boolean True if ok |
</span></span><span id="517" class="l"><a class="l" href="#517">517: </a><span class="php-comment"> */</span> |
</span><span id="518" class="l"><a class="l" href="#518">518: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_verifierBddStructureVersion" href="#_verifierBddStructureVersion">verifierBddStructureVersion</a>() { |
</span><span id="519" class="l"><a class="l" href="#519">519: </a> <span class="php-var">$version_ok</span> = <span class="php-keyword1">false</span>; |
</span><span id="520" class="l"><a class="l" href="#520">520: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">'SELECT num FROM version'</span>); |
</span><span id="521" class="l"><a class="l" href="#521">521: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span>) { |
</span><span id="522" class="l"><a class="l" href="#522">522: </a> <span class="php-var">$ligne</span> = @<span class="php-keyword2">sqlite_fetch_array</span>(<span class="php-var">$resultat</span>); |
</span><span id="523" class="l"><a class="l" href="#523">523: </a> <span class="php-keyword1">if</span> (<span class="php-var">$ligne</span>) { |
</span><span id="524" class="l"><a class="l" href="#524">524: </a> <span class="php-keyword1">if</span> (((int) <span class="php-var">$ligne</span>[<span class="php-quote">'num'</span>]) == <span class="php-num">1</span>) { |
</span><span id="525" class="l"><a class="l" href="#525">525: </a> <span class="php-var">$version_ok</span> = <span class="php-keyword1">true</span>; |
</span><span id="526" class="l"><a class="l" href="#526">526: </a> } <span class="php-keyword1">else</span> { |
</span><span id="527" class="l"><a class="l" href="#527">527: </a> <span class="php-comment">// TODO : ajouter un log CacheSqlite::verifierBddStructureVersion() : vielle version de la structure de la base de données de cache détectée => le cache est entrain d'être supprimé</span> |
</span><span id="528" class="l"><a class="l" href="#528">528: </a> } |
</span><span id="529" class="l"><a class="l" href="#529">529: </a> } |
</span><span id="530" class="l"><a class="l" href="#530">530: </a> } |
</span><span id="531" class="l"><a class="l" href="#531">531: </a> <span class="php-keyword1">return</span> <span class="php-var">$version_ok</span>; |
</span><span id="532" class="l"><a class="l" href="#532">532: </a> } |
</span><span id="533" class="l"><a class="l" href="#533">533: </a> |
</span><span id="534" class="l"><a class="l" href="#534">534: </a> <span class="php-comment">/** |
</span></span><span id="535" class="l"><a class="l" href="#535">535: </a><span class="php-comment"> * Clean some cache records |
</span></span><span id="536" class="l"><a class="l" href="#536">536: </a><span class="php-comment"> * |
</span></span><span id="537" class="l"><a class="l" href="#537">537: </a><span class="php-comment"> * Available modes are : |
</span></span><span id="538" class="l"><a class="l" href="#538">538: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) |
</span></span><span id="539" class="l"><a class="l" href="#539">539: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) |
</span></span><span id="540" class="l"><a class="l" href="#540">540: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags |
</span></span><span id="541" class="l"><a class="l" href="#541">541: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="542" class="l"><a class="l" href="#542">542: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} |
</span></span><span id="543" class="l"><a class="l" href="#543">543: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="544" class="l"><a class="l" href="#544">544: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags |
</span></span><span id="545" class="l"><a class="l" href="#545">545: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="546" class="l"><a class="l" href="#546">546: </a><span class="php-comment"> * |
</span></span><span id="547" class="l"><a class="l" href="#547">547: </a><span class="php-comment"> * @param string $mode Clean mode |
</span></span><span id="548" class="l"><a class="l" href="#548">548: </a><span class="php-comment"> * @param array $tags Array of tags |
</span></span><span id="549" class="l"><a class="l" href="#549">549: </a><span class="php-comment"> * @return boolean True if no problem |
</span></span><span id="550" class="l"><a class="l" href="#550">550: </a><span class="php-comment"> */</span> |
</span><span id="551" class="l"><a class="l" href="#551">551: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_nettoyerSqlite" href="#_nettoyerSqlite">nettoyerSqlite</a>(<span class="php-var">$mode</span> = Cache::NETTOYAGE_MODE_TOUS, <span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="552" class="l"><a class="l" href="#552">552: </a> <span class="php-var">$nettoyage_ok</span> = <span class="php-keyword1">false</span>; |
</span><span id="553" class="l"><a class="l" href="#553">553: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$mode</span>) { |
</span><span id="554" class="l"><a class="l" href="#554">554: </a> <span class="php-keyword1">case</span> Cache::NETTOYAGE_MODE_TOUS: |
</span><span id="555" class="l"><a class="l" href="#555">555: </a> <span class="php-var">$suppression_cache</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">'DELETE FROM cache'</span>); |
</span><span id="556" class="l"><a class="l" href="#556">556: </a> <span class="php-var">$suppression_tag</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">'DELETE FROM tag'</span>); |
</span><span id="557" class="l"><a class="l" href="#557">557: </a> <span class="php-var">$nettoyage_ok</span> = <span class="php-var">$suppression_cache</span> && <span class="php-var">$suppression_tag</span>; |
</span><span id="558" class="l"><a class="l" href="#558">558: </a> <span class="php-keyword1">break</span>; |
</span><span id="559" class="l"><a class="l" href="#559">559: </a> <span class="php-keyword1">case</span> Cache::NETTOYAGE_MODE_EXPIRATION: |
</span><span id="560" class="l"><a class="l" href="#560">560: </a> <span class="php-var">$mktime</span> = <span class="php-keyword2">time</span>(); |
</span><span id="561" class="l"><a class="l" href="#561">561: </a> <span class="php-var">$suppression_tag</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">"DELETE FROM tag WHERE id IN (SELECT id FROM cache WHERE expire > 0 AND expire <= </span><span class="php-var">$mktime</span><span class="php-quote">)"</span>); |
</span><span id="562" class="l"><a class="l" href="#562">562: </a> <span class="php-var">$suppression_cache</span> = <span class="php-var">$this</span>->requeter(<span class="php-quote">"DELETE FROM cache WHERE expire > 0 AND expire <= </span><span class="php-var">$mktime</span><span class="php-quote">"</span>); |
</span><span id="563" class="l"><a class="l" href="#563">563: </a> <span class="php-keyword1">return</span> <span class="php-var">$suppression_tag</span> && <span class="php-var">$suppression_cache</span>; |
</span><span id="564" class="l"><a class="l" href="#564">564: </a> <span class="php-keyword1">break</span>; |
</span><span id="565" class="l"><a class="l" href="#565">565: </a> <span class="php-keyword1">case</span> Cache::NETTOYAGE_MODE_AVEC_LES_TAGS: |
</span><span id="566" class="l"><a class="l" href="#566">566: </a> <span class="php-var">$ids</span> = <span class="php-var">$this</span>->getIdsAvecLesTags(<span class="php-var">$tags</span>); |
</span><span id="567" class="l"><a class="l" href="#567">567: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="568" class="l"><a class="l" href="#568">568: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$ids</span> <span class="php-keyword1">as</span> <span class="php-var">$id</span>) { |
</span><span id="569" class="l"><a class="l" href="#569">569: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->supprimer(<span class="php-var">$id</span>) && <span class="php-var">$resultat</span>; |
</span><span id="570" class="l"><a class="l" href="#570">570: </a> } |
</span><span id="571" class="l"><a class="l" href="#571">571: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="572" class="l"><a class="l" href="#572">572: </a> <span class="php-keyword1">break</span>; |
</span><span id="573" class="l"><a class="l" href="#573">573: </a> <span class="php-keyword1">case</span> Cache::NETTOYAGE_MODE_SANS_LES_TAGS: |
</span><span id="574" class="l"><a class="l" href="#574">574: </a> <span class="php-var">$ids</span> = <span class="php-var">$this</span>->getIdsSansLesTags(<span class="php-var">$tags</span>); |
</span><span id="575" class="l"><a class="l" href="#575">575: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="576" class="l"><a class="l" href="#576">576: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$ids</span> <span class="php-keyword1">as</span> <span class="php-var">$id</span>) { |
</span><span id="577" class="l"><a class="l" href="#577">577: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->supprimer(<span class="php-var">$id</span>) && <span class="php-var">$resultat</span>; |
</span><span id="578" class="l"><a class="l" href="#578">578: </a> } |
</span><span id="579" class="l"><a class="l" href="#579">579: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="580" class="l"><a class="l" href="#580">580: </a> <span class="php-keyword1">break</span>; |
</span><span id="581" class="l"><a class="l" href="#581">581: </a> <span class="php-keyword1">case</span> Cache::NETTOYAGE_MODE_AVEC_UN_TAG: |
</span><span id="582" class="l"><a class="l" href="#582">582: </a> <span class="php-var">$ids</span> = <span class="php-var">$this</span>->getIdsAvecUnTag(<span class="php-var">$tags</span>); |
</span><span id="583" class="l"><a class="l" href="#583">583: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="584" class="l"><a class="l" href="#584">584: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$ids</span> <span class="php-keyword1">as</span> <span class="php-var">$id</span>) { |
</span><span id="585" class="l"><a class="l" href="#585">585: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->supprimer(<span class="php-var">$id</span>) && <span class="php-var">$resultat</span>; |
</span><span id="586" class="l"><a class="l" href="#586">586: </a> } |
</span><span id="587" class="l"><a class="l" href="#587">587: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="588" class="l"><a class="l" href="#588">588: </a> <span class="php-keyword1">break</span>; |
</span><span id="589" class="l"><a class="l" href="#589">589: </a> <span class="php-keyword1">default</span>: |
</span><span id="590" class="l"><a class="l" href="#590">590: </a> <span class="php-keyword1">break</span>; |
</span><span id="591" class="l"><a class="l" href="#591">591: </a> } |
</span><span id="592" class="l"><a class="l" href="#592">592: </a> <span class="php-keyword1">return</span> <span class="php-var">$nettoyage_ok</span>; |
</span><span id="593" class="l"><a class="l" href="#593">593: </a> } |
</span><span id="594" class="l"><a class="l" href="#594">594: </a> |
</span><span id="595" class="l"><a class="l" href="#595">595: </a> <span class="php-comment">/** |
</span></span><span id="596" class="l"><a class="l" href="#596">596: </a><span class="php-comment"> * Check if the database structure is ok (with the good version), if no : build it |
</span></span><span id="597" class="l"><a class="l" href="#597">597: </a><span class="php-comment"> * |
</span></span><span id="598" class="l"><a class="l" href="#598">598: </a><span class="php-comment"> * @throws Zend_Cache_Exception |
</span></span><span id="599" class="l"><a class="l" href="#599">599: </a><span class="php-comment"> * @return boolean True if ok |
</span></span><span id="600" class="l"><a class="l" href="#600">600: </a><span class="php-comment"> */</span> |
</span><span id="601" class="l"><a class="l" href="#601">601: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_verifierEtCreerStructureBdd" href="#_verifierEtCreerStructureBdd">verifierEtCreerStructureBdd</a>() { |
</span><span id="602" class="l"><a class="l" href="#602">602: </a> <span class="php-keyword1">if</span> (! <span class="php-var">$this</span>->structure_ok) { |
</span><span id="603" class="l"><a class="l" href="#603">603: </a> <span class="php-keyword1">if</span> (! <span class="php-var">$this</span>->verifierBddStructureVersion()) { |
</span><span id="604" class="l"><a class="l" href="#604">604: </a> <span class="php-var">$this</span>->creerStructure(); |
</span><span id="605" class="l"><a class="l" href="#605">605: </a> <span class="php-keyword1">if</span> (! <span class="php-var">$this</span>->verifierBddStructureVersion()) { |
</span><span id="606" class="l"><a class="l" href="#606">606: </a> <span class="php-var">$e</span> = <span class="php-quote">"Impossible de construire la base de données de cache dans "</span>.<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>]; |
</span><span id="607" class="l"><a class="l" href="#607">607: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_WARNING); |
</span><span id="608" class="l"><a class="l" href="#608">608: </a> <span class="php-var">$this</span>->structure_ok = <span class="php-keyword1">false</span>; |
</span><span id="609" class="l"><a class="l" href="#609">609: </a> } |
</span><span id="610" class="l"><a class="l" href="#610">610: </a> } |
</span><span id="611" class="l"><a class="l" href="#611">611: </a> <span class="php-var">$this</span>->structure_ok = <span class="php-keyword1">true</span>; |
</span><span id="612" class="l"><a class="l" href="#612">612: </a> } |
</span><span id="613" class="l"><a class="l" href="#613">613: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->structure_ok; |
</span><span id="614" class="l"><a class="l" href="#614">614: </a> } |
</span><span id="615" class="l"><a class="l" href="#615">615: </a> |
</span><span id="616" class="l"><a class="l" href="#616">616: </a>} |
</span><span id="617" class="l"><a class="l" href="#617">617: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Debug.html |
---|
New file |
0,0 → 1,546 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Debug | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li class="active"><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Debug</h1> |
<div class="description"> |
<p>Classe fournissant des fonctions de débogage équivalante à var_dump et |
print_r. L'affichage et l'utilisation de ces fonctions sont améliorés via |
cette classe. Cette classe est inspirée de la classe Zend_Debug.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2009, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Debug.php 365 2011-09-30 08:19:57Z jpm $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Debug.html#3-191" title="Go to source code">framework/Debug.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="getMode" id="_getMode"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getMode">#</a> |
<code><a href="source-class-Debug.html#40-49" title="Go to source code">getMode</a>( )</code> |
<div class="description short"> |
<p>Accesseur pour le mode</p> |
</div> |
<div class="description detailed hidden"> |
<p>Accesseur pour le mode</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>le mode de php<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="dump" id="_dump"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_dump">#</a> |
<code><a href="source-class-Debug.html#51-69" title="Go to source code">dump</a>( <span>mixed <var>$variable</var></span>, <span>string <var>$mot_cle</var> = <span class="php-keyword1">null</span></span>, <span>boolean <var>$echo</var> = <span class="php-keyword1">false</span></span> )</code> |
<div class="description short"> |
<p>Equivalent de var_dump</p> |
</div> |
<div class="description detailed hidden"> |
<p>Equivalent de var_dump</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$variable</var></dt> |
<dd><code>mixed</code><br>$variable la variable à dumper</dd> |
<dt><var>$mot_cle</var></dt> |
<dd><code>string</code><br>$mot_cle le mot cle à associer à la variable</dd> |
<dt><var>$echo</var></dt> |
<dd><code>boolean</code><br>$echo si true on affiche le résultat, si false on ne renvoie que la chaine sans |
l'afficher</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>la chaine à afficher representant le dump ou null si echo<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="printr" id="_printr"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_printr">#</a> |
<code><a href="source-class-Debug.html#71-84" title="Go to source code">printr</a>( <span>mixed <var>$variable</var></span>, <span>string <var>$mot_cle</var> = <span class="php-keyword1">null</span></span>, <span>boolean <var>$echo</var> = <span class="php-keyword1">false</span></span> )</code> |
<div class="description short"> |
<p>Equivalent de print_r.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Equivalent de print_r.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$variable</var></dt> |
<dd><code>mixed</code><br>$variable la variable à afficher</dd> |
<dt><var>$mot_cle</var></dt> |
<dd><code>string</code><br>$mot_cle le mot cle à associer</dd> |
<dt><var>$echo</var></dt> |
<dd><code>boolean</code><br>$echo faire un echo ou non</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>la chaine contenant la variable printée ou null si echo<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="tailleMemoireVar" id="_tailleMemoireVar"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_tailleMemoireVar">#</a> |
<code><a href="source-class-Debug.html#86-104" title="Go to source code">tailleMemoireVar</a>( <span>mixed <var>$var</var></span>, <span>string <var>$mot_cle</var> = <span class="php-keyword1">null</span></span>, <span>boolean <var>$echo</var> = <span class="php-keyword1">false</span></span> )</code> |
<div class="description short"> |
<p>Affichage d'informations sur l'espace mémoire occupé par une variable</p> |
</div> |
<div class="description detailed hidden"> |
<p>Affichage d'informations sur l'espace mémoire occupé par une variable</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$var</var></dt> |
<dd><code>mixed</code><br>$var la variable dont on veut connaître l'empreinte mémoire.</dd> |
<dt><var>$mot_cle</var></dt> |
<dd><code>string</code><br>$mot_cle le mot cle à associer</dd> |
<dt><var>$echo</var></dt> |
<dd><code>boolean</code><br>$echo faire un echo ou non</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>la chaine d'information sur l'espace mémoire occupé ou bien null si echo<br> |
</div> |
<h4>Since</h4> |
<div class="list"> |
0.3<br> |
</div> |
<h4>Link</h4> |
<div class="list"> |
<a href="http://forum.webmaster-rank.info/developpement-site/code-taille-memoire-d-une-variable-en-php-t1344.html">http://forum.webmaster-rank.info/developpement-site/code-taille-memoire-d-une-variable-en-php-t1344.html</a><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="tailleMemoireScript" id="_tailleMemoireScript"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_tailleMemoireScript">#</a> |
<code><a href="source-class-Debug.html#106-130" title="Go to source code">tailleMemoireScript</a>( <span>string <var>$mot_cle</var> = <span class="php-keyword1">null</span></span>, <span>boolean <var>$echo</var> = <span class="php-keyword1">false</span></span> )</code> |
<div class="description short"> |
<p>Affichage d'informations sur l'espace mémoire occupé par le script PHP</p> |
</div> |
<div class="description detailed hidden"> |
<p>Affichage d'informations sur l'espace mémoire occupé par le script PHP</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$mot_cle</var></dt> |
<dd><code>string</code><br>$mot_cle le mot cle à associer</dd> |
<dt><var>$echo</var></dt> |
<dd><code>boolean</code><br>$echo faire un echo ou non</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>la chaine d'information sur l'espace mémoire occupé ou bien null si echo<br> |
</div> |
<h4>Since</h4> |
<div class="list"> |
0.3<br> |
</div> |
<h4>Link</h4> |
<div class="list"> |
<a href="http://forum.webmaster-rank.info/developpement-site/code-taille-memoire-d-une-variable-en-php-t1344.html">http://forum.webmaster-rank.info/developpement-site/code-taille-memoire-d-une-variable-en-php-t1344.html</a><br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="constants"> |
<caption>Constants summary</caption> |
<tr data-order="MODE_ECHO" id="MODE_ECHO"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Debug.html#19-21" title="Go to source code"><b>MODE_ECHO</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'echo'</span></code></td> |
<td class="description"><div> |
<a href="#MODE_ECHO" class="anchor">#</a> |
<div class="description short"> |
<p>Paramètrer le fichier de config avec "php:Debug::MODE_ECHO" : les messages |
sont affichés en utilisant echo au moment où ils sont déclenchés dans le |
code.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Paramètrer le fichier de config avec "php:Debug::MODE_ECHO" : les messages |
sont affichés en utilisant echo au moment où ils sont déclenchés dans le |
code.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="MODE_NOTICE" id="MODE_NOTICE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Debug.html#23-26" title="Go to source code"><b>MODE_NOTICE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'e_user_notice'</span></code></td> |
<td class="description"><div> |
<a href="#MODE_NOTICE" class="anchor">#</a> |
<div class="description short"> |
<p>Paramètrer le fichier de config avec "php:Debug::MODE_NOTICE" : les message |
sont stockés par le gestionnaire d'exception sous forme d'erreur de type |
E_USER_NOTICE et sont renvoyés sur la sortie standard à la fin de l'execution |
du programme (via echo).</p> |
</div> |
<div class="description detailed hidden"> |
<p>Paramètrer le fichier de config avec "php:Debug::MODE_NOTICE" : les message |
sont stockés par le gestionnaire d'exception sous forme d'erreur de type |
E_USER_NOTICE et sont renvoyés sur la sortie standard à la fin de l'execution |
du programme (via echo).</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="MODE_ENTETE_HTTP" id="MODE_ENTETE_HTTP"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Debug.html#28-32" title="Go to source code"><b>MODE_ENTETE_HTTP</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'entete_http'</span></code></td> |
<td class="description"><div> |
<a href="#MODE_ENTETE_HTTP" class="anchor">#</a> |
<div class="description short"> |
<p>Paramètrer le fichier de config avec "php:Debug::MODE_ENTETE_HTTP" : les |
message sont stockés par le gestionnaire d'exception sous forme d'erreur de |
type E_USER_NOTICE et sont renvoyés dans un entête HTTP |
(X_REST_DEBOGAGE_MESSAGES) à la fin de l'execution du programme. Surtout utile |
pour le Serveur REST.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Paramètrer le fichier de config avec "php:Debug::MODE_ENTETE_HTTP" : les |
message sont stockés par le gestionnaire d'exception sous forme d'erreur de |
type E_USER_NOTICE et sont renvoyés dans un entête HTTP |
(X_REST_DEBOGAGE_MESSAGES) à la fin de l'execution du programme. Surtout utile |
pour le Serveur REST.</p> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr data-order="mode" id="$mode"> |
<td class="attributes"><code> |
protected static |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-Debug.html#34-35" title="Go to source code"><var>$mode</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">null</span></code></td> |
<td class="description"><div> |
<a href="#$mode" class="anchor">#</a> |
<div class="description short"> |
<p>Mode de php (cli ou sapi)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Mode de php (cli ou sapi)</p> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Bdd.html |
---|
New file |
0,0 → 1,580 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Bdd.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li class="active"><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Bdd.html" title="Summary of Bdd"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe Bdd, d'accés au base de données. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * Elle fait office d'abstraction légère de base de données en utilisant diverses possibilités d'accès aux |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * bases de données (PDO, mysql, mysqli, SQLite3). |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * Les valeurs pour le paramètre 'bdd_abstraction' du fichier config.ini sont : pdo, mysql, mysqli, sqlite3 |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * Vous pouvez aussi utiliser : "php:Bdd::ABSTRACTION_PDO","php:Bdd::ABSTRACTION_MYSQL", "php:Bdd::ABSTRACTION_MYSQLI", |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * "php:Bdd::ABSTRACTION_SQLITE3". |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * Elle peut être étendue, pour ajouter le support d'autres bases de données où prendre en compte des méthodes spécifique à |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * un type d'abstraction. |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @category php 5.2 |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @package Framework |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @author Aurélien PERONNET <aurelien@tela-botanica.org> |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
</span></span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
</span></span><span id="20" class="l"><a class="l" href="#20"> 20: </a><span class="php-comment"> * @version $Id: Bdd.php 461 2014-03-05 16:13:16Z jpm $ |
</span></span><span id="21" class="l"><a class="l" href="#21"> 21: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="22" class="l"><a class="l" href="#22"> 22: </a><span class="php-comment"> */</span> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a><span class="php-keyword1">class</span> <a id="Bdd" href="#Bdd">Bdd</a> { |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> <span class="php-comment">/** Constante stockant le squelette du message en cas d'erreur de requête sql. */</span> |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> <span class="php-keyword1">const</span> <a id="ERREUR_REQUETE_TPL" href="#ERREUR_REQUETE_TPL">ERREUR_REQUETE_TPL</a> = <span class="php-quote">'Requête echec.\nFichier : %s.\nLigne : %s.\nMessage : %s.\nRequête : %s'</span>; |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> <span class="php-comment">/** Constante stockant le squelette du message en cas d'erreur de connexion à la base de données. */</span> |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-keyword1">const</span> <a id="ERREUR_CONNEXION_TPL" href="#ERREUR_CONNEXION_TPL">ERREUR_CONNEXION_TPL</a> = <span class="php-quote">'Erreur de connexion à la base de données, vérifiez les paramètres du fichier de configuration.\nMessage : %S.'</span>; |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-comment">/** Constante stockant le squelette du message en cas d'erreur de sélection de la base de données. */</span> |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> <span class="php-keyword1">const</span> <a id="ERREUR_SELECTION_BDD_TPL" href="#ERREUR_SELECTION_BDD_TPL">ERREUR_SELECTION_BDD_TPL</a> = <span class="php-quote">'Erreur de sélection de la base de données, vérifiez les paramètres du fichier de configuration.\nMessage : %S.'</span>; |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> <span class="php-comment">/** Constante stockant le code pour l'abstraction de PDO. */</span> |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> <span class="php-keyword1">const</span> <a id="ABSTRACTION_PDO" href="#ABSTRACTION_PDO">ABSTRACTION_PDO</a> = <span class="php-quote">'pdo'</span>; |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> <span class="php-comment">/** Constante stockant le code pour l'abstraction de mysql. */</span> |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> <span class="php-keyword1">const</span> <a id="ABSTRACTION_MYSQL" href="#ABSTRACTION_MYSQL">ABSTRACTION_MYSQL</a> = <span class="php-quote">'mysql'</span>; |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> <span class="php-comment">/** Constante stockant le code pour l'abstraction de mysqli. */</span> |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> <span class="php-keyword1">const</span> <a id="ABSTRACTION_MYSQLI" href="#ABSTRACTION_MYSQLI">ABSTRACTION_MYSQLI</a> = <span class="php-quote">'mysqli'</span>; |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> <span class="php-comment">/** Constante stockant le code pour l'abstraction de SQLite3. */</span> |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> <span class="php-keyword1">const</span> ABSTRACTION_SQLITE3 = <span class="php-quote">'sqlite3'</span>; |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> <span class="php-comment">/** Constante stockant le code pour le mode tableau associatif des résultats des requêtes. */</span> |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> <span class="php-keyword1">const</span> <a id="MODE_ASSOC" href="#MODE_ASSOC">MODE_ASSOC</a> = <span class="php-quote">'ASSOC'</span>; |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-comment">/** Constante stockant le code pour le mode objet des résultats des requêtes. */</span> |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-keyword1">const</span> <a id="MODE_OBJET" href="#MODE_OBJET">MODE_OBJET</a> = <span class="php-quote">'OBJECT'</span>; |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> <span class="php-comment">/** Mode de fetch associatif */</span> |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$ASSOC" href="#$ASSOC">$ASSOC</a></span> = <span class="php-quote">''</span>; |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-comment">/** Mode de fetch objet */</span> |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$OBJECT" href="#$OBJECT">$OBJECT</a></span> = <span class="php-quote">''</span>; |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> <span class="php-comment">/** abstraction de base de données utilisée */</span> |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$abstraction" href="#$abstraction">$abstraction</a></span>; |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> <span class="php-comment">/** DSN pour accéder à la base de données */</span> |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$dsn" href="#$dsn">$dsn</a></span>; |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> <span class="php-comment">/** Type de base de données (mysql, mysqli, etc ...) */</span> |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$type" href="#$type">$type</a></span>; |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> <span class="php-comment">/** Hote herbergeant la base de données */</span> |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$hote" href="#$hote">$hote</a></span>; |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> <span class="php-comment">/** Nom de la base de données à laquelle le modèle doit se connecter */</span> |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$bdd_nom" href="#$bdd_nom">$bdd_nom</a></span>; |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> <span class="php-comment">/** Nom d'utilisateur */</span> |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$utilisateur" href="#$utilisateur">$utilisateur</a></span>; |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> <span class="php-comment">/** Mot de passe */</span> |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$pass" href="#$pass">$pass</a></span>; |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> <span class="php-comment">/** Encodage de la base de données */</span> |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$encodage" href="#$encodage">$encodage</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> <span class="php-comment">/** Connexion à la base de données */</span> |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$connexion" href="#$connexion">$connexion</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> <span class="php-comment">/** Tableau des noms des paramètres à définir dans le fichier de config car obligatoirement nécessaire à cette classe.*/</span> |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$parametres_obligatoires" href="#$parametres_obligatoires">$parametres_obligatoires</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'bdd_abstraction'</span>, <span class="php-quote">'bdd_protocole'</span>, <span class="php-quote">'bdd_serveur'</span>, <span class="php-quote">'bdd_nom'</span>, |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> <span class="php-quote">'bdd_utilisateur'</span>, <span class="php-quote">'bdd_mot_de_passe'</span>, <span class="php-quote">'bdd_encodage'</span>); |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> <span class="php-comment">/** Constructeur par défaut, appelé à l'initialisation. */</span> |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>() { |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> Config::verifierPresenceParametres(<span class="php-var">$this</span>->parametres_obligatoires); |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-var">$this</span>->abstraction = <span class="php-keyword2">strtolower</span>(Config::get(<span class="php-quote">'bdd_abstraction'</span>)); |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-var">$this</span>->type = Config::get(<span class="php-quote">'bdd_protocole'</span>); |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-var">$this</span>->hote = Config::get(<span class="php-quote">'bdd_serveur'</span>); |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> <span class="php-var">$this</span>->bdd_nom = Config::get(<span class="php-quote">'bdd_nom'</span>); |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> <span class="php-var">$this</span>->utilisateur = Config::get(<span class="php-quote">'bdd_utilisateur'</span>); |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> <span class="php-var">$this</span>->pass = Config::get(<span class="php-quote">'bdd_mot_de_passe'</span>); |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-var">$this</span>->encodage = Config::get(<span class="php-quote">'bdd_encodage'</span>); |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->type == <span class="php-quote">'sqlite'</span> || <span class="php-var">$this</span>->type == <span class="php-quote">'sqlite2'</span>) { |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> <span class="php-var">$this</span>->dsn = <span class="php-var">$this</span>->type.<span class="php-quote">':'</span>.<span class="php-var">$this</span>->hote; |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> } <span class="php-keyword1">else</span> { |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> <span class="php-var">$this</span>->dsn = <span class="php-var">$this</span>->type.<span class="php-quote">':dbname='</span>.<span class="php-var">$this</span>->bdd_nom.<span class="php-quote">';host='</span>.<span class="php-var">$this</span>->hote; |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> } |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-var">$this</span>->initialiserProtocole(); |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> } |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> <span class="php-comment">/** Initialise les constantes de classe à leur bonne valeur et déclenche une erreur si le protocole n'est pas bien défini. */</span> |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_initialiserProtocole" href="#_initialiserProtocole">initialiserProtocole</a>() { |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>->abstraction) { |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_PDO : |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> <span class="php-var">$this</span>->ASSOC = PDO::FETCH_ASSOC; |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-var">$this</span>->OBJECT = PDO::FETCH_OBJ; |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> <span class="php-keyword1">break</span>; |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQL : |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> <span class="php-var">$this</span>->ASSOC = <span class="php-quote">'mysql_fetch_assoc'</span>; |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> <span class="php-var">$this</span>->OBJECT = <span class="php-quote">'mysql_fetch_object'</span>; |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-keyword1">break</span>; |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQLI : |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> <span class="php-var">$this</span>->ASSOC = <span class="php-quote">'fetch_assoc'</span>; |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-var">$this</span>->OBJECT = <span class="php-quote">'fetch_object'</span>; |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> <span class="php-keyword1">break</span>; |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_SQLITE3 : |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> <span class="php-var">$this</span>->ASSOC = <span class="php-quote">'SQLITE3_ASSOC'</span>; |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> <span class="php-var">$this</span>->OBJECT = <span class="php-quote">'SQLITE3_OBJECT'</span>; |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-keyword1">break</span>; |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-keyword1">default</span>: |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-var">$m</span> = <span class="php-quote">"Erreur : l'abstraction '</span><span class="php-var">{$this->abstraction}</span><span class="php-quote">' n'est pas prise en charge"</span>; |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$m</span>, E_USER_WARNING); |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> } |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> } |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> <span class="php-comment">/** |
</span></span><span id="134" class="l"><a class="l" href="#134">134: </a><span class="php-comment"> * Connection à la base de données en utilisant les informations fournies par |
</span></span><span id="135" class="l"><a class="l" href="#135">135: </a><span class="php-comment"> * le fichier de configuration. |
</span></span><span id="136" class="l"><a class="l" href="#136">136: </a><span class="php-comment"> * Cette méthode est private et final car elle n'a pas vocation a être appelée par l'utilisateur. |
</span></span><span id="137" class="l"><a class="l" href="#137">137: </a><span class="php-comment"> * TODO : il est peut être nécessaire pour MYSQL, MYSQLi et SQLITE3 afin d'éviter les boucles infinis |
</span></span><span id="138" class="l"><a class="l" href="#138">138: </a><span class="php-comment"> * d'erreur quand la bdd n'est pas configuré d'utiliser : $this->connexion->query (comme pour PDO) |
</span></span><span id="139" class="l"><a class="l" href="#139">139: </a><span class="php-comment"> */</span> |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_connecter" href="#_connecter">connecter</a>() { |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->connexion == <span class="php-keyword1">null</span>) { |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>->abstraction) { |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_PDO : |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-keyword1">try</span> { |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> <span class="php-var">$this</span>->connexion = <span class="php-keyword1">new</span> PDO(<span class="php-var">$this</span>->dsn, <span class="php-var">$this</span>->utilisateur, <span class="php-var">$this</span>->pass); |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> <span class="php-var">$this</span>->connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> } <span class="php-keyword1">catch</span> (PDOException <span class="php-var">$e</span>) { |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> <span class="php-var">$e</span> = <span class="php-keyword2">sprintf</span>(self::ERREUR_CONNEXION_TPL, <span class="php-var">$e</span>->getMessage()); |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_WARNING); |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> } |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->encodage != <span class="php-keyword1">null</span> && <span class="php-var">$this</span>->type == <span class="php-quote">'mysql'</span>) { |
</span><span id="152" class="l"><a class="l" href="#152">152: </a> <span class="php-var">$this</span>->connexion->query(<span class="php-quote">"SET names '"</span>.<span class="php-var">$this</span>->encodage.<span class="php-quote">"'"</span>); |
</span><span id="153" class="l"><a class="l" href="#153">153: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->type == <span class="php-quote">'sqlite'</span>) { |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> <span class="php-var">$this</span>->connexion->query(<span class="php-quote">"PRAGMA case_sensitive_like = false"</span>); |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> } |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> <span class="php-keyword1">break</span>; |
</span><span id="157" class="l"><a class="l" href="#157">157: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQL : |
</span><span id="158" class="l"><a class="l" href="#158">158: </a> <span class="php-var">$this</span>->connexion = <span class="php-keyword2">mysql_connect</span>(<span class="php-var">$this</span>->hote, <span class="php-var">$this</span>->utilisateur, <span class="php-var">$this</span>->pass); |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->connexion !== <span class="php-keyword1">false</span>) { |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> <span class="php-var">$selection</span> = <span class="php-keyword2">mysql_select_db</span>(<span class="php-var">$this</span>->bdd_nom, <span class="php-var">$this</span>->connexion); |
</span><span id="161" class="l"><a class="l" href="#161">161: </a> <span class="php-keyword1">if</span> (<span class="php-var">$selection</span> === <span class="php-keyword1">false</span>) { |
</span><span id="162" class="l"><a class="l" href="#162">162: </a> <span class="php-var">$e</span> = <span class="php-keyword2">sprintf</span>(self::ERREUR_SELECTION_BDD_TPL, <span class="php-keyword2">mysql_error</span>()); |
</span><span id="163" class="l"><a class="l" href="#163">163: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_WARNING); |
</span><span id="164" class="l"><a class="l" href="#164">164: </a> } |
</span><span id="165" class="l"><a class="l" href="#165">165: </a> } <span class="php-keyword1">else</span> { |
</span><span id="166" class="l"><a class="l" href="#166">166: </a> <span class="php-var">$e</span> = <span class="php-keyword2">sprintf</span>(self::ERREUR_CONNEXION_TPL, <span class="php-keyword2">mysql_error</span>()); |
</span><span id="167" class="l"><a class="l" href="#167">167: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_WARNING); |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> } |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->encodage != <span class="php-keyword1">null</span>) { |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">"SET names '"</span>.<span class="php-var">$this</span>->encodage.<span class="php-quote">"'"</span>); |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> } |
</span><span id="172" class="l"><a class="l" href="#172">172: </a> <span class="php-keyword1">break</span>; |
</span><span id="173" class="l"><a class="l" href="#173">173: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQLI : |
</span><span id="174" class="l"><a class="l" href="#174">174: </a> <span class="php-var">$this</span>->connexion = @<span class="php-keyword1">new</span> mysqli(<span class="php-var">$this</span>->hote, <span class="php-var">$this</span>->utilisateur, <span class="php-var">$this</span>->pass, <span class="php-var">$this</span>->bdd_nom); |
</span><span id="175" class="l"><a class="l" href="#175">175: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->connexion->connect_errno) { |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> <span class="php-var">$e</span> = <span class="php-keyword2">sprintf</span>(self::ERREUR_CONNEXION_TPL, <span class="php-var">$this</span>->connexion->connect_error); |
</span><span id="177" class="l"><a class="l" href="#177">177: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_WARNING); |
</span><span id="178" class="l"><a class="l" href="#178">178: </a> } |
</span><span id="179" class="l"><a class="l" href="#179">179: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->encodage != <span class="php-keyword1">null</span>) { |
</span><span id="180" class="l"><a class="l" href="#180">180: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">"SET names '"</span>.<span class="php-var">$this</span>->encodage.<span class="php-quote">"'"</span>); |
</span><span id="181" class="l"><a class="l" href="#181">181: </a> } |
</span><span id="182" class="l"><a class="l" href="#182">182: </a> <span class="php-keyword1">break</span>; |
</span><span id="183" class="l"><a class="l" href="#183">183: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_SQLITE3 : |
</span><span id="184" class="l"><a class="l" href="#184">184: </a> <span class="php-comment">// cas particulier de sqllite, on considère que le nom de la base de données correspond au fichier à ouvrir</span> |
</span><span id="185" class="l"><a class="l" href="#185">185: </a> <span class="php-var">$this</span>->connexion = <span class="php-keyword1">new</span> SQLite3(<span class="php-var">$this</span>->bdd_nom); |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>->connexion) { |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> <span class="php-var">$e</span> = <span class="php-keyword2">sprintf</span>(self::ERREUR_CONNEXION_TPL, <span class="php-quote">''</span>); |
</span><span id="188" class="l"><a class="l" href="#188">188: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_WARNING); |
</span><span id="189" class="l"><a class="l" href="#189">189: </a> } |
</span><span id="190" class="l"><a class="l" href="#190">190: </a> <span class="php-var">$this</span>->requeter(<span class="php-quote">"PRAGMA case_sensitive_like = false"</span>); |
</span><span id="191" class="l"><a class="l" href="#191">191: </a> <span class="php-keyword1">break</span>; |
</span><span id="192" class="l"><a class="l" href="#192">192: </a> <span class="php-keyword1">default</span>: |
</span><span id="193" class="l"><a class="l" href="#193">193: </a> <span class="php-var">$this</span>->connexion = <span class="php-keyword1">null</span>; |
</span><span id="194" class="l"><a class="l" href="#194">194: </a> } |
</span><span id="195" class="l"><a class="l" href="#195">195: </a> |
</span><span id="196" class="l"><a class="l" href="#196">196: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->encodage != <span class="php-keyword1">null</span>) { |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> <span class="php-var">$this</span>->requete(<span class="php-quote">"SET names '"</span>.<span class="php-var">$this</span>->encodage.<span class="php-quote">"'"</span>); |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> } |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> } |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> } |
</span><span id="201" class="l"><a class="l" href="#201">201: </a> |
</span><span id="202" class="l"><a class="l" href="#202">202: </a> <span class="php-comment">/** |
</span></span><span id="203" class="l"><a class="l" href="#203">203: </a><span class="php-comment"> * @deprecated changement de nom. Disparaîtra dans la version 0.4. Utiliser à la place : @see requeter |
</span></span><span id="204" class="l"><a class="l" href="#204">204: </a><span class="php-comment"> */</span> |
</span><span id="205" class="l"><a class="l" href="#205">205: </a> <span class="php-keyword1">final</span> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_requete" href="#_requete">requete</a>(<span class="php-var">$requete</span>) { |
</span><span id="206" class="l"><a class="l" href="#206">206: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->requeter(<span class="php-var">$requete</span>); |
</span><span id="207" class="l"><a class="l" href="#207">207: </a> } |
</span><span id="208" class="l"><a class="l" href="#208">208: </a> |
</span><span id="209" class="l"><a class="l" href="#209">209: </a> <span class="php-comment">/** |
</span></span><span id="210" class="l"><a class="l" href="#210">210: </a><span class="php-comment"> * Execute une requête et retourne le résultat tel que renvoyé par l'abstraction courante. |
</span></span><span id="211" class="l"><a class="l" href="#211">211: </a><span class="php-comment"> * |
</span></span><span id="212" class="l"><a class="l" href="#212">212: </a><span class="php-comment"> * @param string la requête à effectuer |
</span></span><span id="213" class="l"><a class="l" href="#213">213: </a><span class="php-comment"> * @return mixed un objet contenant le résultat de la requête |
</span></span><span id="214" class="l"><a class="l" href="#214">214: </a><span class="php-comment"> */</span> |
</span><span id="215" class="l"><a class="l" href="#215">215: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_requeter" href="#_requeter">requeter</a>(<span class="php-var">$requete</span>) { |
</span><span id="216" class="l"><a class="l" href="#216">216: </a> <span class="php-var">$this</span>->connecter(); |
</span><span id="217" class="l"><a class="l" href="#217">217: </a> |
</span><span id="218" class="l"><a class="l" href="#218">218: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">null</span>; |
</span><span id="219" class="l"><a class="l" href="#219">219: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>->abstraction) { |
</span><span id="220" class="l"><a class="l" href="#220">220: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_PDO : |
</span><span id="221" class="l"><a class="l" href="#221">221: </a> <span class="php-keyword1">try</span> { |
</span><span id="222" class="l"><a class="l" href="#222">222: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->connexion->query(<span class="php-var">$requete</span>); |
</span><span id="223" class="l"><a class="l" href="#223">223: </a> } <span class="php-keyword1">catch</span> (PDOException <span class="php-var">$e</span>) { |
</span><span id="224" class="l"><a class="l" href="#224">224: </a> <span class="php-var">$m</span> = <span class="php-keyword2">sprintf</span>(self::ERREUR_REQUETE_TPL, <span class="php-var">$e</span>->getFile(), <span class="php-var">$e</span>->getLine(), <span class="php-var">$e</span>->getMessage(), <span class="php-var">$requete</span>); |
</span><span id="225" class="l"><a class="l" href="#225">225: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$m</span>, E_USER_WARNING); |
</span><span id="226" class="l"><a class="l" href="#226">226: </a> } |
</span><span id="227" class="l"><a class="l" href="#227">227: </a> <span class="php-keyword1">break</span>; |
</span><span id="228" class="l"><a class="l" href="#228">228: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQL : |
</span><span id="229" class="l"><a class="l" href="#229">229: </a> <span class="php-var">$retour</span> = <span class="php-keyword2">mysql_query</span>(<span class="php-var">$requete</span>, <span class="php-var">$this</span>->connexion); |
</span><span id="230" class="l"><a class="l" href="#230">230: </a> <span class="php-keyword1">break</span>; |
</span><span id="231" class="l"><a class="l" href="#231">231: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQLI : |
</span><span id="232" class="l"><a class="l" href="#232">232: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->connexion->query(<span class="php-var">$requete</span>); |
</span><span id="233" class="l"><a class="l" href="#233">233: </a> <span class="php-keyword1">break</span>; |
</span><span id="234" class="l"><a class="l" href="#234">234: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_SQLITE3 : |
</span><span id="235" class="l"><a class="l" href="#235">235: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->connexion-><span class="php-keyword2">exec</span>(<span class="php-var">$requete</span>); |
</span><span id="236" class="l"><a class="l" href="#236">236: </a> <span class="php-keyword1">break</span>; |
</span><span id="237" class="l"><a class="l" href="#237">237: </a> } |
</span><span id="238" class="l"><a class="l" href="#238">238: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="239" class="l"><a class="l" href="#239">239: </a> } |
</span><span id="240" class="l"><a class="l" href="#240">240: </a> |
</span><span id="241" class="l"><a class="l" href="#241">241: </a> <span class="php-comment">/** |
</span></span><span id="242" class="l"><a class="l" href="#242">242: </a><span class="php-comment"> * @deprecated changement de nom. Disparaîtra dans la version 0.4. Utiliser à la place : @see recuperer |
</span></span><span id="243" class="l"><a class="l" href="#243">243: </a><span class="php-comment"> */</span> |
</span><span id="244" class="l"><a class="l" href="#244">244: </a> <span class="php-keyword1">final</span> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_requeteUn" href="#_requeteUn">requeteUn</a>(<span class="php-var">$requete</span>, <span class="php-var">$mode</span> = self::MODE_ASSOC) { |
</span><span id="245" class="l"><a class="l" href="#245">245: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->recuperer(<span class="php-var">$requete</span>, <span class="php-var">$mode</span>); |
</span><span id="246" class="l"><a class="l" href="#246">246: </a> } |
</span><span id="247" class="l"><a class="l" href="#247">247: </a> |
</span><span id="248" class="l"><a class="l" href="#248">248: </a> <span class="php-comment">/** |
</span></span><span id="249" class="l"><a class="l" href="#249">249: </a><span class="php-comment"> * Execute une requête et retourne le premier résultat sous forme de tableau (par défaut) ou d'objet. |
</span></span><span id="250" class="l"><a class="l" href="#250">250: </a><span class="php-comment"> * Les noms des champs de la base de données correspondent aux noms des clés du tableau ou aux noms des attributs de l'objet. |
</span></span><span id="251" class="l"><a class="l" href="#251">251: </a><span class="php-comment"> * |
</span></span><span id="252" class="l"><a class="l" href="#252">252: </a><span class="php-comment"> * @param string la requête à effectuer |
</span></span><span id="253" class="l"><a class="l" href="#253">253: </a><span class="php-comment"> * @param string le mode de retour ASSOC (Bdd::MODE_ASSOC) pour un tableau ou OBJECT (Bdd::MODE_OBJET) pour un objet. |
</span></span><span id="254" class="l"><a class="l" href="#254">254: </a><span class="php-comment"> * @return mixed un objet ou un tableau contenant le résultat de la requête |
</span></span><span id="255" class="l"><a class="l" href="#255">255: </a><span class="php-comment"> */</span> |
</span><span id="256" class="l"><a class="l" href="#256">256: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_recuperer" href="#_recuperer">recuperer</a>(<span class="php-var">$requete</span>, <span class="php-var">$mode</span> = self::MODE_ASSOC) { |
</span><span id="257" class="l"><a class="l" href="#257">257: </a> <span class="php-var">$this</span>->connecter(); |
</span><span id="258" class="l"><a class="l" href="#258">258: </a> |
</span><span id="259" class="l"><a class="l" href="#259">259: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">null</span>; |
</span><span id="260" class="l"><a class="l" href="#260">260: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>->abstraction) { |
</span><span id="261" class="l"><a class="l" href="#261">261: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_PDO : |
</span><span id="262" class="l"><a class="l" href="#262">262: </a> <span class="php-keyword1">try</span> { |
</span><span id="263" class="l"><a class="l" href="#263">263: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->connexion->query(<span class="php-var">$requete</span>); |
</span><span id="264" class="l"><a class="l" href="#264">264: </a> <span class="php-var">$retour</span> = (<span class="php-var">$resultat</span> !== <span class="php-keyword1">false</span>) ? <span class="php-var">$resultat</span>->fetch(<span class="php-var">$this</span>-><span class="php-var">$mode</span>) : <span class="php-var">$resultat</span>; |
</span><span id="265" class="l"><a class="l" href="#265">265: </a> } <span class="php-keyword1">catch</span> (PDOException <span class="php-var">$e</span>) { |
</span><span id="266" class="l"><a class="l" href="#266">266: </a> <span class="php-var">$m</span> = <span class="php-keyword2">sprintf</span>(self::ERREUR_REQUETE_TPL, <span class="php-var">$e</span>->getFile(), <span class="php-var">$e</span>->getLine(), <span class="php-var">$e</span>->getMessage(), <span class="php-var">$requete</span>); |
</span><span id="267" class="l"><a class="l" href="#267">267: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$m</span>, E_USER_WARNING); |
</span><span id="268" class="l"><a class="l" href="#268">268: </a> } |
</span><span id="269" class="l"><a class="l" href="#269">269: </a> <span class="php-keyword1">break</span>; |
</span><span id="270" class="l"><a class="l" href="#270">270: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQL : |
</span><span id="271" class="l"><a class="l" href="#271">271: </a> <span class="php-var">$res</span> = <span class="php-keyword2">mysql_query</span>(<span class="php-var">$requete</span>, <span class="php-var">$this</span>->connexion); |
</span><span id="272" class="l"><a class="l" href="#272">272: </a> <span class="php-var">$fonction_fetch</span> = <span class="php-var">$this</span>-><span class="php-var">$mode</span>; |
</span><span id="273" class="l"><a class="l" href="#273">273: </a> <span class="php-var">$retour</span> = <span class="php-var">$fonction_fetch</span>(<span class="php-var">$res</span>); |
</span><span id="274" class="l"><a class="l" href="#274">274: </a> <span class="php-keyword1">break</span>; |
</span><span id="275" class="l"><a class="l" href="#275">275: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQLI : |
</span><span id="276" class="l"><a class="l" href="#276">276: </a> <span class="php-var">$res</span> = <span class="php-var">$this</span>->connexion->query(<span class="php-var">$requete</span>); |
</span><span id="277" class="l"><a class="l" href="#277">277: </a> <span class="php-var">$fonction_fetch</span> = <span class="php-var">$this</span>-><span class="php-var">$mode</span>; |
</span><span id="278" class="l"><a class="l" href="#278">278: </a> <span class="php-var">$retour</span> = <span class="php-var">$res</span>-><span class="php-var">$fonction_fetch</span>(); |
</span><span id="279" class="l"><a class="l" href="#279">279: </a> <span class="php-keyword1">break</span>; |
</span><span id="280" class="l"><a class="l" href="#280">280: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_SQLITE3 : |
</span><span id="281" class="l"><a class="l" href="#281">281: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->connexion->querySingle(<span class="php-var">$requete</span>); |
</span><span id="282" class="l"><a class="l" href="#282">282: </a> <span class="php-keyword1">break</span>; |
</span><span id="283" class="l"><a class="l" href="#283">283: </a> } |
</span><span id="284" class="l"><a class="l" href="#284">284: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="285" class="l"><a class="l" href="#285">285: </a> } |
</span><span id="286" class="l"><a class="l" href="#286">286: </a> |
</span><span id="287" class="l"><a class="l" href="#287">287: </a> <span class="php-comment">/** |
</span></span><span id="288" class="l"><a class="l" href="#288">288: </a><span class="php-comment"> * @deprecated changement de nom. Disparaîtra dans la version 0.4. Utiliser à la place : @see recupererTous |
</span></span><span id="289" class="l"><a class="l" href="#289">289: </a><span class="php-comment"> */</span> |
</span><span id="290" class="l"><a class="l" href="#290">290: </a> <span class="php-keyword1">final</span> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_requeteTous" href="#_requeteTous">requeteTous</a>(<span class="php-var">$requete</span>, <span class="php-var">$mode</span> = self::MODE_ASSOC) { |
</span><span id="291" class="l"><a class="l" href="#291">291: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->recupererTous(<span class="php-var">$requete</span>, <span class="php-var">$mode</span>); |
</span><span id="292" class="l"><a class="l" href="#292">292: </a> } |
</span><span id="293" class="l"><a class="l" href="#293">293: </a> |
</span><span id="294" class="l"><a class="l" href="#294">294: </a> <span class="php-comment">/** |
</span></span><span id="295" class="l"><a class="l" href="#295">295: </a><span class="php-comment"> * Execute une requête et retourne un tableau de résultats. Un résultat peut être présentés sous forme |
</span></span><span id="296" class="l"><a class="l" href="#296">296: </a><span class="php-comment"> * de tableau (par défaut) ou d'objet. |
</span></span><span id="297" class="l"><a class="l" href="#297">297: </a><span class="php-comment"> * Les noms des champs de la base de données correspondent aux noms des clés du tableau résultat ou |
</span></span><span id="298" class="l"><a class="l" href="#298">298: </a><span class="php-comment"> * aux noms des attributs de l'objet résultat. |
</span></span><span id="299" class="l"><a class="l" href="#299">299: </a><span class="php-comment"> * |
</span></span><span id="300" class="l"><a class="l" href="#300">300: </a><span class="php-comment"> * @param string la requête à effectuer |
</span></span><span id="301" class="l"><a class="l" href="#301">301: </a><span class="php-comment"> * @param string le mode de retour des résultats : ASSOC (Bdd::MODE_ASSOC) pour un tableau ou OBJECT (Bdd::MODE_OBJET) pour un objet. |
</span></span><span id="302" class="l"><a class="l" href="#302">302: </a><span class="php-comment"> * @return array un tableau contenant les résultats sous forme d'objets ou de tableau (par défaut). |
</span></span><span id="303" class="l"><a class="l" href="#303">303: </a><span class="php-comment"> */</span> |
</span><span id="304" class="l"><a class="l" href="#304">304: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_recupererTous" href="#_recupererTous">recupererTous</a>(<span class="php-var">$requete</span>, <span class="php-var">$mode</span> = self::MODE_ASSOC) { |
</span><span id="305" class="l"><a class="l" href="#305">305: </a> <span class="php-var">$this</span>->connecter(); |
</span><span id="306" class="l"><a class="l" href="#306">306: </a> |
</span><span id="307" class="l"><a class="l" href="#307">307: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">null</span>; |
</span><span id="308" class="l"><a class="l" href="#308">308: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>->abstraction) { |
</span><span id="309" class="l"><a class="l" href="#309">309: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_PDO : |
</span><span id="310" class="l"><a class="l" href="#310">310: </a> <span class="php-keyword1">try</span> { |
</span><span id="311" class="l"><a class="l" href="#311">311: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->connexion->query(<span class="php-var">$requete</span>); |
</span><span id="312" class="l"><a class="l" href="#312">312: </a> <span class="php-var">$retour</span> = (<span class="php-var">$resultat</span> !== <span class="php-keyword1">false</span>) ? <span class="php-var">$resultat</span>->fetchAll(<span class="php-var">$this</span>-><span class="php-var">$mode</span>) : <span class="php-var">$resultat</span>; |
</span><span id="313" class="l"><a class="l" href="#313">313: </a> } <span class="php-keyword1">catch</span> (PDOException <span class="php-var">$e</span>) { |
</span><span id="314" class="l"><a class="l" href="#314">314: </a> <span class="php-var">$m</span> = <span class="php-keyword2">sprintf</span>(self::ERREUR_REQUETE_TPL, <span class="php-var">$e</span>->getFile(), <span class="php-var">$e</span>->getLine(), <span class="php-var">$e</span>->getMessage(), <span class="php-var">$requete</span>); |
</span><span id="315" class="l"><a class="l" href="#315">315: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$m</span>, E_USER_WARNING); |
</span><span id="316" class="l"><a class="l" href="#316">316: </a> } |
</span><span id="317" class="l"><a class="l" href="#317">317: </a> <span class="php-keyword1">break</span>; |
</span><span id="318" class="l"><a class="l" href="#318">318: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQL : |
</span><span id="319" class="l"><a class="l" href="#319">319: </a> <span class="php-var">$resultat</span> = <span class="php-keyword2">mysql_query</span>(<span class="php-var">$requete</span>, <span class="php-var">$this</span>->connexion); |
</span><span id="320" class="l"><a class="l" href="#320">320: </a> <span class="php-var">$fonction_fetch</span> = <span class="php-var">$this</span>-><span class="php-var">$mode</span>; |
</span><span id="321" class="l"><a class="l" href="#321">321: </a> <span class="php-keyword1">while</span> (<span class="php-var">$ligne</span> = <span class="php-var">$fonction_fetch</span>(<span class="php-var">$resultat</span>)) { |
</span><span id="322" class="l"><a class="l" href="#322">322: </a> <span class="php-var">$retour</span>[] = <span class="php-var">$ligne</span>; |
</span><span id="323" class="l"><a class="l" href="#323">323: </a> } |
</span><span id="324" class="l"><a class="l" href="#324">324: </a> <span class="php-keyword1">break</span>; |
</span><span id="325" class="l"><a class="l" href="#325">325: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQLI : |
</span><span id="326" class="l"><a class="l" href="#326">326: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->connexion->query(<span class="php-var">$requete</span>); |
</span><span id="327" class="l"><a class="l" href="#327">327: </a> <span class="php-var">$function_fetch</span> = <span class="php-var">$this</span>-><span class="php-var">$mode</span>; |
</span><span id="328" class="l"><a class="l" href="#328">328: </a> <span class="php-keyword1">while</span> (<span class="php-var">$ligne</span> = <span class="php-var">$resultat</span>-><span class="php-var">$function_fetch</span>()) { |
</span><span id="329" class="l"><a class="l" href="#329">329: </a> <span class="php-var">$retour</span>[] = <span class="php-var">$ligne</span>; |
</span><span id="330" class="l"><a class="l" href="#330">330: </a> } |
</span><span id="331" class="l"><a class="l" href="#331">331: </a> <span class="php-keyword1">break</span>; |
</span><span id="332" class="l"><a class="l" href="#332">332: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_SQLITE3 : |
</span><span id="333" class="l"><a class="l" href="#333">333: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->connexion->query(<span class="php-var">$requete</span>); |
</span><span id="334" class="l"><a class="l" href="#334">334: </a> <span class="php-keyword1">while</span> (<span class="php-var">$ligne</span> = <span class="php-var">$resultat</span>->fetch_array(<span class="php-var">$this</span>->ASSOC)) { |
</span><span id="335" class="l"><a class="l" href="#335">335: </a> <span class="php-keyword1">if</span> (<span class="php-var">$mode</span> == self::MODE_OBJET) { |
</span><span id="336" class="l"><a class="l" href="#336">336: </a> <span class="php-comment">// Cas particulier de sqllite qui n'a pas de fonction fetch_object</span> |
</span><span id="337" class="l"><a class="l" href="#337">337: </a> <span class="php-var">$ligneObjet</span> = <span class="php-keyword1">new</span> stdClass(); |
</span><span id="338" class="l"><a class="l" href="#338">338: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$ligne</span> <span class="php-keyword1">as</span> <span class="php-var">$colonne</span> => <span class="php-var">$valeur</span>) { |
</span><span id="339" class="l"><a class="l" href="#339">339: </a> <span class="php-var">$ligneObjet</span>-><span class="php-var">$colonne</span> = <span class="php-var">$valeur</span>; |
</span><span id="340" class="l"><a class="l" href="#340">340: </a> } |
</span><span id="341" class="l"><a class="l" href="#341">341: </a> <span class="php-var">$ligne</span> = <span class="php-var">$ligneObjet</span>; |
</span><span id="342" class="l"><a class="l" href="#342">342: </a> } |
</span><span id="343" class="l"><a class="l" href="#343">343: </a> <span class="php-var">$retour</span>[] = <span class="php-var">$ligne</span>; |
</span><span id="344" class="l"><a class="l" href="#344">344: </a> } |
</span><span id="345" class="l"><a class="l" href="#345">345: </a> <span class="php-keyword1">break</span>; |
</span><span id="346" class="l"><a class="l" href="#346">346: </a> } |
</span><span id="347" class="l"><a class="l" href="#347">347: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="348" class="l"><a class="l" href="#348">348: </a> } |
</span><span id="349" class="l"><a class="l" href="#349">349: </a> |
</span><span id="350" class="l"><a class="l" href="#350">350: </a> <span class="php-comment">/** |
</span></span><span id="351" class="l"><a class="l" href="#351">351: </a><span class="php-comment"> * Protège une chaine de caractères ou le contenu d'un tablea avant l'insertion dans la base de données |
</span></span><span id="352" class="l"><a class="l" href="#352">352: </a><span class="php-comment"> * (ajout de quotes ou guillemets). |
</span></span><span id="353" class="l"><a class="l" href="#353">353: </a><span class="php-comment"> * @param Mixed une chaine ou un tableau à protéger |
</span></span><span id="354" class="l"><a class="l" href="#354">354: </a><span class="php-comment"> * @return mixed la chaine ou le tableau à protégé |
</span></span><span id="355" class="l"><a class="l" href="#355">355: </a><span class="php-comment"> */</span> |
</span><span id="356" class="l"><a class="l" href="#356">356: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_proteger" href="#_proteger">proteger</a>(<span class="php-var">$donnees</span>) { |
</span><span id="357" class="l"><a class="l" href="#357">357: </a> <span class="php-var">$this</span>->connecter(); |
</span><span id="358" class="l"><a class="l" href="#358">358: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$donnees</span>)) { |
</span><span id="359" class="l"><a class="l" href="#359">359: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->protegerTableau(<span class="php-var">$donnees</span>); |
</span><span id="360" class="l"><a class="l" href="#360">360: </a> } <span class="php-keyword1">else</span> { |
</span><span id="361" class="l"><a class="l" href="#361">361: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->protegerChaine(<span class="php-var">$donnees</span>); |
</span><span id="362" class="l"><a class="l" href="#362">362: </a> } |
</span><span id="363" class="l"><a class="l" href="#363">363: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="364" class="l"><a class="l" href="#364">364: </a> } |
</span><span id="365" class="l"><a class="l" href="#365">365: </a> |
</span><span id="366" class="l"><a class="l" href="#366">366: </a> <span class="php-comment">/** |
</span></span><span id="367" class="l"><a class="l" href="#367">367: </a><span class="php-comment"> * Protège une chaine de caractères avant l'insertion dans la base de données (ajout de quotes ou guillemets). |
</span></span><span id="368" class="l"><a class="l" href="#368">368: </a><span class="php-comment"> * @param string la chaine à protéger |
</span></span><span id="369" class="l"><a class="l" href="#369">369: </a><span class="php-comment"> * @return string la chaine protégée |
</span></span><span id="370" class="l"><a class="l" href="#370">370: </a><span class="php-comment"> */</span> |
</span><span id="371" class="l"><a class="l" href="#371">371: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_protegerChaine" href="#_protegerChaine">protegerChaine</a>(<span class="php-var">$chaine</span>) { |
</span><span id="372" class="l"><a class="l" href="#372">372: </a> <span class="php-var">$retour</span> = <span class="php-var">$chaine</span>; |
</span><span id="373" class="l"><a class="l" href="#373">373: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>->abstraction) { |
</span><span id="374" class="l"><a class="l" href="#374">374: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_PDO : |
</span><span id="375" class="l"><a class="l" href="#375">375: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->connexion->quote(<span class="php-var">$chaine</span>); |
</span><span id="376" class="l"><a class="l" href="#376">376: </a> <span class="php-keyword1">break</span>; |
</span><span id="377" class="l"><a class="l" href="#377">377: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQL : |
</span><span id="378" class="l"><a class="l" href="#378">378: </a> <span class="php-var">$retour</span> = <span class="php-quote">'"'</span>.<span class="php-keyword2">mysql_real_escape_string</span>(<span class="php-var">$chaine</span>, <span class="php-var">$this</span>->connexion).<span class="php-quote">'"'</span>; |
</span><span id="379" class="l"><a class="l" href="#379">379: </a> <span class="php-keyword1">break</span>; |
</span><span id="380" class="l"><a class="l" href="#380">380: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQLI : |
</span><span id="381" class="l"><a class="l" href="#381">381: </a> <span class="php-var">$retour</span> = <span class="php-quote">'"'</span>.<span class="php-var">$this</span>->connexion->real_escape_string(<span class="php-var">$chaine</span>).<span class="php-quote">'"'</span>; |
</span><span id="382" class="l"><a class="l" href="#382">382: </a> <span class="php-keyword1">break</span>; |
</span><span id="383" class="l"><a class="l" href="#383">383: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_SQLITE3 : |
</span><span id="384" class="l"><a class="l" href="#384">384: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->connexion->escapeString(<span class="php-var">$chaine</span>); |
</span><span id="385" class="l"><a class="l" href="#385">385: </a> <span class="php-keyword1">break</span>; |
</span><span id="386" class="l"><a class="l" href="#386">386: </a> } |
</span><span id="387" class="l"><a class="l" href="#387">387: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="388" class="l"><a class="l" href="#388">388: </a> } |
</span><span id="389" class="l"><a class="l" href="#389">389: </a> |
</span><span id="390" class="l"><a class="l" href="#390">390: </a> <span class="php-comment">/** |
</span></span><span id="391" class="l"><a class="l" href="#391">391: </a><span class="php-comment"> * @deprecated changement de nom. Deviendra "private" dans la version 0.5. Utiliser à la place : @see proteger |
</span></span><span id="392" class="l"><a class="l" href="#392">392: </a><span class="php-comment"> */</span> |
</span><span id="393" class="l"><a class="l" href="#393">393: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_protegerTableau" href="#_protegerTableau">protegerTableau</a>(<span class="php-keyword1">Array</span> <span class="php-var">$tableau</span>) { |
</span><span id="394" class="l"><a class="l" href="#394">394: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tableau</span> <span class="php-keyword1">as</span> <span class="php-var">$id</span> => <span class="php-var">$val</span>) { |
</span><span id="395" class="l"><a class="l" href="#395">395: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$val</span>)) { |
</span><span id="396" class="l"><a class="l" href="#396">396: </a> <span class="php-var">$tableau</span>[<span class="php-var">$id</span>] = <span class="php-var">$this</span>->protegerTableau(<span class="php-var">$val</span>); |
</span><span id="397" class="l"><a class="l" href="#397">397: </a> } <span class="php-keyword1">else</span> { |
</span><span id="398" class="l"><a class="l" href="#398">398: </a> <span class="php-var">$tableau</span>[<span class="php-var">$id</span>] = <span class="php-var">$this</span>->protegerChaine(<span class="php-var">$val</span>); |
</span><span id="399" class="l"><a class="l" href="#399">399: </a> } |
</span><span id="400" class="l"><a class="l" href="#400">400: </a> } |
</span><span id="401" class="l"><a class="l" href="#401">401: </a> <span class="php-keyword1">return</span> <span class="php-var">$tableau</span>; |
</span><span id="402" class="l"><a class="l" href="#402">402: </a> } |
</span><span id="403" class="l"><a class="l" href="#403">403: </a> |
</span><span id="404" class="l"><a class="l" href="#404">404: </a> <span class="php-comment">/** |
</span></span><span id="405" class="l"><a class="l" href="#405">405: </a><span class="php-comment"> * Retourne l'identifiant de la dernière ligne insérée, ou la dernière valeur d'une séquence d'objets, dépendamment, dans |
</span></span><span id="406" class="l"><a class="l" href="#406">406: </a><span class="php-comment"> * le cas de PDO, du driver utilisé. Les méthodes utilisées pour retourner l'identifiant peuvent avoir des comportements |
</span></span><span id="407" class="l"><a class="l" href="#407">407: </a><span class="php-comment"> * différent. Consulter la documentation PHP correspondant à l'abstraction choisie avant de l'utiliser : |
</span></span><span id="408" class="l"><a class="l" href="#408">408: </a><span class="php-comment"> * @link(http://fr.php.net/manual/fr/pdo.lastinsertid.php, PDO::lastInsertId([ string $name = NULL ])) |
</span></span><span id="409" class="l"><a class="l" href="#409">409: </a><span class="php-comment"> * @link(http://php.net/manual/en/mysqli.insert-id.php, mysqli->insert_id()) |
</span></span><span id="410" class="l"><a class="l" href="#410">410: </a><span class="php-comment"> * @link(http://fr.php.net/manual/fr/function.mysql-insert-id.php, mysql_insert_id()) |
</span></span><span id="411" class="l"><a class="l" href="#411">411: </a><span class="php-comment"> * @link(http://fr.php.net/manual/fr/sqlite3.lastinsertrowid.php, SQLite3::lastInsertRowID()) |
</span></span><span id="412" class="l"><a class="l" href="#412">412: </a><span class="php-comment"> * @param mixed un paramètre éventuel à transmettre (en fonction de l'abstraction de BDD utilisée). |
</span></span><span id="413" class="l"><a class="l" href="#413">413: </a><span class="php-comment"> * @return mixed le dernier identifiant de clé primaire ajouté dans la base de données (string ou int). |
</span></span><span id="414" class="l"><a class="l" href="#414">414: </a><span class="php-comment"> */</span> |
</span><span id="415" class="l"><a class="l" href="#415">415: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_recupererIdDernierAjout" href="#_recupererIdDernierAjout">recupererIdDernierAjout</a>(<span class="php-var">$parametres</span> = <span class="php-keyword1">null</span>) { |
</span><span id="416" class="l"><a class="l" href="#416">416: </a> <span class="php-var">$this</span>->connecter(); |
</span><span id="417" class="l"><a class="l" href="#417">417: </a> |
</span><span id="418" class="l"><a class="l" href="#418">418: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">null</span>; |
</span><span id="419" class="l"><a class="l" href="#419">419: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>->abstraction) { |
</span><span id="420" class="l"><a class="l" href="#420">420: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_PDO : |
</span><span id="421" class="l"><a class="l" href="#421">421: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->connexion->lastInsertId(<span class="php-var">$parametres</span>); |
</span><span id="422" class="l"><a class="l" href="#422">422: </a> <span class="php-keyword1">break</span>; |
</span><span id="423" class="l"><a class="l" href="#423">423: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQL : |
</span><span id="424" class="l"><a class="l" href="#424">424: </a> <span class="php-var">$retour</span> = <span class="php-keyword2">mysql_insert_id</span>(<span class="php-var">$this</span>->connexion); |
</span><span id="425" class="l"><a class="l" href="#425">425: </a> <span class="php-keyword1">break</span>; |
</span><span id="426" class="l"><a class="l" href="#426">426: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQLI : |
</span><span id="427" class="l"><a class="l" href="#427">427: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->connexion->insert_id(); |
</span><span id="428" class="l"><a class="l" href="#428">428: </a> <span class="php-keyword1">break</span>; |
</span><span id="429" class="l"><a class="l" href="#429">429: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_SQLITE3 : |
</span><span id="430" class="l"><a class="l" href="#430">430: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->connexion->lastInsertRowID(); |
</span><span id="431" class="l"><a class="l" href="#431">431: </a> <span class="php-keyword1">break</span>; |
</span><span id="432" class="l"><a class="l" href="#432">432: </a> } |
</span><span id="433" class="l"><a class="l" href="#433">433: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="434" class="l"><a class="l" href="#434">434: </a> } |
</span><span id="435" class="l"><a class="l" href="#435">435: </a> |
</span><span id="436" class="l"><a class="l" href="#436">436: </a> <span class="php-comment">/** |
</span></span><span id="437" class="l"><a class="l" href="#437">437: </a><span class="php-comment"> * Destructeur de classe, se contente de fermer explicitement la connexion à la base de donnée. |
</span></span><span id="438" class="l"><a class="l" href="#438">438: </a><span class="php-comment"> */</span> |
</span><span id="439" class="l"><a class="l" href="#439">439: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___destruct" href="#___destruct">__destruct</a>() { |
</span><span id="440" class="l"><a class="l" href="#440">440: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->connexion)) { |
</span><span id="441" class="l"><a class="l" href="#441">441: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>->abstraction) { |
</span><span id="442" class="l"><a class="l" href="#442">442: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_PDO : |
</span><span id="443" class="l"><a class="l" href="#443">443: </a> <span class="php-var">$this</span>->connexion = <span class="php-keyword1">null</span>; |
</span><span id="444" class="l"><a class="l" href="#444">444: </a> <span class="php-keyword1">break</span>; |
</span><span id="445" class="l"><a class="l" href="#445">445: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQL : |
</span><span id="446" class="l"><a class="l" href="#446">446: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->connexion)) { |
</span><span id="447" class="l"><a class="l" href="#447">447: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">mysql_close</span>(<span class="php-var">$this</span>->connexion); |
</span><span id="448" class="l"><a class="l" href="#448">448: </a> } |
</span><span id="449" class="l"><a class="l" href="#449">449: </a> <span class="php-keyword1">break</span>; |
</span><span id="450" class="l"><a class="l" href="#450">450: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_MYSQLI : |
</span><span id="451" class="l"><a class="l" href="#451">451: </a> <span class="php-var">$this</span>->connexion->close(); |
</span><span id="452" class="l"><a class="l" href="#452">452: </a> <span class="php-keyword1">break</span>; |
</span><span id="453" class="l"><a class="l" href="#453">453: </a> <span class="php-keyword1">case</span> self::ABSTRACTION_SQLITE3 : |
</span><span id="454" class="l"><a class="l" href="#454">454: </a> <span class="php-var">$this</span>->connexion->close(); |
</span><span id="455" class="l"><a class="l" href="#455">455: </a> <span class="php-keyword1">break</span>; |
</span><span id="456" class="l"><a class="l" href="#456">456: </a> } |
</span><span id="457" class="l"><a class="l" href="#457">457: </a> } |
</span><span id="458" class="l"><a class="l" href="#458">458: </a> } |
</span><span id="459" class="l"><a class="l" href="#459">459: </a>} |
</span><span id="460" class="l"><a class="l" href="#460">460: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-CacheFichier.html |
---|
New file |
0,0 → 1,971 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/CacheFichier.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li class="active"><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li class="active"><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li><a href="class-MonScript.html">MonScript</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-None.html" title="Summary of None"><span>Package</span></a> |
</li> |
<li> |
<a href="class-CacheFichier.html" title="Summary of CacheFichier"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-keyword1">class</span> <a id="CacheFichier" href="#CacheFichier">CacheFichier</a> { |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a> <span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Options disponibles |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * ====> (string) stockage_chemin : |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * Chemin vers le dossier devant contenir l'arborescence du cache. |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * =====> (boolean) fichier_verrou : |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * - Active / Désactive le verrouillage des fichiers |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * - Peut éviter la corruption du cache dans de mauvaises circonstances, mais cela ne fonctionne pas sur des serveur |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * multithread et sur les systèmes de fichiers NFS par exemple. |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * =====> (boolean) controle_lecture : |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * - Activer / désactiver le contrôle de lecture |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * - S'il est activé, une clé de contrôle est ajoutée dans le fichier de cache et cette clé est comparée avec celle calculée |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> * après la lecture. |
</span></span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-comment"> * |
</span></span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-comment"> * =====> (string) controle_lecture_type : |
</span></span><span id="20" class="l"><a class="l" href="#20"> 20: </a><span class="php-comment"> * Type de contrôle de lecture (seulement si le contrôle de lecture est activé). |
</span></span><span id="21" class="l"><a class="l" href="#21"> 21: </a><span class="php-comment"> * Les valeurs disponibles sont: |
</span></span><span id="22" class="l"><a class="l" href="#22"> 22: </a><span class="php-comment"> * - «md5» pour un contrôle md5 (le meilleur mais le plus lent) |
</span></span><span id="23" class="l"><a class="l" href="#23"> 23: </a><span class="php-comment"> * - «crc32» pour un contrôle de hachage crc32 (un peu moins sécurisé, mais plus rapide, un meilleur choix) |
</span></span><span id="24" class="l"><a class="l" href="#24"> 24: </a><span class="php-comment"> * - «adler32» pour un contrôle de hachage adler32 (excellent choix aussi, plus rapide que crc32) |
</span></span><span id="25" class="l"><a class="l" href="#25"> 25: </a><span class="php-comment"> * - «strlen» pour un test de longueur uniquement (le plus rapide) |
</span></span><span id="26" class="l"><a class="l" href="#26"> 26: </a><span class="php-comment"> * |
</span></span><span id="27" class="l"><a class="l" href="#27"> 27: </a><span class="php-comment"> * =====> (int) dossier_niveau : |
</span></span><span id="28" class="l"><a class="l" href="#28"> 28: </a><span class="php-comment"> * - Permet de réglez le nombre de niveau de sous-dossier que contiendra l'arborescence des dossiers du cache. |
</span></span><span id="29" class="l"><a class="l" href="#29"> 29: </a><span class="php-comment"> * 0 signifie "pas de sous-dossier pour le cache", |
</span></span><span id="30" class="l"><a class="l" href="#30"> 30: </a><span class="php-comment"> * 1 signifie "un niveau de sous-dossier", |
</span></span><span id="31" class="l"><a class="l" href="#31"> 31: </a><span class="php-comment"> * 2 signifie "deux niveaux" ... |
</span></span><span id="32" class="l"><a class="l" href="#32"> 32: </a><span class="php-comment"> * Cette option peut accélérer le cache seulement lorsque vous avez plusieurs centaines de fichiers de cache. |
</span></span><span id="33" class="l"><a class="l" href="#33"> 33: </a><span class="php-comment"> * Seuls des tests spécifiques peuvent vous aider à choisir la meilleure valeur possible pour vous. |
</span></span><span id="34" class="l"><a class="l" href="#34"> 34: </a><span class="php-comment"> * 1 ou 2 peut être est un bon début. |
</span></span><span id="35" class="l"><a class="l" href="#35"> 35: </a><span class="php-comment"> * |
</span></span><span id="36" class="l"><a class="l" href="#36"> 36: </a><span class="php-comment"> * =====> (int) dossier_umask : |
</span></span><span id="37" class="l"><a class="l" href="#37"> 37: </a><span class="php-comment"> * - Umask pour les sous-dossiers de l'arborescence du cache. |
</span></span><span id="38" class="l"><a class="l" href="#38"> 38: </a><span class="php-comment"> * |
</span></span><span id="39" class="l"><a class="l" href="#39"> 39: </a><span class="php-comment"> * =====> (string) fichier_prefixe : |
</span></span><span id="40" class="l"><a class="l" href="#40"> 40: </a><span class="php-comment"> * - préfixe pour les fichiers du cache |
</span></span><span id="41" class="l"><a class="l" href="#41"> 41: </a><span class="php-comment"> * - ATTENTION : faite vraiment attention avec cette option, car une valeur trop générique dans le dossier cache du système |
</span></span><span id="42" class="l"><a class="l" href="#42"> 42: </a><span class="php-comment"> * (comme /tmp) peut provoquer des catastrophes lors du nettoyage du cache. |
</span></span><span id="43" class="l"><a class="l" href="#43"> 43: </a><span class="php-comment"> * |
</span></span><span id="44" class="l"><a class="l" href="#44"> 44: </a><span class="php-comment"> * =====> (int) fichier_umask : |
</span></span><span id="45" class="l"><a class="l" href="#45"> 45: </a><span class="php-comment"> * - Umask pour les fichiers de cache |
</span></span><span id="46" class="l"><a class="l" href="#46"> 46: </a><span class="php-comment"> * |
</span></span><span id="47" class="l"><a class="l" href="#47"> 47: </a><span class="php-comment"> * =====> (int) metadonnees_max_taille : |
</span></span><span id="48" class="l"><a class="l" href="#48"> 48: </a><span class="php-comment"> * - taille maximum pour le tableau de métadonnées du cache (ne changer pas cette valeur sauf si vous savez ce que vous faite) |
</span></span><span id="49" class="l"><a class="l" href="#49"> 49: </a><span class="php-comment"> * |
</span></span><span id="50" class="l"><a class="l" href="#50"> 50: </a><span class="php-comment"> * @var array options disponibles |
</span></span><span id="51" class="l"><a class="l" href="#51"> 51: </a><span class="php-comment"> */</span> |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$options" href="#$options">$options</a></span> = <span class="php-keyword1">array</span>( |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> <span class="php-quote">'stockage_chemin'</span> => <span class="php-keyword1">null</span>, |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-quote">'fichier_verrou'</span> => <span class="php-keyword1">true</span>, |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> <span class="php-quote">'controle_lecture'</span> => <span class="php-keyword1">true</span>, |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> <span class="php-quote">'controle_lecture_type'</span> => <span class="php-quote">'crc32'</span>, |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> <span class="php-quote">'dossier_niveau'</span> => <span class="php-num">0</span>, |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> <span class="php-quote">'dossier_umask'</span> => <span class="php-num">0700</span>, |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-quote">'fichier_prefixe'</span> => <span class="php-quote">'tbf'</span>, |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> <span class="php-quote">'fichier_umask'</span> => <span class="php-num">0600</span>, |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> <span class="php-quote">'metadonnees_max_taille'</span> => <span class="php-num">100</span> |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> ); |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-comment">/** |
</span></span><span id="65" class="l"><a class="l" href="#65"> 65: </a><span class="php-comment"> * Array of metadatas (each item is an associative array) |
</span></span><span id="66" class="l"><a class="l" href="#66"> 66: </a><span class="php-comment"> * |
</span></span><span id="67" class="l"><a class="l" href="#67"> 67: </a><span class="php-comment"> * @var array |
</span></span><span id="68" class="l"><a class="l" href="#68"> 68: </a><span class="php-comment"> */</span> |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$metadonnees" href="#$metadonnees">$metadonnees</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$Cache" href="#$Cache">$Cache</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> <span class="php-comment">/** |
</span></span><span id="74" class="l"><a class="l" href="#74"> 74: </a><span class="php-comment"> * Constructor |
</span></span><span id="75" class="l"><a class="l" href="#75"> 75: </a><span class="php-comment"> * |
</span></span><span id="76" class="l"><a class="l" href="#76"> 76: </a><span class="php-comment"> * @param array $options associative array of options |
</span></span><span id="77" class="l"><a class="l" href="#77"> 77: </a><span class="php-comment"> * @throws Zend_Cache_Exception |
</span></span><span id="78" class="l"><a class="l" href="#78"> 78: </a><span class="php-comment"> * @return void |
</span></span><span id="79" class="l"><a class="l" href="#79"> 79: </a><span class="php-comment"> */</span> |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>(<span class="php-keyword1">array</span> <span class="php-var">$options</span> = <span class="php-keyword1">array</span>(), Cache <span class="php-var">$cache</span>) { |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> <span class="php-var">$this</span>->Cache = <span class="php-var">$cache</span>; |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> <span class="php-var">$this</span>->initialiserOptionsParConfig(); |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> <span class="php-var">$this</span>->setOptions(<span class="php-var">$options</span>); |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->options[<span class="php-quote">'prefixe_fichier'</span>])) { |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">preg_match</span>(<span class="php-quote">'~^[a-zA-Z0-9_]+$~D'</span>, <span class="php-var">$this</span>->options[<span class="php-quote">'prefixe_fichier'</span>])) { |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Préfixe de nom de fichier invalide : doit contenir seulement [a-zA-Z0-9_]"</span>, E_USER_WARNING); |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> } |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> } |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'metadonnees_max_taille'</span>] < <span class="php-num">10</span>) { |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Taille du tableau des méta-données invalide, elle doit être > 10"</span>, E_USER_WARNING); |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> } |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$options</span>[<span class="php-quote">'dossier_umask'</span>]) && <span class="php-keyword2">is_string</span>(<span class="php-var">$options</span>[<span class="php-quote">'dossier_umask'</span>])) { |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> <span class="php-comment">// See #ZF-4422</span> |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> <span class="php-var">$this</span>->options[<span class="php-quote">'dossier_umask'</span>] = <span class="php-keyword2">octdec</span>(<span class="php-var">$this</span>->options[<span class="php-quote">'dossier_umask'</span>]); |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> } |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$options</span>[<span class="php-quote">'fichier_umask'</span>]) && <span class="php-keyword2">is_string</span>(<span class="php-var">$options</span>[<span class="php-quote">'fichier_umask'</span>])) { |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-comment">// See #ZF-4422</span> |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> <span class="php-var">$this</span>->options[<span class="php-quote">'fichier_umask'</span>] = <span class="php-keyword2">octdec</span>(<span class="php-var">$this</span>->options[<span class="php-quote">'fichier_umask'</span>]); |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> } |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> } |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_initialiserOptionsParConfig" href="#_initialiserOptionsParConfig">initialiserOptionsParConfig</a>() { |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> <span class="php-keyword1">while</span> (<span class="php-keyword1">list</span>(<span class="php-var">$nom</span>, <span class="php-var">$valeur</span>) = <span class="php-keyword2">each</span>(<span class="php-var">$this</span>->options)) { |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-keyword1">if</span> (Config::existe(<span class="php-var">$nom</span>)) { |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> <span class="php-var">$this</span>->options[<span class="php-var">$nom</span>] = Config::get(<span class="php-var">$nom</span>); |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> } |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> } |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> } |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_setOptions" href="#_setOptions">setOptions</a>(<span class="php-var">$options</span>) { |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> <span class="php-keyword1">while</span> (<span class="php-keyword1">list</span>(<span class="php-var">$nom</span>, <span class="php-var">$valeur</span>) = <span class="php-keyword2">each</span>(<span class="php-var">$options</span>)) { |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_string</span>(<span class="php-var">$nom</span>)) { |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Nom d'option incorecte : </span><span class="php-var">$nom</span><span class="php-quote">"</span>, E_USER_WARNING); |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> } |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> <span class="php-var">$nom</span> = <span class="php-keyword2">strtolower</span>(<span class="php-var">$nom</span>); |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">array_key_exists</span>(<span class="php-var">$nom</span>, <span class="php-var">$this</span>->options)) { |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-var">$this</span>->options[<span class="php-var">$nom</span>] = <span class="php-var">$valeur</span>; |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> } |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> } |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> } |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_setEmplacement" href="#_setEmplacement">setEmplacement</a>(<span class="php-var">$emplacement</span>) { |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_dir</span>(<span class="php-var">$emplacement</span>)) { |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"L'emplacement doit être un dossier."</span>, E_USER_WARNING); |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> } |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_writable</span>(<span class="php-var">$emplacement</span>)) { |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Le dossier de stockage du cache n'est pas accessible en écriture"</span>, E_USER_WARNING); |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> } |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> <span class="php-var">$emplacement</span> = <span class="php-keyword2">rtrim</span>(<span class="php-keyword2">realpath</span>(<span class="php-var">$emplacement</span>), <span class="php-quote">'\\/'</span>).DS; |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> <span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>] = <span class="php-var">$emplacement</span>; |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> } |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> <span class="php-comment">/** |
</span></span><span id="135" class="l"><a class="l" href="#135">135: </a><span class="php-comment"> * Test if a cache is available for the given id and (if yes) return it (false else) |
</span></span><span id="136" class="l"><a class="l" href="#136">136: </a><span class="php-comment"> * |
</span></span><span id="137" class="l"><a class="l" href="#137">137: </a><span class="php-comment"> * @param string $id cache id |
</span></span><span id="138" class="l"><a class="l" href="#138">138: </a><span class="php-comment"> * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested |
</span></span><span id="139" class="l"><a class="l" href="#139">139: </a><span class="php-comment"> * @return string|false cached datas |
</span></span><span id="140" class="l"><a class="l" href="#140">140: </a><span class="php-comment"> */</span> |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_charger" href="#_charger">charger</a>(<span class="php-var">$id</span>, <span class="php-var">$ne_pas_tester_validiter_du_cache</span> = <span class="php-keyword1">false</span>) { |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> <span class="php-var">$donnees</span> = <span class="php-keyword1">false</span>; |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->tester(<span class="php-var">$id</span>, <span class="php-var">$ne_pas_tester_validiter_du_cache</span>)) { |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-var">$metadonnees</span> = <span class="php-var">$this</span>->getMetadonneesFichier(<span class="php-var">$id</span>); |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> <span class="php-var">$fichier</span> = <span class="php-var">$this</span>->getFichierNom(<span class="php-var">$id</span>); |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> <span class="php-var">$donnees</span> = <span class="php-var">$this</span>->getContenuFichier(<span class="php-var">$fichier</span>); |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'controle_lecture'</span>]) { |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> <span class="php-var">$cle_secu_donnees</span> = <span class="php-var">$this</span>->genererCleSecu(<span class="php-var">$donnees</span>, <span class="php-var">$this</span>->options[<span class="php-quote">'controle_lecture_type'</span>]); |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> <span class="php-var">$cle_secu_controle</span> = <span class="php-var">$metadonnees</span>[<span class="php-quote">'hash'</span>]; |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> <span class="php-keyword1">if</span> (<span class="php-var">$cle_secu_donnees</span> != <span class="php-var">$cle_secu_controle</span>) { |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> <span class="php-comment">// Probléme détecté par le contrôle de lecture !</span> |
</span><span id="152" class="l"><a class="l" href="#152">152: </a> <span class="php-comment">// TODO : loguer le pb de sécu</span> |
</span><span id="153" class="l"><a class="l" href="#153">153: </a> <span class="php-var">$this</span>->supprimer(<span class="php-var">$id</span>); |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> <span class="php-var">$donnees</span> = <span class="php-keyword1">false</span>; |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> } |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> } |
</span><span id="157" class="l"><a class="l" href="#157">157: </a> } |
</span><span id="158" class="l"><a class="l" href="#158">158: </a> <span class="php-keyword1">return</span> <span class="php-var">$donnees</span>; |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> } |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> |
</span><span id="161" class="l"><a class="l" href="#161">161: </a> <span class="php-comment">/** |
</span></span><span id="162" class="l"><a class="l" href="#162">162: </a><span class="php-comment"> * Teste si un enregistrement en cache est disponible ou pas (pour l'id passé en paramètre). |
</span></span><span id="163" class="l"><a class="l" href="#163">163: </a><span class="php-comment"> * |
</span></span><span id="164" class="l"><a class="l" href="#164">164: </a><span class="php-comment"> * @param string $id identifiant de cache. |
</span></span><span id="165" class="l"><a class="l" href="#165">165: </a><span class="php-comment"> * @return mixed false (le cache n'est pas disponible) ou timestamp (int) "de dernière modification" de l'enregistrement en cache |
</span></span><span id="166" class="l"><a class="l" href="#166">166: </a><span class="php-comment"> */</span> |
</span><span id="167" class="l"><a class="l" href="#167">167: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_tester" href="#_tester">tester</a>(<span class="php-var">$id</span>) { |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> <span class="php-keyword2">clearstatcache</span>(); |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->testerExistenceCache(<span class="php-var">$id</span>, <span class="php-keyword1">false</span>); |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> } |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> |
</span><span id="172" class="l"><a class="l" href="#172">172: </a> <span class="php-comment">/** |
</span></span><span id="173" class="l"><a class="l" href="#173">173: </a><span class="php-comment"> * Save some string datas into a cache record |
</span></span><span id="174" class="l"><a class="l" href="#174">174: </a><span class="php-comment"> * |
</span></span><span id="175" class="l"><a class="l" href="#175">175: </a><span class="php-comment"> * Note : $data is always "string" (serialization is done by the |
</span></span><span id="176" class="l"><a class="l" href="#176">176: </a><span class="php-comment"> * core not by the backend) |
</span></span><span id="177" class="l"><a class="l" href="#177">177: </a><span class="php-comment"> * |
</span></span><span id="178" class="l"><a class="l" href="#178">178: </a><span class="php-comment"> * @param string $data Datas to cache |
</span></span><span id="179" class="l"><a class="l" href="#179">179: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="180" class="l"><a class="l" href="#180">180: </a><span class="php-comment"> * @param array $tags Array of strings, the cache record will be tagged by each string entry |
</span></span><span id="181" class="l"><a class="l" href="#181">181: </a><span class="php-comment"> * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) |
</span></span><span id="182" class="l"><a class="l" href="#182">182: </a><span class="php-comment"> * @return boolean true if no problem |
</span></span><span id="183" class="l"><a class="l" href="#183">183: </a><span class="php-comment"> */</span> |
</span><span id="184" class="l"><a class="l" href="#184">184: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_sauver" href="#_sauver">sauver</a>(<span class="php-var">$donnees</span>, <span class="php-var">$id</span>, <span class="php-var">$tags</span> = <span class="php-keyword1">array</span>(), <span class="php-var">$duree_vie_specifique</span> = <span class="php-keyword1">false</span>) { |
</span><span id="185" class="l"><a class="l" href="#185">185: </a> <span class="php-keyword2">clearstatcache</span>(); |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> <span class="php-var">$fichier</span> = <span class="php-var">$this</span>->getFichierNom(<span class="php-var">$id</span>); |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> <span class="php-var">$chemin</span> = <span class="php-var">$this</span>->getChemin(<span class="php-var">$id</span>); |
</span><span id="188" class="l"><a class="l" href="#188">188: </a> |
</span><span id="189" class="l"><a class="l" href="#189">189: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="190" class="l"><a class="l" href="#190">190: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'dossier_niveau'</span>] > <span class="php-num">0</span>) { |
</span><span id="191" class="l"><a class="l" href="#191">191: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_writable</span>(<span class="php-var">$chemin</span>)) { |
</span><span id="192" class="l"><a class="l" href="#192">192: </a> <span class="php-comment">// maybe, we just have to build the directory structure</span> |
</span><span id="193" class="l"><a class="l" href="#193">193: </a> <span class="php-var">$this</span>->lancerMkdirEtChmodRecursif(<span class="php-var">$id</span>); |
</span><span id="194" class="l"><a class="l" href="#194">194: </a> } |
</span><span id="195" class="l"><a class="l" href="#195">195: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_writable</span>(<span class="php-var">$chemin</span>)) { |
</span><span id="196" class="l"><a class="l" href="#196">196: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">false</span>; |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> } |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> } |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span> === <span class="php-keyword1">true</span>) { |
</span><span id="201" class="l"><a class="l" href="#201">201: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'controle_lecture'</span>]) { |
</span><span id="202" class="l"><a class="l" href="#202">202: </a> <span class="php-var">$cle_secu</span> = <span class="php-var">$this</span>->genererCleSecu(<span class="php-var">$donnees</span>, <span class="php-var">$this</span>->options[<span class="php-quote">'controle_lecture_type'</span>]); |
</span><span id="203" class="l"><a class="l" href="#203">203: </a> } <span class="php-keyword1">else</span> { |
</span><span id="204" class="l"><a class="l" href="#204">204: </a> <span class="php-var">$cle_secu</span> = <span class="php-quote">''</span>; |
</span><span id="205" class="l"><a class="l" href="#205">205: </a> } |
</span><span id="206" class="l"><a class="l" href="#206">206: </a> |
</span><span id="207" class="l"><a class="l" href="#207">207: </a> <span class="php-var">$metadonnees</span> = <span class="php-keyword1">array</span>( |
</span><span id="208" class="l"><a class="l" href="#208">208: </a> <span class="php-quote">'hash'</span> => <span class="php-var">$cle_secu</span>, |
</span><span id="209" class="l"><a class="l" href="#209">209: </a> <span class="php-quote">'mtime'</span> => <span class="php-keyword2">time</span>(), |
</span><span id="210" class="l"><a class="l" href="#210">210: </a> <span class="php-quote">'expiration'</span> => <span class="php-var">$this</span>->Cache->getTimestampExpiration(<span class="php-var">$duree_vie_specifique</span>), |
</span><span id="211" class="l"><a class="l" href="#211">211: </a> <span class="php-quote">'tags'</span> => <span class="php-var">$tags</span> |
</span><span id="212" class="l"><a class="l" href="#212">212: </a> ); |
</span><span id="213" class="l"><a class="l" href="#213">213: </a> |
</span><span id="214" class="l"><a class="l" href="#214">214: </a> <span class="php-keyword1">if</span> (! <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->setMetadonnees(<span class="php-var">$id</span>, <span class="php-var">$metadonnees</span>)) { |
</span><span id="215" class="l"><a class="l" href="#215">215: </a> <span class="php-comment">// TODO : ajouter un log</span> |
</span><span id="216" class="l"><a class="l" href="#216">216: </a> } <span class="php-keyword1">else</span> { |
</span><span id="217" class="l"><a class="l" href="#217">217: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->setContenuFichier(<span class="php-var">$fichier</span>, <span class="php-var">$donnees</span>); |
</span><span id="218" class="l"><a class="l" href="#218">218: </a> } |
</span><span id="219" class="l"><a class="l" href="#219">219: </a> } |
</span><span id="220" class="l"><a class="l" href="#220">220: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="221" class="l"><a class="l" href="#221">221: </a> } |
</span><span id="222" class="l"><a class="l" href="#222">222: </a> |
</span><span id="223" class="l"><a class="l" href="#223">223: </a> <span class="php-comment">/** |
</span></span><span id="224" class="l"><a class="l" href="#224">224: </a><span class="php-comment"> * Remove a cache record |
</span></span><span id="225" class="l"><a class="l" href="#225">225: </a><span class="php-comment"> * |
</span></span><span id="226" class="l"><a class="l" href="#226">226: </a><span class="php-comment"> * @param string $id cache id |
</span></span><span id="227" class="l"><a class="l" href="#227">227: </a><span class="php-comment"> * @return boolean true if no problem |
</span></span><span id="228" class="l"><a class="l" href="#228">228: </a><span class="php-comment"> */</span> |
</span><span id="229" class="l"><a class="l" href="#229">229: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_supprimer" href="#_supprimer">supprimer</a>(<span class="php-var">$id</span>) { |
</span><span id="230" class="l"><a class="l" href="#230">230: </a> <span class="php-var">$fichier</span> = <span class="php-var">$this</span>->getFichierNom(<span class="php-var">$id</span>); |
</span><span id="231" class="l"><a class="l" href="#231">231: </a> <span class="php-var">$suppression_fichier</span> = <span class="php-var">$this</span>->supprimerFichier(<span class="php-var">$fichier</span>); |
</span><span id="232" class="l"><a class="l" href="#232">232: </a> <span class="php-var">$suppression_metadonnees</span> = <span class="php-var">$this</span>->supprimerMetadonnees(<span class="php-var">$id</span>); |
</span><span id="233" class="l"><a class="l" href="#233">233: </a> <span class="php-keyword1">return</span> <span class="php-var">$suppression_metadonnees</span> && <span class="php-var">$suppression_fichier</span>; |
</span><span id="234" class="l"><a class="l" href="#234">234: </a> } |
</span><span id="235" class="l"><a class="l" href="#235">235: </a> |
</span><span id="236" class="l"><a class="l" href="#236">236: </a> <span class="php-comment">/** |
</span></span><span id="237" class="l"><a class="l" href="#237">237: </a><span class="php-comment"> * Clean some cache records |
</span></span><span id="238" class="l"><a class="l" href="#238">238: </a><span class="php-comment"> * |
</span></span><span id="239" class="l"><a class="l" href="#239">239: </a><span class="php-comment"> * Available modes are : |
</span></span><span id="240" class="l"><a class="l" href="#240">240: </a><span class="php-comment"> * 'all' (default) => remove all cache entries ($tags is not used) |
</span></span><span id="241" class="l"><a class="l" href="#241">241: </a><span class="php-comment"> * 'old' => remove too old cache entries ($tags is not used) |
</span></span><span id="242" class="l"><a class="l" href="#242">242: </a><span class="php-comment"> * 'matchingTag' => remove cache entries matching all given tags |
</span></span><span id="243" class="l"><a class="l" href="#243">243: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="244" class="l"><a class="l" href="#244">244: </a><span class="php-comment"> * 'notMatchingTag' => remove cache entries not matching one of the given tags |
</span></span><span id="245" class="l"><a class="l" href="#245">245: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="246" class="l"><a class="l" href="#246">246: </a><span class="php-comment"> * 'matchingAnyTag' => remove cache entries matching any given tags |
</span></span><span id="247" class="l"><a class="l" href="#247">247: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="248" class="l"><a class="l" href="#248">248: </a><span class="php-comment"> * |
</span></span><span id="249" class="l"><a class="l" href="#249">249: </a><span class="php-comment"> * @param string $mode clean mode |
</span></span><span id="250" class="l"><a class="l" href="#250">250: </a><span class="php-comment"> * @param tags array $tags array of tags |
</span></span><span id="251" class="l"><a class="l" href="#251">251: </a><span class="php-comment"> * @return boolean true if no problem |
</span></span><span id="252" class="l"><a class="l" href="#252">252: </a><span class="php-comment"> */</span> |
</span><span id="253" class="l"><a class="l" href="#253">253: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_nettoyer" href="#_nettoyer">nettoyer</a>(<span class="php-var">$mode</span> = Cache::NETTOYAGE_MODE_TOUS, <span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="254" class="l"><a class="l" href="#254">254: </a> <span class="php-comment">// We use this protected method to hide the recursive stuff</span> |
</span><span id="255" class="l"><a class="l" href="#255">255: </a> <span class="php-keyword2">clearstatcache</span>(); |
</span><span id="256" class="l"><a class="l" href="#256">256: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->nettoyerFichiers(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>], <span class="php-var">$mode</span>, <span class="php-var">$tags</span>); |
</span><span id="257" class="l"><a class="l" href="#257">257: </a> } |
</span><span id="258" class="l"><a class="l" href="#258">258: </a> |
</span><span id="259" class="l"><a class="l" href="#259">259: </a> <span class="php-comment">/** |
</span></span><span id="260" class="l"><a class="l" href="#260">260: </a><span class="php-comment"> * Return an array of stored cache ids |
</span></span><span id="261" class="l"><a class="l" href="#261">261: </a><span class="php-comment"> * |
</span></span><span id="262" class="l"><a class="l" href="#262">262: </a><span class="php-comment"> * @return array array of stored cache ids (string) |
</span></span><span id="263" class="l"><a class="l" href="#263">263: </a><span class="php-comment"> */</span> |
</span><span id="264" class="l"><a class="l" href="#264">264: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIds" href="#_getIds">getIds</a>() { |
</span><span id="265" class="l"><a class="l" href="#265">265: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->analyserCache(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>], <span class="php-quote">'ids'</span>, <span class="php-keyword1">array</span>()); |
</span><span id="266" class="l"><a class="l" href="#266">266: </a> } |
</span><span id="267" class="l"><a class="l" href="#267">267: </a> |
</span><span id="268" class="l"><a class="l" href="#268">268: </a> <span class="php-comment">/** |
</span></span><span id="269" class="l"><a class="l" href="#269">269: </a><span class="php-comment"> * Return an array of stored tags |
</span></span><span id="270" class="l"><a class="l" href="#270">270: </a><span class="php-comment"> * |
</span></span><span id="271" class="l"><a class="l" href="#271">271: </a><span class="php-comment"> * @return array array of stored tags (string) |
</span></span><span id="272" class="l"><a class="l" href="#272">272: </a><span class="php-comment"> */</span> |
</span><span id="273" class="l"><a class="l" href="#273">273: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getTags" href="#_getTags">getTags</a>() { |
</span><span id="274" class="l"><a class="l" href="#274">274: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->analyserCache(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>], <span class="php-quote">'tags'</span>, <span class="php-keyword1">array</span>()); |
</span><span id="275" class="l"><a class="l" href="#275">275: </a> } |
</span><span id="276" class="l"><a class="l" href="#276">276: </a> |
</span><span id="277" class="l"><a class="l" href="#277">277: </a> <span class="php-comment">/** |
</span></span><span id="278" class="l"><a class="l" href="#278">278: </a><span class="php-comment"> * Return an array of stored cache ids which match given tags |
</span></span><span id="279" class="l"><a class="l" href="#279">279: </a><span class="php-comment"> * |
</span></span><span id="280" class="l"><a class="l" href="#280">280: </a><span class="php-comment"> * In case of multiple tags, a logical AND is made between tags |
</span></span><span id="281" class="l"><a class="l" href="#281">281: </a><span class="php-comment"> * |
</span></span><span id="282" class="l"><a class="l" href="#282">282: </a><span class="php-comment"> * @param array $tags array of tags |
</span></span><span id="283" class="l"><a class="l" href="#283">283: </a><span class="php-comment"> * @return array array of matching cache ids (string) |
</span></span><span id="284" class="l"><a class="l" href="#284">284: </a><span class="php-comment"> */</span> |
</span><span id="285" class="l"><a class="l" href="#285">285: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIdsAvecLesTags" href="#_getIdsAvecLesTags">getIdsAvecLesTags</a>(<span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="286" class="l"><a class="l" href="#286">286: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->analyserCache(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>], <span class="php-quote">'matching'</span>, <span class="php-var">$tags</span>); |
</span><span id="287" class="l"><a class="l" href="#287">287: </a> } |
</span><span id="288" class="l"><a class="l" href="#288">288: </a> |
</span><span id="289" class="l"><a class="l" href="#289">289: </a> <span class="php-comment">/** |
</span></span><span id="290" class="l"><a class="l" href="#290">290: </a><span class="php-comment"> * Return an array of stored cache ids which don't match given tags |
</span></span><span id="291" class="l"><a class="l" href="#291">291: </a><span class="php-comment"> * |
</span></span><span id="292" class="l"><a class="l" href="#292">292: </a><span class="php-comment"> * In case of multiple tags, a logical OR is made between tags |
</span></span><span id="293" class="l"><a class="l" href="#293">293: </a><span class="php-comment"> * |
</span></span><span id="294" class="l"><a class="l" href="#294">294: </a><span class="php-comment"> * @param array $tags array of tags |
</span></span><span id="295" class="l"><a class="l" href="#295">295: </a><span class="php-comment"> * @return array array of not matching cache ids (string) |
</span></span><span id="296" class="l"><a class="l" href="#296">296: </a><span class="php-comment"> */</span> |
</span><span id="297" class="l"><a class="l" href="#297">297: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIdsSansLesTags" href="#_getIdsSansLesTags">getIdsSansLesTags</a>(<span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="298" class="l"><a class="l" href="#298">298: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->analyserCache(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>], <span class="php-quote">'notMatching'</span>, <span class="php-var">$tags</span>); |
</span><span id="299" class="l"><a class="l" href="#299">299: </a> } |
</span><span id="300" class="l"><a class="l" href="#300">300: </a> |
</span><span id="301" class="l"><a class="l" href="#301">301: </a> <span class="php-comment">/** |
</span></span><span id="302" class="l"><a class="l" href="#302">302: </a><span class="php-comment"> * Return an array of stored cache ids which match any given tags |
</span></span><span id="303" class="l"><a class="l" href="#303">303: </a><span class="php-comment"> * |
</span></span><span id="304" class="l"><a class="l" href="#304">304: </a><span class="php-comment"> * In case of multiple tags, a logical AND is made between tags |
</span></span><span id="305" class="l"><a class="l" href="#305">305: </a><span class="php-comment"> * |
</span></span><span id="306" class="l"><a class="l" href="#306">306: </a><span class="php-comment"> * @param array $tags array of tags |
</span></span><span id="307" class="l"><a class="l" href="#307">307: </a><span class="php-comment"> * @return array array of any matching cache ids (string) |
</span></span><span id="308" class="l"><a class="l" href="#308">308: </a><span class="php-comment"> */</span> |
</span><span id="309" class="l"><a class="l" href="#309">309: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getIdsAvecUnTag" href="#_getIdsAvecUnTag">getIdsAvecUnTag</a>(<span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="310" class="l"><a class="l" href="#310">310: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->analyserCache(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>], <span class="php-quote">'matchingAny'</span>, <span class="php-var">$tags</span>); |
</span><span id="311" class="l"><a class="l" href="#311">311: </a> } |
</span><span id="312" class="l"><a class="l" href="#312">312: </a> |
</span><span id="313" class="l"><a class="l" href="#313">313: </a> <span class="php-comment">/** |
</span></span><span id="314" class="l"><a class="l" href="#314">314: </a><span class="php-comment"> * Return the filling percentage of the backend storage |
</span></span><span id="315" class="l"><a class="l" href="#315">315: </a><span class="php-comment"> * |
</span></span><span id="316" class="l"><a class="l" href="#316">316: </a><span class="php-comment"> * @throws Zend_Cache_Exception |
</span></span><span id="317" class="l"><a class="l" href="#317">317: </a><span class="php-comment"> * @return int integer between 0 and 100 |
</span></span><span id="318" class="l"><a class="l" href="#318">318: </a><span class="php-comment"> */</span> |
</span><span id="319" class="l"><a class="l" href="#319">319: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getPourcentageRemplissage" href="#_getPourcentageRemplissage">getPourcentageRemplissage</a>() { |
</span><span id="320" class="l"><a class="l" href="#320">320: </a> <span class="php-var">$libre</span> = <span class="php-keyword2">disk_free_space</span>(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>]); |
</span><span id="321" class="l"><a class="l" href="#321">321: </a> <span class="php-var">$total</span> = <span class="php-keyword2">disk_total_space</span>(<span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>]); |
</span><span id="322" class="l"><a class="l" href="#322">322: </a> |
</span><span id="323" class="l"><a class="l" href="#323">323: </a> <span class="php-var">$pourcentage</span> = <span class="php-num">0</span>; |
</span><span id="324" class="l"><a class="l" href="#324">324: </a> <span class="php-keyword1">if</span> (<span class="php-var">$total</span> == <span class="php-num">0</span>) { |
</span><span id="325" class="l"><a class="l" href="#325">325: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Impossible d'utiliser la fonction disk_total_space"</span>, E_USER_WARNING); |
</span><span id="326" class="l"><a class="l" href="#326">326: </a> } <span class="php-keyword1">else</span> { |
</span><span id="327" class="l"><a class="l" href="#327">327: </a> <span class="php-var">$pourcentage</span> = (<span class="php-var">$libre</span> >= <span class="php-var">$total</span>) ? <span class="php-num">100</span> : ((int) (<span class="php-num">100</span>. * (<span class="php-var">$total</span> - <span class="php-var">$libre</span>) / <span class="php-var">$total</span>)); |
</span><span id="328" class="l"><a class="l" href="#328">328: </a> } |
</span><span id="329" class="l"><a class="l" href="#329">329: </a> <span class="php-keyword1">return</span> <span class="php-var">$pourcentage</span>; |
</span><span id="330" class="l"><a class="l" href="#330">330: </a> } |
</span><span id="331" class="l"><a class="l" href="#331">331: </a> |
</span><span id="332" class="l"><a class="l" href="#332">332: </a> <span class="php-comment">/** |
</span></span><span id="333" class="l"><a class="l" href="#333">333: </a><span class="php-comment"> * Return an array of metadatas for the given cache id |
</span></span><span id="334" class="l"><a class="l" href="#334">334: </a><span class="php-comment"> * |
</span></span><span id="335" class="l"><a class="l" href="#335">335: </a><span class="php-comment"> * The array must include these keys : |
</span></span><span id="336" class="l"><a class="l" href="#336">336: </a><span class="php-comment"> * - expire : the expire timestamp |
</span></span><span id="337" class="l"><a class="l" href="#337">337: </a><span class="php-comment"> * - tags : a string array of tags |
</span></span><span id="338" class="l"><a class="l" href="#338">338: </a><span class="php-comment"> * - mtime : timestamp of last modification time |
</span></span><span id="339" class="l"><a class="l" href="#339">339: </a><span class="php-comment"> * |
</span></span><span id="340" class="l"><a class="l" href="#340">340: </a><span class="php-comment"> * @param string $id cache id |
</span></span><span id="341" class="l"><a class="l" href="#341">341: </a><span class="php-comment"> * @return array array of metadatas (false if the cache id is not found) |
</span></span><span id="342" class="l"><a class="l" href="#342">342: </a><span class="php-comment"> */</span> |
</span><span id="343" class="l"><a class="l" href="#343">343: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getMetadonnees" href="#_getMetadonnees">getMetadonnees</a>(<span class="php-var">$id</span>) { |
</span><span id="344" class="l"><a class="l" href="#344">344: </a> <span class="php-keyword1">if</span> (<span class="php-var">$metadonnees</span> = <span class="php-var">$this</span>->getMetadonneesFichier(<span class="php-var">$id</span>)) { |
</span><span id="345" class="l"><a class="l" href="#345">345: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">time</span>() > <span class="php-var">$metadonnees</span>[<span class="php-quote">'expiration'</span>]) { |
</span><span id="346" class="l"><a class="l" href="#346">346: </a> <span class="php-var">$metadonnees</span> = <span class="php-keyword1">false</span>; |
</span><span id="347" class="l"><a class="l" href="#347">347: </a> } <span class="php-keyword1">else</span> { |
</span><span id="348" class="l"><a class="l" href="#348">348: </a> <span class="php-var">$metadonnees</span> = <span class="php-keyword1">array</span>( |
</span><span id="349" class="l"><a class="l" href="#349">349: </a> <span class="php-quote">'expiration'</span> => <span class="php-var">$metadonnees</span>[<span class="php-quote">'expiration'</span>], |
</span><span id="350" class="l"><a class="l" href="#350">350: </a> <span class="php-quote">'tags'</span> => <span class="php-var">$metadonnees</span>[<span class="php-quote">'tags'</span>], |
</span><span id="351" class="l"><a class="l" href="#351">351: </a> <span class="php-quote">'mtime'</span> => <span class="php-var">$metadonnees</span>[<span class="php-quote">'mtime'</span>] |
</span><span id="352" class="l"><a class="l" href="#352">352: </a> ); |
</span><span id="353" class="l"><a class="l" href="#353">353: </a> } |
</span><span id="354" class="l"><a class="l" href="#354">354: </a> } |
</span><span id="355" class="l"><a class="l" href="#355">355: </a> |
</span><span id="356" class="l"><a class="l" href="#356">356: </a> <span class="php-keyword1">return</span> <span class="php-var">$metadonnees</span>; |
</span><span id="357" class="l"><a class="l" href="#357">357: </a> } |
</span><span id="358" class="l"><a class="l" href="#358">358: </a> |
</span><span id="359" class="l"><a class="l" href="#359">359: </a> <span class="php-comment">/** |
</span></span><span id="360" class="l"><a class="l" href="#360">360: </a><span class="php-comment"> * Give (if possible) an extra lifetime to the given cache id |
</span></span><span id="361" class="l"><a class="l" href="#361">361: </a><span class="php-comment"> * |
</span></span><span id="362" class="l"><a class="l" href="#362">362: </a><span class="php-comment"> * @param string $id cache id |
</span></span><span id="363" class="l"><a class="l" href="#363">363: </a><span class="php-comment"> * @param int $extraLifetime |
</span></span><span id="364" class="l"><a class="l" href="#364">364: </a><span class="php-comment"> * @return boolean true if ok |
</span></span><span id="365" class="l"><a class="l" href="#365">365: </a><span class="php-comment"> */</span> |
</span><span id="366" class="l"><a class="l" href="#366">366: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ajouterSupplementDureeDeVie" href="#_ajouterSupplementDureeDeVie">ajouterSupplementDureeDeVie</a>(<span class="php-var">$id</span>, <span class="php-var">$supplement_duree_de_vie</span>) { |
</span><span id="367" class="l"><a class="l" href="#367">367: </a> <span class="php-var">$augmentation</span> = <span class="php-keyword1">true</span>; |
</span><span id="368" class="l"><a class="l" href="#368">368: </a> <span class="php-keyword1">if</span> (<span class="php-var">$metadonnees</span> = <span class="php-var">$this</span>->getMetadonneesFichier(<span class="php-var">$id</span>)) { |
</span><span id="369" class="l"><a class="l" href="#369">369: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">time</span>() > <span class="php-var">$metadonnees</span>[<span class="php-quote">'expiration'</span>]) { |
</span><span id="370" class="l"><a class="l" href="#370">370: </a> <span class="php-var">$augmentation</span> = <span class="php-keyword1">false</span>; |
</span><span id="371" class="l"><a class="l" href="#371">371: </a> } <span class="php-keyword1">else</span> { |
</span><span id="372" class="l"><a class="l" href="#372">372: </a> <span class="php-var">$metadonnees_nouvelle</span> = <span class="php-keyword1">array</span>( |
</span><span id="373" class="l"><a class="l" href="#373">373: </a> <span class="php-quote">'hash'</span> => <span class="php-var">$metadonnees</span>[<span class="php-quote">'hash'</span>], |
</span><span id="374" class="l"><a class="l" href="#374">374: </a> <span class="php-quote">'mtime'</span> => <span class="php-keyword2">time</span>(), |
</span><span id="375" class="l"><a class="l" href="#375">375: </a> <span class="php-quote">'expiration'</span> => <span class="php-var">$metadonnees</span>[<span class="php-quote">'expiration'</span>] + <span class="php-var">$supplement_duree_de_vie</span>, |
</span><span id="376" class="l"><a class="l" href="#376">376: </a> <span class="php-quote">'tags'</span> => <span class="php-var">$metadonnees</span>[<span class="php-quote">'tags'</span>] |
</span><span id="377" class="l"><a class="l" href="#377">377: </a> ); |
</span><span id="378" class="l"><a class="l" href="#378">378: </a> <span class="php-var">$augmentation</span> = <span class="php-var">$this</span>->setMetadonnees(<span class="php-var">$id</span>, <span class="php-var">$metadonnees_nouvelle</span>); |
</span><span id="379" class="l"><a class="l" href="#379">379: </a> } |
</span><span id="380" class="l"><a class="l" href="#380">380: </a> } |
</span><span id="381" class="l"><a class="l" href="#381">381: </a> <span class="php-keyword1">return</span> <span class="php-var">$augmentation</span>; |
</span><span id="382" class="l"><a class="l" href="#382">382: </a> } |
</span><span id="383" class="l"><a class="l" href="#383">383: </a> |
</span><span id="384" class="l"><a class="l" href="#384">384: </a> <span class="php-comment">/** |
</span></span><span id="385" class="l"><a class="l" href="#385">385: </a><span class="php-comment"> * Get a metadatas record |
</span></span><span id="386" class="l"><a class="l" href="#386">386: </a><span class="php-comment"> * |
</span></span><span id="387" class="l"><a class="l" href="#387">387: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="388" class="l"><a class="l" href="#388">388: </a><span class="php-comment"> * @return array|false Associative array of metadatas |
</span></span><span id="389" class="l"><a class="l" href="#389">389: </a><span class="php-comment"> */</span> |
</span><span id="390" class="l"><a class="l" href="#390">390: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getMetadonneesFichier" href="#_getMetadonneesFichier">getMetadonneesFichier</a>(<span class="php-var">$id</span>) { |
</span><span id="391" class="l"><a class="l" href="#391">391: </a> <span class="php-var">$metadonnees</span> = <span class="php-keyword1">false</span>; |
</span><span id="392" class="l"><a class="l" href="#392">392: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->metadonnees[<span class="php-var">$id</span>])) { |
</span><span id="393" class="l"><a class="l" href="#393">393: </a> <span class="php-var">$metadonnees</span> = <span class="php-var">$this</span>->metadonnees[<span class="php-var">$id</span>]; |
</span><span id="394" class="l"><a class="l" href="#394">394: </a> } <span class="php-keyword1">else</span> { |
</span><span id="395" class="l"><a class="l" href="#395">395: </a> <span class="php-keyword1">if</span> (<span class="php-var">$metadonnees</span> = <span class="php-var">$this</span>->chargerMetadonnees(<span class="php-var">$id</span>)) { |
</span><span id="396" class="l"><a class="l" href="#396">396: </a> <span class="php-var">$this</span>->setMetadonnees(<span class="php-var">$id</span>, <span class="php-var">$metadonnees</span>, <span class="php-keyword1">false</span>); |
</span><span id="397" class="l"><a class="l" href="#397">397: </a> } |
</span><span id="398" class="l"><a class="l" href="#398">398: </a> } |
</span><span id="399" class="l"><a class="l" href="#399">399: </a> <span class="php-keyword1">return</span> <span class="php-var">$metadonnees</span>; |
</span><span id="400" class="l"><a class="l" href="#400">400: </a> } |
</span><span id="401" class="l"><a class="l" href="#401">401: </a> |
</span><span id="402" class="l"><a class="l" href="#402">402: </a> <span class="php-comment">/** |
</span></span><span id="403" class="l"><a class="l" href="#403">403: </a><span class="php-comment"> * Set a metadatas record |
</span></span><span id="404" class="l"><a class="l" href="#404">404: </a><span class="php-comment"> * |
</span></span><span id="405" class="l"><a class="l" href="#405">405: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="406" class="l"><a class="l" href="#406">406: </a><span class="php-comment"> * @param array $metadatas Associative array of metadatas |
</span></span><span id="407" class="l"><a class="l" href="#407">407: </a><span class="php-comment"> * @param boolean $save optional pass false to disable saving to file |
</span></span><span id="408" class="l"><a class="l" href="#408">408: </a><span class="php-comment"> * @return boolean True if no problem |
</span></span><span id="409" class="l"><a class="l" href="#409">409: </a><span class="php-comment"> */</span> |
</span><span id="410" class="l"><a class="l" href="#410">410: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_setMetadonnees" href="#_setMetadonnees">setMetadonnees</a>(<span class="php-var">$id</span>, <span class="php-var">$metadonnees</span>, <span class="php-var">$sauvegarde</span> = <span class="php-keyword1">true</span>) { |
</span><span id="411" class="l"><a class="l" href="#411">411: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>->metadonnees) >= <span class="php-var">$this</span>->options[<span class="php-quote">'metadonnees_max_taille'</span>]) { |
</span><span id="412" class="l"><a class="l" href="#412">412: </a> <span class="php-var">$n</span> = (int) (<span class="php-var">$this</span>->options[<span class="php-quote">'metadonnees_max_taille'</span>] / <span class="php-num">10</span>); |
</span><span id="413" class="l"><a class="l" href="#413">413: </a> <span class="php-var">$this</span>->metadonnees = <span class="php-keyword2">array_slice</span>(<span class="php-var">$this</span>->metadonnees, <span class="php-var">$n</span>); |
</span><span id="414" class="l"><a class="l" href="#414">414: </a> } |
</span><span id="415" class="l"><a class="l" href="#415">415: </a> |
</span><span id="416" class="l"><a class="l" href="#416">416: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="417" class="l"><a class="l" href="#417">417: </a> <span class="php-keyword1">if</span> (<span class="php-var">$sauvegarde</span>) { |
</span><span id="418" class="l"><a class="l" href="#418">418: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->sauverMetadonnees(<span class="php-var">$id</span>, <span class="php-var">$metadonnees</span>); |
</span><span id="419" class="l"><a class="l" href="#419">419: </a> } |
</span><span id="420" class="l"><a class="l" href="#420">420: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span> == <span class="php-keyword1">true</span>) { |
</span><span id="421" class="l"><a class="l" href="#421">421: </a> <span class="php-var">$this</span>->metadonnees[<span class="php-var">$id</span>] = <span class="php-var">$metadonnees</span>; |
</span><span id="422" class="l"><a class="l" href="#422">422: </a> } |
</span><span id="423" class="l"><a class="l" href="#423">423: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="424" class="l"><a class="l" href="#424">424: </a> } |
</span><span id="425" class="l"><a class="l" href="#425">425: </a> |
</span><span id="426" class="l"><a class="l" href="#426">426: </a> <span class="php-comment">/** |
</span></span><span id="427" class="l"><a class="l" href="#427">427: </a><span class="php-comment"> * Drop a metadata record |
</span></span><span id="428" class="l"><a class="l" href="#428">428: </a><span class="php-comment"> * |
</span></span><span id="429" class="l"><a class="l" href="#429">429: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="430" class="l"><a class="l" href="#430">430: </a><span class="php-comment"> * @return boolean True if no problem |
</span></span><span id="431" class="l"><a class="l" href="#431">431: </a><span class="php-comment"> */</span> |
</span><span id="432" class="l"><a class="l" href="#432">432: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_supprimerMetadonnees" href="#_supprimerMetadonnees">supprimerMetadonnees</a>(<span class="php-var">$id</span>) { |
</span><span id="433" class="l"><a class="l" href="#433">433: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->metadonnees[<span class="php-var">$id</span>])) { |
</span><span id="434" class="l"><a class="l" href="#434">434: </a> <span class="php-keyword1">unset</span>(<span class="php-var">$this</span>->metadonnees[<span class="php-var">$id</span>]); |
</span><span id="435" class="l"><a class="l" href="#435">435: </a> } |
</span><span id="436" class="l"><a class="l" href="#436">436: </a> <span class="php-var">$fichier_meta</span> = <span class="php-var">$this</span>->getNomFichierMeta(<span class="php-var">$id</span>); |
</span><span id="437" class="l"><a class="l" href="#437">437: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->supprimerFichier(<span class="php-var">$fichier_meta</span>); |
</span><span id="438" class="l"><a class="l" href="#438">438: </a> } |
</span><span id="439" class="l"><a class="l" href="#439">439: </a> |
</span><span id="440" class="l"><a class="l" href="#440">440: </a> <span class="php-comment">/** |
</span></span><span id="441" class="l"><a class="l" href="#441">441: </a><span class="php-comment"> * Clear the metadatas array |
</span></span><span id="442" class="l"><a class="l" href="#442">442: </a><span class="php-comment"> * |
</span></span><span id="443" class="l"><a class="l" href="#443">443: </a><span class="php-comment"> * @return void |
</span></span><span id="444" class="l"><a class="l" href="#444">444: </a><span class="php-comment"> */</span> |
</span><span id="445" class="l"><a class="l" href="#445">445: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_nettoyerMetadonnees" href="#_nettoyerMetadonnees">nettoyerMetadonnees</a>() { |
</span><span id="446" class="l"><a class="l" href="#446">446: </a> <span class="php-var">$this</span>->metadonnees = <span class="php-keyword1">array</span>(); |
</span><span id="447" class="l"><a class="l" href="#447">447: </a> } |
</span><span id="448" class="l"><a class="l" href="#448">448: </a> |
</span><span id="449" class="l"><a class="l" href="#449">449: </a> <span class="php-comment">/** |
</span></span><span id="450" class="l"><a class="l" href="#450">450: </a><span class="php-comment"> * Load metadatas from disk |
</span></span><span id="451" class="l"><a class="l" href="#451">451: </a><span class="php-comment"> * |
</span></span><span id="452" class="l"><a class="l" href="#452">452: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="453" class="l"><a class="l" href="#453">453: </a><span class="php-comment"> * @return array|false Metadatas associative array |
</span></span><span id="454" class="l"><a class="l" href="#454">454: </a><span class="php-comment"> */</span> |
</span><span id="455" class="l"><a class="l" href="#455">455: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_chargerMetadonnees" href="#_chargerMetadonnees">chargerMetadonnees</a>(<span class="php-var">$id</span>) { |
</span><span id="456" class="l"><a class="l" href="#456">456: </a> <span class="php-var">$fichier</span> = <span class="php-var">$this</span>->getNomFichierMeta(<span class="php-var">$id</span>); |
</span><span id="457" class="l"><a class="l" href="#457">457: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span> = <span class="php-var">$this</span>->getContenuFichier(<span class="php-var">$fichier</span>)) { |
</span><span id="458" class="l"><a class="l" href="#458">458: </a> <span class="php-var">$resultat</span> = @<span class="php-keyword2">unserialize</span>(<span class="php-var">$resultat</span>); |
</span><span id="459" class="l"><a class="l" href="#459">459: </a> } |
</span><span id="460" class="l"><a class="l" href="#460">460: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="461" class="l"><a class="l" href="#461">461: </a> } |
</span><span id="462" class="l"><a class="l" href="#462">462: </a> |
</span><span id="463" class="l"><a class="l" href="#463">463: </a> <span class="php-comment">/** |
</span></span><span id="464" class="l"><a class="l" href="#464">464: </a><span class="php-comment"> * Save metadatas to disk |
</span></span><span id="465" class="l"><a class="l" href="#465">465: </a><span class="php-comment"> * |
</span></span><span id="466" class="l"><a class="l" href="#466">466: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="467" class="l"><a class="l" href="#467">467: </a><span class="php-comment"> * @param array $metadatas Associative array |
</span></span><span id="468" class="l"><a class="l" href="#468">468: </a><span class="php-comment"> * @return boolean True if no problem |
</span></span><span id="469" class="l"><a class="l" href="#469">469: </a><span class="php-comment"> */</span> |
</span><span id="470" class="l"><a class="l" href="#470">470: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_sauverMetadonnees" href="#_sauverMetadonnees">sauverMetadonnees</a>(<span class="php-var">$id</span>, <span class="php-var">$metadonnees</span>) { |
</span><span id="471" class="l"><a class="l" href="#471">471: </a> <span class="php-var">$fichier</span> = <span class="php-var">$this</span>->getNomFichierMeta(<span class="php-var">$id</span>); |
</span><span id="472" class="l"><a class="l" href="#472">472: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->setContenuFichier(<span class="php-var">$fichier</span>, <span class="php-keyword2">serialize</span>(<span class="php-var">$metadonnees</span>)); |
</span><span id="473" class="l"><a class="l" href="#473">473: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="474" class="l"><a class="l" href="#474">474: </a> } |
</span><span id="475" class="l"><a class="l" href="#475">475: </a> |
</span><span id="476" class="l"><a class="l" href="#476">476: </a> <span class="php-comment">/** |
</span></span><span id="477" class="l"><a class="l" href="#477">477: </a><span class="php-comment"> * Make and return a file name (with path) for metadatas |
</span></span><span id="478" class="l"><a class="l" href="#478">478: </a><span class="php-comment"> * |
</span></span><span id="479" class="l"><a class="l" href="#479">479: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="480" class="l"><a class="l" href="#480">480: </a><span class="php-comment"> * @return string Metadatas file name (with path) |
</span></span><span id="481" class="l"><a class="l" href="#481">481: </a><span class="php-comment"> */</span> |
</span><span id="482" class="l"><a class="l" href="#482">482: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getNomFichierMeta" href="#_getNomFichierMeta">getNomFichierMeta</a>(<span class="php-var">$id</span>) { |
</span><span id="483" class="l"><a class="l" href="#483">483: </a> <span class="php-var">$chemin</span> = <span class="php-var">$this</span>->getChemin(<span class="php-var">$id</span>); |
</span><span id="484" class="l"><a class="l" href="#484">484: </a> <span class="php-var">$fichier_nom</span> = <span class="php-var">$this</span>->transformaterIdEnNomFichier(<span class="php-quote">'interne-meta---'</span>.<span class="php-var">$id</span>); |
</span><span id="485" class="l"><a class="l" href="#485">485: </a> <span class="php-keyword1">return</span> <span class="php-var">$chemin</span>.<span class="php-var">$fichier_nom</span>; |
</span><span id="486" class="l"><a class="l" href="#486">486: </a> } |
</span><span id="487" class="l"><a class="l" href="#487">487: </a> |
</span><span id="488" class="l"><a class="l" href="#488">488: </a> <span class="php-comment">/** |
</span></span><span id="489" class="l"><a class="l" href="#489">489: </a><span class="php-comment"> * Check if the given filename is a metadatas one |
</span></span><span id="490" class="l"><a class="l" href="#490">490: </a><span class="php-comment"> * |
</span></span><span id="491" class="l"><a class="l" href="#491">491: </a><span class="php-comment"> * @param string $fileName File name |
</span></span><span id="492" class="l"><a class="l" href="#492">492: </a><span class="php-comment"> * @return boolean True if it's a metadatas one |
</span></span><span id="493" class="l"><a class="l" href="#493">493: </a><span class="php-comment"> */</span> |
</span><span id="494" class="l"><a class="l" href="#494">494: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_etreFichierMeta" href="#_etreFichierMeta">etreFichierMeta</a>(<span class="php-var">$fichier_nom</span>) { |
</span><span id="495" class="l"><a class="l" href="#495">495: </a> <span class="php-var">$id</span> = <span class="php-var">$this</span>->transformerNomFichierEnId(<span class="php-var">$fichier_nom</span>); |
</span><span id="496" class="l"><a class="l" href="#496">496: </a> <span class="php-keyword1">return</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$id</span>, <span class="php-num">0</span>, <span class="php-num">21</span>) == <span class="php-quote">'interne-meta---'</span>) ? <span class="php-keyword1">true</span> : <span class="php-keyword1">false</span>; |
</span><span id="497" class="l"><a class="l" href="#497">497: </a> } |
</span><span id="498" class="l"><a class="l" href="#498">498: </a> |
</span><span id="499" class="l"><a class="l" href="#499">499: </a> <span class="php-comment">/** |
</span></span><span id="500" class="l"><a class="l" href="#500">500: </a><span class="php-comment"> * Remove a file |
</span></span><span id="501" class="l"><a class="l" href="#501">501: </a><span class="php-comment"> * |
</span></span><span id="502" class="l"><a class="l" href="#502">502: </a><span class="php-comment"> * If we can't remove the file (because of locks or any problem), we will touch |
</span></span><span id="503" class="l"><a class="l" href="#503">503: </a><span class="php-comment"> * the file to invalidate it |
</span></span><span id="504" class="l"><a class="l" href="#504">504: </a><span class="php-comment"> * |
</span></span><span id="505" class="l"><a class="l" href="#505">505: </a><span class="php-comment"> * @param string $file Complete file path |
</span></span><span id="506" class="l"><a class="l" href="#506">506: </a><span class="php-comment"> * @return boolean True if ok |
</span></span><span id="507" class="l"><a class="l" href="#507">507: </a><span class="php-comment"> */</span> |
</span><span id="508" class="l"><a class="l" href="#508">508: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_supprimerFichier" href="#_supprimerFichier">supprimerFichier</a>(<span class="php-var">$fichier</span>) { |
</span><span id="509" class="l"><a class="l" href="#509">509: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">false</span>; |
</span><span id="510" class="l"><a class="l" href="#510">510: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_file</span>(<span class="php-var">$fichier</span>)) { |
</span><span id="511" class="l"><a class="l" href="#511">511: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span> = @<span class="php-keyword2">unlink</span>(<span class="php-var">$fichier</span>)) { |
</span><span id="512" class="l"><a class="l" href="#512">512: </a> <span class="php-comment">// TODO : ajouter un log</span> |
</span><span id="513" class="l"><a class="l" href="#513">513: </a> } |
</span><span id="514" class="l"><a class="l" href="#514">514: </a> } |
</span><span id="515" class="l"><a class="l" href="#515">515: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="516" class="l"><a class="l" href="#516">516: </a> } |
</span><span id="517" class="l"><a class="l" href="#517">517: </a> |
</span><span id="518" class="l"><a class="l" href="#518">518: </a> <span class="php-comment">/** |
</span></span><span id="519" class="l"><a class="l" href="#519">519: </a><span class="php-comment"> * Clean some cache records (protected method used for recursive stuff) |
</span></span><span id="520" class="l"><a class="l" href="#520">520: </a><span class="php-comment"> * |
</span></span><span id="521" class="l"><a class="l" href="#521">521: </a><span class="php-comment"> * Available modes are : |
</span></span><span id="522" class="l"><a class="l" href="#522">522: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) |
</span></span><span id="523" class="l"><a class="l" href="#523">523: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) |
</span></span><span id="524" class="l"><a class="l" href="#524">524: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags |
</span></span><span id="525" class="l"><a class="l" href="#525">525: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="526" class="l"><a class="l" href="#526">526: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} |
</span></span><span id="527" class="l"><a class="l" href="#527">527: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="528" class="l"><a class="l" href="#528">528: </a><span class="php-comment"> * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags |
</span></span><span id="529" class="l"><a class="l" href="#529">529: </a><span class="php-comment"> * ($tags can be an array of strings or a single string) |
</span></span><span id="530" class="l"><a class="l" href="#530">530: </a><span class="php-comment"> * |
</span></span><span id="531" class="l"><a class="l" href="#531">531: </a><span class="php-comment"> * @param string $dir Directory to clean |
</span></span><span id="532" class="l"><a class="l" href="#532">532: </a><span class="php-comment"> * @param string $mode Clean mode |
</span></span><span id="533" class="l"><a class="l" href="#533">533: </a><span class="php-comment"> * @param array $tags Array of tags |
</span></span><span id="534" class="l"><a class="l" href="#534">534: </a><span class="php-comment"> * @throws Zend_Cache_Exception |
</span></span><span id="535" class="l"><a class="l" href="#535">535: </a><span class="php-comment"> * @return boolean True if no problem |
</span></span><span id="536" class="l"><a class="l" href="#536">536: </a><span class="php-comment"> */</span> |
</span><span id="537" class="l"><a class="l" href="#537">537: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_nettoyerFichiers" href="#_nettoyerFichiers">nettoyerFichiers</a>(<span class="php-var">$dossier</span>, <span class="php-var">$mode</span> = Cache::NETTOYAGE_MODE_TOUS, <span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="538" class="l"><a class="l" href="#538">538: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_dir</span>(<span class="php-var">$dossier</span>)) { |
</span><span id="539" class="l"><a class="l" href="#539">539: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="540" class="l"><a class="l" href="#540">540: </a> } |
</span><span id="541" class="l"><a class="l" href="#541">541: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="542" class="l"><a class="l" href="#542">542: </a> <span class="php-var">$prefixe</span> = <span class="php-var">$this</span>->options[<span class="php-quote">'fichier_prefixe'</span>]; |
</span><span id="543" class="l"><a class="l" href="#543">543: </a> <span class="php-var">$glob</span> = @<span class="php-keyword2">glob</span>(<span class="php-var">$dossier</span>.<span class="php-var">$prefixe</span>.<span class="php-quote">'--*'</span>); |
</span><span id="544" class="l"><a class="l" href="#544">544: </a> <span class="php-keyword1">if</span> (<span class="php-var">$glob</span> === <span class="php-keyword1">false</span>) { |
</span><span id="545" class="l"><a class="l" href="#545">545: </a> <span class="php-comment">// On some systems it is impossible to distinguish between empty match and an error.</span> |
</span><span id="546" class="l"><a class="l" href="#546">546: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">true</span>; |
</span><span id="547" class="l"><a class="l" href="#547">547: </a> } |
</span><span id="548" class="l"><a class="l" href="#548">548: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$glob</span> <span class="php-keyword1">as</span> <span class="php-var">$fichier</span>) { |
</span><span id="549" class="l"><a class="l" href="#549">549: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_file</span>(<span class="php-var">$fichier</span>)) { |
</span><span id="550" class="l"><a class="l" href="#550">550: </a> <span class="php-var">$fichier_nom</span> = <span class="php-keyword2">basename</span>(<span class="php-var">$fichier</span>); |
</span><span id="551" class="l"><a class="l" href="#551">551: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->etreFichierMeta(<span class="php-var">$fichier_nom</span>)) { |
</span><span id="552" class="l"><a class="l" href="#552">552: </a> <span class="php-comment">// Pour le mode Cache::NETTOYAGE_MODE_TOUS, nous essayons de tous supprimer même les vieux fichiers méta</span> |
</span><span id="553" class="l"><a class="l" href="#553">553: </a> <span class="php-keyword1">if</span> (<span class="php-var">$mode</span> != Cache::NETTOYAGE_MODE_TOUS) { |
</span><span id="554" class="l"><a class="l" href="#554">554: </a> <span class="php-keyword1">continue</span>; |
</span><span id="555" class="l"><a class="l" href="#555">555: </a> } |
</span><span id="556" class="l"><a class="l" href="#556">556: </a> } |
</span><span id="557" class="l"><a class="l" href="#557">557: </a> <span class="php-var">$id</span> = <span class="php-var">$this</span>->transformerNomFichierEnId(<span class="php-var">$fichier_nom</span>); |
</span><span id="558" class="l"><a class="l" href="#558">558: </a> <span class="php-var">$metadonnees</span> = <span class="php-var">$this</span>->getMetadonneesFichier(<span class="php-var">$id</span>); |
</span><span id="559" class="l"><a class="l" href="#559">559: </a> <span class="php-keyword1">if</span> (<span class="php-var">$metadonnees</span> === <span class="php-keyword1">FALSE</span>) { |
</span><span id="560" class="l"><a class="l" href="#560">560: </a> <span class="php-var">$metadonnees</span> = <span class="php-keyword1">array</span>(<span class="php-quote">'expiration'</span> => <span class="php-num">1</span>, <span class="php-quote">'tags'</span> => <span class="php-keyword1">array</span>()); |
</span><span id="561" class="l"><a class="l" href="#561">561: </a> } |
</span><span id="562" class="l"><a class="l" href="#562">562: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$mode</span>) { |
</span><span id="563" class="l"><a class="l" href="#563">563: </a> <span class="php-keyword1">case</span> Cache::NETTOYAGE_MODE_TOUS : |
</span><span id="564" class="l"><a class="l" href="#564">564: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat_suppression</span> = <span class="php-var">$this</span>->supprimer(<span class="php-var">$id</span>)) { |
</span><span id="565" class="l"><a class="l" href="#565">565: </a> <span class="php-comment">// Dans ce cas seulement, nous acception qu'il y ait un problème avec la suppresssion du fichier meta</span> |
</span><span id="566" class="l"><a class="l" href="#566">566: </a> <span class="php-var">$resultat_suppression</span> = <span class="php-var">$this</span>->supprimerFichier(<span class="php-var">$fichier</span>); |
</span><span id="567" class="l"><a class="l" href="#567">567: </a> } |
</span><span id="568" class="l"><a class="l" href="#568">568: </a> <span class="php-var">$resultat</span> = <span class="php-var">$resultat</span> && <span class="php-var">$resultat_suppression</span>; |
</span><span id="569" class="l"><a class="l" href="#569">569: </a> <span class="php-keyword1">break</span>; |
</span><span id="570" class="l"><a class="l" href="#570">570: </a> <span class="php-keyword1">case</span> Cache::NETTOYAGE_MODE_EXPIRATION : |
</span><span id="571" class="l"><a class="l" href="#571">571: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">time</span>() > <span class="php-var">$metadonnees</span>[<span class="php-quote">'expiration'</span>]) { |
</span><span id="572" class="l"><a class="l" href="#572">572: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->supprimer(<span class="php-var">$id</span>) && <span class="php-var">$resultat</span>; |
</span><span id="573" class="l"><a class="l" href="#573">573: </a> } |
</span><span id="574" class="l"><a class="l" href="#574">574: </a> <span class="php-keyword1">break</span>; |
</span><span id="575" class="l"><a class="l" href="#575">575: </a> <span class="php-keyword1">case</span> Cache::NETTOYAGE_MODE_AVEC_LES_TAGS : |
</span><span id="576" class="l"><a class="l" href="#576">576: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">true</span>; |
</span><span id="577" class="l"><a class="l" href="#577">577: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tags</span> <span class="php-keyword1">as</span> <span class="php-var">$tag</span>) { |
</span><span id="578" class="l"><a class="l" href="#578">578: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">in_array</span>(<span class="php-var">$tag</span>, <span class="php-var">$metadonnees</span>[<span class="php-quote">'tags'</span>])) { |
</span><span id="579" class="l"><a class="l" href="#579">579: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">false</span>; |
</span><span id="580" class="l"><a class="l" href="#580">580: </a> <span class="php-keyword1">break</span>; |
</span><span id="581" class="l"><a class="l" href="#581">581: </a> } |
</span><span id="582" class="l"><a class="l" href="#582">582: </a> } |
</span><span id="583" class="l"><a class="l" href="#583">583: </a> <span class="php-keyword1">if</span> (<span class="php-var">$correspondance</span>) { |
</span><span id="584" class="l"><a class="l" href="#584">584: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->supprimer(<span class="php-var">$id</span>) && <span class="php-var">$resultat</span>; |
</span><span id="585" class="l"><a class="l" href="#585">585: </a> } |
</span><span id="586" class="l"><a class="l" href="#586">586: </a> <span class="php-keyword1">break</span>; |
</span><span id="587" class="l"><a class="l" href="#587">587: </a> <span class="php-keyword1">case</span> Cache::NETTOYAGE_MODE_SANS_LES_TAGS : |
</span><span id="588" class="l"><a class="l" href="#588">588: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">false</span>; |
</span><span id="589" class="l"><a class="l" href="#589">589: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tags</span> <span class="php-keyword1">as</span> <span class="php-var">$tag</span>) { |
</span><span id="590" class="l"><a class="l" href="#590">590: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">in_array</span>(<span class="php-var">$tag</span>, <span class="php-var">$metadonnees</span>[<span class="php-quote">'tags'</span>])) { |
</span><span id="591" class="l"><a class="l" href="#591">591: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">true</span>; |
</span><span id="592" class="l"><a class="l" href="#592">592: </a> <span class="php-keyword1">break</span>; |
</span><span id="593" class="l"><a class="l" href="#593">593: </a> } |
</span><span id="594" class="l"><a class="l" href="#594">594: </a> } |
</span><span id="595" class="l"><a class="l" href="#595">595: </a> <span class="php-keyword1">if</span> (!<span class="php-var">$correspondance</span>) { |
</span><span id="596" class="l"><a class="l" href="#596">596: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->supprimer(<span class="php-var">$id</span>) && <span class="php-var">$resultat</span>; |
</span><span id="597" class="l"><a class="l" href="#597">597: </a> } |
</span><span id="598" class="l"><a class="l" href="#598">598: </a> <span class="php-keyword1">break</span>; |
</span><span id="599" class="l"><a class="l" href="#599">599: </a> <span class="php-keyword1">case</span> Cache::NETTOYAGE_MODE_AVEC_UN_TAG : |
</span><span id="600" class="l"><a class="l" href="#600">600: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">false</span>; |
</span><span id="601" class="l"><a class="l" href="#601">601: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tags</span> <span class="php-keyword1">as</span> <span class="php-var">$tag</span>) { |
</span><span id="602" class="l"><a class="l" href="#602">602: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">in_array</span>(<span class="php-var">$tag</span>, <span class="php-var">$metadonnees</span>[<span class="php-quote">'tags'</span>])) { |
</span><span id="603" class="l"><a class="l" href="#603">603: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">true</span>; |
</span><span id="604" class="l"><a class="l" href="#604">604: </a> <span class="php-keyword1">break</span>; |
</span><span id="605" class="l"><a class="l" href="#605">605: </a> } |
</span><span id="606" class="l"><a class="l" href="#606">606: </a> } |
</span><span id="607" class="l"><a class="l" href="#607">607: </a> <span class="php-keyword1">if</span> (<span class="php-var">$correspondance</span>) { |
</span><span id="608" class="l"><a class="l" href="#608">608: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->supprimer(<span class="php-var">$id</span>) && <span class="php-var">$resultat</span>; |
</span><span id="609" class="l"><a class="l" href="#609">609: </a> } |
</span><span id="610" class="l"><a class="l" href="#610">610: </a> <span class="php-keyword1">break</span>; |
</span><span id="611" class="l"><a class="l" href="#611">611: </a> <span class="php-keyword1">default</span>: |
</span><span id="612" class="l"><a class="l" href="#612">612: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Mode de nettoyage invalide pour la méthode nettoyer()"</span>, E_USER_WARNING); |
</span><span id="613" class="l"><a class="l" href="#613">613: </a> <span class="php-keyword1">break</span>; |
</span><span id="614" class="l"><a class="l" href="#614">614: </a> } |
</span><span id="615" class="l"><a class="l" href="#615">615: </a> } |
</span><span id="616" class="l"><a class="l" href="#616">616: </a> <span class="php-keyword1">if</span> ((<span class="php-keyword2">is_dir</span>(<span class="php-var">$fichier</span>)) <span class="php-keyword1">and</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'dossier_niveau'</span>] > <span class="php-num">0</span>)) { |
</span><span id="617" class="l"><a class="l" href="#617">617: </a> <span class="php-comment">// Appel récursif</span> |
</span><span id="618" class="l"><a class="l" href="#618">618: </a> <span class="php-var">$resultat</span> = <span class="php-var">$this</span>->nettoyerFichiers(<span class="php-var">$fichier</span>.DS, <span class="php-var">$mode</span>, <span class="php-var">$tags</span>) && <span class="php-var">$resultat</span>; |
</span><span id="619" class="l"><a class="l" href="#619">619: </a> <span class="php-keyword1">if</span> (<span class="php-var">$mode</span> == Cache::NETTOYAGE_MODE_TOUS) { |
</span><span id="620" class="l"><a class="l" href="#620">620: </a> <span class="php-comment">// Si mode == Cache::NETTOYAGE_MODE_TOUS, nous essayons de supprimer la structure aussi</span> |
</span><span id="621" class="l"><a class="l" href="#621">621: </a> @<span class="php-keyword2">rmdir</span>(<span class="php-var">$fichier</span>); |
</span><span id="622" class="l"><a class="l" href="#622">622: </a> } |
</span><span id="623" class="l"><a class="l" href="#623">623: </a> } |
</span><span id="624" class="l"><a class="l" href="#624">624: </a> } |
</span><span id="625" class="l"><a class="l" href="#625">625: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="626" class="l"><a class="l" href="#626">626: </a> } |
</span><span id="627" class="l"><a class="l" href="#627">627: </a> |
</span><span id="628" class="l"><a class="l" href="#628">628: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_analyserCache" href="#_analyserCache">analyserCache</a>(<span class="php-var">$dossier</span>, <span class="php-var">$mode</span>, <span class="php-var">$tags</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="629" class="l"><a class="l" href="#629">629: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_dir</span>(<span class="php-var">$dossier</span>)) { |
</span><span id="630" class="l"><a class="l" href="#630">630: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="631" class="l"><a class="l" href="#631">631: </a> } |
</span><span id="632" class="l"><a class="l" href="#632">632: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">array</span>(); |
</span><span id="633" class="l"><a class="l" href="#633">633: </a> <span class="php-var">$prefixe</span> = <span class="php-var">$this</span>->options[<span class="php-quote">'fichier_prefixe'</span>]; |
</span><span id="634" class="l"><a class="l" href="#634">634: </a> <span class="php-var">$glob</span> = @<span class="php-keyword2">glob</span>(<span class="php-var">$dossier</span>.<span class="php-var">$prefixe</span>.<span class="php-quote">'--*'</span>); |
</span><span id="635" class="l"><a class="l" href="#635">635: </a> <span class="php-keyword1">if</span> (<span class="php-var">$glob</span> === <span class="php-keyword1">false</span>) { |
</span><span id="636" class="l"><a class="l" href="#636">636: </a> <span class="php-comment">// On some systems it is impossible to distinguish between empty match and an error.</span> |
</span><span id="637" class="l"><a class="l" href="#637">637: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">array</span>(); |
</span><span id="638" class="l"><a class="l" href="#638">638: </a> } |
</span><span id="639" class="l"><a class="l" href="#639">639: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$glob</span> <span class="php-keyword1">as</span> <span class="php-var">$fichier</span>) { |
</span><span id="640" class="l"><a class="l" href="#640">640: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_file</span>(<span class="php-var">$fichier</span>)) { |
</span><span id="641" class="l"><a class="l" href="#641">641: </a> <span class="php-var">$nom_fichier</span> = <span class="php-keyword2">basename</span>(<span class="php-var">$fichier</span>); |
</span><span id="642" class="l"><a class="l" href="#642">642: </a> <span class="php-var">$id</span> = <span class="php-var">$this</span>->transformerNomFichierEnId(<span class="php-var">$nom_fichier</span>); |
</span><span id="643" class="l"><a class="l" href="#643">643: </a> <span class="php-var">$metadonnees</span> = <span class="php-var">$this</span>->getMetadonneesFichier(<span class="php-var">$id</span>); |
</span><span id="644" class="l"><a class="l" href="#644">644: </a> <span class="php-keyword1">if</span> (<span class="php-var">$metadonnees</span> === <span class="php-keyword1">FALSE</span>) { |
</span><span id="645" class="l"><a class="l" href="#645">645: </a> <span class="php-keyword1">continue</span>; |
</span><span id="646" class="l"><a class="l" href="#646">646: </a> } |
</span><span id="647" class="l"><a class="l" href="#647">647: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">time</span>() > <span class="php-var">$metadonnees</span>[<span class="php-quote">'expiration'</span>]) { |
</span><span id="648" class="l"><a class="l" href="#648">648: </a> <span class="php-keyword1">continue</span>; |
</span><span id="649" class="l"><a class="l" href="#649">649: </a> } |
</span><span id="650" class="l"><a class="l" href="#650">650: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$mode</span>) { |
</span><span id="651" class="l"><a class="l" href="#651">651: </a> <span class="php-keyword1">case</span> <span class="php-quote">'ids'</span>: |
</span><span id="652" class="l"><a class="l" href="#652">652: </a> <span class="php-var">$resultat</span>[] = <span class="php-var">$id</span>; |
</span><span id="653" class="l"><a class="l" href="#653">653: </a> <span class="php-keyword1">break</span>; |
</span><span id="654" class="l"><a class="l" href="#654">654: </a> <span class="php-keyword1">case</span> <span class="php-quote">'tags'</span>: |
</span><span id="655" class="l"><a class="l" href="#655">655: </a> <span class="php-var">$resultat</span> = <span class="php-keyword2">array_unique</span>(<span class="php-keyword2">array_merge</span>(<span class="php-var">$resultat</span>, <span class="php-var">$metadonnees</span>[<span class="php-quote">'tags'</span>])); |
</span><span id="656" class="l"><a class="l" href="#656">656: </a> <span class="php-keyword1">break</span>; |
</span><span id="657" class="l"><a class="l" href="#657">657: </a> <span class="php-keyword1">case</span> <span class="php-quote">'matching'</span>: |
</span><span id="658" class="l"><a class="l" href="#658">658: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">true</span>; |
</span><span id="659" class="l"><a class="l" href="#659">659: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tags</span> <span class="php-keyword1">as</span> <span class="php-var">$tag</span>) { |
</span><span id="660" class="l"><a class="l" href="#660">660: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">in_array</span>(<span class="php-var">$tag</span>, <span class="php-var">$metadonnees</span>[<span class="php-quote">'tags'</span>])) { |
</span><span id="661" class="l"><a class="l" href="#661">661: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">false</span>; |
</span><span id="662" class="l"><a class="l" href="#662">662: </a> <span class="php-keyword1">break</span>; |
</span><span id="663" class="l"><a class="l" href="#663">663: </a> } |
</span><span id="664" class="l"><a class="l" href="#664">664: </a> } |
</span><span id="665" class="l"><a class="l" href="#665">665: </a> <span class="php-keyword1">if</span> (<span class="php-var">$correspondance</span>) { |
</span><span id="666" class="l"><a class="l" href="#666">666: </a> <span class="php-var">$resultat</span>[] = <span class="php-var">$id</span>; |
</span><span id="667" class="l"><a class="l" href="#667">667: </a> } |
</span><span id="668" class="l"><a class="l" href="#668">668: </a> <span class="php-keyword1">break</span>; |
</span><span id="669" class="l"><a class="l" href="#669">669: </a> <span class="php-keyword1">case</span> <span class="php-quote">'notMatching'</span>: |
</span><span id="670" class="l"><a class="l" href="#670">670: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">false</span>; |
</span><span id="671" class="l"><a class="l" href="#671">671: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tags</span> <span class="php-keyword1">as</span> <span class="php-var">$tag</span>) { |
</span><span id="672" class="l"><a class="l" href="#672">672: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">in_array</span>(<span class="php-var">$tag</span>, <span class="php-var">$metadonnees</span>[<span class="php-quote">'tags'</span>])) { |
</span><span id="673" class="l"><a class="l" href="#673">673: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">true</span>; |
</span><span id="674" class="l"><a class="l" href="#674">674: </a> <span class="php-keyword1">break</span>; |
</span><span id="675" class="l"><a class="l" href="#675">675: </a> } |
</span><span id="676" class="l"><a class="l" href="#676">676: </a> } |
</span><span id="677" class="l"><a class="l" href="#677">677: </a> <span class="php-keyword1">if</span> (!<span class="php-var">$correspondance</span>) { |
</span><span id="678" class="l"><a class="l" href="#678">678: </a> <span class="php-var">$resultat</span>[] = <span class="php-var">$id</span>; |
</span><span id="679" class="l"><a class="l" href="#679">679: </a> } |
</span><span id="680" class="l"><a class="l" href="#680">680: </a> <span class="php-keyword1">break</span>; |
</span><span id="681" class="l"><a class="l" href="#681">681: </a> <span class="php-keyword1">case</span> <span class="php-quote">'matchingAny'</span>: |
</span><span id="682" class="l"><a class="l" href="#682">682: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">false</span>; |
</span><span id="683" class="l"><a class="l" href="#683">683: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tags</span> <span class="php-keyword1">as</span> <span class="php-var">$tag</span>) { |
</span><span id="684" class="l"><a class="l" href="#684">684: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">in_array</span>(<span class="php-var">$tag</span>, <span class="php-var">$metadonnees</span>[<span class="php-quote">'tags'</span>])) { |
</span><span id="685" class="l"><a class="l" href="#685">685: </a> <span class="php-var">$correspondance</span> = <span class="php-keyword1">true</span>; |
</span><span id="686" class="l"><a class="l" href="#686">686: </a> <span class="php-keyword1">break</span>; |
</span><span id="687" class="l"><a class="l" href="#687">687: </a> } |
</span><span id="688" class="l"><a class="l" href="#688">688: </a> } |
</span><span id="689" class="l"><a class="l" href="#689">689: </a> <span class="php-keyword1">if</span> (<span class="php-var">$correspondance</span>) { |
</span><span id="690" class="l"><a class="l" href="#690">690: </a> <span class="php-var">$resultat</span>[] = <span class="php-var">$id</span>; |
</span><span id="691" class="l"><a class="l" href="#691">691: </a> } |
</span><span id="692" class="l"><a class="l" href="#692">692: </a> <span class="php-keyword1">break</span>; |
</span><span id="693" class="l"><a class="l" href="#693">693: </a> <span class="php-keyword1">default</span>: |
</span><span id="694" class="l"><a class="l" href="#694">694: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Mode invalide pour la méthode analyserCache()"</span>, E_USER_WARNING); |
</span><span id="695" class="l"><a class="l" href="#695">695: </a> <span class="php-keyword1">break</span>; |
</span><span id="696" class="l"><a class="l" href="#696">696: </a> } |
</span><span id="697" class="l"><a class="l" href="#697">697: </a> } |
</span><span id="698" class="l"><a class="l" href="#698">698: </a> <span class="php-keyword1">if</span> ((<span class="php-keyword2">is_dir</span>(<span class="php-var">$fichier</span>)) <span class="php-keyword1">and</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'dossier_niveau'</span>] > <span class="php-num">0</span>)) { |
</span><span id="699" class="l"><a class="l" href="#699">699: </a> <span class="php-comment">// Appel récursif</span> |
</span><span id="700" class="l"><a class="l" href="#700">700: </a> <span class="php-var">$resultat_analyse_recursive</span> = <span class="php-var">$this</span>->analyserCache(<span class="php-var">$fichier</span>.DS, <span class="php-var">$mode</span>, <span class="php-var">$tags</span>); |
</span><span id="701" class="l"><a class="l" href="#701">701: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat_analyse_recursive</span> === <span class="php-keyword1">false</span>) { |
</span><span id="702" class="l"><a class="l" href="#702">702: </a> <span class="php-comment">// TODO : ajoute un log</span> |
</span><span id="703" class="l"><a class="l" href="#703">703: </a> } <span class="php-keyword1">else</span> { |
</span><span id="704" class="l"><a class="l" href="#704">704: </a> <span class="php-var">$resultat</span> = <span class="php-keyword2">array_unique</span>(<span class="php-keyword2">array_merge</span>(<span class="php-var">$resultat</span>, <span class="php-var">$resultat_analyse_recursive</span>)); |
</span><span id="705" class="l"><a class="l" href="#705">705: </a> } |
</span><span id="706" class="l"><a class="l" href="#706">706: </a> } |
</span><span id="707" class="l"><a class="l" href="#707">707: </a> } |
</span><span id="708" class="l"><a class="l" href="#708">708: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">array_unique</span>(<span class="php-var">$resultat</span>); |
</span><span id="709" class="l"><a class="l" href="#709">709: </a> } |
</span><span id="710" class="l"><a class="l" href="#710">710: </a> |
</span><span id="711" class="l"><a class="l" href="#711">711: </a> <span class="php-comment">/** |
</span></span><span id="712" class="l"><a class="l" href="#712">712: </a><span class="php-comment"> * Make a control key with the string containing datas |
</span></span><span id="713" class="l"><a class="l" href="#713">713: </a><span class="php-comment"> * |
</span></span><span id="714" class="l"><a class="l" href="#714">714: </a><span class="php-comment"> * @param string $data Data |
</span></span><span id="715" class="l"><a class="l" href="#715">715: </a><span class="php-comment"> * @param string $controlType Type of control 'md5', 'crc32' or 'strlen' |
</span></span><span id="716" class="l"><a class="l" href="#716">716: </a><span class="php-comment"> * @throws Zend_Cache_Exception |
</span></span><span id="717" class="l"><a class="l" href="#717">717: </a><span class="php-comment"> * @return string Control key |
</span></span><span id="718" class="l"><a class="l" href="#718">718: </a><span class="php-comment"> */</span> |
</span><span id="719" class="l"><a class="l" href="#719">719: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_genererCleSecu" href="#_genererCleSecu">genererCleSecu</a>(<span class="php-var">$donnees</span>, <span class="php-var">$type_de_controle</span>) { |
</span><span id="720" class="l"><a class="l" href="#720">720: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$type_de_controle</span>) { |
</span><span id="721" class="l"><a class="l" href="#721">721: </a> <span class="php-keyword1">case</span> <span class="php-quote">'md5'</span>: |
</span><span id="722" class="l"><a class="l" href="#722">722: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">md5</span>(<span class="php-var">$donnees</span>); |
</span><span id="723" class="l"><a class="l" href="#723">723: </a> <span class="php-keyword1">case</span> <span class="php-quote">'crc32'</span>: |
</span><span id="724" class="l"><a class="l" href="#724">724: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">crc32</span>(<span class="php-var">$donnees</span>); |
</span><span id="725" class="l"><a class="l" href="#725">725: </a> <span class="php-keyword1">case</span> <span class="php-quote">'strlen'</span>: |
</span><span id="726" class="l"><a class="l" href="#726">726: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">strlen</span>(<span class="php-var">$donnees</span>); |
</span><span id="727" class="l"><a class="l" href="#727">727: </a> <span class="php-keyword1">case</span> <span class="php-quote">'adler32'</span>: |
</span><span id="728" class="l"><a class="l" href="#728">728: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">hash</span>(<span class="php-quote">'adler32'</span>, <span class="php-var">$donnees</span>); |
</span><span id="729" class="l"><a class="l" href="#729">729: </a> <span class="php-keyword1">default</span>: |
</span><span id="730" class="l"><a class="l" href="#730">730: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Fonction de génération de clé de sécurité introuvable : </span><span class="php-var">$type_de_controle</span><span class="php-quote">"</span>, E_USER_WARNING); |
</span><span id="731" class="l"><a class="l" href="#731">731: </a> } |
</span><span id="732" class="l"><a class="l" href="#732">732: </a> } |
</span><span id="733" class="l"><a class="l" href="#733">733: </a> |
</span><span id="734" class="l"><a class="l" href="#734">734: </a> <span class="php-comment">/** |
</span></span><span id="735" class="l"><a class="l" href="#735">735: </a><span class="php-comment"> * Transform a cache id into a file name and return it |
</span></span><span id="736" class="l"><a class="l" href="#736">736: </a><span class="php-comment"> * |
</span></span><span id="737" class="l"><a class="l" href="#737">737: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="738" class="l"><a class="l" href="#738">738: </a><span class="php-comment"> * @return string File name |
</span></span><span id="739" class="l"><a class="l" href="#739">739: </a><span class="php-comment"> */</span> |
</span><span id="740" class="l"><a class="l" href="#740">740: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_transformaterIdEnNomFichier" href="#_transformaterIdEnNomFichier">transformaterIdEnNomFichier</a>(<span class="php-var">$id</span>) { |
</span><span id="741" class="l"><a class="l" href="#741">741: </a> <span class="php-var">$prefixe</span> = <span class="php-var">$this</span>->options[<span class="php-quote">'fichier_prefixe'</span>]; |
</span><span id="742" class="l"><a class="l" href="#742">742: </a> <span class="php-var">$resultat</span> = <span class="php-var">$prefixe</span>.<span class="php-quote">'---'</span>.<span class="php-var">$id</span>; |
</span><span id="743" class="l"><a class="l" href="#743">743: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="744" class="l"><a class="l" href="#744">744: </a> } |
</span><span id="745" class="l"><a class="l" href="#745">745: </a> |
</span><span id="746" class="l"><a class="l" href="#746">746: </a> <span class="php-comment">/** |
</span></span><span id="747" class="l"><a class="l" href="#747">747: </a><span class="php-comment"> * Make and return a file name (with path) |
</span></span><span id="748" class="l"><a class="l" href="#748">748: </a><span class="php-comment"> * |
</span></span><span id="749" class="l"><a class="l" href="#749">749: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="750" class="l"><a class="l" href="#750">750: </a><span class="php-comment"> * @return string File name (with path) |
</span></span><span id="751" class="l"><a class="l" href="#751">751: </a><span class="php-comment"> */</span> |
</span><span id="752" class="l"><a class="l" href="#752">752: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getFichierNom" href="#_getFichierNom">getFichierNom</a>(<span class="php-var">$id</span>) { |
</span><span id="753" class="l"><a class="l" href="#753">753: </a> <span class="php-var">$path</span> = <span class="php-var">$this</span>->getChemin(<span class="php-var">$id</span>); |
</span><span id="754" class="l"><a class="l" href="#754">754: </a> <span class="php-var">$fileName</span> = <span class="php-var">$this</span>->transformaterIdEnNomFichier(<span class="php-var">$id</span>); |
</span><span id="755" class="l"><a class="l" href="#755">755: </a> <span class="php-keyword1">return</span> <span class="php-var">$path</span> . <span class="php-var">$fileName</span>; |
</span><span id="756" class="l"><a class="l" href="#756">756: </a> } |
</span><span id="757" class="l"><a class="l" href="#757">757: </a> |
</span><span id="758" class="l"><a class="l" href="#758">758: </a> <span class="php-comment">/** |
</span></span><span id="759" class="l"><a class="l" href="#759">759: </a><span class="php-comment"> * Return the complete directory path of a filename (including hashedDirectoryStructure) |
</span></span><span id="760" class="l"><a class="l" href="#760">760: </a><span class="php-comment"> * |
</span></span><span id="761" class="l"><a class="l" href="#761">761: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="762" class="l"><a class="l" href="#762">762: </a><span class="php-comment"> * @param boolean $decoupage if true, returns array of directory parts instead of single string |
</span></span><span id="763" class="l"><a class="l" href="#763">763: </a><span class="php-comment"> * @return string Complete directory path |
</span></span><span id="764" class="l"><a class="l" href="#764">764: </a><span class="php-comment"> */</span> |
</span><span id="765" class="l"><a class="l" href="#765">765: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getChemin" href="#_getChemin">getChemin</a>(<span class="php-var">$id</span>, <span class="php-var">$decoupage</span> = <span class="php-keyword1">false</span>) { |
</span><span id="766" class="l"><a class="l" href="#766">766: </a> <span class="php-var">$morceaux</span> = <span class="php-keyword1">array</span>(); |
</span><span id="767" class="l"><a class="l" href="#767">767: </a> <span class="php-var">$chemin</span> = <span class="php-var">$this</span>->options[<span class="php-quote">'stockage_chemin'</span>]; |
</span><span id="768" class="l"><a class="l" href="#768">768: </a> <span class="php-var">$prefixe</span> = <span class="php-var">$this</span>->options[<span class="php-quote">'fichier_prefixe'</span>]; |
</span><span id="769" class="l"><a class="l" href="#769">769: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'dossier_niveau'</span>] > <span class="php-num">0</span>) { |
</span><span id="770" class="l"><a class="l" href="#770">770: </a> <span class="php-var">$hash</span> = <span class="php-keyword2">hash</span>(<span class="php-quote">'adler32'</span>, <span class="php-var">$id</span>); |
</span><span id="771" class="l"><a class="l" href="#771">771: </a> <span class="php-keyword1">for</span> (<span class="php-var">$i</span> = <span class="php-num">0</span> ; <span class="php-var">$i</span> < <span class="php-var">$this</span>->options[<span class="php-quote">'dossier_niveau'</span>] ; <span class="php-var">$i</span>++) { |
</span><span id="772" class="l"><a class="l" href="#772">772: </a> <span class="php-var">$chemin</span> .= <span class="php-var">$prefixe</span>.<span class="php-quote">'--'</span>.<span class="php-keyword2">substr</span>(<span class="php-var">$hash</span>, <span class="php-num">0</span>, <span class="php-var">$i</span> + <span class="php-num">1</span>).DS; |
</span><span id="773" class="l"><a class="l" href="#773">773: </a> <span class="php-var">$morceaux</span>[] = <span class="php-var">$chemin</span>; |
</span><span id="774" class="l"><a class="l" href="#774">774: </a> } |
</span><span id="775" class="l"><a class="l" href="#775">775: </a> } |
</span><span id="776" class="l"><a class="l" href="#776">776: </a> <span class="php-keyword1">return</span> (<span class="php-var">$decoupage</span>) ? <span class="php-var">$morceaux</span> : <span class="php-var">$chemin</span>; |
</span><span id="777" class="l"><a class="l" href="#777">777: </a> } |
</span><span id="778" class="l"><a class="l" href="#778">778: </a> |
</span><span id="779" class="l"><a class="l" href="#779">779: </a> <span class="php-comment">/** |
</span></span><span id="780" class="l"><a class="l" href="#780">780: </a><span class="php-comment"> * Make the directory strucuture for the given id |
</span></span><span id="781" class="l"><a class="l" href="#781">781: </a><span class="php-comment"> * |
</span></span><span id="782" class="l"><a class="l" href="#782">782: </a><span class="php-comment"> * @param string $id cache id |
</span></span><span id="783" class="l"><a class="l" href="#783">783: </a><span class="php-comment"> * @return boolean true |
</span></span><span id="784" class="l"><a class="l" href="#784">784: </a><span class="php-comment"> */</span> |
</span><span id="785" class="l"><a class="l" href="#785">785: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_lancerMkdirEtChmodRecursif" href="#_lancerMkdirEtChmodRecursif">lancerMkdirEtChmodRecursif</a>(<span class="php-var">$id</span>) { |
</span><span id="786" class="l"><a class="l" href="#786">786: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="787" class="l"><a class="l" href="#787">787: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'dossier_niveau'</span>] > <span class="php-num">0</span>) { |
</span><span id="788" class="l"><a class="l" href="#788">788: </a> <span class="php-var">$chemins</span> = <span class="php-var">$this</span>->getChemin(<span class="php-var">$id</span>, <span class="php-keyword1">true</span>); |
</span><span id="789" class="l"><a class="l" href="#789">789: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$chemins</span> <span class="php-keyword1">as</span> <span class="php-var">$chemin</span>) { |
</span><span id="790" class="l"><a class="l" href="#790">790: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_dir</span>(<span class="php-var">$chemin</span>)) { |
</span><span id="791" class="l"><a class="l" href="#791">791: </a> @<span class="php-keyword2">mkdir</span>(<span class="php-var">$chemin</span>, <span class="php-var">$this</span>->options[<span class="php-quote">'dossier_umask'</span>]); |
</span><span id="792" class="l"><a class="l" href="#792">792: </a> @<span class="php-keyword2">chmod</span>(<span class="php-var">$chemin</span>, <span class="php-var">$this</span>->options[<span class="php-quote">'dossier_umask'</span>]); <span class="php-comment">// see #ZF-320 (this line is required in some configurations)</span> |
</span><span id="793" class="l"><a class="l" href="#793">793: </a> } |
</span><span id="794" class="l"><a class="l" href="#794">794: </a> } |
</span><span id="795" class="l"><a class="l" href="#795">795: </a> } |
</span><span id="796" class="l"><a class="l" href="#796">796: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="797" class="l"><a class="l" href="#797">797: </a> } |
</span><span id="798" class="l"><a class="l" href="#798">798: </a> |
</span><span id="799" class="l"><a class="l" href="#799">799: </a> <span class="php-comment">/** |
</span></span><span id="800" class="l"><a class="l" href="#800">800: </a><span class="php-comment"> * Test if the given cache id is available (and still valid as a cache record) |
</span></span><span id="801" class="l"><a class="l" href="#801">801: </a><span class="php-comment"> * |
</span></span><span id="802" class="l"><a class="l" href="#802">802: </a><span class="php-comment"> * @param string $id Cache id |
</span></span><span id="803" class="l"><a class="l" href="#803">803: </a><span class="php-comment"> * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested |
</span></span><span id="804" class="l"><a class="l" href="#804">804: </a><span class="php-comment"> * @return boolean|mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record |
</span></span><span id="805" class="l"><a class="l" href="#805">805: </a><span class="php-comment"> */</span> |
</span><span id="806" class="l"><a class="l" href="#806">806: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_testerExistenceCache" href="#_testerExistenceCache">testerExistenceCache</a>(<span class="php-var">$id</span>, <span class="php-var">$ne_pas_tester_validiter_du_cache</span>) { |
</span><span id="807" class="l"><a class="l" href="#807">807: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">false</span>; |
</span><span id="808" class="l"><a class="l" href="#808">808: </a> <span class="php-keyword1">if</span> (<span class="php-var">$metadonnees</span> = <span class="php-var">$this</span>->getMetadonnees(<span class="php-var">$id</span>)) { |
</span><span id="809" class="l"><a class="l" href="#809">809: </a> <span class="php-keyword1">if</span> (<span class="php-var">$ne_pas_tester_validiter_du_cache</span> || (<span class="php-keyword2">time</span>() <= <span class="php-var">$metadonnees</span>[<span class="php-quote">'expiration'</span>])) { |
</span><span id="810" class="l"><a class="l" href="#810">810: </a> <span class="php-var">$resultat</span> = <span class="php-var">$metadonnees</span>[<span class="php-quote">'mtime'</span>]; |
</span><span id="811" class="l"><a class="l" href="#811">811: </a> } |
</span><span id="812" class="l"><a class="l" href="#812">812: </a> } |
</span><span id="813" class="l"><a class="l" href="#813">813: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="814" class="l"><a class="l" href="#814">814: </a> } |
</span><span id="815" class="l"><a class="l" href="#815">815: </a> |
</span><span id="816" class="l"><a class="l" href="#816">816: </a> <span class="php-comment">/** |
</span></span><span id="817" class="l"><a class="l" href="#817">817: </a><span class="php-comment"> * Return the file content of the given file |
</span></span><span id="818" class="l"><a class="l" href="#818">818: </a><span class="php-comment"> * |
</span></span><span id="819" class="l"><a class="l" href="#819">819: </a><span class="php-comment"> * @param string $file File complete path |
</span></span><span id="820" class="l"><a class="l" href="#820">820: </a><span class="php-comment"> * @return string File content (or false if problem) |
</span></span><span id="821" class="l"><a class="l" href="#821">821: </a><span class="php-comment"> */</span> |
</span><span id="822" class="l"><a class="l" href="#822">822: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getContenuFichier" href="#_getContenuFichier">getContenuFichier</a>(<span class="php-var">$fichier</span>) { |
</span><span id="823" class="l"><a class="l" href="#823">823: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">false</span>; |
</span><span id="824" class="l"><a class="l" href="#824">824: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_file</span>(<span class="php-var">$fichier</span>)) { |
</span><span id="825" class="l"><a class="l" href="#825">825: </a> <span class="php-var">$f</span> = @<span class="php-keyword2">fopen</span>(<span class="php-var">$fichier</span>, <span class="php-quote">'rb'</span>); |
</span><span id="826" class="l"><a class="l" href="#826">826: </a> <span class="php-keyword1">if</span> (<span class="php-var">$f</span>) { |
</span><span id="827" class="l"><a class="l" href="#827">827: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'fichier_verrou'</span>]) @<span class="php-keyword2">flock</span>(<span class="php-var">$f</span>, LOCK_SH); |
</span><span id="828" class="l"><a class="l" href="#828">828: </a> <span class="php-var">$resultat</span> = <span class="php-keyword2">stream_get_contents</span>(<span class="php-var">$f</span>); |
</span><span id="829" class="l"><a class="l" href="#829">829: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'fichier_verrou'</span>]) @<span class="php-keyword2">flock</span>(<span class="php-var">$f</span>, LOCK_UN); |
</span><span id="830" class="l"><a class="l" href="#830">830: </a> @<span class="php-keyword2">fclose</span>(<span class="php-var">$f</span>); |
</span><span id="831" class="l"><a class="l" href="#831">831: </a> } |
</span><span id="832" class="l"><a class="l" href="#832">832: </a> } |
</span><span id="833" class="l"><a class="l" href="#833">833: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="834" class="l"><a class="l" href="#834">834: </a> } |
</span><span id="835" class="l"><a class="l" href="#835">835: </a> |
</span><span id="836" class="l"><a class="l" href="#836">836: </a> <span class="php-comment">/** |
</span></span><span id="837" class="l"><a class="l" href="#837">837: </a><span class="php-comment"> * Put the given string into the given file |
</span></span><span id="838" class="l"><a class="l" href="#838">838: </a><span class="php-comment"> * |
</span></span><span id="839" class="l"><a class="l" href="#839">839: </a><span class="php-comment"> * @param string $file File complete path |
</span></span><span id="840" class="l"><a class="l" href="#840">840: </a><span class="php-comment"> * @param string $string String to put in file |
</span></span><span id="841" class="l"><a class="l" href="#841">841: </a><span class="php-comment"> * @return boolean true if no problem |
</span></span><span id="842" class="l"><a class="l" href="#842">842: </a><span class="php-comment"> */</span> |
</span><span id="843" class="l"><a class="l" href="#843">843: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_setContenuFichier" href="#_setContenuFichier">setContenuFichier</a>(<span class="php-var">$fichier</span>, <span class="php-var">$chaine</span>) { |
</span><span id="844" class="l"><a class="l" href="#844">844: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">false</span>; |
</span><span id="845" class="l"><a class="l" href="#845">845: </a> <span class="php-var">$f</span> = @<span class="php-keyword2">fopen</span>(<span class="php-var">$fichier</span>, <span class="php-quote">'ab+'</span>); |
</span><span id="846" class="l"><a class="l" href="#846">846: </a> <span class="php-keyword1">if</span> (<span class="php-var">$f</span>) { |
</span><span id="847" class="l"><a class="l" href="#847">847: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->options[<span class="php-quote">'fichier_verrou'</span>]) @<span class="php-keyword2">flock</span>(<span class="php-var">$f</span>, LOCK_EX); |
</span><span id="848" class="l"><a class="l" href="#848">848: </a> <span class="php-keyword2">fseek</span>(<span class="php-var">$f</span>, <span class="php-num">0</span>); |
</span><span id="849" class="l"><a class="l" href="#849">849: </a> <span class="php-keyword2">ftruncate</span>(<span class="php-var">$f</span>, <span class="php-num">0</span>); |
</span><span id="850" class="l"><a class="l" href="#850">850: </a> <span class="php-var">$tmp</span> = @<span class="php-keyword2">fwrite</span>(<span class="php-var">$f</span>, <span class="php-var">$chaine</span>); |
</span><span id="851" class="l"><a class="l" href="#851">851: </a> <span class="php-keyword1">if</span> (!(<span class="php-var">$tmp</span> === <span class="php-keyword1">FALSE</span>)) { |
</span><span id="852" class="l"><a class="l" href="#852">852: </a> <span class="php-var">$resultat</span> = <span class="php-keyword1">true</span>; |
</span><span id="853" class="l"><a class="l" href="#853">853: </a> } |
</span><span id="854" class="l"><a class="l" href="#854">854: </a> @<span class="php-keyword2">fclose</span>(<span class="php-var">$f</span>); |
</span><span id="855" class="l"><a class="l" href="#855">855: </a> } |
</span><span id="856" class="l"><a class="l" href="#856">856: </a> @<span class="php-keyword2">chmod</span>(<span class="php-var">$fichier</span>, <span class="php-var">$this</span>->options[<span class="php-quote">'fichier_umask'</span>]); |
</span><span id="857" class="l"><a class="l" href="#857">857: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="858" class="l"><a class="l" href="#858">858: </a> } |
</span><span id="859" class="l"><a class="l" href="#859">859: </a> |
</span><span id="860" class="l"><a class="l" href="#860">860: </a> <span class="php-comment">/** |
</span></span><span id="861" class="l"><a class="l" href="#861">861: </a><span class="php-comment"> * Transform a file name into cache id and return it |
</span></span><span id="862" class="l"><a class="l" href="#862">862: </a><span class="php-comment"> * |
</span></span><span id="863" class="l"><a class="l" href="#863">863: </a><span class="php-comment"> * @param string $fileName File name |
</span></span><span id="864" class="l"><a class="l" href="#864">864: </a><span class="php-comment"> * @return string Cache id |
</span></span><span id="865" class="l"><a class="l" href="#865">865: </a><span class="php-comment"> */</span> |
</span><span id="866" class="l"><a class="l" href="#866">866: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_transformerNomFichierEnId" href="#_transformerNomFichierEnId">transformerNomFichierEnId</a>(<span class="php-var">$nom_de_fichier</span>) { |
</span><span id="867" class="l"><a class="l" href="#867">867: </a> <span class="php-var">$prefixe</span> = <span class="php-var">$this</span>->options[<span class="php-quote">'fichier_prefixe'</span>]; |
</span><span id="868" class="l"><a class="l" href="#868">868: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">preg_replace</span>(<span class="php-quote">'~^'</span> . <span class="php-var">$prefixe</span> . <span class="php-quote">'---(.*)$~'</span>, <span class="php-quote">'$1'</span>, <span class="php-var">$nom_de_fichier</span>); |
</span><span id="869" class="l"><a class="l" href="#869">869: </a> } |
</span><span id="870" class="l"><a class="l" href="#870">870: </a>} |
</span><span id="871" class="l"><a class="l" href="#871">871: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-CacheFichier.html |
---|
New file |
0,0 → 1,1812 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class CacheFichier | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li class="active"><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li class="active"><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li><a href="class-MonScript.html">MonScript</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-None.html" title="Summary of None"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class CacheFichier</h1> |
<div class="info"> |
<b>Located at</b> <a href="source-class-CacheFichier.html#2-870" title="Go to source code">framework/CacheFichier.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="__construct" id="___construct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___construct">#</a> |
<code><a href="source-class-CacheFichier.html#73-101" title="Go to source code">__construct</a>( <span>array <var>$options</var> = <span class="php-keyword1">array</span>()</span>, <span><code><a href="class-Cache.html">Cache</a></code> <var>$cache</var></span> )</code> |
<div class="description short"> |
<p>Constructor</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constructor</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$options</var></dt> |
<dd><code>array</code><br>$options associative array of options</dd> |
<dt><var>$cache</var></dt> |
<dd></dd> |
</dl></div> |
<h4>Throws</h4> |
<div class="list"> |
<code>Zend_Cache_Exception</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="setEmplacement" id="_setEmplacement"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setEmplacement">#</a> |
<code><a href="source-class-CacheFichier.html#123-132" title="Go to source code">setEmplacement</a>( <span>mixed <var>$emplacement</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="charger" id="_charger"> |
<td class="attributes"><code> |
public |
string|false |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_charger">#</a> |
<code><a href="source-class-CacheFichier.html#134-159" title="Go to source code">charger</a>( <span>string <var>$id</var></span>, <span>boolean <var>$ne_pas_tester_validiter_du_cache</var> = <span class="php-keyword1">false</span></span> )</code> |
<div class="description short"> |
<p>Test if a cache is available for the given id and (if yes) return it (false |
else)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Test if a cache is available for the given id and (if yes) return it (false |
else)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id cache id</dd> |
<dt><var>$ne_pas_tester_validiter_du_cache</var></dt> |
<dd><code>boolean</code><br>$doNotTestCacheValidity if set to true, the cache validity won't be tested</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string|false</code><br>cached datas<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="tester" id="_tester"> |
<td class="attributes"><code> |
public |
mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_tester">#</a> |
<code><a href="source-class-CacheFichier.html#161-170" title="Go to source code">tester</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Teste si un enregistrement en cache est disponible ou pas (pour l'id passé |
en paramètre).</p> |
</div> |
<div class="description detailed hidden"> |
<p>Teste si un enregistrement en cache est disponible ou pas (pour l'id passé |
en paramètre).</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id identifiant de cache.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed</code><br>false (le cache n'est pas disponible) ou timestamp (int) "de dernière |
modification" de l'enregistrement en cache<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="sauver" id="_sauver"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_sauver">#</a> |
<code><a href="source-class-CacheFichier.html#172-221" title="Go to source code">sauver</a>( <span>string <var>$donnees</var></span>, <span>string <var>$id</var></span>, <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span>, <span>integer <var>$duree_vie_specifique</var> = <span class="php-keyword1">false</span></span> )</code> |
<div class="description short"> |
<p>Save some string datas into a cache record</p> |
</div> |
<div class="description detailed hidden"> |
<p>Save some string datas into a cache record</p> |
<p>Note : $data is always "string" (serialization is done by the core not by the |
backend)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$donnees</var></dt> |
<dd><code>string</code><br>$data Datas to cache</dd> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags Array of strings, the cache record will be tagged by each string entry</dd> |
<dt><var>$duree_vie_specifique</var></dt> |
<dd><code>integer</code><br>$specificLifetime If != false, set a specific lifetime for this cache record |
(null => infinite lifetime)</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true if no problem<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="supprimer" id="_supprimer"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_supprimer">#</a> |
<code><a href="source-class-CacheFichier.html#223-234" title="Go to source code">supprimer</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Remove a cache record</p> |
</div> |
<div class="description detailed hidden"> |
<p>Remove a cache record</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true if no problem<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="nettoyer" id="_nettoyer"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_nettoyer">#</a> |
<code><a href="source-class-CacheFichier.html#236-257" title="Go to source code">nettoyer</a>( <span>string <var>$mode</var> = <code><a href="class-Cache.html#NETTOYAGE_MODE_TOUS">Cache::<b>NETTOYAGE_MODE_TOUS</b></a></code></span>, <span>tags <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Clean some cache records</p> |
</div> |
<div class="description detailed hidden"> |
<p>Clean some cache records</p> |
<p>Available modes are : 'all' (default) => remove all cache entries ($tags |
is not used) 'old' => remove too old cache entries ($tags is not used) |
'matchingTag' => remove cache entries matching all given tags ($tags can be |
an array of strings or a single string) 'notMatchingTag' => remove cache |
entries not matching one of the given tags ($tags can be an array of strings or |
a single string) 'matchingAnyTag' => remove cache entries matching any given |
tags ($tags can be an array of strings or a single string)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$mode</var></dt> |
<dd><code>string</code><br>$mode clean mode</dd> |
<dt><var>$tags</var></dt> |
<dd><code>tags</code><br>array $tags array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true if no problem<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIds" id="_getIds"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIds">#</a> |
<code><a href="source-class-CacheFichier.html#259-266" title="Go to source code">getIds</a>( )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of stored cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getTags" id="_getTags"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getTags">#</a> |
<code><a href="source-class-CacheFichier.html#268-275" title="Go to source code">getTags</a>( )</code> |
<div class="description short"> |
<p>Return an array of stored tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored tags</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of stored tags (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIdsAvecLesTags" id="_getIdsAvecLesTags"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIdsAvecLesTags">#</a> |
<code><a href="source-class-CacheFichier.html#277-287" title="Go to source code">getIdsAvecLesTags</a>( <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids which match given tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids which match given tags</p> |
<p>In case of multiple tags, a logical AND is made between tags</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of matching cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIdsSansLesTags" id="_getIdsSansLesTags"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIdsSansLesTags">#</a> |
<code><a href="source-class-CacheFichier.html#289-299" title="Go to source code">getIdsSansLesTags</a>( <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids which don't match given tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids which don't match given tags</p> |
<p>In case of multiple tags, a logical OR is made between tags</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of not matching cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIdsAvecUnTag" id="_getIdsAvecUnTag"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIdsAvecUnTag">#</a> |
<code><a href="source-class-CacheFichier.html#301-311" title="Go to source code">getIdsAvecUnTag</a>( <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids which match any given tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids which match any given tags</p> |
<p>In case of multiple tags, a logical AND is made between tags</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of any matching cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getPourcentageRemplissage" id="_getPourcentageRemplissage"> |
<td class="attributes"><code> |
public |
integer |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getPourcentageRemplissage">#</a> |
<code><a href="source-class-CacheFichier.html#313-330" title="Go to source code">getPourcentageRemplissage</a>( )</code> |
<div class="description short"> |
<p>Return the filling percentage of the backend storage</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return the filling percentage of the backend storage</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>integer</code><br>integer between 0 and 100<br> |
</div> |
<h4>Throws</h4> |
<div class="list"> |
<code>Zend_Cache_Exception</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getMetadonnees" id="_getMetadonnees"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getMetadonnees">#</a> |
<code><a href="source-class-CacheFichier.html#332-357" title="Go to source code">getMetadonnees</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Return an array of metadatas for the given cache id</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of metadatas for the given cache id</p> |
<p>The array must include these keys :</p> |
<ul> |
<li>expire : the expire timestamp</li> |
<li>tags : a string array of tags</li> |
<li>mtime : timestamp of last modification time</li> |
</ul> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of metadatas (false if the cache id is not found)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="ajouterSupplementDureeDeVie" id="_ajouterSupplementDureeDeVie"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_ajouterSupplementDureeDeVie">#</a> |
<code><a href="source-class-CacheFichier.html#359-382" title="Go to source code">ajouterSupplementDureeDeVie</a>( <span>string <var>$id</var></span>, <span>integer <var>$supplement_duree_de_vie</var></span> )</code> |
<div class="description short"> |
<p>Give (if possible) an extra lifetime to the given cache id</p> |
</div> |
<div class="description detailed hidden"> |
<p>Give (if possible) an extra lifetime to the given cache id</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id cache id</dd> |
<dt><var>$supplement_duree_de_vie</var></dt> |
<dd><code>integer</code><br>$extraLifetime</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true if ok<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getMetadonneesFichier" id="_getMetadonneesFichier"> |
<td class="attributes"><code> |
protected |
array|false |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getMetadonneesFichier">#</a> |
<code><a href="source-class-CacheFichier.html#384-400" title="Go to source code">getMetadonneesFichier</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Get a metadatas record</p> |
</div> |
<div class="description detailed hidden"> |
<p>Get a metadatas record</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array|false</code><br>Associative array of metadatas<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="setMetadonnees" id="_setMetadonnees"> |
<td class="attributes"><code> |
protected |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setMetadonnees">#</a> |
<code><a href="source-class-CacheFichier.html#402-424" title="Go to source code">setMetadonnees</a>( <span>string <var>$id</var></span>, <span>array <var>$metadonnees</var></span>, <span>boolean <var>$sauvegarde</var> = <span class="php-keyword1">true</span></span> )</code> |
<div class="description short"> |
<p>Set a metadatas record</p> |
</div> |
<div class="description detailed hidden"> |
<p>Set a metadatas record</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
<dt><var>$metadonnees</var></dt> |
<dd><code>array</code><br>$metadatas Associative array of metadatas</dd> |
<dt><var>$sauvegarde</var></dt> |
<dd><code>boolean</code><br>$save optional pass false to disable saving to file</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True if no problem<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="supprimerMetadonnees" id="_supprimerMetadonnees"> |
<td class="attributes"><code> |
protected |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_supprimerMetadonnees">#</a> |
<code><a href="source-class-CacheFichier.html#426-438" title="Go to source code">supprimerMetadonnees</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Drop a metadata record</p> |
</div> |
<div class="description detailed hidden"> |
<p>Drop a metadata record</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True if no problem<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="nettoyerMetadonnees" id="_nettoyerMetadonnees"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_nettoyerMetadonnees">#</a> |
<code><a href="source-class-CacheFichier.html#440-447" title="Go to source code">nettoyerMetadonnees</a>( )</code> |
<div class="description short"> |
<p>Clear the metadatas array</p> |
</div> |
<div class="description detailed hidden"> |
<p>Clear the metadatas array</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="chargerMetadonnees" id="_chargerMetadonnees"> |
<td class="attributes"><code> |
protected |
array|false |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_chargerMetadonnees">#</a> |
<code><a href="source-class-CacheFichier.html#449-461" title="Go to source code">chargerMetadonnees</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Load metadatas from disk</p> |
</div> |
<div class="description detailed hidden"> |
<p>Load metadatas from disk</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array|false</code><br>Metadatas associative array<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="sauverMetadonnees" id="_sauverMetadonnees"> |
<td class="attributes"><code> |
protected |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_sauverMetadonnees">#</a> |
<code><a href="source-class-CacheFichier.html#463-474" title="Go to source code">sauverMetadonnees</a>( <span>string <var>$id</var></span>, <span>array <var>$metadonnees</var></span> )</code> |
<div class="description short"> |
<p>Save metadatas to disk</p> |
</div> |
<div class="description detailed hidden"> |
<p>Save metadatas to disk</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
<dt><var>$metadonnees</var></dt> |
<dd><code>array</code><br>$metadatas Associative array</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True if no problem<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getNomFichierMeta" id="_getNomFichierMeta"> |
<td class="attributes"><code> |
protected |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getNomFichierMeta">#</a> |
<code><a href="source-class-CacheFichier.html#476-486" title="Go to source code">getNomFichierMeta</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Make and return a file name (with path) for metadatas</p> |
</div> |
<div class="description detailed hidden"> |
<p>Make and return a file name (with path) for metadatas</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>Metadatas file name (with path)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="etreFichierMeta" id="_etreFichierMeta"> |
<td class="attributes"><code> |
protected |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_etreFichierMeta">#</a> |
<code><a href="source-class-CacheFichier.html#488-497" title="Go to source code">etreFichierMeta</a>( <span>string <var>$fichier_nom</var></span> )</code> |
<div class="description short"> |
<p>Check if the given filename is a metadatas one</p> |
</div> |
<div class="description detailed hidden"> |
<p>Check if the given filename is a metadatas one</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$fichier_nom</var></dt> |
<dd><code>string</code><br>$fileName File name</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True if it's a metadatas one<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="supprimerFichier" id="_supprimerFichier"> |
<td class="attributes"><code> |
protected |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_supprimerFichier">#</a> |
<code><a href="source-class-CacheFichier.html#499-516" title="Go to source code">supprimerFichier</a>( <span>string <var>$fichier</var></span> )</code> |
<div class="description short"> |
<p>Remove a file</p> |
</div> |
<div class="description detailed hidden"> |
<p>Remove a file</p> |
<p>If we can't remove the file (because of locks or any problem), we will touch |
the file to invalidate it</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$fichier</var></dt> |
<dd><code>string</code><br>$file Complete file path</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True if ok<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="nettoyerFichiers" id="_nettoyerFichiers"> |
<td class="attributes"><code> |
protected |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_nettoyerFichiers">#</a> |
<code><a href="source-class-CacheFichier.html#518-626" title="Go to source code">nettoyerFichiers</a>( <span>string <var>$dossier</var></span>, <span>string <var>$mode</var> = <code><a href="class-Cache.html#NETTOYAGE_MODE_TOUS">Cache::<b>NETTOYAGE_MODE_TOUS</b></a></code></span>, <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Clean some cache records (protected method used for recursive stuff)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Clean some cache records (protected method used for recursive stuff)</p> |
<p>Available modes are : Zend_Cache::CLEANING_MODE_ALL (default) => remove |
all cache entries ($tags is not used) Zend_Cache::CLEANING_MODE_OLD => remove |
too old cache entries ($tags is not used) Zend_Cache::CLEANING_MODE_MATCHING_TAG |
=> remove cache entries matching all given tags ($tags can be an array of |
strings or a single string) Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => |
remove cache entries not {matching one of the given tags} ($tags can be an array |
of strings or a single string) Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => |
remove cache entries matching any given tags ($tags can be an array of strings |
or a single string)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$dossier</var></dt> |
<dd><code>string</code><br>$dir Directory to clean</dd> |
<dt><var>$mode</var></dt> |
<dd><code>string</code><br>$mode Clean mode</dd> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags Array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True if no problem<br> |
</div> |
<h4>Throws</h4> |
<div class="list"> |
<code>Zend_Cache_Exception</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="analyserCache" id="_analyserCache"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_analyserCache">#</a> |
<code><a href="source-class-CacheFichier.html#628-709" title="Go to source code">analyserCache</a>( <span>mixed <var>$dossier</var></span>, <span>mixed <var>$mode</var></span>, <span>mixed <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="genererCleSecu" id="_genererCleSecu"> |
<td class="attributes"><code> |
protected |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_genererCleSecu">#</a> |
<code><a href="source-class-CacheFichier.html#711-732" title="Go to source code">genererCleSecu</a>( <span>string <var>$donnees</var></span>, <span>string <var>$type_de_controle</var></span> )</code> |
<div class="description short"> |
<p>Make a control key with the string containing datas</p> |
</div> |
<div class="description detailed hidden"> |
<p>Make a control key with the string containing datas</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$donnees</var></dt> |
<dd><code>string</code><br>$data Data</dd> |
<dt><var>$type_de_controle</var></dt> |
<dd><code>string</code><br>$controlType Type of control 'md5', 'crc32' or 'strlen'</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>Control key<br> |
</div> |
<h4>Throws</h4> |
<div class="list"> |
<code>Zend_Cache_Exception</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="transformaterIdEnNomFichier" id="_transformaterIdEnNomFichier"> |
<td class="attributes"><code> |
protected |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_transformaterIdEnNomFichier">#</a> |
<code><a href="source-class-CacheFichier.html#734-744" title="Go to source code">transformaterIdEnNomFichier</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Transform a cache id into a file name and return it</p> |
</div> |
<div class="description detailed hidden"> |
<p>Transform a cache id into a file name and return it</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>File name<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getFichierNom" id="_getFichierNom"> |
<td class="attributes"><code> |
protected |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getFichierNom">#</a> |
<code><a href="source-class-CacheFichier.html#746-756" title="Go to source code">getFichierNom</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Make and return a file name (with path)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Make and return a file name (with path)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>File name (with path)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getChemin" id="_getChemin"> |
<td class="attributes"><code> |
protected |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getChemin">#</a> |
<code><a href="source-class-CacheFichier.html#758-777" title="Go to source code">getChemin</a>( <span>string <var>$id</var></span>, <span>boolean <var>$decoupage</var> = <span class="php-keyword1">false</span></span> )</code> |
<div class="description short"> |
<p>Return the complete directory path of a filename (including |
hashedDirectoryStructure)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return the complete directory path of a filename (including |
hashedDirectoryStructure)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
<dt><var>$decoupage</var></dt> |
<dd><code>boolean</code><br>$decoupage if true, returns array of directory parts instead of single string</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>Complete directory path<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="lancerMkdirEtChmodRecursif" id="_lancerMkdirEtChmodRecursif"> |
<td class="attributes"><code> |
protected |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_lancerMkdirEtChmodRecursif">#</a> |
<code><a href="source-class-CacheFichier.html#779-797" title="Go to source code">lancerMkdirEtChmodRecursif</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Make the directory strucuture for the given id</p> |
</div> |
<div class="description detailed hidden"> |
<p>Make the directory strucuture for the given id</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="testerExistenceCache" id="_testerExistenceCache"> |
<td class="attributes"><code> |
protected |
boolean|mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_testerExistenceCache">#</a> |
<code><a href="source-class-CacheFichier.html#799-814" title="Go to source code">testerExistenceCache</a>( <span>string <var>$id</var></span>, <span>boolean <var>$ne_pas_tester_validiter_du_cache</var></span> )</code> |
<div class="description short"> |
<p>Test if the given cache id is available (and still valid as a cache |
record)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Test if the given cache id is available (and still valid as a cache |
record)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
<dt><var>$ne_pas_tester_validiter_du_cache</var></dt> |
<dd><code>boolean</code><br>$doNotTestCacheValidity If set to true, the cache validity won't be tested</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean|mixed</code><br>false (a cache is not available) or "last modified" timestamp (int) of the |
available cache record<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getContenuFichier" id="_getContenuFichier"> |
<td class="attributes"><code> |
protected |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getContenuFichier">#</a> |
<code><a href="source-class-CacheFichier.html#816-834" title="Go to source code">getContenuFichier</a>( <span>string <var>$fichier</var></span> )</code> |
<div class="description short"> |
<p>Return the file content of the given file</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return the file content of the given file</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$fichier</var></dt> |
<dd><code>string</code><br>$file File complete path</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>File content (or false if problem)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="setContenuFichier" id="_setContenuFichier"> |
<td class="attributes"><code> |
protected |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setContenuFichier">#</a> |
<code><a href="source-class-CacheFichier.html#836-858" title="Go to source code">setContenuFichier</a>( <span>string <var>$fichier</var></span>, <span>string <var>$chaine</var></span> )</code> |
<div class="description short"> |
<p>Put the given string into the given file</p> |
</div> |
<div class="description detailed hidden"> |
<p>Put the given string into the given file</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$fichier</var></dt> |
<dd><code>string</code><br>$file File complete path</dd> |
<dt><var>$chaine</var></dt> |
<dd><code>string</code><br>$string String to put in file</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true if no problem<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="transformerNomFichierEnId" id="_transformerNomFichierEnId"> |
<td class="attributes"><code> |
protected |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_transformerNomFichierEnId">#</a> |
<code><a href="source-class-CacheFichier.html#860-869" title="Go to source code">transformerNomFichierEnId</a>( <span>string <var>$nom_de_fichier</var></span> )</code> |
<div class="description short"> |
<p>Transform a file name into cache id and return it</p> |
</div> |
<div class="description detailed hidden"> |
<p>Transform a file name into cache id and return it</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$nom_de_fichier</var></dt> |
<dd><code>string</code><br>$fileName File name</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>Cache id<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr data-order="options" id="$options"> |
<td class="attributes"><code> |
protected |
array |
</code></td> |
<td class="name"> |
<a href="source-class-CacheFichier.html#3-62" title="Go to source code"><var>$options</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">array</span>( |
<span class="php-quote">'stockage_chemin'</span> => <span class="php-keyword1">null</span>, |
<span class="php-quote">'fichier_verrou'</span> => <span class="php-keyword1">true</span>, |
<span class="php-quote">'controle_lecture'</span> => <span class="php-keyword1">true</span>, |
<span class="php-quote">'controle_lecture_type'</span> => <span class="php-quote">'crc32'</span>, |
<span class="php-quote">'dossier_niveau'</span> => <span class="php-num">0</span>, |
<span class="php-quote">'dossier_umask'</span> => <span class="php-num">0700</span>, |
<span class="php-quote">'fichier_prefixe'</span> => <span class="php-quote">'tbf'</span>, |
<span class="php-quote">'fichier_umask'</span> => <span class="php-num">0600</span>, |
<span class="php-quote">'metadonnees_max_taille'</span> => <span class="php-num">100</span> |
)</code></td> |
<td class="description"><div> |
<a href="#$options" class="anchor">#</a> |
<div class="description short"> |
<p>Options disponibles</p> |
</div> |
<div class="description detailed hidden"> |
<p>Options disponibles</p> |
<h2>> (string) stockage_chemin :</h2> |
<p>Chemin vers le dossier devant contenir l'arborescence du cache.</p> |
<h1>> (boolean) fichier_verrou :</h1> |
<ul> |
<li>Active / Désactive le verrouillage des fichiers</li> |
<li>Peut éviter la corruption du cache dans de mauvaises circonstances, mais |
cela ne fonctionne pas sur des serveur</li> |
</ul> |
<p>multithread et sur les systèmes de fichiers NFS par exemple.</p> |
<h1>> (boolean) controle_lecture :</h1> |
<ul> |
<li>Activer / désactiver le contrôle de lecture</li> |
<li>S'il est activé, une clé de contrôle est ajoutée dans le fichier de |
cache et cette clé est comparée avec celle calculée</li> |
</ul> |
<p>après la lecture.</p> |
<h1>> (string) controle_lecture_type :</h1> |
<p>Type de contrôle de lecture (seulement si le contrôle de lecture est |
activé). Les valeurs disponibles sont:</p> |
<ul> |
<li>«md5» pour un contrôle md5 (le meilleur mais le plus lent)</li> |
<li>«crc32» pour un contrôle de hachage crc32 (un peu moins sécurisé, mais |
plus rapide, un meilleur choix)</li> |
<li>«adler32» pour un contrôle de hachage adler32 (excellent choix aussi, |
plus rapide que crc32)</li> |
<li>«strlen» pour un test de longueur uniquement (le plus rapide)</li> |
</ul> |
<h1>> (int) dossier_niveau :</h1> |
<ul> |
<li>Permet de réglez le nombre de niveau de sous-dossier que contiendra |
l'arborescence des dossiers du cache.</li> |
</ul> |
<p>0 signifie "pas de sous-dossier pour le cache", 1 signifie "un niveau de |
sous-dossier", 2 signifie "deux niveaux" ... Cette option peut accélérer le |
cache seulement lorsque vous avez plusieurs centaines de fichiers de cache. |
Seuls des tests spécifiques peuvent vous aider à choisir la meilleure valeur |
possible pour vous. 1 ou 2 peut être est un bon début.</p> |
<h1>> (int) dossier_umask :</h1> |
<ul> |
<li>Umask pour les sous-dossiers de l'arborescence du cache.</li> |
</ul> |
<h1>> (string) fichier_prefixe :</h1> |
<ul> |
<li>préfixe pour les fichiers du cache</li> |
<li>ATTENTION : faite vraiment attention avec cette option, car une valeur trop |
générique dans le dossier cache du système</li> |
</ul> |
<p>(comme /tmp) peut provoquer des catastrophes lors du nettoyage du cache.</p> |
<h1>> (int) fichier_umask :</h1> |
<ul> |
<li>Umask pour les fichiers de cache</li> |
</ul> |
<h1>> (int) metadonnees_max_taille :</h1> |
<ul> |
<li>taille maximum pour le tableau de métadonnées du cache (ne changer pas |
cette valeur sauf si vous savez ce que vous faite)</li> |
</ul> |
</div> |
</div></td> |
</tr> |
<tr data-order="metadonnees" id="$metadonnees"> |
<td class="attributes"><code> |
protected |
array |
</code></td> |
<td class="name"> |
<a href="source-class-CacheFichier.html#64-69" title="Go to source code"><var>$metadonnees</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">array</span>()</code></td> |
<td class="description"><div> |
<a href="#$metadonnees" class="anchor">#</a> |
<div class="description short"> |
<p>Array of metadatas (each item is an associative array)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Array of metadatas (each item is an associative array)</p> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Url.html |
---|
New file |
0,0 → 1,698 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Url | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li class="active"><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Url</h1> |
<div class="description"> |
<p>Classe Url, gérant le découpage des paramètres, leurs modification etc... |
Traduction et conversion d'une classe (NET_Url2) issue de Pear</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
Php 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL</a><br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL</a><br> |
<b>Author:</b> |
Christian SCHMIDT <<a |
href="mailto:schmidt@php.net">schmidt@<!-- -->php.net</a>> (Auteur |
classe originale)<br> |
<b>Author:</b> |
Aurélien PERONNET <<a |
href="mailto:aurelien@tela-botanica.org">aurelien@<!-- -->tela-botanica.org</a>><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
SVN: $Id: Url.php 405 2012-02-22 15:45:39Z gduche $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Url.html#3-425" title="Go to source code">framework/Url.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="__construct" id="___construct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___construct">#</a> |
<code><a href="source-class-Url.html#97-134" title="Go to source code">__construct</a>( <span>string <var>$url</var></span>, <span>array <var>$options</var> = <span class="php-keyword1">null</span></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$url</var></dt> |
<dd><code>string</code><br>$url une URL relative ou absolue</dd> |
<dt><var>$options</var></dt> |
<dd><code>array</code><br>$options</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getOption" id="_getOption"> |
<td class="attributes"><code> |
public |
mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getOption">#</a> |
<code><a href="source-class-Url.html#136-145" title="Go to source code">getOption</a>( <span>string <var>$nomOption</var></span> )</code> |
<div class="description short"> |
<p>Renvoie la valeur de l'option specifiée.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Renvoie la valeur de l'option specifiée.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$nomOption</var></dt> |
<dd><code>string</code><br>$nomOption Nom de l'option demandée</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="setOption" id="_setOption"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setOption">#</a> |
<code><a href="source-class-Url.html#147-163" title="Go to source code">setOption</a>( <span>string <var>$nomOption</var></span>, <span>mixed <var>$valeur</var></span> )</code> |
<div class="description short"> |
<p>Met à jour la valeur de l'option spécifiée.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Met à jour la valeur de l'option spécifiée.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$nomOption</var></dt> |
<dd><code>string</code><br>$nomOption une des constantes commençant par self::OPTION_</dd> |
<dt><var>$valeur</var></dt> |
<dd><code>mixed</code><br>$valeur valeur de l'option</dd> |
</dl></div> |
<h4>See</h4> |
<div class="list"> |
self::OPTION_STRICTE<br> |
<code><code><a href="class-Url.html#OPTION_UTILISER_CROCHETS">Url::<b>OPTION_UTILISER_CROCHETS</b></a></code></code><br> |
<code><code><a href="class-Url.html#OPTION_ENCODER_CLES">Url::<b>OPTION_ENCODER_CLES</b></a></code></code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="setRequete" id="_setRequete"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setRequete">#</a> |
<code><a href="source-class-Url.html#264-299" title="Go to source code">setRequete</a>( <span>array <var>$parametres</var></span> )</code> |
<div class="description short"> |
<p>(Re-)Création de la partie requête de l'URL à partir des données du |
tableau (passé en paramètre).</p> |
</div> |
<div class="description detailed hidden"> |
<p>(Re-)Création de la partie requête de l'URL à partir des données du |
tableau (passé en paramètre).</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$parametres</var></dt> |
<dd><code>array</code><br>(nom => valeur) tableau de clés & valeurs pour la partie requête de |
l'url.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code></code><br>(Re-)Création de la partie requête.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="fusionnerRequete" id="_fusionnerRequete"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_fusionnerRequete">#</a> |
<code><a href="source-class-Url.html#301-313" title="Go to source code">fusionnerRequete</a>( <span>array <var>$parametres</var></span> )</code> |
<div class="description short"> |
<p>(Re-)Création de la partie requête de l'URL à partir de la fusion du |
tableau (passé en paramètre) et les valeurs présentes dans $_GET.</p> |
</div> |
<div class="description detailed hidden"> |
<p>(Re-)Création de la partie requête de l'URL à partir de la fusion du |
tableau (passé en paramètre) et les valeurs présentes dans $_GET.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$parametres</var></dt> |
<dd><code>array</code><br>(nom => valeur) tableau de clés & valeurs pour la partie requête de |
l'url.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code></code><br>(Re-)Création de la partie requête.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="normaliser" id="_normaliser"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_normaliser">#</a> |
<code><a href="source-class-Url.html#315-352" title="Go to source code">normaliser</a>( )</code> |
<div class="description short"> |
<p>Normalise les données de l'instance d'Url faisant appel à cette |
méthode.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Normalise les données de l'instance d'Url faisant appel à cette |
méthode.</p> |
<h4>Returns</h4> |
<div class="list"> |
<code></code><br>l'instance d'Url courrante est normalisée.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getCanonique" id="_getCanonique"> |
<td class="attributes"><code> |
public static |
<code><a href="class-Url.html">Url</a></code> |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getCanonique">#</a> |
<code><a href="source-class-Url.html#354-374" title="Go to source code">getCanonique</a>( )</code> |
<div class="description short"> |
<p>Renvoie une instance d'objet Url representant l'URL canonique du script PHP |
en cours d'éxécution.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Renvoie une instance d'objet Url representant l'URL canonique du script PHP |
en cours d'éxécution.</p> |
<h4>Returns</h4> |
<div class="list"> |
<code><code><a href="class-Url.html">Url</a></code></code><br>retourne un objet Url ou null en cas d'erreur.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getDemande" id="_getDemande"> |
<td class="attributes"><code> |
public static |
<code><a href="class-Url.html">Url</a></code> |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getDemande">#</a> |
<code><a href="source-class-Url.html#376-393" title="Go to source code">getDemande</a>( )</code> |
<div class="description short"> |
<p>Renvoie une instance d'objet Url representant l'URL utilisée pour |
récupérer la requête en cours.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Renvoie une instance d'objet Url representant l'URL utilisée pour |
récupérer la requête en cours.</p> |
<h4>Returns</h4> |
<div class="list"> |
<code><code><a href="class-Url.html">Url</a></code></code><br>retourne un objet Url ou null en cas d'erreur.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getURL" id="_getURL"> |
<td class="attributes"><code> |
public |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getURL">#</a> |
<code><a href="source-class-Url.html#396-424" title="Go to source code">getURL</a>( )</code> |
<div class="description short"> |
<p>Renvoie un représentation sous forme de chaine de l'URL.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Renvoie un représentation sous forme de chaine de l'URL.</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>l'url<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="constants"> |
<caption>Constants summary</caption> |
<tr data-order="OPTION_UTILISER_CROCHETS" id="OPTION_UTILISER_CROCHETS"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Url.html#20-23" title="Go to source code"><b>OPTION_UTILISER_CROCHETS</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'utiliser_crochets'</span></code></td> |
<td class="description"><div> |
<a href="#OPTION_UTILISER_CROCHETS" class="anchor">#</a> |
<div class="description short"> |
<p>Répresenter les tableaux dans les requêtes en utilisant la notation php []. |
Par défaut à true.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Répresenter les tableaux dans les requêtes en utilisant la notation php []. |
Par défaut à true.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="OPTION_ENCODER_CLES" id="OPTION_ENCODER_CLES"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Url.html#25-28" title="Go to source code"><b>OPTION_ENCODER_CLES</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'encoder_cles'</span></code></td> |
<td class="description"><div> |
<a href="#OPTION_ENCODER_CLES" class="anchor">#</a> |
<div class="description short"> |
<p>URL-encoder les clés des variables dans les requêtes. Par défaut à |
true.</p> |
</div> |
<div class="description detailed hidden"> |
<p>URL-encoder les clés des variables dans les requêtes. Par défaut à |
true.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="OPTION_ENCODER_VALEURS" id="OPTION_ENCODER_VALEURS"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Url.html#30-33" title="Go to source code"><b>OPTION_ENCODER_VALEURS</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'encoder_valeurs'</span></code></td> |
<td class="description"><div> |
<a href="#OPTION_ENCODER_VALEURS" class="anchor">#</a> |
<div class="description short"> |
<p>URL-encoder les valeurs des variables dans les requêtes. Par défaut à |
false.</p> |
</div> |
<div class="description detailed hidden"> |
<p>URL-encoder les valeurs des variables dans les requêtes. Par défaut à |
false.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="OPTION_SEPARATEUR_ENTREE" id="OPTION_SEPARATEUR_ENTREE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Url.html#35-40" title="Go to source code"><b>OPTION_SEPARATEUR_ENTREE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'separateur_entree'</span></code></td> |
<td class="description"><div> |
<a href="#OPTION_SEPARATEUR_ENTREE" class="anchor">#</a> |
<div class="description short"> |
<p>Séparateurs de variables lors du parsing de la requête. Chaque caractère |
est considéré comme un séparateur. Par défaut, spécifié par le paramêtre |
arg_separator.input dans php.ini (par défaut "&").</p> |
</div> |
<div class="description detailed hidden"> |
<p>Séparateurs de variables lors du parsing de la requête. Chaque caractère |
est considéré comme un séparateur. Par défaut, spécifié par le paramêtre |
arg_separator.input dans php.ini (par défaut "&").</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="OPTION_SEPARATEUR_SORTIE" id="OPTION_SEPARATEUR_SORTIE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Url.html#42-46" title="Go to source code"><b>OPTION_SEPARATEUR_SORTIE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'separateur_sortie'</span></code></td> |
<td class="description"><div> |
<a href="#OPTION_SEPARATEUR_SORTIE" class="anchor">#</a> |
<div class="description short"> |
<p>Séparateur de variables lors de la génération de la requête. Par défaut, |
spécifié par le paramètre arg_separator.output dans php.ini (par défaut |
"&").</p> |
</div> |
<div class="description detailed hidden"> |
<p>Séparateur de variables lors de la génération de la requête. Par défaut, |
spécifié par le paramètre arg_separator.output dans php.ini (par défaut |
"&").</p> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/resources/footer.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/trunk/doc/ApiGen/resources/footer.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/trunk/doc/ApiGen/resources/tree-last.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/trunk/doc/ApiGen/resources/tree-last.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/trunk/doc/ApiGen/resources/resize.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/trunk/doc/ApiGen/resources/resize.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/trunk/doc/ApiGen/resources/inherit.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/trunk/doc/ApiGen/resources/inherit.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/trunk/doc/ApiGen/resources/style.css |
---|
New file |
0,0 → 1,608 |
/*! |
* ApiGen 2.8.0 - API documentation generator for PHP 5.3+ |
* |
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com) |
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich) |
* Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville) |
* |
* For the full copyright and license information, please view |
* the file LICENSE.md that was distributed with this source code. |
*/ |
body { |
font: 13px/1.5 Verdana, 'Geneva CE', lucida, sans-serif; |
margin: 0; |
padding: 0; |
background: #ffffff; |
color: #333333; |
} |
h1, h2, h3, h4, caption { |
font-family: 'Trebuchet MS', 'Geneva CE', lucida, sans-serif; |
color: #053368; |
} |
h1 { |
color: #1e5eb6; |
font-size: 230%; |
font-weight: normal; |
margin: .3em 0; |
} |
h2 { |
color: #1e5eb6; |
font-size: 150%; |
font-weight: normal; |
margin: -.3em 0 .3em 0; |
} |
h3 { |
font-size: 1.6em; |
font-weight: normal; |
margin-bottom: 2px; |
} |
h4 { |
font-size: 100%; |
font-weight: bold; |
padding: 0; |
margin: 0; |
} |
caption { |
border: 1px solid #cccccc; |
background: #ecede5; |
font-weight: bold; |
font-size: 1.2em; |
padding: 3px 5px; |
text-align: left; |
margin-bottom: 0; |
} |
p { |
margin: .7em 0 1em; |
padding: 0; |
} |
hr { |
margin: 2em 0 1em; |
border: none; |
border-top: 1px solid #cccccc; |
height: 0; |
} |
a { |
color: #006aeb; |
padding: 3px 1px; |
text-decoration: none; |
} |
h1 a { |
color: #1e5eb6; |
} |
a:hover, a:active, a:focus, a:hover b, a:hover var { |
background-color: #006aeb; |
color: #ffffff !important; |
} |
code, var, pre { |
font-family: monospace; |
} |
var { |
font-weight: bold; |
font-style: normal; |
color: #ca8a04; |
} |
pre { |
margin: 0; |
} |
code a b { |
color: #000000; |
} |
.deprecated { |
text-decoration: line-through; |
} |
.invalid { |
color: #e71818; |
} |
.hidden { |
display: none; |
} |
/* Left side */ |
#left { |
overflow: auto; |
width: 270px; |
height: 100%; |
position: fixed; |
} |
/* Menu */ |
#menu { |
padding: 10px; |
} |
#menu ul { |
list-style: none; |
padding: 0; |
margin: 0; |
} |
#menu ul ul { |
padding-left: 10px; |
} |
#menu li { |
white-space: nowrap; |
position: relative; |
} |
#menu a { |
display: block; |
padding: 0 2px; |
} |
#menu .active > a, #menu > span { |
color: #333333; |
background: none; |
font-weight: bold; |
} |
#menu .active > a.invalid { |
color: #e71818; |
} |
#menu .active > a:hover, #menu .active > a:active, #menu .active > a:focus { |
background-color: #006aeb; |
} |
#menu #groups span { |
position: absolute; |
top: 4px; |
right: 2px; |
cursor: pointer; |
display: block; |
width: 12px; |
height: 12px; |
background: url('collapsed.png') transparent 0 0 no-repeat; |
} |
#menu #groups span:hover { |
background-position: -12px 0; |
} |
#menu #groups span.collapsed { |
background-position: 0 -12px; |
} |
#menu #groups span.collapsed:hover { |
background-position: -12px -12px; |
} |
#menu #groups ul.collapsed { |
display: none; |
} |
/* Right side */ |
#right { |
overflow: auto; |
margin-left: 275px; |
height: 100%; |
position: fixed; |
left: 0; |
right: 0; |
} |
#rightInner { |
max-width: 1000px; |
min-width: 350px; |
} |
/* Search */ |
#search { |
float: right; |
margin: 3px 8px; |
} |
#search input.text { |
padding: 3px 5px; |
width: 250px; |
} |
/* Autocomplete */ |
.ac_results { |
padding: 0; |
border: 1px solid #cccccc; |
background-color: #ffffff; |
overflow: hidden; |
z-index: 99999; |
} |
.ac_results ul { |
width: 100%; |
list-style-position: outside; |
list-style: none; |
padding: 0; |
margin: 0; |
} |
.ac_results li { |
margin: 0; |
padding: 2px 5px; |
cursor: default; |
display: block; |
font: 12px 'Trebuchet MS', 'Geneva CE', lucida, sans-serif; |
line-height: 16px; |
overflow: hidden; |
white-space: nowrap; |
} |
.ac_results li strong { |
color: #000000; |
} |
.ac_odd { |
background-color: #eeeeee; |
} |
.ac_over { |
background-color: #006aeb; |
color: #ffffff; |
} |
.ac_results li.ac_over strong { |
color: #ffffff; |
} |
/* Navigation */ |
#navigation { |
padding: 3px 8px; |
background-color: #f6f6f4; |
height: 26px; |
} |
#navigation ul { |
list-style: none; |
margin: 0 8px 4px 0; |
padding: 0; |
overflow: hidden; |
float: left; |
} |
#navigation ul + ul { |
border-left: 1px solid #000000; |
padding-left: 8px; |
} |
#navigation ul li { |
float: left; |
margin: 2px; |
padding: 0 3px; |
font-family: Verdana, 'Geneva CE', lucida, sans-serif; |
color: #808080; |
} |
#navigation ul li.active { |
background-color: #053368; |
color: #ffffff; |
font-weight: bold; |
} |
#navigation ul li a { |
color: #000000; |
font-weight: bold; |
padding: 0; |
} |
#navigation ul li span { |
float: left; |
padding: 0 3px; |
} |
#navigation ul li a:hover span, #navigation ul li a:active span, #navigation ul li a:focus span { |
background-color: #006aeb; |
} |
/* Content */ |
#content { |
clear: both; |
padding: 5px 15px; |
} |
.description pre { |
padding: .6em; |
background: #fcfcf7; |
} |
#content > .description { |
background: #ecede5; |
padding: 1px 8px; |
margin: 1.2em 0; |
} |
#content > .description pre { |
margin: .5em 0; |
} |
dl.tree { |
margin: 1.2em 0; |
} |
dl.tree dd { |
margin: 0; |
padding: 0; |
} |
.info { |
margin: 1.2em 0; |
} |
.summary { |
border: 1px solid #cccccc; |
border-collapse: collapse; |
font-size: 1em; |
width: 100%; |
margin: 1.2em 0 2.4em; |
} |
.summary caption { |
border-width: 1px 1px 0; |
} |
.summary caption.switchable { |
background: #ecede5 url('sort.png') no-repeat center right; |
cursor: pointer; |
} |
.summary td { |
border: 1px solid #cccccc; |
margin: 0; |
padding: 3px 10px; |
font-size: 1em; |
vertical-align: top; |
} |
.summary td:first-child { |
text-align: right; |
} |
#packages.summary td:first-child, #namespaces.summary td:first-child, .inherited.summary td:first-child, .used.summary td:first-child { |
text-align: left; |
} |
.summary tr:hover td { |
background: #f6f6f4; |
} |
.summary .description pre { |
border: .5em solid #ecede5; |
} |
.summary .description p { |
margin: 0; |
} |
.summary .description p + p, .summary .description ul { |
margin: 3px 0 0 0; |
} |
.summary .description.detailed h4 { |
margin-top: 3px; |
} |
.summary dl { |
margin: 0; |
} |
.summary dd { |
margin: 0 0 0 25px; |
} |
.name, .attributes { |
white-space: nowrap; |
} |
.value { |
white-space: pre-wrap; |
} |
td.name, td.attributes { |
width: 1%; |
} |
.class #methods .name { |
width: auto; |
white-space: normal; |
} |
.class #methods .name > div > code { |
white-space: pre-wrap; |
} |
.class #methods .name > div > code span, .function .value > code { |
white-space: nowrap; |
} |
.class #methods td.name > div, .class td.description > div { |
position: relative; |
padding-right: 1em; |
} |
.anchor { |
position: absolute; |
top: 0; |
right: 0; |
line-height: 1; |
font-size: 85%; |
margin: 0; |
color: #006aeb !important; |
} |
.list { |
margin: 0 0 5px 25px; |
} |
div.invalid { |
background-color: #fae4e0; |
padding: 10px; |
} |
/* Splitter */ |
#splitter { |
position: fixed; |
height: 100%; |
width: 5px; |
left: 270px; |
background: #1e5eb6 url('resize.png') left center no-repeat; |
cursor: e-resize; |
} |
#splitter.active { |
opacity: .5; |
} |
/* Footer */ |
#footer { |
border-top: 1px solid #e9eeef; |
clear: both; |
color: #a7a7a7; |
font-size: 8pt; |
text-align: center; |
padding: 20px 0 0; |
margin: 3em 0 0; |
height: 90px; |
background: #ffffff url('footer.png') no-repeat center top; |
} |
/* Tree */ |
div.tree ul { |
list-style: none; |
background: url('tree-vertical.png') left repeat-y; |
padding: 0; |
margin-left: 20px; |
} |
div.tree li { |
margin: 0; |
padding: 0; |
} |
div.tree div { |
padding-left: 30px; |
} |
div.tree div.notlast { |
background: url('tree-hasnext.png') left 10px no-repeat; |
} |
div.tree div.last { |
background: url('tree-last.png') left -240px no-repeat; |
} |
div.tree li.last { |
background: url('tree-cleaner.png') left center repeat-y; |
} |
div.tree span.padding { |
padding-left: 15px; |
} |
/* Source code */ |
.php-keyword1 { |
color: #e71818; |
font-weight: bold; |
} |
.php-keyword2 { |
font-weight: bold; |
} |
.php-var { |
color: #d59401; |
font-weight: bold; |
} |
.php-num { |
color: #cd0673; |
} |
.php-quote { |
color: #008000; |
} |
.php-comment { |
color: #929292; |
} |
.xlang { |
color: #ff0000; |
font-weight: bold; |
} |
span.l { |
display: block; |
} |
span.l.selected { |
background: #f6f6f4; |
} |
span.l a { |
color: #333333; |
} |
span.l a:hover, div.l a:active, div.l a:focus { |
background: transparent; |
color: #333333 !important; |
} |
span.l .php-var a { |
color: #d59401; |
} |
span.l .php-var a:hover, span.l .php-var a:active, span.l .php-var a:focus { |
color: #d59401 !important; |
} |
span.l a.l { |
padding-left: 2px; |
color: #c0c0c0; |
} |
span.l a.l:hover, span.l a.l:active, span.l a.l:focus { |
background: transparent; |
color: #c0c0c0 !important; |
} |
#rightInner.medium #navigation { |
height: 52px; |
} |
#rightInner.medium #navigation ul:first-child + ul { |
clear: left; |
border: none; |
padding: 0; |
} |
#rightInner.medium .name, #rightInner.medium .attributes { |
white-space: normal; |
} |
#rightInner.small #search { |
float: left; |
} |
#rightInner.small #navigation { |
height: 78px; |
} |
#rightInner.small #navigation ul:first-child { |
clear: both; |
} |
/trunk/doc/ApiGen/resources/collapsed.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/trunk/doc/ApiGen/resources/collapsed.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/trunk/doc/ApiGen/resources/tree-cleaner.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/trunk/doc/ApiGen/resources/tree-cleaner.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/trunk/doc/ApiGen/resources/tree-vertical.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/trunk/doc/ApiGen/resources/tree-vertical.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/trunk/doc/ApiGen/resources/sort.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/trunk/doc/ApiGen/resources/sort.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/trunk/doc/ApiGen/resources/tree-hasnext.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/trunk/doc/ApiGen/resources/tree-hasnext.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/trunk/doc/ApiGen/resources/combined.js |
---|
New file |
0,0 → 1,1264 |
var ApiGen = ApiGen || {}; |
ApiGen.config = {"require":{"min":"2.8.0"},"resources":{"resources":"resources"},"templates":{"common":{"overview.latte":"index.html","combined.js.latte":"resources\/combined.js","elementlist.js.latte":"elementlist.js","404.latte":"404.html"},"optional":{"sitemap":{"filename":"sitemap.xml","template":"sitemap.xml.latte"},"opensearch":{"filename":"opensearch.xml","template":"opensearch.xml.latte"},"robots":{"filename":"robots.txt","template":"robots.txt.latte"}},"main":{"package":{"filename":"package-%s.html","template":"package.latte"},"namespace":{"filename":"namespace-%s.html","template":"namespace.latte"},"class":{"filename":"class-%s.html","template":"class.latte"},"constant":{"filename":"constant-%s.html","template":"constant.latte"},"function":{"filename":"function-%s.html","template":"function.latte"},"source":{"filename":"source-%s.html","template":"source.latte"},"tree":{"filename":"tree.html","template":"tree.latte"},"deprecated":{"filename":"deprecated.html","template":"deprecated.latte"},"todo":{"filename":"todo.html","template":"todo.latte"}}},"options":{"elementDetailsCollapsed":true,"elementsOrder":"natural"},"config":"\/opt\/lampp\/lib\/php\/data\/ApiGen\/templates\/default\/config.neon"}; |
/*! jQuery v1.7 jquery.com | jquery.org/license */ |
(function(a,b){function cA(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cx(a){if(!cm[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cn||(cn=c.createElement("iframe"),cn.frameBorder=cn.width=cn.height=0),b.appendChild(cn);if(!co||!cn.createElement)co=(cn.contentWindow||cn.contentDocument).document,co.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),co.close();d=co.createElement(a),co.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cn)}cm[a]=e}return cm[a]}function cw(a,b){var c={};f.each(cs.concat.apply([],cs.slice(0,b)),function(){c[this]=a});return c}function cv(){ct=b}function cu(){setTimeout(cv,0);return ct=f.now()}function cl(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ck(){try{return new a.XMLHttpRequest}catch(b){}}function ce(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cd(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function cc(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bG.test(a)?d(a,e):cc(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)cc(a+"["+e+"]",b[e],c,d);else d(a,b)}function cb(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function ca(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bV,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=ca(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=ca(a,c,d,e,"*",g));return l}function b_(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bR),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bE(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bz:bA;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bB(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function br(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bi,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bq(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bp(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bp)}function bp(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bo(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bn(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bm(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bl(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function X(a){var b=Y.split(" "),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function W(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(R.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(){return!0}function M(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.add(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;B.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return a!=null&&m.test(a)&&!isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:H?function(a){return a==null?"":H.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?F.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(I)return I.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=G.call(arguments,2),g=function(){return a.apply(c,f.concat(G.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),A=e.uaMatch(z),A.browser&&(e.browser[A.browser]=!0,e.browser.version=A.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?C=function(){c.removeEventListener("DOMContentLoaded",C,!1),e.ready()}:c.attachEvent&&(C=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",C),e.ready())}),typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return e});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){return i.done.apply(i,arguments).fail.apply(i,arguments)},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/><nav></nav>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,unknownElems:!!a.getElementsByTagName("nav").length,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",enctype:!!c.createElement("form").enctype,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.lastChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-999px",top:"-999px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;f(function(){var a,b,d,e,g,h,i=1,j="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",l="visibility:hidden;border:0;",n="style='"+j+"border:5px solid #000;padding:0;'",p="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>";m=c.getElementsByTagName("body")[0];!m||(a=c.createElement("div"),a.style.cssText=l+"width:0;height:0;position:static;top:0;margin-top:"+i+"px",m.insertBefore(a,m.firstChild),o=c.createElement("div"),o.style.cssText=j+l,o.innerHTML=p,a.appendChild(o),b=o.firstChild,d=b.firstChild,g=b.nextSibling.firstChild.firstChild,h={doesNotAddBorder:d.offsetTop!==5,doesAddBorderForTableAndCells:g.offsetTop===5},d.style.position="fixed",d.style.top="20px",h.fixedPosition=d.offsetTop===20||d.offsetTop===15,d.style.position=d.style.top="",b.style.overflow="hidden",b.style.position="relative",h.subtractsBorderForOverflowNotVisible=d.offsetTop===-5,h.doesNotIncludeMarginInBodyOffset=m.offsetTop!==i,m.removeChild(a),o=a=null,f.extend(k,h))}),o.innerHTML="",n.removeChild(o),o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[f.expando]:a[f.expando]&&f.expando,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[f.expando]=n=++f.uuid:n=f.expando),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[f.expando]:f.expando;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)?b=b:b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" "));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];if(!arguments.length){if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}return b}e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!a||j===3||j===8||j===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g},removeAttr:function(a,b){var c,d,e,g,h=0;if(a.nodeType===1){d=(b||"").split(p),g=d.length;for(;h<g;h++)e=d[h].toLowerCase(),c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1)}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return b;h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/\.(.*)$/,A=/^(?:textarea|input|select)$/i,B=/\./g,C=/ /g,D=/[^\w\s.|`]/g,E=/^([^\.]*)?(?:\.(.+))?$/,F=/\bhover(\.\S+)?/,G=/^key/,H=/^(?:mouse|contextmenu)|click/,I=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,J=function(a){var b=I.exec(a);b&& |
(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},K=function(a,b){return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||a.id===b[2])&&(!b[3]||b[3].test(a.className))},L=function(a){return f.event.special.hover?a:a.replace(F,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=L(c).split(" ");for(k=0;k<c.length;k++){l=E.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,namespace:n.join(".")},p),g&&(o.quick=J(g),!o.quick&&f.expr.match.POS.test(g)&&(o.isPositional=!0)),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d){var e=f.hasData(a)&&f._data(a),g,h,i,j,k,l,m,n,o,p,q;if(!!e&&!!(m=e.events)){b=L(b||"").split(" ");for(g=0;g<b.length;g++){h=E.exec(b[g])||[],i=h[1],j=h[2];if(!i){j=j?"."+j:"";for(l in m)f.event.remove(a,l+j,c,d);return}n=f.event.special[i]||{},i=(d?n.delegateType:n.bindType)||i,p=m[i]||[],k=p.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;if(c||j||d||n.remove)for(l=0;l<p.length;l++){q=p[l];if(!c||c.guid===q.guid)if(!j||j.test(q.namespace))if(!d||d===q.selector||d==="**"&&q.selector)p.splice(l--,1),q.selector&&p.delegateCount--,n.remove&&n.remove.call(a,q)}else p.length=0;p.length===0&&k!==p.length&&((!n.teardown||n.teardown.call(a,j)===!1)&&f.removeEvent(a,i,e.handle),delete m[i])}f.isEmptyObject(m)&&(o=e.handle,o&&(o.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"",(g||!e)&&c.preventDefault();if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,n=null;for(m=e.parentNode;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length;l++){m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d);if(c.isPropagationStopped())break}c.type=h,c.isDefaultPrevented()||(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=(f.event.special[c.type]||{}).handle,j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click"))for(m=c.target;m!=this;m=m.parentNode||this){o={},q=[];for(k=0;k<e;k++)r=d[k],s=r.selector,t=o[s],r.isPositional?t=(t||(o[s]=f(s))).index(m)>=0:t===b&&(t=o[s]=r.quick?K(m,r.quick):f(m).is(s)),t&&q.push(r);q.length&&j.push({elem:m,matches:q})}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){p=j[k],c.currentTarget=p.elem;for(l=0;l<p.matches.length&&!c.isImmediatePropagationStopped();l++){r=p.matches[l];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=(i||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement wheelDelta".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},focus:{delegateType:"focusin",noBubble:!0},blur:{delegateType:"focusout",noBubble:!0},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?N:M):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=N;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=N;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=N,this.stopPropagation()},isDefaultPrevented:M,isPropagationStopped:M,isImmediatePropagationStopped:M},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]=f.event.special[b]={delegateType:b,bindType:b,handle:function(a){var b=this,c=a.relatedTarget,d=a.handleObj,e=d.selector,g,h;if(!c||d.origType===a.type||c!==b&&!f.contains(b,c))g=a.type,a.type=d.origType,h=d.handler.apply(this,arguments),a.type=g;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(A.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;A.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return A.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=M;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=M);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),G.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),H.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw"Syntax error, unrecognized expression: "+a};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var O=/Until$/,P=/^(?:parents|prevUntil|prevAll)/,Q=/,/,R=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,T=f.expr.match.POS,U={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(W(this,a,!1),"not",a)},filter:function(a){return this.pushStack(W(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?T.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",Z=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,_=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,ba=/<([\w:]+)/,bb=/<tbody/i,bc=/<|&#?\w+;/,bd=/<(?:script|style)/i,be=/<(?:script|object|embed|option|style)/i,bf=new RegExp("<(?:"+Y.replace(" ","|")+")","i"),bg=/checked\s*(?:[^=]|=\s*.checked.)/i,bh=/\/(java|ecma)script/i,bi=/^\s*<!(?:\[CDATA\[|\-\-)/,bj={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bk=X(c);bj.optgroup=bj.option,bj.tbody=bj.tfoot=bj.colgroup=bj.caption=bj.thead,bj.th=bj.td,f.support.htmlSerialize||(bj._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after" |
,arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Z,""):null;if(typeof a=="string"&&!bd.test(a)&&(f.support.leadingWhitespace||!$.test(a))&&!bj[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(_,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bg.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bl(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,br)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!be.test(j)&&(f.support.checkClone||!bg.test(j))&&!f.support.unknownElems&&bf.test(j)&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bn(a,d),e=bo(a),g=bo(d);for(h=0;e[h];++h)g[h]&&bn(e[h],g[h])}if(b){bm(a,d);if(c){e=bo(a),g=bo(d);for(h=0;e[h];++h)bm(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bc.test(k))k=b.createTextNode(k);else{k=k.replace(_,"<$1></$2>");var l=(ba.exec(k)||["",""])[1].toLowerCase(),m=bj[l]||bj._default,n=m[0],o=b.createElement("div");b===c?bk.appendChild(o):X(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=bb.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&$.test(k)&&o.insertBefore(b.createTextNode($.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bq(k[i]);else bq(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bh.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bs=/alpha\([^)]*\)/i,bt=/opacity=([^)]*)/,bu=/([A-Z]|^ms)/g,bv=/^-?\d+(?:px)?$/i,bw=/^-?\d/,bx=/^([\-+])=([\-+.\de]+)/,by={position:"absolute",visibility:"hidden",display:"block"},bz=["Left","Right"],bA=["Top","Bottom"],bB,bC,bD;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bB(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bx.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bB)return bB(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bE(a,b,d);f.swap(a,by,function(){e=bE(a,b,d)});return e}},set:function(a,b){if(!bv.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bt.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bs,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bs.test(g)?g.replace(bs,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bB(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bC=function(a,c){var d,e,g;c=c.replace(bu,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bD=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bv.test(f)&&bw.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bB=bC||bD,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bF=/%20/g,bG=/\[\]$/,bH=/\r?\n/g,bI=/#.*$/,bJ=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bK=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bL=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bM=/^(?:GET|HEAD)$/,bN=/^\/\//,bO=/\?/,bP=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bQ=/^(?:select|textarea)/i,bR=/\s+/,bS=/([?&])_=[^&]*/,bT=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bU=f.fn.load,bV={},bW={},bX,bY,bZ=["*/"]+["*"];try{bX=e.href}catch(b$){bX=c.createElement("a"),bX.href="",bX=bX.href}bY=bT.exec(bX.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bU)return bU.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bP,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bQ.test(this.nodeName)||bK.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bH,"\r\n")}}):{name:b.name,value:c.replace(bH,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?cb(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),cb(a,b);return a},ajaxSettings:{url:bX,isLocal:bL.test(bY[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bZ},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:b_(bV),ajaxTransport:b_(bW),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cd(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=ce(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bJ.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bI,"").replace(bN,bY[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bR),d.crossDomain==null&&(r=bT.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bY[1]&&r[2]==bY[2]&&(r[3]||(r[1]==="http:"?80:443))==(bY[3]||(bY[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),ca(bV,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bM.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bO.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bS,"$1_="+x);d.url=y+(y===d.url?(bO.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bZ+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=ca(bW,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)cc(g,a[g],c,e);return d.join("&").replace(bF,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cf=f.now(),cg=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cf++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cg.test(b.url)||e&&cg.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cg,l),b.url===j&&(e&&(k=k.replace(cg,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ch=a.ActiveXObject?function(){for(var a in cj)cj[a](0,1)}:!1,ci=0,cj;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ck()||cl()}:ck,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ch&&delete cj[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++ci,ch&&(cj||(cj={},f(a).unload(ch)),cj[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cm={},cn,co,cp=/^(?:toggle|show|hide)$/,cq=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cr,cs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],ct;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cw("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cx(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cw("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cw("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cx(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cp.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=cq.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cw("show",1),slideUp:cw("hide",1),slideToggle:cw("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=ct||cu(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cr&&(cr=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=ct||cu(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cr),cr=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now))}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cy=/^t(?:able|d|h)$/i,cz=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cA(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cy.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cz.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cz.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cA(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cA(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); |
/** |
* Cookie plugin |
* |
* Copyright (c) 2006 Klaus Hartl (stilbuero.de) |
* Dual licensed under the MIT and GPL licenses: |
* http://www.opensource.org/licenses/mit-license.php |
* http://www.gnu.org/licenses/gpl.html |
* |
*/ |
/** |
* Create a cookie with the given name and value and other optional parameters. |
* |
* @example $.cookie('the_cookie', 'the_value'); |
* @desc Set the value of a cookie. |
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); |
* @desc Create a cookie with all available options. |
* @example $.cookie('the_cookie', 'the_value'); |
* @desc Create a session cookie. |
* @example $.cookie('the_cookie', null); |
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain |
* used when the cookie was set. |
* |
* @param String name The name of the cookie. |
* @param String value The value of the cookie. |
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes. |
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. |
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted. |
* If set to null or omitted, the cookie will be a session cookie and will not be retained |
* when the the browser exits. |
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). |
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). |
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will |
* require a secure protocol (like HTTPS). |
* @type undefined |
* |
* @name $.cookie |
* @cat Plugins/Cookie |
* @author Klaus Hartl/klaus.hartl@stilbuero.de |
*/ |
/** |
* Get the value of a cookie with the given name. |
* |
* @example $.cookie('the_cookie'); |
* @desc Get the value of a cookie. |
* |
* @param String name The name of the cookie. |
* @return The value of the cookie. |
* @type String |
* |
* @name $.cookie |
* @cat Plugins/Cookie |
* @author Klaus Hartl/klaus.hartl@stilbuero.de |
*/ |
jQuery.cookie = function(name, value, options) { |
if (typeof value != 'undefined') { // name and value given, set cookie |
options = options || {}; |
if (value === null) { |
value = ''; |
options.expires = -1; |
} |
var expires = ''; |
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { |
var date; |
if (typeof options.expires == 'number') { |
date = new Date(); |
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); |
} else { |
date = options.expires; |
} |
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE |
} |
// CAUTION: Needed to parenthesize options.path and options.domain |
// in the following expressions, otherwise they evaluate to undefined |
// in the packed version for some reason... |
var path = options.path ? '; path=' + (options.path) : ''; |
var domain = options.domain ? '; domain=' + (options.domain) : ''; |
var secure = options.secure ? '; secure' : ''; |
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); |
} else { // only name given, get cookie |
var cookieValue = null; |
if (document.cookie && document.cookie != '') { |
var cookies = document.cookie.split(';'); |
for (var i = 0; i < cookies.length; i++) { |
var cookie = jQuery.trim(cookies[i]); |
// Does this cookie string begin with the name we want? |
if (cookie.substring(0, name.length + 1) == (name + '=')) { |
cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); |
break; |
} |
} |
} |
return cookieValue; |
} |
}; |
/*! |
* sprintf and vsprintf for jQuery |
* somewhat based on http://jan.moesen.nu/code/javascript/sprintf-and-printf-in-javascript/ |
* Copyright (c) 2008 Sabin Iacob (m0n5t3r) <iacobs@m0n5t3r.info> |
* @license http://www.gnu.org/licenses/gpl.html |
* @project jquery.sprintf |
*/ |
(function(d){var a={b:function(e){return parseInt(e,10).toString(2)},c:function(e){return String.fromCharCode(parseInt(e,10))},d:function(e){return parseInt(e,10)},u:function(e){return Math.abs(e)},f:function(f,e){e=parseInt(e,10);f=parseFloat(f);if(isNaN(e&&f)){return NaN}return e&&f.toFixed(e)||f},o:function(e){return parseInt(e,10).toString(8)},s:function(e){return e},x:function(e){return(""+parseInt(e,10).toString(16)).toLowerCase()},X:function(e){return(""+parseInt(e,10).toString(16)).toUpperCase()}};var c=/%(?:(\d+)?(?:\.(\d+))?|\(([^)]+)\))([%bcdufosxX])/g;var b=function(f){if(f.length==1&&typeof f[0]=="object"){f=f[0];return function(i,h,k,j,g,m,l){return a[g](f[j])}}else{var e=0;return function(i,h,k,j,g,m,l){if(g=="%"){return"%"}return a[g](f[e++],k)}}};d.extend({sprintf:function(f){var e=Array.apply(null,arguments).slice(1);return f.replace(c,b(e))},vsprintf:function(f,e){return f.replace(c,b(e))}})})(jQuery); |
/*! |
* jQuery Autocomplete plugin 1.1 |
* |
* Copyright (c) 2009 Jörn Zaefferer |
* |
* Dual licensed under the MIT and GPL licenses: |
* http://www.opensource.org/licenses/mit-license.php |
* http://www.gnu.org/licenses/gpl.html |
* |
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $ |
*/ |
;(function($) { |
$.fn.extend({ |
autocomplete: function(urlOrData, options) { |
var isUrl = typeof urlOrData == "string"; |
options = $.extend({}, $.Autocompleter.defaults, { |
url: isUrl ? urlOrData : null, |
data: isUrl ? null : urlOrData, |
delay: isUrl ? $.Autocompleter.defaults.delay : 10, |
max: options && !options.scroll ? 10 : 150 |
}, options); |
// if highlight is set to false, replace it with a do-nothing function |
options.highlight = options.highlight || function(value) { return value; }; |
// if the formatMatch option is not specified, then use formatItem for backwards compatibility |
options.formatMatch = options.formatMatch || options.formatItem; |
options.show = options.show || function(list) {}; |
return this.each(function() { |
new $.Autocompleter(this, options); |
}); |
}, |
result: function(handler) { |
return this.bind("result", handler); |
}, |
search: function(handler) { |
return this.trigger("search", [handler]); |
}, |
flushCache: function() { |
return this.trigger("flushCache"); |
}, |
setOptions: function(options){ |
return this.trigger("setOptions", [options]); |
}, |
unautocomplete: function() { |
return this.trigger("unautocomplete"); |
} |
}); |
$.Autocompleter = function(input, options) { |
var KEY = { |
UP: 38, |
DOWN: 40, |
DEL: 46, |
TAB: 9, |
RETURN: 13, |
ESC: 27, |
COMMA: 188, |
PAGEUP: 33, |
PAGEDOWN: 34, |
BACKSPACE: 8 |
}; |
// Create $ object for input element |
var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); |
var timeout; |
var previousValue = ""; |
var cache = $.Autocompleter.Cache(options); |
var hasFocus = 0; |
var lastKeyPressCode; |
var config = { |
mouseDownOnSelect: false |
}; |
var select = $.Autocompleter.Select(options, input, selectCurrent, config); |
// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all |
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { |
// a keypress means the input has focus |
// avoids issue where input had focus before the autocomplete was applied |
hasFocus = 1; |
// track last key pressed |
lastKeyPressCode = event.keyCode; |
switch(event.keyCode) { |
case KEY.UP: |
event.preventDefault(); |
if ( select.visible() ) { |
select.prev(); |
} else { |
onChange(0, true); |
} |
break; |
case KEY.DOWN: |
event.preventDefault(); |
if ( select.visible() ) { |
select.next(); |
} else { |
onChange(0, true); |
} |
break; |
case KEY.PAGEUP: |
event.preventDefault(); |
if ( select.visible() ) { |
select.pageUp(); |
} else { |
onChange(0, true); |
} |
break; |
case KEY.PAGEDOWN: |
event.preventDefault(); |
if ( select.visible() ) { |
select.pageDown(); |
} else { |
onChange(0, true); |
} |
break; |
// matches also semicolon |
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: |
case KEY.TAB: |
case KEY.RETURN: |
if( selectCurrent() ) { |
//event.preventDefault(); |
//return false; |
} |
break; |
case KEY.ESC: |
select.hide(); |
break; |
default: |
clearTimeout(timeout); |
timeout = setTimeout(onChange, options.delay); |
break; |
} |
}).focus(function(){ |
// track whether the field has focus, we shouldn't process any |
// results if the field no longer has focus |
hasFocus++; |
}).blur(function() { |
hasFocus = 0; |
if (!config.mouseDownOnSelect) { |
hideResults(); |
} |
}).click(function() { |
// show select when clicking in a focused field |
if ( hasFocus++ > 1 && !select.visible() ) { |
onChange(0, true); |
} |
}).bind("search", function() { |
// TODO why not just specifying both arguments? |
var fn = (arguments.length > 1) ? arguments[1] : null; |
function findValueCallback(q, data) { |
var result; |
if( data && data.length ) { |
for (var i=0; i < data.length; i++) { |
if( data[i].result.toLowerCase() == q.toLowerCase() ) { |
result = data[i]; |
break; |
} |
} |
} |
if( typeof fn == "function" ) fn(result); |
else $input.trigger("result", result && [result.data, result.value]); |
} |
$.each(trimWords($input.val()), function(i, value) { |
request(value, findValueCallback, findValueCallback); |
}); |
}).bind("flushCache", function() { |
cache.flush(); |
}).bind("setOptions", function() { |
$.extend(options, arguments[1]); |
// if we've updated the data, repopulate |
if ( "data" in arguments[1] ) |
cache.populate(); |
}).bind("unautocomplete", function() { |
select.unbind(); |
$input.unbind(); |
$(input.form).unbind(".autocomplete"); |
}); |
function selectCurrent() { |
var selected = select.selected(); |
if( !selected ) |
return false; |
var v = selected.result; |
previousValue = v; |
if ( options.multiple ) { |
var words = trimWords($input.val()); |
if ( words.length > 1 ) { |
var seperator = options.multipleSeparator.length; |
var cursorAt = $(input).selection().start; |
var wordAt, progress = 0; |
$.each(words, function(i, word) { |
progress += word.length; |
if (cursorAt <= progress) { |
wordAt = i; |
return false; |
} |
progress += seperator; |
}); |
words[wordAt] = v; |
// TODO this should set the cursor to the right position, but it gets overriden somewhere |
//$.Autocompleter.Selection(input, progress + seperator, progress + seperator); |
v = words.join( options.multipleSeparator ); |
} |
v += options.multipleSeparator; |
} |
$input.val(v); |
hideResultsNow(); |
$input.trigger("result", [selected.data, selected.value]); |
return true; |
} |
function onChange(crap, skipPrevCheck) { |
if( lastKeyPressCode == KEY.DEL ) { |
select.hide(); |
return; |
} |
var currentValue = $input.val(); |
if ( !skipPrevCheck && currentValue == previousValue ) |
return; |
previousValue = currentValue; |
currentValue = lastWord(currentValue); |
if ( currentValue.length >= options.minChars) { |
$input.addClass(options.loadingClass); |
if (!options.matchCase) |
currentValue = currentValue.toLowerCase(); |
request(currentValue, receiveData, hideResultsNow); |
} else { |
stopLoading(); |
select.hide(); |
} |
}; |
function trimWords(value) { |
if (!value) |
return [""]; |
if (!options.multiple) |
return [$.trim(value)]; |
return $.map(value.split(options.multipleSeparator), function(word) { |
return $.trim(value).length ? $.trim(word) : null; |
}); |
} |
function lastWord(value) { |
if ( !options.multiple ) |
return value; |
var words = trimWords(value); |
if (words.length == 1) |
return words[0]; |
var cursorAt = $(input).selection().start; |
if (cursorAt == value.length) { |
words = trimWords(value) |
} else { |
words = trimWords(value.replace(value.substring(cursorAt), "")); |
} |
return words[words.length - 1]; |
} |
// fills in the input box w/the first match (assumed to be the best match) |
// q: the term entered |
// sValue: the first matching result |
function autoFill(q, sValue){ |
// autofill in the complete box w/the first match as long as the user hasn't entered in more data |
// if the last user key pressed was backspace, don't autofill |
if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) { |
// fill in the value (keep the case the user has typed) |
$input.val($input.val() + sValue.substring(lastWord(previousValue).length)); |
// select the portion of the value not typed by the user (so the next character will erase) |
$(input).selection(previousValue.length, previousValue.length + sValue.length); |
} |
}; |
function hideResults() { |
clearTimeout(timeout); |
timeout = setTimeout(hideResultsNow, 200); |
}; |
function hideResultsNow() { |
var wasVisible = select.visible(); |
select.hide(); |
clearTimeout(timeout); |
stopLoading(); |
if (options.mustMatch) { |
// call search and run callback |
$input.search( |
function (result){ |
// if no value found, clear the input box |
if( !result ) { |
if (options.multiple) { |
var words = trimWords($input.val()).slice(0, -1); |
$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") ); |
} |
else { |
$input.val( "" ); |
$input.trigger("result", null); |
} |
} |
} |
); |
} |
}; |
function receiveData(q, data) { |
if ( data && data.length && hasFocus ) { |
stopLoading(); |
select.display(data, q); |
autoFill(q, data[0].value); |
select.show(); |
} else { |
hideResultsNow(); |
} |
}; |
function request(term, success, failure) { |
if (!options.matchCase) |
term = term.toLowerCase(); |
var data = cache.load(term); |
// recieve the cached data |
if (data && data.length) { |
success(term, data); |
// if an AJAX url has been supplied, try loading the data now |
} else if( (typeof options.url == "string") && (options.url.length > 0) ){ |
var extraParams = { |
timestamp: +new Date() |
}; |
$.each(options.extraParams, function(key, param) { |
extraParams[key] = typeof param == "function" ? param() : param; |
}); |
$.ajax({ |
// try to leverage ajaxQueue plugin to abort previous requests |
mode: "abort", |
// limit abortion to this input |
port: "autocomplete" + input.name, |
dataType: options.dataType, |
url: options.url, |
data: $.extend({ |
q: lastWord(term), |
limit: options.max |
}, extraParams), |
success: function(data) { |
var parsed = options.parse && options.parse(data) || parse(data); |
cache.add(term, parsed); |
success(term, parsed); |
} |
}); |
} else { |
// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match |
select.emptyList(); |
failure(term); |
} |
}; |
function parse(data) { |
var parsed = []; |
var rows = data.split("\n"); |
for (var i=0; i < rows.length; i++) { |
var row = $.trim(rows[i]); |
if (row) { |
row = row.split("|"); |
parsed[parsed.length] = { |
data: row, |
value: row[0], |
result: options.formatResult && options.formatResult(row, row[0]) || row[0] |
}; |
} |
} |
return parsed; |
}; |
function stopLoading() { |
$input.removeClass(options.loadingClass); |
}; |
}; |
$.Autocompleter.defaults = { |
inputClass: "ac_input", |
resultsClass: "ac_results", |
loadingClass: "ac_loading", |
minChars: 1, |
delay: 400, |
matchCase: false, |
matchSubset: true, |
matchContains: false, |
cacheLength: 10, |
max: 100, |
mustMatch: false, |
extraParams: {}, |
selectFirst: true, |
formatItem: function(row) { return row[0]; }, |
formatMatch: null, |
autoFill: false, |
width: 0, |
multiple: false, |
multipleSeparator: ", ", |
highlight: function(value, term) { |
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"); |
}, |
scroll: true, |
scrollHeight: 180 |
}; |
$.Autocompleter.Cache = function(options) { |
var data = {}; |
var length = 0; |
function matchSubset(s, sub) { |
if (!options.matchCase) |
s = s.toLowerCase(); |
var i = s.indexOf(sub); |
if (options.matchContains == "word"){ |
i = s.toLowerCase().search("\\b" + sub.toLowerCase()); |
} |
if (i == -1) return false; |
return i == 0 || options.matchContains; |
}; |
function add(q, value) { |
if (length > options.cacheLength){ |
flush(); |
} |
if (!data[q]){ |
length++; |
} |
data[q] = value; |
} |
function populate(){ |
if( !options.data ) return false; |
// track the matches |
var stMatchSets = {}, |
nullData = 0; |
// no url was specified, we need to adjust the cache length to make sure it fits the local data store |
if( !options.url ) options.cacheLength = 1; |
// track all options for minChars = 0 |
stMatchSets[""] = []; |
// loop through the array and create a lookup structure |
for ( var i = 0, ol = options.data.length; i < ol; i++ ) { |
var rawValue = options.data[i]; |
// if rawValue is a string, make an array otherwise just reference the array |
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; |
var value = options.formatMatch(rawValue, i+1, options.data.length); |
if ( value === false ) |
continue; |
var firstChar = value.charAt(0).toLowerCase(); |
// if no lookup array for this character exists, look it up now |
if( !stMatchSets[firstChar] ) |
stMatchSets[firstChar] = []; |
// if the match is a string |
var row = { |
value: value, |
data: rawValue, |
result: options.formatResult && options.formatResult(rawValue) || value |
}; |
// push the current match into the set list |
stMatchSets[firstChar].push(row); |
// keep track of minChars zero items |
if ( nullData++ < options.max ) { |
stMatchSets[""].push(row); |
} |
}; |
// add the data items to the cache |
$.each(stMatchSets, function(i, value) { |
// increase the cache size |
options.cacheLength++; |
// add to the cache |
add(i, value); |
}); |
} |
// populate any existing data |
setTimeout(populate, 25); |
function flush(){ |
data = {}; |
length = 0; |
} |
return { |
flush: flush, |
add: add, |
populate: populate, |
load: function(q) { |
if (!options.cacheLength || !length) |
return null; |
/* |
* if dealing w/local data and matchContains than we must make sure |
* to loop through all the data collections looking for matches |
*/ |
if( !options.url && options.matchContains ){ |
// track all matches |
var csub = []; |
// loop through all the data grids for matches |
for( var k in data ){ |
// don't search through the stMatchSets[""] (minChars: 0) cache |
// this prevents duplicates |
if( k.length > 0 ){ |
var c = data[k]; |
$.each(c, function(i, x) { |
// if we've got a match, add it to the array |
if (matchSubset(x.value, q)) { |
csub.push(x); |
} |
}); |
} |
} |
return csub; |
} else |
// if the exact item exists, use it |
if (data[q]){ |
return data[q]; |
} else |
if (options.matchSubset) { |
for (var i = q.length - 1; i >= options.minChars; i--) { |
var c = data[q.substr(0, i)]; |
if (c) { |
var csub = []; |
$.each(c, function(i, x) { |
if (matchSubset(x.value, q)) { |
csub[csub.length] = x; |
} |
}); |
return csub; |
} |
} |
} |
return null; |
} |
}; |
}; |
$.Autocompleter.Select = function (options, input, select, config) { |
var CLASSES = { |
ACTIVE: "ac_over" |
}; |
var listItems, |
active = -1, |
data, |
term = "", |
needsInit = true, |
element, |
list; |
// Create results |
function init() { |
if (!needsInit) |
return; |
element = $("<div/>") |
.hide() |
.addClass(options.resultsClass) |
.css("position", "absolute") |
.appendTo(document.body); |
list = $("<ul/>").appendTo(element).mouseover( function(event) { |
if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { |
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); |
$(target(event)).addClass(CLASSES.ACTIVE); |
} |
}).click(function(event) { |
$(target(event)).addClass(CLASSES.ACTIVE); |
select(); |
// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus |
input.focus(); |
return false; |
}).mousedown(function() { |
config.mouseDownOnSelect = true; |
}).mouseup(function() { |
config.mouseDownOnSelect = false; |
}); |
if( options.width > 0 ) |
element.css("width", options.width); |
needsInit = false; |
} |
function target(event) { |
var element = event.target; |
while(element && element.tagName != "LI") |
element = element.parentNode; |
// more fun with IE, sometimes event.target is empty, just ignore it then |
if(!element) |
return []; |
return element; |
} |
function moveSelect(step) { |
listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); |
movePosition(step); |
var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); |
if(options.scroll) { |
var offset = 0; |
listItems.slice(0, active).each(function() { |
offset += this.offsetHeight; |
}); |
if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { |
list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); |
} else if(offset < list.scrollTop()) { |
list.scrollTop(offset); |
} |
} |
}; |
function movePosition(step) { |
active += step; |
if (active < 0) { |
active = listItems.size() - 1; |
} else if (active >= listItems.size()) { |
active = 0; |
} |
} |
function limitNumberOfItems(available) { |
return options.max && options.max < available |
? options.max |
: available; |
} |
function fillList() { |
list.empty(); |
var max = limitNumberOfItems(data.length); |
for (var i=0; i < max; i++) { |
if (!data[i]) |
continue; |
var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term); |
if ( formatted === false ) |
continue; |
var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; |
$.data(li, "ac_data", data[i]); |
} |
listItems = list.find("li"); |
if ( options.selectFirst ) { |
listItems.slice(0, 1).addClass(CLASSES.ACTIVE); |
active = 0; |
} |
// apply bgiframe if available |
if ( $.fn.bgiframe ) |
list.bgiframe(); |
} |
return { |
display: function(d, q) { |
init(); |
data = d; |
term = q; |
fillList(); |
}, |
next: function() { |
moveSelect(1); |
}, |
prev: function() { |
moveSelect(-1); |
}, |
pageUp: function() { |
if (active != 0 && active - 8 < 0) { |
moveSelect( -active ); |
} else { |
moveSelect(-8); |
} |
}, |
pageDown: function() { |
if (active != listItems.size() - 1 && active + 8 > listItems.size()) { |
moveSelect( listItems.size() - 1 - active ); |
} else { |
moveSelect(8); |
} |
}, |
hide: function() { |
element && element.hide(); |
listItems && listItems.removeClass(CLASSES.ACTIVE); |
active = -1; |
}, |
visible : function() { |
return element && element.is(":visible"); |
}, |
current: function() { |
return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); |
}, |
show: function() { |
var offset = $(input).offset(); |
element.css({ |
width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).innerWidth(), |
top: offset.top + input.offsetHeight, |
left: offset.left |
}).show(); |
options.show(element); |
if(options.scroll) { |
list.scrollTop(0); |
list.css({ |
maxHeight: options.scrollHeight, |
overflow: 'auto' |
}); |
if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { |
var listHeight = 0; |
listItems.each(function() { |
listHeight += this.offsetHeight; |
}); |
var scrollbarsVisible = listHeight > options.scrollHeight; |
list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight ); |
if (!scrollbarsVisible) { |
// IE doesn't recalculate width when scrollbar disappears |
listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); |
} |
} |
} |
}, |
selected: function() { |
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); |
return selected && selected.length && $.data(selected[0], "ac_data"); |
}, |
emptyList: function (){ |
list && list.empty(); |
}, |
unbind: function() { |
element && element.remove(); |
} |
}; |
}; |
$.fn.selection = function(start, end) { |
if (start !== undefined) { |
return this.each(function() { |
if( this.createTextRange ){ |
var selRange = this.createTextRange(); |
if (end === undefined || start == end) { |
selRange.move("character", start); |
selRange.select(); |
} else { |
selRange.collapse(true); |
selRange.moveStart("character", start); |
selRange.moveEnd("character", end); |
selRange.select(); |
} |
} else if( this.setSelectionRange ){ |
this.setSelectionRange(start, end); |
} else if( this.selectionStart ){ |
this.selectionStart = start; |
this.selectionEnd = end; |
} |
}); |
} |
var field = this[0]; |
if ( field.createTextRange ) { |
var range = document.selection.createRange(), |
orig = field.value, |
teststring = "<->", |
textLength = range.text.length; |
range.text = teststring; |
var caretAt = field.value.indexOf(teststring); |
field.value = orig; |
this.selection(caretAt, caretAt + textLength); |
return { |
start: caretAt, |
end: caretAt + textLength |
} |
} else if( field.selectionStart !== undefined ){ |
return { |
start: field.selectionStart, |
end: field.selectionEnd |
} |
} |
}; |
})(jQuery); |
/** |
* jQuery.fn.sortElements |
* -------------- |
* @author James Padolsey (http://james.padolsey.com) |
* @version 0.11 |
* @updated 18-MAR-2010 |
* -------------- |
* @param Function comparator: |
* Exactly the same behaviour as [1,2,3].sort(comparator) |
* |
* @param Function getSortable |
* A function that should return the element that is |
* to be sorted. The comparator will run on the |
* current collection, but you may want the actual |
* resulting sort to occur on a parent or another |
* associated element. |
* |
* E.g. $('td').sortElements(comparator, function(){ |
* return this.parentNode; |
* }) |
* |
* The <td>'s parent (<tr>) will be sorted instead |
* of the <td> itself. |
*/ |
jQuery.fn.sortElements = (function(){ |
var sort = [].sort; |
return function(comparator, getSortable) { |
getSortable = getSortable || function(){return this;}; |
var placements = this.map(function(){ |
var sortElement = getSortable.call(this), |
parentNode = sortElement.parentNode, |
// Since the element itself will change position, we have |
// to have some way of storing it's original position in |
// the DOM. The easiest way is to have a 'flag' node: |
nextSibling = parentNode.insertBefore( |
document.createTextNode(''), |
sortElement.nextSibling |
); |
return function() { |
if (parentNode === this) { |
throw new Error( |
"You can't sort elements if any one is a descendant of another." |
); |
} |
// Insert before flag: |
parentNode.insertBefore(this, nextSibling); |
// Remove flag: |
parentNode.removeChild(nextSibling); |
}; |
}); |
return sort.call(this, comparator).each(function(i){ |
placements[i].call(getSortable.call(this)); |
}); |
}; |
})(); |
/*! |
* ApiGen 2.8.0 - API documentation generator for PHP 5.3+ |
* |
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com) |
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich) |
* Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville) |
* |
* For the full copyright and license information, please view |
* the file LICENSE.md that was distributed with this source code. |
*/ |
$(function() { |
var $document = $(document); |
var $left = $('#left'); |
var $right = $('#right'); |
var $rightInner = $('#rightInner'); |
var $splitter = $('#splitter'); |
var $groups = $('#groups'); |
var $content = $('#content'); |
// Menu |
// Hide deep packages and namespaces |
$('ul span', $groups).click(function(event) { |
event.preventDefault(); |
event.stopPropagation(); |
$(this) |
.toggleClass('collapsed') |
.parent() |
.next('ul') |
.toggleClass('collapsed'); |
}).click(); |
$active = $('ul li.active', $groups); |
if ($active.length > 0) { |
// Open active |
$('> a > span', $active).click(); |
} else { |
$main = $('> ul > li.main', $groups); |
if ($main.length > 0) { |
// Open first level of the main project |
$('> a > span', $main).click(); |
} else { |
// Open first level of all |
$('> ul > li > a > span', $groups).click(); |
} |
} |
// Content |
// Search autocompletion |
var autocompleteFound = false; |
var autocompleteFiles = {'c': 'class', 'co': 'constant', 'f': 'function', 'm': 'class', 'mm': 'class', 'p': 'class', 'mp': 'class', 'cc': 'class'}; |
var $search = $('#search input[name=q]'); |
$search |
.autocomplete(ApiGen.elements, { |
matchContains: true, |
scrollHeight: 200, |
max: 20, |
formatItem: function(data) { |
return data[1].replace(/^(.+\\)(.+)$/, '<span><small>$1</small>$2</span>'); |
}, |
formatMatch: function(data) { |
return data[1]; |
}, |
formatResult: function(data) { |
return data[1]; |
}, |
show: function($list) { |
var $items = $('li span', $list); |
var maxWidth = Math.max.apply(null, $items.map(function() { |
return $(this).width(); |
})); |
// 10px padding |
$list |
.width(Math.max(maxWidth + 10, $search.innerWidth())) |
.css('left', $search.offset().left + $search.outerWidth() - $list.outerWidth()); |
} |
}).result(function(event, data) { |
autocompleteFound = true; |
var location = window.location.href.split('/'); |
location.pop(); |
var parts = data[1].split(/::|$/); |
var file = $.sprintf(ApiGen.config.templates.main[autocompleteFiles[data[0]]].filename, parts[0].replace(/[^\w]/g, '.')); |
if (parts[1]) { |
file += '#' + ('mm' === data[0] || 'mp' === data[0] ? 'm' : '') + parts[1].replace(/([\w]+)\(\)/, '_$1'); |
} |
location.push(file); |
window.location = location.join('/'); |
// Workaround for Opera bug |
$(this).closest('form').attr('action', location.join('/')); |
}).closest('form') |
.submit(function() { |
var query = $search.val(); |
if ('' === query) { |
return false; |
} |
var label = $('#search input[name=more]').val(); |
if (!autocompleteFound && label && -1 === query.indexOf('more:')) { |
$search.val(query + ' more:' + label); |
} |
return !autocompleteFound && '' !== $('#search input[name=cx]').val(); |
}); |
// Save natural order |
$('table.summary tr[data-order]', $content).each(function(index) { |
do { |
index = '0' + index; |
} while (index.length < 3); |
$(this).attr('data-order-natural', index); |
}); |
// Switch between natural and alphabetical order |
var $caption = $('table.summary', $content) |
.filter(':has(tr[data-order])') |
.find('caption'); |
$caption |
.click(function() { |
var $this = $(this); |
var order = $this.data('order') || 'natural'; |
order = 'natural' === order ? 'alphabetical' : 'natural'; |
$this.data('order', order); |
$.cookie('order', order, {expires: 365}); |
var attr = 'alphabetical' === order ? 'data-order' : 'data-order-natural'; |
$this |
.closest('table') |
.find('tr').sortElements(function(a, b) { |
return $(a).attr(attr) > $(b).attr(attr) ? 1 : -1; |
}); |
return false; |
}) |
.addClass('switchable') |
.attr('title', 'Switch between natural and alphabetical order'); |
if ((null === $.cookie('order') && 'alphabetical' === ApiGen.config.options.elementsOrder) || 'alphabetical' === $.cookie('order')) { |
$caption.click(); |
} |
// Open details |
if (ApiGen.config.options.elementDetailsCollapsed) { |
$('tr', $content).filter(':has(.detailed)') |
.click(function() { |
var $this = $(this); |
$('.short', $this).hide(); |
$('.detailed', $this).show(); |
}); |
} |
// Splitter |
var splitterWidth = $splitter.width(); |
function setSplitterPosition(position) |
{ |
$left.width(position); |
$right.css('margin-left', position + splitterWidth); |
$splitter.css('left', position); |
} |
function setNavigationPosition() |
{ |
var width = $rightInner.width(); |
$rightInner |
.toggleClass('medium', width <= 960) |
.toggleClass('small', width <= 650); |
} |
$splitter.mousedown(function() { |
$splitter.addClass('active'); |
$document.mousemove(function(event) { |
if (event.pageX >= 230 && $document.width() - event.pageX >= 600 + splitterWidth) { |
setSplitterPosition(event.pageX); |
setNavigationPosition(); |
} |
}); |
$() |
.add($splitter) |
.add($document) |
.mouseup(function() { |
$splitter |
.removeClass('active') |
.unbind('mouseup'); |
$document |
.unbind('mousemove') |
.unbind('mouseup'); |
$.cookie('splitter', parseInt($splitter.css('left')), {expires: 365}); |
}); |
return false; |
}); |
var splitterPosition = $.cookie('splitter'); |
if (null !== splitterPosition) { |
setSplitterPosition(parseInt(splitterPosition)); |
} |
setNavigationPosition(); |
$(window).resize(setNavigationPosition); |
// Select selected lines |
var matches = window.location.hash.substr(1).match(/^\d+(?:-\d+)?(?:,\d+(?:-\d+)?)*$/); |
if (null !== matches) { |
var lists = matches[0].split(','); |
for (var i = 0; i < lists.length; i++) { |
var lines = lists[i].split('-'); |
lines[1] = lines[1] || lines[0]; |
for (var j = lines[0]; j <= lines[1]; j++) { |
$('#' + j).addClass('selected'); |
} |
} |
var $firstLine = $('#' + parseInt(matches[0])); |
if ($firstLine.length > 0) { |
$right.scrollTop($firstLine.offset().top); |
} |
} |
// Save selected lines |
var lastLine; |
$('a.l').click(function(event) { |
event.preventDefault(); |
var $selectedLine = $(this).parent(); |
var selectedLine = parseInt($selectedLine.attr('id')); |
if (event.shiftKey) { |
if (lastLine) { |
for (var i = Math.min(selectedLine, lastLine); i <= Math.max(selectedLine, lastLine); i++) { |
$('#' + i).addClass('selected'); |
} |
} else { |
$selectedLine.addClass('selected'); |
} |
} else if (event.ctrlKey) { |
$selectedLine.toggleClass('selected'); |
} else { |
var $selected = $('.l.selected') |
.not($selectedLine) |
.removeClass('selected'); |
if ($selected.length > 0) { |
$selectedLine.addClass('selected'); |
} else { |
$selectedLine.toggleClass('selected'); |
} |
} |
lastLine = $selectedLine.hasClass('selected') ? selectedLine : null; |
// Update hash |
var lines = $('.l.selected') |
.map(function() { |
return parseInt($(this).attr('id')); |
}) |
.get() |
.sort(function(a, b) { |
return a - b; |
}); |
var hash = []; |
var list = []; |
for (var j = 0; j < lines.length; j++) { |
if (0 === j && j + 1 === lines.length) { |
hash.push(lines[j]); |
} else if (0 === j) { |
list[0] = lines[j]; |
} else if (lines[j - 1] + 1 !== lines[j] && j + 1 === lines.length) { |
hash.push(list.join('-')); |
hash.push(lines[j]); |
} else if (lines[j - 1] + 1 !== lines[j]) { |
hash.push(list.join('-')); |
list = [lines[j]]; |
} else if (j + 1 === lines.length) { |
list[1] = lines[j]; |
hash.push(list.join('-')); |
} else { |
list[1] = lines[j]; |
} |
} |
window.location.hash = hash.join(','); |
}); |
}); |
/trunk/doc/ApiGen/source-class-Cli.html |
---|
New file |
0,0 → 1,228 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Cli.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li class="active"><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Cli.html" title="Summary of Cli"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * CLI permet de récupérer les paramètres passés en ligne de commande pour instancier une classe héritant de la classe abstraite |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * Script. |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * Elle va déclencher l'éxecution du script via l'appel de la méthode executer(). |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * C'est une Singleton. |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @package Framework |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @author Delphine CAUQUIL <delphine@tela-botanica.org> |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> * @version $Id: Cli.php 387 2011-10-28 15:57:40Z jpm $ |
</span></span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-comment"> */</span> |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a><span class="php-keyword1">class</span> <a id="Cli" href="#Cli">Cli</a> { |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> <span class="php-comment">/** Tableau des noms des paramètres à définir dans le fichier de config car obligatoirement nécessaire à cette classe.*/</span> |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$parametres_obligatoires" href="#$parametres_obligatoires">$parametres_obligatoires</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'chemin_modules'</span>); |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> <span class="php-comment">/** |
</span></span><span id="28" class="l"><a class="l" href="#28"> 28: </a><span class="php-comment"> * Execute la ligne de commande en récupérant le nom du script à lancer et ses paramètres. |
</span></span><span id="29" class="l"><a class="l" href="#29"> 29: </a><span class="php-comment"> * Instancie la classe du script à lancer et appelle la méthode executer(). |
</span></span><span id="30" class="l"><a class="l" href="#30"> 30: </a><span class="php-comment"> * @return void |
</span></span><span id="31" class="l"><a class="l" href="#31"> 31: </a><span class="php-comment"> */</span> |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_executer" href="#_executer">executer</a>() { |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> <span class="php-keyword1">if</span> (<span class="php-var">$_SERVER</span>[<span class="php-quote">'argc'</span>] < <span class="php-num">2</span>){ |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Erreur: vous n'avez pas indiqué le nom du script. Voir '"</span>.<span class="php-var">$_SERVER</span>[<span class="php-quote">'argv'</span>][<span class="php-num">0</span>].<span class="php-quote">" help'.\n"</span>, E_USER_ERROR); |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> } |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> <span class="php-comment">// Récupération de la ligne de commande</span> |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> <span class="php-var">$argv</span> = <span class="php-var">$_SERVER</span>[<span class="php-quote">'argv'</span>]; |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> <span class="php-comment">// Nous dépilons le nom du fichier qui initialise le framework et appele cette méthode.</span> |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> <span class="php-keyword2">array_shift</span>(<span class="php-var">$argv</span>); |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> <span class="php-comment">// Nous dépilons le nom du script à lancer</span> |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> <span class="php-var">$script</span> = <span class="php-keyword2">array_shift</span>(<span class="php-var">$argv</span>); |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> <span class="php-comment">// Récupération des paramètres d'execution du script</span> |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> <span class="php-var">$parametres</span> = self::getParametres(<span class="php-var">$argv</span>); |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> <span class="php-comment">// Chargement du script à lancer</span> |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> <span class="php-var">$Script</span> = Cli::charger(<span class="php-var">$script</span>, <span class="php-var">$parametres</span>); |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_null</span>(<span class="php-var">$Script</span>)) { |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-var">$Script</span>->executer(); |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> } |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> <span class="php-comment">// Affichage des exceptions et erreurs générées par le script</span> |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> <span class="php-keyword1">echo</span> GestionnaireException::getExceptions(); |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> <span class="php-comment">// Fin d'execution</span> |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> <span class="php-keyword1">exit</span>(<span class="php-num">0</span>); |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> } |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_charger" href="#_charger">charger</a>(<span class="php-var">$script_nom</span>, <span class="php-var">$parametres</span>) { |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> <span class="php-var">$Script</span> = <span class="php-keyword1">null</span>; |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> Config::verifierPresenceParametres(self::<span class="php-var">$parametres_obligatoires</span>); |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strpos</span>(<span class="php-var">$script_nom</span>, DS)) { |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-var">$decompoScriptNom</span> = <span class="php-keyword2">explode</span>(DS, <span class="php-var">$script_nom</span>); |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> <span class="php-var">$script_nom</span> = <span class="php-keyword2">array_pop</span>(<span class="php-var">$decompoScriptNom</span>); |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> <span class="php-var">$dossier_nom</span> = <span class="php-keyword2">implode</span>(DS, <span class="php-var">$decompoScriptNom</span>); |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> } <span class="php-keyword1">else</span> { |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> <span class="php-var">$dossier_nom</span> = <span class="php-keyword2">strtolower</span>(<span class="php-var">$script_nom</span>); |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> } |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> <span class="php-var">$classe_nom</span> = self::obtenirNomClasse(<span class="php-var">$script_nom</span>); |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> <span class="php-var">$fichier_script</span> = Config::get(<span class="php-quote">'chemin_modules'</span>).<span class="php-var">$dossier_nom</span>.DS.<span class="php-var">$classe_nom</span>.<span class="php-quote">'.php'</span>; |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">file_exists</span>(<span class="php-var">$fichier_script</span>)){ |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Erreur : script '</span><span class="php-var">$fichier_script</span><span class="php-quote">' inconnu!\n"</span>, E_USER_ERROR); |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> } <span class="php-keyword1">else</span> { |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> <span class="php-keyword1">require_once</span> <span class="php-var">$fichier_script</span>; |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">class_exists</span>( <span class="php-var">$classe_nom</span>)) { |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Erreur: impossible de trouver la classe de la commande : </span><span class="php-var">$classe_nom</span><span class="php-quote">\n"</span>, E_USER_ERROR); |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> } <span class="php-keyword1">else</span> { |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> <span class="php-var">$Script</span> = <span class="php-keyword1">new</span> <span class="php-var">$classe_nom</span>(<span class="php-var">$script_nom</span>, <span class="php-var">$parametres</span>); |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> } |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> } |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> <span class="php-keyword1">return</span> <span class="php-var">$Script</span>; |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> } |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_obtenirNomClasse" href="#_obtenirNomClasse">obtenirNomClasse</a>(<span class="php-var">$script_nom</span>) { |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> <span class="php-var">$nom_classe</span> = <span class="php-keyword2">implode</span>(<span class="php-quote">''</span>, <span class="php-keyword2">array_map</span>(<span class="php-quote">'ucfirst'</span>, <span class="php-keyword2">explode</span>(<span class="php-quote">'_'</span>, <span class="php-keyword2">strtolower</span>(<span class="php-var">$script_nom</span>)))); |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> <span class="php-keyword1">return</span> <span class="php-var">$nom_classe</span>; |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> } |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getParametres" href="#_getParametres">getParametres</a>(<span class="php-var">$argv</span>) { |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-var">$parametres</span> = <span class="php-keyword1">array</span>(); |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> <span class="php-comment">// Récupération des options</span> |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> <span class="php-keyword1">while</span> (<span class="php-keyword2">count</span>(<span class="php-var">$argv</span>)) { |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$argv</span>[<span class="php-num">1</span>]) && <span class="php-var">$argv</span>[<span class="php-num">1</span>]{<span class="php-num">0</span>} != <span class="php-quote">'-'</span>) { |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-var">$param</span> = <span class="php-keyword2">array_shift</span>(<span class="php-var">$argv</span>); |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-var">$parametres</span>[<span class="php-var">$param</span>] = <span class="php-keyword2">array_shift</span>(<span class="php-var">$argv</span>); |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> } <span class="php-keyword1">elseif</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$argv</span>[<span class="php-num">1</span>]) || <span class="php-var">$argv</span>[<span class="php-num">1</span>]{<span class="php-num">0</span>} == <span class="php-quote">'-'</span>) { |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> <span class="php-var">$parametres</span>[<span class="php-keyword2">array_shift</span>(<span class="php-var">$argv</span>)] = <span class="php-keyword1">null</span>; |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> } <span class="php-keyword1">else</span> { |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Erreur: valeur manquante pour le paramêtre '"</span>.<span class="php-var">$argv</span>[<span class="php-num">0</span>].<span class="php-quote">"' \n"</span>, E_USER_ERROR); |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> } |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> } |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-keyword1">return</span> <span class="php-var">$parametres</span>; |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> } |
</span><span id="107" class="l"><a class="l" href="#107">107: </a>} |
</span><span id="108" class="l"><a class="l" href="#108">108: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-RestClient.html |
---|
New file |
0,0 → 1,339 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/RestClient.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li class="active"><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-RestClient.html" title="Summary of RestClient"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment">* Classe client permettant d'interroger des services web REST. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment">* |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment">* @category php 5.2 |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment">* @package Framework |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment">* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment">* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment">* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment">* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment">* @version $Id: RestClient.php 439 2013-10-14 15:48:41Z raphael $ |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment">*/</span> |
</span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-keyword1">class</span> <a id="RestClient" href="#RestClient">RestClient</a> { |
</span><span id="15" class="l"><a class="l" href="#15"> 15: </a> <span class="php-keyword1">const</span> <a id="HTTP_URL_REQUETE_SEPARATEUR" href="#HTTP_URL_REQUETE_SEPARATEUR">HTTP_URL_REQUETE_SEPARATEUR</a> = <span class="php-quote">'&'</span>; |
</span><span id="16" class="l"><a class="l" href="#16"> 16: </a> <span class="php-keyword1">const</span> <a id="HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR" href="#HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR">HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR</a> = <span class="php-quote">'='</span>; |
</span><span id="17" class="l"><a class="l" href="#17"> 17: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$http_methodes" href="#$http_methodes">$http_methodes</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'GET'</span>, <span class="php-quote">'POST'</span>, <span class="php-quote">'PUT'</span>, <span class="php-quote">'DELETE'</span>, <span class="php-quote">'HEAD'</span>, <span class="php-quote">'OPTIONS'</span>, <span class="php-quote">'CONNECT'</span>, <span class="php-quote">'TRACE'</span>); |
</span><span id="18" class="l"><a class="l" href="#18"> 18: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$parametres" href="#$parametres">$parametres</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="19" class="l"><a class="l" href="#19"> 19: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$url" href="#$url">$url</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$reponse_entetes" href="#$reponse_entetes">$reponse_entetes</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> <span class="php-comment">//+----------------------------------------------------------------------------------------------------------------+</span> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> <span class="php-comment">// ACCESSEURS</span> |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getReponseEntetes" href="#_getReponseEntetes">getReponseEntetes</a>() { |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->reponse_entetes; |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> } |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getParametre" href="#_getParametre">getParametre</a>(<span class="php-var">$cle</span>) { |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-var">$valeur</span> = (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->parametres[<span class="php-var">$cle</span>])) ? <span class="php-var">$this</span>->parametres[<span class="php-var">$cle</span>] : <span class="php-keyword1">null</span>; |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> <span class="php-keyword1">return</span> <span class="php-var">$valeur</span>; |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> } |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ajouterParametre" href="#_ajouterParametre">ajouterParametre</a>(<span class="php-var">$cle</span>, <span class="php-var">$valeur</span>) { |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-var">$this</span>->parametres[<span class="php-var">$cle</span>] = <span class="php-var">$valeur</span>; |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> } |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_supprimerParametre" href="#_supprimerParametre">supprimerParametre</a>(<span class="php-var">$cle</span>) { |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> <span class="php-keyword1">unset</span>(<span class="php-var">$this</span>->parametres[<span class="php-var">$cle</span>]); |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> } |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_nettoyerParametres" href="#_nettoyerParametres">nettoyerParametres</a>() { |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> <span class="php-var">$this</span>->parametres = <span class="php-keyword1">null</span>; |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> } |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> <span class="php-comment">//+----------------------------------------------------------------------------------------------------------------+</span> |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> <span class="php-comment">// MÉTHODES</span> |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_consulter" href="#_consulter">consulter</a>(<span class="php-var">$url</span>) { |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->envoyerRequete(<span class="php-var">$url</span>, <span class="php-quote">'GET'</span>); |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> } |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ajouter" href="#_ajouter">ajouter</a>(<span class="php-var">$url</span>, <span class="php-keyword1">Array</span> <span class="php-var">$donnees</span>) { |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->envoyerRequete(<span class="php-var">$url</span>, <span class="php-quote">'PUT'</span>, <span class="php-var">$donnees</span>); |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> } |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_modifier" href="#_modifier">modifier</a>(<span class="php-var">$url</span>, <span class="php-keyword1">Array</span> <span class="php-var">$donnees</span>) { |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->envoyerRequete(<span class="php-var">$url</span>, <span class="php-quote">'POST'</span>, <span class="php-var">$donnees</span>); |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> } |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_supprimer" href="#_supprimer">supprimer</a>(<span class="php-var">$url</span>) { |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->envoyerRequete(<span class="php-var">$url</span>, <span class="php-quote">'DELETE'</span>); |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> } |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_envoyerCurlRequete" href="#_envoyerCurlRequete">envoyerCurlRequete</a>(<span class="php-var">$url</span>, <span class="php-var">$mode</span>, <span class="php-keyword1">Array</span> <span class="php-var">$donnees</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> <span class="php-var">$this</span>->url = <span class="php-var">$url</span>; |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> <span class="php-var">$contenu</span> = <span class="php-keyword1">false</span>; |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> <span class="php-keyword1">if</span> (! <span class="php-keyword2">in_array</span>(<span class="php-var">$mode</span>, <span class="php-var">$this</span>->http_methodes)) { |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> <span class="php-var">$e</span> = <span class="php-quote">"Le mode de requête '</span><span class="php-var">$mode</span><span class="php-quote">' n'est pas accepté!"</span>; |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_WARNING); |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> } <span class="php-keyword1">else</span> { |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> <span class="php-keyword1">if</span> (<span class="php-var">$mode</span> == <span class="php-quote">'GET'</span>) { |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> <span class="php-var">$this</span>->traiterUrlParametres(); |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> } |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> <span class="php-var">$ch</span> = <span class="php-keyword2">curl_init</span>(<span class="php-var">$this</span>->url); |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_HEADER, <span class="php-keyword1">TRUE</span>); |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_RETURNTRANSFER, <span class="php-keyword1">TRUE</span>); |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_FOLLOWLOCATION, <span class="php-num">1</span>); |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> <span class="php-keyword1">if</span>(<span class="php-var">$mode</span> == <span class="php-quote">'POST'</span>) <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_POST, <span class="php-keyword1">TRUE</span>); |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> <span class="php-keyword1">elseif</span>(<span class="php-var">$mode</span> == <span class="php-quote">'PUT'</span>) <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_PUT, <span class="php-keyword1">TRUE</span>); |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-keyword1">elseif</span>(<span class="php-var">$mode</span> == <span class="php-quote">'DELETE'</span>) <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_CUSTOMREQUEST, <span class="php-quote">"DELETE"</span>); |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> <span class="php-keyword1">if</span>(<span class="php-var">$donnees</span>) <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_POSTFIELDS, <span class="php-keyword2">http_build_query</span>(<span class="php-var">$donnees</span>, <span class="php-keyword1">null</span>, self::HTTP_URL_REQUETE_SEPARATEUR)); |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-comment">/* if(isset($_COOKIES["XDEBUG_PROFILE"])) curl_setopt($ch, CURLOPT_COOKIE, "XDEBUG_PROFILE"); |
</span></span><span id="92" class="l"><a class="l" href="#92"> 92: </a><span class="php-comment"> $caller = self::getCaller(debug_backtrace()); |
</span></span><span id="93" class="l"><a class="l" href="#93"> 93: </a><span class="php-comment"> @curl_setopt($ch, CURLOPT_REFERER, sprintf("%s[%s:%d:%s]", $_SERVER['REQUEST_URI'], $caller['file'], $caller['line'], $caller['function'])); // $_SERVER['QUERY_STRING']; // debug */</span> |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> <span class="php-var">$flux</span> = <span class="php-keyword2">curl_exec</span>(<span class="php-var">$ch</span>); |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> <span class="php-keyword2">curl_close</span>(<span class="php-var">$ch</span>); |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-keyword1">if</span> (!<span class="php-var">$flux</span>) { |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-var">$this</span>->reponse_entetes = <span class="php-var">$http_response_header</span>; |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-keyword2">sprintf</span>(<span class="php-quote">"fail: %s \"%s\" (%s)"</span>, <span class="php-keyword2">strtoupper</span>(<span class="php-var">$mode</span>), <span class="php-var">$this</span>->url, <span class="php-keyword2">http_build_query</span>(<span class="php-var">$donnees</span>, <span class="php-keyword1">null</span>, self::HTTP_URL_REQUETE_SEPARATEUR)), |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> E_USER_WARNING); |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> } <span class="php-keyword1">else</span> { |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> <span class="php-comment">// attention, CURLOPT_FOLLOWLOCATION amène le stream à contenir plusieurs section d'header HTTP successives</span> |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> <span class="php-var">$t</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">"\r\n\r\n"</span>, <span class="php-var">$flux</span>); |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> <span class="php-var">$contenu</span> = <span class="php-keyword2">array_splice</span>(<span class="php-var">$t</span>, -<span class="php-num">1</span>); |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-var">$dernier_entete</span> = <span class="php-keyword2">array_splice</span>(<span class="php-var">$t</span>, -<span class="php-num">1</span>); |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> <span class="php-var">$contenu</span> = <span class="php-var">$contenu</span>[<span class="php-num">0</span>]; |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> <span class="php-var">$dernier_entete</span> = <span class="php-var">$dernier_entete</span>[<span class="php-num">0</span>]; |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> <span class="php-comment">// XXX: mimic stream_get_meta_data() (ce qui n'est pas très propre, le code appelant ferait mieux de se mettre à jour)</span> |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> <span class="php-var">$this</span>->reponse_entetes = <span class="php-keyword1">array</span>(<span class="php-quote">'wrapper_data'</span> => <span class="php-keyword2">explode</span>(<span class="php-quote">"\r\n"</span>, <span class="php-var">$dernier_entete</span>)); |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> } |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> <span class="php-var">$this</span>->traiterEntete(); |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> } |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> <span class="php-var">$this</span>->reinitialiser(); |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> <span class="php-keyword1">return</span> <span class="php-var">$contenu</span>; |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> } |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getCaller" href="#_getCaller">getCaller</a>(<span class="php-var">$trace</span>) { |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> <span class="php-keyword1">foreach</span>(<span class="php-var">$trace</span> <span class="php-keyword1">as</span> <span class="php-var">$v</span>) <span class="php-keyword1">if</span>(<span class="php-keyword2">strpos</span>(<span class="php-var">$v</span>[<span class="php-quote">'file'</span>], <span class="php-quote">'/modules/'</span>) !== <span class="php-keyword1">false</span>) <span class="php-keyword1">return</span> <span class="php-var">$v</span>; |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">NULL</span>; |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> } |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_envoyerRequete" href="#_envoyerRequete">envoyerRequete</a>(<span class="php-var">$url</span>, <span class="php-var">$mode</span>, <span class="php-keyword1">Array</span> <span class="php-var">$donnees</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> <span class="php-comment">// error_log("framework/envoyerRequete: $mode $url");</span> |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-comment">// nous n'activons le wrapper que pour GET pour l'instant</span> |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-comment">// car l'utilisation de curl pour les autres modes pourrait</span> |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-comment">// vraisemblablement induire des comportements différents. (test-suite needed)</span> |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> <span class="php-keyword1">if</span>(<span class="php-keyword1">FALSE</span> && <span class="php-keyword2">function_exists</span>(<span class="php-quote">'curl_init'</span>) && <span class="php-var">$mode</span> == <span class="php-quote">'GET'</span>) { |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->envoyerCurlRequete(<span class="php-var">$url</span>, <span class="php-var">$mode</span>, <span class="php-var">$donnees</span>); |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> } |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> <span class="php-var">$this</span>->url = <span class="php-var">$url</span>; |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> <span class="php-var">$contenu</span> = <span class="php-keyword1">false</span>; |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> <span class="php-keyword1">if</span> (! <span class="php-keyword2">in_array</span>(<span class="php-var">$mode</span>, <span class="php-var">$this</span>->http_methodes)) { |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> <span class="php-var">$e</span> = <span class="php-quote">"Le mode de requête '</span><span class="php-var">$mode</span><span class="php-quote">' n'est pas accepté!"</span>; |
</span><span id="137" class="l"><a class="l" href="#137">137: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_WARNING); |
</span><span id="138" class="l"><a class="l" href="#138">138: </a> } <span class="php-keyword1">else</span> { |
</span><span id="139" class="l"><a class="l" href="#139">139: </a> <span class="php-keyword1">if</span> (<span class="php-var">$mode</span> == <span class="php-quote">'GET'</span>) { |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> <span class="php-var">$this</span>->traiterUrlParametres(); |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> } |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> <span class="php-var">$contexte</span> = <span class="php-keyword2">stream_context_create</span>(<span class="php-keyword1">array</span>( |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-quote">'http'</span> => <span class="php-keyword1">array</span>( |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-quote">'method'</span> => <span class="php-var">$mode</span>, |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> <span class="php-quote">'header'</span> => <span class="php-quote">"Content-type: application/x-www-form-urlencoded\r\n"</span>, |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> <span class="php-quote">'content'</span> => <span class="php-keyword2">http_build_query</span>(<span class="php-var">$donnees</span>, <span class="php-keyword1">null</span>, self::HTTP_URL_REQUETE_SEPARATEUR)))); |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> <span class="php-var">$flux</span> = @<span class="php-keyword2">fopen</span>(<span class="php-var">$this</span>->url, <span class="php-quote">'r'</span>, <span class="php-keyword1">false</span>, <span class="php-var">$contexte</span>); |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> <span class="php-keyword1">if</span> (!<span class="php-var">$flux</span>) { |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> <span class="php-var">$this</span>->reponse_entetes = <span class="php-var">$http_response_header</span>; |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-keyword2">sprintf</span>(<span class="php-quote">"fail: %s \"%s\" (%s)"</span>, <span class="php-keyword2">strtoupper</span>(<span class="php-var">$mode</span>), <span class="php-var">$this</span>->url, <span class="php-keyword2">http_build_query</span>(<span class="php-var">$donnees</span>, <span class="php-keyword1">null</span>, self::HTTP_URL_REQUETE_SEPARATEUR)), |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> E_USER_WARNING); |
</span><span id="152" class="l"><a class="l" href="#152">152: </a> |
</span><span id="153" class="l"><a class="l" href="#153">153: </a> } <span class="php-keyword1">else</span> { |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> <span class="php-comment">// Informations sur les en-têtes et métadonnées du flux</span> |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> <span class="php-var">$this</span>->reponse_entetes = <span class="php-keyword2">stream_get_meta_data</span>(<span class="php-var">$flux</span>); |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> |
</span><span id="157" class="l"><a class="l" href="#157">157: </a> <span class="php-comment">// Contenu actuel de $url</span> |
</span><span id="158" class="l"><a class="l" href="#158">158: </a> <span class="php-var">$contenu</span> = <span class="php-keyword2">stream_get_contents</span>(<span class="php-var">$flux</span>); |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> <span class="php-keyword2">fclose</span>(<span class="php-var">$flux</span>); |
</span><span id="161" class="l"><a class="l" href="#161">161: </a> } |
</span><span id="162" class="l"><a class="l" href="#162">162: </a> <span class="php-var">$this</span>->traiterEntete(); |
</span><span id="163" class="l"><a class="l" href="#163">163: </a> } |
</span><span id="164" class="l"><a class="l" href="#164">164: </a> <span class="php-var">$this</span>->reinitialiser(); |
</span><span id="165" class="l"><a class="l" href="#165">165: </a> <span class="php-keyword1">return</span> <span class="php-var">$contenu</span>; |
</span><span id="166" class="l"><a class="l" href="#166">166: </a> } |
</span><span id="167" class="l"><a class="l" href="#167">167: </a> |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_traiterUrlParametres" href="#_traiterUrlParametres">traiterUrlParametres</a>() { |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> <span class="php-var">$parametres</span> = <span class="php-keyword1">array</span>(); |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>->parametres) > <span class="php-num">0</span>) { |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>->parametres <span class="php-keyword1">as</span> <span class="php-var">$cle</span> => <span class="php-var">$valeur</span>) { |
</span><span id="172" class="l"><a class="l" href="#172">172: </a> <span class="php-var">$cle</span> = <span class="php-keyword2">rawurlencode</span>(<span class="php-var">$cle</span>); |
</span><span id="173" class="l"><a class="l" href="#173">173: </a> <span class="php-var">$valeur</span> = <span class="php-keyword2">rawurlencode</span>(<span class="php-var">$valeur</span>); |
</span><span id="174" class="l"><a class="l" href="#174">174: </a> <span class="php-var">$parametres</span>[] = <span class="php-var">$cle</span>.self::HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR.<span class="php-var">$valeur</span>; |
</span><span id="175" class="l"><a class="l" href="#175">175: </a> } |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> <span class="php-var">$url_parametres</span> = <span class="php-keyword2">implode</span>(self::HTTP_URL_REQUETE_SEPARATEUR, <span class="php-var">$parametres</span>); |
</span><span id="177" class="l"><a class="l" href="#177">177: </a> <span class="php-var">$this</span>->url = <span class="php-var">$this</span>->url.<span class="php-quote">'?'</span>.<span class="php-var">$url_parametres</span>; |
</span><span id="178" class="l"><a class="l" href="#178">178: </a> } |
</span><span id="179" class="l"><a class="l" href="#179">179: </a> } |
</span><span id="180" class="l"><a class="l" href="#180">180: </a> |
</span><span id="181" class="l"><a class="l" href="#181">181: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_traiterEntete" href="#_traiterEntete">traiterEntete</a>() { |
</span><span id="182" class="l"><a class="l" href="#182">182: </a> <span class="php-var">$infos</span> = <span class="php-var">$this</span>->analyserEntete(); |
</span><span id="183" class="l"><a class="l" href="#183">183: </a> <span class="php-var">$this</span>->traiterEnteteDebogage(<span class="php-var">$infos</span>); |
</span><span id="184" class="l"><a class="l" href="#184">184: </a> } |
</span><span id="185" class="l"><a class="l" href="#185">185: </a> |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_analyserEntete" href="#_analyserEntete">analyserEntete</a>() { |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> <span class="php-var">$entetes</span> = <span class="php-var">$this</span>->reponse_entetes; |
</span><span id="188" class="l"><a class="l" href="#188">188: </a> <span class="php-var">$infos</span> = <span class="php-keyword1">array</span>(<span class="php-quote">'date'</span> => <span class="php-keyword1">null</span>, <span class="php-quote">'uri'</span> => <span class="php-var">$this</span>->url, <span class="php-quote">'debogages'</span> => <span class="php-keyword1">null</span>); |
</span><span id="189" class="l"><a class="l" href="#189">189: </a> |
</span><span id="190" class="l"><a class="l" href="#190">190: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$entetes</span>[<span class="php-quote">'wrapper_data'</span>])) { |
</span><span id="191" class="l"><a class="l" href="#191">191: </a> <span class="php-var">$entetes</span> = <span class="php-var">$entetes</span>[<span class="php-quote">'wrapper_data'</span>]; |
</span><span id="192" class="l"><a class="l" href="#192">192: </a> } |
</span><span id="193" class="l"><a class="l" href="#193">193: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$entetes</span> <span class="php-keyword1">as</span> <span class="php-var">$entete</span>) { |
</span><span id="194" class="l"><a class="l" href="#194">194: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">preg_match</span>(<span class="php-quote">'/^X_REST_DEBOGAGE_MESSAGES: (.+)$/'</span>, <span class="php-var">$entete</span>, <span class="php-var">$match</span>)) { |
</span><span id="195" class="l"><a class="l" href="#195">195: </a> <span class="php-var">$infos</span>[<span class="php-quote">'debogages'</span>] = <span class="php-keyword2">json_decode</span>(<span class="php-var">$match</span>[<span class="php-num">1</span>]); |
</span><span id="196" class="l"><a class="l" href="#196">196: </a> } |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">preg_match</span>(<span class="php-quote">'/^Date: .+ ([012][0-9]:[012345][0-9]:[012345][0-9]) .*$/'</span>, <span class="php-var">$entete</span>, <span class="php-var">$match</span>)) { |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> <span class="php-var">$infos</span>[<span class="php-quote">'date'</span>] = <span class="php-var">$match</span>[<span class="php-num">1</span>]; |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> } |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> } |
</span><span id="201" class="l"><a class="l" href="#201">201: </a> <span class="php-keyword1">return</span> <span class="php-var">$infos</span>; |
</span><span id="202" class="l"><a class="l" href="#202">202: </a> } |
</span><span id="203" class="l"><a class="l" href="#203">203: </a> |
</span><span id="204" class="l"><a class="l" href="#204">204: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_traiterEnteteDebogage" href="#_traiterEnteteDebogage">traiterEnteteDebogage</a>(<span class="php-var">$entetes_analyses</span>) { |
</span><span id="205" class="l"><a class="l" href="#205">205: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$entetes</span>[<span class="php-quote">'debogages'</span>])) { |
</span><span id="206" class="l"><a class="l" href="#206">206: </a> <span class="php-var">$date</span> = <span class="php-var">$entetes</span>[<span class="php-quote">'date'</span>]; |
</span><span id="207" class="l"><a class="l" href="#207">207: </a> <span class="php-var">$uri</span> = <span class="php-var">$entetes</span>[<span class="php-quote">'uri'</span>]; |
</span><span id="208" class="l"><a class="l" href="#208">208: </a> <span class="php-var">$debogages</span> = <span class="php-var">$entetes</span>[<span class="php-quote">'debogages'</span>]; |
</span><span id="209" class="l"><a class="l" href="#209">209: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$debogages</span> <span class="php-keyword1">as</span> <span class="php-var">$debogage</span>) { |
</span><span id="210" class="l"><a class="l" href="#210">210: </a> <span class="php-var">$e</span> = <span class="php-quote">"DEBOGAGE : </span><span class="php-var">$date</span><span class="php-quote"> - </span><span class="php-var">$uri</span><span class="php-quote"> :\n</span><span class="php-var">$debogage</span><span class="php-quote">"</span>; |
</span><span id="211" class="l"><a class="l" href="#211">211: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_NOTICE); |
</span><span id="212" class="l"><a class="l" href="#212">212: </a> } |
</span><span id="213" class="l"><a class="l" href="#213">213: </a> } |
</span><span id="214" class="l"><a class="l" href="#214">214: </a> } |
</span><span id="215" class="l"><a class="l" href="#215">215: </a> |
</span><span id="216" class="l"><a class="l" href="#216">216: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_reinitialiser" href="#_reinitialiser">reinitialiser</a>() { |
</span><span id="217" class="l"><a class="l" href="#217">217: </a> <span class="php-var">$this</span>->nettoyerParametres(); |
</span><span id="218" class="l"><a class="l" href="#218">218: </a> } |
</span><span id="219" class="l"><a class="l" href="#219">219: </a></span>}</code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-CacheSimple.html |
---|
New file |
0,0 → 1,247 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/CacheSimple.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li class="active"><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-CacheSimple.html" title="Summary of CacheSimple"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe Cache permettant de mettre en cache des données de façon extremement simple. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * Le cache est stocker dans des fichiers textes. |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * Le contrôle de la durée de vie du cache se fait avec la fonction PHP filemtime. |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * Si la durée de vie du cache est modifiée dans le constructeur ou le fichier de config, alors la durée de vie de l'ensemble |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * des fichiers de cache est modifiée en conséquence. |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * Les clés pour le tableau des options et les valeurs par défaut sont indiquées dans l'attribut options de la classe. |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @category php 5.2 |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @package Framework |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @author Aurélien PERONNET <aurelien@tela-botanica.org> |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * @license http://framework.zend.com/license/new-bsd Licence New BSD |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
</span></span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
</span></span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-comment"> * @version $Id: CacheSimple.php 445 2013-10-24 17:08:14Z raphael $ |
</span></span><span id="20" class="l"><a class="l" href="#20"> 20: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="21" class="l"><a class="l" href="#21"> 21: </a><span class="php-comment"> */</span> |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a><span class="php-comment">// TODO : voir ce qui est le plus pratique : error_log ou le gestionnaire de bogue du framework</span> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a><span class="php-keyword1">class</span> <a id="CacheSimple" href="#CacheSimple">CacheSimple</a> { |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$mise_en_cache" href="#$mise_en_cache">$mise_en_cache</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$stockage_chemin" href="#$stockage_chemin">$stockage_chemin</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$duree_de_vie" href="#$duree_de_vie">$duree_de_vie</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$options" href="#$options">$options</a></span> = <span class="php-keyword1">array</span>( |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-quote">'mise_en_cache'</span> => <span class="php-quote">'true'</span>, |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> <span class="php-quote">'stockage_chemin'</span> => <span class="php-quote">'Fichier::getDossierTmp()'</span>, |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> <span class="php-quote">'duree_de_vie'</span> => <span class="php-quote">'3600*24'</span> |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> ); |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>(<span class="php-var">$options</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> <span class="php-keyword2">extract</span>(<span class="php-var">$options</span>); |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> <span class="php-var">$this</span>->mise_en_cache = <span class="php-keyword2">is_bool</span>(<span class="php-var">$mise_en_cache</span>) ? <span class="php-var">$mise_en_cache</span> : <span class="php-var">$mise_en_cache</span> == <span class="php-quote">''</span> ? <span class="php-keyword1">false</span> : <span class="php-keyword1">true</span>; |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->mise_en_cache) { |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> <span class="php-var">$this</span>->stockage_chemin = <span class="php-keyword1">isset</span>(<span class="php-var">$stockage_chemin</span>) ? <span class="php-keyword2">realpath</span>(<span class="php-var">$stockage_chemin</span>) : Fichier::getDossierTmp(); |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">realpath</span>(<span class="php-var">$stockage_chemin</span>)) { |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> <span class="php-keyword2">error_log</span>(<span class="php-keyword2">sprintf</span>(<span class="php-quote">"%s: Attention, %s invalide: creation [%s]"</span>, |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> __FILE__, |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> <span class="php-var">$stockage_chemin</span>, |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> @<span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_URI'</span>])); |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> <span class="php-keyword2">mkdir</span>(<span class="php-var">$stockage_chemin</span>, <span class="php-num">0755</span>, <span class="php-keyword1">TRUE</span>); |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> } |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">realpath</span>(<span class="php-var">$stockage_chemin</span>)) { |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-keyword2">error_log</span>(<span class="php-keyword2">sprintf</span>(<span class="php-quote">"%s: Attention, realpath(%s) invalide [%s]"</span>, |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> __FILE__, |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> <span class="php-var">$stockage_chemin</span>, |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> @<span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_URI'</span>])); |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span>(!<span class="php-keyword2">is_writable</span>(<span class="php-keyword2">realpath</span>(<span class="php-var">$stockage_chemin</span>))) { |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-keyword2">error_log</span>(<span class="php-keyword2">sprintf</span>(<span class="php-quote">"%s: Attention, realpath(%s) non-inscriptible [%s]"</span>, |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> __FILE__, |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> <span class="php-keyword2">realpath</span>(<span class="php-var">$stockage_chemin</span>), |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> @<span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_URI'</span>])); |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> } <span class="php-keyword1">else</span> { |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-var">$this</span>->duree_de_vie = <span class="php-keyword1">isset</span>(<span class="php-var">$duree_de_vie</span>) ? <span class="php-var">$duree_de_vie</span> : <span class="php-num">3600</span>*<span class="php-num">24</span>; |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> } |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> } |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> } |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_initialiserOptionsParConfig" href="#_initialiserOptionsParConfig">initialiserOptionsParConfig</a>() { |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> <span class="php-keyword1">while</span> (<span class="php-keyword1">list</span>(<span class="php-var">$nom</span>, <span class="php-var">$valeur</span>) = <span class="php-keyword2">each</span>(<span class="php-var">$this</span>->options)) { |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> <span class="php-keyword1">if</span> (Config::existe(<span class="php-var">$nom</span>)) { |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> <span class="php-var">$this</span>-><span class="php-var">$nom</span> = Config::get(<span class="php-var">$nom</span>); |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> } |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> } |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> } |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> <span class="php-comment">/** |
</span></span><span id="73" class="l"><a class="l" href="#73"> 73: </a><span class="php-comment"> * Teste si le cache est disponible pour l'id donné et (si oui) le retourne (sinon renvoie false) |
</span></span><span id="74" class="l"><a class="l" href="#74"> 74: </a><span class="php-comment"> * |
</span></span><span id="75" class="l"><a class="l" href="#75"> 75: </a><span class="php-comment"> * @param string $id l'identifiant du Cache. |
</span></span><span id="76" class="l"><a class="l" href="#76"> 76: </a><span class="php-comment"> * @return string|false les données en cache. |
</span></span><span id="77" class="l"><a class="l" href="#77"> 77: </a><span class="php-comment"> */</span> |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_charger" href="#_charger">charger</a>(<span class="php-var">$id</span>) { |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> <span class="php-var">$contenu</span> = <span class="php-keyword1">false</span>; |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->mise_en_cache) { |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> <span class="php-var">$chemin_fichier_cache</span> = <span class="php-var">$this</span>->stockage_chemin.DS.<span class="php-var">$id</span>.<span class="php-quote">'.txt'</span>; |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">file_exists</span>(<span class="php-var">$chemin_fichier_cache</span> ) && (<span class="php-keyword2">time</span>() - @<span class="php-keyword2">filemtime</span>(<span class="php-var">$chemin_fichier_cache</span>) < <span class="php-var">$this</span>->duree_de_vie)) { |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> <span class="php-var">$contenu</span> = <span class="php-keyword2">file_get_contents</span>(<span class="php-var">$chemin_fichier_cache</span>); |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> } |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> } |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> <span class="php-keyword1">return</span> <span class="php-var">$contenu</span>; |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> } |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> <span class="php-comment">/** |
</span></span><span id="90" class="l"><a class="l" href="#90"> 90: </a><span class="php-comment"> * Sauvegarde la chaine de données dans un fichier texte. |
</span></span><span id="91" class="l"><a class="l" href="#91"> 91: </a><span class="php-comment"> * |
</span></span><span id="92" class="l"><a class="l" href="#92"> 92: </a><span class="php-comment"> * Note : $contenu est toujours de type "string". C'est à vous de gérer la sérialisation. |
</span></span><span id="93" class="l"><a class="l" href="#93"> 93: </a><span class="php-comment"> * |
</span></span><span id="94" class="l"><a class="l" href="#94"> 94: </a><span class="php-comment"> * @param string $contenu les données à mettre en cache. |
</span></span><span id="95" class="l"><a class="l" href="#95"> 95: </a><span class="php-comment"> * @param string $id l'identifiant du Cache. |
</span></span><span id="96" class="l"><a class="l" href="#96"> 96: </a><span class="php-comment"> * @return boolean true si aucun problème |
</span></span><span id="97" class="l"><a class="l" href="#97"> 97: </a><span class="php-comment"> */</span> |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_sauver" href="#_sauver">sauver</a>(<span class="php-var">$contenu</span>, <span class="php-var">$id</span>) { |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> <span class="php-keyword1">if</span> (! <span class="php-var">$this</span>->mise_en_cache) <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>; |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> <span class="php-var">$ok</span> = <span class="php-keyword1">false</span>; |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> <span class="php-var">$chemin_fichier_cache</span> = <span class="php-var">$this</span>->stockage_chemin.DS.<span class="php-var">$id</span>.<span class="php-quote">'.txt'</span>; |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">file_exists</span>(<span class="php-var">$chemin_fichier_cache</span>) || (<span class="php-keyword2">time</span>() - @<span class="php-keyword2">filemtime</span>(<span class="php-var">$chemin_fichier_cache</span>) > <span class="php-var">$this</span>->duree_de_vie)) { |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> <span class="php-var">$dossier_fichier_cache</span> = <span class="php-keyword2">dirname</span>(<span class="php-var">$chemin_fichier_cache</span>); |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_dir</span>(<span class="php-var">$dossier_fichier_cache</span>)) |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> { |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> <span class="php-keyword2">mkdir</span>(<span class="php-var">$dossier_fichier_cache</span>, <span class="php-num">0755</span>, <span class="php-keyword1">true</span>); |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> } |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> <span class="php-var">$fh</span> = <span class="php-keyword2">fopen</span>(<span class="php-var">$chemin_fichier_cache</span>,<span class="php-quote">'w+'</span>); |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> <span class="php-keyword1">if</span> (<span class="php-var">$fh</span>) { |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">fwrite</span>(<span class="php-var">$fh</span>, <span class="php-var">$contenu</span>)) { |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">fclose</span>(<span class="php-var">$fh</span>)) { |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> <span class="php-keyword2">error_log</span>(<span class="php-keyword2">sprintf</span>(<span class="php-quote">"%s: caching \"%s\" [%s]"</span>, __FILE__, <span class="php-var">$chemin_fichier_cache</span>, @<span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_URI'</span>])); |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> <span class="php-var">$ok</span> = <span class="php-keyword1">true</span>; |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> } |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> } |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> <span class="php-comment">// Voir #ZF-4422 pour la raison de l'utilisation de octdec()</span> |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> @<span class="php-keyword2">chmod</span>(<span class="php-var">$chemin_fichier_cache</span>, <span class="php-keyword2">octdec</span>(<span class="php-quote">'0777'</span>)); |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> } |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> } |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-keyword1">if</span>(!<span class="php-var">$ok</span>) <span class="php-keyword2">error_log</span>(<span class="php-keyword2">sprintf</span>(<span class="php-quote">"%s: ERROR trying to cache \"%s\" [%s]"</span>, __FILE__, <span class="php-var">$chemin_fichier_cache</span>, @<span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_URI'</span>])); |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> <span class="php-keyword1">return</span> <span class="php-var">$ok</span>; |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> } |
</span><span id="126" class="l"><a class="l" href="#126">126: </a>} |
</span><span id="127" class="l"><a class="l" href="#127">127: </a></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-RestClient.html |
---|
New file |
0,0 → 1,600 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class RestClient | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li class="active"><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class RestClient</h1> |
<div class="description"> |
<p>Classe client permettant d'interroger des services web REST.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
php 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL</a><br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: RestClient.php 439 2013-10-14 15:48:41Z raphael $<br> |
<b>Located at</b> <a href="source-class-RestClient.html#3-219" title="Go to source code">framework/RestClient.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="getReponseEntetes" id="_getReponseEntetes"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getReponseEntetes">#</a> |
<code><a href="source-class-RestClient.html#25-27" title="Go to source code">getReponseEntetes</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getParametre" id="_getParametre"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getParametre">#</a> |
<code><a href="source-class-RestClient.html#29-32" title="Go to source code">getParametre</a>( <span>mixed <var>$cle</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="ajouterParametre" id="_ajouterParametre"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_ajouterParametre">#</a> |
<code><a href="source-class-RestClient.html#34-36" title="Go to source code">ajouterParametre</a>( <span>mixed <var>$cle</var></span>, <span>mixed <var>$valeur</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="supprimerParametre" id="_supprimerParametre"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_supprimerParametre">#</a> |
<code><a href="source-class-RestClient.html#38-40" title="Go to source code">supprimerParametre</a>( <span>mixed <var>$cle</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="nettoyerParametres" id="_nettoyerParametres"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_nettoyerParametres">#</a> |
<code><a href="source-class-RestClient.html#42-44" title="Go to source code">nettoyerParametres</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="consulter" id="_consulter"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_consulter">#</a> |
<code><a href="source-class-RestClient.html#49-52" title="Go to source code">consulter</a>( <span>mixed <var>$url</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="ajouter" id="_ajouter"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_ajouter">#</a> |
<code><a href="source-class-RestClient.html#54-57" title="Go to source code">ajouter</a>( <span>mixed <var>$url</var></span>, <span>array <var>$donnees</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="modifier" id="_modifier"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_modifier">#</a> |
<code><a href="source-class-RestClient.html#59-62" title="Go to source code">modifier</a>( <span>mixed <var>$url</var></span>, <span>array <var>$donnees</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="supprimer" id="_supprimer"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_supprimer">#</a> |
<code><a href="source-class-RestClient.html#64-67" title="Go to source code">supprimer</a>( <span>mixed <var>$url</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="envoyerCurlRequete" id="_envoyerCurlRequete"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_envoyerCurlRequete">#</a> |
<code><a href="source-class-RestClient.html#69-116" title="Go to source code">envoyerCurlRequete</a>( <span>mixed <var>$url</var></span>, <span>mixed <var>$mode</var></span>, <span>array <var>$donnees</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getCaller" id="_getCaller"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getCaller">#</a> |
<code><a href="source-class-RestClient.html#118-121" title="Go to source code">getCaller</a>( <span>mixed <var>$trace</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="envoyerRequete" id="_envoyerRequete"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_envoyerRequete">#</a> |
<code><a href="source-class-RestClient.html#123-166" title="Go to source code">envoyerRequete</a>( <span>mixed <var>$url</var></span>, <span>mixed <var>$mode</var></span>, <span>array <var>$donnees</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="constants"> |
<caption>Constants summary</caption> |
<tr data-order="HTTP_URL_REQUETE_SEPARATEUR" id="HTTP_URL_REQUETE_SEPARATEUR"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestClient.html#15" title="Go to source code"><b>HTTP_URL_REQUETE_SEPARATEUR</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'&'</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_URL_REQUETE_SEPARATEUR" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR" id="HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-RestClient.html#16" title="Go to source code"><b>HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'='</span></code></td> |
<td class="description"><div> |
<a href="#HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr data-order="parametres" id="$parametres"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-RestClient.html#18" title="Go to source code"><var>$parametres</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">null</span></code></td> |
<td class="description"><div> |
<a href="#$parametres" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/package-PHP.html |
---|
New file |
0,0 → 1,113 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Package PHP | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li class="active"><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Exceptions</h3> |
<ul> |
<li><a href="class-Exception.html">Exception</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li class="active"> |
<span>Package</span> </li> |
<li> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="package"> |
<h1>Package PHP</h1> |
<table class="summary" id="exceptions"> |
<caption>Exceptions summary</caption> |
<tr> |
<td class="name"><a href="class-Exception.html">Exception</a></td> |
<td></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-ServiceCacheFichier.html |
---|
New file |
0,0 → 1,280 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class ServiceCacheFichier | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li class="active"><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class ServiceCacheFichier</h1> |
<div class="description"> |
<p>Classe principale gérant les services. Paramètres liés dans config.ini : - |
serveur.baseURL</p> |
<p>Encodage en entrée : utf8 Encodage en sortie : utf8</p> |
</div> |
<dl class="tree"> |
<dd style="padding-left:0px"> |
<a href="class-RestService.html"><span>RestService</span></a> |
</dd> |
<dd style="padding-left:30px"> |
<img src="resources/inherit.png" alt="Extended by"> |
<b><span>ServiceCacheFichier</span></b> |
</dd> |
</dl> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
Php 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="GPL">v3 <http://www.gnu.org/licenses/gpl.txt></a><br> |
<b>License:</b> |
<a href="CECILL">v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt></a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: RestService.php 417 2012-05-15 09:24:12Z jpm $<br> |
<b>Since:</b> |
0.3<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-ServiceCacheFichier.html#2-98" title="Go to source code">exemples/services/modules/0.1/ServiceCacheFichier.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="consulter" id="_consulter"> |
<td class="attributes"><code> |
public |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_consulter">#</a> |
<code><a href="source-class-ServiceCacheFichier.html#4-97" title="Go to source code">consulter</a>( <span>array <var>$ressources</var></span>, <span>array <var>$parametres</var></span> )</code> |
<div class="description short"> |
<p>Méthode appelée lors d'une requête HTTP de type GET.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode appelée lors d'une requête HTTP de type GET.</p> |
<p>Si la consultation est un succès, le code statut HTTP retourné sera 200. |
Dans tous les autres cas, la méthode devra retourner le code statut HTTP |
adéquate.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$ressources</var></dt> |
<dd><code>array</code><br>Morceaux de l'url servant à préciser la ressource concerné pour le service |
demandé.</dd> |
<dt><var>$parametres</var></dt> |
<dd><code>array</code><br>Partie de l'url situé après le '?' servant à paramétrer le service demandé.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>une chaine indiquant le succès de l'opération et les données demandées.<br> |
</div> |
<h4>Overrides</h4> |
<div class="list"><code><a href="class-RestService.html#_consulter">RestService::consulter()</a></code></div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary inherited"> |
<caption>Methods inherited from <a href="class-RestService.html#methods">RestService</a></caption> |
<tr> |
<td><code> |
<a href="class-RestService.html#___construct">__construct()</a>, |
<a href="class-RestService.html#_ajouter">ajouter()</a>, |
<a href="class-RestService.html#_ajouterMessage">ajouterMessage()</a>, |
<a href="class-RestService.html#_getBdd">getBdd()</a>, |
<a href="class-RestService.html#_getRestClient">getRestClient()</a>, |
<a href="class-RestService.html#_initialiser">initialiser()</a>, |
<a href="class-RestService.html#_modifier">modifier()</a>, |
<a href="class-RestService.html#_supprimer">supprimer()</a>, |
<a href="class-RestService.html#_utiliserParametresBruts">utiliserParametresBruts()</a> |
</code></td> |
</tr> |
</table> |
<table class="summary inherited"> |
<caption>Properties inherited from <a href="class-RestService.html#properties">RestService</a></caption> |
<tr> |
<td><code> |
<a href="class-RestService.html#$bdd"><var><span class="deprecated">$bdd</span></var></a>, |
<a href="class-RestService.html#$utilisationParametresBruts"><var>$utilisationParametresBruts</var></a> |
</code></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-SquelettePhp.html |
---|
New file |
0,0 → 1,195 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/SquelettePhp.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li class="active"><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-SquelettePhp.html" title="Summary of SquelettePhp"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe SquelettePhp, traitant les squelette Php utilisant la syntaxe courte php ou pas. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * Ces méthodes sont statiques. |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @category php5 |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @package Framework |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="10" class="l"><a class="l" href="#10">10: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="11" class="l"><a class="l" href="#11">11: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
</span></span><span id="12" class="l"><a class="l" href="#12">12: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
</span></span><span id="13" class="l"><a class="l" href="#13">13: </a><span class="php-comment"> * @version $Id: SquelettePhp.php 446 2013-10-28 14:21:50Z raphael $ |
</span></span><span id="14" class="l"><a class="l" href="#14">14: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="15" class="l"><a class="l" href="#15">15: </a><span class="php-comment"> */</span> |
</span><span id="16" class="l"><a class="l" href="#16">16: </a><span class="php-keyword1">class</span> <a id="SquelettePhp" href="#SquelettePhp">SquelettePhp</a> { |
</span><span id="17" class="l"><a class="l" href="#17">17: </a> |
</span><span id="18" class="l"><a class="l" href="#18">18: </a> <span class="php-comment">/** |
</span></span><span id="19" class="l"><a class="l" href="#19">19: </a><span class="php-comment"> * Fonction prenant en paramètre un chemin de fichier squelette et un tableau associatif de données, |
</span></span><span id="20" class="l"><a class="l" href="#20">20: </a><span class="php-comment"> * en extrait les variables, charge le squelette et retourne le résultat des deux combinés. |
</span></span><span id="21" class="l"><a class="l" href="#21">21: </a><span class="php-comment"> * |
</span></span><span id="22" class="l"><a class="l" href="#22">22: </a><span class="php-comment"> * @param String $fichier le chemin du fichier du squelette |
</span></span><span id="23" class="l"><a class="l" href="#23">23: </a><span class="php-comment"> * @param Array $donnees un tableau associatif contenant les variables a injecter dans le squelette. |
</span></span><span id="24" class="l"><a class="l" href="#24">24: </a><span class="php-comment"> * @return boolean false si la vue n'existe pas, sinon la chaine résultat. |
</span></span><span id="25" class="l"><a class="l" href="#25">25: </a><span class="php-comment"> */</span> |
</span><span id="26" class="l"><a class="l" href="#26">26: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_analyser" href="#_analyser">analyser</a>(<span class="php-var">$fichier</span>, <span class="php-keyword1">Array</span> &<span class="php-var">$donnees</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="27" class="l"><a class="l" href="#27">27: </a> <span class="php-var">$sortie</span> = <span class="php-keyword1">false</span>; |
</span><span id="28" class="l"><a class="l" href="#28">28: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">file_exists</span>(<span class="php-var">$fichier</span>)) { |
</span><span id="29" class="l"><a class="l" href="#29">29: </a> <span class="php-comment">// Extraction des variables du tableau de données</span> |
</span><span id="30" class="l"><a class="l" href="#30">30: </a> <span class="php-keyword2">extract</span>(<span class="php-var">$donnees</span>); |
</span><span id="31" class="l"><a class="l" href="#31">31: </a> |
</span><span id="32" class="l"><a class="l" href="#32">32: </a> <span class="php-comment">// Démarage de la bufferisation de sortie</span> |
</span><span id="33" class="l"><a class="l" href="#33">33: </a> <span class="php-keyword2">ob_start</span>(); |
</span><span id="34" class="l"><a class="l" href="#34">34: </a> <span class="php-comment">// Si les tags courts sont activés</span> |
</span><span id="35" class="l"><a class="l" href="#35">35: </a> <span class="php-keyword1">if</span> ((bool) @<span class="php-keyword2">ini_get</span>(<span class="php-quote">'short_open_tag'</span>) === <span class="php-keyword1">true</span>) { |
</span><span id="36" class="l"><a class="l" href="#36">36: </a> <span class="php-comment">// Simple inclusion du squelette</span> |
</span><span id="37" class="l"><a class="l" href="#37">37: </a> <span class="php-keyword1">include</span> <span class="php-var">$fichier</span>; |
</span><span id="38" class="l"><a class="l" href="#38">38: </a> } <span class="php-keyword1">else</span> { |
</span><span id="39" class="l"><a class="l" href="#39">39: </a> <span class="php-comment">// Sinon, remplacement des tags courts par la syntaxe classique avec echo</span> |
</span><span id="40" class="l"><a class="l" href="#40">40: </a> <span class="php-var">$html_et_code_php</span> = self::traiterTagsCourts(<span class="php-var">$fichier</span>); |
</span><span id="41" class="l"><a class="l" href="#41">41: </a> <span class="php-comment">// Pour évaluer du php mélangé dans du html il est nécessaire de fermer la balise php ouverte par eval</span> |
</span><span id="42" class="l"><a class="l" href="#42">42: </a> <span class="php-var">$html_et_code_php</span> = <span class="php-quote">'?>'</span>.<span class="php-var">$html_et_code_php</span>; |
</span><span id="43" class="l"><a class="l" href="#43">43: </a> <span class="php-comment">// Interprétation du html et du php dans le buffer</span> |
</span><span id="44" class="l"><a class="l" href="#44">44: </a> <span class="php-keyword1">echo</span> <span class="php-keyword2">eval</span>(<span class="php-var">$html_et_code_php</span>); |
</span><span id="45" class="l"><a class="l" href="#45">45: </a> } |
</span><span id="46" class="l"><a class="l" href="#46">46: </a> <span class="php-comment">// Récupèration du contenu du buffer</span> |
</span><span id="47" class="l"><a class="l" href="#47">47: </a> <span class="php-var">$sortie</span> = <span class="php-keyword2">ob_get_contents</span>(); |
</span><span id="48" class="l"><a class="l" href="#48">48: </a> <span class="php-comment">// Suppression du buffer</span> |
</span><span id="49" class="l"><a class="l" href="#49">49: </a> @<span class="php-keyword2">ob_end_clean</span>(); |
</span><span id="50" class="l"><a class="l" href="#50">50: </a> } <span class="php-keyword1">else</span> { |
</span><span id="51" class="l"><a class="l" href="#51">51: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Le fichier du squelette '</span><span class="php-var">$fichier</span><span class="php-quote">' n'existe pas."</span> . <span class="php-keyword2">print_r</span>(<span class="php-keyword2">debug_backtrace</span>(), <span class="php-keyword1">TRUE</span>) . <span class="php-quote">"</pre>"</span>, |
</span><span id="52" class="l"><a class="l" href="#52">52: </a> E_USER_WARNING); |
</span><span id="53" class="l"><a class="l" href="#53">53: </a> } |
</span><span id="54" class="l"><a class="l" href="#54">54: </a> <span class="php-comment">// Retourne le contenu</span> |
</span><span id="55" class="l"><a class="l" href="#55">55: </a> <span class="php-keyword1">return</span> <span class="php-var">$sortie</span>; |
</span><span id="56" class="l"><a class="l" href="#56">56: </a> } |
</span><span id="57" class="l"><a class="l" href="#57">57: </a> |
</span><span id="58" class="l"><a class="l" href="#58">58: </a> <span class="php-comment">/** |
</span></span><span id="59" class="l"><a class="l" href="#59">59: </a><span class="php-comment"> * Fonction chargeant le contenu du squelette et remplaçant les tags court php (<?= ...) par un tag long avec echo. |
</span></span><span id="60" class="l"><a class="l" href="#60">60: </a><span class="php-comment"> * |
</span></span><span id="61" class="l"><a class="l" href="#61">61: </a><span class="php-comment"> * @param String $chemin_squelette le chemin du fichier du squelette |
</span></span><span id="62" class="l"><a class="l" href="#62">62: </a><span class="php-comment"> * @return string le contenu du fichier du squelette php avec les tags courts remplacés. |
</span></span><span id="63" class="l"><a class="l" href="#63">63: </a><span class="php-comment"> */</span> |
</span><span id="64" class="l"><a class="l" href="#64">64: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_traiterTagsCourts" href="#_traiterTagsCourts">traiterTagsCourts</a>(<span class="php-var">$chemin_squelette</span>) { |
</span><span id="65" class="l"><a class="l" href="#65">65: </a> <span class="php-var">$contenu</span> = <span class="php-keyword2">file_get_contents</span>(<span class="php-var">$chemin_squelette</span>); |
</span><span id="66" class="l"><a class="l" href="#66">66: </a> <span class="php-comment">// Remplacement de tags courts par un tag long avec echo</span> |
</span><span id="67" class="l"><a class="l" href="#67">67: </a> <span class="php-var">$contenu</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">'<?='</span>, <span class="php-quote">'<?php echo '</span>, <span class="php-var">$contenu</span>); |
</span><span id="68" class="l"><a class="l" href="#68">68: </a> <span class="php-var">$contenu</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">'<? '</span>, <span class="php-quote">'<?php '</span>, <span class="php-var">$contenu</span>); |
</span><span id="69" class="l"><a class="l" href="#69">69: </a> <span class="php-var">$contenu</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">'<?if '</span>, <span class="php-quote">'<?php if '</span>, <span class="php-var">$contenu</span>); |
</span><span id="70" class="l"><a class="l" href="#70">70: </a> <span class="php-comment">// Ajout systématique d'un point virgule avant la fermeture php</span> |
</span><span id="71" class="l"><a class="l" href="#71">71: </a> <span class="php-var">$contenu</span> = <span class="php-keyword2">preg_replace</span>(<span class="php-quote">"/;*\s*\?>/"</span>, <span class="php-quote">"; ?>"</span>, <span class="php-var">$contenu</span>); |
</span><span id="72" class="l"><a class="l" href="#72">72: </a> <span class="php-keyword1">return</span> <span class="php-var">$contenu</span>; |
</span><span id="73" class="l"><a class="l" href="#73">73: </a> } |
</span><span id="74" class="l"><a class="l" href="#74">74: </a>} |
</span><span id="75" class="l"><a class="l" href="#75">75: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/package-Framework.html |
---|
New file |
0,0 → 1,261 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Package Framework | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li class="active"> |
<span>Package</span> </li> |
<li> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="package"> |
<h1>Package Framework</h1> |
<table class="summary" id="classes"> |
<caption>Classes summary</caption> |
<tr> |
<td class="name"><a href="class-Bdd.html">Bdd</a></td> |
<td>Classe Bdd, d'accés au base de données. Elle fait office d'abstraction |
légère de base de données en utilisant diverses possibilités d'accès aux |
bases de données (PDO, mysql, mysqli, SQLite3). Les valeurs pour le paramètre |
'bdd_abstraction' du fichier config.ini sont : pdo, mysql, mysqli, sqlite3 Vous |
pouvez aussi utiliser : "php:Bdd::ABSTRACTION_PDO","php:Bdd::ABSTRACTION_MYSQL", |
"php:Bdd::ABSTRACTION_MYSQLI", "php:Bdd::ABSTRACTION_SQLITE3". Elle peut être |
étendue, pour ajouter le support d'autres bases de données où prendre en |
compte des méthodes spécifique à un type d'abstraction.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Cache.html">Cache</a></td> |
<td>Classe Cache permettant de mettre en cache des données. Basée sur les |
principes de Zend_Cache (Copyright (c) 2005-2010, Zend Technologies USA, Inc. |
All rights reserved.)</td> |
</tr> |
<tr> |
<td class="name"><a href="class-CacheSimple.html">CacheSimple</a></td> |
<td></td> |
</tr> |
<tr> |
<td class="name"><a href="class-Chronometre.html">Chronometre</a></td> |
<td>Chronometre permet de stocker et d'afficher les temps d'éxécution de script.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Cli.html">Cli</a></td> |
<td>CLI permet de récupérer les paramètres passés en ligne de commande pour |
instancier une classe héritant de la classe abstraite Script. Elle va |
déclencher l'éxecution du script via l'appel de la méthode executer(). C'est |
une Singleton.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Config.html">Config</a></td> |
<td>Config permet de charger automatiquement les fichiers ini du Framework et de |
l'application. Elle offre l'accès en lecture seule aux paramètres de config. |
C'est une Singleton. Si vous avez besoin de modifier dynamiquement des |
paramètres de configuration, utiliser le @see Registe, il est fait pour ça.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Controleur.html">Controleur</a></td> |
<td>Classe Controleur, coeur d'une application, c'est normalement la seule classe |
d'une application qui devrait être appelée de l'extérieur. Elle est abstraite |
donc doit obligatoirement être étendue.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Debug.html">Debug</a></td> |
<td>Classe fournissant des fonctions de débogage équivalante à var_dump et |
print_r. L'affichage et l'utilisation de ces fonctions sont améliorés via |
cette classe. Cette classe est inspirée de la classe Zend_Debug.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Framework.html">Framework</a></td> |
<td>Classe de base du Framework : - fournissant des infos sur l'application, - |
paramétrant l'environnement de l'appli et du framework, - réalisant des |
traitements sur les variables globales ($_GET, $_POST, $_COOKIE...)</td> |
</tr> |
<tr> |
<td class="name"><a href="class-GestionnaireException.html">GestionnaireException</a></td> |
<td>Classe de gestion des exceptions. C'est un Singleton.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-I18n.html">I18n</a></td> |
<td>I18n permet de traduire une application à partir de données stockées dans des |
fichiers ini. Si vous souhaitez utiliser le fonctionnement par défaut vous |
devrez : - déposer les fichiers ini dans le dossier définit par la variable de |
config "chemin_i18n". - nommer les fichiers selon la forme "locale.ini" (Ex.: |
fr.ini ou fr_CH.ini ).</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Log.html">Log</a></td> |
<td>Classe permettant de logger des messages dans les fichier situés dans le |
dossier de log.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-MonService.html">MonService</a></td> |
<td>Classe principale gérant les services. Paramètres liés dans config.ini : - |
serveur.baseURL</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Registre.html">Registre</a></td> |
<td>Classe Registre, qui permet un accès à différentes variables et paramètres |
à travers les autres classes. C'est un remplaçant à la variable magique |
$_GLOBALS de Php. C'est un singleton. Si vous voulez paramètré votre |
application via un fichier de configuration, utilisez plutôt la classe @see |
Config.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-RestClient.html">RestClient</a></td> |
<td>Classe client permettant d'interroger des services web REST.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-RestServeur.html">RestServeur</a></td> |
<td></td> |
</tr> |
<tr> |
<td class="name"><a href="class-RestService.html">RestService</a></td> |
<td>Classe principale gérant les services. Paramètres liés dans config.ini : - |
serveur.baseURL</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Script.html">Script</a></td> |
<td>Script est une classe abstraite qui doit être implémenté par les classes |
éxecutant des scripts en ligne de commande.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></td> |
<td>Classe principale gérant les services. Paramètres liés dans config.ini : - |
serveur.baseURL</td> |
</tr> |
<tr> |
<td class="name"><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></td> |
<td>Classe principale gérant les services. Paramètres liés dans config.ini : - |
serveur.baseURL</td> |
</tr> |
<tr> |
<td class="name"><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></td> |
<td>Classe principale gérant les services. Paramètres liés dans config.ini : - |
serveur.baseURL</td> |
</tr> |
<tr> |
<td class="name"><a href="class-SquelettePhp.html">SquelettePhp</a></td> |
<td>Classe SquelettePhp, traitant les squelette Php utilisant la syntaxe courte php |
ou pas. Ces méthodes sont statiques.</td> |
</tr> |
<tr> |
<td class="name"><a href="class-Url.html">Url</a></td> |
<td>Classe Url, gérant le découpage des paramètres, leurs modification etc... |
Traduction et conversion d'une classe (NET_Url2) issue de Pear</td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-SquelettePhp.html |
---|
New file |
0,0 → 1,235 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class SquelettePhp | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li class="active"><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class SquelettePhp</h1> |
<div class="description"> |
<p>Classe SquelettePhp, traitant les squelette Php utilisant la syntaxe courte |
php ou pas. Ces méthodes sont statiques.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
php5<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL</a><br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: SquelettePhp.php 446 2013-10-28 14:21:50Z raphael $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-SquelettePhp.html#3-74" title="Go to source code">framework/SquelettePhp.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="analyser" id="_analyser"> |
<td class="attributes"><code> |
public static |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_analyser">#</a> |
<code><a href="source-class-SquelettePhp.html#18-56" title="Go to source code">analyser</a>( <span>String <var>$fichier</var></span>, <span>array <var>& $donnees</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Fonction prenant en paramètre un chemin de fichier squelette et un tableau |
associatif de données, en extrait les variables, charge le squelette et |
retourne le résultat des deux combinés.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Fonction prenant en paramètre un chemin de fichier squelette et un tableau |
associatif de données, en extrait les variables, charge le squelette et |
retourne le résultat des deux combinés.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$fichier</var></dt> |
<dd><code>String</code><br>$fichier le chemin du fichier du squelette</dd> |
<dt><var>$donnees</var></dt> |
<dd><code>Array</code><br>$donnees un tableau associatif contenant les variables a injecter dans le |
squelette.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>false si la vue n'existe pas, sinon la chaine résultat.<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Chronometre.html |
---|
New file |
0,0 → 1,295 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Chronometre | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li class="active"><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Chronometre</h1> |
<div class="description"> |
<p>Chronometre permet de stocker et d'afficher les temps d'éxécution de |
script.</p> |
<p>Cette classe permet de réaliser un ensemble de mesure de temps prises à |
différents endroits d'un script. Ces mesures peuvent ensuite être affichées |
au sein d'un tableau XHTML.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Chronometre.php 327 2011-02-08 17:54:34Z jpm $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Chronometre.html#3-137" title="Go to source code">framework/Chronometre.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="chrono" id="_chrono"> |
<td class="attributes"><code> |
public static |
null |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_chrono">#</a> |
<code><a href="source-class-Chronometre.html#54-68" title="Go to source code">chrono</a>( <span>string <var>$cle</var> = <span class="php-keyword1">null</span></span> )</code> |
<div class="description short"> |
<p>Effectue un chronometrage. Vous pouvez indiquer le nom du point de |
chronométrage. Si vous n'indiquez rien, un nombre sera généré en débutant |
à 1.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Effectue un chronometrage. Vous pouvez indiquer le nom du point de |
chronométrage. Si vous n'indiquez rien, un nombre sera généré en débutant |
à 1.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$cle</var></dt> |
<dd><code>string</code><br>le nom du point de chronométrage</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>null</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="afficherChrono" id="_afficherChrono"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_afficherChrono">#</a> |
<code><a href="source-class-Chronometre.html#70-131" title="Go to source code">afficherChrono</a>( <span>string <var>$cle</var> = <span class="php-keyword1">null</span></span> )</code> |
<div class="description short"> |
<p>Permet d'afficher les temps d'éxécution de différentes parties d'un |
script.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Permet d'afficher les temps d'éxécution de différentes parties d'un |
script.</p> |
<p>Cette fonction permet d'afficher un ensemble de mesure de temps prises à |
différents endroits d'un script. Ces mesures sont affichées au sein d'un |
tableau XHTML dont on peut controler l'indentation des balises. Pour un site en |
production, il suffit d'ajouter un style #chrono {display:none;} dans la css. De |
cette façon, le tableau ne s'affichera pas. Le webmaster lui pourra rajouter sa |
propre feuille de style affichant le tableau. Le développeur initial de cette |
fonction est Loic d'Anterroches. Elle a été modifiée par Jean-Pascal |
Milcent.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$cle</var></dt> |
<dd><code>string</code><br>l'eventuel nom du point de chronométrage de fin.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>la chaine XHTML de mesure des temps.<br> |
</div> |
<h4>Author</h4> |
<div class="list"> |
Loic d'Anterroches<br> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-RestServeur.html |
---|
New file |
0,0 → 1,787 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/RestServeur.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li class="active"><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-RestServeur.html" title="Summary of RestServeur"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe principale gérant les services web de type (@link(REST, http://fr.wikipedia.org/wiki/Rest). |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * Elle contient : |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * - les constantes indiquant les différentes (@link(méthode HTTP, http://fr.wikipedia.org/wiki/Http) prises en compte. |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * - les @link(codes HTTP des réponses, http://fr.wikipedia.org/wiki/Liste_des_codes_HTTP) |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * Ce serveur REST accepte 4 types de méthodes HTTP : GET, PUT, POST, DELETE. |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * GET et POST ne pose généralement pas de problème pour les clients HTTP mais ce n'est pas forcément le cas pour PUT et DELETE. |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * Vous pouvez donc pour réaliser : |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * - DELETE : utiliser la méthode POST avec action=DELETE dans le corps de la requête. |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * - PUT : utiliser la méthode POST avec une url ne contenant aucune indication de ressource. |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * Une autre solution consiste à utiliser n'importe quelle méthode et à ajouter l'entête "X_HTTP_METHOD_OVERRIDE" avec pour |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * valeur le nom de la méthode que vous souhaitez utiliser. Exemple d'entête : "X_HTTP_METHOD_OVERRIDE: PUT". |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> * Exemple : <code>curl -v -v -H "X_HTTP_METHOD_OVERRIDE: DELETE" "http://www.mondomaine.org/services/apiVersion/[mon-service]/"</code> |
</span></span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-comment"> * Cela fonctionne avec Apache. |
</span></span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-comment"> * |
</span></span><span id="20" class="l"><a class="l" href="#20"> 20: </a><span class="php-comment"> * Les classes des services web doivent avoir un nom au format ChatMot "MonService" et être appelée dans l'url par le même nom |
</span></span><span id="21" class="l"><a class="l" href="#21"> 21: </a><span class="php-comment"> * en minuscule où les mots sont séparés par des tirets "mon-service". |
</span></span><span id="22" class="l"><a class="l" href="#22"> 22: </a><span class="php-comment"> * |
</span></span><span id="23" class="l"><a class="l" href="#23"> 23: </a><span class="php-comment"> * Paramètres liés dans config.ini : |
</span></span><span id="24" class="l"><a class="l" href="#24"> 24: </a><span class="php-comment"> * - serveur.baseURL : morceau de l'url pour appeler le serveur relative au domaine. Exemple : pour http://www.tela-botanica.org/mon_serveur/ |
</span></span><span id="25" class="l"><a class="l" href="#25"> 25: </a><span class="php-comment"> * mettre : "/mon_serveur/" |
</span></span><span id="26" class="l"><a class="l" href="#26"> 26: </a><span class="php-comment"> * - serveur.baseAlternativeURL : sur le même principe que ci-dessus permet d'affecter une deuxième url (pour gérer des raccourci via htaccess) |
</span></span><span id="27" class="l"><a class="l" href="#27"> 27: </a><span class="php-comment"> * |
</span></span><span id="28" class="l"><a class="l" href="#28"> 28: </a><span class="php-comment"> * Encodage en entrée : utf8 |
</span></span><span id="29" class="l"><a class="l" href="#29"> 29: </a><span class="php-comment"> * Encodage en sortie : utf8 |
</span></span><span id="30" class="l"><a class="l" href="#30"> 30: </a><span class="php-comment"> * |
</span></span><span id="31" class="l"><a class="l" href="#31"> 31: </a><span class="php-comment"> * @category Php 5.2 |
</span></span><span id="32" class="l"><a class="l" href="#32"> 32: </a><span class="php-comment"> * @package Framework |
</span></span><span id="33" class="l"><a class="l" href="#33"> 33: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="34" class="l"><a class="l" href="#34"> 34: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="35" class="l"><a class="l" href="#35"> 35: </a><span class="php-comment"> * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt> |
</span></span><span id="36" class="l"><a class="l" href="#36"> 36: </a><span class="php-comment"> * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt> |
</span></span><span id="37" class="l"><a class="l" href="#37"> 37: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="38" class="l"><a class="l" href="#38"> 38: </a><span class="php-comment"> * @version $Id: RestServeur.php 421 2013-04-11 14:43:49Z jpm $ |
</span></span><span id="39" class="l"><a class="l" href="#39"> 39: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="40" class="l"><a class="l" href="#40"> 40: </a><span class="php-comment"> */</span> |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a><span class="php-comment">// TODO : gerer les retours : dans ce controleur : code retour et envoi ...</span> |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a><span class="php-keyword1">class</span> <a id="RestServeur" href="#RestServeur">RestServeur</a> { |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> <span class="php-comment">/** Nom de la méthode appelée dans un service pour éxécuter une requête de type GET. */</span> |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> <span class="php-keyword1">const</span> <a id="METHODE_GET" href="#METHODE_GET">METHODE_GET</a> = <span class="php-quote">'consulter'</span>; |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> <span class="php-comment">/** Nom de la méthode appelée dans un service pour éxécuter une requête de type POST. */</span> |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-keyword1">const</span> <a id="METHODE_POST" href="#METHODE_POST">METHODE_POST</a> = <span class="php-quote">'modifier'</span>; |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> <span class="php-comment">/** Nom de la méthode appelée dans un service pour éxécuter une requête de type DELETE. */</span> |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> <span class="php-keyword1">const</span> <a id="METHODE_DELETE" href="#METHODE_DELETE">METHODE_DELETE</a> = <span class="php-quote">'supprimer'</span>; |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> <span class="php-comment">/** Nom de la méthode appelée dans un service pour éxécuter une requête de type PUT. */</span> |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-keyword1">const</span> <a id="METHODE_PUT" href="#METHODE_PUT">METHODE_PUT</a> = <span class="php-quote">'ajouter'</span>; |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> <span class="php-comment">/** Code HTTP 200 indiquant le succès de l'accès à un service web par la méthode GET. |
</span></span><span id="57" class="l"><a class="l" href="#57"> 57: </a><span class="php-comment"> * L'utiliser lors d'une requète de type GET (consulter) pour indiquer le succès de l'opération. |
</span></span><span id="58" class="l"><a class="l" href="#58"> 58: </a><span class="php-comment"> * Sera renvoyée par défaut par PHP. */</span> |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-keyword1">const</span> <a id="HTTP_CODE_OK" href="#HTTP_CODE_OK">HTTP_CODE_OK</a> = <span class="php-quote">'200'</span>; |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> <span class="php-comment">/** Code HTTP 201 indiquant que l'accès à un service web est un succès et que la ressource a été créée ou modifié. |
</span></span><span id="62" class="l"><a class="l" href="#62"> 62: </a><span class="php-comment"> * L'utiliser lors d'une requète de type PUT (ajouter) ou POST (modifier) pour indiquer le succès de l'opération. */</span> |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> <span class="php-keyword1">const</span> <a id="HTTP_CODE_CREATION_OK" href="#HTTP_CODE_CREATION_OK">HTTP_CODE_CREATION_OK</a> = <span class="php-quote">'201'</span>; |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> <span class="php-comment">/** Code HTTP 204 indique que l'accès à un service web est un succès et qu'il n'y a pas de contenu à renvoyer. |
</span></span><span id="66" class="l"><a class="l" href="#66"> 66: </a><span class="php-comment"> * L'utiliser lors d'une requète de type DELETE (supprimer) pour indiquer le succès de l'opération si aucun |
</span></span><span id="67" class="l"><a class="l" href="#67"> 67: </a><span class="php-comment"> * contenu (status) ne doit être renvoyé, sinon utiliser 200 OK. */</span> |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> <span class="php-keyword1">const</span> <a id="HTTP_CODE_SUPPRESSION_OK" href="#HTTP_CODE_SUPPRESSION_OK">HTTP_CODE_SUPPRESSION_OK</a> = <span class="php-quote">'204'</span>; |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> <span class="php-comment">/** Code HTTP 400 indique que les paramètres envoyés au service contiennent des erreurs. |
</span></span><span id="71" class="l"><a class="l" href="#71"> 71: </a><span class="php-comment"> * L'utiliser pour indiquer l'échec de l'accès au service. La réponse pourra contenir un message expliquant la source |
</span></span><span id="72" class="l"><a class="l" href="#72"> 72: </a><span class="php-comment"> * de l'erreur. */</span> |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> <span class="php-keyword1">const</span> <a id="HTTP_CODE_MAUVAISE_REQUETE" href="#HTTP_CODE_MAUVAISE_REQUETE">HTTP_CODE_MAUVAISE_REQUETE</a> = <span class="php-quote">'400'</span>; |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> <span class="php-comment">/** Code HTTP 401 indiquant que l'accès à un service web est refusé car l'authentification (obligatoire) a échoué pour |
</span></span><span id="76" class="l"><a class="l" href="#76"> 76: </a><span class="php-comment"> * accéder à la ressource. */</span> |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> <span class="php-keyword1">const</span> <a id="HTTP_CODE_ACCES_NON_AUTORISE" href="#HTTP_CODE_ACCES_NON_AUTORISE">HTTP_CODE_ACCES_NON_AUTORISE</a> = <span class="php-quote">'401'</span>; |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> <span class="php-comment">/** Code HTTP 404 indiquant que la ressource indiquée par l'url est introuvable. */</span> |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> <span class="php-keyword1">const</span> <a id="HTTP_CODE_RESSOURCE_INTROUVABLE" href="#HTTP_CODE_RESSOURCE_INTROUVABLE">HTTP_CODE_RESSOURCE_INTROUVABLE</a> = <span class="php-quote">'404'</span>; |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> <span class="php-comment">/** Code HTTP 405 indiquant soit : |
</span></span><span id="83" class="l"><a class="l" href="#83"> 83: </a><span class="php-comment"> * - que le service web ne possède pas d'accès la ressource correspondant à la méthode HTTP employée. |
</span></span><span id="84" class="l"><a class="l" href="#84"> 84: </a><span class="php-comment"> * - que la méthode HTTP enployée n'est pas en accord avec la ressource indiquée par l'url. */</span> |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> <span class="php-keyword1">const</span> <a id="HTTP_CODE_METHODE_NON_AUTORISE" href="#HTTP_CODE_METHODE_NON_AUTORISE">HTTP_CODE_METHODE_NON_AUTORISE</a> = <span class="php-quote">'405'</span>; |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-comment">/** Code d'erreur HTTP 409 indiquant qu'un conflit est survenu vis à vis de la ressource. |
</span></span><span id="88" class="l"><a class="l" href="#88"> 88: </a><span class="php-comment"> * Par exemple, essayer de créer deux fois la même ressource ou bien tenter de modifier une ressource qui a été modifiée par |
</span></span><span id="89" class="l"><a class="l" href="#89"> 89: </a><span class="php-comment"> * ailleurs. */</span> |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> <span class="php-keyword1">const</span> <a id="HTTP_CODE_CONFLIT" href="#HTTP_CODE_CONFLIT">HTTP_CODE_CONFLIT</a> = <span class="php-quote">'409'</span>; |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-comment">/** Code HTTP 411 indiquant que des paramètres passés dans le contenu de la requête sont nécessaires au service. */</span> |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-keyword1">const</span> <a id="HTTP_CODE_CONTENU_REQUIS" href="#HTTP_CODE_CONTENU_REQUIS">HTTP_CODE_CONTENU_REQUIS</a> = <span class="php-quote">'411'</span>; |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> <span class="php-comment">/** Code d'erreur HTTP 500 Internal Server Error. |
</span></span><span id="96" class="l"><a class="l" href="#96"> 96: </a><span class="php-comment"> * L'utiliser quand le serveur ou un service soulève une erreur ou une exception. */</span> |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-keyword1">const</span> <a id="HTTP_CODE_ERREUR" href="#HTTP_CODE_ERREUR">HTTP_CODE_ERREUR</a> = <span class="php-quote">'500'</span>; |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> <span class="php-comment">/** Motif de l'epression régulière vérfiant la version de l'API. */</span> |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> <span class="php-keyword1">const</span> <a id="MOTIF_API_VERSION" href="#MOTIF_API_VERSION">MOTIF_API_VERSION</a> = <span class="php-quote">'/^[0-9]+(?:[.][0-9]+)*$/'</span>; |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> <span class="php-comment">/** Motif de l'epression régulière vérfiant le nom du service. */</span> |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> <span class="php-keyword1">const</span> <a id="MOTIF_SERVICE_NOM" href="#MOTIF_SERVICE_NOM">MOTIF_SERVICE_NOM</a> = <span class="php-quote">'/^[a-z0-9]+(?:[-][a-z0-9]+)*$/'</span>; |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-comment">/** Mettre à true pour activer l'affichage des messages d'erreurs et de débogage. |
</span></span><span id="106" class="l"><a class="l" href="#106">106: </a><span class="php-comment"> * @var boolean */</span> |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$debogageActivation" href="#$debogageActivation">$debogageActivation</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> <span class="php-comment">/** Indiquer le mode de débogage à utiliser (@see Debug). |
</span></span><span id="110" class="l"><a class="l" href="#110">110: </a><span class="php-comment"> * @var string */</span> |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$debogageMode" href="#$debogageMode">$debogageMode</a></span> = <span class="php-quote">''</span>; |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-comment">/** La méthode de la requête HTTP utilisée. |
</span></span><span id="114" class="l"><a class="l" href="#114">114: </a><span class="php-comment"> * @var string */</span> |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$methode" href="#$methode">$methode</a></span> = <span class="php-quote">'GET'</span>; |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> <span class="php-comment">/** Le contenu brut du corps de la requête HTTP (s'il y en a). |
</span></span><span id="118" class="l"><a class="l" href="#118">118: </a><span class="php-comment"> * @var array */</span> |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$requeteDonnees" href="#$requeteDonnees">$requeteDonnees</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-comment">/** Le contenu sous forme de tableau de paires clés-valeurs du corps de la requête HTTP (s'il y en a). |
</span></span><span id="122" class="l"><a class="l" href="#122">122: </a><span class="php-comment"> * @var array */</span> |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$requeteDonneesParsees" href="#$requeteDonneesParsees">$requeteDonneesParsees</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> <span class="php-comment">/** Version de l'API demandée. |
</span></span><span id="126" class="l"><a class="l" href="#126">126: </a><span class="php-comment"> * Ex. http://www.mondomaine.org/services/[apiVersion]/mon-service/ |
</span></span><span id="127" class="l"><a class="l" href="#127">127: </a><span class="php-comment"> * @var mixed Généralement deux nombres séparés par un point. Ex. : 1.0 |
</span></span><span id="128" class="l"><a class="l" href="#128">128: </a><span class="php-comment"> */</span> |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$apiVersion" href="#$apiVersion">$apiVersion</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> <span class="php-comment">/** Nom du service demandé. |
</span></span><span id="132" class="l"><a class="l" href="#132">132: </a><span class="php-comment"> * Ex. http://www.mondomaine.org/services/apiVersion/[mon-service]/ |
</span></span><span id="133" class="l"><a class="l" href="#133">133: </a><span class="php-comment"> * @var string par défaut vaut null. |
</span></span><span id="134" class="l"><a class="l" href="#134">134: </a><span class="php-comment"> */</span> |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$service" href="#$service">$service</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> |
</span><span id="137" class="l"><a class="l" href="#137">137: </a> <span class="php-comment">/** Morceaux de l'url servant à préciser la ressource concerné pour le service demandé. |
</span></span><span id="138" class="l"><a class="l" href="#138">138: </a><span class="php-comment"> * Ex. http://www.mondomaine.org/services/apiVersion/mon-service/[maRessource/maSousResource...] |
</span></span><span id="139" class="l"><a class="l" href="#139">139: </a><span class="php-comment"> * @var array |
</span></span><span id="140" class="l"><a class="l" href="#140">140: </a><span class="php-comment"> */</span> |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$ressources" href="#$ressources">$ressources</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-comment">/** Partie de l'url situé après le '?' servant à paramétrer le service demandé. |
</span></span><span id="144" class="l"><a class="l" href="#144">144: </a><span class="php-comment"> * Les données proviennent de $_GET où les caractères suivant ont été transformé en '_' undescrore dans les clés : |
</span></span><span id="145" class="l"><a class="l" href="#145">145: </a><span class="php-comment"> * - chr(32) ( ) (space) |
</span></span><span id="146" class="l"><a class="l" href="#146">146: </a><span class="php-comment"> * - chr(46) (.) (dot) |
</span></span><span id="147" class="l"><a class="l" href="#147">147: </a><span class="php-comment"> * - chr(91) ([) (open square bracket) |
</span></span><span id="148" class="l"><a class="l" href="#148">148: </a><span class="php-comment"> * - chr(128) - chr(159) (various) |
</span></span><span id="149" class="l"><a class="l" href="#149">149: </a><span class="php-comment"> * En outre nous appliquons la méthode nettoyerGet() qui effectue d'autres remplacement dans les valeurs. |
</span></span><span id="150" class="l"><a class="l" href="#150">150: </a><span class="php-comment"> * Ex. http://www.mondomaine.org/services/apiVersion/mon-service?monParametre1=maValeur1&monParametre2=maValeur2 |
</span></span><span id="151" class="l"><a class="l" href="#151">151: </a><span class="php-comment"> * @see parametresBruts |
</span></span><span id="152" class="l"><a class="l" href="#152">152: </a><span class="php-comment"> * @var array |
</span></span><span id="153" class="l"><a class="l" href="#153">153: </a><span class="php-comment"> */</span> |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$parametres" href="#$parametres">$parametres</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> <span class="php-comment">/** Partie de l'url situé après le '?' servant à paramétrer le service demandé. |
</span></span><span id="157" class="l"><a class="l" href="#157">157: </a><span class="php-comment"> * Les données proviennent de $_SERVER['QUERY_STRING'] et n'ont subies aucune transformation au niveau des clés. |
</span></span><span id="158" class="l"><a class="l" href="#158">158: </a><span class="php-comment"> * Cependant nous appliquons la méthode nettoyerGet() qui effectue d'autres remplacement dans les valeurs. |
</span></span><span id="159" class="l"><a class="l" href="#159">159: </a><span class="php-comment"> * Ex. http://www.mondomaine.org/services/apiVersion/mon-service?monParametre1=maValeur1&monParametre2=maValeur2 |
</span></span><span id="160" class="l"><a class="l" href="#160">160: </a><span class="php-comment"> * @see parametres |
</span></span><span id="161" class="l"><a class="l" href="#161">161: </a><span class="php-comment"> * @var array |
</span></span><span id="162" class="l"><a class="l" href="#162">162: </a><span class="php-comment"> */</span> |
</span><span id="163" class="l"><a class="l" href="#163">163: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$parametresBruts" href="#$parametresBruts">$parametresBruts</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="164" class="l"><a class="l" href="#164">164: </a> |
</span><span id="165" class="l"><a class="l" href="#165">165: </a> <span class="php-comment">/** Tableau contenant les paramètres de configuration du serveur. |
</span></span><span id="166" class="l"><a class="l" href="#166">166: </a><span class="php-comment"> * @var array |
</span></span><span id="167" class="l"><a class="l" href="#167">167: </a><span class="php-comment"> */</span> |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$config" href="#$config">$config</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> <span class="php-comment">/** Tableau contenant les messages d'erreur et/ou d'avertissement du Serveur. |
</span></span><span id="171" class="l"><a class="l" href="#171">171: </a><span class="php-comment"> * @var array |
</span></span><span id="172" class="l"><a class="l" href="#172">172: </a><span class="php-comment"> * */</span> |
</span><span id="173" class="l"><a class="l" href="#173">173: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$messages" href="#$messages">$messages</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="174" class="l"><a class="l" href="#174">174: </a> |
</span><span id="175" class="l"><a class="l" href="#175">175: </a> <span class="php-comment">/** Codes HTTP. */</span> |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$http10" href="#$http10">$http10</a></span> = <span class="php-keyword1">array</span>( |
</span><span id="177" class="l"><a class="l" href="#177">177: </a> self::HTTP_CODE_OK => <span class="php-quote">'OK'</span>, |
</span><span id="178" class="l"><a class="l" href="#178">178: </a> self::HTTP_CODE_CREATION_OK => <span class="php-quote">'Created'</span>, |
</span><span id="179" class="l"><a class="l" href="#179">179: </a> self::HTTP_CODE_SUPPRESSION_OK => <span class="php-quote">'No Content'</span>, |
</span><span id="180" class="l"><a class="l" href="#180">180: </a> self::HTTP_CODE_MAUVAISE_REQUETE => <span class="php-quote">'Bad Request'</span>, |
</span><span id="181" class="l"><a class="l" href="#181">181: </a> self::HTTP_CODE_ACCES_NON_AUTORISE => <span class="php-quote">'Unauthorized'</span>, |
</span><span id="182" class="l"><a class="l" href="#182">182: </a> self::HTTP_CODE_RESSOURCE_INTROUVABLE => <span class="php-quote">'Not Found'</span>, |
</span><span id="183" class="l"><a class="l" href="#183">183: </a> self::HTTP_CODE_METHODE_NON_AUTORISE => <span class="php-quote">'Method Not Allowed'</span>, |
</span><span id="184" class="l"><a class="l" href="#184">184: </a> self::HTTP_CODE_CONFLIT => <span class="php-quote">'Conflict'</span>, |
</span><span id="185" class="l"><a class="l" href="#185">185: </a> self::HTTP_CODE_CONTENU_REQUIS => <span class="php-quote">'Length Required'</span>, |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> self::HTTP_CODE_ERREUR => <span class="php-quote">'Internal Server Error'</span> |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> ); |
</span><span id="188" class="l"><a class="l" href="#188">188: </a> |
</span><span id="189" class="l"><a class="l" href="#189">189: </a> <span class="php-comment">/** Tableau des noms des paramètres à définir dans le fichier de config car obligatoirement nécessaire à cette classe.*/</span> |
</span><span id="190" class="l"><a class="l" href="#190">190: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$parametres_obligatoires" href="#$parametres_obligatoires">$parametres_obligatoires</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'debogage'</span>, <span class="php-quote">'debogage_mode'</span>, <span class="php-quote">'serveur.baseURL'</span>, <span class="php-quote">'chemin_modules'</span>); |
</span><span id="191" class="l"><a class="l" href="#191">191: </a> |
</span><span id="192" class="l"><a class="l" href="#192">192: </a> <span class="php-comment">/** |
</span></span><span id="193" class="l"><a class="l" href="#193">193: </a><span class="php-comment"> * Analyse les données envoyées au serveur, enregistre la méthode HTTP utilisée pour appeler le serveur et parse |
</span></span><span id="194" class="l"><a class="l" href="#194">194: </a><span class="php-comment"> * l'url appelée pour trouver le service demandé. |
</span></span><span id="195" class="l"><a class="l" href="#195">195: </a><span class="php-comment"> */</span> |
</span><span id="196" class="l"><a class="l" href="#196">196: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>() { |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> Config::verifierPresenceParametres(<span class="php-var">$this</span>->parametres_obligatoires); |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> self::<span class="php-var">$debogageActivation</span> = Config::get(<span class="php-quote">'debogage'</span>); |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> self::<span class="php-var">$debogageMode</span> = Config::get(<span class="php-quote">'debogage_mode'</span>); |
</span><span id="201" class="l"><a class="l" href="#201">201: </a> |
</span><span id="202" class="l"><a class="l" href="#202">202: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_URI'</span>]) && <span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_METHOD'</span>]) && <span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'QUERY_STRING'</span>])) { |
</span><span id="203" class="l"><a class="l" href="#203">203: </a> <span class="php-var">$this</span>->initialiserMethode(); |
</span><span id="204" class="l"><a class="l" href="#204">204: </a> <span class="php-var">$this</span>->initialiserRequeteDonnees(); |
</span><span id="205" class="l"><a class="l" href="#205">205: </a> |
</span><span id="206" class="l"><a class="l" href="#206">206: </a> <span class="php-var">$urlParts</span> = <span class="php-var">$this</span>->decouperUrlChemin(); |
</span><span id="207" class="l"><a class="l" href="#207">207: </a> |
</span><span id="208" class="l"><a class="l" href="#208">208: </a> <span class="php-var">$this</span>->initialiserApiVersion(<span class="php-keyword2">array_shift</span>(<span class="php-var">$urlParts</span>)); |
</span><span id="209" class="l"><a class="l" href="#209">209: </a> <span class="php-var">$this</span>->initialiserServiceNom(<span class="php-keyword2">array_shift</span>(<span class="php-var">$urlParts</span>)); |
</span><span id="210" class="l"><a class="l" href="#210">210: </a> <span class="php-var">$this</span>->initialiserRessource(<span class="php-var">$urlParts</span>); |
</span><span id="211" class="l"><a class="l" href="#211">211: </a> |
</span><span id="212" class="l"><a class="l" href="#212">212: </a> <span class="php-var">$this</span>->initialiserParametres(); |
</span><span id="213" class="l"><a class="l" href="#213">213: </a> <span class="php-comment">// Enregistrement en première position des autoload de la méthode gérant les classes des services</span> |
</span><span id="214" class="l"><a class="l" href="#214">214: </a> <span class="php-keyword2">spl_autoload_register</span>(<span class="php-keyword1">array</span>(<span class="php-keyword2">get_class</span>(), <span class="php-quote">'chargerClasse'</span>)); |
</span><span id="215" class="l"><a class="l" href="#215">215: </a> } <span class="php-keyword1">else</span> { |
</span><span id="216" class="l"><a class="l" href="#216">216: </a> self::envoyerEnteteStatutHttp(self::HTTP_CODE_ERREUR); |
</span><span id="217" class="l"><a class="l" href="#217">217: </a> <span class="php-var">$e</span> = <span class="php-quote">"La classe Serveur du TBFRamework nécessite, pour fonctionner, l'accès aux variables serveurs REQUEST_URI, REQUEST_METHOD et QUERY_STRING."</span>; |
</span><span id="218" class="l"><a class="l" href="#218">218: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="219" class="l"><a class="l" href="#219">219: </a> } |
</span><span id="220" class="l"><a class="l" href="#220">220: </a> } |
</span><span id="221" class="l"><a class="l" href="#221">221: </a> |
</span><span id="222" class="l"><a class="l" href="#222">222: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_initialiserMethode" href="#_initialiserMethode">initialiserMethode</a>() { |
</span><span id="223" class="l"><a class="l" href="#223">223: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'HTTP_X_HTTP_METHOD_OVERRIDE'</span>]) && <span class="php-keyword2">count</span>(<span class="php-keyword2">trim</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'HTTP_X_HTTP_METHOD_OVERRIDE'</span>])) > <span class="php-num">0</span>) { |
</span><span id="224" class="l"><a class="l" href="#224">224: </a> <span class="php-var">$this</span>->methode = <span class="php-keyword2">trim</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'HTTP_X_HTTP_METHOD_OVERRIDE'</span>]); |
</span><span id="225" class="l"><a class="l" href="#225">225: </a> } <span class="php-keyword1">else</span> { |
</span><span id="226" class="l"><a class="l" href="#226">226: </a> <span class="php-var">$this</span>->methode = <span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_METHOD'</span>]; |
</span><span id="227" class="l"><a class="l" href="#227">227: </a> } |
</span><span id="228" class="l"><a class="l" href="#228">228: </a> } |
</span><span id="229" class="l"><a class="l" href="#229">229: </a> |
</span><span id="230" class="l"><a class="l" href="#230">230: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_initialiserRequeteDonnees" href="#_initialiserRequeteDonnees">initialiserRequeteDonnees</a>() { |
</span><span id="231" class="l"><a class="l" href="#231">231: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'CONTENT_LENGTH'</span>]) && <span class="php-var">$_SERVER</span>[<span class="php-quote">'CONTENT_LENGTH'</span>] > <span class="php-num">0</span>) { |
</span><span id="232" class="l"><a class="l" href="#232">232: </a> <span class="php-var">$this</span>->requeteDonnees = <span class="php-quote">''</span>; |
</span><span id="233" class="l"><a class="l" href="#233">233: </a> <span class="php-var">$httpContent</span> = <span class="php-keyword2">fopen</span>(<span class="php-quote">'php://input'</span>, <span class="php-quote">'r'</span>); |
</span><span id="234" class="l"><a class="l" href="#234">234: </a> <span class="php-keyword1">while</span> (<span class="php-var">$data</span> = <span class="php-keyword2">fread</span>(<span class="php-var">$httpContent</span>, <span class="php-num">1024</span>)) { |
</span><span id="235" class="l"><a class="l" href="#235">235: </a> <span class="php-var">$this</span>->requeteDonnees .= <span class="php-var">$data</span>; |
</span><span id="236" class="l"><a class="l" href="#236">236: </a> } |
</span><span id="237" class="l"><a class="l" href="#237">237: </a> <span class="php-keyword2">fclose</span>(<span class="php-var">$httpContent</span>); |
</span><span id="238" class="l"><a class="l" href="#238">238: </a> } |
</span><span id="239" class="l"><a class="l" href="#239">239: </a> } |
</span><span id="240" class="l"><a class="l" href="#240">240: </a> |
</span><span id="241" class="l"><a class="l" href="#241">241: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_decouperUrlChemin" href="#_decouperUrlChemin">decouperUrlChemin</a>() { |
</span><span id="242" class="l"><a class="l" href="#242">242: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'REDIRECT_URL'</span>]) && <span class="php-var">$_SERVER</span>[<span class="php-quote">'REDIRECT_URL'</span>] != <span class="php-quote">''</span>) { |
</span><span id="243" class="l"><a class="l" href="#243">243: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'REDIRECT_QUERY_STRING'</span>]) && !<span class="php-keyword1">empty</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'REDIRECT_QUERY_STRING'</span>])) { |
</span><span id="244" class="l"><a class="l" href="#244">244: </a> <span class="php-var">$url</span> = <span class="php-var">$_SERVER</span>[<span class="php-quote">'REDIRECT_URL'</span>].<span class="php-quote">'?'</span>.<span class="php-var">$_SERVER</span>[<span class="php-quote">'REDIRECT_QUERY_STRING'</span>]; |
</span><span id="245" class="l"><a class="l" href="#245">245: </a> } <span class="php-keyword1">else</span> { |
</span><span id="246" class="l"><a class="l" href="#246">246: </a> <span class="php-var">$url</span> = <span class="php-var">$_SERVER</span>[<span class="php-quote">'REDIRECT_URL'</span>]; |
</span><span id="247" class="l"><a class="l" href="#247">247: </a> } |
</span><span id="248" class="l"><a class="l" href="#248">248: </a> } <span class="php-keyword1">else</span> { |
</span><span id="249" class="l"><a class="l" href="#249">249: </a> <span class="php-var">$url</span> = <span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_URI'</span>]; |
</span><span id="250" class="l"><a class="l" href="#250">250: </a> } |
</span><span id="251" class="l"><a class="l" href="#251">251: </a> |
</span><span id="252" class="l"><a class="l" href="#252">252: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'QUERY_STRING'</span>]) == <span class="php-num">0</span>) { |
</span><span id="253" class="l"><a class="l" href="#253">253: </a> <span class="php-var">$tailleURL</span> = <span class="php-keyword2">strlen</span>(<span class="php-var">$url</span>); |
</span><span id="254" class="l"><a class="l" href="#254">254: </a> } <span class="php-keyword1">else</span> { |
</span><span id="255" class="l"><a class="l" href="#255">255: </a> <span class="php-var">$tailleURL</span> = -(<span class="php-keyword2">strlen</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'QUERY_STRING'</span>]) + <span class="php-num">1</span>); |
</span><span id="256" class="l"><a class="l" href="#256">256: </a> } |
</span><span id="257" class="l"><a class="l" href="#257">257: </a> |
</span><span id="258" class="l"><a class="l" href="#258">258: </a> <span class="php-var">$urlChaine</span> = <span class="php-quote">''</span>; |
</span><span id="259" class="l"><a class="l" href="#259">259: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strpos</span>(<span class="php-var">$url</span>, Config::get(<span class="php-quote">'serveur.baseURL'</span>)) !== <span class="php-keyword1">false</span>) { |
</span><span id="260" class="l"><a class="l" href="#260">260: </a> <span class="php-var">$urlChaine</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$url</span>, <span class="php-keyword2">strlen</span>(Config::get(<span class="php-quote">'serveur.baseURL'</span>)), <span class="php-var">$tailleURL</span>); |
</span><span id="261" class="l"><a class="l" href="#261">261: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-keyword2">strpos</span>(<span class="php-var">$url</span>, Config::get(<span class="php-quote">'serveur.baseAlternativeURL'</span>)) !== <span class="php-keyword1">false</span>) { |
</span><span id="262" class="l"><a class="l" href="#262">262: </a> <span class="php-var">$urlChaine</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$url</span>, <span class="php-keyword2">strlen</span>(Config::get(<span class="php-quote">'serveur.baseAlternativeURL'</span>)), <span class="php-var">$tailleURL</span>); |
</span><span id="263" class="l"><a class="l" href="#263">263: </a> } |
</span><span id="264" class="l"><a class="l" href="#264">264: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">explode</span>(<span class="php-quote">'/'</span>, <span class="php-var">$urlChaine</span>); |
</span><span id="265" class="l"><a class="l" href="#265">265: </a> } |
</span><span id="266" class="l"><a class="l" href="#266">266: </a> |
</span><span id="267" class="l"><a class="l" href="#267">267: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_initialiserApiVersion" href="#_initialiserApiVersion">initialiserApiVersion</a>(<span class="php-var">$apiVersion</span>) { |
</span><span id="268" class="l"><a class="l" href="#268">268: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->verifierApiVersion(<span class="php-var">$apiVersion</span>)) { |
</span><span id="269" class="l"><a class="l" href="#269">269: </a> <span class="php-var">$this</span>->apiVersion = <span class="php-var">$apiVersion</span>; |
</span><span id="270" class="l"><a class="l" href="#270">270: </a> self::<span class="php-var">$config</span>[<span class="php-quote">'chemins'</span>][<span class="php-quote">'api'</span>] = Config::get(<span class="php-quote">'chemin_modules'</span>).<span class="php-var">$this</span>->apiVersion.DS; |
</span><span id="271" class="l"><a class="l" href="#271">271: </a> self::<span class="php-var">$config</span>[<span class="php-quote">'chemins'</span>][<span class="php-quote">'api_bibliotheque'</span>] = self::<span class="php-var">$config</span>[<span class="php-quote">'chemins'</span>][<span class="php-quote">'api'</span>].Config::get(<span class="php-quote">'dossier_bibliotheque'</span>).DS; |
</span><span id="272" class="l"><a class="l" href="#272">272: </a> } <span class="php-keyword1">else</span> { |
</span><span id="273" class="l"><a class="l" href="#273">273: </a> self::envoyerEnteteStatutHttp(self::HTTP_CODE_MAUVAISE_REQUETE); |
</span><span id="274" class="l"><a class="l" href="#274">274: </a> <span class="php-var">$e</span> = <span class="php-quote">"Aucune version d'API n'a été spécifiée.\n"</span>. |
</span><span id="275" class="l"><a class="l" href="#275">275: </a> <span class="php-quote">"La version doit respecter l'expression régulière suivante : "</span>.self::MOTIF_API_VERSION.<span class="php-quote">".\n"</span>. |
</span><span id="276" class="l"><a class="l" href="#276">276: </a> <span class="php-quote">"L'url doit avoir la forme suivante : http://www.mondomaine.org/services/apiVersion/monService/"</span>; |
</span><span id="277" class="l"><a class="l" href="#277">277: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="278" class="l"><a class="l" href="#278">278: </a> self::cloreAccesServeur(); |
</span><span id="279" class="l"><a class="l" href="#279">279: </a> } |
</span><span id="280" class="l"><a class="l" href="#280">280: </a> } |
</span><span id="281" class="l"><a class="l" href="#281">281: </a> |
</span><span id="282" class="l"><a class="l" href="#282">282: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_verifierApiVersion" href="#_verifierApiVersion">verifierApiVersion</a>(<span class="php-var">$apiVersion</span>) { |
</span><span id="283" class="l"><a class="l" href="#283">283: </a> <span class="php-var">$apiOk</span> = <span class="php-keyword1">false</span>; |
</span><span id="284" class="l"><a class="l" href="#284">284: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$apiVersion</span>) && !<span class="php-keyword1">empty</span>(<span class="php-var">$apiVersion</span>) && <span class="php-keyword2">preg_match</span>(self::MOTIF_API_VERSION, <span class="php-var">$apiVersion</span>)) { |
</span><span id="285" class="l"><a class="l" href="#285">285: </a> <span class="php-var">$apiOk</span> = <span class="php-keyword1">true</span>; |
</span><span id="286" class="l"><a class="l" href="#286">286: </a> } |
</span><span id="287" class="l"><a class="l" href="#287">287: </a> <span class="php-keyword1">return</span> <span class="php-var">$apiOk</span>; |
</span><span id="288" class="l"><a class="l" href="#288">288: </a> } |
</span><span id="289" class="l"><a class="l" href="#289">289: </a> |
</span><span id="290" class="l"><a class="l" href="#290">290: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_initialiserServiceNom" href="#_initialiserServiceNom">initialiserServiceNom</a>(<span class="php-var">$serviceNom</span>) { |
</span><span id="291" class="l"><a class="l" href="#291">291: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->verifierServiceNom(<span class="php-var">$serviceNom</span>)) { |
</span><span id="292" class="l"><a class="l" href="#292">292: </a> <span class="php-var">$this</span>->service = <span class="php-var">$this</span>->traiterNomService(<span class="php-var">$serviceNom</span>); |
</span><span id="293" class="l"><a class="l" href="#293">293: </a> } <span class="php-keyword1">else</span> { |
</span><span id="294" class="l"><a class="l" href="#294">294: </a> self::envoyerEnteteStatutHttp(self::HTTP_CODE_MAUVAISE_REQUETE); |
</span><span id="295" class="l"><a class="l" href="#295">295: </a> <span class="php-var">$e</span> = <span class="php-quote">"Aucune nom de service n'a été spécifié.\n"</span>. |
</span><span id="296" class="l"><a class="l" href="#296">296: </a> <span class="php-quote">"La nom du service doit respecter l'expression régulière suivante : "</span>.self::MOTIF_SERVICE_NOM.<span class="php-quote">".\n"</span>. |
</span><span id="297" class="l"><a class="l" href="#297">297: </a> <span class="php-quote">"L'url doit avoir la forme suivante : http://www.mondomaine.org/services/apiVersion/monService/"</span>; |
</span><span id="298" class="l"><a class="l" href="#298">298: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="299" class="l"><a class="l" href="#299">299: </a> self::cloreAccesServeur(); |
</span><span id="300" class="l"><a class="l" href="#300">300: </a> } |
</span><span id="301" class="l"><a class="l" href="#301">301: </a> } |
</span><span id="302" class="l"><a class="l" href="#302">302: </a> |
</span><span id="303" class="l"><a class="l" href="#303">303: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_verifierServiceNom" href="#_verifierServiceNom">verifierServiceNom</a>(<span class="php-var">$serviceNom</span>) { |
</span><span id="304" class="l"><a class="l" href="#304">304: </a> <span class="php-var">$serviceNomOk</span> = <span class="php-keyword1">false</span>; |
</span><span id="305" class="l"><a class="l" href="#305">305: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$serviceNom</span>) && !<span class="php-keyword1">empty</span>(<span class="php-var">$serviceNom</span>) && <span class="php-keyword2">preg_match</span>(self::MOTIF_SERVICE_NOM, <span class="php-var">$serviceNom</span>)) { |
</span><span id="306" class="l"><a class="l" href="#306">306: </a> <span class="php-var">$serviceNomOk</span> = <span class="php-keyword1">true</span>; |
</span><span id="307" class="l"><a class="l" href="#307">307: </a> } |
</span><span id="308" class="l"><a class="l" href="#308">308: </a> <span class="php-keyword1">return</span> <span class="php-var">$serviceNomOk</span>; |
</span><span id="309" class="l"><a class="l" href="#309">309: </a> } |
</span><span id="310" class="l"><a class="l" href="#310">310: </a> |
</span><span id="311" class="l"><a class="l" href="#311">311: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_traiterNomService" href="#_traiterNomService">traiterNomService</a>(<span class="php-var">$serviceNom</span>) { |
</span><span id="312" class="l"><a class="l" href="#312">312: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">str_replace</span>(<span class="php-quote">' '</span>, <span class="php-quote">''</span>, <span class="php-keyword2">ucwords</span>(<span class="php-keyword2">str_replace</span>(<span class="php-quote">'-'</span>, <span class="php-quote">' '</span>, <span class="php-keyword2">strtolower</span>(<span class="php-var">$serviceNom</span>)))); |
</span><span id="313" class="l"><a class="l" href="#313">313: </a> } |
</span><span id="314" class="l"><a class="l" href="#314">314: </a> |
</span><span id="315" class="l"><a class="l" href="#315">315: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_initialiserRessource" href="#_initialiserRessource">initialiserRessource</a>(<span class="php-var">$urlParts</span>) { |
</span><span id="316" class="l"><a class="l" href="#316">316: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$urlParts</span>) && <span class="php-keyword2">count</span>(<span class="php-var">$urlParts</span>) > <span class="php-num">0</span>) { |
</span><span id="317" class="l"><a class="l" href="#317">317: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$urlParts</span> <span class="php-keyword1">as</span> <span class="php-var">$ressource</span>) { |
</span><span id="318" class="l"><a class="l" href="#318">318: </a> <span class="php-comment">// Ne pas utiliser empty() car valeur 0 acceptée</span> |
</span><span id="319" class="l"><a class="l" href="#319">319: </a> <span class="php-keyword1">if</span> (<span class="php-var">$ressource</span> != <span class="php-quote">''</span>) { |
</span><span id="320" class="l"><a class="l" href="#320">320: </a> <span class="php-var">$this</span>->ressources[] = <span class="php-keyword2">urldecode</span>(<span class="php-var">$ressource</span>); |
</span><span id="321" class="l"><a class="l" href="#321">321: </a> } |
</span><span id="322" class="l"><a class="l" href="#322">322: </a> } |
</span><span id="323" class="l"><a class="l" href="#323">323: </a> } |
</span><span id="324" class="l"><a class="l" href="#324">324: </a> } |
</span><span id="325" class="l"><a class="l" href="#325">325: </a> |
</span><span id="326" class="l"><a class="l" href="#326">326: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_initialiserParametres" href="#_initialiserParametres">initialiserParametres</a>() { |
</span><span id="327" class="l"><a class="l" href="#327">327: </a> <span class="php-var">$this</span>->parametres = <span class="php-var">$this</span>->recupererParametresGet(); |
</span><span id="328" class="l"><a class="l" href="#328">328: </a> <span class="php-var">$this</span>->parametresBruts = <span class="php-var">$this</span>->recupererParametresBruts(); |
</span><span id="329" class="l"><a class="l" href="#329">329: </a> } |
</span><span id="330" class="l"><a class="l" href="#330">330: </a> |
</span><span id="331" class="l"><a class="l" href="#331">331: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_recupererParametresGet" href="#_recupererParametresGet">recupererParametresGet</a>() { |
</span><span id="332" class="l"><a class="l" href="#332">332: </a> <span class="php-var">$_GET</span> = <span class="php-var">$this</span>->nettoyerParametres(<span class="php-var">$_GET</span>); |
</span><span id="333" class="l"><a class="l" href="#333">333: </a> <span class="php-keyword1">return</span> <span class="php-var">$_GET</span>; |
</span><span id="334" class="l"><a class="l" href="#334">334: </a> } |
</span><span id="335" class="l"><a class="l" href="#335">335: </a> |
</span><span id="336" class="l"><a class="l" href="#336">336: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_nettoyerParametres" href="#_nettoyerParametres">nettoyerParametres</a>(<span class="php-keyword1">Array</span> <span class="php-var">$parametres</span>) { |
</span><span id="337" class="l"><a class="l" href="#337">337: </a> <span class="php-comment">// Pas besoin d'utiliser urldecode car déjà fait par php pour les clés et valeur de $_GET</span> |
</span><span id="338" class="l"><a class="l" href="#338">338: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$parametres</span>) && <span class="php-keyword2">count</span>(<span class="php-var">$parametres</span>) > <span class="php-num">0</span>) { |
</span><span id="339" class="l"><a class="l" href="#339">339: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$parametres</span> <span class="php-keyword1">as</span> <span class="php-var">$cle</span> => <span class="php-var">$valeur</span>) { |
</span><span id="340" class="l"><a class="l" href="#340">340: </a> <span class="php-comment">// les quotes, guillements et points-virgules ont été retirés des caractères à vérifier car</span> |
</span><span id="341" class="l"><a class="l" href="#341">341: </a> <span class="php-comment">//ça n'a plus lieu d'être maintenant que l'on utilise protéger à peu près partout</span> |
</span><span id="342" class="l"><a class="l" href="#342">342: </a> <span class="php-var">$verifier</span> = <span class="php-keyword1">array</span>(<span class="php-quote">'NULL'</span>, <span class="php-quote">"\\"</span>, <span class="php-quote">"\x00"</span>, <span class="php-quote">"\x1a"</span>); |
</span><span id="343" class="l"><a class="l" href="#343">343: </a> <span class="php-var">$parametres</span>[<span class="php-var">$cle</span>] = <span class="php-keyword2">strip_tags</span>(<span class="php-keyword2">str_replace</span>(<span class="php-var">$verifier</span>, <span class="php-quote">''</span>, <span class="php-var">$valeur</span>)); |
</span><span id="344" class="l"><a class="l" href="#344">344: </a> } |
</span><span id="345" class="l"><a class="l" href="#345">345: </a> } |
</span><span id="346" class="l"><a class="l" href="#346">346: </a> <span class="php-keyword1">return</span> <span class="php-var">$parametres</span>; |
</span><span id="347" class="l"><a class="l" href="#347">347: </a> } |
</span><span id="348" class="l"><a class="l" href="#348">348: </a> |
</span><span id="349" class="l"><a class="l" href="#349">349: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_recupererParametresBruts" href="#_recupererParametresBruts">recupererParametresBruts</a>() { |
</span><span id="350" class="l"><a class="l" href="#350">350: </a> <span class="php-var">$parametres_bruts</span> = <span class="php-keyword1">array</span>(); |
</span><span id="351" class="l"><a class="l" href="#351">351: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">empty</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'QUERY_STRING'</span>])) { |
</span><span id="352" class="l"><a class="l" href="#352">352: </a> <span class="php-var">$paires</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">'&'</span>, <span class="php-var">$_SERVER</span>[<span class="php-quote">'QUERY_STRING'</span>]); |
</span><span id="353" class="l"><a class="l" href="#353">353: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$paires</span> <span class="php-keyword1">as</span> <span class="php-var">$paire</span>) { |
</span><span id="354" class="l"><a class="l" href="#354">354: </a> <span class="php-var">$nv</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">'='</span>, <span class="php-var">$paire</span>); |
</span><span id="355" class="l"><a class="l" href="#355">355: </a> <span class="php-var">$nom</span> = <span class="php-keyword2">urldecode</span>(<span class="php-var">$nv</span>[<span class="php-num">0</span>]); |
</span><span id="356" class="l"><a class="l" href="#356">356: </a> <span class="php-var">$valeur</span> = <span class="php-keyword2">urldecode</span>(<span class="php-var">$nv</span>[<span class="php-num">1</span>]); |
</span><span id="357" class="l"><a class="l" href="#357">357: </a> <span class="php-var">$parametres_bruts</span>[<span class="php-var">$nom</span>] = <span class="php-var">$valeur</span>; |
</span><span id="358" class="l"><a class="l" href="#358">358: </a> } |
</span><span id="359" class="l"><a class="l" href="#359">359: </a> <span class="php-var">$parametres_bruts</span> = <span class="php-var">$this</span>->nettoyerParametres(<span class="php-var">$parametres_bruts</span>); |
</span><span id="360" class="l"><a class="l" href="#360">360: </a> } |
</span><span id="361" class="l"><a class="l" href="#361">361: </a> <span class="php-keyword1">return</span> <span class="php-var">$parametres_bruts</span>; |
</span><span id="362" class="l"><a class="l" href="#362">362: </a> } |
</span><span id="363" class="l"><a class="l" href="#363">363: </a> |
</span><span id="364" class="l"><a class="l" href="#364">364: </a> <span class="php-comment">/** |
</span></span><span id="365" class="l"><a class="l" href="#365">365: </a><span class="php-comment"> * La méthode __autoload() charge dynamiquement les classes trouvées dans le code. |
</span></span><span id="366" class="l"><a class="l" href="#366">366: </a><span class="php-comment"> * Cette fonction est appelée par php5 quand il trouve une instanciation de classe dans le code. |
</span></span><span id="367" class="l"><a class="l" href="#367">367: </a><span class="php-comment"> * |
</span></span><span id="368" class="l"><a class="l" href="#368">368: </a><span class="php-comment"> *@param string le nom de la classe appelée. |
</span></span><span id="369" class="l"><a class="l" href="#369">369: </a><span class="php-comment"> *@return void le fichier contenant la classe doit être inclu par la fonction. |
</span></span><span id="370" class="l"><a class="l" href="#370">370: </a><span class="php-comment"> */</span> |
</span><span id="371" class="l"><a class="l" href="#371">371: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_chargerClasse" href="#_chargerClasse">chargerClasse</a>(<span class="php-var">$classe</span>) { |
</span><span id="372" class="l"><a class="l" href="#372">372: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">class_exists</span>(<span class="php-var">$classe</span>)) { |
</span><span id="373" class="l"><a class="l" href="#373">373: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">null</span>; |
</span><span id="374" class="l"><a class="l" href="#374">374: </a> } |
</span><span id="375" class="l"><a class="l" href="#375">375: </a> <span class="php-var">$chemins</span> = <span class="php-keyword1">array</span>(<span class="php-quote">''</span>, self::<span class="php-var">$config</span>[<span class="php-quote">'chemins'</span>][<span class="php-quote">'api'</span>], self::<span class="php-var">$config</span>[<span class="php-quote">'chemins'</span>][<span class="php-quote">'api_bibliotheque'</span>]); |
</span><span id="376" class="l"><a class="l" href="#376">376: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$chemins</span> <span class="php-keyword1">as</span> <span class="php-var">$chemin</span>) { |
</span><span id="377" class="l"><a class="l" href="#377">377: </a> <span class="php-var">$chemin</span> = <span class="php-var">$chemin</span>.<span class="php-var">$classe</span>.<span class="php-quote">'.php'</span>; |
</span><span id="378" class="l"><a class="l" href="#378">378: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">file_exists</span>(<span class="php-var">$chemin</span>)) { |
</span><span id="379" class="l"><a class="l" href="#379">379: </a> <span class="php-keyword1">require_once</span> <span class="php-var">$chemin</span>; |
</span><span id="380" class="l"><a class="l" href="#380">380: </a> } |
</span><span id="381" class="l"><a class="l" href="#381">381: </a> } |
</span><span id="382" class="l"><a class="l" href="#382">382: </a> } |
</span><span id="383" class="l"><a class="l" href="#383">383: </a> |
</span><span id="384" class="l"><a class="l" href="#384">384: </a> <span class="php-comment">/** |
</span></span><span id="385" class="l"><a class="l" href="#385">385: </a><span class="php-comment"> * Execute la requête. |
</span></span><span id="386" class="l"><a class="l" href="#386">386: </a><span class="php-comment"> */</span> |
</span><span id="387" class="l"><a class="l" href="#387">387: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_executer" href="#_executer">executer</a>() { |
</span><span id="388" class="l"><a class="l" href="#388">388: </a> <span class="php-var">$retour</span> = <span class="php-quote">''</span>; |
</span><span id="389" class="l"><a class="l" href="#389">389: </a> <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>->methode) { |
</span><span id="390" class="l"><a class="l" href="#390">390: </a> <span class="php-keyword1">case</span> <span class="php-quote">'GET'</span>: |
</span><span id="391" class="l"><a class="l" href="#391">391: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->get(); |
</span><span id="392" class="l"><a class="l" href="#392">392: </a> <span class="php-keyword1">break</span>; |
</span><span id="393" class="l"><a class="l" href="#393">393: </a> <span class="php-keyword1">case</span> <span class="php-quote">'POST'</span>: |
</span><span id="394" class="l"><a class="l" href="#394">394: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->post();<span class="php-comment">// Retour pour l'alternative PUT</span> |
</span><span id="395" class="l"><a class="l" href="#395">395: </a> <span class="php-keyword1">break</span>; |
</span><span id="396" class="l"><a class="l" href="#396">396: </a> <span class="php-keyword1">case</span> <span class="php-quote">'DELETE'</span>: |
</span><span id="397" class="l"><a class="l" href="#397">397: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>-><span class="php-keyword2">delete</span>(); |
</span><span id="398" class="l"><a class="l" href="#398">398: </a> <span class="php-keyword1">break</span>; |
</span><span id="399" class="l"><a class="l" href="#399">399: </a> <span class="php-keyword1">case</span> <span class="php-quote">'PUT'</span>: |
</span><span id="400" class="l"><a class="l" href="#400">400: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->put(); |
</span><span id="401" class="l"><a class="l" href="#401">401: </a> <span class="php-keyword1">break</span>; |
</span><span id="402" class="l"><a class="l" href="#402">402: </a> <span class="php-comment">// Autorise l'accès depuis des serveurs tiers</span> |
</span><span id="403" class="l"><a class="l" href="#403">403: </a> <span class="php-keyword1">case</span> <span class="php-quote">'OPTIONS'</span>: |
</span><span id="404" class="l"><a class="l" href="#404">404: </a> <span class="php-comment">/*header('Access-Control-Allow-Origin: *'); |
</span></span><span id="405" class="l"><a class="l" href="#405">405: </a><span class="php-comment"> header('Access-Control-Allow-Headers:origin, content-type'); |
</span></span><span id="406" class="l"><a class="l" href="#406">406: </a><span class="php-comment"> header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS'); |
</span></span><span id="407" class="l"><a class="l" href="#407">407: </a><span class="php-comment"> header('Access-Control-Allow-Content-Type: application/json'); |
</span></span><span id="408" class="l"><a class="l" href="#408">408: </a><span class="php-comment"> header('Access-Control-Max-Age: 3628800'); |
</span></span><span id="409" class="l"><a class="l" href="#409">409: </a><span class="php-comment"> header('Access-Control-Allow-Credentials: false');*/</span> |
</span><span id="410" class="l"><a class="l" href="#410">410: </a> <span class="php-keyword1">break</span>; |
</span><span id="411" class="l"><a class="l" href="#411">411: </a> <span class="php-keyword1">default</span> : |
</span><span id="412" class="l"><a class="l" href="#412">412: </a> self::envoyerEnteteStatutHttp(self::HTTP_CODE_METHODE_NON_AUTORISE); |
</span><span id="413" class="l"><a class="l" href="#413">413: </a> <span class="php-keyword2">header</span>(<span class="php-quote">'Allow: GET, POST, DELETE, PUT'</span>); |
</span><span id="414" class="l"><a class="l" href="#414">414: </a> <span class="php-var">$e</span> = <span class="php-quote">"La méthode HTTP '</span><span class="php-var">{$this->methode}</span><span class="php-quote">' n'est pas prise en compte par ce serveur REST.\n"</span>. |
</span><span id="415" class="l"><a class="l" href="#415">415: </a> <span class="php-quote">"Consulter l'entête Allow pour connaître les méthodes autorisées."</span>; |
</span><span id="416" class="l"><a class="l" href="#416">416: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="417" class="l"><a class="l" href="#417">417: </a> } |
</span><span id="418" class="l"><a class="l" href="#418">418: </a> <span class="php-var">$this</span>->cloreAccesServeur(<span class="php-var">$retour</span>); |
</span><span id="419" class="l"><a class="l" href="#419">419: </a> } |
</span><span id="420" class="l"><a class="l" href="#420">420: </a> |
</span><span id="421" class="l"><a class="l" href="#421">421: </a> <span class="php-comment">/** |
</span></span><span id="422" class="l"><a class="l" href="#422">422: </a><span class="php-comment"> * Execute a GET request. A GET request fetches a list of resource when no resource name is given, a list of element |
</span></span><span id="423" class="l"><a class="l" href="#423">423: </a><span class="php-comment"> * when a resource name is given, or a resource element when a resource and resource unique identifier are given. It does not change the |
</span></span><span id="424" class="l"><a class="l" href="#424">424: </a><span class="php-comment"> * database contents. |
</span></span><span id="425" class="l"><a class="l" href="#425">425: </a><span class="php-comment"> */</span> |
</span><span id="426" class="l"><a class="l" href="#426">426: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_get" href="#_get">get</a>() { |
</span><span id="427" class="l"><a class="l" href="#427">427: </a> <span class="php-var">$retour</span> = <span class="php-quote">''</span>; |
</span><span id="428" class="l"><a class="l" href="#428">428: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->service != <span class="php-keyword1">null</span>) { |
</span><span id="429" class="l"><a class="l" href="#429">429: </a> <span class="php-var">$Service</span> = <span class="php-keyword1">new</span> <span class="php-var">$this</span>->service(self::<span class="php-var">$config</span>); |
</span><span id="430" class="l"><a class="l" href="#430">430: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">method_exists</span>(<span class="php-var">$Service</span>, self::METHODE_GET)) { |
</span><span id="431" class="l"><a class="l" href="#431">431: </a> <span class="php-var">$methodeGet</span> = self::METHODE_GET; |
</span><span id="432" class="l"><a class="l" href="#432">432: </a> <span class="php-var">$parametres</span> = <span class="php-var">$Service</span>->utiliserParametresBruts() ? <span class="php-var">$this</span>->parametresBruts : <span class="php-var">$this</span>->parametres; |
</span><span id="433" class="l"><a class="l" href="#433">433: </a> <span class="php-var">$retour</span> = <span class="php-var">$Service</span>-><span class="php-var">$methodeGet</span>(<span class="php-var">$this</span>->ressources, <span class="php-var">$parametres</span>); |
</span><span id="434" class="l"><a class="l" href="#434">434: </a> } <span class="php-keyword1">else</span> { |
</span><span id="435" class="l"><a class="l" href="#435">435: </a> self::envoyerEnteteStatutHttp(self::HTTP_CODE_RESSOURCE_INTROUVABLE); |
</span><span id="436" class="l"><a class="l" href="#436">436: </a> <span class="php-var">$e</span> = <span class="php-quote">"Le service '</span><span class="php-var">{$this->service}</span><span class="php-quote">' ne contient pas la méthode '"</span>.self::METHODE_GET.<span class="php-quote">"' nécessaire "</span>. |
</span><span id="437" class="l"><a class="l" href="#437">437: </a> <span class="php-quote">"lors de l'appel du service via la méthode HTTP GET."</span>; |
</span><span id="438" class="l"><a class="l" href="#438">438: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="439" class="l"><a class="l" href="#439">439: </a> } |
</span><span id="440" class="l"><a class="l" href="#440">440: </a> } |
</span><span id="441" class="l"><a class="l" href="#441">441: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="442" class="l"><a class="l" href="#442">442: </a> } |
</span><span id="443" class="l"><a class="l" href="#443">443: </a> |
</span><span id="444" class="l"><a class="l" href="#444">444: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_post" href="#_post">post</a>() { |
</span><span id="445" class="l"><a class="l" href="#445">445: </a> <span class="php-var">$retour</span> = <span class="php-quote">''</span>; |
</span><span id="446" class="l"><a class="l" href="#446">446: </a> <span class="php-var">$paires</span> = <span class="php-var">$this</span>->parserDonneesRequete(); |
</span><span id="447" class="l"><a class="l" href="#447">447: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$paires</span>) != <span class="php-num">0</span>) { |
</span><span id="448" class="l"><a class="l" href="#448">448: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$paires</span>[<span class="php-quote">'action'</span>]) && <span class="php-var">$paires</span>[<span class="php-quote">'action'</span>] == <span class="php-quote">'DELETE'</span>) {<span class="php-comment">// Alternative à l'utilisation de DELETE</span> |
</span><span id="449" class="l"><a class="l" href="#449">449: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>-><span class="php-keyword2">delete</span>(); |
</span><span id="450" class="l"><a class="l" href="#450">450: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>->ressources) == <span class="php-num">0</span>) {<span class="php-comment">// Alternative à l'utilisation de PUT</span> |
</span><span id="451" class="l"><a class="l" href="#451">451: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->put(); |
</span><span id="452" class="l"><a class="l" href="#452">452: </a> } <span class="php-keyword1">else</span> { |
</span><span id="453" class="l"><a class="l" href="#453">453: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->service != <span class="php-keyword1">null</span>) { |
</span><span id="454" class="l"><a class="l" href="#454">454: </a> <span class="php-var">$Service</span> = <span class="php-keyword1">new</span> <span class="php-var">$this</span>->service(self::<span class="php-var">$config</span>); |
</span><span id="455" class="l"><a class="l" href="#455">455: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">method_exists</span>(<span class="php-var">$Service</span>, self::METHODE_POST)) { |
</span><span id="456" class="l"><a class="l" href="#456">456: </a> <span class="php-var">$methodePost</span> = self::METHODE_POST; |
</span><span id="457" class="l"><a class="l" href="#457">457: </a> <span class="php-var">$info</span> = <span class="php-var">$Service</span>-><span class="php-var">$methodePost</span>(<span class="php-var">$this</span>->ressources, <span class="php-var">$paires</span>); |
</span><span id="458" class="l"><a class="l" href="#458">458: </a> <span class="php-keyword1">if</span> (<span class="php-var">$info</span> !== <span class="php-keyword1">false</span>) { |
</span><span id="459" class="l"><a class="l" href="#459">459: </a> <span class="php-var">$this</span>->envoyerEnteteStatutHttp(self::HTTP_CODE_CREATION_OK); |
</span><span id="460" class="l"><a class="l" href="#460">460: </a> <span class="php-var">$retour</span> = <span class="php-var">$info</span>; |
</span><span id="461" class="l"><a class="l" href="#461">461: </a> } |
</span><span id="462" class="l"><a class="l" href="#462">462: </a> } <span class="php-keyword1">else</span> { |
</span><span id="463" class="l"><a class="l" href="#463">463: </a> self::envoyerEnteteStatutHttp(self::HTTP_CODE_RESSOURCE_INTROUVABLE); |
</span><span id="464" class="l"><a class="l" href="#464">464: </a> <span class="php-var">$e</span> = <span class="php-quote">"Le service '</span><span class="php-var">{$this->service}</span><span class="php-quote">' ne contient pas la méthode '"</span>.self::METHODE_POST.<span class="php-quote">"' nécessaire "</span>. |
</span><span id="465" class="l"><a class="l" href="#465">465: </a> <span class="php-quote">"lors de l'appel du service via la méthode HTTP GET."</span>; |
</span><span id="466" class="l"><a class="l" href="#466">466: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="467" class="l"><a class="l" href="#467">467: </a> } |
</span><span id="468" class="l"><a class="l" href="#468">468: </a> } |
</span><span id="469" class="l"><a class="l" href="#469">469: </a> } |
</span><span id="470" class="l"><a class="l" href="#470">470: </a> } <span class="php-keyword1">else</span> { |
</span><span id="471" class="l"><a class="l" href="#471">471: </a> <span class="php-var">$this</span>->envoyerEnteteStatutHttp(self::HTTP_CODE_CONTENU_REQUIS); |
</span><span id="472" class="l"><a class="l" href="#472">472: </a> <span class="php-var">$e</span> = <span class="php-quote">"Le service '</span><span class="php-var">{$this->service}</span><span class="php-quote">' requiert de fournir le contenu à modifier dans le corps "</span>. |
</span><span id="473" class="l"><a class="l" href="#473">473: </a> <span class="php-quote">"de la requête avec la méthode HTTP POST."</span>; |
</span><span id="474" class="l"><a class="l" href="#474">474: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="475" class="l"><a class="l" href="#475">475: </a> } |
</span><span id="476" class="l"><a class="l" href="#476">476: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="477" class="l"><a class="l" href="#477">477: </a> } |
</span><span id="478" class="l"><a class="l" href="#478">478: </a> |
</span><span id="479" class="l"><a class="l" href="#479">479: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_put" href="#_put">put</a>() { |
</span><span id="480" class="l"><a class="l" href="#480">480: </a> <span class="php-var">$retour</span> = <span class="php-quote">''</span>; |
</span><span id="481" class="l"><a class="l" href="#481">481: </a> <span class="php-var">$paires</span> = <span class="php-var">$this</span>->parserDonneesRequete(); |
</span><span id="482" class="l"><a class="l" href="#482">482: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$paires</span>) != <span class="php-num">0</span>) { |
</span><span id="483" class="l"><a class="l" href="#483">483: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->service != <span class="php-keyword1">null</span>) { |
</span><span id="484" class="l"><a class="l" href="#484">484: </a> <span class="php-var">$Service</span> = <span class="php-keyword1">new</span> <span class="php-var">$this</span>->service(self::<span class="php-var">$config</span>); |
</span><span id="485" class="l"><a class="l" href="#485">485: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">method_exists</span>(<span class="php-var">$Service</span>, self::METHODE_PUT)) { |
</span><span id="486" class="l"><a class="l" href="#486">486: </a> <span class="php-var">$methodePut</span> = self::METHODE_PUT; |
</span><span id="487" class="l"><a class="l" href="#487">487: </a> <span class="php-var">$info</span> = <span class="php-var">$Service</span>-><span class="php-var">$methodePut</span>(<span class="php-var">$this</span>->ressources, <span class="php-var">$paires</span>); |
</span><span id="488" class="l"><a class="l" href="#488">488: </a> <span class="php-keyword1">if</span> (<span class="php-var">$info</span> !== <span class="php-keyword1">false</span>) { |
</span><span id="489" class="l"><a class="l" href="#489">489: </a> <span class="php-var">$this</span>->envoyerEnteteStatutHttp(self::HTTP_CODE_CREATION_OK); |
</span><span id="490" class="l"><a class="l" href="#490">490: </a> <span class="php-var">$retour</span> = <span class="php-var">$info</span>; |
</span><span id="491" class="l"><a class="l" href="#491">491: </a> } |
</span><span id="492" class="l"><a class="l" href="#492">492: </a> } <span class="php-keyword1">else</span> { |
</span><span id="493" class="l"><a class="l" href="#493">493: </a> self::envoyerEnteteStatutHttp(self::HTTP_CODE_RESSOURCE_INTROUVABLE); |
</span><span id="494" class="l"><a class="l" href="#494">494: </a> <span class="php-var">$e</span> = <span class="php-quote">"Le service '</span><span class="php-var">{$this->service}</span><span class="php-quote">' ne contient pas la méthode '"</span>.self::METHODE_PUT.<span class="php-quote">"' nécessaire "</span>. |
</span><span id="495" class="l"><a class="l" href="#495">495: </a> <span class="php-quote">"lors de l'appel du service via la méthode HTTP GET."</span>; |
</span><span id="496" class="l"><a class="l" href="#496">496: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="497" class="l"><a class="l" href="#497">497: </a> } |
</span><span id="498" class="l"><a class="l" href="#498">498: </a> } |
</span><span id="499" class="l"><a class="l" href="#499">499: </a> } <span class="php-keyword1">else</span> { |
</span><span id="500" class="l"><a class="l" href="#500">500: </a> <span class="php-var">$this</span>->envoyerEnteteStatutHttp(self::HTTP_CODE_CONTENU_REQUIS); |
</span><span id="501" class="l"><a class="l" href="#501">501: </a> <span class="php-var">$e</span> = <span class="php-quote">"Il est nécessaire de fournir du contenu dans le corps de la requête pour créer une nouvelle ressource."</span>; |
</span><span id="502" class="l"><a class="l" href="#502">502: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="503" class="l"><a class="l" href="#503">503: </a> } |
</span><span id="504" class="l"><a class="l" href="#504">504: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="505" class="l"><a class="l" href="#505">505: </a> } |
</span><span id="506" class="l"><a class="l" href="#506">506: </a> |
</span><span id="507" class="l"><a class="l" href="#507">507: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <span class="php-keyword2">delete</span>() { |
</span><span id="508" class="l"><a class="l" href="#508">508: </a> <span class="php-var">$retour</span> = <span class="php-quote">''</span>; |
</span><span id="509" class="l"><a class="l" href="#509">509: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>->ressources) != <span class="php-num">0</span>) { |
</span><span id="510" class="l"><a class="l" href="#510">510: </a> <span class="php-var">$paires</span> = <span class="php-var">$this</span>->parserDonneesRequete(); |
</span><span id="511" class="l"><a class="l" href="#511">511: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->service != <span class="php-keyword1">null</span>) { |
</span><span id="512" class="l"><a class="l" href="#512">512: </a> <span class="php-var">$Service</span> = <span class="php-keyword1">new</span> <span class="php-var">$this</span>->service(self::<span class="php-var">$config</span>); |
</span><span id="513" class="l"><a class="l" href="#513">513: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">method_exists</span>(<span class="php-var">$Service</span>, self::METHODE_DELETE)) { |
</span><span id="514" class="l"><a class="l" href="#514">514: </a> <span class="php-var">$methodeDelete</span> = self::METHODE_DELETE; |
</span><span id="515" class="l"><a class="l" href="#515">515: </a> <span class="php-var">$info</span> = <span class="php-var">$Service</span>-><span class="php-var">$methodeDelete</span>(<span class="php-var">$this</span>->ressources, <span class="php-var">$paires</span>); |
</span><span id="516" class="l"><a class="l" href="#516">516: </a> <span class="php-keyword1">if</span> (<span class="php-var">$info</span> === <span class="php-keyword1">true</span>) { |
</span><span id="517" class="l"><a class="l" href="#517">517: </a> <span class="php-var">$this</span>->envoyerEnteteStatutHttp(self::HTTP_CODE_SUPPRESSION_OK); |
</span><span id="518" class="l"><a class="l" href="#518">518: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-var">$info</span> === <span class="php-keyword1">false</span>) { |
</span><span id="519" class="l"><a class="l" href="#519">519: </a> <span class="php-var">$this</span>->envoyerEnteteStatutHttp(self::HTTP_CODE_RESSOURCE_INTROUVABLE); |
</span><span id="520" class="l"><a class="l" href="#520">520: </a> <span class="php-var">$e</span> = <span class="php-quote">"La ressource à supprimer est introuvable. Il se peut qu'elle ait été préalablement supprimé."</span>; |
</span><span id="521" class="l"><a class="l" href="#521">521: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="522" class="l"><a class="l" href="#522">522: </a> } <span class="php-keyword1">else</span> { |
</span><span id="523" class="l"><a class="l" href="#523">523: </a> <span class="php-var">$this</span>->envoyerEnteteStatutHttp(self::HTTP_CODE_OK); |
</span><span id="524" class="l"><a class="l" href="#524">524: </a> <span class="php-var">$retour</span> = <span class="php-var">$info</span>; |
</span><span id="525" class="l"><a class="l" href="#525">525: </a> } |
</span><span id="526" class="l"><a class="l" href="#526">526: </a> } <span class="php-keyword1">else</span> { |
</span><span id="527" class="l"><a class="l" href="#527">527: </a> self::envoyerEnteteStatutHttp(self::HTTP_CODE_RESSOURCE_INTROUVABLE); |
</span><span id="528" class="l"><a class="l" href="#528">528: </a> <span class="php-var">$e</span> = <span class="php-quote">"Le service '</span><span class="php-var">{$this->service}</span><span class="php-quote">' ne contient pas la méthode '"</span>.self::METHODE_DELETE.<span class="php-quote">"' nécessaire "</span>. |
</span><span id="529" class="l"><a class="l" href="#529">529: </a> <span class="php-quote">"lors de l'appel du service via la méthode HTTP GET."</span>; |
</span><span id="530" class="l"><a class="l" href="#530">530: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="531" class="l"><a class="l" href="#531">531: </a> } |
</span><span id="532" class="l"><a class="l" href="#532">532: </a> } |
</span><span id="533" class="l"><a class="l" href="#533">533: </a> } <span class="php-keyword1">else</span> { |
</span><span id="534" class="l"><a class="l" href="#534">534: </a> <span class="php-var">$this</span>->envoyerEnteteStatutHttp(self::HTTP_CODE_MAUVAISE_REQUETE); |
</span><span id="535" class="l"><a class="l" href="#535">535: </a> <span class="php-var">$e</span> = <span class="php-quote">"Il est nécessaire d'indiquer dans l'url la ressource à supprimer."</span>; |
</span><span id="536" class="l"><a class="l" href="#536">536: </a> self::ajouterMessage(<span class="php-var">$e</span>); |
</span><span id="537" class="l"><a class="l" href="#537">537: </a> } |
</span><span id="538" class="l"><a class="l" href="#538">538: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="539" class="l"><a class="l" href="#539">539: </a> } |
</span><span id="540" class="l"><a class="l" href="#540">540: </a> |
</span><span id="541" class="l"><a class="l" href="#541">541: </a> <span class="php-comment">/** |
</span></span><span id="542" class="l"><a class="l" href="#542">542: </a><span class="php-comment"> * Parse les données contenu dans le corps de la requête HTTP (= POST) en : |
</span></span><span id="543" class="l"><a class="l" href="#543">543: </a><span class="php-comment"> * - décodant les clés et valeurs. |
</span></span><span id="544" class="l"><a class="l" href="#544">544: </a><span class="php-comment"> * - supprimant les espaces en début et fin des clés et des valeurs. |
</span></span><span id="545" class="l"><a class="l" href="#545">545: </a><span class="php-comment"> * |
</span></span><span id="546" class="l"><a class="l" href="#546">546: </a><span class="php-comment"> * @return array Tableau de paires clé et valeur. |
</span></span><span id="547" class="l"><a class="l" href="#547">547: </a><span class="php-comment"> */</span> |
</span><span id="548" class="l"><a class="l" href="#548">548: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_parserDonneesRequete" href="#_parserDonneesRequete">parserDonneesRequete</a>() { |
</span><span id="549" class="l"><a class="l" href="#549">549: </a> <span class="php-var">$donnees</span> = <span class="php-keyword1">array</span>(); |
</span><span id="550" class="l"><a class="l" href="#550">550: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->requeteDonneesParsees != <span class="php-keyword1">null</span>) { |
</span><span id="551" class="l"><a class="l" href="#551">551: </a> <span class="php-var">$donnees</span> = <span class="php-var">$this</span>->requeteDonneesParsees; |
</span><span id="552" class="l"><a class="l" href="#552">552: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->requeteDonnees != <span class="php-keyword1">null</span>) { |
</span><span id="553" class="l"><a class="l" href="#553">553: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">preg_match</span>(<span class="php-quote">'/application\/json/'</span>, <span class="php-var">$_SERVER</span>[<span class="php-quote">'CONTENT_TYPE'</span>])) { |
</span><span id="554" class="l"><a class="l" href="#554">554: </a> <span class="php-var">$donnees</span> = <span class="php-keyword2">json_decode</span>(<span class="php-var">$this</span>->requeteDonnees, <span class="php-keyword1">true</span>); |
</span><span id="555" class="l"><a class="l" href="#555">555: </a> } <span class="php-keyword1">else</span> { |
</span><span id="556" class="l"><a class="l" href="#556">556: </a> <span class="php-var">$paires</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">'&'</span>, <span class="php-var">$this</span>->requeteDonnees); |
</span><span id="557" class="l"><a class="l" href="#557">557: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$paires</span> <span class="php-keyword1">as</span> <span class="php-var">$paire</span>) { |
</span><span id="558" class="l"><a class="l" href="#558">558: </a> <span class="php-keyword1">list</span>(<span class="php-var">$cle</span>, <span class="php-var">$valeur</span>) = <span class="php-keyword2">explode</span>(<span class="php-quote">'='</span>, <span class="php-var">$paire</span>); |
</span><span id="559" class="l"><a class="l" href="#559">559: </a> <span class="php-var">$cle</span> = (<span class="php-keyword1">isset</span>(<span class="php-var">$cle</span>)) ? <span class="php-keyword2">trim</span>(<span class="php-keyword2">urldecode</span>(<span class="php-var">$cle</span>)) : <span class="php-quote">''</span>; |
</span><span id="560" class="l"><a class="l" href="#560">560: </a> <span class="php-var">$valeur</span> = (<span class="php-keyword1">isset</span>(<span class="php-var">$valeur</span>)) ? <span class="php-keyword2">trim</span>(<span class="php-keyword2">urldecode</span>(<span class="php-var">$valeur</span>)) : <span class="php-quote">''</span>; |
</span><span id="561" class="l"><a class="l" href="#561">561: </a> <span class="php-var">$donnees</span>[<span class="php-var">$cle</span>] = <span class="php-var">$valeur</span>; |
</span><span id="562" class="l"><a class="l" href="#562">562: </a> } |
</span><span id="563" class="l"><a class="l" href="#563">563: </a> } |
</span><span id="564" class="l"><a class="l" href="#564">564: </a> <span class="php-var">$this</span>->requeteDonneesParsees = <span class="php-var">$donnees</span>; |
</span><span id="565" class="l"><a class="l" href="#565">565: </a> } |
</span><span id="566" class="l"><a class="l" href="#566">566: </a> <span class="php-keyword1">return</span> <span class="php-var">$donnees</span>; |
</span><span id="567" class="l"><a class="l" href="#567">567: </a> } |
</span><span id="568" class="l"><a class="l" href="#568">568: </a> |
</span><span id="569" class="l"><a class="l" href="#569">569: </a> <span class="php-comment">/** |
</span></span><span id="570" class="l"><a class="l" href="#570">570: </a><span class="php-comment"> * Envoyer un entête HTTP (version 1.0) de statut. |
</span></span><span id="571" class="l"><a class="l" href="#571">571: </a><span class="php-comment"> * Il remplacera systématiquement tout entête HTTP de statut précédement envoyé. |
</span></span><span id="572" class="l"><a class="l" href="#572">572: </a><span class="php-comment"> * @param int $code entier indiquant le code du statut de l'entête HTTP à envoyer. |
</span></span><span id="573" class="l"><a class="l" href="#573">573: </a><span class="php-comment"> */</span> |
</span><span id="574" class="l"><a class="l" href="#574">574: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_envoyerEnteteStatutHttp" href="#_envoyerEnteteStatutHttp">envoyerEnteteStatutHttp</a>(<span class="php-var">$code</span>) { |
</span><span id="575" class="l"><a class="l" href="#575">575: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(self::<span class="php-var">$http10</span>[<span class="php-var">$code</span>])) { |
</span><span id="576" class="l"><a class="l" href="#576">576: </a> <span class="php-var">$txt</span> = self::<span class="php-var">$http10</span>[<span class="php-var">$code</span>]; |
</span><span id="577" class="l"><a class="l" href="#577">577: </a> <span class="php-keyword2">header</span>(<span class="php-quote">"HTTP/1.0 </span><span class="php-var">$code</span><span class="php-quote"> </span><span class="php-var">$txt</span><span class="php-quote">"</span>, <span class="php-keyword1">true</span>); |
</span><span id="578" class="l"><a class="l" href="#578">578: </a> } |
</span><span id="579" class="l"><a class="l" href="#579">579: </a> } |
</span><span id="580" class="l"><a class="l" href="#580">580: </a> |
</span><span id="581" class="l"><a class="l" href="#581">581: </a> <span class="php-comment">/** |
</span></span><span id="582" class="l"><a class="l" href="#582">582: </a><span class="php-comment"> * Termine l'accès au serveur après envoir envoyer les messages. |
</span></span><span id="583" class="l"><a class="l" href="#583">583: </a><span class="php-comment"> */</span> |
</span><span id="584" class="l"><a class="l" href="#584">584: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_cloreAccesServeur" href="#_cloreAccesServeur">cloreAccesServeur</a>(<span class="php-var">$retour</span> = <span class="php-quote">''</span>) { |
</span><span id="585" class="l"><a class="l" href="#585">585: </a> <span class="php-comment">// Gestion des exceptions et erreurs générées par les services</span> |
</span><span id="586" class="l"><a class="l" href="#586">586: </a> <span class="php-var">$retour</span> .= self::gererErreurs(); |
</span><span id="587" class="l"><a class="l" href="#587">587: </a> |
</span><span id="588" class="l"><a class="l" href="#588">588: </a> <span class="php-comment">// Envoie des messages d'erreur et d'avertissement du serveur</span> |
</span><span id="589" class="l"><a class="l" href="#589">589: </a> <span class="php-var">$retour</span> .= self::envoyerMessages(); |
</span><span id="590" class="l"><a class="l" href="#590">590: </a> |
</span><span id="591" class="l"><a class="l" href="#591">591: </a> <span class="php-comment">// Autorise l'accès depuis des serveurs tiers</span> |
</span><span id="592" class="l"><a class="l" href="#592">592: </a> <span class="php-comment">//header('Access-Control-Allow-Origin: *');</span> |
</span><span id="593" class="l"><a class="l" href="#593">593: </a> |
</span><span id="594" class="l"><a class="l" href="#594">594: </a> <span class="php-comment">// Envoie sur la sortie standard le contenu de la réponse HTTP</span> |
</span><span id="595" class="l"><a class="l" href="#595">595: </a> <span class="php-keyword1">print</span> <span class="php-var">$retour</span>; |
</span><span id="596" class="l"><a class="l" href="#596">596: </a> |
</span><span id="597" class="l"><a class="l" href="#597">597: </a> <span class="php-comment">// Nous terminons le script</span> |
</span><span id="598" class="l"><a class="l" href="#598">598: </a> <span class="php-keyword1">exit</span>(<span class="php-num">0</span>); |
</span><span id="599" class="l"><a class="l" href="#599">599: </a> } |
</span><span id="600" class="l"><a class="l" href="#600">600: </a> |
</span><span id="601" class="l"><a class="l" href="#601">601: </a> <span class="php-comment">/** |
</span></span><span id="602" class="l"><a class="l" href="#602">602: </a><span class="php-comment"> * Si des exceptions ou des erreurs sont soulevées par le serveur ou les services, elles sont gérées par cette méthode. |
</span></span><span id="603" class="l"><a class="l" href="#603">603: </a><span class="php-comment"> * Si nous avec des erreurs d'un type différent d'E_USER_NOTICE (réservé au débogage), elle sont renvoyées sur la sortie |
</span></span><span id="604" class="l"><a class="l" href="#604">604: </a><span class="php-comment"> * standard (via echo). |
</span></span><span id="605" class="l"><a class="l" href="#605">605: </a><span class="php-comment"> * Si seulement des erreurs de type E_USER_NOTICE, sont présentes, elle sont envoyées en fonction du contenu du paramètre de |
</span></span><span id="606" class="l"><a class="l" href="#606">606: </a><span class="php-comment"> * config "debogage_mode" : |
</span></span><span id="607" class="l"><a class="l" href="#607">607: </a><span class="php-comment"> * - Debug::MODE_ECHO : les messages sont affichés en utilisant echo au moment où ils sont déclenchés dans le code. |
</span></span><span id="608" class="l"><a class="l" href="#608">608: </a><span class="php-comment"> * - Debug::MODE_NOTICE : les message sont stockés par le gestionnaire d'exception sous forme d'erreur de type |
</span></span><span id="609" class="l"><a class="l" href="#609">609: </a><span class="php-comment"> * E_USER_NOTICE et sont renvoyés sur la sortie standard à la fin de l'execution du programme (via echo). |
</span></span><span id="610" class="l"><a class="l" href="#610">610: </a><span class="php-comment"> * - Debug::MODE_ENTETE_HTTP : les message sont stockés par le gestionnaire d'exception sous forme d'erreur de type |
</span></span><span id="611" class="l"><a class="l" href="#611">611: </a><span class="php-comment"> * E_USER_NOTICE et sont renvoyés dans un entête HTTP (X_REST_DEBOGAGE_MESSAGES) à la fin de l'execution du programme. |
</span></span><span id="612" class="l"><a class="l" href="#612">612: </a><span class="php-comment"> * - Autre valeur : les messages sont formatés puis retournés par la fonction de débogage (à vous de les afficher). |
</span></span><span id="613" class="l"><a class="l" href="#613">613: </a><span class="php-comment"> */</span> |
</span><span id="614" class="l"><a class="l" href="#614">614: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_gererErreurs" href="#_gererErreurs">gererErreurs</a>() { |
</span><span id="615" class="l"><a class="l" href="#615">615: </a> <span class="php-var">$retour</span> = <span class="php-quote">''</span>; |
</span><span id="616" class="l"><a class="l" href="#616">616: </a> <span class="php-keyword1">if</span> (self::<span class="php-var">$debogageActivation</span> && GestionnaireException::getExceptionsNbre() > <span class="php-num">0</span>) { |
</span><span id="617" class="l"><a class="l" href="#617">617: </a> |
</span><span id="618" class="l"><a class="l" href="#618">618: </a> <span class="php-var">$exceptionsTriees</span> = GestionnaireException::getExceptionsTriees(); |
</span><span id="619" class="l"><a class="l" href="#619">619: </a> <span class="php-keyword2">reset</span>(<span class="php-var">$exceptionsTriees</span>); |
</span><span id="620" class="l"><a class="l" href="#620">620: </a> <span class="php-var">$debogageSeulement</span> = <span class="php-keyword1">true</span>; |
</span><span id="621" class="l"><a class="l" href="#621">621: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">array_key_exists</span>(E_USER_ERROR, <span class="php-var">$exceptionsTriees</span>)) { |
</span><span id="622" class="l"><a class="l" href="#622">622: </a> self::envoyerEnteteStatutHttp(self::HTTP_CODE_ERREUR); |
</span><span id="623" class="l"><a class="l" href="#623">623: </a> <span class="php-var">$debogageSeulement</span> = <span class="php-keyword1">false</span>; |
</span><span id="624" class="l"><a class="l" href="#624">624: </a> } |
</span><span id="625" class="l"><a class="l" href="#625">625: </a> |
</span><span id="626" class="l"><a class="l" href="#626">626: </a> <span class="php-var">$exceptionsFormatees</span> = <span class="php-keyword1">array</span>(); |
</span><span id="627" class="l"><a class="l" href="#627">627: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$exceptionsTriees</span> <span class="php-keyword1">as</span> <span class="php-var">$exceptions</span>) { |
</span><span id="628" class="l"><a class="l" href="#628">628: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$exceptions</span> <span class="php-keyword1">as</span> <span class="php-var">$e</span>) { |
</span><span id="629" class="l"><a class="l" href="#629">629: </a> <span class="php-keyword1">if</span> (<span class="php-var">$debogageSeulement</span> && self::<span class="php-var">$debogageMode</span> == Debug::MODE_ENTETE_HTTP) { |
</span><span id="630" class="l"><a class="l" href="#630">630: </a> <span class="php-var">$exceptionsFormatees</span>[] = GestionnaireException::formaterExceptionDebug(<span class="php-var">$e</span>); |
</span><span id="631" class="l"><a class="l" href="#631">631: </a> } <span class="php-keyword1">else</span> { |
</span><span id="632" class="l"><a class="l" href="#632">632: </a> <span class="php-var">$retour</span> = GestionnaireException::formaterExceptionXhtml(<span class="php-var">$e</span>); |
</span><span id="633" class="l"><a class="l" href="#633">633: </a> } |
</span><span id="634" class="l"><a class="l" href="#634">634: </a> } |
</span><span id="635" class="l"><a class="l" href="#635">635: </a> } |
</span><span id="636" class="l"><a class="l" href="#636">636: </a> |
</span><span id="637" class="l"><a class="l" href="#637">637: </a> <span class="php-keyword1">if</span> (<span class="php-var">$debogageSeulement</span> && self::<span class="php-var">$debogageMode</span> == Debug::MODE_ENTETE_HTTP) { |
</span><span id="638" class="l"><a class="l" href="#638">638: </a> <span class="php-keyword2">header</span>(<span class="php-quote">'X_REST_DEBOGAGE_MESSAGES: '</span>.<span class="php-keyword2">json_encode</span>(<span class="php-var">$exceptionsFormatees</span>)); |
</span><span id="639" class="l"><a class="l" href="#639">639: </a> } |
</span><span id="640" class="l"><a class="l" href="#640">640: </a> } |
</span><span id="641" class="l"><a class="l" href="#641">641: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="642" class="l"><a class="l" href="#642">642: </a> } |
</span><span id="643" class="l"><a class="l" href="#643">643: </a> |
</span><span id="644" class="l"><a class="l" href="#644">644: </a> |
</span><span id="645" class="l"><a class="l" href="#645">645: </a> <span class="php-comment">/** |
</span></span><span id="646" class="l"><a class="l" href="#646">646: </a><span class="php-comment"> * Permet d'ajouter un message d'erreur ou d'avertissement qui sera envoyé au client. |
</span></span><span id="647" class="l"><a class="l" href="#647">647: </a><span class="php-comment"> * Le message doit être au format texte et en UTF-8. |
</span></span><span id="648" class="l"><a class="l" href="#648">648: </a><span class="php-comment"> * @param string $message le message à envoyer. |
</span></span><span id="649" class="l"><a class="l" href="#649">649: </a><span class="php-comment"> */</span> |
</span><span id="650" class="l"><a class="l" href="#650">650: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_ajouterMessage" href="#_ajouterMessage">ajouterMessage</a>(<span class="php-var">$message</span>) { |
</span><span id="651" class="l"><a class="l" href="#651">651: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$message</span>) && !<span class="php-keyword1">empty</span>(<span class="php-var">$message</span>)) { |
</span><span id="652" class="l"><a class="l" href="#652">652: </a> self::<span class="php-var">$messages</span>[] = <span class="php-var">$message</span>; |
</span><span id="653" class="l"><a class="l" href="#653">653: </a> } |
</span><span id="654" class="l"><a class="l" href="#654">654: </a> } |
</span><span id="655" class="l"><a class="l" href="#655">655: </a> |
</span><span id="656" class="l"><a class="l" href="#656">656: </a> <span class="php-comment">/** |
</span></span><span id="657" class="l"><a class="l" href="#657">657: </a><span class="php-comment"> * Envoie au client les éventuels messages d'erreur et d'avertissement du Serveur. |
</span></span><span id="658" class="l"><a class="l" href="#658">658: </a><span class="php-comment"> * Le format d'envoie est text/plain encodé en UTF-8. |
</span></span><span id="659" class="l"><a class="l" href="#659">659: </a><span class="php-comment"> */</span> |
</span><span id="660" class="l"><a class="l" href="#660">660: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_envoyerMessages" href="#_envoyerMessages">envoyerMessages</a>() { |
</span><span id="661" class="l"><a class="l" href="#661">661: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(self::<span class="php-var">$messages</span>) > <span class="php-num">0</span>) { |
</span><span id="662" class="l"><a class="l" href="#662">662: </a> <span class="php-keyword2">header</span>(<span class="php-quote">"Content-Type: text/plain; charset=utf-8"</span>); |
</span><span id="663" class="l"><a class="l" href="#663">663: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">implode</span>(<span class="php-quote">"\n"</span>, self::<span class="php-var">$messages</span>); |
</span><span id="664" class="l"><a class="l" href="#664">664: </a> } |
</span><span id="665" class="l"><a class="l" href="#665">665: </a> } |
</span><span id="666" class="l"><a class="l" href="#666">666: </a>} |
</span><span id="667" class="l"><a class="l" href="#667">667: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Framework.html |
---|
New file |
0,0 → 1,373 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Framework.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li class="active"><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Framework.html" title="Summary of Framework"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe de base du Framework : |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * - fournissant des infos sur l'application, |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * - paramétrant l'environnement de l'appli et du framework, |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * - réalisant des traitements sur les variables globales ($_GET, $_POST, $_COOKIE...) |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * Cette classe contient la fonction de chargement automatique de classes. |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * Ce fichier doit toujours rester à la racine du framework car il initialise le chemin |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * de l'application en se basant sur son propre emplacement. |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @package Framework |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-comment"> * @version $Id: Framework.php 393 2011-11-10 13:36:48Z jpm $ |
</span></span><span id="20" class="l"><a class="l" href="#20"> 20: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="21" class="l"><a class="l" href="#21"> 21: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="22" class="l"><a class="l" href="#22"> 22: </a><span class="php-comment"> */</span> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a><span class="php-keyword1">class</span> <a id="Framework" href="#Framework">Framework</a> { |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> <span class="php-comment">/** Variable statique indiquant que les tableaux _GET et _POST ont déjà été encodé au format de l'appli. */</span> |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$encodage" href="#$encodage">$encodage</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-comment">/** Tableau d'informations sur l'application */</span> |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$info" href="#$info">$info</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> <span class="php-comment">/** Chemin de base de l'application */</span> |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$chemin" href="#$chemin">$chemin</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> <span class="php-comment">/** Tableau des noms des paramètres à définir dans le fichier de config car obligatoirement nécessaire à cette classe.*/</span> |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$parametres_obligatoires" href="#$parametres_obligatoires">$parametres_obligatoires</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'chemin_controleurs'</span>, <span class="php-quote">'chemin_modeles'</span>, <span class="php-quote">'chemin_bibliotheque'</span>, |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> <span class="php-quote">'url_arg_separateur_entree'</span>, <span class="php-quote">'url_arg_separateur_sortie'</span>, |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> <span class="php-quote">'encodage_sortie'</span>, <span class="php-quote">'encodage_appli'</span>); |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> <span class="php-comment">/** |
</span></span><span id="40" class="l"><a class="l" href="#40"> 40: </a><span class="php-comment"> * Initialise l'environnement nécessaire au Framework : constantes globales, méthodeles autoload, séparateur d'arguments |
</span></span><span id="41" class="l"><a class="l" href="#41"> 41: </a><span class="php-comment"> * d'url. |
</span></span><span id="42" class="l"><a class="l" href="#42"> 42: </a><span class="php-comment"> * Cette méthode est appelée automatiquement suite à la définition du chemin de l'application via Application::setChemin(). |
</span></span><span id="43" class="l"><a class="l" href="#43"> 43: </a><span class="php-comment"> */</span> |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_initialiserEnvironnement" href="#_initialiserEnvironnement">initialiserEnvironnement</a>() { |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> self::enregistrerMethodesAutoload(); |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> self::initialiserUrl(); |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> } |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-comment">/** |
</span></span><span id="50" class="l"><a class="l" href="#50"> 50: </a><span class="php-comment"> * Initialise différentes classes du Framework nécessaires pour le fonctionnement de l'application. |
</span></span><span id="51" class="l"><a class="l" href="#51"> 51: </a><span class="php-comment"> * Ces classes sont ensuites controlées via les fichiers de config.ini. |
</span></span><span id="52" class="l"><a class="l" href="#52"> 52: </a><span class="php-comment"> * Elle est appelée automatiquement suite à la définition du chemin de l'application via Application::setChemin(). |
</span></span><span id="53" class="l"><a class="l" href="#53"> 53: </a><span class="php-comment"> */</span> |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_initialiserFramework" href="#_initialiserFramework">initialiserFramework</a>() { |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> GestionnaireException::configurer(); |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> <span class="php-comment">//Log::configurer();</span> |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> self::verifierEtReencoderTableauRequete(); |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> } |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> <span class="php-comment">/** |
</span></span><span id="61" class="l"><a class="l" href="#61"> 61: </a><span class="php-comment"> * Redéfinit des constantes globales utiles pour le Framework et les applis. |
</span></span><span id="62" class="l"><a class="l" href="#62"> 62: </a><span class="php-comment"> */</span> |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_definirConstantesGlobales" href="#_definirConstantesGlobales">definirConstantesGlobales</a>() { |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">defined</span>(<span class="php-quote">'DS'</span>)) { |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> <span class="php-comment">/** Redéfinition de la constante DIRECTORY_SEPARATOR en version abrégée DS */</span> |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> <span class="php-keyword2">define</span>(<span class="php-quote">'DS'</span>, DIRECTORY_SEPARATOR); |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> } |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">defined</span>(<span class="php-quote">'PS'</span>)) { |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> <span class="php-comment">/** Redéfinition de la constante PATH_SEPARATOR en version abrégée PS */</span> |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> <span class="php-keyword2">define</span>(<span class="php-quote">'PS'</span>, PATH_SEPARATOR); |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> } |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> } |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_definirCheminAppli" href="#_definirCheminAppli">definirCheminAppli</a>(<span class="php-var">$chemin</span>) { |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_file</span>(<span class="php-var">$chemin</span>)) { |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> self::<span class="php-var">$chemin</span> = <span class="php-keyword2">dirname</span>(<span class="php-var">$chemin</span>).DS; |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_dir</span>(<span class="php-var">$chemin</span>)) { |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> self::<span class="php-var">$chemin</span> = <span class="php-var">$chemin</span>; |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> } <span class="php-keyword1">else</span> { |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> Exception(<span class="php-quote">"Le chemin indiqué '</span><span class="php-var">$chemin</span><span class="php-quote">' n'est ni un fichier ni un dossier."</span>); |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> } |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> } |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_enregistrerMethodesAutoload" href="#_enregistrerMethodesAutoload">enregistrerMethodesAutoload</a>() { |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> <span class="php-keyword2">spl_autoload_register</span>(<span class="php-keyword1">array</span>(<span class="php-keyword2">get_class</span>(), <span class="php-quote">'autoloadFw'</span>)); |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-comment">// Vérification des paramètres de configuration obligatoire pour assurer le fonctionnement du Framework</span> |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> Config::verifierPresenceParametres(self::<span class="php-var">$parametres_obligatoires</span>); |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> <span class="php-comment">// Initialisation du gestionnaire d'erreur avant toute chose</span> |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> GestionnaireException::initialiser(); |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-keyword2">spl_autoload_register</span>(<span class="php-keyword1">array</span>(<span class="php-keyword2">get_class</span>(), <span class="php-quote">'autoloadAppliDefaut'</span>)); |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> <span class="php-comment">// Autoload défini par l'application</span> |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">function_exists</span>(<span class="php-quote">'__autoload'</span>)) { |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-keyword2">spl_autoload_register</span>(<span class="php-quote">'__autoload'</span>); |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> } |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> } |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> <span class="php-comment">/** |
</span></span><span id="102" class="l"><a class="l" href="#102">102: </a><span class="php-comment"> * Autoload pour le Framework. |
</span></span><span id="103" class="l"><a class="l" href="#103">103: </a><span class="php-comment"> */</span> |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_autoloadFw" href="#_autoloadFw">autoloadFw</a>(<span class="php-var">$nom_classe_fw</span>) { |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-var">$racine_fw</span> = <span class="php-keyword2">dirname</span>(__FILE__).DS; |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> <span class="php-var">$dossiers_classes</span> = <span class="php-keyword1">array</span>( <span class="php-var">$racine_fw</span>, |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> <span class="php-var">$racine_fw</span>.<span class="php-quote">'utilitaires'</span>.DS, |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> <span class="php-var">$racine_fw</span>.<span class="php-quote">'brouillons'</span>.DS); |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$dossiers_classes</span> <span class="php-keyword1">as</span> <span class="php-var">$chemin</span>) { |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> <span class="php-var">$fichier_a_tester</span> = <span class="php-var">$chemin</span>.<span class="php-var">$nom_classe_fw</span>.<span class="php-quote">'.php'</span>; |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">file_exists</span>(<span class="php-var">$fichier_a_tester</span>)) { |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> <span class="php-keyword1">include_once</span> <span class="php-var">$fichier_a_tester</span>; |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">null</span>; |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> } |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> } |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> } |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-comment">/** |
</span></span><span id="119" class="l"><a class="l" href="#119">119: </a><span class="php-comment"> * Autoload par défaut pour l'application |
</span></span><span id="120" class="l"><a class="l" href="#120">120: </a><span class="php-comment"> */</span> |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_autoloadAppliDefaut" href="#_autoloadAppliDefaut">autoloadAppliDefaut</a>(<span class="php-var">$nom_classe</span>) { |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> <span class="php-var">$dossiers_classes</span> = <span class="php-keyword1">array</span>( Config::get(<span class="php-quote">'chemin_controleurs'</span>), |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> Config::get(<span class="php-quote">'chemin_modeles'</span>), |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> Config::get(<span class="php-quote">'chemin_bibliotheque'</span>)); |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$dossiers_classes</span> <span class="php-keyword1">as</span> <span class="php-var">$chemin</span>) { |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-var">$fichier_a_tester</span> = <span class="php-var">$chemin</span>.<span class="php-var">$nom_classe</span>.<span class="php-quote">'.php'</span>; |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">file_exists</span>(<span class="php-var">$fichier_a_tester</span>)) { |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> <span class="php-keyword1">include_once</span> <span class="php-var">$fichier_a_tester</span>; |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">null</span>; |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> } |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> } |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> } |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> <span class="php-comment">/** |
</span></span><span id="136" class="l"><a class="l" href="#136">136: </a><span class="php-comment"> * Initialise le format des urls. |
</span></span><span id="137" class="l"><a class="l" href="#137">137: </a><span class="php-comment"> */</span> |
</span><span id="138" class="l"><a class="l" href="#138">138: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_initialiserUrl" href="#_initialiserUrl">initialiserUrl</a>() { |
</span><span id="139" class="l"><a class="l" href="#139">139: </a> <span class="php-keyword2">ini_set</span>(<span class="php-quote">'arg_separator.input'</span>, Config::get(<span class="php-quote">'furl_arg_separateur_entree'</span>)); |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> <span class="php-keyword2">ini_set</span>(<span class="php-quote">'arg_separator.output'</span>, Config::get(<span class="php-quote">'url_arg_separateur_sortie'</span>)); |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> } |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-comment">/** |
</span></span><span id="144" class="l"><a class="l" href="#144">144: </a><span class="php-comment"> * Permet d'indiquer le chemin de base de l'Application. |
</span></span><span id="145" class="l"><a class="l" href="#145">145: </a><span class="php-comment"> * Cette méthode doit obligatoirement être utilisée par l'application pour que le Framework fonctionne correctement. |
</span></span><span id="146" class="l"><a class="l" href="#146">146: </a><span class="php-comment"> * @param string $chemin_fichier_principal chemin de base |
</span></span><span id="147" class="l"><a class="l" href="#147">147: </a><span class="php-comment"> */</span> |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_setCheminAppli" href="#_setCheminAppli">setCheminAppli</a>(<span class="php-var">$chemin_fichier_principal</span>) { |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> <span class="php-keyword1">if</span> (self::<span class="php-var">$chemin</span> === <span class="php-keyword1">null</span>) { |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">file_exists</span>(<span class="php-var">$chemin_fichier_principal</span>)) { |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Le fichier indiqué n'existe pas. Utilisez __FILE__ dans la méthode setCheminAppli()."</span>, E_USER_ERROR); |
</span><span id="152" class="l"><a class="l" href="#152">152: </a> } <span class="php-keyword1">else</span> { |
</span><span id="153" class="l"><a class="l" href="#153">153: </a> self::definirConstantesGlobales(); |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> self::definirCheminAppli(<span class="php-var">$chemin_fichier_principal</span>); |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> self::initialiserEnvironnement(); |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> self::initialiserFramework(); |
</span><span id="157" class="l"><a class="l" href="#157">157: </a> } |
</span><span id="158" class="l"><a class="l" href="#158">158: </a> } <span class="php-keyword1">else</span> { |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Le chemin de l'application a déjà été enregistré auprès du Framework"</span>, E_USER_WARNING); |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> } |
</span><span id="161" class="l"><a class="l" href="#161">161: </a> } |
</span><span id="162" class="l"><a class="l" href="#162">162: </a> |
</span><span id="163" class="l"><a class="l" href="#163">163: </a> <span class="php-comment">/** |
</span></span><span id="164" class="l"><a class="l" href="#164">164: </a><span class="php-comment"> * accesseur pour le chemin |
</span></span><span id="165" class="l"><a class="l" href="#165">165: </a><span class="php-comment"> * @return string le chemin |
</span></span><span id="166" class="l"><a class="l" href="#166">166: </a><span class="php-comment"> */</span> |
</span><span id="167" class="l"><a class="l" href="#167">167: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getCheminAppli" href="#_getCheminAppli">getCheminAppli</a>() { |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> <span class="php-keyword1">return</span> self::<span class="php-var">$chemin</span>; |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> } |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> <span class="php-comment">/** Le tableau des informations sur l'application possède les clés suivantes : |
</span></span><span id="172" class="l"><a class="l" href="#172">172: </a><span class="php-comment"> * - nom : nom de l'application |
</span></span><span id="173" class="l"><a class="l" href="#173">173: </a><span class="php-comment"> * - abr : abréviation de l'application |
</span></span><span id="174" class="l"><a class="l" href="#174">174: </a><span class="php-comment"> * - encodage : encodage de l'application (ISO-8859-15, UTF-8...) |
</span></span><span id="175" class="l"><a class="l" href="#175">175: </a><span class="php-comment"> * |
</span></span><span id="176" class="l"><a class="l" href="#176">176: </a><span class="php-comment"> * @param array $info tableau fournissant des informations sur l'application |
</span></span><span id="177" class="l"><a class="l" href="#177">177: </a><span class="php-comment"> * @return void |
</span></span><span id="178" class="l"><a class="l" href="#178">178: </a><span class="php-comment"> */</span> |
</span><span id="179" class="l"><a class="l" href="#179">179: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_setInfoAppli" href="#_setInfoAppli">setInfoAppli</a>(<span class="php-var">$info</span>) { |
</span><span id="180" class="l"><a class="l" href="#180">180: </a> <span class="php-keyword1">if</span> (self::<span class="php-var">$info</span> === <span class="php-keyword1">null</span>) { |
</span><span id="181" class="l"><a class="l" href="#181">181: </a> self::<span class="php-var">$info</span> = <span class="php-var">$info</span>; |
</span><span id="182" class="l"><a class="l" href="#182">182: </a> } <span class="php-keyword1">else</span> { |
</span><span id="183" class="l"><a class="l" href="#183">183: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Le informations de l'application ont déjà été enregistrées auprès du Framework"</span>, E_USER_WARNING); |
</span><span id="184" class="l"><a class="l" href="#184">184: </a> } |
</span><span id="185" class="l"><a class="l" href="#185">185: </a> } |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> <span class="php-comment">/** |
</span></span><span id="188" class="l"><a class="l" href="#188">188: </a><span class="php-comment"> * Accesseur pour le tableau d'infos sur l'application. |
</span></span><span id="189" class="l"><a class="l" href="#189">189: </a><span class="php-comment"> * @param string $cle la clé à laquelle on veut accéder |
</span></span><span id="190" class="l"><a class="l" href="#190">190: </a><span class="php-comment"> */</span> |
</span><span id="191" class="l"><a class="l" href="#191">191: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getInfoAppli" href="#_getInfoAppli">getInfoAppli</a>(<span class="php-var">$cle</span> = <span class="php-keyword1">null</span>) { |
</span><span id="192" class="l"><a class="l" href="#192">192: </a> <span class="php-keyword1">if</span> (<span class="php-var">$cle</span> !== <span class="php-keyword1">null</span>) { |
</span><span id="193" class="l"><a class="l" href="#193">193: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(self::<span class="php-var">$info</span>[<span class="php-var">$cle</span>])) { |
</span><span id="194" class="l"><a class="l" href="#194">194: </a> <span class="php-keyword1">return</span> self::<span class="php-var">$info</span>[<span class="php-var">$cle</span>]; |
</span><span id="195" class="l"><a class="l" href="#195">195: </a> } |
</span><span id="196" class="l"><a class="l" href="#196">196: </a> } <span class="php-keyword1">else</span> { |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> <span class="php-keyword1">return</span> self::<span class="php-var">$info</span>; |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> } |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> } |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> |
</span><span id="201" class="l"><a class="l" href="#201">201: </a> <span class="php-comment">/** |
</span></span><span id="202" class="l"><a class="l" href="#202">202: </a><span class="php-comment"> * Procédure vérifiant l'encodage des tableaux $_GET et $_POST et les transcodant dans l'encodage de l'application |
</span></span><span id="203" class="l"><a class="l" href="#203">203: </a><span class="php-comment"> */</span> |
</span><span id="204" class="l"><a class="l" href="#204">204: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_verifierEtReencoderTableauRequete" href="#_verifierEtReencoderTableauRequete">verifierEtReencoderTableauRequete</a>() { |
</span><span id="205" class="l"><a class="l" href="#205">205: </a> <span class="php-keyword1">if</span> (self::<span class="php-var">$encodage</span> == <span class="php-keyword1">false</span> && Config::get(<span class="php-quote">'encodage_sortie'</span>) != Config::get(<span class="php-quote">'encodage_appli'</span>)) { |
</span><span id="206" class="l"><a class="l" href="#206">206: </a> <span class="php-var">$_POST</span> = self::encoderTableau(<span class="php-var">$_POST</span>, Config::get(<span class="php-quote">'encodage_appli'</span>), Config::get(<span class="php-quote">'encodage_sortie'</span>)); |
</span><span id="207" class="l"><a class="l" href="#207">207: </a> <span class="php-var">$_GET</span> = self::encoderTableau(<span class="php-var">$_GET</span>, Config::get(<span class="php-quote">'encodage_appli'</span>), Config::get(<span class="php-quote">'encodage_sortie'</span>)); |
</span><span id="208" class="l"><a class="l" href="#208">208: </a> |
</span><span id="209" class="l"><a class="l" href="#209">209: </a> <span class="php-comment">// Traitement des magic quotes</span> |
</span><span id="210" class="l"><a class="l" href="#210">210: </a> self::verifierEtTraiterSlashTableauRequete(); |
</span><span id="211" class="l"><a class="l" href="#211">211: </a> |
</span><span id="212" class="l"><a class="l" href="#212">212: </a> self::<span class="php-var">$encodage</span> = <span class="php-keyword1">true</span>; |
</span><span id="213" class="l"><a class="l" href="#213">213: </a> } |
</span><span id="214" class="l"><a class="l" href="#214">214: </a> } |
</span><span id="215" class="l"><a class="l" href="#215">215: </a> |
</span><span id="216" class="l"><a class="l" href="#216">216: </a> <span class="php-comment">/** |
</span></span><span id="217" class="l"><a class="l" href="#217">217: </a><span class="php-comment"> * Procédure vérifiant l'activation des magic quotes et remplacant les slash dans les tableaux de requete |
</span></span><span id="218" class="l"><a class="l" href="#218">218: </a><span class="php-comment"> */</span> |
</span><span id="219" class="l"><a class="l" href="#219">219: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_verifierEtTraiterSlashTableauRequete" href="#_verifierEtTraiterSlashTableauRequete">verifierEtTraiterSlashTableauRequete</a>() { |
</span><span id="220" class="l"><a class="l" href="#220">220: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">get_magic_quotes_gpc</span>()) { |
</span><span id="221" class="l"><a class="l" href="#221">221: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">function_exists</span>(<span class="php-quote">'nettoyerSlashProfond'</span>)) { |
</span><span id="222" class="l"><a class="l" href="#222">222: </a> <span class="php-keyword1">function</span> <a id="_nettoyerSlashProfond" href="#_nettoyerSlashProfond">nettoyerSlashProfond</a>(<span class="php-var">$valeur</span>) { |
</span><span id="223" class="l"><a class="l" href="#223">223: </a> <span class="php-keyword1">return</span> ( <span class="php-keyword2">is_array</span>(<span class="php-var">$valeur</span>) ) ? <span class="php-keyword2">array_map</span>(<span class="php-quote">'nettoyerSlashProfond'</span>, <span class="php-var">$valeur</span>) : <span class="php-keyword2">stripslashes</span>(<span class="php-var">$valeur</span>); |
</span><span id="224" class="l"><a class="l" href="#224">224: </a> } |
</span><span id="225" class="l"><a class="l" href="#225">225: </a> } |
</span><span id="226" class="l"><a class="l" href="#226">226: </a> <span class="php-var">$_GET</span> = <span class="php-keyword2">array_map</span>(<span class="php-quote">'nettoyerSlashProfond'</span>, <span class="php-var">$_GET</span>); |
</span><span id="227" class="l"><a class="l" href="#227">227: </a> <span class="php-var">$_POST</span> = <span class="php-keyword2">array_map</span>(<span class="php-quote">'nettoyerSlashProfond'</span>, <span class="php-var">$_POST</span>); |
</span><span id="228" class="l"><a class="l" href="#228">228: </a> <span class="php-var">$_COOKIE</span> = <span class="php-keyword2">array_map</span>(<span class="php-quote">'nettoyerSlashProfond'</span>, <span class="php-var">$_COOKIE</span>); |
</span><span id="229" class="l"><a class="l" href="#229">229: </a> } |
</span><span id="230" class="l"><a class="l" href="#230">230: </a> } |
</span><span id="231" class="l"><a class="l" href="#231">231: </a> |
</span><span id="232" class="l"><a class="l" href="#232">232: </a> <span class="php-comment">/** |
</span></span><span id="233" class="l"><a class="l" href="#233">233: </a><span class="php-comment"> * Fonction récursive transcodant toutes les valeurs d'un tableau de leur encodage d'entrée vers un encodage de sortie donné |
</span></span><span id="234" class="l"><a class="l" href="#234">234: </a><span class="php-comment"> * @param $tableau Array Un tableau de données à encoder |
</span></span><span id="235" class="l"><a class="l" href="#235">235: </a><span class="php-comment"> * @param $encodage_sortie String l'encodage vers lequel on doit transcoder |
</span></span><span id="236" class="l"><a class="l" href="#236">236: </a><span class="php-comment"> * @param $encodage_entree String l'encodage original des chaines du tableau (optionnel) |
</span></span><span id="237" class="l"><a class="l" href="#237">237: </a><span class="php-comment"> * @return Array Le tableau encodé dans l'encodage de sortie |
</span></span><span id="238" class="l"><a class="l" href="#238">238: </a><span class="php-comment"> * |
</span></span><span id="239" class="l"><a class="l" href="#239">239: </a><span class="php-comment"> */</span> |
</span><span id="240" class="l"><a class="l" href="#240">240: </a> <span class="php-keyword1">final</span> <span class="php-keyword1">static</span> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_encoderTableau" href="#_encoderTableau">encoderTableau</a>(<span class="php-var">$tableau</span>, <span class="php-var">$encodage_sortie</span>, <span class="php-var">$encodage_entree</span> = <span class="php-keyword1">null</span>) { |
</span><span id="241" class="l"><a class="l" href="#241">241: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$tableau</span>)) { |
</span><span id="242" class="l"><a class="l" href="#242">242: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$tableau</span> <span class="php-keyword1">as</span> <span class="php-var">$cle</span> => <span class="php-var">$valeur</span>) { |
</span><span id="243" class="l"><a class="l" href="#243">243: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$valeur</span>)) { |
</span><span id="244" class="l"><a class="l" href="#244">244: </a> <span class="php-var">$tableau</span>[<span class="php-var">$cle</span>] = self::encoderTableau(<span class="php-var">$valeur</span>, <span class="php-var">$encodage_sortie</span>, <span class="php-var">$encodage_entree</span>); |
</span><span id="245" class="l"><a class="l" href="#245">245: </a> } <span class="php-keyword1">else</span> { |
</span><span id="246" class="l"><a class="l" href="#246">246: </a> <span class="php-var">$tableau</span>[<span class="php-var">$cle</span>] = <span class="php-keyword2">mb_convert_encoding</span>(<span class="php-var">$valeur</span>, <span class="php-var">$encodage_sortie</span>, <span class="php-var">$encodage_entree</span>); |
</span><span id="247" class="l"><a class="l" href="#247">247: </a> } |
</span><span id="248" class="l"><a class="l" href="#248">248: </a> } |
</span><span id="249" class="l"><a class="l" href="#249">249: </a> } |
</span><span id="250" class="l"><a class="l" href="#250">250: </a> <span class="php-keyword1">return</span> <span class="php-var">$tableau</span>; |
</span><span id="251" class="l"><a class="l" href="#251">251: </a> } |
</span><span id="252" class="l"><a class="l" href="#252">252: </a>} |
</span><span id="253" class="l"><a class="l" href="#253">253: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-RestService.html |
---|
New file |
0,0 → 1,672 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class RestService | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li class="active"><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class RestService</h1> |
<div class="description"> |
<p>Classe principale gérant les services. Paramètres liés dans config.ini : - |
serveur.baseURL</p> |
<p>Encodage en entrée : utf8 Encodage en sortie : utf8</p> |
</div> |
<div> |
<h4>Direct known subclasses</h4> |
<a href="class-MonService.html">MonService</a>, |
<a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a>, |
<a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a>, |
<a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a> |
</div> |
<div class="info"> |
<b>Abstract</b><br> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
Php 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="GPL">v3 <http://www.gnu.org/licenses/gpl.txt></a><br> |
<b>License:</b> |
<a href="CECILL">v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt></a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: RestService.php 417 2012-05-15 09:24:12Z jpm $<br> |
<b>Since:</b> |
0.3<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-RestService.html#2-150" title="Go to source code">framework/RestService.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="__construct" id="___construct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___construct">#</a> |
<code><a href="source-class-RestService.html#34-37" title="Go to source code">__construct</a>( <span>mixed <var>$config</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="initialiser" id="_initialiser"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_initialiser">#</a> |
<code><a href="source-class-RestService.html#39-41" title="Go to source code">initialiser</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getBdd" id="_getBdd"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getBdd">#</a> |
<code><a href="source-class-RestService.html#43-52" title="Go to source code">getBdd</a>( )</code> |
<div class="description short"> |
<p>Méthode de connection à la base de données sur demande. Tous les services |
web n'ont pas besoin de s'y connecter.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode de connection à la base de données sur demande. Tous les services |
web n'ont pas besoin de s'y connecter.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="getRestClient" id="_getRestClient"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getRestClient">#</a> |
<code><a href="source-class-RestService.html#54-62" title="Go to source code">getRestClient</a>( )</code> |
<div class="description short"> |
<p>Méthode permettant de faire appel à un client REST en fonction des besoins |
du service.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode permettant de faire appel à un client REST en fonction des besoins |
du service.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="utiliserParametresBruts" id="_utiliserParametresBruts"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_utiliserParametresBruts">#</a> |
<code><a href="source-class-RestService.html#64-70" title="Go to source code">utiliserParametresBruts</a>( )</code> |
<div class="description short"> |
<p>Méthode permettant de savoir si le service veut utiliser des paramètres |
bruts (issu de la QueryString) ou pas (issu de $_GET).</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode permettant de savoir si le service veut utiliser des paramètres |
bruts (issu de la QueryString) ou pas (issu de $_GET).</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="ajouterMessage" id="_ajouterMessage"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_ajouterMessage">#</a> |
<code><a href="source-class-RestService.html#72-79" title="Go to source code">ajouterMessage</a>( <span>string <var>$message</var></span> )</code> |
<div class="description short"> |
<p>Permet d'ajouter un message d'erreur ou d'avertissement qui sera envoyé au |
client. Le message doit être au format texte et en UTF-8.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Permet d'ajouter un message d'erreur ou d'avertissement qui sera envoyé au |
client. Le message doit être au format texte et en UTF-8.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$message</var></dt> |
<dd><code>string</code><br>$message le message à envoyer.</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="consulter" id="_consulter"> |
<td class="attributes"><code> |
public |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_consulter">#</a> |
<code><a href="source-class-RestService.html#81-94" title="Go to source code">consulter</a>( <span>array <var>$ressources</var></span>, <span>array <var>$parametres</var></span> )</code> |
<div class="description short"> |
<p>Méthode appelée lors d'une requête HTTP de type GET.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode appelée lors d'une requête HTTP de type GET.</p> |
<p>Si la consultation est un succès, le code statut HTTP retourné sera 200. |
Dans tous les autres cas, la méthode devra retourner le code statut HTTP |
adéquate.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$ressources</var></dt> |
<dd><code>array</code><br>Morceaux de l'url servant à préciser la ressource concerné pour le service |
demandé.</dd> |
<dt><var>$parametres</var></dt> |
<dd><code>array</code><br>Partie de l'url situé après le '?' servant à paramétrer le service demandé.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>une chaine indiquant le succès de l'opération et les données demandées.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="modifier" id="_modifier"> |
<td class="attributes"><code> |
public |
mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_modifier">#</a> |
<code><a href="source-class-RestService.html#96-111" title="Go to source code">modifier</a>( <span>array <var>$ressources</var></span>, <span>array <var>$requeteDonnees</var></span> )</code> |
<div class="description short"> |
<p>Méthode appelée lors d'une requête HTTP de type POST.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode appelée lors d'une requête HTTP de type POST.</p> |
<p>La ressource à modifier est indiquée via l'url. Les données devant servir |
à la mise à jours sont passées dans le corps de la requête. Si la |
modification est un succès, la méthode devra retourner "true" et le code |
statut HTTP retourné sera 201.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$ressources</var></dt> |
<dd><code>array</code><br>Morceaux de l'url servant à préciser la ressource concerné pour le service |
demandé.</dd> |
<dt><var>$requeteDonnees</var></dt> |
<dd><code>array</code><br>les données transférées dans le corps de la requête devant servir à la |
modification.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed</code><br>une chaine indiquant le succès de l'opération ou rien.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="ajouter" id="_ajouter"> |
<td class="attributes"><code> |
public |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_ajouter">#</a> |
<code><a href="source-class-RestService.html#113-130" title="Go to source code">ajouter</a>( <span>array <var>$ressources</var></span>, <span>array <var>$requeteDonnees</var></span> )</code> |
<div class="description short"> |
<p>Méthode appelée lors d'une requête HTTP de type PUT.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode appelée lors d'une requête HTTP de type PUT.</p> |
<p>L'identifiant de la ressource à ajouter est indiqué via l'url si on le |
connait par avance. Sinon, il doit être créé par le service. Dans ce dernier |
cas, le nouvel identifiant devrait être renvoyé dans le corps de la réponse. |
Si l'ajout est un succès, la méthode devra retourner "true" ou l'identifiant. |
Le code statut HTTP retourné sera 201 en cas de succès. Dans le cas contraire, |
la méthode devra retourner false.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$ressources</var></dt> |
<dd><code>array</code><br>Morceaux de l'url servant à préciser la ressource concerné pour le service |
demandé.</dd> |
<dt><var>$requeteDonnees</var></dt> |
<dd><code>array</code><br>les données transférées dans le corps de la requête devant servir à |
l'ajout.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>l'identifiant créé.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="supprimer" id="_supprimer"> |
<td class="attributes"><code> |
public |
mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_supprimer">#</a> |
<code><a href="source-class-RestService.html#132-149" title="Go to source code">supprimer</a>( <span>array <var>$ressources</var></span> )</code> |
<div class="description short"> |
<p>Méthode appelée lors d'une requête HTTP de type DELETE (ou POST avec |
action=DELETE dans le corps de la requete).</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode appelée lors d'une requête HTTP de type DELETE (ou POST avec |
action=DELETE dans le corps de la requete).</p> |
<p>Si la suppression est un succès, la méthode devra retourner "true" et le |
code statut HTTP retourné par RestServeur sera 204. Si la ressource à |
supprimer est introuvable, la méthode devra retourner "false" et le code statut |
HTTP retourné par RestServeur sera 404. Dans les autres cas de figure ou si |
vous souhaitez gérer vos propres codes de retour erreur, retourner la valeur |
null ou rien.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$ressources</var></dt> |
<dd><code>array</code><br>Morceaux de l'url servant à préciser la ressource concerné pour le service |
demandé.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed</code><br>une chaine indiquant le succès de l'opération ou rien.<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr data-order="bdd" id="$bdd"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-RestService.html#22-26" title="Go to source code"><var>$bdd</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">null</span></code></td> |
<td class="description"><div> |
<a href="#$bdd" class="anchor">#</a> |
<div class="description short"> |
<p>Objet de connection à la base de données.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Objet de connection à la base de données.</p> |
<h4>Deprecated</h4> |
<div class="list"> |
Utiliser la methode getBdd().<br> |
</div> |
<h4>See</h4> |
<div class="list"> |
<code><code><a href="class-RestService.html#_getBdd">RestService::getBdd()</a></code></code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="utilisationParametresBruts" id="$utilisationParametresBruts"> |
<td class="attributes"><code> |
protected |
boolean |
</code></td> |
<td class="name"> |
<a href="source-class-RestService.html#31-32" title="Go to source code"><var>$utilisationParametresBruts</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">false</span></code></td> |
<td class="description"><div> |
<a href="#$utilisationParametresBruts" class="anchor">#</a> |
<div class="description short"> |
<p>Indique si oui (true) ou non (false), on veut utiliser les paramètres |
brutes.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Indique si oui (true) ou non (false), on veut utiliser les paramètres |
brutes.</p> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Config.html |
---|
New file |
0,0 → 1,403 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Config.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li class="active"><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Config.html" title="Summary of Config"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Config permet de charger automatiquement les fichiers ini du Framework et de l'application. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * Elle offre l'accès en lecture seule aux paramètres de config. |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * C'est une Singleton. |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * Si vous avez besoin de modifier dynamiquement des paramètres de configuration, utiliser le @see Registe, il est fait pour ça. |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @package Framework |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @version $Id: Config.php 447 2013-12-19 10:52:37Z jpm $ |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> */</span> |
</span><span id="18" class="l"><a class="l" href="#18"> 18: </a> |
</span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-keyword1">class</span> <a id="Config" href="#Config">Config</a> { |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> <span class="php-comment">/** Instance de la classe pointant sur elle même (pour le pattern singleton). */</span> |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$instance" href="#$instance">$instance</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> <span class="php-comment">/** Paramètres de configuration. */</span> |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$parametres" href="#$parametres">$parametres</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>() { |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-comment">// Définition de paramètres avant chargement du config.ini</span> |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> self::<span class="php-var">$parametres</span> = <span class="php-keyword1">array</span>( |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-quote">'fichier_config'</span> => <span class="php-quote">'config%s.ini'</span>, |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> <span class="php-quote">'chemin_framework'</span> => <span class="php-keyword2">dirname</span>(__FILE__).DS |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> ); |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> <span class="php-comment">// Chargement du fichier config.ini du Framework</span> |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-var">$existe</span> = self::parserFichierIni(self::<span class="php-var">$parametres</span>[<span class="php-quote">'chemin_framework'</span>].<span class="php-keyword2">sprintf</span>(self::<span class="php-var">$parametres</span>[<span class="php-quote">'fichier_config'</span>], <span class="php-quote">''</span>)); |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> <span class="php-keyword1">if</span> (<span class="php-var">$existe</span> === <span class="php-keyword1">false</span>) { |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Veuillez configurer le Framework en renommant le fichier config.defaut.ini en config.ini."</span>, E_USER_ERROR); |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> } |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> <span class="php-comment">// Chargement du fichier config.ini par défaut de l'application</span> |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> <span class="php-var">$chemin_config_defaut_appli</span> = self::<span class="php-var">$parametres</span>[<span class="php-quote">'chemin_configurations'</span>].<span class="php-keyword2">sprintf</span>(self::<span class="php-var">$parametres</span>[<span class="php-quote">'fichier_config'</span>], <span class="php-quote">''</span>); |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> self::parserFichierIni(<span class="php-var">$chemin_config_defaut_appli</span>); |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> <span class="php-comment">// Chargement des fichiers config.ini contextuels</span> |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> <span class="php-keyword1">if</span> (PHP_SAPI == <span class="php-quote">'cli'</span>) {<span class="php-comment">// mode console</span> |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$_SERVER</span>[<span class="php-quote">'argv'</span>] <span class="php-keyword1">as</span> <span class="php-var">$cle</span> => <span class="php-var">$valeur</span>) { |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> <span class="php-keyword1">if</span> (<span class="php-var">$valeur</span> == <span class="php-quote">'-contexte'</span>) { |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> self::chargerFichierContexte(<span class="php-var">$_SERVER</span>[<span class="php-quote">'argv'</span>][(<span class="php-var">$cle</span>+<span class="php-num">1</span>)]); |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> <span class="php-keyword1">break</span>; |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> } |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> } |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> } <span class="php-keyword1">else</span> {<span class="php-comment">// mode web</span> |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> <span class="php-comment">// Pour Papyrus</span> |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">defined</span>(<span class="php-quote">'PAP_VERSION'</span>)) { |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> self::chargerFichierContexte(<span class="php-quote">'papyrus'</span>); |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> } |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> <span class="php-comment">// Via le fichie .ini par défaut de l'appli</span> |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> <span class="php-keyword1">if</span> (Config::existeValeur(<span class="php-quote">'info.contexte'</span>, self::<span class="php-var">$parametres</span>)) { |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> self::chargerFichierContexte(Config::get(<span class="php-quote">'info.contexte'</span>)); |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> } |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> <span class="php-comment">// Chargement du contexte présent dans le GET</span> |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$_GET</span>[<span class="php-quote">'contexte'</span>])) { |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-var">$_GET</span>[<span class="php-quote">'contexte'</span>] = <span class="php-keyword2">strip_tags</span>(<span class="php-var">$_GET</span>[<span class="php-quote">'contexte'</span>]); |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> self::chargerFichierContexte(<span class="php-var">$_GET</span>[<span class="php-quote">'contexte'</span>]); |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> } |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> <span class="php-comment">// Chargement du contexte présent dans le POST</span> |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$_POST</span>[<span class="php-quote">'contexte'</span>])) { |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> <span class="php-var">$_POST</span>[<span class="php-quote">'contexte'</span>] = <span class="php-keyword2">strip_tags</span>(<span class="php-var">$_POST</span>[<span class="php-quote">'contexte'</span>]); |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> self::chargerFichierContexte(<span class="php-var">$_POST</span>[<span class="php-quote">'contexte'</span>]); |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> } |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> } |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> } |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> <span class="php-comment">/** |
</span></span><span id="77" class="l"><a class="l" href="#77"> 77: </a><span class="php-comment"> * Charge le fichier de config correspondant au contexte |
</span></span><span id="78" class="l"><a class="l" href="#78"> 78: </a><span class="php-comment"> * @param string $contexte le contexte |
</span></span><span id="79" class="l"><a class="l" href="#79"> 79: </a><span class="php-comment"> */</span> |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_chargerFichierContexte" href="#_chargerFichierContexte">chargerFichierContexte</a>(<span class="php-var">$contexte</span>) { |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> <span class="php-var">$chemin_config_appli_contextuel</span> = self::<span class="php-var">$parametres</span>[<span class="php-quote">'chemin_configurations'</span>]; |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> <span class="php-var">$chemin_config_appli_contextuel</span> .= <span class="php-keyword2">sprintf</span>(self::<span class="php-var">$parametres</span>[<span class="php-quote">'fichier_config'</span>], <span class="php-quote">'_'</span>.<span class="php-var">$contexte</span>); |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> self::parserFichierIni(<span class="php-var">$chemin_config_appli_contextuel</span>); |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> } |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> <span class="php-comment">/** |
</span></span><span id="87" class="l"><a class="l" href="#87"> 87: </a><span class="php-comment"> * Parse le fichier ini donné en paramètre |
</span></span><span id="88" class="l"><a class="l" href="#88"> 88: </a><span class="php-comment"> * @param string $fichier_ini nom du fichier ini à parser |
</span></span><span id="89" class="l"><a class="l" href="#89"> 89: </a><span class="php-comment"> * @return array tableau contenant les paramètres du fichier ini |
</span></span><span id="90" class="l"><a class="l" href="#90"> 90: </a><span class="php-comment"> */</span> |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_parserFichierIni" href="#_parserFichierIni">parserFichierIni</a>(<span class="php-var">$fichier_ini</span>) { |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">false</span>; |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">file_exists</span>(<span class="php-var">$fichier_ini</span>)) { |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> <span class="php-var">$ini</span> = <span class="php-keyword2">parse_ini_file</span>(<span class="php-var">$fichier_ini</span>, <span class="php-keyword1">true</span>); |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> <span class="php-var">$ini</span> = self::analyserTableauIni(<span class="php-var">$ini</span>); |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">true</span>; |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> } <span class="php-keyword1">else</span> { |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-keyword2">error_log</span>(<span class="php-quote">"Fichier de configuration introuvable : </span><span class="php-var">$fichier_ini</span><span class="php-quote">"</span>); |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> } |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> } |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> <span class="php-comment">/** |
</span></span><span id="104" class="l"><a class="l" href="#104">104: </a><span class="php-comment"> * Fusionne un tableau de paramètres avec le tableau de paramètres global |
</span></span><span id="105" class="l"><a class="l" href="#105">105: </a><span class="php-comment"> * @param array $ini le tableau à fusionner |
</span></span><span id="106" class="l"><a class="l" href="#106">106: </a><span class="php-comment"> */</span> |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_fusionner" href="#_fusionner">fusionner</a>(<span class="php-keyword1">array</span> <span class="php-var">$ini</span>) { |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> self::<span class="php-var">$parametres</span> = <span class="php-keyword2">array_merge</span>(self::<span class="php-var">$parametres</span>, <span class="php-var">$ini</span>); |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> } |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> <span class="php-comment">/** |
</span></span><span id="112" class="l"><a class="l" href="#112">112: </a><span class="php-comment"> * Renvoie la valeur demandée grâce une chaîne de paramètres |
</span></span><span id="113" class="l"><a class="l" href="#113">113: </a><span class="php-comment"> * @param string $param la chaine de paramètres |
</span></span><span id="114" class="l"><a class="l" href="#114">114: </a><span class="php-comment"> * @param array $config le tableau de paramètre |
</span></span><span id="115" class="l"><a class="l" href="#115">115: </a><span class="php-comment"> * @return string la valeur de la chaine demandée |
</span></span><span id="116" class="l"><a class="l" href="#116">116: </a><span class="php-comment"> */</span> |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getValeur" href="#_getValeur">getValeur</a>(<span class="php-var">$param</span>, <span class="php-var">$config</span>) { |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-keyword1">if</span> (<span class="php-var">$param</span> === <span class="php-keyword1">null</span>) { |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">null</span>; |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> } <span class="php-keyword1">else</span> { |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$config</span>[<span class="php-var">$param</span>])) { |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> <span class="php-keyword1">return</span> <span class="php-var">$config</span>[<span class="php-var">$param</span>]; |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-keyword2">strpos</span>(<span class="php-var">$param</span>, <span class="php-quote">'.'</span>) !== <span class="php-keyword1">false</span>) { |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> <span class="php-var">$pieces</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">'.'</span>, <span class="php-var">$param</span>, <span class="php-num">2</span>); |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$pieces</span>[<span class="php-num">0</span>]) && <span class="php-keyword2">strlen</span>(<span class="php-var">$pieces</span>[<span class="php-num">1</span>])) { |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$config</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]])) { |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$config</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]])) { |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-keyword1">return</span> self::getValeur(<span class="php-var">$pieces</span>[<span class="php-num">1</span>], <span class="php-var">$config</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]]); |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> } |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> } |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> } |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> } <span class="php-keyword1">else</span> { |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">null</span>; |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> } |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> } |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> } |
</span><span id="137" class="l"><a class="l" href="#137">137: </a> |
</span><span id="138" class="l"><a class="l" href="#138">138: </a> <span class="php-comment">/** |
</span></span><span id="139" class="l"><a class="l" href="#139">139: </a><span class="php-comment"> * Teste si param existe dans le tableau config |
</span></span><span id="140" class="l"><a class="l" href="#140">140: </a><span class="php-comment"> * @param string $param nom du paramètre |
</span></span><span id="141" class="l"><a class="l" href="#141">141: </a><span class="php-comment"> * @param array tableau de configuration |
</span></span><span id="142" class="l"><a class="l" href="#142">142: </a><span class="php-comment"> */</span> |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_existeValeur" href="#_existeValeur">existeValeur</a>(<span class="php-var">$param</span>, <span class="php-var">$config</span>) { |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">false</span>; |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> <span class="php-keyword1">if</span> (self::getValeur(<span class="php-var">$param</span>, <span class="php-var">$config</span>) !== <span class="php-keyword1">null</span>) { |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">true</span>; |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> } |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> } |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> <span class="php-comment">/** |
</span></span><span id="152" class="l"><a class="l" href="#152">152: </a><span class="php-comment"> * Vérifie si l'instance de classe à été crée, si non la crée |
</span></span><span id="153" class="l"><a class="l" href="#153">153: </a><span class="php-comment"> */</span> |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_verifierCreationInstance" href="#_verifierCreationInstance">verifierCreationInstance</a>() { |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">empty</span>(self::<span class="php-var">$instance</span>)) { |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> self::<span class="php-var">$instance</span> = <span class="php-keyword1">new</span> Config(); |
</span><span id="157" class="l"><a class="l" href="#157">157: </a> } |
</span><span id="158" class="l"><a class="l" href="#158">158: </a> } |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> <span class="php-comment">/** |
</span></span><span id="161" class="l"><a class="l" href="#161">161: </a><span class="php-comment"> * Analyse un tableau de paramètres. |
</span></span><span id="162" class="l"><a class="l" href="#162">162: </a><span class="php-comment"> * @param array $config le tableau de paramètres |
</span></span><span id="163" class="l"><a class="l" href="#163">163: </a><span class="php-comment"> * @return array le tableau analysé |
</span></span><span id="164" class="l"><a class="l" href="#164">164: </a><span class="php-comment"> */</span> |
</span><span id="165" class="l"><a class="l" href="#165">165: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_analyserTableauIni" href="#_analyserTableauIni">analyserTableauIni</a>(<span class="php-var">$config</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="166" class="l"><a class="l" href="#166">166: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$config</span> <span class="php-keyword1">as</span> <span class="php-var">$cle</span> => &<span class="php-var">$valeur</span>) { |
</span><span id="167" class="l"><a class="l" href="#167">167: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$valeur</span>)) { |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> <span class="php-var">$config</span>[<span class="php-var">$cle</span>] = self::analyserTableauIni(<span class="php-var">$valeur</span>); |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> } <span class="php-keyword1">else</span> { |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> self::evaluerReferences(<span class="php-var">$config</span>, <span class="php-var">$cle</span>); |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> self::evaluerPhp(<span class="php-var">$config</span>, <span class="php-var">$cle</span>); |
</span><span id="172" class="l"><a class="l" href="#172">172: </a> self::evaluerCle(<span class="php-var">$config</span>, <span class="php-var">$cle</span>, <span class="php-var">$config</span>[<span class="php-var">$cle</span>]); |
</span><span id="173" class="l"><a class="l" href="#173">173: </a> } |
</span><span id="174" class="l"><a class="l" href="#174">174: </a> self::fusionner(<span class="php-var">$config</span>); |
</span><span id="175" class="l"><a class="l" href="#175">175: </a> } |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> <span class="php-keyword1">return</span> <span class="php-var">$config</span>; |
</span><span id="177" class="l"><a class="l" href="#177">177: </a> } |
</span><span id="178" class="l"><a class="l" href="#178">178: </a> |
</span><span id="179" class="l"><a class="l" href="#179">179: </a> <span class="php-comment">/** |
</span></span><span id="180" class="l"><a class="l" href="#180">180: </a><span class="php-comment"> * Dans le cas des chaine de configuration à sous clé (ex.: cle.souscle) |
</span></span><span id="181" class="l"><a class="l" href="#181">181: </a><span class="php-comment"> * évalue les valeurs correspondantes et crée les sous tableaux associés. |
</span></span><span id="182" class="l"><a class="l" href="#182">182: </a><span class="php-comment"> * @param array $config tableau de configuration (par référence) |
</span></span><span id="183" class="l"><a class="l" href="#183">183: </a><span class="php-comment"> * @param string $cle la cle dans le tableau |
</span></span><span id="184" class="l"><a class="l" href="#184">184: </a><span class="php-comment"> * @param string $valeur la valeur à affecter |
</span></span><span id="185" class="l"><a class="l" href="#185">185: </a><span class="php-comment"> */</span> |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_evaluerCle" href="#_evaluerCle">evaluerCle</a>(&<span class="php-var">$config</span>, <span class="php-var">$cle</span>, <span class="php-var">$valeur</span>) { |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strpos</span>(<span class="php-var">$cle</span>, <span class="php-quote">'.'</span>) !== <span class="php-keyword1">false</span>) { |
</span><span id="188" class="l"><a class="l" href="#188">188: </a> <span class="php-keyword1">unset</span>(<span class="php-var">$config</span>[<span class="php-var">$cle</span>]); |
</span><span id="189" class="l"><a class="l" href="#189">189: </a> <span class="php-var">$pieces</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">'.'</span>, <span class="php-var">$cle</span>, <span class="php-num">2</span>); |
</span><span id="190" class="l"><a class="l" href="#190">190: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$pieces</span>[<span class="php-num">0</span>]) && <span class="php-keyword2">strlen</span>(<span class="php-var">$pieces</span>[<span class="php-num">1</span>])) { |
</span><span id="191" class="l"><a class="l" href="#191">191: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$config</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]]) && !<span class="php-keyword2">is_array</span>(<span class="php-var">$config</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]])) { |
</span><span id="192" class="l"><a class="l" href="#192">192: </a> <span class="php-var">$m</span> = <span class="php-quote">"Ne peut pas créer de sous-clé pour '</span><span class="php-var">{$pieces[0]}</span><span class="php-quote">' car la clé existe déjà"</span>; |
</span><span id="193" class="l"><a class="l" href="#193">193: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$m</span>, E_USER_WARNING); |
</span><span id="194" class="l"><a class="l" href="#194">194: </a> } <span class="php-keyword1">else</span> { |
</span><span id="195" class="l"><a class="l" href="#195">195: </a> <span class="php-var">$config</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]][<span class="php-var">$pieces</span>[<span class="php-num">1</span>]] = <span class="php-var">$valeur</span>; |
</span><span id="196" class="l"><a class="l" href="#196">196: </a> <span class="php-var">$config</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]] = self::evaluerCle(<span class="php-var">$config</span>[<span class="php-var">$pieces</span>[<span class="php-num">0</span>]], <span class="php-var">$pieces</span>[<span class="php-num">1</span>], <span class="php-var">$valeur</span>); |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> } |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> } <span class="php-keyword1">else</span> { |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> <span class="php-var">$m</span> = <span class="php-quote">"Clé invalide '</span><span class="php-var">$cle</span><span class="php-quote">'"</span>; |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$m</span>, E_USER_WARNING); |
</span><span id="201" class="l"><a class="l" href="#201">201: </a> } |
</span><span id="202" class="l"><a class="l" href="#202">202: </a> } <span class="php-keyword1">else</span> { |
</span><span id="203" class="l"><a class="l" href="#203">203: </a> <span class="php-var">$config</span>[<span class="php-var">$cle</span>] = <span class="php-var">$valeur</span>; |
</span><span id="204" class="l"><a class="l" href="#204">204: </a> } |
</span><span id="205" class="l"><a class="l" href="#205">205: </a> <span class="php-keyword1">return</span> <span class="php-var">$config</span>; |
</span><span id="206" class="l"><a class="l" href="#206">206: </a> } |
</span><span id="207" class="l"><a class="l" href="#207">207: </a> |
</span><span id="208" class="l"><a class="l" href="#208">208: </a> <span class="php-comment">/** |
</span></span><span id="209" class="l"><a class="l" href="#209">209: </a><span class="php-comment"> * Évalue les valeurs de références à une clé dans le tableau config (cas du ref:cle). |
</span></span><span id="210" class="l"><a class="l" href="#210">210: </a><span class="php-comment"> * @param array $config tableau de configuration |
</span></span><span id="211" class="l"><a class="l" href="#211">211: </a><span class="php-comment"> * @param string $cle la clé dont il faut évaluer les références |
</span></span><span id="212" class="l"><a class="l" href="#212">212: </a><span class="php-comment"> */</span> |
</span><span id="213" class="l"><a class="l" href="#213">213: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_evaluerReferences" href="#_evaluerReferences">evaluerReferences</a>(&<span class="php-var">$config</span>, <span class="php-var">$cle</span>) { |
</span><span id="214" class="l"><a class="l" href="#214">214: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">preg_match_all</span>(<span class="php-quote">'/{ref:([A-Za-z0-9_.-]+)}/'</span>, <span class="php-var">$config</span>[<span class="php-var">$cle</span>], <span class="php-var">$correspondances</span>, PREG_SET_ORDER)) { |
</span><span id="215" class="l"><a class="l" href="#215">215: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$correspondances</span> <span class="php-keyword1">as</span> <span class="php-var">$ref</span>) { |
</span><span id="216" class="l"><a class="l" href="#216">216: </a> <span class="php-var">$config</span>[<span class="php-var">$cle</span>] = <span class="php-keyword2">str_replace</span>(<span class="php-var">$ref</span>[<span class="php-num">0</span>], self::getValeur(<span class="php-var">$ref</span>[<span class="php-num">1</span>], self::<span class="php-var">$parametres</span>), <span class="php-var">$config</span>[<span class="php-var">$cle</span>]); |
</span><span id="217" class="l"><a class="l" href="#217">217: </a> } |
</span><span id="218" class="l"><a class="l" href="#218">218: </a> } |
</span><span id="219" class="l"><a class="l" href="#219">219: </a> } |
</span><span id="220" class="l"><a class="l" href="#220">220: </a> |
</span><span id="221" class="l"><a class="l" href="#221">221: </a> <span class="php-comment">/** |
</span></span><span id="222" class="l"><a class="l" href="#222">222: </a><span class="php-comment"> * Évalue le code php contenu dans un clé tu tableau config. |
</span></span><span id="223" class="l"><a class="l" href="#223">223: </a><span class="php-comment"> * @param array $config tableau de configuration (par référence) |
</span></span><span id="224" class="l"><a class="l" href="#224">224: </a><span class="php-comment"> * @param string $cle le clé du tableau dont il faut évaluer la valeur |
</span></span><span id="225" class="l"><a class="l" href="#225">225: </a><span class="php-comment"> */</span> |
</span><span id="226" class="l"><a class="l" href="#226">226: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_evaluerPhp" href="#_evaluerPhp">evaluerPhp</a>(&<span class="php-var">$config</span>, <span class="php-var">$cle</span>) { |
</span><span id="227" class="l"><a class="l" href="#227">227: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">preg_match</span>(<span class="php-quote">'/^php:(.+)$/'</span>, <span class="php-var">$config</span>[<span class="php-var">$cle</span>], <span class="php-var">$correspondances</span>)) { |
</span><span id="228" class="l"><a class="l" href="#228">228: </a> <span class="php-keyword2">eval</span>(<span class="php-quote">'$config["'</span>.<span class="php-var">$cle</span>.<span class="php-quote">'"] = '</span>.<span class="php-var">$correspondances</span>[<span class="php-num">1</span>].<span class="php-quote">';'</span>); |
</span><span id="229" class="l"><a class="l" href="#229">229: </a> } |
</span><span id="230" class="l"><a class="l" href="#230">230: </a> } |
</span><span id="231" class="l"><a class="l" href="#231">231: </a> |
</span><span id="232" class="l"><a class="l" href="#232">232: </a> <span class="php-comment">/** |
</span></span><span id="233" class="l"><a class="l" href="#233">233: </a><span class="php-comment"> * Charge un fichier ini dans le tableau des paramètres de l'appli. |
</span></span><span id="234" class="l"><a class="l" href="#234">234: </a><span class="php-comment"> * @param string $fichier_ini le nom du fichier à charger |
</span></span><span id="235" class="l"><a class="l" href="#235">235: </a><span class="php-comment"> * @return array le fichier ini parsé |
</span></span><span id="236" class="l"><a class="l" href="#236">236: </a><span class="php-comment"> */</span> |
</span><span id="237" class="l"><a class="l" href="#237">237: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_charger" href="#_charger">charger</a>(<span class="php-var">$fichier_ini</span>) { |
</span><span id="238" class="l"><a class="l" href="#238">238: </a> self::verifierCreationInstance(); |
</span><span id="239" class="l"><a class="l" href="#239">239: </a> <span class="php-keyword1">return</span> self::parserFichierIni(<span class="php-var">$fichier_ini</span>); |
</span><span id="240" class="l"><a class="l" href="#240">240: </a> } |
</span><span id="241" class="l"><a class="l" href="#241">241: </a> |
</span><span id="242" class="l"><a class="l" href="#242">242: </a> <span class="php-comment">/** |
</span></span><span id="243" class="l"><a class="l" href="#243">243: </a><span class="php-comment"> * Accesseur pour la valeur d'un paramètre. |
</span></span><span id="244" class="l"><a class="l" href="#244">244: </a><span class="php-comment"> * @param string $param le nom du paramètre |
</span></span><span id="245" class="l"><a class="l" href="#245">245: </a><span class="php-comment"> * @return string la valeur du paramètre |
</span></span><span id="246" class="l"><a class="l" href="#246">246: </a><span class="php-comment"> */</span> |
</span><span id="247" class="l"><a class="l" href="#247">247: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_get" href="#_get">get</a>(<span class="php-var">$param</span> = <span class="php-keyword1">null</span>) { |
</span><span id="248" class="l"><a class="l" href="#248">248: </a> self::verifierCreationInstance(); |
</span><span id="249" class="l"><a class="l" href="#249">249: </a> <span class="php-keyword1">return</span> self::getValeur(<span class="php-var">$param</span>, self::<span class="php-var">$parametres</span>); |
</span><span id="250" class="l"><a class="l" href="#250">250: </a> } |
</span><span id="251" class="l"><a class="l" href="#251">251: </a> |
</span><span id="252" class="l"><a class="l" href="#252">252: </a> <span class="php-comment">/** |
</span></span><span id="253" class="l"><a class="l" href="#253">253: </a><span class="php-comment"> * Vérifie si la valeur d'un paramètre existe. |
</span></span><span id="254" class="l"><a class="l" href="#254">254: </a><span class="php-comment"> * @param string $param le nom du paramètre |
</span></span><span id="255" class="l"><a class="l" href="#255">255: </a><span class="php-comment"> * @return boolean vrai si le paramètre existe, false sinon |
</span></span><span id="256" class="l"><a class="l" href="#256">256: </a><span class="php-comment"> */</span> |
</span><span id="257" class="l"><a class="l" href="#257">257: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_existe" href="#_existe">existe</a>(<span class="php-var">$param</span>) { |
</span><span id="258" class="l"><a class="l" href="#258">258: </a> self::verifierCreationInstance(); |
</span><span id="259" class="l"><a class="l" href="#259">259: </a> <span class="php-keyword1">return</span> self::existeValeur(<span class="php-var">$param</span>, self::<span class="php-var">$parametres</span>); |
</span><span id="260" class="l"><a class="l" href="#260">260: </a> } |
</span><span id="261" class="l"><a class="l" href="#261">261: </a> |
</span><span id="262" class="l"><a class="l" href="#262">262: </a> <span class="php-comment">/** |
</span></span><span id="263" class="l"><a class="l" href="#263">263: </a><span class="php-comment"> * Vérifie que tous les paramêtres de config nécessaires au fonctionnement d'une classe existe dans les fichiers |
</span></span><span id="264" class="l"><a class="l" href="#264">264: </a><span class="php-comment"> * de configurations. |
</span></span><span id="265" class="l"><a class="l" href="#265">265: </a><span class="php-comment"> * L'utilisation de cette méthode depuis la classe Config évite de faire appel à une classe supplémentaire. |
</span></span><span id="266" class="l"><a class="l" href="#266">266: </a><span class="php-comment"> * |
</span></span><span id="267" class="l"><a class="l" href="#267">267: </a><span class="php-comment"> * @param array $parametres tableau des noms des paramètres de la config à verifier. |
</span></span><span id="268" class="l"><a class="l" href="#268">268: </a><span class="php-comment"> * @return boolean true si tous les paramétres sont présents sinon false. |
</span></span><span id="269" class="l"><a class="l" href="#269">269: </a><span class="php-comment"> */</span> |
</span><span id="270" class="l"><a class="l" href="#270">270: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_verifierPresenceParametres" href="#_verifierPresenceParametres">verifierPresenceParametres</a>(<span class="php-keyword1">Array</span> <span class="php-var">$parametres</span>) { |
</span><span id="271" class="l"><a class="l" href="#271">271: </a> <span class="php-var">$ok</span> = <span class="php-keyword1">true</span>; |
</span><span id="272" class="l"><a class="l" href="#272">272: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$parametres</span> <span class="php-keyword1">as</span> <span class="php-var">$param</span>) { |
</span><span id="273" class="l"><a class="l" href="#273">273: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_null</span>(self::get(<span class="php-var">$param</span>))) { |
</span><span id="274" class="l"><a class="l" href="#274">274: </a> <span class="php-var">$classe</span> = <span class="php-keyword2">get_class</span>(); |
</span><span id="275" class="l"><a class="l" href="#275">275: </a> <span class="php-var">$m</span> = <span class="php-quote">"L'utilisation de la classe </span><span class="php-var">$classe</span><span class="php-quote"> nécessite de définir '</span><span class="php-var">$param</span><span class="php-quote">' dans un fichier de configuration."</span>; |
</span><span id="276" class="l"><a class="l" href="#276">276: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$m</span>, E_USER_ERROR); |
</span><span id="277" class="l"><a class="l" href="#277">277: </a> <span class="php-var">$ok</span> = <span class="php-keyword1">false</span>; |
</span><span id="278" class="l"><a class="l" href="#278">278: </a> } |
</span><span id="279" class="l"><a class="l" href="#279">279: </a> } |
</span><span id="280" class="l"><a class="l" href="#280">280: </a> <span class="php-keyword1">return</span> <span class="php-var">$ok</span>; |
</span><span id="281" class="l"><a class="l" href="#281">281: </a> } |
</span><span id="282" class="l"><a class="l" href="#282">282: </a>} |
</span><span id="283" class="l"><a class="l" href="#283">283: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Cache.html |
---|
New file |
0,0 → 1,1339 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Cache | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li class="active"><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Cache</h1> |
<div class="description"> |
<p>Classe Cache permettant de mettre en cache des données. Basée sur les |
principes de Zend_Cache (Copyright (c) 2005-2010, Zend Technologies USA, Inc. |
All rights reserved.)</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
php 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://framework.zend.com/license/new-bsd">Licence New BSD</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL</a><br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Cache.php 299 2011-01-18 14:03:46Z jpm $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Cache.html#3-507" title="Go to source code">framework/Cache.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="__construct" id="___construct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___construct">#</a> |
<code><a href="source-class-Cache.html#98-110" title="Go to source code">__construct</a>( <span>mixed <var>$options</var> = <span class="php-keyword1">array</span>()</span>, <span>mixed <var>$options_stockage</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="setEmplacement" id="_setEmplacement"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setEmplacement">#</a> |
<code><a href="source-class-Cache.html#132-146" title="Go to source code">setEmplacement</a>( <span>string <var>$emplacement</var></span> )</code> |
<div class="description short"> |
<p>Permet de (re-)définir l'emplacement pour le stockage du cache. En fonction |
du mode de stockage utilisé , l'emplacement indiqué correspondra au chemin du |
:<br /> |
- dossier où stocker les fichiers pour le mode "fichier".<br /> |
- fichier de la base de données pour le mode "sqlite".</p> |
</div> |
<div class="description detailed hidden"> |
<p>Permet de (re-)définir l'emplacement pour le stockage du cache. En fonction |
du mode de stockage utilisé , l'emplacement indiqué correspondra au chemin du |
: - dossier où stocker les fichiers pour le mode "fichier". - fichier de la |
base de données pour le mode "sqlite".</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$emplacement</var></dt> |
<dd><code>string</code><br>$emplacement chemin vers dossier (Cache::STOCKAGE_MODE_FICHIER) ou fichier base |
Sqlite (Cache::STOCKAGE_MODE_SQLITE)</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="fabriquer" id="_fabriquer"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_fabriquer">#</a> |
<code><a href="source-class-Cache.html#148-155" title="Go to source code">fabriquer</a>( <span>mixed <var>$mode</var></span>, <span>mixed <var>$options</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="charger" id="_charger"> |
<td class="attributes"><code> |
public |
mixed|false |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_charger">#</a> |
<code><a href="source-class-Cache.html#157-174" title="Go to source code">charger</a>( <span>string <var>$id</var></span>, <span>boolean <var>$ne_pas_tester_validiter_du_cache</var> = <span class="php-keyword1">false</span></span> )</code> |
<div class="description short"> |
<p>Teste si un cache est disponible pour l'identifiant donné et (si oui) le |
retourne (false dans le cas contraire)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Teste si un cache est disponible pour l'identifiant donné et (si oui) le |
retourne (false dans le cas contraire)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Identifiant de cache.</dd> |
<dt><var>$ne_pas_tester_validiter_du_cache</var></dt> |
<dd><code>boolean</code><br>$ne_pas_tester_validiter_du_cache Si mis à true, la validité du cache n'est |
pas testée</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed|false</code><br>Cached datas<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="tester" id="_tester"> |
<td class="attributes"><code> |
public |
integer|false |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_tester">#</a> |
<code><a href="source-class-Cache.html#176-191" title="Go to source code">tester</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Test if a cache is available for the given id</p> |
</div> |
<div class="description detailed hidden"> |
<p>Test if a cache is available for the given id</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>integer|false</code><br>Last modified time of cache entry if it is available, false otherwise<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="sauver" id="_sauver"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_sauver">#</a> |
<code><a href="source-class-Cache.html#193-222" title="Go to source code">sauver</a>( <span>mixed <var>$donnees</var></span>, <span>string <var>$id</var> = <span class="php-keyword1">null</span></span>, <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span>, <span>integer <var>$duree_de_vie_specifique</var> = <span class="php-keyword1">false</span></span> )</code> |
<div class="description short"> |
<p>Sauvegarde en cache les données passées en paramètre.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Sauvegarde en cache les données passées en paramètre.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$donnees</var></dt> |
<dd><code>mixed</code><br>$donnees Données à mettre en cache (peut être différent d'une chaine si |
serialisation_auto vaut true).</dd> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Identifiant du cache (s'il n'est pas définit, le dernier identifiant sera |
utilisé).</dd> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags Mots-clés du cache.</dd> |
<dt><var>$duree_de_vie_specifique</var></dt> |
<dd><code>integer</code><br>$duree_de_vie_specifique Si != false, indique une durée de vie spécifique pour |
cet enregistrement en cache (null => durée de vie infinie)</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True si aucun problème n'est survenu.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="supprimer" id="_supprimer"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_supprimer">#</a> |
<code><a href="source-class-Cache.html#224-238" title="Go to source code">supprimer</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Supprime un enregistrement en cache.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Supprime un enregistrement en cache.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Identificant du cache à supprimer.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True si ok<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="nettoyer" id="_nettoyer"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_nettoyer">#</a> |
<code><a href="source-class-Cache.html#240-269" title="Go to source code">nettoyer</a>( <span>string <var>$mode</var> = <code><a href="class-Cache.html#NETTOYAGE_MODE_TOUS">Cache::<b>NETTOYAGE_MODE_TOUS</b></a></code></span>, <span>array|string <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Nettoyage des enregistrements en cache</p> |
</div> |
<div class="description detailed hidden"> |
<p>Nettoyage des enregistrements en cache</p> |
<p>Mode de nettoyage disponibles : 'tous' (défaut) => supprime tous les |
enregistrements ($tags n'est pas utilisé) 'expiration' => supprime tous les |
enregistrements dont la date d'expériration est dépassée ($tags n'est pas |
utilisé) 'avecLesTag' => supprime tous les enregistrements contenant tous |
les tags indiqués 'sansLesTag' => supprime tous les enregistrements |
contenant aucun des tags indiqués 'avecUnTag' => supprime tous les |
enregistrements contenant au moins un des tags indiqués</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$mode</var></dt> |
<dd><code>string</code><br>$mode mode de nettoyage</dd> |
<dt><var>$tags</var></dt> |
<dd><code>array|string</code><br>$tags peut être un tableau de chaîne ou une simple chaine.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True si ok<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIds" id="_getIds"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIds">#</a> |
<code><a href="source-class-Cache.html#271-280" title="Go to source code">getIds</a>( )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of stored cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getTags" id="_getTags"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getTags">#</a> |
<code><a href="source-class-Cache.html#282-289" title="Go to source code">getTags</a>( )</code> |
<div class="description short"> |
<p>Return an array of stored tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored tags</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of stored tags (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIdsAvecLesTags" id="_getIdsAvecLesTags"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIdsAvecLesTags">#</a> |
<code><a href="source-class-Cache.html#291-303" title="Go to source code">getIdsAvecLesTags</a>( <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids which match given tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids which match given tags</p> |
<p>In case of multiple tags, a logical AND is made between tags</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of matching cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIdsSansLesTags" id="_getIdsSansLesTags"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIdsSansLesTags">#</a> |
<code><a href="source-class-Cache.html#305-317" title="Go to source code">getIdsSansLesTags</a>( <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids which don't match given tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids which don't match given tags</p> |
<p>In case of multiple tags, a logical OR is made between tags</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of not matching cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIdsAvecUnTag" id="_getIdsAvecUnTag"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIdsAvecUnTag">#</a> |
<code><a href="source-class-Cache.html#319-331" title="Go to source code">getIdsAvecUnTag</a>( <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids which match any given tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids which match any given tags</p> |
<p>In case of multiple tags, a logical OR is made between tags</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of matching any cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getPourcentageRemplissage" id="_getPourcentageRemplissage"> |
<td class="attributes"><code> |
public |
integer |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getPourcentageRemplissage">#</a> |
<code><a href="source-class-Cache.html#333-340" title="Go to source code">getPourcentageRemplissage</a>( )</code> |
<div class="description short"> |
<p>Return the filling percentage of the backend storage</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return the filling percentage of the backend storage</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>integer</code><br>integer between 0 and 100<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getMetadonnees" id="_getMetadonnees"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getMetadonnees">#</a> |
<code><a href="source-class-Cache.html#342-356" title="Go to source code">getMetadonnees</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Return an array of metadatas for the given cache id</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of metadatas for the given cache id</p> |
<p>The array will include these keys :</p> |
<ul> |
<li>expire : the expire timestamp</li> |
<li>tags : a string array of tags</li> |
<li>mtime : timestamp of last modification time</li> |
</ul> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of metadatas (false if the cache id is not found)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="ajouterSupplementDureeDeVie" id="_ajouterSupplementDureeDeVie"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_ajouterSupplementDureeDeVie">#</a> |
<code><a href="source-class-Cache.html#358-368" title="Go to source code">ajouterSupplementDureeDeVie</a>( <span>string <var>$id</var></span>, <span>integer <var>$supplement_duree_de_vie</var></span> )</code> |
<div class="description short"> |
<p>Give (if possible) an extra lifetime to the given cache id</p> |
</div> |
<div class="description detailed hidden"> |
<p>Give (if possible) an extra lifetime to the given cache id</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id cache id</dd> |
<dt><var>$supplement_duree_de_vie</var></dt> |
<dd><code>integer</code><br>$extraLifetime</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true if ok<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="validerIdOuTag" id="_validerIdOuTag"> |
<td class="attributes"><code> |
protected static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_validerIdOuTag">#</a> |
<code><a href="source-class-Cache.html#456-472" title="Go to source code">validerIdOuTag</a>( <span>string <var>$chaine</var></span> )</code> |
<div class="description short"> |
<p>Valide un identifiant de cache ou un tag (securité, nom de fichiers fiables, |
préfixes réservés...)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Valide un identifiant de cache ou un tag (securité, nom de fichiers fiables, |
préfixes réservés...)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$chaine</var></dt> |
<dd><code>string</code><br>$chaine Identificant de cache ou tag</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="validerTableauDeTags" id="_validerTableauDeTags"> |
<td class="attributes"><code> |
protected static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_validerTableauDeTags">#</a> |
<code><a href="source-class-Cache.html#474-488" title="Go to source code">validerTableauDeTags</a>( <span>array <var>$tags</var></span> )</code> |
<div class="description short"> |
<p>Valide un tableau de tags (securité, nom de fichiers fiables, préfixes |
réservés...)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Valide un tableau de tags (securité, nom de fichiers fiables, préfixes |
réservés...)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags tableau de tags</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getTimestampExpiration" id="_getTimestampExpiration"> |
<td class="attributes"><code> |
public |
integer |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getTimestampExpiration">#</a> |
<code><a href="source-class-Cache.html#490-505" title="Go to source code">getTimestampExpiration</a>( <span>mixed <var>$duree_de_vie</var></span> )</code> |
<div class="description short"> |
<p>Calcule et retourne le timestamp d'expiration</p> |
</div> |
<div class="description detailed hidden"> |
<p>Calcule et retourne le timestamp d'expiration</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>integer</code><br>timestamp d'expiration (unix timestamp)<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="constants"> |
<caption>Constants summary</caption> |
<tr data-order="STOCKAGE_MODE_SIMPLE" id="STOCKAGE_MODE_SIMPLE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Cache.html#18-19" title="Go to source code"><b>STOCKAGE_MODE_SIMPLE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"FichierSimple"</span></code></td> |
<td class="description"><div> |
<a href="#STOCKAGE_MODE_SIMPLE" class="anchor">#</a> |
<div class="description short"> |
<p>Socke les enregistrements du cache dans des fichiers textes de façon |
extremement simple.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Socke les enregistrements du cache dans des fichiers textes de façon |
extremement simple.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="STOCKAGE_MODE_FICHIER" id="STOCKAGE_MODE_FICHIER"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Cache.html#20-21" title="Go to source code"><b>STOCKAGE_MODE_FICHIER</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"Fichier"</span></code></td> |
<td class="description"><div> |
<a href="#STOCKAGE_MODE_FICHIER" class="anchor">#</a> |
<div class="description short"> |
<p>Socke les enregistrements du cache dans des fichiers textes.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Socke les enregistrements du cache dans des fichiers textes.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="STOCKAGE_MODE_SQLITE" id="STOCKAGE_MODE_SQLITE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Cache.html#22-23" title="Go to source code"><b>STOCKAGE_MODE_SQLITE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"Sqlite"</span></code></td> |
<td class="description"><div> |
<a href="#STOCKAGE_MODE_SQLITE" class="anchor">#</a> |
<div class="description short"> |
<p>Socke les enregistrements du cache dans une base de données SQLite.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Socke les enregistrements du cache dans une base de données SQLite.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="NETTOYAGE_MODE_TOUS" id="NETTOYAGE_MODE_TOUS"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Cache.html#25-26" title="Go to source code"><b>NETTOYAGE_MODE_TOUS</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"tous"</span></code></td> |
<td class="description"><div> |
<a href="#NETTOYAGE_MODE_TOUS" class="anchor">#</a> |
<div class="description short"> |
<p>'tous' (par défaut) : supprime tous les enregistrements.</p> |
</div> |
<div class="description detailed hidden"> |
<p>'tous' (par défaut) : supprime tous les enregistrements.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="NETTOYAGE_MODE_EXPIRATION" id="NETTOYAGE_MODE_EXPIRATION"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Cache.html#27-28" title="Go to source code"><b>NETTOYAGE_MODE_EXPIRATION</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"expiration"</span></code></td> |
<td class="description"><div> |
<a href="#NETTOYAGE_MODE_EXPIRATION" class="anchor">#</a> |
<div class="description short"> |
<p>'expiration' : supprime tous les enregistrements dont la date d'expériration |
est dépassée.</p> |
</div> |
<div class="description detailed hidden"> |
<p>'expiration' : supprime tous les enregistrements dont la date d'expériration |
est dépassée.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="NETTOYAGE_MODE_AVEC_LES_TAGS" id="NETTOYAGE_MODE_AVEC_LES_TAGS"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Cache.html#29-30" title="Go to source code"><b>NETTOYAGE_MODE_AVEC_LES_TAGS</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"avecLesTags"</span></code></td> |
<td class="description"><div> |
<a href="#NETTOYAGE_MODE_AVEC_LES_TAGS" class="anchor">#</a> |
<div class="description short"> |
<p>'avecLesTags' : supprime tous les enregistrements contenant tous les tags |
indiqués.</p> |
</div> |
<div class="description detailed hidden"> |
<p>'avecLesTags' : supprime tous les enregistrements contenant tous les tags |
indiqués.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="NETTOYAGE_MODE_SANS_LES_TAGS" id="NETTOYAGE_MODE_SANS_LES_TAGS"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Cache.html#31-32" title="Go to source code"><b>NETTOYAGE_MODE_SANS_LES_TAGS</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"sansLesTags"</span></code></td> |
<td class="description"><div> |
<a href="#NETTOYAGE_MODE_SANS_LES_TAGS" class="anchor">#</a> |
<div class="description short"> |
<p>'sansLesTags' : supprime tous les enregistrements contenant aucun des tags |
indiqués.</p> |
</div> |
<div class="description detailed hidden"> |
<p>'sansLesTags' : supprime tous les enregistrements contenant aucun des tags |
indiqués.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="NETTOYAGE_MODE_AVEC_UN_TAG" id="NETTOYAGE_MODE_AVEC_UN_TAG"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Cache.html#33-34" title="Go to source code"><b>NETTOYAGE_MODE_AVEC_UN_TAG</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"avecUnTag"</span></code></td> |
<td class="description"><div> |
<a href="#NETTOYAGE_MODE_AVEC_UN_TAG" class="anchor">#</a> |
<div class="description short"> |
<p>'avecUnTag' : supprime tous les enregistrements contenant au moins un des |
tags indiqués.</p> |
</div> |
<div class="description detailed hidden"> |
<p>'avecUnTag' : supprime tous les enregistrements contenant au moins un des |
tags indiqués.</p> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr data-order="options" id="$options"> |
<td class="attributes"><code> |
protected |
array |
</code></td> |
<td class="name"> |
<a href="source-class-Cache.html#43-94" title="Go to source code"><var>$options</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">array</span>( |
<span class="php-quote">'stockage_mode'</span> => self::STOCKAGE_MODE_FICHIER, |
<span class="php-quote">'stockage_chemin'</span> => <span class="php-keyword1">null</span>, |
<span class="php-quote">'controle_ecriture'</span> => <span class="php-keyword1">true</span>, |
<span class="php-quote">'mise_en_cache'</span> => <span class="php-keyword1">true</span>, |
<span class="php-quote">'cache_id_prefixe'</span> => <span class="php-keyword1">null</span>, |
<span class="php-quote">'serialisation_auto'</span> => <span class="php-keyword1">false</span>, |
<span class="php-quote">'nettoyage_auto'</span> => <span class="php-num">10</span>, |
<span class="php-quote">'duree_de_vie'</span> => <span class="php-num">3600</span>, |
)</code></td> |
<td class="description"><div> |
<a href="#$options" class="anchor">#</a> |
<div class="description short"> |
<p>Les options disponibles pour le cache :</p> |
<h1>> (string) stockage_mode :</h1> |
<p>Indique le mode de stockage du cache à utiliser parmis :</p> |
<ul> |
<li>Cache::STOCKAGE_MODE_FICHIER : sous forme d'une arborescence de fichiers et |
dossier</li> |
<li>Cache::STOCKAGE_MODE_SQLITE : sous forme d'une base de données SQLite</li> |
</ul> |
</div> |
<div class="description detailed hidden"> |
<p>Les options disponibles pour le cache :</p> |
<h2>> (string) stockage_mode :</h2> |
<p>Indique le mode de stockage du cache à utiliser parmis :</p> |
<ul> |
<li>Cache::STOCKAGE_MODE_FICHIER : sous forme d'une arborescence de fichiers et |
dossier</li> |
<li>Cache::STOCKAGE_MODE_SQLITE : sous forme d'une base de données SQLite</li> |
</ul> |
<h2>> (string) stockage_chemin :</h2> |
<p>Chemin vers :</p> |
<ul> |
<li>Cache::STOCKAGE_MODE_FICHIER : le dossier devant contenir |
l'arborescence.</li> |
<li>Cache::STOCKAGE_MODE_SQLITE : le fichier contenant la base SQLite.</li> |
</ul> |
<h2>> (boolean) controle_ecriture :</h2> |
<ul> |
<li>Active / Désactive le controle d'écriture (le cache est lue jute après |
l'écriture du fichier pour détecter sa corruption)</li> |
<li>Activer le controle d'écriture ralentira légèrement l'écriture du |
fichier de cache mais pas sa lecture</li> |
</ul> |
<p>Le controle d'écriture peut détecter la corruption de fichier mais ce n'est |
pas un système de controle parfait.</p> |
<h2>> (boolean) mise_en_cache :</h2> |
<ul> |
<li>Active / Désactive la mise en cache</li> |
</ul> |
<p>(peut être très utile pour le débogage des scripts utilisant le cache</p> |
<h1>> (string) cache_id_prefixe :</h1> |
<ul> |
<li>préfixe pour les identifiant de cache ( = espace de nom)</li> |
</ul> |
<h2>> (boolean) serialisation_auto :</h2> |
<ul> |
<li>Active / Désactive la sérialisation automatique</li> |
<li>Peut être utilisé pour sauver directement des données qui ne sont pas des |
chaines (mais c'est plus lent)</li> |
</ul> |
<h2>> (int) nettoyage_auto :</h2> |
<ul> |
<li>Désactive / Régler le processus de nettoyage automatique</li> |
<li>Le processus de nettoyage automatiques détruit les fichier trop vieux (pour |
la durée de vie donnée) quand un nouveau fichier de cache est écrit : 0 => |
pas de nettoyage automatique 1 => nettoyage automatique systématique x |
(integer) > 1 => nettoyage automatique toutes les 1 fois (au hasard) sur x |
écriture de fichier de cache</li> |
</ul> |
<h2>> (int) duree_de_vie :</h2> |
<ul> |
<li>Durée de vie du cache (en secondes)</li> |
<li>Si null, le cache est valide indéfiniment.</li> |
</ul> |
</div> |
</div></td> |
</tr> |
<tr data-order="stockage" id="$stockage"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-Cache.html#96" title="Go to source code"><var>$stockage</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">null</span></code></td> |
<td class="description"><div> |
<a href="#$stockage" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-ServiceCacheSqlite.html |
---|
New file |
0,0 → 1,208 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File exemples/services/modules/0.1/ServiceCacheSqlite.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li class="active"><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-ServiceCacheSqlite.html" title="Summary of ServiceCacheSqlite"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-keyword1">class</span> <a id="ServiceCacheSqlite" href="#ServiceCacheSqlite">ServiceCacheSqlite</a> <span class="php-keyword1">extends</span> RestService { |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a> |
</span><span id="4" class="l"><a class="l" href="#4"> 4: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_consulter" href="#_consulter">consulter</a>(<span class="php-var">$ressources</span>, <span class="php-var">$parametres</span>) { |
</span><span id="5" class="l"><a class="l" href="#5"> 5: </a> <span class="php-comment">// Redéfinition ici mais peut être configuré depuis le fichier config.ini</span> |
</span><span id="6" class="l"><a class="l" href="#6"> 6: </a> <span class="php-var">$options</span> = <span class="php-keyword1">array</span>( |
</span><span id="7" class="l"><a class="l" href="#7"> 7: </a> <span class="php-quote">'stockage_mode'</span> => Cache::STOCKAGE_MODE_SQLITE, |
</span><span id="8" class="l"><a class="l" href="#8"> 8: </a> <span class="php-quote">'stockage_chemin'</span> => Fichier::getDossierTmp().DS.<span class="php-quote">'cache.sqlite'</span>, |
</span><span id="9" class="l"><a class="l" href="#9"> 9: </a> <span class="php-quote">'controle_ecriture'</span> => <span class="php-keyword1">false</span>, |
</span><span id="10" class="l"><a class="l" href="#10">10: </a> <span class="php-quote">'mise_en_cache'</span> => <span class="php-keyword1">true</span>, |
</span><span id="11" class="l"><a class="l" href="#11">11: </a> <span class="php-quote">'cache_id_prefixe'</span> => <span class="php-keyword1">null</span>, |
</span><span id="12" class="l"><a class="l" href="#12">12: </a> <span class="php-quote">'serialisation_auto'</span> => <span class="php-keyword1">false</span>, |
</span><span id="13" class="l"><a class="l" href="#13">13: </a> <span class="php-quote">'nettoyage_auto'</span> => <span class="php-num">10</span>, |
</span><span id="14" class="l"><a class="l" href="#14">14: </a> <span class="php-quote">'duree_de_vie'</span> => <span class="php-num">3600</span>, |
</span><span id="15" class="l"><a class="l" href="#15">15: </a> ); |
</span><span id="16" class="l"><a class="l" href="#16">16: </a> <span class="php-var">$cache</span> = <span class="php-keyword1">new</span> Cache(<span class="php-var">$options</span>); |
</span><span id="17" class="l"><a class="l" href="#17">17: </a> |
</span><span id="18" class="l"><a class="l" href="#18">18: </a> <span class="php-var">$id</span> = <span class="php-quote">'monCache'</span>; <span class="php-comment">// id de cache de "ce que l'on veut cacher"</span> |
</span><span id="19" class="l"><a class="l" href="#19">19: </a> <span class="php-var">$id01</span> = <span class="php-var">$id</span>.<span class="php-quote">'01'</span>; |
</span><span id="20" class="l"><a class="l" href="#20">20: </a> <span class="php-var">$id02</span> = <span class="php-var">$id</span>.<span class="php-quote">'02'</span>; |
</span><span id="21" class="l"><a class="l" href="#21">21: </a> <span class="php-var">$id03</span> = <span class="php-var">$id</span>.<span class="php-quote">'03'</span>; |
</span><span id="22" class="l"><a class="l" href="#22">22: </a> <span class="php-keyword1">if</span> (!(<span class="php-var">$donnees</span> = <span class="php-var">$cache</span>->charger(<span class="php-var">$id01</span>))) { |
</span><span id="23" class="l"><a class="l" href="#23">23: </a> <span class="php-var">$donnees</span> = <span class="php-quote">'Mise en cache à : '</span>.<span class="php-keyword2">strftime</span>(<span class="php-quote">'%A %d %B %Y à %H:%M:%S'</span>, <span class="php-keyword2">time</span>()).<span class="php-quote">'<br/>'</span>; |
</span><span id="24" class="l"><a class="l" href="#24">24: </a> <span class="php-keyword1">for</span> (<span class="php-var">$i</span> = <span class="php-num">0</span>; <span class="php-var">$i</span> < <span class="php-num">100000</span>; <span class="php-var">$i</span>++) { |
</span><span id="25" class="l"><a class="l" href="#25">25: </a> <span class="php-var">$donnees</span> .= <span class="php-var">$i</span>; |
</span><span id="26" class="l"><a class="l" href="#26">26: </a> } |
</span><span id="27" class="l"><a class="l" href="#27">27: </a> <span class="php-var">$cache</span>->sauver(<span class="php-var">$donnees</span>, <span class="php-var">$id01</span>); |
</span><span id="28" class="l"><a class="l" href="#28">28: </a> <span class="php-var">$cache</span>->sauver(<span class="php-var">$donnees</span>, <span class="php-var">$id02</span>, <span class="php-keyword1">array</span>(<span class="php-quote">'tagTest01'</span>)); |
</span><span id="29" class="l"><a class="l" href="#29">29: </a> <span class="php-var">$cache</span>->sauver(<span class="php-var">$donnees</span>, <span class="php-var">$id03</span>, <span class="php-keyword1">array</span>(<span class="php-quote">'tagTest01'</span>,<span class="php-quote">'tagTest02'</span>, <span class="php-quote">'tagTest03'</span>)); |
</span><span id="30" class="l"><a class="l" href="#30">30: </a> } |
</span><span id="31" class="l"><a class="l" href="#31">31: </a> <span class="php-comment">// Affichage des données</span> |
</span><span id="32" class="l"><a class="l" href="#32">32: </a> <span class="php-keyword1">echo</span> <span class="php-var">$donnees</span>.<span class="php-quote">'<br/>'</span>; |
</span><span id="33" class="l"><a class="l" href="#33">33: </a> |
</span><span id="34" class="l"><a class="l" href="#34">34: </a> <span class="php-comment">// Affichage des ids du cache</span> |
</span><span id="35" class="l"><a class="l" href="#35">35: </a> <span class="php-keyword1">echo</span> <span class="php-quote">'Ids des enregistrements en cache : <pre>'</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$cache</span>->getIds(), <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="36" class="l"><a class="l" href="#36">36: </a> |
</span><span id="37" class="l"><a class="l" href="#37">37: </a> <span class="php-comment">// Affichage des ids du cache</span> |
</span><span id="38" class="l"><a class="l" href="#38">38: </a> <span class="php-keyword1">echo</span> <span class="php-quote">'Tags des enregistrements en cache : <pre>'</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$cache</span>->getTags(), <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="39" class="l"><a class="l" href="#39">39: </a> |
</span><span id="40" class="l"><a class="l" href="#40">40: </a> <span class="php-comment">// Affichage des ids du cache pour un tag donnée</span> |
</span><span id="41" class="l"><a class="l" href="#41">41: </a> <span class="php-var">$tag01</span> = <span class="php-quote">'tagTest01'</span>; |
</span><span id="42" class="l"><a class="l" href="#42">42: </a> <span class="php-var">$tag02</span> = <span class="php-quote">'tagTest02'</span>; |
</span><span id="43" class="l"><a class="l" href="#43">43: </a> <span class="php-var">$tag03</span> = <span class="php-quote">'tagTest03'</span>; |
</span><span id="44" class="l"><a class="l" href="#44">44: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Ids avec les tag '</span><span class="php-var">$tag02</span><span class="php-quote">, </span><span class="php-var">$tag03</span><span class="php-quote">' : "</span>.<span class="php-quote">'<pre>'</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$cache</span>->getIdsAvecLesTags(<span class="php-keyword1">array</span>(<span class="php-var">$tag02</span>, <span class="php-var">$tag03</span>)), <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="45" class="l"><a class="l" href="#45">45: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Ids possédant le tag '</span><span class="php-var">$tag01</span><span class="php-quote">' : "</span>.<span class="php-quote">'<pre>'</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$cache</span>->getIdsAvecUnTag(<span class="php-keyword1">array</span>(<span class="php-var">$tag01</span>)), <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="46" class="l"><a class="l" href="#46">46: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Ids sans les tag '</span><span class="php-var">$tag01</span><span class="php-quote">, </span><span class="php-var">$tag02</span><span class="php-quote">' : "</span>.<span class="php-quote">'<pre>'</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$cache</span>->getIdsSansLesTags(<span class="php-keyword1">array</span>(<span class="php-var">$tag01</span>, <span class="php-var">$tag02</span>)), <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="47" class="l"><a class="l" href="#47">47: </a> |
</span><span id="48" class="l"><a class="l" href="#48">48: </a> <span class="php-comment">// Test du test de l'existence du cache</span> |
</span><span id="49" class="l"><a class="l" href="#49">49: </a> <span class="php-var">$id_test</span> = <span class="php-var">$id01</span>; |
</span><span id="50" class="l"><a class="l" href="#50">50: </a> <span class="php-keyword1">echo</span> (<span class="php-var">$cache</span>->tester(<span class="php-var">$id_test</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id_test</span><span class="php-quote">' existe"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id_test</span><span class="php-quote">' devrait exister"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="51" class="l"><a class="l" href="#51">51: </a> |
</span><span id="52" class="l"><a class="l" href="#52">52: </a> <span class="php-comment">// Affichage du pourcentage de remplissage</span> |
</span><span id="53" class="l"><a class="l" href="#53">53: </a> <span class="php-keyword1">echo</span> <span class="php-quote">'Pourcentage de remplissage : '</span>.<span class="php-var">$cache</span>->getPourcentageRemplissage().<span class="php-quote">'%<br/>'</span>; |
</span><span id="54" class="l"><a class="l" href="#54">54: </a> |
</span><span id="55" class="l"><a class="l" href="#55">55: </a> <span class="php-comment">// Affichage des métadonnées</span> |
</span><span id="56" class="l"><a class="l" href="#56">56: </a> <span class="php-var">$meta03</span> = <span class="php-var">$cache</span>->getMetadonnees(<span class="php-var">$id03</span>); |
</span><span id="57" class="l"><a class="l" href="#57">57: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Métadonnées du cache '</span><span class="php-var">$id03</span><span class="php-quote">' : <pre>"</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$meta03</span>, <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="58" class="l"><a class="l" href="#58">58: </a> <span class="php-var">$meta01</span> = <span class="php-var">$cache</span>->getMetadonnees(<span class="php-var">$id_test</span>); |
</span><span id="59" class="l"><a class="l" href="#59">59: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Métadonnées du cache '</span><span class="php-var">$id_test</span><span class="php-quote">' : <pre>"</span>.<span class="php-keyword2">print_r</span>(<span class="php-var">$meta01</span>, <span class="php-keyword1">true</span>).<span class="php-quote">'</pre>'</span>; |
</span><span id="60" class="l"><a class="l" href="#60">60: </a> |
</span><span id="61" class="l"><a class="l" href="#61">61: </a> <span class="php-comment">// Nettoyage & suppression</span> |
</span><span id="62" class="l"><a class="l" href="#62">62: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Temps avant suppression du cache : "</span>.(<span class="php-keyword2">time</span>() - <span class="php-var">$meta01</span>[<span class="php-quote">'expiration'</span>]).<span class="php-quote">'s<br/>'</span>; |
</span><span id="63" class="l"><a class="l" href="#63">63: </a> <span class="php-keyword1">if</span> ((<span class="php-keyword2">time</span>() - <span class="php-var">$meta01</span>[<span class="php-quote">'expiration'</span>]) >= -<span class="php-num">30</span>) { |
</span><span id="64" class="l"><a class="l" href="#64">64: </a> <span class="php-comment">// Suppressions</span> |
</span><span id="65" class="l"><a class="l" href="#65">65: </a> <span class="php-var">$cache</span>->supprimer(<span class="php-var">$id_test</span>); |
</span><span id="66" class="l"><a class="l" href="#66">66: </a> <span class="php-keyword1">echo</span> (!<span class="php-var">$cache</span>->tester(<span class="php-var">$id_test</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id_test</span><span class="php-quote">' a bien été supprimé"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id_test</span><span class="php-quote">' n'a pas été supprimé"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="67" class="l"><a class="l" href="#67">67: </a> |
</span><span id="68" class="l"><a class="l" href="#68">68: </a> <span class="php-comment">// Nettoyage</span> |
</span><span id="69" class="l"><a class="l" href="#69">69: </a> <span class="php-var">$cache</span>->nettoyer(Cache::NETTOYAGE_MODE_AVEC_LES_TAGS, <span class="php-keyword1">array</span>(<span class="php-var">$tag02</span>, <span class="php-var">$tag03</span>)); |
</span><span id="70" class="l"><a class="l" href="#70">70: </a> <span class="php-keyword1">echo</span> (!<span class="php-var">$cache</span>->tester(<span class="php-var">$id03</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id03</span><span class="php-quote">' a bien été supprimé"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id03</span><span class="php-quote">' n'a pas été supprimé"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="71" class="l"><a class="l" href="#71">71: </a> <span class="php-var">$cache</span>->nettoyer(Cache::NETTOYAGE_MODE_SANS_LES_TAGS, <span class="php-keyword1">array</span>(<span class="php-var">$tag01</span>)); |
</span><span id="72" class="l"><a class="l" href="#72">72: </a> <span class="php-keyword1">echo</span> (<span class="php-var">$cache</span>->tester(<span class="php-var">$id02</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' n'a pas été supprimé"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' a été supprimé"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="73" class="l"><a class="l" href="#73">73: </a> <span class="php-var">$cache</span>->nettoyer(Cache::NETTOYAGE_MODE_EXPIRATION); |
</span><span id="74" class="l"><a class="l" href="#74">74: </a> <span class="php-keyword1">echo</span> (<span class="php-var">$cache</span>->tester(<span class="php-var">$id02</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' n'a pas été supprimé"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' a été supprimé"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="75" class="l"><a class="l" href="#75">75: </a> <span class="php-var">$cache</span>->nettoyer(Cache::NETTOYAGE_MODE_TOUS); |
</span><span id="76" class="l"><a class="l" href="#76">76: </a> <span class="php-keyword1">echo</span> (!<span class="php-var">$cache</span>->tester(<span class="php-var">$id01</span>) ? <span class="php-quote">"OK : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' a été supprimé"</span> : <span class="php-quote">"KO : le cache '</span><span class="php-var">$id02</span><span class="php-quote">' n'a pas été supprimé"</span>).<span class="php-quote">'<br/>'</span>; |
</span><span id="77" class="l"><a class="l" href="#77">77: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> ((<span class="php-keyword2">time</span>() - <span class="php-var">$meta01</span>[<span class="php-quote">'expiration'</span>]) < -<span class="php-num">60</span>) { |
</span><span id="78" class="l"><a class="l" href="#78">78: </a> <span class="php-comment">// Test ajout d'une durée de vie supplémentaire</span> |
</span><span id="79" class="l"><a class="l" href="#79">79: </a> <span class="php-var">$meta01</span> = <span class="php-var">$cache</span>->getMetadonnees(<span class="php-var">$id_test</span>); |
</span><span id="80" class="l"><a class="l" href="#80">80: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Durée de vie du cache '</span><span class="php-var">$id_test</span><span class="php-quote">' : "</span>.<span class="php-var">$meta01</span>[<span class="php-quote">'expiration'</span>].<span class="php-quote">'<br/>'</span>; |
</span><span id="81" class="l"><a class="l" href="#81">81: </a> <span class="php-var">$cache</span>->ajouterSupplementDureeDeVie(<span class="php-var">$id_test</span>, -<span class="php-num">3540</span>); |
</span><span id="82" class="l"><a class="l" href="#82">82: </a> <span class="php-var">$meta02</span> = <span class="php-var">$cache</span>->getMetadonnees(<span class="php-var">$id_test</span>); |
</span><span id="83" class="l"><a class="l" href="#83">83: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"Durée de vie du cache '</span><span class="php-var">$id_test</span><span class="php-quote">' après ajout supplément de -3540s : "</span>.<span class="php-var">$meta02</span>[<span class="php-quote">'expiration'</span>]. |
</span><span id="84" class="l"><a class="l" href="#84">84: </a> <span class="php-quote">' - diff. : '</span>.(<span class="php-var">$meta02</span>[<span class="php-quote">'expiration'</span>] - <span class="php-var">$meta01</span>[<span class="php-quote">'expiration'</span>]).<span class="php-quote">'<br/>'</span>; |
</span><span id="85" class="l"><a class="l" href="#85">85: </a> } |
</span><span id="86" class="l"><a class="l" href="#86">86: </a> } |
</span><span id="87" class="l"><a class="l" href="#87">87: </a>} |
</span><span id="88" class="l"><a class="l" href="#88">88: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Config.html |
---|
New file |
0,0 → 1,363 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Config | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li class="active"><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Config</h1> |
<div class="description"> |
<p>Config permet de charger automatiquement les fichiers ini du Framework et de |
l'application. Elle offre l'accès en lecture seule aux paramètres de config. |
C'est une Singleton. Si vous avez besoin de modifier dynamiquement des |
paramètres de configuration, utiliser le @see Registe, il est fait pour |
ça.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2009, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Config.php 447 2013-12-19 10:52:37Z jpm $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Config.html#4-282" title="Go to source code">framework/Config.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="charger" id="_charger"> |
<td class="attributes"><code> |
public static |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_charger">#</a> |
<code><a href="source-class-Config.html#232-240" title="Go to source code">charger</a>( <span>string <var>$fichier_ini</var></span> )</code> |
<div class="description short"> |
<p>Charge un fichier ini dans le tableau des paramètres de l'appli.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Charge un fichier ini dans le tableau des paramètres de l'appli.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$fichier_ini</var></dt> |
<dd><code>string</code><br>$fichier_ini le nom du fichier à charger</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>le fichier ini parsé<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="get" id="_get"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_get">#</a> |
<code><a href="source-class-Config.html#242-250" title="Go to source code">get</a>( <span>string <var>$param</var> = <span class="php-keyword1">null</span></span> )</code> |
<div class="description short"> |
<p>Accesseur pour la valeur d'un paramètre.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Accesseur pour la valeur d'un paramètre.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$param</var></dt> |
<dd><code>string</code><br>$param le nom du paramètre</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>la valeur du paramètre<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="existe" id="_existe"> |
<td class="attributes"><code> |
public static |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_existe">#</a> |
<code><a href="source-class-Config.html#252-260" title="Go to source code">existe</a>( <span>string <var>$param</var></span> )</code> |
<div class="description short"> |
<p>Vérifie si la valeur d'un paramètre existe.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Vérifie si la valeur d'un paramètre existe.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$param</var></dt> |
<dd><code>string</code><br>$param le nom du paramètre</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>vrai si le paramètre existe, false sinon<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="verifierPresenceParametres" id="_verifierPresenceParametres"> |
<td class="attributes"><code> |
public static |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_verifierPresenceParametres">#</a> |
<code><a href="source-class-Config.html#262-281" title="Go to source code">verifierPresenceParametres</a>( <span>array <var>$parametres</var></span> )</code> |
<div class="description short"> |
<p>Vérifie que tous les paramêtres de config nécessaires au fonctionnement |
d'une classe existe dans les fichiers de configurations. L'utilisation de cette |
méthode depuis la classe Config évite de faire appel à une classe |
supplémentaire.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Vérifie que tous les paramêtres de config nécessaires au fonctionnement |
d'une classe existe dans les fichiers de configurations. L'utilisation de cette |
méthode depuis la classe Config évite de faire appel à une classe |
supplémentaire.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$parametres</var></dt> |
<dd><code>array</code><br>$parametres tableau des noms des paramètres de la config à verifier.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true si tous les paramétres sont présents sinon false.<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-ServiceCacheSqlite.html |
---|
New file |
0,0 → 1,280 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class ServiceCacheSqlite | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li class="active"><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class ServiceCacheSqlite</h1> |
<div class="description"> |
<p>Classe principale gérant les services. Paramètres liés dans config.ini : - |
serveur.baseURL</p> |
<p>Encodage en entrée : utf8 Encodage en sortie : utf8</p> |
</div> |
<dl class="tree"> |
<dd style="padding-left:0px"> |
<a href="class-RestService.html"><span>RestService</span></a> |
</dd> |
<dd style="padding-left:30px"> |
<img src="resources/inherit.png" alt="Extended by"> |
<b><span>ServiceCacheSqlite</span></b> |
</dd> |
</dl> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
Php 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="GPL">v3 <http://www.gnu.org/licenses/gpl.txt></a><br> |
<b>License:</b> |
<a href="CECILL">v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt></a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: RestService.php 417 2012-05-15 09:24:12Z jpm $<br> |
<b>Since:</b> |
0.3<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-ServiceCacheSqlite.html#2-87" title="Go to source code">exemples/services/modules/0.1/ServiceCacheSqlite.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="consulter" id="_consulter"> |
<td class="attributes"><code> |
public |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_consulter">#</a> |
<code><a href="source-class-ServiceCacheSqlite.html#4-86" title="Go to source code">consulter</a>( <span>array <var>$ressources</var></span>, <span>array <var>$parametres</var></span> )</code> |
<div class="description short"> |
<p>Méthode appelée lors d'une requête HTTP de type GET.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode appelée lors d'une requête HTTP de type GET.</p> |
<p>Si la consultation est un succès, le code statut HTTP retourné sera 200. |
Dans tous les autres cas, la méthode devra retourner le code statut HTTP |
adéquate.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$ressources</var></dt> |
<dd><code>array</code><br>Morceaux de l'url servant à préciser la ressource concerné pour le service |
demandé.</dd> |
<dt><var>$parametres</var></dt> |
<dd><code>array</code><br>Partie de l'url situé après le '?' servant à paramétrer le service demandé.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>une chaine indiquant le succès de l'opération et les données demandées.<br> |
</div> |
<h4>Overrides</h4> |
<div class="list"><code><a href="class-RestService.html#_consulter">RestService::consulter()</a></code></div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary inherited"> |
<caption>Methods inherited from <a href="class-RestService.html#methods">RestService</a></caption> |
<tr> |
<td><code> |
<a href="class-RestService.html#___construct">__construct()</a>, |
<a href="class-RestService.html#_ajouter">ajouter()</a>, |
<a href="class-RestService.html#_ajouterMessage">ajouterMessage()</a>, |
<a href="class-RestService.html#_getBdd">getBdd()</a>, |
<a href="class-RestService.html#_getRestClient">getRestClient()</a>, |
<a href="class-RestService.html#_initialiser">initialiser()</a>, |
<a href="class-RestService.html#_modifier">modifier()</a>, |
<a href="class-RestService.html#_supprimer">supprimer()</a>, |
<a href="class-RestService.html#_utiliserParametresBruts">utiliserParametresBruts()</a> |
</code></td> |
</tr> |
</table> |
<table class="summary inherited"> |
<caption>Properties inherited from <a href="class-RestService.html#properties">RestService</a></caption> |
<tr> |
<td><code> |
<a href="class-RestService.html#$bdd"><var><span class="deprecated">$bdd</span></var></a>, |
<a href="class-RestService.html#$utilisationParametresBruts"><var>$utilisationParametresBruts</var></a> |
</code></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-GestionnaireException.html |
---|
New file |
0,0 → 1,802 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class GestionnaireException | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li class="active"><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class GestionnaireException</h1> |
<div class="description"> |
<p>Classe de gestion des exceptions. C'est un Singleton.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2009, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL</a><br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL</a><br> |
<b>Author:</b> |
Aurélien PERONNET <<a |
href="mailto:aurelien@tela-botanica.org">aurelien@<!-- -->tela-botanica.org</a>><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jmp@tela-botanica.org">jmp@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: GestionnaireException.php 369 2011-10-03 12:47:17Z jpm $$<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-GestionnaireException.html#3-249" title="Go to source code">framework/GestionnaireException.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="initialiser" id="_initialiser"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_initialiser">#</a> |
<code><a href="source-class-GestionnaireException.html#40-50" title="Go to source code">initialiser</a>( )</code> |
<div class="description short"> |
<p>Initialise le Gestionnaire d'exceptions et d'erreur sans tenir comptes des |
paramêtres de config.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Initialise le Gestionnaire d'exceptions et d'erreur sans tenir comptes des |
paramêtres de config.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="configurer" id="_configurer"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_configurer">#</a> |
<code><a href="source-class-GestionnaireException.html#52-58" title="Go to source code">configurer</a>( )</code> |
<div class="description short"> |
<p>Configure le Gestionnaire d'exceptions et d'erreur à partir des paramêtres |
de config.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Configure le Gestionnaire d'exceptions et d'erreur à partir des paramêtres |
de config.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="getExceptionsNbre" id="_getExceptionsNbre"> |
<td class="attributes"><code> |
public static |
integer |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getExceptionsNbre">#</a> |
<code><a href="source-class-GestionnaireException.html#60-68" title="Go to source code">getExceptionsNbre</a>( )</code> |
<div class="description short"> |
<p>Renvoie le nombre d'exceptions et d'erreurs levées.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Renvoie le nombre d'exceptions et d'erreurs levées.</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>integer</code><br>le nombre d'exception actuellement levées<br> |
</div> |
<h4>Since</h4> |
<div class="list"> |
0.3<br> |
</div> |
<h4>See</h4> |
<div class="list"> |
getExceptions() pour obtenir les exceptions formatées.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getContexte" id="_getContexte"> |
<td class="attributes"><code> |
public static |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getContexte">#</a> |
<code><a href="source-class-GestionnaireException.html#70-76" title="Go to source code">getContexte</a>( )</code> |
<div class="description short"> |
<p>Renvoie le booleen définissant si l'on affiche le contexte ou non</p> |
</div> |
<div class="description detailed hidden"> |
<p>Renvoie le booleen définissant si l'on affiche le contexte ou non</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true si on affiche le contexte sinon false.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="setContexte" id="_setContexte"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setContexte">#</a> |
<code><a href="source-class-GestionnaireException.html#78-84" title="Go to source code">setContexte</a>( <span>boolean <var>$contexte</var></span> )</code> |
<div class="description short"> |
<p>Definit si l'on veut afficher le contexte ou non</p> |
</div> |
<div class="description detailed hidden"> |
<p>Definit si l'on veut afficher le contexte ou non</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$contexte</var></dt> |
<dd><code>boolean</code><br>true si on veut afficher le contexte, false sinon, par défaut vaut false</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="gererException" id="_gererException"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_gererException">#</a> |
<code><a href="source-class-GestionnaireException.html#86-97" title="Go to source code">gererException</a>( <span><code><a href="class-Exception.html">Exception</a></code> <var>$e</var></span> )</code> |
<div class="description short"> |
<p>Fonction de gestion des exceptions, remplace le handler par défaut. Si une |
boucle génère de multiple exception (ou erreur) identique une seule sera |
stockée.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Fonction de gestion des exceptions, remplace le handler par défaut. Si une |
boucle génère de multiple exception (ou erreur) identique une seule sera |
stockée.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$e</var></dt> |
<dd><code><code><a href="class-Exception.html">Exception</a></code></code><br>$e l'exception à traiter</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="gererErreur" id="_gererErreur"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_gererErreur">#</a> |
<code><a href="source-class-GestionnaireException.html#99-114" title="Go to source code">gererErreur</a>( <span>integer <var>$niveau</var></span>, <span>string <var>$message</var></span>, <span>string <var>$fichier</var></span>, <span>integer <var>$ligne</var></span>, <span>string <var>$contexte</var></span> )</code> |
<div class="description short"> |
<p>Gère les erreurs en les convertissant en exceptions (remplace la fonction |
gestion d'erreurs native de php)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Gère les erreurs en les convertissant en exceptions (remplace la fonction |
gestion d'erreurs native de php)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$niveau</var></dt> |
<dd><code>integer</code><br>$niveau le niveau de l'erreur</dd> |
<dt><var>$message</var></dt> |
<dd><code>string</code><br>$message le message associé à l'erreur</dd> |
<dt><var>$fichier</var></dt> |
<dd><code>string</code><br>$fichier le nom du fichier où l'erreur s'est produite</dd> |
<dt><var>$ligne</var></dt> |
<dd><code>integer</code><br>$ligne la ligne où l'erreur s'est produite</dd> |
<dt><var>$contexte</var></dt> |
<dd><code>string</code><br>$contexte le contexte associé à l'erreur</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getExceptions" id="_getExceptions"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getExceptions">#</a> |
<code><a href="source-class-GestionnaireException.html#116-125" title="Go to source code">getExceptions</a>( )</code> |
<div class="description short"> |
<p>Renvoie les exceptions au format (X)HTML ou bien au format texte suivant le |
mode d'utilisation de PHP.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Renvoie les exceptions au format (X)HTML ou bien au format texte suivant le |
mode d'utilisation de PHP.</p> |
<h4>Deprecated</h4> |
<div class="list"> |
</div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>les exceptions formatées en texte ou (X)HTML.<br> |
</div> |
<h4>Since</h4> |
<div class="list"> |
0.3<br> |
</div> |
<h4>See</h4> |
<div class="list"> |
<code><code><a href="class-GestionnaireException.html#_getExceptionsFormatees">GestionnaireException::getExceptionsFormatees()</a></code></code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getExceptionsFormatees" id="_getExceptionsFormatees"> |
<td class="attributes"><code> |
public static |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getExceptionsFormatees">#</a> |
<code><a href="source-class-GestionnaireException.html#127-148" title="Go to source code">getExceptionsFormatees</a>( )</code> |
<div class="description short"> |
<p>Renvoie les exceptions au format (X)HTML ou bien au format texte suivant le |
mode d'utilisation de PHP.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Renvoie les exceptions au format (X)HTML ou bien au format texte suivant le |
mode d'utilisation de PHP.</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>les exceptions formatées en texte ou (X)HTML.<br> |
</div> |
<h4>Since</h4> |
<div class="list"> |
0.3<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getExceptionsTriees" id="_getExceptionsTriees"> |
<td class="attributes"><code> |
public static |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getExceptionsTriees">#</a> |
<code><a href="source-class-GestionnaireException.html#150-170" title="Go to source code">getExceptionsTriees</a>( )</code> |
<div class="description short"> |
<p>Renvoie le tableau d'objets Exception générées par le script PHP triées |
du niveau de sévérité le plus élevé au moins élevé. Format du tableau : |
array{sévérité_1 = array{Exception1, Exception2, Exception3,...}, |
sévérité_1 = array{Exception1, Exception2, ...}, ...}; ATTENTION : si vous |
utilisez cette méthode, c'est à vous de gérer l'affichage des Exceptions. Le |
gestionnaire d'exception n'enverra plus rien au navigateur ou à la console.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Renvoie le tableau d'objets Exception générées par le script PHP triées |
du niveau de sévérité le plus élevé au moins élevé. Format du tableau : |
array{sévérité_1 = array{Exception1, Exception2, Exception3,...}, |
sévérité_1 = array{Exception1, Exception2, ...}, ...}; ATTENTION : si vous |
utilisez cette méthode, c'est à vous de gérer l'affichage des Exceptions. Le |
gestionnaire d'exception n'enverra plus rien au navigateur ou à la console.</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>le tableau trié d'objet Exception.<br> |
</div> |
<h4>Since</h4> |
<div class="list"> |
0.3<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="formaterExceptionDebug" id="_formaterExceptionDebug"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_formaterExceptionDebug">#</a> |
<code><a href="source-class-GestionnaireException.html#183-199" title="Go to source code">formaterExceptionDebug</a>( <span><code><a href="class-Exception.html">Exception</a></code> <var>$e</var></span> )</code> |
<div class="description short"> |
<p>Formate une exception de type Notice générée par la classe Debug. Seul le |
message est gardé car les autres infos font référence à la classe Debug et |
non à l'endroit où le débug est lancée. TODO : faire en sorte d'afficher le |
fichier et la ligne où le débug est lancé.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Formate une exception de type Notice générée par la classe Debug. Seul le |
message est gardé car les autres infos font référence à la classe Debug et |
non à l'endroit où le débug est lancée. TODO : faire en sorte d'afficher le |
fichier et la ligne où le débug est lancé.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$e</var></dt> |
<dd><code><code><a href="class-Exception.html">Exception</a></code></code><br>l'exception à formater.</dd> |
</dl></div> |
<h4>Since</h4> |
<div class="list"> |
0.3<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="formaterExceptionTxt" id="_formaterExceptionTxt"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_formaterExceptionTxt">#</a> |
<code><a href="source-class-GestionnaireException.html#201-216" title="Go to source code">formaterExceptionTxt</a>( <span><code><a href="class-Exception.html">Exception</a></code> <var>$e</var></span> )</code> |
<div class="description short"> |
<p>Formate en texte une exception passée en paramètre.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Formate en texte une exception passée en paramètre.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$e</var></dt> |
<dd><code><code><a href="class-Exception.html">Exception</a></code></code><br>l'exception à formater.</dd> |
</dl></div> |
<h4>Since</h4> |
<div class="list"> |
0.3<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="formaterExceptionXhtml" id="_formaterExceptionXhtml"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_formaterExceptionXhtml">#</a> |
<code><a href="source-class-GestionnaireException.html#218-236" title="Go to source code">formaterExceptionXhtml</a>( <span><code><a href="class-Exception.html">Exception</a></code> <var>$e</var></span> )</code> |
<div class="description short"> |
<p>Formate en (X)HTML une exception passée en paramètre.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Formate en (X)HTML une exception passée en paramètre.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$e</var></dt> |
<dd><code><code><a href="class-Exception.html">Exception</a></code></code><br>l'exception à formater.</dd> |
</dl></div> |
<h4>Since</h4> |
<div class="list"> |
0.3<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="__destruct" id="___destruct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___destruct">#</a> |
<code><a href="source-class-GestionnaireException.html#238-247" title="Go to source code">__destruct</a>( )</code> |
<div class="description short"> |
<p>Lors de la destruction de la classe si des exceptions n'ont pas été |
affichées, et si le débogage est à true, elles sont affichées.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Lors de la destruction de la classe si des exceptions n'ont pas été |
affichées, et si le débogage est à true, elles sont affichées.</p> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="constants"> |
<caption>Constants summary</caption> |
<tr data-order="MODE_CLI" id="MODE_CLI"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-GestionnaireException.html#20" title="Go to source code"><b>MODE_CLI</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'cli'</span></code></td> |
<td class="description"><div> |
<a href="#MODE_CLI" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Fichier.html |
---|
New file |
0,0 → 1,304 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/utilitaires/Fichier.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li class="active"><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li class="active"><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Utilitaire.html" title="Summary of Utilitaire"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Fichier.html" title="Summary of Fichier"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe fournissant des méthodes statiques de manipulation des fichiers. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @package Utilitaire |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @version $Id: Fichier.php 352 2011-07-21 10:25:56Z jpm $ |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> */</span> |
</span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-keyword1">class</span> <a id="Fichier" href="#Fichier">Fichier</a> { |
</span><span id="16" class="l"><a class="l" href="#16"> 16: </a> <span class="php-comment">/** |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment"> * Créer et stocke du contenu dans un fichier. |
</span></span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-comment"> * |
</span></span><span id="19" class="l"><a class="l" href="#19"> 19: </a><span class="php-comment"> * @param string le chemin et le nom du fichier. |
</span></span><span id="20" class="l"><a class="l" href="#20"> 20: </a><span class="php-comment"> * @param string le contenu à stocker dans le fichier. |
</span></span><span id="21" class="l"><a class="l" href="#21"> 21: </a><span class="php-comment"> * @return string true en cas de succès sinon false. |
</span></span><span id="22" class="l"><a class="l" href="#22"> 22: </a><span class="php-comment"> */</span> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_creerFichier" href="#_creerFichier">creerFichier</a>(<span class="php-var">$fichier</span>, <span class="php-var">$contenu</span>) { |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> <span class="php-var">$erreur</span> = <span class="php-keyword1">null</span>; |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> <span class="php-comment">// Début de l'écriture du fichier</span> |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resource</span> = <span class="php-keyword2">fopen</span>(<span class="php-var">$fichier</span>, <span class="php-quote">'w'</span>)) { |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">fwrite</span>(<span class="php-var">$resource</span>, <span class="php-var">$contenu</span>)) { |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">fclose</span>(<span class="php-var">$resource</span>)) { |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-var">$erreur</span> = <span class="php-quote">"Le fichier '</span><span class="php-var">$fichier</span><span class="php-quote">' n'a pas pu être fermé."</span>; |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> } |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> } <span class="php-keyword1">else</span> { |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> <span class="php-var">$erreur</span> = <span class="php-quote">"Le contenu texte n'a pas pu être écrit dans le fichier '</span><span class="php-var">$fichier</span><span class="php-quote">'."</span>; |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> } |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> } <span class="php-keyword1">else</span> { |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> <span class="php-var">$erreur</span> = <span class="php-quote">"Le fichier '</span><span class="php-var">$fichier</span><span class="php-quote">' n'a pas pu être ouvert."</span>; |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> } |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> <span class="php-comment">// Gestion des erreurs et du retour</span> |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_null</span>(<span class="php-var">$erreur</span>)) { |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">true</span>; |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> } <span class="php-keyword1">else</span> { |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$erreur</span>, E_USER_WARNING); |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> } |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> } |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-comment">/** |
</span></span><span id="49" class="l"><a class="l" href="#49"> 49: </a><span class="php-comment"> * Créer et stocke du contenu dans un fichier compressé en Gzip. |
</span></span><span id="50" class="l"><a class="l" href="#50"> 50: </a><span class="php-comment"> * |
</span></span><span id="51" class="l"><a class="l" href="#51"> 51: </a><span class="php-comment"> * @param string le chemin et le nom du fichier. |
</span></span><span id="52" class="l"><a class="l" href="#52"> 52: </a><span class="php-comment"> * @param string le contenu à stocker dans le fichier. |
</span></span><span id="53" class="l"><a class="l" href="#53"> 53: </a><span class="php-comment"> * @return string true en cas de succès sinon false. |
</span></span><span id="54" class="l"><a class="l" href="#54"> 54: </a><span class="php-comment"> */</span> |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_creerFichierGzip" href="#_creerFichierGzip">creerFichierGzip</a>(<span class="php-var">$fichier</span>, <span class="php-var">$contenu</span>) { |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> <span class="php-var">$erreur</span> = <span class="php-keyword1">null</span>; |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> <span class="php-comment">// Ajout de l'extension gz</span> |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$fichier</span>, -<span class="php-num">3</span>) != <span class="php-quote">'.gz'</span>) { |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> <span class="php-var">$fichier</span> = <span class="php-var">$fichier</span>.<span class="php-quote">'.gz'</span>; |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> } |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> <span class="php-comment">// Début de l'écriture du fichier compressé</span> |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resource</span> = <span class="php-keyword2">gzopen</span>(<span class="php-var">$fichier</span>, <span class="php-quote">'w9'</span>)) { |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">gzwrite</span>(<span class="php-var">$resource</span>, <span class="php-var">$contenu</span>)) { |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">gzclose</span>(<span class="php-var">$resource</span>)) { |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> <span class="php-var">$erreur</span> = <span class="php-quote">"Le fichier compressé '</span><span class="php-var">$fichier</span><span class="php-quote">' n'a pas pu être fermé."</span>; |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> } |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> } <span class="php-keyword1">else</span> { |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> <span class="php-var">$erreur</span> = <span class="php-quote">"Le contenu texte n'a pas pu être écrit dans le fichier compressé '</span><span class="php-var">$fichier</span><span class="php-quote">'."</span>; |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> } |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> } <span class="php-keyword1">else</span> { |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> <span class="php-var">$erreur</span> = <span class="php-quote">"Le fichier compressé '</span><span class="php-var">$fichier</span><span class="php-quote">' n'a pas pu être ouvert."</span>; |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> } |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> <span class="php-comment">// Gestion des erreurs et du retour</span> |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_null</span>(<span class="php-var">$erreur</span>)) { |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">true</span>; |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> } <span class="php-keyword1">else</span> { |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$erreur</span>, E_USER_WARNING); |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> } |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> } |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> <span class="php-comment">/** |
</span></span><span id="86" class="l"><a class="l" href="#86"> 86: </a><span class="php-comment"> * Supprime récursivement un dossier et tout son contenu. |
</span></span><span id="87" class="l"><a class="l" href="#87"> 87: </a><span class="php-comment"> * |
</span></span><span id="88" class="l"><a class="l" href="#88"> 88: </a><span class="php-comment"> * @param string $dossier le chemin vers le dossier à supprimer. |
</span></span><span id="89" class="l"><a class="l" href="#89"> 89: </a><span class="php-comment"> * @return void |
</span></span><span id="90" class="l"><a class="l" href="#90"> 90: </a><span class="php-comment"> */</span> |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_supprimerDossier" href="#_supprimerDossier">supprimerDossier</a>(<span class="php-var">$dossier</span>) { |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_dir</span>(<span class="php-var">$dossier</span>)) { |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-var">$objets</span> = <span class="php-keyword2">scandir</span>(<span class="php-var">$dossier</span>); |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$objets</span> <span class="php-keyword1">as</span> <span class="php-var">$objet</span>) { |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> <span class="php-keyword1">if</span> (<span class="php-var">$objet</span> != <span class="php-quote">'.'</span> && <span class="php-var">$objet</span> != <span class="php-quote">'..'</span>) { |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> <span class="php-var">$chemin</span> = <span class="php-var">$dossier</span>.<span class="php-quote">'/'</span>.<span class="php-var">$objet</span>; |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">filetype</span>(<span class="php-var">$chemin</span>) == <span class="php-quote">'dir'</span>) { |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-var">$this</span>->supprimerDossier(<span class="php-var">$chemin</span>); |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> } <span class="php-keyword1">else</span> { |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> <span class="php-keyword2">unlink</span>(<span class="php-var">$chemin</span>); |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> } |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> } |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> } |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> <span class="php-keyword2">reset</span>(<span class="php-var">$objets</span>); |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-keyword2">rmdir</span>(<span class="php-var">$dossier</span>); |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> } |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> } |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> <span class="php-comment">/** |
</span></span><span id="110" class="l"><a class="l" href="#110">110: </a><span class="php-comment"> * Convertion d'un nombre d'octet en kB, MB, GB. |
</span></span><span id="111" class="l"><a class="l" href="#111">111: </a><span class="php-comment"> * @link http://forum.webmaster-rank.info/developpement-site/code-taille-memoire-d-une-variable-en-php-t1344.html |
</span></span><span id="112" class="l"><a class="l" href="#112">112: </a><span class="php-comment"> * @param integer $taille la taille en octet à convertir |
</span></span><span id="113" class="l"><a class="l" href="#113">113: </a><span class="php-comment"> * |
</span></span><span id="114" class="l"><a class="l" href="#114">114: </a><span class="php-comment"> * @return string la chaine représentant la taille en octets. |
</span></span><span id="115" class="l"><a class="l" href="#115">115: </a><span class="php-comment"> */</span> |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_convertirTaille" href="#_convertirTaille">convertirTaille</a>(<span class="php-var">$taille</span>) { |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> <span class="php-var">$unite</span> = <span class="php-keyword1">array</span>(<span class="php-quote">'B'</span>, <span class="php-quote">'kB'</span>, <span class="php-quote">'MB'</span>, <span class="php-quote">'GB'</span>); |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-keyword1">return</span> @<span class="php-keyword2">round</span>(<span class="php-var">$taille</span> / <span class="php-keyword2">pow</span>(<span class="php-num">1024</span>, (<span class="php-var">$i</span> = <span class="php-keyword2">floor</span>(<span class="php-keyword2">log</span>(<span class="php-var">$taille</span>,<span class="php-num">1024</span>)))), <span class="php-num">2</span>).<span class="php-quote">' '</span>.<span class="php-var">$unite</span>[<span class="php-var">$i</span>]; |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> } |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-comment">/** |
</span></span><span id="122" class="l"><a class="l" href="#122">122: </a><span class="php-comment"> * Détermine le dossier système temporaire et détecte si nous y avons accès en lecture et écriture. |
</span></span><span id="123" class="l"><a class="l" href="#123">123: </a><span class="php-comment"> * |
</span></span><span id="124" class="l"><a class="l" href="#124">124: </a><span class="php-comment"> * Inspiré de Zend_File_Transfer_Adapter_Abstract & Zend_Cache |
</span></span><span id="125" class="l"><a class="l" href="#125">125: </a><span class="php-comment"> * |
</span></span><span id="126" class="l"><a class="l" href="#126">126: </a><span class="php-comment"> * @return string|false le chemine vers le dossier temporaire ou false en cas d'échec. |
</span></span><span id="127" class="l"><a class="l" href="#127">127: </a><span class="php-comment"> */</span> |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getDossierTmp" href="#_getDossierTmp">getDossierTmp</a>() { |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> <span class="php-var">$dossier_tmp</span> = <span class="php-keyword1">false</span>; |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> <span class="php-keyword1">foreach</span> (<span class="php-keyword1">array</span>(<span class="php-var">$_ENV</span>, <span class="php-var">$_SERVER</span>) <span class="php-keyword1">as</span> <span class="php-var">$environnement</span>) { |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> <span class="php-keyword1">foreach</span> (<span class="php-keyword1">array</span>(<span class="php-quote">'TMPDIR'</span>, <span class="php-quote">'TEMP'</span>, <span class="php-quote">'TMP'</span>, <span class="php-quote">'windir'</span>, <span class="php-quote">'SystemRoot'</span>) <span class="php-keyword1">as</span> <span class="php-var">$cle</span>) { |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$environnement</span>[<span class="php-var">$cle</span>])) { |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> <span class="php-keyword1">if</span> ((<span class="php-var">$cle</span> == <span class="php-quote">'windir'</span>) <span class="php-keyword1">or</span> (<span class="php-var">$cle</span> == <span class="php-quote">'SystemRoot'</span>)) { |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> <span class="php-var">$dossier</span> = <span class="php-keyword2">realpath</span>(<span class="php-var">$environnement</span>[<span class="php-var">$cle</span>] . <span class="php-quote">'\\temp'</span>); |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> } <span class="php-keyword1">else</span> { |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> <span class="php-var">$dossier</span> = <span class="php-keyword2">realpath</span>(<span class="php-var">$environnement</span>[<span class="php-var">$cle</span>]); |
</span><span id="137" class="l"><a class="l" href="#137">137: </a> } |
</span><span id="138" class="l"><a class="l" href="#138">138: </a> <span class="php-keyword1">if</span> (self::etreAccessibleEnLectureEtEcriture(<span class="php-var">$dossier</span>)) { |
</span><span id="139" class="l"><a class="l" href="#139">139: </a> <span class="php-var">$dossier_tmp</span> = <span class="php-var">$dossier</span>; |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> <span class="php-keyword1">break</span> <span class="php-num">2</span>; |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> } |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> } |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> } |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> } |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> <span class="php-keyword1">if</span> ( ! <span class="php-var">$dossier_tmp</span>) { |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> <span class="php-var">$dossier_televersement_tmp</span> = <span class="php-keyword2">ini_get</span>(<span class="php-quote">'upload_tmp_dir'</span>); |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> <span class="php-keyword1">if</span> (<span class="php-var">$dossier_televersement_tmp</span>) { |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> <span class="php-var">$dossier</span> = <span class="php-keyword2">realpath</span>(<span class="php-var">$dossier_televersement_tmp</span>); |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> <span class="php-keyword1">if</span> (self::etreAccessibleEnLectureEtEcriture(<span class="php-var">$dossier</span>)) { |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> <span class="php-var">$dossier_tmp</span> = <span class="php-var">$dossier</span>; |
</span><span id="152" class="l"><a class="l" href="#152">152: </a> } |
</span><span id="153" class="l"><a class="l" href="#153">153: </a> } |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> } |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> <span class="php-keyword1">if</span> ( ! <span class="php-var">$dossier_tmp</span>) { |
</span><span id="157" class="l"><a class="l" href="#157">157: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">function_exists</span>(<span class="php-quote">'sys_get_temp_dir'</span>)) { |
</span><span id="158" class="l"><a class="l" href="#158">158: </a> <span class="php-var">$dossier</span> = <span class="php-keyword2">sys_get_temp_dir</span>(); |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> <span class="php-keyword1">if</span> (self::etreAccessibleEnLectureEtEcriture(<span class="php-var">$dossier</span>)) { |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> <span class="php-var">$dossier_tmp</span> = <span class="php-var">$dossier</span>; |
</span><span id="161" class="l"><a class="l" href="#161">161: </a> } |
</span><span id="162" class="l"><a class="l" href="#162">162: </a> } |
</span><span id="163" class="l"><a class="l" href="#163">163: </a> } |
</span><span id="164" class="l"><a class="l" href="#164">164: </a> |
</span><span id="165" class="l"><a class="l" href="#165">165: </a> <span class="php-keyword1">if</span> ( ! <span class="php-var">$dossier_tmp</span>) { |
</span><span id="166" class="l"><a class="l" href="#166">166: </a> <span class="php-comment">// Tentative de création d'un fichier temporaire dans le dossier courrant</span> |
</span><span id="167" class="l"><a class="l" href="#167">167: </a> <span class="php-var">$fichier_tmp</span> = @<span class="php-keyword2">tempnam</span>(<span class="php-keyword2">md5</span>(<span class="php-keyword2">uniqid</span>(<span class="php-keyword2">rand</span>(), <span class="php-keyword1">TRUE</span>)), <span class="php-quote">''</span>); |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> <span class="php-keyword1">if</span> (<span class="php-var">$fichier_tmp</span>) { |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> <span class="php-var">$dossier</span> = @<span class="php-keyword2">realpath</span>(<span class="php-keyword2">dirname</span>(<span class="php-var">$fichier_tmp</span>)); |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> @<span class="php-keyword2">unlink</span>(<span class="php-var">$fichier_tmp</span>); |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> <span class="php-keyword1">if</span> (self::etreAccessibleEnLectureEtEcriture(<span class="php-var">$dossier</span>)) { |
</span><span id="172" class="l"><a class="l" href="#172">172: </a> <span class="php-var">$dossier_tmp</span> = <span class="php-var">$dossier</span>; |
</span><span id="173" class="l"><a class="l" href="#173">173: </a> } |
</span><span id="174" class="l"><a class="l" href="#174">174: </a> } |
</span><span id="175" class="l"><a class="l" href="#175">175: </a> } |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> |
</span><span id="177" class="l"><a class="l" href="#177">177: </a> <span class="php-keyword1">if</span> ( ! <span class="php-var">$dossier_tmp</span> && self::etreAccessibleEnLectureEtEcriture(<span class="php-quote">'/tmp'</span>)) { |
</span><span id="178" class="l"><a class="l" href="#178">178: </a> <span class="php-var">$dossier_tmp</span> = <span class="php-quote">'/tmp'</span>; |
</span><span id="179" class="l"><a class="l" href="#179">179: </a> } |
</span><span id="180" class="l"><a class="l" href="#180">180: </a> |
</span><span id="181" class="l"><a class="l" href="#181">181: </a> <span class="php-keyword1">if</span> ( ! <span class="php-var">$dossier_tmp</span> && self::etreAccessibleEnLectureEtEcriture(<span class="php-quote">'\\temp'</span>)) { |
</span><span id="182" class="l"><a class="l" href="#182">182: </a> <span class="php-var">$dossier_tmp</span> = <span class="php-quote">'\\temp'</span>; |
</span><span id="183" class="l"><a class="l" href="#183">183: </a> } |
</span><span id="184" class="l"><a class="l" href="#184">184: </a> |
</span><span id="185" class="l"><a class="l" href="#185">185: </a> <span class="php-keyword1">return</span> <span class="php-var">$dossier_tmp</span>; |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> } |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> |
</span><span id="188" class="l"><a class="l" href="#188">188: </a> <span class="php-comment">/** |
</span></span><span id="189" class="l"><a class="l" href="#189">189: </a><span class="php-comment"> * Vérifie si le fichier ou dossier est accessible en lecture et écriture. |
</span></span><span id="190" class="l"><a class="l" href="#190">190: </a><span class="php-comment"> * |
</span></span><span id="191" class="l"><a class="l" href="#191">191: </a><span class="php-comment"> * @param $ressource chemin vers le dossier ou fichier à tester |
</span></span><span id="192" class="l"><a class="l" href="#192">192: </a><span class="php-comment"> * @return boolean true si la ressource est accessible en lecture et écriture. |
</span></span><span id="193" class="l"><a class="l" href="#193">193: </a><span class="php-comment"> */</span> |
</span><span id="194" class="l"><a class="l" href="#194">194: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_etreAccessibleEnLectureEtEcriture" href="#_etreAccessibleEnLectureEtEcriture">etreAccessibleEnLectureEtEcriture</a>(<span class="php-var">$ressource</span>){ |
</span><span id="195" class="l"><a class="l" href="#195">195: </a> <span class="php-var">$accessible</span> = <span class="php-keyword1">false</span>; |
</span><span id="196" class="l"><a class="l" href="#196">196: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_readable</span>(<span class="php-var">$ressource</span>) && <span class="php-keyword2">is_writable</span>(<span class="php-var">$ressource</span>)) { |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> <span class="php-var">$accessible</span> = <span class="php-keyword1">true</span>; |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> } |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> <span class="php-keyword1">return</span> <span class="php-var">$accessible</span>; |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> } |
</span><span id="201" class="l"><a class="l" href="#201">201: </a>} |
</span><span id="202" class="l"><a class="l" href="#202">202: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Tableau.html |
---|
New file |
0,0 → 1,253 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/utilitaires/Tableau.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li class="active"><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li class="active"><a href="class-Tableau.html">Tableau</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Utilitaire.html" title="Summary of Utilitaire"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Tableau.html" title="Summary of Tableau"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe fournissant des méthodes statiques de manipulation des tableaux (Array). |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @package Utilitaire |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @version $Id: Tableau.php 400 2011-11-25 16:26:26Z jpm $ |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> */</span> |
</span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment">// TODO : réaliser une seule méthode pour trierMD et trierMDType</span> |
</span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-keyword1">class</span> <a id="Tableau" href="#Tableau">Tableau</a> { |
</span><span id="17" class="l"><a class="l" href="#17"> 17: </a> <span class="php-keyword1">const</span> <a id="TRI_NATUREL" href="#TRI_NATUREL">TRI_NATUREL</a> = <span class="php-quote">'nat'</span>; |
</span><span id="18" class="l"><a class="l" href="#18"> 18: </a> <span class="php-keyword1">const</span> <a id="TRI_CASSE_SENSIBLE" href="#TRI_CASSE_SENSIBLE">TRI_CASSE_SENSIBLE</a> = <span class="php-quote">'ci'</span>; |
</span><span id="19" class="l"><a class="l" href="#19"> 19: </a> <span class="php-keyword1">const</span> <a id="TRI_CASSE_INSENSIBLE" href="#TRI_CASSE_INSENSIBLE">TRI_CASSE_INSENSIBLE</a> = <span class="php-quote">'ci'</span>; |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$triMultiDimension" href="#$triMultiDimension">$triMultiDimension</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$triType" href="#$triType">$triType</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> <span class="php-comment">/** |
</span></span><span id="25" class="l"><a class="l" href="#25"> 25: </a><span class="php-comment"> * Etend le tableau à étendre avec les données du tableau à copier. Si des clés sont identiques entre les deux tableaux |
</span></span><span id="26" class="l"><a class="l" href="#26"> 26: </a><span class="php-comment"> * une erreur est déclenchée et la valeur du tableau à étendre est gardée. Si les deux tableaux ont des clés numériques |
</span></span><span id="27" class="l"><a class="l" href="#27"> 27: </a><span class="php-comment"> * leurs valeurs sont gardées (à la différence de array_merge). |
</span></span><span id="28" class="l"><a class="l" href="#28"> 28: </a><span class="php-comment"> * Les tableaux sont passés par références et le tableau à copier est progressivement détruit pour éviter la consomation |
</span></span><span id="29" class="l"><a class="l" href="#29"> 29: </a><span class="php-comment"> * de mémoire. |
</span></span><span id="30" class="l"><a class="l" href="#30"> 30: </a><span class="php-comment"> * |
</span></span><span id="31" class="l"><a class="l" href="#31"> 31: </a><span class="php-comment"> * @param array $tableau_a_etendre |
</span></span><span id="32" class="l"><a class="l" href="#32"> 32: </a><span class="php-comment"> * @param array $tableau_a_copier |
</span></span><span id="33" class="l"><a class="l" href="#33"> 33: </a><span class="php-comment"> * @return void |
</span></span><span id="34" class="l"><a class="l" href="#34"> 34: </a><span class="php-comment"> */</span> |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_etendre" href="#_etendre">etendre</a>(<span class="php-keyword1">Array</span> &<span class="php-var">$tableau_a_etendre</span>, <span class="php-keyword1">Array</span> &<span class="php-var">$tableau_a_copier</span>) { |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> <span class="php-var">$cles_existantes</span> = <span class="php-keyword1">null</span>; |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> <span class="php-keyword1">foreach</span>(<span class="php-var">$tableau_a_copier</span> <span class="php-keyword1">as</span> <span class="php-var">$cle</span> => <span class="php-var">$val</span>) { |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$tableau_a_etendre</span>[<span class="php-var">$cle</span>])) { |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> <span class="php-var">$tableau_a_etendre</span>[<span class="php-var">$cle</span>] = <span class="php-var">$val</span>; |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> <span class="php-keyword1">unset</span>(<span class="php-var">$tableau_a_copier</span>[<span class="php-var">$cle</span>]); |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> } <span class="php-keyword1">else</span> { |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> <span class="php-var">$cles_existantes</span>[] = <span class="php-var">$cle</span>; |
</span><span id="43" class="l"><a class="l" href="#43"> 43: </a> } |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> } |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$cles_existantes</span>)) { |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> <span class="php-var">$e</span> = <span class="php-quote">"Le tableau a étendre contenait déjà les clés suivantes : "</span>.<span class="php-keyword2">implode</span>(<span class="php-quote">', '</span>, <span class="php-var">$cles_existantes</span>); |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$e</span>, E_USER_WARNING); |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> } |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> } |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> <span class="php-comment">/** |
</span></span><span id="52" class="l"><a class="l" href="#52"> 52: </a><span class="php-comment"> * @deprecated Utiliser la méthode trierMD() |
</span></span><span id="53" class="l"><a class="l" href="#53"> 53: </a><span class="php-comment"> * @see trierMD() |
</span></span><span id="54" class="l"><a class="l" href="#54"> 54: </a><span class="php-comment"> */</span> |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_trierTableauMd" href="#_trierTableauMd">trierTableauMd</a>(<span class="php-var">$array</span>, <span class="php-var">$cols</span>) { |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> <span class="php-keyword1">return</span> self::trierMD(<span class="php-var">$array</span>, <span class="php-var">$cols</span>); |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> } |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-comment">/** |
</span></span><span id="60" class="l"><a class="l" href="#60"> 60: </a><span class="php-comment"> * Permet de trier un tableau multi-dimenssionnel en gardant l'ordre des clés. |
</span></span><span id="61" class="l"><a class="l" href="#61"> 61: </a><span class="php-comment"> * |
</span></span><span id="62" class="l"><a class="l" href="#62"> 62: </a><span class="php-comment"> * @param Array $array le tableau à trier |
</span></span><span id="63" class="l"><a class="l" href="#63"> 63: </a><span class="php-comment"> * @param Array $cols tableau indiquant en clé la colonne à trier et en valeur l'ordre avec SORT_ASC ou SORT_DESC |
</span></span><span id="64" class="l"><a class="l" href="#64"> 64: </a><span class="php-comment"> * @return Array le tableau trié. |
</span></span><span id="65" class="l"><a class="l" href="#65"> 65: </a><span class="php-comment"> * @author cagret at gmail dot com |
</span></span><span id="66" class="l"><a class="l" href="#66"> 66: </a><span class="php-comment"> * @see http://fr.php.net/manual/fr/function.array-multisort.php Post du 21-Jun-2009 12:38 |
</span></span><span id="67" class="l"><a class="l" href="#67"> 67: </a><span class="php-comment"> */</span> |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_trierMD" href="#_trierMD">trierMD</a>(<span class="php-var">$array</span>, <span class="php-var">$cols</span>) { |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> <span class="php-var">$colarr</span> = <span class="php-keyword1">array</span>(); |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$cols</span> <span class="php-keyword1">as</span> <span class="php-var">$col</span> => <span class="php-var">$order</span>) { |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> <span class="php-var">$colarr</span>[<span class="php-var">$col</span>] = <span class="php-keyword1">array</span>(); |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$array</span> <span class="php-keyword1">as</span> <span class="php-var">$k</span> => <span class="php-var">$row</span>) { |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> <span class="php-var">$colarr</span>[<span class="php-var">$col</span>][<span class="php-quote">'_'</span>.<span class="php-var">$k</span>] = <span class="php-keyword2">strtolower</span>(<span class="php-var">$row</span>[<span class="php-var">$col</span>]); |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> } |
</span><span id="75" class="l"><a class="l" href="#75"> 75: </a> } |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> <span class="php-var">$params</span> = <span class="php-keyword1">array</span>(); |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$cols</span> <span class="php-keyword1">as</span> <span class="php-var">$col</span> => <span class="php-var">$order</span>) { |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> <span class="php-var">$params</span>[] =& <span class="php-var">$colarr</span>[<span class="php-var">$col</span>]; |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> <span class="php-var">$orders</span> = (<span class="php-keyword1">array</span>) <span class="php-var">$order</span>; |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> <span class="php-keyword1">foreach</span>(<span class="php-var">$orders</span> <span class="php-keyword1">as</span> <span class="php-var">$orderElement</span>) { |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> <span class="php-var">$params</span>[] =& <span class="php-var">$orderElement</span>; |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> } |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> } |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> <span class="php-keyword2">call_user_func_array</span>(<span class="php-quote">'array_multisort'</span>, <span class="php-var">$params</span>); |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> <span class="php-var">$ret</span> = <span class="php-keyword1">array</span>(); |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> <span class="php-var">$keys</span> = <span class="php-keyword1">array</span>(); |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-var">$first</span> = <span class="php-keyword1">true</span>; |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$colarr</span> <span class="php-keyword1">as</span> <span class="php-var">$col</span> => <span class="php-var">$arr</span>) { |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$arr</span> <span class="php-keyword1">as</span> <span class="php-var">$k</span> => <span class="php-var">$v</span>) { |
</span><span id="90" class="l"><a class="l" href="#90"> 90: </a> <span class="php-keyword1">if</span> (<span class="php-var">$first</span>) { |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-var">$keys</span>[<span class="php-var">$k</span>] = <span class="php-keyword2">substr</span>(<span class="php-var">$k</span>, <span class="php-num">1</span>); |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> } |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-var">$k</span> = <span class="php-var">$keys</span>[<span class="php-var">$k</span>]; |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$ret</span>[<span class="php-var">$k</span>])) { |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> <span class="php-var">$ret</span>[<span class="php-var">$k</span>] = <span class="php-var">$array</span>[<span class="php-var">$k</span>]; |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> } |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-var">$ret</span>[<span class="php-var">$k</span>][<span class="php-var">$col</span>] = <span class="php-var">$array</span>[<span class="php-var">$k</span>][<span class="php-var">$col</span>]; |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> } |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> <span class="php-var">$first</span> = <span class="php-keyword1">false</span>; |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> } |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> <span class="php-keyword1">return</span> <span class="php-var">$ret</span>; |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> } |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> <span class="php-comment">/** |
</span></span><span id="105" class="l"><a class="l" href="#105">105: </a><span class="php-comment"> * Méthode réalisant un tri d'un tableau multidimension. Attention les clés du tableau ne sont pas modifiées. |
</span></span><span id="106" class="l"><a class="l" href="#106">106: </a><span class="php-comment"> * A utiliser de cette façon: |
</span></span><span id="107" class="l"><a class="l" href="#107">107: </a><span class="php-comment"> * EfloreTriage::trieMultiple( $tableau_multidimension, array('ma_cle1' => SORT_ASC, 'ma_cle2' => SORT_DESC), $type_de_tri); |
</span></span><span id="108" class="l"><a class="l" href="#108">108: </a><span class="php-comment"> * Utiliser les constantes php SORT_DESC ou SORT_ASC pour l'odre de tri. |
</span></span><span id="109" class="l"><a class="l" href="#109">109: </a><span class="php-comment"> * Pour le type de tri : utiliser : |
</span></span><span id="110" class="l"><a class="l" href="#110">110: </a><span class="php-comment"> * - Tableau::TRI_NATUREL pour un trie naturel, |
</span></span><span id="111" class="l"><a class="l" href="#111">111: </a><span class="php-comment"> * - Tableau::TRI_CASSE_SENSIBLE pour un tri sensible à la casse, |
</span></span><span id="112" class="l"><a class="l" href="#112">112: </a><span class="php-comment"> * - Tableau::TRI_CASSE_INSENSIBLE pour un tri insensible à la casse. |
</span></span><span id="113" class="l"><a class="l" href="#113">113: </a><span class="php-comment"> * @param array le tableau à trier |
</span></span><span id="114" class="l"><a class="l" href="#114">114: </a><span class="php-comment"> * @param array le talbeau des colonnes à trier constituer de nom de clé en clé et d'ordres de tri en valeur. |
</span></span><span id="115" class="l"><a class="l" href="#115">115: </a><span class="php-comment"> * @param string le type de tri à appliquer. |
</span></span><span id="116" class="l"><a class="l" href="#116">116: </a><span class="php-comment"> * @return array le tableau trié. |
</span></span><span id="117" class="l"><a class="l" href="#117">117: </a><span class="php-comment"> */</span> |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_trierMDType" href="#_trierMDType">trierMDType</a>(&<span class="php-var">$tableau</span>, <span class="php-var">$cols</span>, <span class="php-var">$type</span> = self::TRI_CASSE_INSENSIBLE) { |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> self::<span class="php-var">$triMultiDimension</span> = <span class="php-var">$cols</span>; |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> self::<span class="php-var">$triType</span> = <span class="php-var">$type</span>; |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-keyword2">uasort</span>(<span class="php-var">$tableau</span>, <span class="php-keyword1">array</span>(<span class="php-quote">'self'</span>, <span class="php-quote">'comparer'</span>)); |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> <span class="php-keyword1">return</span> <span class="php-var">$tableau</span>; |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> } |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_comparer" href="#_comparer">comparer</a>(<span class="php-var">$a</span>, <span class="php-var">$b</span>) { |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-var">$resultat</span> = <span class="php-num">0</span>; |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-keyword1">foreach</span> (self::<span class="php-var">$triMultiDimension</span> <span class="php-keyword1">as</span> <span class="php-var">$champ</span> => <span class="php-var">$ordre</span>) { |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-keyword1">if</span> (<span class="php-var">$resultat</span> == <span class="php-num">0</span>) { |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> <span class="php-var">$mot_01</span> = Chaine::supprimerAccents(<span class="php-var">$b</span>[<span class="php-var">$champ</span>]); |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> <span class="php-var">$mot_02</span> = Chaine::supprimerAccents(<span class="php-var">$a</span>[<span class="php-var">$champ</span>]); |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> <span class="php-keyword1">switch</span> (self::<span class="php-var">$triType</span>) { |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> <span class="php-keyword1">case</span> self::TRI_NATUREL : |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> <span class="php-var">$resultat</span> = (<span class="php-var">$ordre</span> == SORT_DESC) ? <span class="php-keyword2">strnatcmp</span>(<span class="php-var">$mot_01</span>, <span class="php-var">$mot_02</span>) : <span class="php-keyword2">strnatcmp</span>(<span class="php-var">$mot_02</span>, <span class="php-var">$mot_01</span>); |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> <span class="php-keyword1">break</span>; |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> <span class="php-keyword1">case</span> self::TRI_CASSE_SENSIBLE : |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> <span class="php-var">$resultat</span> = (<span class="php-var">$ordre</span> == SORT_DESC) ? <span class="php-keyword2">strcmp</span>(<span class="php-var">$mot_01</span>, <span class="php-var">$mot_02</span>) : <span class="php-keyword2">strcmp</span>(<span class="php-var">$mot_02</span>, <span class="php-var">$mot_01</span>); |
</span><span id="137" class="l"><a class="l" href="#137">137: </a> <span class="php-keyword1">break</span>; |
</span><span id="138" class="l"><a class="l" href="#138">138: </a> <span class="php-keyword1">case</span> self::TRI_CASSE_INSENSIBLE : |
</span><span id="139" class="l"><a class="l" href="#139">139: </a> <span class="php-var">$resultat</span> = (<span class="php-var">$ordre</span> == SORT_DESC) ? <span class="php-keyword2">strcasecmp</span>(<span class="php-var">$mot_01</span>, <span class="php-var">$mot_02</span>) : <span class="php-keyword2">strcasecmp</span>(<span class="php-var">$mot_02</span>, <span class="php-var">$mot_01</span>); |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> <span class="php-keyword1">break</span>; |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> <span class="php-keyword1">default</span>: |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> <span class="php-var">$resultat</span> = (<span class="php-var">$ordre</span> == SORT_DESC) ? <span class="php-keyword2">strcasecmp</span>(<span class="php-var">$mot_01</span>, <span class="php-var">$mot_02</span>) : <span class="php-keyword2">strcasecmp</span>(<span class="php-var">$mot_02</span>, <span class="php-var">$mot_01</span>); |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-keyword1">break</span>; |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> } |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> } |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> } |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> <span class="php-keyword1">return</span> <span class="php-var">$resultat</span>; |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> } |
</span><span id="150" class="l"><a class="l" href="#150">150: </a>} |
</span><span id="151" class="l"><a class="l" href="#151">151: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Pattern.html |
---|
New file |
0,0 → 1,308 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Pattern | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li class="active"><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li class="active"><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Utilitaire.html" title="Summary of Utilitaire"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Pattern</h1> |
<div class="description"> |
<p>Classe fournissant des constantes correspondant à des expressions |
régulières de vérification très courrantes.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Utilitaire.html">Utilitaire</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2009, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Pattern.php 299 2011-01-18 14:03:46Z jpm $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Pattern.html#3-23" title="Go to source code">framework/utilitaires/Pattern.php</a><br> |
</div> |
<table class="summary" id="constants"> |
<caption>Constants summary</caption> |
<tr data-order="PRENOM" id="PRENOM"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Pattern.html#16" title="Go to source code"><b>PRENOM</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"[\p{L}-]+"</span></code></td> |
<td class="description"><div> |
<a href="#PRENOM" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="NOM" id="NOM"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Pattern.html#17" title="Go to source code"><b>NOM</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"[\p{Lu}]+"</span></code></td> |
<td class="description"><div> |
<a href="#NOM" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="COURRIEL" id="COURRIEL"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Pattern.html#18" title="Go to source code"><b>COURRIEL</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"[a-z0-9!#</span><span class="php-var">$</span><span class="php-quote">%&'*+=?^_`{|}~-]+(?:\\.[a-z0-9!#</span><span class="php-var">$</span><span class="php-quote">%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"</span></code></td> |
<td class="description"><div> |
<a href="#COURRIEL" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="URL" id="URL"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Pattern.html#19" title="Go to source code"><b>URL</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"^(?:(?:ht|f)tp(?:s?)\\:\\/\\/|~/|/)?(?:\\w+:\\w+@)?(?:(?:[-\\w]+\\.)+(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?::[\\d]{1,5})?(?:(?:(?:/(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,=]|%[a-f\\d]{2})+)+|/)+|\\?|#)?(?:(?:\\?(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,*:]|%[a-f\\d{2}])+=(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,*:=]|%[a-f\\d]{2})*)(?:&(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,*:]|%[a-f\\d{2}])+=(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,*:=]|%[a-f\\d]{2})*)*)*(?:#(?:[-\\w~!</span><span class="php-var">$</span><span class="php-quote">+|.,*:=]|%[a-f\\d]{2})*)?</span><span class="php-var">$</span><span class="php-quote">"</span></code></td> |
<td class="description"><div> |
<a href="#URL" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="HEURE_MINUTE" id="HEURE_MINUTE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Pattern.html#20" title="Go to source code"><b>HEURE_MINUTE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"^(?:[0-1][0-9]|2[0-4]):(?:[0-5][0-9]|60)</span><span class="php-var">$</span><span class="php-quote">"</span></code></td> |
<td class="description"><div> |
<a href="#HEURE_MINUTE" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="LATITUDE" id="LATITUDE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Pattern.html#21" title="Go to source code"><b>LATITUDE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"^-?([0-8]?[0-9]([.,][0-9]*)?|90)</span><span class="php-var">$</span><span class="php-quote">"</span></code></td> |
<td class="description"><div> |
<a href="#LATITUDE" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="LONGITUDE" id="LONGITUDE"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Pattern.html#22" title="Go to source code"><b>LONGITUDE</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">"^-?((1[0-7][0-9]|[1-9]?[0-9])([.,][0-9]*)?|180)</span><span class="php-var">$</span><span class="php-quote">"</span></code></td> |
<td class="description"><div> |
<a href="#LONGITUDE" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-MonScript.html |
---|
New file |
0,0 → 1,306 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class MonScript | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li class="active"><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li class="active"><a href="class-MonScript.html">MonScript</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-None.html" title="Summary of None"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class MonScript</h1> |
<div class="description"> |
<p>Exemple de script utilisable avec le TBFramework. Pour le lancer, taper en |
ligne de commande, en vous plaçant dans le dossier /framework/exemple/scripts/ |
: <code>/opt/lampp/bin/php cli.php mon_script -a test</code></p> |
</div> |
<dl class="tree"> |
<dd style="padding-left:0px"> |
<a href="class-Script.html"><span>Script</span></a> |
</dd> |
<dd style="padding-left:30px"> |
<img src="resources/inherit.png" alt="Extended by"> |
<b><span>MonScript</span></b> |
</dd> |
</dl> |
<div class="info"> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id$<br> |
<b>Located at</b> <a href="source-class-MonScript.html#3-65" title="Go to source code">exemples/scripts/modules/mon_script/MonScript.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="executer" id="_executer"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_executer">#</a> |
<code><a href="source-class-MonScript.html#19-31" title="Go to source code">executer</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary inherited"> |
<caption>Methods inherited from <a href="class-Script.html#methods">Script</a></caption> |
<tr> |
<td><code> |
<a href="class-Script.html#___construct">__construct()</a>, |
<a href="class-Script.html#_afficherAvancement">afficherAvancement()</a>, |
<a href="class-Script.html#_formaterMsg">formaterMsg()</a>, |
<a href="class-Script.html#_getParametre">getParametre()</a>, |
<a href="class-Script.html#_getScriptChemin">getScriptChemin()</a>, |
<a href="class-Script.html#_getScriptNom">getScriptNom()</a>, |
<a href="class-Script.html#_traiterAvertissement">traiterAvertissement()</a>, |
<a href="class-Script.html#_traiterErreur">traiterErreur()</a>, |
<a href="class-Script.html#_traiterInfo">traiterInfo()</a> |
</code></td> |
</tr> |
</table> |
<table class="summary inherited"> |
<caption>Constants inherited from <a href="class-Script.html#constants">Script</a></caption> |
<tr> |
<td><code> |
<a href="class-Script.html#MSG_AVERTISSEMENT"><b>MSG_AVERTISSEMENT</b></a>, |
<a href="class-Script.html#MSG_ERREUR"><b>MSG_ERREUR</b></a>, |
<a href="class-Script.html#MSG_INFO"><b>MSG_INFO</b></a>, |
<a href="class-Script.html#MSG_LOG"><b>MSG_LOG</b></a> |
</code></td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr data-order="parametres_autorises" id="$parametres_autorises"> |
<td class="attributes"><code> |
protected |
array |
</code></td> |
<td class="name"> |
<a href="source-class-MonScript.html#16-17" title="Go to source code"><var>$parametres_autorises</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">array</span>( |
<span class="php-quote">'-y'</span> => <span class="php-keyword1">array</span>(<span class="php-keyword1">false</span>, <span class="php-quote">'exemple de valeur par défaut'</span>, <span class="php-quote">'Un parametre supplémentaire de test'</span>))</code></td> |
<td class="description"><div> |
<a href="#$parametres_autorises" class="anchor">#</a> |
<div class="description short"> |
<p>Paramêtres autorisés par le script. le tableau est de la forme suivante |
:</p> |
<ul> |
<li>clé = nom du paramêtre '-foo'</li> |
<li>value = contient un nouveau tableau composé de cette façon : |
<ul> |
<li>booléen: true si le paramêtre est obligatoire</li> |
<li>booléen ou var : true si le paramêtre nécessite un valeur à sa suite ou |
la valeur par défaut</li> |
<li>string: description du contenu du paramêtre</li> |
</ul> |
</li> |
</ul> |
<p>Les paramêtres optionels devraient être déclaré à la fin du tableau. Le |
dernier parametre du tableau peut avoir la valeur '...', il contiendra alors |
l'ensemble des paramêtres suivant trouvés sur la ligne de commande.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Paramêtres autorisés par le script. le tableau est de la forme suivante |
:</p> |
<ul> |
<li>clé = nom du paramêtre '-foo'</li> |
<li>value = contient un nouveau tableau composé de cette façon : - booléen: |
true si le paramêtre est obligatoire - booléen ou var : true si le paramêtre |
nécessite un valeur à sa suite ou la valeur par défaut - string: description |
du contenu du paramêtre</li> |
</ul> |
<p>Les paramêtres optionels devraient être déclaré à la fin du tableau. Le |
dernier parametre du tableau peut avoir la valeur '...', il contiendra alors |
l'ensemble des paramêtres suivant trouvés sur la ligne de commande.</p> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary inherited"> |
<caption>Properties inherited from <a href="class-Script.html#properties">Script</a></caption> |
<tr> |
<td><code> |
<a href="class-Script.html#$parametres"><var>$parametres</var></a> |
</code></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Log.html |
---|
New file |
0,0 → 1,416 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Log | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li class="active"><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Log</h1> |
<div class="description"> |
<p>Classe permettant de logger des messages dans les fichier situés dans le |
dossier de log.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2009, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL</a><br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL</a><br> |
<b>Author:</b> |
Aurélien PERONNET <<a |
href="mailto:aurelien@tela-botanica.org">aurelien@<!-- -->tela-botanica.org</a>><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Log.php 274 2010-12-28 15:37:22Z jpm $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Log.html#3-148" title="Go to source code">framework/Log.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="initialiser" id="_initialiser"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_initialiser">#</a> |
<code><a href="source-class-Log.html#45-55" title="Go to source code">initialiser</a>( )</code> |
<div class="description short"> |
<p>Initialiser les logs par défaut, sans tenir comptes des paramêtres de |
config.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Initialiser les logs par défaut, sans tenir comptes des paramêtres de |
config.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="configurer" id="_configurer"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_configurer">#</a> |
<code><a href="source-class-Log.html#57-65" title="Go to source code">configurer</a>( )</code> |
<div class="description short"> |
<p>Configure le Log à partir des paramêtres de config.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Configure le Log à partir des paramêtres de config.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="ajouterEntree" id="_ajouterEntree"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_ajouterEntree">#</a> |
<code><a href="source-class-Log.html#67-82" title="Go to source code">ajouterEntree</a>( <span>string <var>$nomFichier</var></span>, <span>mixed <var>$entree</var></span>, <span>mixed <var>$mode</var> = <span class="php-quote">'a+'</span></span> )</code> |
<div class="description short"> |
<p>Ajoute une entrée au log spécifié par le paramètre $nomFichier</p> |
</div> |
<div class="description detailed hidden"> |
<p>Ajoute une entrée au log spécifié par le paramètre $nomFichier</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$nomFichier</var></dt> |
<dd><code>string</code><br>$nomFichier le nom du fichier dans lequel écrire</dd> |
<dt><var>$entree</var></dt> |
<dd></dd> |
<dt><var>$mode</var></dt> |
<dd></dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="viderLog" id="_viderLog"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_viderLog">#</a> |
<code><a href="source-class-Log.html#84-90" title="Go to source code">viderLog</a>( <span>string <var>$nomFichier</var></span> )</code> |
<div class="description short"> |
<p>Vide un fichier log indiqué</p> |
</div> |
<div class="description detailed hidden"> |
<p>Vide un fichier log indiqué</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$nomFichier</var></dt> |
<dd><code>string</code><br>$nomFichier le nom du fichier à vider</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="verifierOuvrirFichier" id="_verifierOuvrirFichier"> |
<td class="attributes"><code> |
public static |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_verifierOuvrirFichier">#</a> |
<code><a href="source-class-Log.html#92-112" title="Go to source code">verifierOuvrirFichier</a>( <span>string <var>$nomFichier</var></span>, <span>mixed <var>$mode</var></span> )</code> |
<div class="description short"> |
<p>Vérifie la présence d'un fichier dans le tableau, ses droits d'écriture, |
l'ouvre si nécessaire.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Vérifie la présence d'un fichier dans le tableau, ses droits d'écriture, |
l'ouvre si nécessaire.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$nomFichier</var></dt> |
<dd><code>string</code><br>$nomFichier le nom du fichier dont on doit vérifier la présence</dd> |
<dt><var>$mode</var></dt> |
<dd></dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true si le fichier est ouvert ou maintenant accessible, false sinon<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="__destruct" id="___destruct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___destruct">#</a> |
<code><a href="source-class-Log.html#142-147" title="Go to source code">__destruct</a>( )</code> |
<div class="description short"> |
<p>Destructeur de classe, ferme les descripteurs ouverts.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Destructeur de classe, ferme les descripteurs ouverts.</p> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Registre.html |
---|
New file |
0,0 → 1,186 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Registre.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li class="active"><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Registre.html" title="Summary of Registre"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe Registre, qui permet un accès à différentes variables et paramètres à travers les autres classes. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * C'est un remplaçant à la variable magique $_GLOBALS de Php. |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * C'est un singleton. |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * Si vous voulez paramètré votre application via un fichier de configuration, utilisez plutôt la classe @see Config. |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @category php 5.2 |
</span></span><span id="10" class="l"><a class="l" href="#10">10: </a><span class="php-comment"> * @package Framework |
</span></span><span id="11" class="l"><a class="l" href="#11">11: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jmp@tela-botanica.org> |
</span></span><span id="12" class="l"><a class="l" href="#12">12: </a><span class="php-comment"> * @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="13" class="l"><a class="l" href="#13">13: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
</span></span><span id="14" class="l"><a class="l" href="#14">14: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
</span></span><span id="15" class="l"><a class="l" href="#15">15: </a><span class="php-comment"> * @version $Id: Registre.php 443 2013-10-22 15:09:30Z raphael $ |
</span></span><span id="16" class="l"><a class="l" href="#16">16: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="17" class="l"><a class="l" href="#17">17: </a><span class="php-comment"> * |
</span></span><span id="18" class="l"><a class="l" href="#18">18: </a><span class="php-comment">*/</span> |
</span><span id="19" class="l"><a class="l" href="#19">19: </a><span class="php-keyword1">class</span> <a id="Registre" href="#Registre">Registre</a> { |
</span><span id="20" class="l"><a class="l" href="#20">20: </a> |
</span><span id="21" class="l"><a class="l" href="#21">21: </a> <span class="php-comment">/** Tableau associatif stockant les variables. */</span> |
</span><span id="22" class="l"><a class="l" href="#22">22: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$stockage" href="#$stockage">$stockage</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="23" class="l"><a class="l" href="#23">23: </a> |
</span><span id="24" class="l"><a class="l" href="#24">24: </a> <span class="php-comment">/** |
</span></span><span id="25" class="l"><a class="l" href="#25">25: </a><span class="php-comment"> * Ajoute un objet au tableau selon un intitulé donné. |
</span></span><span id="26" class="l"><a class="l" href="#26">26: </a><span class="php-comment"> * @param string l'intitulé sous lequel l'objet sera conservé |
</span></span><span id="27" class="l"><a class="l" href="#27">27: </a><span class="php-comment"> * @param mixed l'objet à conserver |
</span></span><span id="28" class="l"><a class="l" href="#28">28: </a><span class="php-comment"> */</span> |
</span><span id="29" class="l"><a class="l" href="#29">29: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_set" href="#_set">set</a>(<span class="php-var">$intitule</span>, <span class="php-var">$objet</span>) { |
</span><span id="30" class="l"><a class="l" href="#30">30: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$objet</span>) && <span class="php-keyword1">isset</span>(self::<span class="php-var">$stockage</span>[<span class="php-var">$intitule</span>])) { |
</span><span id="31" class="l"><a class="l" href="#31">31: </a> self::<span class="php-var">$stockage</span>[<span class="php-var">$intitule</span>] = <span class="php-keyword2">array_merge</span>((<span class="php-keyword1">array</span>) self::<span class="php-var">$stockage</span>[<span class="php-var">$intitule</span>], (<span class="php-keyword1">array</span>) <span class="php-var">$objet</span>); |
</span><span id="32" class="l"><a class="l" href="#32">32: </a> <span class="php-var">$message</span> = <span class="php-quote">"Le tableau \"</span><span class="php-var">$intitule</span><span class="php-quote">\" présent dans le registre a été fusionné avec un nouveau tableau de même intitulé !"</span>; |
</span><span id="33" class="l"><a class="l" href="#33">33: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$message</span>, E_USER_WARNING); |
</span><span id="34" class="l"><a class="l" href="#34">34: </a> } <span class="php-keyword1">else</span> { |
</span><span id="35" class="l"><a class="l" href="#35">35: </a> self::<span class="php-var">$stockage</span>[<span class="php-var">$intitule</span>] = <span class="php-var">$objet</span>; |
</span><span id="36" class="l"><a class="l" href="#36">36: </a> } |
</span><span id="37" class="l"><a class="l" href="#37">37: </a> } |
</span><span id="38" class="l"><a class="l" href="#38">38: </a> |
</span><span id="39" class="l"><a class="l" href="#39">39: </a> <span class="php-comment">/** |
</span></span><span id="40" class="l"><a class="l" href="#40">40: </a><span class="php-comment"> * Renvoie le contenu associé à l'intitulé donné en paramètre. |
</span></span><span id="41" class="l"><a class="l" href="#41">41: </a><span class="php-comment"> * @return mixed l'objet associé à l'intitulé ou null s'il n'est pas présent |
</span></span><span id="42" class="l"><a class="l" href="#42">42: </a><span class="php-comment"> */</span> |
</span><span id="43" class="l"><a class="l" href="#43">43: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_get" href="#_get">get</a>(<span class="php-var">$intitule</span>) { |
</span><span id="44" class="l"><a class="l" href="#44">44: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">isset</span>(self::<span class="php-var">$stockage</span>[<span class="php-var">$intitule</span>]) ? self::<span class="php-var">$stockage</span>[<span class="php-var">$intitule</span>] : <span class="php-keyword1">null</span>; |
</span><span id="45" class="l"><a class="l" href="#45">45: </a> } |
</span><span id="46" class="l"><a class="l" href="#46">46: </a> |
</span><span id="47" class="l"><a class="l" href="#47">47: </a> <span class="php-comment">/** |
</span></span><span id="48" class="l"><a class="l" href="#48">48: </a><span class="php-comment"> * Détruit l'objet associé à l'intitulé, n'a pas d'effet si il n'y a pas d'objet associé. |
</span></span><span id="49" class="l"><a class="l" href="#49">49: </a><span class="php-comment"> * @param string l'intitulé de l'entrée du registre à détruire. |
</span></span><span id="50" class="l"><a class="l" href="#50">50: </a><span class="php-comment"> */</span> |
</span><span id="51" class="l"><a class="l" href="#51">51: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_detruire" href="#_detruire">detruire</a>(<span class="php-var">$intitule</span>) { |
</span><span id="52" class="l"><a class="l" href="#52">52: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(self::<span class="php-var">$stockage</span>[<span class="php-var">$intitule</span>])) { |
</span><span id="53" class="l"><a class="l" href="#53">53: </a> <span class="php-keyword1">unset</span>(self::<span class="php-var">$stockage</span>[<span class="php-var">$intitule</span>]); |
</span><span id="54" class="l"><a class="l" href="#54">54: </a> } |
</span><span id="55" class="l"><a class="l" href="#55">55: </a> } |
</span><span id="56" class="l"><a class="l" href="#56">56: </a> |
</span><span id="57" class="l"><a class="l" href="#57">57: </a> <span class="php-comment">/** |
</span></span><span id="58" class="l"><a class="l" href="#58">58: </a><span class="php-comment"> * Teste si le registre contient une donnée pour un intitulé d'entrée donné. |
</span></span><span id="59" class="l"><a class="l" href="#59">59: </a><span class="php-comment"> * @param string l'intitulé de l'entrée du registre à tester. |
</span></span><span id="60" class="l"><a class="l" href="#60">60: </a><span class="php-comment"> * @return boolean true si un objet associé à cet intitulé est présent, false sinon |
</span></span><span id="61" class="l"><a class="l" href="#61">61: </a><span class="php-comment"> */</span> |
</span><span id="62" class="l"><a class="l" href="#62">62: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_existe" href="#_existe">existe</a>(<span class="php-var">$intitule</span>) { |
</span><span id="63" class="l"><a class="l" href="#63">63: </a> <span class="php-keyword1">return</span> <span class="php-keyword2">array_key_exists</span>(<span class="php-var">$intitule</span>, self::<span class="php-var">$stockage</span>); |
</span><span id="64" class="l"><a class="l" href="#64">64: </a> } |
</span><span id="65" class="l"><a class="l" href="#65">65: </a>} |
</span><span id="66" class="l"><a class="l" href="#66">66: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Registre.html |
---|
New file |
0,0 → 1,350 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Registre | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li class="active"><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Registre</h1> |
<div class="description"> |
<p>Classe Registre, qui permet un accès à différentes variables et |
paramètres à travers les autres classes. C'est un remplaçant à la variable |
magique $_GLOBALS de Php. C'est un singleton. Si vous voulez paramètré votre |
application via un fichier de configuration, utilisez plutôt la classe @see |
Config.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
php 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2009, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL</a><br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jmp@tela-botanica.org">jmp@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Registre.php 443 2013-10-22 15:09:30Z raphael $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Registre.html#3-65" title="Go to source code">framework/Registre.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="set" id="_set"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_set">#</a> |
<code><a href="source-class-Registre.html#24-37" title="Go to source code">set</a>( <span>string <var>$intitule</var></span>, <span>mixed <var>$objet</var></span> )</code> |
<div class="description short"> |
<p>Ajoute un objet au tableau selon un intitulé donné.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Ajoute un objet au tableau selon un intitulé donné.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$intitule</var></dt> |
<dd><code>string</code><br>l'intitulé sous lequel l'objet sera conservé</dd> |
<dt><var>$objet</var></dt> |
<dd><code>mixed</code><br>l'objet à conserver</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="get" id="_get"> |
<td class="attributes"><code> |
public static |
mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_get">#</a> |
<code><a href="source-class-Registre.html#39-45" title="Go to source code">get</a>( <span>mixed <var>$intitule</var></span> )</code> |
<div class="description short"> |
<p>Renvoie le contenu associé à l'intitulé donné en paramètre.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Renvoie le contenu associé à l'intitulé donné en paramètre.</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed</code><br>l'objet associé à l'intitulé ou null s'il n'est pas présent<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="detruire" id="_detruire"> |
<td class="attributes"><code> |
public static |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_detruire">#</a> |
<code><a href="source-class-Registre.html#47-55" title="Go to source code">detruire</a>( <span>string <var>$intitule</var></span> )</code> |
<div class="description short"> |
<p>Détruit l'objet associé à l'intitulé, n'a pas d'effet si il n'y a pas |
d'objet associé.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Détruit l'objet associé à l'intitulé, n'a pas d'effet si il n'y a pas |
d'objet associé.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$intitule</var></dt> |
<dd><code>string</code><br>l'intitulé de l'entrée du registre à détruire.</dd> |
</dl></div> |
</div> |
</div></td> |
</tr> |
<tr data-order="existe" id="_existe"> |
<td class="attributes"><code> |
public static |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_existe">#</a> |
<code><a href="source-class-Registre.html#57-64" title="Go to source code">existe</a>( <span>string <var>$intitule</var></span> )</code> |
<div class="description short"> |
<p>Teste si le registre contient une donnée pour un intitulé d'entrée |
donné.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Teste si le registre contient une donnée pour un intitulé d'entrée |
donné.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$intitule</var></dt> |
<dd><code>string</code><br>l'intitulé de l'entrée du registre à tester.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true si un objet associé à cet intitulé est présent, false sinon<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Debug.html |
---|
New file |
0,0 → 1,312 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Debug.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li class="active"><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Debug.html" title="Summary of Debug"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe fournissant des fonctions de débogage équivalante à var_dump et print_r. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * L'affichage et l'utilisation de ces fonctions sont améliorés via cette classe. |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * Cette classe est inspirée de la classe Zend_Debug. |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @package Framework |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @version $Id: Debug.php 365 2011-09-30 08:19:57Z jpm $ |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> */</span> |
</span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-keyword1">class</span> <a id="Debug" href="#Debug">Debug</a> { |
</span><span id="18" class="l"><a class="l" href="#18"> 18: </a> |
</span><span id="19" class="l"><a class="l" href="#19"> 19: </a> <span class="php-comment">/** Paramètrer le fichier de config avec "php:Debug::MODE_ECHO" : les messages sont affichés en utilisant echo au moment |
</span></span><span id="20" class="l"><a class="l" href="#20"> 20: </a><span class="php-comment"> * où ils sont déclenchés dans le code.*/</span> |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> <span class="php-keyword1">const</span> <a id="MODE_ECHO" href="#MODE_ECHO">MODE_ECHO</a> = <span class="php-quote">'echo'</span>; |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> <span class="php-comment">/** Paramètrer le fichier de config avec "php:Debug::MODE_NOTICE" : les message sont stockés par le gestionnaire |
</span></span><span id="24" class="l"><a class="l" href="#24"> 24: </a><span class="php-comment"> * d'exception sous forme d'erreur de type E_USER_NOTICE et sont renvoyés sur la sortie standard à la fin de l'execution |
</span></span><span id="25" class="l"><a class="l" href="#25"> 25: </a><span class="php-comment"> * du programme (via echo).*/</span> |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> <span class="php-keyword1">const</span> <a id="MODE_NOTICE" href="#MODE_NOTICE">MODE_NOTICE</a> = <span class="php-quote">'e_user_notice'</span>; |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-comment">/** Paramètrer le fichier de config avec "php:Debug::MODE_ENTETE_HTTP" : les message sont stockés par le gestionnaire |
</span></span><span id="29" class="l"><a class="l" href="#29"> 29: </a><span class="php-comment"> * d'exception sous forme d'erreur de type E_USER_NOTICE et sont renvoyés dans un entête HTTP (X_REST_DEBOGAGE_MESSAGES) |
</span></span><span id="30" class="l"><a class="l" href="#30"> 30: </a><span class="php-comment"> * à la fin de l'execution du programme. |
</span></span><span id="31" class="l"><a class="l" href="#31"> 31: </a><span class="php-comment"> * Surtout utile pour le Serveur REST. */</span> |
</span><span id="32" class="l"><a class="l" href="#32"> 32: </a> <span class="php-keyword1">const</span> <a id="MODE_ENTETE_HTTP" href="#MODE_ENTETE_HTTP">MODE_ENTETE_HTTP</a> = <span class="php-quote">'entete_http'</span>; |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> <span class="php-comment">/** Mode de php (cli ou sapi) */</span> |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$mode" href="#$mode">$mode</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> <span class="php-comment">/** Tableau des noms des paramètres à définir dans le fichier de config car obligatoirement nécessaire à cette classe.*/</span> |
</span><span id="38" class="l"><a class="l" href="#38"> 38: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$parametres_obligatoires" href="#$parametres_obligatoires">$parametres_obligatoires</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'debogage'</span>, <span class="php-quote">'debogage_mode'</span>); |
</span><span id="39" class="l"><a class="l" href="#39"> 39: </a> |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> <span class="php-comment">/** |
</span></span><span id="41" class="l"><a class="l" href="#41"> 41: </a><span class="php-comment"> * Accesseur pour le mode |
</span></span><span id="42" class="l"><a class="l" href="#42"> 42: </a><span class="php-comment"> * @return string le mode de php |
</span></span><span id="43" class="l"><a class="l" href="#43"> 43: </a><span class="php-comment"> */</span> |
</span><span id="44" class="l"><a class="l" href="#44"> 44: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getMode" href="#_getMode">getMode</a>() { |
</span><span id="45" class="l"><a class="l" href="#45"> 45: </a> <span class="php-keyword1">if</span> (self::<span class="php-var">$mode</span> === <span class="php-keyword1">null</span>) { |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> self::<span class="php-var">$mode</span> = PHP_SAPI; |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> } |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-keyword1">return</span> self::<span class="php-var">$mode</span>; |
</span><span id="49" class="l"><a class="l" href="#49"> 49: </a> } |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> <span class="php-comment">/** |
</span></span><span id="52" class="l"><a class="l" href="#52"> 52: </a><span class="php-comment"> * Equivalent de var_dump |
</span></span><span id="53" class="l"><a class="l" href="#53"> 53: </a><span class="php-comment"> * @param mixed $variable la variable à dumper |
</span></span><span id="54" class="l"><a class="l" href="#54"> 54: </a><span class="php-comment"> * @param string $mot_cle le mot cle à associer à la variable |
</span></span><span id="55" class="l"><a class="l" href="#55"> 55: </a><span class="php-comment"> * @param boolean $echo si true on affiche le résultat, si false on ne renvoie que la chaine sans l'afficher |
</span></span><span id="56" class="l"><a class="l" href="#56"> 56: </a><span class="php-comment"> * @return string la chaine à afficher representant le dump ou null si echo |
</span></span><span id="57" class="l"><a class="l" href="#57"> 57: </a><span class="php-comment"> */</span> |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_dump" href="#_dump">dump</a>(<span class="php-var">$variable</span>, <span class="php-var">$mot_cle</span> = <span class="php-keyword1">null</span>, <span class="php-var">$echo</span> = <span class="php-keyword1">false</span>) { |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-comment">// var_dump de la variable dans un buffer et récupération de la sortie</span> |
</span><span id="60" class="l"><a class="l" href="#60"> 60: </a> <span class="php-keyword2">ob_start</span>(); |
</span><span id="61" class="l"><a class="l" href="#61"> 61: </a> <span class="php-keyword2">var_dump</span>(<span class="php-var">$variable</span>); |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> <span class="php-var">$sortie</span> = <span class="php-keyword2">ob_get_clean</span>(); |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-comment">// Pré-traitement de la sortie</span> |
</span><span id="65" class="l"><a class="l" href="#65"> 65: </a> <span class="php-var">$sortie</span> = <span class="php-keyword2">preg_replace</span>(<span class="php-quote">"/\]\=\>\n(\s+)/m"</span>, <span class="php-quote">"] => "</span>, <span class="php-var">$sortie</span>); |
</span><span id="66" class="l"><a class="l" href="#66"> 66: </a> |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> <span class="php-comment">// Traitement général du débogage</span> |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> <span class="php-keyword1">return</span> self::traiterDebogage(<span class="php-var">$mot_cle</span>, <span class="php-var">$sortie</span>, <span class="php-var">$echo</span>); |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> } |
</span><span id="70" class="l"><a class="l" href="#70"> 70: </a> |
</span><span id="71" class="l"><a class="l" href="#71"> 71: </a> <span class="php-comment">/** |
</span></span><span id="72" class="l"><a class="l" href="#72"> 72: </a><span class="php-comment"> * Equivalent de print_r. |
</span></span><span id="73" class="l"><a class="l" href="#73"> 73: </a><span class="php-comment"> * @param mixed $variable la variable à afficher |
</span></span><span id="74" class="l"><a class="l" href="#74"> 74: </a><span class="php-comment"> * @param string $mot_cle le mot cle à associer |
</span></span><span id="75" class="l"><a class="l" href="#75"> 75: </a><span class="php-comment"> * @param boolean $echo faire un echo ou non |
</span></span><span id="76" class="l"><a class="l" href="#76"> 76: </a><span class="php-comment"> * @return string la chaine contenant la variable printée ou null si echo |
</span></span><span id="77" class="l"><a class="l" href="#77"> 77: </a><span class="php-comment"> */</span> |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_printr" href="#_printr">printr</a>(<span class="php-var">$variable</span>, <span class="php-var">$mot_cle</span> = <span class="php-keyword1">null</span>, <span class="php-var">$echo</span> = <span class="php-keyword1">false</span>) { |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> <span class="php-comment">// Récupération de la sortie</span> |
</span><span id="80" class="l"><a class="l" href="#80"> 80: </a> <span class="php-var">$sortie</span> = <span class="php-keyword2">print_r</span>(<span class="php-var">$variable</span>, <span class="php-keyword1">true</span>); |
</span><span id="81" class="l"><a class="l" href="#81"> 81: </a> |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> <span class="php-comment">// Traitement général du débogage</span> |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> <span class="php-keyword1">return</span> self::traiterDebogage(<span class="php-var">$mot_cle</span>, <span class="php-var">$sortie</span>, <span class="php-var">$echo</span>); |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> } |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> <span class="php-comment">/** |
</span></span><span id="87" class="l"><a class="l" href="#87"> 87: </a><span class="php-comment"> * Affichage d'informations sur l'espace mémoire occupé par une variable |
</span></span><span id="88" class="l"><a class="l" href="#88"> 88: </a><span class="php-comment"> * |
</span></span><span id="89" class="l"><a class="l" href="#89"> 89: </a><span class="php-comment"> * @link http://forum.webmaster-rank.info/developpement-site/code-taille-memoire-d-une-variable-en-php-t1344.html |
</span></span><span id="90" class="l"><a class="l" href="#90"> 90: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="91" class="l"><a class="l" href="#91"> 91: </a><span class="php-comment"> * |
</span></span><span id="92" class="l"><a class="l" href="#92"> 92: </a><span class="php-comment"> * @param mixed $var la variable dont on veut connaître l'empreinte mémoire. |
</span></span><span id="93" class="l"><a class="l" href="#93"> 93: </a><span class="php-comment"> * @param string $mot_cle le mot cle à associer |
</span></span><span id="94" class="l"><a class="l" href="#94"> 94: </a><span class="php-comment"> * @param boolean $echo faire un echo ou non |
</span></span><span id="95" class="l"><a class="l" href="#95"> 95: </a><span class="php-comment"> * |
</span></span><span id="96" class="l"><a class="l" href="#96"> 96: </a><span class="php-comment"> * @return string la chaine d'information sur l'espace mémoire occupé ou bien null si echo |
</span></span><span id="97" class="l"><a class="l" href="#97"> 97: </a><span class="php-comment"> */</span> |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_tailleMemoireVar" href="#_tailleMemoireVar">tailleMemoireVar</a>(<span class="php-var">$var</span>, <span class="php-var">$mot_cle</span> = <span class="php-keyword1">null</span>, <span class="php-var">$echo</span> = <span class="php-keyword1">false</span>) { |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> <span class="php-var">$memoire_depart</span> = <span class="php-keyword2">memory_get_usage</span>(); |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> <span class="php-var">$temp</span> = <span class="php-keyword2">unserialize</span>(<span class="php-keyword2">serialize</span>(<span class="php-var">$var</span>)); |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> <span class="php-var">$taille</span> = <span class="php-keyword2">memory_get_usage</span>() - <span class="php-var">$memoire_depart</span>; |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> <span class="php-var">$sortie</span> = Fichier::convertirTaille(<span class="php-var">$taille</span>); |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> <span class="php-keyword1">return</span> self::traiterDebogage(<span class="php-var">$mot_cle</span>, <span class="php-var">$sortie</span>, <span class="php-var">$echo</span>); |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> } |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> <span class="php-comment">/** |
</span></span><span id="107" class="l"><a class="l" href="#107">107: </a><span class="php-comment"> * Affichage d'informations sur l'espace mémoire occupé par le script PHP |
</span></span><span id="108" class="l"><a class="l" href="#108">108: </a><span class="php-comment"> * |
</span></span><span id="109" class="l"><a class="l" href="#109">109: </a><span class="php-comment"> * @link http://forum.webmaster-rank.info/developpement-site/code-taille-memoire-d-une-variable-en-php-t1344.html |
</span></span><span id="110" class="l"><a class="l" href="#110">110: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="111" class="l"><a class="l" href="#111">111: </a><span class="php-comment"> * |
</span></span><span id="112" class="l"><a class="l" href="#112">112: </a><span class="php-comment"> * @param string $mot_cle le mot cle à associer |
</span></span><span id="113" class="l"><a class="l" href="#113">113: </a><span class="php-comment"> * @param boolean $echo faire un echo ou non |
</span></span><span id="114" class="l"><a class="l" href="#114">114: </a><span class="php-comment"> * |
</span></span><span id="115" class="l"><a class="l" href="#115">115: </a><span class="php-comment"> * @return string la chaine d'information sur l'espace mémoire occupé ou bien null si echo |
</span></span><span id="116" class="l"><a class="l" href="#116">116: </a><span class="php-comment"> */</span> |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_tailleMemoireScript" href="#_tailleMemoireScript">tailleMemoireScript</a>(<span class="php-var">$mot_cle</span> = <span class="php-keyword1">null</span>, <span class="php-var">$echo</span> = <span class="php-keyword1">false</span>) { |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-var">$sortie</span> = <span class="php-quote">'Mémoire -- Utilisé : '</span>.Fichier::convertirTaille(<span class="php-keyword2">memory_get_usage</span>(<span class="php-keyword1">false</span>)). |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> <span class="php-quote">' || Alloué : '</span>. |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> Fichier::convertirTaille(<span class="php-keyword2">memory_get_usage</span>(<span class="php-keyword1">true</span>)) . |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> <span class="php-quote">' || MAX Utilisé : '</span>. |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> Fichier::convertirTaille(<span class="php-keyword2">memory_get_peak_usage</span>(<span class="php-keyword1">false</span>)). |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-quote">' || MAX Alloué : '</span>. |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> Fichier::convertirTaille(<span class="php-keyword2">memory_get_peak_usage</span>(<span class="php-keyword1">true</span>)). |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> <span class="php-quote">' || MAX autorisé : '</span>. |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-keyword2">ini_get</span>(<span class="php-quote">'memory_limit'</span>); |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-comment">// Traitement général du débogage</span> |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> <span class="php-keyword1">return</span> self::traiterDebogage(<span class="php-var">$mot_cle</span>, <span class="php-var">$sortie</span>, <span class="php-var">$echo</span>); |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> } |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> <span class="php-comment">/** |
</span></span><span id="133" class="l"><a class="l" href="#133">133: </a><span class="php-comment"> * Traite une chaine de débogage et les mots clés associés |
</span></span><span id="134" class="l"><a class="l" href="#134">134: </a><span class="php-comment"> * @param string $mot_cle le mot à associer à la chaine |
</span></span><span id="135" class="l"><a class="l" href="#135">135: </a><span class="php-comment"> * @param string $sortie le chaine de debogage |
</span></span><span id="136" class="l"><a class="l" href="#136">136: </a><span class="php-comment"> * @param boolean $echo faire un echo du resultat ou non |
</span></span><span id="137" class="l"><a class="l" href="#137">137: </a><span class="php-comment"> * @return string la chaine de debogage formatée ou bien null si echo |
</span></span><span id="138" class="l"><a class="l" href="#138">138: </a><span class="php-comment"> */</span> |
</span><span id="139" class="l"><a class="l" href="#139">139: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_traiterDebogage" href="#_traiterDebogage">traiterDebogage</a>(<span class="php-var">$mot_cle</span>, <span class="php-var">$sortie</span>, <span class="php-var">$echo</span>) { |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> Config::verifierPresenceParametres(self::<span class="php-var">$parametres_obligatoires</span>); |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> <span class="php-var">$debogage</span> = Config::get(<span class="php-quote">'debogage'</span>); |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> <span class="php-var">$mode</span> = Config::get(<span class="php-quote">'debogage_mode'</span>); |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-var">$mot_cle</span> = self::formaterMotCle(<span class="php-var">$mot_cle</span>); |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> <span class="php-var">$sortie</span> = self::traiterSortieSuivantMode(<span class="php-var">$mot_cle</span>, <span class="php-var">$sortie</span>); |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> <span class="php-comment">// Affichage et/ou retour</span> |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> <span class="php-keyword1">if</span> (<span class="php-var">$debogage</span> == <span class="php-keyword1">true</span>) { |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> <span class="php-keyword1">if</span> (<span class="php-var">$echo</span> === <span class="php-keyword1">true</span> || <span class="php-var">$mode</span> == self::MODE_ECHO) { |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> <span class="php-keyword1">echo</span> <span class="php-var">$sortie</span>; |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">null</span>; |
</span><span id="152" class="l"><a class="l" href="#152">152: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-var">$mode</span> == self::MODE_NOTICE || <span class="php-var">$mode</span> == self::MODE_ENTETE_HTTP) { |
</span><span id="153" class="l"><a class="l" href="#153">153: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-var">$sortie</span>, E_USER_NOTICE); |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">null</span>; |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> } <span class="php-keyword1">else</span> { |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> <span class="php-keyword1">return</span> <span class="php-var">$sortie</span>; |
</span><span id="157" class="l"><a class="l" href="#157">157: </a> } |
</span><span id="158" class="l"><a class="l" href="#158">158: </a> } |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> } |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> |
</span><span id="161" class="l"><a class="l" href="#161">161: </a> <span class="php-comment">/** |
</span></span><span id="162" class="l"><a class="l" href="#162">162: </a><span class="php-comment"> * formate un mot clé donné |
</span></span><span id="163" class="l"><a class="l" href="#163">163: </a><span class="php-comment"> * @param string $mot_cle le mot clé à formaté |
</span></span><span id="164" class="l"><a class="l" href="#164">164: </a><span class="php-comment"> * @return string le mot clé formaté ou bien un chaine vide le mot clé est null ou vide |
</span></span><span id="165" class="l"><a class="l" href="#165">165: </a><span class="php-comment"> */</span> |
</span><span id="166" class="l"><a class="l" href="#166">166: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_formaterMotCle" href="#_formaterMotCle">formaterMotCle</a>(<span class="php-var">$mot_cle</span>) { |
</span><span id="167" class="l"><a class="l" href="#167">167: </a> <span class="php-keyword1">return</span> (<span class="php-var">$mot_cle</span> === <span class="php-keyword1">null</span>) ? <span class="php-quote">''</span> : <span class="php-keyword2">rtrim</span>(<span class="php-var">$mot_cle</span>).<span class="php-quote">' '</span>; |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> } |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> <span class="php-comment">/** |
</span></span><span id="171" class="l"><a class="l" href="#171">171: </a><span class="php-comment"> * traite la sortie de la chaine de débogage suivant le mode de php |
</span></span><span id="172" class="l"><a class="l" href="#172">172: </a><span class="php-comment"> * @param string $mot_cle le mot clé associé à la chaine |
</span></span><span id="173" class="l"><a class="l" href="#173">173: </a><span class="php-comment"> * @param string $sortie la chaine de débogage |
</span></span><span id="174" class="l"><a class="l" href="#174">174: </a><span class="php-comment"> * @return string la sortie formatée pour le mode en cours |
</span></span><span id="175" class="l"><a class="l" href="#175">175: </a><span class="php-comment"> */</span> |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_traiterSortieSuivantMode" href="#_traiterSortieSuivantMode">traiterSortieSuivantMode</a>(<span class="php-var">$mot_cle</span>, <span class="php-var">$sortie</span>) { |
</span><span id="177" class="l"><a class="l" href="#177">177: </a> <span class="php-var">$mode_actuel</span> = Config::get(<span class="php-quote">'debogage_mode'</span>); |
</span><span id="178" class="l"><a class="l" href="#178">178: </a> <span class="php-keyword1">if</span> (<span class="php-var">$mode_actuel</span> == self::MODE_ENTETE_HTTP) { |
</span><span id="179" class="l"><a class="l" href="#179">179: </a> <span class="php-var">$cle</span> = (<span class="php-keyword1">empty</span>(<span class="php-var">$mot_cle</span>)) ? <span class="php-quote">'message'</span> : <span class="php-var">$mot_cle</span>; |
</span><span id="180" class="l"><a class="l" href="#180">180: </a> <span class="php-var">$sortie</span> = <span class="php-quote">"</span><span class="php-var">$cle</span><span class="php-quote">:</span><span class="php-var">$sortie</span><span class="php-quote">"</span>; |
</span><span id="181" class="l"><a class="l" href="#181">181: </a> } <span class="php-keyword1">else</span> { |
</span><span id="182" class="l"><a class="l" href="#182">182: </a> <span class="php-var">$corps</span> = <span class="php-var">$mot_cle</span>.PHP_EOL.<span class="php-var">$sortie</span>; |
</span><span id="183" class="l"><a class="l" href="#183">183: </a> <span class="php-keyword1">if</span> (self::getMode() == <span class="php-quote">'cli'</span>) { |
</span><span id="184" class="l"><a class="l" href="#184">184: </a> <span class="php-var">$sortie</span> = PHP_EOL.<span class="php-var">$corps</span>.PHP_EOL; |
</span><span id="185" class="l"><a class="l" href="#185">185: </a> } <span class="php-keyword1">else</span> { |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> <span class="php-var">$sortie</span> = <span class="php-quote">'<pre>'</span>.<span class="php-var">$corps</span>.<span class="php-quote">'</pre>'</span>; |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> } |
</span><span id="188" class="l"><a class="l" href="#188">188: </a> } |
</span><span id="189" class="l"><a class="l" href="#189">189: </a> <span class="php-keyword1">return</span> <span class="php-var">$sortie</span>; |
</span><span id="190" class="l"><a class="l" href="#190">190: </a> } |
</span><span id="191" class="l"><a class="l" href="#191">191: </a>} |
</span><span id="192" class="l"><a class="l" href="#192">192: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-CacheSqlite.html |
---|
New file |
0,0 → 1,884 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class CacheSqlite | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li class="active"><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li class="active"><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li><a href="class-MonScript.html">MonScript</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-None.html" title="Summary of None"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class CacheSqlite</h1> |
<div class="info"> |
<b>Located at</b> <a href="source-class-CacheSqlite.html#2-616" title="Go to source code">framework/CacheSqlite.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="__construct" id="___construct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___construct">#</a> |
<code><a href="source-class-CacheSqlite.html#41-57" title="Go to source code">__construct</a>( <span>array <var>$options</var> = <span class="php-keyword1">array</span>()</span>, <span><code><a href="class-Cache.html">Cache</a></code> <var>$cache</var></span> )</code> |
<div class="description short"> |
<p>Constructor</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constructor</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$options</var></dt> |
<dd><code>array</code><br>$options Associative array of options</dd> |
<dt><var>$cache</var></dt> |
<dd></dd> |
</dl></div> |
<h4>Throws</h4> |
<div class="list"> |
<code>Zend_cache_Exception</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="__destruct" id="___destruct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___destruct">#</a> |
<code><a href="source-class-CacheSqlite.html#67-74" title="Go to source code">__destruct</a>( )</code> |
<div class="description short"> |
<p>Destructor</p> |
</div> |
<div class="description detailed hidden"> |
<p>Destructor</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="setEmplacement" id="_setEmplacement"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_setEmplacement">#</a> |
<code><a href="source-class-CacheSqlite.html#88-95" title="Go to source code">setEmplacement</a>( <span>mixed <var>$emplacement</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="charger" id="_charger"> |
<td class="attributes"><code> |
public |
string|false |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_charger">#</a> |
<code><a href="source-class-CacheSqlite.html#97-111" title="Go to source code">charger</a>( <span>string <var>$id</var></span>, <span>boolean <var>$ne_pas_tester_validiter_du_cache</var> = <span class="php-keyword1">false</span></span> )</code> |
<div class="description short"> |
<p>Test if a cache is available for the given id and (if yes) return it (false |
else)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Test if a cache is available for the given id and (if yes) return it (false |
else)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
<dt><var>$ne_pas_tester_validiter_du_cache</var></dt> |
<dd><code>boolean</code><br>$doNotTestCacheValidity If set to true, the cache validity won't be tested</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string|false</code><br>Cached datas<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="tester" id="_tester"> |
<td class="attributes"><code> |
public |
mixed|false |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_tester">#</a> |
<code><a href="source-class-CacheSqlite.html#113-125" title="Go to source code">tester</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Test if a cache is available or not (for the given id)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Test if a cache is available or not (for the given id)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed|false</code><br>(a cache is not available) or "last modified" timestamp (int) of the available |
cache record<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="sauver" id="_sauver"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_sauver">#</a> |
<code><a href="source-class-CacheSqlite.html#127-162" title="Go to source code">sauver</a>( <span>string <var>$donnees</var></span>, <span>string <var>$id</var></span>, <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span>, <span>integer <var>$duree_vie_specifique</var> = <span class="php-keyword1">false</span></span> )</code> |
<div class="description short"> |
<p>Save some string datas into a cache record</p> |
</div> |
<div class="description detailed hidden"> |
<p>Save some string datas into a cache record</p> |
<p>Note : $data is always "string" (serialization is done by the core not by the |
backend)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$donnees</var></dt> |
<dd><code>string</code><br>$data Datas to cache</dd> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags Array of strings, the cache record will be tagged by each string entry</dd> |
<dt><var>$duree_vie_specifique</var></dt> |
<dd><code>integer</code><br>$specificLifetime If != false, set a specific lifetime for this cache record |
(null => infinite lifetime)</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True if no problem<br> |
</div> |
<h4>Throws</h4> |
<div class="list"> |
<code>Zend_Cache_Exception</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="supprimer" id="_supprimer"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_supprimer">#</a> |
<code><a href="source-class-CacheSqlite.html#164-178" title="Go to source code">supprimer</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Remove a cache record</p> |
</div> |
<div class="description detailed hidden"> |
<p>Remove a cache record</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id Cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True if no problem<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="nettoyer" id="_nettoyer"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_nettoyer">#</a> |
<code><a href="source-class-CacheSqlite.html#180-202" title="Go to source code">nettoyer</a>( <span>string <var>$mode</var> = <code><a href="class-Cache.html#NETTOYAGE_MODE_TOUS">Cache::<b>NETTOYAGE_MODE_TOUS</b></a></code></span>, <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Clean some cache records</p> |
</div> |
<div class="description detailed hidden"> |
<p>Clean some cache records</p> |
<p>Available modes are : Zend_Cache::CLEANING_MODE_ALL (default) => remove |
all cache entries ($tags is not used) Zend_Cache::CLEANING_MODE_OLD => remove |
too old cache entries ($tags is not used) Zend_Cache::CLEANING_MODE_MATCHING_TAG |
=> remove cache entries matching all given tags ($tags can be an array of |
strings or a single string) Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => |
remove cache entries not {matching one of the given tags} ($tags can be an array |
of strings or a single string) Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => |
remove cache entries matching any given tags ($tags can be an array of strings |
or a single string)</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$mode</var></dt> |
<dd><code>string</code><br>$mode Clean mode</dd> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags Array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>True if no problem<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIds" id="_getIds"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIds">#</a> |
<code><a href="source-class-CacheSqlite.html#204-217" title="Go to source code">getIds</a>( )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of stored cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getTags" id="_getTags"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getTags">#</a> |
<code><a href="source-class-CacheSqlite.html#219-232" title="Go to source code">getTags</a>( )</code> |
<div class="description short"> |
<p>Return an array of stored tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored tags</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of stored tags (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIdsAvecLesTags" id="_getIdsAvecLesTags"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIdsAvecLesTags">#</a> |
<code><a href="source-class-CacheSqlite.html#234-270" title="Go to source code">getIdsAvecLesTags</a>( <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids which match given tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids which match given tags</p> |
<p>In case of multiple tags, a logical AND is made between tags</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of matching cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIdsSansLesTags" id="_getIdsSansLesTags"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIdsSansLesTags">#</a> |
<code><a href="source-class-CacheSqlite.html#272-302" title="Go to source code">getIdsSansLesTags</a>( <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids which don't match given tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids which don't match given tags</p> |
<p>In case of multiple tags, a logical OR is made between tags</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of not matching cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getIdsAvecUnTag" id="_getIdsAvecUnTag"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getIdsAvecUnTag">#</a> |
<code><a href="source-class-CacheSqlite.html#304-340" title="Go to source code">getIdsAvecUnTag</a>( <span>array <var>$tags</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Return an array of stored cache ids which match any given tags</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of stored cache ids which match any given tags</p> |
<p>In case of multiple tags, a logical AND is made between tags</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$tags</var></dt> |
<dd><code>array</code><br>$tags array of tags</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of any matching cache ids (string)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getPourcentageRemplissage" id="_getPourcentageRemplissage"> |
<td class="attributes"><code> |
public |
integer |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getPourcentageRemplissage">#</a> |
<code><a href="source-class-CacheSqlite.html#342-360" title="Go to source code">getPourcentageRemplissage</a>( )</code> |
<div class="description short"> |
<p>Return the filling percentage of the backend storage</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return the filling percentage of the backend storage</p> |
<h4>Returns</h4> |
<div class="list"> |
<code>integer</code><br>integer between 0 and 100<br> |
</div> |
<h4>Throws</h4> |
<div class="list"> |
<code>Zend_Cache_Exception</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="getMetadonnees" id="_getMetadonnees"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getMetadonnees">#</a> |
<code><a href="source-class-CacheSqlite.html#362-394" title="Go to source code">getMetadonnees</a>( <span>string <var>$id</var></span> )</code> |
<div class="description short"> |
<p>Return an array of metadatas for the given cache id</p> |
</div> |
<div class="description detailed hidden"> |
<p>Return an array of metadatas for the given cache id</p> |
<p>The array must include these keys :</p> |
<ul> |
<li>expire : the expire timestamp</li> |
<li>tags : a string array of tags</li> |
<li>mtime : timestamp of last modification time</li> |
</ul> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id cache id</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>array of metadatas (false if the cache id is not found)<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="ajouterSupplementDureeDeVie" id="_ajouterSupplementDureeDeVie"> |
<td class="attributes"><code> |
public |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_ajouterSupplementDureeDeVie">#</a> |
<code><a href="source-class-CacheSqlite.html#396-415" title="Go to source code">ajouterSupplementDureeDeVie</a>( <span>string <var>$id</var></span>, <span>integer <var>$supplement_duree_de_vie</var></span> )</code> |
<div class="description short"> |
<p>Give (if possible) an extra lifetime to the given cache id</p> |
</div> |
<div class="description detailed hidden"> |
<p>Give (if possible) an extra lifetime to the given cache id</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$id</var></dt> |
<dd><code>string</code><br>$id cache id</dd> |
<dt><var>$supplement_duree_de_vie</var></dt> |
<dd><code>integer</code><br>$extraLifetime</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true if ok<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr data-order="options" id="$options"> |
<td class="attributes"><code> |
protected |
array |
</code></td> |
<td class="name"> |
<a href="source-class-CacheSqlite.html#3-23" title="Go to source code"><var>$options</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">array</span>( |
<span class="php-quote">'stockage_chemin'</span> => <span class="php-keyword1">null</span>, |
<span class="php-quote">'defragmentation_auto'</span> => <span class="php-num">10</span> |
)</code></td> |
<td class="description"><div> |
<a href="#$options" class="anchor">#</a> |
<div class="description short"> |
<p>Options disponibles :</p> |
</div> |
<div class="description detailed hidden"> |
<p>Options disponibles :</p> |
<h1>> (string) stockage_chemin :</h1> |
<p>Chemin vers le fichier contenant la base SQLite.</p> |
<h1>> (int) defragmentation_auto :</h1> |
<ul> |
<li>Désactive / Régler le processus de défragmentation automatique</li> |
<li>Le processus de défragmentation automatiques réduit la taille du fichier |
contenant la base de données quand un ajout ou une suppression de cache est |
réalisée : 0 => pas de défragmentation automatique 1 => |
défragmentation automatique systématique x (integer) > 1 => |
défragmentation automatique toutes les 1 fois (au hasard) sur x ajout ou |
suppression de cache</li> |
</ul> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Bdd.html |
---|
New file |
0,0 → 1,1295 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Bdd | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li class="active"><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Bdd</h1> |
<div class="description"> |
<p>Classe Bdd, d'accés au base de données. Elle fait office d'abstraction |
légère de base de données en utilisant diverses possibilités d'accès aux |
bases de données (PDO, mysql, mysqli, SQLite3). Les valeurs pour le paramètre |
'bdd_abstraction' du fichier config.ini sont : pdo, mysql, mysqli, sqlite3 Vous |
pouvez aussi utiliser : "php:Bdd::ABSTRACTION_PDO","php:Bdd::ABSTRACTION_MYSQL", |
"php:Bdd::ABSTRACTION_MYSQLI", "php:Bdd::ABSTRACTION_SQLITE3". Elle peut être |
étendue, pour ajouter le support d'autres bases de données où prendre en |
compte des méthodes spécifique à un type d'abstraction.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
php 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL</a><br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL</a><br> |
<b>Author:</b> |
Aurélien PERONNET <<a |
href="mailto:aurelien@tela-botanica.org">aurelien@<!-- -->tela-botanica.org</a>><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Bdd.php 461 2014-03-05 16:13:16Z jpm $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Bdd.html#3-459" title="Go to source code">framework/Bdd.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="__construct" id="___construct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___construct">#</a> |
<code><a href="source-class-Bdd.html#88-106" title="Go to source code">__construct</a>( )</code> |
<div class="description short"> |
<p>Constructeur par défaut, appelé à l'initialisation.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constructeur par défaut, appelé à l'initialisation.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="initialiserProtocole" id="_initialiserProtocole"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_initialiserProtocole">#</a> |
<code><a href="source-class-Bdd.html#108-131" title="Go to source code">initialiserProtocole</a>( )</code> |
<div class="description short"> |
<p>Initialise les constantes de classe à leur bonne valeur et déclenche une |
erreur si le protocole n'est pas bien défini.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Initialise les constantes de classe à leur bonne valeur et déclenche une |
erreur si le protocole n'est pas bien défini.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="connecter" id="_connecter"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_connecter">#</a> |
<code><a href="source-class-Bdd.html#133-200" title="Go to source code">connecter</a>( )</code> |
<div class="description short"> |
<p>Connection à la base de données en utilisant les informations fournies par |
le fichier de configuration. Cette méthode est private et final car elle n'a |
pas vocation a être appelée par l'utilisateur. TODO : il est peut être |
nécessaire pour MYSQL, MYSQLi et SQLITE3 afin d'éviter les boucles infinis |
d'erreur quand la bdd n'est pas configuré d'utiliser : |
$this->connexion->query (comme pour PDO)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Connection à la base de données en utilisant les informations fournies par |
le fichier de configuration. Cette méthode est private et final car elle n'a |
pas vocation a être appelée par l'utilisateur. TODO : il est peut être |
nécessaire pour MYSQL, MYSQLi et SQLITE3 afin d'éviter les boucles infinis |
d'erreur quand la bdd n'est pas configuré d'utiliser : |
$this->connexion->query (comme pour PDO)</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="requete" id="_requete"> |
<td class="attributes"><code> |
final protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_requete">#</a> |
<code><a href="source-class-Bdd.html#202-207" title="Go to source code">requete</a>( <span>mixed <var>$requete</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
<h4>Deprecated</h4> |
<div class="list"> |
changement de nom. Disparaîtra dans la version 0.4. Utiliser à la place : @see |
requeter<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="requeter" id="_requeter"> |
<td class="attributes"><code> |
public |
mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_requeter">#</a> |
<code><a href="source-class-Bdd.html#209-239" title="Go to source code">requeter</a>( <span>string <var>$requete</var></span> )</code> |
<div class="description short"> |
<p>Execute une requête et retourne le résultat tel que renvoyé par |
l'abstraction courante.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Execute une requête et retourne le résultat tel que renvoyé par |
l'abstraction courante.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$requete</var></dt> |
<dd><code>string</code><br>la requête à effectuer</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed</code><br>un objet contenant le résultat de la requête<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="requeteUn" id="_requeteUn"> |
<td class="attributes"><code> |
final protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_requeteUn">#</a> |
<code><a href="source-class-Bdd.html#241-246" title="Go to source code">requeteUn</a>( <span>mixed <var>$requete</var></span>, <span>mixed <var>$mode</var> = <code><a href="class-Bdd.html#MODE_ASSOC">Bdd::<b>MODE_ASSOC</b></a></code></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
<h4>Deprecated</h4> |
<div class="list"> |
changement de nom. Disparaîtra dans la version 0.4. Utiliser à la place : @see |
recuperer<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="recuperer" id="_recuperer"> |
<td class="attributes"><code> |
public |
mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_recuperer">#</a> |
<code><a href="source-class-Bdd.html#248-285" title="Go to source code">recuperer</a>( <span>string <var>$requete</var></span>, <span>string <var>$mode</var> = <code><a href="class-Bdd.html#MODE_ASSOC">Bdd::<b>MODE_ASSOC</b></a></code></span> )</code> |
<div class="description short"> |
<p>Execute une requête et retourne le premier résultat sous forme de tableau |
(par défaut) ou d'objet. Les noms des champs de la base de données |
correspondent aux noms des clés du tableau ou aux noms des attributs de |
l'objet.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Execute une requête et retourne le premier résultat sous forme de tableau |
(par défaut) ou d'objet. Les noms des champs de la base de données |
correspondent aux noms des clés du tableau ou aux noms des attributs de |
l'objet.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$requete</var></dt> |
<dd><code>string</code><br>la requête à effectuer</dd> |
<dt><var>$mode</var></dt> |
<dd><code>string</code><br>le mode de retour ASSOC (Bdd::MODE_ASSOC) pour un tableau ou OBJECT |
(Bdd::MODE_OBJET) pour un objet.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed</code><br>un objet ou un tableau contenant le résultat de la requête<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="requeteTous" id="_requeteTous"> |
<td class="attributes"><code> |
final protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_requeteTous">#</a> |
<code><a href="source-class-Bdd.html#287-292" title="Go to source code">requeteTous</a>( <span>mixed <var>$requete</var></span>, <span>mixed <var>$mode</var> = <code><a href="class-Bdd.html#MODE_ASSOC">Bdd::<b>MODE_ASSOC</b></a></code></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
<h4>Deprecated</h4> |
<div class="list"> |
changement de nom. Disparaîtra dans la version 0.4. Utiliser à la place : @see |
recupererTous<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="recupererTous" id="_recupererTous"> |
<td class="attributes"><code> |
public |
array |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_recupererTous">#</a> |
<code><a href="source-class-Bdd.html#294-348" title="Go to source code">recupererTous</a>( <span>string <var>$requete</var></span>, <span>string <var>$mode</var> = <code><a href="class-Bdd.html#MODE_ASSOC">Bdd::<b>MODE_ASSOC</b></a></code></span> )</code> |
<div class="description short"> |
<p>Execute une requête et retourne un tableau de résultats. Un résultat peut |
être présentés sous forme de tableau (par défaut) ou d'objet. Les noms des |
champs de la base de données correspondent aux noms des clés du tableau |
résultat ou aux noms des attributs de l'objet résultat.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Execute une requête et retourne un tableau de résultats. Un résultat peut |
être présentés sous forme de tableau (par défaut) ou d'objet. Les noms des |
champs de la base de données correspondent aux noms des clés du tableau |
résultat ou aux noms des attributs de l'objet résultat.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$requete</var></dt> |
<dd><code>string</code><br>la requête à effectuer</dd> |
<dt><var>$mode</var></dt> |
<dd><code>string</code><br>le mode de retour des résultats : ASSOC (Bdd::MODE_ASSOC) pour un tableau ou |
OBJECT (Bdd::MODE_OBJET) pour un objet.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>array</code><br>un tableau contenant les résultats sous forme d'objets ou de tableau (par |
défaut).<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="proteger" id="_proteger"> |
<td class="attributes"><code> |
public |
mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_proteger">#</a> |
<code><a href="source-class-Bdd.html#350-364" title="Go to source code">proteger</a>( <span>Mixed <var>$donnees</var></span> )</code> |
<div class="description short"> |
<p>Protège une chaine de caractères ou le contenu d'un tablea avant |
l'insertion dans la base de données (ajout de quotes ou guillemets).</p> |
</div> |
<div class="description detailed hidden"> |
<p>Protège une chaine de caractères ou le contenu d'un tablea avant |
l'insertion dans la base de données (ajout de quotes ou guillemets).</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$donnees</var></dt> |
<dd><code>Mixed</code><br>une chaine ou un tableau à protéger</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed</code><br>la chaine ou le tableau à protégé<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="protegerTableau" id="_protegerTableau"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_protegerTableau">#</a> |
<code><a href="source-class-Bdd.html#390-402" title="Go to source code">protegerTableau</a>( <span>array <var>$tableau</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
<h4>Deprecated</h4> |
<div class="list"> |
changement de nom. Deviendra "private" dans la version 0.5. Utiliser à la place |
: @see proteger<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="recupererIdDernierAjout" id="_recupererIdDernierAjout"> |
<td class="attributes"><code> |
public |
mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_recupererIdDernierAjout">#</a> |
<code><a href="source-class-Bdd.html#404-434" title="Go to source code">recupererIdDernierAjout</a>( <span>mixed <var>$parametres</var> = <span class="php-keyword1">null</span></span> )</code> |
<div class="description short"> |
<p>Retourne l'identifiant de la dernière ligne insérée, ou la dernière |
valeur d'une séquence d'objets, dépendamment, dans le cas de PDO, du driver |
utilisé. Les méthodes utilisées pour retourner l'identifiant peuvent avoir |
des comportements différent. Consulter la documentation PHP correspondant à |
l'abstraction choisie avant de l'utiliser :</p> |
</div> |
<div class="description detailed hidden"> |
<p>Retourne l'identifiant de la dernière ligne insérée, ou la dernière |
valeur d'une séquence d'objets, dépendamment, dans le cas de PDO, du driver |
utilisé. Les méthodes utilisées pour retourner l'identifiant peuvent avoir |
des comportements différent. Consulter la documentation PHP correspondant à |
l'abstraction choisie avant de l'utiliser :</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$parametres</var></dt> |
<dd><code>mixed</code><br>un paramètre éventuel à transmettre (en fonction de l'abstraction de BDD |
utilisée).</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed</code><br>le dernier identifiant de clé primaire ajouté dans la base de données (string |
ou int).<br> |
</div> |
<h4>Link(http://fr.php.net/manual/fr/function.mysql-insert-id.php,</h4> |
<div class="list"> |
mysql_insert_id())<br> |
</div> |
<h4>Link(http://fr.php.net/manual/fr/pdo.lastinsertid.php,</h4> |
<div class="list"> |
PDO::lastInsertId([ string $name = NULL ]))<br> |
</div> |
<h4>Link(http://fr.php.net/manual/fr/sqlite3.lastinsertrowid.php,</h4> |
<div class="list"> |
SQLite3::lastInsertRowID())<br> |
</div> |
<h4>Link(http://php.net/manual/en/mysqli.insert-id.php,</h4> |
<div class="list"> |
mysqli->insert_id())<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="__destruct" id="___destruct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___destruct">#</a> |
<code><a href="source-class-Bdd.html#436-458" title="Go to source code">__destruct</a>( )</code> |
<div class="description short"> |
<p>Destructeur de classe, se contente de fermer explicitement la connexion à la |
base de donnée.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Destructeur de classe, se contente de fermer explicitement la connexion à la |
base de donnée.</p> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="constants"> |
<caption>Constants summary</caption> |
<tr data-order="ERREUR_REQUETE_TPL" id="ERREUR_REQUETE_TPL"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Bdd.html#24-25" title="Go to source code"><b>ERREUR_REQUETE_TPL</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'Requête echec.\nFichier : %s.\nLigne : %s.\nMessage : %s.\nRequête : %s'</span></code></td> |
<td class="description"><div> |
<a href="#ERREUR_REQUETE_TPL" class="anchor">#</a> |
<div class="description short"> |
<p>Constante stockant le squelette du message en cas d'erreur de requête |
sql.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constante stockant le squelette du message en cas d'erreur de requête |
sql.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="ERREUR_CONNEXION_TPL" id="ERREUR_CONNEXION_TPL"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Bdd.html#27-28" title="Go to source code"><b>ERREUR_CONNEXION_TPL</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'Erreur de connexion à la base de données, vérifiez les paramètres du fichier de configuration.\nMessage : %S.'</span></code></td> |
<td class="description"><div> |
<a href="#ERREUR_CONNEXION_TPL" class="anchor">#</a> |
<div class="description short"> |
<p>Constante stockant le squelette du message en cas d'erreur de connexion à la |
base de données.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constante stockant le squelette du message en cas d'erreur de connexion à la |
base de données.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="ERREUR_SELECTION_BDD_TPL" id="ERREUR_SELECTION_BDD_TPL"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Bdd.html#30-31" title="Go to source code"><b>ERREUR_SELECTION_BDD_TPL</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'Erreur de sélection de la base de données, vérifiez les paramètres du fichier de configuration.\nMessage : %S.'</span></code></td> |
<td class="description"><div> |
<a href="#ERREUR_SELECTION_BDD_TPL" class="anchor">#</a> |
<div class="description short"> |
<p>Constante stockant le squelette du message en cas d'erreur de sélection de |
la base de données.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constante stockant le squelette du message en cas d'erreur de sélection de |
la base de données.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="ABSTRACTION_PDO" id="ABSTRACTION_PDO"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Bdd.html#33-34" title="Go to source code"><b>ABSTRACTION_PDO</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'pdo'</span></code></td> |
<td class="description"><div> |
<a href="#ABSTRACTION_PDO" class="anchor">#</a> |
<div class="description short"> |
<p>Constante stockant le code pour l'abstraction de PDO.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constante stockant le code pour l'abstraction de PDO.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="ABSTRACTION_MYSQL" id="ABSTRACTION_MYSQL"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Bdd.html#36-37" title="Go to source code"><b>ABSTRACTION_MYSQL</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'mysql'</span></code></td> |
<td class="description"><div> |
<a href="#ABSTRACTION_MYSQL" class="anchor">#</a> |
<div class="description short"> |
<p>Constante stockant le code pour l'abstraction de mysql.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constante stockant le code pour l'abstraction de mysql.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="ABSTRACTION_MYSQLI" id="ABSTRACTION_MYSQLI"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Bdd.html#39-40" title="Go to source code"><b>ABSTRACTION_MYSQLI</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'mysqli'</span></code></td> |
<td class="description"><div> |
<a href="#ABSTRACTION_MYSQLI" class="anchor">#</a> |
<div class="description short"> |
<p>Constante stockant le code pour l'abstraction de mysqli.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constante stockant le code pour l'abstraction de mysqli.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="ABSTRACTION_SQLITE3" id="ABSTRACTION_SQLITE3"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Bdd.html#42-43" title="Go to source code"><b>ABSTRACTION_SQLITE3</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'sqlite3'</span></code></td> |
<td class="description"><div> |
<a href="#ABSTRACTION_SQLITE3" class="anchor">#</a> |
<div class="description short"> |
<p>Constante stockant le code pour l'abstraction de SQLite3.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constante stockant le code pour l'abstraction de SQLite3.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="MODE_ASSOC" id="MODE_ASSOC"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Bdd.html#45-46" title="Go to source code"><b>MODE_ASSOC</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'ASSOC'</span></code></td> |
<td class="description"><div> |
<a href="#MODE_ASSOC" class="anchor">#</a> |
<div class="description short"> |
<p>Constante stockant le code pour le mode tableau associatif des résultats des |
requêtes.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constante stockant le code pour le mode tableau associatif des résultats des |
requêtes.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="MODE_OBJET" id="MODE_OBJET"> |
<td class="attributes"><code>string</code></td> |
<td class="name"><code> |
<a href="source-class-Bdd.html#48-49" title="Go to source code"><b>MODE_OBJET</b></a> |
</code></td> |
<td class="value"><code><span class="php-quote">'OBJECT'</span></code></td> |
<td class="description"><div> |
<a href="#MODE_OBJET" class="anchor">#</a> |
<div class="description short"> |
<p>Constante stockant le code pour le mode objet des résultats des |
requêtes.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Constante stockant le code pour le mode objet des résultats des |
requêtes.</p> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr data-order="ASSOC" id="$ASSOC"> |
<td class="attributes"><code> |
protected |
string |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#51-52" title="Go to source code"><var>$ASSOC</var></a> |
</td> |
<td class="value"><code><span class="php-quote">''</span></code></td> |
<td class="description"><div> |
<a href="#$ASSOC" class="anchor">#</a> |
<div class="description short"> |
<p>Mode de fetch associatif</p> |
</div> |
<div class="description detailed hidden"> |
<p>Mode de fetch associatif</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="OBJECT" id="$OBJECT"> |
<td class="attributes"><code> |
protected |
string |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#54-55" title="Go to source code"><var>$OBJECT</var></a> |
</td> |
<td class="value"><code><span class="php-quote">''</span></code></td> |
<td class="description"><div> |
<a href="#$OBJECT" class="anchor">#</a> |
<div class="description short"> |
<p>Mode de fetch objet</p> |
</div> |
<div class="description detailed hidden"> |
<p>Mode de fetch objet</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="abstraction" id="$abstraction"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#57-58" title="Go to source code"><var>$abstraction</var></a> |
</td> |
<td class="value"><code></code></td> |
<td class="description"><div> |
<a href="#$abstraction" class="anchor">#</a> |
<div class="description short"> |
<p>abstraction de base de données utilisée</p> |
</div> |
<div class="description detailed hidden"> |
<p>abstraction de base de données utilisée</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="dsn" id="$dsn"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#60-61" title="Go to source code"><var>$dsn</var></a> |
</td> |
<td class="value"><code></code></td> |
<td class="description"><div> |
<a href="#$dsn" class="anchor">#</a> |
<div class="description short"> |
<p>DSN pour accéder à la base de données</p> |
</div> |
<div class="description detailed hidden"> |
<p>DSN pour accéder à la base de données</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="type" id="$type"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#63-64" title="Go to source code"><var>$type</var></a> |
</td> |
<td class="value"><code></code></td> |
<td class="description"><div> |
<a href="#$type" class="anchor">#</a> |
<div class="description short"> |
<p>Type de base de données (mysql, mysqli, etc ...)</p> |
</div> |
<div class="description detailed hidden"> |
<p>Type de base de données (mysql, mysqli, etc ...)</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="hote" id="$hote"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#66-67" title="Go to source code"><var>$hote</var></a> |
</td> |
<td class="value"><code></code></td> |
<td class="description"><div> |
<a href="#$hote" class="anchor">#</a> |
<div class="description short"> |
<p>Hote herbergeant la base de données</p> |
</div> |
<div class="description detailed hidden"> |
<p>Hote herbergeant la base de données</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="bdd_nom" id="$bdd_nom"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#69-70" title="Go to source code"><var>$bdd_nom</var></a> |
</td> |
<td class="value"><code></code></td> |
<td class="description"><div> |
<a href="#$bdd_nom" class="anchor">#</a> |
<div class="description short"> |
<p>Nom de la base de données à laquelle le modèle doit se connecter</p> |
</div> |
<div class="description detailed hidden"> |
<p>Nom de la base de données à laquelle le modèle doit se connecter</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="utilisateur" id="$utilisateur"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#72-73" title="Go to source code"><var>$utilisateur</var></a> |
</td> |
<td class="value"><code></code></td> |
<td class="description"><div> |
<a href="#$utilisateur" class="anchor">#</a> |
<div class="description short"> |
<p>Nom d'utilisateur</p> |
</div> |
<div class="description detailed hidden"> |
<p>Nom d'utilisateur</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="pass" id="$pass"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#75-76" title="Go to source code"><var>$pass</var></a> |
</td> |
<td class="value"><code></code></td> |
<td class="description"><div> |
<a href="#$pass" class="anchor">#</a> |
<div class="description short"> |
<p>Mot de passe</p> |
</div> |
<div class="description detailed hidden"> |
<p>Mot de passe</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="encodage" id="$encodage"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#78-79" title="Go to source code"><var>$encodage</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">null</span></code></td> |
<td class="description"><div> |
<a href="#$encodage" class="anchor">#</a> |
<div class="description short"> |
<p>Encodage de la base de données</p> |
</div> |
<div class="description detailed hidden"> |
<p>Encodage de la base de données</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="connexion" id="$connexion"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#81-82" title="Go to source code"><var>$connexion</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">null</span></code></td> |
<td class="description"><div> |
<a href="#$connexion" class="anchor">#</a> |
<div class="description short"> |
<p>Connexion à la base de données</p> |
</div> |
<div class="description detailed hidden"> |
<p>Connexion à la base de données</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="parametres_obligatoires" id="$parametres_obligatoires"> |
<td class="attributes"><code> |
protected |
array |
</code></td> |
<td class="name"> |
<a href="source-class-Bdd.html#84-86" title="Go to source code"><var>$parametres_obligatoires</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">array</span>(<span class="php-quote">'bdd_abstraction'</span>, <span class="php-quote">'bdd_protocole'</span>, <span class="php-quote">'bdd_serveur'</span>, <span class="php-quote">'bdd_nom'</span>, |
<span class="php-quote">'bdd_utilisateur'</span>, <span class="php-quote">'bdd_mot_de_passe'</span>, <span class="php-quote">'bdd_encodage'</span>)</code></td> |
<td class="description"><div> |
<a href="#$parametres_obligatoires" class="anchor">#</a> |
<div class="description short"> |
<p>Tableau des noms des paramètres à définir dans le fichier de config car |
obligatoirement nécessaire à cette classe.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Tableau des noms des paramètres à définir dans le fichier de config car |
obligatoirement nécessaire à cette classe.</p> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/elementlist.js |
---|
New file |
0,0 → 1,3 |
var ApiGen = ApiGen || {}; |
ApiGen.elements = [["c","Bdd"],["c","Cache"],["c","CacheFichier"],["c","CacheSimple"],["c","CacheSqlite"],["c","Chaine"],["c","Chronometre"],["c","Cli"],["c","Config"],["c","Controleur"],["c","Debug"],["c","Encodage"],["c","Exception"],["c","Fichier"],["c","Framework"],["c","GestionnaireException"],["c","I18n"],["c","Log"],["c","MonScript"],["c","MonService"],["c","Pattern"],["c","Registre"],["c","RestClient"],["c","RestServeur"],["c","RestService"],["c","Script"],["c","ServiceCacheFichier"],["c","ServiceCacheSimple"],["c","ServiceCacheSqlite"],["c","SquelettePhp"],["c","Tableau"],["c","Url"]]; |
/trunk/doc/ApiGen/source-class-ServiceCacheSimple.html |
---|
New file |
0,0 → 1,148 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File exemples/services/modules/0.1/ServiceCacheSimple.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li class="active"><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-ServiceCacheSimple.html" title="Summary of ServiceCacheSimple"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-keyword1">class</span> <a id="ServiceCacheSimple" href="#ServiceCacheSimple">ServiceCacheSimple</a> <span class="php-keyword1">extends</span> RestService { |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a> |
</span><span id="4" class="l"><a class="l" href="#4"> 4: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_consulter" href="#_consulter">consulter</a>(<span class="php-var">$ressources</span>, <span class="php-var">$parametres</span>) { |
</span><span id="5" class="l"><a class="l" href="#5"> 5: </a> <span class="php-comment">// Redéfinition ici mais peut être configuré depuis le fichier config.ini</span> |
</span><span id="6" class="l"><a class="l" href="#6"> 6: </a> <span class="php-var">$options</span> = <span class="php-keyword1">array</span>( |
</span><span id="7" class="l"><a class="l" href="#7"> 7: </a> <span class="php-quote">'mise_en_cache'</span> => <span class="php-keyword1">true</span>, |
</span><span id="8" class="l"><a class="l" href="#8"> 8: </a> <span class="php-quote">'stockage_mode'</span> => Cache::STOCKAGE_MODE_SIMPLE, |
</span><span id="9" class="l"><a class="l" href="#9"> 9: </a> <span class="php-comment">//'stockage_chemin' => 'indiquer le chemin du dossier où mettre le cache par défaut utilise Fichier::getDossierTmp()',</span> |
</span><span id="10" class="l"><a class="l" href="#10">10: </a> <span class="php-quote">'duree_de_vie'</span> => <span class="php-num">10</span> |
</span><span id="11" class="l"><a class="l" href="#11">11: </a> ); |
</span><span id="12" class="l"><a class="l" href="#12">12: </a> <span class="php-comment">// Le cache Simple utilise le design pattern fabrique pour être généré.</span> |
</span><span id="13" class="l"><a class="l" href="#13">13: </a> <span class="php-var">$cache</span> = Cache::fabriquer(Cache::STOCKAGE_MODE_SIMPLE, <span class="php-var">$options</span>); |
</span><span id="14" class="l"><a class="l" href="#14">14: </a> |
</span><span id="15" class="l"><a class="l" href="#15">15: </a> <span class="php-var">$id</span> = <span class="php-quote">'monCache1'</span>; <span class="php-comment">// id de cache de "ce que l'on veut cacher"</span> |
</span><span id="16" class="l"><a class="l" href="#16">16: </a> <span class="php-keyword1">if</span> (!(<span class="php-var">$donnees</span> = <span class="php-var">$cache</span>->charger(<span class="php-var">$id</span>))) { |
</span><span id="17" class="l"><a class="l" href="#17">17: </a> <span class="php-var">$donnees</span> = <span class="php-quote">'Mise en cache à : '</span>.<span class="php-keyword2">strftime</span>(<span class="php-quote">'%A %d %B %Y à %H:%M:%S'</span>, <span class="php-keyword2">time</span>()).<span class="php-quote">'<br/>'</span>; |
</span><span id="18" class="l"><a class="l" href="#18">18: </a> <span class="php-keyword1">for</span> (<span class="php-var">$i</span> = <span class="php-num">0</span>; <span class="php-var">$i</span> < <span class="php-num">100000</span>; <span class="php-var">$i</span>++) { |
</span><span id="19" class="l"><a class="l" href="#19">19: </a> <span class="php-var">$donnees</span> .= <span class="php-var">$i</span>; |
</span><span id="20" class="l"><a class="l" href="#20">20: </a> } |
</span><span id="21" class="l"><a class="l" href="#21">21: </a> <span class="php-var">$cache</span>->sauver(<span class="php-var">$donnees</span>, <span class="php-var">$id</span>); |
</span><span id="22" class="l"><a class="l" href="#22">22: </a> } |
</span><span id="23" class="l"><a class="l" href="#23">23: </a> <span class="php-comment">// Affichage des données</span> |
</span><span id="24" class="l"><a class="l" href="#24">24: </a> |
</span><span id="25" class="l"><a class="l" href="#25">25: </a> <span class="php-keyword1">echo</span> <span class="php-quote">'<hr/>'</span>.<span class="php-var">$donnees</span>.<span class="php-quote">'<hr/><p>Hors cache : '</span>.<span class="php-keyword2">strftime</span>(<span class="php-quote">'%A %d %B %Y à %H:%M:%S'</span>).<span class="php-quote">'</p>'</span>; |
</span><span id="26" class="l"><a class="l" href="#26">26: </a> } |
</span><span id="27" class="l"><a class="l" href="#27">27: </a>} |
</span><span id="28" class="l"><a class="l" href="#28">28: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Exception.html |
---|
New file |
0,0 → 1,498 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Exception | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li class="active"><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Exceptions</h3> |
<ul> |
<li class="active"><a href="class-Exception.html">Exception</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-PHP.html" title="Summary of PHP"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Exception</h1> |
<div class="info"> |
<b>PHP Extension:</b> <a href="http://php.net/manual" title="Go to PHP documentation">Core</a><br> |
<b>Documented at</b> <a href="http://php.net/manual/class.exception.php" title="Go to PHP documentation">php.net</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="__construct" id="___construct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___construct">#</a> |
<code><a href="http://php.net/manual/exception.construct.php" title="Go to PHP documentation">__construct</a>( <span>mixed <var>$message</var></span>, <span>mixed <var>$code</var></span>, <span>mixed <var>$previous</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getMessage" id="_getMessage"> |
<td class="attributes"><code> |
final public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getMessage">#</a> |
<code><a href="http://php.net/manual/exception.getmessage.php" title="Go to PHP documentation">getMessage</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getCode" id="_getCode"> |
<td class="attributes"><code> |
final public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getCode">#</a> |
<code><a href="http://php.net/manual/exception.getcode.php" title="Go to PHP documentation">getCode</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getFile" id="_getFile"> |
<td class="attributes"><code> |
final public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getFile">#</a> |
<code><a href="http://php.net/manual/exception.getfile.php" title="Go to PHP documentation">getFile</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getLine" id="_getLine"> |
<td class="attributes"><code> |
final public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getLine">#</a> |
<code><a href="http://php.net/manual/exception.getline.php" title="Go to PHP documentation">getLine</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getTrace" id="_getTrace"> |
<td class="attributes"><code> |
final public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getTrace">#</a> |
<code><a href="http://php.net/manual/exception.gettrace.php" title="Go to PHP documentation">getTrace</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getPrevious" id="_getPrevious"> |
<td class="attributes"><code> |
final public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getPrevious">#</a> |
<code><a href="http://php.net/manual/exception.getprevious.php" title="Go to PHP documentation">getPrevious</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getTraceAsString" id="_getTraceAsString"> |
<td class="attributes"><code> |
final public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getTraceAsString">#</a> |
<code><a href="http://php.net/manual/exception.gettraceasstring.php" title="Go to PHP documentation">getTraceAsString</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="__toString" id="___toString"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___toString">#</a> |
<code><a href="http://php.net/manual/exception.tostring.php" title="Go to PHP documentation">__toString</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr data-order="message" id="$message"> |
<td class="attributes"><code> |
protected |
string |
</code></td> |
<td class="name"> |
<a href="http://php.net/manual/class.exception.php#exception.props.message" title="Go to PHP documentation"><var>$message</var></a> |
</td> |
<td class="value"><code><span class="php-quote">''</span></code></td> |
<td class="description"><div> |
<a href="#$message" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="code" id="$code"> |
<td class="attributes"><code> |
protected |
integer |
</code></td> |
<td class="name"> |
<a href="http://php.net/manual/class.exception.php#exception.props.code" title="Go to PHP documentation"><var>$code</var></a> |
</td> |
<td class="value"><code><span class="php-num">0</span></code></td> |
<td class="description"><div> |
<a href="#$code" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="file" id="$file"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="http://php.net/manual/class.exception.php#exception.props.file" title="Go to PHP documentation"><var>$file</var></a> |
</td> |
<td class="value"><code></code></td> |
<td class="description"><div> |
<a href="#$file" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="line" id="$line"> |
<td class="attributes"><code> |
protected |
mixed |
</code></td> |
<td class="name"> |
<a href="http://php.net/manual/class.exception.php#exception.props.line" title="Go to PHP documentation"><var>$line</var></a> |
</td> |
<td class="value"><code></code></td> |
<td class="description"><div> |
<a href="#$line" class="anchor">#</a> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-ServiceCacheSimple.html |
---|
New file |
0,0 → 1,280 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class ServiceCacheSimple | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li class="active"><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class ServiceCacheSimple</h1> |
<div class="description"> |
<p>Classe principale gérant les services. Paramètres liés dans config.ini : - |
serveur.baseURL</p> |
<p>Encodage en entrée : utf8 Encodage en sortie : utf8</p> |
</div> |
<dl class="tree"> |
<dd style="padding-left:0px"> |
<a href="class-RestService.html"><span>RestService</span></a> |
</dd> |
<dd style="padding-left:30px"> |
<img src="resources/inherit.png" alt="Extended by"> |
<b><span>ServiceCacheSimple</span></b> |
</dd> |
</dl> |
<div class="info"> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
Php 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="GPL">v3 <http://www.gnu.org/licenses/gpl.txt></a><br> |
<b>License:</b> |
<a href="CECILL">v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt></a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: RestService.php 417 2012-05-15 09:24:12Z jpm $<br> |
<b>Since:</b> |
0.3<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-ServiceCacheSimple.html#2-27" title="Go to source code">exemples/services/modules/0.1/ServiceCacheSimple.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="consulter" id="_consulter"> |
<td class="attributes"><code> |
public |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_consulter">#</a> |
<code><a href="source-class-ServiceCacheSimple.html#4-26" title="Go to source code">consulter</a>( <span>array <var>$ressources</var></span>, <span>array <var>$parametres</var></span> )</code> |
<div class="description short"> |
<p>Méthode appelée lors d'une requête HTTP de type GET.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode appelée lors d'une requête HTTP de type GET.</p> |
<p>Si la consultation est un succès, le code statut HTTP retourné sera 200. |
Dans tous les autres cas, la méthode devra retourner le code statut HTTP |
adéquate.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$ressources</var></dt> |
<dd><code>array</code><br>Morceaux de l'url servant à préciser la ressource concerné pour le service |
demandé.</dd> |
<dt><var>$parametres</var></dt> |
<dd><code>array</code><br>Partie de l'url situé après le '?' servant à paramétrer le service demandé.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>une chaine indiquant le succès de l'opération et les données demandées.<br> |
</div> |
<h4>Overrides</h4> |
<div class="list"><code><a href="class-RestService.html#_consulter">RestService::consulter()</a></code></div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary inherited"> |
<caption>Methods inherited from <a href="class-RestService.html#methods">RestService</a></caption> |
<tr> |
<td><code> |
<a href="class-RestService.html#___construct">__construct()</a>, |
<a href="class-RestService.html#_ajouter">ajouter()</a>, |
<a href="class-RestService.html#_ajouterMessage">ajouterMessage()</a>, |
<a href="class-RestService.html#_getBdd">getBdd()</a>, |
<a href="class-RestService.html#_getRestClient">getRestClient()</a>, |
<a href="class-RestService.html#_initialiser">initialiser()</a>, |
<a href="class-RestService.html#_modifier">modifier()</a>, |
<a href="class-RestService.html#_supprimer">supprimer()</a>, |
<a href="class-RestService.html#_utiliserParametresBruts">utiliserParametresBruts()</a> |
</code></td> |
</tr> |
</table> |
<table class="summary inherited"> |
<caption>Properties inherited from <a href="class-RestService.html#properties">RestService</a></caption> |
<tr> |
<td><code> |
<a href="class-RestService.html#$bdd"><var><span class="deprecated">$bdd</span></var></a>, |
<a href="class-RestService.html#$utilisationParametresBruts"><var>$utilisationParametresBruts</var></a> |
</code></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Url.html |
---|
New file |
0,0 → 1,546 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Url.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li class="active"><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Url.html" title="Summary of Url"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe Url, gérant le découpage des paramètres, leurs modification etc... |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * Traduction et conversion d'une classe (NET_Url2) issue de Pear |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @category Php 5.2 |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @package Framework |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @author Christian SCHMIDT <schmidt@php.net> (Auteur classe originale) |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @author Aurélien PERONNET <aurelien@tela-botanica.org> |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @version SVN: $Id: Url.php 405 2012-02-22 15:45:39Z gduche $ |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="17" class="l"><a class="l" href="#17"> 17: </a><span class="php-comment">*/</span> |
</span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-keyword1">class</span> <a id="Url" href="#Url">Url</a> { |
</span><span id="19" class="l"><a class="l" href="#19"> 19: </a> |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> <span class="php-comment">/** |
</span></span><span id="21" class="l"><a class="l" href="#21"> 21: </a><span class="php-comment"> * Répresenter les tableaux dans les requêtes en utilisant la notation php []. Par défaut à true. |
</span></span><span id="22" class="l"><a class="l" href="#22"> 22: </a><span class="php-comment"> */</span> |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> <span class="php-keyword1">const</span> <a id="OPTION_UTILISER_CROCHETS" href="#OPTION_UTILISER_CROCHETS">OPTION_UTILISER_CROCHETS</a> = <span class="php-quote">'utiliser_crochets'</span>; |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> <span class="php-comment">/** |
</span></span><span id="26" class="l"><a class="l" href="#26"> 26: </a><span class="php-comment"> * URL-encoder les clés des variables dans les requêtes. Par défaut à true. |
</span></span><span id="27" class="l"><a class="l" href="#27"> 27: </a><span class="php-comment"> */</span> |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-keyword1">const</span> <a id="OPTION_ENCODER_CLES" href="#OPTION_ENCODER_CLES">OPTION_ENCODER_CLES</a> = <span class="php-quote">'encoder_cles'</span>; |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> <span class="php-comment">/** |
</span></span><span id="31" class="l"><a class="l" href="#31"> 31: </a><span class="php-comment"> * URL-encoder les valeurs des variables dans les requêtes. Par défaut à false. |
</span></span><span id="32" class="l"><a class="l" href="#32"> 32: </a><span class="php-comment"> */</span> |
</span><span id="33" class="l"><a class="l" href="#33"> 33: </a> <span class="php-keyword1">const</span> <a id="OPTION_ENCODER_VALEURS" href="#OPTION_ENCODER_VALEURS">OPTION_ENCODER_VALEURS</a> = <span class="php-quote">'encoder_valeurs'</span>; |
</span><span id="34" class="l"><a class="l" href="#34"> 34: </a> |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-comment">/** |
</span></span><span id="36" class="l"><a class="l" href="#36"> 36: </a><span class="php-comment"> * Séparateurs de variables lors du parsing de la requête. Chaque caractère |
</span></span><span id="37" class="l"><a class="l" href="#37"> 37: </a><span class="php-comment"> * est considéré comme un séparateur. Par défaut, spécifié par le paramêtre |
</span></span><span id="38" class="l"><a class="l" href="#38"> 38: </a><span class="php-comment"> * arg_separator.input dans php.ini (par défaut "&"). |
</span></span><span id="39" class="l"><a class="l" href="#39"> 39: </a><span class="php-comment"> */</span> |
</span><span id="40" class="l"><a class="l" href="#40"> 40: </a> <span class="php-keyword1">const</span> <a id="OPTION_SEPARATEUR_ENTREE" href="#OPTION_SEPARATEUR_ENTREE">OPTION_SEPARATEUR_ENTREE</a> = <span class="php-quote">'separateur_entree'</span>; |
</span><span id="41" class="l"><a class="l" href="#41"> 41: </a> |
</span><span id="42" class="l"><a class="l" href="#42"> 42: </a> <span class="php-comment">/** |
</span></span><span id="43" class="l"><a class="l" href="#43"> 43: </a><span class="php-comment"> * Séparateur de variables lors de la génération de la requête. Par défaut, spécifié |
</span></span><span id="44" class="l"><a class="l" href="#44"> 44: </a><span class="php-comment"> * par le paramètre arg_separator.output dans php.ini (par défaut "&"). |
</span></span><span id="45" class="l"><a class="l" href="#45"> 45: </a><span class="php-comment"> */</span> |
</span><span id="46" class="l"><a class="l" href="#46"> 46: </a> <span class="php-keyword1">const</span> <a id="OPTION_SEPARATEUR_SORTIE" href="#OPTION_SEPARATEUR_SORTIE">OPTION_SEPARATEUR_SORTIE</a> = <span class="php-quote">'separateur_sortie'</span>; |
</span><span id="47" class="l"><a class="l" href="#47"> 47: </a> |
</span><span id="48" class="l"><a class="l" href="#48"> 48: </a> <span class="php-comment">/** |
</span></span><span id="49" class="l"><a class="l" href="#49"> 49: </a><span class="php-comment"> * Options par défaut correspondant au comportement de php |
</span></span><span id="50" class="l"><a class="l" href="#50"> 50: </a><span class="php-comment"> * vis à vis de $_GET |
</span></span><span id="51" class="l"><a class="l" href="#51"> 51: </a><span class="php-comment"> */</span> |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$options" href="#$options">$options</a></span> = <span class="php-keyword1">array</span>( |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> self::OPTION_UTILISER_CROCHETS => <span class="php-keyword1">true</span>, |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> self::OPTION_ENCODER_CLES => <span class="php-keyword1">true</span>, |
</span><span id="55" class="l"><a class="l" href="#55"> 55: </a> self::OPTION_ENCODER_VALEURS => <span class="php-keyword1">false</span>, |
</span><span id="56" class="l"><a class="l" href="#56"> 56: </a> self::OPTION_SEPARATEUR_ENTREE => <span class="php-quote">'&'</span>, |
</span><span id="57" class="l"><a class="l" href="#57"> 57: </a> self::OPTION_SEPARATEUR_SORTIE => <span class="php-quote">'&'</span>); |
</span><span id="58" class="l"><a class="l" href="#58"> 58: </a> |
</span><span id="59" class="l"><a class="l" href="#59"> 59: </a> <span class="php-comment">/** |
</span></span><span id="60" class="l"><a class="l" href="#60"> 60: </a><span class="php-comment"> * @var string|bool |
</span></span><span id="61" class="l"><a class="l" href="#61"> 61: </a><span class="php-comment"> */</span> |
</span><span id="62" class="l"><a class="l" href="#62"> 62: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$schema" href="#$schema">$schema</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="63" class="l"><a class="l" href="#63"> 63: </a> |
</span><span id="64" class="l"><a class="l" href="#64"> 64: </a> <span class="php-comment">/** |
</span></span><span id="65" class="l"><a class="l" href="#65"> 65: </a><span class="php-comment"> * @var string|bool |
</span></span><span id="66" class="l"><a class="l" href="#66"> 66: </a><span class="php-comment"> */</span> |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$infoUtilisateur" href="#$infoUtilisateur">$infoUtilisateur</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> <span class="php-comment">/** |
</span></span><span id="70" class="l"><a class="l" href="#70"> 70: </a><span class="php-comment"> * @var string|bool |
</span></span><span id="71" class="l"><a class="l" href="#71"> 71: </a><span class="php-comment"> */</span> |
</span><span id="72" class="l"><a class="l" href="#72"> 72: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$hote" href="#$hote">$hote</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="73" class="l"><a class="l" href="#73"> 73: </a> |
</span><span id="74" class="l"><a class="l" href="#74"> 74: </a> <span class="php-comment">/** |
</span></span><span id="75" class="l"><a class="l" href="#75"> 75: </a><span class="php-comment"> * @var int|bool |
</span></span><span id="76" class="l"><a class="l" href="#76"> 76: </a><span class="php-comment"> */</span> |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$port" href="#$port">$port</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> |
</span><span id="79" class="l"><a class="l" href="#79"> 79: </a> <span class="php-comment">/** |
</span></span><span id="80" class="l"><a class="l" href="#80"> 80: </a><span class="php-comment"> * @var string |
</span></span><span id="81" class="l"><a class="l" href="#81"> 81: </a><span class="php-comment"> */</span> |
</span><span id="82" class="l"><a class="l" href="#82"> 82: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$chemin" href="#$chemin">$chemin</a></span> = <span class="php-quote">''</span>; |
</span><span id="83" class="l"><a class="l" href="#83"> 83: </a> |
</span><span id="84" class="l"><a class="l" href="#84"> 84: </a> <span class="php-comment">/** |
</span></span><span id="85" class="l"><a class="l" href="#85"> 85: </a><span class="php-comment"> * @var string|bool |
</span></span><span id="86" class="l"><a class="l" href="#86"> 86: </a><span class="php-comment"> */</span> |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$requete" href="#$requete">$requete</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="88" class="l"><a class="l" href="#88"> 88: </a> |
</span><span id="89" class="l"><a class="l" href="#89"> 89: </a> <span class="php-comment">/** |
</span></span><span id="90" class="l"><a class="l" href="#90"> 90: </a><span class="php-comment"> * @var string|bool |
</span></span><span id="91" class="l"><a class="l" href="#91"> 91: </a><span class="php-comment"> */</span> |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$fragment" href="#$fragment">$fragment</a></span> = <span class="php-keyword1">false</span>; |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> <span class="php-comment">/** Tableau des noms des paramètres à définir dans le fichier de config car obligatoirement nécessaire à cette classe.*/</span> |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$parametres_obligatoires" href="#$parametres_obligatoires">$parametres_obligatoires</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'url_arg_separateur_entree'</span>, <span class="php-quote">'url_arg_separateur_sortie'</span>); |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-comment">/** |
</span></span><span id="98" class="l"><a class="l" href="#98"> 98: </a><span class="php-comment"> * @param string $url une URL relative ou absolue |
</span></span><span id="99" class="l"><a class="l" href="#99"> 99: </a><span class="php-comment"> * @param array $options |
</span></span><span id="100" class="l"><a class="l" href="#100">100: </a><span class="php-comment"> */</span> |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>(<span class="php-var">$url</span>, <span class="php-var">$options</span> = <span class="php-keyword1">null</span>) { |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> Config::verifierPresenceParametres(<span class="php-var">$this</span>->parametres_obligatoires); |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> <span class="php-var">$this</span>->setOption(self::OPTION_SEPARATEUR_ENTREE, Config::get(<span class="php-quote">'url_arg_separateur_entree'</span>)); |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-var">$this</span>->setOption(self::OPTION_SEPARATEUR_SORTIE, Config::get(<span class="php-quote">'url_arg_separateur_sortie'</span>)); |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$options</span>)) { |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$options</span> <span class="php-keyword1">as</span> <span class="php-var">$nomOption</span> => <span class="php-var">$valeur</span>) { |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> <span class="php-var">$this</span>->setOption(<span class="php-var">$nomOption</span>); |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> } |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> } |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">preg_match</span>(<span class="php-quote">'@^([a-z][a-z0-9.+-]*):@i'</span>, <span class="php-var">$url</span>, <span class="php-var">$reg</span>)) { |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-var">$this</span>->schema = <span class="php-var">$reg</span>[<span class="php-num">1</span>]; |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> <span class="php-var">$url</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$url</span>, <span class="php-keyword2">strlen</span>(<span class="php-var">$reg</span>[<span class="php-num">0</span>])); |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> } |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">preg_match</span>(<span class="php-quote">'@^//([^/#?]+)@'</span>, <span class="php-var">$url</span>, <span class="php-var">$reg</span>)) { |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-var">$this</span>->setAutorite(<span class="php-var">$reg</span>[<span class="php-num">1</span>]); |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> <span class="php-var">$url</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$url</span>, <span class="php-keyword2">strlen</span>(<span class="php-var">$reg</span>[<span class="php-num">0</span>])); |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> } |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> <span class="php-var">$i</span> = <span class="php-keyword2">strcspn</span>(<span class="php-var">$url</span>, <span class="php-quote">'?#'</span>); |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> <span class="php-var">$this</span>->chemin = <span class="php-keyword2">substr</span>(<span class="php-var">$url</span>, <span class="php-num">0</span>, <span class="php-var">$i</span>); |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> <span class="php-var">$url</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$url</span>, <span class="php-var">$i</span>); |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">preg_match</span>(<span class="php-quote">'@^\?([^#]*)@'</span>, <span class="php-var">$url</span>, <span class="php-var">$reg</span>)) { |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-var">$this</span>->requete = <span class="php-var">$reg</span>[<span class="php-num">1</span>]; |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-var">$url</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$url</span>, <span class="php-keyword2">strlen</span>(<span class="php-var">$reg</span>[<span class="php-num">0</span>])); |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> } |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> <span class="php-keyword1">if</span> (<span class="php-var">$url</span>) { |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> <span class="php-var">$this</span>->fragment = <span class="php-keyword2">substr</span>(<span class="php-var">$url</span>, <span class="php-num">1</span>); |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> } |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> } |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> <span class="php-comment">/** |
</span></span><span id="137" class="l"><a class="l" href="#137">137: </a><span class="php-comment"> * Renvoie la valeur de l'option specifiée. |
</span></span><span id="138" class="l"><a class="l" href="#138">138: </a><span class="php-comment"> * |
</span></span><span id="139" class="l"><a class="l" href="#139">139: </a><span class="php-comment"> * @param string $nomOption Nom de l'option demandée |
</span></span><span id="140" class="l"><a class="l" href="#140">140: </a><span class="php-comment"> * |
</span></span><span id="141" class="l"><a class="l" href="#141">141: </a><span class="php-comment"> * @return mixed |
</span></span><span id="142" class="l"><a class="l" href="#142">142: </a><span class="php-comment"> */</span> |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getOption" href="#_getOption">getOption</a>(<span class="php-var">$nomOption</span>) { |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->options[<span class="php-var">$nomOption</span>]) ? <span class="php-var">$this</span>->options[<span class="php-var">$nomOption</span>] : <span class="php-keyword1">false</span>; |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> } |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> <span class="php-comment">/** |
</span></span><span id="148" class="l"><a class="l" href="#148">148: </a><span class="php-comment"> * Met à jour la valeur de l'option spécifiée. |
</span></span><span id="149" class="l"><a class="l" href="#149">149: </a><span class="php-comment"> * |
</span></span><span id="150" class="l"><a class="l" href="#150">150: </a><span class="php-comment"> * @param string $nomOption une des constantes commençant par self::OPTION_ |
</span></span><span id="151" class="l"><a class="l" href="#151">151: </a><span class="php-comment"> * @param mixed $valeur valeur de l'option |
</span></span><span id="152" class="l"><a class="l" href="#152">152: </a><span class="php-comment"> * |
</span></span><span id="153" class="l"><a class="l" href="#153">153: </a><span class="php-comment"> * @return void |
</span></span><span id="154" class="l"><a class="l" href="#154">154: </a><span class="php-comment"> * @see self::OPTION_STRICTE |
</span></span><span id="155" class="l"><a class="l" href="#155">155: </a><span class="php-comment"> * @see self::OPTION_UTILISER_CROCHETS |
</span></span><span id="156" class="l"><a class="l" href="#156">156: </a><span class="php-comment"> * @see self::OPTION_ENCODER_CLES |
</span></span><span id="157" class="l"><a class="l" href="#157">157: </a><span class="php-comment"> */</span> |
</span><span id="158" class="l"><a class="l" href="#158">158: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_setOption" href="#_setOption">setOption</a>(<span class="php-var">$nomOption</span>, <span class="php-var">$valeur</span>) { |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">array_key_exists</span>(<span class="php-var">$nomOption</span>, <span class="php-var">$this</span>->options)) { |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="161" class="l"><a class="l" href="#161">161: </a> } |
</span><span id="162" class="l"><a class="l" href="#162">162: </a> <span class="php-var">$this</span>->options[<span class="php-var">$nomOption</span>] = <span class="php-var">$valeur</span>; |
</span><span id="163" class="l"><a class="l" href="#163">163: </a> } |
</span><span id="164" class="l"><a class="l" href="#164">164: </a> |
</span><span id="165" class="l"><a class="l" href="#165">165: </a> <span class="php-comment">/** |
</span></span><span id="166" class="l"><a class="l" href="#166">166: </a><span class="php-comment"> * Renvoie la partie autorité, i.e. [ infoUtilisateur "@" ] hote [ ":" port ], ou |
</span></span><span id="167" class="l"><a class="l" href="#167">167: </a><span class="php-comment"> * false si celle-ci est absente. |
</span></span><span id="168" class="l"><a class="l" href="#168">168: </a><span class="php-comment"> * |
</span></span><span id="169" class="l"><a class="l" href="#169">169: </a><span class="php-comment"> * @return string|bool |
</span></span><span id="170" class="l"><a class="l" href="#170">170: </a><span class="php-comment"> */</span> |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_getAutorite" href="#_getAutorite">getAutorite</a>() { |
</span><span id="172" class="l"><a class="l" href="#172">172: </a> <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>->hote) { |
</span><span id="173" class="l"><a class="l" href="#173">173: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="174" class="l"><a class="l" href="#174">174: </a> } |
</span><span id="175" class="l"><a class="l" href="#175">175: </a> |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> <span class="php-var">$autorite</span> = <span class="php-quote">''</span>; |
</span><span id="177" class="l"><a class="l" href="#177">177: </a> |
</span><span id="178" class="l"><a class="l" href="#178">178: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->infoUtilisateur !== <span class="php-keyword1">false</span>) { |
</span><span id="179" class="l"><a class="l" href="#179">179: </a> <span class="php-var">$autorite</span> .= <span class="php-var">$this</span>->infoUtilisateur . <span class="php-quote">'@'</span>; |
</span><span id="180" class="l"><a class="l" href="#180">180: </a> } |
</span><span id="181" class="l"><a class="l" href="#181">181: </a> |
</span><span id="182" class="l"><a class="l" href="#182">182: </a> <span class="php-var">$autorite</span> .= <span class="php-var">$this</span>->hote; |
</span><span id="183" class="l"><a class="l" href="#183">183: </a> |
</span><span id="184" class="l"><a class="l" href="#184">184: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->port !== <span class="php-keyword1">false</span>) { |
</span><span id="185" class="l"><a class="l" href="#185">185: </a> <span class="php-var">$autorite</span> .= <span class="php-quote">':'</span> . <span class="php-var">$this</span>->port; |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> } |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> |
</span><span id="188" class="l"><a class="l" href="#188">188: </a> <span class="php-keyword1">return</span> <span class="php-var">$autorite</span>; |
</span><span id="189" class="l"><a class="l" href="#189">189: </a> } |
</span><span id="190" class="l"><a class="l" href="#190">190: </a> |
</span><span id="191" class="l"><a class="l" href="#191">191: </a> <span class="php-comment">/** |
</span></span><span id="192" class="l"><a class="l" href="#192">192: </a><span class="php-comment"> * @param string|false $autorite |
</span></span><span id="193" class="l"><a class="l" href="#193">193: </a><span class="php-comment"> * |
</span></span><span id="194" class="l"><a class="l" href="#194">194: </a><span class="php-comment"> * @return void |
</span></span><span id="195" class="l"><a class="l" href="#195">195: </a><span class="php-comment"> */</span> |
</span><span id="196" class="l"><a class="l" href="#196">196: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_setAutorite" href="#_setAutorite">setAutorite</a>(<span class="php-var">$autorite</span>) { |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> <span class="php-var">$this</span>->user = <span class="php-keyword1">false</span>; |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> <span class="php-var">$this</span>->pass = <span class="php-keyword1">false</span>; |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> <span class="php-var">$this</span>->hote = <span class="php-keyword1">false</span>; |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> <span class="php-var">$this</span>->port = <span class="php-keyword1">false</span>; |
</span><span id="201" class="l"><a class="l" href="#201">201: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">preg_match</span>(<span class="php-quote">'@^(([^\@]+)\@)?([^:]+)(:(\d*))?$@'</span>, <span class="php-var">$autorite</span>, <span class="php-var">$reg</span>)) { |
</span><span id="202" class="l"><a class="l" href="#202">202: </a> <span class="php-keyword1">if</span> (<span class="php-var">$reg</span>[<span class="php-num">1</span>]) { |
</span><span id="203" class="l"><a class="l" href="#203">203: </a> <span class="php-var">$this</span>->infoUtilisateur = <span class="php-var">$reg</span>[<span class="php-num">2</span>]; |
</span><span id="204" class="l"><a class="l" href="#204">204: </a> } |
</span><span id="205" class="l"><a class="l" href="#205">205: </a> |
</span><span id="206" class="l"><a class="l" href="#206">206: </a> <span class="php-var">$this</span>->hote = <span class="php-var">$reg</span>[<span class="php-num">3</span>]; |
</span><span id="207" class="l"><a class="l" href="#207">207: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$reg</span>[<span class="php-num">5</span>])) { |
</span><span id="208" class="l"><a class="l" href="#208">208: </a> <span class="php-var">$this</span>->port = <span class="php-keyword2">intval</span>(<span class="php-var">$reg</span>[<span class="php-num">5</span>]); |
</span><span id="209" class="l"><a class="l" href="#209">209: </a> } |
</span><span id="210" class="l"><a class="l" href="#210">210: </a> } |
</span><span id="211" class="l"><a class="l" href="#211">211: </a> } |
</span><span id="212" class="l"><a class="l" href="#212">212: </a> |
</span><span id="213" class="l"><a class="l" href="#213">213: </a> <span class="php-comment">/** |
</span></span><span id="214" class="l"><a class="l" href="#214">214: </a><span class="php-comment"> * Renvoie vrai ou faux suivant que l'instance en cours représente une URL relative ou absolue. |
</span></span><span id="215" class="l"><a class="l" href="#215">215: </a><span class="php-comment"> * |
</span></span><span id="216" class="l"><a class="l" href="#216">216: </a><span class="php-comment"> * @return bool |
</span></span><span id="217" class="l"><a class="l" href="#217">217: </a><span class="php-comment"> */</span> |
</span><span id="218" class="l"><a class="l" href="#218">218: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_etreAbsolue" href="#_etreAbsolue">etreAbsolue</a>() { |
</span><span id="219" class="l"><a class="l" href="#219">219: </a> <span class="php-keyword1">return</span> (bool) <span class="php-var">$this</span>->schema; |
</span><span id="220" class="l"><a class="l" href="#220">220: </a> } |
</span><span id="221" class="l"><a class="l" href="#221">221: </a> |
</span><span id="222" class="l"><a class="l" href="#222">222: </a> <span class="php-comment">/** |
</span></span><span id="223" class="l"><a class="l" href="#223">223: </a><span class="php-comment"> * La suppression des segments à points est décrite dans la RFC 3986, section 5.2.4, e.g. |
</span></span><span id="224" class="l"><a class="l" href="#224">224: </a><span class="php-comment"> * "/foo/../bar/baz" => "/bar/baz" |
</span></span><span id="225" class="l"><a class="l" href="#225">225: </a><span class="php-comment"> * |
</span></span><span id="226" class="l"><a class="l" href="#226">226: </a><span class="php-comment"> * @param string $chemin un chemin |
</span></span><span id="227" class="l"><a class="l" href="#227">227: </a><span class="php-comment"> * |
</span></span><span id="228" class="l"><a class="l" href="#228">228: </a><span class="php-comment"> * @return string un chemin |
</span></span><span id="229" class="l"><a class="l" href="#229">229: </a><span class="php-comment"> */</span> |
</span><span id="230" class="l"><a class="l" href="#230">230: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_supprimerSegmentsAPoints" href="#_supprimerSegmentsAPoints">supprimerSegmentsAPoints</a>(<span class="php-var">$chemin</span>) { |
</span><span id="231" class="l"><a class="l" href="#231">231: </a> <span class="php-var">$sortie</span> = <span class="php-quote">''</span>; |
</span><span id="232" class="l"><a class="l" href="#232">232: </a> |
</span><span id="233" class="l"><a class="l" href="#233">233: </a> <span class="php-comment">// Assurons nous de ne pas nous retrouver piégés dans une boucle infinie due à un bug de cette méthode</span> |
</span><span id="234" class="l"><a class="l" href="#234">234: </a> <span class="php-var">$j</span> = <span class="php-num">0</span>; |
</span><span id="235" class="l"><a class="l" href="#235">235: </a> <span class="php-keyword1">while</span> (<span class="php-var">$chemin</span> && <span class="php-var">$j</span>++ < <span class="php-num">100</span>) { |
</span><span id="236" class="l"><a class="l" href="#236">236: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$chemin</span>, <span class="php-num">0</span>, <span class="php-num">2</span>) == <span class="php-quote">'./'</span>) {<span class="php-comment">// Étape A</span> |
</span><span id="237" class="l"><a class="l" href="#237">237: </a> <span class="php-var">$chemin</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$chemin</span>, <span class="php-num">2</span>); |
</span><span id="238" class="l"><a class="l" href="#238">238: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$chemin</span>, <span class="php-num">0</span>, <span class="php-num">3</span>) == <span class="php-quote">'../'</span>) { |
</span><span id="239" class="l"><a class="l" href="#239">239: </a> <span class="php-var">$chemin</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$chemin</span>, <span class="php-num">3</span>); |
</span><span id="240" class="l"><a class="l" href="#240">240: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$chemin</span>, <span class="php-num">0</span>, <span class="php-num">3</span>) == <span class="php-quote">'/./'</span> || <span class="php-var">$chemin</span> == <span class="php-quote">'/.'</span>) {<span class="php-comment">// Étape B</span> |
</span><span id="241" class="l"><a class="l" href="#241">241: </a> <span class="php-var">$chemin</span> = <span class="php-quote">'/'</span> . <span class="php-keyword2">substr</span>(<span class="php-var">$chemin</span>, <span class="php-num">3</span>); |
</span><span id="242" class="l"><a class="l" href="#242">242: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$chemin</span>, <span class="php-num">0</span>, <span class="php-num">4</span>) == <span class="php-quote">'/../'</span> || <span class="php-var">$chemin</span> == <span class="php-quote">'/..'</span>) {<span class="php-comment">// Étape C</span> |
</span><span id="243" class="l"><a class="l" href="#243">243: </a> <span class="php-var">$chemin</span> = <span class="php-quote">'/'</span> . <span class="php-keyword2">substr</span>(<span class="php-var">$chemin</span>, <span class="php-num">4</span>); |
</span><span id="244" class="l"><a class="l" href="#244">244: </a> <span class="php-var">$i</span> = <span class="php-keyword2">strrpos</span>(<span class="php-var">$sortie</span>, <span class="php-quote">'/'</span>); |
</span><span id="245" class="l"><a class="l" href="#245">245: </a> <span class="php-var">$sortie</span> = <span class="php-var">$i</span> === <span class="php-keyword1">false</span> ? <span class="php-quote">''</span> : <span class="php-keyword2">substr</span>(<span class="php-var">$sortie</span>, <span class="php-num">0</span>, <span class="php-var">$i</span>); |
</span><span id="246" class="l"><a class="l" href="#246">246: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-var">$chemin</span> == <span class="php-quote">'.'</span> || <span class="php-var">$chemin</span> == <span class="php-quote">'..'</span>) {<span class="php-comment">// Étape D</span> |
</span><span id="247" class="l"><a class="l" href="#247">247: </a> <span class="php-var">$chemin</span> = <span class="php-quote">''</span>; |
</span><span id="248" class="l"><a class="l" href="#248">248: </a> } <span class="php-keyword1">else</span> {<span class="php-comment">// Étape E</span> |
</span><span id="249" class="l"><a class="l" href="#249">249: </a> <span class="php-var">$i</span> = <span class="php-keyword2">strpos</span>(<span class="php-var">$chemin</span>, <span class="php-quote">'/'</span>); |
</span><span id="250" class="l"><a class="l" href="#250">250: </a> <span class="php-keyword1">if</span> (<span class="php-var">$i</span> === <span class="php-num">0</span>) { |
</span><span id="251" class="l"><a class="l" href="#251">251: </a> <span class="php-var">$i</span> = <span class="php-keyword2">strpos</span>(<span class="php-var">$chemin</span>, <span class="php-quote">'/'</span>, <span class="php-num">1</span>); |
</span><span id="252" class="l"><a class="l" href="#252">252: </a> } |
</span><span id="253" class="l"><a class="l" href="#253">253: </a> <span class="php-keyword1">if</span> (<span class="php-var">$i</span> === <span class="php-keyword1">false</span>) { |
</span><span id="254" class="l"><a class="l" href="#254">254: </a> <span class="php-var">$i</span> = <span class="php-keyword2">strlen</span>(<span class="php-var">$chemin</span>); |
</span><span id="255" class="l"><a class="l" href="#255">255: </a> } |
</span><span id="256" class="l"><a class="l" href="#256">256: </a> <span class="php-var">$sortie</span> .= <span class="php-keyword2">substr</span>(<span class="php-var">$chemin</span>, <span class="php-num">0</span>, <span class="php-var">$i</span>); |
</span><span id="257" class="l"><a class="l" href="#257">257: </a> <span class="php-var">$chemin</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$chemin</span>, <span class="php-var">$i</span>); |
</span><span id="258" class="l"><a class="l" href="#258">258: </a> } |
</span><span id="259" class="l"><a class="l" href="#259">259: </a> } |
</span><span id="260" class="l"><a class="l" href="#260">260: </a> |
</span><span id="261" class="l"><a class="l" href="#261">261: </a> <span class="php-keyword1">return</span> <span class="php-var">$sortie</span>; |
</span><span id="262" class="l"><a class="l" href="#262">262: </a> } |
</span><span id="263" class="l"><a class="l" href="#263">263: </a> |
</span><span id="264" class="l"><a class="l" href="#264">264: </a> <span class="php-comment">/** |
</span></span><span id="265" class="l"><a class="l" href="#265">265: </a><span class="php-comment"> * (Re-)Création de la partie requête de l'URL à partir des données du tableau (passé en paramètre). |
</span></span><span id="266" class="l"><a class="l" href="#266">266: </a><span class="php-comment"> * |
</span></span><span id="267" class="l"><a class="l" href="#267">267: </a><span class="php-comment"> * @param array (nom => valeur) tableau de clés & valeurs pour la partie requête de l'url. |
</span></span><span id="268" class="l"><a class="l" href="#268">268: </a><span class="php-comment"> * @return void (Re-)Création de la partie requête. |
</span></span><span id="269" class="l"><a class="l" href="#269">269: </a><span class="php-comment"> */</span> |
</span><span id="270" class="l"><a class="l" href="#270">270: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_setRequete" href="#_setRequete">setRequete</a>(<span class="php-keyword1">Array</span> <span class="php-var">$parametres</span>) { |
</span><span id="271" class="l"><a class="l" href="#271">271: </a> <span class="php-keyword1">if</span> (!<span class="php-var">$parametres</span>) { |
</span><span id="272" class="l"><a class="l" href="#272">272: </a> <span class="php-var">$this</span>->requete = <span class="php-keyword1">false</span>; |
</span><span id="273" class="l"><a class="l" href="#273">273: </a> } <span class="php-keyword1">else</span> { |
</span><span id="274" class="l"><a class="l" href="#274">274: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$parametres</span> <span class="php-keyword1">as</span> <span class="php-var">$nom</span> => <span class="php-var">$valeur</span>) { |
</span><span id="275" class="l"><a class="l" href="#275">275: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->getOption(self::OPTION_ENCODER_CLES)) { |
</span><span id="276" class="l"><a class="l" href="#276">276: </a> <span class="php-var">$nom</span> = <span class="php-keyword2">rawurlencode</span>(<span class="php-var">$nom</span>); |
</span><span id="277" class="l"><a class="l" href="#277">277: </a> } |
</span><span id="278" class="l"><a class="l" href="#278">278: </a> |
</span><span id="279" class="l"><a class="l" href="#279">279: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->getOption(self::OPTION_ENCODER_VALEURS)) { |
</span><span id="280" class="l"><a class="l" href="#280">280: </a> <span class="php-var">$valeur</span> = <span class="php-keyword2">rawurlencode</span>(<span class="php-var">$valeur</span>); |
</span><span id="281" class="l"><a class="l" href="#281">281: </a> } |
</span><span id="282" class="l"><a class="l" href="#282">282: </a> |
</span><span id="283" class="l"><a class="l" href="#283">283: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$valeur</span>)) { |
</span><span id="284" class="l"><a class="l" href="#284">284: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$valeur</span> <span class="php-keyword1">as</span> <span class="php-var">$k</span> => <span class="php-var">$v</span>) { |
</span><span id="285" class="l"><a class="l" href="#285">285: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->getOption(self::OPTION_UTILISER_CROCHETS)) { |
</span><span id="286" class="l"><a class="l" href="#286">286: </a> <span class="php-var">$parties</span>[] = <span class="php-keyword2">sprintf</span>(<span class="php-quote">'%s[%s]=%s'</span>, <span class="php-var">$nom</span>, <span class="php-var">$k</span>, <span class="php-var">$v</span>); |
</span><span id="287" class="l"><a class="l" href="#287">287: </a> } <span class="php-keyword1">else</span> { |
</span><span id="288" class="l"><a class="l" href="#288">288: </a> <span class="php-var">$parties</span>[] = <span class="php-var">$nom</span>.<span class="php-quote">'='</span>.<span class="php-var">$v</span>; |
</span><span id="289" class="l"><a class="l" href="#289">289: </a> } |
</span><span id="290" class="l"><a class="l" href="#290">290: </a> } |
</span><span id="291" class="l"><a class="l" href="#291">291: </a> } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_null</span>(<span class="php-var">$valeur</span>)) { |
</span><span id="292" class="l"><a class="l" href="#292">292: </a> <span class="php-var">$parties</span>[] = <span class="php-var">$nom</span> . <span class="php-quote">'='</span> . <span class="php-var">$valeur</span>; |
</span><span id="293" class="l"><a class="l" href="#293">293: </a> } <span class="php-keyword1">else</span> { |
</span><span id="294" class="l"><a class="l" href="#294">294: </a> <span class="php-var">$parties</span>[] = <span class="php-var">$nom</span>; |
</span><span id="295" class="l"><a class="l" href="#295">295: </a> } |
</span><span id="296" class="l"><a class="l" href="#296">296: </a> } |
</span><span id="297" class="l"><a class="l" href="#297">297: </a> <span class="php-var">$this</span>->requete = <span class="php-keyword2">implode</span>(<span class="php-var">$this</span>->getOption(self::OPTION_SEPARATEUR_SORTIE), <span class="php-var">$parties</span>); |
</span><span id="298" class="l"><a class="l" href="#298">298: </a> } |
</span><span id="299" class="l"><a class="l" href="#299">299: </a> } |
</span><span id="300" class="l"><a class="l" href="#300">300: </a> |
</span><span id="301" class="l"><a class="l" href="#301">301: </a> <span class="php-comment">/** |
</span></span><span id="302" class="l"><a class="l" href="#302">302: </a><span class="php-comment"> * (Re-)Création de la partie requête de l'URL à partir de la fusion du tableau (passé en paramètre) et |
</span></span><span id="303" class="l"><a class="l" href="#303">303: </a><span class="php-comment"> * les valeurs présentes dans $_GET. |
</span></span><span id="304" class="l"><a class="l" href="#304">304: </a><span class="php-comment"> * |
</span></span><span id="305" class="l"><a class="l" href="#305">305: </a><span class="php-comment"> * @param array (nom => valeur) tableau de clés & valeurs pour la partie requête de l'url. |
</span></span><span id="306" class="l"><a class="l" href="#306">306: </a><span class="php-comment"> * @return void (Re-)Création de la partie requête. |
</span></span><span id="307" class="l"><a class="l" href="#307">307: </a><span class="php-comment"> */</span> |
</span><span id="308" class="l"><a class="l" href="#308">308: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_fusionnerRequete" href="#_fusionnerRequete">fusionnerRequete</a>(<span class="php-keyword1">Array</span> <span class="php-var">$parametres</span>) { |
</span><span id="309" class="l"><a class="l" href="#309">309: </a> <span class="php-keyword1">if</span> (<span class="php-var">$parametres</span>) { |
</span><span id="310" class="l"><a class="l" href="#310">310: </a> <span class="php-var">$requete</span> = <span class="php-var">$parametres</span> + <span class="php-var">$_GET</span>; |
</span><span id="311" class="l"><a class="l" href="#311">311: </a> <span class="php-var">$this</span>->setRequete(<span class="php-var">$requete</span>); |
</span><span id="312" class="l"><a class="l" href="#312">312: </a> } |
</span><span id="313" class="l"><a class="l" href="#313">313: </a> } |
</span><span id="314" class="l"><a class="l" href="#314">314: </a> |
</span><span id="315" class="l"><a class="l" href="#315">315: </a> <span class="php-comment">/** |
</span></span><span id="316" class="l"><a class="l" href="#316">316: </a><span class="php-comment"> * Normalise les données de l'instance d'Url faisant appel à cette méthode. |
</span></span><span id="317" class="l"><a class="l" href="#317">317: </a><span class="php-comment"> * |
</span></span><span id="318" class="l"><a class="l" href="#318">318: </a><span class="php-comment"> * @return void l'instance d'Url courrante est normalisée. |
</span></span><span id="319" class="l"><a class="l" href="#319">319: </a><span class="php-comment"> */</span> |
</span><span id="320" class="l"><a class="l" href="#320">320: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_normaliser" href="#_normaliser">normaliser</a>() { |
</span><span id="321" class="l"><a class="l" href="#321">321: </a> <span class="php-comment">// Voir RFC 3886, section 6</span> |
</span><span id="322" class="l"><a class="l" href="#322">322: </a> |
</span><span id="323" class="l"><a class="l" href="#323">323: </a> <span class="php-comment">// les cchémas sont insesibles à la casse</span> |
</span><span id="324" class="l"><a class="l" href="#324">324: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->schema) { |
</span><span id="325" class="l"><a class="l" href="#325">325: </a> <span class="php-var">$this</span>->schema = <span class="php-keyword2">strtolower</span>(<span class="php-var">$this</span>->schema); |
</span><span id="326" class="l"><a class="l" href="#326">326: </a> } |
</span><span id="327" class="l"><a class="l" href="#327">327: </a> |
</span><span id="328" class="l"><a class="l" href="#328">328: </a> <span class="php-comment">// les noms d'hotes sont insensibles à la casse</span> |
</span><span id="329" class="l"><a class="l" href="#329">329: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->hote) { |
</span><span id="330" class="l"><a class="l" href="#330">330: </a> <span class="php-var">$this</span>->hote = <span class="php-keyword2">strtolower</span>(<span class="php-var">$this</span>->hote); |
</span><span id="331" class="l"><a class="l" href="#331">331: </a> } |
</span><span id="332" class="l"><a class="l" href="#332">332: </a> |
</span><span id="333" class="l"><a class="l" href="#333">333: </a> <span class="php-comment">// Supprimer le numéro de port par défaut pour les schemas connus (RFC 3986, section 6.2.3)</span> |
</span><span id="334" class="l"><a class="l" href="#334">334: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->port && <span class="php-var">$this</span>->schema && <span class="php-var">$this</span>->port == <span class="php-keyword2">getservbyname</span>(<span class="php-var">$this</span>->schema, <span class="php-quote">'tcp'</span>)) { |
</span><span id="335" class="l"><a class="l" href="#335">335: </a> <span class="php-var">$this</span>->port = <span class="php-keyword1">false</span>; |
</span><span id="336" class="l"><a class="l" href="#336">336: </a> } |
</span><span id="337" class="l"><a class="l" href="#337">337: </a> |
</span><span id="338" class="l"><a class="l" href="#338">338: </a> <span class="php-comment">// normalisation dans le cas d'un encodage avec %XX pourcentage (RFC 3986, section 6.2.2.1)</span> |
</span><span id="339" class="l"><a class="l" href="#339">339: </a> <span class="php-keyword1">foreach</span> (<span class="php-keyword1">array</span>(<span class="php-quote">'infoUtilisateur'</span>, <span class="php-quote">'hote'</span>, <span class="php-quote">'chemin'</span>) <span class="php-keyword1">as</span> <span class="php-var">$partie</span>) { |
</span><span id="340" class="l"><a class="l" href="#340">340: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-><span class="php-var">$partie</span>) { |
</span><span id="341" class="l"><a class="l" href="#341">341: </a> <span class="php-var">$this</span>-><span class="php-var">$partie</span> = <span class="php-keyword2">preg_replace</span>(<span class="php-quote">'/%[0-9a-f]{2}/ie'</span>, <span class="php-quote">'strtoupper("\0")'</span>, <span class="php-var">$this</span>-><span class="php-var">$partie</span>); |
</span><span id="342" class="l"><a class="l" href="#342">342: </a> } |
</span><span id="343" class="l"><a class="l" href="#343">343: </a> } |
</span><span id="344" class="l"><a class="l" href="#344">344: </a> |
</span><span id="345" class="l"><a class="l" href="#345">345: </a> <span class="php-comment">// normalisation des segments du chemin (RFC 3986, section 6.2.2.3)</span> |
</span><span id="346" class="l"><a class="l" href="#346">346: </a> <span class="php-var">$this</span>->chemin = self::supprimerSegmentsAPoints(<span class="php-var">$this</span>->chemin); |
</span><span id="347" class="l"><a class="l" href="#347">347: </a> |
</span><span id="348" class="l"><a class="l" href="#348">348: </a> <span class="php-comment">// normalisation basée sur le schéma (RFC 3986, section 6.2.3)</span> |
</span><span id="349" class="l"><a class="l" href="#349">349: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->hote && !<span class="php-var">$this</span>->chemin) { |
</span><span id="350" class="l"><a class="l" href="#350">350: </a> <span class="php-var">$this</span>->chemin = <span class="php-quote">'/'</span>; |
</span><span id="351" class="l"><a class="l" href="#351">351: </a> } |
</span><span id="352" class="l"><a class="l" href="#352">352: </a> } |
</span><span id="353" class="l"><a class="l" href="#353">353: </a> |
</span><span id="354" class="l"><a class="l" href="#354">354: </a> <span class="php-comment">/** |
</span></span><span id="355" class="l"><a class="l" href="#355">355: </a><span class="php-comment"> * Renvoie une instance d'objet Url representant l'URL canonique du script PHP en cours d'éxécution. |
</span></span><span id="356" class="l"><a class="l" href="#356">356: </a><span class="php-comment"> * |
</span></span><span id="357" class="l"><a class="l" href="#357">357: </a><span class="php-comment"> * @return Url retourne un objet Url ou null en cas d'erreur. |
</span></span><span id="358" class="l"><a class="l" href="#358">358: </a><span class="php-comment"> */</span> |
</span><span id="359" class="l"><a class="l" href="#359">359: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getCanonique" href="#_getCanonique">getCanonique</a>() { |
</span><span id="360" class="l"><a class="l" href="#360">360: </a> <span class="php-var">$url</span> = <span class="php-keyword1">null</span>; |
</span><span id="361" class="l"><a class="l" href="#361">361: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_METHOD'</span>])) { |
</span><span id="362" class="l"><a class="l" href="#362">362: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Le script n'a pas été appellé à travers un serveur web"</span>, E_USER_WARNING); |
</span><span id="363" class="l"><a class="l" href="#363">363: </a> } <span class="php-keyword1">else</span> { |
</span><span id="364" class="l"><a class="l" href="#364">364: </a> <span class="php-comment">// À partir d'une URL relative</span> |
</span><span id="365" class="l"><a class="l" href="#365">365: </a> <span class="php-var">$url</span> = <span class="php-keyword1">new</span> self(<span class="php-var">$_SERVER</span>[<span class="php-quote">'PHP_SELF'</span>]); |
</span><span id="366" class="l"><a class="l" href="#366">366: </a> <span class="php-var">$url</span>->schema = <span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'HTTPS'</span>]) ? <span class="php-quote">'https'</span> : <span class="php-quote">'http'</span>; |
</span><span id="367" class="l"><a class="l" href="#367">367: </a> <span class="php-var">$url</span>->hote = <span class="php-var">$_SERVER</span>[<span class="php-quote">'SERVER_NAME'</span>]; |
</span><span id="368" class="l"><a class="l" href="#368">368: </a> <span class="php-var">$port</span> = <span class="php-keyword2">intval</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'SERVER_PORT'</span>]); |
</span><span id="369" class="l"><a class="l" href="#369">369: </a> <span class="php-keyword1">if</span> (<span class="php-var">$url</span>->schema == <span class="php-quote">'http'</span> && <span class="php-var">$port</span> != <span class="php-num">80</span> || <span class="php-var">$url</span>->schema == <span class="php-quote">'https'</span> && <span class="php-var">$port</span> != <span class="php-num">443</span>) { |
</span><span id="370" class="l"><a class="l" href="#370">370: </a> <span class="php-var">$url</span>->port = <span class="php-var">$port</span>; |
</span><span id="371" class="l"><a class="l" href="#371">371: </a> } |
</span><span id="372" class="l"><a class="l" href="#372">372: </a> } |
</span><span id="373" class="l"><a class="l" href="#373">373: </a> <span class="php-keyword1">return</span> <span class="php-var">$url</span>; |
</span><span id="374" class="l"><a class="l" href="#374">374: </a> } |
</span><span id="375" class="l"><a class="l" href="#375">375: </a> |
</span><span id="376" class="l"><a class="l" href="#376">376: </a> <span class="php-comment">/** |
</span></span><span id="377" class="l"><a class="l" href="#377">377: </a><span class="php-comment"> * Renvoie une instance d'objet Url representant l'URL utilisée pour récupérer la requête en cours. |
</span></span><span id="378" class="l"><a class="l" href="#378">378: </a><span class="php-comment"> * |
</span></span><span id="379" class="l"><a class="l" href="#379">379: </a><span class="php-comment"> * @return Url retourne un objet Url ou null en cas d'erreur. |
</span></span><span id="380" class="l"><a class="l" href="#380">380: </a><span class="php-comment"> */</span> |
</span><span id="381" class="l"><a class="l" href="#381">381: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getDemande" href="#_getDemande">getDemande</a>() { |
</span><span id="382" class="l"><a class="l" href="#382">382: </a> <span class="php-var">$url</span> = <span class="php-keyword1">null</span>; |
</span><span id="383" class="l"><a class="l" href="#383">383: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_METHOD'</span>])) { |
</span><span id="384" class="l"><a class="l" href="#384">384: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Le script n'a pas été appellé à travers un serveur web"</span>, E_USER_WARNING); |
</span><span id="385" class="l"><a class="l" href="#385">385: </a> } <span class="php-keyword1">else</span> { |
</span><span id="386" class="l"><a class="l" href="#386">386: </a> <span class="php-comment">// On part d'une URL relative</span> |
</span><span id="387" class="l"><a class="l" href="#387">387: </a> <span class="php-var">$url</span> = <span class="php-keyword1">new</span> self(<span class="php-var">$_SERVER</span>[<span class="php-quote">'REQUEST_URI'</span>]); |
</span><span id="388" class="l"><a class="l" href="#388">388: </a> <span class="php-var">$url</span>->schema = <span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'HTTPS'</span>]) ? <span class="php-quote">'https'</span> : <span class="php-quote">'http'</span>; |
</span><span id="389" class="l"><a class="l" href="#389">389: </a> <span class="php-comment">// On met à jour les valeurs de l'hôte et si possible du port</span> |
</span><span id="390" class="l"><a class="l" href="#390">390: </a> <span class="php-var">$url</span>->setAutorite(<span class="php-var">$_SERVER</span>[<span class="php-quote">'HTTP_hote'</span>]); |
</span><span id="391" class="l"><a class="l" href="#391">391: </a> } |
</span><span id="392" class="l"><a class="l" href="#392">392: </a> <span class="php-keyword1">return</span> <span class="php-var">$url</span>; |
</span><span id="393" class="l"><a class="l" href="#393">393: </a> } |
</span><span id="394" class="l"><a class="l" href="#394">394: </a> |
</span><span id="395" class="l"><a class="l" href="#395">395: </a> |
</span><span id="396" class="l"><a class="l" href="#396">396: </a> <span class="php-comment">/** |
</span></span><span id="397" class="l"><a class="l" href="#397">397: </a><span class="php-comment"> * Renvoie un représentation sous forme de chaine de l'URL. |
</span></span><span id="398" class="l"><a class="l" href="#398">398: </a><span class="php-comment"> * |
</span></span><span id="399" class="l"><a class="l" href="#399">399: </a><span class="php-comment"> * @return string l'url |
</span></span><span id="400" class="l"><a class="l" href="#400">400: </a><span class="php-comment"> */</span> |
</span><span id="401" class="l"><a class="l" href="#401">401: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getURL" href="#_getURL">getURL</a>() { |
</span><span id="402" class="l"><a class="l" href="#402">402: </a> <span class="php-comment">// Voir RFC 3986, section 5.3</span> |
</span><span id="403" class="l"><a class="l" href="#403">403: </a> <span class="php-var">$url</span> = <span class="php-quote">''</span>; |
</span><span id="404" class="l"><a class="l" href="#404">404: </a> |
</span><span id="405" class="l"><a class="l" href="#405">405: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->schema !== <span class="php-keyword1">false</span>) { |
</span><span id="406" class="l"><a class="l" href="#406">406: </a> <span class="php-var">$url</span> .= <span class="php-var">$this</span>->schema . <span class="php-quote">':'</span>; |
</span><span id="407" class="l"><a class="l" href="#407">407: </a> } |
</span><span id="408" class="l"><a class="l" href="#408">408: </a> |
</span><span id="409" class="l"><a class="l" href="#409">409: </a> <span class="php-var">$autorite</span> = <span class="php-var">$this</span>->getAutorite(); |
</span><span id="410" class="l"><a class="l" href="#410">410: </a> <span class="php-keyword1">if</span> (<span class="php-var">$autorite</span> !== <span class="php-keyword1">false</span>) { |
</span><span id="411" class="l"><a class="l" href="#411">411: </a> <span class="php-var">$url</span> .= <span class="php-quote">'//'</span> . <span class="php-var">$autorite</span>; |
</span><span id="412" class="l"><a class="l" href="#412">412: </a> } |
</span><span id="413" class="l"><a class="l" href="#413">413: </a> <span class="php-var">$url</span> .= <span class="php-var">$this</span>->chemin; |
</span><span id="414" class="l"><a class="l" href="#414">414: </a> |
</span><span id="415" class="l"><a class="l" href="#415">415: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->requete !== <span class="php-keyword1">false</span>) { |
</span><span id="416" class="l"><a class="l" href="#416">416: </a> <span class="php-var">$url</span> .= <span class="php-quote">'?'</span> . <span class="php-var">$this</span>->requete; |
</span><span id="417" class="l"><a class="l" href="#417">417: </a> } |
</span><span id="418" class="l"><a class="l" href="#418">418: </a> |
</span><span id="419" class="l"><a class="l" href="#419">419: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->fragment !== <span class="php-keyword1">false</span>) { |
</span><span id="420" class="l"><a class="l" href="#420">420: </a> <span class="php-var">$url</span> .= <span class="php-quote">'#'</span> . <span class="php-var">$this</span>->fragment; |
</span><span id="421" class="l"><a class="l" href="#421">421: </a> } |
</span><span id="422" class="l"><a class="l" href="#422">422: </a> |
</span><span id="423" class="l"><a class="l" href="#423">423: </a> <span class="php-keyword1">return</span> <span class="php-var">$url</span>; |
</span><span id="424" class="l"><a class="l" href="#424">424: </a> } |
</span><span id="425" class="l"><a class="l" href="#425">425: </a>} |
</span><span id="426" class="l"><a class="l" href="#426">426: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Script.html |
---|
New file |
0,0 → 1,409 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/Script.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li class="active"><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Script.html" title="Summary of Script"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Script est une classe abstraite qui doit être implémenté par les classes éxecutant des scripts en ligne de commande. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @package Framework |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @author Delphine CAUQUIL <delphine@tela-botanica.org> |
</span></span><span id="10" class="l"><a class="l" href="#10"> 10: </a><span class="php-comment"> * @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="11" class="l"><a class="l" href="#11"> 11: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="12" class="l"><a class="l" href="#12"> 12: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="13" class="l"><a class="l" href="#13"> 13: </a><span class="php-comment"> * @since 0.3 |
</span></span><span id="14" class="l"><a class="l" href="#14"> 14: </a><span class="php-comment"> * @version $Id: Script.php 299 2011-01-18 14:03:46Z jpm $ |
</span></span><span id="15" class="l"><a class="l" href="#15"> 15: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="16" class="l"><a class="l" href="#16"> 16: </a><span class="php-comment"> */</span> |
</span><span id="17" class="l"><a class="l" href="#17"> 17: </a> |
</span><span id="18" class="l"><a class="l" href="#18"> 18: </a><span class="php-keyword1">abstract</span> <span class="php-keyword1">class</span> <a id="Script" href="#Script">Script</a> { |
</span><span id="19" class="l"><a class="l" href="#19"> 19: </a> <span class="php-comment">/** Niveau de message de type LOG */</span> |
</span><span id="20" class="l"><a class="l" href="#20"> 20: </a> <span class="php-keyword1">const</span> <a id="MSG_LOG" href="#MSG_LOG">MSG_LOG</a> = <span class="php-num">0</span>; |
</span><span id="21" class="l"><a class="l" href="#21"> 21: </a> <span class="php-comment">/** Niveau de message de type ERREUR */</span> |
</span><span id="22" class="l"><a class="l" href="#22"> 22: </a> <span class="php-keyword1">const</span> <a id="MSG_ERREUR" href="#MSG_ERREUR">MSG_ERREUR</a> = <span class="php-num">1</span>; |
</span><span id="23" class="l"><a class="l" href="#23"> 23: </a> <span class="php-comment">/** Niveau de message de type AVERTISSEMENT */</span> |
</span><span id="24" class="l"><a class="l" href="#24"> 24: </a> <span class="php-keyword1">const</span> <a id="MSG_AVERTISSEMENT" href="#MSG_AVERTISSEMENT">MSG_AVERTISSEMENT</a> = <span class="php-num">2</span>; |
</span><span id="25" class="l"><a class="l" href="#25"> 25: </a> <span class="php-comment">/** Niveau de message de type INFORMATION */</span> |
</span><span id="26" class="l"><a class="l" href="#26"> 26: </a> <span class="php-keyword1">const</span> <a id="MSG_INFO" href="#MSG_INFO">MSG_INFO</a> = <span class="php-num">3</span>; |
</span><span id="27" class="l"><a class="l" href="#27"> 27: </a> |
</span><span id="28" class="l"><a class="l" href="#28"> 28: </a> <span class="php-comment">/** Inititulé des différents types de message. */</span> |
</span><span id="29" class="l"><a class="l" href="#29"> 29: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$msg_niveaux_txt" href="#$msg_niveaux_txt">$msg_niveaux_txt</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'LOG'</span>, <span class="php-quote">'ERREUR'</span>,<span class="php-quote">'AVERTISSEMENT'</span>, <span class="php-quote">'INFO'</span>); |
</span><span id="30" class="l"><a class="l" href="#30"> 30: </a> |
</span><span id="31" class="l"><a class="l" href="#31"> 31: </a> <span class="php-comment">/** |
</span></span><span id="32" class="l"><a class="l" href="#32"> 32: </a><span class="php-comment"> * Le nom du script tel que passé dans la ligne de commande. |
</span></span><span id="33" class="l"><a class="l" href="#33"> 33: </a><span class="php-comment"> * @var string |
</span></span><span id="34" class="l"><a class="l" href="#34"> 34: </a><span class="php-comment"> */</span> |
</span><span id="35" class="l"><a class="l" href="#35"> 35: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$script_nom" href="#$script_nom">$script_nom</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="36" class="l"><a class="l" href="#36"> 36: </a> |
</span><span id="37" class="l"><a class="l" href="#37"> 37: </a> <span class="php-comment">/** |
</span></span><span id="38" class="l"><a class="l" href="#38"> 38: </a><span class="php-comment"> * Paramêtres par défaut disponibles pour la ligne de commande |
</span></span><span id="39" class="l"><a class="l" href="#39"> 39: </a><span class="php-comment"> * le tableau se construit de la forme suivante : |
</span></span><span id="40" class="l"><a class="l" href="#40"> 40: </a><span class="php-comment"> * - clé = nom du paramêtre '-foo' |
</span></span><span id="41" class="l"><a class="l" href="#41"> 41: </a><span class="php-comment"> * - value = contient un nouveau tableau composé de cette façon : |
</span></span><span id="42" class="l"><a class="l" href="#42"> 42: </a><span class="php-comment"> * - booléen: true si le paramêtre est obligatoire |
</span></span><span id="43" class="l"><a class="l" href="#43"> 43: </a><span class="php-comment"> * - booléen ou var : true si le paramêtre nécessite un valeur à sa suite ou la valeur par défaut |
</span></span><span id="44" class="l"><a class="l" href="#44"> 44: </a><span class="php-comment"> * - string: description du contenu du paramêtre |
</span></span><span id="45" class="l"><a class="l" href="#45"> 45: </a><span class="php-comment"> * Les paramêtres optionels devraient être déclaré à la fin du tableau. |
</span></span><span id="46" class="l"><a class="l" href="#46"> 46: </a><span class="php-comment"> * Le dernier parametre du tableau peut avoir la valeur '...', |
</span></span><span id="47" class="l"><a class="l" href="#47"> 47: </a><span class="php-comment"> * il contiendra alors l'ensemble des paramêtres suivant trouvés sur la ligne de commande. |
</span></span><span id="48" class="l"><a class="l" href="#48"> 48: </a><span class="php-comment"> * @var array |
</span></span><span id="49" class="l"><a class="l" href="#49"> 49: </a><span class="php-comment"> */</span> |
</span><span id="50" class="l"><a class="l" href="#50"> 50: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$parametres_autorises_defaut" href="#$parametres_autorises_defaut">$parametres_autorises_defaut</a></span> = <span class="php-keyword1">array</span>( |
</span><span id="51" class="l"><a class="l" href="#51"> 51: </a> <span class="php-quote">'-a'</span> => <span class="php-keyword1">array</span>(<span class="php-keyword1">true</span>, <span class="php-keyword1">true</span>, <span class="php-quote">'Action à réaliser'</span>), |
</span><span id="52" class="l"><a class="l" href="#52"> 52: </a> <span class="php-quote">'-v'</span> => <span class="php-keyword1">array</span>(<span class="php-keyword1">false</span>, <span class="php-quote">'1'</span>, <span class="php-quote">'Mode verbeux : 1 ou 2'</span>)); |
</span><span id="53" class="l"><a class="l" href="#53"> 53: </a> |
</span><span id="54" class="l"><a class="l" href="#54"> 54: </a> <span class="php-comment">/** |
</span></span><span id="55" class="l"><a class="l" href="#55"> 55: </a><span class="php-comment"> * Paramêtres autorisés par le script. |
</span></span><span id="56" class="l"><a class="l" href="#56"> 56: </a><span class="php-comment"> * le tableau est de la forme suivante : |
</span></span><span id="57" class="l"><a class="l" href="#57"> 57: </a><span class="php-comment"> * - clé = nom du paramêtre '-foo' |
</span></span><span id="58" class="l"><a class="l" href="#58"> 58: </a><span class="php-comment"> * - value = contient un nouveau tableau composé de cette façon : |
</span></span><span id="59" class="l"><a class="l" href="#59"> 59: </a><span class="php-comment"> * - booléen: true si le paramêtre est obligatoire |
</span></span><span id="60" class="l"><a class="l" href="#60"> 60: </a><span class="php-comment"> * - booléen ou var : true si le paramêtre nécessite un valeur à sa suite ou la valeur par défaut |
</span></span><span id="61" class="l"><a class="l" href="#61"> 61: </a><span class="php-comment"> * - string: description du contenu du paramêtre |
</span></span><span id="62" class="l"><a class="l" href="#62"> 62: </a><span class="php-comment"> * Les paramêtres optionels devraient être déclaré à la fin du tableau. |
</span></span><span id="63" class="l"><a class="l" href="#63"> 63: </a><span class="php-comment"> * Le dernier parametre du tableau peut avoir la valeur '...', |
</span></span><span id="64" class="l"><a class="l" href="#64"> 64: </a><span class="php-comment"> * il contiendra alors l'ensemble des paramêtres suivant trouvés sur la ligne de commande. |
</span></span><span id="65" class="l"><a class="l" href="#65"> 65: </a><span class="php-comment"> * @var array |
</span></span><span id="66" class="l"><a class="l" href="#66"> 66: </a><span class="php-comment"> */</span> |
</span><span id="67" class="l"><a class="l" href="#67"> 67: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$parametres_autorises" href="#$parametres_autorises">$parametres_autorises</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="68" class="l"><a class="l" href="#68"> 68: </a> |
</span><span id="69" class="l"><a class="l" href="#69"> 69: </a> <span class="php-comment">/** |
</span></span><span id="70" class="l"><a class="l" href="#70"> 70: </a><span class="php-comment"> * Contient les valeurs des paramêtres récupérés de la ligne de commande : |
</span></span><span id="71" class="l"><a class="l" href="#71"> 71: </a><span class="php-comment"> * le tableau se construit de la forme suivnate : |
</span></span><span id="72" class="l"><a class="l" href="#72"> 72: </a><span class="php-comment"> * - clé = nom du paramêtre '-foo' |
</span></span><span id="73" class="l"><a class="l" href="#73"> 73: </a><span class="php-comment"> * - valeur = la valeur récupérée sur la ligne de commande |
</span></span><span id="74" class="l"><a class="l" href="#74"> 74: </a><span class="php-comment"> * @var array |
</span></span><span id="75" class="l"><a class="l" href="#75"> 75: </a><span class="php-comment"> */</span> |
</span><span id="76" class="l"><a class="l" href="#76"> 76: </a> <span class="php-keyword1">private</span> <span class="php-var"><a id="$parametres_cli" href="#$parametres_cli">$parametres_cli</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="77" class="l"><a class="l" href="#77"> 77: </a> |
</span><span id="78" class="l"><a class="l" href="#78"> 78: </a> <span class="php-comment">/** |
</span></span><span id="79" class="l"><a class="l" href="#79"> 79: </a><span class="php-comment"> * Contient le tableau des paramètres disponible après vérification : |
</span></span><span id="80" class="l"><a class="l" href="#80"> 80: </a><span class="php-comment"> * le tableau est de la forme suivante : |
</span></span><span id="81" class="l"><a class="l" href="#81"> 81: </a><span class="php-comment"> * - clé = nom du paramêtre '-foo' |
</span></span><span id="82" class="l"><a class="l" href="#82"> 82: </a><span class="php-comment"> * - valeur = la valeur récupérée sur la ligne de commande |
</span></span><span id="83" class="l"><a class="l" href="#83"> 83: </a><span class="php-comment"> * @var array |
</span></span><span id="84" class="l"><a class="l" href="#84"> 84: </a><span class="php-comment"> */</span> |
</span><span id="85" class="l"><a class="l" href="#85"> 85: </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$parametres" href="#$parametres">$parametres</a></span> = <span class="php-keyword1">null</span>; |
</span><span id="86" class="l"><a class="l" href="#86"> 86: </a> |
</span><span id="87" class="l"><a class="l" href="#87"> 87: </a> <span class="php-comment">/** Tableau associatif permettant de stocker l'avancement dans une boucle. |
</span></span><span id="88" class="l"><a class="l" href="#88"> 88: </a><span class="php-comment"> * La clé est un md5 du message à afficher au démarrage de la boucle. |
</span></span><span id="89" class="l"><a class="l" href="#89"> 89: </a><span class="php-comment"> * @var array |
</span></span><span id="90" class="l"><a class="l" href="#90"> 90: </a><span class="php-comment"> */</span> |
</span><span id="91" class="l"><a class="l" href="#91"> 91: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$avancement" href="#$avancement">$avancement</a></span> = <span class="php-keyword1">array</span>(); |
</span><span id="92" class="l"><a class="l" href="#92"> 92: </a> |
</span><span id="93" class="l"><a class="l" href="#93"> 93: </a> <span class="php-comment">/** Tableau des noms des paramètres à définir dans le fichier de config car obligatoirement nécessaire à cette classe.*/</span> |
</span><span id="94" class="l"><a class="l" href="#94"> 94: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var"><a id="$parametres_obligatoires" href="#$parametres_obligatoires">$parametres_obligatoires</a></span> = <span class="php-keyword1">array</span>(<span class="php-quote">'chemin_modules'</span>, <span class="php-quote">'log_script'</span>); |
</span><span id="95" class="l"><a class="l" href="#95"> 95: </a> |
</span><span id="96" class="l"><a class="l" href="#96"> 96: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>(<span class="php-var">$script_nom</span>, <span class="php-var">$parametres_cli</span>) { |
</span><span id="97" class="l"><a class="l" href="#97"> 97: </a> <span class="php-var">$this</span>->script_nom = <span class="php-var">$script_nom</span>; |
</span><span id="98" class="l"><a class="l" href="#98"> 98: </a> <span class="php-var">$this</span>->parametres_cli = <span class="php-var">$parametres_cli</span>; |
</span><span id="99" class="l"><a class="l" href="#99"> 99: </a> |
</span><span id="100" class="l"><a class="l" href="#100">100: </a> Config::verifierPresenceParametres(self::<span class="php-var">$parametres_obligatoires</span>); |
</span><span id="101" class="l"><a class="l" href="#101">101: </a> |
</span><span id="102" class="l"><a class="l" href="#102">102: </a> <span class="php-var">$fichier_ini_script</span> = <span class="php-var">$this</span>->getScriptChemin().<span class="php-quote">'config.ini'</span>; |
</span><span id="103" class="l"><a class="l" href="#103">103: </a> Config::charger(<span class="php-var">$fichier_ini_script</span>); |
</span><span id="104" class="l"><a class="l" href="#104">104: </a> |
</span><span id="105" class="l"><a class="l" href="#105">105: </a> <span class="php-var">$this</span>->chargerParametresAutorises(); |
</span><span id="106" class="l"><a class="l" href="#106">106: </a> <span class="php-var">$this</span>->chargerParametres(); |
</span><span id="107" class="l"><a class="l" href="#107">107: </a> } |
</span><span id="108" class="l"><a class="l" href="#108">108: </a> |
</span><span id="109" class="l"><a class="l" href="#109">109: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_getMsgNiveauTxt" href="#_getMsgNiveauTxt">getMsgNiveauTxt</a>(<span class="php-var">$niveau</span>) { |
</span><span id="110" class="l"><a class="l" href="#110">110: </a> <span class="php-keyword1">return</span> self::<span class="php-var">$msg_niveaux_txt</span>[<span class="php-var">$niveau</span>]; |
</span><span id="111" class="l"><a class="l" href="#111">111: </a> } |
</span><span id="112" class="l"><a class="l" href="#112">112: </a> |
</span><span id="113" class="l"><a class="l" href="#113">113: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getScriptNom" href="#_getScriptNom">getScriptNom</a>() { |
</span><span id="114" class="l"><a class="l" href="#114">114: </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->script_nom; |
</span><span id="115" class="l"><a class="l" href="#115">115: </a> } |
</span><span id="116" class="l"><a class="l" href="#116">116: </a> |
</span><span id="117" class="l"><a class="l" href="#117">117: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getScriptChemin" href="#_getScriptChemin">getScriptChemin</a>(<span class="php-var">$doit_exister</span> = <span class="php-keyword1">true</span>) { |
</span><span id="118" class="l"><a class="l" href="#118">118: </a> <span class="php-var">$chemin</span> = Config::get(<span class="php-quote">'chemin_modules'</span>).<span class="php-var">$this</span>->getScriptNom().DS; |
</span><span id="119" class="l"><a class="l" href="#119">119: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">file_exists</span>(<span class="php-var">$chemin</span>) && <span class="php-var">$doit_exister</span>) { |
</span><span id="120" class="l"><a class="l" href="#120">120: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Erreur: le module '"</span>.<span class="php-var">$this</span>->getScriptNom().<span class="php-quote">"' n'existe pas (</span><span class="php-var">$chemin</span><span class="php-quote">)\n"</span>, E_USER_ERROR); |
</span><span id="121" class="l"><a class="l" href="#121">121: </a> } |
</span><span id="122" class="l"><a class="l" href="#122">122: </a> <span class="php-keyword1">return</span> <span class="php-var">$chemin</span>; |
</span><span id="123" class="l"><a class="l" href="#123">123: </a> } |
</span><span id="124" class="l"><a class="l" href="#124">124: </a> |
</span><span id="125" class="l"><a class="l" href="#125">125: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_getParametre" href="#_getParametre">getParametre</a>(<span class="php-var">$parametre</span>) { |
</span><span id="126" class="l"><a class="l" href="#126">126: </a> <span class="php-var">$retour</span> = <span class="php-keyword1">false</span>; |
</span><span id="127" class="l"><a class="l" href="#127">127: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_null</span>(<span class="php-var">$parametre</span>)) { |
</span><span id="128" class="l"><a class="l" href="#128">128: </a> <span class="php-var">$parametre</span> = <span class="php-keyword2">ltrim</span>(<span class="php-var">$parametre</span>, <span class="php-quote">'-'</span>); |
</span><span id="129" class="l"><a class="l" href="#129">129: </a> |
</span><span id="130" class="l"><a class="l" href="#130">130: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->parametres[<span class="php-var">$parametre</span>])) { |
</span><span id="131" class="l"><a class="l" href="#131">131: </a> <span class="php-var">$retour</span> = <span class="php-var">$this</span>->parametres[<span class="php-var">$parametre</span>]; |
</span><span id="132" class="l"><a class="l" href="#132">132: </a> } <span class="php-keyword1">else</span> { |
</span><span id="133" class="l"><a class="l" href="#133">133: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Erreur: la ligne de commande ne contenait pas le paramêtre '</span><span class="php-var">$parametre</span><span class="php-quote">'\n"</span>, E_USER_WARNING); |
</span><span id="134" class="l"><a class="l" href="#134">134: </a> } |
</span><span id="135" class="l"><a class="l" href="#135">135: </a> } |
</span><span id="136" class="l"><a class="l" href="#136">136: </a> <span class="php-keyword1">return</span> <span class="php-var">$retour</span>; |
</span><span id="137" class="l"><a class="l" href="#137">137: </a> } |
</span><span id="138" class="l"><a class="l" href="#138">138: </a> |
</span><span id="139" class="l"><a class="l" href="#139">139: </a> <span class="php-keyword1">abstract</span> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_executer" href="#_executer">executer</a>(); |
</span><span id="140" class="l"><a class="l" href="#140">140: </a> |
</span><span id="141" class="l"><a class="l" href="#141">141: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_chargerParametresAutorises" href="#_chargerParametresAutorises">chargerParametresAutorises</a>() { |
</span><span id="142" class="l"><a class="l" href="#142">142: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>->parametres_autorises_defaut <span class="php-keyword1">as</span> <span class="php-var">$c</span> => <span class="php-var">$v</span>) { |
</span><span id="143" class="l"><a class="l" href="#143">143: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->parametres_autorises[<span class="php-var">$c</span>])) { |
</span><span id="144" class="l"><a class="l" href="#144">144: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Erreur: le script '"</span>.<span class="php-var">$this</span>->getScriptNom().<span class="php-quote">"' ne peut définir le paramêtre '</span><span class="php-var">$c</span><span class="php-quote">' car il existe déjà\n"</span>, E_USER_ERROR); |
</span><span id="145" class="l"><a class="l" href="#145">145: </a> } <span class="php-keyword1">else</span> { |
</span><span id="146" class="l"><a class="l" href="#146">146: </a> <span class="php-var">$this</span>->parametres_autorises[<span class="php-var">$c</span>] = <span class="php-var">$v</span>; |
</span><span id="147" class="l"><a class="l" href="#147">147: </a> } |
</span><span id="148" class="l"><a class="l" href="#148">148: </a> } |
</span><span id="149" class="l"><a class="l" href="#149">149: </a> } |
</span><span id="150" class="l"><a class="l" href="#150">150: </a> |
</span><span id="151" class="l"><a class="l" href="#151">151: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_chargerParametres" href="#_chargerParametres">chargerParametres</a>() { |
</span><span id="152" class="l"><a class="l" href="#152">152: </a> <span class="php-var">$parametres_cli</span> = <span class="php-var">$this</span>->parametres_cli; |
</span><span id="153" class="l"><a class="l" href="#153">153: </a> |
</span><span id="154" class="l"><a class="l" href="#154">154: </a> <span class="php-comment">// Récupération des paramêtresgetMsgNiveauTxt</span> |
</span><span id="155" class="l"><a class="l" href="#155">155: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>->parametres_autorises <span class="php-keyword1">as</span> <span class="php-var">$p_nom</span> => <span class="php-var">$p_val</span>) { |
</span><span id="156" class="l"><a class="l" href="#156">156: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$parametres_cli</span>) == <span class="php-num">0</span>) { |
</span><span id="157" class="l"><a class="l" href="#157">157: </a> <span class="php-keyword1">if</span> (<span class="php-var">$p_val</span>[<span class="php-num">0</span>]) { |
</span><span id="158" class="l"><a class="l" href="#158">158: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Erreur: paramêtre manquant '"</span>.<span class="php-var">$p_nom</span>.<span class="php-quote">"' \n"</span>, E_USER_WARNING); |
</span><span id="159" class="l"><a class="l" href="#159">159: </a> } |
</span><span id="160" class="l"><a class="l" href="#160">160: </a> } |
</span><span id="161" class="l"><a class="l" href="#161">161: </a> <span class="php-keyword1">if</span> (<span class="php-var">$p_nom</span> == <span class="php-quote">'...'</span>) { |
</span><span id="162" class="l"><a class="l" href="#162">162: </a> <span class="php-var">$this</span>->parametres[<span class="php-quote">'...'</span>] = <span class="php-keyword1">array</span>(); |
</span><span id="163" class="l"><a class="l" href="#163">163: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$parametres_cli</span> <span class="php-keyword1">as</span> <span class="php-var">$arg</span>) { |
</span><span id="164" class="l"><a class="l" href="#164">164: </a> <span class="php-var">$this</span>->parametres[<span class="php-quote">'...'</span>][] = <span class="php-var">$arg</span>; |
</span><span id="165" class="l"><a class="l" href="#165">165: </a> } |
</span><span id="166" class="l"><a class="l" href="#166">166: </a> <span class="php-var">$parametres_cli</span> = <span class="php-keyword1">array</span>(); |
</span><span id="167" class="l"><a class="l" href="#167">167: </a> <span class="php-keyword1">break</span>; |
</span><span id="168" class="l"><a class="l" href="#168">168: </a> } <span class="php-keyword1">else</span> { |
</span><span id="169" class="l"><a class="l" href="#169">169: </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$parametres_cli</span>[<span class="php-var">$p_nom</span>])) { |
</span><span id="170" class="l"><a class="l" href="#170">170: </a> <span class="php-comment">// Attribution de la valeur issue de la ligne de commande</span> |
</span><span id="171" class="l"><a class="l" href="#171">171: </a> <span class="php-var">$this</span>->parametres[<span class="php-keyword2">ltrim</span>(<span class="php-var">$p_nom</span>, <span class="php-quote">'-'</span>)] = <span class="php-var">$parametres_cli</span>[<span class="php-var">$p_nom</span>]; |
</span><span id="172" class="l"><a class="l" href="#172">172: </a> <span class="php-keyword1">unset</span>(<span class="php-var">$parametres_cli</span>[<span class="php-var">$p_nom</span>]); |
</span><span id="173" class="l"><a class="l" href="#173">173: </a> } <span class="php-keyword1">else</span> { |
</span><span id="174" class="l"><a class="l" href="#174">174: </a> <span class="php-comment">// Attribution de la valeur par défaut</span> |
</span><span id="175" class="l"><a class="l" href="#175">175: </a> <span class="php-keyword1">if</span> (<span class="php-var">$p_val</span>[<span class="php-num">1</span>] !== <span class="php-keyword1">true</span>) { |
</span><span id="176" class="l"><a class="l" href="#176">176: </a> <span class="php-var">$this</span>->parametres[<span class="php-keyword2">ltrim</span>(<span class="php-var">$p_nom</span>, <span class="php-quote">'-'</span>)] = <span class="php-var">$p_val</span>[<span class="php-num">1</span>]; |
</span><span id="177" class="l"><a class="l" href="#177">177: </a> <span class="php-keyword1">unset</span>(<span class="php-var">$parametres_cli</span>[<span class="php-var">$p_nom</span>]); |
</span><span id="178" class="l"><a class="l" href="#178">178: </a> } |
</span><span id="179" class="l"><a class="l" href="#179">179: </a> } |
</span><span id="180" class="l"><a class="l" href="#180">180: </a> } |
</span><span id="181" class="l"><a class="l" href="#181">181: </a> } |
</span><span id="182" class="l"><a class="l" href="#182">182: </a> |
</span><span id="183" class="l"><a class="l" href="#183">183: </a> <span class="php-comment">// Gestion de l'excédant de paramêtres</span> |
</span><span id="184" class="l"><a class="l" href="#184">184: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$parametres_cli</span>)) { |
</span><span id="185" class="l"><a class="l" href="#185">185: </a> <span class="php-keyword2">trigger_error</span>(<span class="php-quote">"Erreur: trop de paramêtres\n"</span>, E_USER_ERROR); |
</span><span id="186" class="l"><a class="l" href="#186">186: </a> } |
</span><span id="187" class="l"><a class="l" href="#187">187: </a> } |
</span><span id="188" class="l"><a class="l" href="#188">188: </a> |
</span><span id="189" class="l"><a class="l" href="#189">189: </a> <span class="php-comment">/** |
</span></span><span id="190" class="l"><a class="l" href="#190">190: </a><span class="php-comment"> * Affiche un message d'erreur formaté. |
</span></span><span id="191" class="l"><a class="l" href="#191">191: </a><span class="php-comment"> * Si le paramétre de verbosité (-v) vaut 1 ou plus, le message est écrit dans le fichier de log et afficher dans la console. |
</span></span><span id="192" class="l"><a class="l" href="#192">192: </a><span class="php-comment"> * |
</span></span><span id="193" class="l"><a class="l" href="#193">193: </a><span class="php-comment"> * @param string le message d'erreur avec des %s. |
</span></span><span id="194" class="l"><a class="l" href="#194">194: </a><span class="php-comment"> * @param array le tableau des paramêtres à insérer dans le message d'erreur. |
</span></span><span id="195" class="l"><a class="l" href="#195">195: </a><span class="php-comment"> * @return void. |
</span></span><span id="196" class="l"><a class="l" href="#196">196: </a><span class="php-comment"> */</span> |
</span><span id="197" class="l"><a class="l" href="#197">197: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_traiterErreur" href="#_traiterErreur">traiterErreur</a>(<span class="php-var">$message</span>, <span class="php-var">$tab_arguments</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="198" class="l"><a class="l" href="#198">198: </a> <span class="php-var">$this</span>->traiterMessage(<span class="php-var">$message</span>, <span class="php-var">$tab_arguments</span>, self::MSG_ERREUR); |
</span><span id="199" class="l"><a class="l" href="#199">199: </a> } |
</span><span id="200" class="l"><a class="l" href="#200">200: </a> |
</span><span id="201" class="l"><a class="l" href="#201">201: </a> <span class="php-comment">/** |
</span></span><span id="202" class="l"><a class="l" href="#202">202: </a><span class="php-comment"> * Affiche un message d'avertissement formaté. |
</span></span><span id="203" class="l"><a class="l" href="#203">203: </a><span class="php-comment"> * Si le paramétre de verbosité (-v) vaut 1, le message est écrit dans le fichier de log. |
</span></span><span id="204" class="l"><a class="l" href="#204">204: </a><span class="php-comment"> * Si le paramétre de verbosité (-v) vaut 2 ou plus, le message est écrit dans le fichier de log et afficher dans la console. |
</span></span><span id="205" class="l"><a class="l" href="#205">205: </a><span class="php-comment"> * |
</span></span><span id="206" class="l"><a class="l" href="#206">206: </a><span class="php-comment"> * @param string le message d'erreur avec des %s. |
</span></span><span id="207" class="l"><a class="l" href="#207">207: </a><span class="php-comment"> * @param array le tableau des paramêtres à insérer dans le message d'erreur. |
</span></span><span id="208" class="l"><a class="l" href="#208">208: </a><span class="php-comment"> * @return void. |
</span></span><span id="209" class="l"><a class="l" href="#209">209: </a><span class="php-comment"> */</span> |
</span><span id="210" class="l"><a class="l" href="#210">210: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_traiterAvertissement" href="#_traiterAvertissement">traiterAvertissement</a>(<span class="php-var">$message</span>, <span class="php-var">$tab_arguments</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="211" class="l"><a class="l" href="#211">211: </a> <span class="php-var">$this</span>->traiterMessage(<span class="php-var">$message</span>, <span class="php-var">$tab_arguments</span>, self::MSG_AVERTISSEMENT); |
</span><span id="212" class="l"><a class="l" href="#212">212: </a> } |
</span><span id="213" class="l"><a class="l" href="#213">213: </a> |
</span><span id="214" class="l"><a class="l" href="#214">214: </a> <span class="php-comment">/** |
</span></span><span id="215" class="l"><a class="l" href="#215">215: </a><span class="php-comment"> * Retourne un message d'information formaté. |
</span></span><span id="216" class="l"><a class="l" href="#216">216: </a><span class="php-comment"> * Si le paramétre de verbosité (-v) vaut 1 ou 2 , le message est écrit dans le fichier de log. |
</span></span><span id="217" class="l"><a class="l" href="#217">217: </a><span class="php-comment"> * Si le paramétre de verbosité (-v) vaut 3 ou plus, le message est écrit dans le fichier de log et afficher dans la console. |
</span></span><span id="218" class="l"><a class="l" href="#218">218: </a><span class="php-comment"> * |
</span></span><span id="219" class="l"><a class="l" href="#219">219: </a><span class="php-comment"> * @param string le message d'information avec des %s. |
</span></span><span id="220" class="l"><a class="l" href="#220">220: </a><span class="php-comment"> * @param array le tableau des paramêtres à insérer dans le message d'erreur. |
</span></span><span id="221" class="l"><a class="l" href="#221">221: </a><span class="php-comment"> * @return void. |
</span></span><span id="222" class="l"><a class="l" href="#222">222: </a><span class="php-comment"> */</span> |
</span><span id="223" class="l"><a class="l" href="#223">223: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_traiterInfo" href="#_traiterInfo">traiterInfo</a>(<span class="php-var">$message</span>, <span class="php-var">$tab_arguments</span> = <span class="php-keyword1">array</span>()) { |
</span><span id="224" class="l"><a class="l" href="#224">224: </a> <span class="php-var">$this</span>->traiterMessage(<span class="php-var">$message</span>, <span class="php-var">$tab_arguments</span>, self::MSG_INFO); |
</span><span id="225" class="l"><a class="l" href="#225">225: </a> } |
</span><span id="226" class="l"><a class="l" href="#226">226: </a> |
</span><span id="227" class="l"><a class="l" href="#227">227: </a> <span class="php-comment">/** |
</span></span><span id="228" class="l"><a class="l" href="#228">228: </a><span class="php-comment"> * Retourne un message formaté en le stockant dans un fichier de log si nécessaire. |
</span></span><span id="229" class="l"><a class="l" href="#229">229: </a><span class="php-comment"> * |
</span></span><span id="230" class="l"><a class="l" href="#230">230: </a><span class="php-comment"> * @param string le message d'erreur avec des %s. |
</span></span><span id="231" class="l"><a class="l" href="#231">231: </a><span class="php-comment"> * @param array le tableau des paramêtres à insérer dans le message d'erreur. |
</span></span><span id="232" class="l"><a class="l" href="#232">232: </a><span class="php-comment"> * @param int le niveau de verbosité à dépasser pour afficher les messages. |
</span></span><span id="233" class="l"><a class="l" href="#233">233: </a><span class="php-comment"> * @return void. |
</span></span><span id="234" class="l"><a class="l" href="#234">234: </a><span class="php-comment"> */</span> |
</span><span id="235" class="l"><a class="l" href="#235">235: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> <a id="_traiterMessage" href="#_traiterMessage">traiterMessage</a>(<span class="php-var">$message</span>, <span class="php-var">$tab_arguments</span>, <span class="php-var">$niveau</span> = self::MSG_LOG) { |
</span><span id="236" class="l"><a class="l" href="#236">236: </a> <span class="php-var">$log</span> = <span class="php-var">$this</span>->formaterMsg(<span class="php-var">$message</span>, <span class="php-var">$tab_arguments</span>, <span class="php-var">$niveau</span>); |
</span><span id="237" class="l"><a class="l" href="#237">237: </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>->getParametre(<span class="php-quote">'v'</span>) > (<span class="php-var">$niveau</span> - <span class="php-num">1</span>)) { |
</span><span id="238" class="l"><a class="l" href="#238">238: </a> <span class="php-keyword1">echo</span> <span class="php-var">$log</span>; |
</span><span id="239" class="l"><a class="l" href="#239">239: </a> <span class="php-keyword1">if</span> (Config::get(<span class="php-quote">'log_script'</span>)) { |
</span><span id="240" class="l"><a class="l" href="#240">240: </a> <span class="php-comment">// TODO : lancer le log</span> |
</span><span id="241" class="l"><a class="l" href="#241">241: </a> } |
</span><span id="242" class="l"><a class="l" href="#242">242: </a> } |
</span><span id="243" class="l"><a class="l" href="#243">243: </a> } |
</span><span id="244" class="l"><a class="l" href="#244">244: </a> |
</span><span id="245" class="l"><a class="l" href="#245">245: </a> <span class="php-comment">/** |
</span></span><span id="246" class="l"><a class="l" href="#246">246: </a><span class="php-comment"> * Retourne un message d'information formaté. |
</span></span><span id="247" class="l"><a class="l" href="#247">247: </a><span class="php-comment"> * |
</span></span><span id="248" class="l"><a class="l" href="#248">248: </a><span class="php-comment"> * @param string le message d'information avec des %s. |
</span></span><span id="249" class="l"><a class="l" href="#249">249: </a><span class="php-comment"> * @param array le tableau des paramêtres à insérer dans le message d'erreur. |
</span></span><span id="250" class="l"><a class="l" href="#250">250: </a><span class="php-comment"> * @return string le message d'erreur formaté. |
</span></span><span id="251" class="l"><a class="l" href="#251">251: </a><span class="php-comment"> */</span> |
</span><span id="252" class="l"><a class="l" href="#252">252: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_formaterMsg" href="#_formaterMsg">formaterMsg</a>(<span class="php-var">$message</span>, <span class="php-var">$tab_arguments</span> = <span class="php-keyword1">array</span>(), <span class="php-var">$niveau</span> = <span class="php-keyword1">null</span>) { |
</span><span id="253" class="l"><a class="l" href="#253">253: </a> <span class="php-var">$texte</span> = <span class="php-keyword2">vsprintf</span>(<span class="php-var">$message</span>, <span class="php-var">$tab_arguments</span>); |
</span><span id="254" class="l"><a class="l" href="#254">254: </a> <span class="php-var">$prefixe</span> = <span class="php-keyword2">date</span>(<span class="php-quote">'Y-m-j_H:i:s'</span>, <span class="php-keyword2">time</span>()); |
</span><span id="255" class="l"><a class="l" href="#255">255: </a> <span class="php-var">$prefixe</span> .= <span class="php-keyword2">is_null</span>(<span class="php-var">$niveau</span>) ? <span class="php-quote">' : '</span> : <span class="php-quote">' - '</span>.self::getMsgNiveauTxt(<span class="php-var">$niveau</span>).<span class="php-quote">' : '</span>; |
</span><span id="256" class="l"><a class="l" href="#256">256: </a> <span class="php-var">$log</span> = <span class="php-var">$prefixe</span>.<span class="php-var">$texte</span>.<span class="php-quote">"\n"</span>; |
</span><span id="257" class="l"><a class="l" href="#257">257: </a> <span class="php-keyword1">return</span> <span class="php-var">$log</span>; |
</span><span id="258" class="l"><a class="l" href="#258">258: </a> } |
</span><span id="259" class="l"><a class="l" href="#259">259: </a> |
</span><span id="260" class="l"><a class="l" href="#260">260: </a> <span class="php-comment">/** |
</span></span><span id="261" class="l"><a class="l" href="#261">261: </a><span class="php-comment"> * Utiliser cette méthode dans une boucle pour afficher un message suivi du nombre de tour de boucle effectué. |
</span></span><span id="262" class="l"><a class="l" href="#262">262: </a><span class="php-comment"> * Vous devrez vous même gérer le retour à la ligne à la sortie de la boucle. |
</span></span><span id="263" class="l"><a class="l" href="#263">263: </a><span class="php-comment"> * |
</span></span><span id="264" class="l"><a class="l" href="#264">264: </a><span class="php-comment"> * @param string le message d'information. |
</span></span><span id="265" class="l"><a class="l" href="#265">265: </a><span class="php-comment"> * @param int le nombre de départ à afficher. |
</span></span><span id="266" class="l"><a class="l" href="#266">266: </a><span class="php-comment"> * @return void le message est affiché dans la console. |
</span></span><span id="267" class="l"><a class="l" href="#267">267: </a><span class="php-comment"> */</span> |
</span><span id="268" class="l"><a class="l" href="#268">268: </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_afficherAvancement" href="#_afficherAvancement">afficherAvancement</a>(<span class="php-var">$message</span>, <span class="php-var">$depart</span> = <span class="php-num">0</span>) { |
</span><span id="269" class="l"><a class="l" href="#269">269: </a> <span class="php-keyword1">if</span> (! <span class="php-keyword1">isset</span>(self::<span class="php-var">$avancement</span>[<span class="php-var">$message</span>])) { |
</span><span id="270" class="l"><a class="l" href="#270">270: </a> self::<span class="php-var">$avancement</span>[<span class="php-var">$message</span>] = <span class="php-var">$depart</span>; |
</span><span id="271" class="l"><a class="l" href="#271">271: </a> <span class="php-keyword1">echo</span> <span class="php-quote">"</span><span class="php-var">$message</span><span class="php-quote"> : "</span>; |
</span><span id="272" class="l"><a class="l" href="#272">272: </a> |
</span><span id="273" class="l"><a class="l" href="#273">273: </a> <span class="php-var">$actuel</span> =& self::<span class="php-var">$avancement</span>[<span class="php-var">$message</span>]; |
</span><span id="274" class="l"><a class="l" href="#274">274: </a> <span class="php-keyword1">echo</span> <span class="php-var">$actuel</span>++; |
</span><span id="275" class="l"><a class="l" href="#275">275: </a> } <span class="php-keyword1">else</span> { |
</span><span id="276" class="l"><a class="l" href="#276">276: </a> <span class="php-var">$actuel</span> =& self::<span class="php-var">$avancement</span>[<span class="php-var">$message</span>]; |
</span><span id="277" class="l"><a class="l" href="#277">277: </a> |
</span><span id="278" class="l"><a class="l" href="#278">278: </a> <span class="php-comment">// Cas du passage de 99 (= 2 caractères) à 100 (= 3 caractères)</span> |
</span><span id="279" class="l"><a class="l" href="#279">279: </a> <span class="php-var">$passage</span> = <span class="php-num">0</span>; |
</span><span id="280" class="l"><a class="l" href="#280">280: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>((string) (<span class="php-var">$actuel</span> - <span class="php-num">1</span>)) < <span class="php-keyword2">strlen</span>((string) (<span class="php-var">$actuel</span>))) { |
</span><span id="281" class="l"><a class="l" href="#281">281: </a> <span class="php-var">$passage</span> = <span class="php-num">1</span>; |
</span><span id="282" class="l"><a class="l" href="#282">282: </a> } |
</span><span id="283" class="l"><a class="l" href="#283">283: </a> |
</span><span id="284" class="l"><a class="l" href="#284">284: </a> <span class="php-keyword1">echo</span> <span class="php-keyword2">str_repeat</span>(<span class="php-keyword2">chr</span>(<span class="php-num">8</span>), (<span class="php-keyword2">strlen</span>((string) <span class="php-var">$actuel</span>) - <span class="php-var">$passage</span>)); |
</span><span id="285" class="l"><a class="l" href="#285">285: </a> <span class="php-keyword1">echo</span> <span class="php-var">$actuel</span>++; |
</span><span id="286" class="l"><a class="l" href="#286">286: </a> } |
</span><span id="287" class="l"><a class="l" href="#287">287: </a> } |
</span><span id="288" class="l"><a class="l" href="#288">288: </a>} |
</span><span id="289" class="l"><a class="l" href="#289">289: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/todo.html |
---|
New file |
0,0 → 1,140 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Todo | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonScript.html">MonScript</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
<h3>Exceptions</h3> |
<ul> |
<li><a href="class-Exception.html">Exception</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<span>Package</span> </li> |
<li> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li class="active"> |
<span>Todo</span> </li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content"> |
<h1>Todo</h1> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/source-class-Encodage.html |
---|
New file |
0,0 → 1,159 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<meta name="robots" content="noindex"> |
<title>File framework/utilitaires/Encodage.php | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li class="active"><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li class="active"><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Utilitaire.html" title="Summary of Utilitaire"><span>Package</span></a> |
</li> |
<li> |
<a href="class-Encodage.html" title="Summary of Encodage"><span>Class</span></a> |
</li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span> |
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-comment">// declare(encoding='UTF-8');</span> |
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a><span class="php-comment">/** |
</span></span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment"> * Classe fournissant des méthodes statiques concernant l'encodage et le décodage des caractères de variable. |
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * |
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> * @category PHP 5.2 |
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @package Utilitaire |
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> * @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
</span></span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-comment"> * @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org) |
</span></span><span id="10" class="l"><a class="l" href="#10">10: </a><span class="php-comment"> * @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
</span></span><span id="11" class="l"><a class="l" href="#11">11: </a><span class="php-comment"> * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
</span></span><span id="12" class="l"><a class="l" href="#12">12: </a><span class="php-comment"> * @version $Id: Encodage.php 299 2011-01-18 14:03:46Z jpm $ |
</span></span><span id="13" class="l"><a class="l" href="#13">13: </a><span class="php-comment"> * @link /doc/framework/ |
</span></span><span id="14" class="l"><a class="l" href="#14">14: </a><span class="php-comment"> */</span> |
</span><span id="15" class="l"><a class="l" href="#15">15: </a><span class="php-keyword1">class</span> <a id="Encodage" href="#Encodage">Encodage</a> { |
</span><span id="16" class="l"><a class="l" href="#16">16: </a> <span class="php-comment">/** |
</span></span><span id="17" class="l"><a class="l" href="#17">17: </a><span class="php-comment"> * Méthode permettant d'encoder par défaut de ISO-8859-15 vers UTF-8 une variable ou un tableau de variables. |
</span></span><span id="18" class="l"><a class="l" href="#18">18: </a><span class="php-comment"> * |
</span></span><span id="19" class="l"><a class="l" href="#19">19: </a><span class="php-comment"> * @param mixed la chaine ou le tableau à encoder en UTF-8 depuis ISO-8859-15. |
</span></span><span id="20" class="l"><a class="l" href="#20">20: </a><span class="php-comment"> * @param string l'encodage d'origine si ce n'est pas ISO-8859-15. |
</span></span><span id="21" class="l"><a class="l" href="#21">21: </a><span class="php-comment"> * @return mixed la chaine ou le tableau encodé en UTF-8. |
</span></span><span id="22" class="l"><a class="l" href="#22">22: </a><span class="php-comment"> * @access protected |
</span></span><span id="23" class="l"><a class="l" href="#23">23: </a><span class="php-comment"> */</span> |
</span><span id="24" class="l"><a class="l" href="#24">24: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_encoderEnUtf8" href="#_encoderEnUtf8">encoderEnUtf8</a>(&<span class="php-var">$variable</span>, <span class="php-var">$encodage</span> = <span class="php-quote">'ISO-8859-15'</span>) { |
</span><span id="25" class="l"><a class="l" href="#25">25: </a> <span class="php-comment">//echo print_r($variable, true)."\n";</span> |
</span><span id="26" class="l"><a class="l" href="#26">26: </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">is_array</span>(<span class="php-var">$variable</span>)) { |
</span><span id="27" class="l"><a class="l" href="#27">27: </a> <span class="php-keyword1">foreach</span> (<span class="php-var">$variable</span> <span class="php-keyword1">as</span> <span class="php-var">$c</span> => <span class="php-var">$v</span>) { |
</span><span id="28" class="l"><a class="l" href="#28">28: </a> <span class="php-var">$variable</span>[<span class="php-var">$c</span>] = self::encoderEnUtf8(<span class="php-var">$v</span>); |
</span><span id="29" class="l"><a class="l" href="#29">29: </a> } |
</span><span id="30" class="l"><a class="l" href="#30">30: </a> } <span class="php-keyword1">else</span> { |
</span><span id="31" class="l"><a class="l" href="#31">31: </a> <span class="php-comment">// Nous vérifions si nous avons un bon encodage UTF-8</span> |
</span><span id="32" class="l"><a class="l" href="#32">32: </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_numeric</span>(<span class="php-var">$variable</span>) && !<span class="php-keyword1">empty</span>(<span class="php-var">$variable</span>) && !self::detecterUtf8(<span class="php-var">$variable</span>)) { |
</span><span id="33" class="l"><a class="l" href="#33">33: </a> <span class="php-comment">// Les nombres, les valeurs vides et ce qui est déjà en UTF-8 ne sont pas encodés.</span> |
</span><span id="34" class="l"><a class="l" href="#34">34: </a> <span class="php-var">$variable</span> = <span class="php-keyword2">mb_convert_encoding</span>(<span class="php-var">$variable</span>, <span class="php-quote">'UTF-8'</span>, <span class="php-var">$encodage</span>); |
</span><span id="35" class="l"><a class="l" href="#35">35: </a> } |
</span><span id="36" class="l"><a class="l" href="#36">36: </a> } |
</span><span id="37" class="l"><a class="l" href="#37">37: </a> <span class="php-keyword1">return</span> <span class="php-var">$variable</span>; |
</span><span id="38" class="l"><a class="l" href="#38">38: </a> } |
</span><span id="39" class="l"><a class="l" href="#39">39: </a> |
</span><span id="40" class="l"><a class="l" href="#40">40: </a> <span class="php-comment">/** |
</span></span><span id="41" class="l"><a class="l" href="#41">41: </a><span class="php-comment"> * Méthode permettant de détecter réellement l'encodage UTF-8. |
</span></span><span id="42" class="l"><a class="l" href="#42">42: </a><span class="php-comment"> * mb_detect_encoding plante si la chaine de caractère se termine par un caractère accentué. |
</span></span><span id="43" class="l"><a class="l" href="#43">43: </a><span class="php-comment"> * Provient de PHPDIG. |
</span></span><span id="44" class="l"><a class="l" href="#44">44: </a><span class="php-comment"> * |
</span></span><span id="45" class="l"><a class="l" href="#45">45: </a><span class="php-comment"> * @param string la chaine à vérifier. |
</span></span><span id="46" class="l"><a class="l" href="#46">46: </a><span class="php-comment"> * @return bool true si c'est de UTF-8, sinon false. |
</span></span><span id="47" class="l"><a class="l" href="#47">47: </a><span class="php-comment"> * @access private |
</span></span><span id="48" class="l"><a class="l" href="#48">48: </a><span class="php-comment"> */</span> |
</span><span id="49" class="l"><a class="l" href="#49">49: </a> <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> <a id="_detecterUtf8" href="#_detecterUtf8">detecterUtf8</a>(<span class="php-var">$chaine</span>) { |
</span><span id="50" class="l"><a class="l" href="#50">50: </a> <span class="php-keyword1">if</span> (<span class="php-var">$chaine</span> === <span class="php-keyword2">mb_convert_encoding</span>(<span class="php-keyword2">mb_convert_encoding</span>(<span class="php-var">$chaine</span>, <span class="php-quote">'UTF-32'</span>, <span class="php-quote">'UTF-8'</span>), <span class="php-quote">'UTF-8'</span>, <span class="php-quote">'UTF-32'</span>)) { |
</span><span id="51" class="l"><a class="l" href="#51">51: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">true</span>; |
</span><span id="52" class="l"><a class="l" href="#52">52: </a> } <span class="php-keyword1">else</span> { |
</span><span id="53" class="l"><a class="l" href="#53">53: </a> <span class="php-keyword1">return</span> <span class="php-keyword1">false</span>; |
</span><span id="54" class="l"><a class="l" href="#54">54: </a> } |
</span><span id="55" class="l"><a class="l" href="#55">55: </a> } |
</span><span id="56" class="l"><a class="l" href="#56">56: </a>} |
</span><span id="57" class="l"><a class="l" href="#57">57: </a></span><span class="xlang">?></span></code></pre> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/index.html |
---|
New file |
0,0 → 1,149 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js"></script> |
<script type="text/javascript" src="elementlist.js"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<span>Overview</span> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheFichier.html">CacheFichier</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-CacheSqlite.html">CacheSqlite</a></li> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonScript.html">MonScript</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
<h3>Exceptions</h3> |
<ul> |
<li><a href="class-Exception.html">Exception</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text" autofocus> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li class="active"> |
<span>Overview</span> </li> |
<li> |
<span>Package</span> </li> |
<li> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content"> |
<h1>TBFramework - v0.4</h1> |
<table class="summary" id="packages"> |
<caption>Packages summary</caption> |
<tr> |
<td class="name"><a href="package-Framework.html">Framework</a></td> |
</tr> |
<tr> |
<td class="name"><a href="package-None.html">None</a></td> |
</tr> |
<tr> |
<td class="name"><a href="package-PHP.html">PHP</a></td> |
</tr> |
<tr> |
<td class="name"><a href="package-Utilitaire.html">Utilitaire</a></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Script.html |
---|
New file |
0,0 → 1,786 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Script | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li class="active"><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Bdd.html">Bdd</a></li> |
<li><a href="class-Cache.html">Cache</a></li> |
<li><a href="class-CacheSimple.html">CacheSimple</a></li> |
<li><a href="class-Chronometre.html">Chronometre</a></li> |
<li><a href="class-Cli.html">Cli</a></li> |
<li><a href="class-Config.html">Config</a></li> |
<li><a href="class-Controleur.html">Controleur</a></li> |
<li><a href="class-Debug.html">Debug</a></li> |
<li><a href="class-Framework.html">Framework</a></li> |
<li><a href="class-GestionnaireException.html">GestionnaireException</a></li> |
<li><a href="class-I18n.html">I18n</a></li> |
<li><a href="class-Log.html">Log</a></li> |
<li><a href="class-MonService.html">MonService</a></li> |
<li><a href="class-Registre.html">Registre</a></li> |
<li><a href="class-RestClient.html">RestClient</a></li> |
<li><a href="class-RestServeur.html">RestServeur</a></li> |
<li><a href="class-RestService.html">RestService</a></li> |
<li class="active"><a href="class-Script.html">Script</a></li> |
<li><a href="class-ServiceCacheFichier.html">ServiceCacheFichier</a></li> |
<li><a href="class-ServiceCacheSimple.html">ServiceCacheSimple</a></li> |
<li><a href="class-ServiceCacheSqlite.html">ServiceCacheSqlite</a></li> |
<li><a href="class-SquelettePhp.html">SquelettePhp</a></li> |
<li><a href="class-Url.html">Url</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Framework.html" title="Summary of Framework"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Script</h1> |
<div class="description"> |
<p>Script est une classe abstraite qui doit être implémenté par les classes |
éxecutant des scripts en ligne de commande.</p> |
</div> |
<div> |
<h4>Direct known subclasses</h4> |
<a href="class-MonScript.html">MonScript</a> |
</div> |
<div class="info"> |
<b>Abstract</b><br> |
<b>Package:</b> <a href="package-Framework.html">Framework</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2010, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Author:</b> |
Delphine CAUQUIL <<a |
href="mailto:delphine@tela-botanica.org">delphine@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Script.php 299 2011-01-18 14:03:46Z jpm $<br> |
<b>Since:</b> |
0.3<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Script.html#4-288" title="Go to source code">framework/Script.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="__construct" id="___construct"> |
<td class="attributes"><code> |
public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#___construct">#</a> |
<code><a href="source-class-Script.html#96-107" title="Go to source code">__construct</a>( <span>mixed <var>$script_nom</var></span>, <span>mixed <var>$parametres_cli</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getScriptNom" id="_getScriptNom"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getScriptNom">#</a> |
<code><a href="source-class-Script.html#113-115" title="Go to source code">getScriptNom</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getScriptChemin" id="_getScriptChemin"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getScriptChemin">#</a> |
<code><a href="source-class-Script.html#117-123" title="Go to source code">getScriptChemin</a>( <span>mixed <var>$doit_exister</var> = <span class="php-keyword1">true</span></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="getParametre" id="_getParametre"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_getParametre">#</a> |
<code><a href="source-class-Script.html#125-137" title="Go to source code">getParametre</a>( <span>mixed <var>$parametre</var></span> )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="executer" id="_executer"> |
<td class="attributes"><code> |
abstract public |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_executer">#</a> |
<code><a href="source-class-Script.html#139" title="Go to source code">executer</a>( )</code> |
<div class="description short"> |
</div> |
<div class="description detailed hidden"> |
</div> |
</div></td> |
</tr> |
<tr data-order="traiterErreur" id="_traiterErreur"> |
<td class="attributes"><code> |
protected |
void. |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_traiterErreur">#</a> |
<code><a href="source-class-Script.html#189-199" title="Go to source code">traiterErreur</a>( <span>string <var>$message</var></span>, <span>array <var>$tab_arguments</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Affiche un message d'erreur formaté. Si le paramétre de verbosité (-v) |
vaut 1 ou plus, le message est écrit dans le fichier de log et afficher dans la |
console.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Affiche un message d'erreur formaté. Si le paramétre de verbosité (-v) |
vaut 1 ou plus, le message est écrit dans le fichier de log et afficher dans la |
console.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$message</var></dt> |
<dd><code>string</code><br>le message d'erreur avec des %s.</dd> |
<dt><var>$tab_arguments</var></dt> |
<dd><code>array</code><br>le tableau des paramêtres à insérer dans le message d'erreur.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>void.</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="traiterAvertissement" id="_traiterAvertissement"> |
<td class="attributes"><code> |
protected |
void. |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_traiterAvertissement">#</a> |
<code><a href="source-class-Script.html#201-212" title="Go to source code">traiterAvertissement</a>( <span>string <var>$message</var></span>, <span>array <var>$tab_arguments</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Affiche un message d'avertissement formaté. Si le paramétre de verbosité |
(-v) vaut 1, le message est écrit dans le fichier de log. Si le paramétre de |
verbosité (-v) vaut 2 ou plus, le message est écrit dans le fichier de log et |
afficher dans la console.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Affiche un message d'avertissement formaté. Si le paramétre de verbosité |
(-v) vaut 1, le message est écrit dans le fichier de log. Si le paramétre de |
verbosité (-v) vaut 2 ou plus, le message est écrit dans le fichier de log et |
afficher dans la console.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$message</var></dt> |
<dd><code>string</code><br>le message d'erreur avec des %s.</dd> |
<dt><var>$tab_arguments</var></dt> |
<dd><code>array</code><br>le tableau des paramêtres à insérer dans le message d'erreur.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>void.</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="traiterInfo" id="_traiterInfo"> |
<td class="attributes"><code> |
protected |
void. |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_traiterInfo">#</a> |
<code><a href="source-class-Script.html#214-225" title="Go to source code">traiterInfo</a>( <span>string <var>$message</var></span>, <span>array <var>$tab_arguments</var> = <span class="php-keyword1">array</span>()</span> )</code> |
<div class="description short"> |
<p>Retourne un message d'information formaté. Si le paramétre de verbosité |
(-v) vaut 1 ou 2 , le message est écrit dans le fichier de log. Si le |
paramétre de verbosité (-v) vaut 3 ou plus, le message est écrit dans le |
fichier de log et afficher dans la console.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Retourne un message d'information formaté. Si le paramétre de verbosité |
(-v) vaut 1 ou 2 , le message est écrit dans le fichier de log. Si le |
paramétre de verbosité (-v) vaut 3 ou plus, le message est écrit dans le |
fichier de log et afficher dans la console.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$message</var></dt> |
<dd><code>string</code><br>le message d'information avec des %s.</dd> |
<dt><var>$tab_arguments</var></dt> |
<dd><code>array</code><br>le tableau des paramêtres à insérer dans le message d'erreur.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>void.</code><br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="formaterMsg" id="_formaterMsg"> |
<td class="attributes"><code> |
protected |
string |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_formaterMsg">#</a> |
<code><a href="source-class-Script.html#245-258" title="Go to source code">formaterMsg</a>( <span>string <var>$message</var></span>, <span>array <var>$tab_arguments</var> = <span class="php-keyword1">array</span>()</span>, <span>mixed <var>$niveau</var> = <span class="php-keyword1">null</span></span> )</code> |
<div class="description short"> |
<p>Retourne un message d'information formaté.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Retourne un message d'information formaté.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$message</var></dt> |
<dd><code>string</code><br>le message d'information avec des %s.</dd> |
<dt><var>$tab_arguments</var></dt> |
<dd><code>array</code><br>le tableau des paramêtres à insérer dans le message d'erreur.</dd> |
<dt><var>$niveau</var></dt> |
<dd></dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>string</code><br>le message d'erreur formaté.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="afficherAvancement" id="_afficherAvancement"> |
<td class="attributes"><code> |
protected |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_afficherAvancement">#</a> |
<code><a href="source-class-Script.html#260-287" title="Go to source code">afficherAvancement</a>( <span>string <var>$message</var></span>, <span>integer <var>$depart</var> = <span class="php-num">0</span></span> )</code> |
<div class="description short"> |
<p>Utiliser cette méthode dans une boucle pour afficher un message suivi du |
nombre de tour de boucle effectué. Vous devrez vous même gérer le retour à |
la ligne à la sortie de la boucle.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Utiliser cette méthode dans une boucle pour afficher un message suivi du |
nombre de tour de boucle effectué. Vous devrez vous même gérer le retour à |
la ligne à la sortie de la boucle.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$message</var></dt> |
<dd><code>string</code><br>le message d'information.</dd> |
<dt><var>$depart</var></dt> |
<dd><code>integer</code><br>le nombre de départ à afficher.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code></code><br>le message est affiché dans la console.<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="constants"> |
<caption>Constants summary</caption> |
<tr data-order="MSG_LOG" id="MSG_LOG"> |
<td class="attributes"><code>integer</code></td> |
<td class="name"><code> |
<a href="source-class-Script.html#19-20" title="Go to source code"><b>MSG_LOG</b></a> |
</code></td> |
<td class="value"><code><span class="php-num">0</span></code></td> |
<td class="description"><div> |
<a href="#MSG_LOG" class="anchor">#</a> |
<div class="description short"> |
<p>Niveau de message de type LOG</p> |
</div> |
<div class="description detailed hidden"> |
<p>Niveau de message de type LOG</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="MSG_ERREUR" id="MSG_ERREUR"> |
<td class="attributes"><code>integer</code></td> |
<td class="name"><code> |
<a href="source-class-Script.html#21-22" title="Go to source code"><b>MSG_ERREUR</b></a> |
</code></td> |
<td class="value"><code><span class="php-num">1</span></code></td> |
<td class="description"><div> |
<a href="#MSG_ERREUR" class="anchor">#</a> |
<div class="description short"> |
<p>Niveau de message de type ERREUR</p> |
</div> |
<div class="description detailed hidden"> |
<p>Niveau de message de type ERREUR</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="MSG_AVERTISSEMENT" id="MSG_AVERTISSEMENT"> |
<td class="attributes"><code>integer</code></td> |
<td class="name"><code> |
<a href="source-class-Script.html#23-24" title="Go to source code"><b>MSG_AVERTISSEMENT</b></a> |
</code></td> |
<td class="value"><code><span class="php-num">2</span></code></td> |
<td class="description"><div> |
<a href="#MSG_AVERTISSEMENT" class="anchor">#</a> |
<div class="description short"> |
<p>Niveau de message de type AVERTISSEMENT</p> |
</div> |
<div class="description detailed hidden"> |
<p>Niveau de message de type AVERTISSEMENT</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="MSG_INFO" id="MSG_INFO"> |
<td class="attributes"><code>integer</code></td> |
<td class="name"><code> |
<a href="source-class-Script.html#25-26" title="Go to source code"><b>MSG_INFO</b></a> |
</code></td> |
<td class="value"><code><span class="php-num">3</span></code></td> |
<td class="description"><div> |
<a href="#MSG_INFO" class="anchor">#</a> |
<div class="description short"> |
<p>Niveau de message de type INFORMATION</p> |
</div> |
<div class="description detailed hidden"> |
<p>Niveau de message de type INFORMATION</p> |
</div> |
</div></td> |
</tr> |
</table> |
<table class="summary" id="properties"> |
<caption>Properties summary</caption> |
<tr data-order="parametres_autorises" id="$parametres_autorises"> |
<td class="attributes"><code> |
protected |
array |
</code></td> |
<td class="name"> |
<a href="source-class-Script.html#54-67" title="Go to source code"><var>$parametres_autorises</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">null</span></code></td> |
<td class="description"><div> |
<a href="#$parametres_autorises" class="anchor">#</a> |
<div class="description short"> |
<p>Paramêtres autorisés par le script. le tableau est de la forme suivante |
:</p> |
<ul> |
<li>clé = nom du paramêtre '-foo'</li> |
<li>value = contient un nouveau tableau composé de cette façon : |
<ul> |
<li>booléen: true si le paramêtre est obligatoire</li> |
<li>booléen ou var : true si le paramêtre nécessite un valeur à sa suite ou |
la valeur par défaut</li> |
<li>string: description du contenu du paramêtre</li> |
</ul> |
</li> |
</ul> |
<p>Les paramêtres optionels devraient être déclaré à la fin du tableau. Le |
dernier parametre du tableau peut avoir la valeur '...', il contiendra alors |
l'ensemble des paramêtres suivant trouvés sur la ligne de commande.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Paramêtres autorisés par le script. le tableau est de la forme suivante |
:</p> |
<ul> |
<li>clé = nom du paramêtre '-foo'</li> |
<li>value = contient un nouveau tableau composé de cette façon : - booléen: |
true si le paramêtre est obligatoire - booléen ou var : true si le paramêtre |
nécessite un valeur à sa suite ou la valeur par défaut - string: description |
du contenu du paramêtre</li> |
</ul> |
<p>Les paramêtres optionels devraient être déclaré à la fin du tableau. Le |
dernier parametre du tableau peut avoir la valeur '...', il contiendra alors |
l'ensemble des paramêtres suivant trouvés sur la ligne de commande.</p> |
</div> |
</div></td> |
</tr> |
<tr data-order="parametres" id="$parametres"> |
<td class="attributes"><code> |
protected |
array |
</code></td> |
<td class="name"> |
<a href="source-class-Script.html#78-85" title="Go to source code"><var>$parametres</var></a> |
</td> |
<td class="value"><code><span class="php-keyword1">null</span></code></td> |
<td class="description"><div> |
<a href="#$parametres" class="anchor">#</a> |
<div class="description short"> |
<p>Contient le tableau des paramètres disponible après vérification : le |
tableau est de la forme suivante :</p> |
<ul> |
<li>clé = nom du paramêtre '-foo'</li> |
<li>valeur = la valeur récupérée sur la ligne de commande</li> |
</ul> |
</div> |
<div class="description detailed hidden"> |
<p>Contient le tableau des paramètres disponible après vérification : le |
tableau est de la forme suivante :</p> |
<ul> |
<li>clé = nom du paramêtre '-foo'</li> |
<li>valeur = la valeur récupérée sur la ligne de commande</li> |
</ul> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |
/trunk/doc/ApiGen/class-Encodage.html |
---|
New file |
0,0 → 1,260 |
<!DOCTYPE html> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<meta name="generator" content="ApiGen 2.8.0"> |
<title>Class Encodage | TBFramework - v0.4</title> |
<script type="text/javascript" src="resources/combined.js?4205936287"></script> |
<script type="text/javascript" src="elementlist.js?1964084359"></script> |
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360"> |
</head> |
<body> |
<div id="left"> |
<div id="menu"> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
<div id="groups"> |
<h3>Packages</h3> |
<ul> |
<li><a href="package-Framework.html">Framework</a> |
</li> |
<li><a href="package-None.html">None</a> |
</li> |
<li><a href="package-PHP.html">PHP</a> |
</li> |
<li class="active"><a href="package-Utilitaire.html">Utilitaire</a> |
</li> |
</ul> |
</div> |
<hr> |
<div id="elements"> |
<h3>Classes</h3> |
<ul> |
<li><a href="class-Chaine.html">Chaine</a></li> |
<li class="active"><a href="class-Encodage.html">Encodage</a></li> |
<li><a href="class-Fichier.html">Fichier</a></li> |
<li><a href="class-Pattern.html">Pattern</a></li> |
<li><a href="class-Tableau.html">Tableau</a></li> |
</ul> |
</div> |
</div> |
</div> |
<div id="splitter"></div> |
<div id="right"> |
<div id="rightInner"> |
<form id="search"> |
<input type="hidden" name="cx" value=""> |
<input type="hidden" name="ie" value="UTF-8"> |
<input type="text" name="q" class="text"> |
<input type="submit" value="Search"> |
</form> |
<div id="navigation"> |
<ul> |
<li> |
<a href="index.html" title="Overview"><span>Overview</span></a> |
</li> |
<li> |
<a href="package-Utilitaire.html" title="Summary of Utilitaire"><span>Package</span></a> |
</li> |
<li class="active"> |
<span>Class</span> </li> |
</ul> |
<ul> |
<li> |
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a> |
</li> |
<li> |
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a> |
</li> |
<li> |
<a href="todo.html" title="Todo list"><span>Todo</span></a> |
</li> |
</ul> |
<ul> |
</ul> |
</div> |
<div id="content" class="class"> |
<h1>Class Encodage</h1> |
<div class="description"> |
<p>Classe fournissant des méthodes statiques concernant l'encodage et le |
décodage des caractères de variable.</p> |
</div> |
<div class="info"> |
<b>Package:</b> <a href="package-Utilitaire.html">Utilitaire</a><br> |
<b>Category:</b> |
PHP 5.2<br> |
<b>Copyright:</b> |
Copyright (c) 2009, Tela Botanica (<a |
href="mailto:accueil@tela-botanica.org">accueil@<!-- -->tela-botanica.org</a>)<br> |
<b>License:</b> |
<a href="http://www.gnu.org/licenses/gpl.html">Licence GNU-GPL-v3</a><br> |
<b>License:</b> |
<a href="http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt">Licence CECILL-v2</a><br> |
<b>Author:</b> |
Jean-Pascal MILCENT <<a |
href="mailto:jpm@tela-botanica.org">jpm@<!-- -->tela-botanica.org</a>><br> |
<b>Version:</b> |
$Id: Encodage.php 299 2011-01-18 14:03:46Z jpm $<br> |
<b>Link:</b> |
/doc/framework/<br> |
<b>Located at</b> <a href="source-class-Encodage.html#3-56" title="Go to source code">framework/utilitaires/Encodage.php</a><br> |
</div> |
<table class="summary" id="methods"> |
<caption>Methods summary</caption> |
<tr data-order="encoderEnUtf8" id="_encoderEnUtf8"> |
<td class="attributes"><code> |
public static |
mixed |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_encoderEnUtf8">#</a> |
<code><a href="source-class-Encodage.html#16-38" title="Go to source code">encoderEnUtf8</a>( <span>mixed <var>& $variable</var></span>, <span>string <var>$encodage</var> = <span class="php-quote">'ISO-8859-15'</span></span> )</code> |
<div class="description short"> |
<p>Méthode permettant d'encoder par défaut de ISO-8859-15 vers UTF-8 une |
variable ou un tableau de variables.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode permettant d'encoder par défaut de ISO-8859-15 vers UTF-8 une |
variable ou un tableau de variables.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$variable</var></dt> |
<dd><code>mixed</code><br>la chaine ou le tableau à encoder en UTF-8 depuis ISO-8859-15.</dd> |
<dt><var>$encodage</var></dt> |
<dd><code>string</code><br>l'encodage d'origine si ce n'est pas ISO-8859-15.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>mixed</code><br>la chaine ou le tableau encodé en UTF-8.<br> |
</div> |
</div> |
</div></td> |
</tr> |
<tr data-order="detecterUtf8" id="_detecterUtf8"> |
<td class="attributes"><code> |
public static |
boolean |
</code> |
</td> |
<td class="name"><div> |
<a class="anchor" href="#_detecterUtf8">#</a> |
<code><a href="source-class-Encodage.html#40-55" title="Go to source code">detecterUtf8</a>( <span>string <var>$chaine</var></span> )</code> |
<div class="description short"> |
<p>Méthode permettant de détecter réellement l'encodage UTF-8. |
mb_detect_encoding plante si la chaine de caractère se termine par un |
caractère accentué. Provient de PHPDIG.</p> |
</div> |
<div class="description detailed hidden"> |
<p>Méthode permettant de détecter réellement l'encodage UTF-8. |
mb_detect_encoding plante si la chaine de caractère se termine par un |
caractère accentué. Provient de PHPDIG.</p> |
<h4>Parameters</h4> |
<div class="list"><dl> |
<dt><var>$chaine</var></dt> |
<dd><code>string</code><br>la chaine à vérifier.</dd> |
</dl></div> |
<h4>Returns</h4> |
<div class="list"> |
<code>boolean</code><br>true si c'est de UTF-8, sinon false.<br> |
</div> |
</div> |
</div></td> |
</tr> |
</table> |
</div> |
<div id="footer"> |
TBFramework - v0.4 API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a> |
</div> |
</div> |
</div> |
</body> |
</html> |