diff --git a/lib/accesslib.php b/lib/accesslib.php index 83833b7e47e78..5e6a45a6e58b3 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -1,7 +1,7 @@ . @@ -78,7 +78,7 @@ * $accessdata[ra][$contextpath]= array($roleid) * [$contextpath]= array($roleid) * [$contextpath]= array($roleid) - * + * * * Role definitions are stored like this * (no cap merge is done - so it's compact) @@ -170,15 +170,15 @@ define('ROLENAME_ALIAS_RAW', 4); /** size limit for context cache */ -if (!defined('MAX_CONTEXT_CACHE_SIZE')) { +if (!defined('MAX_CONTEXT_CACHE_SIZE')) { define('MAX_CONTEXT_CACHE_SIZE', 5000); } /** - * Although this looks like a global variable, it isn't really. + * Although this looks like a global variable, it isn't really. * - * It is just a private implementation detail to accesslib that MUST NOT be used elsewhere. - * It is used to cache various bits of data between function calls for performance reasons. + * It is just a private implementation detail to accesslib that MUST NOT be used elsewhere. + * It is used to cache various bits of data between function calls for performance reasons. * Sadly, a PHP global variale is the only way to impleemnt this, withough rewriting everything * as methods of a class, instead of functions. * @@ -198,7 +198,7 @@ /** * Clears accesslib's private caches. ONLY BE USED BY UNIT TESTS - * + * * This method should ONLY BE USED BY UNIT TESTS. It clears all of * accesslib's private caches. You need to do this before setting up test data, * and also at the end fo the tests. @@ -405,7 +405,7 @@ function get_default_frontpage_role_access($roleid, $accessdata=NULL) { /** * Get the default guest role - * + * * @global object * @global object * @return object role @@ -443,7 +443,7 @@ function get_guest_role() { * By default checks the capabilties of the current user, but you can pass a * different userid. By default will return true for admin-like users who have the * moodle/site:doanything capability, but you can override that with the fourth argument. - * + * * @param string $capability the name of the capability to check. For example mod/forum:view * @param object $context the context to check the capability in. You normally get this with {@link get_context_instance}. * @param integer $userid A user id. By default (null) checks the permissions of the current user. @@ -1284,7 +1284,7 @@ function get_user_courses_bycap($userid, $cap, $accessdata, $doanything, $sort=' if ($limit > 0 && $cc >= $limit) { break; } - + $courses[] = $c; $cc++; } @@ -1731,7 +1731,7 @@ function compact_rdefs(&$rdefs) { * for example. Call it only _after_ you've setup $USER and called * check_enrolment_plugins(); * @see check_enrolment_plugins() - * + * * @global object * @global object * @global object @@ -2808,7 +2808,7 @@ function assign_capability($capability, $permission, $roleid, $contextid, $overw /** * Unassign a capability from a role. - * + * * @global object * @param int $roleid the role id * @param string $capability the name of the capability @@ -2880,7 +2880,7 @@ function get_roles_with_capability($capability, $permission=NULL, $context='') { /** * This function makes a role-assignment (a role for a user or group in a particular context) - * + * * @global object * @global object * @global object @@ -3505,11 +3505,11 @@ function print_context_name($context, $withprefix = true, $short = false) { } /** - * Get a URL for a context, if there is a natural one. For example, for + * Get a URL for a context, if there is a natural one. For example, for * CONTEXT_COURSE, this is the course page. For CONTEXT_USER it is the * user profile page. * - * First three parameters as for + * First three parameters as for * * @global object * @global object @@ -3559,10 +3559,10 @@ function get_context_url($context) { /** * Returns an array of all the known types of risk - * The array keys can be used, for example as CSS class names, or in calls to + * The array keys can be used, for example as CSS class names, or in calls to * print_risk_icon. The values are the corresponding RISK_ constants. * - * @return array all the known types of risk. + * @return array all the known types of risk. */ function get_all_risks() { return array( @@ -3649,7 +3649,7 @@ function fetch_context_capabilities($context) { include_once($modfile); $modfunction = $module->name.'_get_extra_capabilities'; if (function_exists($modfunction)) { - $extracaps = $modfunction(); + $extracaps = $modfunction(); } } if(empty($extracaps)) { @@ -3797,7 +3797,7 @@ function get_parent_contextid($context) { * otherwise false. * * @param object $context a context object. - * @return bool + * @return bool */ function is_inside_frontpage($context) { $frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID); @@ -4057,7 +4057,7 @@ function get_capability_string($capabilityname) { case 'webservice': $string = get_string($stringname, 'webservice_'.$componentname); break; - + default: $string = get_string($stringname); break; @@ -4442,7 +4442,7 @@ function get_assignable_roles($context, $rolenamedisplay = ROLENAME_ALIAS, $with if (has_capability('moodle/site:doanything', get_context_instance(CONTEXT_SYSTEM))) { // show all roles allowed in this context to admins $raafrom = ""; - $raawhere = ""; + $raawhere = ""; } $params['userid'] = $USER->id; @@ -4620,7 +4620,7 @@ function get_overridable_roles($context, $rolenamedisplay = ROLENAME_ALIAS, $wit SELECT ro.id, ro.name$extrafields FROM {role} ro ORDER BY ro.sortorder ASC", $params); - + } else { $roles = $DB->get_records_sql(" SELECT ro.id, ro.name$extrafields @@ -5504,7 +5504,7 @@ function get_role_users($roleid, $context, $parent=false, $fields='', /** * Counts all the users assigned this role in this context or higher - * + * * @global object * @param mixed $roleid either int or an array of ints * @param object $context @@ -5766,7 +5766,7 @@ function get_users_from_role_on_context($role, $context) { /** * Simple function returning a boolean true if roles exist, otherwise false - * + * * @global object * @param int $userid * @param int $roleid @@ -5879,7 +5879,7 @@ function role_fix_names($roleoptions, $context, $rolenamedisplay=ROLENAME_ALIAS) * * @param string $cap component string a * @param string $comp component string b - * @param mixed $contextlevel + * @param mixed $contextlevel * @return bool whether 2 component are in different "sections" */ function component_level_changed($cap, $comp, $contextlevel) { @@ -5966,7 +5966,7 @@ function build_context_path($force=false) { * * Different code for each database - mostly for performance reasons */ - $dbfamily = $DB->get_dbfamily(); + $dbfamily = $DB->get_dbfamily(); if ($dbfamily == 'mysql') { $updatesql = "UPDATE {context} ct, {context_temp} temp SET ct.path = temp.path, @@ -6169,7 +6169,7 @@ function make_context_subobj($rec) { /** * Do some basic, quick checks to see whether $rec->context looks like a valid context object. * - * @param object $rec a think that has a context, for example a course, + * @param object $rec a think that has a context, for example a course, * course category, course modules, etc. * @param int $contextlevel the type of thing $rec is, one of the CONTEXT_... constants. * @return bool whether $rec->context looks like the correct context object @@ -6316,5 +6316,3 @@ function role_cap_duplicate($sourcerole, $targetrole) { $DB->insert_record('role_capabilities', $cap); } } - -?> diff --git a/lib/ajax/ajaxlib.php b/lib/ajax/ajaxlib.php index f53f0cc65a92f..b4fe79c5ecdad 100644 --- a/lib/ajax/ajaxlib.php +++ b/lib/ajax/ajaxlib.php @@ -54,7 +54,7 @@ function setup_core_javascript(page_requirements_manager $requires) { $requires->skip_link_to('maincontent', get_string('tocontent', 'access')); - // Note that, as a short-cut, the code + // Note that, as a short-cut, the code // $js = "document.body.className += ' jsenabled';\n"; // is hard-coded in {@link page_requirements_manager::get_top_of_body_code) $requires->yui_lib('container'); @@ -62,7 +62,7 @@ function setup_core_javascript(page_requirements_manager $requires) { $requires->string_for_js('confirmation', 'admin'); $requires->string_for_js('cancel', 'moodle'); $requires->string_for_js('yes', 'moodle'); - $requires->js_function_call('init_help_icons'); + $requires->js_function_call('init_help_icons'); } @@ -258,7 +258,7 @@ public function js_function_call($function, $arguments = array()) { /** * Make a language string available to JavaScript. - * + * * All the strings will be available in a mstr object in the global namespace. * So, for example, after a call to $PAGE->requires->string_for_js('course', 'moodle'); * then the JavaScript variable mstr.moodle.course will be 'Course', or the @@ -327,7 +327,7 @@ public function strings_for_js($identifiers, $module, $a=NULL) { /** * Make some data from PHP available to JavaScript code. - * + * * For example, if you call *
* $PAGE->requires->data_for_js('mydata', array('name' => 'Moodle')); @@ -360,7 +360,7 @@ public function data_for_js($variable, $data) { $this->variablesinitialised[$variable] = 1; return $requirement; } - + /** * Creates a YUI event handler. * @@ -1090,9 +1090,9 @@ public function get_js_code() { } /** - * This class represents a Javascript event handler, listening for a + * This class represents a Javascript event handler, listening for a * specific Event to occur on a DOM element identified by a given id. - * By default the data will be output at the end of the page, but you + * By default the data will be output at the end of the page, but you * can change that using the {@link asap()}, {@link in_head()}, etc. methods. * * @copyright 2009 Nicolas Connault @@ -1445,5 +1445,3 @@ function print_javascript($courseid, $return=false) { } } - -?> diff --git a/lib/ajax/getnavbranch.php b/lib/ajax/getnavbranch.php index dd57c0f6ae820..524f7a664809d 100644 --- a/lib/ajax/getnavbranch.php +++ b/lib/ajax/getnavbranch.php @@ -94,4 +94,4 @@ header('Content-type: text/xml'); echo ''; // Convert and output the branch as XML -echo $converter->convert($branch); \ No newline at end of file +echo $converter->convert($branch); diff --git a/lib/ajax/setuserpref.php b/lib/ajax/setuserpref.php index 28c8b52742fa2..ca94ccbd20072 100644 --- a/lib/ajax/setuserpref.php +++ b/lib/ajax/setuserpref.php @@ -1,4 +1,4 @@ - \ No newline at end of file diff --git a/lib/ajax/simpletest/testajaxlib.php b/lib/ajax/simpletest/testajaxlib.php index fdca24f687fae..d235f5a5c39ac 100644 --- a/lib/ajax/simpletest/testajaxlib.php +++ b/lib/ajax/simpletest/testajaxlib.php @@ -503,5 +503,3 @@ function test_ajaxenabled() $this->assertTrue(ajaxenabled($tested_browsers)); } } - -?> diff --git a/lib/authlib.php b/lib/authlib.php index 77a74f8343080..b89aa0160f335 100644 --- a/lib/authlib.php +++ b/lib/authlib.php @@ -1,7 +1,7 @@ . @@ -19,7 +19,7 @@ * Multiple plugin authentication Support library * * 2006-08-28 File created, AUTH return values defined. - * + * * @package moodlecore * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -101,7 +101,7 @@ class auth_plugin_base { /** * This is the primary method that is used by the authenticate_user_login() - * function in moodlelib.php. + * function in moodlelib.php. * * This method should return a boolean indicating * whether or not the username and password authenticate successfully. @@ -131,7 +131,7 @@ function can_change_password() { /** * Returns the URL for changing the users' passwords, or empty if the default - * URL can be used. + * URL can be used. * * This method is used if can_change_password() returns true. * This method is called only when user is logged in, it may use global $USER. @@ -156,7 +156,7 @@ function is_internal() { } /** - * Updates the user's password. + * Updates the user's password. * * In previous versions of Moodle, the function * auth_user_update_password accepted a username as the first parameter. The @@ -420,7 +420,7 @@ function get_description() { } return $authdescription; } - + /** * Returns whether or not the captcha element is enabled, and the admin settings fulfil its requirements. * @@ -433,5 +433,3 @@ function is_captcha_enabled() { } - -?> diff --git a/lib/base32.php b/lib/base32.php index f888abdd51bfb..48c3dece0f3cf 100644 --- a/lib/base32.php +++ b/lib/base32.php @@ -194,5 +194,3 @@ function Base32_decode($inString) { return $outString; } - -?> \ No newline at end of file diff --git a/lib/boxlib.php b/lib/boxlib.php index 325a0a0d3e526..a412cbb26ec02 100755 --- a/lib/boxlib.php +++ b/lib/boxlib.php @@ -642,4 +642,3 @@ function _clearErrors() { } } -?> diff --git a/lib/completionlib.php b/lib/completionlib.php index 715dce44b5548..7b429a12ffaf2 100644 --- a/lib/completionlib.php +++ b/lib/completionlib.php @@ -1,7 +1,7 @@ . @@ -20,7 +20,7 @@ * by students ('completion') * * Completion top-level options (admin setting enablecompletion) - * + * * @package moodlecore * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -113,8 +113,8 @@ public function __construct($course) { /** * Determines whether completion is enabled across entire site. - * - * Static function. + * + * Static function. * * @global object * @return int COMPLETION_ENABLED (true) if completion is enabled for the site, @@ -396,7 +396,7 @@ public function count_user_data($cm) { /** * Deletes completion state related to an activity for all users. - * + * * Intended for use only when the activity itself is deleted. * * @global object @@ -420,12 +420,12 @@ public function delete_all_state($cm) { /** * Recalculates completion state related to an activity for all users. - * + * * Intended for use if completion conditions change. (This should be avoided * as it may cause some things to become incomplete when they were previously * complete, with the effect - for example - of hiding a later activity that * was previously available.) - * + * * Resetting state of manual tickbox has same result as deleting state for * it. * @@ -479,8 +479,8 @@ public function reset_all_state($cm) { * fill the cache, retrieves information from the entire course not just for * this one activity * @param int $userid User ID or 0 (default) for current user - * @param array $modinfo Supply the value here - this is used for unit - * testing and so that it can be called recursively from within + * @param array $modinfo Supply the value here - this is used for unit + * testing and so that it can be called recursively from within * get_fast_modinfo. (Needs only list of all CMs with IDs.) * Otherwise the method calls get_fast_modinfo itself. * @return object Completion data (record from course_modules_completion) @@ -593,7 +593,7 @@ public function get_data($cm, $wholecourse=false, $userid=0, $modinfo=null) { /** * Updates completion data for a particular coursemodule and user (user is * determined from $data). - * + * * (Internal function. Not private, so we can unit-test it.) * * @global object @@ -687,10 +687,10 @@ function internal_get_tracked_users($sortfirstname, $groupid=0) { /** * Obtains progress information across a course for all users on that course, or * for all users in a specific group. Intended for use when displaying progress. - * + * * This includes only users who, in course context, have one of the roles for * which progress is tracked (the progresstrackedroles admin option). - * + * * Users are included (in the first array) even if they do not have * completion progress for any course-module. * @@ -788,7 +788,7 @@ public function inform_grade_changed($cm, $item, $grade, $deleted) { * Calculates the completion state that would result from a graded item * (where grade-based completion is turned on) based on the actual grade * and settings. - * + * * Internal function. Not private, so we can unit-test it. * * @uses COMPLETION_INCOMPLETE @@ -837,8 +837,8 @@ function internal_systemerror($error) { $CFG->wwwroot.'/course/view.php?id='.$this->course->id,null,$error); } - /** - * For testing only. Wipes information cached in user session. + /** + * For testing only. Wipes information cached in user session. * * @global object */ @@ -848,6 +848,3 @@ static function wipe_session_cache() { unset($SESSION->completioncacheuserid); } } - - -?> diff --git a/lib/componentlib.class.php b/lib/componentlib.class.php index 51a1d767ccfa4..43a4be3427266 100644 --- a/lib/componentlib.class.php +++ b/lib/componentlib.class.php @@ -1,7 +1,7 @@ . @@ -124,7 +124,7 @@ * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - + /** * @global object $CFG * @name $CFG @@ -140,7 +140,7 @@ /** * This class is used to check, download and install items from - * download.moodle.org to the moodledata directory. + * download.moodle.org to the moodledata directory. * * It always return true/false in all their public methods to say if * execution has ended succesfuly or not. If there is any problem @@ -545,5 +545,3 @@ function get_extra_md5_field() { } } /// End of component_installer class - -?> diff --git a/lib/conditionlib.php b/lib/conditionlib.php index b9f2e663aaf19..b9af5f21a6703 100644 --- a/lib/conditionlib.php +++ b/lib/conditionlib.php @@ -1,6 +1,6 @@ . /** * Used for tracking conditions that apply before activities are displayed * to students ('conditional availability'). - * + * * @package moodlecore * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -31,7 +31,7 @@ /** The $cm variable is expected to contain all completion-related data */ define('CONDITION_MISSING_NOTHING',0); -/** The $cm variable is expected to contain the fields from course_modules but +/** The $cm variable is expected to contain the fields from course_modules but not the course_modules_availability data */ define('CONDITION_MISSING_EXTRATABLE',1); /** The $cm variable is expected to contain nothing except the ID */ @@ -66,12 +66,12 @@ class condition_info { * @uses DEBUG_DEVELOPER * @uses CONDITION_MISSING_EXTRATABLE * @param object $cm Moodle course-module object. May have extra fields - * ->conditionsgrade, ->conditionscompletion which should come from - * get_fast_modinfo. Should have ->availablefrom, ->availableuntil, + * ->conditionsgrade, ->conditionscompletion which should come from + * get_fast_modinfo. Should have ->availablefrom, ->availableuntil, * and ->showavailability, ->course; but the only required thing is ->id. * @param int $expectingmissing Used to control whether or not a developer - * debugging message (performance warning) will be displayed if some of - * the above data is missing and needs to be retrieved; a + * debugging message (performance warning) will be displayed if some of + * the above data is missing and needs to be retrieved; a * CONDITION_MISSING_xx constant * @param bool $loaddata If you need a 'write-only' object, set this value * to false to prevent database access from constructor @@ -95,12 +95,12 @@ public function __construct($cm, $expectingmissing=CONDITION_MISSING_NOTHING, } // Missing basic data from course_modules - if (!isset($cm->availablefrom) || !isset($cm->availableuntil) || + if (!isset($cm->availablefrom) || !isset($cm->availableuntil) || !isset($cm->showavailability) || !isset($cm->course)) { if ($expectingmissingconditionsgrade) || !isset($cm->conditionscompletion)) { if ($expectingmissing get_records_sql($sql=" -SELECT +SELECT cma.id as cmaid, gi.*,cma.sourcecmid,cma.requiredcompletion,cma.gradeitemid, cma.grademin as conditiongrademin, cma.grademax as conditiongrademax FROM @@ -181,7 +181,7 @@ private static function get_grade_name($gradeitemobj) { if (isset($gradeitemobj->id)) { require_once($CFG->libdir.'/gradelib.php'); $item = new grade_item; - grade_object::set_properties($item, $gradeitemobj); + grade_object::set_properties($item, $gradeitemobj); return $item->get_name(); } else { return '!missing'; // Ooops, missing grade @@ -276,9 +276,9 @@ public function wipe_conditions() { * @global object * @global object * @param object $modinfo Usually leave as null for default. Specify when - * calling recursively from inside get_fast_modinfo. The value supplied + * calling recursively from inside get_fast_modinfo. The value supplied * here must include list of all CMs with 'id' and 'name' - * @return string Information string (for admin) about all restrictions on + * @return string Information string (for admin) about all restrictions on * this item */ public function get_full_information($modinfo=null) { @@ -343,9 +343,9 @@ public function get_full_information($modinfo=null) { /** * Determines whether this particular course-module is currently available - * according to these criteria. - * - * - This does not include the 'visible' setting (i.e. this might return + * according to these criteria. + * + * - This does not include the 'visible' setting (i.e. this might return * true even if visible is false); visible is handled independently. * - This does not take account of the viewhiddenactivities capability. * That should apply later. @@ -356,14 +356,14 @@ public function get_full_information($modinfo=null) { * @uses COMPLETION_COMPLETE_FAIL * @uses COMPLETION_COMPLETE_PASS * @param string $information If the item has availability restrictions, - * a string that describes the conditions will be stored in this variable; + * a string that describes the conditions will be stored in this variable; * if this variable is set blank, that means don't display anything - * @param bool $grabthelot Performance hint: if true, caches information + * @param bool $grabthelot Performance hint: if true, caches information * required for all course-modules, to make the front page and similar * pages work more quickly (works only for current user) * @param int $userid If set, specifies a different user ID to check availability for * @param object $modinfo Usually leave as null for default. Specify when - * calling recursively from inside get_fast_modinfo. The value supplied + * calling recursively from inside get_fast_modinfo. The value supplied * here must include list of all CMs with 'id' and 'name' * @return bool True if this item is available to the user, false otherwise */ @@ -422,7 +422,7 @@ public function is_available(&$information, $grabthelot=false, $userid=0, $modin foreach ($this->cm->conditionsgrade as $gradeitemid=>$minmax) { $score = $this->get_cached_grade_score($gradeitemid, $grabthelot, $userid); if ($score===false || - (!is_null($minmax->min) && $score<$minmax->min) || + (!is_null($minmax->min) && $score<$minmax->min) || (!is_null($minmax->max) && $score>=$minmax->max)) { // Grade fail $available = false; @@ -473,7 +473,7 @@ public function is_available(&$information, $grabthelot=false, $userid=0, $modin } /** - * Shows a time either as a date (if it falls exactly on the day) or + * Shows a time either as a date (if it falls exactly on the day) or * a full date and time, according to user's timezone. * * @param int $time Time @@ -508,7 +508,7 @@ public function show_availability() { $this->require_data(); return $this->cm->showavailability; } - + /** * Internal function cheks that data was loaded. * @@ -522,19 +522,19 @@ private function require_data() { } /** - * Obtains a grade score. Note that this score should not be displayed to - * the user, because gradebook rules might prohibit that. It may be a + * Obtains a grade score. Note that this score should not be displayed to + * the user, because gradebook rules might prohibit that. It may be a * non-final score subject to adjustment later. * * @global object * @global object * @global object * @param int $gradeitemid Grade item ID we're interested in - * @param bool $grabthelot If true, grabs all scores for current user on + * @param bool $grabthelot If true, grabs all scores for current user on * this course, so that later ones come from cache - * @param int $userid Set if requesting grade for a different user (does + * @param int $userid Set if requesting grade for a different user (does * not use cache) - * @return float Grade score as a percentage in range 0-100 (e.g. 100.0 + * @return float Grade score as a percentage in range 0-100 (e.g. 100.0 * or 37.21), or false if user does not have a grade yet */ private function get_cached_grade_score($gradeitemid, $grabthelot=false, $userid=0) { @@ -544,14 +544,14 @@ private function get_cached_grade_score($gradeitemid, $grabthelot=false, $userid if (empty($SESSION->gradescorecache) || $SESSION->gradescorecacheuserid!=$USER->id) { $SESSION->gradescorecache = array(); $SESSION->gradescorecacheuserid = $USER->id; - } + } if (!array_key_exists($gradeitemid, $SESSION->gradescorecache)) { if ($grabthelot) { // Get all grades for the current course $rs = $DB->get_recordset_sql(" SELECT - gi.id,gg.finalgrade,gg.rawgrademin,gg.rawgrademax -FROM + gi.id,gg.finalgrade,gg.rawgrademin,gg.rawgrademax +FROM {grade_items} gi LEFT JOIN {grade_grades} gg ON gi.id=gg.itemid AND gg.userid=? WHERE @@ -560,7 +560,7 @@ private function get_cached_grade_score($gradeitemid, $grabthelot=false, $userid $SESSION->gradescorecache[$record->id] = is_null($record->finalgrade) // No grade = false - ? false + ? false // Otherwise convert grade to percentage : (($record->finalgrade - $record->rawgrademin) * 100) / ($record->rawgrademax - $record->rawgrademin); @@ -605,8 +605,8 @@ private function get_cached_grade_score($gradeitemid, $grabthelot=false, $userid } } - /** - * For testing only. Wipes information cached in user session. + /** + * For testing only. Wipes information cached in user session. * * @global object */ @@ -617,7 +617,7 @@ static function wipe_session_cache() { } /** - * Utility function called by modedit.php; updates the + * Utility function called by modedit.php; updates the * course_modules_availability table based on the module form data. * * @param object $cm Course-module with as much data as necessary, min id @@ -671,4 +671,3 @@ public static function completion_value_used_as_condition($course, $cm) { return array_key_exists($cm->id, $CONDITIONLIB_PRIVATE->usedincondition[$course->id]); } } -?> diff --git a/lib/csvlib.class.php b/lib/csvlib.class.php index cebe02e5894fd..8ef0878395ff2 100644 --- a/lib/csvlib.class.php +++ b/lib/csvlib.class.php @@ -318,4 +318,3 @@ function get_new_iid($type) { return $iiid; } } -?> diff --git a/lib/customcheckslib.php b/lib/customcheckslib.php index 80597459ab947..5d860b27e7f97 100644 --- a/lib/customcheckslib.php +++ b/lib/customcheckslib.php @@ -51,5 +51,3 @@ function php_check_register_globals($result) { return $result; } - -?> diff --git a/lib/datalib.php b/lib/datalib.php index ab0281194cea1..6a5b1ca00c32d 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -1,7 +1,7 @@ . @@ -27,21 +27,21 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - /** + /** * The maximum courses in a category - * MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer! + * MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer! */ define('MAX_COURSES_IN_CATEGORY', 10000); -/** +/** * The maximum number of course categories - * MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer! + * MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer! */ define('MAX_COURSE_CATEGORIES', 10000); - /** + /** * Number of seconds to wait before updating lastaccess information in DB. */ - define('LASTACCESS_UPDATE_SECS', 60); + define('LASTACCESS_UPDATE_SECS', 60); /** * Returns $user object of the main admin user @@ -265,7 +265,7 @@ function search_users($courseid, $groupid, $searchtext, $sort='', array $excepti * @param string $page The page or records to return * @param string $recordsperpage The number of records to return per page * @param string $fields A comma separated list of fields to be returned from the chosen table. - * @return array|int|bool {@link $USER} records unless get is false in which case the integer count of the records found is returned. + * @return array|int|bool {@link $USER} records unless get is false in which case the integer count of the records found is returned. * False is returned if an error is encountered. */ function get_users($get=true, $search='', $confirmed=false, array $exceptions=null, $sort='firstname ASC', @@ -508,7 +508,7 @@ function get_courses($categoryid="all", $sort="c.sortorder ASC", $fields="c.*") * @param int $totalcount Reference for the number of courses * @param string $limitfrom The course to start from * @param string $limitnum The number of courses to limit to - * @return array Array of courses + * @return array Array of courses */ function get_courses_page($categoryid="all", $sort="c.sortorder ASC", $fields="c.*", &$totalcount, $limitfrom="", $limitnum="") { @@ -929,7 +929,7 @@ function get_my_courses($userid, $sort='visible DESC,sortorder ASC', $fields=NUL if ($limit > 0 && $cc >= $limit) { break; } - + $courses[$c->id] = $c; $cc++; } @@ -1287,7 +1287,7 @@ function get_all_subcategories($catid) { /** * Return specified category, default if given does not exist - * + * * @global object * @uses MAX_COURSES_IN_CATEGORY * @uses CONTEXT_COURSECAT @@ -1947,7 +1947,7 @@ function get_all_instances_in_course($modulename, $course, $userid=NULL, $includ * is visible or not, groupmembersonly visibility not tested * * @global object - + * @param $moduletype Name of the module eg 'forum' * @param $module Object which is the instance of the module * @return bool Success @@ -2001,8 +2001,8 @@ function coursemodule_visible_for_user($cm, $userid=0) { if ($CFG->enableavailability) { require_once($CFG->libdir.'/conditionlib.php'); $ci=new condition_info($cm,CONDITION_MISSING_EXTRATABLE); - if(!$ci->is_available($cm->availableinfo,false,$userid) and - !has_capability('moodle/course:viewhiddenactivities', + if(!$ci->is_available($cm->availableinfo,false,$userid) and + !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id), $userid)) { return false; } @@ -2440,5 +2440,3 @@ function user_can_create_courses() { $catsrs->close(); return false; } - -?> diff --git a/lib/db/access.php b/lib/db/access.php index 69009a61dd3df..eddbdd51f7ccf 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -1,4 +1,4 @@ - diff --git a/lib/db/events.php b/lib/db/events.php index 1caad0df040ac..b7751cb173aa6 100644 --- a/lib/db/events.php +++ b/lib/db/events.php @@ -1,4 +1,4 @@ - array ( 'handlerfile' => '/lib/messagelib.php', - 'handlerfunction' => 'message_send_handler', + 'handlerfunction' => 'message_send_handler', 'schedule' => 'instant' ), @@ -106,5 +106,3 @@ role_unassigned - object role_assignments table record */ - -?> diff --git a/lib/db/install.php b/lib/db/install.php index 949a44131a20f..2f210f0c9d023 100644 --- a/lib/db/install.php +++ b/lib/db/install.php @@ -1,4 +1,4 @@ - diff --git a/lib/ddl/database_manager.php b/lib/ddl/database_manager.php index 6411b87814a3e..bbf30554a7cbd 100644 --- a/lib/ddl/database_manager.php +++ b/lib/ddl/database_manager.php @@ -429,7 +429,7 @@ public function install_one_table_from_xmldb_file($file, $tablename) { } /** - * This function will generate all the needed SQL statements, specific for each + * This function will generate all the needed SQL statements, specific for each * RDBMS type and, finally, it will execute all those statements against the DB. * * @param object $structure xmldb_structure object @@ -965,11 +965,11 @@ public function get_install_xml_schema() { } return $schema; } - + /** * Checks the database schema against a schema specified by an xmldb_structure object * @param xmldb_structure $schema export schema describing all known tables - * @return array keyed by table name with array of difference messages as values + * @return array keyed by table name with array of difference messages as values */ public function check_database_schema(xmldb_structure $schema) { $errors = array(); @@ -1036,6 +1036,3 @@ public function check_database_schema(xmldb_structure $schema) { return $errors; } } - - -?> diff --git a/lib/ddl/mssql_sql_generator.php b/lib/ddl/mssql_sql_generator.php index 9392aed3abf64..e5dbcfcc936f7 100644 --- a/lib/ddl/mssql_sql_generator.php +++ b/lib/ddl/mssql_sql_generator.php @@ -641,5 +641,3 @@ public static function getReservedWords() { return $reserved_words; } } - -?> diff --git a/lib/ddl/mysql_sql_generator.php b/lib/ddl/mysql_sql_generator.php index 74b092f3215bc..56911c9217bb1 100644 --- a/lib/ddl/mysql_sql_generator.php +++ b/lib/ddl/mysql_sql_generator.php @@ -426,5 +426,3 @@ public static function getReservedWords() { return $reserved_words; } } - -?> diff --git a/lib/ddl/oracle_sql_generator.php b/lib/ddl/oracle_sql_generator.php index f28530851754a..c37b5eea70075 100644 --- a/lib/ddl/oracle_sql_generator.php +++ b/lib/ddl/oracle_sql_generator.php @@ -692,5 +692,3 @@ public static function getReservedWords() { return $reserved_words; } } - -?> diff --git a/lib/ddl/postgres_sql_generator.php b/lib/ddl/postgres_sql_generator.php index 9d78fbcc61e90..468d4bf4f1783 100644 --- a/lib/ddl/postgres_sql_generator.php +++ b/lib/ddl/postgres_sql_generator.php @@ -473,5 +473,3 @@ public static function getReservedWords() { return $reserved_words; } } - -?> diff --git a/lib/ddl/simpletest/testddl.php b/lib/ddl/simpletest/testddl.php index a267004322934..529c7c5c763a2 100755 --- a/lib/ddl/simpletest/testddl.php +++ b/lib/ddl/simpletest/testddl.php @@ -1402,4 +1402,3 @@ public function testRenameKey() { */ } -?> diff --git a/lib/ddl/sql_generator.php b/lib/ddl/sql_generator.php index d5ca19eeac65e..f9d3763dc9e47 100644 --- a/lib/ddl/sql_generator.php +++ b/lib/ddl/sql_generator.php @@ -31,7 +31,7 @@ */ /** - * Abstract sql generator class, base for all bd specific implementations. + * Abstract sql generator class, base for all bd specific implementations. */ abstract class sql_generator { @@ -1237,5 +1237,3 @@ public function addslashes($s) { return $s; } } - -?> diff --git a/lib/ddl/sqlite_sql_generator.php b/lib/ddl/sqlite_sql_generator.php index 31b0eb7969ccb..56bb04a0339e9 100644 --- a/lib/ddl/sqlite_sql_generator.php +++ b/lib/ddl/sqlite_sql_generator.php @@ -263,14 +263,14 @@ protected function getAlterTableSchema($xmldb_table, $xmldb_add_field=NULL, $xml $results[] = 'COMMIT'; return $results; } - + /** * Given one xmldb_table and one xmldb_field, return the SQL statements needded to alter the field in the table */ public function getAlterFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause = NULL, $skip_default_clause = NULL, $skip_notnull_clause = NULL) { return $this->getAlterTableSchema($xmldb_table, $xmldb_field, $xmldb_field); } - + /** * Given one xmldb_table and one xmldb_key, return the SQL statements needded to add the key to the table * note that undelying indexes will be added as parametrised by $xxxx_keys and $xxxx_index parameters @@ -360,7 +360,7 @@ public function getDropKeySQL($xmldb_table, $xmldb_key) { $xmldb_table->deleteKey($xmldb_key->getName()); return $this->getAlterTableSchema($xmldb_table); } - + /** * Given one xmldb_table and one xmldb_field, return the SQL statements needded to drop its default * (usually invoked from getModifyDefaultSQL() diff --git a/lib/dml/pgsql_native_moodle_database.php b/lib/dml/pgsql_native_moodle_database.php index be39cf93cd0c2..efdfff3776a21 100644 --- a/lib/dml/pgsql_native_moodle_database.php +++ b/lib/dml/pgsql_native_moodle_database.php @@ -156,7 +156,7 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop } $dberr = ob_get_contents(); ob_end_clean(); - + $status = pg_connection_status($this->pgsql); if ($status === false or $status === PGSQL_CONNECTION_BAD) { diff --git a/lib/dmllib.php b/lib/dmllib.php index 18a82457fecef..a4a2fbc99a000 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -86,7 +86,7 @@ class dml_read_exception extends dml_exception { public $sql; /** @var array */ public $params; - + /** * Constructor * @param string $error @@ -110,7 +110,7 @@ class dml_multiple_records_exception extends dml_exception { public $sql; /** @var array */ public $params; - + /** * Constructor * @param string $table table name if known, '' if unknown @@ -133,7 +133,7 @@ class dml_missing_record_exception extends dml_exception { public $sql; /** @var array */ public $params; - + /** * Constructor * @param string $table table name if known, '' if unknown @@ -147,7 +147,7 @@ function __construct($tablename, $sql='', array $params=null) { $this->tablename = $tablename; $this->sql = $sql; $this->params = $params; - + switch ($tablename) { case null: $errcode = 'invalidrecordunknown'; diff --git a/lib/environmentlib.php b/lib/environmentlib.php index df4df27cb5d57..3c8e7c59c0560 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -1578,4 +1578,3 @@ function process_environment_result($element, &$result) { /// Process restrict, modifying $result if needed. process_environment_restrict($element, $result); } -?> diff --git a/lib/eventslib.php b/lib/eventslib.php index faba2a34c4526..c36c42b899ccf 100755 --- a/lib/eventslib.php +++ b/lib/eventslib.php @@ -1,7 +1,7 @@ . /** * Library of functions for events manipulation. - * + * * The public API is all at the end of this file. * * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} @@ -532,4 +532,3 @@ function events_pending_count($eventname) { WHERE qh.handlerid = h.id AND h.eventname=?"; return $DB->count_records_sql($sql, array($eventname)); } -?> diff --git a/lib/excellib.class.php b/lib/excellib.class.php index bbdc93879b892..03c5cfdbf4775 100644 --- a/lib/excellib.class.php +++ b/lib/excellib.class.php @@ -1,7 +1,7 @@ . /** * excellib.class.php - * + * * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @package moodlecore @@ -135,10 +135,10 @@ class MoodleExcelWorksheet { */ function MoodleExcelWorksheet($name, &$workbook, $latin_output=false) { - /// Internally, add one sheet to the workbook + /// Internally, add one sheet to the workbook $this->pear_excel_worksheet =& $workbook->addWorksheet($name); $this->latin_output = $latin_output; - /// Set encoding to UTF-16LE + /// Set encoding to UTF-16LE if (!$this->latin_output) { /// Only if don't want to use latin (win1252) stronger output $this->pear_excel_worksheet->setInputEncoding('UTF-16LE'); } @@ -316,7 +316,7 @@ function hide_gridlines() { function hide_screen_gridlines() { $this->pear_excel_worksheet->hideScreenGridlines(); } - + /** * Insert a 24bit bitmap image in a worksheet. * @@ -388,7 +388,7 @@ class MoodleExcelFormat { * @param array $properties */ function MoodleExcelFormat(&$workbook, $properties = array()) { - /// Internally, add one sheet to the workbook + /// Internally, add one sheet to the workbook $this->pear_excel_format =& $workbook->addFormat(); /// If we have something in the array of properties, compute them foreach($properties as $property => $value) { @@ -623,5 +623,3 @@ function set_num_format($num_format) { } } - -?> diff --git a/lib/filelib.php b/lib/filelib.php index 1cac02d0fedf1..b9cc2ed3d223f 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -1885,7 +1885,7 @@ function get_records_csv($file, $table) { } /** - * + * * @global object * @global object * @param string $file The file to put the CSV content into @@ -2143,7 +2143,7 @@ class curl { /** @var string */ public $info; public $error; - + /** @var array */ private $options; /** @var string */ @@ -2493,7 +2493,7 @@ protected function request($url, $options = array()){ /** * HTTP HEAD method * - * @see request() + * @see request() * * @param string $url * @param array $options @@ -2510,7 +2510,7 @@ public function head($url, $options = array()){ * HTTP POST method * * @param string $url - * @param array|string $params + * @param array|string $params * @param array $options * @return bool */ @@ -2538,7 +2538,7 @@ public function post($url, $params = '', $options = array()){ * HTTP GET method * * @param string $url - * @param array $params + * @param array $params * @param array $options * @return bool */ @@ -2556,7 +2556,7 @@ public function get($url, $params = array(), $options = array()){ * HTTP PUT method * * @param string $url - * @param array $params + * @param array $params * @param array $options * @return bool */ @@ -2582,7 +2582,7 @@ public function put($url, $params = array(), $options = array()){ * HTTP DELETE method * * @param string $url - * @param array $params + * @param array $params * @param array $options * @return bool */ diff --git a/lib/filterlib.php b/lib/filterlib.php index 50a0dfc248d20..ebc7f917b0ac8 100644 --- a/lib/filterlib.php +++ b/lib/filterlib.php @@ -1,7 +1,7 @@ . @@ -44,15 +44,15 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class filter_manager { - /** + /** * @var array This list of active filters, by context, for filtering content. - * An array contextid => array of filter objects. + * An array contextid => array of filter objects. */ protected $textfilters = array(); /** * @var array This list of active filters, by context, for filtering strings. - * An array contextid => array of filter objects. + * An array contextid => array of filter objects. */ protected $stringfilters = array(); @@ -82,8 +82,8 @@ public static function instance() { return self::$singletoninstance; } - /** - * Load all the filters required by this context. + /** + * Load all the filters required by this context. * * @param object $context * @param int $courseid @@ -137,7 +137,7 @@ protected function make_filter_object($filtername, $context, $courseid, $localco } /** - * @todo Document this function + * @todo Document this function * @param string $text * @param array $filterchain * @return string $text @@ -150,7 +150,7 @@ protected function apply_filter_chain($text, $filterchain) { } /** - * @todo Document this function + * @todo Document this function * @param object $context * @param int $courseid * @return object A text filter @@ -163,7 +163,7 @@ protected function get_text_filters($context, $courseid) { } /** - * @todo Document this function + * @todo Document this function * @param object $context * @param int $courseid * @return object A string filter @@ -203,7 +203,7 @@ public function filter_string($string, $context, $courseid) { } /** - * @todo Document this function + * @todo Document this function * @param object $context * @param int $courseid * @return object A string filter @@ -404,8 +404,8 @@ public function filter($text) { define('EXCL_SEPARATOR', '-%-'); /** - * This is just a little object to define a phrase and some instructions - * for how to process it. Filters can create an array of these to pass + * This is just a little object to define a phrase and some instructions + * for how to process it. Filters can create an array of these to pass * to the filter_phrases function below. * * @package moodlecore @@ -441,9 +441,9 @@ class filterobject { * @param bool $fullmatch * @param mixed $replacementphrase */ - function filterobject($phrase, $hreftagbegin='', - $hreftagend='', - $casesensitive=false, + function filterobject($phrase, $hreftagbegin='', + $hreftagend='', + $casesensitive=false, $fullmatch=false, $replacementphrase=NULL) { @@ -1005,7 +1005,7 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl $ignoretagsopen = array(']+?>'); $ignoretagsclose = array(''); } - + if ( is_array($ignoretagsopen) ) { foreach ($ignoretagsopen as $open) $filterignoretagsopen[] = $open; foreach ($ignoretagsclose as $close) $filterignoretagsclose[] = $close; @@ -1015,7 +1015,7 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl $text = preg_replace('/([#*%])/','\1\1',$text); -////Remove everything enclosed by the ignore tags from $text +////Remove everything enclosed by the ignore tags from $text filter_save_ignore_tags($text,$filterignoretagsopen,$filterignoretagsclose,$ignoretags); /// Remove tags from $text @@ -1083,7 +1083,7 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl /// Work calculated $linkobject->work_calculated = true; - + } /// If $CFG->filtermatchoneperpage, avoid previously (request) linked phrases @@ -1116,12 +1116,12 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl /// Finally we do our highlighting if (!empty($CFG->filtermatchonepertext) || !empty($CFG->filtermatchoneperpage)) { - $resulttext = preg_replace('/('.$linkobject->work_phrase.')/'.$modifiers, + $resulttext = preg_replace('/('.$linkobject->work_phrase.')/'.$modifiers, $linkobject->work_hreftagbegin. $linkobject->work_replacementphrase. $linkobject->work_hreftagend, $text, 1); } else { - $resulttext = preg_replace('/('.$linkobject->work_phrase.')/'.$modifiers, + $resulttext = preg_replace('/('.$linkobject->work_phrase.')/'.$modifiers, $linkobject->work_hreftagbegin. $linkobject->work_replacementphrase. $linkobject->work_hreftagend, $text); @@ -1132,7 +1132,7 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl if ($resulttext != $text) { /// Set $text to $resulttext $text = $resulttext; - /// Remove everything enclosed by the ignore tags from $text + /// Remove everything enclosed by the ignore tags from $text filter_save_ignore_tags($text,$filterignoretagsopen,$filterignoretagsclose,$ignoretags); /// Remove tags from $text filter_save_tags($text,$tags); @@ -1161,7 +1161,7 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl $text = str_replace(array_keys($ignoretags),$ignoretags,$text); } - //// Remove the protective doubleups + //// Remove the protective doubleups $text = preg_replace('/([#*%])(\1)/','\1',$text); /// Add missing javascript for popus @@ -1182,14 +1182,14 @@ function filter_remove_duplicates($linkarray) { $lconcepts = array(); // a lower case version for case insensitive $cleanlinks = array(); - + foreach ($linkarray as $key=>$filterobject) { if ($filterobject->casesensitive) { $exists = in_array($filterobject->phrase, $concepts); } else { $exists = in_array(moodle_strtolower($filterobject->phrase), $lconcepts); } - + if (!$exists) { $cleanlinks[] = $filterobject; $concepts[] = $filterobject->phrase; @@ -1208,7 +1208,7 @@ function filter_remove_duplicates($linkarray) { * * @param string $text the text that we are filtering (in/out) * @param array $filterignoretagsopen an array of open tags to start searching - * @param array $filterignoretagsclose an array of close tags to end searching + * @param array $filterignoretagsclose an array of close tags to end searching * @param array $ignoretags an array of saved strings useful to rebuild the original text (in/out) **/ function filter_save_ignore_tags(&$text,$filterignoretagsopen,$filterignoretagsclose,&$ignoretags) { @@ -1220,7 +1220,7 @@ function filter_save_ignore_tags(&$text,$filterignoretagsopen,$filterignoretagsc $opentag = str_replace('/','\/',$opentag); // delimit forward slashes $closetag = str_replace('/','\/',$closetag); // delimit forward slashes $pregexp = '/'.$opentag.'(.*?)'.$closetag.'/is'; - + preg_match_all($pregexp, $text, $list_of_ignores); foreach (array_unique($list_of_ignores[0]) as $key=>$value) { $prefix = (string)(count($ignoretags) + 1); @@ -1236,7 +1236,7 @@ function filter_save_ignore_tags(&$text,$filterignoretagsopen,$filterignoretagsc * Extract tags (any text enclosed by < and > to avoid being processed by filters. * It returns the text converted with some <%xEXCL_SEPARATORx%> codes replacing the extracted text. Such extracted * texts are returned in the tags array (as values), with codes as keys. - * + * * @param string $text the text that we are filtering (in/out) * @param array $tags an array of saved strings useful to rebuild the original text (in/out) **/ @@ -1268,7 +1268,7 @@ function filter_add_javascript($text) { if (strpos($text, 'onclick="return openpopup') === FALSE) { return $text; // no popup - no need to add javascript } - $js =" + $js ="