Skip to content

Commit

Permalink
Merge pull request #263 from phpbits/develop
Browse files Browse the repository at this point in the history
Fix WP 5.6 array_intersect_key error
  • Loading branch information
jeffpaul committed Jul 13, 2021
2 parents 8e2f8bd + 864f63b commit b732b92
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions includes/Classifai/Services/ImageProcessing.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function register_endpoints() {
[
'methods' => 'GET',
'callback' => [ $this, 'provider_endpoint_callback' ],
'args' => [ 'route' => 'alt-tags' ],
'args' => [ 'route' => [ 'alt-tags' ] ],
'permission_callback' => '__return_true',
]
);
Expand All @@ -107,7 +107,7 @@ public function register_endpoints() {
[
'methods' => 'GET',
'callback' => [ $this, 'provider_endpoint_callback' ],
'args' => [ 'route' => 'image-tags' ],
'args' => [ 'route' => [ 'image-tags' ] ],
'permission_callback' => '__return_true',
]
);
Expand All @@ -118,7 +118,7 @@ public function register_endpoints() {
[
'methods' => 'GET',
'callback' => [ $this, 'provider_endpoint_callback' ],
'args' => [ 'route' => 'ocr' ],
'args' => [ 'route' => [ 'ocr' ] ],
'permission_callback' => '__return_true',
]
);
Expand All @@ -129,7 +129,7 @@ public function register_endpoints() {
[
'methods' => 'GET',
'callback' => [ $this, 'provider_endpoint_callback' ],
'args' => [ 'route' => 'smart-crop' ],
'args' => [ 'route' => [ 'smart-crop' ] ],
'permission_callback' => '__return_true',
]
);
Expand All @@ -146,7 +146,7 @@ public function provider_endpoint_callback( $request ) {
$response = true;
$attachment_id = $request->get_param( 'id' );
$custom_attributes = $request->get_attributes();
$route_to_call = isset( $custom_attributes['args'] ) && isset( $custom_attributes['args']['route'] ) ? $custom_attributes['args']['route'] : false;
$route_to_call = empty( $custom_attributes['args']['route'] ) ? false : $custom_attributes['args']['route'][0];

// Check to be sure the post both exists and is an attachment.
if ( ! get_post( $attachment_id ) || 'attachment' !== get_post_type( $attachment_id ) ) {
Expand Down

0 comments on commit b732b92

Please sign in to comment.