Skip to content

Commit

Permalink
Update for travis
Browse files Browse the repository at this point in the history
  • Loading branch information
luukverhoeven committed Oct 5, 2018
1 parent a4e0beb commit d10c5e2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
3 changes: 2 additions & 1 deletion ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
}
define('NO_DEBUG_DISPLAY', true);

require('../../config.php');
require_once(dirname(__FILE__) . '/../../config.php');
defined('MOODLE_INTERNAL') || die;
defined('MOODLE_INTERNAL') || die;

require_once("$CFG->libdir/gdlib.php");
Expand Down
5 changes: 3 additions & 2 deletions block_mfavatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function init() {
$this->title = get_string('pluginname', 'block_mfavatar');
}

public function instance_allow_multiple() {
public function instance_allow_multiple() {
return false;
}

Expand Down Expand Up @@ -84,7 +84,8 @@ public function get_content() {
<div>
<input type="hidden" name="blockid" value="' . $this->instance->id . '"/>
<input type="hidden" name="courseid" value="' . $COURSE->id . '"/>
<input class="singlebutton btn btn-primary" type="submit" value="' . get_string('makesnapshot', 'block_mfavatar') . '"/>
<input class="singlebutton btn btn-primary" type="submit" value="' .
get_string('makesnapshot', 'block_mfavatar') . '"/>
</div>
</form>
</div>';
Expand Down
2 changes: 1 addition & 1 deletion classes/avatargenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class avatargenerator {
'border' => [
'size' => 0,

// Properties: 'foreground','background','#aabbcc'.
// Sample: foreground,background,#aabbcc.
'color' => 'foreground',
],
];
Expand Down
24 changes: 12 additions & 12 deletions module.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ M.block_mfavatar = {
* Logging.
* @param val
*/
log : function (val) {
log: function (val) {
try {
console.log(val);
} catch (e) {
Expand All @@ -32,14 +32,14 @@ M.block_mfavatar = {
* @param flashvars
* @param supportwebrtc
*/
init : function (Y, applicationpath, expresspath, flashvars, supportwebrtc) {
init: function (Y, applicationpath, expresspath, flashvars, supportwebrtc) {

supportwebrtc = (supportwebrtc == 1) ? true : false;

if(location.protocol != 'https:'){
if (location.protocol != 'https:') {
alert('Microphone and Camera access no longer works on insecure origins. ' +
'To use this feature, you should consider switching your application to a secure origin, ' +
'such as HTTPS. See https://goo.gl/rStTGz for more details.');
'To use this feature, you should consider switching your application to a secure origin, ' +
'such as HTTPS. See https://goo.gl/rStTGz for more details.');
}

if (this.webrtc_is_supported() && supportwebrtc) {
Expand Down Expand Up @@ -78,7 +78,7 @@ M.block_mfavatar = {
*
* @param flashvars
*/
webrtc_load : function (flashvars) {
webrtc_load: function (flashvars) {
var snapshotButton = document.querySelector('button#snapshot');
var video = window.video = document.querySelector('video');
var canvasrender = window.canvas = document.querySelector('canvas#render');
Expand All @@ -101,7 +101,7 @@ M.block_mfavatar = {

var data = canvasrender.toDataURL('image/png');
YUI().use('io-base', function (Y) {
// saving the file
// Saving the file.
var cfg = {
method: 'POST',
data : {
Expand All @@ -111,7 +111,7 @@ M.block_mfavatar = {
};
var request = Y.io(flashvars.uploadPath, cfg);

//on completed request
// On completed request.
Y.on('io:complete', onComplete, Y);
});
};
Expand Down Expand Up @@ -164,7 +164,7 @@ M.block_mfavatar = {
var json = JSON.parse(response.response);

if (json.status == true) {
//reload profile picture
// Reload profile picture.
M.block_mfavatar.saved();
}
M.block_mfavatar.log(json);
Expand All @@ -188,13 +188,13 @@ M.block_mfavatar = {
*/
webrtc_is_supported: function () {
return !!(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia ||
navigator.msGetUserMedia) && location.protocol == 'https:';
navigator.msGetUserMedia) && location.protocol == 'https:';
},

/**
* Called when avatar is saved.
*/
saved : function () {
saved: function () {
this.log('Saved!!!');
var profilePicture = Y.one('img.profilepic');
if (profilePicture) {
Expand All @@ -212,7 +212,7 @@ M.block_mfavatar = {
* Error message.
* @param err
*/
error : function (err) {
error: function (err) {
M.block_mfavatar.log('Error!');
M.block_mfavatar.log(err);
}
Expand Down
4 changes: 3 additions & 1 deletion renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* @copyright 2015 MoodleFreak.com
* @author Luuk Verhoeven
**/
defined('MOODLE_INTERNAL') || die;

class block_mfavatar_renderer extends plugin_renderer_base {

/**
Expand Down Expand Up @@ -70,7 +72,7 @@ public function add_javascript_module() {
* @throws coding_exception
*/
public function snapshot_tool() {
// @TODO Convert to mustache.
// TODO Convert to mustache.
global $USER, $CFG; // Used for the profile link.

$html = '<div id="snapshotholder" style="display: none;">
Expand Down

0 comments on commit d10c5e2

Please sign in to comment.