return $_tab ;
 public static function getLineByAttribute($pDocument, $pQueries)
 * return node matching request by attribute
 {
 $_users = $pDocument->getElementsByTagName('user');
 foreach ($_users as $u)
 if ($u->nodeType != XML_TEXT_NODE)
 $_flg = true ;
 foreach($pQueries as $_qa )
 if( !($u->getAttribute($_qa['attribute']) 
 == $_qa['value']) || !$_flg )
 { // 1:1 match
 $_flg = false ; 
 if($_flg)
 return utilities::getAttributesContents($u) ;
 return false ;
Un test concluant de ces méthodes nous rend opérationnel pour cette phase 
<?php
require_once "./Cms/Classes/dataManager.class.php";
require_once "./Cms/Classes/utilities.class.php";
$_manager = new dataManager();
$_manager->data['path'] = $_manager->data['root'] . "Customer1/Contents/user1.xml"; //
 $_manager->data['query_1'] = array(
 array("attribute"=>"login", "value"=>"user2")
 , array("attribute"=>"pass", "value"=>"pass2"));
 // query test
 $_res = utilities::getLineByAttribute($_manager->initialize(), $_manager->data['query_1']) ;
print_r_html($_res);
Résultat :
Liste des défauts.
Cette gestion des utilisateurs ne prend actuellement que les attributs de nœuds...
[3] Complétion du frameset.
<?php 
function print_r_html($data,$return_data=false)
 $data = print_r($data,true);
 $data = str_replace( " ","&nbsp;", $data);
 $data = str_replace( "\r\n","<br/>\r\n", $data);
 $data = str_replace( "\r","<br/>\r", $data);
 $data = str_replace( "\n","<br/>\n", $data);
 if (!$return_data)
 echo $data;
 else
 return $data;
class utilities

public static function getNodes($pDomDoc, $pXpathString)
 * get the node from DomDoc with XpathString
 {
 $xp = new DOMXPath($pDomDoc);
 $xp->registerNamespace('x', 'http://www.w3.org/1999/xhtml');
 $xp->registerNamespace('xhtml', 'http://www.w3.org/1999/xhtml');
 $xp->registerNamespace('i18n', 'http://apache.org/cocoon/i18n/2.1');
 $ret = array();
 $nodes = $xp->query($pXpathString);
 foreach ($nodes as $node)
 array_push($ret, $node);
 public static function isContent($pPattern, $pFeed)
 * check is pattern in feed
 {
 return preg_match('/('.$pPattern.')/',$pFeed)?true:false;
<?php
class templateControler
/**
 * Control the templates
 * @var (mixed) ($domDoc, $data, $stack)

private $pattern 
 = array(
 'inc'=>'//' // inclusion patterns
 );
 protected $domDoc, $stack;
 //
 public $data;
 /*
 public function __construct()
 $this->domDoc = new DOMDocument();
 $this->initialize();
 */
 /**
 * Enter description here...
 * @param unknown_type $pVar
 * @return templateControler
 public function templateControler($pVar)
 $this->domDoc = new DOMDocument();
 $this->setter($pVar);
 $this->initialize();

* Enter description here...
 * @param unknown_type $pVar
 public function setter($pVar)
 $this->data = $pVar;

// TODO GETTER
 public function initialize()
 $this->domDoc->load( $this->data['path'] );

* Enter description here...
 */
 public function getNode($pXPath) //"//html/body/*[@class='text']";
 return $this->data['feed'] = utilities::getNodes($this->domDoc, $pXPath);
 public function getAnchors($pFeed)
 preg_match_all($this->pattern['inc'], $pFeed, $this->data['result']);
 return $this->data['result']; // on prefere les données centralisées dans la classe

public function publicTemplate()
 return $this->domDoc->saveXML();

Le test suivant permet de voir si on prend bien les ancres d'injection, par exemple, pour le nœud frameset/content
//
$tmp = new templateControler(array("path"=>"object.xml"));
$tst = $tmp->getNode("//template/frameset/content");
print_r_html($tmp->getAnchors($tst[0]->nodeValue));
On implémente ces deux nouvelles fonctions à templateControler
 /**
 * getContent retourne le contenu du/des nœuds demandés
 * > (nodeName, nodeId) - (string) >
 public function getContent($nodeName,$nodeId)
 // set expression
 $_expr = "//" . $nodeName . ($nodeId&&$nodeId!='*'?"[id='$nodeId']":"");
 $set = $this->getNode($_expr);
 $content=null;
 foreach($set as $k=>$v)
 $content .= "<" . $nodeName . ">" . trim($v->nodeValue) . "</" . $nodeName . ">";

return $content?$content:"";
 * replace anchor by content
 public function anchorContentReplacer()

$i=0;
 foreach($this->data['result'][0] as $k=>$v)
 // formatting anchor's syllabes
 $v = str_replace(array('{','[','}',']'),array(",' ',","),$v);
 $tmp = explode(":",$v);$_ = explode(' ',$tmp[1]);
 // replacing
 $this->data['result'][0][$i++] 
 = array("node"=>$_[0],"value"=>$this->getContent($_[0], $_[1]));
// TODO : getNodeById pour disposer d'un getElementById moins spécialisé et fonctionnel ici.
Le test suivant permet de voir si on remplace bien l'ancre par son contenu :
require_once "templateControler.class.php";
$tmp = new templateControler(array("path"=>"template.xml"));
$tmp->getNode("//template/frameset/content");
$tmp->getAnchors(
 $tmp
 ->data['feed'][0]
 ->nodeValue);
$tmp->anchorContentReplacer();
print_r_html(
 $tmp->data['result']
Le contenu est bien localisé dans le template, par conséquent l'objectif de cette phase est atteint. On est opérationnel pour l'injection.
class SnippetActer

protected $_type,$_content,$_stack;
 public function setType()
 list($_1,$_2)=explode('/',$this->_type);
 $this->actCode(array($_1,$_2));

public function setContent($pContent)
 $this->_content = $pContent;

* act statements
 public function actCode($pType)
 switch(true)
 case $pType[0]=="text"&&$pType[0]=="php":
 $this->write();
 break;
 case $pType[0]=="text"&&$pType[0]=="javascript":
 $this->inject();
 break;
 case $pType[0]=="action"&&$pType[0]=="php":
 $this->unstack();$this->act();
 break;
 /*
 * stack statements
 public function unstack()
 $_this->_stack = explode(";",$this->_content);

* execute statements
 public function act()
 foreach($this->_stack as $v)
 eval($v);
[4] Un webservice.
Le webService propose par défaut une synergie avec d'autres solutions, sites, applications. Des fonctionnalités distantes permettent l'interfaçage logicielle avec le serveur de données, option qui deviendra basique pour les systèmes orientés données.
<?php
 webservice servker

ini_set("soap.wsdl_cache_enabled", "0");
 $serveurSOAP = new SoapServer('service.wsdl');
 /* inqueries services 
 in :
 out :
 $serveurSOAP->addFunction('request');

/* high level services 
 in :
 out :
 $serveurSOAP->addFunction('harvest');

/* low level services 
 in : 
 out :
 $serveurSOAP->addFunction('deploy');
 $serveurSOAP->addFunction('f_01');
 $serveurSOAP->addFunction('f_02');

if ($_SERVER['REQUEST_METHOD'] == 'POST')
 $serveurSOAP->handle();

require_once "./Services/request.srv.php";
 require_once "./Services/service_01.srv.php";
 require_once "./Services/service_02.srv.php";
 function listen($pIn)
 return 'Copy : ' . $pIn;

Programmation PHP/Exemples/MiniCMS/Déploiement de la vue

Le frontOffice.
Le front office est orienté ajax.
<?xml version="1.0" encoding="UTF-8"?>
<!-- templateChunk model -->
<template id="nested" number="" topic="" links="">
 <!-- HEADER CONTENT -->
 <header>
 <assert>
 <![CDATA[
 :: HERE COMES SERVER/CLIENT SIDE SNIPPETS ::
 ]]>
 </assert>
 <!-- -->
 <content>
 <style id="" />
 <style id="standard">
 body
 /* background-color:red; */
 font-family:verdana;
 font-size:10px;
 margin:0px 0px 0px 0px;
 padding:0px;

.click
 cursor:pointer;

.style_01
 /* some style in */

.encoder
 font-size:11px;
 font-family:verdana;
 width:95%;

.title td
 font-weight:bold;

.specButton
 font-weight:bold;
 cursor:pointer;
 font-size:10px;
 font-family:verdana;

div
 /* border: grey 1px solid ; */
 .dirPath
 background-color:yellow;

.red
 color:red;

.green
 color:green;

.dark
 padding:2px;
 background:#bbb;
 /* font-weight:bold; */
 color:white;

.panel 
 position: fixed;
 background:#eee;
 top: 1em;
 right: 2%;
 border: 1px solid #000000;
 padding: 1em;
 z-index: 10;
 width: 200;

.adminMenu 
 position: fixed;
 background:#eee;
 top: 1em;
 left: 2%;
 border: 1px solid #000000;
 padding: 1em;
 z-index: 10;
 width: 200;