diff --git a/callback.php b/callback.php index 16a37ae..e498e16 100644 --- a/callback.php +++ b/callback.php @@ -1,4 +1,19 @@ . + /** * Implementation of a callback handler for accepting media item selections * from the RES Moodle plugin service. @@ -33,7 +48,9 @@ * @license GPL v3 - https://www.gnu.org/licenses/gpl-3.0.txt */ -// extract and decode querystring +defined('MOODLE_INTERNAL') || die; + +// Extract and decode querystring. if (!isset($_GET['media'])) { die('media parameter must be set'); } @@ -76,6 +93,6 @@ HTML; -// Output the generated HTML +// Output the generated HTML. header('Content-Type: text/html; charset=utf-8'); echo $html; diff --git a/db/access.php b/db/access.php index e9a701a..13b0616 100644 --- a/db/access.php +++ b/db/access.php @@ -1,4 +1,19 @@ . + /** * Set plugin access permissions * diff --git a/db/install.php b/db/install.php index 70bb88c..db17988 100644 --- a/db/install.php +++ b/db/install.php @@ -1,4 +1,19 @@ . + /** * Setup for repository_res plugin. * @@ -8,6 +23,8 @@ * @license GPL v3 - https://www.gnu.org/licenses/gpl-3.0.txt */ +defined('MOODLE_INTERNAL') || die; + /** * Install repository_res data into database. * diff --git a/lib.php b/lib.php index bc8fd23..84d5417 100644 --- a/lib.php +++ b/lib.php @@ -1,4 +1,19 @@ . + /** * Repository plugin which uses an external application to enable users to * select RES media URLs as resources. @@ -11,6 +26,9 @@ * @author Elliot Smith * @license GPL v3 - https://www.gnu.org/licenses/gpl-3.0.txt */ + +defined('MOODLE_INTERNAL') || die; + global $CFG; require_once($CFG->dirroot . '/repository/lib.php'); @@ -27,7 +45,7 @@ public static function plugin_init() { 'pluginservice_url' => getenv('PLUGINSERVICE_URL') ); - $id = repository::static_function('res','create', 'res', 0, + $id = repository::static_function('res', 'create', 'res', 0, context_system::instance(), $options, 0); @@ -38,8 +56,8 @@ public static function plugin_init() { * Expose the RES Moodle plugin service URL as a configuration option. */ public static function get_instance_option_names() { - $option_names = array('pluginservice_url'); - return array_merge(parent::get_instance_option_names(), $option_names); + $optionNames = array('pluginservice_url'); + return array_merge(parent::get_instance_option_names(), $optionNames); } /** @@ -50,10 +68,8 @@ public static function instance_config_form($mform, $classname = 'repository_res') { parent::instance_config_form($mform, 'repository_res'); - // name $mform->setDefault('name', 'RES'); - // pluginservice_url $mform->addElement('text', 'pluginservice_url', get_string('res:pluginservice_url', 'repository_res'), array('size' => '60')); @@ -68,12 +84,12 @@ public static function instance_config_form($mform, * Moodle plugin service). */ public function get_listing($path = null, $page = null) { - // load external filepicker - $callback_url = new moodle_url('/') . - 'repository/res/callback.php?repo_id=' . $this->id; + // Load external filepicker. + $callbackUrl = new moodle_url('/') . + 'repository/res/callback.php?repo_id=' . $this->id; - $pluginservice_url = $this->get_option('pluginservice_url') . - '?callback=' . urlencode($callback_url); + $pluginserviceUrl = $this->get_option('pluginservice_url') . + '?callback=' . urlencode($callbackUrl); return array( 'nologin' => true, @@ -81,7 +97,7 @@ public function get_listing($path = null, $page = null) { 'nosearch' => true, 'object' => array( 'type' => 'text/html', - 'src' => $pluginservice_url + 'src' => $pluginserviceUrl ) ); } diff --git a/version.php b/version.php index 5c207f4..855df0b 100644 --- a/version.php +++ b/version.php @@ -1,4 +1,19 @@ . + /** * Version data for repository_res plugin. * @@ -12,6 +27,6 @@ $plugin->component = 'repository_res'; $plugin->requires = 2017051500; -$plugin->version = 2017070500; +$plugin->version = 2017112700; $plugin->maturity = MATURITY_BETA; -$plugin->release = '0.0.3'; +$plugin->release = '0.0.4';