|
1
|
|
|
<?php |
|
2
|
|
|
namespace core\contenus; |
|
3
|
|
|
|
|
4
|
|
|
use core\App; |
|
5
|
|
|
use core\functions\ChaineCaractere; |
|
6
|
|
|
use core\RedirectError; |
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
class Contenus { |
|
10
|
|
|
//pour la table page |
|
11
|
|
|
protected $id_page; |
|
12
|
|
|
protected $titre; |
|
13
|
|
|
protected $contenu; |
|
14
|
|
|
protected $url; |
|
15
|
|
|
protected $meta_description; |
|
16
|
|
|
protected $balise_title; |
|
17
|
|
|
protected $parent; |
|
18
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
|
|
21
|
|
|
//-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------// |
|
22
|
|
|
public function __construct($url, $admin_contenu = null) { |
|
23
|
|
|
$dbc = \core\App::getDb(); |
|
24
|
|
|
|
|
25
|
|
|
if ($admin_contenu === null) { |
|
26
|
|
|
$query = $dbc->select()->from("page")->where("url", "=", $url)->get(); |
|
27
|
|
|
|
|
28
|
|
|
if (RedirectError::testRedirect404($query, $url) === true) { |
|
29
|
|
|
foreach ($query as $obj) { |
|
30
|
|
|
$redirect = 0; |
|
31
|
|
|
if (ChaineCaractere::FindInString($url, "http://") === true) { |
|
32
|
|
|
$redirect = 1; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
App::setValues(["contenus" => [ |
|
36
|
|
|
"id_page" => $this->id_page = $obj->ID_page, |
|
37
|
|
|
"meta_description" => $this->meta_description = $obj->meta_description, |
|
38
|
|
|
"balise_title" => $this->balise_title = $obj->balise_title, |
|
39
|
|
|
"url" => $this->url = $obj->url, |
|
40
|
|
|
"titre" => $this->titre = $obj->titre, |
|
41
|
|
|
"contenu" => $this->contenu = $obj->contenu, |
|
42
|
|
|
"parent" => $this->parent = $obj->parent, |
|
43
|
|
|
"redirect_page" => $redirect |
|
44
|
|
|
]]); |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
//-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------// |
|
50
|
|
|
|
|
51
|
|
|
|
|
52
|
|
|
|
|
53
|
|
|
//-------------------------- GETTER ----------------------------------------------------------------------------// |
|
54
|
|
|
//pour la table page |
|
55
|
|
|
public function getIdPage() { |
|
56
|
|
|
return $this->id_page; |
|
57
|
|
|
} |
|
58
|
|
|
public function getTitre() { |
|
59
|
|
|
return $this->titre; |
|
60
|
|
|
} |
|
61
|
|
|
public function getContenu() { |
|
62
|
|
|
return $this->contenu; |
|
63
|
|
|
} |
|
64
|
|
|
public function getUrl() { |
|
65
|
|
|
return $this->url; |
|
66
|
|
|
} |
|
67
|
|
|
public function getMetaDescription() { |
|
68
|
|
|
return $this->meta_description; |
|
69
|
|
|
} |
|
70
|
|
|
public function getBaliseTitle() { |
|
71
|
|
|
return $this->balise_title; |
|
72
|
|
|
} |
|
73
|
|
|
public function getParent() { |
|
74
|
|
|
return $this->parent; |
|
75
|
|
|
} |
|
76
|
|
|
//-------------------------- FIN GETTER ----------------------------------------------------------------------------// |
|
77
|
|
|
|
|
78
|
|
|
|
|
79
|
|
|
|
|
80
|
|
|
//-------------------------- SETTER ----------------------------------------------------------------------------// |
|
81
|
|
|
//-------------------------- FIN SETTER ----------------------------------------------------------------------------// |
|
82
|
|
|
} |