1717/**
1818 * Fires when new toots are loaded
1919 *
20- * This hook can be used by other plugins to process after load functions.
20+ * This action will be fired after toot update to execute custom post-processing.
2121 * For example: Cache Refresh
2222 *
2323 * @since 0.1
@@ -27,20 +27,6 @@ function tootpress_fire_toots_update() {
2727 do_action ( 'tootpress_toots_update ' );
2828}
2929
30- /**
31- * Action Example: tootpress_toots_update
32- *
33- * @since 0.4
34- *
35- * function tootpress_toots_update_postprocessing() {
36- *
37- * // Add your code to be executed here
38- *
39- * }
40- * add_action('tootpress_toots_update', 'tootpress_toots_update_postprocessing');
41- *
42- */
43-
4430/**
4531 * Filter
4632 */
@@ -52,79 +38,39 @@ function tootpress_fire_toots_update() {
5238 *
5339 * @since 0.4
5440 *
55- * @param string Unfiltered Preample
41+ * @param string Empty Preample
5642 * @return html Filtered Preample
5743 */
5844
5945function tootpress_preamble_filter_apply ($ preamble ) {
60- $ preamble. =apply_filters ( 'tootpress_preamble_filter ' , $ preamble );
46+ $ preamble =apply_filters ( 'tootpress_preamble_filter ' , $ preamble );
6147 return $ preamble ;
6248}
6349
64- /**
65- * Filter Example: tootpress_preamble_filter
66- *
67- * @since 0.4
68- *
69- * @param string Unfiltered Preample
70- * @return html Filtered Preample
71- *
72- * function tootpress_preamble_add( $preamble ) {
73- *
74- * // Add your filter code here
75- * // Example: $preamble='<p>Hello World.</p>';
76- *
77- * return $preamble;
78- *
79- * }
80- * add_filter( 'tootpress_preamble_filter', 'tootpress_preamble_add', 10, 1 );
81- *
82- */
83-
8450/**
8551 * Closing Filter
8652 *
8753 * This filter outputs content after the last toot loop.
8854 *
8955 * @since 0.5
9056 *
91- * @param string Content
57+ * @param string Empty Content
9258 * @return string Filtered Content
9359 */
9460
9561function tootpress_closing_filter_apply ($ content ) {
96- $ content. =apply_filters ( 'tootpress_closing_filter ' , $ content );
62+ $ content =apply_filters ( 'tootpress_closing_filter ' , $ content );
9763 return $ content ;
9864}
9965
100- /**
101- * Filter Example: tootpress_closing_filter
102- *
103- * @since 0.5
104- *
105- * @param string Content
106- * @return string Filtered Content
107- *
108- * function tootpress_closing_add( $content ) {
109- *
110- * // Add your filter code here
111- * // Example: $content='<p>Hello World.</p>';
112- *
113- * return $content;
114- *
115- * }
116- * add_filter( 'tootpress_closing_filter', 'tootpress_closing_add', 10, 1 );
117- *
118- */
119-
12066/**
12167 * Move Forward Filter
12268 *
12369 * This filter overwrites the forward label in the menu
12470 *
12571 * @since 0.5
12672 *
127- * @param string Label Forward
73+ * @param string Original Label
12874 * @return string New Label
12975 */
13076
@@ -133,32 +79,14 @@ function tootpress_menu_forward_filter_apply($label) {
13379 return $ label ;
13480}
13581
136- /**
137- * Usage Example: tootpress_menu_forward_label
138- *
139- * @param string Label Forward
140- * @return string New Label
141- *
142- * function tootpress_menu_forward_label_change( $label ) {
143- *
144- * // Add your filter code here
145- * // Example: $label='Newer Posts';
146- *
147- * return $label;
148- *
149- * }
150- * add_filter( 'tootpress_menu_forward_label', 'tootpress_menu_forward_label_change', 10, 1 );
151- *
152- */
153-
15482/**
15583 * Move Backward Filter
15684 *
15785 * This filter overwrites the backward label in the menu
15886 *
15987 * @since 0.5
16088 *
161- * @param string Label Backward
89+ * @param string Original Backward
16290 * @return string New Label
16391 */
16492
@@ -167,24 +95,6 @@ function tootpress_menu_backward_filter_apply($label) {
16795 return $ label ;
16896}
16997
170- /**
171- * Usage Example: tootpress_menu_backward_label
172- *
173- * @param string Label Backward
174- * @return string New Label
175- *
176- * function tootpress_menu_backward_label_change( $label ) {
177- *
178- * // Add your filter code here
179- * // Example: $label='Older Posts';
180- *
181- * return $label;
182- *
183- * }
184- * add_filter( 'tootpress_menu_backward_label', 'tootpress_menu_backward_label_change', 10, 1 );
185- *
186- */
187-
18898/**
18999 * Before Loop Filter
190100 *
@@ -197,31 +107,14 @@ function tootpress_menu_backward_filter_apply($label) {
197107 * @return string Content
198108 */
199109
200- function tootpress_beforeloop_filter_apply ($ page_number ) {
110+ function tootpress_beforeloop_filter_apply ($ current_page_number ) {
201111
202112 $ content ='' ;
113+ $ last_page_number =tootpress_amount_of_pages ();
203114
204- $ content =apply_filters ( 'tootpress_beforeloop_filter ' , $ content , $ page_number );
115+ $ content =apply_filters ( 'tootpress_beforeloop_filter ' , $ content , $ current_page_number , $ last_page_number );
205116
206117 return $ content ;
207118}
208119
209- /**
210- * Usage Example: tootpress_beforeloop_filter
211- *
212- * @param string Content (empty)
213- * @param int TootPress Page Number
214- * @return string Content (filtered)
215- *
216- * function tootpress_beforeloop_filter_add( $content, $page_number ) {
217- *
218- * // Add your filter code here
219- * // Example: $content='<p>Page '.$page_number.'</p>';
220- *
221- * return $content;
222- *
223- * }
224- * add_filter( 'tootpress_beforeloop_filter', 'tootpress_beforeloop_filter_add', 10, 2 );
225- */
226-
227120?>
0 commit comments