Beispiel #1
0
function lti_parse_request($wp)
{
    // Note: we should use the base_prefix always as when in site
    // blogs the prefix changes to prefixblog_id_, i.e. wp_60_
    global $wpdb;
    if (empty($_POST['lti_message_type'])) {
        return FALSE;
    }
    // Clear any existing session variables for this plugin
    lti_reset_session();
    // Deal with magic quotes before they cause OAuth to fail
    lti_strip_magic_quotes();
    // Do the necessary
    $tool = new LTI_Tool_Provider('lti_do_connect', array($wpdb->base_prefix));
    $tool->setParameterConstraint('resource_link_id', TRUE, 40);
    $tool->setParameterConstraint('user_id', TRUE);
    // Get settings and check whether sharing is enabled.
    $tool->allowSharing = TRUE;
    $tool->execute();
    exit;
}
Beispiel #2
0
 /**
  * Get the plugin instance...
  *
  * @param string|array $callbackHandler
  * @return \LTI_Tool_Provider
  */
 public function getLtiToolProvider($callbackHandler = null)
 {
     if (!$this->exists('res.lti.toolProvider')) {
         $tool = new \LTI_Tool_Provider($callbackHandler, $this->getLtiDataConnector());
         $tool->setParameterConstraint('oauth_consumer_key', TRUE, 50);
         $tool->setParameterConstraint('resource_link_id', TRUE, 50);
         $tool->setParameterConstraint('user_id', TRUE, 50);
         $tool->setParameterConstraint('roles', TRUE);
         $this->set('res.lti.toolProvider', $tool);
     }
     return $this->get('res.lti.toolProvider');
 }