@@ -32,13 +32,13 @@ public function rules() {
32
32
'default ' => 'draft ' ,
33
33
'sanitize_callback ' => [ $ this , 'sanitize_status ' ],
34
34
],
35
- 'sync ' => [
35
+ 'sync ' => [
36
36
'description ' => __ ( 'Whether the Repo should be synced to Gist. ' , 'wp-gistpen ' ),
37
37
'required ' => false ,
38
38
'default ' => 'off ' ,
39
39
'sanitize_callback ' => [ $ this , 'sanitize_sync ' ],
40
40
],
41
- 'blobs ' => [
41
+ 'blobs ' => [
42
42
'description ' => __ ( 'Individual code snippets attached to the repo. ' , 'wp-gistpen ' ),
43
43
'required ' => false ,
44
44
'default ' => [],
@@ -68,7 +68,7 @@ public function sanitize_description( $description ) {
68
68
* @return string|WP_Error The status, or an error if invalid.
69
69
*/
70
70
public function sanitize_status ( $ status ) {
71
- if ( ! in_array ( $ status , array_keys ( get_post_statuses () ) ) ) {
71
+ if ( ! in_array ( $ status , array_keys ( get_post_statuses () ), true ) ) {
72
72
return $ this ->create_error ( __ ( 'Param "status" must be a valid post status. ' , 'wp-gistpen ' ) );
73
73
}
74
74
@@ -82,7 +82,7 @@ public function sanitize_status( $status ) {
82
82
* @return string|WP_Error The sync value, or error if invalid.
83
83
*/
84
84
public function sanitize_sync ( $ sync ) {
85
- if ( ! in_array ( $ sync , [ 'on ' , 'off ' ] ) ) {
85
+ if ( ! in_array ( $ sync , [ 'on ' , 'off ' ], true ) ) {
86
86
return $ this ->create_error ( __ ( 'Param "sync" must be one of: on, off. ' , 'wp-gistpen ' ) );
87
87
}
88
88
@@ -125,6 +125,7 @@ public function sanitize_blobs( $blobs ) {
125
125
public function sanitize_blob ( $ blob , $ index ) {
126
126
if ( ! is_array ( $ blob ) ) {
127
127
return $ this ->create_error ( sprintf (
128
+ /* translators: %d: Blob index. */
128
129
__ ( 'Param "blob[%d]" must be an object. ' , 'wp-gistpen ' ),
129
130
$ index
130
131
) );
@@ -140,6 +141,7 @@ public function sanitize_blob( $blob, $index ) {
140
141
// @todo simplyify logic?
141
142
) {
142
143
return $ this ->create_error ( sprintf (
144
+ /* translators: %d: Blob index. */
143
145
__ ( 'Param "blob[%d].filename" must be a non-empty string. ' , 'wp-gistpen ' ),
144
146
$ index
145
147
) );
@@ -150,6 +152,7 @@ public function sanitize_blob( $blob, $index ) {
150
152
! is_string ( $ blob ['code ' ] )
151
153
) {
152
154
return $ this ->create_error ( sprintf (
155
+ /* translators: %d: Blob index. */
153
156
__ ( 'Param "blob[%d].code" must be a string. ' , 'wp-gistpen ' ),
154
157
$ index
155
158
) );
0 commit comments