Carbon_Pagination_HTML::get_current_number_html()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
/**
3
 * The Carbon Pagination HTML class.
4
 * Contains and manages the pagination HTML settings.
5
 * Abstract, can be extended by all specific pagination types.
6
 *
7
 * @uses Carbon_Pagination
8
 */
9
abstract class Carbon_Pagination_HTML extends Carbon_Pagination {
10
11
	/**
12
	 * @var string Wrapper - before.
13
	 */
14
	protected $wrapper_before = '<div class="paging">';
15
16
	/**
17
	 * @var string Wrapper - after.
18
	 */
19
	protected $wrapper_after = '</div>';
20
21
	/**
22
	 * @var string The wrapper before the page number links (1, 2, 3, etc).
23
	 */
24
	protected $numbers_wrapper_before = '<ul>';
25
26
	/**
27
	 * @var string The wrapper after the page number links (1, 2, 3, etc).
28
	 */
29
	protected $numbers_wrapper_after = '</ul>';
30
31
	/**
32
	 * @var string 
33
	 * 
34
	 * The HTML of the previous page link. You can use the following tokens:
35
	 * - {URL} - the link URL
36
	 */
37
	protected $prev_html = '<a href="{URL}" class="paging-prev"></a>';
38
39
	/**
40
	 * @var string 
41
	 * 
42
	 * The HTML of the next page link. You can use the following tokens:
43
	 * - {URL} - the link URL
44
	 */
45
	protected $next_html = '<a href="{URL}" class="paging-next"></a>';
46
47
	/**
48
	 * @var string 
49
	 * 
50
	 * The HTML of the first page link. You can use the following tokens:
51
	 * - {URL} - the link URL
52
	 */
53
	protected $first_html = '<a href="{URL}" class="paging-first"></a>';
54
55
	/**
56
	 * @var string 
57
	 * 
58
	 * The HTML of the last page link. You can use the following tokens:
59
	 * - {URL} - the link URL
60
	 */
61
	protected $last_html = '<a href="{URL}" class="paging-last"></a>';
62
63
	/**
64
	 * @var string 
65
	 * 
66
	 * The HTML of the page number link. You can use the following tokens:
67
	 * - {URL} - the link URL
68
	 * - {PAGE_NUMBER} - the particular page number
69
	 */
70
	protected $number_html = '<li><a href="{URL}">{PAGE_NUMBER}</a></li>';
71
72
	/**
73
	 * @var string
74
	 * 
75
	 * The HTML of the current page number link. You can use the following tokens:
76
	 * - {URL} - the link URL
77
	 * - {PAGE_NUMBER} - the particular page number
78
	 */
79
	protected $current_number_html = '<li class="current"><a href="{URL}">{PAGE_NUMBER}</a></li>';
80
81
	/**
82
	 * @var string The HTML of limiter between page number links.
83
	 */
84
	protected $limiter_html = '<li class="paging-spacer">...</li>';
85
86
	/**
87
	 * @var string
88
	 * 
89
	 * The current page text HTML. You can use the following tokens:
90
	 * - {CURRENT_PAGE} - the current page number
91
	 * - {TOTAL_PAGES} - the total number of pages
92
	 */
93
	protected $current_page_html = '<span class="paging-label">Page {CURRENT_PAGE} of {TOTAL_PAGES}</span>';
94
95
	/**
96
	 * Retrieve the pagination wrapper - before.
97
	 * 
98
	 * @return string $wrapper_before The pagination wrapper - before.
99
	 */
100 1
	public function get_wrapper_before() {
101 1
		return $this->wrapper_before;
102
	}
103
104
	/**
105
	 * Modify the pagination wrapper - before.
106
	 * 
107
	 * @param string $wrapper_before The new pagination wrapper - before.
108
	 */
109 1
	public function set_wrapper_before( $wrapper_before ) {
110 1
		$this->wrapper_before = $wrapper_before;
111 1
	}
112
113
	/**
114
	 * Retrieve the pagination wrapper - after.
115
	 * 
116
	 * @return string $wrapper_after The pagination wrapper - after.
117
	 */
118 1
	public function get_wrapper_after() {
119 1
		return $this->wrapper_after;
120
	}
121
122
	/**
123
	 * Modify the pagination wrapper - after.
124
	 * 
125
	 * @param string $wrapper_after The new pagination wrapper - after.
126
	 */
127 1
	public function set_wrapper_after( $wrapper_after ) {
128 1
		$this->wrapper_after = $wrapper_after;
129 1
	}
130
131
	/**
132
	 * Retrieve the pagination numbers wrapper - before.
133
	 * 
134
	 * @return string $numbers_wrapper_before The pagination numbers wrapper - before.
135
	 */
136 1
	public function get_numbers_wrapper_before() {
137 1
		return $this->numbers_wrapper_before;
138
	}
139
140
	/**
141
	 * Modify the pagination numbers wrapper - before.
142
	 * 
143
	 * @param string $numbers_wrapper_before The new pagination numbers wrapper - before.
144
	 */
145 1
	public function set_numbers_wrapper_before( $numbers_wrapper_before ) {
146 1
		$this->numbers_wrapper_before = $numbers_wrapper_before;
147 1
	}
148
149
	/**
150
	 * Retrieve the pagination numbers wrapper - after.
151
	 * 
152
	 * @return string $numbers_wrapper_after The pagination numbers wrapper - after.
153
	 */
154 1
	public function get_numbers_wrapper_after() {
155 1
		return $this->numbers_wrapper_after;
156
	}
157
158
	/**
159
	 * Modify the pagination numbers wrapper - after.
160
	 * 
161
	 * @param string $numbers_wrapper_after The new pagination numbers wrapper - after.
162
	 */
163 1
	public function set_numbers_wrapper_after( $numbers_wrapper_after ) {
164 1
		$this->numbers_wrapper_after = $numbers_wrapper_after;
165 1
	}
166
167
	/**
168
	 * Retrieve the previous page link HTML.
169
	 * 
170
	 * @return string $prev_html The previous page link HTML.
171
	 */
172 1
	public function get_prev_html() {
173 1
		return $this->prev_html;
174
	}
175
176
	/**
177
	 * Modify the previous page link HTML.
178
	 * 
179
	 * @param string $prev_html The new previous page link HTML.
180
	 */
181 1
	public function set_prev_html( $prev_html ) {
182 1
		$this->prev_html = $prev_html;
183 1
	}
184
185
	/**
186
	 * Retrieve the next page link HTML.
187
	 * 
188
	 * @return string $next_html The next page link HTML.
189
	 */
190 1
	public function get_next_html() {
191 1
		return $this->next_html;
192
	}
193
194
	/**
195
	 * Modify the next page link HTML.
196
	 * 
197
	 * @param string $next_html The new next page link HTML.
198
	 */
199 1
	public function set_next_html( $next_html ) {
200 1
		$this->next_html = $next_html;
201 1
	}
202
203
	/**
204
	 * Retrieve the first page link HTML.
205
	 * 
206
	 * @return string $first_html The first page link HTML.
207
	 */
208 1
	public function get_first_html() {
209 1
		return $this->first_html;
210
	}
211
212
	/**
213
	 * Modify the first page link HTML.
214
	 * 
215
	 * @param string $first_html The new first page link HTML.
216
	 */
217 1
	public function set_first_html( $first_html ) {
218 1
		$this->first_html = $first_html;
219 1
	}
220
221
	/**
222
	 * Retrieve the last page link HTML.
223
	 * 
224
	 * @return string $last_html The last page link HTML.
225
	 */
226 1
	public function get_last_html() {
227 1
		return $this->last_html;
228
	}
229
230
	/**
231
	 * Modify the last page link HTML.
232
	 * 
233
	 * @param string $last_html The new last page link HTML.
234
	 */
235 1
	public function set_last_html( $last_html ) {
236 1
		$this->last_html = $last_html;
237 1
	}
238
239
	/**
240
	 * Retrieve the HTML of a page number link.
241
	 * 
242
	 * @return string $number_html The HTML of a page number link.
243
	 */
244 1
	public function get_number_html() {
245 1
		return $this->number_html;
246
	}
247
248
	/**
249
	 * Modify the HTML of a page number link.
250
	 * 
251
	 * @param string $number_html The new HTML of a page number link.
252
	 */
253 1
	public function set_number_html( $number_html ) {
254 1
		$this->number_html = $number_html;
255 1
	}
256
257
	/**
258
	 * Retrieve the HTML of the current page number link.
259
	 * 
260
	 * @return string $current_number_html The HTML of the current page number link.
261
	 */
262 1
	public function get_current_number_html() {
263 1
		return $this->current_number_html;
264
	}
265
266
	/**
267
	 * Modify the HTML of the current page number link.
268
	 * 
269
	 * @param string $current_number_html The new HTML of the current page number link.
270
	 */
271 1
	public function set_current_number_html( $current_number_html ) {
272 1
		$this->current_number_html = $current_number_html;
273 1
	}
274
275
	/**
276
	 * Retrieve the HTML of a limiter.
277
	 * 
278
	 * @return string $limiter_html The HTML of a limiter.
279
	 */
280 1
	public function get_limiter_html() {
281 1
		return $this->limiter_html;
282
	}
283
284
	/**
285
	 * Modify the HTML of a limiter.
286
	 * 
287
	 * @param string $limiter_html The new HTML of a limiter.
288
	 */
289 1
	public function set_limiter_html( $limiter_html ) {
290 1
		$this->limiter_html = $limiter_html;
291 1
	}
292
293
	/**
294
	 * Retrieve the HTML of the current page text.
295
	 * 
296
	 * @return string $current_page_html The HTML of the current page text.
297
	 */
298 1
	public function get_current_page_html() {
299 1
		return $this->current_page_html;
300
	}
301
302
	/**
303
	 * Modify the HTML of the current page text.
304
	 * 
305
	 * @param string $current_page_html The new HTML of the current page text.
306
	 */
307 1
	public function set_current_page_html( $current_page_html ) {
308 1
		$this->current_page_html = $current_page_html;
309 1
	}
310
311
	/**
312
	 * Render the pagination.
313
	 * 
314
	 * @param bool $echo Whether to display or return the output. True will display, false will return.
315
	 */
316 2
	public function render( $echo = true ) {
317 2
		$presenter = new Carbon_Pagination_Presenter( $this );
318 2
		$output = $presenter->render();
319
320 2
		if ( ! $echo ) {
321 1
			return $output;
322
		}
323
		
324 1
		echo wp_kses( $output, wp_kses_allowed_html( 'post' ) );
325 1
	}
326
327
}