Skip to content

Commit

Permalink
HFP-2858 Change function name to lower-case letters only
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmars committed Oct 8, 2019
1 parent 9a433dc commit 165aea0
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions classes/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static function instance($type = null) {
$fs = new \mod_hvp\file_storage();

$context = \context_system::instance();
$root = view_assets::getSiteRoot();
$root = view_assets::getsiteroot();
$url = "{$root}/pluginfile.php/{$context->id}/mod_hvp";

$language = self::get_language();
Expand Down Expand Up @@ -504,7 +504,7 @@ public function getH5pPath() {
// @codingStandardsIgnoreLine
public function getLibraryFileUrl($libraryfoldername, $fileName) {
$context = \context_system::instance();
$basepath = view_assets::getSiteRoot() . '/';
$basepath = view_assets::getsiteroot() . '/';
return "{$basepath}pluginfile.php/{$context->id}/mod_hvp/libraries/{$libraryfoldername}/{$fileName}";
}

Expand Down
14 changes: 7 additions & 7 deletions classes/view_assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct($cm, $course, $options = []) {

// Add JavaScript settings for this content.
$cid = 'cid-' . $this->content['id'];
$root = self::getSiteRoot();
$root = self::getsiteroot();
$this->settings['contents'][ $cid ] = array(
'library' => \H5PCore::libraryToString($this->content['library']),
'jsonContent' => $this->getfilteredparameters(),
Expand Down Expand Up @@ -152,7 +152,7 @@ private function getembedcode($embedenabled) {
return '';
}

$root = self::getSiteRoot();
$root = self::getsiteroot();
$embedurl = new \moodle_url("{$root}/mod/hvp/embed.php?id={$this->cm->id}");

return "<iframe src=\"{$embedurl->out()}\" width=\":w\" height=\":h\" frameborder=\"0\" " .
Expand All @@ -171,7 +171,7 @@ private function getresizecode($embedenabled) {
return '';
}

$resizeurl = new \moodle_url(self::getSiteRoot() . '/mod/hvp/library/js/h5p-resizer.js');
$resizeurl = new \moodle_url(self::getsiteroot() . '/mod/hvp/library/js/h5p-resizer.js');

return "<script src=\"{$resizeurl->out()}\" charset=\"UTF-8\"></script>";
}
Expand Down Expand Up @@ -213,7 +213,7 @@ private function generateassets() {
$url = $hvppath . $url;
}
$this->settings['loadedJs'][] = $url;
$this->jsrequires[] = new \moodle_url($isexternal ? $url : self::getSiteRoot() . $url);
$this->jsrequires[] = new \moodle_url($isexternal ? $url : self::getsiteroot() . $url);
}

// Schedule stylesheets for loading through Moodle.
Expand All @@ -226,7 +226,7 @@ private function generateassets() {
$url = $hvppath . $url;
}
$this->settings['loadedCss'][] = $url;
$this->cssrequires[] = new \moodle_url($isexternal ? $url : self::getSiteRoot() . $url);
$this->cssrequires[] = new \moodle_url($isexternal ? $url : self::getsiteroot() . $url);
}
} else {
// JavaScripts and stylesheets will be loaded through h5p.js.
Expand Down Expand Up @@ -300,7 +300,7 @@ public function addassetstopage() {
$PAGE->requires->data_for_js('H5PIntegration', $this->settings, true);

// Add xAPI collector script.
$PAGE->requires->js(new \moodle_url(self::getSiteRoot() . '/mod/hvp/xapi-collector.js'), true);
$PAGE->requires->js(new \moodle_url(self::getsiteroot() . '/mod/hvp/xapi-collector.js'), true);
}

/**
Expand Down Expand Up @@ -337,7 +337,7 @@ public function validatecontent() {
*
* @return string Root address for the site
*/
public static function getSiteRoot() {
public static function getsiteroot() {
global $CFG;
// In Moodle 3.4 version wwwroot is always the same as httpswwwroot
if ($CFG->version < 2017111300) {
Expand Down
4 changes: 2 additions & 2 deletions embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
require_course_login($course, true, $cm, true, true);
} catch (Exception $e) {
$PAGE->set_pagelayout('embedded');
$root = \mod_hvp\view_assets::getSiteRoot();
$root = \mod_hvp\view_assets::getsiteroot();
$embedfailedsvg = new \moodle_url("{$root}/mod/hvp/library/images/h5p.svg");
echo '<body style="margin:0">' .
'<div style="background: #fafafa ' .
Expand Down Expand Up @@ -84,7 +84,7 @@
// Embed specific page setup.
$PAGE->add_body_class('h5p-embed');
$PAGE->set_pagelayout('embedded');
$root = \mod_hvp\view_assets::getSiteRoot();
$root = \mod_hvp\view_assets::getsiteroot();
$PAGE->requires->css(new \moodle_url("{$root}/mod/hvp/embed.css"));
$PAGE->requires->js(new \moodle_url("{$root}/mod/hvp/embed.js"));

Expand Down
2 changes: 1 addition & 1 deletion grade.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
$dataviewid = 'h5p-results';

// Add required assets for data views.
$root = \mod_hvp\view_assets::getSiteRoot();
$root = \mod_hvp\view_assets::getsiteroot();
$PAGE->requires->js(new moodle_url($root . '/mod/hvp/library/js/jquery.js'), true);
$PAGE->requires->js(new moodle_url($root . '/mod/hvp/library/js/h5p-utils.js'), true);
$PAGE->requires->js(new moodle_url($root . '/mod/hvp/library/js/h5p-data-view.js'), true);
Expand Down
2 changes: 1 addition & 1 deletion library_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
);

// Add js.
$liburl = \mod_hvp\view_assets::getSiteRoot() . '/mod/hvp/library/';
$liburl = \mod_hvp\view_assets::getsiteroot() . '/mod/hvp/library/';

hvp_admin_add_generic_css_and_js($PAGE, $liburl, $settings);
$PAGE->requires->js(new moodle_url($liburl . 'js/h5p-library-list.js' . hvp_get_cache_buster()), true);
Expand Down
10 changes: 5 additions & 5 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function hvp_get_core_settings($context) {
global $USER, $CFG;

$systemcontext = \context_system::instance();
$basepath = \mod_hvp\view_assets::getSiteRoot() . '/';
$basepath = \mod_hvp\view_assets::getsiteroot() . '/';

// Check permissions and generate ajax paths.
$ajaxpaths = array();
Expand Down Expand Up @@ -106,7 +106,7 @@ function hvp_get_core_assets($context) {
$cachebuster = \hvp_get_cache_buster();

// Use relative URL to support both http and https.
$liburl = \mod_hvp\view_assets::getSiteRoot() . '/mod/hvp/library/';
$liburl = \mod_hvp\view_assets::getsiteroot() . '/mod/hvp/library/';
$relpath = '/' . preg_replace('/^[^:]+:\/\/[^\/]+\//', '', $liburl);

// Add core stylesheets.
Expand Down Expand Up @@ -154,7 +154,7 @@ function hvp_add_editor_assets($id = null, $mformid = null) {
);

// Use relative URL to support both http and https.
$url = \mod_hvp\view_assets::getSiteRoot() . '/mod/hvp/';
$url = \mod_hvp\view_assets::getsiteroot() . '/mod/hvp/';
$url = '/' . preg_replace('/^[^:]+:\/\/[^\/]+\//', '', $url);

// Make sure files are reloaded for each plugin update.
Expand Down Expand Up @@ -187,7 +187,7 @@ function hvp_add_editor_assets($id = null, $mformid = null) {
$PAGE->requires->js(new moodle_url('/mod/hvp/' . $languagescript . $cachebuster), true);

// Add JavaScript settings.
$root = \mod_hvp\view_assets::getSiteRoot();
$root = \mod_hvp\view_assets::getsiteroot();
$filespathbase = "{$root}/pluginfile.php/{$context->id}/mod_hvp/";
$contentvalidator = \mod_hvp\framework::instance('contentvalidator');
$editorajaxtoken = \H5PCore::createToken('editorajax');
Expand Down Expand Up @@ -411,7 +411,7 @@ function hvp_get_library_upgrade_info($name, $major, $minor) {
$context = \context_system::instance();
$libraryfoldername = "{$library->name}-{$library->version->major}.{$library->version->minor}";
if (\mod_hvp\file_storage::fileExists($context->id, 'libraries', '/' . $libraryfoldername . '/', 'upgrades.js')) {
$basepath = \mod_hvp\view_assets::getSiteRoot() . '/';
$basepath = \mod_hvp\view_assets::getsiteroot() . '/';
$library->upgradesScript = "{$basepath}pluginfile.php/{$context->id}/mod_hvp/libraries/{$libraryfoldername}/upgrades.js";
}

Expand Down
2 changes: 1 addition & 1 deletion review.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
$pageurl = new moodle_url('/mod/hvp/review.php', [
'id' => $hvp->id,
]);
$basepath = \mod_hvp\view_assets::getSiteRoot();
$basepath = \mod_hvp\view_assets::getsiteroot();
$PAGE->set_url($pageurl);
$PAGE->set_title($hvp->title);
$PAGE->set_heading($COURSE->fullname);
Expand Down
2 changes: 1 addition & 1 deletion upgrade_content_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
);

// Add JavaScripts.
$liburl = \mod_hvp\view_assets::getSiteRoot() . '/mod/hvp/library/';
$liburl = \mod_hvp\view_assets::getsiteroot() . '/mod/hvp/library/';
hvp_admin_add_generic_css_and_js($PAGE, $liburl, $settings);
$PAGE->requires->js(new moodle_url($liburl . 'js/h5p-version.js' . hvp_get_cache_buster()), true);
$PAGE->requires->js(new moodle_url($liburl . 'js/h5p-content-upgrade.js' . hvp_get_cache_buster()), true);
Expand Down

0 comments on commit 165aea0

Please sign in to comment.