@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Each image filter is represented by a subclass of this class,m |
|
4 | - * and each filter call is a new instance, with call arguments as properties. |
|
5 | - * |
|
6 | - * Only 3 methods need to be implemented: |
|
7 | - * - constructor, storing all filter arguments |
|
8 | - * - filename |
|
9 | - * - run |
|
10 | - */ |
|
3 | + * Each image filter is represented by a subclass of this class,m |
|
4 | + * and each filter call is a new instance, with call arguments as properties. |
|
5 | + * |
|
6 | + * Only 3 methods need to be implemented: |
|
7 | + * - constructor, storing all filter arguments |
|
8 | + * - filename |
|
9 | + * - run |
|
10 | + */ |
|
11 | 11 | abstract class TimberImageOperation { |
12 | 12 | /** |
13 | 13 | * Builds the result filename, based on source filename and extension |
@@ -36,14 +36,14 @@ |
||
36 | 36 | * @return array array('red', 'green', 'blue') to int |
37 | 37 | * ex: array('red' => 255, 'green' => 20, 'blue' => 85); |
38 | 38 | */ |
39 | - public static function hexrgb( $hexstr ) { |
|
40 | - if ( !strstr( $hexstr, '#' ) ) { |
|
39 | + public static function hexrgb($hexstr) { |
|
40 | + if ( !strstr($hexstr, '#') ) { |
|
41 | 41 | $hexstr = '#' . $hexstr; |
42 | 42 | } |
43 | - if ( strlen( $hexstr ) == 4 ) { |
|
43 | + if ( strlen($hexstr) == 4 ) { |
|
44 | 44 | $hexstr = '#' . $hexstr[1] . $hexstr[1] . $hexstr[2] . $hexstr[2] . $hexstr[3] . $hexstr[3]; |
45 | 45 | } |
46 | - $int = hexdec( $hexstr ); |
|
47 | - return array( "red" => 0xFF & ( $int >> 0x10 ), "green" => 0xFF & ( $int >> 0x8 ), "blue" => 0xFF & $int ); |
|
46 | + $int = hexdec($hexstr); |
|
47 | + return array("red" => 0xFF & ($int >> 0x10), "green" => 0xFF & ($int >> 0x8), "blue" => 0xFF & $int); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | \ No newline at end of file |
@@ -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 |
@@ -3,55 +3,55 @@ |
||
3 | 3 | class ACFTimber { |
4 | 4 | |
5 | 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 ); |
|
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 | 12 | } |
13 | 13 | |
14 | - function post_get_meta( $customs, $post_id ) { |
|
14 | + function post_get_meta($customs, $post_id) { |
|
15 | 15 | return $customs; |
16 | 16 | } |
17 | 17 | |
18 | - function post_get_meta_field( $value, $post_id, $field_name ) { |
|
19 | - return get_field( $field_name, $post_id ); |
|
18 | + function post_get_meta_field($value, $post_id, $field_name) { |
|
19 | + return get_field($field_name, $post_id); |
|
20 | 20 | } |
21 | 21 | |
22 | - function term_get_meta_field( $value, $term_id, $field_name, $term ) { |
|
22 | + function term_get_meta_field($value, $term_id, $field_name, $term) { |
|
23 | 23 | $searcher = $term->taxonomy . "_" . $term->ID; |
24 | - return get_field( $field_name, $searcher ); |
|
24 | + return get_field($field_name, $searcher); |
|
25 | 25 | } |
26 | 26 | |
27 | - function term_set_meta( $value, $field, $term_id, $term ) { |
|
27 | + function term_set_meta($value, $field, $term_id, $term) { |
|
28 | 28 | $searcher = $term->taxonomy . "_" . $term->ID; |
29 | - update_field( $field, $value, $searcher ); |
|
29 | + update_field($field, $value, $searcher); |
|
30 | 30 | return $value; |
31 | 31 | } |
32 | 32 | |
33 | - function term_get_meta( $fields, $term_id, $term ) { |
|
33 | + function term_get_meta($fields, $term_id, $term) { |
|
34 | 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 ); |
|
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 | 42 | $fields[$key] = $field; |
43 | 43 | } |
44 | - $fields = array_merge( $fields, $fds ); |
|
44 | + $fields = array_merge($fields, $fds); |
|
45 | 45 | } |
46 | 46 | return $fields; |
47 | 47 | } |
48 | 48 | |
49 | - function user_get_meta( $fields, $user_id ) { |
|
49 | + function user_get_meta($fields, $user_id) { |
|
50 | 50 | return $fields; |
51 | 51 | } |
52 | 52 | |
53 | - function user_get_meta_field( $value, $uid, $field ) { |
|
54 | - return get_field( $field, 'user_' . $uid ); |
|
53 | + function user_get_meta_field($value, $uid, $field) { |
|
54 | + return get_field($field, 'user_' . $uid); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 |
@@ -6,31 +6,31 @@ |
||
6 | 6 | */ |
7 | 7 | class TimberCommand { |
8 | 8 | |
9 | - public static function clear_cache($mode = 'all'){ |
|
10 | - if (is_array($mode)){ |
|
11 | - $mode = reset($mode); |
|
12 | - } |
|
13 | - if ($mode == 'all') { |
|
14 | - $twig_cache = self::clear_cache_twig(); |
|
15 | - $timber_cache = self::clear_cache_timber(); |
|
16 | - if ($twig_cache && $timber_cache){ |
|
17 | - return true; |
|
18 | - } |
|
19 | - } else if ($mode == 'twig') { |
|
20 | - return self::clear_cache_twig(); |
|
21 | - } else if ($mode == 'timber') { |
|
22 | - return self::clear_cache_timber(); |
|
23 | - } |
|
24 | - } |
|
9 | + public static function clear_cache($mode = 'all'){ |
|
10 | + if (is_array($mode)){ |
|
11 | + $mode = reset($mode); |
|
12 | + } |
|
13 | + if ($mode == 'all') { |
|
14 | + $twig_cache = self::clear_cache_twig(); |
|
15 | + $timber_cache = self::clear_cache_timber(); |
|
16 | + if ($twig_cache && $timber_cache){ |
|
17 | + return true; |
|
18 | + } |
|
19 | + } else if ($mode == 'twig') { |
|
20 | + return self::clear_cache_twig(); |
|
21 | + } else if ($mode == 'timber') { |
|
22 | + return self::clear_cache_timber(); |
|
23 | + } |
|
24 | + } |
|
25 | 25 | |
26 | - static function clear_cache_timber(){ |
|
27 | - $loader = new TimberLoader(); |
|
28 | - return $loader->clear_cache_timber(); |
|
29 | - } |
|
26 | + static function clear_cache_timber(){ |
|
27 | + $loader = new TimberLoader(); |
|
28 | + return $loader->clear_cache_timber(); |
|
29 | + } |
|
30 | 30 | |
31 | - static function clear_cache_twig(){ |
|
32 | - $loader = new TimberLoader(); |
|
33 | - return $loader->clear_cache_twig(); |
|
34 | - } |
|
31 | + static function clear_cache_twig(){ |
|
32 | + $loader = new TimberLoader(); |
|
33 | + return $loader->clear_cache_twig(); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | } |
@@ -6,29 +6,29 @@ |
||
6 | 6 | */ |
7 | 7 | class TimberCommand { |
8 | 8 | |
9 | - public static function clear_cache($mode = 'all'){ |
|
10 | - if (is_array($mode)){ |
|
9 | + public static function clear_cache($mode = 'all') { |
|
10 | + if ( is_array($mode) ) { |
|
11 | 11 | $mode = reset($mode); |
12 | 12 | } |
13 | - if ($mode == 'all') { |
|
13 | + if ( $mode == 'all' ) { |
|
14 | 14 | $twig_cache = self::clear_cache_twig(); |
15 | 15 | $timber_cache = self::clear_cache_timber(); |
16 | - if ($twig_cache && $timber_cache){ |
|
16 | + if ( $twig_cache && $timber_cache ) { |
|
17 | 17 | return true; |
18 | 18 | } |
19 | - } else if ($mode == 'twig') { |
|
19 | + } else if ( $mode == 'twig' ) { |
|
20 | 20 | return self::clear_cache_twig(); |
21 | - } else if ($mode == 'timber') { |
|
21 | + } else if ( $mode == 'timber' ) { |
|
22 | 22 | return self::clear_cache_timber(); |
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | - static function clear_cache_timber(){ |
|
26 | + static function clear_cache_timber() { |
|
27 | 27 | $loader = new TimberLoader(); |
28 | 28 | return $loader->clear_cache_timber(); |
29 | 29 | } |
30 | 30 | |
31 | - static function clear_cache_twig(){ |
|
31 | + static function clear_cache_twig() { |
|
32 | 32 | $loader = new TimberLoader(); |
33 | 33 | return $loader->clear_cache_twig(); |
34 | 34 | } |
@@ -6,14 +6,14 @@ discard block |
||
6 | 6 | */ |
7 | 7 | class TimberCommand { |
8 | 8 | |
9 | - public static function clear_cache($mode = 'all'){ |
|
10 | - if (is_array($mode)){ |
|
9 | + public static function clear_cache($mode = 'all') { |
|
10 | + if (is_array($mode)) { |
|
11 | 11 | $mode = reset($mode); |
12 | 12 | } |
13 | 13 | if ($mode == 'all') { |
14 | 14 | $twig_cache = self::clear_cache_twig(); |
15 | 15 | $timber_cache = self::clear_cache_timber(); |
16 | - if ($twig_cache && $timber_cache){ |
|
16 | + if ($twig_cache && $timber_cache) { |
|
17 | 17 | return true; |
18 | 18 | } |
19 | 19 | } else if ($mode == 'twig') { |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | - static function clear_cache_timber(){ |
|
26 | + static function clear_cache_timber() { |
|
27 | 27 | $loader = new TimberLoader(); |
28 | 28 | return $loader->clear_cache_timber(); |
29 | 29 | } |
30 | 30 | |
31 | - static function clear_cache_twig(){ |
|
31 | + static function clear_cache_twig() { |
|
32 | 32 | $loader = new TimberLoader(); |
33 | 33 | return $loader->clear_cache_twig(); |
34 | 34 | } |
@@ -5,53 +5,53 @@ |
||
5 | 5 | |
6 | 6 | class Timber_WP_CLI_Command extends WP_CLI_Command { |
7 | 7 | |
8 | - /** |
|
9 | - * Clears Timber and Twig's Cache |
|
10 | - * |
|
11 | - * ## EXAMPLES |
|
12 | - * |
|
13 | - * wp timber clear_cache |
|
14 | - * |
|
15 | - */ |
|
16 | - public function clear_cache($mode = 'all') { |
|
17 | - TimberCommand::clear_cache($mode); |
|
18 | - } |
|
8 | + /** |
|
9 | + * Clears Timber and Twig's Cache |
|
10 | + * |
|
11 | + * ## EXAMPLES |
|
12 | + * |
|
13 | + * wp timber clear_cache |
|
14 | + * |
|
15 | + */ |
|
16 | + public function clear_cache($mode = 'all') { |
|
17 | + TimberCommand::clear_cache($mode); |
|
18 | + } |
|
19 | 19 | |
20 | - /** |
|
21 | - * Clears Twig's Cache |
|
22 | - * |
|
23 | - * ## EXAMPLES |
|
24 | - * |
|
25 | - * wp timber clear_cache_twig |
|
26 | - * |
|
27 | - */ |
|
28 | - function clear_cache_twig(){ |
|
29 | - $clear = TimberCommand::clear_cache_twig(); |
|
30 | - if ($clear){ |
|
31 | - WP_CLI::success('Cleared contents of twig cache'); |
|
32 | - } else { |
|
33 | - WP_CLI::warning('Failed to clear twig cache'); |
|
34 | - } |
|
35 | - } |
|
20 | + /** |
|
21 | + * Clears Twig's Cache |
|
22 | + * |
|
23 | + * ## EXAMPLES |
|
24 | + * |
|
25 | + * wp timber clear_cache_twig |
|
26 | + * |
|
27 | + */ |
|
28 | + function clear_cache_twig(){ |
|
29 | + $clear = TimberCommand::clear_cache_twig(); |
|
30 | + if ($clear){ |
|
31 | + WP_CLI::success('Cleared contents of twig cache'); |
|
32 | + } else { |
|
33 | + WP_CLI::warning('Failed to clear twig cache'); |
|
34 | + } |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Clears Timber's Cache |
|
39 | - * |
|
40 | - * ## EXAMPLES |
|
41 | - * |
|
42 | - * wp timber clear_cache_timber |
|
43 | - * |
|
44 | - */ |
|
45 | - function clear_cache_timber() { |
|
46 | - $clear = TimberCommand::clear_cache_timber(); |
|
47 | - $message = 'Failed to clear timber cache'; |
|
48 | - if ($clear){ |
|
49 | - $message = "Cleared contents of Timber's Cache"; |
|
50 | - WP_CLI::success($message); |
|
51 | - } else { |
|
52 | - WP_CLI::warning($message); |
|
53 | - } |
|
54 | - return $message; |
|
55 | - } |
|
37 | + /** |
|
38 | + * Clears Timber's Cache |
|
39 | + * |
|
40 | + * ## EXAMPLES |
|
41 | + * |
|
42 | + * wp timber clear_cache_timber |
|
43 | + * |
|
44 | + */ |
|
45 | + function clear_cache_timber() { |
|
46 | + $clear = TimberCommand::clear_cache_timber(); |
|
47 | + $message = 'Failed to clear timber cache'; |
|
48 | + if ($clear){ |
|
49 | + $message = "Cleared contents of Timber's Cache"; |
|
50 | + WP_CLI::success($message); |
|
51 | + } else { |
|
52 | + WP_CLI::warning($message); |
|
53 | + } |
|
54 | + return $message; |
|
55 | + } |
|
56 | 56 | |
57 | 57 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!class_exists('WP_CLI_Command')) { |
|
2 | +if ( !class_exists('WP_CLI_Command') ) { |
|
3 | 3 | return; |
4 | 4 | } |
5 | 5 | |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | * wp timber clear_cache_twig |
26 | 26 | * |
27 | 27 | */ |
28 | - function clear_cache_twig(){ |
|
28 | + function clear_cache_twig() { |
|
29 | 29 | $clear = TimberCommand::clear_cache_twig(); |
30 | - if ($clear){ |
|
30 | + if ( $clear ) { |
|
31 | 31 | WP_CLI::success('Cleared contents of twig cache'); |
32 | 32 | } else { |
33 | 33 | WP_CLI::warning('Failed to clear twig cache'); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | function clear_cache_timber() { |
46 | 46 | $clear = TimberCommand::clear_cache_timber(); |
47 | 47 | $message = 'Failed to clear timber cache'; |
48 | - if ($clear){ |
|
48 | + if ( $clear ) { |
|
49 | 49 | $message = "Cleared contents of Timber's Cache"; |
50 | 50 | WP_CLI::success($message); |
51 | 51 | } else { |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | * wp timber clear_cache_twig |
26 | 26 | * |
27 | 27 | */ |
28 | - function clear_cache_twig(){ |
|
28 | + function clear_cache_twig() { |
|
29 | 29 | $clear = TimberCommand::clear_cache_twig(); |
30 | - if ($clear){ |
|
30 | + if ($clear) { |
|
31 | 31 | WP_CLI::success('Cleared contents of twig cache'); |
32 | 32 | } else { |
33 | 33 | WP_CLI::warning('Failed to clear twig cache'); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | function clear_cache_timber() { |
46 | 46 | $clear = TimberCommand::clear_cache_timber(); |
47 | 47 | $message = 'Failed to clear timber cache'; |
48 | - if ($clear){ |
|
48 | + if ($clear) { |
|
49 | 49 | $message = "Cleared contents of Timber's Cache"; |
50 | 50 | WP_CLI::success($message); |
51 | 51 | } else { |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | class TimberAdmin { |
4 | 4 | |
5 | - public static function init() { |
|
6 | - return add_filter( 'plugin_row_meta', array( __CLASS__, 'meta_links' ), 10, 2 ); |
|
7 | - } |
|
5 | + public static function init() { |
|
6 | + return add_filter( 'plugin_row_meta', array( __CLASS__, 'meta_links' ), 10, 2 ); |
|
7 | + } |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @param array $links |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | class TimberAdmin { |
4 | 4 | |
5 | 5 | public static function init() { |
6 | - return add_filter( 'plugin_row_meta', array( __CLASS__, 'meta_links' ), 10, 2 ); |
|
6 | + return add_filter('plugin_row_meta', array(__CLASS__, 'meta_links'), 10, 2); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | /** |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | * @param string $file |
12 | 12 | * @return array |
13 | 13 | */ |
14 | - public static function meta_links( $links, $file ) { |
|
15 | - if ( strstr( $file, '/timber.php' ) ) { |
|
14 | + public static function meta_links($links, $file) { |
|
15 | + if ( strstr($file, '/timber.php') ) { |
|
16 | 16 | unset($links[2]); |
17 | 17 | $links[] = '<a href="/wp-admin/plugin-install.php?tab=plugin-information&plugin=timber-library&TB_iframe=true&width=600&height=550" class="thickbox" aria-label="More information about Timber" data-title="Timber">View details</a>'; |
18 | 18 | $links[] = '<a href="http://upstatement.com/timber" target="_blank">Homepage</a>'; |
@@ -133,7 +133,7 @@ |
||
133 | 133 | $show_year = $r['show_year']; |
134 | 134 | //will need to specify which year we're looking for |
135 | 135 | $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts " |
136 | - . "FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) " |
|
136 | + . "from $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) " |
|
137 | 137 | . "ORDER BY post_date $order $limit"; |
138 | 138 | $key = md5($query); |
139 | 139 | $key = "wp_get_archives:$key:$last_changed"; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * } |
55 | 55 | * @param string $base any additional paths that need to be prepended to the URLs that are generated, for example: "tags" |
56 | 56 | */ |
57 | - function __construct( $args = null, $base = '' ) { |
|
57 | + function __construct($args = null, $base = '') { |
|
58 | 58 | $this->init($args, $base); |
59 | 59 | } |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param array|string $args |
64 | 64 | * @param string $base |
65 | 65 | */ |
66 | - function init( $args = null, $base = '' ) { |
|
66 | + function init($args = null, $base = '') { |
|
67 | 67 | $this->base = $base; |
68 | 68 | $this->items = $this->get_items($args); |
69 | 69 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string $text |
75 | 75 | * @return mixed |
76 | 76 | */ |
77 | - protected function get_archives_link( $url, $text ) { |
|
77 | + protected function get_archives_link($url, $text) { |
|
78 | 78 | $ret = array(); |
79 | 79 | $ret['text'] = $ret['title'] = $ret['name'] = wptexturize($text); |
80 | 80 | $ret['url'] = $ret['link'] = esc_url(TimberURLHelper::prepend_to_url($url, $this->base)); |
@@ -91,19 +91,19 @@ discard block |
||
91 | 91 | * @param string $limit |
92 | 92 | * @return array |
93 | 93 | */ |
94 | - protected function get_items_yearly( $args, $last_changed, $join, $where, $order, $limit ) { |
|
94 | + protected function get_items_yearly($args, $last_changed, $join, $where, $order, $limit) { |
|
95 | 95 | global $wpdb; |
96 | 96 | $output = array(); |
97 | 97 | $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM {$wpdb->posts} $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit"; |
98 | 98 | $key = md5($query); |
99 | 99 | $key = "wp_get_archives:$key:$last_changed"; |
100 | - if (!$results = wp_cache_get($key, 'posts')) { |
|
100 | + if ( !$results = wp_cache_get($key, 'posts') ) { |
|
101 | 101 | $results = $wpdb->get_results($query); |
102 | 102 | wp_cache_set($key, $results, 'posts'); |
103 | 103 | } |
104 | - if ($results) { |
|
105 | - foreach ( (array)$results as $result ) { |
|
106 | - $url = get_year_link( $result->year ); |
|
104 | + if ( $results ) { |
|
105 | + foreach ((array) $results as $result) { |
|
106 | + $url = get_year_link($result->year); |
|
107 | 107 | $text = sprintf('%d', $result->year); |
108 | 108 | $output[] = $this->get_archives_link($url, $text); |
109 | 109 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param bool $nested |
123 | 123 | * @return array |
124 | 124 | */ |
125 | - protected function get_items_monthly( $args, $last_changed, $join, $where, $order, $limit = 1000, $nested = true ) { |
|
125 | + protected function get_items_monthly($args, $last_changed, $join, $where, $order, $limit = 1000, $nested = true) { |
|
126 | 126 | global $wpdb, $wp_locale; |
127 | 127 | $output = array(); |
128 | 128 | $defaults = array( |
@@ -137,26 +137,26 @@ discard block |
||
137 | 137 | . "ORDER BY post_date $order $limit"; |
138 | 138 | $key = md5($query); |
139 | 139 | $key = "wp_get_archives:$key:$last_changed"; |
140 | - if (!$results = wp_cache_get($key, 'posts')) { |
|
140 | + if ( !$results = wp_cache_get($key, 'posts') ) { |
|
141 | 141 | $results = $wpdb->get_results($query); |
142 | 142 | wp_cache_set($key, $results, 'posts'); |
143 | 143 | } |
144 | - if ($results) { |
|
145 | - foreach ((array)$results as $result) { |
|
144 | + if ( $results ) { |
|
145 | + foreach ((array) $results as $result) { |
|
146 | 146 | $url = get_month_link($result->year, $result->month); |
147 | - if ($show_year && !$nested) { |
|
147 | + if ( $show_year && !$nested ) { |
|
148 | 148 | $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($result->month), $result->year); |
149 | 149 | } else { |
150 | 150 | $text = sprintf(__('%1$s'), $wp_locale->get_month($result->month)); |
151 | 151 | } |
152 | - if ($nested) { |
|
152 | + if ( $nested ) { |
|
153 | 153 | $output[$result->year][] = $this->get_archives_link($url, $text); |
154 | 154 | } else { |
155 | 155 | $output[] = $this->get_archives_link($url, $text); |
156 | 156 | } |
157 | 157 | } |
158 | 158 | } |
159 | - if ($nested) { |
|
159 | + if ( $nested ) { |
|
160 | 160 | $out2 = array(); |
161 | 161 | foreach ($output as $year => $months) { |
162 | 162 | $out2[] = array('name' => $year, 'children' => $months); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param array|string $args |
172 | 172 | * @return array|string |
173 | 173 | */ |
174 | - function get_items( $args = null ) { |
|
174 | + function get_items($args = null) { |
|
175 | 175 | global $wpdb; |
176 | 176 | |
177 | 177 | $defaults = array( |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $archive_week_start_date_format = 'Y/m/d'; |
221 | 221 | $archive_week_end_date_format = 'Y/m/d'; |
222 | 222 | |
223 | - if (!$archive_date_format_over_ride) { |
|
223 | + if ( !$archive_date_format_over_ride ) { |
|
224 | 224 | $archive_day_date_format = get_option('date_format'); |
225 | 225 | $archive_week_start_date_format = get_option('date_format'); |
226 | 226 | $archive_week_end_date_format = get_option('date_format'); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | $output = array(); |
234 | 234 | $last_changed = wp_cache_get('last_changed', 'posts'); |
235 | - if (!$last_changed) { |
|
235 | + if ( !$last_changed ) { |
|
236 | 236 | $last_changed = microtime(); |
237 | 237 | wp_cache_set('last_changed', $last_changed, 'posts'); |
238 | 238 | } |
@@ -246,14 +246,14 @@ discard block |
||
246 | 246 | $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit"; |
247 | 247 | $key = md5($query); |
248 | 248 | $key = "wp_get_archives:$key:$last_changed"; |
249 | - if (!$results = wp_cache_get($key, 'posts')) { |
|
249 | + if ( !$results = wp_cache_get($key, 'posts') ) { |
|
250 | 250 | $results = $wpdb->get_results($query); |
251 | 251 | $cache = array(); |
252 | 252 | $cache[$key] = $results; |
253 | 253 | wp_cache_set($key, $results, 'posts'); |
254 | 254 | } |
255 | 255 | if ( $results ) { |
256 | - foreach ( (array)$results as $result ) { |
|
256 | + foreach ((array) $results as $result) { |
|
257 | 257 | $url = get_day_link($result->year, $result->month, $result->dayofmonth); |
258 | 258 | $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth); |
259 | 259 | $text = mysql2date($archive_day_date_format, $date); |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | . "count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit"; |
267 | 267 | $key = md5($query); |
268 | 268 | $key = "wp_get_archives:$key:$last_changed"; |
269 | - if (!$results = wp_cache_get($key, 'posts')) { |
|
269 | + if ( !$results = wp_cache_get($key, 'posts') ) { |
|
270 | 270 | $results = $wpdb->get_results($query); |
271 | 271 | wp_cache_set($key, $results, 'posts'); |
272 | 272 | } |
273 | 273 | $arc_w_last = ''; |
274 | 274 | if ( $results ) { |
275 | - foreach ( (array)$results as $result ) { |
|
275 | + foreach ((array) $results as $result) { |
|
276 | 276 | if ( $result->week != $arc_w_last ) { |
277 | 277 | $arc_year = $result->yr; |
278 | 278 | $arc_w_last = $result->week; |
@@ -295,10 +295,10 @@ discard block |
||
295 | 295 | wp_cache_set($key, $results, 'posts'); |
296 | 296 | } |
297 | 297 | if ( $results ) { |
298 | - foreach ( (array)$results as $result ) { |
|
299 | - if ($result->post_date != '0000-00-00 00:00:00') { |
|
298 | + foreach ((array) $results as $result) { |
|
299 | + if ( $result->post_date != '0000-00-00 00:00:00' ) { |
|
300 | 300 | $url = get_permalink($result); |
301 | - if ($result->post_title) { |
|
301 | + if ( $result->post_title ) { |
|
302 | 302 | /** This filter is documented in wp-includes/post-template.php */ |
303 | 303 | $text = strip_tags(apply_filters('the_title', $result->post_title, $result->ID)); |
304 | 304 | } else { |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | interface TimberCoreInterface { |
4 | 4 | |
5 | - public function __call( $field, $args ); |
|
5 | + public function __call($field, $args); |
|
6 | 6 | |
7 | - public function __get( $field ); |
|
7 | + public function __get($field); |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @return boolean |
11 | 11 | */ |
12 | - public function __isset( $field ); |
|
12 | + public function __isset($field); |
|
13 | 13 | |
14 | - public function meta( $key ); |
|
14 | + public function meta($key); |
|
15 | 15 | |
16 | 16 | } |
@@ -2,116 +2,116 @@ |
||
2 | 2 | |
3 | 3 | abstract class TimberCore { |
4 | 4 | |
5 | - public $id; |
|
6 | - public $ID; |
|
7 | - public $object_type; |
|
5 | + public $id; |
|
6 | + public $ID; |
|
7 | + public $object_type; |
|
8 | 8 | |
9 | - /** |
|
10 | - * |
|
11 | - * |
|
12 | - * @return boolean |
|
13 | - */ |
|
14 | - function __isset( $field ) { |
|
15 | - if ( isset( $this->$field ) ) { |
|
16 | - return $this->$field; |
|
17 | - } |
|
18 | - return false; |
|
19 | - } |
|
9 | + /** |
|
10 | + * |
|
11 | + * |
|
12 | + * @return boolean |
|
13 | + */ |
|
14 | + function __isset( $field ) { |
|
15 | + if ( isset( $this->$field ) ) { |
|
16 | + return $this->$field; |
|
17 | + } |
|
18 | + return false; |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * This is helpful for twig to return properties and methods see: https://github.com/fabpot/Twig/issues/2 |
|
23 | - * @return mixed |
|
24 | - */ |
|
25 | - function __call( $field, $args ) { |
|
26 | - return $this->__get( $field ); |
|
27 | - } |
|
21 | + /** |
|
22 | + * This is helpful for twig to return properties and methods see: https://github.com/fabpot/Twig/issues/2 |
|
23 | + * @return mixed |
|
24 | + */ |
|
25 | + function __call( $field, $args ) { |
|
26 | + return $this->__get( $field ); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * This is helpful for twig to return properties and methods see: https://github.com/fabpot/Twig/issues/2 |
|
31 | - * |
|
32 | - * @return mixed |
|
33 | - */ |
|
34 | - function __get( $field ) { |
|
35 | - if ( property_exists($this, $field) ) { |
|
36 | - return $this->$field; |
|
37 | - } |
|
38 | - if ( method_exists($this, 'meta') && $meta_value = $this->meta( $field ) ) { |
|
39 | - return $this->$field = $meta_value; |
|
40 | - } |
|
41 | - if ( method_exists($this, $field) ) { |
|
42 | - return $this->$field = $this->$field(); |
|
43 | - } |
|
44 | - return $this->$field = false; |
|
45 | - } |
|
29 | + /** |
|
30 | + * This is helpful for twig to return properties and methods see: https://github.com/fabpot/Twig/issues/2 |
|
31 | + * |
|
32 | + * @return mixed |
|
33 | + */ |
|
34 | + function __get( $field ) { |
|
35 | + if ( property_exists($this, $field) ) { |
|
36 | + return $this->$field; |
|
37 | + } |
|
38 | + if ( method_exists($this, 'meta') && $meta_value = $this->meta( $field ) ) { |
|
39 | + return $this->$field = $meta_value; |
|
40 | + } |
|
41 | + if ( method_exists($this, $field) ) { |
|
42 | + return $this->$field = $this->$field(); |
|
43 | + } |
|
44 | + return $this->$field = false; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Takes an array or object and adds the properties to the parent object |
|
49 | - * @example |
|
50 | - * ```php |
|
51 | - * $data = array('airplane' => '757-200', 'flight' => '5316'); |
|
52 | - * $post = new TimberPost() |
|
53 | - * $post->import(data); |
|
54 | - * echo $post->airplane; //757-200 |
|
55 | - * ``` |
|
56 | - * @param array|object $info an object or array you want to grab data from to attach to the Timber object |
|
57 | - */ |
|
58 | - function import( $info, $force = false ) { |
|
59 | - if ( is_object( $info ) ) { |
|
60 | - $info = get_object_vars( $info ); |
|
61 | - } |
|
62 | - if ( is_array( $info ) ) { |
|
63 | - foreach ( $info as $key => $value ) { |
|
64 | - if ( !empty( $key ) && $force ) { |
|
65 | - $this->$key = $value; |
|
66 | - } else if ( !empty( $key ) && !method_exists($this, $key) ){ |
|
67 | - $this->$key = $value; |
|
68 | - } |
|
69 | - } |
|
70 | - } |
|
71 | - } |
|
47 | + /** |
|
48 | + * Takes an array or object and adds the properties to the parent object |
|
49 | + * @example |
|
50 | + * ```php |
|
51 | + * $data = array('airplane' => '757-200', 'flight' => '5316'); |
|
52 | + * $post = new TimberPost() |
|
53 | + * $post->import(data); |
|
54 | + * echo $post->airplane; //757-200 |
|
55 | + * ``` |
|
56 | + * @param array|object $info an object or array you want to grab data from to attach to the Timber object |
|
57 | + */ |
|
58 | + function import( $info, $force = false ) { |
|
59 | + if ( is_object( $info ) ) { |
|
60 | + $info = get_object_vars( $info ); |
|
61 | + } |
|
62 | + if ( is_array( $info ) ) { |
|
63 | + foreach ( $info as $key => $value ) { |
|
64 | + if ( !empty( $key ) && $force ) { |
|
65 | + $this->$key = $value; |
|
66 | + } else if ( !empty( $key ) && !method_exists($this, $key) ){ |
|
67 | + $this->$key = $value; |
|
68 | + } |
|
69 | + } |
|
70 | + } |
|
71 | + } |
|
72 | 72 | |
73 | 73 | |
74 | - /** |
|
75 | - * @ignore |
|
76 | - * @param string $key |
|
77 | - * @param mixed $value |
|
78 | - */ |
|
79 | - function update( $key, $value ) { |
|
80 | - update_metadata( $this->object_type, $this->ID, $key, $value ); |
|
81 | - } |
|
74 | + /** |
|
75 | + * @ignore |
|
76 | + * @param string $key |
|
77 | + * @param mixed $value |
|
78 | + */ |
|
79 | + function update( $key, $value ) { |
|
80 | + update_metadata( $this->object_type, $this->ID, $key, $value ); |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * Can you edit this post/term/user? Well good for you. You're no better than me. |
|
85 | - * @example |
|
86 | - * ```twig |
|
87 | - * {% if post.can_edit %} |
|
88 | - * <a href="{{ post.edit_link }}">Edit</a> |
|
89 | - * {% endif %} |
|
90 | - * ``` |
|
91 | - * ```html |
|
92 | - * <a href="http://example.org/wp-admin/edit.php?p=242">Edit</a> |
|
93 | - * ``` |
|
94 | - * @return bool |
|
95 | - */ |
|
96 | - function can_edit() { |
|
97 | - if ( !function_exists( 'current_user_can' ) ) { |
|
98 | - return false; |
|
99 | - } |
|
100 | - if ( current_user_can( 'edit_post', $this->ID ) ) { |
|
101 | - return true; |
|
102 | - } |
|
103 | - return false; |
|
104 | - } |
|
83 | + /** |
|
84 | + * Can you edit this post/term/user? Well good for you. You're no better than me. |
|
85 | + * @example |
|
86 | + * ```twig |
|
87 | + * {% if post.can_edit %} |
|
88 | + * <a href="{{ post.edit_link }}">Edit</a> |
|
89 | + * {% endif %} |
|
90 | + * ``` |
|
91 | + * ```html |
|
92 | + * <a href="http://example.org/wp-admin/edit.php?p=242">Edit</a> |
|
93 | + * ``` |
|
94 | + * @return bool |
|
95 | + */ |
|
96 | + function can_edit() { |
|
97 | + if ( !function_exists( 'current_user_can' ) ) { |
|
98 | + return false; |
|
99 | + } |
|
100 | + if ( current_user_can( 'edit_post', $this->ID ) ) { |
|
101 | + return true; |
|
102 | + } |
|
103 | + return false; |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * |
|
108 | - * |
|
109 | - * @return array |
|
110 | - */ |
|
111 | - function get_method_values() { |
|
112 | - $ret = array(); |
|
113 | - $ret['can_edit'] = $this->can_edit(); |
|
114 | - return $ret; |
|
115 | - } |
|
106 | + /** |
|
107 | + * |
|
108 | + * |
|
109 | + * @return array |
|
110 | + */ |
|
111 | + function get_method_values() { |
|
112 | + $ret = array(); |
|
113 | + $ret['can_edit'] = $this->can_edit(); |
|
114 | + return $ret; |
|
115 | + } |
|
116 | 116 | |
117 | 117 | } |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @return boolean |
13 | 13 | */ |
14 | - function __isset( $field ) { |
|
15 | - if ( isset( $this->$field ) ) { |
|
14 | + function __isset($field) { |
|
15 | + if ( isset($this->$field) ) { |
|
16 | 16 | return $this->$field; |
17 | 17 | } |
18 | 18 | return false; |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * This is helpful for twig to return properties and methods see: https://github.com/fabpot/Twig/issues/2 |
23 | 23 | * @return mixed |
24 | 24 | */ |
25 | - function __call( $field, $args ) { |
|
26 | - return $this->__get( $field ); |
|
25 | + function __call($field, $args) { |
|
26 | + return $this->__get($field); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @return mixed |
33 | 33 | */ |
34 | - function __get( $field ) { |
|
34 | + function __get($field) { |
|
35 | 35 | if ( property_exists($this, $field) ) { |
36 | 36 | return $this->$field; |
37 | 37 | } |
38 | - if ( method_exists($this, 'meta') && $meta_value = $this->meta( $field ) ) { |
|
38 | + if ( method_exists($this, 'meta') && $meta_value = $this->meta($field) ) { |
|
39 | 39 | return $this->$field = $meta_value; |
40 | 40 | } |
41 | 41 | if ( method_exists($this, $field) ) { |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | * ``` |
56 | 56 | * @param array|object $info an object or array you want to grab data from to attach to the Timber object |
57 | 57 | */ |
58 | - function import( $info, $force = false ) { |
|
59 | - if ( is_object( $info ) ) { |
|
60 | - $info = get_object_vars( $info ); |
|
58 | + function import($info, $force = false) { |
|
59 | + if ( is_object($info) ) { |
|
60 | + $info = get_object_vars($info); |
|
61 | 61 | } |
62 | - if ( is_array( $info ) ) { |
|
63 | - foreach ( $info as $key => $value ) { |
|
64 | - if ( !empty( $key ) && $force ) { |
|
62 | + if ( is_array($info) ) { |
|
63 | + foreach ($info as $key => $value) { |
|
64 | + if ( !empty($key) && $force ) { |
|
65 | 65 | $this->$key = $value; |
66 | - } else if ( !empty( $key ) && !method_exists($this, $key) ){ |
|
66 | + } else if ( !empty($key) && !method_exists($this, $key) ) { |
|
67 | 67 | $this->$key = $value; |
68 | 68 | } |
69 | 69 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param string $key |
77 | 77 | * @param mixed $value |
78 | 78 | */ |
79 | - function update( $key, $value ) { |
|
80 | - update_metadata( $this->object_type, $this->ID, $key, $value ); |
|
79 | + function update($key, $value) { |
|
80 | + update_metadata($this->object_type, $this->ID, $key, $value); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @return bool |
95 | 95 | */ |
96 | 96 | function can_edit() { |
97 | - if ( !function_exists( 'current_user_can' ) ) { |
|
97 | + if ( !function_exists('current_user_can') ) { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | - if ( current_user_can( 'edit_post', $this->ID ) ) { |
|
100 | + if ( current_user_can('edit_post', $this->ID) ) { |
|
101 | 101 | return true; |
102 | 102 | } |
103 | 103 | return false; |
@@ -63,7 +63,7 @@ |
||
63 | 63 | foreach ( $info as $key => $value ) { |
64 | 64 | if ( !empty( $key ) && $force ) { |
65 | 65 | $this->$key = $value; |
66 | - } else if ( !empty( $key ) && !method_exists($this, $key) ){ |
|
66 | + } else if ( !empty( $key ) && !method_exists($this, $key) ) { |
|
67 | 67 | $this->$key = $value; |
68 | 68 | } |
69 | 69 | } |
@@ -5,20 +5,20 @@ |
||
5 | 5 | * @package timber |
6 | 6 | */ |
7 | 7 | class TimberIntegrations { |
8 | - public static function init() { |
|
8 | + public static function init() { |
|
9 | 9 | |
10 | - add_action( 'init', array( __CLASS__, 'maybe_init_acftimber' ) ); |
|
10 | + add_action( 'init', array( __CLASS__, 'maybe_init_acftimber' ) ); |
|
11 | 11 | |
12 | - if ( class_exists( 'WP_CLI_Command' ) ) { |
|
13 | - WP_CLI::add_command( 'timber', 'Timber_WP_CLI_Command' ); |
|
14 | - } |
|
15 | - } |
|
12 | + if ( class_exists( 'WP_CLI_Command' ) ) { |
|
13 | + WP_CLI::add_command( 'timber', 'Timber_WP_CLI_Command' ); |
|
14 | + } |
|
15 | + } |
|
16 | 16 | |
17 | - public static function maybe_init_acftimber() { |
|
17 | + public static function maybe_init_acftimber() { |
|
18 | 18 | |
19 | - if ( class_exists( 'ACF' ) ) { |
|
20 | - new ACFTimber(); |
|
21 | - } |
|
19 | + if ( class_exists( 'ACF' ) ) { |
|
20 | + new ACFTimber(); |
|
21 | + } |
|
22 | 22 | |
23 | - } |
|
23 | + } |
|
24 | 24 | } |
@@ -7,16 +7,16 @@ |
||
7 | 7 | class TimberIntegrations { |
8 | 8 | public static function init() { |
9 | 9 | |
10 | - add_action( 'init', array( __CLASS__, 'maybe_init_acftimber' ) ); |
|
10 | + add_action('init', array(__CLASS__, 'maybe_init_acftimber')); |
|
11 | 11 | |
12 | - if ( class_exists( 'WP_CLI_Command' ) ) { |
|
13 | - WP_CLI::add_command( 'timber', 'Timber_WP_CLI_Command' ); |
|
12 | + if ( class_exists('WP_CLI_Command') ) { |
|
13 | + WP_CLI::add_command('timber', 'Timber_WP_CLI_Command'); |
|
14 | 14 | } |
15 | 15 | } |
16 | 16 | |
17 | 17 | public static function maybe_init_acftimber() { |
18 | 18 | |
19 | - if ( class_exists( 'ACF' ) ) { |
|
19 | + if ( class_exists('ACF') ) { |
|
20 | 20 | new ACFTimber(); |
21 | 21 | } |
22 | 22 |