Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.
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
9 changes: 4 additions & 5 deletions wp-content/plugins/candela-lti/candela-lti.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static function deactivate() {
*/
public static function lti_launch() {
global $wp;

setcookie('content_only', 1, time()+3600, COOKIEPATH, COOKIE_DOMAIN);
// allows deep links with an LTI launch urls like:
// candela/api/lti/BLOGID?page_title=page_name
// candela/api/lti/BLOGID?page_title=section_name%2Fpage_name
Expand All @@ -117,23 +117,23 @@ public static function lti_launch() {

// todo make all the hide_* parameters copy over?
// If it's a deep LTI link default to showing content_only
wp_redirect( get_bloginfo('wpurl') . $slash . $page . "?content_only" );
wp_redirect( get_bloginfo('wpurl') . $slash . $page );
exit;
}

// allows deep links with an LTI launch urls like:
// candela/api/lti/BLOGID?page_id=10
if ( ! empty($wp->query_vars['page_id'] ) && is_numeric($wp->query_vars['page_id']) ) {
switch_to_blog((int)$wp->query_vars['blog']);
wp_redirect( get_bloginfo('wpurl') . "?p=" . $wp->query_vars['page_id'] . "&content_only" );
wp_redirect( get_bloginfo('wpurl') . "?p=" . $wp->query_vars['page_id'] );
exit;
}

// allows deep links with an LTI custom parameter like:
// custom_page_id=10
if ( ! empty($wp->query_vars['custom_page_id'] ) && is_numeric($wp->query_vars['custom_page_id']) ) {
switch_to_blog((int)$wp->query_vars['blog']);
wp_redirect( get_bloginfo('wpurl') . "?p=" . $wp->query_vars['custom_page_id'] . "&content_only" );
wp_redirect( get_bloginfo('wpurl') . "?p=" . $wp->query_vars['custom_page_id'] );
exit;
}

Expand Down Expand Up @@ -643,4 +643,3 @@ public static function remove_db_table() {
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,6 @@ function add_iframe_resize_message() {
);

}
function LTI_header_display() {
isset($_COOKIE['content_only']);
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<a href="#main-content">Skip to main content</a>
</div>

<?php if (!isset($_GET['content_only'])) { ?>
<?php if (LTI_header_display()) { ?>
<div class="row">
<nav role="navigation">
<!-- Book Title -->
Expand Down