1 | <?php namespace Arcanedev\LaravelDisqus; |
||
12 | class Disqus implements DisqusContract |
||
13 | { |
||
14 | /* ------------------------------------------------------------------------------------------------ |
||
15 | | Properties |
||
16 | | ------------------------------------------------------------------------------------------------ |
||
17 | */ |
||
18 | /** |
||
19 | * The Username property. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $username = ''; |
||
24 | |||
25 | /** |
||
26 | * The Page URL property. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $pageUrl = ''; |
||
31 | |||
32 | /** |
||
33 | * The Page ID property. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $pageId = ''; |
||
38 | |||
39 | /** |
||
40 | * The Language property. |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $language; |
||
45 | |||
46 | /** |
||
47 | * Disqus enabled status. |
||
48 | * |
||
49 | * @var bool |
||
50 | */ |
||
51 | protected $enabled = false; |
||
52 | |||
53 | /* ------------------------------------------------------------------------------------------------ |
||
54 | | Constructor |
||
55 | | ------------------------------------------------------------------------------------------------ |
||
56 | */ |
||
57 | /** |
||
58 | * Disqus constructor. |
||
59 | * |
||
60 | * @param array $options |
||
61 | */ |
||
62 | 120 | public function __construct(array $options = []) |
|
67 | |||
68 | /* ------------------------------------------------------------------------------------------------ |
||
69 | | Getters & Setters |
||
70 | | ------------------------------------------------------------------------------------------------ |
||
71 | */ |
||
72 | /** |
||
73 | * Get the disqus's username property. |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | 24 | public function username() |
|
81 | |||
82 | /** |
||
83 | * Set the disqus's username property. |
||
84 | * |
||
85 | * @param string $username |
||
86 | * |
||
87 | * @return self |
||
88 | */ |
||
89 | 120 | public function setUsername($username) |
|
95 | |||
96 | /** |
||
97 | * Get the Page URL. |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | 36 | public function pageUrl() |
|
105 | |||
106 | /** |
||
107 | * Set the Page URL. |
||
108 | * |
||
109 | * @param string $pageUrl |
||
110 | * |
||
111 | * @return self |
||
112 | */ |
||
113 | 36 | public function setPageUrl($pageUrl) |
|
119 | |||
120 | /** |
||
121 | * Get the Page ID. |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | 36 | public function pageId() |
|
129 | |||
130 | /** |
||
131 | * Set the Page ID. |
||
132 | * |
||
133 | * @param string $pageId |
||
134 | * |
||
135 | * @return self |
||
136 | */ |
||
137 | 36 | public function setPageId($pageId) |
|
143 | |||
144 | /** |
||
145 | * Get the language. |
||
146 | * |
||
147 | * @return string |
||
148 | */ |
||
149 | 24 | public function language() |
|
153 | |||
154 | /** |
||
155 | * Set the language. |
||
156 | * |
||
157 | * @param string $language |
||
158 | * |
||
159 | * @return self |
||
160 | */ |
||
161 | 120 | public function setLanguage($language) |
|
167 | |||
168 | /** |
||
169 | * Set the disqus's enabled property. |
||
170 | * |
||
171 | * @param bool $enabled |
||
172 | * |
||
173 | * @return self |
||
174 | */ |
||
175 | 120 | public function setEnabled($enabled) |
|
181 | |||
182 | /* ------------------------------------------------------------------------------------------------ |
||
183 | | Main Functions |
||
184 | | ------------------------------------------------------------------------------------------------ |
||
185 | */ |
||
186 | /** |
||
187 | * Render the Disqus thread. |
||
188 | * |
||
189 | * @return \Illuminate\Support\HtmlString |
||
190 | */ |
||
191 | 12 | public function render() |
|
197 | |||
198 | /** |
||
199 | * Generate Disqus js script. |
||
200 | * |
||
201 | * @return \Illuminate\Support\HtmlString |
||
202 | */ |
||
203 | 12 | public function script() |
|
211 | |||
212 | /** |
||
213 | * Enable Disqus. |
||
214 | * |
||
215 | * @return self |
||
216 | */ |
||
217 | 48 | public function enable() |
|
221 | |||
222 | /** |
||
223 | * Disable Disqus. |
||
224 | * |
||
225 | * @return self |
||
226 | */ |
||
227 | 12 | public function disable() |
|
231 | |||
232 | /** |
||
233 | * Check if Disqus is enabled. |
||
234 | * |
||
235 | * @return bool |
||
236 | */ |
||
237 | 72 | public function isEnabled() |
|
241 | |||
242 | /* ------------------------------------------------------------------------------------------------ |
||
243 | | Other Functions |
||
244 | | ------------------------------------------------------------------------------------------------ |
||
245 | */ |
||
246 | /** |
||
247 | * Convert the string content to Html Object. |
||
248 | * |
||
249 | * @param string $content |
||
250 | * |
||
251 | * @return \Illuminate\Support\HtmlString |
||
252 | */ |
||
253 | 24 | protected function toHtml($content) |
|
257 | |||
258 | /** |
||
259 | * Get the script parameters. |
||
260 | * |
||
261 | * @return array |
||
262 | */ |
||
263 | 12 | private function getScriptParams() |
|
272 | } |
||
273 |