'index, follow'
,'geo.region' => "FR"
// ,'geo.placename' => "Le Controis-en-Sologne, Loir-et-Cher"
// ,'geo.position' => "47.420083230613315;1.429889413492917"
// ,'ICBM' => "47.420083230613315, 1.429889413492917"
);
protected static $defaultStaticPagesData = array(
array(
"uri" => "/mentions-legales"
,"content" => "mentions-legales/contrat.html"
,"title" => "Mentions Légales"
,"titleHtml" => "Mentions Légales"
,"footerLink" => true
,"meta" => array(
"description" => "Nos mentions légales."
)
)
,array(
"uri" => "/charte"
,"content" => "charte/contrat.html"
,"title" => "Charte RGPD"
,"titleHtml" => "Réglement Générale des Protections de données"
,"footerLink" => true
,"meta" => array(
"description" => "Charte du Réglement Générale des Protections de données."
)
)
// ,array( "uri" => "/contact" ,"content" => "contact/contrat.html" ,"title" => "Contact" )
);
protected function loadStaticPagesData() {
$this->staticPagesData = self::$defaultStaticPagesData;
}
protected function initFooterLink() {
$this->loadStaticPagesData();
$this->ulFooterLink->clear();
$this->ulFooterLink->setParam( 'class' ,'footer-link w3-center' );
$this->firstFooterLink=true;
//die( print_r( $this->staticPagesData ) );
if ( \is_array( $this->staticPagesData ) )
foreach( $this->staticPagesData as $staticPageData ) {
if ( isset( $staticPageData[ "footerLink" ] ) && $staticPageData[ "footerLink" ] )
$this->addFooterLink( $staticPageData );
}
}
protected $firstFooterLink = true;
// $page->addFooterLink( array(
// 'uri' => '//jigsaw.w3.org/css-validator/check/referer'
// ,'title' => 'css valid'
// ,'
'
// ) );
protected function addFooterLink( array $staticPageData ) {
$this->addHtmlFooterLink( $staticPageData["uri"] ,$staticPageData["title"] ,$staticPageData["titleHtml"] );
}
protected function addHtmlFooterLink( string $link, string $title ,string $titleHtml ) {
if ( $this->firstFooterLink ) $this->firstFooterLink=false;
else {
$liFooterLink = new Html( "li" );$this->ulFooterLink->add( $liFooterLink );
$liFooterLink->add( '|' );
}
$liFooterLink = new Html( "li" );$this->ulFooterLink->add( $liFooterLink );
$aLink = new Html( 'a', array(
"href" => $link
,"title" => $title
, 'class' => 'w3-hover-theme'
) );
$aLink->add( $titleHtml );
$liFooterLink->add( $aLink );
}
public function errorPage( string $dataError ) : void {
$this->addLog( __METHOD__ );
$this->littleClear();
$this->setTitle( "Error Page" );//d1rKM3b.fr <= serais drole ce domain :D
$this->w3cHeaderTitle( "an error is occure" );
$this->add( "
" );
}
public function loadPage( array $staticPageData ) : void {
$this->addLog( __METHOD__ );
if ( isset( $staticPageData[ "meta" ] ) ) {
foreach( $staticPageData[ "meta" ] as $metaName => $metaContent )
$this->setHeadMeta( $metaName ,$metaContent );
}
//$this->littleClear();
$this->clear();
$this->setTitle( $staticPageData["title"] );//d1rKM3b.fr
if ( isset( $staticPageData["titleHtml"] ) )
$this->w3cHeaderTitle( $staticPageData["titleHtml"] );
else
$this->w3cHeaderTitle( $staticPageData["title"] );
$this->add( $this->getFile( $staticPageData["content"] ) );
$this->domJsonRefObj->clear();
$this->domJsonRefObj->setParam( "type" ,"application/ld+json" );
if ( isset( $staticPageData[ "fileHeadRefObjJson" ] ) )
$this->domJsonRefObj->add( $this->getFile( $staticPageData["fileHeadRefObjJson"] ) );
}
protected function w3cHeaderTitle( $titleHtml ) : void {
$aLink = new Html( 'a', array(
"href" => "/"
//,"title" => $title
, 'class' => 'w3-hover-theme'
) );
$aLink->add( $titleHtml );
$this->headerTitle( $aLink );
//$domH3Title->add( $staticPageData["title"] );
}
public static $themes = array(
"w3-theme-red" // 0
,"w3-theme-pink" // 1
,"w3-theme-purple" // 2
,"w3-theme-deep-purple" // 3
,"w3-theme-indigo" // 4
,"w3-theme-blue" // 5
,"w3-theme-light-blue" // 6
,"w3-theme-cyan" // 7
,"w3-theme-teal" // 8
,"w3-theme-green" // 9
,"w3-theme-light-green" // 10
,"w3-theme-lime" // 11
,"w3-theme-khaki" // 12
,"w3-theme-yellow" // 13
,"w3-theme-amber" // 14
,"w3-theme-orange" // 15
,"w3-theme-deep-orange" // 16
,"w3-theme-blue-grey" // 17
,"w3-theme-brown" // 18
,"w3-theme-grey" // 19
,"w3-theme-dark-grey" // 20
,"w3-theme-black" // 21
,"w3-theme-w3schools" // 22
);
private $htmlsHead = array();
private $htmlLinkTheme = null;
protected $domContainerHead = null;
protected $domContainerFoot = null;
//protected $domBottomLeftContainer = null;
protected $domBottomMiddleContainer = null;
//protected $domBottomRigthContainer = null;
protected $domContainerBody = null;
protected $ulFooterLink = null;
protected $htmlContent = null;
private $domJsonRefObj = null;
private $cssW3Cfolder = null;
public function __construct( string $title = "Page with W3C", string $cssW3Cfolder ="/bakuba-css" ) {
$this->cssW3Cfolder = $cssW3Cfolder;
$this->htmlContent = new Html( "div" );
$this->ulFooterLink = new Html( "ul" );
$this->domContainerHead = new Html( 'div' );
$this->domContainerFoot = new Html( 'div' );
//$this->domBottomLeftContainer = new Html( 'div' );
$this->domBottomMiddleContainer = new Html( 'div' );
//$this->domBottomRigthContainer = new Html( 'div' );
$this->domContainerBody = new Html( 'div' );
foreach( $this->globalMeta as $metaName => $metaContent )
$this->setHeadMeta( $metaName ,$metaContent );
$this->htmlsHead[] = new HtmlLink ( array(
'rel' => 'stylesheet'
,'type' => 'text/css'
,'media' => 'all'
,'href' => $this->cssW3Cfolder.'/w3.css'
) );
$this->htmlsHead[] = new HtmlLink ( array(
'rel' => 'stylesheet'
,'type' => 'text/css'
,'media' => 'all'
,'href' => $this->cssW3Cfolder.'/w3colors.css'
) );
$this->htmlsHead[] = new HtmlLink ( array(
'rel' => 'stylesheet'
,'type' => 'text/css'
,'media' => 'all'
,'href' => $this->cssW3Cfolder.'/../../icon-font/css/dashicons.css'
) );
$this->htmlLinkTheme = new HtmlLink ( array(
'rel' => 'stylesheet'
,'type' => 'text/css'
,'media' => 'all'
//,'href' => $this->cssW3Cfolder.'/themes/'.self::$themes[rand ( 0 , count(self::$themes) - 1 )].'.css'
) );
$this->htmlsHead[] = new HtmlLink ( array(
'rel' => 'stylesheet'
,'type' => 'text/css'
,'media' => 'all'
,'href' => $this->cssW3Cfolder.'/../../style.css'
) );
$this->htmlsHead[] = new HtmlLink ( array(
'rel' => 'stylesheet'
,'type' => 'text/css'
,'media' => 'print'
,'href' => $this->cssW3Cfolder.'/print.css'
) );
$this->domJsonRefObj = new Html( "script" );
$this->htmlsHead[] = $this->domJsonRefObj;
parent::__construct( $title );
$this->clear();
}
public function littleClear() : void {
$this->domContainerHead->clear();
$this->domContainerHead->setParams( array( 'class' => 'w3-noprint w3-container w3-top w3-row w3-theme', 'style' => "height:50px;" ) );
$this->htmlContent->clear();
$this->htmlContent->setParam( "class" ,"w3-container" );
}
public function randomTheme() : void {
$this->setTheme( rand ( 0 , count(self::$themes) - 1 ) );
}
public function setTheme( int $idxTheme ) : void {
$this->addLog( __METHOD__.":".$idxTheme );
$this->htmlLinkTheme->setParam( 'href' ,$this->cssW3Cfolder.'/themes/'.self::$themes[$idxTheme].'.css' );
}
///*
public function clear( ) : void {
$this->addLog( __METHOD__ );
$this->randomTheme();
$this->domContainerFoot->clear();
$this->domContainerFoot->setParams( array('class' => 'w3-noprint w3-container w3-bottom w3-row w3-theme-d5', 'style' => "height:50px;" ) );
/*********************** BOTTOM ******************/
/*
$this->domBottomLeftContainer->clear();
$this->domBottomLeftContainer->setParam( 'class' ,'w3-col s1 w3-center' );
$this->domBottomLeftContainer->add(" ");
//*/
$this->domBottomMiddleContainer->clear();
$this->domBottomMiddleContainer->setParam( 'class' ,'w3-col s12 w3-center' );
/*
$this->domBottomRigthContainer->clear();
$this->domBottomRigthContainer->setParam( 'class' ,'w3-col s1 w3-center' );
$this->domBottomRigthContainer->add(" ");
//*/
/************************* BODY **************************/
$this->domContainerBody->clear();
$this->domContainerBody->setParam( 'class' ,'w3-container' );
$this->domContainerBody->setParam( 'style' ,'margin-top:50px;margin-bottom:50px;' );
$this->littleClear();
parent::clear();
$this->initFooterLink();
}
/*
protected function execute(
\bakuba\kernel\application\controller\DwControllerConnexion $dwControllerConnexion
) : void {
parent::execute( $dwControllerConnexion );
}
//*/
public function initHeader() : void {
parent::initHeader();
foreach( $this->htmlsHead as $htmlHead )
$this->addToHead( $htmlHead );
$this->addToHead( $this->htmlLinkTheme );
}
protected function initBodyHeader() {
parent::addToBody( $this->domContainerHead );
//$this->w3cHeaderTitle( $this->getTitle() );
}
protected function headerTitle ( $headerTitle ) {
$domH3Title = new Html( "h3" ,array( 'class' => 'w3-center' ) );
$this->domContainerHead->add( $domH3Title );
$domH3Title->add( $headerTitle );
}
private function initBodyFoot() {
parent::addToBody( $this->domContainerFoot );
//$this->domContainerFoot->add( $this->domBottomLeftContainer );
$this->domContainerFoot->add( $this->domBottomMiddleContainer );
//$this->domContainerFoot->add( $this->domBottomRigthContainer );
//$this->footerTitle( $this->getTitle() );
}
protected function footerTitle( string $footerTitle ) {
$this->domBottomMiddleContainer->clear();
$this->domBottomMiddleContainer->setParam( 'class' ,'w3-col s12 w3-center' );
$domH3Title = new Html( "h3" ,array( 'class' => 'w3-center' ) );
$this->domBottomMiddleContainer->add( $domH3Title );
$domH3Title->add( $footerTitle );
}
public function initBody() : void {
parent::initBody( );
$this->paramsBody( array( "class" => "w3-page w3-theme-l3" ) );
$this->initBodyHeader();
parent::addToBody( $this->domContainerBody );
$this->initBodyFoot();
$this->domBottomMiddleContainer->clear();
$this->domBottomMiddleContainer->setParam( 'class' ,'w3-col s12 w3-center' );
$this->domBottomMiddleContainer->add( $this->ulFooterLink );
if ( is_object( $this->htmlLog ) )
$this->domContainerBody->add( $this->htmlLog );
$this->domContainerBody->add( $this->htmlContent );
}
public function addToBody( $html ) : void {
$this->htmlContent->add( $html );
}
public function parseToBody( string $fileToParse ,array $keys = null ,array $values = null ) : void {
$content = $this->getFile( $fileToParse );
if ( is_null( $content ) ) $content=" no file[ {$this->pageRootFolder} ]:$fileToParse";
$this->addToBody( \darkphp\template\Template::parse( $content ,$keys ,$values ) );
}
private $htmlLog = null;
protected function enableLog( ) : void {
$this->htmlLog = new Html( "div" ,array('class' => 'w3-container' ) );
$this->htmlLog->add( "Debug Message :
" );
parent::enableLog();
}
protected function addLog( $logComment ) : void {
//if ( is_null( $this->htmlLog ) )
parent::addLog( $logComment );
//else
if ( is_object( $this->htmlLog ) ) {
$this->htmlLog->add( \date(\DATE_RFC2822) );
$this->htmlLog->add( " === ".$logComment );
$this->htmlLog->add( "
" );
}
}
public function getClassName( bool $fqcn=null ) : string {
return self::getStaticClassName( $fqcn );
}
public static function getStaticClassName( bool $fqcn=null ) : string {
return $fqcn ? parent::getStaticClassName( $fqcn ).self::CLASS_SEPARATOR.__CLASS__ : __CLASS__;
}
}