Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions includes/tutor-general-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,16 @@ function tutor_getallheaders() {
}
}

if ( ! isset( $headers['Authorization'] ) ) {
foreach ( $headers as $name => $value ) {
if ( strtolower( $name ) === 'authorization' ) {
unset( $headers[$name] );
$headers['Authorization'] = $value;
break;
}
}
}

return $headers;
}
}
Expand Down
13 changes: 11 additions & 2 deletions includes/tutor-template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,14 +545,23 @@ function get_tutor_course_thumbnail( $size = 'post-thumbnail', $url = false ) {
$placeholder_url = tutor()->url . 'assets/images/placeholder.svg';
$thumb_url = $post_thumbnail_id ? wp_get_attachment_image_url( $post_thumbnail_id, $size ) : $placeholder_url;
$thumb_url = apply_filters( 'tutor_course_thumb_url', $thumb_url, $post_id, $size, $post_thumbnail_id );
$alt_text = '';

if ( $url ) {
return $thumb_url;
}

if ( $post_thumbnail_id ) {
$alt_text = get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true );
}

if ( empty( $alt_text ) ) {
$alt_text = get_the_title( $post_id );
}

echo '<div class="tutor-course-thumbnail">
<img src="' . esc_url( $thumb_url ) . '" />
</div>';
<img src="' . esc_url( $thumb_url ) . '" alt="' . esc_attr( $alt_text ) . '" />
</div>';
}
}

Expand Down
2 changes: 1 addition & 1 deletion restapi/RestAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public static function validate_api_key_secret( $api_key, $api_secret, $return_r
* @return boolean
*/
public static function process_api_request() {
$headers = apache_request_headers();
$headers = tutor_getallheaders();

if ( isset( $headers['Authorization'] ) ) {
$authorization_header = $headers['Authorization'];
Expand Down