@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * |
178 | 178 | * @param mixed $arg that you want to error_log |
179 | - * @return void |
|
179 | + * @return null|boolean |
|
180 | 180 | */ |
181 | 181 | public static function error_log( $arg ) { |
182 | 182 | if ( !WP_DEBUG ) { |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @param string $text |
210 | 210 | * @param int $num_words |
211 | - * @param string|null|false $more text to appear in "Read more...". Null to use default, false to hide |
|
211 | + * @param boolean $more text to appear in "Read more...". Null to use default, false to hide |
|
212 | 212 | * @param string $allowed_tags |
213 | 213 | * @return string |
214 | 214 | */ |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * Generates a new image with increased size, for display on Retina screens. |
86 | 86 | * |
87 | 87 | * @param string $src |
88 | - * @param float $multiplier |
|
88 | + * @param integer $multiplier |
|
89 | 89 | * @param boolean $force |
90 | 90 | * |
91 | 91 | * @return string url to the new image |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @param int $h |
137 | 137 | * @param string $color |
138 | 138 | * @param bool $force |
139 | - * @return mixed|null|string |
|
139 | + * @return string |
|
140 | 140 | */ |
141 | 141 | public static function letterbox( $src, $w, $h, $color = '#000000', $force = false ) { |
142 | 142 | $op = new TimberImageOperationLetterbox($w, $h, $color); |
@@ -121,10 +121,10 @@ |
||
121 | 121 | while(!feof($fh) && $count < 2) { |
122 | 122 | $chunk = fread($fh, 1024 * 100); //read 100kb at a time |
123 | 123 | $count += preg_match_all('#\x00\x21\xF9\x04.{4}\x00[\x2C\x21]#s', $chunk, $matches); |
124 | - } |
|
124 | + } |
|
125 | 125 | |
126 | - fclose($fh); |
|
127 | - return $count > 1; |
|
126 | + fclose($fh); |
|
127 | + return $count > 1; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -301,7 +301,7 @@ |
||
301 | 301 | * <img src="{{ post.thumbnail.src|resize(500) }}" alt="A sumo wrestler" /> |
302 | 302 | * {% endif %} |
303 | 303 | * ``` |
304 | - * @return float |
|
304 | + * @return integer |
|
305 | 305 | */ |
306 | 306 | public function aspect() { |
307 | 307 | $w = intval($this->width()); |
@@ -149,7 +149,7 @@ |
||
149 | 149 | /** |
150 | 150 | * |
151 | 151 | * @internal |
152 | - * @return bool |
|
152 | + * @return boolean|null |
|
153 | 153 | */ |
154 | 154 | function update_child_levels() { |
155 | 155 | if (is_array($this->children)) { |
@@ -73,7 +73,7 @@ |
||
73 | 73 | public $title; |
74 | 74 | |
75 | 75 | /** |
76 | - * @param int|string $slug |
|
76 | + * @param integer $slug |
|
77 | 77 | */ |
78 | 78 | function __construct($slug = 0) { |
79 | 79 | $locations = get_nav_menu_locations(); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | /** |
226 | 226 | * Initializes a TimberPost |
227 | 227 | * @internal |
228 | - * @param int|bool $pid |
|
228 | + * @param integer $pid |
|
229 | 229 | */ |
230 | 230 | protected function init($pid = false) { |
231 | 231 | if ( $pid === false ) { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * takes a mix of integer (post ID), string (post slug), |
273 | 273 | * or object to return a WordPress post object from WP's built-in get_post() function |
274 | 274 | * @internal |
275 | - * @param mixed $pid |
|
275 | + * @param integer $pid |
|
276 | 276 | * @return WP_Post on success |
277 | 277 | */ |
278 | 278 | protected function prepare_post_info( $pid = 0 ) { |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * Gets a User object from the author of the post |
599 | 599 | * @internal |
600 | 600 | * @see TimberPost::author |
601 | - * @return bool|TimberUser |
|
601 | + * @return TimberUser|null |
|
602 | 602 | */ |
603 | 603 | function get_author() { |
604 | 604 | if ( isset($this->post_author) ) { |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | |
609 | 609 | /** |
610 | 610 | * @internal |
611 | - * @return bool|TimberUser |
|
611 | + * @return TimberUser|null |
|
612 | 612 | */ |
613 | 613 | function get_modified_author() { |
614 | 614 | $user_id = get_post_meta($this->ID, '_edit_last', true); |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | * <a href="{{post.author.link}}">{{post.author.name}}</a> |
1074 | 1074 | * </p> |
1075 | 1075 | * ``` |
1076 | - * @return TimberUser|bool A TimberUser object if found, false if not |
|
1076 | + * @return TimberUser|null A TimberUser object if found, false if not |
|
1077 | 1077 | */ |
1078 | 1078 | public function author() { |
1079 | 1079 | return $this->get_author(); |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | * ```html |
1089 | 1089 | * Last updated by Harper Lee |
1090 | 1090 | * ``` |
1091 | - * @return TimberUser|bool A TimberUser object if found, false if not |
|
1091 | + * @return TimberUser|null A TimberUser object if found, false if not |
|
1092 | 1092 | */ |
1093 | 1093 | public function modified_author() { |
1094 | 1094 | return $this->get_modified_author(); |
@@ -231,13 +231,13 @@ |
||
231 | 231 | $can_preview = array(); |
232 | 232 | |
233 | 233 | foreach( $can as $type ) { |
234 | - if( current_user_can( $type ) ) { |
|
235 | - $can_preview[] = true; |
|
236 | - } |
|
234 | + if( current_user_can( $type ) ) { |
|
235 | + $can_preview[] = true; |
|
236 | + } |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | if ( count( $can_preview ) !== count( $can ) ) { |
240 | - return; |
|
240 | + return; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | $revisions = wp_get_post_revisions( $query->queried_object_id ); |
@@ -4,6 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | /** |
6 | 6 | * @deprecated since 0.21.1 use Upstatement/routes instead |
7 | + * @param Timber $timber |
|
7 | 8 | */ |
8 | 9 | public static function init( $timber ) { |
9 | 10 | // Install ourselves in Timber |
@@ -24,7 +25,7 @@ discard block |
||
24 | 25 | * @param mixed $query |
25 | 26 | * @param int $status_code |
26 | 27 | * @param bool $tparams |
27 | - * @return bool |
|
28 | + * @return boolean|null |
|
28 | 29 | * @deprecated since 0.21.1 use Upstatement/routes instead |
29 | 30 | */ |
30 | 31 | public static function load_view($template, $query = false, $status_code = 200, $tparams = false) { |
@@ -136,6 +136,9 @@ discard block |
||
136 | 136 | return $path; |
137 | 137 | } |
138 | 138 | |
139 | + /** |
|
140 | + * @param string $fs |
|
141 | + */ |
|
139 | 142 | public static function file_system_to_url( $fs ) { |
140 | 143 | $relative_path = self::get_rel_path( $fs ); |
141 | 144 | $home = home_url( '/'.$relative_path ); |
@@ -210,6 +213,7 @@ discard block |
||
210 | 213 | /** |
211 | 214 | * This will evaluate wheter a URL is at an aboslute location (like http://example.org/whatever) |
212 | 215 | * |
216 | + * @param string $path |
|
213 | 217 | * @return boolean true if $path is an absolute url, false if relative. |
214 | 218 | */ |
215 | 219 | public static function is_absolute( $path ) { |
@@ -230,6 +234,9 @@ discard block |
||
230 | 234 | return $is_external; |
231 | 235 | } |
232 | 236 | |
237 | + /** |
|
238 | + * @param string $url |
|
239 | + */ |
|
233 | 240 | private static function is_internal_content($url) { |
234 | 241 | // using content_url() instead of site_url or home_url is IMPORTANT |
235 | 242 | // otherwise you run into errors with sites that: |
@@ -2,57 +2,57 @@ |
||
2 | 2 | |
3 | 3 | class ACFTimber { |
4 | 4 | |
5 | - function __construct() { |
|
6 | - add_filter( 'timber_post_get_meta', array( $this, 'post_get_meta' ), 10, 2 ); |
|
7 | - add_filter( 'timber_post_get_meta_field', array( $this, 'post_get_meta_field' ), 10, 3 ); |
|
8 | - add_filter( 'timber_term_get_meta', array( $this, 'term_get_meta' ), 10, 3 ); |
|
9 | - add_filter( 'timber_term_get_meta_field', array( $this, 'term_get_meta_field' ), 10, 4 ); |
|
10 | - add_filter( 'timber_user_get_meta_field_pre', array( $this, 'user_get_meta_field' ), 10, 3 ); |
|
11 | - add_filter( 'timber_term_set_meta', array( $this, 'term_set_meta'), 10, 4 ); |
|
12 | - } |
|
13 | - |
|
14 | - function post_get_meta( $customs, $post_id ) { |
|
15 | - return $customs; |
|
16 | - } |
|
17 | - |
|
18 | - function post_get_meta_field( $value, $post_id, $field_name ) { |
|
19 | - return get_field( $field_name, $post_id ); |
|
20 | - } |
|
21 | - |
|
22 | - function term_get_meta_field( $value, $term_id, $field_name, $term ) { |
|
23 | - $searcher = $term->taxonomy . "_" . $term->ID; |
|
24 | - return get_field( $field_name, $searcher ); |
|
25 | - } |
|
26 | - |
|
27 | - function term_set_meta( $value, $field, $term_id, $term ) { |
|
28 | - $searcher = $term->taxonomy . "_" . $term->ID; |
|
29 | - update_field( $field, $value, $searcher ); |
|
30 | - return $value; |
|
31 | - } |
|
32 | - |
|
33 | - function term_get_meta( $fields, $term_id, $term ) { |
|
34 | - $searcher = $term->taxonomy . "_" . $term->ID; // save to a specific category |
|
35 | - $fds = get_fields( $searcher ); |
|
36 | - if ( is_array( $fds ) ) { |
|
37 | - foreach ( $fds as $key => $value ) { |
|
38 | - $key = preg_replace( '/_/', '', $key, 1 ); |
|
39 | - $key = str_replace( $searcher, '', $key ); |
|
40 | - $key = preg_replace( '/_/', '', $key, 1 ); |
|
41 | - $field = get_field( $key, $searcher ); |
|
42 | - $fields[$key] = $field; |
|
43 | - } |
|
44 | - $fields = array_merge( $fields, $fds ); |
|
45 | - } |
|
46 | - return $fields; |
|
47 | - } |
|
48 | - |
|
49 | - function user_get_meta( $fields, $user_id ) { |
|
50 | - return $fields; |
|
51 | - } |
|
52 | - |
|
53 | - function user_get_meta_field( $value, $uid, $field ) { |
|
54 | - return get_field( $field, 'user_' . $uid ); |
|
55 | - } |
|
5 | + function __construct() { |
|
6 | + add_filter( 'timber_post_get_meta', array( $this, 'post_get_meta' ), 10, 2 ); |
|
7 | + add_filter( 'timber_post_get_meta_field', array( $this, 'post_get_meta_field' ), 10, 3 ); |
|
8 | + add_filter( 'timber_term_get_meta', array( $this, 'term_get_meta' ), 10, 3 ); |
|
9 | + add_filter( 'timber_term_get_meta_field', array( $this, 'term_get_meta_field' ), 10, 4 ); |
|
10 | + add_filter( 'timber_user_get_meta_field_pre', array( $this, 'user_get_meta_field' ), 10, 3 ); |
|
11 | + add_filter( 'timber_term_set_meta', array( $this, 'term_set_meta'), 10, 4 ); |
|
12 | + } |
|
13 | + |
|
14 | + function post_get_meta( $customs, $post_id ) { |
|
15 | + return $customs; |
|
16 | + } |
|
17 | + |
|
18 | + function post_get_meta_field( $value, $post_id, $field_name ) { |
|
19 | + return get_field( $field_name, $post_id ); |
|
20 | + } |
|
21 | + |
|
22 | + function term_get_meta_field( $value, $term_id, $field_name, $term ) { |
|
23 | + $searcher = $term->taxonomy . "_" . $term->ID; |
|
24 | + return get_field( $field_name, $searcher ); |
|
25 | + } |
|
26 | + |
|
27 | + function term_set_meta( $value, $field, $term_id, $term ) { |
|
28 | + $searcher = $term->taxonomy . "_" . $term->ID; |
|
29 | + update_field( $field, $value, $searcher ); |
|
30 | + return $value; |
|
31 | + } |
|
32 | + |
|
33 | + function term_get_meta( $fields, $term_id, $term ) { |
|
34 | + $searcher = $term->taxonomy . "_" . $term->ID; // save to a specific category |
|
35 | + $fds = get_fields( $searcher ); |
|
36 | + if ( is_array( $fds ) ) { |
|
37 | + foreach ( $fds as $key => $value ) { |
|
38 | + $key = preg_replace( '/_/', '', $key, 1 ); |
|
39 | + $key = str_replace( $searcher, '', $key ); |
|
40 | + $key = preg_replace( '/_/', '', $key, 1 ); |
|
41 | + $field = get_field( $key, $searcher ); |
|
42 | + $fields[$key] = $field; |
|
43 | + } |
|
44 | + $fields = array_merge( $fields, $fds ); |
|
45 | + } |
|
46 | + return $fields; |
|
47 | + } |
|
48 | + |
|
49 | + function user_get_meta( $fields, $user_id ) { |
|
50 | + return $fields; |
|
51 | + } |
|
52 | + |
|
53 | + function user_get_meta_field( $value, $uid, $field ) { |
|
54 | + return get_field( $field, 'user_' . $uid ); |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | |
58 | 58 |