-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhed_classes.php
executable file
·116 lines (96 loc) · 2.34 KB
/
hed_classes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
include "credentials.inc";
class getDBConnect {
private $dbConnect = "";
public function __construct($dbhost, $dbuser, $dbpassword, $dbdb) {
$dbConnect = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbdb) or die("can't connect to db");
return $dbConnect;
}
public function closeDB() {
mysqli::close();
}
}
class Headlines {
private $heds;
private $deks;
private $urls;
public function __construct($setheds, $seturls, $setdeks) {
try {
$this->setHeds($setheds);
$this->setUrls($seturls);
$this->setDeks($setdeks);
//throw new Exception("can't set private variables<br />");
}
catch(Exception $e) {
print "threw an exception in the class";
print $e->getMessage();
}
}
//getter functions
public function getHeds() {
return $this->heds;
}
public function getDeks() {
return $this->deks;
}
public function getUrls() {
return $this->urls;
}
//setter functions
private function setHeds($setheds) {
$this->heds = $setheds;
}
private function setDeks($setdeks) {
$this->deks = $setdeks;
}
private function setUrls($seturls) {
$this->urls = $seturls;
}
}
class HeadlinesWrapper {
private $main_div;
private $div_close;
public function __construct() {
$this->setTable("<table id='main' style='margin:5px auto;width:640px;border:2px #cccccc solid;'>");
$this->setCloseTable("</table>");
}
private function setTable($main_div_code){
$this->main_div = $main_div_code;
}
private function setCloseTable($close_div) {
$this->div_close = $close_div;
}
public function getTable() {
return $this->main_div;
}
public function getCloseTable() {
return $this->div_close;
}
public function getCloseTr() {
return "</tr>";
}
public function getCloseTd() {
return "</td>";
}
public function getOpenTr() {
return "<tr>";
}
public function getOpenTd() {
return "<td>";
}
public function getHeaderSection() {
$header_sect = "<div style='width:638px;margin:0 0 5px 0;'>";
return $header_sect;
}
public function getSectionDiv() {
$sect_div = "<div style='width:319px;padding:0 10px;'>";
return $sect_div;
}
public function getCloseSection() {
$close_sect = "</div>";
return $close_sect;
}
}
?>