diff --git a/ajax.php b/ajax.php index ca09431..842869f 100644 --- a/ajax.php +++ b/ajax.php @@ -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"); diff --git a/block_mfavatar.php b/block_mfavatar.php index 9c859f5..2bcb227 100644 --- a/block_mfavatar.php +++ b/block_mfavatar.php @@ -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; } @@ -84,7 +84,8 @@ public function get_content() {
- +
'; diff --git a/classes/avatargenerator.php b/classes/avatargenerator.php index e01b037..37a7432 100644 --- a/classes/avatargenerator.php +++ b/classes/avatargenerator.php @@ -89,7 +89,7 @@ class avatargenerator { 'border' => [ 'size' => 0, - // Properties: 'foreground','background','#aabbcc'. + // Sample: foreground,background,#aabbcc. 'color' => 'foreground', ], ]; diff --git a/module.js b/module.js index 4b1ae2c..3d423f4 100644 --- a/module.js +++ b/module.js @@ -15,7 +15,7 @@ M.block_mfavatar = { * Logging. * @param val */ - log : function (val) { + log: function (val) { try { console.log(val); } catch (e) { @@ -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) { @@ -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'); @@ -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 : { @@ -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); }); }; @@ -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); @@ -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) { @@ -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); } diff --git a/renderer.php b/renderer.php index 7b359af..1aa2de3 100644 --- a/renderer.php +++ b/renderer.php @@ -23,6 +23,8 @@ * @copyright 2015 MoodleFreak.com * @author Luuk Verhoeven **/ +defined('MOODLE_INTERNAL') || die; + class block_mfavatar_renderer extends plugin_renderer_base { /** @@ -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 = '