@@ -28,27 +28,27 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return bool Always returns true. |
30 | 30 | */ |
31 | - public function save( $data ) { |
|
31 | + public function save($data) { |
|
32 | 32 | |
33 | - $postid = isset( $data['postid'] ) ? $data['postid'] : false; |
|
34 | - $locations = isset( $data['ase-map-component-locations'] ) ? $data['ase-map-component-locations'] : false; |
|
35 | - $start_point = isset( $data['ase-map-component-start-point'] ) ? $data['ase-map-component-start-point']: false; |
|
36 | - $zoom = isset( $data['ase-map-component-zoom'] ) ? $data['ase-map-component-zoom' ] : false; |
|
33 | + $postid = isset($data['postid']) ? $data['postid'] : false; |
|
34 | + $locations = isset($data['ase-map-component-locations']) ? $data['ase-map-component-locations'] : false; |
|
35 | + $start_point = isset($data['ase-map-component-start-point']) ? $data['ase-map-component-start-point'] : false; |
|
36 | + $zoom = isset($data['ase-map-component-zoom']) ? $data['ase-map-component-zoom'] : false; |
|
37 | 37 | |
38 | - if ( is_array( $locations ) ) { |
|
39 | - delete_post_meta( $postid, 'ase_map_component_locations' ); |
|
38 | + if (is_array($locations)) { |
|
39 | + delete_post_meta($postid, 'ase_map_component_locations'); |
|
40 | 40 | |
41 | 41 | // update locations if set |
42 | - foreach ( $locations as $location ) { |
|
43 | - $point = json_decode( urldecode( $location ), true ); |
|
44 | - add_post_meta( $postid, 'ase_map_component_locations', $point ); |
|
42 | + foreach ($locations as $location) { |
|
43 | + $point = json_decode(urldecode($location), true); |
|
44 | + add_post_meta($postid, 'ase_map_component_locations', $point); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // udpate start point |
48 | - update_post_meta( $postid, 'ase_map_component_start_point', $start_point ); |
|
48 | + update_post_meta($postid, 'ase_map_component_start_point', $start_point); |
|
49 | 49 | |
50 | 50 | // update zoom |
51 | - update_post_meta( $postid, 'ase_map_component_zoom', $zoom ); |
|
51 | + update_post_meta($postid, 'ase_map_component_zoom', $zoom); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | return true; |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return array Array of keys to pull from $_POST per action and their sanitization callback |
64 | 64 | */ |
65 | - public static function params(){ |
|
66 | - $params[ 'process_map_save' ] = array( |
|
65 | + public static function params() { |
|
66 | + $params['process_map_save'] = array( |
|
67 | 67 | 'postid' => 'absint', |
68 | 68 | 'ase-map-component-locations' => 'lasso_sanitize_data', |
69 | 69 | 'ase-map-component-start-point' => array( |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return array Array of additional functions to use to authorize action. |
88 | 88 | */ |
89 | 89 | public static function auth_callbacks() { |
90 | - $params[ 'process_map_save' ] = array( |
|
90 | + $params['process_map_save'] = array( |
|
91 | 91 | 'lasso_user_can' |
92 | 92 | ); |
93 | 93 |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return bool Always returns true. |
30 | 30 | */ |
31 | - public function update( $data ) { |
|
31 | + public function update($data) { |
|
32 | 32 | |
33 | - $post_id = isset( $data['post_id'] ) ? $data['post_id'] : false; |
|
33 | + $post_id = isset($data['post_id']) ? $data['post_id'] : false; |
|
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param array $allowed_fields The fields |
42 | 42 | */ |
43 | - $allowed_fields = apply_filters( 'lasso_meta_fields', array() ); |
|
44 | - if ( ! empty( $allowed_fields ) ) { |
|
45 | - foreach( $allowed_fields as $field ) { |
|
46 | - if ( isset( $data[ $field ] ) ) { |
|
47 | - update_post_meta( $post_id, lasso_unclean_string( $field ), $data[ $field ] ); |
|
43 | + $allowed_fields = apply_filters('lasso_meta_fields', array()); |
|
44 | + if (!empty($allowed_fields)) { |
|
45 | + foreach ($allowed_fields as $field) { |
|
46 | + if (isset($data[$field])) { |
|
47 | + update_post_meta($post_id, lasso_unclean_string($field), $data[$field]); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return array Array of keys to pull from $data per action and their sanitization callback |
64 | 64 | */ |
65 | - public static function params(){ |
|
66 | - $params[ 'process_meta_update' ] = array( |
|
65 | + public static function params() { |
|
66 | + $params['process_meta_update'] = array( |
|
67 | 67 | 'post_id' => 'absint', |
68 | 68 | 'tab_name' => 'trim' |
69 | 69 | ); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @return array Array of additional functions to use to authorize action. |
81 | 81 | */ |
82 | 82 | public static function auth_callbacks() { |
83 | - $params[ 'process_meta_update' ] = array( |
|
83 | + $params['process_meta_update'] = array( |
|
84 | 84 | 'lasso_user_can' |
85 | 85 | ); |
86 | 86 |
@@ -28,26 +28,26 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @since 1.0 |
30 | 30 | */ |
31 | - public function post( $data ) { |
|
31 | + public function post($data) { |
|
32 | 32 | |
33 | - $title = $data[ 'story_title' ]; |
|
33 | + $title = $data['story_title']; |
|
34 | 34 | |
35 | - $object = is_null( $data[ 'object'] ) ? false : $data[ 'object' ]; |
|
35 | + $object = is_null($data['object']) ? false : $data['object']; |
|
36 | 36 | |
37 | 37 | // insert a new post |
38 | 38 | $args = array( |
39 | 39 | 'post_title' => $title, |
40 | 40 | 'post_status' => 'draft', |
41 | 41 | 'post_type' => $object, |
42 | - 'post_content' => apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso') ) |
|
42 | + 'post_content' => apply_filters('lasso_new_object_content', __('Once upon a time...', 'lasso')) |
|
43 | 43 | ); |
44 | 44 | |
45 | - $postid = wp_insert_post( apply_filters( 'lasso_insert_object_args', $args ) ); |
|
45 | + $postid = wp_insert_post(apply_filters('lasso_insert_object_args', $args)); |
|
46 | 46 | |
47 | - do_action( 'lasso_new_object', $postid, $object, $title, get_current_user_ID() ); |
|
47 | + do_action('lasso_new_object', $postid, $object, $title, get_current_user_ID()); |
|
48 | 48 | |
49 | 49 | return array( |
50 | - 'postlink' => get_permalink( $postid ) |
|
50 | + 'postlink' => get_permalink($postid) |
|
51 | 51 | ); |
52 | 52 | |
53 | 53 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * @return array Array of keys to pull from $_POST per action and their sanitization callback |
61 | 61 | */ |
62 | 62 | public static function params() { |
63 | - $params[ 'process_new_object_post' ] = array( |
|
64 | - 'story_title' => array( 'wp_strip_all_tags', 'trim' ), |
|
63 | + $params['process_new_object_post'] = array( |
|
64 | + 'story_title' => array('wp_strip_all_tags', 'trim'), |
|
65 | 65 | 'object' => 'trim' |
66 | 66 | ); |
67 | 67 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return array Array of additional functions to use to authorize action. |
78 | 78 | */ |
79 | 79 | public static function auth_callbacks() { |
80 | - $params[ 'process_new_object_post' ] = array(); |
|
80 | + $params['process_new_object_post'] = array(); |
|
81 | 81 | |
82 | 82 | return $params; |
83 | 83 |
@@ -27,17 +27,17 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @return array |
29 | 29 | */ |
30 | - public static function get( $data ) { |
|
30 | + public static function get($data) { |
|
31 | 31 | $args = array(); |
32 | - if ( isset( $data[ 'limit' ] ) ) { |
|
33 | - $args[ 'posts_per_page' ] = $data[ 'limit' ]; |
|
34 | - }else{ |
|
35 | - $args[ 'posts_per_page' ] = 6; // we start at revision 0 |
|
32 | + if (isset($data['limit'])) { |
|
33 | + $args['posts_per_page'] = $data['limit']; |
|
34 | + } else { |
|
35 | + $args['posts_per_page'] = 6; // we start at revision 0 |
|
36 | 36 | } |
37 | 37 | |
38 | - $revisions = wp_get_post_revisions( $data[ 'postid' ], $args ); |
|
39 | - if ( is_array( $revisions ) && ! empty( $revisions ) ) { |
|
40 | - self::set_revisions( $data[ 'postid' ], $revisions ); |
|
38 | + $revisions = wp_get_post_revisions($data['postid'], $args); |
|
39 | + if (is_array($revisions) && !empty($revisions)) { |
|
40 | + self::set_revisions($data['postid'], $revisions); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return self::$revisions; |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @param int $id The post ID to get the revisions for |
54 | 54 | * @param obj $revisions The revisions for this post |
55 | 55 | */ |
56 | - protected static function set_revisions( $id, $revisions ) { |
|
56 | + protected static function set_revisions($id, $revisions) { |
|
57 | 57 | |
58 | - array_walk( $revisions, function ( $post, $i ) { |
|
58 | + array_walk($revisions, function($post, $i) { |
|
59 | 59 | self::$revisions[] = array( |
60 | 60 | 'post_content' => $post->post_content, |
61 | 61 | 'post_title' => $post->post_title, |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return array Array of keys to pull from $_POST per action and their sanitization callback |
75 | 75 | */ |
76 | - public static function params(){ |
|
77 | - $params[ 'process_revision_get' ] = array( |
|
76 | + public static function params() { |
|
77 | + $params['process_revision_get'] = array( |
|
78 | 78 | 'postid' => 'absint', |
79 | 79 | 'limit' => 'absint' |
80 | 80 | ); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @return array Array of additional functions to use to authorize action. |
91 | 91 | */ |
92 | 92 | public static function auth_callbacks() { |
93 | - $params[ 'process_revision_get' ] = array( |
|
93 | + $params['process_revision_get'] = array( |
|
94 | 94 | 'lasso_user_can' |
95 | 95 | ); |
96 | 96 |
@@ -19,26 +19,26 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return bool Always returns true. |
21 | 21 | */ |
22 | - public function content( $data ) { |
|
22 | + public function content($data) { |
|
23 | 23 | |
24 | 24 | $save_to_post_disabled = $this->save_to_post_disables(); |
25 | 25 | |
26 | - $postid = (int) $data[ 'post_id' ]; |
|
27 | - $content = $data[ 'content' ]; |
|
26 | + $postid = (int) $data['post_id']; |
|
27 | + $content = $data['content']; |
|
28 | 28 | |
29 | - if ( 'off' == $save_to_post_disabled || empty( $save_to_post_disabled ) ) { |
|
29 | + if ('off' == $save_to_post_disabled || empty($save_to_post_disabled)) { |
|
30 | 30 | |
31 | 31 | $args = array( |
32 | 32 | 'ID' => (int) $postid, |
33 | 33 | 'post_content' => $content |
34 | 34 | ); |
35 | 35 | |
36 | - wp_update_post( apply_filters( 'lasso_object_save_args', $args ) ); |
|
36 | + wp_update_post(apply_filters('lasso_object_save_args', $args)); |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | |
40 | 40 | // run save action |
41 | - do_action( 'lasso_post_saved', $postid, $content, get_current_user_ID() ); |
|
41 | + do_action('lasso_post_saved', $postid, $content, get_current_user_ID()); |
|
42 | 42 | |
43 | 43 | return true; |
44 | 44 | |
@@ -53,24 +53,24 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return bool Always returns true. |
55 | 55 | */ |
56 | - public function publish_content( $data ) { |
|
56 | + public function publish_content($data) { |
|
57 | 57 | $save_to_post_disabled = $this->save_to_post_disables(); |
58 | 58 | |
59 | - $postid = (int) $data[ 'post_id' ]; |
|
60 | - $content = $data[ 'content' ]; |
|
59 | + $postid = (int) $data['post_id']; |
|
60 | + $content = $data['content']; |
|
61 | 61 | |
62 | - if ( 'off' == $save_to_post_disabled || empty( $save_to_post_disabled ) ) { |
|
62 | + if ('off' == $save_to_post_disabled || empty($save_to_post_disabled)) { |
|
63 | 63 | |
64 | - $args = array ( |
|
64 | + $args = array( |
|
65 | 65 | 'ID' => $postid, |
66 | 66 | 'post_content' => $content, |
67 | 67 | 'post_status' => 'publish' |
68 | 68 | ); |
69 | - wp_update_post( apply_filters( 'lasso_object_publish_args', $args ) ); |
|
69 | + wp_update_post(apply_filters('lasso_object_publish_args', $args)); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
73 | - do_action( 'lasso_post_published', $postid, $content, get_current_user_ID() ); |
|
73 | + do_action('lasso_post_published', $postid, $content, get_current_user_ID()); |
|
74 | 74 | |
75 | 75 | return true; |
76 | 76 | |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return array Array of keys to pull from $_POST per action and their sanitization callback |
85 | 85 | */ |
86 | - public static function params(){ |
|
87 | - $params[ 'process_save_content' ] = array( |
|
86 | + public static function params() { |
|
87 | + $params['process_save_content'] = array( |
|
88 | 88 | 'post_id' => 'absint', |
89 | 89 | 'content' => 'wp_kses_post' |
90 | 90 | ); |
91 | 91 | |
92 | - $params[ 'process_save_publish_content' ] = array( |
|
92 | + $params['process_save_publish_content'] = array( |
|
93 | 93 | 'post_id' => 'absint', |
94 | 94 | 'content' => 'wp_kses_post' |
95 | 95 | ); |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | * @return array Array of additional functions to use to authorize action. |
106 | 106 | */ |
107 | 107 | public static function auth_callbacks() { |
108 | - $params[ 'process_save_content' ] = array( |
|
108 | + $params['process_save_content'] = array( |
|
109 | 109 | 'lasso_user_can' |
110 | 110 | ); |
111 | 111 | |
112 | - $params[ 'process_save_publish_content' ] = array(); |
|
112 | + $params['process_save_publish_content'] = array(); |
|
113 | 113 | |
114 | 114 | return $params; |
115 | 115 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @return bool |
126 | 126 | */ |
127 | 127 | protected function save_to_post_disables() { |
128 | - $save_to_post_disabled = lasso_editor_get_option( 'post_save_disabled', 'lasso_editor' ); |
|
128 | + $save_to_post_disabled = lasso_editor_get_option('post_save_disabled', 'lasso_editor'); |
|
129 | 129 | |
130 | 130 | return $save_to_post_disabled; |
131 | 131 |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return bool Always returns true. |
30 | 30 | */ |
31 | - public function post( $data ) { |
|
31 | + public function post($data) { |
|
32 | 32 | |
33 | - $postid = isset( $data['postid'] ) ? $data['postid'] : false; |
|
34 | - $title = isset( $data['title'] ) ? $data['title'] : false; |
|
33 | + $postid = isset($data['postid']) ? $data['postid'] : false; |
|
34 | + $title = isset($data['title']) ? $data['title'] : false; |
|
35 | 35 | |
36 | 36 | $args = array( |
37 | 37 | 'ID' => (int) $postid, |
38 | - 'post_title' => wp_strip_all_tags( $title ) |
|
38 | + 'post_title' => wp_strip_all_tags($title) |
|
39 | 39 | ); |
40 | 40 | |
41 | - wp_update_post( apply_filters( 'lasso_title_updated_args', $args ) ); |
|
41 | + wp_update_post(apply_filters('lasso_title_updated_args', $args)); |
|
42 | 42 | |
43 | - do_action( 'lasso_title_updated', $postid, $title, get_current_user_ID() ); |
|
43 | + do_action('lasso_title_updated', $postid, $title, get_current_user_ID()); |
|
44 | 44 | |
45 | 45 | return true; |
46 | 46 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return array Array of keys to pull from $data per action and their sanitization callback |
55 | 55 | */ |
56 | - public static function params(){ |
|
57 | - $params[ 'process_title_update_post' ] = array( |
|
56 | + public static function params() { |
|
57 | + $params['process_title_update_post'] = array( |
|
58 | 58 | 'postid' => 'absint', |
59 | 59 | 'title' => 'strip_tags' |
60 | 60 | ); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @return array Array of additional functions to use to authorize action. |
72 | 72 | */ |
73 | 73 | public static function auth_callbacks() { |
74 | - $params[ 'process_title_update_post' ] = array( |
|
74 | + $params['process_title_update_post'] = array( |
|
75 | 75 | 'lasso_user_can' |
76 | 76 | ); |
77 | 77 |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @returns bool Always returns true |
28 | 28 | */ |
29 | - public function hide( $data ) { |
|
29 | + public function hide($data) { |
|
30 | 30 | |
31 | 31 | $user_id = get_current_user_ID(); |
32 | 32 | |
33 | - update_user_meta( $user_id, 'lasso_hide_tour', true ); |
|
33 | + update_user_meta($user_id, 'lasso_hide_tour', true); |
|
34 | 34 | |
35 | - do_action( 'lasso_tour_hidden', $user_id ); |
|
35 | + do_action('lasso_tour_hidden', $user_id); |
|
36 | 36 | |
37 | 37 | return true; |
38 | 38 | |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return array Array of keys to pull from $_POST per action and their sanitization callback |
47 | 47 | */ |
48 | - public static function params(){ |
|
49 | - $params[ 'process_tour_hide' ] = array( |
|
48 | + public static function params() { |
|
49 | + $params['process_tour_hide'] = array( |
|
50 | 50 | 'action' |
51 | 51 | ); |
52 | 52 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return array Array of additional functions to use to authorize action. |
62 | 62 | */ |
63 | 63 | public static function auth_callbacks() { |
64 | - $params[ 'process_tour_hide' ] = array( |
|
64 | + $params['process_tour_hide'] = array( |
|
65 | 65 | 'lasso_user_can' |
66 | 66 | ); |
67 | 67 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | use lasso\internal_api\api_action; |
11 | 11 | |
12 | -class update_object implements api_action{ |
|
12 | +class update_object implements api_action { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * The nonce action for this request. |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return bool Always returns true. |
31 | 31 | */ |
32 | - public function post( $data ) { |
|
32 | + public function post($data) { |
|
33 | 33 | |
34 | - $status = isset( $data['status'] ) ? $data['status'] : false; |
|
35 | - $postid = isset( $data['postid'] ) ? $data['postid'] : false; |
|
36 | - $slug = isset( $data['story_slug'] ) ? $data['story_slug'] : false; |
|
34 | + $status = isset($data['status']) ? $data['status'] : false; |
|
35 | + $postid = isset($data['postid']) ? $data['postid'] : false; |
|
36 | + $slug = isset($data['story_slug']) ? $data['story_slug'] : false; |
|
37 | 37 | |
38 | 38 | |
39 | 39 | |
@@ -43,20 +43,20 @@ discard block |
||
43 | 43 | 'post_status' => $status |
44 | 44 | ); |
45 | 45 | |
46 | - wp_update_post( apply_filters( 'lasso_object_status_update_args', $args ) ); |
|
46 | + wp_update_post(apply_filters('lasso_object_status_update_args', $args)); |
|
47 | 47 | |
48 | 48 | |
49 | 49 | // update categories |
50 | - $cats = isset( $data['story_cats'] ) ? $data['story_cats'] : false; |
|
51 | - self::set_post_terms( $postid, $cats, 'category' ); |
|
50 | + $cats = isset($data['story_cats']) ? $data['story_cats'] : false; |
|
51 | + self::set_post_terms($postid, $cats, 'category'); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | // update tags |
55 | - $tags = isset( $data['story_tags'] ) ? $data['story_tags'] : false; |
|
56 | - self::set_post_terms( $postid, $tags, 'post_tag' ); |
|
55 | + $tags = isset($data['story_tags']) ? $data['story_tags'] : false; |
|
56 | + self::set_post_terms($postid, $tags, 'post_tag'); |
|
57 | 57 | |
58 | 58 | |
59 | - do_action( 'lasso_post_updated', $postid, $slug, $status, get_current_user_ID() ); |
|
59 | + do_action('lasso_post_updated', $postid, $slug, $status, get_current_user_ID()); |
|
60 | 60 | |
61 | 61 | return true; |
62 | 62 | |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return array Array of keys to pull from $_POST per action and their sanitization callback |
72 | 72 | */ |
73 | - public static function params(){ |
|
74 | - $params[ 'process_update_object_post' ] = array( |
|
73 | + public static function params() { |
|
74 | + $params['process_update_object_post'] = array( |
|
75 | 75 | 'postid' => 'absint', |
76 | 76 | 'status' => 'strip_tags', |
77 | 77 | 'story_slug' => array( |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return array Array of additional functions to use to authorize action. |
102 | 102 | */ |
103 | 103 | public static function auth_callbacks() { |
104 | - $params[ 'process_update_object_post' ] = array( |
|
104 | + $params['process_update_object_post'] = array( |
|
105 | 105 | 'lasso_user_can' |
106 | 106 | ); |
107 | 107 | |
@@ -123,25 +123,25 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return bool True if update was successful, false if not. |
125 | 125 | */ |
126 | - public function set_post_terms( $postid, $value, $taxonomy ) { |
|
127 | - if( $value ) { |
|
126 | + public function set_post_terms($postid, $value, $taxonomy) { |
|
127 | + if ($value) { |
|
128 | 128 | // first check if multiple, make array if so. |
129 | - if ( self::has_multiple_objects( $value ) ) { |
|
130 | - $value = explode( ',', $value ); |
|
129 | + if (self::has_multiple_objects($value)) { |
|
130 | + $value = explode(',', $value); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
134 | - $result = wp_set_object_terms( $postid, $value, $taxonomy ); |
|
134 | + $result = wp_set_object_terms($postid, $value, $taxonomy); |
|
135 | 135 | } |
136 | - else { |
|
136 | + else { |
|
137 | 137 | //remove all terms from post |
138 | - $result = wp_set_object_terms( $postid, null, $taxonomy ); |
|
138 | + $result = wp_set_object_terms($postid, null, $taxonomy); |
|
139 | 139 | |
140 | 140 | } |
141 | 141 | |
142 | - if ( ! is_wp_error( $result ) ) { |
|
142 | + if (!is_wp_error($result)) { |
|
143 | 143 | return true; |
144 | - }else{ |
|
144 | + } else { |
|
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | * @return bool True if there are multiple terms; otherwise, false. |
157 | 157 | * @since 0.9.3 |
158 | 158 | */ |
159 | - public function has_multiple_objects( $value ) { |
|
159 | + public function has_multiple_objects($value) { |
|
160 | 160 | |
161 | - return 0 < strpos( $value, ',' ); |
|
161 | + return 0 < strpos($value, ','); |
|
162 | 162 | |
163 | 163 | } |
164 | 164 |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return bool Always returns true. |
30 | 30 | */ |
31 | - public function upload( $data ) { |
|
31 | + public function upload($data) { |
|
32 | 32 | |
33 | - $postid = isset( $data['postid'] ) ? $data['postid'] : false; |
|
34 | - $image_id = isset( $data['image_id'] ) ? absint( $data['image_id'] ) : false; |
|
33 | + $postid = isset($data['postid']) ? $data['postid'] : false; |
|
34 | + $image_id = isset($data['image_id']) ? absint($data['image_id']) : false; |
|
35 | 35 | |
36 | - set_post_thumbnail( $postid, $image_id ); |
|
36 | + set_post_thumbnail($postid, $image_id); |
|
37 | 37 | |
38 | - do_action( 'lasso_featured_image_set', $postid, $image_id, get_current_user_ID() ); |
|
38 | + do_action('lasso_featured_image_set', $postid, $image_id, get_current_user_ID()); |
|
39 | 39 | |
40 | 40 | return true; |
41 | 41 | |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return bool Always returns true. |
52 | 52 | */ |
53 | - public function delete( $data ) { |
|
53 | + public function delete($data) { |
|
54 | 54 | |
55 | - $postid = isset( $data['postid'] ) ? $data['postid'] : false; |
|
55 | + $postid = isset($data['postid']) ? $data['postid'] : false; |
|
56 | 56 | |
57 | - delete_post_thumbnail( $postid ); |
|
57 | + delete_post_thumbnail($postid); |
|
58 | 58 | |
59 | - do_action( 'lasso_featured_image_deleted', $postid, get_current_user_ID() ); |
|
59 | + do_action('lasso_featured_image_deleted', $postid, get_current_user_ID()); |
|
60 | 60 | |
61 | 61 | return true; |
62 | 62 | |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return array Array of keys to pull from $data per action and their sanitization callback |
71 | 71 | */ |
72 | - public static function params(){ |
|
73 | - $params[ 'process_upload_image_upload' ] = array( |
|
72 | + public static function params() { |
|
73 | + $params['process_upload_image_upload'] = array( |
|
74 | 74 | 'postid' => 'absint', |
75 | 75 | 'image_id' => 'absint' |
76 | 76 | ); |
77 | 77 | |
78 | - $params[ 'process_upload_image_delete' ] = array( |
|
78 | + $params['process_upload_image_delete'] = array( |
|
79 | 79 | 'postid' => 'absint', |
80 | 80 | ); |
81 | 81 |