From 1b6f5e650fa774cda77d511bf4cbdc638a2b42f6 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Thu, 12 Apr 2018 16:54:59 +0200 Subject: delete_update_media_blank --- class/class.aff.php | 109 +++++++++++++++++++++++++++++++++++----------------- class/class.app.php | 6 ++- class/class.art.php | 23 +++++++++-- 3 files changed, 98 insertions(+), 40 deletions(-) (limited to 'class') diff --git a/class/class.aff.php b/class/class.aff.php index 46402f4..16d77ca 100644 --- a/class/class.aff.php +++ b/class/class.aff.php @@ -35,11 +35,15 @@ class Aff a { color: couleurlien() ?>; } + + a[target="_blank"] { + color: couleurlienblank() ?>; + } css() ?>

titre() ?>

-

soustitre() ?>

+
soustitre() ?>

html('html') ?>

-
- + @@ -77,12 +80,16 @@ class Aff + + - - +
+ + +
@@ -97,6 +104,7 @@ public function head($title) ?> + <?= $title ?> @@ -109,16 +117,25 @@ public function head($title) public function home($list) { - echo ' '; } public function tag($getlist, $tag) @@ -156,40 +173,62 @@ public function head($title) bdd->prepare('INSERT INTO art(id, titre, soustitre, intro, tag, datecreation, datemodif, css, html, secure, couleurtext, couleurbkg, couleurlien) VALUES(:id, :titre, :soustitre, :intro, :tag, :datecreation, :datemodif, :css, :html, :secure, :couleurtext, :couleurbkg, :couleurlien)'); + $q = $this->bdd->prepare('INSERT INTO art(id, titre, soustitre, intro, tag, datecreation, datemodif, css, html, secure, couleurtext, couleurbkg, couleurlien, couleurlienblank) VALUES(:id, :titre, :soustitre, :intro, :tag, :datecreation, :datemodif, :css, :html, :secure, :couleurtext, :couleurbkg, :couleurlien, :couleurlienblank)'); $q->bindValue(':id', $art->id()); $q->bindValue(':titre', $art->titre()); @@ -41,6 +41,7 @@ class App $q->bindValue(':couleurtext', $art->couleurtext()); $q->bindValue(':couleurbkg', $art->couleurbkg()); $q->bindValue(':couleurlien', $art->couleurlien()); + $q->bindValue(':couleurlienblank', $art->couleurlienblank()); $q->execute(); } @@ -104,7 +105,7 @@ class App { $now = new DateTimeImmutable(null, timezone_open("Europe/Paris")); - $q = $this->bdd->prepare('UPDATE art SET titre = :titre, soustitre = :soustitre, intro = :intro, tag = :tag, datecreation = :datecreation, datemodif = :datemodif, css = :css, html = :html, secure = :secure, couleurtext = :couleurtext, couleurbkg = :couleurbkg, couleurlien = :couleurlien WHERE id = :id'); + $q = $this->bdd->prepare('UPDATE art SET titre = :titre, soustitre = :soustitre, intro = :intro, tag = :tag, datecreation = :datecreation, datemodif = :datemodif, css = :css, html = :html, secure = :secure, couleurtext = :couleurtext, couleurbkg = :couleurbkg, couleurlien = :couleurlien, couleurlienblank = :couleurlienblank WHERE id = :id'); $q->bindValue(':id', $art->id()); $q->bindValue(':titre', $art->titre()); @@ -119,6 +120,7 @@ class App $q->bindValue(':couleurtext', $art->couleurtext()); $q->bindValue(':couleurbkg', $art->couleurbkg()); $q->bindValue(':couleurlien', $art->couleurlien()); + $q->bindValue(':couleurlienblank', $art->couleurlienblank()); $q->execute(); } diff --git a/class/class.art.php b/class/class.art.php index 897cd0b..f945767 100644 --- a/class/class.art.php +++ b/class/class.art.php @@ -53,7 +53,8 @@ class Art $this->setintro('resumé'); $this->settag('sans tag,'); $this->setdatecreation($now); - $this->setcss('article {}'); + $this->setcss('article {} +a:hover {}'); $this->sethtml('contenu'); $this->setsecure(2); $this->setcouleurtext('#000000'); @@ -123,8 +124,11 @@ class Art return $this->html; } elseif ($option == 'html') { $html = MarkdownExtra::defaultTransform($this->html); - $htmla = str_replace('class="b"', ' target="_blank" ', $html); - return $htmla; + $htmla = str_replace('href="http://', ' class="external" target="_blank" href="http://', $html); + + $htmla = str_replace('class="b"', ' target="_blank" ', $htmla); + $htmlmedia = str_replace('src="/', 'src="../media/', $htmla); + return $htmlmedia; } } @@ -148,6 +152,11 @@ class Art return $this->couleurlien; } + public function couleurlienblank() + { + return $this->couleurlienblank; + } + // _____________________________________________________ S E T ____________________________________________________ @@ -252,6 +261,14 @@ class Art } } + public function setcouleurlienblank($couleurlienblank) + { + $couleurlienblank = strval($couleurlienblank); + if (strlen($couleurlienblank) <= self::$lencouleur) { + $this->couleurlienblank = strip_tags(trim($couleurlienblank)); + } + } + } -- cgit v1.2.3