removed pokemon

This commit is contained in:
Florian Bouillon 2018-12-03 13:41:25 +01:00
parent 66e357d009
commit 589506478b
9 changed files with 259 additions and 150 deletions

@ -1 +0,0 @@
Subproject commit 8147e64108216ba18cc7d1b73be0530dcf265f1a

View File

@ -0,0 +1,141 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/******************************
* Fin reset.css
*****************************/
body{
margin: 0;
}
.nav_imie{
height: 40px;
background-color: #1c1c1c;
}
.nav_blog{
height: 80px;
background-color: white;
}
.item_nav_imie{
display: inline-block;
padding-left: 20px;
padding-top: 10px;
color: white;
float: right;
font-family: 'Open Sans', sans-serif;
font-size: 16px;
font-weight: 600;
}
.item_nav_blog_gauche{
padding-top:25px;
vertical-align: center;
display: inline-block;
color: black;
float: left;
}
.item_nav_blog_droite{
padding-top: 20px;
display: inline-block;
color: black;
float: right;
}
#twi{
height: 18px;
width: 18px;
}
#fb{
height: 18px;
width: 9px;
}
#search{
background-color: transparent;
border: none;
width: 120px;
border-bottom: #1c1c1c solid 2px;
}
#glass{
height: 20px;
width: 20px;
margin-left: 8px;
}
@media screen and (max-width: 640px) {
.nav_imie {
height: 0;
}
.item_nav_imie{
font-size: 0;
}
#twi{
height: 0;
width: 0;
}
#fb{
height: 0;
width: 0;
}
}
@media screen and (max-width: 365px) {
#search{
background-color: transparent;
border: none;
width: 60px;
border-bottom: #1c1c1c solid 2px;
}
}

View File

@ -1,86 +0,0 @@
body{
margin: 0;
}
.nav_imie{
height: 40px;
background-color: #1c1c1c;
}
.nav_blog{
height: 80px;
background-color: white;
}
.item_nav_imie{
display: inline-block;
padding-left: 20px;
padding-top: 10px;
color: white;
float: right;
font-family: 'Open Sans', sans-serif;
font-size: 16px;
font-weight: 600;
}
.item_nav_blog_gauche{
padding-top:25px;
vertical-align: center;
display: inline-block;
color: black;
float: left;
}
.item_nav_blog_droite{
padding-top: 20px;
display: inline-block;
color: black;
float: right;
}
#twi{
height: 18px;
width: 18px;
}
#fb{
height: 18px;
width: 9px;
}
#search{
background-color: transparent;
border: none;
width: 120px;
border-bottom: #1c1c1c solid 2px;
}
#glass{
height: 20px;
width: 20px;
margin-left: 8px;
}
@media screen and (max-width: 640px) {
.nav_imie {
height: 0;
}
.item_nav_imie{
font-size: 0;
}
#twi{
height: 0;
width: 0;
}
#fb{
height: 0;
width: 0;
}
}
@media screen and (max-width: 365px) {
#search{
background-color: transparent;
border: none;
width: 60px;
border-bottom: #1c1c1c solid 2px;
}
}

View File

@ -1,8 +1,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Page Title</title> <title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" media="screen" href="main.css" /> <link rel="stylesheet" type="text/css" media="screen" href="/assets/css/style.css" />
<script src="main.js"></script>
</head> </head>

View File

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<header>
<tag type="includes" file="header" />
</header>
<footer>
<tag type="includes" file="footer" />
</footer>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>
<!-- é -->

View File

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<header>
<tag type="includes" file="header" />
</header>
<footer>
<tag type="includes" file="footer" />
</footer>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>
<!--

View File

@ -1,7 +1,27 @@
<?php <?php
/* Fichier qui va gerer la creation de la page et la redirection au cas ou */ /* Fichier qui va gerer la creation de la page et la redirection au cas ou */
ini_set('display_errors', 'On');
// var_dump($_SERVER);
if(endsWith($_GET["page"], ".css")) {
echo file_get_contents("../css/style.css");
die;
}
//si on cherche un fichier js
if(endsWith($_GET["page"], ".js")) {
echo file_get_contents("../js/script.js");
die;
}
//rajout d'un / a la fin (parceque c'est jolie)
if($_GET["page"] != "" && !endsWith($_GET["page"], "/")) {
header("Location: /".$_GET["page"]."/");
die;
}
$_GET['page'] = trim($_GET['page'], '/'); $_GET['page'] = trim($_GET['page'], '/');
$_GET['page'] = explode('/', $_GET['page'])[0]; $_GET['page'] = explode('/', $_GET['page'])[0];
@ -9,11 +29,88 @@ if($_GET['page'] == '') {
$_GET['page'] = 'index'; $_GET['page'] = 'index';
} }
// é
// var_dump($_POST); // var_dump($_POST);
// var_dump($_GET); // var_dump($_GET);
// die;
include_once "tagHandler.php"; include_once "tagHandler.php";
$pokemon = loadTags("../html/".$_GET["page"].".html", false); $pokemon = loadTags("../html/".$_GET["page"].".html", false);
$pokemon = mb_convert_encoding($pokemon, "utf-16"); // var_dump(mb_detect_encoding($pokemon));
$pokemon = htmlspecialchars_decode($pokemon, ENT_HTML5);
echo $pokemon; echo $pokemon;
// echo mb_convert_encoding($pokemon, "ascii"); // var_dump(mb_detect_encoding($pokemon));
function endsWith($haystack, $needle)
{
$length = strlen($needle);
if ($length == 0) {
return true;
}
return (substr($haystack, -$length) === $needle);
}
/**
* classe Pages
* a constructor to load additionnal pages and initialize the whole class and load the pages
*/
/**
* Class Pages
*
* attributes
* pageList : Array
*
* functions
*
* __construct($pages = array())
* # load the pages list from db and static files (index/search)
* loadPage($url)
* # return a class of type Page (see below)
*/
/**
* class Page
* contain the Page to load (on init only a light version but when using loadPage the whole page is in the class)
* here it contains three extended classes (Index/Search/Post where we will add functions to the loadPage)
*/
/**
* abstract Class Page
*
* attributes
* id
* title
* regex
* content
* isLoaded: boolean
*
* functions:
* __construct(id, title, regex)
* absract loadPage()
*
*/
/**
* class Post
* contains a post
* with basics informations at first and when loadPost is launche the whole class will be usable
*/
/**
* class Post
*
* attributes
* id
* authorName
* authorLinkedin
* content
* isloaded: false
*
* __construct(id);
*
* loadPost()
*
*/

View File

@ -3,12 +3,11 @@
* <tag type="pokemon" arg="pokemongo"><div class="pokemon-item"></div></tag> * <tag type="pokemon" arg="pokemongo"><div class="pokemon-item"></div></tag>
*/ */
ini_set('display_errors', 'On');
$debug = false; $debug = false;
class tag { class Tag {
private $DOM; private $DOM;
private $doc; private $doc;
@ -38,7 +37,7 @@ class tag {
//input <tag type="bold">test</tag> //input <tag type="bold">test</tag>
//result <span style="font-weight: bold">test</span> //result <span style="font-weight: bold">test</span>
class bold extends tag { class Bold extends Tag {
public function render() { public function render() {
//recuperation de la balise de base (<tag type="bold">pouet</tag>) //recuperation de la balise de base (<tag type="bold">pouet</tag>)
$pok = $this->getDOM(); $pok = $this->getDOM();
@ -56,12 +55,11 @@ class bold extends tag {
//enfin on met la div final dans le fichier //enfin on met la div final dans le fichier
$pok->parentNode->insertBefore($res, $pok); $pok->parentNode->insertBefore($res, $pok);
} }
} }
//inputs <tag type="article" column="(voir les collones de la table post) //inputs <tag type="article" column="(voir les collones de la table post)
//return #text //return #text
class article extends tag { class Article extends Tag {
public function render() { public function render() {
$post = array( //testing purpose $post = array( //testing purpose
@ -87,16 +85,13 @@ class article extends tag {
$txt = $doc->createTextNode($post[$attr]); $txt = $doc->createTextNode($post[$attr]);
$pok->parentNode->insertBefore($txt, $pok); $pok->parentNode->insertBefore($txt, $pok);
} }
} }
} }
/** /**
* return element is user * return element is user
*/ */
class isLoggedIn extends tag { class IsLoggedIn extends Tag {
public function render() { public function render() {
$el = $this->getDOM(); $el = $this->getDOM();
@ -104,20 +99,19 @@ class isLoggedIn extends tag {
//debugging purpose //debugging purpose
$loggedin = false; $loggedin = false;
foreach ($el->getElementsByTagName("if") as $element) { foreach ($el->getElementsByTagName("if") as $element) {
if($element->hasAttribute("true") && $loggedin){ if($element->hasAttribute("true") && $loggedin) {
$r = $element->childNodes->item(1); $r = $element->childNodes->item(1);
$el->parentNode->insertBefore($r, $el); $el->parentNode->insertBefore($r, $el);
} elseif ($element->hasAttribute("false")) { } elseif ($element->hasAttribute("false")) {
$r = $element->childNodes->item(1); $r = $element->childNodes->item(1);
$el->parentNode->insertBefore($r, $el); $el->parentNode->insertBefore($r, $el);
}
} }
}
} }
} }
class author extends tag { class Author extends Tag {
public function render() { public function render() {
$post = array( //testing purpose $post = array( //testing purpose
@ -136,11 +130,10 @@ class author extends tag {
$txt = $doc->createTextNode($post[$attr]); $txt = $doc->createTextNode($post[$attr]);
$pok->parentNode->insertBefore($txt, $pok); $pok->parentNode->insertBefore($txt, $pok);
} }
} }
class includes extends tag { class Includes extends Tag {
public function render() { public function render() {
$el = $this->getDOM(); $el = $this->getDOM();
$doc = $this->getDoc(); $doc = $this->getDoc();
@ -148,7 +141,6 @@ class includes extends tag {
$t = $doc->createDocumentFragment(); $t = $doc->createDocumentFragment();
$p = file_get_contents("../html/includes/".$attr.".html"); $p = file_get_contents("../html/includes/".$attr.".html");
appendHTML($el->parentNode, $p); appendHTML($el->parentNode, $p);
} }
} }
@ -156,7 +148,7 @@ class includes extends tag {
/** /**
* input <tag type="loop" for="(table)" limit="(nombre-max généré)"> * input <tag type="loop" for="(table)" limit="(nombre-max généré)">
*/ */
class loop extends tag { class Loop extends Tag {
public function render() { public function render() {
$el = $this->getDOM(); $el = $this->getDOM();
@ -210,7 +202,6 @@ class loop extends tag {
$elements = $pok->getElementsByTagName("loop"); $elements = $pok->getElementsByTagName("loop");
foreach ($elements as $ele) { foreach ($elements as $ele) {
if($ele->getAttribute("column") == "content") { if($ele->getAttribute("column") == "content") {
appendHTML($ele, $posts[$i][$ele->getAttribute("column")]); appendHTML($ele, $posts[$i][$ele->getAttribute("column")]);
} else { } else {
@ -260,7 +251,7 @@ function loadTags($ctnt, $debug) {
for ($i=0; $i < $list->count(); $i++) { for ($i=0; $i < $list->count(); $i++) {
$lst = $list->item($i); $lst = $list->item($i);
$tgs = $lst->getAttribute("type"); $tgs = ucfirst($lst->getAttribute("type"));
$tg = new $tgs($dom, $lst, $debug); $tg = new $tgs($dom, $lst, $debug);

View File

@ -11,4 +11,4 @@
</rule> </rule>
</ruleset> </ruleset>