Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
moodlelib.php File Reference

Classes

class  emoticon_manager
 Provides core support for plugins that have to deal with emoticons (like HTML editor or emoticon filter). More...
 
class  lang_string
 The lang_string class. More...
 

Functions

 address_in_subnet ($addr, $subnetstr, $checkallzeros=false)
 Function to check the passed address is within the passed subnet.
 
 array_is_nested ($array)
 Check if there is a nested array within the passed array.
 
 authenticate_user_login ( $username, $password, $ignorelockout=false, &$failurereason=null, $logintoken=false, string|bool $loginrecaptcha=false,)
 Authenticates a user against the chosen authentication mechanism.
 
 bounded_number ($min, $value, $max)
 Used to make sure that $min <= $value <= $max.
 
 calculate_entropy (#[\SensitiveParameter] string $pepper)
 Calculate the Shannon entropy of a string.
 
 can_send_from_real_email_address ($from, $user, $unused=null)
 Check to see if a user's real email address should be used for the "From" field.
 
 check_consecutive_identical_characters ($password, $maxchars)
 Check whether the given password has no more than the specified number of consecutive identical characters.
 
 check_password_policy ($password, &$errmsg, $user=null)
 Validate a password against the configured password policy.
 
 check_php_version ($version='5.2.4')
 Returns true if the current version of PHP is greater that the specified one.
 
 check_user_preferences_loaded (stdClass $user, $cachelifetime=120)
 Refresh user preference cache.
 
 clean_filename ($string)
 Cleans a given filename by removing suspicious or troublesome characters.
 
 clean_param ($param, $type)
 Used by optional_param() and required_param() to clean the variables and/or cast to specific types, based on an options field.
 
 clean_param_array (?array $param, $type, $recursive=false)
 Makes sure array contains only the allowed types, this function does not validate array key names!
 
 cleanremoteaddr ($addr, $compress=false)
 Cleans an ip address.
 
 cleardoubleslashes ($path)
 Replace 1 or more slashes or backslashes to 1 slash.
 
 complete_user_login ($user, array $extrauserinfo=[])
 Call to complete the user login process after authenticate_user_login() has succeeded.
 
 complex_random_string ($length=null)
 Generate a complex random string (useful for md5 salts)
 
 component_callback ($component, $function, array $params=array(), $default=null, bool $migratedtohook=false)
 Invoke component's callback functions.
 
 component_callback_exists ($component, $function)
 Determine if a component callback exists and return the function name to call.
 
 component_class_callback ($classname, $methodname, array $params, $default=null)
 Call the specified callback method on the provided class.
 
 convert_to_array ($var)
 Converts an object into an associative array.
 
 count_letters ($string, $format=null)
 Count letters in a string.
 
 count_words ($string, $format=null)
 Count words in a string.
 
 create_user_key ($script, $userid, $instance=null, $iprestriction=null, $validuntil=null)
 Creates a new private user access key.
 
 create_user_record ($username, $password, $auth='manual')
 Creates a bare-bones user record.
 
 current_language ()
 Returns the code for the current language.
 
 custom_script_path ()
 Detect a custom script replacement in the data directory that will replace an existing moodle script.
 
 date_format_string ($date, $format, $tz=99)
 Returns a formatted date ensuring it is UTF-8.
 
 dayofweek ($day, $month, $year)
 Calculate the position in the week of a specific calendar day.
 
 days_in_month ($month, $year)
 Calculate the number of days in a given month.
 
 delete_course ($courseorid, $showfeedback=true)
 Delete a course, including all related data from the database, and any associated files.
 
 delete_user (stdClass $user)
 Marks user deleted in internal user database and notifies the auth plugin.
 
 delete_user_key ($script, $userid)
 Delete the user's new private user access keys for a particular script.
 
 display_size ($size, int $decimalplaces=1, string $fixedunits='')
 Converts bytes into display form.
 
 draw_rand_array ($array, $draws)
 Given an arbitrary array, and a number of draws, this function returns an array with that amount of items.
 
 dst_offset_on ($time, $strtimezone=null)
 Calculates the Daylight Saving Offset for a given date/time (timestamp)
 
 email_is_not_allowed ($email)
 Check that an email is allowed.
 
 email_should_be_diverted ($email)
 A helper function to test for email diversion.
 
 email_to_user ($user, $from, $subject, $messagetext, $messagehtml='', $attachment='', $attachname='', $usetrueaddress=true, $replyto='', $replytoname='', $wordwrapwidth=79)
 Send an email to a specified user.
 
 endecrypt ($pwd, $data, $case)
 Based on a class by Mukul Sabharwal [mukulsabharwal @ yahoo.com].
 
 exceeds_password_length (string $password, int $pepperlength=0)
 Validates user's password length.
 
 exists_auth_plugin ($auth)
 Returns whether a given authentication plugin exists.
 
 find_day_in_month ($startday, $weekday, $month, $year)
 Calculates when the day appears in specific month.
 
 fix_current_language (string $lang)
 Fix the current language to the given language code.
 
 fix_utf8 ($value)
 Makes sure the data is using valid utf8, invalid characters are discarded.
 
 force_current_language ($language)
 Force the current language to get strings and dates localised in the given language.
 
 format_float ($float, $decimalpoints=1, $localized=true, $stripzeros=false)
 Given a float, prints it nicely.
 
 format_time ($totalsecs, $str=null)
 Format a date/time (seconds) as weeks, days, hours etc as needed.
 
 fullclone ($thing)
 This function will make a complete copy of anything it's given, regardless of whether it's an object or not.
 
 fullname ($user, $override=false)
 Returns a persons full name.
 
 gc_cache_flags ()
 Garbage-collect volatile flags.
 
 generate_email_messageid ($localpart=null)
 Generate a unique email Message-ID using the moodle domain and install path.
 
 generate_email_processing_address ($modid, $modargs)
 Generate an email processing address.
 
 generate_email_signoff ()
 Generate a signoff for emails based on support settings.
 
 generate_password ($maxlen=10)
 Returns a randomly generated password of length $maxlen.
 
 get_auth_plugin ($auth)
 Returns an authentication plugin instance.
 
 get_cache_flag ($type, $name, $changedsince=null)
 Get volatile flags.
 
 get_cache_flags ($type, $changedsince=null)
 Get volatile flags.
 
 get_callable_name ($callable)
 Get human readable name describing the given callable.
 
 get_complete_user_data ($field, $value, $mnethostid=null, $throwexception=false)
 Get a complete user record, which includes all the info in the user record.
 
 get_config ($plugin, $name=null)
 Get configuration values from the global config table or the config_plugins table.
 
 get_course_display_name_for_list ($course)
 Gets the name of a course to be displayed when showing a list of courses.
 
 get_default_home_page ()
 Returns the default home page to display if current one is not defined or can't be applied.
 
 get_directory_list ($rootdir, $excludefiles='', $descend=true, $getdirs=false, $getfiles=true)
 Returns an array with all the filenames in all subdirectories, relative to the given rootdir.
 
 get_directory_size ($rootdir, $excludefile='')
 Adds up all the files in a directory and works out the size.
 
 get_emoticon_manager ()
 Factory function for emoticon_manager.
 
 get_enabled_auth_plugins ($fix=false)
 Returns array of active auth plugins.
 
 get_file_browser ()
 Returns local file storage instance.
 
 get_file_packer ($mimetype='application/zip')
 Returns file packer.
 
 get_file_storage ($reset=false)
 Returns local file storage instance.
 
 get_home_page ()
 Gets the homepage to use for the current user.
 
 get_host_from_url ($url)
 Returns host part from url.
 
 get_list_of_charsets ()
 Returns a list of charset codes.
 
 get_list_of_plugins ($directory='mod', $exclude='', $basedir='')
 Lists plugin-like directories within specified directory.
 
 get_list_of_themes ()
 Returns a list of valid and compatible themes.
 
 get_login_url ()
 Returns full login url.
 
 get_mailer ($action='get')
 Get mailer instance, enable buffering, flush buffer or disable buffering.
 
 get_max_upload_file_size ($sitebytes=0, $coursebytes=0, $modulebytes=0, $unused=false)
 Returns the maximum size for uploading files.
 
 get_max_upload_sizes ($sitebytes=0, $coursebytes=0, $modulebytes=0, $custombytes=null)
 Returns an array of possible sizes in local language.
 
 get_mnet_environment ()
 helper function to load up and initialise the mnet environment this must be called before you use mnet functions.
 
 get_mnet_remote_client ()
 during xmlrpc server code execution, any code wishing to access information about the remote peer must use this to get it.
 
 get_newuser_language ()
 Returns the string of the language for the new user.
 
 get_parent_language ($lang=null)
 Returns parent language of current active language if defined.
 
 get_password_peppers ()
 Get the available password peppers.
 
 get_performance_info ()
 get_performance_info() pairs up with init_performance_info() loaded in setup.php.
 
 get_plugin_list_with_function ($plugintype, $function, $file='lib.php')
 Get a list of all the plugins of a given type that define a certain API function in a certain file.
 
 get_plugins_with_function ($function, $file='lib.php', $include=true, bool $migratedtohook=false)
 Get a list of all the plugins that define a certain API function in a certain file.
 
 get_site_identifier ()
 Returns the site identifier.
 
 get_string ($identifier, $component='', $a=null, $lazyload=false)
 Returns a localized string.
 
 get_string_manager ($forcereload=false)
 Returns current string_manager instance.
 
 get_strings ($array, $component='')
 Converts an array of strings to their localized value.
 
 get_time_interval_string (int $time1, int $time2, string $format='', bool $dropzeroes=false, bool $fullformat=false)
 Get a formatted string representation of an interval between two unix timestamps.
 
 get_user_fieldnames ()
 Returns an array of user fields.
 
 get_user_key ($script, $userid, $instance=null, $iprestriction=null, $validuntil=null)
 Gets a private user access key (and creates one if one doesn't exist).
 
 get_user_max_upload_file_size ($context, $sitebytes=0, $coursebytes=0, $modulebytes=0, $user=null, $unused=false)
 Returns the maximum size for uploading files for the current user.
 
 get_user_preferences ($name=null, $default=null, $user=null)
 Used to fetch user preference(s)
 
 get_user_timezone ($tz=99)
 Returns a float or a string which denotes the user's timezone A float value means that a simple offset from GMT is used, while a string (it will be the name of a timezone in the database) means that for this timezone there are also DST rules to be taken into account Checks various settings and picks the most dominant of those which have a value.
 
 get_users_from_config ($value, $capability, $includeadmins=true)
 Use this function to get a list of users from a config setting of type admin_setting_users_with_capability.
 
 getremoteaddr ($default='0.0.0.0')
 Returns most reliable client address.
 
 getweek ($startdate, $thedate)
 Given dates in seconds, how many weeks is the date from startdate The first week is 1, the second 2 etc ...
 
 guest_user ()
 Retrieve the guest user object.
 
 hash_internal_user_password (#[\SensitiveParameter] string $password, $fasthash=false, $pepperlength=0)
 Calculate hash for a plain text password.
 
 html_is_blank ($string)
 Tests whether anything was returned by text editor.
 
 in_object_vars ($var, $object)
 Checks whether the given variable name is defined as a variable within the given object.
 
 ip_is_public ($ip)
 Is IP address a public address?
 
 is_enabled_auth ($auth)
 Checks if a given plugin is in the list of enabled authentication plugins.
 
 is_internal_auth ($auth)
 Returns true if an internal authentication method is being used.
 
 is_mnet_remote_user ($user)
 Returns whether or not the user object is a remote MNET user.
 
 is_newnav ($navigation)
 Check if the passed navigation is of the new style.
 
 is_number ($value)
 Return true if given value is integer or string with integer value.
 
 is_primary_admin ($userid)
 Is a userid the primary administrator?
 
 is_proxybypass ( $url)
 Check if $url matches anything in proxybypass list.
 
 is_restored_user ($username)
 Returns true if the user is a 'restored' one.
 
 is_rtl_compatible ($paramtype)
 Whether the PARAM_* type is compatible in RTL.
 
 is_valid_plugin_name ($name)
 This method validates a plug name.
 
 ismoving ($courseid)
 Determines if the logged in user is currently moving an activity.
 
 make_grades_menu ($gradingtype)
 Creates an array that represents all the current grades that can be chosen using the given grading type.
 
 make_menu_from_list ($list, $separator=',')
 Given a list (eg a,b,c,d,e) this function returns an array of 1->a, 2->b, 3->c etc.
 
 make_timestamp ($year, $month=1, $day=1, $hour=0, $minute=0, $second=0, $timezone=99, $applydst=true)
 Given Gregorian date parts in user time produce a GMT timestamp.
 
 make_unique_id_code ($extra='')
 make_unique_id_code
 
 microtime_diff ($a, $b)
 Calculate the difference between two microtimes.
 
 mnet_get_idp_jump_url ($user)
 return the jump url for a given remote user this is used for rewriting forum post links in emails, etc
 
 moodle_getlocale ()
 Gets the system locale.
 
 moodle_major_version ($fromdisk=false)
 Returns the major version of this site.
 
 moodle_needs_upgrading ($checkupgradeflag=true)
 Determine if moodle installation requires update.
 
 moodle_process_email ($modargs, $body)
 ?
 
 moodle_setlocale ($locale='')
 Sets the system locale.
 
 mtrace ($string, $eol="\n", $sleep=0)
 For outputting debugging info.
 
 mtrace_exception (Throwable $e)
 Helper to {.
 
 object_array_unique ($array, $keepkeyassoc=true)
 Returns an array without repeated objects.
 
 object_property_exists ( $obj, $property)
 Detect if an object or a class contains a given property will take an actual object or the name of a class.
 
 optional_param ($parname, $default, $type)
 Returns a particular value for the named variable, taken from POST or GET, otherwise returning a given default.
 
 optional_param_array ($parname, $default, $type)
 Returns a particular array value for the named variable, taken from POST or GET, otherwise returning a given default.
 
 order_in_string ($values, $stringformat)
 Returns an array of values in order of occurance in a provided string.
 
 over_bounce_threshold ($user)
 Check whether the user has exceeded the bounce threshold.
 
 partial ()
 Helper function to do partial function binding.
 
 password_is_legacy_hash (#[\SensitiveParameter] string $password)
 Check a password hash to see if it was hashed using the legacy hash algorithm (bcrypt).
 
 plugin_callback ($type, $name, $feature, $action, $params=null, $default=null, bool $migratedtohook=false)
 Invoke plugin's callback functions.
 
 plugin_supports ($type, $name, $feature, $default=null)
 Checks whether a plugin supports a specified feature.
 
 print_string ($identifier, $component='', $a=null)
 Prints out a translated string.
 
 purge_all_caches ()
 Invalidates browser caches and cached data in temp.
 
 purge_caches ($options=[])
 Selectively invalidate different types of cache.
 
 purge_other_caches ()
 Purge all non-MUC caches not otherwise purged in purge_caches.
 
 random_string ($length=15)
 Generate and return a random string of the specified length.
 
 rc4decrypt ($data)
 rc4decrypt
 
 rc4encrypt ($data)
 rc4encrypt
 
 remoteip_in_list ($list)
 Is the current ip in a given list?
 
 remove_course_contents ($courseid, $showfeedback=true, array $options=null)
 Clear a course out completely, deleting all content but don't delete the course itself.
 
 remove_dir ($dir, $contentonly=false)
 Delete directory or only its content.
 
 rename_to_unused_name (string $filepath, string $prefix='_temp_')
 Renames a file or directory to a unique name within the same directory.
 
 require_admin ()
 A convenience function for where we must be logged in as admin.
 
 require_course_login ($courseorid, $autologinguest=true, $cm=null, $setwantsurltome=true, $preventredirect=false)
 Weaker version of require_login()
 
 require_login ($courseorid=null, $autologinguest=true, $cm=null, $setwantsurltome=true, $preventredirect=false)
 This function checks that the current user is logged in and has the required privileges.
 
 require_logout ()
 This function just makes sure a user is logged out.
 
 require_user_key_login ($script, $instance=null, $keyvalue=null)
 Require key login.
 
 required_param ($parname, $type)
 Returns a particular value for the named variable, taken from POST or GET.
 
 required_param_array ($parname, $type)
 Returns a particular array value for the named variable, taken from POST or GET.
 
 reset_course_userdata ($data)
 This function will empty a course of user data.
 
 reset_password_and_mail ($user)
 Resets specified user's password and send the new password to the user via email.
 
 send_confirmation_email ($user, $confirmationurl=null)
 Send email to specified user with confirmation text and activation link.
 
 send_password_change_confirmation_email ($user, $resetrecord)
 Sends a password change confirmation email.
 
 send_password_change_info ($user)
 Sends an email containing information on how to change your password.
 
 set_bounce_count ($user, $reset=false)
 Increment or reset user's email bounce count.
 
 set_cache_flag ($type, $name, $value, $expiry=null)
 Set a volatile flag.
 
 set_config ($name, $value, $plugin=null)
 Set a key in global configuration.
 
 set_login_session_preferences ()
 When logging in, this function is run to set certain preferences for the current SESSION.
 
 set_mnet_remote_client ($client)
 during the xmlrpc server code execution, this will be called to setup the object returned by get_mnet_remote_client
 
 set_send_count ($user, $reset=false)
 Used to increment or reset email sent count.
 
 set_user_preference ($name, $value, $user=null)
 Sets a preference for the specified user.
 
 set_user_preferences (array $prefarray, $user=null)
 Sets a whole array of preferences for the current user.
 
 setnew_password_and_mail ($user, $fasthash=false)
 Sets specified user's password and send the new password to the user via email.
 
 setup_lang_from_browser ()
 This function will search for browser prefereed languages, setting Moodle to use the best one available if $SESSION->lang is undefined.
 
 shift_course_mod_dates ($modname, $fields, $timeshift, $courseid, $modid=0)
 Change dates in module - used from course reset.
 
 shorten_filename ($filename, $length=MAX_FILENAME_SIZE, $includehash=false)
 Shortens a given filename by removing characters positioned after the ideal string length.
 
 shorten_filenames (array $path, $length=MAX_FILENAME_SIZE, $includehash=false)
 Shortens a given array of filenames by removing characters positioned after the ideal string length.
 
 shorten_text ($text, $ideal=30, $exact=false, $ending='...')
 Given some text (which may contain HTML) and an ideal length, this function truncates the text neatly on a word boundary if possible.
 
 site_is_public ()
 Tries to guess if $CFG->wwwroot is publicly accessible or not.
 
 swapshuffle ($array)
 Given a simple array, this shuffles it up just like shuffle() Unlike PHP's shuffle() this function works on any machine.
 
 swapshuffle_assoc ($array)
 Like swapshuffle(), but works on associative arrays.
 
 truncate_userinfo (array $info)
 Will truncate userinfo as it comes from auth_get_userinfo (from external auth) which may have large fields.
 
 unformat_float ($localefloat, $strict=false)
 Converts locale specific floating point/comma number back to standard PHP float value Do NOT try to do any math operations before this conversion on any user submitted floats!
 
 unserialize_array ($expression)
 Safe analogue of unserialize() that can only parse arrays.
 
 unserialize_object (string $input)
 Safe method for unserializing given input that is expected to contain only a serialized instance of an stdClass object.
 
 unset_all_config_for_plugin ($plugin)
 Remove all the config variables for a given plugin.
 
 unset_cache_flag ($type, $name)
 Removes a single volatile flag.
 
 unset_config ($name, $plugin=null)
 Removes a key from global configuration.
 
 unset_user_preference ($name, $user=null)
 Unsets a preference completely by deleting it from the database.
 
 update_internal_user_password (stdClass $user, #[\SensitiveParameter] ?string $password, bool $fasthash=false)
 Update password hash in user object (if necessary).
 
 update_user_login_times ()
 Modify the user table by setting the currently logged in user's last login to now.
 
 update_user_record ($username)
 Will update a local user record from an external source (MNET users can not be updated using this method!).
 
 update_user_record_by_id ($id)
 Will update a local user record from an external source (MNET users can not be updated using this method!).
 
 user_not_fully_set_up ($user, $strict=true)
 Determines if a user has completed setting up their account.
 
 userdate ($date, $format='', $timezone=99, $fixday=true, $fixhour=true)
 Returns a formatted string that represents a date in user time.
 
 userdate_htmltime ($date, $format='', $timezone=99, $fixday=true, $fixhour=true)
 Returns a html "time" tag with both the exact user date with timezone information as a datetime attribute in the W3C format, and the user readable date and time as text.
 
 usergetdate ($time, $timezone=99)
 Given a $time timestamp in GMT (seconds since epoch), returns an array that represents the Gregorian date in user time.
 
 usergetmidnight ($date, $timezone=99)
 Given a time, return the GMT timestamp of the most recent midnight for the current user.
 
 username_load_fields_from_object ($addtoobject, $secondobject, $prefix=null, $additionalfields=null)
 Reduces lines of duplicated code for getting user name fields.
 
 usertime ($date, $timezone=99)
 Given a GMT timestamp (seconds since epoch), offsets it by the timezone.
 
 usertimezone ($timezone=99)
 Returns a string that prints the user's timezone.
 
 valid_uploaded_file ($newfile)
 Returns current name of file on disk if it exists.
 
 validate_internal_user_password (stdClass $user, #[\SensitiveParameter] string $password)
 Compare password against hash stored in user object to determine if it is valid.
 
 validate_param ($param, $type, $allownull=NULL_NOT_ALLOWED, $debuginfo='')
 Strict validation of parameter values, the values are only converted to requested PHP type.
 
 validate_user_key ($keyvalue, $script, $instance)
 Validates a user key, checking if the key exists, is not expired and the remote ip is correct.
 

Variables

const AUTH_PASSWORD_NOT_CACHED 'not cached'
 Authentication constant: String used in password field when password is not stored.
 
const BLOG_COURSE_LEVEL 3
 
const BLOG_GLOBAL_LEVEL 5
 
const BLOG_GROUP_LEVEL 2
 
const BLOG_SITE_LEVEL 4
 
const BLOG_USER_LEVEL 1
 
const CONTACT_SUPPORT_ANYONE 2
 Contact site support form/link available to anyone visiting the site.
 
const CONTACT_SUPPORT_AUTHENTICATED 1
 Contact site support form/link only available to authenticated users.
 
const CONTACT_SUPPORT_DISABLED 0
 Contact site support form/link disabled.
 
const COURSE_DISPLAY_MULTIPAGE 1
 Course display settings: split pages into a page per section.
 
const COURSE_DISPLAY_SINGLEPAGE 0
 Course display settings: display all sections on one page.
 
const DAYMINS 1440
 Time constant - the number of minutes in a day.
 
const DAYSECS 86400
 Time constant - the number of seconds in a day.
 
 defined ( 'HUB_MOODLEORGHUBURL')||define( 'HUB_MOODLEORGHUBURL'
 URL of the Moodle sites registration portal.
 
const EMAIL_VIA_ALWAYS 1
 Email from header to always include via information.
 
const EMAIL_VIA_NEVER 0
 Email from header to never include via information.
 
const EMAIL_VIA_NO_REPLY_ONLY 2
 Email from header to only include via information if the address is no-reply.
 
const EXTERNAL_TOKEN_EMBEDDED 1
 Security token used for allowing access of embedded applications, the code is executed in the active user session.
 
const EXTERNAL_TOKEN_PERMANENT 0
 Security token used for allowing access from external application such as web services.
 
const FEATURE_ADVANCED_GRADING 'grade_advanced_grading'
 True if module supports advanced grading methods.
 
const FEATURE_BACKUP_MOODLE2 'backup_moodle2'
 True if module supports backup/restore of moodle2 format.
 
const FEATURE_COMMENT 'comment'
 
const FEATURE_COMPLETION_HAS_RULES 'completion_has_rules'
 True if module has custom completion rules.
 
const FEATURE_COMPLETION_TRACKS_VIEWS 'completion_tracks_views'
 True if module has code to track whether somebody viewed it.
 
const FEATURE_CONTROLS_GRADE_VISIBILITY 'controlsgradevisbility'
 True if module controls the grade visibility over the gradebook.
 
const FEATURE_GRADE_HAS_GRADE 'grade_has_grade'
 True if module can provide a grade.
 
const FEATURE_GRADE_OUTCOMES 'outcomes'
 True if module supports outcomes.
 
const FEATURE_GROUPINGS 'groupings'
 True if module supports groupings.
 
const FEATURE_GROUPMEMBERSONLY 'groupmembersonly'
 True if module supports groupmembersonly (which no longer exists)
 
const FEATURE_GROUPS 'groups'
 True if module supports groups.
 
const FEATURE_IDNUMBER 'idnumber'
 True (which is default) if the module wants support for setting the ID number for grade calculation purposes.
 
const FEATURE_MOD_ARCHETYPE 'mod_archetype'
 Type of module.
 
const FEATURE_MOD_INTRO 'mod_intro'
 True if module supports intro editor.
 
const FEATURE_MOD_PURPOSE 'mod_purpose'
 Type of module.
 
const FEATURE_MODEDIT_DEFAULT_COMPLETION 'modedit_default_completion'
 True if module has default completion.
 
const FEATURE_NO_VIEW_LINK 'viewlink'
 True if module has no 'view' page (like label)
 
const FEATURE_PLAGIARISM 'plagiarism'
 True if module supports plagiarism plugins.
 
const FEATURE_RATE 'rate'
 
const FEATURE_SHOW_DESCRIPTION 'showdescription'
 True if module can show description on course main page.
 
const FEATURE_USES_QUESTIONS 'usesquestions'
 True if module uses the question bank.
 
const GETREMOTEADDR_SKIP_DEFAULT GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR|GETREMOTEADDR_SKIP_HTTP_CLIENT_IP
 GETREMOTEADDR_SKIP_DEFAULT defines the default behavior remote IP address validation.
 
const GETREMOTEADDR_SKIP_HTTP_CLIENT_IP '1'
 Get remote addr constant.
 
const GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR '2'
 Get remote addr constant.
 
const HOMEPAGE_MY 1
 The home page should be the users my page.
 
const HOMEPAGE_MYCOURSES 3
 The home page should be the users my courses page.
 
const HOMEPAGE_SITE 0
 The home page should be the site home.
 
const HOMEPAGE_USER 2
 The home page can be chosen by the user.
 
const HOURMINS 60
 Time constant - the number of minutes in an hour.
 
const HOURSECS 3600
 Time constant - the number of seconds in an hour.
 
const MAX_FILENAME_SIZE 100
 Maximum filename char size.
 
const MAX_PASSWORD_CHARACTERS 128
 Maximum number of characters for password.
 
const MINSECS 60
 Time constant - the number of seconds in a minute.
 
const MOD_ARCHETYPE_ASSIGNMENT 2
 Assignment module archetype.
 
const MOD_ARCHETYPE_OTHER 0
 Unspecified module archetype.
 
const MOD_ARCHETYPE_RESOURCE 1
 Resource-like type module.
 
const MOD_ARCHETYPE_SYSTEM 3
 System (not user-addable) module archetype.
 
const MOD_PURPOSE_ADMINISTRATION 'administration'
 Module purpose administration.
 
const MOD_PURPOSE_ASSESSMENT 'assessment'
 Module purpose assessment.
 
const MOD_PURPOSE_COLLABORATION 'collaboration'
 Module purpose communication.
 
const MOD_PURPOSE_COMMUNICATION 'communication'
 Module purpose communication.
 
const MOD_PURPOSE_CONTENT 'content'
 Module purpose content.
 
const MOD_PURPOSE_INTERFACE 'interface'
 Module purpose interface.
 
const MOD_PURPOSE_OTHER 'other'
 Module purpose other.
 
const MOODLE_OFFICIAL_MOBILE_SERVICE 'moodle_mobile_app'
 Moodle mobile app service name.
 
const NULL_ALLOWED true
 NULL_ALLOWED - the parameter can be set to null in the database.
 
const NULL_NOT_ALLOWED false
 NULL_NOT_ALLOWED - the parameter can not be set to null in the database.
 
const PAGE_COURSE_VIEW 'course-view'
 PAGE_COURSE_VIEW is a definition of a page type.
 
const PARAM_ACTION 'alphanumext'
 PARAM_ACTION - deprecated alias for PARAM_ALPHANUMEXT, use for various actions in forms and urls NOTE: originally alias for PARAM_APLHA.
 
const PARAM_ALPHA 'alpha'
 PARAM_ALPHA - contains only English ascii letters [a-zA-Z].
 
const PARAM_ALPHAEXT 'alphaext'
 PARAM_ALPHAEXT the same contents as PARAM_ALPHA (English ascii letters [a-zA-Z]) plus the chars in quotes: "_-" allowed NOTE: originally this allowed "/" too, please use PARAM_SAFEPATH if "/" needed.
 
const PARAM_ALPHANUM 'alphanum'
 PARAM_ALPHANUM - expected numbers 0-9 and English ascii letters [a-zA-Z] only.
 
const PARAM_ALPHANUMEXT 'alphanumext'
 PARAM_ALPHANUMEXT - expected numbers 0-9, letters (English ascii letters [a-zA-Z]) and _- only.
 
const PARAM_AREA 'area'
 PARAM_AREA is a name of area used when addressing files, comments, ratings, etc.
 
const PARAM_AUTH 'auth'
 PARAM_AUTH - actually checks to make sure the string is a valid auth plugin.
 
const PARAM_BASE64 'base64'
 PARAM_BASE64 - Base 64 encoded format.
 
const PARAM_BOOL 'bool'
 PARAM_BOOL - converts input into 0 or 1, use for switches in forms and urls.
 
const PARAM_CAPABILITY 'capability'
 PARAM_CAPABILITY - A capability name, like 'moodle/role:manage'.
 
const PARAM_CLEAN 'clean'
 PARAM_CLEAN - obsoleted, please use a more specific type of parameter.
 
const PARAM_CLEANFILE 'file'
 PARAM_CLEANFILE - deprecated alias of PARAM_FILE; originally was removing regional chars too.
 
const PARAM_CLEANHTML 'cleanhtml'
 PARAM_CLEANHTML - cleans submitted HTML code.
 
const PARAM_COMPONENT 'component'
 PARAM_COMPONENT is used for full component names (aka frankenstyle) such as 'mod_forum', 'core_rating', 'auth_ldap'.
 
const PARAM_EMAIL 'email'
 PARAM_EMAIL - an email address following the RFC.
 
const PARAM_FILE 'file'
 PARAM_FILE - safe file name, all dangerous chars are stripped, protects against XSS, SQL injections and directory traversals.
 
const PARAM_FLOAT 'float'
 PARAM_FLOAT - a real/floating point number.
 
const PARAM_FORMAT 'alphanumext'
 PARAM_FORMAT - deprecated alias for PARAM_ALPHANUMEXT, use for names of plugins, formats, etc.
 
const PARAM_HOST 'host'
 PARAM_HOST - expected fully qualified domain name (FQDN) or an IPv4 dotted quad (IP address)
 
const PARAM_INT 'int'
 PARAM_INT - integers only, use when expecting only numbers.
 
const PARAM_INTEGER 'int'
 PARAM_INTEGER - deprecated alias for PARAM_INT.
 
const PARAM_LANG 'lang'
 PARAM_LANG - checks to see if the string is a valid installed language in the current site.
 
const PARAM_LOCALISEDFLOAT 'localisedfloat'
 PARAM_LOCALISEDFLOAT - a localised real/floating point number.
 
const PARAM_LOCALURL 'localurl'
 PARAM_LOCALURL - expected properly formatted URL as well as one that refers to the local server itself.
 
const PARAM_MULTILANG 'text'
 PARAM_MULTILANG - deprecated alias of PARAM_TEXT.
 
const PARAM_NOTAGS 'notags'
 PARAM_NOTAGS - all html tags are stripped from the text.
 
const PARAM_NUMBER 'float'
 PARAM_NUMBER - deprecated alias of PARAM_FLOAT.
 
const PARAM_PATH 'path'
 PARAM_PATH - safe relative path name, all dangerous chars are stripped, protects against XSS, SQL injections and directory traversals note: the leading slash is not removed, window drive letter is not allowed.
 
const PARAM_PEM 'pem'
 PARAM_PEM - Privacy Enhanced Mail format.
 
const PARAM_PERMISSION 'permission'
 PARAM_PERMISSION - A permission, one of CAP_INHERIT, CAP_ALLOW, CAP_PREVENT or CAP_PROHIBIT.
 
const PARAM_PLUGIN 'plugin'
 PARAM_PLUGIN is used for plugin names such as 'forum', 'glossary', 'ldap', 'paypal', 'completionstatus'.
 
const PARAM_RAW 'raw'
 PARAM_RAW specifies a parameter that is not cleaned/processed in any way except the discarding of the invalid utf-8 characters.
 
const PARAM_RAW_TRIMMED 'raw_trimmed'
 PARAM_RAW_TRIMMED like PARAM_RAW but leading and trailing whitespace is stripped.
 
const PARAM_SAFEDIR 'safedir'
 PARAM_SAFEDIR - safe directory name, suitable for include() and require()
 
const PARAM_SAFEPATH 'safepath'
 PARAM_SAFEPATH - several PARAM_SAFEDIR joined by "/", suitable for include() and require(), plugin paths and other references to Moodle code files.
 
const PARAM_SEQUENCE 'sequence'
 PARAM_SEQUENCE - expects a sequence of numbers like 8 to 1,5,6,4,6,8,9.
 
const PARAM_STRINGID 'stringid'
 PARAM_STRINGID - used to check if the given string is valid string identifier for get_string()
 
const PARAM_TAG 'tag'
 PARAM_TAG - one tag (interests, blogs, etc.) - mostly international characters and space, <> not supported.
 
const PARAM_TAGLIST 'taglist'
 PARAM_TAGLIST - list of tags separated by commas (interests, blogs, etc.)
 
const PARAM_TEXT 'text'
 PARAM_TEXT - general plain text compatible with multilang filter, no other html tags.
 
const PARAM_THEME 'theme'
 PARAM_THEME - Checks to see if the string is a valid theme name in the current site.
 
const PARAM_TIMEZONE 'timezone'
 PARAM_TIMEZONE - expected timezone.
 
const PARAM_URL 'url'
 PARAM_URL - expected properly formatted URL.
 
const PARAM_USERNAME 'username'
 PARAM_USERNAME - Clean username to only contains allowed characters.
 
const PASSWORD_DIGITS '0123456789'
 
const PASSWORD_LOWER 'abcdefghijklmnopqrstuvwxyz'
 
const PASSWORD_NONALPHANUM '.,;:!?_-+/*@#&$'
 
const PASSWORD_UPPER 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
const PEPPER_ENTROPY 112
 Required password pepper entropy.
 
const TAG_MAX_LENGTH 50
 To prevent problems with multibytes strings,Flag updating in nav not working on the review page.
 
const USER_CAN_IGNORE_FILE_SIZE_LIMITS -1
 Indicates the user has the capabilities required to ignore activity and course file size restrictions.
 
const VALUE_DEFAULT 0
 VALUE_DEFAULT - if the parameter is not supplied, then the default value is used.
 
const VALUE_OPTIONAL 2
 VALUE_OPTIONAL - if the parameter is not supplied, then the param has no value.
 
const VALUE_REQUIRED 1
 VALUE_REQUIRED - if the parameter is not supplied, there is an error.
 
const WEEKSECS 604800
 Time constant - the number of seconds in a week.
 
const YEARSECS 31536000
 Time constant - the number of seconds in a year.