@@ -21,7 +21,9 @@ class UserProfile {
21
21
protected $ id ;
22
22
protected $ instagram_username ;
23
23
protected $ phone ;
24
+ protected $ reddit_username ;
24
25
protected $ skype_username ;
26
+ protected $ steam_id ;
25
27
protected $ twitter_username ;
26
28
protected $ website ;
27
29
@@ -33,7 +35,9 @@ public function __construct($data) {
33
35
$ this ->id = (int ) $ data ;
34
36
$ this ->instagram_username = null ;
35
37
$ this ->phone = null ;
38
+ $ this ->reddit_username = null ;
36
39
$ this ->skype_username = null ;
40
+ $ this ->steam_id = null ;
37
41
$ this ->twitter_username = null ;
38
42
$ this ->website = null ;
39
43
$ this ->refresh ();
@@ -45,7 +49,9 @@ public function __construct($data) {
45
49
$ this ->id = $ data ->id ;
46
50
$ this ->instagram_username = $ data ->instagram_username ;
47
51
$ this ->phone = $ data ->phone ;
52
+ $ this ->reddit_username = $ data ->reddit_username ;
48
53
$ this ->skype_username = $ data ->skype_username ;
54
+ $ this ->steam_id = $ data ->steam_id ;
49
55
$ this ->twitter_username = $ data ->twitter_username ;
50
56
$ this ->website = $ data ->website ;
51
57
} else {
@@ -57,10 +63,18 @@ public function getBiography() {
57
63
return $ this ->biography ;
58
64
}
59
65
66
+ public function getFacebookURI () {
67
+ return "https://www.facebook.com/ " . $ this ->getFacebookUsername ();
68
+ }
69
+
60
70
public function getFacebookUsername () {
61
71
return $ this ->facebook_username ;
62
72
}
63
73
74
+ public function getGitHubURI () {
75
+ return "https://github.com/ " . $ this ->getGitHubUsername ();
76
+ }
77
+
64
78
public function getGitHubUsername () {
65
79
return $ this ->github_username ;
66
80
}
@@ -69,6 +83,10 @@ public function getId() {
69
83
return $ this ->id ;
70
84
}
71
85
86
+ public function getInstagramURI () {
87
+ return "https://instagram.com/ " . $ this ->getInstagramUsername ();
88
+ }
89
+
72
90
public function getInstagramUsername () {
73
91
return $ this ->instagram_username ;
74
92
}
@@ -77,20 +95,66 @@ public function getPhone() {
77
95
return $ this ->phone ;
78
96
}
79
97
98
+ public function getPhoneURI () {
99
+ return "tel:// " . $ this ->getPhone ();
100
+ }
101
+
102
+ public function getRedditURI () {
103
+ return "https://www.reddit.com/user/ " . $ this ->getRedditUsername ();
104
+ }
105
+
106
+ public function getRedditUsername () {
107
+ return $ this ->reddit_username ;
108
+ }
109
+
110
+ public function getSkypeURI () {
111
+ return "skype: " . $ this ->getSkypeUsername () . "?chat " ;
112
+ }
113
+
80
114
public function getSkypeUsername () {
81
115
return $ this ->skype_username ;
82
116
}
83
117
118
+ public function getSteamId () {
119
+ return $ this ->steam_id ;
120
+ }
121
+
122
+ public function getSteamURI () {
123
+ return "https://steamcommunity.com/profiles/ " . $ this ->getSteamId ();
124
+ }
125
+
126
+ public function getTwitterURI () {
127
+ return "https://twitter.com/ " . $ this ->getTwitterUsername ();
128
+ }
129
+
84
130
public function getTwitterUsername () {
85
131
return $ this ->twitter_username ;
86
132
}
87
133
88
134
public function getWebsite () {
89
- return $ this ->website ;
135
+ $ value = strtolower ($ this ->website );
136
+ if (substr ($ value , 0 , 7 ) == "http:// " ) {
137
+ return substr ($ value , 7 );
138
+ } else if (substr ($ value , 0 , 8 ) == "https:// " ) {
139
+ return substr ($ value , 8 );
140
+ } else {
141
+ return "http:// " . $ value ;
142
+ }
143
+ }
144
+
145
+ public function getWebsiteURI () {
146
+ $ value = strtolower ($ this ->website );
147
+ if (substr ($ value , 0 , 7 ) == "http:// "
148
+ || substr ($ value , 0 , 8 ) == "https:// " ) {
149
+ return $ value ;
150
+ } else {
151
+ return "http:// " . $ value ;
152
+ }
90
153
}
91
154
92
155
protected static function normalize (StdClass &$ data ) {
93
- $ data ->user_id = (int ) $ data ->user_id ;
156
+ $ data ->user_id = (int ) $ data ->user_id ;
157
+ $ data ->steam_id = (int ) $ data ->steam_id ;
94
158
95
159
if (!is_null ($ data ->biography ))
96
160
$ data ->biography = (string ) $ data ->biography ;
@@ -107,6 +171,9 @@ protected static function normalize(StdClass &$data) {
107
171
if (!is_null ($ data ->phone ))
108
172
$ data ->phone = (string ) $ data ->phone ;
109
173
174
+ if (!is_null ($ data ->reddit_username ))
175
+ $ data ->reddit_username = (string ) $ data ->reddit_username ;
176
+
110
177
if (!is_null ($ data ->skype_username ))
111
178
$ data ->skype_username = (string ) $ data ->skype_username ;
112
179
@@ -129,7 +196,9 @@ public function refresh() {
129
196
$ this ->github_username = $ cache_val ->github_username ;
130
197
$ this ->instagram_username = $ cache_val ->instagram_username ;
131
198
$ this ->phone = $ cache_val ->phone ;
199
+ $ this ->reddit_username = $ cache_val ->reddit_username ;
132
200
$ this ->skype_username = $ cache_val ->skype_username ;
201
+ $ this ->steam_id = $ cache_val ->steam_id ;
133
202
$ this ->twitter_username = $ cache_val ->twitter_username ;
134
203
$ this ->website = $ cache_val ->website ;
135
204
return true ;
@@ -143,11 +212,13 @@ public function refresh() {
143
212
`biography`,
144
213
`facebook_username`,
145
214
`github_username`,
146
- `user_id`,
147
215
`instagram_username`,
148
216
`phone`,
217
+ `reddit_username`,
149
218
`skype_username`,
219
+ `steam_id`,
150
220
`twitter_username`,
221
+ `user_id`,
151
222
`website`
152
223
FROM `user_profiles`
153
224
WHERE `user_id` = :id
@@ -167,7 +238,9 @@ public function refresh() {
167
238
$ this ->github_username = $ row ->github_username ;
168
239
$ this ->instagram_username = $ row ->instagram_username ;
169
240
$ this ->phone = $ row ->phone ;
241
+ $ this ->reddit_username = $ row ->reddit_username ;
170
242
$ this ->skype_username = $ row ->skype_username ;
243
+ $ this ->steam_id = $ row ->steam_id ;
171
244
$ this ->twitter_username = $ row ->twitter_username ;
172
245
$ this ->website = $ row ->website ;
173
246
Common::$ cache ->set ($ cache_key , serialize ($ row ), 300 );
0 commit comments