Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Classes | Functions | Variables
moodlelib.php File Reference

moodlelib.php - Moodle main library More...

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
 

Functions

 address_in_subnet ($addr, $subnetstr)
 Function to check the passed address is within the passed subnet. More...
 
 array_is_nested ($array)
 Check if there is a nested array within the passed array. More...
 
 authenticate_user_login ($username, $password, $ignorelockout=false, &$failurereason=null, $logintoken=false)
 Authenticates a user against the chosen authentication mechanism. More...
 
 bounded_number ($min, $value, $max)
 Used to make sure that $min <= $value <= $max. More...
 
 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. More...
 
 check_consecutive_identical_characters ($password, $maxchars)
 Check whether the given password has no more than the specified number of consecutive identical characters. More...
 
 check_password_policy ($password, &$errmsg, $user=null)
 Validate a password against the configured password policy. More...
 
 check_php_version ($version='5.2.4')
 Returns true if the current version of PHP is greater that the specified one. More...
 
 check_user_preferences_loaded (stdClass $user, $cachelifetime=120)
 
 clean_filename ($string)
 Cleans a given filename by removing suspicious or troublesome characters. More...
 
 clean_param ($param, $type)
 Used by } and required_param() to clean the variables and/or cast to specific types, based on an options field. More...
 
 clean_param_array (array $param=null, $type, $recursive=false)
 Makes sure array contains only the allowed types, this function does not validate array key names! More...
 
 cleanremoteaddr ($addr, $compress=false)
 Cleans an ip address. More...
 
 cleardoubleslashes ($path)
 Replace 1 or more slashes or backslashes to 1 slash. More...
 
 complete_user_login ($user)
 Call to complete the user login process after authenticate_user_login() has succeeded. More...
 
 complex_random_string ($length=null)
 Generate a complex random string (useful for md5 salts) More...
 
 component_callback ($component, $function, array $params=array(), $default=null)
 Invoke component's callback functions. More...
 
 component_callback_exists ($component, $function)
 Determine if a component callback exists and return the function name to call. More...
 
 component_class_callback ($classname, $methodname, array $params, $default=null)
 Call the specified callback method on the provided class. More...
 
 convert_to_array ($var)
 Converts an object into an associative array. More...
 
 count_letters ($string)
 
 count_words ($string)
 
 create_user_key ($script, $userid, $instance=null, $iprestriction=null, $validuntil=null)
 Creates a new private user access key. More...
 
 create_user_record ($username, $password, $auth='manual')
 Creates a bare-bones user record. More...
 
 current_language ()
 
 custom_script_path ()
 Detect a custom script replacement in the data directory that will replace an existing moodle script. More...
 
 date_format_string ($date, $format, $tz=99)
 Returns a formatted date ensuring it is UTF-8. More...
 
 dayofweek ($day, $month, $year)
 
 days_in_month ($month, $year)
 
 delete_course ($courseorid, $showfeedback=true)
 Delete a course, including all related data from the database, and any associated files. More...
 
 delete_user (stdClass $user)
 Marks user deleted in internal user database and notifies the auth plugin. More...
 
 delete_user_key ($script, $userid)
 Delete the user's new private user access keys for a particular script. More...
 
 display_size ($size)
 Converts bytes into display form. More...
 
 draw_rand_array ($array, $draws)
 Given an arbitrary array, and a number of draws, this function returns an array with that amount of items. More...
 
 dst_offset_on ($time, $strtimezone=null)
 
 email_is_not_allowed ($email)
 Check that an email is allowed. More...
 
 email_should_be_diverted ($email)
 A helper function to test for email diversion. More...
 
 email_to_user ($user, $from, $subject, $messagetext, $messagehtml='', $attachment='', $attachname='', $usetrueaddress=true, $replyto='', $replytoname='', $wordwrapwidth=79)
 Send an email to a specified user. More...
 
 endecrypt ($pwd, $data, $case)
 Based on a class by Mukul Sabharwal [mukulsabharwal @ yahoo.com]. More...
 
 exists_auth_plugin ($auth)
 Returns whether a given authentication plugin exists. More...
 
 find_day_in_month ($startday, $weekday, $month, $year)
 
 fix_utf8 ($value)
 Makes sure the data is using valid utf8, invalid characters are discarded. More...
 
 force_current_language ($language)
 Force the current language to get strings and dates localised in the given language. More...
 
 format_float ($float, $decimalpoints=1, $localized=true, $stripzeros=false)
 Given a float, prints it nicely. More...
 
 format_time ($totalsecs, $str=null)
 
 fullclone ($thing)
 This function will make a complete copy of anything it's given, regardless of whether it's an object or not. More...
 
 fullname ($user, $override=false)
 Returns a persons full name. More...
 
 gc_cache_flags ()
 Garbage-collect volatile flags. More...
 
 generate_email_messageid ($localpart=null)
 Generate a unique email Message-ID using the moodle domain and install path. More...
 
 generate_email_processing_address ($modid, $modargs)
 Generate an email processing address. More...
 
 generate_email_signoff ()
 Generate a signoff for emails based on support settings. More...
 
 generate_password ($maxlen=10)
 Returns a randomly generated password of length $maxlen. More...
 
 get_all_user_name_fields ($returnsql=false, $tableprefix=null, $prefix=null, $fieldprefix=null, $order=false)
 A centralised location for the all name fields. More...
 
 get_auth_plugin ($auth)
 Returns an authentication plugin instance. More...
 
 get_cache_flag ($type, $name, $changedsince=null)
 Get volatile flags. More...
 
 get_cache_flags ($type, $changedsince=null)
 Get volatile flags. More...
 
 get_callable_name ($callable)
 Get human readable name describing the given callable. More...
 
 get_complete_user_data ($field, $value, $mnethostid=null, $throwexception=false)
 Get a complete user record, which includes all the info in the user record. More...
 
 get_config ($plugin, $name=null)
 Get configuration values from the global config table or the config_plugins table. More...
 
 get_course_display_name_for_list ($course)
 Gets the name of a course to be displayed when showing a list of courses. More...
 
 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. More...
 
 get_directory_size ($rootdir, $excludefile='')
 Adds up all the files in a directory and works out the size. More...
 
 get_emoticon_manager ()
 Factory function for emoticon_manager. More...
 
 get_enabled_auth_plugins ($fix=false)
 Returns array of active auth plugins. More...
 
 get_extra_user_fields ($context, $already=array())
 Checks if current user is shown any extra fields when listing users. More...
 
 get_extra_user_fields_sql ($context, $alias='', $prefix='', $already=array())
 If the current user is to be shown extra user fields when listing or selecting users, returns a string suitable for including in an SQL select clause to retrieve those fields. More...
 
 get_file_browser ()
 Returns local file storage instance. More...
 
 get_file_packer ($mimetype='application/zip')
 Returns file packer. More...
 
 get_file_storage ($reset=false)
 Returns local file storage instance. More...
 
 get_home_page ()
 Gets the homepage to use for the current user. More...
 
 get_host_from_url ($url)
 Returns host part from url. More...
 
 get_list_of_charsets ()
 Returns a list of charset codes. More...
 
 get_list_of_plugins ($directory='mod', $exclude='', $basedir='')
 Lists plugin-like directories within specified directory. More...
 
 get_list_of_themes ()
 Returns a list of valid and compatible themes. More...
 
 get_login_url ()
 Returns full login url. More...
 
 get_mailer ($action='get')
 Get mailer instance, enable buffering, flush buffer or disable buffering. More...
 
 get_max_upload_file_size ($sitebytes=0, $coursebytes=0, $modulebytes=0, $unused=false)
 Returns the maximum size for uploading files. More...
 
 get_max_upload_sizes ($sitebytes=0, $coursebytes=0, $modulebytes=0, $custombytes=null)
 Returns an array of possible sizes in local language. More...
 
 get_mnet_environment ()
 helper function to load up and initialise the mnet environment this must be called before you use mnet functions. More...
 
 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. More...
 
 get_parent_language ($lang=null)
 
 get_performance_info ()
 get_performance_info() pairs up with init_performance_info() loaded in setup.php. More...
 
 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. More...
 
 get_plugins_with_function ($function, $file='lib.php', $include=true)
 Get a list of all the plugins that define a certain API function in a certain file. More...
 
 get_site_identifier ()
 Returns the site identifier. More...
 
 get_string ($identifier, $component='', $a=null, $lazyload=false)
 
 get_string_manager ($forcereload=false)
 
 get_strings ($array, $component='')
 Converts an array of strings to their localized value. More...
 
 get_time_interval_string (int $time1, int $time2, string $format='')
 Get a formatted string representation of an interval between two unix timestamps. More...
 
 get_user_field_name ($field)
 Returns the display name of a field in the user table. More...
 
 get_user_fieldnames ()
 Returns an array of user fields. More...
 
 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). More...
 
 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. More...
 
 get_user_preferences ($name=null, $default=null, $user=null)
 
 get_user_timezone ($tz=99)
 
 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. More...
 
 getremoteaddr ($default='0.0.0.0')
 Returns most reliable client address. More...
 
 getweek ($startdate, $thedate)
 Given dates in seconds, how many weeks is the date from startdate The first week is 1, the second 2 etc ... More...
 
 guest_user ()
 Retrieve the guest user object. More...
 
 hash_internal_user_password ($password, $fasthash=false)
 Calculate hash for a plain text password. More...
 
 html_is_blank ($string)
 Tests whether anything was returned by text editor. More...
 
 in_object_vars ($var, $object)
 Checks whether the given variable name is defined as a variable within the given object. More...
 
 ip_is_public ($ip)
 Is IP address a public address? More...
 
 is_enabled_auth ($auth)
 Checks if a given plugin is in the list of enabled authentication plugins. More...
 
 is_internal_auth ($auth)
 Returns true if an internal authentication method is being used. More...
 
 is_mnet_remote_user ($user)
 Returns whether or not the user object is a remote MNET user. More...
 
 is_newnav ($navigation)
 Check if the passed navigation is of the new style. More...
 
 is_number ($value)
 Return true if given value is integer or string with integer value. More...
 
 is_primary_admin ($userid)
 Is a userid the primary administrator? More...
 
 is_proxybypass ( $url)
 Check if $url matches anything in proxybypass list. More...
 
 is_restored_user ($username)
 Returns true if the user is a 'restored' one. More...
 
 is_rtl_compatible ($paramtype)
 Whether the PARAM_* type is compatible in RTL. More...
 
 is_valid_plugin_name ($name)
 This method validates a plug name. More...
 
 ismoving ($courseid)
 Determines if the logged in user is currently moving an activity. More...
 
 make_grades_menu ($gradingtype)
 Creates an array that represents all the current grades that can be chosen using the given grading type. More...
 
 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. More...
 
 make_timestamp ($year, $month=1, $day=1, $hour=0, $minute=0, $second=0, $timezone=99, $applydst=true)
 
 make_unique_id_code ($extra='')
 make_unique_id_code More...
 
 microtime_diff ($a, $b)
 Calculate the difference between two microtimes. More...
 
 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 More...
 
 moodle_getlocale ()
 Gets the system locale. More...
 
 moodle_major_version ($fromdisk=false)
 Returns the major version of this site. More...
 
 moodle_needs_upgrading ()
 Determine if moodle installation requires update. More...
 
 moodle_process_email ($modargs, $body)
 ? More...
 
 moodle_setlocale ($locale='')
 
 mtrace ($string, $eol="\n", $sleep=0)
 For outputting debugging info. More...
 
 object_array_unique ($array, $keepkeyassoc=true)
 Returns an array without repeated objects. More...
 
 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. More...
 
 optional_param ($parname, $default, $type)
 Returns a particular value for the named variable, taken from POST or GET, otherwise returning a given default. More...
 
 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. More...
 
 order_in_string ($values, $stringformat)
 Returns an array of values in order of occurance in a provided string. More...
 
 over_bounce_threshold ($user)
 Check whether the user has exceeded the bounce threshold. More...
 
 partial ()
 Helper function to do partial function binding. More...
 
 password_is_legacy_hash ($password)
 Check a password hash to see if it was hashed using the legacy hash algorithm (md5). More...
 
 plugin_callback ($type, $name, $feature, $action, $params=null, $default=null)
 Invoke plugin's callback functions. More...
 
 plugin_supports ($type, $name, $feature, $default=null)
 Checks whether a plugin supports a specified feature. More...
 
 print_string ($identifier, $component='', $a=null)
 
 purge_all_caches ()
 Invalidates browser caches and cached data in temp. More...
 
 purge_caches ($options=[])
 Selectively invalidate different types of cache. More...
 
 purge_other_caches ()
 Purge all non-MUC caches not otherwise purged in purge_caches. More...
 
 random_bytes_emulate ($length)
 Try to generates cryptographically secure pseudo-random bytes. More...
 
 random_string ($length=15)
 Generate and return a random string of the specified length. More...
 
 rc4decrypt ($data)
 rc4decrypt More...
 
 rc4encrypt ($data)
 rc4encrypt More...
 
 remoteip_in_list ($list)
 Is the current ip in a given list? More...
 
 remove_course_contents ($courseid, $showfeedback=true, array $options=null)
 Clear a course out completely, deleting all content but don't delete the course itself. More...
 
 remove_dir ($dir, $contentonly=false)
 Delete directory or only its content. More...
 
 require_admin ()
 A convenience function for where we must be logged in as admin. More...
 
 require_course_login ($courseorid, $autologinguest=true, $cm=null, $setwantsurltome=true, $preventredirect=false)
 
 require_login ($courseorid=null, $autologinguest=true, $cm=null, $setwantsurltome=true, $preventredirect=false)
 
 require_logout ()
 
 require_user_key_login ($script, $instance=null, $keyvalue=null)
 Require key login. More...
 
 required_param ($parname, $type)
 Returns a particular value for the named variable, taken from POST or GET. More...
 
 required_param_array ($parname, $type)
 Returns a particular array value for the named variable, taken from POST or GET. More...
 
 reset_course_userdata ($data)
 This function will empty a course of user data. More...
 
 reset_password_and_mail ($user)
 Resets specified user's password and send the new password to the user via email. More...
 
 send_confirmation_email ($user, $confirmationurl=null)
 Send email to specified user with confirmation text and activation link. More...
 
 send_password_change_confirmation_email ($user, $resetrecord)
 Sends a password change confirmation email. More...
 
 send_password_change_info ($user)
 Sends an email containing information on how to change your password. More...
 
 set_bounce_count ($user, $reset=false)
 Increment or reset user's email bounce count. More...
 
 set_cache_flag ($type, $name, $value, $expiry=null)
 Set a volatile flag. More...
 
 set_config ($name, $value, $plugin=null)
 Set a key in global configuration. More...
 
 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 More...
 
 set_send_count ($user, $reset=false)
 Used to increment or reset email sent count. More...
 
 set_user_preference ($name, $value, $user=null)
 
 set_user_preferences (array $prefarray, $user=null)
 
 setnew_password_and_mail ($user, $fasthash=false)
 Sets specified user's password and send the new password to the user via email. More...
 
 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. More...
 
 shorten_filename ($filename, $length=MAX_FILENAME_SIZE, $includehash=false)
 Shortens a given filename by removing characters positioned after the ideal string length. More...
 
 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. More...
 
 shorten_text ($text, $ideal=30, $exact=false, $ending='...')
 
 site_is_public ()
 Tries to guess if $CFG->wwwroot is publicly accessible or not. More...
 
 swapshuffle ($array)
 Given a simple array, this shuffles it up just like shuffle() Unlike PHP's shuffle() this function works on any machine. More...
 
 swapshuffle_assoc ($array)
 Like swapshuffle(), but works on associative arrays. More...
 
 truncate_userinfo (array $info)
 Will truncate userinfo as it comes from auth_get_userinfo (from external auth) which may have large fields. More...
 
 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! More...
 
 unserialize_array ($expression)
 Safe analogue of unserialize() that can only parse arrays. More...
 
 unset_all_config_for_plugin ($plugin)
 Remove all the config variables for a given plugin. More...
 
 unset_cache_flag ($type, $name)
 Removes a single volatile flag. More...
 
 unset_config ($name, $plugin=null)
 Removes a key from global configuration. More...
 
 unset_user_preference ($name, $user=null)
 
 update_internal_user_password ($user, $password, $fasthash=false)
 Update password hash in user object (if necessary). More...
 
 update_user_login_times ()
 Modify the user table by setting the currently logged in user's last login to now. More...
 
 update_user_record ($username)
 Will update a local user record from an external source (MNET users can not be updated using this method!). More...
 
 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!). More...
 
 user_not_fully_set_up ($user, $strict=true)
 Determines if a user has completed setting up their account. More...
 
 userdate ($date, $format='', $timezone=99, $fixday=true, $fixhour=true)
 
 userdate_htmltime ($date, $format='', $timezone=99, $fixday=true, $fixhour=true)
 
 usergetdate ($time, $timezone=99)
 
 usergetmidnight ($date, $timezone=99)
 
 username_load_fields_from_object ($addtoobject, $secondobject, $prefix=null, $additionalfields=null)
 Reduces lines of duplicated code for getting user name fields. More...
 
 usertime ($date, $timezone=99)
 
 usertimezone ($timezone=99)
 
 valid_uploaded_file ($newfile)
 Returns current name of file on disk if it exists. More...
 
 validate_internal_user_password ($user, $password)
 Compare password against hash stored in user object to determine if it is valid. More...
 
 validate_param ($param, $type, $allownull=NULL_NOT_ALLOWED, $debuginfo='')
 Strict validation of parameter values, the values are only converted to requested PHP type. More...
 
 validate_user_key ($keyvalue, $script, $instance)
 Validates a user key, checking if the key exists, is not expired and the remote ip is correct. More...
 

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 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. More...
 
const EXTERNAL_TOKEN_PERMANENT 0
 Security token used for allowing access from external application such as web services. More...
 
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) More...
 
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_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_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 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 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. More...
 
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. More...
 
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 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 and letters only.
 
const PARAM_ALPHANUMEXT 'alphanumext'
 PARAM_ALPHANUMEXT - expected numbers, letters only and _-.
 
const PARAM_AREA 'area'
 PARAM_AREA is a name of area used when addressing files, comments, ratings, etc. More...
 
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'. More...
 
const PARAM_CLEAN 'clean'
 PARAM_CLEAN - obsoleted, please use a more specific type of parameter. More...
 
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. More...
 
const PARAM_COMPONENT 'component'
 PARAM_COMPONENT is used for full component names (aka frankenstyle) such as 'mod_forum', 'core_rating', 'auth_ldap'. More...
 
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. More...
 
const PARAM_FORMAT 'alphanumext'
 PARAM_FORMAT - deprecated alias for PARAM_ALPHANUMEXT, use for names of plugins, formats, etc. More...
 
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. More...
 
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. More...
 
const PARAM_LOCALURL 'localurl'
 PARAM_LOCALURL - expected properly formatted URL as well as one that refers to the local server itself. More...
 
const PARAM_MULTILANG 'text'
 PARAM_MULTILANG - deprecated alias of PARAM_TEXT. More...
 
const PARAM_NOTAGS 'notags'
 PARAM_NOTAGS - all html tags are stripped from the text. More...
 
const PARAM_NUMBER 'float'
 PARAM_NUMBER - deprecated alias of PARAM_FLOAT. More...
 
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'. More...
 
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, etc.
 
const PARAM_SEQUENCE 'sequence'
 PARAM_SEQUENCE - expects a sequence of numbers like 8 to 1,5,6,4,6,8,9. More...
 
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. More...
 
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. More...
 
const PARAM_URL 'url'
 PARAM_URL - expected properly formatted URL. More...
 
const PARAM_USERNAME 'username'
 PARAM_USERNAME - Clean username to only contains allowed characters. More...
 
const PASSWORD_DIGITS '0123456789'
 
const PASSWORD_LOWER 'abcdefghijklmnopqrstuvwxyz'
 
const PASSWORD_NONALPHANUM '.,;:!?_-+/*@#&$'
 
const PASSWORD_UPPER 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
const TAG_MAX_LENGTH 50
 To prevent problems with multibytes strings,Flag updating in nav not working on the review page. More...
 
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.
 

Detailed Description

moodlelib.php - Moodle main library

Main library file of miscellaneous general-purpose Moodle functions. Other main libraries:

@subpackage lib

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later