Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header hider session #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 0 additions & 4 deletions .gitignore

This file was deleted.

24 changes: 0 additions & 24 deletions .htaccess

This file was deleted.

15 changes: 10 additions & 5 deletions wp-content/plugins/candela-lti/candela-lti.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
// If file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) exit;

// session_start() called in pressbooks.php
if (!isset($_SESSION['LTI_session'])) {
session_start();
$_SESSION['LTI_session'] = array();
}

// Do our necessary plugin setup and add_action routines.
CandelaLTI::init();

Expand Down Expand Up @@ -114,26 +120,26 @@ public static function lti_launch() {
} else {
$slash = '/';
}

//-REMOVE DEFUNCT(?) 'content_only' REDIRECTS?
// 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 . "?content_only" );
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'] . "&content_only" );
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'] . "&content_only" );
exit;
}

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

}

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

}

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

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